From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 15 00:46:29 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 C9563106566B; Sun, 15 Jan 2012 00:46:29 +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 A8F0B8FC13; Sun, 15 Jan 2012 00:46:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0F0kTT7055895; Sun, 15 Jan 2012 00:46:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0F0kTb3055892; Sun, 15 Jan 2012 00:46:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201150046.q0F0kTb3055892@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 15 Jan 2012 00:46: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: r230124 - in stable/9/sys: kern ufs/ufs 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, 15 Jan 2012 00:46:30 -0000 Author: kib Date: Sun Jan 15 00:46:29 2012 New Revision: 230124 URL: http://svn.freebsd.org/changeset/base/230124 Log: MFC r229828: Avoid LOR between vfs_busy() lock and covered vnode lock on quotaon(). Modified: stable/9/sys/kern/vfs_syscalls.c stable/9/sys/ufs/ufs/ufs_quota.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_syscalls.c ============================================================================== --- stable/9/sys/kern/vfs_syscalls.c Sun Jan 15 00:08:14 2012 (r230123) +++ stable/9/sys/kern/vfs_syscalls.c Sun Jan 15 00:46:29 2012 (r230124) @@ -86,6 +86,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + static MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information"); SDT_PROVIDER_DEFINE(vfs); @@ -212,7 +214,20 @@ sys_quotactl(td, uap) return (error); } error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg); - vfs_unbusy(mp); + + /* + * Since quota on operation typically needs to open quota + * file, the Q_QUOTAON handler needs to unbusy the mount point + * before calling into namei. Otherwise, unmount might be + * started between two vfs_busy() invocations (first is our, + * second is from mount point cross-walk code in lookup()), + * causing deadlock. + * + * Require that Q_QUOTAON handles the vfs_busy() reference on + * its own, always returning with ubusied mount point. + */ + if ((uap->cmd >> SUBCMDSHIFT) != Q_QUOTAON) + vfs_unbusy(mp); VFS_UNLOCK_GIANT(vfslocked); return (error); } Modified: stable/9/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/9/sys/ufs/ufs/ufs_quota.c Sun Jan 15 00:08:14 2012 (r230123) +++ stable/9/sys/ufs/ufs/ufs_quota.c Sun Jan 15 00:46:29 2012 (r230124) @@ -512,17 +512,29 @@ quotaon(struct thread *td, struct mount NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_USERSPACE, fname, td); flags = FREAD | FWRITE; + vfs_ref(mp); + vfs_unbusy(mp); error = vn_open(&nd, &flags, 0, NULL); - if (error) + if (error != 0) { + vfs_rel(mp); return (error); + } vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; - if (vp->v_type != VREG) { + error = vfs_busy(mp, MBF_NOWAIT); + vfs_rel(mp); + if (error == 0) { + if (vp->v_type != VREG) { + error = EACCES; + vfs_unbusy(mp); + } + } + if (error != 0) { VOP_UNLOCK(vp, 0); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); VFS_UNLOCK_GIANT(vfslocked); - return (EACCES); + return (error); } UFS_LOCK(ump); @@ -531,6 +543,7 @@ quotaon(struct thread *td, struct mount VOP_UNLOCK(vp, 0); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); VFS_UNLOCK_GIANT(vfslocked); + vfs_unbusy(mp); return (EALREADY); } ump->um_qflags[type] |= QTF_OPENING|QTF_CLOSING; @@ -542,6 +555,7 @@ quotaon(struct thread *td, struct mount UFS_UNLOCK(ump); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); VFS_UNLOCK_GIANT(vfslocked); + vfs_unbusy(mp); return (error); } VOP_UNLOCK(vp, 0); @@ -619,6 +633,7 @@ again: ("quotaon: leaking flags")); UFS_UNLOCK(ump); + vfs_unbusy(mp); return (error); } From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 15 07:48: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 3A7C8106564A; Sun, 15 Jan 2012 07:48:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 267188FC0C; Sun, 15 Jan 2012 07:48: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 q0F7mCSj069098; Sun, 15 Jan 2012 07:48:12 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0F7mCNw069096; Sun, 15 Jan 2012 07:48:12 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201150748.q0F7mCNw069096@svn.freebsd.org> From: Hiroki Sato Date: Sun, 15 Jan 2012 07:48: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: r230126 - stable/9/release/doc/en_US.ISO8859-1/errata 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, 15 Jan 2012 07:48:13 -0000 Author: hrs Date: Sun Jan 15 07:48:12 2012 New Revision: 230126 URL: http://svn.freebsd.org/changeset/base/230126 Log: Document ugen devctl event change. Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Sun Jan 15 07:09:18 2012 (r230125) +++ stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Sun Jan 15 07:48:12 2012 (r230126) @@ -242,6 +242,27 @@ boot /boot/loader.conf: debug.acpi.disabled="hostres" + + A &man.devctl.4; event upon arrival of a &man.ugen.4; device + has been changed. The event now includes + ugen and cdev variables + instead of device-name. This change can + prevent the following &man.devd.8; rule which worked in a + previous releases from working: + + attach 0 { + match "device-name" "ugen[0-9]+.[0-9]+"; + action "/path/to/script /dev/$device-name"; +} + + This should be updated to the following: + + attach 0 { + match "subsystem" "DEVICE"; + match "type" "ATTACH"; + match "cdev" "ugen[0-9]+.[0-9]+"; + action "/path/to/script /dev/$cdev"; +} From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 15 20:53: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 DF775106566B; Sun, 15 Jan 2012 20:53:50 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C96ED8FC17; Sun, 15 Jan 2012 20:53: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 q0FKroMS099657; Sun, 15 Jan 2012 20:53:50 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0FKroE0099655; Sun, 15 Jan 2012 20:53:50 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201152053.q0FKroE0099655@svn.freebsd.org> From: Eitan Adler Date: Sun, 15 Jan 2012 20:53: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: r230160 - 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: Sun, 15 Jan 2012 20:53:51 -0000 Author: eadler (ports committer) Date: Sun Jan 15 20:53:50 2012 New Revision: 230160 URL: http://svn.freebsd.org/changeset/base/230160 Log: MFC r228343: - Fix ktrace leakage if error is set PR: kern/163098 Approved by: sbruno Modified: stable/9/sys/kern/kern_ktrace.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_ktrace.c ============================================================================== --- stable/9/sys/kern/kern_ktrace.c Sun Jan 15 20:52:31 2012 (r230159) +++ stable/9/sys/kern/kern_ktrace.c Sun Jan 15 20:53:50 2012 (r230160) @@ -476,7 +476,7 @@ ktrsysret(code, error, retval) ktp = &req->ktr_data.ktr_sysret; ktp->ktr_code = code; ktp->ktr_error = error; - ktp->ktr_retval = retval; /* what about val2 ? */ + ktp->ktr_retval = ((error == 0) ? retval: 0); /* what about val2 ? */ ktr_submitrequest(curthread, req); } From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 15 21:48: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 727631065672; Sun, 15 Jan 2012 21:48:42 +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 5C8998FC08; Sun, 15 Jan 2012 21:48: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 q0FLmgYC001582; Sun, 15 Jan 2012 21:48:42 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0FLmgn6001580; Sun, 15 Jan 2012 21:48:42 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201201152148.q0FLmgn6001580@svn.freebsd.org> From: Andriy Gapon Date: Sun, 15 Jan 2012 21:48: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: r230163 - stable/9/sys/boot/zfs 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, 15 Jan 2012 21:48:42 -0000 Author: avg Date: Sun Jan 15 21:48:42 2012 New Revision: 230163 URL: http://svn.freebsd.org/changeset/base/230163 Log: MFC r228266: zfs boot: allow file vdevs to be used in testing (e.g. with zfsboottest) Modified: stable/9/sys/boot/zfs/zfsimpl.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) Modified: stable/9/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/9/sys/boot/zfs/zfsimpl.c Sun Jan 15 21:43:24 2012 (r230162) +++ stable/9/sys/boot/zfs/zfsimpl.c Sun Jan 15 21:48:42 2012 (r230163) @@ -458,6 +458,9 @@ vdev_init_from_nvlist(const unsigned cha if (strcmp(type, VDEV_TYPE_MIRROR) && strcmp(type, VDEV_TYPE_DISK) +#ifdef ZFS_TEST + && strcmp(type, VDEV_TYPE_FILE) +#endif && strcmp(type, VDEV_TYPE_RAIDZ) && strcmp(type, VDEV_TYPE_REPLACING)) { printf("ZFS: can only boot from disk, mirror, raidz1, raidz2 and raidz3 vdevs\n"); From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 15 21:51:56 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 F2EA01065673; Sun, 15 Jan 2012 21:51:55 +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 DDA828FC21; Sun, 15 Jan 2012 21:51: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 q0FLptg0001791; Sun, 15 Jan 2012 21:51:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0FLptmA001789; Sun, 15 Jan 2012 21:51:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201201152151.q0FLptmA001789@svn.freebsd.org> From: Andriy Gapon Date: Sun, 15 Jan 2012 21:51: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: r230165 - stable/9/sys/boot/i386/zfsboot 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, 15 Jan 2012 21:51:56 -0000 Author: avg Date: Sun Jan 15 21:51:55 2012 New Revision: 230165 URL: http://svn.freebsd.org/changeset/base/230165 Log: MFC r228267: zfsboot: print boot.config contents before parsing it Modified: stable/9/sys/boot/i386/zfsboot/zfsboot.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) Modified: stable/9/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- stable/9/sys/boot/i386/zfsboot/zfsboot.c Sun Jan 15 21:50:17 2012 (r230164) +++ stable/9/sys/boot/i386/zfsboot/zfsboot.c Sun Jan 15 21:51:55 2012 (r230165) @@ -539,10 +539,10 @@ main(void) } if (*cmd) { - if (parse()) - autoboot = 0; if (!OPT_CHECK(RBX_QUIET)) printf("%s: %s", PATH_CONFIG, cmd); + if (parse()) + autoboot = 0; /* Do not process this command twice */ *cmd = 0; } From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 15 21:58: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 EA4B6106564A; Sun, 15 Jan 2012 21:58:51 +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 C93DE8FC13; Sun, 15 Jan 2012 21:58:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0FLwp57002118; Sun, 15 Jan 2012 21:58:51 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0FLwpII002112; Sun, 15 Jan 2012 21:58:51 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201201152158.q0FLwpII002112@svn.freebsd.org> From: Andriy Gapon Date: Sun, 15 Jan 2012 21:58:51 +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: r230167 - in stable/9/sys: kern security/mac 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, 15 Jan 2012 21:58:52 -0000 Author: avg Date: Sun Jan 15 21:58:51 2012 New Revision: 230167 URL: http://svn.freebsd.org/changeset/base/230167 Log: MFC r228430,228433: put sys/systm.h at its proper place or add it if missing Modified: stable/9/sys/kern/kern_racct.c stable/9/sys/kern/kern_sx.c stable/9/sys/kern/vfs_cache.c stable/9/sys/security/mac/mac_framework.c stable/9/sys/security/mac/mac_priv.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) Modified: stable/9/sys/kern/kern_racct.c ============================================================================== --- stable/9/sys/kern/kern_racct.c Sun Jan 15 21:52:45 2012 (r230166) +++ stable/9/sys/kern/kern_racct.c Sun Jan 15 21:58:51 2012 (r230167) @@ -35,8 +35,8 @@ __FBSDID("$FreeBSD$"); #include "opt_kdtrace.h" #include +#include #include -#include #include #include #include @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #ifdef RCTL Modified: stable/9/sys/kern/kern_sx.c ============================================================================== --- stable/9/sys/kern/kern_sx.c Sun Jan 15 21:52:45 2012 (r230166) +++ stable/9/sys/kern/kern_sx.c Sun Jan 15 21:58:51 2012 (r230167) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -51,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #if defined(SMP) && !defined(NO_ADAPTIVE_SX) #include Modified: stable/9/sys/kern/vfs_cache.c ============================================================================== --- stable/9/sys/kern/vfs_cache.c Sun Jan 15 21:52:45 2012 (r230166) +++ stable/9/sys/kern/vfs_cache.c Sun Jan 15 21:58:51 2012 (r230167) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ktrace.h" #include +#include #include #include #include @@ -52,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #ifdef KTRACE #include Modified: stable/9/sys/security/mac/mac_framework.c ============================================================================== --- stable/9/sys/security/mac/mac_framework.c Sun Jan 15 21:52:45 2012 (r230166) +++ stable/9/sys/security/mac/mac_framework.c Sun Jan 15 21:58:51 2012 (r230167) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -81,7 +82,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/9/sys/security/mac/mac_priv.c ============================================================================== --- stable/9/sys/security/mac/mac_priv.c Sun Jan 15 21:52:45 2012 (r230166) +++ stable/9/sys/security/mac/mac_priv.c Sun Jan 15 21:58:51 2012 (r230167) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include "opt_mac.h" #include +#include #include #include #include From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 15 22:04: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 89ED1106564A; Sun, 15 Jan 2012 22:04:28 +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 5AF488FC18; Sun, 15 Jan 2012 22:04: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 q0FM4SwI002416; Sun, 15 Jan 2012 22:04:28 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0FM4SEu002413; Sun, 15 Jan 2012 22:04:28 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201201152204.q0FM4SEu002413@svn.freebsd.org> From: Andriy Gapon Date: Sun, 15 Jan 2012 22:04:28 +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: r230169 - stable/9/sys/dev/syscons 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, 15 Jan 2012 22:04:28 -0000 Author: avg Date: Sun Jan 15 22:04:28 2012 New Revision: 230169 URL: http://svn.freebsd.org/changeset/base/230169 Log: MFC r228426: syscons: make sc_puts static as it is used only privately Modified: stable/9/sys/dev/syscons/syscons.c stable/9/sys/dev/syscons/syscons.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) Modified: stable/9/sys/dev/syscons/syscons.c ============================================================================== --- stable/9/sys/dev/syscons/syscons.c Sun Jan 15 22:02:35 2012 (r230168) +++ stable/9/sys/dev/syscons/syscons.c Sun Jan 15 22:04:28 2012 (r230169) @@ -185,6 +185,7 @@ static void scshutdown(void *, int); static void scsuspend(void *); static void scresume(void *); static u_int scgetc(sc_softc_t *sc, u_int flags); +static void sc_puts(scr_stat *scp, u_char *buf, int len, int kernel); #define SCGETC_CN 1 #define SCGETC_NONBLOCK 2 static void sccnupdate(scr_stat *scp); @@ -2603,7 +2604,7 @@ exchange_scr(sc_softc_t *sc) mark_all(scp); } -void +static void sc_puts(scr_stat *scp, u_char *buf, int len, int kernel) { int need_unlock = 0; Modified: stable/9/sys/dev/syscons/syscons.h ============================================================================== --- stable/9/sys/dev/syscons/syscons.h Sun Jan 15 22:02:35 2012 (r230168) +++ stable/9/sys/dev/syscons/syscons.h Sun Jan 15 22:04:28 2012 (r230169) @@ -562,7 +562,6 @@ void sc_save_font(scr_stat *scp, int pa void sc_show_font(scr_stat *scp, int page); void sc_touch_scrn_saver(void); -void sc_puts(scr_stat *scp, u_char *buf, int len, int kernel); void sc_draw_cursor_image(scr_stat *scp); void sc_remove_cursor_image(scr_stat *scp); void sc_set_cursor_image(scr_stat *scp); From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 15 22:07: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 0A2341065670; Sun, 15 Jan 2012 22:07:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CDF938FC15; Sun, 15 Jan 2012 22:07: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 q0FM7E42002602; Sun, 15 Jan 2012 22:07:14 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0FM7ECZ002600; Sun, 15 Jan 2012 22:07:14 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201201152207.q0FM7ECZ002600@svn.freebsd.org> From: Andriy Gapon Date: Sun, 15 Jan 2012 22:07: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: r230171 - stable/9/sys/cddl/compat/opensolaris/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: Sun, 15 Jan 2012 22:07:15 -0000 Author: avg Date: Sun Jan 15 22:07:14 2012 New Revision: 230171 URL: http://svn.freebsd.org/changeset/base/230171 Log: MFC r228710: opensolaris compat: fix vcmn_err so that panic(9) produces a proper message Modified: stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.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) Modified: stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c Sun Jan 15 22:05:15 2012 (r230170) +++ stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c Sun Jan 15 22:07:14 2012 (r230171) @@ -28,29 +28,35 @@ void vcmn_err(int ce, const char *fmt, va_list adx) { char buf[256]; + const char *prefix; + prefix = NULL; /* silence unwitty compilers */ switch (ce) { case CE_CONT: - snprintf(buf, sizeof(buf), "Solaris(cont): %s\n", fmt); + prefix = "Solaris(cont): "; break; case CE_NOTE: - snprintf(buf, sizeof(buf), "Solaris: NOTICE: %s\n", fmt); + prefix = "Solaris: NOTICE: "; break; case CE_WARN: - snprintf(buf, sizeof(buf), "Solaris: WARNING: %s\n", fmt); + prefix = "Solaris: WARNING: "; break; case CE_PANIC: - snprintf(buf, sizeof(buf), "Solaris(panic): %s\n", fmt); + prefix = "Solaris(panic): "; break; case CE_IGNORE: break; default: panic("Solaris: unknown severity level"); } - if (ce == CE_PANIC) - panic("%s", buf); - if (ce != CE_IGNORE) - vprintf(buf, adx); + if (ce == CE_PANIC) { + vsnprintf(buf, sizeof(buf), fmt, adx); + panic("%s%s", prefix, buf); + } + if (ce != CE_IGNORE) { + printf("%s", prefix); + vprintf(fmt, adx); + } } void From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 15 22:10:35 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 B7A881065670; Sun, 15 Jan 2012 22:10:35 +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 87BED8FC0C; Sun, 15 Jan 2012 22: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 q0FMAZXO002810; Sun, 15 Jan 2012 22:10:35 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0FMAZDw002808; Sun, 15 Jan 2012 22:10:35 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201201152210.q0FMAZDw002808@svn.freebsd.org> From: Andriy Gapon Date: Sun, 15 Jan 2012 22: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: r230173 - 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: Sun, 15 Jan 2012 22:10:35 -0000 Author: avg Date: Sun Jan 15 22:10:35 2012 New Revision: 230173 URL: http://svn.freebsd.org/changeset/base/230173 Log: MFC r228718: ule: ensure that batch timeshare threads are scheduled fairly Modified: stable/9/sys/kern/sched_ule.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) Modified: stable/9/sys/kern/sched_ule.c ============================================================================== --- stable/9/sys/kern/sched_ule.c Sun Jan 15 22:08:44 2012 (r230172) +++ stable/9/sys/kern/sched_ule.c Sun Jan 15 22:10:35 2012 (r230173) @@ -125,6 +125,7 @@ static struct td_sched td_sched0; */ #define PRI_TIMESHARE_RANGE (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE + 1) #define PRI_INTERACT_RANGE ((PRI_TIMESHARE_RANGE - SCHED_PRI_NRESV) / 2) +#define PRI_BATCH_RANGE (PRI_TIMESHARE_RANGE - PRI_INTERACT_RANGE) #define PRI_MIN_INTERACT PRI_MIN_TIMESHARE #define PRI_MAX_INTERACT (PRI_MIN_TIMESHARE + PRI_INTERACT_RANGE - 1) @@ -416,7 +417,6 @@ sched_shouldpreempt(int pri, int cpri, i return (0); } -#define TS_RQ_PPQ (((PRI_MAX_BATCH - PRI_MIN_BATCH) + 1) / RQ_NQS) /* * Add a thread to the actual run-queue. Keeps transferable counts up to * date with what is actually on the run-queue. Selects the correct @@ -449,7 +449,7 @@ tdq_runq_add(struct tdq *tdq, struct thr * realtime. Use the whole queue to represent these values. */ if ((flags & (SRQ_BORROWING|SRQ_PREEMPTED)) == 0) { - pri = (pri - PRI_MIN_BATCH) / TS_RQ_PPQ; + pri = RQ_NQS * (pri - PRI_MIN_BATCH) / PRI_BATCH_RANGE; pri = (pri + tdq->tdq_idx) % RQ_NQS; /* * This effectively shortens the queue by one so we From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 15 22:20: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 8FD9B106566C; Sun, 15 Jan 2012 22:20:52 +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 7AD118FC0C; Sun, 15 Jan 2012 22:20: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 q0FMKqQ1003286; Sun, 15 Jan 2012 22:20:52 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0FMKquN003284; Sun, 15 Jan 2012 22:20:52 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201201152220.q0FMKquN003284@svn.freebsd.org> From: Andriy Gapon Date: Sun, 15 Jan 2012 22:20: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: r230175 - 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: Sun, 15 Jan 2012 22:20:52 -0000 Author: avg Date: Sun Jan 15 22:20:52 2012 New Revision: 230175 URL: http://svn.freebsd.org/changeset/base/230175 Log: MFC r228265: critical_exit: ignore td_owepreempt if kdb_active is set Modified: stable/9/sys/kern/kern_switch.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) Modified: stable/9/sys/kern/kern_switch.c ============================================================================== --- stable/9/sys/kern/kern_switch.c Sun Jan 15 22:18:54 2012 (r230174) +++ stable/9/sys/kern/kern_switch.c Sun Jan 15 22:20:52 2012 (r230175) @@ -200,7 +200,7 @@ critical_exit(void) if (td->td_critnest == 1) { td->td_critnest = 0; - if (td->td_owepreempt) { + if (td->td_owepreempt && !kdb_active) { td->td_critnest = 1; thread_lock(td); td->td_critnest--; From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 04:00:33 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 79DA8106566C; Mon, 16 Jan 2012 04:00:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63BDD8FC0A; Mon, 16 Jan 2012 04:00: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 q0G40XEN014353; Mon, 16 Jan 2012 04:00:33 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0G40Xmw014349; Mon, 16 Jan 2012 04:00:33 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201160400.q0G40Xmw014349@svn.freebsd.org> From: Eitan Adler Date: Mon, 16 Jan 2012 04:00: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: r230187 - stable/9/usr.sbin 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, 16 Jan 2012 04:00:33 -0000 Author: eadler (ports committer) Date: Mon Jan 16 04:00:32 2012 New Revision: 230187 URL: http://svn.freebsd.org/changeset/base/230187 Log: - Listen to WITHOUT_SYSINSTALL PR: bin/164185 Submitted by: Pierre Guinoiseau Reviewed by: imp Approved by: cperciva MFC After 3 days Modified: stable/9/usr.sbin/Makefile Modified: stable/9/usr.sbin/Makefile ============================================================================== --- stable/9/usr.sbin/Makefile Mon Jan 16 03:42:40 2012 (r230186) +++ stable/9/usr.sbin/Makefile Mon Jan 16 04:00:32 2012 (r230187) @@ -290,7 +290,9 @@ SUBDIR+= praliases SUBDIR+= sendmail .endif +.if ${MK_SYSINSTALL} != "no" SUBDIR+= sysinstall +.endif .if ${MK_TOOLCHAIN} != "no" SUBDIR+= config From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 04:44: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 D2950106566C; Mon, 16 Jan 2012 04:44:19 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1F3138FC12; Mon, 16 Jan 2012 04:44:18 +0000 (UTC) Received: by lahd3 with SMTP id d3so1869216lah.13 for ; Sun, 15 Jan 2012 20:44:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :content-transfer-encoding; bh=dbapPD0MXqwp/x9g2squ99gTQmz0kVWzLO7fzD/MWC8=; b=U1silHYXJdS+uS9N6v4ZGoPCRwPT/sH8lzgQcRQ1PeCY2sGq+4iKELCGCYz8fE0zpb m9h1yDnyQhmMfCFVx3isAgBDFqUdXMhpQc4E6RHuYyp+oINgBHeW0Fi8CiJ+F0uASWcq yfB6eERRQaERKU1xAHeV4H15uZulQEt+v4G0o= Received: by 10.152.144.133 with SMTP id sm5mr5096049lab.38.1326687316121; Sun, 15 Jan 2012 20:15:16 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.18.227 with HTTP; Sun, 15 Jan 2012 20:14:45 -0800 (PST) In-Reply-To: <201201160400.q0G40Xmw014349@svn.freebsd.org> References: <201201160400.q0G40Xmw014349@svn.freebsd.org> From: Eitan Adler Date: Sun, 15 Jan 2012 23:14:45 -0500 X-Google-Sender-Auth: MYqzLDOrFvNdLszKUQdT1Un9W3U Message-ID: To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r230187 - stable/9/usr.sbin 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, 16 Jan 2012 04:44:19 -0000 On Sun, Jan 15, 2012 at 11:00 PM, Eitan Adler wrote: > Author: eadler (ports committer) > Date: Mon Jan 16 04:00:32 2012 > New Revision: 230187 > URL: http://svn.freebsd.org/changeset/base/230187 > > Log: > =C2=A0- Listen to WITHOUT_SYSINSTALL I should have added to the commit log: Direct commit to stable because sysinstall does not exist on HEAD --=20 Eitan Adler Ports committer X11, Bugbusting teams From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 05:15: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 C7B7A1065673; Mon, 16 Jan 2012 05:15:13 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B23C08FC14; Mon, 16 Jan 2012 05:15: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 q0G5FDix017027; Mon, 16 Jan 2012 05:15:13 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0G5FDPx017016; Mon, 16 Jan 2012 05:15:13 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201160515.q0G5FDPx017016@svn.freebsd.org> From: Kevin Lo Date: Mon, 16 Jan 2012 05:15: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: r230196 - in stable/9: lib/libkiconv sys/conf sys/fs/msdosfs sys/fs/smbfs sys/kern sys/libkern sys/modules/libiconv sys/modules/libmchain sys/netsmb 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: Mon, 16 Jan 2012 05:15:13 -0000 Author: kevlo Date: Mon Jan 16 05:15:13 2012 New Revision: 230196 URL: http://svn.freebsd.org/changeset/base/230196 Log: MFC r228796: Discarding local array based on return values. MFC r227650: Add unicode support to msdosfs and smbfs; original pathes from imura, bug fixes by Kuan-Chung Chiu . Added: stable/9/sys/libkern/iconv_ucs.c (contents, props changed) Modified: stable/9/lib/libkiconv/xlat16_iconv.c stable/9/sys/conf/files stable/9/sys/fs/msdosfs/msdosfs_conv.c stable/9/sys/fs/smbfs/smbfs_smb.c stable/9/sys/fs/smbfs/smbfs_subr.c stable/9/sys/kern/subr_mchain.c stable/9/sys/libkern/iconv.c stable/9/sys/modules/libiconv/Makefile stable/9/sys/modules/libmchain/Makefile stable/9/sys/netsmb/smb_conn.c stable/9/sys/netsmb/smb_conn.h stable/9/sys/netsmb/smb_smb.c stable/9/sys/netsmb/smb_subr.c stable/9/sys/sys/iconv.h stable/9/sys/sys/mchain.h Modified: stable/9/lib/libkiconv/xlat16_iconv.c ============================================================================== --- stable/9/lib/libkiconv/xlat16_iconv.c Mon Jan 16 05:07:32 2012 (r230195) +++ stable/9/lib/libkiconv/xlat16_iconv.c Mon Jan 16 05:15:13 2012 (r230196) @@ -74,6 +74,18 @@ kiconv_add_xlat16_cspair(const char *toc struct xlat16_table xt; void *data; char *p; + const char unicode[] = ENCODING_UNICODE; + + if ((flag & KICONV_WCTYPE) == 0 && + strcmp(unicode, tocode) != 0 && + strcmp(unicode, fromcode) != 0 && + kiconv_lookupconv(unicode) == 0) { + error = kiconv_add_xlat16_cspair(unicode, fromcode, flag); + if (error) + return (-1); + error = kiconv_add_xlat16_cspair(tocode, unicode, flag); + return (error); + } if (kiconv_lookupcs(tocode, fromcode) == 0) return (0); Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Mon Jan 16 05:07:32 2012 (r230195) +++ stable/9/sys/conf/files Mon Jan 16 05:15:13 2012 (r230196) @@ -2540,6 +2540,7 @@ libkern/fnmatch.c standard libkern/gets.c standard libkern/iconv.c optional libiconv libkern/iconv_converter_if.m optional libiconv +libkern/iconv_ucs.c optional libiconv libkern/iconv_xlat.c optional libiconv libkern/iconv_xlat16.c optional libiconv libkern/index.c standard Modified: stable/9/sys/fs/msdosfs/msdosfs_conv.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_conv.c Mon Jan 16 05:07:32 2012 (r230195) +++ stable/9/sys/fs/msdosfs/msdosfs_conv.c Mon Jan 16 05:15:13 2012 (r230196) @@ -61,9 +61,9 @@ extern struct iconv_functions *msdosfs_iconv; static int mbsadjpos(const char **, size_t, size_t, int, int, void *handle); -static u_int16_t dos2unixchr(const u_char **, size_t *, int, struct msdosfsmount *); +static u_char * dos2unixchr(u_char *, const u_char **, size_t *, int, struct msdosfsmount *); static u_int16_t unix2doschr(const u_char **, size_t *, struct msdosfsmount *); -static u_int16_t win2unixchr(u_int16_t, struct msdosfsmount *); +static u_char * win2unixchr(u_char *, u_int16_t, struct msdosfsmount *); static u_int16_t unix2winchr(const u_char **, size_t *, int, struct msdosfsmount *); /* @@ -242,7 +242,7 @@ dos2unixfn(dn, un, lower, pmp) { size_t i; int thislong = 0; - u_int16_t c; + u_char *c, tmpbuf[5]; /* * If first char of the filename is SLOT_E5 (0x05), then the real @@ -257,14 +257,12 @@ dos2unixfn(dn, un, lower, pmp) * Copy the name portion into the unix filename string. */ for (i = 8; i > 0 && *dn != ' ';) { - c = dos2unixchr((const u_char **)&dn, &i, lower & LCASE_BASE, - pmp); - if (c & 0xff00) { - *un++ = c >> 8; + c = dos2unixchr(tmpbuf, (const u_char **)&dn, &i, + lower & LCASE_BASE, pmp); + while (*c != '\0') { + *un++ = *c++; thislong++; } - *un++ = c; - thislong++; } dn += i; @@ -276,14 +274,12 @@ dos2unixfn(dn, un, lower, pmp) *un++ = '.'; thislong++; for (i = 3; i > 0 && *dn != ' ';) { - c = dos2unixchr((const u_char **)&dn, &i, + c = dos2unixchr(tmpbuf, (const u_char **)&dn, &i, lower & LCASE_EXT, pmp); - if (c & 0xff00) { - *un++ = c >> 8; + while (*c != '\0') { + *un++ = *c++; thislong++; } - *un++ = c; - thislong++; } } *un++ = 0; @@ -652,8 +648,9 @@ win2unixfn(nbp, wep, chksum, pmp) int chksum; struct msdosfsmount *pmp; { + u_char *c, tmpbuf[5]; u_int8_t *cp; - u_int8_t *np, name[WIN_CHARS * 2 + 1]; + u_int8_t *np, name[WIN_CHARS * 3 + 1]; u_int16_t code; int i; @@ -686,10 +683,9 @@ win2unixfn(nbp, wep, chksum, pmp) *np = '\0'; return -1; default: - code = win2unixchr(code, pmp); - if (code & 0xff00) - *np++ = code >> 8; - *np++ = code; + c = win2unixchr(tmpbuf, code, pmp); + while (*c != '\0') + *np++ = *c++; break; } cp += 2; @@ -705,10 +701,9 @@ win2unixfn(nbp, wep, chksum, pmp) *np = '\0'; return -1; default: - code = win2unixchr(code, pmp); - if (code & 0xff00) - *np++ = code >> 8; - *np++ = code; + c = win2unixchr(tmpbuf, code, pmp); + while (*c != '\0') + *np++ = *c++; break; } cp += 2; @@ -724,10 +719,9 @@ win2unixfn(nbp, wep, chksum, pmp) *np = '\0'; return -1; default: - code = win2unixchr(code, pmp); - if (code & 0xff00) - *np++ = code >> 8; - *np++ = code; + c = win2unixchr(tmpbuf, code, pmp); + while (*c != '\0') + *np++ = *c++; break; } cp += 2; @@ -817,24 +811,22 @@ mbsadjpos(const char **instr, size_t inl /* * Convert DOS char to Local char */ -static u_int16_t -dos2unixchr(const u_char **instr, size_t *ilen, int lower, struct msdosfsmount *pmp) +static u_char * +dos2unixchr(u_char *outbuf, const u_char **instr, size_t *ilen, int lower, struct msdosfsmount *pmp) { - u_char c; - char *outp, outbuf[3]; - u_int16_t wc; + u_char c, *outp; size_t len, olen; + outp = outbuf; if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) { - olen = len = 2; - outp = outbuf; + olen = len = 4; if (lower & (LCASE_BASE | LCASE_EXT)) msdosfs_iconv->convchr_case(pmp->pm_d2u, (const char **)instr, - ilen, &outp, &olen, KICONV_LOWER); + ilen, (char **)&outp, &olen, KICONV_LOWER); else msdosfs_iconv->convchr(pmp->pm_d2u, (const char **)instr, - ilen, &outp, &olen); + ilen, (char **)&outp, &olen); len -= olen; /* @@ -843,21 +835,21 @@ dos2unixchr(const u_char **instr, size_t if (len == 0) { (*ilen)--; (*instr)++; - return ('?'); + *outp++ = '?'; } - - wc = 0; - while(len--) - wc |= (*(outp - len - 1) & 0xff) << (len << 3); - return (wc); + } else { + (*ilen)--; + c = *(*instr)++; + c = dos2unix[c]; + if (lower & (LCASE_BASE | LCASE_EXT)) + c = u2l[c]; + *outp++ = c; + outbuf[1] = '\0'; } - (*ilen)--; - c = *(*instr)++; - c = dos2unix[c]; - if (lower & (LCASE_BASE | LCASE_EXT)) - c = u2l[c]; - return ((u_int16_t)c); + *outp = '\0'; + outp = outbuf; + return (outp); } /* @@ -940,23 +932,21 @@ unix2doschr(const u_char **instr, size_t /* * Convert Windows char to Local char */ -static u_int16_t -win2unixchr(u_int16_t wc, struct msdosfsmount *pmp) +static u_char * +win2unixchr(u_char *outbuf, u_int16_t wc, struct msdosfsmount *pmp) { - u_char *inp, *outp, inbuf[3], outbuf[3]; + u_char *inp, *outp, inbuf[3]; size_t ilen, olen, len; - if (wc == 0) - return (0); - + outp = outbuf; if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) { inbuf[0] = (u_char)(wc>>8); inbuf[1] = (u_char)wc; inbuf[2] = '\0'; - ilen = olen = len = 2; + ilen = 2; + olen = len = 4; inp = inbuf; - outp = outbuf; msdosfs_iconv->convchr(pmp->pm_w2u, (const char **)&inp, &ilen, (char **)&outp, &olen); len -= olen; @@ -964,21 +954,15 @@ win2unixchr(u_int16_t wc, struct msdosfs /* * return '?' if failed to convert */ - if (len == 0) { - wc = '?'; - return (wc); - } - - wc = 0; - while(len--) - wc |= (*(outp - len - 1) & 0xff) << (len << 3); - return (wc); + if (len == 0) + *outp++ = '?'; + } else { + *outp++ = (wc & 0xff00) ? '?' : (u_char)(wc & 0xff); } - if (wc & 0xff00) - wc = '?'; - - return (wc); + *outp = '\0'; + outp = outbuf; + return (outp); } /* Modified: stable/9/sys/fs/smbfs/smbfs_smb.c ============================================================================== --- stable/9/sys/fs/smbfs/smbfs_smb.c Mon Jan 16 05:07:32 2012 (r230195) +++ stable/9/sys/fs/smbfs/smbfs_smb.c Mon Jan 16 05:15:13 2012 (r230196) @@ -34,6 +34,7 @@ #include #include #include +#include #ifdef USE_MD5_HASH #include @@ -393,6 +394,10 @@ smbfs_smb_setpattr(struct smbnode *np, u if (error) break; mb_put_uint8(mbp, SMB_DT_ASCII); + if (SMB_UNICODE_STRINGS(SSTOVC(ssp))) { + mb_put_padbyte(mbp); + mb_put_uint8(mbp, 0); /* 1st byte of NULL Unicode char */ + } mb_put_uint8(mbp, 0); smb_rq_bend(rqp); error = smb_rq_simple(rqp); @@ -909,6 +914,10 @@ smbfs_smb_search(struct smbfs_fctx *ctx) mb_put_uint16le(mbp, 0); /* context length */ ctx->f_flags &= ~SMBFS_RDD_FINDFIRST; } else { + if (SMB_UNICODE_STRINGS(vcp)) { + mb_put_padbyte(mbp); + mb_put_uint8(mbp, 0); + } mb_put_uint8(mbp, 0); /* file name length */ mb_put_uint8(mbp, SMB_DT_VARIABLE); mb_put_uint16le(mbp, SMB_SKEYLEN); @@ -1069,7 +1078,7 @@ smbfs_smb_trans2find2(struct smbfs_fctx mb_put_uint32le(mbp, 0); /* resume key */ mb_put_uint16le(mbp, flags); if (ctx->f_rname) - mb_put_mem(mbp, ctx->f_rname, strlen(ctx->f_rname) + 1, MB_MSYSTEM); + mb_put_mem(mbp, ctx->f_rname, ctx->f_rnamelen + 1, MB_MSYSTEM); else mb_put_uint8(mbp, 0); /* resume file name */ #if 0 @@ -1152,7 +1161,10 @@ static int smbfs_findopenLM2(struct smbfs_fctx *ctx, struct smbnode *dnp, const char *wildcard, int wclen, int attr, struct smb_cred *scred) { - ctx->f_name = malloc(SMB_MAXFNAMELEN, M_SMBFSDATA, M_WAITOK); + if (SMB_UNICODE_STRINGS(SSTOVC(ctx->f_ssp))) { + ctx->f_name = malloc(SMB_MAXFNAMELEN * 2, M_SMBFSDATA, M_WAITOK); + } else + ctx->f_name = malloc(SMB_MAXFNAMELEN, M_SMBFSDATA, M_WAITOK); if (ctx->f_name == NULL) return ENOMEM; ctx->f_infolevel = SMB_DIALECT(SSTOVC(ctx->f_ssp)) < SMB_DIALECT_NTLM0_12 ? @@ -1231,7 +1243,10 @@ smbfs_findnextLM2(struct smbfs_fctx *ctx SMBERROR("unexpected info level %d\n", ctx->f_infolevel); return EINVAL; } - nmlen = min(size, SMB_MAXFNAMELEN); + if (SMB_UNICODE_STRINGS(SSTOVC(ctx->f_ssp))) { + nmlen = min(size, SMB_MAXFNAMELEN * 2); + } else + nmlen = min(size, SMB_MAXFNAMELEN); cp = ctx->f_name; error = md_get_mem(mbp, cp, nmlen, MB_MSYSTEM); if (error) @@ -1245,8 +1260,12 @@ smbfs_findnextLM2(struct smbfs_fctx *ctx return EBADRPC; } } - if (nmlen && cp[nmlen - 1] == 0) - nmlen--; + if (SMB_UNICODE_STRINGS(SSTOVC(ctx->f_ssp))) { + if (nmlen > 1 && cp[nmlen - 1] == 0 && cp[nmlen - 2] == 0) + nmlen -= 2; + } else + if (nmlen && cp[nmlen - 1] == 0) + nmlen--; if (nmlen == 0) return EBADRPC; @@ -1330,10 +1349,17 @@ smbfs_findnext(struct smbfs_fctx *ctx, i error = smbfs_findnextLM2(ctx, limit); if (error) return error; - if ((ctx->f_nmlen == 1 && ctx->f_name[0] == '.') || - (ctx->f_nmlen == 2 && ctx->f_name[0] == '.' && - ctx->f_name[1] == '.')) - continue; + if (SMB_UNICODE_STRINGS(SSTOVC(ctx->f_ssp))) { + if ((ctx->f_nmlen == 2 && + *(u_int16_t *)ctx->f_name == htole16(0x002e)) || + (ctx->f_nmlen == 4 && + *(u_int32_t *)ctx->f_name == htole32(0x002e002e))) + continue; + } else + if ((ctx->f_nmlen == 1 && ctx->f_name[0] == '.') || + (ctx->f_nmlen == 2 && ctx->f_name[0] == '.' && + ctx->f_name[1] == '.')) + continue; break; } smbfs_fname_tolocal(SSTOVC(ctx->f_ssp), ctx->f_name, &ctx->f_nmlen, Modified: stable/9/sys/fs/smbfs/smbfs_subr.c ============================================================================== --- stable/9/sys/fs/smbfs/smbfs_subr.c Mon Jan 16 05:07:32 2012 (r230195) +++ stable/9/sys/fs/smbfs/smbfs_subr.c Mon Jan 16 05:15:13 2012 (r230196) @@ -130,7 +130,10 @@ smb_fphelp(struct mbchain *mbp, struct s return smb_put_dmem(mbp, vcp, "\\", 2, caseopt);*/ while (i--) { np = *--npp; - error = mb_put_uint8(mbp, '\\'); + if (SMB_UNICODE_STRINGS(vcp)) + error = mb_put_uint16le(mbp, '\\'); + else + error = mb_put_uint8(mbp, '\\'); if (error) break; error = smb_put_dmem(mbp, vcp, np->n_name, np->n_nmlen, caseopt); @@ -148,6 +151,11 @@ smbfs_fullpath(struct mbchain *mbp, stru int caseopt = SMB_CS_NONE; int error; + if (SMB_UNICODE_STRINGS(vcp)) { + error = mb_put_padbyte(mbp); + if (error) + return error; + } if (SMB_DIALECT(vcp) < SMB_DIALECT_LANMAN1_0) caseopt |= SMB_CS_UPPER; if (dnp != NULL) { @@ -156,7 +164,10 @@ smbfs_fullpath(struct mbchain *mbp, stru return error; } if (name) { - error = mb_put_uint8(mbp, '\\'); + if (SMB_UNICODE_STRINGS(vcp)) + error = mb_put_uint16le(mbp, '\\'); + else + error = mb_put_uint8(mbp, '\\'); if (error) return error; error = smb_put_dmem(mbp, vcp, name, nmlen, caseopt); @@ -164,6 +175,8 @@ smbfs_fullpath(struct mbchain *mbp, stru return error; } error = mb_put_uint8(mbp, 0); + if (SMB_UNICODE_STRINGS(vcp) && error == 0) + error = mb_put_uint8(mbp, 0); return error; } @@ -191,6 +204,17 @@ smbfs_fname_tolocal(struct smb_vc *vcp, error = iconv_conv_case (vcp->vc_tolocal, (const char **)&ibuf, &ilen, &obuf, &olen, copt); + if (error && SMB_UNICODE_STRINGS(vcp)) { + /* + * If using unicode, leaving a file name as it was when + * convert fails will cause a problem because the file name + * will contain NULL. + * Here, put '?' and give converted file name. + */ + *obuf = '?'; + olen--; + error = 0; + } if (!error) { *nmlen = sizeof(outbuf) - olen; memcpy(name, outbuf, *nmlen); Modified: stable/9/sys/kern/subr_mchain.c ============================================================================== --- stable/9/sys/kern/subr_mchain.c Mon Jan 16 05:07:32 2012 (r230195) +++ stable/9/sys/kern/subr_mchain.c Mon Jan 16 05:15:13 2012 (r230196) @@ -128,6 +128,36 @@ mb_reserve(struct mbchain *mbp, int size } int +mb_put_padbyte(struct mbchain *mbp) +{ + caddr_t dst; + char x = 0; + + dst = mtod(mbp->mb_cur, caddr_t) + mbp->mb_cur->m_len; + + /* only add padding if address is odd */ + if ((unsigned long)dst & 1) + return mb_put_mem(mbp, (caddr_t)&x, 1, MB_MSYSTEM); + else + return 0; +} + +int +mb_put_padbyte(struct mbchain *mbp) +{ + caddr_t dst; + char x = 0; + + dst = mtod(mbp->mb_cur, caddr_t) + mbp->mb_cur->m_len; + + /* only add padding if address is odd */ + if ((unsigned long)dst & 1) + return mb_put_mem(mbp, (caddr_t)&x, 1, MB_MSYSTEM); + else + return 0; +} + +int mb_put_uint8(struct mbchain *mbp, uint8_t x) { return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); Modified: stable/9/sys/libkern/iconv.c ============================================================================== --- stable/9/sys/libkern/iconv.c Mon Jan 16 05:07:32 2012 (r230195) +++ stable/9/sys/libkern/iconv.c Mon Jan 16 05:15:13 2012 (r230196) @@ -377,6 +377,18 @@ iconv_sysctl_cslist(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_kern_iconv, OID_AUTO, cslist, CTLFLAG_RD | CTLTYPE_OPAQUE, NULL, 0, iconv_sysctl_cslist, "S,xlat", "registered charset pairs"); +int +iconv_add(const char *converter, const char *to, const char *from) +{ + struct iconv_converter_class *dcp; + struct iconv_cspair *csp; + + if (iconv_lookupconv(converter, &dcp) != 0) + return EINVAL; + + return iconv_register_cspair(to, from, dcp, NULL, &csp); +} + /* * Add new charset pair */ Added: stable/9/sys/libkern/iconv_ucs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/libkern/iconv_ucs.c Mon Jan 16 05:15:13 2012 (r230196) @@ -0,0 +1,540 @@ +/*- + * Copyright (c) 2003, 2005 Ryuichiro Imura + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include "iconv_converter_if.h" + +/* + * "UCS" converter + */ + +#define KICONV_UCS_COMBINE 0x1 +#define KICONV_UCS_FROM_UTF8 0x2 +#define KICONV_UCS_TO_UTF8 0x4 +#define KICONV_UCS_FROM_LE 0x8 +#define KICONV_UCS_TO_LE 0x10 +#define KICONV_UCS_FROM_UTF16 0x20 +#define KICONV_UCS_TO_UTF16 0x40 +#define KICONV_UCS_UCS4 0x80 + +#define ENCODING_UTF16 "UTF-16BE" +#define ENCODING_UTF8 "UTF-8" + +static struct { + const char *name; + int from_flag, to_flag; +} unicode_family[] = { + { "UTF-8", KICONV_UCS_FROM_UTF8, KICONV_UCS_TO_UTF8 }, + { "UCS-2LE", KICONV_UCS_FROM_LE, KICONV_UCS_TO_LE }, + { "UTF-16BE", KICONV_UCS_FROM_UTF16, KICONV_UCS_TO_UTF16 }, + { "UTF-16LE", KICONV_UCS_FROM_UTF16|KICONV_UCS_FROM_LE, + KICONV_UCS_TO_UTF16|KICONV_UCS_TO_LE }, + { NULL, 0, 0 } +}; + +static uint32_t utf8_to_ucs4(const char *src, size_t *utf8width, size_t srclen); +static u_char *ucs4_to_utf8(uint32_t ucs4, char * dst, size_t *utf8width, size_t dstlen); +static uint32_t encode_surrogate(uint32_t code); +static uint32_t decode_surrogate(const u_char *ucs); + +#ifdef MODULE_DEPEND +MODULE_DEPEND(iconv_ucs, libiconv, 2, 2, 2); +#endif + +/* + * UCS converter instance + */ +struct iconv_ucs { + KOBJ_FIELDS; + int convtype; + struct iconv_cspair * d_csp; + struct iconv_cspair * d_cspf; + void * f_ctp; + void * t_ctp; + void * ctype; +}; + +static int +iconv_ucs_open(struct iconv_converter_class *dcp, + struct iconv_cspair *csp, struct iconv_cspair *cspf, void **dpp) +{ + struct iconv_ucs *dp; + int i; + const char *from, *to; + + dp = (struct iconv_ucs *)kobj_create((struct kobj_class*)dcp, M_ICONV, M_WAITOK); + to = csp->cp_to; + from = cspf ? cspf->cp_from : csp->cp_from; + + dp->convtype = 0; + + if (cspf) + dp->convtype |= KICONV_UCS_COMBINE; + for (i = 0; unicode_family[i].name; i++) { + if (strcmp(from, unicode_family[i].name) == 0) + dp->convtype |= unicode_family[i].from_flag; + if (strcmp(to, unicode_family[i].name) == 0) + dp->convtype |= unicode_family[i].to_flag; + } + if (strcmp(ENCODING_UNICODE, ENCODING_UTF16) == 0) + dp->convtype |= KICONV_UCS_UCS4; + else + dp->convtype &= ~KICONV_UCS_UCS4; + + dp->f_ctp = dp->t_ctp = NULL; + if (dp->convtype & KICONV_UCS_COMBINE) { + if ((dp->convtype & KICONV_UCS_FROM_UTF8) == 0 && + (dp->convtype & KICONV_UCS_FROM_LE) == 0) { + iconv_open(ENCODING_UNICODE, from, &dp->f_ctp); + } + if ((dp->convtype & KICONV_UCS_TO_UTF8) == 0 && + (dp->convtype & KICONV_UCS_TO_LE) == 0) { + iconv_open(to, ENCODING_UNICODE, &dp->t_ctp); + } + } + + dp->ctype = NULL; + if (dp->convtype & (KICONV_UCS_FROM_UTF8 | KICONV_UCS_TO_UTF8)) + iconv_open(KICONV_WCTYPE_NAME, ENCODING_UTF8, &dp->ctype); + + dp->d_csp = csp; + if (dp->convtype & (KICONV_UCS_FROM_UTF8 | KICONV_UCS_FROM_LE)) { + if (cspf) { + dp->d_cspf = cspf; + cspf->cp_refcount++; + } else + csp->cp_refcount++; + } + if (dp->convtype & (KICONV_UCS_TO_UTF8 | KICONV_UCS_TO_LE)) + csp->cp_refcount++; + *dpp = (void*)dp; + return 0; +} + +static int +iconv_ucs_close(void *data) +{ + struct iconv_ucs *dp = data; + + if (dp->f_ctp) + iconv_close(dp->f_ctp); + if (dp->t_ctp) + iconv_close(dp->t_ctp); + if (dp->ctype) + iconv_close(dp->ctype); + if (dp->d_cspf) + dp->d_cspf->cp_refcount--; + else if (dp->convtype & (KICONV_UCS_FROM_UTF8 | KICONV_UCS_FROM_LE)) + dp->d_csp->cp_refcount--; + if (dp->convtype & (KICONV_UCS_TO_UTF8 | KICONV_UCS_TO_LE)) + dp->d_csp->cp_refcount--; + kobj_delete((struct kobj*)data, M_ICONV); + return 0; +} + +static int +iconv_ucs_conv(void *d2p, const char **inbuf, + size_t *inbytesleft, char **outbuf, size_t *outbytesleft, + int convchar, int casetype) +{ + struct iconv_ucs *dp = (struct iconv_ucs*)d2p; + int ret = 0, i; + size_t in, on, ir, or, inlen, outlen, ucslen; + const char *src, *p; + char *dst; + u_char ucs[4], *q; + uint32_t code; + + if (inbuf == NULL || *inbuf == NULL || outbuf == NULL || *outbuf == NULL) + return 0; + ir = in = *inbytesleft; + or = on = *outbytesleft; + src = *inbuf; + dst = *outbuf; + + while (ir > 0 && or > 0) { + + /* + * The first half of conversion. + * (convert any code into ENCODING_UNICODE) + */ + code = 0; + p = src; + if (dp->convtype & KICONV_UCS_FROM_UTF8) { + /* convert UTF-8 to ENCODING_UNICODE */ + inlen = 0; + code = utf8_to_ucs4(p, &inlen, ir); + if (code == 0) { + ret = -1; + break; + } + + if (casetype == KICONV_FROM_LOWER && dp->ctype) { + code = towlower(code, dp->ctype); + } else if (casetype == KICONV_FROM_UPPER && dp->ctype) { + code = towupper(code, dp->ctype); + } + + if ((code >= 0xd800 && code < 0xe000) || code >= 0x110000 ) { + /* reserved for utf-16 surrogate pair */ + /* invalid unicode */ + ret = -1; + break; + } + + if (inlen == 4) { + if (dp->convtype & KICONV_UCS_UCS4) { + ucslen = 4; + code = encode_surrogate(code); + } else { + /* can't handle with ucs-2 */ + ret = -1; + break; + } + } else { + ucslen = 2; + } + + /* save UCS-4 into ucs[] */ + for (q = ucs, i = ucslen - 1 ; i >= 0 ; i--) + *q++ = (code >> (i << 3)) & 0xff; + + } else if (dp->convtype & KICONV_UCS_COMBINE && dp->f_ctp) { + /* convert local code to ENCODING_UNICODE */ + ucslen = 4; + inlen = ir; + q = ucs; + ret = iconv_convchr_case(dp->f_ctp, &p, &inlen, (char **)&q, + &ucslen, casetype & (KICONV_FROM_LOWER | KICONV_FROM_UPPER)); + if (ret) + break; + inlen = ir - inlen; + ucslen = 4 - ucslen; + + } else { + /* src code is a proper subset of ENCODING_UNICODE */ + q = ucs; + if (dp->convtype & KICONV_UCS_FROM_LE) { + *q = *(p + 1); + *(q + 1) = *p; + p += 2; + } else { + *q = *p++; + *(q + 1) = *p++; + } + if ((*q & 0xfc) == 0xd8) { + if (dp->convtype & KICONV_UCS_UCS4 && + dp->convtype & KICONV_UCS_FROM_UTF16) { + inlen = ucslen = 4; + } else { + /* invalid unicode */ + ret = -1; + break; + } + } else { + inlen = ucslen = 2; + } + if (ir < inlen) { + ret = -1; + break; + } + if (ucslen == 4) { + q += 2; + if (dp->convtype & KICONV_UCS_FROM_LE) { + *q = *(p + 1); + *(q + 1) = *p; + } else { + *q = *p++; + *(q + 1) = *p; + } + if ((*q & 0xfc) != 0xdc) { + /* invalid unicode */ + ret = -1; + break; + } + } + } + + /* + * The second half of conversion. + * (convert ENCODING_UNICODE into any code) + */ + p = ucs; + if (dp->convtype & KICONV_UCS_TO_UTF8) { + q = (u_char *)dst; + if (ucslen == 4 && dp->convtype & KICONV_UCS_UCS4) { + /* decode surrogate pair */ + code = decode_surrogate(p); + } else { + code = (ucs[0] << 8) | ucs[1]; + } + + if (casetype == KICONV_LOWER && dp->ctype) { + code = towlower(code, dp->ctype); + } else if (casetype == KICONV_UPPER && dp->ctype) { + code = towupper(code, dp->ctype); + } + + outlen = 0; + if (ucs4_to_utf8(code, q, &outlen, or) == NULL) { + ret = -1; + break; + } + + src += inlen; + ir -= inlen; + dst += outlen; + or -= outlen; + + } else if (dp->convtype & KICONV_UCS_COMBINE && dp->t_ctp) { + ret = iconv_convchr_case(dp->t_ctp, &p, &ucslen, &dst, + &or, casetype & (KICONV_LOWER | KICONV_UPPER)); + if (ret) + break; + + src += inlen; + ir -= inlen; + + } else { + /* dst code is a proper subset of ENCODING_UNICODE */ + if (or < ucslen) { + ret = -1; + break; + } + src += inlen; + ir -= inlen; + or -= ucslen; + if (dp->convtype & KICONV_UCS_TO_LE) { + *dst++ = *(p + 1); + *dst++ = *p; + p += 2; + } else { + *dst++ = *p++; + *dst++ = *p++; + } + if (ucslen == 4) { + if ((dp->convtype & KICONV_UCS_UCS4) == 0 || + (dp->convtype & KICONV_UCS_TO_UTF16) == 0) { + ret = -1; + break; + } + if (dp->convtype & KICONV_UCS_TO_LE) { + *dst++ = *(p + 1); + *dst++ = *p; + } else { + *dst++ = *p++; + *dst++ = *p; + } + } + } + + if (convchar == 1) + break; + } + + *inbuf += in - ir; + *outbuf += on - or; + *inbytesleft -= in - ir; + *outbytesleft -= on - or; + return (ret); +} + +static int +iconv_ucs_init(struct iconv_converter_class *dcp) +{ + int error; + + error = iconv_add(ENCODING_UNICODE, ENCODING_UNICODE, ENCODING_UTF8); + if (error) + return (error); + error = iconv_add(ENCODING_UNICODE, ENCODING_UTF8, ENCODING_UNICODE); + if (error) + return (error); + return (0); +} + +static int +iconv_ucs_done(struct iconv_converter_class *dcp) +{ + return (0); +} + +static const char * +iconv_ucs_name(struct iconv_converter_class *dcp) +{ + return (ENCODING_UNICODE); +} + +static kobj_method_t iconv_ucs_methods[] = { + KOBJMETHOD(iconv_converter_open, iconv_ucs_open), + KOBJMETHOD(iconv_converter_close, iconv_ucs_close), + KOBJMETHOD(iconv_converter_conv, iconv_ucs_conv), + KOBJMETHOD(iconv_converter_init, iconv_ucs_init), + KOBJMETHOD(iconv_converter_done, iconv_ucs_done), + KOBJMETHOD(iconv_converter_name, iconv_ucs_name), + {0, 0} +}; + +KICONV_CONVERTER(ucs, sizeof(struct iconv_ucs)); + +static uint32_t +utf8_to_ucs4(const char *src, size_t *utf8width, size_t srclen) +{ + size_t i, w = 0; + uint32_t ucs4 = 0; + + /* + * get leading 1 byte from utf-8 + */ + if ((*src & 0x80) == 0) { + /* + * leading 1 bit is "0" + * utf-8: 0xxxxxxx + * ucs-4: 00000000 00000000 00000000 0xxxxxxx + */ + w = 1; + /* get trailing 7 bits */ + ucs4 = *src & 0x7f; + } else if ((*src & 0xe0) == 0xc0) { + /* + * leading 3 bits are "110" + * utf-8: 110xxxxx 10yyyyyy + * ucs-4: 00000000 00000000 00000xxx xxyyyyyy + */ + w = 2; + /* get trailing 5 bits */ + ucs4 = *src & 0x1f; + } else if ((*src & 0xf0) == 0xe0) { + /* + * leading 4 bits are "1110" + * utf-8: 1110xxxx 10yyyyyy 10zzzzzz + * ucs-4: 00000000 00000000 xxxxyyyy yyzzzzzz + */ + w = 3; + /* get trailing 4 bits */ + ucs4 = *src & 0x0f; + } else if ((*src & 0xf8) == 0xf0) { + /* + * leading 5 bits are "11110" + * utf-8: 11110www 10xxxxxx 10yyyyyy 10zzzzzz + * ucs-4: 00000000 000wwwxx xxxxyyyy yyzzzzzz + */ + w = 4; + /* get trailing 3 bits */ + ucs4 = *src & 0x07; + } else { + /* out of utf-16 range or having illegal bits */ + return (0); + } + if (w == 0) + return (0); + + if (srclen < w) + return (0); + + /* + * get left parts from utf-8 + */ + for (i = 1 ; i < w ; i++) { + if ((*(src + i) & 0xc0) != 0x80) { + /* invalid: leading 2 bits are not "10" */ + return (0); + } + /* concatenate trailing 6 bits into ucs4 */ + ucs4 <<= 6; + ucs4 |= *(src + i) & 0x3f; + } + + *utf8width = w; + return (ucs4); +} + +static u_char * +ucs4_to_utf8(uint32_t ucs4, char *dst, size_t *utf8width, size_t dstlen) +{ + u_char lead, *p; + size_t i, w; + + /* + * determine utf-8 width and leading bits + */ + if (ucs4 < 0x80) { + w = 1; + lead = 0; /* "0" */ + } else if (ucs4 < 0x800) { + w = 2; + lead = 0xc0; /* "11" */ + } else if (ucs4 < 0x10000) { + w = 3; + lead = 0xe0; /* "111" */ + } else if (ucs4 < 0x200000) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 05:22: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 8031D106566C; Mon, 16 Jan 2012 05:22:19 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D95B8FC18; Mon, 16 Jan 2012 05:22: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 q0G5MJBY017279; Mon, 16 Jan 2012 05:22:19 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0G5MJfD017275; Mon, 16 Jan 2012 05:22:19 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201160522.q0G5MJfD017275@svn.freebsd.org> From: Kevin Lo Date: Mon, 16 Jan 2012 05:22: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: r230197 - stable/9/sys/fs/ntfs 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, 16 Jan 2012 05:22:19 -0000 Author: kevlo Date: Mon Jan 16 05:22:18 2012 New Revision: 230197 URL: http://svn.freebsd.org/changeset/base/230197 Log: MFC r228864: Discard local array based on return values. Pointed out by: uqs Found with: Coverity Prevent(tm) CID: 10089 MFC 228023: Add unicode support to ntfs Obtained from: imura Modified: stable/9/sys/fs/ntfs/ntfs_subr.c stable/9/sys/fs/ntfs/ntfs_subr.h stable/9/sys/fs/ntfs/ntfs_vnops.c Modified: stable/9/sys/fs/ntfs/ntfs_subr.c ============================================================================== --- stable/9/sys/fs/ntfs/ntfs_subr.c Mon Jan 16 05:15:13 2012 (r230196) +++ stable/9/sys/fs/ntfs/ntfs_subr.c Mon Jan 16 05:22:18 2012 (r230197) @@ -667,23 +667,18 @@ ntfs_uastricmp(ntmp, ustr, ustrlen, astr const char *astr; size_t astrlen; { - int len; + const char *astrp = astr; + char tmpbuf[5]; + int len, res; size_t i, j, mbstrlen = astrlen; - int res; - wchar wc; if (ntmp->ntm_ic_l2u) { - for (i = 0, j = 0; i < ustrlen && j < astrlen; i++, j++) { - if (j < astrlen -1) { - wc = (wchar)astr[j]<<8 | (astr[j+1]&0xFF); - len = 2; - } else { - wc = (wchar)astr[j]<<8 & 0xFF00; - len = 1; - } + for (i = 0, j = 0; i < ustrlen && j < astrlen; i++) { + len = 4; res = ((int) NTFS_TOUPPER(ustr[i])) - - ((int)NTFS_TOUPPER(NTFS_82U(wc, &len))); - j += len - 1; + ((int)NTFS_TOUPPER(NTFS_82U(astrp, &len))); + astrp += len; + j += len; mbstrlen -= len - 1; if (res) @@ -696,7 +691,8 @@ ntfs_uastricmp(ntmp, ustr, ustrlen, astr */ for (i = 0; i < ustrlen && i < astrlen; i++) { res = ((int) NTFS_TOUPPER(NTFS_82U(NTFS_U28(ustr[i]), &len))) - - ((int)NTFS_TOUPPER(NTFS_82U((wchar)astr[i], &len))); + ((int)NTFS_TOUPPER(NTFS_82U(astrp, &len))); + astrp++; if (res) return res; } @@ -715,23 +711,18 @@ ntfs_uastrcmp(ntmp, ustr, ustrlen, astr, const char *astr; size_t astrlen; { - char u, l; + char *c, tmpbuf[5]; size_t i, j, mbstrlen = astrlen; int res; - wchar wc; - for (i = 0, j = 0; (i < ustrlen) && (j < astrlen); i++, j++) { - res = 0; - wc = NTFS_U28(ustr[i]); - u = (char)(wc>>8); - l = (char)wc; - if (u != '\0' && j < astrlen -1) { - res = (int) (u - astr[j++]); + for (i = 0, j = 0; (i < ustrlen) && (j < astrlen); i++, mbstrlen++) { + c = NTFS_U28(ustr[i]); + while (*c != '\0') { + res = (int) (*c++ - astr[j++]); + if (res) + return res; mbstrlen--; } - res = (res<<8) + (int) (l - astr[j]); - if (res) - return res; } return (ustrlen - mbstrlen); } @@ -2135,50 +2126,48 @@ ntfs_82u_uninit(struct ntfsmount *ntmp) } /* - * maps the Unicode char to 8bit equivalent - * XXX currently only gets lower 8bit from the Unicode char - * and substitutes a '_' for it if the result would be '\0'; - * something better has to be definitely though out + * maps the Unicode char to local character */ -wchar +char * ntfs_u28( + char *outbuf, struct ntfsmount *ntmp, wchar wc) { - char *p, *outp, inbuf[3], outbuf[3]; + char *p, *outp, inbuf[3]; size_t ilen, olen; + outp = outbuf; if (ntfs_iconv && ntmp->ntm_ic_u2l) { - ilen = olen = 2; + ilen = 2; + olen = 4; inbuf[0] = (char)(wc>>8); inbuf[1] = (char)wc; inbuf[2] = '\0'; p = inbuf; - outp = outbuf; ntfs_iconv->convchr(ntmp->ntm_ic_u2l, (const char **)&p, &ilen, &outp, &olen); - if (olen == 1) { - return ((wchar)(outbuf[0]&0xFF)); - } else if (olen == 0) { - return ((wchar)((outbuf[0]<<8) | (outbuf[1]&0xFF))); - } - return ('?'); + if (olen == 4) + *outp++ = '?'; + *outp = '\0'; + outp = outbuf; + return (outp); } p = ntmp->ntm_u28[(wc>>8)&0xFF]; - if (p == NULL) - return ('_'); - return (p[wc&0xFF]&0xFF); + outbuf[0] = (p == NULL) ? '_' : p[wc&0xFF] & 0xFF; + outbuf[1] = '\0'; + return (outp); } wchar ntfs_82u( struct ntfsmount *ntmp, - wchar wc, + const char *c, int *len) { - char *p, *outp, inbuf[3], outbuf[3]; + char *outp, outbuf[3]; wchar uc; size_t ilen, olen; @@ -2186,13 +2175,8 @@ ntfs_82u( ilen = (size_t)*len; olen = 2; - inbuf[0] = (char)(wc>>8); - inbuf[1] = (char)wc; - inbuf[2] = '\0'; - p = inbuf; outp = outbuf; - ntfs_iconv->convchr(ntmp->ntm_ic_l2u, (const char **)&p, &ilen, - &outp, &olen); + ntfs_iconv->convchr(ntmp->ntm_ic_l2u, &c, &ilen, &outp, &olen); *len -= (int)ilen; uc = (wchar)((outbuf[0]<<8) | (outbuf[1]&0xFF)); @@ -2200,7 +2184,7 @@ ntfs_82u( } if (ntmp->ntm_82u != NULL) - return (ntmp->ntm_82u[wc&0xFF]); + return (ntmp->ntm_82u[*c&0xFF]); return ('?'); } Modified: stable/9/sys/fs/ntfs/ntfs_subr.h ============================================================================== --- stable/9/sys/fs/ntfs/ntfs_subr.h Mon Jan 16 05:15:13 2012 (r230196) +++ stable/9/sys/fs/ntfs/ntfs_subr.h Mon Jan 16 05:22:18 2012 (r230197) @@ -112,9 +112,9 @@ int ntfs_u28_init(struct ntfsmount *ntmp int ntfs_u28_uninit(struct ntfsmount *ntmp); int ntfs_82u_init(struct ntfsmount *ntmp, char *cs_local, char *cs_ntfs); int ntfs_82u_uninit(struct ntfsmount *ntmp); -wchar ntfs_u28(struct ntfsmount *ntmp, wchar wc); -wchar ntfs_82u(struct ntfsmount *ntmp, wchar wc, int *len); -#define NTFS_U28(ch) ntfs_u28(ntmp, (ch)) +char * ntfs_u28(char *outbuf, struct ntfsmount *ntmp, wchar wc); +wchar ntfs_82u(struct ntfsmount *ntmp, const char *c, int *len); +#define NTFS_U28(ch) ntfs_u28(tmpbuf, ntmp, (ch)) #define NTFS_82U(ch, len) ntfs_82u(ntmp, (ch), len) #define NTFS_UASTRCMP(ustr, ustrlen, astr, astrlen) \ ntfs_uastrcmp(ntmp, (ustr), (ustrlen), (astr), (astrlen)) Modified: stable/9/sys/fs/ntfs/ntfs_vnops.c ============================================================================== --- stable/9/sys/fs/ntfs/ntfs_vnops.c Mon Jan 16 05:15:13 2012 (r230196) +++ stable/9/sys/fs/ntfs/ntfs_vnops.c Mon Jan 16 05:22:18 2012 (r230197) @@ -481,7 +481,7 @@ ntfs_readdir(ap) struct uio *uio = ap->a_uio; struct ntfsmount *ntmp = ip->i_mp; int i, j, error = 0; - wchar c; + char *c, tmpbuf[5]; u_int32_t faked = 0, num; int ncookies = 0; struct dirent cde; @@ -538,11 +538,10 @@ ntfs_readdir(ap) if(!ntfs_isnamepermitted(ntmp,iep)) continue; - for(i=0, j=0; iie_fnamelen; i++, j++) { + for(i=0, j=0; iie_fnamelen; i++) { c = NTFS_U28(iep->ie_fname[i]); - if (c&0xFF00) - cde.d_name[j++] = (char)(c>>8); - cde.d_name[j] = (char)c&0xFF; + while (*c != '\0') + cde.d_name[j++] = *c++; } cde.d_name[j] = '\0'; dprintf(("ntfs_readdir: elem: %d, fname:[%s] type: %d, flag: %d, ", From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 06:49: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 94CA7106564A; Mon, 16 Jan 2012 06:49:04 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 829F78FC08; Mon, 16 Jan 2012 06:49: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 q0G6n4Jj020643; Mon, 16 Jan 2012 06:49:04 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0G6n4BW020641; Mon, 16 Jan 2012 06:49:04 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201160649.q0G6n4BW020641@svn.freebsd.org> From: Hiroki Sato Date: Mon, 16 Jan 2012 06:49: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: r230202 - stable/9/release/doc/en_US.ISO8859-1/errata 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, 16 Jan 2012 06:49:04 -0000 Author: hrs Date: Mon Jan 16 06:49:03 2012 New Revision: 230202 URL: http://svn.freebsd.org/changeset/base/230202 Log: Document {ALLOW_NEW,BLOCK_OLD}_SOURCES state change record type support for SSM MLDv2 forgotten in the 9.0R Release Notes. Pointy hat to: hrs Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Mon Jan 16 06:15:14 2012 (r230201) +++ stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Mon Jan 16 06:49:03 2012 (r230202) @@ -263,6 +263,20 @@ boot match "cdev" "ugen[0-9]+.[0-9]+"; action "/path/to/script /dev/$cdev"; } + + The &os; &release.current; Release Notes should have + mentioned that SSM (Source-Specific Multicast) MLDv2 now uses + ALLOW_NEW_SOURCES and + BLOCK_OLD_SOURCES record types to signal a + join or a leave by default. This conforms RFC 4604, + Using Internet Group Management Protocol Version 3 + (IGMPv3) and Multicast Listener Discovery Protocol Version 2 + (MLDv2) for Source-Specific Multicast. A new + &man.sysctl.8; variable + net.inet6.mld.use_allow which controls the + behavior has been added. The default value is + 1 (use ALLOW_NEW_SOURCES + and BLOCK_OLD_SOURCES). From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 07:03:00 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 32B5E106566C; Mon, 16 Jan 2012 07:03:00 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FFD48FC13; Mon, 16 Jan 2012 07:03:00 +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 q0G72xbD021109; Mon, 16 Jan 2012 07:02:59 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0G72xaM021107; Mon, 16 Jan 2012 07:02:59 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201160702.q0G72xaM021107@svn.freebsd.org> From: Hiroki Sato Date: Mon, 16 Jan 2012 07:02: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: r230203 - stable/9/release/doc/en_US.ISO8859-1/errata 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, 16 Jan 2012 07:03:00 -0000 Author: hrs Date: Mon Jan 16 07:02:59 2012 New Revision: 230203 URL: http://svn.freebsd.org/changeset/base/230203 Log: Use to format entries. Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Mon Jan 16 06:49:03 2012 (r230202) +++ stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Mon Jan 16 07:02:59 2012 (r230203) @@ -220,63 +220,75 @@ Open Issues - In some releases prior to &release.current;, upgrading by - using &man.freebsd-update.8; can fail. This issue has been - fixed by a change in Errata Notice EN-12:01. For more - information, see - - &os; &release.current; includes several - changes to improve resource management of PCI devices. Some x86 - machines may not boot or may have devices that no longer attach - when using ACPI as a result of these changes. This can be - worked around by setting a &man.loader.8; tunable - debug.acpi.disabled to - hostres. To do this, enter the following - lines at the loader prompt: + + + In some releases prior to &release.current;, upgrading + by using &man.freebsd-update.8; can fail. This issue has + been fixed by a change in Errata Notice EN-12:01. For more + information, see + + + + &os; &release.current; includes + several changes to improve resource management of PCI + devices. Some x86 machines may not boot or may have devices + that no longer attach when using ACPI as a result of these + changes. This can be worked around by setting a + &man.loader.8; tunable + debug.acpi.disabled to + hostres. To do this, enter the following + lines at the loader prompt: - set debug.acpi.disabled="hostres" + set debug.acpi.disabled="hostres" boot - Or, put the following line into - /boot/loader.conf: + Or, put the following line into + /boot/loader.conf: - debug.acpi.disabled="hostres" + debug.acpi.disabled="hostres" + - A &man.devctl.4; event upon arrival of a &man.ugen.4; device - has been changed. The event now includes - ugen and cdev variables - instead of device-name. This change can - prevent the following &man.devd.8; rule which worked in a - previous releases from working: + + A &man.devctl.4; event upon arrival of a &man.ugen.4; + device has been changed. The event now includes + ugen and cdev + variables instead of device-name. This + change can prevent the following &man.devd.8; rule which + worked in a previous releases from working: - attach 0 { + attach 0 { match "device-name" "ugen[0-9]+.[0-9]+"; action "/path/to/script /dev/$device-name"; } - This should be updated to the following: + This should be updated to the following: - attach 0 { + attach 0 { match "subsystem" "DEVICE"; match "type" "ATTACH"; match "cdev" "ugen[0-9]+.[0-9]+"; action "/path/to/script /dev/$cdev"; } + - The &os; &release.current; Release Notes should have - mentioned that SSM (Source-Specific Multicast) MLDv2 now uses - ALLOW_NEW_SOURCES and - BLOCK_OLD_SOURCES record types to signal a - join or a leave by default. This conforms RFC 4604, - Using Internet Group Management Protocol Version 3 - (IGMPv3) and Multicast Listener Discovery Protocol Version 2 - (MLDv2) for Source-Specific Multicast. A new - &man.sysctl.8; variable - net.inet6.mld.use_allow which controls the - behavior has been added. The default value is - 1 (use ALLOW_NEW_SOURCES - and BLOCK_OLD_SOURCES). + + The &os; &release.current; Release Notes should have + mentioned that SSM (Source-Specific Multicast) MLDv2 now + uses ALLOW_NEW_SOURCES and + BLOCK_OLD_SOURCES record types to signal + a join or a leave by default. This conforms RFC 4604, + Using Internet Group Management Protocol Version 3 + (IGMPv3) and Multicast Listener Discovery Protocol Version 2 + (MLDv2) for Source-Specific Multicast. A new + &man.sysctl.8; variable + net.inet6.mld.use_allow which controls + the behavior has been added. The default value is + 1 (use + ALLOW_NEW_SOURCES and + BLOCK_OLD_SOURCES). + + From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 14:31:01 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 CFF6C106564A; Mon, 16 Jan 2012 14:31:01 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE3138FC08; Mon, 16 Jan 2012 14:31:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0GEV1MD038108; Mon, 16 Jan 2012 14:31:01 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0GEV1Su038106; Mon, 16 Jan 2012 14:31:01 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201161431.q0GEV1Su038106@svn.freebsd.org> From: Kevin Lo Date: Mon, 16 Jan 2012 14:31: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: r230216 - 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, 16 Jan 2012 14:31:01 -0000 Author: kevlo Date: Mon Jan 16 14:31:01 2012 New Revision: 230216 URL: http://svn.freebsd.org/changeset/base/230216 Log: Fix build breakage Modified: stable/9/sys/kern/subr_mchain.c Modified: stable/9/sys/kern/subr_mchain.c ============================================================================== --- stable/9/sys/kern/subr_mchain.c Mon Jan 16 13:23:19 2012 (r230215) +++ stable/9/sys/kern/subr_mchain.c Mon Jan 16 14:31:01 2012 (r230216) @@ -133,21 +133,6 @@ mb_put_padbyte(struct mbchain *mbp) caddr_t dst; char x = 0; - dst = mtod(mbp->mb_cur, caddr_t) + mbp->mb_cur->m_len; - - /* only add padding if address is odd */ - if ((unsigned long)dst & 1) - return mb_put_mem(mbp, (caddr_t)&x, 1, MB_MSYSTEM); - else - return 0; -} - -int -mb_put_padbyte(struct mbchain *mbp) -{ - caddr_t dst; - char x = 0; - dst = mtod(mbp->mb_cur, caddr_t) + mbp->mb_cur->m_len; /* only add padding if address is odd */ From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 14:55: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 8D61E106566C; Mon, 16 Jan 2012 14:55:42 +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 79A9C8FC08; Mon, 16 Jan 2012 14:55: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 q0GEtg1s039030; Mon, 16 Jan 2012 14:55:42 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0GEtg44039026; Mon, 16 Jan 2012 14:55:42 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201161455.q0GEtg44039026@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 16 Jan 2012 14:55: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: r230219 - stable/9/sys/boot/forth 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, 16 Jan 2012 14:55:42 -0000 Author: pluknet Date: Mon Jan 16 14:55:42 2012 New Revision: 230219 URL: http://svn.freebsd.org/changeset/base/230219 Log: MFC r228985,229881: Unset the environment variables associated with individual menu items before invoking the kernel. Get rid of a spurious warning on the console when booting the kernel from the interactive loader(8) prompt and beastie_disable="YES" is set in loader.conf(5). Submitted by: Devin Teske Modified: stable/9/sys/boot/forth/loader.4th stable/9/sys/boot/forth/menu.4th stable/9/sys/boot/forth/menu.4th.8 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) Modified: stable/9/sys/boot/forth/loader.4th ============================================================================== --- stable/9/sys/boot/forth/loader.4th Mon Jan 16 14:54:48 2012 (r230218) +++ stable/9/sys/boot/forth/loader.4th Mon Jan 16 14:55:42 2012 (r230219) @@ -41,12 +41,26 @@ s" arch-i386" environment? [if] [if] include /boot/support.4th -\ ***** boot-conf -\ -\ Prepares to boot as specified by loaded configuration files. - only forth also support-functions also builtins definitions +: try-menu-unset + \ menu-unset may not be present + s" beastie_disable" getenv + dup -1 <> if + s" YES" compare-insensitive 0= if + exit + then + else + drop + then + s" menu-unset" + sfind if + execute + else + drop + then +; + : boot 0= if ( interpreted ) get_arguments then @@ -57,24 +71,32 @@ only forth also support-functions also b 0 1 unload drop else s" kernelname" getenv? if ( a kernel has been loaded ) + try-menu-unset 1 boot exit then load_kernel_and_modules ?dup if exit then + try-menu-unset 0 1 boot exit then else s" kernelname" getenv? if ( a kernel has been loaded ) + try-menu-unset 1 boot exit then load_kernel_and_modules ?dup if exit then + try-menu-unset 0 1 boot exit then load_kernel_and_modules ?dup 0= if 0 1 boot then ; +\ ***** boot-conf +\ +\ Prepares to boot as specified by loaded configuration files. + : boot-conf 0= if ( interpreted ) get_arguments then 0 1 unload drop Modified: stable/9/sys/boot/forth/menu.4th ============================================================================== --- stable/9/sys/boot/forth/menu.4th Mon Jan 16 14:54:48 2012 (r230218) +++ stable/9/sys/boot/forth/menu.4th Mon Jan 16 14:55:42 2012 (r230219) @@ -131,11 +131,11 @@ create init_text8 255 allot \ Print the value of menuidx loader_color? if - ." " + ." " (  ) then menuidx @ . loader_color? if - ." " + ." " (  ) then \ Move the cursor forward 1 column @@ -897,22 +897,60 @@ create init_text8 255 allot ; \ This function unsets all the possible environment variables associated with -\ creating the interactive menu. Call this when you want to clear the menu -\ area in preparation for another menu. +\ creating the interactive menu. \ -: menu-clear ( -- ) +: menu-unset ( -- ) 49 \ Iterator start (loop range 49 to 56; ASCII '1' to '8') begin - \ basename for caption variable - loader_color? if - s" ansi_caption[x]" - else - s" menu_caption[x]" - then + \ Unset variables in-order of appearance in menu.4th(8) + + s" menu_caption[x]" \ basename for caption variable -rot 2dup 13 + c! rot \ replace 'x' with current iteration unsetenv \ not erroneous to unset unknown var + s" menu_command[x]" \ command basename + -rot 2dup 13 + c! rot \ replace 'x' + unsetenv + + s" menu_keycode[x]" \ keycode basename + -rot 2dup 13 + c! rot \ replace 'x' + unsetenv + + s" ansi_caption[x]" \ ANSI caption basename + -rot 2dup 13 + c! rot \ replace 'x' + unsetenv + + s" toggled_text[x]" \ toggle_menuitem caption basename + -rot 2dup 13 + c! rot \ replace 'x' + unsetenv + + s" toggled_ansi[x]" \ toggle_menuitem ANSI caption basename + -rot 2dup 13 + c! rot \ replace 'x' + unsetenv + + s" menu_caption[x][y]" \ cycle_menuitem caption + -rot 2dup 13 + c! rot \ replace 'x' + 49 -rot + begin + 16 2over rot + c! \ replace 'y' + 2dup unsetenv + + rot 1+ dup 56 > 2swap rot + until + 2drop drop + + s" ansi_caption[x][y]" \ cycle_menuitem ANSI caption + -rot 2dup 13 + c! rot \ replace 'x' + 49 -rot + begin + 16 2over rot + c! \ replace 'y' + 2dup unsetenv + + rot 1+ dup 56 > 2swap rot + until + 2drop drop + s" 0 menukeyN !" \ basename for key association var -rot 2dup 9 + c! rot \ replace 'N' with current iteration evaluate \ assign zero (0) to key assoc. var @@ -921,6 +959,9 @@ create init_text8 255 allot until drop \ iterator + \ unset the timeout command + s" menu_timeout_command" unsetenv + \ clear the "Reboot" menu option flag s" menu_reboot" unsetenv 0 menureboot ! @@ -933,6 +974,13 @@ create init_text8 255 allot s" menu_options" unsetenv 0 menuoptions ! +; + +\ This function both unsets menu variables and visually erases the menu area +\ in-preparation for another menu. +\ +: menu-clear ( -- ) + menu-unset menu-erase ; Modified: stable/9/sys/boot/forth/menu.4th.8 ============================================================================== --- stable/9/sys/boot/forth/menu.4th.8 Mon Jan 16 14:54:48 2012 (r230218) +++ stable/9/sys/boot/forth/menu.4th.8 Mon Jan 16 14:55:42 2012 (r230219) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Aug 29, 2011 +.Dd Dec 27, 2011 .Dt MENU.4TH 8 .Os .Sh NAME @@ -69,9 +69,13 @@ Clears the screen area within the menu b Calls .Ic menu-erase and then redraws the menu. +.It Ic menu-unset +Unsets the environment variables associated with individual menu items, +clearing the way for a new menu. .It Ic menu-clear -Unsets all possible environment variables used -to configure the menu and then calls +Calls +.Ic menu-unset +and then .Ic menu-erase . .El .Pp From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 17:30:01 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 59CED106566B; Mon, 16 Jan 2012 17:30:01 +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 2CF978FC1B; Mon, 16 Jan 2012 17:30:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0GHU1Vq044071; Mon, 16 Jan 2012 17:30:01 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0GHU15C044068; Mon, 16 Jan 2012 17:30:01 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201201161730.q0GHU15C044068@svn.freebsd.org> From: Jim Harris Date: Mon, 16 Jan 2012 17: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: r230223 - in stable/9/sys/dev: ahci ata ata/chipsets 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, 16 Jan 2012 17:30:01 -0000 Author: jimharris Date: Mon Jan 16 17:30:00 2012 New Revision: 230223 URL: http://svn.freebsd.org/changeset/base/230223 Log: MFC r229671: Add 0x2826 device ID for C600 (Patsburg) SATA controller in RAID mode. Sponsored by: Intel Approved by: sbruno Modified: stable/9/sys/dev/ahci/ahci.c stable/9/sys/dev/ata/ata-pci.h stable/9/sys/dev/ata/chipsets/ata-intel.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/dev/ahci/ahci.c ============================================================================== --- stable/9/sys/dev/ahci/ahci.c Mon Jan 16 17:08:08 2012 (r230222) +++ stable/9/sys/dev/ahci/ahci.c Mon Jan 16 17:30:00 2012 (r230223) @@ -171,6 +171,7 @@ static struct { {0x1d028086, 0x00, "Intel Patsburg", 0}, {0x1d048086, 0x00, "Intel Patsburg", 0}, {0x1d068086, 0x00, "Intel Patsburg", 0}, + {0x28268086, 0x00, "Intel Patsburg (RAID)", 0}, {0x1e028086, 0x00, "Intel Panther Point", 0}, {0x1e038086, 0x00, "Intel Panther Point", 0}, {0x1e048086, 0x00, "Intel Panther Point", 0}, Modified: stable/9/sys/dev/ata/ata-pci.h ============================================================================== --- stable/9/sys/dev/ata/ata-pci.h Mon Jan 16 17:08:08 2012 (r230222) +++ stable/9/sys/dev/ata/ata-pci.h Mon Jan 16 17:30:00 2012 (r230223) @@ -236,6 +236,7 @@ struct ata_pci_controller { #define ATA_PBG_AH1 0x1d028086 #define ATA_PBG_R1 0x1d048086 #define ATA_PBG_R2 0x1d068086 +#define ATA_PBG_R3 0x28268086 #define ATA_PBG_S2 0x1d088086 #define ATA_PPT_S1 0x1e008086 Modified: stable/9/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/9/sys/dev/ata/chipsets/ata-intel.c Mon Jan 16 17:08:08 2012 (r230222) +++ stable/9/sys/dev/ata/chipsets/ata-intel.c Mon Jan 16 17:30:00 2012 (r230223) @@ -197,6 +197,7 @@ ata_intel_probe(device_t dev) { ATA_PBG_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, + { ATA_PBG_R3, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_S2, 0, INTEL_6CH2, 0, ATA_SA300, "Patsburg" }, { ATA_PPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 17:53: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 B19721065673; Mon, 16 Jan 2012 17:53:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 95EC48FC0A; Mon, 16 Jan 2012 17:53:44 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA23977; Mon, 16 Jan 2012 19:39:02 +0200 (EET) (envelope-from avg@FreeBSD.org) Message-ID: <4F1460B5.9000502@FreeBSD.org> Date: Mon, 16 Jan 2012 19:39:01 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111109 Thunderbird/8.0 MIME-Version: 1.0 To: Jim Harris References: <201201161730.q0GHU15C044068@svn.freebsd.org> In-Reply-To: <201201161730.q0GHU15C044068@svn.freebsd.org> X-Enigmail-Version: undefined Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-9@FreeBSD.org, Sean Bruno Subject: Re: svn commit: r230223 - in stable/9/sys/dev: ahci ata ata/chipsets 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, 16 Jan 2012 17:53:45 -0000 on 16/01/2012 19:30 Jim Harris said the following: [snip] > Modified: > stable/9/sys/dev/ahci/ahci.c > stable/9/sys/dev/ata/ata-pci.h > stable/9/sys/dev/ata/chipsets/ata-intel.c > Directory Properties: > stable/9/ (props changed) > stable/9/sys/ (props changed) [snip] The last two lines look incorrect. Are you following http://wiki.freebsd.org/SubversionPrimer/Merging ? Namely, this change should have been svn-merged to the 'sys' sub-directory. -- Andriy Gapon From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 22:17: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 42EC3106566C; Mon, 16 Jan 2012 22:17:13 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 276C48FC0A; Mon, 16 Jan 2012 22:17: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 q0GMHDAB054168; Mon, 16 Jan 2012 22:17:13 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0GMHDCe054163; Mon, 16 Jan 2012 22:17:13 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201201162217.q0GMHDCe054163@svn.freebsd.org> From: Baptiste Daroussin Date: Mon, 16 Jan 2012 22:17: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: r230237 - in stable/9: contrib/gperf contrib/gperf/doc contrib/gperf/lib contrib/gperf/src contrib/gperf/tests gnu/usr.bin/gperf 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: Mon, 16 Jan 2012 22:17:13 -0000 Author: bapt Date: Mon Jan 16 22:17:12 2012 New Revision: 230237 URL: http://svn.freebsd.org/changeset/base/230237 Log: MFC r228060, r228068, r228060 Upgrade gperf to 3.0.3 latest GPLv2 version Approved by: des (mentor) Added: stable/9/contrib/gperf/configure.ac - copied unchanged from r228060, head/contrib/gperf/configure.ac stable/9/contrib/gperf/doc/configure.ac - copied unchanged from r228060, head/contrib/gperf/doc/configure.ac stable/9/contrib/gperf/lib/configure.ac - copied unchanged from r228060, head/contrib/gperf/lib/configure.ac stable/9/contrib/gperf/lib/getline.cc - copied unchanged from r228060, head/contrib/gperf/lib/getline.cc stable/9/contrib/gperf/lib/getline.h - copied unchanged from r228060, head/contrib/gperf/lib/getline.h stable/9/contrib/gperf/src/config.h_vms - copied unchanged from r228060, head/contrib/gperf/src/config.h_vms stable/9/contrib/gperf/src/configure.ac - copied unchanged from r228060, head/contrib/gperf/src/configure.ac stable/9/contrib/gperf/src/input.cc - copied unchanged from r228060, head/contrib/gperf/src/input.cc stable/9/contrib/gperf/src/input.h - copied unchanged from r228060, head/contrib/gperf/src/input.h stable/9/contrib/gperf/src/keyword-list.cc - copied unchanged from r228060, head/contrib/gperf/src/keyword-list.cc stable/9/contrib/gperf/src/keyword-list.h - copied unchanged from r228060, head/contrib/gperf/src/keyword-list.h stable/9/contrib/gperf/src/keyword-list.icc - copied unchanged from r228060, head/contrib/gperf/src/keyword-list.icc stable/9/contrib/gperf/src/keyword.cc - copied unchanged from r228060, head/contrib/gperf/src/keyword.cc stable/9/contrib/gperf/src/keyword.h - copied unchanged from r228060, head/contrib/gperf/src/keyword.h stable/9/contrib/gperf/src/keyword.icc - copied unchanged from r228060, head/contrib/gperf/src/keyword.icc stable/9/contrib/gperf/src/output.cc - copied, changed from r228060, head/contrib/gperf/src/output.cc stable/9/contrib/gperf/src/output.h - copied unchanged from r228060, head/contrib/gperf/src/output.h stable/9/contrib/gperf/src/positions.cc - copied unchanged from r228060, head/contrib/gperf/src/positions.cc stable/9/contrib/gperf/src/positions.h - copied unchanged from r228060, head/contrib/gperf/src/positions.h stable/9/contrib/gperf/src/positions.icc - copied unchanged from r228060, head/contrib/gperf/src/positions.icc stable/9/contrib/gperf/src/search.cc - copied unchanged from r228060, head/contrib/gperf/src/search.cc stable/9/contrib/gperf/src/search.h - copied unchanged from r228060, head/contrib/gperf/src/search.h Replaced: stable/9/contrib/gperf/doc/gperf.texi - copied unchanged from r228068, head/contrib/gperf/doc/gperf.texi stable/9/contrib/gperf/doc/gpl.texinfo - copied unchanged from r228068, head/contrib/gperf/doc/gpl.texinfo Deleted: stable/9/contrib/gperf/acconfig.h stable/9/contrib/gperf/configure.in stable/9/contrib/gperf/doc/configure.in stable/9/contrib/gperf/doc/texinfo.tex stable/9/contrib/gperf/lib/configure.in stable/9/contrib/gperf/src/configure.in stable/9/contrib/gperf/src/gen-perf.cc stable/9/contrib/gperf/src/gen-perf.h stable/9/contrib/gperf/src/iterator.cc stable/9/contrib/gperf/src/iterator.h stable/9/contrib/gperf/src/key-list.cc stable/9/contrib/gperf/src/key-list.h stable/9/contrib/gperf/src/list-node.cc stable/9/contrib/gperf/src/list-node.h stable/9/contrib/gperf/src/new.cc stable/9/contrib/gperf/src/read-line.cc stable/9/contrib/gperf/src/read-line.h stable/9/contrib/gperf/src/read-line.icc stable/9/contrib/gperf/src/trace.cc stable/9/contrib/gperf/src/trace.h stable/9/contrib/gperf/src/vectors.cc stable/9/contrib/gperf/src/vectors.h stable/9/contrib/gperf/tests/ Modified: stable/9/contrib/gperf/AUTHORS stable/9/contrib/gperf/COPYING stable/9/contrib/gperf/ChangeLog stable/9/contrib/gperf/FREEBSD-Xlist stable/9/contrib/gperf/INSTALL stable/9/contrib/gperf/Makefile.devel stable/9/contrib/gperf/Makefile.in stable/9/contrib/gperf/NEWS stable/9/contrib/gperf/README stable/9/contrib/gperf/aclocal.m4 stable/9/contrib/gperf/configure stable/9/contrib/gperf/doc/Makefile.in stable/9/contrib/gperf/doc/configure stable/9/contrib/gperf/doc/gperf.1 stable/9/contrib/gperf/doc/help2man stable/9/contrib/gperf/lib/Makefile.in stable/9/contrib/gperf/lib/configure stable/9/contrib/gperf/lib/hash.cc stable/9/contrib/gperf/lib/hash.h stable/9/contrib/gperf/src/Makefile.in stable/9/contrib/gperf/src/bool-array.cc stable/9/contrib/gperf/src/bool-array.h stable/9/contrib/gperf/src/bool-array.icc stable/9/contrib/gperf/src/config.h.in stable/9/contrib/gperf/src/configure stable/9/contrib/gperf/src/hash-table.cc stable/9/contrib/gperf/src/hash-table.h stable/9/contrib/gperf/src/main.cc stable/9/contrib/gperf/src/options.cc stable/9/contrib/gperf/src/options.h stable/9/contrib/gperf/src/options.icc stable/9/contrib/gperf/src/version.cc stable/9/contrib/gperf/src/version.h stable/9/gnu/usr.bin/gperf/Makefile stable/9/gnu/usr.bin/gperf/config.h stable/9/sys/sys/param.h Directory Properties: stable/9/contrib/gperf/ (props changed) stable/9/gnu/usr.bin/gperf/ (props changed) Modified: stable/9/contrib/gperf/AUTHORS ============================================================================== --- stable/9/contrib/gperf/AUTHORS Mon Jan 16 21:50:20 2012 (r230236) +++ stable/9/contrib/gperf/AUTHORS Mon Jan 16 22:17:12 2012 (r230237) @@ -1,2 +1,2 @@ Douglas C. Schmidt -Bruno Haible +Bruno Haible Modified: stable/9/contrib/gperf/COPYING ============================================================================== --- stable/9/contrib/gperf/COPYING Mon Jan 16 21:50:20 2012 (r230236) +++ stable/9/contrib/gperf/COPYING Mon Jan 16 22:17:12 2012 (r230237) @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307, + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Modified: stable/9/contrib/gperf/ChangeLog ============================================================================== --- stable/9/contrib/gperf/ChangeLog Mon Jan 16 21:50:20 2012 (r230236) +++ stable/9/contrib/gperf/ChangeLog Mon Jan 16 22:17:12 2012 (r230237) @@ -1,3 +1,1646 @@ +2007-04-30 Brendan Kehoe + + * gperf-3.0.3 released. + * src/version.cc: Bump to 3.0.3. + * tests/*.exp: Bump to 3.0.3 in header. + * doc/gperf.1: Regenerate with gperf 3.0.3. + +2007-04-06 Bruno Haible + + Improve support for mingw. + * tests/Makefile.in (check-c, check-ada, check-modula3, check-pascal, + check-lang-utf8, check-lang-ucs2): Remove '\r' from output before diff. + (POSTPROCESS_FOR_MINGW): New variable. + (check-test): Use it to postprocess output before diff. + +2007-04-04 Bruno Haible + + Support for newer GNU standards. + * doc/configure.ac (mandir): Remove assignment. + * doc/Makefile.in (datarootdir): New variable. + (docdir, dvidir, psdir, pdfdir, htmldir): Use value determined by + autoconf. + * configure.ac: Require autoconf >= 2.60. + * doc/configure.ac: Likewise. + * lib/configure.ac: Likewise. + * src/configure.ac: Likewise. + * tests/configure.ac: Likewise. + * configure: Regenerated with autoconf-2.61. + * doc/configure: Likewise. + * lib/configure: Likewise. + * src/configure: Likewise. + * tests/configure: Likewise. + * src/config.h.in: Likewise. + * src/config.h.msvc: Likewise. + * src/config.h_vms: Likewise. + +2007-04-04 Bruno Haible + + * doc/Makefile.in (MAKEINFO): Disable also the LC_MESSAGES and LC_ALL + environment variables. + +2007-04-04 Bruno Haible + + * configure.ac: Renamed from configure.in. + * doc/configure.ac: Renamed from doc/configure.in. + * lib/configure.ac: Renamed from lib/configure.in. + * src/configure.ac: Renamed from src/configure.in. + * tests/configure.ac: Renamed from tests/configure.in. + * Makefile.devel: Update. + * INSTALL: Update. + +2007-03-31 Bruno Haible + + * tests/test.c (in_word_set): New declaration. + * tests/test2.c (in_word_set): Likewise. + +2007-03-31 Bruno Haible + + * src/options.cc (Options::parse_options): Bump copyright year. + +2007-03-31 Bruno Haible + + * doc/gperf.texi: Fix typo. + +2007-03-31 Bruno Haible + + Change generated code after the meaning of __inline is changed in + GCC 4.3. + * src/output.cc (Output::output_lookup_function): Emit an inline + marker that also works with gcc-4.3 in c99 or gnu99 mode. + * tests/c-parse.exp, tests/charsets.exp, tests/chill.exp, + tests/cplusplus.exp, tests/gpc.exp, tests/incomplete.exp, + tests/java.exp, tests/languages.exp, tests/modula2.exp, + tests/objc.exp, tests/permut2.exp, tests/permut3.exp, + tests/permutc2.exp, tests/test-4.exp: Update. + Reported by Bruce Korb . + +2006-06-29 Brendan Kehoe + + * gperf-3.0.2 released. + + * doc/Makefile.in (all): No longer depend on dvi. + +2006-01-22 Brendan Kehoe + + * doc/gperf.texi: Update copyright to be 1989-2006. + (UPDATED): Change to 22 January 2006. + * doc/gperf.1 (TH): Fix date. + * configure.in: Update copyright years. + * configure: Regenerate. + * src/Makefile.in: Update copyright years. + + * doc/gperf.{dvi,ps,pdf}: Regenerated by manually invoking tex + instead of trying to use texi2dvi, whose run of etex ends up + actually always running pdfetex, thus always recreating gperf.pdf. + +2006-01-13 Brendan Kehoe + + * NEWS: Add note about #line directive fix. + * doc/gperf.1: Regenerate with Makefile.devel. + + * doc/gperf.texi (UPDATED): Correct to be today. + * doc: Regenerated by doing make in a configured tree. + Requires makeinfo, texi2dvi, texi2pdf, and texi2html. + + * configure.in: Add AC_OBJEXT and AC_EXEEXT. + * lib/Makefile.in (OBJEXT): Define for subst. + (OBJECTS): Use $(OBJEXT) instead of '.o'. + * src/Makefile.in: Make dependencies use $(OBJEXT). + (OBJEXT, EXEEXT): Define for subst. + (TARGETPROG): Add $(EXEEXT). + (OBJECTS): Use $(OBJEXT) instead of '.o'. + (clean): Remove *.$(OBJEXT) instead of *.o. + +2006-01-13 Bruno Haible + + Fix #line directives for filenames containing backslashes. + * src/output.cc (output_line_directive): New function. + (output_keyword_entry, Output::output): Use it. + Reported by Alexander . + + * src/options.cc (Options::parse_options): Update years in --version + output. + +2005-08-29 Brendan Kehoe + + * src/keyword.cc: Tweak comment to avoid nesting. + +2005-08-27 Bruno Haible + + Fix missing ranlib detection when cross-compiling. + * aclocal.m4 (CL_PROG_RANLIB): Remove macro. + * lib/configure.in: Use AC_PROG_RANLIB instead of CL_PROG_RANLIB. + +2005-07-30 Bruno Haible + + * src/version.cc: Bump version number to 3.0.2. + * doc/gperf.texi: Likewise. + * tests/c-parse.exp, tests/charsets.exp, tests/chill.exp, + tests/cplusplus.exp, tests/gpc.exp, tests/incomplete.exp, + tests/java.exp, tests/languages.exp, tests/modula2.exp, + tests/objc.exp, tests/permut2.exp, tests/permut3.exp, + tests/permutc2.exp, tests/test-4.exp: Update. + +2005-07-30 Bruno Haible + + * src/positions.h: Add forward declarations of friend classes. + Needed for compilation with g++ 4.0. + +2004-08-22 Bruno Haible + + * tests/Makefile.in (check-lang-syntax): Add test for the + --length-table-name option. + * tests/test-6.exp: Update. + +2004-08-21 Bruce Lilly + + * src/input.cc (Input::read_input): Accept length-table-name + declaration. + * src/options.h (Options::get_lengthtable_name, + Options::set_lengthtable_name): New declarations. + (Options): Add field _lengthtable_name. + * src/options.icc (Options::get_lengthtable_name): New inline method. + * src/options.cc (DEFAULT_LENGTHTABLE_NAME): New constant. + (Options::long_usage): Document --length-table-name option. + (Options::Options): Initialize _lengthtable_name field. + (Options::~Options): Update. + (Options::set_lengthtable_name): New method. + (long_options): Add option --length-table-name. + (Options::parse_options): Implement --length-table-name option. + * src/output.cc (Output::output_keylength_table, output_switch_case, + Output::output_lookup_function_body): Use option.get_lengthtable_name. + * doc/gperf.texi (Gperf Declarations): Document %define + length-table-name. + (Output Details): Document --length-table-name option. + +2003-06-12 Bruno Haible + + * gperf-3.0.1 released. + + * src/version.cc: Bump version number to 3.0.1. + * doc/gperf.texi: Likewise. + * tests/c-parse.exp, tests/charsets.exp, tests/chill.exp, + tests/cplusplus.exp, tests/gpc.exp, tests/incomplete.exp, + tests/java.exp, tests/languages.exp, tests/modula2.exp, + tests/objc.exp, tests/permut2.exp, tests/permut3.exp, + tests/permutc2.exp, tests/test-4.exp: Update. + +2003-05-31 Bruno Haible + + * doc/gperf.texi (User-supplied Struct): Mention the possibility of an + abbreviated struct declaration. + * src/input.cc (Input::read_input): Support struct declarations of the + form "struct foo;". + * tests/incomplete.gperf: New file. + * tests/incomplete.exp: New file. + * tests/Makefile.in (check-test): Check incomplete.gperf too. + Reported by Rob Leslie . + +2003-05-20 Bruno Haible + + * doc/Makefile.in (gperf.ps): Don't use $< in a target rule. + +2003-05-27 Bruno Haible + + * Makefile.vms (CC): Correct value. + (getopt.obj, getopt1.obj, getline.obj, hash.obj): Don't set + HAVE_CONFIG_H. + +2003-05-17 Bruno Haible + + * Makefile.msvc (DEBUGFLAGS): New variable. + (gperf.exe): Use it, and MFLAGS too. + +2003-05-08 Bruno Haible + + * gperf-3.0 released. + +2003-05-07 Bruno Haible + + * src/version.cc: Bump version number to 3.0. + * doc/gperf.texi: Likewise. + * tests/c-parse.exp, tests/charsets.exp, tests/chill.exp, + tests/cplusplus.exp, tests/gpc.exp, tests/java.exp, + tests/languages.exp, tests/modula2.exp, tests/objc.exp, + tests/permut2.exp, tests/permut3.exp, tests/permutc2.exp, + tests/test-4.exp: Update. + + * src/configure.in: Fix AC_INIT argument. + + * Makefile.devel (configure, lib/configure, src/configure, + tests/configure, doc/configure): Use the newest autoconf. + (src/config.h.in): Use the newest autoheader. + +2003-05-03 Bruno Haible + + * doc/gperf.texi: Use two spaces as sentence separator, as recommended + by the texinfo manual. + +2003-04-12 Bruno Haible + + * doc/configure.in (mandir): Change default value. + * doc/Makefile.in (docdir): Use datadir instead of prefix. + * Makefile.msvc (datadir): New variable. + (mandir, docdir): Use it instead of prefix. + (install, installdirs): Update. + * Makefile.vms (datadir): New variable. + (mandir, docdir): Use it instead of prefix. + (install, installdirs): Update. + +2003-04-12 Bruno Haible + + * README.vms: New file. + * Makefile.vms: New file. + * Makefile.devel (src/config.h_vms): New rule. + (all): Depend on it. + +2003-03-19 Bruno Haible + + * src/input.cc (Input::read_input): Ignore comments at the beginning + of the declarations section. + * doc/gperf.texi (Controls for GNU indent): New section. + Reported by Bruce Lilly . + +2003-03-19 Bruno Haible + + * src/output.cc (Output::output_hash_function): Avoid lint warning if + not all arguments of the hash function are used. Avoid lint warning + for fallthrough in switch. + * tests/c-parse.exp, tests/charsets.exp, tests/chill.exp, + tests/cplusplus.exp, tests/java.exp, tests/languages.exp, + tests/modula2.exp, tests/objc.exp: All /*FALLTHROUGH*/ to expected + output. + Reported by Bruce Lilly . + +2003-03-01 Bruno Haible + + * src/options.h (Options::set_initializer_suffix): New declaration. + * src/options.cc (Options::set_initializer_suffix): New method. + * src/input.cc (Input::read_input): Recognize %define + initializer-suffix. + * doc/gperf.texi (Gperf Declarations): Document %define + initializer-suffix. + * NEWS: Update. + +2003-02-26 Bruno Haible + + * Makefile.msvc: New file. + * README.woe32: New file. + * Makefile.devel (all): Depend on src/config.h.msvc. + (src/config.h.msvc): New rule. + +2003-01-07 Bruno Haible + + * src/input.h (Input::_charset_dependent): New field. + * src/input.cc (Input::read_input): Also set _charset_dependent. + * src/main.cc (main): Pass _charset_dependent from Input to Output. + * src/output.h (Output::Output): Add charset_dependent argument. + (Output::_charset_dependent): New field. + * src/output.cc (Output::Output): Add charset_dependent argument. + (Output::output): Provoke a compilation error if the execution + character set doesn't match the expectations. + * tests/c-parse.exp, tests/charsets.exp, tests/chill.exp, + tests/cplusplus.exp, tests/gpc.exp, tests/java.exp, + tests/languages.exp, tests/modula2.exp, tests/objc.exp, + tests/permut2.exp, tests/permut3.exp, tests/permutc2.exp, + tests/test-4.exp: Update. + + * src/options.cc (Options::long_usage): Change bug report address to + . + * tests/test-6.exp: Update. + + * src/output.cc (USE_DOWNCASE_TABLE): New macro. + (output_upperlower_table): New function. + (output_upperlower_strcmp, output_upperlower_strncmp, + output_upperlower_memcmp): Emit gperf_downcase array accesses. + (Output::output): Call output_upperlower_table. + * tests/permutc2.exp: Update. + + * src/keyword-list.icc (KeywordExt_List::rest): Use a portable cast. + (Only in GCC a cast of an lvalue is an lvalue.) + +2003-01-01 Bruno Haible + + * src/options.cc (Options::parse_options): Update copyright year. + + * doc/gperf.texi (@author): Add me. + + * src/options.h (NULLSTRINGS): New enum value. + (Options::get_stringpool_name, Options::set_stringpool_name): New + method declarations. + (Options::_stringpool_name): New field. + * src/options.icc (Options::get_stringpool_name): New method. + * src/options.cc (DEFAULT_STRINGPOOL_NAME): New variable. + (Options::long_usage): Document -Q and --null-strings. + (Options::Options): Initialize _stringpool_name. + (Options::~Options): Output _stringpool_name, NULLSTRINGS values too. + (Options::set_stringpool_name): New method. + (long_options): Add options --string-pool-name, --null-strings. + (Options::parse_options): Implement options -P, -Q and --null-strings. + * src/input.cc (Input::read_input): Recognize declarations %pic, + %define string-pool-name, %null-strings. + * src/output.h (Output::output_string_pool, + Output::output_lookup_pools): New method declarations. + (Output::_wordlist_eltype): New field. + * src/output.cc (Output::output_keylength_table): Trivial + simplification. + (Output::output_string_pool): New method. + (output_keyword_entry): Add stringpool_index argument. For SHAREDLIB, + use struct offsets. + (output_keyword_blank_entries): For SHAREDLIB, use -1 instead of "". + (Output::output_keyword_table): Use _wordlist_eltype instead of + _struct_tag. Compute stringpool_index for output_keyword_entry. + (Output::output_lookup_pools): New method. + (Output::output_lookup_function_body): Use _wordlist_eltype instead of + _struct_tag. For SHAREDLIB, use "+ stringpool" to convert offsets to + strings. Use "o >= 0" to test for nonempty table entry. + (Output::output_lookup_function): Call output_lookup_pools. + (Output::output): Initialize _wordlist_eltype. Call + output_lookup_pools. + * tests/jstest4.gperf: New file. + * tests/test-6.exp: Update. + * tests/Makefile.in (check-lang-syntax): Drop test of -p. Add tests of + -P and -Q. + * doc/gperf.texi (User-supplied Struct): Mention that first field has + to be of type 'int' if -P is given. + (Gperf Declarations): Document %pic, %define string-pool-name, + %null-strings. + (Output Details): Update description of option -P. Document options -Q + and --null-strings. + + * tests/Makefile.in (check-link-c, check-ada, check-pascal, + check-test): Omit option -p. + * tests/c-parse.exp: Regenerated. + * tests/chill.exp: Regenerated. + * tests/cplusplus.exp: Regenerated. + * tests/gpc.exp: Regenerated. + * tests/java.exp: Regenerated. + * tests/objc.exp: Regenerated. + * tests/test-4.exp: Regenerated. + + * src/output.cc (Output::output_lookup_function_body): Omit the + multicompare code section and its variables when it is not used. + * tests/chill.exp: Regenerated. + + * src/output.c (Output_Compare::output_firstchar_comparison): New + method. + (Output_Compare_Strcmp::output_comparison, + Output_Compare_Strncmp::output_comparison, + Output_Compare_Memcmp::output_comparison): Use it. + * tests/permutc2.exp: Update. + + * tests/smtp.gperf: New file, based on a contribution by Bruce Lilly. + * tests/Makefile.in (check-smtp): New rule. + (check): Depend on it. + (clean): Update. + +2002-12-12 Bruno Haible + + * src/search.h (Search::init_selchars_tuple, + Search::count_duplicates_tuple): Add alpha_unify argument. + (Search::count_duplicates_tuple): New method declaration. + * src/search.cc (Search::init_selchars_tuple, + Search::count_duplicates_tuple): Add alpha_unify argument. + (Search::find_positions): Update. + (Search::count_duplicates_tuple): New method. + (Search::count_duplicates_multiset): Free temp alpha_unify vector. + (Search::find_alpha_inc): Call count_duplicates_tuple. + + * src/configure.in: Add test for stack-allocated variable-size arrays. + * src/config.h.in: Regenerated. + * src/search.cc: Include config.h. + (DYNAMIC_ARRAY, FREE_DYNAMIC_ARRAY): New macros. + (Search::find_alpha_inc, Search::count_possible_collisions, + Search::find_asso_values): Use them. + * src/Makefile.in (search.o): Depend on config.h. + + * src/search.h (Search::keyword_list_length, Search::max_key_length, + Search::get_max_keysig_size, Search::prepare): Remove declarations. + (Search::prepare): Renamed from Search::preprepare. + (Search::_max_selchars_length): New field. + * src/search.cc (Search::prepare): Renamed from Search::preprepare. + (Search::prepare_asso_values): Merged with old Search::prepare. + Initialize _max_selchars_length. + (Search::keyword_list_length): Remove function. Use _list_len instead. + (Search::max_key_length): Remove function. Use _max_key_len instead. + (Search::get_max_keysig_size): Remove function. Use + _max_selchars_length instead. + (Search::count_possible_collisions, Search::find_asso_values): Update. + (Search::find_good_asso_values): Call just prepare_asso_values. + (Search::~Search): Update. + + * src/output.h (Output::output_asso_values_ref): New declaration. + * src/output.cc (char_to_index): Remove variable. + (Output::output_asso_values_ref): New function. + (Output::output_hash_function): Use it. + (Output::output): Update. + + * src/positions.h (Positions::is_useall, Positions::set_useall, + Positions::iterator, Positions::reviterator): New method declarations. + (Positions::_useall): New field. + (PositionIterator): Make constructor private. Add a constructor and a + copy constructor. + (PositionIterator::remaining): New declaration. + (PositionReverseIterator): Make constructor private. Add a constructor + and a copy constructor. + (PositionReverseIterator::remaining): New declaration. + (PositionReverseIterator::_minindex): New field. + * src/positions.icc (Positions::Positions): Initialize _useall. + (Positions::operator=): Likewise. + (Positions::is_useall, Positions::set_useall): New methods. + (Positions::sort): Do nothing if _useall is set. + (Positions::iterator, Positions::reviterator): New methods. + (PositionIterator::PositionIterator): New constructor. + (PositionIterator::remaining): New method. + (PositionReverseIterator::PositionReverseIterator): New constructor. + (PositionReverseIterator::next): Use _minindex as bound. + (PositionReverseIterator::remaining): New method. + * src/positions.cc (Positions::add, Positions::remove): Reset the + useall flag. + (Positions::print): Handle the useall case. + * src/options.h (ALLCHARS): Remove. + * src/options.cc (Options::~Options): Update. + (Options::parse_options): Use Positions::set_useall(). + * src/keyword.h (KeywordExt::init_selchars_tuple, + KeywordExt::init_selchars_multiset, KeywordExt::init_selchars_low): + Remove use_all_chars argument. + * src/keyword.cc (KeywordExt::init_selchars_low): Remove use_all_chars + argument. Tell the position iterator to stop at _allchars_length. + Remove special case code for -k'*'. + (KeywordExt::init_selchars_tuple, KeywordExt::init_selchars_multiset): + Remove use_all_chars argument. + * src/search.h (Search::init_selchars_tuple): Remove use_all_chars + argument. + (Search::init_selchars_multiset): Likewise. + * src/search.cc (Search::init_selchars_tuple): Remove use_all_chars + argument. + (Search::count_duplicates_tuple, Search::find_positions): Update. + (Search::compute_alpha_unify): Remove special case code for -k'*'. + (Search::init_selchars_multiset): Remove use_all_chars argument. + (Search::count_duplicates_multiset): Update. + (Search::find_alpha_inc): Remove special case code for -k'*'. + (Search::prepare): Update. + (Search::get_max_keysig_size): Update. + * src/output.cc (Output::output_hash_function): Remove special case + code for -k'*'. + * tests/chill.exp: Regenerated. + +2002-12-11 Bruno Haible + + Change the positions to be 0-based, instead of 1-based. + * src/positions.h (Positions::LASTCHAR): Set to -1. + (Positions::MAX_SIZE): New constant. + (Positions::pointer): Change return type. + (Positions::_positions): Change element type. + (PositionIterator::EOS, PositionReverseIterator::EOS): Set to -2. + * src/positions.icc (Positions::pointer): Change return type. + (Positions::sort): Update. + * src/positions.cc (Positions::contains, Positions::add, + Positions::remove): Update. + (Positions::print): Update. Fix off-by-one bug. + * src/options.cc (Options::~Options): Update. + (Options::parse_options): Set BAD_VALUE to -3. Update. + * src/keyword.cc (KeywordExt::init_selchars_low): Update. + * src/search.cc (Search::find_positions, Search::compute_alpha_unify, + Search::find_alpha_inc): Update. + * src/output.cc (Output::output_hash_function): Update. Don't emit + a 'case' statement right after 'default:'. + * tests/c-parse.exp: Regenerated. + * tests/charsets.exp: Regenerated. + * tests/cplusplus.exp: Regenerated. + * tests/java.exp: Regenerated. + * tests/languages.exp: Regenerated. + * tests/modula2.exp: Regenerated. + * tests/objc.exp: Regenerated. + +2002-12-10 Bruno Haible + + * src/options.h: Reorder enum values. + (Options::short_usage, Options::long_usage): Make static. + * src/options.cc (Options::short_usage); No longer print a monster + usage line. + (Options::print_options): Improve output of options like + --key-positions=1,2,$. + (Options::~Options): Update. + + * src/options.h (UPPERLOWER): New enum value. + * src/options.cc (Options::long_usage): Document option --ignore-case. + (Options::~Options): Update. + (long_options): Add option --ignore-case. + (Options::parse_options): Handle option --ignore-case. + * src/input.cc (Input::read_input): Recognize option %ignore-case. + * src/keyword.h (KeywordExt::init_selchars_tuple, + KeywordExt::init_selchars_multiset, KeywordExt::init_selchars_low): + Add alpha_unify argument. + * src/keyword.cc (KeywordExt::init_selchars_low): Add alpha_unify + argument. + (KeywordExt::init_selchars_tuple): Add alpha_unify argument. + (KeywordExt::init_selchars_multiset): Add alpha_unify argument. + * src/search.h (Search::compute_alpha_size, + Search::compute_alpha_unify): New declarations. + (Search::init_selchars_multiset): Add alpha_unify argument. + (Search::_alpha_unify): New field. + * src/search.cc (Search::compute_alpha_size, + Search::compute_alpha_unify): New functions. + (Search::init_selchars_tuple): Update. + (Search::find_positions): Temporarily set _alpha_unify. Perform a + case insensitive comparison if needed. + (Search::init_selchars_multiset): Add alpha_unify argument. + (Search::count_duplicates_multiset): Call compute_alpha_unify. + (Search::find_alpha_inc): Temporarily set _alpha_unify. At the end, + set _alpha_size and _alpha_unify. + (Search::prepare): Update. Don't compute _alpga_size here. + (Search::optimize): Propagate unified asso_values. + (Search::~Search) Delete _alpha_unify. + * src/output.cc (output_upperlower_strcmp, output_upperlower_strncmp, + output_upperlower_memcmp): New functions. + (Output_Compare_Strcmp::output_comparison, + Output_Compare_Strncmp::output_comparison, + Output_Compare_Memcmp::output_comparison): Use the case-insensitive + comparison function if --ignore-case was given. + (Output::output): Emit the auxiliary case-insensitive comparison + function if needed. + * tests/permutc2.gperf, tests/permutc2.exp: New files. + * tests/Makefile.in (check-test): Also check permutc2.gperf. + * tests/test-6.exp: Update. + * doc/gperf.texi (Gperf Declarations): Document %ignore-case. + (Input Details): Document option --ignore-case. + * NEWS: Update. + + * src/search.cc (Search::optimize): Fill unused asso_values[] entries + with a large value. + * src/output.h (Output::Output): Remove occurrences argument. + (Output::_occurrences): Remove field. + * src/output.cc (Output::Output): Remove occurrences argument. + (Output::output_hash_function): Ignore _occurrences. + * src/main.cc (main): Don't pass the _occurrences to Output. + + * src/search.cc (Search::preprepare): Exit if keywords contain + out-of-range characters. + + * src/search.cc (for): Define so as to avoid errors with old compilers. + + * src/options.h (SHAREDLIB): New enum value. + * src/options.cc (Options::short_usage): Mention option -P. + (Options::long_usage): Document option -P. + (long_options): Add option --pic. + (Options::parse_options): Handle option -P/--pic. + * src/output.cc (output_keyword_blank_entries): When SHAREDLIB is + specified, emit NULL pointers instead of "". + (Output::output_lookup_function_body): When SHAREDLIB is specified + and SWITCH and DUP and not specified, test the table entry against + NULL before the string comparison. + * tests/test-6.exp: Update. + * doc/gperf.texi (Output Details): Document option -P. + * NEWS: Update. + Suggested by Ulrich Drepper. + +2002-12-08 Bruno Haible + + * tests/permut2.gperf, tests/permut2.exp: New files. + * tests/permut3.gperf, tests/permut3.exp: New files. + * tests/charsets.gperf: New file, from Bruce Lilly. + * tests/charsets.exp: New file. + * tests/languages.gperf: New file, from Bruce Lilly. + * tests/languages.exp: New file. + * Makefile.in (check-test): Test them all. + + Completely new asso_values search algorithm. + * src/search.h (Search::compute_occurrence, Search::clear_determined, + Search::set_determined, Search::already_determined, Search::reorder): + Remove functions. + (Search::init_asso_values, Search::sort_by_occurrence, + Search::compute_occurrence, Search::sort_by_occurrence, + Search::has_collisions, Search::collision_prior_to): Remove functions. + (Search::compute_partition, Search::count_possible_collisions, + Search::unchanged_partition): New method declarations. + (Search::_determined): Remove field. + * src/search.cc (Search::prepare): Don't initialize _determined. + (Search::compute_occurrence, greater_by_occurrence, + Search::clear_determined, Search::set_determined, + Search::already_determined, Search::reorder): Remove functions. + (Search::init_asso_values, compute_disjoint_union, + Search::sort_by_occurrence, Search::compute_occurrence, + Search::sort_by_occurrence, Search::has_collisions, + Search::collision_prior_to): Remove functions. + (StackEntry): Remove class. + (EquivalenceClass, Step): New classes. + (equals, Search::compute_partition, delete_partition, + Search::count_possible_collisions, Search::unchanged_partition): New + functions. + (Search::find_asso_values): Completely rewritten. + (Search::find_good_asso_values): Don't call reorder(). + (Search::~Search): Don't free _determined. + * src/keyword.h (KeywordExt::_occurrence): Remove field. + * src/options.h (ORDER, FAST, OPT_CHOICE): Remove enum values. + (Options::_iterations): Remove field. + * src/options.icc (Options::get_iterations): Remove method. + * src/options.cc (Options::long_usage): Remove mention of -f and -o. + (Options::Options): Don't initialize _iterations. + (Options::~Options): Update. + (Options::parse_options): Do nothing for options -f, -o, -O. + * doc/gperf.texi: (Contributors): Update. + (Algorithmic Details): Remove options -f and -o. Update description + of option -s. + * tests/c-parse.exp, tests/chill.exp, tests/cplusplus.exp, + tests/gpc.exp, tests/java.exp, tests/modula2.exp, tests/objc.exp, + tests/test-4.exp): Regenerated, smaller than before. + * tests/test-6.exp: Update. + * NEWS: Update. + +2002-12-08 Bruno Haible + + * src/search.h (Search::_alpha_size): Change type to 'unsigned int'. + (Search::_asso_value_max): Likewise. + * src/search.cc (Search::prepare_asso_values): Update. + (Search::init_asso_values): Update. + (Search::~Search): Update. + * src/output.h (Output::Output): Change alpha_size type to + 'unsigned int'. + (Output::_alpha_size): Change type to 'unsigned int'. + * src/output.cc (Output::Output): Change alpha_size type to + 'unsigned int'. + (Output::output_hash_function): Update. + +2002-12-07 Bruno Haible + + * src/options.h (OPT_CHOICE): New enum value. + * src/options.cc (Options::~Options): Update. + (long_options): New option --optimized-collision-resolution. + (Options::parse_options): Accept option -O. + * src/search.h (Search::sort_by_occurrence): Change argument to + 'unsigned int'. + (Search::compute_occurrence, Search::sort_by_occurrence): New method + declarations. + * src/search.cc (Search::sort_by_occurrence): Change argument to + 'unsigned int'. + (Search::compute_occurrence, Search::sort_by_occurrence): New methods. + (Search::find_asso_values): Implement OPT_CHOICE. More debugging + output. + + * src/search.cc (Search::prepare_asso_values) [DEBUG]: Also print + the keyword list in order. + (Search::find_asso_values) [DEBUG]: Upon failure, print the union_set. + + * src/options.h (Options::get_size_multiple): Change return type to + float. + (Options::_size_multiple): Change type to float. + * src/options.icc (Options::get_size_multiple): Change return type to + float. + * src/options.cc (Options::long_usage): Update description of option + -s. + (Options::~Options): Update. + (Options::parse_options): For option -s, accept a fraction. + * src/search.cc (Search::prepare_asso_values): Use get_size_multiple + as it is. + * tests/test-6.exp: Update. + * doc/gperf.texi (Algorithmic Details): Update description of option + -s. + +2002-12-04 Bruno Haible + + Improve debugging output. + * src/hash-table.h (Hash_Table::dump): New method. + * src/hash-table.cc (Hash_Table::dump): New method, extracted from + destructor. + (Hash_Table::~Hash_Table): No longer print the contents. + * src/positions.h (PositionReverseIterator): New class. + * src/positions.icc (PositionReverseIterator::PositionReverseIterator, + PositionReverseIterator::next): New methods. + * src/search.cc (Search::find_positions): If debugging, print the + result. + (Search::find_alpha_inc): If debugging, print the result. + (Search::prepare): Explicitly dump the hash table's contents here. + + Portability fixes. + * src/positions.h (Positions::LASTCHAR, Positions::MAX_KEY_POS, + PositionIterator::EOS): Define as compile-time constants using enum. + * src/bool-array.cc (Bool_Array::~Bool_Array): Remove const qualifier + of pointer to be deleted. + * src/input.cc (Input::~Input): Likewise. + * src/keyword.cc (KeywordExt::delete_selchars): Likewise. + * src/main.cc (main): Likewise. + * src/hash-table.cc (Hash_Table::~Hash_Table): Limit scope of 'for' + variables. + * src/search.cc (Search::prepare_asso_values): Use a static_cast to + convert from time_t to long. This is possible because ISO C 99 says + time_t is a numeric type. + +2002-11-20 Bruno Haible + + * src/search.cc (Search::find_asso_values): Avoid gcc warnings about + uninitialized variables. + + Implement backtracking. + * src/search.h (Search::has_collisions): Renamed from + Search::less_collisions. Return a boolean. + * src/search.cc (Search::has_collisions): Renamed from + Search::less_collisions. Return a boolean. + (StackEntry): Remove field _collisions_so_far. + (Search::find_asso_values): Backtrack when encountering an unresolved + collision. Assume collisions_so_far is always zero. + (Search::optimize): Exit if there are accidental duplicates at the end. + * src/output.cc (Output::num_hash_values): Simply return the list + length. + (Output::output_keylength_table): Remove handling of accidental + duplicates. + (Output::output_keyword_table, Output::output_lookup_array): Likewise. + (output_switch_case, output_switches): Likewise. + * doc/gperf.texi (Algorithmic Details): Adjust description of options + -D, -f, -o, -r. + (Bugs): Remove note about missing backtracking. + (Projects): Likewise. + +2002-11-19 Bruno Haible + + Prepare for backtracking. + * src/search.h (Search::try_asso_value, Search::change_some_asso_value): + Remove declarations. + (Search::less_collisions, Search::collision_prior_to): New declarations. + (Search::_fewest_collisions, Search::_union_set, Search::_num_done): + Remove fields. + * src/search.cc (Search::prepare_asso_values): Don't initialize + _union_set. + (Search::try_asso_value, Search::change_some_asso_value): Remove + methods. + (Search::less_collisions, Search::collision_prior_to): New methods. + (StackEntry): New class. + (Search::find_asso_values): Reorganized to use pseudo-recursion. + (Search::~Search): Don't free _union_set. + + * src/search.h (Search::find_good_asso_values): New declaration. + * src/search.cc: Add comments about the basic structure of the + algorithm. + (Search::find_positions): Move the option[POSITIONS] test to here. + (Search::find_good_asso_values): New method, extracted from + Search::optimize. + (Search::optimize): Remove option[POSITIONS] test. Call + find_good_asso_values. + +2002-11-17 Bruno Haible + + * src/options.cc (Options::parse_options): Include copyright notice + and authors in --version output. + + Avoid artificial duplicates. + * src/keyword.h (KeywordExt::init_selchars_tuple): New declaration. + (KeywordExt::init_selchars_multiset): Renamed from + KeywordExt::init_selchars. + (KeywordExt::init_selchars_low): New declaration. + * src/keyword.cc (KeywordExt::init_selchars_low): Renamed from + KeywordExt::init_selchars. Add alpha_inc argument. Remove sorting. + (KeywordExt::init_selchars_tuple): New method. + (KeywordExt::init_selchars_multiset): New method, replaces + KeywordExt::init_selchars. + * src/search.h (Search::init_selchars_tuple): Renamed from + Search::init_selchars. + (Search::count_duplicates_tuple): Renamed from Search::count_duplicates. + (Search::init_selchars_multiset, Search::count_duplicates_multiset, + Search::find_alpha_inc): New declarations. + (Search::_alpha_inc): New field. + (Search::_alpha_size, Search::_occurrences, Search::_asso_values, + Search::_determined): Make non-const. + * src/search.cc (Search::Search): Don't initialize _key_positions, + _alpha_size, _occurrences, _asso_values, _determined here. + (Search::init_selchars_tuple): Renamed from Search::init_selchars. + (Search::count_duplicates_tuple): Renamed from Search::count_duplicates. + (Search::find_positions): Update. + (Search::init_selchars_multiset, Search::count_duplicates_multiset, + Search::find_alpha_inc): New methods. + (Search::prepare): Move preprepare, find_positions calls away. + Initialize _alpha_size, _occurrences, _asso_values, _determined here. + (Search::optimize): Call preprepare, find_positions here. Initialize + _key_positions here. + (Search::~Search): Deallocate _alpha_inc. + * src/output.cc (Output::Output): Add alpha_inc argument. + (Output::output_hash_function): Use _alpha_inc. + * src/output.h (Output::Output): Add alpha_inc argument. + (Output::_alpha_inc): New field. + * src/main.cc (main): Pass _alpha_inc from Search to Output. + * tests/chill.exp: Update. + * doc/gperf.texi (Algorithmic Details): Remove description of + artificial duplicates. + + * src/keyword.h (KeywordExt::_selchars): Change type to + 'const unsigned int *'. + * src/keyword.cc (sort_char_set): Change argument type to + 'unsigned int *'. + (KeywordExt::init_selchars): Update. + * src/search.h (Search::sort_by_occurrence): Change argument type to + 'unsigned int *'. + (Search::try_asso_value): Change argument type to 'unsigned int'. + (Search::_union_set): Change type to 'unsigned int *'. + * src/search.cc (Search::prepare, Search::compute_occurrence, + Search::set_determined, Search::already_determined, + Search::prepare_asso_values, Search::compute_hash): Update. + (compute_disjoint_union): Change argument types to 'unsigned int *'. + (Search::sort_by_occurrence): Likewise. + (Search::try_asso_value): Change argument type to 'unsigned int'. + (Search::change_some_asso_value, Search::~Search): Update. + * src/hash-table.cc (Hash_Table::~Hash_Table, Hash_Table::equal, + Hash_Table::insert): Update. + + * src/positions.h: New file, extracted from options.h. + * src/positions.icc: New file, extracted from options.icc. + * src/positions.cc: New file, extracted from options.cc. + * src/options.h: Include positions.h. Move classes Positions and + PositionsIterator away. + * src/options.icc: Move classes Positions and PositionsIterator away. + * src/options.cc: Move class Positions away. + * src/keyword.cc: Include positions.h instead of options.h. + * src/output.h: Include positions.h instead of options.h. + * src/search.h: Include positions.h instead of options.h. + * src/Makefile.in (OBJECTS): Add positions.o. + (POSITIONS_H): New variable. + (OPTIONS_H, SEARCH_H, OUTPUT_H, keyword.o): Use it. + (positions.o): New rule. + + * src/options.h (POSITIONS): New enum value. + (Positions::Positions): New copy constructor. + (Positions::operator=, Positions::contains, Position::add, + Positions::remove, Positions::print): New method declaration. + (Options::get_max_keysig_size): Remove method. + * src/options.icc (Positions::Positions): New copy constructor. + (Positions::operator=): New method. + (Options::get_max_keysig_size): Remove method. + * src/options.cc (Options::Options): Initialize _key_positions + trivially. + (Options::parse_options): Option -k sets POSITIONS. + (Positions::contains, Positions::add, Positions::remove, + Positions::print): New methods. + * src/hash-table.cc (Hash_Table::~Hash_Table): Compute the field + width explicitly, instead of using Options::get_max_keysig_size. + * src/keyword.h (KeywordExt::init_selchars): Add arguments + use_all_chars, positions. + (KeywordExt::delete_selchars): New declaration. + * src/keyword.cc (KeywordExt::init_selchars): Add arguments + use_all_chars, positions. Remove error message if there are no key + positions. + (KeywordExt::delete_selchars): New method. + * src/search.h: Include options.h. + (Search::preprepare, Search::init_selchars, Search::delete_selchars, + Search::count_duplicates, Search::find_positions): New declarations. + (Search::_key_positions): New field. + * src/search.cc (Search::Search): Initialize _key_positions. + (Search::preprepare, Search::init_selchars, Search::delete_selchars, + Search::count_duplicates, Search::find_positions): New functions. + (Search::prepare): Call preprepare and find_positions. Tweak error + message. + (Search::get_max_keysig_size): Use _key_positions instead of + option.get_key_positions(). + (Search::optimize): Tweak error message. + * src/output.h: Include options.h. + (Output::Output): Add Positions argument. + (Output::_key_positions): New field. + * src/output.cc (Output::Output): Add Positions argument. + (Output::output_hash_function): Omit the table if there are no + positions at all. Use _key_positions instead of + option.get_key_positions(). + (Output::output): Output the computed positions as a comment. + * src/main.cc (main): Pass the Positions from Searcher to Output. + * src/Makefile.in (SEARCH_H, OUTPUT_H): Include OPTIONS_H. + * tests/Makefile.in (check-test): Pass key positions explicitly. + * tests/gpc.exp: Update. + * tests/test-4.exp: Update. + * doc/gperf.texi (Algorithmic Details): Mention that -k is not needed + usually. + +2002-11-16 Bruno Haible + + * src/options.h (Options::get_slot_name): Renamed from + Options::get_key_name. + (Options::set, Options::set_language, Options::set_total_switches, + Options::set_function_name, Options::set_slot_name, + Options::set_class_name, Options::set_hash_name, + Options::set_wordlist_name, Options::set_delimiters): New method + declarations. + (Options::_language): New field. + (Options::_slot_name): Renamed from Options::_key_name. + * src/options.icc (Options::set): New method. + (Options::get_slot_name): Renamed from Options::get_key_name. + * src/options.cc (DEFAULT_FUNCTION_NAME): Renamed from DEFAULT_NAME. + (DEFAULT_SLOT_NAME): Renamed from DEFAULT_NAME. + (Options::Options): Initialize _language. Update. + (Options::~Options): Update. + (Options::set_language, Options::set_total_switches, + Options::set_function_name, Options::set_slot_name, + Options::set_class_name, Options::set_hash_name, + Options::set_wordlist_name, Options::set_delimiters): New methods. + (Options::parse_options): Call set_language. Update. + * src/input.cc (is_declaration, is_declaration_with_arg, + is_define_declaration): New functions. + (Input::read_input): Accept %DECL declarations. + * src/output.cc (Output::output_lookup_function_body): Update. + * doc/gperf.texi (Declarations): Add new subnodes. + (User-supplied Struct, Gperf Declarations, C Code Inclusion): New + nodes. + (Keywords, Output Format, Binary Strings, Options): Mention % + declarations as being equivalent to the command line options. + + * src/options.cc (Options::long_usage): Rename options -H, -N, -l, -G. + (long_options): Add --hash-function-name, --lookup-function-name, + --compare-lengths. + * doc/gperf.texi (Output Details): Rename options -H, -N, -l, -G. + * tests/test-6.exp: Update. + + * src/options.cc (DEFAULT_DELIMITERS): Remove newline. + * src/options.cc (Options::long_usage): Change default --delimiters. + * doc/gperf.texi (Input Details): Likewise. + * tests/test-6.exp: Update. + + * doc/gperf.texi: Move description of option -l from section + Algorithmic Details to section Output Details. + * src/options.cc (Options::long_usage): Likewise. + * tests/test-6.exp: Update. + +2002-11-12 Bruno Haible + + * src/options.h (Output::get_output_file_name): New method. + (Output::_output_file_name): New field. + * src/options.icc (Options::get_output_file_name): New method. + * src/options.cc (Options::long_usage): Document option --output-file. + (Options::Options): Initialize _output_file_name. + (long_options): Add --output-file. + (Options::parse_options): Handle it. + * src/main.cc (main): Open the output file if given by name. + * doc/gperf.texi (Output File): New section. + * tests/test-6.exp: Update. + +2002-11-10 Bruno Haible + + * src/input.cc (pretty_input_file_name): New function. + (read_input): Use it in all error and warning messages. + + * src/keyword.h (Keyword::_lineno): New field. + * src/input.h (Input::_struct_decl_lineno): New field. + * src/input.cc (Input::read_input): Set _struct_decl_lineno. Fill + each keyword's _lineno field. + * src/main.cc (main): Pass _struct_decl_lineno from Input to Output. + * src/output.h (Output::Output) Add struct_decl_lineno argument. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 22:59: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 2D7EB106566C; Mon, 16 Jan 2012 22:59:24 +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 F2B3B8FC1A; Mon, 16 Jan 2012 22:59:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0GMxNwO055751; Mon, 16 Jan 2012 22:59:23 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0GMxN08055750; Mon, 16 Jan 2012 22:59:23 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201201162259.q0GMxN08055750@svn.freebsd.org> From: Jim Harris Date: Mon, 16 Jan 2012 22:59: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: r230240 - stable/9 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, 16 Jan 2012 22:59:24 -0000 Author: jimharris Date: Mon Jan 16 22:59:23 2012 New Revision: 230240 URL: http://svn.freebsd.org/changeset/base/230240 Log: Revert r229671 mergeinfo property from root directory. This was mistakenly added as part of r230223 MFC commit. Reviewed by: avg Approved by: sbruno Modified: Directory Properties: stable/9/ (props changed) From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 16 23:22:56 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 900411065672; Mon, 16 Jan 2012 23:22:56 +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 77A2D8FC0A; Mon, 16 Jan 2012 23:22: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 q0GNMuA6056880; Mon, 16 Jan 2012 23:22:56 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0GNMuFE056877; Mon, 16 Jan 2012 23:22:56 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201201162322.q0GNMuFE056877@svn.freebsd.org> From: Jim Harris Date: Mon, 16 Jan 2012 23:22: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: r230244 - in stable/9: sbin/geom/class/raid sys/geom/raid 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, 16 Jan 2012 23:22:56 -0000 Author: jimharris Date: Mon Jan 16 23:22:56 2012 New Revision: 230244 URL: http://svn.freebsd.org/changeset/base/230244 Log: MFC r229886: Add support for >2TB disks in GEOM RAID for Intel metadata format. Sponsored by: Intel Approved by: sbruno Modified: stable/9/sbin/geom/class/raid/graid.8 stable/9/sys/geom/raid/md_intel.c Directory Properties: stable/9/sbin/geom/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sbin/geom/class/raid/graid.8 ============================================================================== --- stable/9/sbin/geom/class/raid/graid.8 Mon Jan 16 23:22:42 2012 (r230243) +++ stable/9/sbin/geom/class/raid/graid.8 Mon Jan 16 23:22:56 2012 (r230244) @@ -251,7 +251,7 @@ complete it there. Do not run GEOM RAID class on migrating volumes under pain of possible data corruption! .Sh 2TiB BARRIERS -Intel and Promise metadata formats do not support disks above 2TiB. +Promise metadata format does not support disks above 2TiB. NVIDIA metadata format does not support volumes above 2TiB. .Sh EXIT STATUS Exit status is 0 on success, and non-zero if the command fails. Modified: stable/9/sys/geom/raid/md_intel.c ============================================================================== --- stable/9/sys/geom/raid/md_intel.c Mon Jan 16 23:22:42 2012 (r230243) +++ stable/9/sys/geom/raid/md_intel.c Mon Jan 16 23:22:56 2012 (r230244) @@ -64,7 +64,10 @@ struct intel_raid_map { uint8_t total_domains; uint8_t failed_disk_num; uint8_t ddf; - uint32_t filler_2[7]; + uint32_t offset_hi; + uint32_t disk_sectors_hi; + uint32_t stripe_count_hi; + uint32_t filler_2[4]; uint32_t disk_idx[1]; /* total_disks entries. */ #define INTEL_DI_IDX 0x00ffffff #define INTEL_DI_RBLD 0x01000000 @@ -111,7 +114,8 @@ struct intel_raid_vol { uint8_t fs_state; uint16_t verify_errors; uint16_t bad_blocks; - uint32_t filler_1[4]; + uint32_t curr_migr_unit_hi; + uint32_t filler_1[3]; struct intel_raid_map map[1]; /* 2 entries if migr_state != 0. */ } __packed; @@ -125,8 +129,9 @@ struct intel_raid_disk { #define INTEL_F_ASSIGNED 0x02 #define INTEL_F_FAILED 0x04 #define INTEL_F_ONLINE 0x08 - - uint32_t filler[5]; + uint32_t owner_cfg_num; + uint32_t sectors_hi; + uint32_t filler[3]; } __packed; struct intel_raid_conf { @@ -254,6 +259,82 @@ intel_get_volume(struct intel_raid_conf return (mvol); } +static off_t +intel_get_map_offset(struct intel_raid_map *mmap) +{ + off_t offset = (off_t)mmap->offset_hi << 32; + + offset += mmap->offset; + return (offset); +} + +static void +intel_set_map_offset(struct intel_raid_map *mmap, off_t offset) +{ + + mmap->offset = offset & 0xffffffff; + mmap->offset_hi = offset >> 32; +} + +static off_t +intel_get_map_disk_sectors(struct intel_raid_map *mmap) +{ + off_t disk_sectors = (off_t)mmap->disk_sectors_hi << 32; + + disk_sectors += mmap->disk_sectors; + return (disk_sectors); +} + +static void +intel_set_map_disk_sectors(struct intel_raid_map *mmap, off_t disk_sectors) +{ + + mmap->disk_sectors = disk_sectors & 0xffffffff; + mmap->disk_sectors_hi = disk_sectors >> 32; +} + +static void +intel_set_map_stripe_count(struct intel_raid_map *mmap, off_t stripe_count) +{ + + mmap->stripe_count = stripe_count & 0xffffffff; + mmap->stripe_count_hi = stripe_count >> 32; +} + +static off_t +intel_get_disk_sectors(struct intel_raid_disk *disk) +{ + off_t sectors = (off_t)disk->sectors_hi << 32; + + sectors += disk->sectors; + return (sectors); +} + +static void +intel_set_disk_sectors(struct intel_raid_disk *disk, off_t sectors) +{ + + disk->sectors = sectors & 0xffffffff; + disk->sectors_hi = sectors >> 32; +} + +static off_t +intel_get_vol_curr_migr_unit(struct intel_raid_vol *vol) +{ + off_t curr_migr_unit = (off_t)vol->curr_migr_unit_hi << 32; + + curr_migr_unit += vol->curr_migr_unit; + return (curr_migr_unit); +} + +static void +intel_set_vol_curr_migr_unit(struct intel_raid_vol *vol, off_t curr_migr_unit) +{ + + vol->curr_migr_unit = curr_migr_unit & 0xffffffff; + vol->curr_migr_unit_hi = curr_migr_unit >> 32; +} + static void g_raid_md_intel_print(struct intel_raid_conf *meta) { @@ -274,10 +355,11 @@ g_raid_md_intel_print(struct intel_raid_ printf("attributes 0x%08x\n", meta->attributes); printf("total_disks %u\n", meta->total_disks); printf("total_volumes %u\n", meta->total_volumes); - printf("DISK# serial disk_sectors disk_id flags\n"); + printf("DISK# serial disk_sectors disk_sectors_hi disk_id flags\n"); for (i = 0; i < meta->total_disks; i++ ) { - printf(" %d <%.16s> %u 0x%08x 0x%08x\n", i, + printf(" %d <%.16s> %u %u 0x%08x 0x%08x\n", i, meta->disk[i].serial, meta->disk[i].sectors, + meta->disk[i].sectors_hi, meta->disk[i].id, meta->disk[i].flags); } for (i = 0; i < meta->total_volumes; i++) { @@ -288,6 +370,7 @@ g_raid_md_intel_print(struct intel_raid_ printf(" state %u\n", mvol->state); printf(" reserved %u\n", mvol->reserved); printf(" curr_migr_unit %u\n", mvol->curr_migr_unit); + printf(" curr_migr_unit_hi %u\n", mvol->curr_migr_unit_hi); printf(" checkpoint_id %u\n", mvol->checkpoint_id); printf(" migr_state %u\n", mvol->migr_state); printf(" migr_type %u\n", mvol->migr_type); @@ -297,8 +380,11 @@ g_raid_md_intel_print(struct intel_raid_ printf(" *** Map %d ***\n", j); mmap = intel_get_map(mvol, j); printf(" offset %u\n", mmap->offset); + printf(" offset_hi %u\n", mmap->offset_hi); printf(" disk_sectors %u\n", mmap->disk_sectors); + printf(" disk_sectors_hi %u\n", mmap->disk_sectors_hi); printf(" stripe_count %u\n", mmap->stripe_count); + printf(" stripe_count_hi %u\n", mmap->stripe_count_hi); printf(" strip_sectors %u\n", mmap->strip_sectors); printf(" status %u\n", mmap->status); printf(" type %u\n", mmap->type); @@ -660,12 +746,15 @@ g_raid_md_intel_start_disk(struct g_raid continue; /* Make sure this disk is big enough. */ TAILQ_FOREACH(sd, &tmpdisk->d_subdisks, sd_next) { + off_t disk_sectors = + intel_get_disk_sectors(&pd->pd_disk_meta); + if (sd->sd_offset + sd->sd_size + 4096 > - (off_t)pd->pd_disk_meta.sectors * 512) { + disk_sectors * 512) { G_RAID_DEBUG1(1, sc, "Disk too small (%llu < %llu)", - ((unsigned long long) - pd->pd_disk_meta.sectors) * 512, + (unsigned long long) + disk_sectors * 512, (unsigned long long) sd->sd_offset + sd->sd_size + 4096); break; @@ -788,7 +877,7 @@ nofit: sd->sd_rebuild_pos = 0; } else { sd->sd_rebuild_pos = - (off_t)mvol->curr_migr_unit * + intel_get_vol_curr_migr_unit(mvol) * sd->sd_volume->v_strip_size * mmap0->total_domains; } @@ -815,7 +904,7 @@ nofit: sd->sd_rebuild_pos = 0; } else { sd->sd_rebuild_pos = - (off_t)mvol->curr_migr_unit * + intel_get_vol_curr_migr_unit(mvol) * sd->sd_volume->v_strip_size * mmap0->total_domains; } @@ -967,8 +1056,8 @@ g_raid_md_intel_start(struct g_raid_soft vol->v_sectorsize = 512; //ZZZ for (j = 0; j < vol->v_disks_count; j++) { sd = &vol->v_subdisks[j]; - sd->sd_offset = (off_t)mmap->offset * 512; //ZZZ - sd->sd_size = (off_t)mmap->disk_sectors * 512; //ZZZ + sd->sd_offset = intel_get_map_offset(mmap) * 512; //ZZZ + sd->sd_size = intel_get_map_disk_sectors(mmap) * 512; //ZZZ } g_raid_start_volume(vol); } @@ -1176,9 +1265,6 @@ g_raid_md_taste_intel(struct g_raid_md_o G_RAID_DEBUG(1, "Intel vendor mismatch 0x%04x != 0x8086", vendor); - } else if (pp->mediasize / pp->sectorsize > UINT32_MAX) { - G_RAID_DEBUG(1, - "Intel disk '%s' is too big.", pp->name); } else { G_RAID_DEBUG(1, "No Intel metadata, forcing spare."); @@ -1195,10 +1281,10 @@ g_raid_md_taste_intel(struct g_raid_md_o G_RAID_DEBUG(1, "Intel serial '%s' not found", serial); goto fail1; } - if (meta->disk[disk_pos].sectors != + if (intel_get_disk_sectors(&meta->disk[disk_pos]) != (pp->mediasize / pp->sectorsize)) { G_RAID_DEBUG(1, "Intel size mismatch %ju != %ju", - (off_t)meta->disk[disk_pos].sectors, + intel_get_disk_sectors(&meta->disk[disk_pos]), (off_t)(pp->mediasize / pp->sectorsize)); goto fail1; } @@ -1266,7 +1352,8 @@ search: pd->pd_disk_pos = -1; if (spare == 2) { memcpy(&pd->pd_disk_meta.serial[0], serial, INTEL_SERIAL_LEN); - pd->pd_disk_meta.sectors = pp->mediasize / pp->sectorsize; + intel_set_disk_sectors(&pd->pd_disk_meta, + pp->mediasize / pp->sectorsize); pd->pd_disk_meta.id = 0; pd->pd_disk_meta.flags = INTEL_F_SPARE; } else { @@ -1372,7 +1459,7 @@ g_raid_md_ctl_intel(struct g_raid_md_obj const char *verb, *volname, *levelname, *diskname; char *tmp; int *nargs, *force; - off_t off, size, sectorsize, strip; + off_t off, size, sectorsize, strip, disk_sectors; intmax_t *sizearg, *striparg; int numdisks, i, len, level, qual, update; int error; @@ -1452,13 +1539,6 @@ g_raid_md_ctl_intel(struct g_raid_md_obj cp->private = disk; g_topology_unlock(); - if (pp->mediasize / pp->sectorsize > UINT32_MAX) { - gctl_error(req, - "Disk '%s' is too big.", diskname); - error = -8; - break; - } - error = g_raid_md_get_label(cp, &pd->pd_disk_meta.serial[0], INTEL_SERIAL_LEN); if (error != 0) { @@ -1479,7 +1559,8 @@ g_raid_md_ctl_intel(struct g_raid_md_obj "Dumping not supported by %s.", cp->provider->name); - pd->pd_disk_meta.sectors = pp->mediasize / pp->sectorsize; + intel_set_disk_sectors(&pd->pd_disk_meta, + pp->mediasize / pp->sectorsize); if (size > pp->mediasize) size = pp->mediasize; if (sectorsize < pp->sectorsize) @@ -1544,10 +1625,6 @@ g_raid_md_ctl_intel(struct g_raid_md_obj gctl_error(req, "Size too small."); return (-13); } - if (size > 0xffffffffllu * sectorsize) { - gctl_error(req, "Size too big."); - return (-14); - } /* We have all we need, create things: volume, ... */ mdi->mdio_started = 1; @@ -1655,8 +1732,11 @@ g_raid_md_ctl_intel(struct g_raid_md_obj disk = vol1->v_subdisks[i].sd_disk; pd = (struct g_raid_md_intel_perdisk *) disk->d_md_data; - if ((off_t)pd->pd_disk_meta.sectors * 512 < size) - size = (off_t)pd->pd_disk_meta.sectors * 512; + disk_sectors = + intel_get_disk_sectors(&pd->pd_disk_meta); + + if (disk_sectors * 512 < size) + size = disk_sectors * 512; if (disk->d_consumer != NULL && disk->d_consumer->provider != NULL && disk->d_consumer->provider->sectorsize > @@ -1950,14 +2030,6 @@ g_raid_md_ctl_intel(struct g_raid_md_obj pp = cp->provider; g_topology_unlock(); - if (pp->mediasize / pp->sectorsize > UINT32_MAX) { - gctl_error(req, - "Disk '%s' is too big.", diskname); - g_raid_kill_consumer(sc, cp); - error = -8; - break; - } - /* Read disk serial. */ error = g_raid_md_get_label(cp, &serial[0], INTEL_SERIAL_LEN); @@ -1990,7 +2062,8 @@ g_raid_md_ctl_intel(struct g_raid_md_obj memcpy(&pd->pd_disk_meta.serial[0], &serial[0], INTEL_SERIAL_LEN); - pd->pd_disk_meta.sectors = pp->mediasize / pp->sectorsize; + intel_set_disk_sectors(&pd->pd_disk_meta, + pp->mediasize / pp->sectorsize); pd->pd_disk_meta.id = 0; pd->pd_disk_meta.flags = INTEL_F_SPARE; @@ -2165,8 +2238,8 @@ g_raid_md_write_intel(struct g_raid_md_o mmap0 = intel_get_map(mvol, 0); /* Write map / common part of two maps. */ - mmap0->offset = sd->sd_offset / sectorsize; - mmap0->disk_sectors = sd->sd_size / sectorsize; + intel_set_map_offset(mmap0, sd->sd_offset / sectorsize); + intel_set_map_disk_sectors(mmap0, sd->sd_size / sectorsize); mmap0->strip_sectors = vol->v_strip_size / sectorsize; if (vol->v_state == G_RAID_VOLUME_S_BROKEN) mmap0->status = INTEL_S_FAILURE; @@ -2188,15 +2261,15 @@ g_raid_md_write_intel(struct g_raid_md_o mmap0->total_domains = 2; else mmap0->total_domains = 1; - mmap0->stripe_count = sd->sd_size / vol->v_strip_size / - mmap0->total_domains; + intel_set_map_stripe_count(mmap0, + sd->sd_size / vol->v_strip_size / mmap0->total_domains); mmap0->failed_disk_num = 0xff; mmap0->ddf = 1; /* If there are two maps - copy common and update. */ if (mvol->migr_state) { - mvol->curr_migr_unit = pos / - vol->v_strip_size / mmap0->total_domains; + intel_set_vol_curr_migr_unit(mvol, + pos / vol->v_strip_size / mmap0->total_domains); mmap1 = intel_get_map(mvol, 1); memcpy(mmap1, mmap0, sizeof(struct intel_raid_map)); mmap0->status = INTEL_S_READY; From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 17 01:28: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 EA706106564A; Tue, 17 Jan 2012 01:28:43 +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 D4F118FC08; Tue, 17 Jan 2012 01:28: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 q0H1ShZs061198; Tue, 17 Jan 2012 01:28:43 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0H1ShbN061195; Tue, 17 Jan 2012 01:28:43 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201201170128.q0H1ShbN061195@svn.freebsd.org> From: Xin LI Date: Tue, 17 Jan 2012 01:28: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: r230253 - in stable: 8/sys/dev/tws 9/sys/dev/tws 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, 17 Jan 2012 01:28:44 -0000 Author: delphij Date: Tue Jan 17 01:28:43 2012 New Revision: 230253 URL: http://svn.freebsd.org/changeset/base/230253 Log: MFC 229416 + 223200: Don't forget to release queue lock when allocation of memory failed. Submitted by: Sascha Wildner Obtained from: DragonFly Modified: stable/9/sys/dev/tws/tws.c Directory Properties: stable/9/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/8/sys/dev/tws/tws.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/9/sys/dev/tws/tws.c ============================================================================== --- stable/9/sys/dev/tws/tws.c Tue Jan 17 01:25:53 2012 (r230252) +++ stable/9/sys/dev/tws/tws.c Tue Jan 17 01:28:43 2012 (r230253) @@ -685,6 +685,7 @@ tws_init_reqs(struct tws_softc *sc, u_in { if (bus_dmamap_create(sc->data_tag, 0, &sc->reqs[i].dma_map)) { /* log a ENOMEM failure msg here */ + mtx_unlock(&sc->q_lock); return(FAILURE); } sc->reqs[i].cmd_pkt = &cmd_buf[i]; From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 17 02:49: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 91FC3106566C; Tue, 17 Jan 2012 02:49:24 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 619B98FC08; Tue, 17 Jan 2012 02:49: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 q0H2nOXL063726; Tue, 17 Jan 2012 02:49:24 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0H2nOo6063724; Tue, 17 Jan 2012 02:49:24 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201170249.q0H2nOo6063724@svn.freebsd.org> From: Hiroki Sato Date: Tue, 17 Jan 2012 02:49: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: r230254 - stable/9/release/doc/en_US.ISO8859-1/errata 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, 17 Jan 2012 02:49:24 -0000 Author: hrs Date: Tue Jan 17 02:49:23 2012 New Revision: 230254 URL: http://svn.freebsd.org/changeset/base/230254 Log: Document the following open issues: - $ipv6_prefix_IF fails to configure IF when there is no $ifconfig_IF_ipv6. - USB 3.0 hubs do not work. Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Tue Jan 17 01:28:43 2012 (r230253) +++ stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Tue Jan 17 02:49:23 2012 (r230254) @@ -288,6 +288,34 @@ boot ALLOW_NEW_SOURCES and BLOCK_OLD_SOURCES). + + + &release.current; fails to configure an interface + specified in the &man.rc.conf.5; variable + ipv6_prefix_IF + when the interface does not have a corresponding + ifconfig_IF_ipv6 + variable. This problem will be fixed in the future + releases. To work around this problem on &release.current;, + add an + ifconfig_IF_ipv6 + line for each interface specified in + ipv6_prefix_IF + as the following: + + ipv6_prefix_em0="2001:db8:1:0 2001:db8:2:0" +ifconfig_em0_ipv6="inet6 auto_linklocal" + + + + In &release.current; the &os; USB subsystem supports USB + 3.0 by the &man.xhci.4; driver. However, a bug that could + prevent it from working with a USB 3.0 hub has been found + and fixed after the release date. This means + &release.current; and prior do not work with a USB 3.0 hub. + This problem has been fixed in HEAD and will be merged into + the 9-STABLE branch. + From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 17 06:40: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 3110A106566C; Tue, 17 Jan 2012 06:40: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 10C878FC16; Tue, 17 Jan 2012 06:40: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 q0H6efsj071474; Tue, 17 Jan 2012 06:40:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0H6efP2071470; Tue, 17 Jan 2012 06:40:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201170640.q0H6efP2071470@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Jan 2012 06: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: r230257 - stable/9/sys/boot/i386/libi386 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, 17 Jan 2012 06:40:42 -0000 Author: kib Date: Tue Jan 17 06:40:41 2012 New Revision: 230257 URL: http://svn.freebsd.org/changeset/base/230257 Log: MFC r229435: Add special loader environment variables 'comconsole_port' and 'comconsole_pcidev'. Change allows to use ISA serial ports other than COM1 for the loader/kernel console without loader recompilation, and to configure console on the PCI-attached UARTs. Modified: stable/9/sys/boot/i386/libi386/biospci.c stable/9/sys/boot/i386/libi386/comconsole.c stable/9/sys/boot/i386/libi386/libi386.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/boot/i386/libi386/biospci.c ============================================================================== --- stable/9/sys/boot/i386/libi386/biospci.c Tue Jan 17 06:23:25 2012 (r230256) +++ stable/9/sys/boot/i386/libi386/biospci.c Tue Jan 17 06:40:41 2012 (r230257) @@ -342,3 +342,9 @@ biospci_read_config(uint32_t locator, in return (0); } +uint32_t +biospci_locator(int8_t bus, uint8_t device, uint8_t function) +{ + + return ((bus << 8) | ((device & 0x1f) << 3) | (function & 0x7)); +} Modified: stable/9/sys/boot/i386/libi386/comconsole.c ============================================================================== --- stable/9/sys/boot/i386/libi386/comconsole.c Tue Jan 17 06:23:25 2012 (r230256) +++ stable/9/sys/boot/i386/libi386/comconsole.c Tue Jan 17 06:40:41 2012 (r230257) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "libi386.h" #define COMC_FMT 0x3 /* 8N1 */ @@ -49,14 +50,23 @@ static int comc_init(int arg); static void comc_putchar(int c); static int comc_getchar(void); static int comc_getspeed(void); +static void set_hw_console_hint(void); static int comc_ischar(void); -static int comc_parsespeed(const char *string); -static void comc_setup(int speed); +static int comc_parseint(const char *string); +static uint32_t comc_parse_pcidev(const char *string); +static int comc_pcidev_set(struct env_var *ev, int flags, + const void *value); +static int comc_pcidev_handle(uint32_t locator); +static int comc_port_set(struct env_var *ev, int flags, + const void *value); +static void comc_setup(int speed, int port); static int comc_speed_set(struct env_var *ev, int flags, const void *value); static int comc_started; static int comc_curspeed; +static int comc_port = COMPORT; +static uint32_t comc_locator; struct console comconsole = { "comconsole", @@ -72,9 +82,10 @@ struct console comconsole = { static void comc_probe(struct console *cp) { - char speedbuf[16]; - char *cons, *speedenv; - int speed; + char intbuf[16]; + char *cons, *env; + int speed, port; + uint32_t locator; /* XXX check the BIOS equipment list? */ cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT); @@ -90,16 +101,40 @@ comc_probe(struct console *cp) getenv("boot_multicons") != NULL) { comc_curspeed = comc_getspeed(); } - speedenv = getenv("comconsole_speed"); - if (speedenv != NULL) { - speed = comc_parsespeed(speedenv); + + env = getenv("comconsole_speed"); + if (env != NULL) { + speed = comc_parseint(env); if (speed > 0) comc_curspeed = speed; } - sprintf(speedbuf, "%d", comc_curspeed); + sprintf(intbuf, "%d", comc_curspeed); unsetenv("comconsole_speed"); - env_setenv("comconsole_speed", EV_VOLATILE, speedbuf, comc_speed_set, + env_setenv("comconsole_speed", EV_VOLATILE, intbuf, comc_speed_set, + env_nounset); + + env = getenv("comconsole_port"); + if (env != NULL) { + port = comc_parseint(env); + if (port > 0) + comc_port = port; + } + + sprintf(intbuf, "%d", comc_port); + unsetenv("comconsole_port"); + env_setenv("comconsole_port", EV_VOLATILE, intbuf, comc_port_set, + env_nounset); + + env = getenv("comconsole_pcidev"); + if (env != NULL) { + locator = comc_parse_pcidev(env); + if (locator != 0) + comc_pcidev_handle(locator); + } + + unsetenv("comconsole_pcidev"); + env_setenv("comconsole_pcidev", EV_VOLATILE, env, comc_pcidev_set, env_nounset); } } @@ -111,7 +146,7 @@ comc_init(int arg) return 0; comc_started = 1; - comc_setup(comc_curspeed); + comc_setup(comc_curspeed, comc_port); return(0); } @@ -122,8 +157,8 @@ comc_putchar(int c) int wait; for (wait = COMC_TXWAIT; wait > 0; wait--) - if (inb(COMPORT + com_lsr) & LSR_TXRDY) { - outb(COMPORT + com_data, (u_char)c); + if (inb(comc_port + com_lsr) & LSR_TXRDY) { + outb(comc_port + com_data, (u_char)c); break; } } @@ -131,13 +166,13 @@ comc_putchar(int c) static int comc_getchar(void) { - return(comc_ischar() ? inb(COMPORT + com_data) : -1); + return(comc_ischar() ? inb(comc_port + com_data) : -1); } static int comc_ischar(void) { - return(inb(COMPORT + com_lsr) & LSR_RXRDY); + return(inb(comc_port + com_lsr) & LSR_RXRDY); } static int @@ -145,13 +180,33 @@ comc_speed_set(struct env_var *ev, int f { int speed; - if (value == NULL || (speed = comc_parsespeed(value)) <= 0) { + if (value == NULL || (speed = comc_parseint(value)) <= 0) { printf("Invalid speed\n"); return (CMD_ERROR); } if (comc_started && comc_curspeed != speed) - comc_setup(speed); + comc_setup(speed, comc_port); + + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + + return (CMD_OK); +} + +static int +comc_port_set(struct env_var *ev, int flags, const void *value) +{ + int port; + + if (value == NULL || (port = comc_parseint(value)) <= 0) { + printf("Invalid port\n"); + return (CMD_ERROR); + } + + if (comc_started && comc_port != port) { + comc_setup(comc_curspeed, port); + set_hw_console_hint(); + } env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); @@ -159,24 +214,126 @@ comc_speed_set(struct env_var *ev, int f } static void -comc_setup(int speed) +set_hw_console_hint(void) +{ + char intbuf[64]; + + unsetenv("hw.uart.console"); + sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); + env_setenv("hw.uart.console", EV_VOLATILE, intbuf, + env_noset, env_nounset); +} + +/* + * Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10. + * Output: bar[24:16] bus[15:8] dev[7:3] func[2:0] + */ +static uint32_t +comc_parse_pcidev(const char *string) +{ + char *p, *p1; + uint8_t bus, dev, func, bar; + uint32_t locator; + int pres; + + pres = strtol(string, &p, 0); + if (p == string || *p != ':' || pres < 0 ) + return (0); + bus = pres; + p1 = ++p; + + pres = strtol(p1, &p, 0); + if (p == string || *p != ':' || pres < 0 ) + return (0); + dev = pres; + p1 = ++p; + + pres = strtol(p1, &p, 0); + if (p == string || (*p != ':' && *p != '\0') || pres < 0 ) + return (0); + func = pres; + + if (*p == ':') { + p1 = ++p; + pres = strtol(p1, &p, 0); + if (p == string || *p != '\0' || pres <= 0 ) + return (0); + bar = pres; + } else + bar = 0x10; + + locator = (bar << 16) | biospci_locator(bus, dev, func); + return (locator); +} + +static int +comc_pcidev_handle(uint32_t locator) +{ + char intbuf[64]; + uint32_t port; + + if (biospci_read_config(locator & 0xffff, + (locator & 0xff0000) >> 16, 2, &port) == -1) { + printf("Cannot read bar at 0x%x\n", locator); + return (CMD_ERROR); + } + if (!PCI_BAR_IO(port)) { + printf("Memory bar at 0x%x\n", locator); + return (CMD_ERROR); + } + port &= PCIM_BAR_IO_BASE; + + sprintf(intbuf, "%d", port); + unsetenv("comconsole_port"); + env_setenv("comconsole_port", EV_VOLATILE, intbuf, + comc_port_set, env_nounset); + + comc_setup(comc_curspeed, port); + set_hw_console_hint(); + comc_locator = locator; + + return (CMD_OK); +} + +static int +comc_pcidev_set(struct env_var *ev, int flags, const void *value) +{ + uint32_t locator; + int error; + + if (value == NULL || (locator = comc_parse_pcidev(value)) <= 0) { + printf("Invalid pcidev\n"); + return (CMD_ERROR); + } + if (comc_started && comc_locator != locator) { + error = comc_pcidev_handle(locator); + if (error != CMD_OK) + return (error); + } + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + return (CMD_OK); +} + +static void +comc_setup(int speed, int port) { comc_curspeed = speed; + comc_port = port; - outb(COMPORT + com_cfcr, CFCR_DLAB | COMC_FMT); - outb(COMPORT + com_dlbl, COMC_BPS(speed) & 0xff); - outb(COMPORT + com_dlbh, COMC_BPS(speed) >> 8); - outb(COMPORT + com_cfcr, COMC_FMT); - outb(COMPORT + com_mcr, MCR_RTS | MCR_DTR); + outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT); + outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff); + outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8); + outb(comc_port + com_cfcr, COMC_FMT); + outb(comc_port + com_mcr, MCR_RTS | MCR_DTR); do - inb(COMPORT + com_data); - while (inb(COMPORT + com_lsr) & LSR_RXRDY); + inb(comc_port + com_data); + while (inb(comc_port + com_lsr) & LSR_RXRDY); } static int -comc_parsespeed(const char *speedstr) +comc_parseint(const char *speedstr) { char *p; int speed; @@ -196,13 +353,13 @@ comc_getspeed(void) u_char dlbl; u_char cfcr; - cfcr = inb(COMPORT + com_cfcr); - outb(COMPORT + com_cfcr, CFCR_DLAB | cfcr); + cfcr = inb(comc_port + com_cfcr); + outb(comc_port + com_cfcr, CFCR_DLAB | cfcr); - dlbl = inb(COMPORT + com_dlbl); - dlbh = inb(COMPORT + com_dlbh); + dlbl = inb(comc_port + com_dlbl); + dlbh = inb(comc_port + com_dlbh); - outb(COMPORT + com_cfcr, cfcr); + outb(comc_port + com_cfcr, cfcr); divisor = dlbh << 8 | dlbl; Modified: stable/9/sys/boot/i386/libi386/libi386.h ============================================================================== --- stable/9/sys/boot/i386/libi386/libi386.h Tue Jan 17 06:23:25 2012 (r230256) +++ stable/9/sys/boot/i386/libi386/libi386.h Tue Jan 17 06:40:41 2012 (r230257) @@ -97,6 +97,7 @@ extern vm_offset_t high_heap_base; /* fo int biospci_find_devclass(uint32_t class, int index, uint32_t *locator); int biospci_write_config(uint32_t locator, int offset, int width, uint32_t val); int biospci_read_config(uint32_t locator, int offset, int width, uint32_t *val); +uint32_t biospci_locator(int8_t bus, uint8_t device, uint8_t function); void biosacpi_detect(void); From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 17 06:57: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 EE222106566C; Tue, 17 Jan 2012 06:57: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 D79B48FC12; Tue, 17 Jan 2012 06:57: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 q0H6vt2n072043; Tue, 17 Jan 2012 06:57:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0H6vtwX072041; Tue, 17 Jan 2012 06:57:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201170657.q0H6vtwX072041@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Jan 2012 06:57: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: r230258 - 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, 17 Jan 2012 06:57:56 -0000 Author: kib Date: Tue Jan 17 06:57:55 2012 New Revision: 230258 URL: http://svn.freebsd.org/changeset/base/230258 Log: MFC r229934: Change the type of the paging_in_progress refcounter from u_short to u_int. With the auto-sized buffer cache on the modern machines, UFS metadata can generate more the 65535 pages belonging to the buffers undergoing i/o, overflowing the counter. To keep the layout of other fields of the struct vm_object intact on stable/9, put enlarged paging_in_progress at the end of the structure, and put a placeholder in the place of old pip counter. Modified: stable/9/sys/vm/vm_object.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_object.h ============================================================================== --- stable/9/sys/vm/vm_object.h Tue Jan 17 06:40:41 2012 (r230257) +++ stable/9/sys/vm/vm_object.h Tue Jan 17 06:57:55 2012 (r230258) @@ -96,7 +96,7 @@ struct vm_object { objtype_t type; /* type of pager */ u_short flags; /* see below */ u_short pg_color; /* (c) color of first page in obj */ - u_short paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ + u_short pad1; /* Old pip counter */ int resident_page_count; /* number of resident pages */ struct vm_object *backing_object; /* object that I'm a shadow of */ vm_ooffset_t backing_object_offset;/* Offset in backing object */ @@ -146,6 +146,7 @@ struct vm_object { } un_pager; struct ucred *cred; vm_ooffset_t charge; + u_int paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ }; /* From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 17 07:01:23 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 969801065673; Tue, 17 Jan 2012 07:01:23 +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 66ED68FC08; Tue, 17 Jan 2012 07:01:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0H71Nj6072219; Tue, 17 Jan 2012 07:01:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0H71Ncs072217; Tue, 17 Jan 2012 07:01:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201170701.q0H71Ncs072217@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Jan 2012 07:01: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: r230259 - 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: Tue, 17 Jan 2012 07:01:23 -0000 Author: kib Date: Tue Jan 17 07:01:22 2012 New Revision: 230259 URL: http://svn.freebsd.org/changeset/base/230259 Log: MFC r229771: Document comconsole_port and comconsole_pcidev loader variables. Modified: stable/9/sys/boot/common/loader.8 Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/boot/common/loader.8 ============================================================================== --- stable/9/sys/boot/common/loader.8 Tue Jan 17 06:57:55 2012 (r230258) +++ stable/9/sys/boot/common/loader.8 Tue Jan 17 07:01:22 2012 (r230259) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 27, 2011 +.Dd January 7, 2012 .Dt LOADER 8 .Os .Sh NAME @@ -419,6 +419,43 @@ was compiled. Changes to the .Va comconsole_speed variable take effect immediately. +.It Va comconsole_port +Defines the base i/o port used to access console UART +(i386 and amd64 only). +If the variable is not set, its assumed value is 0x3F8, which +corresponds to PC port COM1, unless overriden by +.Va BOOT_COMCONSOLE_PORT +variable during the compilation of +.Nm . +Setting the +.Va comconsole_port +variable automatically set +.Va hw.uart.console +environment variable to provide a hint to kernel for location of the console. +Loader console is changed immediately after variable +.Va comconsole_port +is set. +.It Va comconsole_pcidev +Defines the location of a PCI device of the 'simple communication' +class to be used as the serial console UART (i386 and amd64 only). +The syntax of the variable is +.Li 'bus:device:function[:bar]' , +where all members must be numeric, with possible +.Li 0x +prefix to indicate a hexadecimal value. +The +.Va bar +member is optional and assumed to be 0x10 if omitted. +The bar must decode i/o space. +Setting the variable +.Va comconsole_pcidev +automatically sets the variable +.Va comconsole_port +to the base of the selected bar, and hint +.Va hw.uart.console . +Loader console is changed immediately after variable +.Va comconsole_pcidev +is set. .It Va console Defines the current console or consoles. Multiple consoles may be specified. From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 17 11:04: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 9226D106564A; Tue, 17 Jan 2012 11:04:59 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F16A8FC08; Tue, 17 Jan 2012 11:04: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 q0HB4xR9087736; Tue, 17 Jan 2012 11:04:59 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0HB4xjn087732; Tue, 17 Jan 2012 11:04:59 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201201171104.q0HB4xjn087732@svn.freebsd.org> From: Peter Holm Date: Tue, 17 Jan 2012 11:04: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: r230263 - 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: Tue, 17 Jan 2012 11:04:59 -0000 Author: pho Date: Tue Jan 17 11:04:58 2012 New Revision: 230263 URL: http://svn.freebsd.org/changeset/base/230263 Log: MFC: r228218, r228219, 228220, 228221 Rename copyin_timeout32 to umtx_copyin_timeout32 and move parameter check here. Include check for negative seconds value. Add umtx_copyin_timeout() and move parameter checks here. Add declaration of umtx_copyin_timeout() Use umtx_copyin_timeout() to copy and check timeout parameter. Modified: stable/9/sys/kern/kern_thr.c stable/9/sys/kern/kern_umtx.c stable/9/sys/sys/umtx.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_thr.c ============================================================================== --- stable/9/sys/kern/kern_thr.c Tue Jan 17 07:30:36 2012 (r230262) +++ stable/9/sys/kern/kern_thr.c Tue Jan 17 11:04:58 2012 (r230263) @@ -449,8 +449,7 @@ sys_thr_suspend(struct thread *td, struc tsp = NULL; if (uap->timeout != NULL) { - error = copyin((const void *)uap->timeout, (void *)&ts, - sizeof(struct timespec)); + error = umtx_copyin_timeout(uap->timeout, &ts); if (error != 0) return (error); tsp = &ts; @@ -473,9 +472,6 @@ kern_thr_suspend(struct thread *td, stru } if (tsp != NULL) { - if (tsp->tv_sec < 0 || tsp->tv_nsec < 0 || - tsp->tv_nsec > 1000000000) - return (EINVAL); if (tsp->tv_sec == 0 && tsp->tv_nsec == 0) error = EWOULDBLOCK; else { Modified: stable/9/sys/kern/kern_umtx.c ============================================================================== --- stable/9/sys/kern/kern_umtx.c Tue Jan 17 07:30:36 2012 (r230262) +++ stable/9/sys/kern/kern_umtx.c Tue Jan 17 11:04:58 2012 (r230263) @@ -2898,6 +2898,21 @@ sys__umtx_unlock(struct thread *td, stru return do_unlock_umtx(td, uap->umtx, td->td_tid); } +inline int +umtx_copyin_timeout(const void *addr, struct timespec *tsp) +{ + int error; + + error = copyin(addr, tsp, sizeof(struct timespec)); + if (error == 0) { + if (tsp->tv_sec < 0 || + tsp->tv_nsec >= 1000000000 || + tsp->tv_nsec < 0) + error = EINVAL; + } + return (error); +} + static int __umtx_op_lock_umtx(struct thread *td, struct _umtx_op_args *uap) { @@ -2908,13 +2923,9 @@ __umtx_op_lock_umtx(struct thread *td, s if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } ts = &timeout; } return (do_lock_umtx(td, uap->obj, uap->val, ts)); @@ -2935,12 +2946,9 @@ __umtx_op_wait(struct thread *td, struct if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_wait(td, uap->obj, uap->val, ts, 0, 0); @@ -2955,12 +2963,9 @@ __umtx_op_wait_uint(struct thread *td, s if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_wait(td, uap->obj, uap->val, ts, 1, 0); @@ -2975,12 +2980,9 @@ __umtx_op_wait_uint_private(struct threa if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_wait(td, uap->obj, uap->val, ts, 1, 1); @@ -3034,14 +3036,9 @@ __umtx_op_lock_umutex(struct thread *td, if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, - sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } ts = &timeout; } return do_lock_umutex(td, uap->obj, ts, 0); @@ -3063,14 +3060,9 @@ __umtx_op_wait_umutex(struct thread *td, if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, - sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } ts = &timeout; } return do_lock_umutex(td, uap->obj, ts, _UMUTEX_WAIT); @@ -3104,14 +3096,9 @@ __umtx_op_cv_wait(struct thread *td, str if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, - sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } ts = &timeout; } return (do_cv_wait(td, uap->obj, uap->uaddr1, ts, uap->val)); @@ -3139,14 +3126,9 @@ __umtx_op_rw_rdlock(struct thread *td, s if (uap->uaddr2 == NULL) { error = do_rw_rdlock(td, uap->obj, uap->val, 0); } else { - error = copyin(uap->uaddr2, &timeout, - sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } error = do_rw_rdlock2(td, uap->obj, uap->val, &timeout); } return (error); @@ -3162,14 +3144,9 @@ __umtx_op_rw_wrlock(struct thread *td, s if (uap->uaddr2 == NULL) { error = do_rw_wrlock(td, uap->obj, 0); } else { - error = copyin(uap->uaddr2, &timeout, - sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } error = do_rw_wrlock2(td, uap->obj, &timeout); } @@ -3192,14 +3169,9 @@ __umtx_op_sem_wait(struct thread *td, st if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, - sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } ts = &timeout; } return (do_sem_wait(td, uap->obj, ts)); @@ -3267,15 +3239,21 @@ struct timespec32 { }; static inline int -copyin_timeout32(void *addr, struct timespec *tsp) +umtx_copyin_timeout32(void *addr, struct timespec *tsp) { struct timespec32 ts32; int error; error = copyin(addr, &ts32, sizeof(struct timespec32)); if (error == 0) { - tsp->tv_sec = ts32.tv_sec; - tsp->tv_nsec = ts32.tv_nsec; + if (ts32.tv_sec < 0 || + ts32.tv_nsec >= 1000000000 || + ts32.tv_nsec < 0) + error = EINVAL; + else { + tsp->tv_sec = ts32.tv_sec; + tsp->tv_nsec = ts32.tv_nsec; + } } return (error); } @@ -3290,13 +3268,9 @@ __umtx_op_lock_umtx_compat32(struct thre if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } ts = &timeout; } return (do_lock_umtx32(td, uap->obj, uap->val, ts)); @@ -3317,12 +3291,9 @@ __umtx_op_wait_compat32(struct thread *t if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_wait(td, uap->obj, uap->val, ts, 1, 0); @@ -3338,12 +3309,9 @@ __umtx_op_lock_umutex_compat32(struct th if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_lock_umutex(td, uap->obj, ts, 0); @@ -3359,12 +3327,9 @@ __umtx_op_wait_umutex_compat32(struct th if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_lock_umutex(td, uap->obj, ts, _UMUTEX_WAIT); @@ -3380,12 +3345,9 @@ __umtx_op_cv_wait_compat32(struct thread if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return (do_cv_wait(td, uap->obj, uap->uaddr1, ts, uap->val)); @@ -3401,13 +3363,9 @@ __umtx_op_rw_rdlock_compat32(struct thre if (uap->uaddr2 == NULL) { error = do_rw_rdlock(td, uap->obj, uap->val, 0); } else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } error = do_rw_rdlock2(td, uap->obj, uap->val, &timeout); } return (error); @@ -3423,13 +3381,9 @@ __umtx_op_rw_wrlock_compat32(struct thre if (uap->uaddr2 == NULL) { error = do_rw_wrlock(td, uap->obj, 0); } else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } error = do_rw_wrlock2(td, uap->obj, &timeout); } @@ -3445,12 +3399,9 @@ __umtx_op_wait_uint_private_compat32(str if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_wait(td, uap->obj, uap->val, ts, 1, 1); @@ -3466,12 +3417,9 @@ __umtx_op_sem_wait_compat32(struct threa if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return (do_sem_wait(td, uap->obj, ts)); Modified: stable/9/sys/sys/umtx.h ============================================================================== --- stable/9/sys/sys/umtx.h Tue Jan 17 07:30:36 2012 (r230262) +++ stable/9/sys/sys/umtx.h Tue Jan 17 11:04:58 2012 (r230263) @@ -223,6 +223,7 @@ umtx_key_match(const struct umtx_key *k1 k1->info.both.b == k2->info.both.b); } +int umtx_copyin_timeout(const void *, struct timespec *); int umtx_key_get(void *, int, int, struct umtx_key *); void umtx_key_release(struct umtx_key *); struct umtx_q *umtxq_alloc(void); From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 17 13:52: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 43C1E1065676; Tue, 17 Jan 2012 13:52:05 +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 316828FC1E; Tue, 17 Jan 2012 13:52: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 q0HDq5Lo092956; Tue, 17 Jan 2012 13:52:05 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0HDq5n2092953; Tue, 17 Jan 2012 13:52:05 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201201171352.q0HDq5n2092953@svn.freebsd.org> From: Gavin Atkinson Date: Tue, 17 Jan 2012 13:52: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: r230266 - in stable/9/sys: amd64/amd64 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: Tue, 17 Jan 2012 13:52:05 -0000 Author: gavin Date: Tue Jan 17 13:52:04 2012 New Revision: 230266 URL: http://svn.freebsd.org/changeset/base/230266 Log: Merge r229085 from head: Default to not performing the early-boot memory tests when we detect we are booting inside a VM. There are three reasons to disable this: o It causes the VM host to believe that all the tested pages or RAM are in use. This in turn may force the host to page out pages of RAM belonging to other VMs, or otherwise cause problems with fair resource sharing on the VM cluster. o It adds significant time to the boot process (around 1 second/Gig in testing) o It is unnecessary - the host should have already verified that the memory is functional etc. Note that this simply changes the default when in a VM - it can still be overridden using the hw.memtest.tests tunable. Early MFC requested by: bz Modified: stable/9/sys/amd64/amd64/machdep.c stable/9/sys/i386/i386/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) Modified: stable/9/sys/amd64/amd64/machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/machdep.c Tue Jan 17 12:14:26 2012 (r230265) +++ stable/9/sys/amd64/amd64/machdep.c Tue Jan 17 13:52:04 2012 (r230266) @@ -1372,10 +1372,13 @@ getmemsize(caddr_t kmdp, u_int64_t first Maxmem = atop(physmem_tunable); /* - * By default keep the memtest enabled. Use a general name so that + * By default enable the memory test on real hardware, and disable + * it if we appear to be running in a VM. This avoids touching all + * pages unnecessarily, which doesn't matter on real hardware but is + * bad for shared VM hosts. Use a general name so that * one could eventually do more with the code than just disable it. */ - memtest = 1; + memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1; TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); /* Modified: stable/9/sys/i386/i386/machdep.c ============================================================================== --- stable/9/sys/i386/i386/machdep.c Tue Jan 17 12:14:26 2012 (r230265) +++ stable/9/sys/i386/i386/machdep.c Tue Jan 17 13:52:04 2012 (r230266) @@ -2340,10 +2340,13 @@ physmap_done: Maxmem = atop(physmap[physmap_idx + 1]); /* - * By default keep the memtest enabled. Use a general name so that + * By default enable the memory test on real hardware, and disable + * it if we appear to be running in a VM. This avoids touching all + * pages unnecessarily, which doesn't matter on real hardware but is + * bad for shared VM hosts. Use a general name so that * one could eventually do more with the code than just disable it. */ - memtest = 1; + memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1; TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); if (atop(physmap[physmap_idx + 1]) != Maxmem && From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 17 20:56: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 E2C12106564A; Tue, 17 Jan 2012 20:56:12 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D0D928FC16; Tue, 17 Jan 2012 20:56: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 q0HKuC1U007262; Tue, 17 Jan 2012 20:56:12 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0HKuC1r007260; Tue, 17 Jan 2012 20:56:12 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201172056.q0HKuC1r007260@svn.freebsd.org> From: Hiroki Sato Date: Tue, 17 Jan 2012 20:56: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: r230280 - stable/9/usr.sbin/ypserv 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, 17 Jan 2012 20:56:13 -0000 Author: hrs Date: Tue Jan 17 20:56:12 2012 New Revision: 230280 URL: http://svn.freebsd.org/changeset/base/230280 Log: MFC: Revert changes in r229899. The ypserv daemon could not work with multiple socktypes due to it. Modified: stable/9/usr.sbin/ypserv/yp_main.c Directory Properties: stable/9/usr.sbin/ypserv/ (props changed) Modified: stable/9/usr.sbin/ypserv/yp_main.c ============================================================================== --- stable/9/usr.sbin/ypserv/yp_main.c Tue Jan 17 20:39:33 2012 (r230279) +++ stable/9/usr.sbin/ypserv/yp_main.c Tue Jan 17 20:56:12 2012 (r230280) @@ -255,7 +255,6 @@ create_service(const int sock, const str const struct __rpc_sockinfo *si) { int error; - char *sname; SVCXPRT *transp; struct addrinfo hints, *res, *res0; @@ -263,7 +262,6 @@ create_service(const int sock, const str struct bindaddrlistent *blep; struct netbuf svcaddr; - sname = NULL; SLIST_INIT(&sle_head); memset(&hints, 0, sizeof(hints)); memset(&svcaddr, 0, sizeof(svcaddr)); @@ -343,6 +341,7 @@ create_service(const int sock, const str if (strncmp("0", servname, 1) == 0) { struct sockaddr *sap; socklen_t slen; + char *sname; sname = malloc(NI_MAXSERV); if (sname == NULL) { @@ -443,7 +442,6 @@ create_service(const int sock, const str } /* XXX: ignore error intentionally */ rpcb_set(YPPROG, YPVERS, nconf, &svcaddr); - free(sname); freeaddrinfo(res0); return 0; } From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 17 22:42:54 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 9E4E91065674; Tue, 17 Jan 2012 22:42:54 +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 818218FC1B; Tue, 17 Jan 2012 22:42:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0HMgs7c011009; Tue, 17 Jan 2012 22:42:54 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0HMgsIM011007; Tue, 17 Jan 2012 22:42:54 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201201172242.q0HMgsIM011007@svn.freebsd.org> From: Justin Hibbits Date: Tue, 17 Jan 2012 22:42: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: r230290 - 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: Tue, 17 Jan 2012 22:42:54 -0000 Author: jhibbits Date: Tue Jan 17 22:42:54 2012 New Revision: 230290 URL: http://svn.freebsd.org/changeset/base/230290 Log: MFC r230035: Add PWM monitoring sysctl to G4 MDD (Windtunnel) fan driver. While there, clean up some style nits. Modified: stable/9/sys/powerpc/powermac/windtunnel.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) Modified: stable/9/sys/powerpc/powermac/windtunnel.c ============================================================================== --- stable/9/sys/powerpc/powermac/windtunnel.c Tue Jan 17 22:19:35 2012 (r230289) +++ stable/9/sys/powerpc/powermac/windtunnel.c Tue Jan 17 22:42:54 2012 (r230290) @@ -59,8 +59,7 @@ struct adm1030_softc { device_t sc_dev; struct intr_config_hook enum_hook; uint32_t sc_addr; - phandle_t sc_thermostat_phandle; - device_t sc_thermostat_dev; + int sc_pwm; }; /* Regular bus attachment functions */ @@ -70,7 +69,8 @@ static int adm1030_attach(device_t); /* Utility functions */ static void adm1030_start(void *xdev); static int adm1030_write_byte(device_t dev, uint32_t addr, uint8_t reg, uint8_t buf); -static int adm1030_set(struct adm1030_softc *fan, int pwm); +static int adm1030_set(struct adm1030_softc *fan, int pwm); +static int adm1030_sysctl(SYSCTL_HANDLER_ARGS); static device_method_t adm1030_methods[] = { /* Device interface */ @@ -151,6 +151,8 @@ static int adm1030_attach(device_t dev) { struct adm1030_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; sc = device_get_softc(dev); @@ -158,17 +160,19 @@ adm1030_attach(device_t dev) sc->enum_hook.ich_arg = dev; /* - * We have to wait until interrupts are enabled. I2C read and write - * only works if the interrupts are available. The unin/i2c is - * controlled by the htpic on unin. But this is not the master. The - * openpic on mac-io is controlling the htpic. This one gets attached - * after the mac-io probing and then the interrupts will be - * available. + * Wait until interrupts are available, which won't be until the openpic is + * intialized. */ if (config_intrhook_establish(&sc->enum_hook) != 0) return (ENOMEM); + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "pwm", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, dev, + 0, adm1030_sysctl, "I", "Fan PWM Rate"); + return (0); } @@ -188,7 +192,7 @@ adm1030_start(void *xdev) /* Use the RPM fields as PWM duty cycles. */ sc->fan.min_rpm = 0; - sc->fan.max_rpm = 15; + sc->fan.max_rpm = 0x0F; sc->fan.default_rpm = 2; strcpy(sc->fan.name, "MDD Case fan"); @@ -211,6 +215,26 @@ static int adm1030_set(struct adm1030_so if (adm1030_write_byte(fan->sc_dev, fan->sc_addr, 0x22, pwm) < 0) return (-1); + fan->sc_pwm = pwm; return (0); } +static int +adm1030_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t adm1030; + struct adm1030_softc *sc; + int pwm, error; + + adm1030 = arg1; + sc = device_get_softc(adm1030); + + pwm = sc->sc_pwm; + + error = sysctl_handle_int(oidp, &pwm, 0, req); + + if (error || !req->newptr) + return (error); + + return (adm1030_set(sc, pwm)); +} From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 17 23:18: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 065831065785; Tue, 17 Jan 2012 23:18:04 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8F0518FC12; Tue, 17 Jan 2012 23:18:03 +0000 (UTC) Received: by ghy10 with SMTP id 10so518654ghy.13 for ; Tue, 17 Jan 2012 15:18:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; bh=rl2dZ9QPb2AsJrVQpl8RFHYwcC2DXXgIOThnNOq2tNM=; b=oEHNRYvfKDjgZfadcIMrq9Ek9hKsq2vrPwAfo7NcRImr+YSo5znYYdPPpSoz3K0nfZ jJQDpLzm/rDJ+vgiF3Xfa6DrvKq1daC0j9gBrb1Ra7yrec38Aq1fPFyk9bMRPjeLXjKp lh/yUOruqO/2NZCk7H7vlXRsqUkk4+tJ7a7hI= Received: by 10.236.173.202 with SMTP id v50mr27688471yhl.102.1326840834127; Tue, 17 Jan 2012 14:53:54 -0800 (PST) Received: from triad.knownspace (216-15-41-8.c3-0.gth-ubr1.lnh-gth.md.cable.rcn.com. [216.15.41.8]) by mx.google.com with ESMTPS id a7sm63871754ana.5.2012.01.17.14.53.51 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jan 2012 14:53:52 -0800 (PST) Message-Id: <0357E3C5-16F1-4842-B33A-E0AB77884D95@gmail.com> From: Justin Hibbits To: Justin Hibbits In-Reply-To: <201201172242.q0HMgsIM011007@svn.freebsd.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Date: Tue, 17 Jan 2012 17:51:48 -0500 References: <201201172242.q0HMgsIM011007@svn.freebsd.org> X-Mailer: Apple Mail (2.936) 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: r230290 - 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: Tue, 17 Jan 2012 23:18:04 -0000 On Jan 17, 2012, at 5:42 PM, Justin Hibbits wrote: > Author: jhibbits > Date: Tue Jan 17 22:42:54 2012 > New Revision: 230290 > URL: http://svn.freebsd.org/changeset/base/230290 > > Log: > MFC r230035: > > Add PWM monitoring sysctl to G4 MDD (Windtunnel) fan driver. While > there, clean > up some style nits. D'oh: Approved by: nwhitehorn (mentor) - Justin From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 18 04:34: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 8D67C106566C; Wed, 18 Jan 2012 04:34:19 +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 77E988FC19; Wed, 18 Jan 2012 04:34: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 q0I4YJ8k022443; Wed, 18 Jan 2012 04:34:19 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0I4YJ6X022441; Wed, 18 Jan 2012 04:34:19 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201180434.q0I4YJ6X022441@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 18 Jan 2012 04:34: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: r230297 - 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: Wed, 18 Jan 2012 04:34:19 -0000 Author: kib Date: Wed Jan 18 04:34:18 2012 New Revision: 230297 URL: http://svn.freebsd.org/changeset/base/230297 Log: MFC r229495: Do not restart the scan in vm_object_page_clean() on the object generation change if requested mode is async. Modified: stable/9/sys/vm/vm_object.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_object.c ============================================================================== --- stable/9/sys/vm/vm_object.c Wed Jan 18 04:12:32 2012 (r230296) +++ stable/9/sys/vm/vm_object.c Wed Jan 18 04:34:18 2012 (r230297) @@ -840,8 +840,12 @@ rescan: if (p->valid == 0) continue; if (vm_page_sleep_if_busy(p, TRUE, "vpcwai")) { - if (object->generation != curgeneration) - goto rescan; + if (object->generation != curgeneration) { + if ((flags & OBJPC_SYNC) != 0) + goto rescan; + else + clearobjflags = 0; + } np = vm_page_find_least(object, pi); continue; } @@ -850,8 +854,12 @@ rescan: n = vm_object_page_collect_flush(object, p, pagerflags, flags, &clearobjflags); - if (object->generation != curgeneration) - goto rescan; + if (object->generation != curgeneration) { + if ((flags & OBJPC_SYNC) != 0) + goto rescan; + else + clearobjflags = 0; + } /* * If the VOP_PUTPAGES() did a truncated write, so From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 18 04:37: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 53F8D106564A; Wed, 18 Jan 2012 04:37: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 3E1678FC0C; Wed, 18 Jan 2012 04:37: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 q0I4bINk022578; Wed, 18 Jan 2012 04:37:18 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0I4bIBM022576; Wed, 18 Jan 2012 04:37:18 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201180437.q0I4bIBM022576@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 18 Jan 2012 04:37: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: r230298 - stable/9/sys/dev/uart 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, 18 Jan 2012 04:37:18 -0000 Author: kib Date: Wed Jan 18 04:37:17 2012 New Revision: 230298 URL: http://svn.freebsd.org/changeset/base/230298 Log: MFC r229971: Add PCI Id for the AMT SOL UART on 5 series Intel chipsets. Modified: stable/9/sys/dev/uart/uart_bus_pci.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/9/sys/dev/uart/uart_bus_pci.c Wed Jan 18 04:34:18 2012 (r230297) +++ stable/9/sys/dev/uart/uart_bus_pci.c Wed Jan 18 04:37:17 2012 (r230298) @@ -112,6 +112,8 @@ static struct pci_id pci_ns8250_ids[] = 0x10, 16384000 }, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, { 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, +{ 0x8086, 0x3b67, 0xffff, 0, "5 Series/3400 Series Chipset KT Controller", + 0x10 }, { 0x8086, 0x8811, 0xffff, 0, "Intel EG20T Serial Port 0", 0x10 }, { 0x8086, 0x8812, 0xffff, 0, "Intel EG20T Serial Port 1", 0x10 }, { 0x8086, 0x8813, 0xffff, 0, "Intel EG20T Serial Port 2", 0x10 }, From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 18 07:57: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 388FD106564A; Wed, 18 Jan 2012 07:57:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20B148FC15; Wed, 18 Jan 2012 07:57: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 q0I7vHnh029178; Wed, 18 Jan 2012 07:57:17 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0I7vHiw029172; Wed, 18 Jan 2012 07:57:17 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201180757.q0I7vHiw029172@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 18 Jan 2012 07:57: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: r230302 - in stable/9/sys/dev/usb: . controller 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, 18 Jan 2012 07:57:18 -0000 Author: hselasky Date: Wed Jan 18 07:57:17 2012 New Revision: 230302 URL: http://svn.freebsd.org/changeset/base/230302 Log: MFC r230032, r230050, r230090, r230091 and r228493. - Various XHCI and USB 3.0 related issues. - USB 3.0 HUBs should work after this change. Modified: stable/9/sys/dev/usb/controller/xhci.c stable/9/sys/dev/usb/usb.h stable/9/sys/dev/usb/usb_hub.c stable/9/sys/dev/usb/usb_request.c stable/9/sys/dev/usb/usb_request.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) Modified: stable/9/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/9/sys/dev/usb/controller/xhci.c Wed Jan 18 07:56:13 2012 (r230301) +++ stable/9/sys/dev/usb/controller/xhci.c Wed Jan 18 07:57:17 2012 (r230302) @@ -2211,9 +2211,10 @@ xhci_configure_device(struct usb_device struct usb_device *hubdev; uint32_t temp; uint32_t route; + uint32_t rh_port; uint8_t is_hub; uint8_t index; - uint8_t rh_port; + uint8_t depth; index = udev->controller_slot_id; @@ -2235,6 +2236,8 @@ xhci_configure_device(struct usb_device if (hubdev->parent_hub == NULL) break; + depth = hubdev->parent_hub->depth; + /* * NOTE: HS/FS/LS devices and the SS root HUB can have * more than 15 ports @@ -2242,17 +2245,18 @@ xhci_configure_device(struct usb_device rh_port = hubdev->port_no; - if (hubdev->parent_hub->parent_hub == NULL) + if (depth == 0) break; - route *= 16; - if (rh_port > 15) - route |= 15; - else - route |= rh_port; + rh_port = 15; + + if (depth < 6) + route |= rh_port << (4 * (depth - 1)); } + DPRINTF("Route=0x%08x\n", route); + temp = XHCI_SCTX_0_ROUTE_SET(route); switch (sc->sc_hw.devs[index].state) { @@ -2260,7 +2264,7 @@ xhci_configure_device(struct usb_device temp |= XHCI_SCTX_0_CTX_NUM_SET(XHCI_MAX_ENDPOINTS - 1); break; default: - temp = XHCI_SCTX_0_CTX_NUM_SET(1); + temp |= XHCI_SCTX_0_CTX_NUM_SET(1); break; } @@ -3063,6 +3067,7 @@ xhci_roothub_exec(struct usb_device *ude case UHF_C_PORT_CONFIG_ERROR: XWRITE4(sc, oper, port, v | XHCI_PS_CEC); break; + case UHF_C_PORT_SUSPEND: case UHF_C_PORT_LINK_STATE: XWRITE4(sc, oper, port, v | XHCI_PS_PLC); break; @@ -3189,8 +3194,13 @@ xhci_roothub_exec(struct usb_device *ude i |= UPS_OVERCURRENT_INDICATOR; if (v & XHCI_PS_PR) i |= UPS_RESET; - if (v & XHCI_PS_PP) + if (v & XHCI_PS_PP) { + /* + * The USB 3.0 RH is using the + * USB 2.0's power bit + */ i |= UPS_PORT_POWER; + } USETW(sc->sc_hub_desc.ps.wPortStatus, i); i = 0; Modified: stable/9/sys/dev/usb/usb.h ============================================================================== --- stable/9/sys/dev/usb/usb.h Wed Jan 18 07:56:13 2012 (r230301) +++ stable/9/sys/dev/usb/usb.h Wed Jan 18 07:57:17 2012 (r230302) @@ -688,6 +688,7 @@ struct usb_port_status { #define UPS_PORT_LS_LOOPBACK 0x0B #define UPS_PORT_LS_RESUME 0x0F #define UPS_PORT_POWER 0x0100 +#define UPS_PORT_POWER_SS 0x0200 /* super-speed only */ #define UPS_LOW_SPEED 0x0200 #define UPS_HIGH_SPEED 0x0400 #define UPS_OTHER_SPEED 0x0600 /* currently FreeBSD specific */ Modified: stable/9/sys/dev/usb/usb_hub.c ============================================================================== --- stable/9/sys/dev/usb/usb_hub.c Wed Jan 18 07:56:13 2012 (r230301) +++ stable/9/sys/dev/usb/usb_hub.c Wed Jan 18 07:57:17 2012 (r230302) @@ -327,6 +327,7 @@ uhub_reattach_port(struct uhub_softc *sc enum usb_dev_speed speed; enum usb_hc_mode mode; usb_error_t err; + uint16_t power_mask; uint8_t timeout; DPRINTF("reattaching port %d\n", portno); @@ -369,10 +370,27 @@ repeat: } /* check if there is no power on the port and print a warning */ - if (!(sc->sc_st.port_status & UPS_PORT_POWER)) { + switch (udev->speed) { + case USB_SPEED_HIGH: + case USB_SPEED_FULL: + case USB_SPEED_LOW: + power_mask = UPS_PORT_POWER; + break; + case USB_SPEED_SUPER: + if (udev->parent_hub == NULL) + power_mask = UPS_PORT_POWER; + else + power_mask = UPS_PORT_POWER_SS; + break; + default: + power_mask = 0; + break; + } + if (!(sc->sc_st.port_status & power_mask)) { DPRINTF("WARNING: strange, connected port %d " "has no power\n", portno); } + /* check if the device is in Host Mode */ if (!(sc->sc_st.port_status & UPS_PORT_MODE_DEVICE)) { @@ -609,13 +627,15 @@ uhub_suspend_resume_port(struct uhub_sof } } else { switch (UPS_PORT_LINK_STATE_GET(sc->sc_st.port_status)) { - case UPS_PORT_LS_U0: - case UPS_PORT_LS_U1: - case UPS_PORT_LS_RESUME: + case UPS_PORT_LS_U3: + is_suspend = 1; + break; + case UPS_PORT_LS_SS_INA: + usbd_req_warm_reset_port(udev, NULL, portno); is_suspend = 0; break; default: - is_suspend = 1; + is_suspend = 0; break; } } @@ -632,8 +652,7 @@ uhub_suspend_resume_port(struct uhub_sof */ if (is_suspend == 0) usb_dev_resume_peer(child); - else if ((child->flags.usb_mode == USB_MODE_DEVICE) || - (usb_device_20_compatible(child) == 0)) + else if (child->flags.usb_mode == USB_MODE_DEVICE) usb_dev_suspend_peer(child); } done: @@ -775,7 +794,8 @@ uhub_explore(struct usb_device *udev) break; } } - if (sc->sc_st.port_change & (UPS_C_SUSPEND | UPS_C_PORT_LINK_STATE)) { + if (sc->sc_st.port_change & (UPS_C_SUSPEND | + UPS_C_PORT_LINK_STATE)) { err = uhub_suspend_resume_port(sc, portno); if (err) { /* most likely the HUB is gone */ @@ -2064,7 +2084,6 @@ usb_peer_should_wakeup(struct usb_device (udev->pwr_save.write_refs != 0) || ((udev->pwr_save.read_refs != 0) && (udev->flags.usb_mode == USB_MODE_HOST) && - (usb_device_20_compatible(udev) != 0) && (usb_peer_can_wakeup(udev) == 0))); } @@ -2244,6 +2263,14 @@ usb_dev_resume_peer(struct usb_device *u DPRINTFN(0, "Resuming port failed\n"); return; } + } else { + /* resume current port (Valid in Host and Device Mode) */ + err = usbd_req_set_port_link_state(udev->parent_hub, + NULL, udev->port_no, UPS_PORT_LS_U0); + if (err) { + DPRINTFN(0, "Resuming port failed\n"); + return; + } } /* resume settle time */ @@ -2285,8 +2312,7 @@ usb_dev_resume_peer(struct usb_device *u usbd_sr_unlock(udev); /* check if peer has wakeup capability */ - if (usb_peer_can_wakeup(udev) && - usb_device_20_compatible(udev)) { + if (usb_peer_can_wakeup(udev)) { /* clear remote wakeup */ err = usbd_req_clear_device_feature(udev, NULL, UF_DEVICE_REMOTE_WAKEUP); @@ -2347,8 +2373,7 @@ repeat: } } - if (usb_peer_can_wakeup(udev) && - usb_device_20_compatible(udev)) { + if (usb_peer_can_wakeup(udev)) { /* * This request needs to be done before we set * "udev->flags.self_suspended": @@ -2380,8 +2405,7 @@ repeat: USB_BUS_UNLOCK(udev->bus); if (err != 0) { - if (usb_peer_can_wakeup(udev) && - usb_device_20_compatible(udev)) { + if (usb_peer_can_wakeup(udev)) { /* allow device to do remote wakeup */ err = usbd_req_clear_device_feature(udev, NULL, UF_DEVICE_REMOTE_WAKEUP); @@ -2437,6 +2461,14 @@ repeat: DPRINTFN(0, "Suspending port failed\n"); return; } + } else { + /* suspend current port */ + err = usbd_req_set_port_link_state(udev->parent_hub, + NULL, udev->port_no, UPS_PORT_LS_U3); + if (err) { + DPRINTFN(0, "Suspending port failed\n"); + return; + } } udev = udev->parent_hub; Modified: stable/9/sys/dev/usb/usb_request.c ============================================================================== --- stable/9/sys/dev/usb/usb_request.c Wed Jan 18 07:56:13 2012 (r230301) +++ stable/9/sys/dev/usb/usb_request.c Wed Jan 18 07:57:17 2012 (r230302) @@ -785,12 +785,17 @@ usbd_req_reset_port(struct usb_device *u struct usb_port_status ps; usb_error_t err; uint16_t n; + uint16_t status; + uint16_t change; #ifdef USB_DEBUG uint16_t pr_poll_delay; uint16_t pr_recovery_delay; #endif + + DPRINTF("\n"); + /* clear any leftover port reset changes first */ usbd_req_clear_port_feature( udev, mtx, port, UHF_C_PORT_RESET); @@ -817,9 +822,6 @@ usbd_req_reset_port(struct usb_device *u #endif n = 0; while (1) { - uint16_t status; - uint16_t change; - #ifdef USB_DEBUG /* wait for the device to recover from reset */ usb_pause_mtx(mtx, USB_MS_TO_TICKS(pr_poll_delay)); @@ -830,9 +832,9 @@ usbd_req_reset_port(struct usb_device *u n += USB_PORT_RESET_DELAY; #endif err = usbd_req_get_port_status(udev, mtx, &ps, port); - if (err) { + if (err) goto done; - } + status = UGETW(ps.wPortStatus); change = UGETW(ps.wPortChange); @@ -862,9 +864,9 @@ usbd_req_reset_port(struct usb_device *u /* clear port reset first */ err = usbd_req_clear_port_feature( udev, mtx, port, UHF_C_PORT_RESET); - if (err) { + if (err) goto done; - } + /* check for timeout */ if (n == 0) { err = USB_ERR_TIMEOUT; @@ -898,21 +900,50 @@ done: * disabled. *------------------------------------------------------------------------*/ usb_error_t -usbd_req_warm_reset_port(struct usb_device *udev, struct mtx *mtx, uint8_t port) +usbd_req_warm_reset_port(struct usb_device *udev, struct mtx *mtx, + uint8_t port) { struct usb_port_status ps; usb_error_t err; uint16_t n; + uint16_t status; + uint16_t change; #ifdef USB_DEBUG uint16_t pr_poll_delay; uint16_t pr_recovery_delay; #endif - err = usbd_req_set_port_feature(udev, mtx, port, UHF_BH_PORT_RESET); - if (err) { + + DPRINTF("\n"); + + err = usbd_req_get_port_status(udev, mtx, &ps, port); + if (err) goto done; + + status = UGETW(ps.wPortStatus); + + switch (UPS_PORT_LINK_STATE_GET(status)) { + case UPS_PORT_LS_U3: + case UPS_PORT_LS_COMP_MODE: + case UPS_PORT_LS_LOOPBACK: + case UPS_PORT_LS_SS_INA: + break; + default: + DPRINTF("Wrong state for warm reset\n"); + return (0); } + + /* clear any leftover warm port reset changes first */ + usbd_req_clear_port_feature(udev, mtx, + port, UHF_C_BH_PORT_RESET); + + /* set warm port reset */ + err = usbd_req_set_port_feature(udev, mtx, + port, UHF_BH_PORT_RESET); + if (err) + goto done; + #ifdef USB_DEBUG /* range check input parameters */ pr_poll_delay = usb_pr_poll_delay; @@ -938,17 +969,20 @@ usbd_req_warm_reset_port(struct usb_devi n += USB_PORT_RESET_DELAY; #endif err = usbd_req_get_port_status(udev, mtx, &ps, port); - if (err) { + if (err) goto done; - } + + status = UGETW(ps.wPortStatus); + change = UGETW(ps.wPortChange); + /* if the device disappeared, just give up */ - if (!(UGETW(ps.wPortStatus) & UPS_CURRENT_CONNECT_STATUS)) { + if (!(status & UPS_CURRENT_CONNECT_STATUS)) goto done; - } + /* check if reset is complete */ - if (UGETW(ps.wPortChange) & UPS_C_BH_PORT_RESET) { + if (change & UPS_C_BH_PORT_RESET) break; - } + /* check for timeout */ if (n > 1000) { n = 0; @@ -959,9 +993,9 @@ usbd_req_warm_reset_port(struct usb_devi /* clear port reset first */ err = usbd_req_clear_port_feature( udev, mtx, port, UHF_C_BH_PORT_RESET); - if (err) { + if (err) goto done; - } + /* check for timeout */ if (n == 0) { err = USB_ERR_TIMEOUT; @@ -2004,6 +2038,10 @@ retry: } } + /* Try to warm reset first */ + if (parent_hub->speed == USB_SPEED_SUPER) + usbd_req_warm_reset_port(parent_hub, mtx, udev->port_no); + /* Try to reset the parent HUB port. */ err = usbd_req_reset_port(parent_hub, mtx, udev->port_no); if (err) { @@ -2164,3 +2202,27 @@ usbd_req_clear_tt_buffer(struct usb_devi USETW(req.wLength, 0); return (usbd_do_request(udev, mtx, &req, 0)); } + +/*------------------------------------------------------------------------* + * usbd_req_set_port_link_state + * + * USB 3.0 specific request + * + * Returns: + * 0: Success + * Else: Failure + *------------------------------------------------------------------------*/ +usb_error_t +usbd_req_set_port_link_state(struct usb_device *udev, struct mtx *mtx, + uint8_t port, uint8_t link_state) +{ + struct usb_device_request req; + + req.bmRequestType = UT_WRITE_CLASS_OTHER; + req.bRequest = UR_SET_FEATURE; + USETW(req.wValue, UHF_PORT_LINK_STATE); + req.wIndex[0] = port; + req.wIndex[1] = link_state; + USETW(req.wLength, 0); + return (usbd_do_request(udev, mtx, &req, 0)); +} Modified: stable/9/sys/dev/usb/usb_request.h ============================================================================== --- stable/9/sys/dev/usb/usb_request.h Wed Jan 18 07:56:13 2012 (r230301) +++ stable/9/sys/dev/usb/usb_request.h Wed Jan 18 07:57:17 2012 (r230302) @@ -89,5 +89,7 @@ usb_error_t usbd_req_reset_tt(struct usb uint8_t port); usb_error_t usbd_req_clear_tt_buffer(struct usb_device *udev, struct mtx *mtx, uint8_t port, uint8_t addr, uint8_t type, uint8_t endpoint); +usb_error_t usbd_req_set_port_link_state(struct usb_device *udev, + struct mtx *mtx, uint8_t port, uint8_t link_state); #endif /* _USB_REQUEST_H_ */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 18 11:48:08 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 60A371065672; Wed, 18 Jan 2012 11:48:08 +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 43E478FC1D; Wed, 18 Jan 2012 11:48:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0IBm8bq038834; Wed, 18 Jan 2012 11:48:08 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0IBm8IV038829; Wed, 18 Jan 2012 11:48:08 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201201181148.q0IBm8IV038829@svn.freebsd.org> From: Justin Hibbits Date: Wed, 18 Jan 2012 11:48:08 +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: r230305 - in stable/9: lib/libpmc sys/dev/hwpmc sys/powerpc/aim sys/powerpc/include 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, 18 Jan 2012 11:48:08 -0000 Author: jhibbits Date: Wed Jan 18 11:48:07 2012 New Revision: 230305 URL: http://svn.freebsd.org/changeset/base/230305 Log: MFC r228869,r228874: Implement hwpmc counting PMC support for PowerPC G4+ (MPC745x/MPC744x). Sampling is in progress. Approved by: nwhitehorn (mentor) Modified: stable/9/lib/libpmc/libpmc.c stable/9/sys/dev/hwpmc/hwpmc_powerpc.c stable/9/sys/dev/hwpmc/pmc_events.h stable/9/sys/powerpc/aim/machdep.c stable/9/sys/powerpc/aim/trap.c stable/9/sys/powerpc/include/pmc_mdep.h stable/9/sys/powerpc/include/spr.h stable/9/sys/sys/pmc.h Directory Properties: stable/9/lib/libpmc/ (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) Modified: stable/9/lib/libpmc/libpmc.c ============================================================================== --- stable/9/lib/libpmc/libpmc.c Wed Jan 18 11:23:46 2012 (r230304) +++ stable/9/lib/libpmc/libpmc.c Wed Jan 18 11:48:07 2012 (r230305) @@ -83,6 +83,10 @@ static int mips24k_allocate_pmc(enum pmc struct pmc_op_pmcallocate *_pmc_config); #endif /* __mips__ */ +#if defined(__powerpc__) +static int ppc7450_allocate_pmc(enum pmc_event _pe, char* ctrspec, + struct pmc_op_pmcallocate *_pmc_config); +#endif /* __powerpc__ */ #define PMC_CALL(cmd, params) \ syscall(pmc_syscall, PMC_OP_##cmd, (params)) @@ -149,6 +153,7 @@ PMC_CLASSDEP_TABLE(p6, P6); PMC_CLASSDEP_TABLE(xscale, XSCALE); PMC_CLASSDEP_TABLE(mips24k, MIPS24K); PMC_CLASSDEP_TABLE(ucf, UCF); +PMC_CLASSDEP_TABLE(ppc7450, PPC7450); #undef __PMC_EV_ALIAS #define __PMC_EV_ALIAS(N,CODE) { N, PMC_EV_##CODE }, @@ -211,6 +216,7 @@ PMC_MDEP_TABLE(p5, P5, PMC_CLASS_TSC); PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC); PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE); PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_MIPS24K); +PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_PPC7450); static const struct pmc_event_descr tsc_event_table[] = { @@ -263,6 +269,10 @@ PMC_CLASS_TABLE_DESC(xscale, XSCALE, xsc PMC_CLASS_TABLE_DESC(mips24k, MIPS24K, mips24k, mips24k); #endif /* __mips__ */ +#if defined(__powerpc__) +PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, ppc7450); +#endif + #undef PMC_CLASS_TABLE_DESC static const struct pmc_class_descr **pmc_class_table; @@ -2212,6 +2222,44 @@ mips24k_allocate_pmc(enum pmc_event pe, } #endif /* __mips__ */ +#if defined(__powerpc__) + +static struct pmc_event_alias ppc7450_aliases[] = { + EV_ALIAS("instructions", "INSTR_COMPLETED"), + EV_ALIAS("branches", "BRANCHES_COMPLETED"), + EV_ALIAS("branch-mispredicts", "MISPREDICTED_BRANCHES"), + EV_ALIAS(NULL, NULL) +}; + +#define PPC7450_KW_OS "os" +#define PPC7450_KW_USR "usr" +#define PPC7450_KW_ANYTHREAD "anythread" + +static int +ppc7450_allocate_pmc(enum pmc_event pe, char *ctrspec __unused, + struct pmc_op_pmcallocate *pmc_config __unused) +{ + char *p; + + (void) pe; + + pmc_config->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE); + + while ((p = strsep(&ctrspec, ",")) != NULL) { + if (KWMATCH(p, PPC7450_KW_OS)) + pmc_config->pm_caps |= PMC_CAP_SYSTEM; + else if (KWMATCH(p, PPC7450_KW_USR)) + pmc_config->pm_caps |= PMC_CAP_USER; + else if (KWMATCH(p, PPC7450_KW_ANYTHREAD)) + pmc_config->pm_caps |= (PMC_CAP_USER | PMC_CAP_SYSTEM); + else + return (-1); + } + + return (0); +} +#endif /* __powerpc__ */ + /* * Match an event name `name' with its canonical form. @@ -2573,6 +2621,10 @@ pmc_event_names_of_class(enum pmc_class ev = mips24k_event_table; count = PMC_EVENT_TABLE_SIZE(mips24k); break; + case PMC_CLASS_PPC7450: + ev = ppc7450_event_table; + count = PMC_EVENT_TABLE_SIZE(ppc7450); + break; default: errno = EINVAL; return (-1); @@ -2784,6 +2836,12 @@ pmc_init(void) pmc_class_table[n] = &mips24k_class_table_descr; break; #endif /* __mips__ */ +#if defined(__powerpc__) + case PMC_CPU_PPC_7450: + PMC_MDEP_INIT(ppc7450); + pmc_class_table[n] = &ppc7450_class_table_descr; + break; +#endif default: /* * Some kind of CPU this version of the library knows nothing @@ -2924,6 +2982,10 @@ _pmc_name_of_event(enum pmc_event pe, en ev = mips24k_event_table; evfence = mips24k_event_table + PMC_EVENT_TABLE_SIZE(mips24k ); + } else if (pe >= PMC_EV_PPC7450_FIRST && pe <= PMC_EV_PPC7450_LAST) { + ev = ppc7450_event_table; + evfence = ppc7450_event_table + PMC_EVENT_TABLE_SIZE(ppc7450 +); } else if (pe == PMC_EV_TSC_TSC) { ev = tsc_event_table; evfence = tsc_event_table + PMC_EVENT_TABLE_SIZE(tsc); Modified: stable/9/sys/dev/hwpmc/hwpmc_powerpc.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_powerpc.c Wed Jan 18 11:23:46 2012 (r230304) +++ stable/9/sys/dev/hwpmc/hwpmc_powerpc.c Wed Jan 18 11:48:07 2012 (r230305) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2011 Justin Hibbits * Copyright (c) 2005, Joseph Koshy * All rights reserved. * @@ -30,20 +31,297 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include +#include +#include -struct pmc_mdep * -pmc_md_initialize() -{ - return NULL; -} +#define POWERPC_PMC_CAPS (PMC_CAP_INTERRUPT | PMC_CAP_USER | \ + PMC_CAP_SYSTEM | PMC_CAP_EDGE | \ + PMC_CAP_THRESHOLD | PMC_CAP_READ | \ + PMC_CAP_WRITE | PMC_CAP_INVERT | \ + PMC_CAP_QUALIFIER) -void -pmc_md_finalize(struct pmc_mdep *md) -{ - (void) md; -} +#define PPC_SET_PMC1SEL(r, x) ((r & ~(SPR_MMCR0_PMC1SEL(0x3f))) | SPR_MMCR0_PMC1SEL(x)) +#define PPC_SET_PMC2SEL(r, x) ((r & ~(SPR_MMCR0_PMC2SEL(0x3f))) | SPR_MMCR0_PMC2SEL(x)) +#define PPC_SET_PMC3SEL(r, x) ((r & ~(SPR_MMCR1_PMC3SEL(0x1f))) | SPR_MMCR1_PMC3SEL(x)) +#define PPC_SET_PMC4SEL(r, x) ((r & ~(SPR_MMCR1_PMC4SEL(0x1f))) | SPR_MMCR1_PMC4SEL(x)) +#define PPC_SET_PMC5SEL(r, x) ((r & ~(SPR_MMCR1_PMC5SEL(0x1f))) | SPR_MMCR1_PMC5SEL(x)) +#define PPC_SET_PMC6SEL(r, x) ((r & ~(SPR_MMCR1_PMC6SEL(0x3f))) | SPR_MMCR1_PMC6SEL(x)) + +/* Change this when we support more than just the 7450. */ +#define PPC_MAX_PMCS 6 + +#define POWERPC_PMC_KERNEL_ENABLE (0x1 << 30) +#define POWERPC_PMC_USER_ENABLE (0x1 << 31) + +#define POWERPC_PMC_ENABLE (POWERPC_PMC_KERNEL_ENABLE | POWERPC_PMC_USER_ENABLE) +#define POWERPC_RELOAD_COUNT_TO_PERFCTR_VALUE(V) (0x80000000-(V)) +#define POWERPC_PERFCTR_VALUE_TO_RELOAD_COUNT(P) ((P)-0x80000000) +#define POWERPC_PMC_HAS_OVERFLOWED(x) (powerpc_pmcn_read(x) & (0x1 << 31)) + + +/* + * This should work for every 32-bit PowerPC implementation I know of (G3 and G4 + * specifically). PoewrPC 970 will take more work. + */ + +/* + * Per-processor information. + */ +struct powerpc_cpu { + struct pmc_hw *pc_ppcpmcs; +}; + +static struct powerpc_cpu **powerpc_pcpu; + +struct powerpc_event_code_map { + enum pmc_event pe_ev; /* enum value */ + uint8_t pe_counter_mask; /* Which counter this can be counted in. */ + uint8_t pe_code; /* numeric code */ +}; + +#define PPC_PMC_MASK1 0 +#define PPC_PMC_MASK2 1 +#define PPC_PMC_MASK3 2 +#define PPC_PMC_MASK4 3 +#define PPC_PMC_MASK5 4 +#define PPC_PMC_MASK6 5 +#define PPC_PMC_MASK_ALL 0x3f + +#define PMC_POWERPC_EVENT(id, mask, number) \ + { .pe_ev = PMC_EV_PPC7450_##id, .pe_counter_mask = mask, .pe_code = number } + +static struct powerpc_event_code_map powerpc_event_codes[] = { + PMC_POWERPC_EVENT(CYCLE,PPC_PMC_MASK_ALL, 1), + PMC_POWERPC_EVENT(INSTR_COMPLETED, 0x0f, 2), + PMC_POWERPC_EVENT(TLB_BIT_TRANSITIONS, 0x0f, 3), + PMC_POWERPC_EVENT(INSTR_DISPATCHED, 0x0f, 4), + PMC_POWERPC_EVENT(PMON_EXCEPT, 0x0f, 5), + PMC_POWERPC_EVENT(PMON_SIG, 0x0f, 7), + PMC_POWERPC_EVENT(VPU_INSTR_COMPLETED, 0x03, 8), + PMC_POWERPC_EVENT(VFPU_INSTR_COMPLETED, 0x03, 9), + PMC_POWERPC_EVENT(VIU1_INSTR_COMPLETED, 0x03, 10), + PMC_POWERPC_EVENT(VIU2_INSTR_COMPLETED, 0x03, 11), + PMC_POWERPC_EVENT(MTVSCR_INSTR_COMPLETED, 0x03, 12), + PMC_POWERPC_EVENT(MTVRSAVE_INSTR_COMPLETED, 0x03, 13), + PMC_POWERPC_EVENT(VPU_INSTR_WAIT_CYCLES, 0x03, 14), + PMC_POWERPC_EVENT(VFPU_INSTR_WAIT_CYCLES, 0x03, 15), + PMC_POWERPC_EVENT(VIU1_INSTR_WAIT_CYCLES, 0x03, 16), + PMC_POWERPC_EVENT(VIU2_INSTR_WAIT_CYCLES, 0x03, 17), + PMC_POWERPC_EVENT(MFVSCR_SYNC_CYCLES, 0x03, 18), + PMC_POWERPC_EVENT(VSCR_SAT_SET, 0x03, 19), + PMC_POWERPC_EVENT(STORE_INSTR_COMPLETED, 0x03, 20), + PMC_POWERPC_EVENT(L1_INSTR_CACHE_MISSES, 0x03, 21), + PMC_POWERPC_EVENT(L1_DATA_SNOOPS, 0x03, 22), + PMC_POWERPC_EVENT(UNRESOLVED_BRANCHES, 0x01, 23), + PMC_POWERPC_EVENT(SPEC_BUFFER_CYCLES, 0x01, 24), + PMC_POWERPC_EVENT(BRANCH_UNIT_STALL_CYCLES, 0x01, 25), + PMC_POWERPC_EVENT(TRUE_BRANCH_TARGET_HITS, 0x01, 26), + PMC_POWERPC_EVENT(BRANCH_LINK_STAC_PREDICTED, 0x01, 27), + PMC_POWERPC_EVENT(GPR_ISSUE_QUEUE_DISPATCHES, 0x01, 28), + PMC_POWERPC_EVENT(CYCLES_THREE_INSTR_DISPATCHED, 0x01, 29), + PMC_POWERPC_EVENT(THRESHOLD_INSTR_QUEUE_ENTRIES_CYCLES, 0x01, 30), + PMC_POWERPC_EVENT(THRESHOLD_VEC_INSTR_QUEUE_ENTRIES_CYCLES, 0x01, 31), + PMC_POWERPC_EVENT(CYCLES_NO_COMPLETED_INSTRS, 0x01, 32), + PMC_POWERPC_EVENT(IU2_INSTR_COMPLETED, 0x01, 33), + PMC_POWERPC_EVENT(BRANCHES_COMPLETED, 0x01, 34), + PMC_POWERPC_EVENT(EIEIO_INSTR_COMPLETED, 0x01, 35), + PMC_POWERPC_EVENT(MTSPR_INSTR_COMPLETED, 0x01, 36), + PMC_POWERPC_EVENT(SC_INSTR_COMPLETED, 0x01, 37), + PMC_POWERPC_EVENT(LS_LM_COMPLETED, 0x01, 38), + PMC_POWERPC_EVENT(ITLB_HW_TABLE_SEARCH_CYCLES, 0x01, 39), + PMC_POWERPC_EVENT(DTLB_HW_SEARCH_CYCLES_OVER_THRESHOLD, 0x01, 40), + PMC_POWERPC_EVENT(L1_INSTR_CACHE_ACCESSES, 0x01, 41), + PMC_POWERPC_EVENT(INSTR_BKPT_MATCHES, 0x01, 42), + PMC_POWERPC_EVENT(L1_DATA_CACHE_LOAD_MISS_CYCLES_OVER_THRESHOLD, 0x01, 43), + PMC_POWERPC_EVENT(L1_DATA_SNOOP_HIT_ON_MODIFIED, 0x01, 44), + PMC_POWERPC_EVENT(LOAD_MISS_ALIAS, 0x01, 45), + PMC_POWERPC_EVENT(LOAD_MISS_ALIAS_ON_TOUCH, 0x01, 46), + PMC_POWERPC_EVENT(TOUCH_ALIAS, 0x01, 47), + PMC_POWERPC_EVENT(L1_DATA_SNOOP_HIT_CASTOUT_QUEUE, 0x01, 48), + PMC_POWERPC_EVENT(L1_DATA_SNOOP_HIT_CASTOUT, 0x01, 49), + PMC_POWERPC_EVENT(L1_DATA_SNOOP_HITS, 0x01, 50), + PMC_POWERPC_EVENT(WRITE_THROUGH_STORES, 0x01, 51), + PMC_POWERPC_EVENT(CACHE_INHIBITED_STORES, 0x01, 52), + PMC_POWERPC_EVENT(L1_DATA_LOAD_HIT, 0x01, 53), + PMC_POWERPC_EVENT(L1_DATA_TOUCH_HIT, 0x01, 54), + PMC_POWERPC_EVENT(L1_DATA_STORE_HIT, 0x01, 55), + PMC_POWERPC_EVENT(L1_DATA_TOTAL_HITS, 0x01, 56), + PMC_POWERPC_EVENT(DST_INSTR_DISPATCHED, 0x01, 57), + PMC_POWERPC_EVENT(REFRESHED_DSTS, 0x01, 58), + PMC_POWERPC_EVENT(SUCCESSFUL_DST_TABLE_SEARCHES, 0x01, 59), + PMC_POWERPC_EVENT(DSS_INSTR_COMPLETED, 0x01, 60), + PMC_POWERPC_EVENT(DST_STREAM_0_CACHE_LINE_FETCHES, 0x01, 61), + PMC_POWERPC_EVENT(VTQ_SUSPENDS_DUE_TO_CTX_CHANGE, 0x01, 62), + PMC_POWERPC_EVENT(VTQ_LINE_FETCH_HIT, 0x01, 63), + PMC_POWERPC_EVENT(VEC_LOAD_INSTR_COMPLETED, 0x01, 64), + PMC_POWERPC_EVENT(FP_STORE_INSTR_COMPLETED_IN_LSU, 0x01, 65), + PMC_POWERPC_EVENT(FPU_RENORMALIZATION, 0x01, 66), + PMC_POWERPC_EVENT(FPU_DENORMALIZATION, 0x01, 67), + PMC_POWERPC_EVENT(FP_STORE_CAUSES_STALL_IN_LSU, 0x01, 68), + PMC_POWERPC_EVENT(LD_ST_TRUE_ALIAS_STALL, 0x01, 70), + PMC_POWERPC_EVENT(LSU_INDEXED_ALIAS_STALL, 0x01, 71), + PMC_POWERPC_EVENT(LSU_ALIAS_VS_FSQ_WB0_WB1, 0x01, 72), + PMC_POWERPC_EVENT(LSU_ALIAS_VS_CSQ, 0x01, 73), + PMC_POWERPC_EVENT(LSU_LOAD_HIT_LINE_ALIAS_VS_CSQ0, 0x01, 74), + PMC_POWERPC_EVENT(LSU_LOAD_MISS_LINE_ALIAS_VS_CSQ0, 0x01, 75), + PMC_POWERPC_EVENT(LSU_TOUCH_LINE_ALIAS_VS_FSQ_WB0_WB1, 0x01, 76), + PMC_POWERPC_EVENT(LSU_TOUCH_ALIAS_VS_CSQ, 0x01, 77), + PMC_POWERPC_EVENT(LSU_LMQ_FULL_STALL, 0x01, 78), + PMC_POWERPC_EVENT(FP_LOAD_INSTR_COMPLETED_IN_LSU, 0x01, 79), + PMC_POWERPC_EVENT(FP_LOAD_SINGLE_INSTR_COMPLETED_IN_LSU, 0x01, 80), + PMC_POWERPC_EVENT(FP_LOAD_DOUBLE_COMPLETED_IN_LSU, 0x01, 81), + PMC_POWERPC_EVENT(LSU_RA_LATCH_STALL, 0x01, 82), + PMC_POWERPC_EVENT(LSU_LOAD_VS_STORE_QUEUE_ALIAS_STALL, 0x01, 83), + PMC_POWERPC_EVENT(LSU_LMQ_INDEX_ALIAS, 0x01, 84), + PMC_POWERPC_EVENT(LSU_STORE_QUEUE_INDEX_ALIAS, 0x01, 85), + PMC_POWERPC_EVENT(LSU_CSQ_FORWARDING, 0x01, 86), + PMC_POWERPC_EVENT(LSU_MISALIGNED_LOAD_FINISH, 0x01, 87), + PMC_POWERPC_EVENT(LSU_MISALIGN_STORE_COMPLETED, 0x01, 88), + PMC_POWERPC_EVENT(LSU_MISALIGN_STALL, 0x01, 89), + PMC_POWERPC_EVENT(FP_ONE_QUARTER_FPSCR_RENAMES_BUSY, 0x01, 90), + PMC_POWERPC_EVENT(FP_ONE_HALF_FPSCR_RENAMES_BUSY, 0x01, 91), + PMC_POWERPC_EVENT(FP_THREE_QUARTERS_FPSCR_RENAMES_BUSY, 0x01, 92), + PMC_POWERPC_EVENT(FP_ALL_FPSCR_RENAMES_BUSY, 0x01, 93), + PMC_POWERPC_EVENT(FP_DENORMALIZED_RESULT, 0x01, 94), + PMC_POWERPC_EVENT(L1_DATA_TOTAL_MISSES, 0x02, 23), + PMC_POWERPC_EVENT(DISPATCHES_TO_FPR_ISSUE_QUEUE, 0x02, 24), + PMC_POWERPC_EVENT(LSU_INSTR_COMPLETED, 0x02, 25), + PMC_POWERPC_EVENT(LOAD_INSTR_COMPLETED, 0x02, 26), + PMC_POWERPC_EVENT(SS_SM_INSTR_COMPLETED, 0x02, 27), + PMC_POWERPC_EVENT(TLBIE_INSTR_COMPLETED, 0x02, 28), + PMC_POWERPC_EVENT(LWARX_INSTR_COMPLETED, 0x02, 29), + PMC_POWERPC_EVENT(MFSPR_INSTR_COMPLETED, 0x02, 30), + PMC_POWERPC_EVENT(REFETCH_SERIALIZATION, 0x02, 31), + PMC_POWERPC_EVENT(COMPLETION_QUEUE_ENTRIES_OVER_THRESHOLD, 0x02, 32), + PMC_POWERPC_EVENT(CYCLES_ONE_INSTR_DISPATCHED, 0x02, 33), + PMC_POWERPC_EVENT(CYCLES_TWO_INSTR_COMPLETED, 0x02, 34), + PMC_POWERPC_EVENT(ITLB_NON_SPECULATIVE_MISSES, 0x02, 35), + PMC_POWERPC_EVENT(CYCLES_WAITING_FROM_L1_INSTR_CACHE_MISS, 0x02, 36), + PMC_POWERPC_EVENT(L1_DATA_LOAD_ACCESS_MISS, 0x02, 37), + PMC_POWERPC_EVENT(L1_DATA_TOUCH_MISS, 0x02, 38), + PMC_POWERPC_EVENT(L1_DATA_STORE_MISS, 0x02, 39), + PMC_POWERPC_EVENT(L1_DATA_TOUCH_MISS_CYCLES, 0x02, 40), + PMC_POWERPC_EVENT(L1_DATA_CYCLES_USED, 0x02, 41), + PMC_POWERPC_EVENT(DST_STREAM_1_CACHE_LINE_FETCHES, 0x02, 42), + PMC_POWERPC_EVENT(VTQ_STREAM_CANCELED_PREMATURELY, 0x02, 43), + PMC_POWERPC_EVENT(VTQ_RESUMES_DUE_TO_CTX_CHANGE, 0x02, 44), + PMC_POWERPC_EVENT(VTQ_LINE_FETCH_MISS, 0x02, 45), + PMC_POWERPC_EVENT(VTQ_LINE_FETCH, 0x02, 46), + PMC_POWERPC_EVENT(TLBIE_SNOOPS, 0x02, 47), + PMC_POWERPC_EVENT(L1_INSTR_CACHE_RELOADS, 0x02, 48), + PMC_POWERPC_EVENT(L1_DATA_CACHE_RELOADS, 0x02, 49), + PMC_POWERPC_EVENT(L1_DATA_CACHE_CASTOUTS_TO_L2, 0x02, 50), + PMC_POWERPC_EVENT(STORE_MERGE_GATHER, 0x02, 51), + PMC_POWERPC_EVENT(CACHEABLE_STORE_MERGE_TO_32_BYTES, 0x02, 52), + PMC_POWERPC_EVENT(DATA_BKPT_MATCHES, 0x02, 53), + PMC_POWERPC_EVENT(FALL_THROUGH_BRANCHES_PROCESSED, 0x02, 54), + PMC_POWERPC_EVENT(FIRST_SPECULATIVE_BRANCH_BUFFER_RESOLVED_CORRECTLY, 0x02, 55), + PMC_POWERPC_EVENT(SECOND_SPECULATION_BUFFER_ACTIVE, 0x02, 56), + PMC_POWERPC_EVENT(BPU_STALL_ON_LR_DEPENDENCY, 0x02, 57), + PMC_POWERPC_EVENT(BTIC_MISS, 0x02, 58), + PMC_POWERPC_EVENT(BRANCH_LINK_STACK_CORRECTLY_RESOLVED, 0x02, 59), + PMC_POWERPC_EVENT(FPR_ISSUE_STALLED, 0x02, 60), + PMC_POWERPC_EVENT(SWITCHES_BETWEEN_PRIV_USER, 0x02, 61), + PMC_POWERPC_EVENT(LSU_COMPLETES_FP_STORE_SINGLE, 0x02, 62), + PMC_POWERPC_EVENT(CYCLES_TWO_INSTR_COMPLETED, 0x04, 8), + PMC_POWERPC_EVENT(CYCLES_ONE_INSTR_DISPATCHED, 0x04, 9), + PMC_POWERPC_EVENT(VR_ISSUE_QUEUE_DISPATCHES, 0x04, 10), + PMC_POWERPC_EVENT(VR_STALLS, 0x04, 11), + PMC_POWERPC_EVENT(GPR_RENAME_BUFFER_ENTRIES_OVER_THRESHOLD, 0x04, 12), + PMC_POWERPC_EVENT(FPR_ISSUE_QUEUE_ENTRIES, 0x04, 13), + PMC_POWERPC_EVENT(FPU_INSTR_COMPLETED, 0x04, 14), + PMC_POWERPC_EVENT(STWCX_INSTR_COMPLETED, 0x04, 15), + PMC_POWERPC_EVENT(LS_LM_INSTR_PIECES, 0x04, 16), + PMC_POWERPC_EVENT(ITLB_HW_SEARCH_CYCLES_OVER_THRESHOLD, 0x04, 17), + PMC_POWERPC_EVENT(DTLB_MISSES, 0x04, 18), + PMC_POWERPC_EVENT(CANCELLED_L1_INSTR_CACHE_MISSES, 0x04, 19), + PMC_POWERPC_EVENT(L1_DATA_CACHE_OP_HIT, 0x04, 20), + PMC_POWERPC_EVENT(L1_DATA_LOAD_MISS_CYCLES, 0x04, 21), + PMC_POWERPC_EVENT(L1_DATA_PUSHES, 0x04, 22), + PMC_POWERPC_EVENT(L1_DATA_TOTAL_MISS, 0x04, 23), + PMC_POWERPC_EVENT(VT2_FETCHES, 0x04, 24), + PMC_POWERPC_EVENT(TAKEN_BRANCHES_PROCESSED, 0x04, 25), + PMC_POWERPC_EVENT(BRANCH_FLUSHES, 0x04, 26), + PMC_POWERPC_EVENT(SECOND_SPECULATIVE_BRANCH_BUFFER_RESOLVED_CORRECTLY, 0x04, 27), + PMC_POWERPC_EVENT(THIRD_SPECULATION_BUFFER_ACTIVE, 0x04, 28), + PMC_POWERPC_EVENT(BRANCH_UNIT_STALL_ON_CTR_DEPENDENCY, 0x04, 29), + PMC_POWERPC_EVENT(FAST_BTIC_HIT, 0x04, 30), + PMC_POWERPC_EVENT(BRANCH_LINK_STACK_MISPREDICTED, 0x04, 31), + PMC_POWERPC_EVENT(CYCLES_THREE_INSTR_COMPLETED, 0x08, 14), + PMC_POWERPC_EVENT(CYCLES_NO_INSTR_DISPATCHED, 0x08, 15), + PMC_POWERPC_EVENT(GPR_ISSUE_QUEUE_ENTRIES_OVER_THRESHOLD, 0x08, 16), + PMC_POWERPC_EVENT(GPR_ISSUE_QUEUE_STALLED, 0x08, 17), + PMC_POWERPC_EVENT(IU1_INSTR_COMPLETED, 0x08, 18), + PMC_POWERPC_EVENT(DSSALL_INSTR_COMPLETED, 0x08, 19), + PMC_POWERPC_EVENT(TLBSYNC_INSTR_COMPLETED, 0x08, 20), + PMC_POWERPC_EVENT(SYNC_INSTR_COMPLETED, 0x08, 21), + PMC_POWERPC_EVENT(SS_SM_INSTR_PIECES, 0x08, 22), + PMC_POWERPC_EVENT(DTLB_HW_SEARCH_CYCLES, 0x08, 23), + PMC_POWERPC_EVENT(SNOOP_RETRIES, 0x08, 24), + PMC_POWERPC_EVENT(SUCCESSFUL_STWCX, 0x08, 25), + PMC_POWERPC_EVENT(DST_STREAM_3_CACHE_LINE_FETCHES, 0x08, 26), + PMC_POWERPC_EVENT(THIRD_SPECULATIVE_BRANCH_BUFFER_RESOLVED_CORRECTLY, 0x08, 27), + PMC_POWERPC_EVENT(MISPREDICTED_BRANCHES, 0x08, 28), + PMC_POWERPC_EVENT(FOLDED_BRANCHES, 0x08, 29), + PMC_POWERPC_EVENT(FP_STORE_DOUBLE_COMPLETES_IN_LSU, 0x08, 30), + PMC_POWERPC_EVENT(L2_CACHE_HITS, 0x30, 2), + PMC_POWERPC_EVENT(L3_CACHE_HITS, 0x30, 3), + PMC_POWERPC_EVENT(L2_INSTR_CACHE_MISSES, 0x30, 4), + PMC_POWERPC_EVENT(L3_INSTR_CACHE_MISSES, 0x30, 5), + PMC_POWERPC_EVENT(L2_DATA_CACHE_MISSES, 0x30, 6), + PMC_POWERPC_EVENT(L3_DATA_CACHE_MISSES, 0x30, 7), + PMC_POWERPC_EVENT(L2_LOAD_HITS, 0x10, 8), + PMC_POWERPC_EVENT(L2_STORE_HITS, 0x10, 9), + PMC_POWERPC_EVENT(L3_LOAD_HITS, 0x10, 10), + PMC_POWERPC_EVENT(L3_STORE_HITS, 0x10, 11), + PMC_POWERPC_EVENT(L2_TOUCH_HITS, 0x30, 13), + PMC_POWERPC_EVENT(L3_TOUCH_HITS, 0x30, 14), + PMC_POWERPC_EVENT(SNOOP_RETRIES, 0x30, 15), + PMC_POWERPC_EVENT(SNOOP_MODIFIED, 0x10, 16), + PMC_POWERPC_EVENT(SNOOP_VALID, 0x10, 17), + PMC_POWERPC_EVENT(INTERVENTION, 0x30, 18), + PMC_POWERPC_EVENT(L2_CACHE_MISSES, 0x10, 19), + PMC_POWERPC_EVENT(L3_CACHE_MISSES, 0x10, 20), + PMC_POWERPC_EVENT(L2_CACHE_CASTOUTS, 0x20, 8), + PMC_POWERPC_EVENT(L3_CACHE_CASTOUTS, 0x20, 9), + PMC_POWERPC_EVENT(L2SQ_FULL_CYCLES, 0x20, 10), + PMC_POWERPC_EVENT(L3SQ_FULL_CYCLES, 0x20, 11), + PMC_POWERPC_EVENT(RAQ_FULL_CYCLES, 0x20, 16), + PMC_POWERPC_EVENT(WAQ_FULL_CYCLES, 0x20, 17), + PMC_POWERPC_EVENT(L1_EXTERNAL_INTERVENTIONS, 0x20, 19), + PMC_POWERPC_EVENT(L2_EXTERNAL_INTERVENTIONS, 0x20, 20), + PMC_POWERPC_EVENT(L3_EXTERNAL_INTERVENTIONS, 0x20, 21), + PMC_POWERPC_EVENT(EXTERNAL_INTERVENTIONS, 0x20, 22), + PMC_POWERPC_EVENT(EXTERNAL_PUSHES, 0x20, 23), + PMC_POWERPC_EVENT(EXTERNAL_SNOOP_RETRY, 0x20, 24), + PMC_POWERPC_EVENT(DTQ_FULL_CYCLES, 0x20, 25), + PMC_POWERPC_EVENT(BUS_RETRY, 0x20, 26), + PMC_POWERPC_EVENT(L2_VALID_REQUEST, 0x20, 27), + PMC_POWERPC_EVENT(BORDQ_FULL, 0x20, 28), + PMC_POWERPC_EVENT(BUS_TAS_FOR_READS, 0x20, 42), + PMC_POWERPC_EVENT(BUS_TAS_FOR_WRITES, 0x20, 43), + PMC_POWERPC_EVENT(BUS_READS_NOT_RETRIED, 0x20, 44), + PMC_POWERPC_EVENT(BUS_WRITES_NOT_RETRIED, 0x20, 45), + PMC_POWERPC_EVENT(BUS_READS_WRITES_NOT_RETRIED, 0x20, 46), + PMC_POWERPC_EVENT(BUS_RETRY_DUE_TO_L1_RETRY, 0x20, 47), + PMC_POWERPC_EVENT(BUS_RETRY_DUE_TO_PREVIOUS_ADJACENT, 0x20, 48), + PMC_POWERPC_EVENT(BUS_RETRY_DUE_TO_COLLISION, 0x20, 49), + PMC_POWERPC_EVENT(BUS_RETRY_DUE_TO_INTERVENTION_ORDERING, 0x20, 50), + PMC_POWERPC_EVENT(SNOOP_REQUESTS, 0x20, 51), + PMC_POWERPC_EVENT(PREFETCH_ENGINE_REQUEST, 0x20, 52), + PMC_POWERPC_EVENT(PREFETCH_ENGINE_COLLISION_VS_LOAD, 0x20, 53), + PMC_POWERPC_EVENT(PREFETCH_ENGINE_COLLISION_VS_STORE, 0x20, 54), + PMC_POWERPC_EVENT(PREFETCH_ENGINE_COLLISION_VS_INSTR_FETCH, 0x20, 55), + PMC_POWERPC_EVENT(PREFETCH_ENGINE_COLLISION_VS_LOAD_STORE_INSTR_FETCH, 0x20, 56), + PMC_POWERPC_EVENT(PREFETCH_ENGINE_FULL, 0x20, 57) +}; + +const size_t powerpc_event_codes_size = + sizeof(powerpc_event_codes) / sizeof(powerpc_event_codes[0]); int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, @@ -55,6 +333,515 @@ pmc_save_kernel_callchain(uintptr_t *cc, return (0); } +static pmc_value_t +powerpc_pmcn_read(unsigned int pmc) +{ + switch (pmc) { + case 0: + return mfspr(SPR_PMC1); + break; + case 1: + return mfspr(SPR_PMC2); + break; + case 2: + return mfspr(SPR_PMC3); + break; + case 3: + return mfspr(SPR_PMC4); + break; + case 4: + return mfspr(SPR_PMC5); + break; + case 5: + return mfspr(SPR_PMC6); + default: + panic("Invalid PMC number: %d\n", pmc); + } +} + +static void +powerpc_pmcn_write(unsigned int pmc, uint32_t val) +{ + switch (pmc) { + case 0: + mtspr(SPR_PMC1, val); + break; + case 1: + mtspr(SPR_PMC2, val); + break; + case 2: + mtspr(SPR_PMC3, val); + break; + case 3: + mtspr(SPR_PMC4, val); + break; + case 4: + mtspr(SPR_PMC5, val); + break; + case 5: + mtspr(SPR_PMC6, val); + break; + default: + panic("Invalid PMC number: %d\n", pmc); + } +} + +static int +powerpc_allocate_pmc(int cpu, int ri, struct pmc *pm, + const struct pmc_op_pmcallocate *a) +{ + enum pmc_event pe; + uint32_t caps, config, counter; + int i; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < PPC_MAX_PMCS, + ("[powerpc,%d] illegal row index %d", __LINE__, ri)); + + caps = a->pm_caps; + + /* + * TODO: Check actual class for different generations. + */ + if (a->pm_class != PMC_CLASS_PPC7450) + return (EINVAL); + pe = a->pm_ev; + for (i = 0; i < powerpc_event_codes_size; i++) { + if (powerpc_event_codes[i].pe_ev == pe) { + config = powerpc_event_codes[i].pe_code; + counter = powerpc_event_codes[i].pe_counter_mask; + break; + } + } + if (i == powerpc_event_codes_size) + return (EINVAL); + + if ((counter & (1 << ri)) == 0) + return (EINVAL); + + if (caps & PMC_CAP_SYSTEM) + config |= POWERPC_PMC_KERNEL_ENABLE; + if (caps & PMC_CAP_USER) + config |= POWERPC_PMC_USER_ENABLE; + if ((caps & (PMC_CAP_USER | PMC_CAP_SYSTEM)) == 0) + config |= POWERPC_PMC_ENABLE; + + pm->pm_md.pm_powerpc.pm_powerpc_evsel = config; + + PMCDBG(MDP,ALL,2,"powerpc-allocate ri=%d -> config=0x%x", ri, config); + + return 0; +} + +static int +powerpc_read_pmc(int cpu, int ri, pmc_value_t *v) +{ + struct pmc *pm; + pmc_value_t tmp; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < PPC_MAX_PMCS, + ("[powerpc,%d] illegal row index %d", __LINE__, ri)); + + pm = powerpc_pcpu[cpu]->pc_ppcpmcs[ri].phw_pmc; + tmp = powerpc_pmcn_read(ri); + PMCDBG(MDP,REA,2,"ppc-read id=%d -> %jd", ri, tmp); + if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) + *v = POWERPC_PERFCTR_VALUE_TO_RELOAD_COUNT(tmp); + else + *v = tmp; + + return 0; +} + +static int +powerpc_write_pmc(int cpu, int ri, pmc_value_t v) +{ + struct pmc *pm; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < PPC_MAX_PMCS, + ("[powerpc,%d] illegal row-index %d", __LINE__, ri)); + + pm = powerpc_pcpu[cpu]->pc_ppcpmcs[ri].phw_pmc; + + if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) + v = POWERPC_RELOAD_COUNT_TO_PERFCTR_VALUE(v); + + PMCDBG(MDP,WRI,1,"powerpc-write cpu=%d ri=%d v=%jx", cpu, ri, v); + + powerpc_pmcn_write(ri, v); + + return 0; +} + +static int +powerpc_config_pmc(int cpu, int ri, struct pmc *pm) +{ + struct pmc_hw *phw; + + PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm); + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < PPC_MAX_PMCS, + ("[powerpc,%d] illegal row-index %d", __LINE__, ri)); + + phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; + + KASSERT(pm == NULL || phw->phw_pmc == NULL, + ("[powerpc,%d] pm=%p phw->pm=%p hwpmc not unconfigured", + __LINE__, pm, phw->phw_pmc)); + + phw->phw_pmc = pm; + + return 0; +} + +static int +powerpc_start_pmc(int cpu, int ri) +{ + uint32_t config; + struct pmc *pm; + struct pmc_hw *phw; + register_t pmc_mmcr; + + phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; + pm = phw->phw_pmc; + config = pm->pm_md.pm_powerpc.pm_powerpc_evsel & ~POWERPC_PMC_ENABLE; + + /* Enable the PMC. */ + switch (ri) { + case 0: + pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = PPC_SET_PMC1SEL(pmc_mmcr, config); + mtspr(SPR_MMCR0, pmc_mmcr); + break; + case 1: + pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = PPC_SET_PMC2SEL(pmc_mmcr, config); + mtspr(SPR_MMCR0, pmc_mmcr); + break; + case 2: + pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = PPC_SET_PMC3SEL(pmc_mmcr, config); + mtspr(SPR_MMCR1, pmc_mmcr); + break; + case 3: + pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = PPC_SET_PMC4SEL(pmc_mmcr, config); + mtspr(SPR_MMCR0, pmc_mmcr); + break; + case 4: + pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = PPC_SET_PMC5SEL(pmc_mmcr, config); + mtspr(SPR_MMCR1, pmc_mmcr); + break; + case 5: + pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = PPC_SET_PMC6SEL(pmc_mmcr, config); + mtspr(SPR_MMCR1, pmc_mmcr); + break; + default: + break; + } + + /* The mask is inverted (enable is 1) compared to the flags in MMCR0, which + * are Freeze flags. + */ + config = ~pm->pm_md.pm_powerpc.pm_powerpc_evsel & POWERPC_PMC_ENABLE; + + pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr &= ~SPR_MMCR0_FC; + pmc_mmcr |= config; + mtspr(SPR_MMCR0, pmc_mmcr); + + return 0; +} + +static int +powerpc_stop_pmc(int cpu, int ri) +{ + struct pmc *pm; + struct pmc_hw *phw; + register_t pmc_mmcr; + + phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; + pm = phw->phw_pmc; + + /* + * Disable the PMCs. + */ + switch (ri) { + case 0: + pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = PPC_SET_PMC1SEL(pmc_mmcr, 0); + mtspr(SPR_MMCR0, pmc_mmcr); + break; + case 1: + pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = PPC_SET_PMC2SEL(pmc_mmcr, 0); + mtspr(SPR_MMCR0, pmc_mmcr); + break; + case 2: + pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = PPC_SET_PMC3SEL(pmc_mmcr, 0); + mtspr(SPR_MMCR1, pmc_mmcr); + break; + case 3: + pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = PPC_SET_PMC4SEL(pmc_mmcr, 0); + mtspr(SPR_MMCR0, pmc_mmcr); + break; + case 4: + pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = PPC_SET_PMC5SEL(pmc_mmcr, 0); + mtspr(SPR_MMCR1, pmc_mmcr); + break; + case 5: + pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = PPC_SET_PMC6SEL(pmc_mmcr, 0); + mtspr(SPR_MMCR1, pmc_mmcr); + break; + default: + break; + } + return 0; +} + +static int +powerpc_release_pmc(int cpu, int ri, struct pmc *pmc) +{ + struct pmc_hw *phw; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < PPC_MAX_PMCS, + ("[powerpc,%d] illegal row-index %d", __LINE__, ri)); + + phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; + KASSERT(phw->phw_pmc == NULL, + ("[powerpc,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc)); + + return 0; +} + +static int +powerpc_switch_in(struct pmc_cpu *pc, struct pmc_process *pp) +{ + return 0; +} + +static int +powerpc_switch_out(struct pmc_cpu *pc, struct pmc_process *pp) +{ + return 0; +} + +static int +powerpc_intr(int cpu, struct trapframe *tf) +{ + int i, error, retval; + uint32_t config; + struct pmc *pm; + struct powerpc_cpu *pac; + pmc_value_t v; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[powerpc,%d] out of range CPU %d", __LINE__, cpu)); + + PMCDBG(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *) tf, + TRAPF_USERMODE(tf)); + + retval = 0; + + pac = powerpc_pcpu[cpu]; + + /* + * look for all PMCs that have interrupted: + * - look for a running, sampling PMC which has overflowed + * and which has a valid 'struct pmc' association + * + * If found, we call a helper to process the interrupt. + */ + + for (i = 0; i < PPC_MAX_PMCS; i++) { + if ((pm = pac->pc_ppcpmcs[i].phw_pmc) == NULL || + !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) { + continue; + } + + if (!POWERPC_PMC_HAS_OVERFLOWED(i)) + continue; + + retval = 1; /* Found an interrupting PMC. */ + + if (pm->pm_state != PMC_STATE_RUNNING) + continue; + + /* Stop the PMC, reload count. */ + v = pm->pm_sc.pm_reloadcount; + config = mfspr(SPR_MMCR0); + + mtspr(SPR_MMCR0, config | SPR_MMCR0_FC); + powerpc_pmcn_write(i, v); + + /* Restart the counter if logging succeeded. */ + error = pmc_process_interrupt(cpu, pm, tf, TRAPF_USERMODE(tf)); + mtspr(SPR_MMCR0, config); + if (error != 0) + powerpc_stop_pmc(cpu, i); + atomic_add_int(retval ? &pmc_stats.pm_intr_processed : + &pmc_stats.pm_intr_ignored, 1); + + } + + /* Re-enable PERF exceptions. */ + mtspr(SPR_MMCR0, mfspr(SPR_MMCR0) | SPR_MMCR0_PMXE); + + return (retval); +} + +static int +powerpc_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc) +{ + int error; + struct pmc_hw *phw; + char powerpc_name[PMC_NAME_MAX]; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[powerpc,%d], illegal CPU %d", __LINE__, cpu)); + KASSERT(ri >= 0 && ri < PPC_MAX_PMCS, + ("[powerpc,%d] row-index %d out of range", __LINE__, ri)); + + phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; + snprintf(powerpc_name, sizeof(powerpc_name), "POWERPC-%d", ri); + if ((error = copystr(powerpc_name, pi->pm_name, PMC_NAME_MAX, + NULL)) != 0) + return error; + pi->pm_class = PMC_CLASS_PPC7450; + if (phw->phw_state & PMC_PHW_FLAG_IS_ENABLED) { + pi->pm_enabled = TRUE; + *ppmc = phw->phw_pmc; + } else { + pi->pm_enabled = FALSE; + *ppmc = NULL; + } + + return (0); +} + +static int +powerpc_get_config(int cpu, int ri, struct pmc **ppm) +{ + *ppm = powerpc_pcpu[cpu]->pc_ppcpmcs[ri].phw_pmc; + + return 0; +} + +static int +powerpc_pcpu_init(struct pmc_mdep *md, int cpu) +{ + int first_ri, i; + struct pmc_cpu *pc; + struct powerpc_cpu *pac; + struct pmc_hw *phw; + + KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), + ("[powerpc,%d] wrong cpu number %d", __LINE__, cpu)); + PMCDBG(MDP,INI,1,"powerpc-init cpu=%d", cpu); + + powerpc_pcpu[cpu] = pac = malloc(sizeof(struct powerpc_cpu), M_PMC, + M_WAITOK|M_ZERO); + pac->pc_ppcpmcs = malloc(sizeof(struct pmc_hw) * PPC_MAX_PMCS, + M_PMC, M_WAITOK|M_ZERO); + pc = pmc_pcpu[cpu]; + first_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_PPC7450].pcd_ri; + KASSERT(pc != NULL, ("[powerpc,%d] NULL per-cpu pointer", __LINE__)); + + for (i = 0, phw = pac->pc_ppcpmcs; i < PPC_MAX_PMCS; i++, phw++) { + phw->phw_state = PMC_PHW_FLAG_IS_ENABLED | + PMC_PHW_CPU_TO_STATE(cpu) | PMC_PHW_INDEX_TO_STATE(i); + phw->phw_pmc = NULL; + pc->pc_hwpmcs[i + first_ri] = phw; + } + + /* Clear the MMCRs, and set FC, to disable all PMCs. */ + mtspr(SPR_MMCR0, SPR_MMCR0_FC | SPR_MMCR0_PMXE | SPR_MMCR0_PMC1CE | SPR_MMCR0_PMCNCE); + mtspr(SPR_MMCR1, 0); + + return 0; +} + +static int +powerpc_pcpu_fini(struct pmc_mdep *md, int cpu) +{ + uint32_t mmcr0 = mfspr(SPR_MMCR0); + + mmcr0 |= SPR_MMCR0_FC; + mtspr(SPR_MMCR0, mmcr0); + free(powerpc_pcpu[cpu]->pc_ppcpmcs, M_PMC); + free(powerpc_pcpu[cpu], M_PMC); + return 0; +} + +struct pmc_mdep * +pmc_md_initialize() +{ + struct pmc_mdep *pmc_mdep; + struct pmc_classdep *pcd; + + /* + * Allocate space for pointers to PMC HW descriptors and for + * the MDEP structure used by MI code. + */ + powerpc_pcpu = malloc(sizeof(struct powerpc_cpu *) * pmc_cpu_max(), M_PMC, + M_WAITOK|M_ZERO); + + /* Just one class */ + pmc_mdep = malloc(sizeof(struct pmc_mdep) + sizeof(struct pmc_classdep), + M_PMC, M_WAITOK|M_ZERO); + + pmc_mdep->pmd_cputype = PMC_CPU_PPC_7450; + pmc_mdep->pmd_nclass = 1; + + pcd = &pmc_mdep->pmd_classdep[PMC_MDEP_CLASS_INDEX_PPC7450]; + pcd->pcd_caps = POWERPC_PMC_CAPS; + pcd->pcd_class = PMC_CLASS_PPC7450; + pcd->pcd_num = PPC_MAX_PMCS; + pcd->pcd_ri = pmc_mdep->pmd_npmc; + pcd->pcd_width = 32; /* All PMCs, even in ppc970, are 32-bit */ + + pcd->pcd_allocate_pmc = powerpc_allocate_pmc; + pcd->pcd_config_pmc = powerpc_config_pmc; + pcd->pcd_pcpu_fini = powerpc_pcpu_fini; + pcd->pcd_pcpu_init = powerpc_pcpu_init; + pcd->pcd_describe = powerpc_describe; + pcd->pcd_get_config = powerpc_get_config; + pcd->pcd_read_pmc = powerpc_read_pmc; + pcd->pcd_release_pmc = powerpc_release_pmc; + pcd->pcd_start_pmc = powerpc_start_pmc; + pcd->pcd_stop_pmc = powerpc_stop_pmc; + pcd->pcd_write_pmc = powerpc_write_pmc; + + pmc_mdep->pmd_intr = powerpc_intr; + pmc_mdep->pmd_switch_in = powerpc_switch_in; + pmc_mdep->pmd_switch_out = powerpc_switch_out; + + pmc_mdep->pmd_npmc += PPC_MAX_PMCS; + + return (pmc_mdep); +} + +void +pmc_md_finalize(struct pmc_mdep *md) +{ + free(md, M_PMC); +} + int pmc_save_user_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) Modified: stable/9/sys/dev/hwpmc/pmc_events.h ============================================================================== --- stable/9/sys/dev/hwpmc/pmc_events.h Wed Jan 18 11:23:46 2012 (r230304) +++ stable/9/sys/dev/hwpmc/pmc_events.h Wed Jan 18 11:48:07 2012 (r230305) @@ -3093,6 +3093,231 @@ __PMC_EV_ALIAS("CYCLES_UNHALTED_L3_FLL_D #define PMC_EV_MIPS24K_FIRST PMC_EV_MIPS24K_CYCLE #define PMC_EV_MIPS24K_LAST PMC_EV_MIPS24K_WBB_FULL_PIPELINE_STALLS +#define __PMC_EV_PPC7450() \ + __PMC_EV(PPC7450, CYCLE) \ + __PMC_EV(PPC7450, INSTR_COMPLETED) \ + __PMC_EV(PPC7450, TLB_BIT_TRANSITIONS) \ + __PMC_EV(PPC7450, INSTR_DISPATCHED) \ + __PMC_EV(PPC7450, PMON_EXCEPT) \ + __PMC_EV(PPC7450, PMON_SIG) \ + __PMC_EV(PPC7450, VPU_INSTR_COMPLETED) \ + __PMC_EV(PPC7450, VFPU_INSTR_COMPLETED) \ + __PMC_EV(PPC7450, VIU1_INSTR_COMPLETED) \ + __PMC_EV(PPC7450, VIU2_INSTR_COMPLETED) \ + __PMC_EV(PPC7450, MTVSCR_INSTR_COMPLETED) \ + __PMC_EV(PPC7450, MTVRSAVE_INSTR_COMPLETED) \ + __PMC_EV(PPC7450, VPU_INSTR_WAIT_CYCLES) \ + __PMC_EV(PPC7450, VFPU_INSTR_WAIT_CYCLES) \ + __PMC_EV(PPC7450, VIU1_INSTR_WAIT_CYCLES) \ + __PMC_EV(PPC7450, VIU2_INSTR_WAIT_CYCLES) \ + __PMC_EV(PPC7450, MFVSCR_SYNC_CYCLES) \ + __PMC_EV(PPC7450, VSCR_SAT_SET) \ + __PMC_EV(PPC7450, STORE_INSTR_COMPLETED) \ + __PMC_EV(PPC7450, L1_INSTR_CACHE_MISSES) \ + __PMC_EV(PPC7450, L1_DATA_SNOOPS) \ + __PMC_EV(PPC7450, UNRESOLVED_BRANCHES) \ + __PMC_EV(PPC7450, SPEC_BUFFER_CYCLES) \ + __PMC_EV(PPC7450, BRANCH_UNIT_STALL_CYCLES) \ + __PMC_EV(PPC7450, TRUE_BRANCH_TARGET_HITS) \ + __PMC_EV(PPC7450, BRANCH_LINK_STAC_PREDICTED) \ + __PMC_EV(PPC7450, GPR_ISSUE_QUEUE_DISPATCHES) \ + __PMC_EV(PPC7450, CYCLES_THREE_INSTR_DISPATCHED) \ + __PMC_EV(PPC7450, THRESHOLD_INSTR_QUEUE_ENTRIES_CYCLES) \ + __PMC_EV(PPC7450, THRESHOLD_VEC_INSTR_QUEUE_ENTRIES_CYCLES) \ + __PMC_EV(PPC7450, CYCLES_NO_COMPLETED_INSTRS) \ + __PMC_EV(PPC7450, IU2_INSTR_COMPLETED) \ + __PMC_EV(PPC7450, BRANCHES_COMPLETED) \ + __PMC_EV(PPC7450, EIEIO_INSTR_COMPLETED) \ + __PMC_EV(PPC7450, MTSPR_INSTR_COMPLETED) \ + __PMC_EV(PPC7450, SC_INSTR_COMPLETED) \ + __PMC_EV(PPC7450, LS_LM_COMPLETED) \ + __PMC_EV(PPC7450, ITLB_HW_TABLE_SEARCH_CYCLES) \ + __PMC_EV(PPC7450, DTLB_HW_SEARCH_CYCLES_OVER_THRESHOLD) \ + __PMC_EV(PPC7450, L1_INSTR_CACHE_ACCESSES) \ + __PMC_EV(PPC7450, INSTR_BKPT_MATCHES) \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 18 21:49:37 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 605A5106566C; Wed, 18 Jan 2012 21:49:37 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E5348FC13; Wed, 18 Jan 2012 21: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 q0ILnbBG058344; Wed, 18 Jan 2012 21:49:37 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ILnbPG058342; Wed, 18 Jan 2012 21:49:37 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201201182149.q0ILnbPG058342@svn.freebsd.org> From: Don Lewis Date: Wed, 18 Jan 2012 21: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: r230317 - stable/9/sys/dev/pst 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, 18 Jan 2012 21:49:37 -0000 Author: truckman Date: Wed Jan 18 21:49:37 2012 New Revision: 230317 URL: http://svn.freebsd.org/changeset/base/230317 Log: MFC: r229984 Pass the arguments to mtx_init() in the correct order. There should be no change to the binary because the value of MTX_DEF is zero and there is a visible function prototype. Modified: stable/9/sys/dev/pst/pst-pci.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/pst/pst-pci.c ============================================================================== --- stable/9/sys/dev/pst/pst-pci.c Wed Jan 18 21:27:49 2012 (r230316) +++ stable/9/sys/dev/pst/pst-pci.c Wed Jan 18 21:49:37 2012 (r230317) @@ -95,7 +95,7 @@ iop_pci_attach(device_t dev) sc->ibase = rman_get_virtual(sc->r_mem); sc->reg = (struct i2o_registers *)sc->ibase; sc->dev = dev; - mtx_init(&sc->mtx, "pst lock", MTX_DEF, 0); + mtx_init(&sc->mtx, "pst lock", NULL, MTX_DEF); if (!iop_init(sc)) return 0; From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 18 21:54: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 7BD09106564A; Wed, 18 Jan 2012 21:54:34 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4428FC0A; Wed, 18 Jan 2012 21:54: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 q0ILsY2K058623; Wed, 18 Jan 2012 21:54:34 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ILsY2K058621; Wed, 18 Jan 2012 21:54:34 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201201182154.q0ILsY2K058621@svn.freebsd.org> From: "George V. Neville-Neil" Date: Wed, 18 Jan 2012 21:54: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: r230320 - stable/9/sys/dev/null 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, 18 Jan 2012 21:54:34 -0000 Author: gnn Date: Wed Jan 18 21:54:34 2012 New Revision: 230320 URL: http://svn.freebsd.org/changeset/base/230320 Log: MFC: 229965 Fix for PR 138526. Add the ability for /dev/null and /dev/zero to accept being set into non blocking mode via fcntl(). This brings the code into compliance with IEEE Std 1003.1-2001 as referenced in another PR, 94729. Reviewed by: jhb Modified: stable/9/sys/dev/null/null.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) Modified: stable/9/sys/dev/null/null.c ============================================================================== --- stable/9/sys/dev/null/null.c Wed Jan 18 21:51:56 2012 (r230319) +++ stable/9/sys/dev/null/null.c Wed Jan 18 21:54:34 2012 (r230320) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -49,6 +50,7 @@ static struct cdev *zero_dev; static d_write_t null_write; static d_ioctl_t null_ioctl; +static d_ioctl_t zero_ioctl; static d_read_t zero_read; static struct cdevsw null_cdevsw = { @@ -63,6 +65,7 @@ static struct cdevsw zero_cdevsw = { .d_version = D_VERSION, .d_read = zero_read, .d_write = null_write, + .d_ioctl = zero_ioctl, .d_name = "zero", .d_flags = D_MMAP_ANON, }; @@ -82,17 +85,50 @@ null_ioctl(struct cdev *dev __unused, u_ int flags __unused, struct thread *td) { int error; + error = 0; - if (cmd != DIOCSKERNELDUMP) - return (ENOIOCTL); - error = priv_check(td, PRIV_SETDUMPER); - if (error) - return (error); - return (set_dumper(NULL)); + switch (cmd) { + case DIOCSKERNELDUMP: + error = priv_check(td, PRIV_SETDUMPER); + if (error == 0) + error = set_dumper(NULL); + break; + case FIONBIO: + break; + case FIOASYNC: + if (*(int *)data != 0) + error = EINVAL; + break; + default: + error = ENOIOCTL; + } + return (error); } /* ARGSUSED */ static int +zero_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data __unused, + int flags __unused, struct thread *td) +{ + int error; + error = 0; + + switch (cmd) { + case FIONBIO: + break; + case FIOASYNC: + if (*(int *)data != 0) + error = EINVAL; + break; + default: + error = ENOIOCTL; + } + return (error); +} + + +/* ARGSUSED */ +static int zero_read(struct cdev *dev __unused, struct uio *uio, int flags __unused) { void *zbuf; From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 18 21:59:33 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 04400106566B; Wed, 18 Jan 2012 21:59:33 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E56918FC0A; Wed, 18 Jan 2012 21:59:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ILxW8r058826; Wed, 18 Jan 2012 21:59:32 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ILxWEL058823; Wed, 18 Jan 2012 21:59:32 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201201182159.q0ILxWEL058823@svn.freebsd.org> From: Christian Brueffer Date: Wed, 18 Jan 2012 21:59: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: r230321 - in stable/9/release/doc: en_US.ISO8859-1/hardware 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: Wed, 18 Jan 2012 21:59:33 -0000 Author: brueffer Date: Wed Jan 18 21:59:32 2012 New Revision: 230321 URL: http://svn.freebsd.org/changeset/base/230321 Log: MFC: r229977 Add hpt27xx to the hardware notes, While here, add the 2012 copyright. Modified: stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml stable/9/release/doc/share/misc/dev.archlist.txt Directory Properties: stable/9/release/ (props changed) stable/9/release/doc/en_US.ISO8859-1/hardware/ (props changed) Modified: stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml Wed Jan 18 21:54:34 2012 (r230320) +++ stable/9/release/doc/en_US.ISO8859-1/hardware/article.sgml Wed Jan 18 21:59:32 2012 (r230321) @@ -32,6 +32,7 @@ 2009 2010 2011 + 2012 The &os; Documentation Project @@ -775,6 +776,8 @@ &hwlist.esp; + &hwlist.hpt27xx; + &hwlist.hptiop; &hwlist.hptmv; Modified: stable/9/release/doc/share/misc/dev.archlist.txt ============================================================================== --- stable/9/release/doc/share/misc/dev.archlist.txt Wed Jan 18 21:54:34 2012 (r230320) +++ stable/9/release/doc/share/misc/dev.archlist.txt Wed Jan 18 21:59:32 2012 (r230321) @@ -72,6 +72,7 @@ ex i386,amd64 fe i386,pc98,amd64 fwohci i386,sparc64,ia64,amd64,powerpc hifn i386,pc98,amd64 +hpt27xx i386,amd64 hptiop i386,amd64 hptmv i386,amd64 hptrr i386,amd64 From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 20 15:16:01 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 538F61065673; Fri, 20 Jan 2012 15:16:01 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 298E08FC15; Fri, 20 Jan 2012 15:16:01 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 66A3C46B09; Fri, 20 Jan 2012 10:16:00 -0500 (EST) Date: Fri, 20 Jan 2012 15:16:00 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Hans Petter Selasky , re@FreeBSD.org In-Reply-To: <201201180757.q0I7vHiw029172@svn.freebsd.org> Message-ID: References: <201201180757.q0I7vHiw029172@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller 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, 20 Jan 2012 15:16:01 -0000 On Wed, 18 Jan 2012, Hans Petter Selasky wrote: > Author: hselasky > Date: Wed Jan 18 07:57:17 2012 > New Revision: 230302 > URL: http://svn.freebsd.org/changeset/base/230302 > > Log: > MFC r230032, r230050, r230090, r230091 and r228493. > - Various XHCI and USB 3.0 related issues. > - USB 3.0 HUBs should work after this change. Should some portion of this be issued as an Errata Note against supported 8.x and 9.x releases -- in particular, support for USB 3.0 hubs? Robert From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 20 15:43: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 4EFB21065677; Fri, 20 Jan 2012 15:43:09 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38D218FC0C; Fri, 20 Jan 2012 15:43: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 q0KFh95d047866; Fri, 20 Jan 2012 15:43:09 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0KFh9Rh047864; Fri, 20 Jan 2012 15:43:09 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201201543.q0KFh9Rh047864@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 20 Jan 2012 15:43: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: r230381 - stable/9/usr.bin/xlint/xlint 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, 20 Jan 2012 15:43:09 -0000 Author: jilles Date: Fri Jan 20 15:43:08 2012 New Revision: 230381 URL: http://svn.freebsd.org/changeset/base/230381 Log: MFC r227123: lint: Fix lseek() argument order. Because SEEK_SET is 0, this seems to have no effect on the generated code. PR: bin/160806 Submitted by: Henning Petersen Obtained from: NetBSD Modified: stable/9/usr.bin/xlint/xlint/xlint.c Directory Properties: stable/9/usr.bin/xlint/ (props changed) Modified: stable/9/usr.bin/xlint/xlint/xlint.c ============================================================================== --- stable/9/usr.bin/xlint/xlint/xlint.c Fri Jan 20 14:44:21 2012 (r230380) +++ stable/9/usr.bin/xlint/xlint/xlint.c Fri Jan 20 15:43:08 2012 (r230381) @@ -656,7 +656,7 @@ fname(const char *name) appcstrg(&args, name); /* we reuse the same tmp file for cpp output, so rewind and truncate */ - if (lseek(cppoutfd, SEEK_SET, (off_t)0) != 0) { + if (lseek(cppoutfd, (off_t)0, SEEK_SET) != 0) { warn("lseek"); terminate(-1); } From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 20 16:29:17 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 8E5D31065672; Fri, 20 Jan 2012 16:29:17 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 780EC8FC15; Fri, 20 Jan 2012 16:29:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0KGTHod049509; Fri, 20 Jan 2012 16:29:17 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0KGTH5M049507; Fri, 20 Jan 2012 16:29:17 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201201629.q0KGTH5M049507@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 20 Jan 2012 16:29: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: r230384 - stable/9/tools/regression/fifo/fifo_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: Fri, 20 Jan 2012 16:29:17 -0000 Author: jilles Date: Fri Jan 20 16:29:17 2012 New Revision: 230384 URL: http://svn.freebsd.org/changeset/base/230384 Log: MFC r227124: fifo_misc test: Fix swapped lseek arguments. It worked regardless because SEEK_CUR happens to be 1. PR: misc/160866 Modified: stable/9/tools/regression/fifo/fifo_misc/fifo_misc.c Directory Properties: stable/9/tools/regression/fifo/ (props changed) Modified: stable/9/tools/regression/fifo/fifo_misc/fifo_misc.c ============================================================================== --- stable/9/tools/regression/fifo/fifo_misc/fifo_misc.c Fri Jan 20 15:46:46 2012 (r230383) +++ stable/9/tools/regression/fifo/fifo_misc/fifo_misc.c Fri Jan 20 16:29:17 2012 (r230384) @@ -115,7 +115,7 @@ test_lseek(void) exit(-1); } - if (lseek(reader_fd, SEEK_CUR, 1) >= 0) { + if (lseek(reader_fd, 1, SEEK_CUR) >= 0) { warnx("%s: lseek succeeded instead of returning ESPIPE", __func__); cleanfifo("testfifo", reader_fd, writer_fd); From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 20 21:41: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 5739D106566C; Fri, 20 Jan 2012 21:41:58 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe04.c2i.net [212.247.154.98]) by mx1.freebsd.org (Postfix) with ESMTP id 2E8EC8FC0A; Fri, 20 Jan 2012 21:41:56 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe04.swip.net (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 230061764; Fri, 20 Jan 2012 22:31:51 +0100 From: Hans Petter Selasky To: Robert Watson Date: Fri, 20 Jan 2012 22:29:43 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201201180757.q0I7vHiw029172@svn.freebsd.org> In-Reply-To: X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201201202229.43815.hselasky@c2i.net> Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "re@FreeBSD.org" , "svn-src-stable-9@freebsd.org" Subject: Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller 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, 20 Jan 2012 21:41:58 -0000 On Friday 20 January 2012 16:16:00 Robert Watson wrote: > On Wed, 18 Jan 2012, Hans Petter Selasky wrote: > > Author: hselasky > > Date: Wed Jan 18 07:57:17 2012 > > New Revision: 230302 > > URL: http://svn.freebsd.org/changeset/base/230302 > > > > Log: > > MFC r230032, r230050, r230090, r230091 and r228493. > > - Various XHCI and USB 3.0 related issues. > > - USB 3.0 HUBs should work after this change. > > Should some portion of this be issued as an Errata Note against supported > 8.x and 9.x releases -- in particular, support for USB 3.0 hubs? > > Robert hrs @ already did that with the 9-release errata I believe. --HPS From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 20 21:43:33 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 BD6DC106566B; Fri, 20 Jan 2012 21:43:33 +0000 (UTC) (envelope-from rwatson@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8F09B8FC0C; Fri, 20 Jan 2012 21:43:33 +0000 (UTC) Received: from [192.168.2.105] (host86-161-238-124.range86-161.btcentralplus.com [86.161.238.124]) by cyrus.watson.org (Postfix) with ESMTPSA id D305446B0C; Fri, 20 Jan 2012 16:43:31 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=windows-1252 From: "Robert N. M. Watson" In-Reply-To: <201201202229.43815.hselasky@c2i.net> Date: Fri, 20 Jan 2012 21:43:29 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <12FADCFC-8ECB-4B7F-80B7-8802DD40C14B@freebsd.org> References: <201201180757.q0I7vHiw029172@svn.freebsd.org> <201201202229.43815.hselasky@c2i.net> To: Hans Petter Selasky X-Mailer: Apple Mail (2.1251.1) Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "re@FreeBSD.org" , "svn-src-stable-9@freebsd.org" Subject: Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller 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, 20 Jan 2012 21:43:33 -0000 On 20 Jan 2012, at 21:29, Hans Petter Selasky wrote: > On Friday 20 January 2012 16:16:00 Robert Watson wrote: >> On Wed, 18 Jan 2012, Hans Petter Selasky wrote: >>> Author: hselasky >>> Date: Wed Jan 18 07:57:17 2012 >>> New Revision: 230302 >>> URL: http://svn.freebsd.org/changeset/base/230302 >>>=20 >>> Log: >>> MFC r230032, r230050, r230090, r230091 and r228493. >>> - Various XHCI and USB 3.0 related issues. >>> - USB 3.0 HUBs should work after this change. >>=20 >> Should some portion of this be issued as an Errata Note against = supported >> 8.x and 9.x releases -- in particular, support for USB 3.0 hubs? >=20 > hrs @ already did that with the 9-release errata I believe. Sorry, I may have been unclear -- I meant Errata Note in the = freebsd-update sense, not as in the release note errata. Robert= From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 01:24:07 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 4A742106566B; Sat, 21 Jan 2012 01:24: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 36C1D8FC18; Sat, 21 Jan 2012 01:24: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 q0L1O7lK067648; Sat, 21 Jan 2012 01:24:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0L1O66T067640; Sat, 21 Jan 2012 01:24:06 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201210124.q0L1O66T067640@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 21 Jan 2012 01:24:06 +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: r230410 - in stable/9: include lib/libc/gen libexec/rtld-elf 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, 21 Jan 2012 01:24:07 -0000 Author: kib Date: Sat Jan 21 01:24:06 2012 New Revision: 230410 URL: http://svn.freebsd.org/changeset/base/230410 Log: MFC r229768: Implement fdlopen(3), an rtld interface to load shared object by file descriptor. Modified: stable/9/include/dlfcn.h stable/9/lib/libc/gen/Makefile.inc stable/9/lib/libc/gen/Symbol.map stable/9/lib/libc/gen/dlfcn.c stable/9/lib/libc/gen/dlopen.3 stable/9/libexec/rtld-elf/Symbol.map stable/9/libexec/rtld-elf/rtld.c Directory Properties: stable/9/include/ (props changed) stable/9/lib/libc/ (props changed) stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/include/dlfcn.h ============================================================================== --- stable/9/include/dlfcn.h Sat Jan 21 00:42:28 2012 (r230409) +++ stable/9/include/dlfcn.h Sat Jan 21 01:24:06 2012 (r230410) @@ -118,6 +118,7 @@ void *dlopen(const char *, int); void *dlsym(void * __restrict, const char * __restrict); #if __BSD_VISIBLE +void *fdlopen(int, int); int dladdr(const void * __restrict, Dl_info * __restrict); dlfunc_t dlfunc(void * __restrict, const char * __restrict); int dlinfo(void * __restrict, int, void * __restrict); Modified: stable/9/lib/libc/gen/Makefile.inc ============================================================================== --- stable/9/lib/libc/gen/Makefile.inc Sat Jan 21 00:42:28 2012 (r230409) +++ stable/9/lib/libc/gen/Makefile.inc Sat Jan 21 01:24:06 2012 (r230410) @@ -93,8 +93,8 @@ MLINKS+=directory.3 closedir.3 directory directory.3 fdopendir.3 \ directory.3 readdir.3 directory.3 readdir_r.3 directory.3 rewinddir.3 \ directory.3 seekdir.3 directory.3 telldir.3 -MLINKS+=dlopen.3 dlclose.3 dlopen.3 dlerror.3 dlopen.3 dlfunc.3 \ - dlopen.3 dlsym.3 +MLINKS+=dlopen.3 fdlopen.3 dlopen.3 dlclose.3 dlopen.3 dlerror.3 \ + dlopen.3 dlfunc.3 dlopen.3 dlsym.3 MLINKS+=err.3 err_set_exit.3 err.3 err_set_file.3 err.3 errc.3 err.3 errx.3 \ err.3 verr.3 err.3 verrc.3 err.3 verrx.3 err.3 vwarn.3 err.3 vwarnc.3 \ err.3 vwarnx.3 err.3 warnc.3 err.3 warn.3 err.3 warnx.3 Modified: stable/9/lib/libc/gen/Symbol.map ============================================================================== --- stable/9/lib/libc/gen/Symbol.map Sat Jan 21 00:42:28 2012 (r230409) +++ stable/9/lib/libc/gen/Symbol.map Sat Jan 21 01:24:06 2012 (r230410) @@ -381,6 +381,7 @@ FBSD_1.2 { }; FBSD_1.3 { + fdlopen; __FreeBSD_libc_enter_restricted_mode; }; Modified: stable/9/lib/libc/gen/dlfcn.c ============================================================================== --- stable/9/lib/libc/gen/dlfcn.c Sat Jan 21 00:42:28 2012 (r230409) +++ stable/9/lib/libc/gen/dlfcn.c Sat Jan 21 01:24:06 2012 (r230410) @@ -147,6 +147,15 @@ dl_iterate_phdr(int (*callback)(struct d return 0; } +#pragma weak fdlopen +void * +fdlopen(int fd, int mode) +{ + + _rtld_error(sorry); + return NULL; +} + #pragma weak _rtld_atfork_pre void _rtld_atfork_pre(int *locks) Modified: stable/9/lib/libc/gen/dlopen.3 ============================================================================== --- stable/9/lib/libc/gen/dlopen.3 Sat Jan 21 00:42:28 2012 (r230409) +++ stable/9/lib/libc/gen/dlopen.3 Sat Jan 21 01:24:06 2012 (r230410) @@ -32,11 +32,12 @@ .\" @(#) dlopen.3 1.6 90/01/31 SMI .\" $FreeBSD$ .\" -.Dd July 7, 2009 +.Dd December 21, 2011 .Dt DLOPEN 3 .Os .Sh NAME .Nm dlopen , +.Nm fdlopen , .Nm dlsym , .Nm dlfunc , .Nm dlerror , @@ -49,6 +50,8 @@ .Ft void * .Fn dlopen "const char *path" "int mode" .Ft void * +.Fn fdlopen "int fd" "int mode" +.Ft void * .Fn dlsym "void * restrict handle" "const char * restrict symbol" .Ft dlfunc_t .Fn dlfunc "void * restrict handle" "const char * restrict symbol" @@ -164,6 +167,36 @@ be interrogated with .Fn dlerror . .Pp The +.Fn fdlopen +function is similar to +.Fn dlopen , +but it takes the file descriptor argument +.Fa fd , +which is used for the file operations needed to load an object +into the address space. +The file descriptor +.Fa fd +is not closed by the function regardless a result of execution, +but a duplicate of the file descriptor is. +This may be important if a +.Xr lockf 3 +lock is held on the passed descriptor. +The +.Fa fd +argument -1 is interpreted as a reference to the main +executable of the process, similar to +.Va NULL +value for the +.Fa name +argument to +.Fn dlopen . +The +.Fn fdlopen +function can be used by the code that needs to perform +additional checks on the loaded objects, to prevent races with +symlinking or renames. +.Pp +The .Fn dlsym function returns the address binding of the symbol described in the null-terminated @@ -354,6 +387,7 @@ option to the C language compiler. .Sh ERRORS The .Fn dlopen , +.Fn fdlopen , .Fn dlsym , and .Fn dlfunc Modified: stable/9/libexec/rtld-elf/Symbol.map ============================================================================== --- stable/9/libexec/rtld-elf/Symbol.map Sat Jan 21 00:42:28 2012 (r230409) +++ stable/9/libexec/rtld-elf/Symbol.map Sat Jan 21 01:24:06 2012 (r230410) @@ -18,6 +18,10 @@ FBSD_1.0 { __tls_get_addr; }; +FBSD_1.3 { + fdlopen; +}; + FBSDprivate_1.0 { _rtld_thread_init; _rtld_allocate_tls; Modified: stable/9/libexec/rtld-elf/rtld.c ============================================================================== --- stable/9/libexec/rtld-elf/rtld.c Sat Jan 21 00:42:28 2012 (r230409) +++ stable/9/libexec/rtld-elf/rtld.c Sat Jan 21 01:24:06 2012 (r230410) @@ -83,7 +83,7 @@ static void digest_dynamic2(Obj_Entry *, static void digest_dynamic(Obj_Entry *, int); static Obj_Entry *digest_phdr(const Elf_Phdr *, int, caddr_t, const char *); static Obj_Entry *dlcheck(void *); -static Obj_Entry *dlopen_object(const char *name, Obj_Entry *refobj, +static Obj_Entry *dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags, int mode); static Obj_Entry *do_load_object(int, const char *, char *, struct stat *, int); static int do_search_info(const Obj_Entry *obj, int, struct dl_serinfo *); @@ -103,7 +103,7 @@ static void load_filtees(Obj_Entry *, in static void unload_filtees(Obj_Entry *); static int load_needed_objects(Obj_Entry *, int); static int load_preload_objects(void); -static Obj_Entry *load_object(const char *, const Obj_Entry *, int); +static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int); static void map_stacks_exec(RtldLockState *); static Obj_Entry *obj_from_addr(const void *); static void objlist_call_fini(Objlist *, Obj_Entry *, RtldLockState *); @@ -120,6 +120,7 @@ static int resolve_objects_ifunc(Obj_Ent RtldLockState *lockstate); static int rtld_dirname(const char *, char *); static int rtld_dirname_abs(const char *, char *); +static void *rtld_dlopen(const char *name, int fd, int mode); static void rtld_exit(void); static char *search_library_path(const char *, const char *); static const void **get_program_var_addr(const char *, RtldLockState *); @@ -1544,7 +1545,7 @@ load_filtee1(Obj_Entry *obj, Needed_Entr { for (; needed != NULL; needed = needed->next) { - needed->obj = dlopen_object(obj->strtab + needed->name, obj, + needed->obj = dlopen_object(obj->strtab + needed->name, -1, obj, flags, ((ld_loadfltr || obj->z_loadfltr) ? RTLD_NOW : RTLD_LAZY) | RTLD_LOCAL); } @@ -1568,7 +1569,7 @@ process_needed(Obj_Entry *obj, Needed_En Obj_Entry *obj1; for (; needed != NULL; needed = needed->next) { - obj1 = needed->obj = load_object(obj->strtab + needed->name, obj, + obj1 = needed->obj = load_object(obj->strtab + needed->name, -1, obj, flags & ~RTLD_LO_NOLOAD); if (obj1 == NULL && !ld_tracing && (flags & RTLD_LO_FILTEES) == 0) return (-1); @@ -1615,7 +1616,7 @@ load_preload_objects(void) savech = p[len]; p[len] = '\0'; - if (load_object(p, NULL, 0) == NULL) + if (load_object(p, -1, NULL, 0) == NULL) return -1; /* XXX - cleanup */ p[len] = savech; p += len; @@ -1625,43 +1626,68 @@ load_preload_objects(void) return 0; } +static const char * +printable_path(const char *path) +{ + + return (path == NULL ? "" : path); +} + /* - * Load a shared object into memory, if it is not already loaded. + * Load a shared object into memory, if it is not already loaded. The + * object may be specified by name or by user-supplied file descriptor + * fd_u. In the later case, the fd_u descriptor is not closed, but its + * duplicate is. * * Returns a pointer to the Obj_Entry for the object. Returns NULL * on failure. */ static Obj_Entry * -load_object(const char *name, const Obj_Entry *refobj, int flags) +load_object(const char *name, int fd_u, const Obj_Entry *refobj, int flags) { Obj_Entry *obj; - int fd = -1; + int fd; struct stat sb; char *path; - for (obj = obj_list->next; obj != NULL; obj = obj->next) - if (object_match_name(obj, name)) - return obj; + if (name != NULL) { + for (obj = obj_list->next; obj != NULL; obj = obj->next) { + if (object_match_name(obj, name)) + return (obj); + } - path = find_library(name, refobj); - if (path == NULL) - return NULL; + path = find_library(name, refobj); + if (path == NULL) + return (NULL); + } else + path = NULL; /* - * If we didn't find a match by pathname, open the file and check - * again by device and inode. This avoids false mismatches caused - * by multiple links or ".." in pathnames. + * If we didn't find a match by pathname, or the name is not + * supplied, open the file and check again by device and inode. + * This avoids false mismatches caused by multiple links or ".." + * in pathnames. * * To avoid a race, we open the file and use fstat() rather than * using stat(). */ - if ((fd = open(path, O_RDONLY)) == -1) { - _rtld_error("Cannot open \"%s\"", path); - free(path); - return NULL; + fd = -1; + if (fd_u == -1) { + if ((fd = open(path, O_RDONLY)) == -1) { + _rtld_error("Cannot open \"%s\"", path); + free(path); + return (NULL); + } + } else { + fd = dup(fd_u); + if (fd == -1) { + _rtld_error("Cannot dup fd"); + free(path); + return (NULL); + } } if (fstat(fd, &sb) == -1) { - _rtld_error("Cannot fstat \"%s\"", path); + _rtld_error("Cannot fstat \"%s\"", printable_path(path)); close(fd); free(path); return NULL; @@ -1669,7 +1695,7 @@ load_object(const char *name, const Obj_ for (obj = obj_list->next; obj != NULL; obj = obj->next) if (obj->ino == sb.st_ino && obj->dev == sb.st_dev) break; - if (obj != NULL) { + if (obj != NULL && name != NULL) { object_add_name(obj, name); free(path); close(fd); @@ -1703,20 +1729,25 @@ do_load_object(int fd, const char *name, */ if (dangerous_ld_env) { if (fstatfs(fd, &fs) != 0) { - _rtld_error("Cannot fstatfs \"%s\"", path); - return NULL; + _rtld_error("Cannot fstatfs \"%s\"", printable_path(path)); + return NULL; } if (fs.f_flags & MNT_NOEXEC) { _rtld_error("Cannot execute objects on %s\n", fs.f_mntonname); return NULL; } } - dbg("loading \"%s\"", path); - obj = map_object(fd, path, sbp); + dbg("loading \"%s\"", printable_path(path)); + obj = map_object(fd, printable_path(path), sbp); if (obj == NULL) return NULL; - object_add_name(obj, name); + /* + * If DT_SONAME is present in the object, digest_dynamic2 already + * added it to the object names. + */ + if (name != NULL) + object_add_name(obj, name); obj->path = path; digest_dynamic(obj, 0); if (obj->z_noopen && (flags & (RTLD_LO_DLOPEN | RTLD_LO_TRACE)) == @@ -2212,6 +2243,20 @@ dllockinit(void *context, void * dlopen(const char *name, int mode) { + + return (rtld_dlopen(name, -1, mode)); +} + +void * +fdlopen(int fd, int mode) +{ + + return (rtld_dlopen(NULL, fd, mode)); +} + +static void * +rtld_dlopen(const char *name, int fd, int mode) +{ RtldLockState lockstate; int lo_flags; @@ -2232,7 +2277,7 @@ dlopen(const char *name, int mode) if (ld_tracing != NULL) lo_flags |= RTLD_LO_TRACE; - return (dlopen_object(name, obj_main, lo_flags, + return (dlopen_object(name, fd, obj_main, lo_flags, mode & (RTLD_MODEMASK | RTLD_GLOBAL))); } @@ -2247,7 +2292,8 @@ dlopen_cleanup(Obj_Entry *obj) } static Obj_Entry * -dlopen_object(const char *name, Obj_Entry *refobj, int lo_flags, int mode) +dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags, + int mode) { Obj_Entry **old_obj_tail; Obj_Entry *obj; @@ -2262,11 +2308,11 @@ dlopen_object(const char *name, Obj_Entr old_obj_tail = obj_tail; obj = NULL; - if (name == NULL) { + if (name == NULL && fd == -1) { obj = obj_main; obj->refcount++; } else { - obj = load_object(name, refobj, lo_flags); + obj = load_object(name, fd, refobj, lo_flags); } if (obj) { From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 03:16:33 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 21A761065670; Sat, 21 Jan 2012 03:16:32 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA8078FC0A; Sat, 21 Jan 2012 03:16:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0L3GWZR071431; Sat, 21 Jan 2012 03:16:32 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0L3GWnD071429; Sat, 21 Jan 2012 03:16:32 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201201210316.q0L3GWnD071429@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 21 Jan 2012 03:16: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: r230412 - stable/9/share/man/man4 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, 21 Jan 2012 03:16:33 -0000 Author: lstewart Date: Sat Jan 21 03:16:32 2012 New Revision: 230412 URL: http://svn.freebsd.org/changeset/base/230412 Log: MFC r230294: Specify the correct section (4 instead of 9) in the h_ertt man page's title and bump the document date. Modified: stable/9/share/man/man4/h_ertt.4 Directory Properties: stable/9/share/man/ (props changed) stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/h_ertt.4 ============================================================================== --- stable/9/share/man/man4/h_ertt.4 Sat Jan 21 03:00:57 2012 (r230411) +++ stable/9/share/man/man4/h_ertt.4 Sat Jan 21 03:16:32 2012 (r230412) @@ -29,8 +29,8 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2011 -.Dt H_ERTT 9 +.Dd January 18, 2012 +.Dt H_ERTT 4 .Os .Sh NAME .Nm h_ertt From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 03:59:32 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 9F59F106566B; Sat, 21 Jan 2012 03:59:32 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72ECB8FC08; Sat, 21 Jan 2012 03:59:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0L3xWXa072932; Sat, 21 Jan 2012 03:59:32 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0L3xWBM072929; Sat, 21 Jan 2012 03:59:32 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201201210359.q0L3xWBM072929@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 21 Jan 2012 03:59: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: r230415 - 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, 21 Jan 2012 03:59:32 -0000 Author: lstewart Date: Sat Jan 21 03:59:31 2012 New Revision: 230415 URL: http://svn.freebsd.org/changeset/base/230415 Log: MFC r229898: Consumers of bpfdetach() expect it to remove all bpf_if structs from the bpf_iflist list which reference the specified ifnet. The existing implementation only removes the first matching bpf_if found in the list, effectively leaking list entries if an ifnet has been bpfattach()ed multiple times with different DLTs. Fix the leak by performing the detach logic in a loop, stopping when all bpf_if structs referencing the specified ifnet have been detached and removed from the bpf_iflist list. Whilst here, also: - Remove the unnecessary "bp->bif_ifp == NULL" check, as a bpf_if should never exist in the list with a NULL ifnet pointer. - Except when INVARIANTS is in the kernel config, silently ignore the case where no bpf_if referencing the specified ifnet is found, as it is harmless and does not require user attention. Reviewed by: csjp Modified: stable/9/sys/net/bpf.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/net/bpf.c ============================================================================== --- stable/9/sys/net/bpf.c Sat Jan 21 03:46:58 2012 (r230414) +++ stable/9/sys/net/bpf.c Sat Jan 21 03:59:31 2012 (r230415) @@ -2253,33 +2253,42 @@ bpfdetach(struct ifnet *ifp) { struct bpf_if *bp; struct bpf_d *d; +#ifdef INVARIANTS + int ndetached; - /* Locate BPF interface information */ - mtx_lock(&bpf_mtx); - LIST_FOREACH(bp, &bpf_iflist, bif_next) { - if (ifp == bp->bif_ifp) - break; - } + ndetached = 0; +#endif - /* Interface wasn't attached */ - if ((bp == NULL) || (bp->bif_ifp == NULL)) { + /* Find all bpf_if struct's which reference ifp and detach them. */ + do { + mtx_lock(&bpf_mtx); + LIST_FOREACH(bp, &bpf_iflist, bif_next) { + if (ifp == bp->bif_ifp) + break; + } + if (bp != NULL) + LIST_REMOVE(bp, bif_next); mtx_unlock(&bpf_mtx); - printf("bpfdetach: %s was not attached\n", ifp->if_xname); - return; - } - - LIST_REMOVE(bp, bif_next); - mtx_unlock(&bpf_mtx); - while ((d = LIST_FIRST(&bp->bif_dlist)) != NULL) { - bpf_detachd(d); - BPFD_LOCK(d); - bpf_wakeup(d); - BPFD_UNLOCK(d); - } + if (bp != NULL) { +#ifdef INVARIANTS + ndetached++; +#endif + while ((d = LIST_FIRST(&bp->bif_dlist)) != NULL) { + bpf_detachd(d); + BPFD_LOCK(d); + bpf_wakeup(d); + BPFD_UNLOCK(d); + } + mtx_destroy(&bp->bif_mtx); + free(bp, M_BPF); + } + } while (bp != NULL); - mtx_destroy(&bp->bif_mtx); - free(bp, M_BPF); +#ifdef INVARIANTS + if (ndetached == 0) + printf("bpfdetach: %s was not attached\n", ifp->if_xname); +#endif } /* From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 05:03:10 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 C02C31065674; Sat, 21 Jan 2012 05:03:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5F848FC08; Sat, 21 Jan 2012 05:03: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 q0L53Ad9075149; Sat, 21 Jan 2012 05:03:10 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0L53ACK075146; Sat, 21 Jan 2012 05:03:10 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201201210503.q0L53ACK075146@svn.freebsd.org> From: Alan Cox Date: Sat, 21 Jan 2012 05:03: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: r230418 - 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, 21 Jan 2012 05:03:11 -0000 Author: alc Date: Sat Jan 21 05:03:10 2012 New Revision: 230418 URL: http://svn.freebsd.org/changeset/base/230418 Log: MFC r226163, r228317, and r228324 Fix the handling of an empty kmem map by sysctl_kmem_map_free(). Eliminate the possibility of 32-bit arithmetic overflow in the calculation of vm_kmem_size that may occur if the system administrator has specified a vm.vm_kmem_size tunable value that exceeds the hard cap. Eliminate stale numbers from a comment. PR: 162741 Modified: stable/9/sys/kern/kern_malloc.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) Modified: stable/9/sys/kern/kern_malloc.c ============================================================================== --- stable/9/sys/kern/kern_malloc.c Sat Jan 21 04:24:19 2012 (r230417) +++ stable/9/sys/kern/kern_malloc.c Sat Jan 21 05:03:10 2012 (r230418) @@ -265,8 +265,8 @@ sysctl_kmem_map_free(SYSCTL_HANDLER_ARGS u_long size; vm_map_lock_read(kmem_map); - size = kmem_map->root != NULL ? - kmem_map->root->max_free : kmem_map->size; + size = kmem_map->root != NULL ? kmem_map->root->max_free : + kmem_map->max_offset - kmem_map->min_offset; vm_map_unlock_read(kmem_map); return (sysctl_handle_long(oidp, &size, 0, req)); } @@ -661,12 +661,9 @@ kmeminit(void *dummy) /* * Try to auto-tune the kernel memory size, so that it is - * more applicable for a wider range of machine sizes. - * On an X86, a VM_KMEM_SIZE_SCALE value of 4 is good, while - * a VM_KMEM_SIZE of 12MB is a fair compromise. The + * more applicable for a wider range of machine sizes. The * VM_KMEM_SIZE_MAX is dependent on the maximum KVA space - * available, and on an X86 with a total KVA space of 256MB, - * try to keep VM_KMEM_SIZE_MAX at 80MB or below. + * available. * * Note that the kmem_map is also used by the zone allocator, * so make sure that there is enough space. @@ -703,11 +700,11 @@ kmeminit(void *dummy) /* * Limit kmem virtual size to twice the physical memory. * This allows for kmem map sparseness, but limits the size - * to something sane. Be careful to not overflow the 32bit - * ints while doing the check. + * to something sane. Be careful to not overflow the 32bit + * ints while doing the check or the adjustment. */ - if (((vm_kmem_size / 2) / PAGE_SIZE) > cnt.v_page_count) - vm_kmem_size = 2 * cnt.v_page_count * PAGE_SIZE; + if (vm_kmem_size / 2 / PAGE_SIZE > mem_size) + vm_kmem_size = 2 * mem_size * PAGE_SIZE; #ifdef DEBUG_MEMGUARD tmp = memguard_fudge(vm_kmem_size, vm_kmem_size_max); From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 08:26: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 D670F1065672; Sat, 21 Jan 2012 08:26:41 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4D4D8FC17; Sat, 21 Jan 2012 08: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 q0L8Qftx081901; Sat, 21 Jan 2012 08:26:41 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0L8QfhL081899; Sat, 21 Jan 2012 08:26:41 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201201210826.q0L8QfhL081899@svn.freebsd.org> From: Alan Cox Date: Sat, 21 Jan 2012 08: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: r230421 - stable/9/sys/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: Sat, 21 Jan 2012 08:26:42 -0000 Author: alc Date: Sat Jan 21 08:26:41 2012 New Revision: 230421 URL: http://svn.freebsd.org/changeset/base/230421 Log: MFC r228398 Avoid the possibility of integer overflow in the calculation of VM_KMEM_SIZE_MAX. Specifically, if the user/kernel address space split was changed such that the kernel address space was greater than or equal to 2 GB, then overflow would occur. PR: 161721 Modified: stable/9/sys/i386/include/vmparam.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) Modified: stable/9/sys/i386/include/vmparam.h ============================================================================== --- stable/9/sys/i386/include/vmparam.h Sat Jan 21 07:57:27 2012 (r230420) +++ stable/9/sys/i386/include/vmparam.h Sat Jan 21 08:26:41 2012 (r230421) @@ -186,11 +186,12 @@ #endif /* - * Ceiling on amount of kmem_map kva space. + * Ceiling on the amount of kmem_map KVA space: 40% of the entire KVA space + * rounded to the nearest multiple of the superpage size. */ #ifndef VM_KMEM_SIZE_MAX -#define VM_KMEM_SIZE_MAX ((VM_MAX_KERNEL_ADDRESS - \ - VM_MIN_KERNEL_ADDRESS) * 2 / 5) +#define VM_KMEM_SIZE_MAX (((((VM_MAX_KERNEL_ADDRESS - \ + VM_MIN_KERNEL_ADDRESS) >> (PDRSHIFT - 2)) + 5) / 10) << PDRSHIFT) #endif /* initial pagein size of beginning of executable file */ From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 11:32: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 09E66106564A; Sat, 21 Jan 2012 11:32:40 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe03.c2i.net [212.247.154.66]) by mx1.freebsd.org (Postfix) with ESMTP id 9D8458FC0A; Sat, 21 Jan 2012 11:32:37 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe03.swip.net (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 63988213; Sat, 21 Jan 2012 12:32:35 +0100 From: Hans Petter Selasky To: "Robert N. M. Watson" Date: Sat, 21 Jan 2012 12:30:28 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201201180757.q0I7vHiw029172@svn.freebsd.org> <201201202229.43815.hselasky@c2i.net> <12FADCFC-8ECB-4B7F-80B7-8802DD40C14B@freebsd.org> In-Reply-To: <12FADCFC-8ECB-4B7F-80B7-8802DD40C14B@freebsd.org> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201201211230.28237.hselasky@c2i.net> Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "re@FreeBSD.org" , "svn-src-stable-9@freebsd.org" Subject: Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller 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, 21 Jan 2012 11:32:40 -0000 On Friday 20 January 2012 22:43:29 Robert N. M. Watson wrote: > On 20 Jan 2012, at 21:29, Hans Petter Selasky wrote: > > On Friday 20 January 2012 16:16:00 Robert Watson wrote: > >> On Wed, 18 Jan 2012, Hans Petter Selasky wrote: > >>> Author: hselasky > >>> Date: Wed Jan 18 07:57:17 2012 > >>> New Revision: 230302 > >>> URL: http://svn.freebsd.org/changeset/base/230302 > >>> > >>> Log: > >>> MFC r230032, r230050, r230090, r230091 and r228493. > >>> - Various XHCI and USB 3.0 related issues. > >>> - USB 3.0 HUBs should work after this change. > >> > >> Should some portion of this be issued as an Errata Note against > >> supported 8.x and 9.x releases -- in particular, support for USB 3.0 > >> hubs? > > > > hrs @ already did that with the 9-release errata I believe. > > Sorry, I may have been unclear -- I meant Errata Note in the freebsd-update > sense, not as in the release note errata. I think there is no such notice at the present moment. --HPS From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 12:22:07 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 B4F8C106566B; Sat, 21 Jan 2012 12:22:07 +0000 (UTC) (envelope-from rwatson@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 89C158FC16; Sat, 21 Jan 2012 12:22:07 +0000 (UTC) Received: from [192.168.2.105] (host86-161-238-124.range86-161.btcentralplus.com [86.161.238.124]) by cyrus.watson.org (Postfix) with ESMTPSA id 16C2046B0C; Sat, 21 Jan 2012 07:22:05 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=windows-1252 From: "Robert N. M. Watson" In-Reply-To: <201201211230.28237.hselasky@c2i.net> Date: Sat, 21 Jan 2012 12:22:02 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <85A5A9E5-401A-414E-93B0-BC4212152AF7@freebsd.org> References: <201201180757.q0I7vHiw029172@svn.freebsd.org> <201201202229.43815.hselasky@c2i.net> <12FADCFC-8ECB-4B7F-80B7-8802DD40C14B@freebsd.org> <201201211230.28237.hselasky@c2i.net> To: Hans Petter Selasky X-Mailer: Apple Mail (2.1251.1) Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "re@FreeBSD.org" , "svn-src-stable-9@freebsd.org" Subject: Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller 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, 21 Jan 2012 12:22:07 -0000 On 21 Jan 2012, at 11:30, Hans Petter Selasky wrote: >>>>> Author: hselasky >>>>> Date: Wed Jan 18 07:57:17 2012 >>>>> New Revision: 230302 >>>>> URL: http://svn.freebsd.org/changeset/base/230302 >>>>>=20 >>>>> Log: >>>>> MFC r230032, r230050, r230090, r230091 and r228493. >>>>> - Various XHCI and USB 3.0 related issues. >>>>> - USB 3.0 HUBs should work after this change. >>>>=20 >>>> Should some portion of this be issued as an Errata Note against >>>> supported 8.x and 9.x releases -- in particular, support for USB = 3.0 >>>> hubs? >>>=20 >>> hrs @ already did that with the 9-release errata I believe. >>=20 >> Sorry, I may have been unclear -- I meant Errata Note in the = freebsd-update >> sense, not as in the release note errata. >=20 > I think there is no such notice at the present moment. Just to clarify, are you saying that: (1) We should not ever do an errata note + binary update for the most = important of these bug fixes, just wait for them to ship in FreeBSD = 8.3/9.1? (2) We should do errata notes + binary updates for the most important of = these bug fixes, but we need to let them settle for a while to ensure = there are no unexpected consequences/etc? Do we think that the impact of the USB 3.0 hub issue will be significant = to our userbase -- e.g., excluding use of USB on many recent systems? Thanks, Robert= From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 12:46:16 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 1AB40106564A; Sat, 21 Jan 2012 12:46:16 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe05.c2i.net [212.247.154.130]) by mx1.freebsd.org (Postfix) with ESMTP id C130C8FC08; Sat, 21 Jan 2012 12:46:14 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe05.swip.net (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 228111343; Sat, 21 Jan 2012 13:46:12 +0100 From: Hans Petter Selasky To: "Robert N. M. Watson" Date: Sat, 21 Jan 2012 13:44:05 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201201180757.q0I7vHiw029172@svn.freebsd.org> <201201211230.28237.hselasky@c2i.net> <85A5A9E5-401A-414E-93B0-BC4212152AF7@freebsd.org> In-Reply-To: <85A5A9E5-401A-414E-93B0-BC4212152AF7@freebsd.org> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201201211344.05511.hselasky@c2i.net> Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "re@FreeBSD.org" , "svn-src-stable-9@freebsd.org" Subject: Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller 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, 21 Jan 2012 12:46:16 -0000 On Saturday 21 January 2012 13:22:02 Robert N. M. Watson wrote: > On 21 Jan 2012, at 11:30, Hans Petter Selasky wrote: > >>>>> Author: hselasky > >>>>> Date: Wed Jan 18 07:57:17 2012 > >>>>> New Revision: 230302 > >>>>> URL: http://svn.freebsd.org/changeset/base/230302 > >>>>> > >>>>> Log: > >>>>> MFC r230032, r230050, r230090, r230091 and r228493. > >>>>> - Various XHCI and USB 3.0 related issues. > >>>>> - USB 3.0 HUBs should work after this change. > >>>> > >>>> Should some portion of this be issued as an Errata Note against > >>>> supported 8.x and 9.x releases -- in particular, support for USB 3.0 > >>>> hubs? > >>> > >>> hrs @ already did that with the 9-release errata I believe. > >> > >> Sorry, I may have been unclear -- I meant Errata Note in the > >> freebsd-update sense, not as in the release note errata. > > > > I think there is no such notice at the present moment. > > Just to clarify, are you saying that: > > (1) We should not ever do an errata note + binary update for the most > important of these bug fixes, just wait for them to ship in FreeBSD > 8.3/9.1? > > (2) We should do errata notes + binary updates for the most important of > these bug fixes, but we need to let them settle for a while to ensure > there are no unexpected consequences/etc? > > Do we think that the impact of the USB 3.0 hub issue will be significant to > our userbase -- e.g., excluding use of USB on many recent systems? I mean (2). I'm not familiar with the process of binary updates. Does that mean I should commit fixes to the release branches in SVN instead of the stable ones? I think I maybe need some help there. Never done that before :-) --HPS From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 12:59:17 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 19DA7106566B; Sat, 21 Jan 2012 12:59:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id B9FC28FC08; Sat, 21 Jan 2012 12:59:16 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id A3E1425D386D; Sat, 21 Jan 2012 12:59:15 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id AD937BD9A66; Sat, 21 Jan 2012 12:59:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id QJTMTVPxpQDa; Sat, 21 Jan 2012 12:59:12 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 73B07BD9A65; Sat, 21 Jan 2012 12:59:12 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201201211344.05511.hselasky@c2i.net> Date: Sat, 21 Jan 2012 12:59:10 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <03DEA3A3-E5E4-4313-B82B-F0AD44F50ECD@FreeBSD.org> References: <201201180757.q0I7vHiw029172@svn.freebsd.org> <201201211230.28237.hselasky@c2i.net> <85A5A9E5-401A-414E-93B0-BC4212152AF7@freebsd.org> <201201211344.05511.hselasky@c2i.net> To: Hans Petter Selasky X-Mailer: Apple Mail (2.1084) Cc: src-committers@freebsd.org, "re@FreeBSD.org" , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-9@freebsd.org, "Robert N. M. Watson" Subject: Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller 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, 21 Jan 2012 12:59:17 -0000 On 21. Jan 2012, at 12:44 , Hans Petter Selasky wrote: > On Saturday 21 January 2012 13:22:02 Robert N. M. Watson wrote: >> On 21 Jan 2012, at 11:30, Hans Petter Selasky wrote: >>>>>>> Author: hselasky >>>>>>> Date: Wed Jan 18 07:57:17 2012 >>>>>>> New Revision: 230302 >>>>>>> URL: http://svn.freebsd.org/changeset/base/230302 >>>>>>>=20 >>>>>>> Log: >>>>>>> MFC r230032, r230050, r230090, r230091 and r228493. >>>>>>> - Various XHCI and USB 3.0 related issues. >>>>>>> - USB 3.0 HUBs should work after this change. >>>>>>=20 >>>>>> Should some portion of this be issued as an Errata Note against >>>>>> supported 8.x and 9.x releases -- in particular, support for USB = 3.0 >>>>>> hubs? >>>>>=20 >>>>> hrs @ already did that with the 9-release errata I believe. >>>>=20 >>>> Sorry, I may have been unclear -- I meant Errata Note in the >>>> freebsd-update sense, not as in the release note errata. >>>=20 >>> I think there is no such notice at the present moment. >>=20 >> Just to clarify, are you saying that: >>=20 >> (1) We should not ever do an errata note + binary update for the most >> important of these bug fixes, just wait for them to ship in FreeBSD >> 8.3/9.1? >>=20 >> (2) We should do errata notes + binary updates for the most important = of >> these bug fixes, but we need to let them settle for a while to ensure >> there are no unexpected consequences/etc? >>=20 >> Do we think that the impact of the USB 3.0 hub issue will be = significant to >> our userbase -- e.g., excluding use of USB on many recent systems? >=20 > I mean (2). I'm not familiar with the process of binary updates. Does = that=20 > mean I should commit fixes to the release branches in SVN instead of = the=20 > stable ones? I think I maybe need some help there. Never done that = before :-) Because you cannot. It would surely help if you could provide the = relevant part of the change as patch to re@ and you can find two samples of ENs = linked from the box in the right lower corner of the front page of = www.freebsd.org and providing parts of the text (ignore revisions etc for now) would = certainly help as well. /bz --=20 Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do! From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 13:35: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 44E011065676; Sat, 21 Jan 2012 13:35:41 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe05.c2i.net [212.247.154.130]) by mx1.freebsd.org (Postfix) with ESMTP id BE3618FC2A; Sat, 21 Jan 2012 13:35:39 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe05.swip.net (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 228120122; Sat, 21 Jan 2012 14:35:37 +0100 From: Hans Petter Selasky To: "Bjoern A. Zeeb" Date: Sat, 21 Jan 2012 14:33:30 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201201211344.05511.hselasky@c2i.net> <03DEA3A3-E5E4-4313-B82B-F0AD44F50ECD@FreeBSD.org> In-Reply-To: <03DEA3A3-E5E4-4313-B82B-F0AD44F50ECD@FreeBSD.org> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201201211433.30626.hselasky@c2i.net> Cc: "src-committers@freebsd.org" , "re@FreeBSD.org" , "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable-9@freebsd.org" , "Robert N. M. Watson" Subject: Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller 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, 21 Jan 2012 13:35:41 -0000 On Saturday 21 January 2012 13:59:10 Bjoern A. Zeeb wrote: > On 21. Jan 2012, at 12:44 , Hans Petter Selasky wrote: > > On Saturday 21 January 2012 13:22:02 Robert N. M. Watson wrote: > >> On 21 Jan 2012, at 11:30, Hans Petter Selasky wrote: > >>>>>>> Author: hselasky > >>>>>>> Date: Wed Jan 18 07:57:17 2012 > >>>>>>> New Revision: 230302 > >>>>>>> URL: http://svn.freebsd.org/changeset/base/230302 > >>>>>>> > >>>>>>> Log: > >>>>>>> MFC r230032, r230050, r230090, r230091 and r228493. > >>>>>>> - Various XHCI and USB 3.0 related issues. > >>>>>>> - USB 3.0 HUBs should work after this change. > >>>>>> > >>>>>> Should some portion of this be issued as an Errata Note against > >>>>>> supported 8.x and 9.x releases -- in particular, support for USB 3.0 > >>>>>> hubs? > >>>>> > >>>>> hrs @ already did that with the 9-release errata I believe. > >>>> > >>>> Sorry, I may have been unclear -- I meant Errata Note in the > >>>> freebsd-update sense, not as in the release note errata. > >>> > >>> I think there is no such notice at the present moment. > >> > >> Just to clarify, are you saying that: > >> > >> (1) We should not ever do an errata note + binary update for the most > >> important of these bug fixes, just wait for them to ship in FreeBSD > >> 8.3/9.1? > >> > >> (2) We should do errata notes + binary updates for the most important of > >> these bug fixes, but we need to let them settle for a while to ensure > >> there are no unexpected consequences/etc? > >> > >> Do we think that the impact of the USB 3.0 hub issue will be significant > >> to our userbase -- e.g., excluding use of USB on many recent systems? > > > > I mean (2). I'm not familiar with the process of binary updates. Does > > that mean I should commit fixes to the release branches in SVN instead > > of the stable ones? I think I maybe need some help there. Never done > > that before :-) > > Because you cannot. It would surely help if you could provide the > relevant part of the change as patch to re@ and you can find two samples > of ENs linked from the box in the right lower corner of the front page of > www.freebsd.org and providing parts of the text (ignore revisions etc for > now) would certainly help as well. Ok, I'll have a look at this once I find some time. --HPS From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 15:19: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 E1ECC106564A; Sat, 21 Jan 2012 15:19:52 +0000 (UTC) (envelope-from rwatson@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B1F388FC12; Sat, 21 Jan 2012 15:19:52 +0000 (UTC) Received: from [192.168.2.105] (host86-161-238-124.range86-161.btcentralplus.com [86.161.238.124]) by cyrus.watson.org (Postfix) with ESMTPSA id F213846B0C; Sat, 21 Jan 2012 10:19:50 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=windows-1252 From: "Robert N. M. Watson" In-Reply-To: <201201211433.30626.hselasky@c2i.net> Date: Sat, 21 Jan 2012 15:19:49 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <7E058E8B-EB49-4A72-8555-A15E358C09F8@freebsd.org> References: <201201211344.05511.hselasky@c2i.net> <03DEA3A3-E5E4-4313-B82B-F0AD44F50ECD@FreeBSD.org> <201201211433.30626.hselasky@c2i.net> To: Hans Petter Selasky X-Mailer: Apple Mail (2.1251.1) Cc: "src-committers@freebsd.org" , "re@FreeBSD.org" , "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable-9@freebsd.org" , "Bjoern A. Zeeb" Subject: Re: svn commit: r230302 - in stable/9/sys/dev/usb: . controller 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, 21 Jan 2012 15:19:53 -0000 On 21 Jan 2012, at 13:33, Hans Petter Selasky wrote: >>>> Just to clarify, are you saying that: >>>>=20 >>>> (1) We should not ever do an errata note + binary update for the = most >>>> important of these bug fixes, just wait for them to ship in FreeBSD >>>> 8.3/9.1? >>>>=20 >>>> (2) We should do errata notes + binary updates for the most = important of >>>> these bug fixes, but we need to let them settle for a while to = ensure >>>> there are no unexpected consequences/etc? >>>>=20 >>>> Do we think that the impact of the USB 3.0 hub issue will be = significant >>>> to our userbase -- e.g., excluding use of USB on many recent = systems? >>>=20 >>> I mean (2). I'm not familiar with the process of binary updates. = Does >>> that mean I should commit fixes to the release branches in SVN = instead >>> of the stable ones? I think I maybe need some help there. Never done >>> that before :-) >>=20 >> Because you cannot. It would surely help if you could provide the >> relevant part of the change as patch to re@ and you can find two = samples >> of ENs linked from the box in the right lower corner of the front = page of >> www.freebsd.org and providing parts of the text (ignore revisions etc = for >> now) would certainly help as well. >=20 > Ok, I'll have a look at this once I find some time. Sounds good -- the first step is really to let the change settle in the = tree for a month or so to make sure we have a high confidence that it is = without serious unfortunate side effects, and cleanly resolves any = issues users are experiencing. Then, as Bjoern says, the next step is to = contact re@ with a proposed patch and some draft text, and we can take = it from there. Robert= From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 17:22:51 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 32791106566B; Sat, 21 Jan 2012 17:22:51 +0000 (UTC) (envelope-from rmh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 025CF8FC08; Sat, 21 Jan 2012 17:22:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0LHMoJ4001553; Sat, 21 Jan 2012 17:22:50 GMT (envelope-from rmh@svn.freebsd.org) Received: (from rmh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0LHMoVs001551; Sat, 21 Jan 2012 17:22:50 GMT (envelope-from rmh@svn.freebsd.org) Message-Id: <201201211722.q0LHMoVs001551@svn.freebsd.org> From: Robert Millan Date: Sat, 21 Jan 2012 17:22: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: r230425 - 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: Sat, 21 Jan 2012 17:22:51 -0000 Author: rmh Date: Sat Jan 21 17:22:50 2012 New Revision: 230425 URL: http://svn.freebsd.org/changeset/base/230425 Log: MFC r227827 Define __FreeBSD_kernel__ macro in sys/param.h. __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, which by definition is always true on FreeBSD. This macro is also defined on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD. It is tempting to use this macro in userland code when we want to enable kernel-specific routines, and in fact it's fine to do this in code that is part of FreeBSD itself. However, be aware that as presence of this macro is still not widespread (e.g. older FreeBSD versions, 3rd party compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in external applications without also checking for __FreeBSD__ as an alternative. Approved by: kib (mentor) Modified: stable/9/sys/sys/param.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) Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Sat Jan 21 13:31:38 2012 (r230424) +++ stable/9/sys/sys/param.h Sat Jan 21 17:22:50 2012 (r230425) @@ -60,6 +60,22 @@ #undef __FreeBSD_version #define __FreeBSD_version 900502 /* Master, propagated to newvers */ +/* + * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, + * which by definition is always true on FreeBSD. This macro is also defined + * on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD. + * + * It is tempting to use this macro in userland code when we want to enable + * kernel-specific routines, and in fact it's fine to do this in code that + * is part of FreeBSD itself. However, be aware that as presence of this + * macro is still not widespread (e.g. older FreeBSD versions, 3rd party + * compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in + * external applications without also checking for __FreeBSD__ as an + * alternative. + */ +#undef __FreeBSD_kernel__ +#define __FreeBSD_kernel__ + #ifdef _KERNEL #define P_OSREL_SIGWAIT 700000 #define P_OSREL_SIGSEGV 700004 From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 18:11: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 09A33106566B; Sat, 21 Jan 2012 18:11:13 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCFA38FC13; Sat, 21 Jan 2012 18:11: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 q0LIBCEF003551; Sat, 21 Jan 2012 18:11:12 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0LIBCsU003549; Sat, 21 Jan 2012 18:11:12 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201201211811.q0LIBCsU003549@svn.freebsd.org> From: Alan Cox Date: Sat, 21 Jan 2012 18:11: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: r230431 - stable/9/sys/i386/xen 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, 21 Jan 2012 18:11:13 -0000 Author: alc Date: Sat Jan 21 18:11:12 2012 New Revision: 230431 URL: http://svn.freebsd.org/changeset/base/230431 Log: MFC r228746 The Xen pmap doesn't support superpages. So, there is no point in it initializing structures, like the pv table, that are only used to implement superpages. In fact, some of the unnecessary code in pmap_init() was actually doing harm. It was preventing the kernel from booting on virtual machines with more than 768 MB of memory. Modified: stable/9/sys/i386/xen/pmap.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) Modified: stable/9/sys/i386/xen/pmap.c ============================================================================== --- stable/9/sys/i386/xen/pmap.c Sat Jan 21 18:06:18 2012 (r230430) +++ stable/9/sys/i386/xen/pmap.c Sat Jan 21 18:11:12 2012 (r230431) @@ -184,9 +184,6 @@ __FBSDID("$FreeBSD$"); #define PV_STAT(x) do { } while (0) #endif -#define pa_index(pa) ((pa) >> PDRSHIFT) -#define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) - /* * Get PDEs and PTEs for user/kernel address space */ @@ -230,7 +227,6 @@ static int pat_works; /* Is page attri * Data for the pv entry allocation mechanism */ static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0; -static struct md_page *pv_table; static int shpgperproc = PMAP_SHPGPERPROC; struct pv_chunk *pv_chunkbase; /* KVA block for pv_chunks */ @@ -278,9 +274,6 @@ SYSCTL_INT(_debug, OID_AUTO, PMAP1unchan static struct mtx PMAP2mutex; SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); -static int pg_ps_enabled; -SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0, - "Are large page mappings enabled?"); SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_max, CTLFLAG_RD, &pv_entry_max, 0, "Max number of PV entries"); @@ -636,24 +629,8 @@ pmap_ptelist_init(vm_offset_t *head, voi void pmap_init(void) { - vm_page_t mpte; - vm_size_t s; - int i, pv_npg; /* - * Initialize the vm page array entries for the kernel pmap's - * page table pages. - */ - for (i = 0; i < nkpt; i++) { - mpte = PHYS_TO_VM_PAGE(xpmap_mtop(PTD[i + KPTDI] & PG_FRAME)); - KASSERT(mpte >= vm_page_array && - mpte < &vm_page_array[vm_page_array_size], - ("pmap_init: page table page is out of range")); - mpte->pindex = i + KPTDI; - mpte->phys_addr = xpmap_mtop(PTD[i + KPTDI] & PG_FRAME); - } - - /* * Initialize the address space (zone) for the pv entries. Set a * high water mark so that the system can recover from excessive * numbers of pv entries. @@ -664,26 +641,6 @@ pmap_init(void) pv_entry_max = roundup(pv_entry_max, _NPCPV); pv_entry_high_water = 9 * (pv_entry_max / 10); - /* - * Are large page mappings enabled? - */ - TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled); - - /* - * Calculate the size of the pv head table for superpages. - */ - for (i = 0; phys_avail[i + 1]; i += 2); - pv_npg = round_4mpage(phys_avail[(i - 2) + 1]) / NBPDR; - - /* - * Allocate memory for the pv head table for superpages. - */ - s = (vm_size_t)(pv_npg * sizeof(struct md_page)); - s = round_page(s); - pv_table = (struct md_page *)kmem_alloc(kernel_map, s); - for (i = 0; i < pv_npg; i++) - TAILQ_INIT(&pv_table[i].pv_list); - pv_maxchunks = MAX(pv_entry_max / _NPCPV, maxproc); pv_chunkbase = (struct pv_chunk *)kmem_alloc_nofault(kernel_map, PAGE_SIZE * pv_maxchunks); @@ -3452,21 +3409,15 @@ pmap_page_wired_mappings(vm_page_t m) } /* - * Returns TRUE if the given page is mapped individually or as part of - * a 4mpage. Otherwise, returns FALSE. + * Returns TRUE if the given page is mapped. Otherwise, returns FALSE. */ boolean_t pmap_page_is_mapped(vm_page_t m) { - boolean_t rv; if ((m->oflags & VPO_UNMANAGED) != 0) return (FALSE); - vm_page_lock_queues(); - rv = !TAILQ_EMPTY(&m->md.pv_list) || - !TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list); - vm_page_unlock_queues(); - return (rv); + return (!TAILQ_EMPTY(&m->md.pv_list)); } /* From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 19:21: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 6582F106566C; Sat, 21 Jan 2012 19:21:42 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E0968FC15; Sat, 21 Jan 2012 19:21: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 q0LJLgmS006313; Sat, 21 Jan 2012 19:21:42 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0LJLg6x006309; Sat, 21 Jan 2012 19:21:42 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201201211921.q0LJLg6x006309@svn.freebsd.org> From: Alan Cox Date: Sat, 21 Jan 2012 19:21: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: r230435 - in stable/9/sys: amd64/amd64 i386/i386 i386/xen 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, 21 Jan 2012 19:21:42 -0000 Author: alc Date: Sat Jan 21 19:21:42 2012 New Revision: 230435 URL: http://svn.freebsd.org/changeset/base/230435 Log: MFC r228923, r228935, and r229007 Eliminate many of the unnecessary differences between the native and paravirtualized pmap implementations for i386. Fix a bug in the Xen pmap's implementation of pmap_extract_and_hold(): If the page lock acquisition is retried, then the underlying thread is not unpinned. Wrap nearby lines that exceed 80 columns. Merge r216333 and r216555 from the native pmap When r207410 eliminated the acquisition and release of the page queues lock from pmap_extract_and_hold(), it didn't take into account that pmap_pte_quick() sometimes requires the page queues lock to be held. This change reimplements pmap_extract_and_hold() such that it no longer uses pmap_pte_quick(), and thus never requires the page queues lock. Merge r177525 from the native pmap Prevent the overflow in the calculation of the next page directory. The overflow causes the wraparound with consequent corruption of the (almost) whole address space mapping. Strictly speaking, r177525 is not required by the Xen pmap because the hypervisor steals the uppermost region of the normal kernel address space. I am nonetheless merging it in order to reduce the number of unnecessary differences between the native and Xen pmap implementations. Modified: stable/9/sys/amd64/amd64/pmap.c stable/9/sys/i386/i386/pmap.c stable/9/sys/i386/xen/pmap.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) Modified: stable/9/sys/amd64/amd64/pmap.c ============================================================================== --- stable/9/sys/amd64/amd64/pmap.c Sat Jan 21 18:54:19 2012 (r230434) +++ stable/9/sys/amd64/amd64/pmap.c Sat Jan 21 19:21:42 2012 (r230435) @@ -1255,8 +1255,8 @@ retry: if (pdep != NULL && (pde = *pdep)) { if (pde & PG_PS) { if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) { - if (vm_page_pa_tryrelock(pmap, (pde & PG_PS_FRAME) | - (va & PDRMASK), &pa)) + if (vm_page_pa_tryrelock(pmap, (pde & + PG_PS_FRAME) | (va & PDRMASK), &pa)) goto retry; m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) | (va & PDRMASK)); @@ -1266,7 +1266,8 @@ retry: pte = *pmap_pde_to_pte(pdep, va); if ((pte & PG_V) && ((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) { - if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, &pa)) + if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, + &pa)) goto retry; m = PHYS_TO_VM_PAGE(pte & PG_FRAME); vm_page_hold(m); Modified: stable/9/sys/i386/i386/pmap.c ============================================================================== --- stable/9/sys/i386/i386/pmap.c Sat Jan 21 18:54:19 2012 (r230434) +++ stable/9/sys/i386/i386/pmap.c Sat Jan 21 19:21:42 2012 (r230435) @@ -330,7 +330,7 @@ static void pmap_update_pde_invalidate(v static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags); -static vm_page_t _pmap_allocpte(pmap_t pmap, unsigned ptepindex, int flags); +static vm_page_t _pmap_allocpte(pmap_t pmap, u_int ptepindex, int flags); static int _pmap_unwire_pte_hold(pmap_t pmap, vm_page_t m, vm_page_t *free); static pt_entry_t *pmap_pte_quick(pmap_t pmap, vm_offset_t va); static void pmap_pte_release(pt_entry_t *pte); @@ -340,6 +340,8 @@ static void *pmap_pdpt_allocf(uma_zone_t #endif static void pmap_set_pg(void); +static __inline void pagezero(void *page); + CTASSERT(1 << PDESHIFT == sizeof(pd_entry_t)); CTASSERT(1 << PTESHIFT == sizeof(pt_entry_t)); @@ -1216,7 +1218,7 @@ pmap_is_current(pmap_t pmap) { return (pmap == kernel_pmap || - (pmap == vmspace_pmap(curthread->td_proc->p_vmspace) && + (pmap == vmspace_pmap(curthread->td_proc->p_vmspace) && (pmap->pm_pdir[PTDPTDI] & PG_FRAME) == (PTDpde[0] & PG_FRAME))); } @@ -1366,8 +1368,8 @@ retry: if (pde != 0) { if (pde & PG_PS) { if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) { - if (vm_page_pa_tryrelock(pmap, (pde & PG_PS_FRAME) | - (va & PDRMASK), &pa)) + if (vm_page_pa_tryrelock(pmap, (pde & + PG_PS_FRAME) | (va & PDRMASK), &pa)) goto retry; m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) | (va & PDRMASK)); @@ -1379,7 +1381,8 @@ retry: pmap_pte_release(ptep); if (pte != 0 && ((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) { - if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, &pa)) + if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, + &pa)) goto retry; m = PHYS_TO_VM_PAGE(pte & PG_FRAME); vm_page_hold(m); @@ -1732,7 +1735,6 @@ pmap_pinit(pmap_t pmap) if (pmap->pm_pdir == NULL) { pmap->pm_pdir = (pd_entry_t *)kmem_alloc_nofault(kernel_map, NBPTD); - if (pmap->pm_pdir == NULL) { PMAP_LOCK_DESTROY(pmap); return (0); @@ -1766,10 +1768,9 @@ pmap_pinit(pmap_t pmap) pmap_qenter((vm_offset_t)pmap->pm_pdir, ptdpg, NPGPTD); - for (i = 0; i < NPGPTD; i++) { + for (i = 0; i < NPGPTD; i++) if ((ptdpg[i]->flags & PG_ZERO) == 0) - bzero(pmap->pm_pdir + (i * NPDEPG), PAGE_SIZE); - } + pagezero(pmap->pm_pdir + (i * NPDEPG)); mtx_lock_spin(&allpmaps_lock); LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); @@ -1798,7 +1799,7 @@ pmap_pinit(pmap_t pmap) * mapped correctly. */ static vm_page_t -_pmap_allocpte(pmap_t pmap, unsigned ptepindex, int flags) +_pmap_allocpte(pmap_t pmap, u_int ptepindex, int flags) { vm_paddr_t ptepa; vm_page_t m; @@ -1846,7 +1847,7 @@ _pmap_allocpte(pmap_t pmap, unsigned pte static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags) { - unsigned ptepindex; + u_int ptepindex; pd_entry_t ptepa; vm_page_t m; @@ -1994,7 +1995,7 @@ pmap_lazyfix(pmap_t pmap) cr3 = vtophys(pmap->pm_pdir); if (cr3 == rcr3()) { load_cr3(PCPU_GET(curpcb)->pcb_cr3); - CPU_CLR(PCPU_GET(cpuid), &pmap->pm_active); + CPU_CLR(PCPU_GET(cpuid), &pmap->pm_active); } } #endif /* SMP */ @@ -2825,7 +2826,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva } for (; sva < eva; sva = pdnxt) { - unsigned pdirindex; + u_int pdirindex; /* * Calculate index for next page table. @@ -3046,7 +3047,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv PMAP_LOCK(pmap); for (; sva < eva; sva = pdnxt) { pt_entry_t obits, pbits; - unsigned pdirindex; + u_int pdirindex; pdnxt = (sva + NBPDR) & ~PDRMASK; if (pdnxt < sva) @@ -3572,7 +3573,7 @@ pmap_enter_object(pmap_t pmap, vm_offset m = TAILQ_NEXT(m, listq); } vm_page_unlock_queues(); - PMAP_UNLOCK(pmap); + PMAP_UNLOCK(pmap); } /* @@ -3614,7 +3615,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ * resident, we are creating it here. */ if (va < VM_MAXUSER_ADDRESS) { - unsigned ptepindex; + u_int ptepindex; pd_entry_t ptepa; /* @@ -3880,7 +3881,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm pt_entry_t *src_pte, *dst_pte; vm_page_t dstmpte, srcmpte; pd_entry_t srcptepaddr; - unsigned ptepindex; + u_int ptepindex; KASSERT(addr < UPT_MIN_ADDRESS, ("pmap_copy: invalid to pmap_copy page tables")); @@ -5220,7 +5221,7 @@ pmap_pid_dump(int pid) #if defined(DEBUG) static void pads(pmap_t pm); -void pmap_pvdump(vm_offset_t pa); +void pmap_pvdump(vm_paddr_t pa); /* print address space of pmap*/ static void Modified: stable/9/sys/i386/xen/pmap.c ============================================================================== --- stable/9/sys/i386/xen/pmap.c Sat Jan 21 18:54:19 2012 (r230434) +++ stable/9/sys/i386/xen/pmap.c Sat Jan 21 19:21:42 2012 (r230435) @@ -125,6 +125,8 @@ __FBSDID("$FreeBSD$"); #include #ifdef SMP #include +#else +#include #endif #include @@ -221,6 +223,8 @@ extern u_int32_t KERNend; pt_entry_t pg_nx; #endif +static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); + static int pat_works; /* Is page attribute table sane? */ /* @@ -273,19 +277,6 @@ SYSCTL_INT(_debug, OID_AUTO, PMAP1unchan "Number of times pmap_pte_quick didn't change PMAP1"); static struct mtx PMAP2mutex; -SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); - -SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_max, CTLFLAG_RD, &pv_entry_max, 0, - "Max number of PV entries"); -SYSCTL_INT(_vm_pmap, OID_AUTO, shpgperproc, CTLFLAG_RD, &shpgperproc, 0, - "Page share factor per proc"); -SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0, - "2/4MB page mapping counters"); - -static u_long pmap_pde_mappings; -SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, mappings, CTLFLAG_RD, - &pmap_pde_mappings, 0, "2/4MB page mappings"); - static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try); static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); @@ -294,6 +285,8 @@ static pv_entry_t pmap_pvh_remove(struct static vm_page_t pmap_enter_quick_locked(multicall_entry_t **mcl, int *count, pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); +static void pmap_flush_page(vm_page_t m); +static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva, vm_page_t *free); static void pmap_remove_page(struct pmap *pmap, vm_offset_t va, @@ -305,14 +298,12 @@ static boolean_t pmap_try_insert_pv_entr static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags); -static vm_page_t _pmap_allocpte(pmap_t pmap, unsigned ptepindex, int flags); +static vm_page_t _pmap_allocpte(pmap_t pmap, u_int ptepindex, int flags); static int _pmap_unwire_pte_hold(pmap_t pmap, vm_page_t m, vm_page_t *free); static pt_entry_t *pmap_pte_quick(pmap_t pmap, vm_offset_t va); static void pmap_pte_release(pt_entry_t *pte); static int pmap_unuse_pt(pmap_t, vm_offset_t, vm_page_t *); -static vm_offset_t pmap_kmem_choose(vm_offset_t addr); static boolean_t pmap_is_prefaultable_locked(pmap_t pmap, vm_offset_t addr); -static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); static __inline void pagezero(void *page); @@ -326,8 +317,6 @@ CTASSERT(1 << PTESHIFT == sizeof(pt_entr */ CTASSERT(KERNBASE % (1 << 24) == 0); - - void pd_set(struct pmap *pmap, int ptepindex, vm_paddr_t val, int type) { @@ -359,24 +348,6 @@ pd_set(struct pmap *pmap, int ptepindex, } /* - * Move the kernel virtual free pointer to the next - * 4MB. This is used to help improve performance - * by using a large (4MB) page for much of the kernel - * (.text, .data, .bss) - */ -static vm_offset_t -pmap_kmem_choose(vm_offset_t addr) -{ - vm_offset_t newaddr = addr; - -#ifndef DISABLE_PSE - if (cpu_feature & CPUID_PSE) - newaddr = (addr + PDRMASK) & ~PDRMASK; -#endif - return newaddr; -} - -/* * Bootstrap the system enough to run with virtual memory. * * On the i386 this is called after mapping has already been enabled @@ -395,15 +366,13 @@ pmap_bootstrap(vm_paddr_t firstaddr) int i; /* - * XXX The calculation of virtual_avail is wrong. It's NKPT*PAGE_SIZE too - * large. It should instead be correctly calculated in locore.s and - * not based on 'first' (which is a physical address, not a virtual - * address, for the start of unused physical memory). The kernel - * page tables are NOT double mapped and thus should not be included - * in this calculation. + * Initialize the first available kernel virtual address. However, + * using "firstaddr" may waste a few pages of the kernel virtual + * address space, because locore may not have mapped every physical + * page that it allocated. Preferably, locore would provide a first + * unused virtual address in addition to "firstaddr". */ virtual_avail = (vm_offset_t) KERNBASE + firstaddr; - virtual_avail = pmap_kmem_choose(virtual_avail); virtual_end = VM_MAX_KERNEL_ADDRESS; @@ -468,8 +437,8 @@ pmap_bootstrap(vm_paddr_t firstaddr) /* * ptemap is used for pmap_pte_quick */ - SYSMAP(pt_entry_t *, PMAP1, PADDR1, 1); - SYSMAP(pt_entry_t *, PMAP2, PADDR2, 1); + SYSMAP(pt_entry_t *, PMAP1, PADDR1, 1) + SYSMAP(pt_entry_t *, PMAP2, PADDR2, 1) mtx_init(&PMAP2mutex, "PMAP2", NULL, MTX_DEF); @@ -650,6 +619,18 @@ pmap_init(void) } +SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_max, CTLFLAG_RD, &pv_entry_max, 0, + "Max number of PV entries"); +SYSCTL_INT(_vm_pmap, OID_AUTO, shpgperproc, CTLFLAG_RD, &shpgperproc, 0, + "Page share factor per proc"); + +static SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0, + "2/4MB page mapping counters"); + +static u_long pmap_pde_mappings; +SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, mappings, CTLFLAG_RD, + &pmap_pde_mappings, 0, "2/4MB page mappings"); + /*************************************************** * Low level helper routines..... ***************************************************/ @@ -896,6 +877,8 @@ pmap_invalidate_cache(void) } #endif /* !SMP */ +#define PMAP_CLFLUSH_THRESHOLD (2 * 1024 * 1024) + void pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva) { @@ -907,7 +890,8 @@ pmap_invalidate_cache_range(vm_offset_t if (cpu_feature & CPUID_SS) ; /* If "Self Snoop" is supported, do nothing. */ - else if (cpu_feature & CPUID_CLFSH) { + else if ((cpu_feature & CPUID_CLFSH) != 0 && + eva - sva < PMAP_CLFLUSH_THRESHOLD) { /* * Otherwise, do per-cache line flush. Use the mfence @@ -924,12 +908,27 @@ pmap_invalidate_cache_range(vm_offset_t /* * No targeted cache flush methods are supported by CPU, - * globally invalidate cache as a last resort. + * or the supplied range is bigger than 2MB. + * Globally invalidate cache. */ pmap_invalidate_cache(); } } +void +pmap_invalidate_cache_pages(vm_page_t *pages, int count) +{ + int i; + + if (count >= PMAP_CLFLUSH_THRESHOLD / PAGE_SIZE || + (cpu_feature & CPUID_CLFSH) == 0) { + pmap_invalidate_cache(); + } else { + for (i = 0; i < count; i++) + pmap_flush_page(pages[i]); + } +} + /* * Are we current address space or kernel? N.B. We return FALSE when * a pmap's page table is in use because a kernel thread is borrowing @@ -942,7 +941,7 @@ pmap_is_current(pmap_t pmap) return (pmap == kernel_pmap || (pmap == vmspace_pmap(curthread->td_proc->p_vmspace) && - (pmap->pm_pdir[PTDPTDI] & PG_FRAME) == (PTDpde[0] & PG_FRAME))); + (pmap->pm_pdir[PTDPTDI] & PG_FRAME) == (PTDpde[0] & PG_FRAME))); } /* @@ -971,10 +970,9 @@ pmap_pte(pmap_t pmap, vm_offset_t va) CTR3(KTR_PMAP, "pmap_pte: pmap=%p va=0x%x newpte=0x%08x", pmap, va, (*PMAP2 & 0xffffffff)); } - return (PADDR2 + (i386_btop(va) & (NPTEPG - 1))); } - return (0); + return (NULL); } /* @@ -1065,7 +1063,7 @@ pmap_extract(pmap_t pmap, vm_offset_t va pt_entry_t *pte; pd_entry_t pde; pt_entry_t pteval; - + rtval = 0; PMAP_LOCK(pmap); pde = pmap->pm_pdir[va >> PDRSHIFT]; @@ -1124,7 +1122,7 @@ vm_page_t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) { pd_entry_t pde; - pt_entry_t pte; + pt_entry_t pte, *ptep; vm_page_t m; vm_paddr_t pa; @@ -1136,26 +1134,25 @@ retry: if (pde != 0) { if (pde & PG_PS) { if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) { - if (vm_page_pa_tryrelock(pmap, (pde & PG_PS_FRAME) | - (va & PDRMASK), &pa)) + if (vm_page_pa_tryrelock(pmap, (pde & + PG_PS_FRAME) | (va & PDRMASK), &pa)) goto retry; m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) | (va & PDRMASK)); vm_page_hold(m); } } else { - sched_pin(); - pte = PT_GET(pmap_pte_quick(pmap, va)); - if (*PMAP1) - PT_SET_MA(PADDR1, 0); - if ((pte & PG_V) && + ptep = pmap_pte(pmap, va); + pte = PT_GET(ptep); + pmap_pte_release(ptep); + if (pte != 0 && ((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) { - if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, &pa)) + if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, + &pa)) goto retry; m = PHYS_TO_VM_PAGE(pte & PG_FRAME); vm_page_hold(m); } - sched_unpin(); } } PA_UNLOCK_COND(pa); @@ -1170,10 +1167,13 @@ retry: /* * Add a wired page to the kva. * Note: not SMP coherent. + * + * This function may be used before pmap_bootstrap() is called. */ void pmap_kenter(vm_offset_t va, vm_paddr_t pa) { + PT_SET_MA(va, xpmap_ptom(pa)| PG_RW | PG_V | pgeflag); } @@ -1186,16 +1186,18 @@ pmap_kenter_ma(vm_offset_t va, vm_paddr_ pte_store_ma(pte, ma | PG_RW | PG_V | pgeflag); } - -static __inline void +static __inline void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode) { + PT_SET_MA(va, pa | PG_RW | PG_V | pgeflag | pmap_cache_bits(mode, 0)); } /* * Remove a page from the kernel pagetables. * Note: not SMP coherent. + * + * This function may be used before pmap_bootstrap() is called. */ PMAP_INLINE void pmap_kremove(vm_offset_t va) @@ -1292,7 +1294,6 @@ pmap_qenter(vm_offset_t sva, vm_page_t * #endif } - /* * This routine tears out page mappings from the * kernel -- it is meant only for temporary mappings. @@ -1342,9 +1343,9 @@ pmap_unwire_pte_hold(pmap_t pmap, vm_pag --m->wire_count; if (m->wire_count == 0) - return _pmap_unwire_pte_hold(pmap, m, free); + return (_pmap_unwire_pte_hold(pmap, m, free)); else - return 0; + return (0); } static int @@ -1385,7 +1386,7 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_pa m->right = *free; *free = m; - return 1; + return (1); } /* @@ -1399,17 +1400,25 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t v vm_page_t mpte; if (va >= VM_MAXUSER_ADDRESS) - return 0; + return (0); ptepde = PT_GET(pmap_pde(pmap, va)); mpte = PHYS_TO_VM_PAGE(ptepde & PG_FRAME); - return pmap_unwire_pte_hold(pmap, mpte, free); + return (pmap_unwire_pte_hold(pmap, mpte, free)); } +/* + * Initialize the pmap for the swapper process. + */ void pmap_pinit0(pmap_t pmap) { PMAP_LOCK_INIT(pmap); + /* + * Since the page table directory is shared with the kernel pmap, + * which is already included in the list "allpmaps", this pmap does + * not need to be inserted into that list. + */ pmap->pm_pdir = (pd_entry_t *)(KERNBASE + (vm_offset_t)IdlePTD); #ifdef PAE pmap->pm_pdpt = (pdpt_entry_t *)(KERNBASE + (vm_offset_t)IdlePDPT); @@ -1418,9 +1427,6 @@ pmap_pinit0(pmap_t pmap) PCPU_SET(curpmap, pmap); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); - mtx_lock_spin(&allpmaps_lock); - LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); - mtx_unlock_spin(&allpmaps_lock); } /* @@ -1473,18 +1479,19 @@ pmap_pinit(pmap_t pmap) ptdpg[i++] = m; } } + pmap_qenter((vm_offset_t)pmap->pm_pdir, ptdpg, NPGPTD); - for (i = 0; i < NPGPTD; i++) { + + for (i = 0; i < NPGPTD; i++) if ((ptdpg[i]->flags & PG_ZERO) == 0) - pagezero(&pmap->pm_pdir[i*NPTEPG]); - } + pagezero(pmap->pm_pdir + (i * NPDEPG)); mtx_lock_spin(&allpmaps_lock); LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); + /* Copy the kernel page table directory entries. */ + bcopy(PTD + KPTDI, pmap->pm_pdir + KPTDI, nkpt * sizeof(pd_entry_t)); mtx_unlock_spin(&allpmaps_lock); - /* Wire in kernel global address entries. */ - bcopy(PTD + KPTDI, pmap->pm_pdir + KPTDI, nkpt * sizeof(pd_entry_t)); #ifdef PAE pmap_qenter((vm_offset_t)pmap->pm_pdpt, &ptdpg[NPGPTD], 1); if ((ptdpg[NPGPTD]->flags & PG_ZERO) == 0) @@ -1536,7 +1543,7 @@ pmap_pinit(pmap_t pmap) * mapped correctly. */ static vm_page_t -_pmap_allocpte(pmap_t pmap, unsigned int ptepindex, int flags) +_pmap_allocpte(pmap_t pmap, u_int ptepindex, int flags) { vm_paddr_t ptema; vm_page_t m; @@ -1571,6 +1578,7 @@ _pmap_allocpte(pmap_t pmap, unsigned int * Map the pagetable page into the process address space, if * it isn't already there. */ + pmap->pm_stats.resident_count++; ptema = VM_PAGE_TO_MACH(m); @@ -1586,7 +1594,7 @@ _pmap_allocpte(pmap_t pmap, unsigned int static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags) { - unsigned ptepindex; + u_int ptepindex; pd_entry_t ptema; vm_page_t m; @@ -1764,6 +1772,7 @@ pmap_release(pmap_t pmap) #else int npgptd = NPGPTD; #endif + KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); @@ -1819,7 +1828,7 @@ kvm_size(SYSCTL_HANDLER_ARGS) { unsigned long ksize = VM_MAX_KERNEL_ADDRESS - KERNBASE; - return sysctl_handle_long(oidp, &ksize, 0, req); + return (sysctl_handle_long(oidp, &ksize, 0, req)); } SYSCTL_PROC(_vm, OID_AUTO, kvm_size, CTLTYPE_LONG|CTLFLAG_RD, 0, 0, kvm_size, "IU", "Size of KVM"); @@ -1829,7 +1838,7 @@ kvm_free(SYSCTL_HANDLER_ARGS) { unsigned long kfree = VM_MAX_KERNEL_ADDRESS - kernel_vm_end; - return sysctl_handle_long(oidp, &kfree, 0, req); + return (sysctl_handle_long(oidp, &kfree, 0, req)); } SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG|CTLFLAG_RD, 0, 0, kvm_free, "IU", "Amount of KVM free"); @@ -1858,12 +1867,12 @@ pmap_growkernel(vm_offset_t addr) } } } - addr = roundup2(addr, PAGE_SIZE * NPTEPG); + addr = roundup2(addr, NBPDR); if (addr - 1 >= kernel_map->max_offset) addr = kernel_map->max_offset; while (kernel_vm_end < addr) { if (pdir_pde(PTD, kernel_vm_end)) { - kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1); + kernel_vm_end = (kernel_vm_end + NBPDR) & ~PDRMASK; if (kernel_vm_end - 1 >= kernel_map->max_offset) { kernel_vm_end = kernel_map->max_offset; break; @@ -1871,17 +1880,16 @@ pmap_growkernel(vm_offset_t addr) continue; } - /* - * This index is bogus, but out of the way - */ - nkpg = vm_page_alloc(NULL, nkpt, - VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); - if (!nkpg) + nkpg = vm_page_alloc(NULL, kernel_vm_end >> PDRSHIFT, + VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); + if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpt++; - pmap_zero_page(nkpg); + if ((nkpg->flags & PG_ZERO) == 0) + pmap_zero_page(nkpg); ptppaddr = VM_PAGE_TO_PHYS(nkpg); newpdir = (pd_entry_t) (ptppaddr | PG_V | PG_RW | PG_A | PG_M); vm_page_lock_queues(); @@ -1893,7 +1901,7 @@ pmap_growkernel(vm_offset_t addr) mtx_unlock_spin(&allpmaps_lock); vm_page_unlock_queues(); - kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1); + kernel_vm_end = (kernel_vm_end + NBPDR) & ~PDRMASK; if (kernel_vm_end - 1 >= kernel_map->max_offset) { kernel_vm_end = kernel_map->max_offset; break; @@ -1913,7 +1921,7 @@ static __inline struct pv_chunk * pv_to_chunk(pv_entry_t pv) { - return (struct pv_chunk *)((uintptr_t)pv & ~(uintptr_t)PAGE_MASK); + return ((struct pv_chunk *)((uintptr_t)pv & ~(uintptr_t)PAGE_MASK)); } #define PV_PMAP(pv) (pv_to_chunk(pv)->pc_pmap) @@ -2035,15 +2043,15 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv pc->pc_map[field] |= 1ul << bit; /* move to head of list */ TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); for (idx = 0; idx < _NPCM; idx++) - if (pc->pc_map[idx] != pc_freemask[idx]) + if (pc->pc_map[idx] != pc_freemask[idx]) { + TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); return; + } PV_STAT(pv_entry_spare -= _NPCPV); PV_STAT(pc_chunk_count--); PV_STAT(pc_chunk_frees++); /* entire chunk is free, return it */ - TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); m = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)pc)); pmap_qremove((vm_offset_t)pc, 1); vm_page_unwire(m, 0); @@ -2274,10 +2282,10 @@ pmap_remove(pmap_t pmap, vm_offset_t sva pt_entry_t *pte; vm_page_t free = NULL; int anyvalid; - + CTR3(KTR_PMAP, "pmap_remove: pmap=%p sva=0x%x eva=0x%x", pmap, sva, eva); - + /* * Perform an unsynchronized read. This is, however, safe. */ @@ -2302,12 +2310,14 @@ pmap_remove(pmap_t pmap, vm_offset_t sva } for (; sva < eva; sva = pdnxt) { - unsigned pdirindex; + u_int pdirindex; /* * Calculate index for next page table. */ pdnxt = (sva + NBPDR) & ~PDRMASK; + if (pdnxt < sva) + pdnxt = eva; if (pmap->pm_stats.resident_count == 0) break; @@ -2397,7 +2407,6 @@ pmap_remove_all(vm_page_t m) PMAP_LOCK(pmap); pmap->pm_stats.resident_count--; pte = pmap_pte_quick(pmap, pv->pv_va); - tpte = *pte; PT_SET_VA_MA(pte, 0, TRUE); if (tpte & PG_W) @@ -2461,9 +2470,11 @@ pmap_protect(pmap_t pmap, vm_offset_t sv PMAP_LOCK(pmap); for (; sva < eva; sva = pdnxt) { pt_entry_t obits, pbits; - unsigned pdirindex; + u_int pdirindex; pdnxt = (sva + NBPDR) & ~PDRMASK; + if (pdnxt < sva) + pdnxt = eva; pdirindex = sva >> PDRSHIFT; ptpaddr = pmap->pm_pdir[pdirindex]; @@ -2573,7 +2584,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS, ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)", va)); - KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0, + KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 || + VM_OBJECT_LOCKED(m->object), ("pmap_enter: page %p is not busy", m)); mpte = NULL; @@ -2776,10 +2788,9 @@ pmap_enter_object(pmap_t pmap, vm_offset multicall_entry_t mcl[16]; multicall_entry_t *mclp = mcl; int error, count = 0; - + VM_OBJECT_LOCK_ASSERT(m_start->object, MA_OWNED); psize = atop(end - start); - mpte = NULL; m = m_start; vm_page_lock_queues(); @@ -2818,7 +2829,7 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ multicall_entry_t mcl, *mclp; int count = 0; mclp = &mcl; - + CTR4(KTR_PMAP, "pmap_enter_quick: pmap=%p va=0x%x m=%p prot=0x%x", pmap, va, m, prot); @@ -2869,7 +2880,7 @@ pmap_enter_quick_locked(multicall_entry_ vm_paddr_t pa; vm_page_t free; multicall_entry_t *mcl = *mclpp; - + KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); @@ -2881,7 +2892,7 @@ pmap_enter_quick_locked(multicall_entry_ * resident, we are creating it here. */ if (va < VM_MAXUSER_ADDRESS) { - unsigned ptepindex; + u_int ptepindex; pd_entry_t ptema; /* @@ -2985,7 +2996,7 @@ pmap_enter_quick_locked(multicall_entry_ *mclpp = mcl + 1; *count = *count + 1; #endif - return mpte; + return (mpte); } /* @@ -3010,9 +3021,8 @@ pmap_kenter_temporary(vm_paddr_t pa, int * are taken, but the code works. */ void -pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, - vm_object_t object, vm_pindex_t pindex, - vm_size_t size) +pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, + vm_pindex_t pindex, vm_size_t size) { pd_entry_t *pde; vm_paddr_t pa, ptepa; @@ -3030,6 +3040,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs KASSERT(p->valid == VM_PAGE_BITS_ALL, ("pmap_object_init_pt: invalid page %p", p)); pat_mode = p->md.pat_mode; + /* * Abort the mapping if the first page is not physically * aligned to a 2/4MB page boundary. @@ -3037,6 +3048,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs ptepa = VM_PAGE_TO_PHYS(p); if (ptepa & (NBPDR - 1)) return; + /* * Skip the first page. Abort the mapping if the rest of * the pages are not physically contiguous or have differing @@ -3052,7 +3064,12 @@ pmap_object_init_pt(pmap_t pmap, vm_offs return; p = TAILQ_NEXT(p, listq); } - /* Map using 2/4MB pages. */ + + /* + * Map using 2/4MB pages. Since "ptepa" is 2/4M aligned and + * "size" is a multiple of 2/4M, adding the PAT setting to + * "pa" will not affect the termination of this loop. + */ PMAP_LOCK(pmap); for (pa = ptepa | pmap_cache_bits(pat_mode, 1); pa < ptepa + size; pa += NBPDR) { @@ -3116,7 +3133,7 @@ pmap_change_wiring(pmap_t pmap, vm_offse void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, - vm_offset_t src_addr) + vm_offset_t src_addr) { vm_page_t free; vm_offset_t addr; @@ -3153,12 +3170,14 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm pt_entry_t *src_pte, *dst_pte; vm_page_t dstmpte, srcmpte; pd_entry_t srcptepaddr; - unsigned ptepindex; + u_int ptepindex; KASSERT(addr < UPT_MIN_ADDRESS, ("pmap_copy: invalid to pmap_copy page tables")); pdnxt = (addr + NBPDR) & ~PDRMASK; + if (pdnxt < addr) + pdnxt = end_addr; ptepindex = addr >> PDRSHIFT; srcptepaddr = PT_GET(&src_pmap->pm_pdir[ptepindex]); @@ -3192,7 +3211,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm dstmpte = pmap_allocpte(dst_pmap, addr, M_NOWAIT); if (dstmpte == NULL) - break; + goto out; dst_pte = pmap_pte_quick(dst_pmap, addr); if (*dst_pte == 0 && pmap_try_insert_pv_entry(dst_pmap, addr, @@ -3216,6 +3235,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm addr); pmap_free_zero_pages(free); } + goto out; } if (dstmpte->wire_count >= srcmpte->wire_count) break; @@ -3224,6 +3244,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm src_pte++; } } +out: PT_UPDATES_FLUSH(); sched_unpin(); vm_page_unlock_queues(); @@ -3286,7 +3307,7 @@ pmap_zero_page_area(vm_page_t m, int off sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; mtx_lock(&sysmaps->lock); if (*sysmaps->CMAP2) - panic("pmap_zero_page: CMAP2 busy"); + panic("pmap_zero_page_area: CMAP2 busy"); sched_pin(); PT_SET_MA(sysmaps->CADDR2, PG_V | PG_RW | VM_PAGE_TO_MACH(m) | PG_A | PG_M); @@ -3310,7 +3331,7 @@ pmap_zero_page_idle(vm_page_t m) { if (*CMAP3) - panic("pmap_zero_page: CMAP3 busy"); + panic("pmap_zero_page_idle: CMAP3 busy"); sched_pin(); PT_SET_MA(CADDR3, PG_V | PG_RW | VM_PAGE_TO_MACH(m) | PG_A | PG_M); pagezero(CADDR3); @@ -3774,7 +3795,6 @@ pmap_ts_referenced(vm_page_t m) PT_UPDATES_FLUSH(); if (*PMAP1) PT_SET_MA(PADDR1, 0); - sched_unpin(); vm_page_unlock_queues(); return (rtval); @@ -3809,7 +3829,7 @@ pmap_clear_modify(vm_page_t m) pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pte = pmap_pte_quick(pmap, pv->pv_va); - if ((*pte & PG_M) != 0) { + if ((*pte & (PG_M | PG_RW)) == (PG_M | PG_RW)) { /* * Regardless of whether a pte is 32 or 64 bits * in size, PG_M is among the least significant @@ -3931,8 +3951,6 @@ pmap_unmapdev(vm_offset_t va, vm_size_t void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) { - struct sysmaps *sysmaps; - vm_offset_t sva, eva; m->md.pat_mode = ma; if ((m->flags & PG_FICTITIOUS) != 0) @@ -3955,11 +3973,21 @@ pmap_page_set_memattr(vm_page_t m, vm_me * invalidation. In the worst case, whole cache is flushed by * pmap_invalidate_cache_range(). */ - if ((cpu_feature & (CPUID_SS|CPUID_CLFSH)) == CPUID_CLFSH) { + if ((cpu_feature & CPUID_SS) == 0) + pmap_flush_page(m); +} + +static void +pmap_flush_page(vm_page_t m) +{ + struct sysmaps *sysmaps; + vm_offset_t sva, eva; + + if ((cpu_feature & CPUID_CLFSH) != 0) { sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; mtx_lock(&sysmaps->lock); if (*sysmaps->CMAP2) - panic("pmap_page_set_memattr: CMAP2 busy"); + panic("pmap_flush_page: CMAP2 busy"); sched_pin(); PT_SET_MA(sysmaps->CADDR2, PG_V | PG_RW | VM_PAGE_TO_MACH(m) | PG_A | PG_M | @@ -3967,21 +3995,35 @@ pmap_page_set_memattr(vm_page_t m, vm_me invlcaddr(sysmaps->CADDR2); sva = (vm_offset_t)sysmaps->CADDR2; eva = sva + PAGE_SIZE; - } else - sva = eva = 0; /* gcc */ - pmap_invalidate_cache_range(sva, eva); - if (sva != 0) { + + /* + * Use mfence despite the ordering implied by + * mtx_{un,}lock() because clflush is not guaranteed + * to be ordered by any other instruction. + */ + mfence(); + for (; sva < eva; sva += cpu_clflush_line_size) + clflush(sva); + mfence(); PT_SET_MA(sysmaps->CADDR2, 0); sched_unpin(); mtx_unlock(&sysmaps->lock); - } + } else + pmap_invalidate_cache(); } +/* + * Changes the specified virtual address range's memory type to that given by + * the parameter "mode". The specified virtual address range must be + * completely contained within either the kernel map. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 21 21:54:31 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 EB79A106564A; Sat, 21 Jan 2012 21:54:31 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D62A88FC12; Sat, 21 Jan 2012 21:54: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 q0LLsVh8011123; Sat, 21 Jan 2012 21:54:31 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0LLsVc8011121; Sat, 21 Jan 2012 21:54:31 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201212154.q0LLsVc8011121@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 21 Jan 2012 21:54: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: r230439 - stable/9/bin/sh 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, 21 Jan 2012 21:54:32 -0000 Author: jilles Date: Sat Jan 21 21:54:31 2012 New Revision: 230439 URL: http://svn.freebsd.org/changeset/base/230439 Log: MFC r230117: sh: Fix out of bounds array access when trap is used with an invalid signal. Modified: stable/9/bin/sh/trap.c Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/trap.c ============================================================================== --- stable/9/bin/sh/trap.c Sat Jan 21 21:12:53 2012 (r230438) +++ stable/9/bin/sh/trap.c Sat Jan 21 21:54:31 2012 (r230439) @@ -191,10 +191,11 @@ trapcmd(int argc, char **argv) argv++; } } - while (*argv) { + for (; *argv; argv++) { if ((signo = sigstring_to_signum(*argv)) == -1) { warning("bad signal %s", *argv); errors = 1; + continue; } INTOFF; if (action) @@ -205,7 +206,6 @@ trapcmd(int argc, char **argv) if (signo != 0) setsignal(signo); INTON; - argv++; } return errors; }