From owner-svn-src-head@FreeBSD.ORG Sun Jul 24 03:34:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6C73106564A; Sun, 24 Jul 2011 03:34:38 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6EEF8FC12; Sun, 24 Jul 2011 03:34:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6O3YcZT088758; Sun, 24 Jul 2011 03:34:38 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6O3YcTh088756; Sun, 24 Jul 2011 03:34:38 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201107240334.p6O3YcTh088756@svn.freebsd.org> From: Glen Barber Date: Sun, 24 Jul 2011 03:34:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224286 - head/usr.sbin/jail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jul 2011 03:34:38 -0000 Author: gjb (doc committer) Date: Sun Jul 24 03:34:38 2011 New Revision: 224286 URL: http://svn.freebsd.org/changeset/base/224286 Log: Document the potential for jail escape. Submitted by: Vedad KAJTAZ (vedad % kajtaz net) PR: 142341 Reviewed by: bz, rwatson Rewording by: rwatson Approved by: re (kensmith) MFC after: 3 days Modified: head/usr.sbin/jail/jail.8 Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Sun Jul 24 01:36:01 2011 (r224285) +++ head/usr.sbin/jail/jail.8 Sun Jul 24 03:34:38 2011 (r224286) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 17, 2010 +.Dd July 23, 2011 .Dt JAIL 8 .Os .Sh NAME @@ -907,3 +907,10 @@ Currently, the simplest answer is to min offered on the host, possibly limiting it to services offered from .Xr inetd 8 which is easily configurable. +.Sh NOTES +Great care should be taken when managing directories visible within the jail. +For example, if a jailed process has its current working directory set to a +directory that is moved out of the jail's chroot, then the process may gain +access to the file space outside of the jail. +It is recommended that directories always be copied, rather than moved, out +of a jail. From owner-svn-src-head@FreeBSD.ORG Sun Jul 24 17:43:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B13A106564A; Sun, 24 Jul 2011 17:43:10 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED6FC8FC0A; Sun, 24 Jul 2011 17: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 p6OHh9eK018061; Sun, 24 Jul 2011 17:43:09 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6OHh9po018053; Sun, 24 Jul 2011 17:43:09 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201107241743.p6OHh9po018053@svn.freebsd.org> From: Kirk McKusick Date: Sun, 24 Jul 2011 17:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224290 - in head/sys: fs/cd9660 fs/msdosfs fs/ntfs fs/smbfs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jul 2011 17:43:10 -0000 Author: mckusick Date: Sun Jul 24 17:43:09 2011 New Revision: 224290 URL: http://svn.freebsd.org/changeset/base/224290 Log: This update changes the mnt_flag field in the mount structure from 32 bits to 64 bits and eliminates the unused mnt_xflag field. The existing mnt_flag field is completely out of bits, so this update gives us room to expand. Note that the f_flags field in the statfs structure is already 64 bits, so the expanded mnt_flag field can be exported without having to make any changes in the statfs structure. Approved by: re (bz) Modified: head/sys/fs/cd9660/iso.h head/sys/fs/msdosfs/msdosfsmount.h head/sys/fs/ntfs/ntfs.h head/sys/fs/smbfs/smbfs.h head/sys/kern/kern_jail.c head/sys/kern/vfs_mount.c head/sys/sys/mount.h Modified: head/sys/fs/cd9660/iso.h ============================================================================== --- head/sys/fs/cd9660/iso.h Sun Jul 24 17:24:26 2011 (r224289) +++ head/sys/fs/cd9660/iso.h Sun Jul 24 17:43:09 2011 (r224290) @@ -220,7 +220,7 @@ enum ISO_FTYPE { ISO_FTYPE_DEFAULT, ISO_ #endif struct iso_mnt { - int im_flags; + uint64_t im_flags; struct mount *im_mountp; struct cdev *im_dev; Modified: head/sys/fs/msdosfs/msdosfsmount.h ============================================================================== --- head/sys/fs/msdosfs/msdosfsmount.h Sun Jul 24 17:24:26 2011 (r224289) +++ head/sys/fs/msdosfs/msdosfsmount.h Sun Jul 24 17:43:09 2011 (r224290) @@ -103,7 +103,7 @@ struct msdosfsmount { u_int pm_fatdiv; /* offset computation */ u_int pm_curfat; /* current fat for FAT32 (0 otherwise) */ u_int *pm_inusemap; /* ptr to bitmap of in-use clusters */ - u_int pm_flags; /* see below */ + uint64_t pm_flags; /* see below */ void *pm_u2w; /* Local->Unicode iconv handle */ void *pm_w2u; /* Unicode->Local iconv handle */ void *pm_u2d; /* Unicode->DOS iconv handle */ Modified: head/sys/fs/ntfs/ntfs.h ============================================================================== --- head/sys/fs/ntfs/ntfs.h Sun Jul 24 17:24:26 2011 (r224289) +++ head/sys/fs/ntfs/ntfs.h Sun Jul 24 17:43:09 2011 (r224290) @@ -250,7 +250,7 @@ struct ntfsmount { uid_t ntm_uid; gid_t ntm_gid; mode_t ntm_mode; - u_int ntm_flag; + uint64_t ntm_flag; cn_t ntm_cfree; struct ntvattrdef *ntm_ad; int ntm_adnum; Modified: head/sys/fs/smbfs/smbfs.h ============================================================================== --- head/sys/fs/smbfs/smbfs.h Sun Jul 24 17:24:26 2011 (r224289) +++ head/sys/fs/smbfs/smbfs.h Sun Jul 24 17:43:09 2011 (r224290) @@ -80,7 +80,7 @@ struct smbmount { struct mount * sm_mp; struct smbnode * sm_root; struct ucred * sm_owner; - u_int sm_flags; + uint64_t sm_flags; long sm_nextino; struct smb_share * sm_share; /* struct simplelock sm_npslock;*/ Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Sun Jul 24 17:24:26 2011 (r224289) +++ head/sys/kern/kern_jail.c Sun Jul 24 17:43:09 2011 (r224290) @@ -540,8 +540,8 @@ kern_jail_set(struct thread *td, struct #ifdef INET6 int ip6s, redo_ip6; #endif - unsigned pr_flags, ch_flags; - unsigned pr_allow, ch_allow, tallow; + uint64_t pr_allow, ch_allow, pr_flags, ch_flags; + unsigned tallow; char numbuf[12]; error = priv_check(td, PRIV_JAIL_SET); Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Sun Jul 24 17:24:26 2011 (r224289) +++ head/sys/kern/vfs_mount.c Sun Jul 24 17:43:09 2011 (r224290) @@ -1496,7 +1496,8 @@ vfs_getopts(struct vfsoptlist *opts, con } int -vfs_flagopt(struct vfsoptlist *opts, const char *name, u_int *w, u_int val) +vfs_flagopt(struct vfsoptlist *opts, const char *name, uint64_t *w, + uint64_t val) { struct vfsopt *opt; Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Sun Jul 24 17:24:26 2011 (r224289) +++ head/sys/sys/mount.h Sun Jul 24 17:43:09 2011 (r224290) @@ -166,8 +166,7 @@ struct mount { int mnt_nvnodelistsize; /* (i) # of vnodes */ int mnt_writeopcount; /* (i) write syscalls pending */ int mnt_kern_flag; /* (i) kernel only flags */ - u_int mnt_flag; /* (i) flags shared with user */ - u_int mnt_xflag; /* (i) more flags shared with user */ + uint64_t mnt_flag; /* (i) flags shared with user */ u_int mnt_noasync; /* (i) # noasync overrides */ struct vfsoptlist *mnt_opt; /* current mount options */ struct vfsoptlist *mnt_optnew; /* new options passed to fs */ @@ -224,43 +223,43 @@ void __mnt_vnode_markerfree(str /* * User specifiable flags, stored in mnt_flag. */ -#define MNT_RDONLY 0x00000001 /* read only filesystem */ -#define MNT_SYNCHRONOUS 0x00000002 /* filesystem written synchronously */ -#define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */ -#define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */ -#define MNT_UNION 0x00000020 /* union with underlying filesystem */ -#define MNT_ASYNC 0x00000040 /* filesystem written asynchronously */ -#define MNT_SUIDDIR 0x00100000 /* special handling of SUID on dirs */ -#define MNT_SOFTDEP 0x00200000 /* soft updates being done */ -#define MNT_NOSYMFOLLOW 0x00400000 /* do not follow symlinks */ -#define MNT_GJOURNAL 0x02000000 /* GEOM journal support enabled */ -#define MNT_MULTILABEL 0x04000000 /* MAC support for individual objects */ -#define MNT_ACLS 0x08000000 /* ACL support enabled */ -#define MNT_NOATIME 0x10000000 /* disable update of file access time */ -#define MNT_NOCLUSTERR 0x40000000 /* disable cluster read */ -#define MNT_NOCLUSTERW 0x80000000 /* disable cluster write */ -#define MNT_NFS4ACLS 0x00000010 +#define MNT_RDONLY 0x0000000000000001ULL /* read only filesystem */ +#define MNT_SYNCHRONOUS 0x0000000000000002ULL /* fs written synchronously */ +#define MNT_NOEXEC 0x0000000000000004ULL /* can't exec from filesystem */ +#define MNT_NOSUID 0x0000000000000008ULL /* don't honor setuid fs bits */ +#define MNT_NFS4ACLS 0x0000000000000010ULL /* enable NFS version 4 ACLs */ +#define MNT_UNION 0x0000000000000020ULL /* union with underlying fs */ +#define MNT_ASYNC 0x0000000000000040ULL /* fs written asynchronously */ +#define MNT_SUIDDIR 0x0000000000100000ULL /* special SUID dir handling */ +#define MNT_SOFTDEP 0x0000000000200000ULL /* using soft updates */ +#define MNT_NOSYMFOLLOW 0x0000000000400000ULL /* do not follow symlinks */ +#define MNT_GJOURNAL 0x0000000002000000ULL /* GEOM journal support enabled */ +#define MNT_MULTILABEL 0x0000000004000000ULL /* MAC support for objects */ +#define MNT_ACLS 0x0000000008000000ULL /* ACL support enabled */ +#define MNT_NOATIME 0x0000000010000000ULL /* dont update file access time */ +#define MNT_NOCLUSTERR 0x0000000040000000ULL /* disable cluster read */ +#define MNT_NOCLUSTERW 0x0000000080000000ULL /* disable cluster write */ /* * NFS export related mount flags. */ -#define MNT_EXRDONLY 0x00000080 /* exported read only */ -#define MNT_EXPORTED 0x00000100 /* filesystem is exported */ -#define MNT_DEFEXPORTED 0x00000200 /* exported to the world */ -#define MNT_EXPORTANON 0x00000400 /* use anon uid mapping for everyone */ -#define MNT_EXKERB 0x00000800 /* exported with Kerberos uid mapping */ -#define MNT_EXPUBLIC 0x20000000 /* public export (WebNFS) */ +#define MNT_EXRDONLY 0x0000000000000080ULL /* exported read only */ +#define MNT_EXPORTED 0x0000000000000100ULL /* filesystem is exported */ +#define MNT_DEFEXPORTED 0x0000000000000200ULL /* exported to the world */ +#define MNT_EXPORTANON 0x0000000000000400ULL /* anon uid mapping for all */ +#define MNT_EXKERB 0x0000000000000800ULL /* exported with Kerberos */ +#define MNT_EXPUBLIC 0x0000000020000000ULL /* public export (WebNFS) */ /* * Flags set by internal operations, * but visible to the user. * XXX some of these are not quite right.. (I've never seen the root flag set) */ -#define MNT_LOCAL 0x00001000 /* filesystem is stored locally */ -#define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */ -#define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */ -#define MNT_USER 0x00008000 /* mounted by a user */ -#define MNT_IGNORE 0x00800000 /* do not show entry in df */ +#define MNT_LOCAL 0x0000000000001000ULL /* filesystem is stored locally */ +#define MNT_QUOTA 0x0000000000002000ULL /* quotas are enabled on fs */ +#define MNT_ROOTFS 0x0000000000004000ULL /* identifies the root fs */ +#define MNT_USER 0x0000000000008000ULL /* mounted by a user */ +#define MNT_IGNORE 0x0000000000800000ULL /* do not show entry in df */ /* * Mask of flags that are visible to statfs(). @@ -293,12 +292,12 @@ void __mnt_vnode_markerfree(str * XXX: MNT_BYFSID collides with MNT_ACLS, but because MNT_ACLS is only used for * mount(2) and MNT_BYFSID is only used for unmount(2) it's harmless. */ -#define MNT_UPDATE 0x00010000 /* not a real mount, just an update */ -#define MNT_DELEXPORT 0x00020000 /* delete export host lists */ -#define MNT_RELOAD 0x00040000 /* reload filesystem data */ -#define MNT_FORCE 0x00080000 /* force unmount or readonly change */ -#define MNT_SNAPSHOT 0x01000000 /* snapshot the filesystem */ -#define MNT_BYFSID 0x08000000 /* specify filesystem by ID. */ +#define MNT_UPDATE 0x0000000000010000ULL /* not real mount, just update */ +#define MNT_DELEXPORT 0x0000000000020000ULL /* delete export host lists */ +#define MNT_RELOAD 0x0000000000040000ULL /* reload filesystem data */ +#define MNT_FORCE 0x0000000000080000ULL /* force unmount or readonly */ +#define MNT_SNAPSHOT 0x0000000001000000ULL /* snapshot the filesystem */ +#define MNT_BYFSID 0x0000000008000000ULL /* specify filesystem by ID. */ #define MNT_CMDFLAGS (MNT_UPDATE | MNT_DELEXPORT | MNT_RELOAD | \ MNT_FORCE | MNT_SNAPSHOT | MNT_BYFSID) /* @@ -715,7 +714,8 @@ void vfs_event_signal(fsid_t *, u_int32_ void vfs_freeopts(struct vfsoptlist *opts); void vfs_deleteopt(struct vfsoptlist *opts, const char *name); int vfs_buildopts(struct uio *auio, struct vfsoptlist **options); -int vfs_flagopt(struct vfsoptlist *opts, const char *name, u_int *w, u_int val); +int vfs_flagopt(struct vfsoptlist *opts, const char *name, uint64_t *w, + uint64_t val); int vfs_getopt(struct vfsoptlist *, const char *, void **, int *); int vfs_getopt_pos(struct vfsoptlist *opts, const char *name); char *vfs_getopts(struct vfsoptlist *, const char *, int *error); From owner-svn-src-head@FreeBSD.ORG Sun Jul 24 18:27:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DE2B1065670; Sun, 24 Jul 2011 18:27:10 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C06F8FC20; Sun, 24 Jul 2011 18:27: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 p6OIR9pl019531; Sun, 24 Jul 2011 18:27:09 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6OIR9Tj019524; Sun, 24 Jul 2011 18:27:09 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201107241827.p6OIR9Tj019524@svn.freebsd.org> From: Kirk McKusick Date: Sun, 24 Jul 2011 18:27:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224294 - in head: sbin/mount sys/kern sys/sys sys/ufs/ffs sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jul 2011 18:27:10 -0000 Author: mckusick Date: Sun Jul 24 18:27:09 2011 New Revision: 224294 URL: http://svn.freebsd.org/changeset/base/224294 Log: Move the MNTK_SUJ flag in mnt_kern_flag to MNT_SUJ in mnt_flag so that it is visible to userland programs. This change enables the `mount' command with no arguments to be able to show if a filesystem is mounted using journaled soft updates as opposed to just normal soft updates. Approved by: re (bz) Modified: head/sbin/mount/mount.c head/sys/kern/vfs_subr.c head/sys/sys/mount.h head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ufs/inode.h Modified: head/sbin/mount/mount.c ============================================================================== --- head/sbin/mount/mount.c Sun Jul 24 18:16:14 2011 (r224293) +++ head/sbin/mount/mount.c Sun Jul 24 18:27:09 2011 (r224294) @@ -109,6 +109,7 @@ static struct opt { { MNT_NOCLUSTERW, "noclusterw" }, { MNT_SUIDDIR, "suiddir" }, { MNT_SOFTDEP, "soft-updates" }, + { MNT_SUJ, "journaled soft-updates" }, { MNT_MULTILABEL, "multilabel" }, { MNT_ACLS, "acls" }, { MNT_NFS4ACLS, "nfsv4acls" }, @@ -316,7 +317,7 @@ main(int argc, char *argv[]) rval = 0; switch (argc) { case 0: - if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) + if ((mntsize = getmntinfo(&mntbuf, MNT_WAIT)) == 0) err(1, "getmntinfo"); if (all) { while ((fs = getfsent()) != NULL) { @@ -665,7 +666,7 @@ getmntpt(const char *name) struct statfs *mntbuf; int i, mntsize; - mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); + mntsize = getmntinfo(&mntbuf, MNT_WAIT); for (i = mntsize - 1; i >= 0; i--) { if (strcmp(mntbuf[i].f_mntfromname, name) == 0 || strcmp(mntbuf[i].f_mntonname, name) == 0) Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sun Jul 24 18:16:14 2011 (r224293) +++ head/sys/kern/vfs_subr.c Sun Jul 24 18:27:09 2011 (r224294) @@ -2841,6 +2841,7 @@ DB_SHOW_COMMAND(mount, db_show_mount) MNT_FLAG(MNT_ASYNC); MNT_FLAG(MNT_SUIDDIR); MNT_FLAG(MNT_SOFTDEP); + MNT_FLAG(MNT_SUJ); MNT_FLAG(MNT_NOSYMFOLLOW); MNT_FLAG(MNT_GJOURNAL); MNT_FLAG(MNT_MULTILABEL); @@ -2866,7 +2867,6 @@ DB_SHOW_COMMAND(mount, db_show_mount) MNT_FLAG(MNT_FORCE); MNT_FLAG(MNT_SNAPSHOT); MNT_FLAG(MNT_BYFSID); - MNT_FLAG(MNT_SOFTDEP); #undef MNT_FLAG if (flags != 0) { if (buf[0] != '\0') @@ -2894,7 +2894,6 @@ DB_SHOW_COMMAND(mount, db_show_mount) MNT_KERN_FLAG(MNTK_REFEXPIRE); MNT_KERN_FLAG(MNTK_EXTENDED_SHARED); MNT_KERN_FLAG(MNTK_SHARED_WRITES); - MNT_KERN_FLAG(MNTK_SUJ); MNT_KERN_FLAG(MNTK_UNMOUNT); MNT_KERN_FLAG(MNTK_MWAIT); MNT_KERN_FLAG(MNTK_SUSPEND); Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Sun Jul 24 18:16:14 2011 (r224293) +++ head/sys/sys/mount.h Sun Jul 24 18:27:09 2011 (r224294) @@ -239,6 +239,7 @@ void __mnt_vnode_markerfree(str #define MNT_NOATIME 0x0000000010000000ULL /* dont update file access time */ #define MNT_NOCLUSTERR 0x0000000040000000ULL /* disable cluster read */ #define MNT_NOCLUSTERW 0x0000000080000000ULL /* disable cluster write */ +#define MNT_SUJ 0x0000000100000000ULL /* using journaled soft updates */ /* * NFS export related mount flags. @@ -267,7 +268,7 @@ void __mnt_vnode_markerfree(str * but the 'mount' program may need changing to handle this. */ #define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | \ - MNT_NOSUID | MNT_UNION | \ + MNT_NOSUID | MNT_UNION | MNT_SUJ | \ MNT_ASYNC | MNT_EXRDONLY | MNT_EXPORTED | \ MNT_DEFEXPORTED | MNT_EXPORTANON| MNT_EXKERB | \ MNT_LOCAL | MNT_USER | MNT_QUOTA | \ @@ -324,7 +325,6 @@ void __mnt_vnode_markerfree(str #define MNTK_REFEXPIRE 0x00000020 /* refcount expiring is happening */ #define MNTK_EXTENDED_SHARED 0x00000040 /* Allow shared locking for more ops */ #define MNTK_SHARED_WRITES 0x00000080 /* Allow shared locking for writes */ -#define MNTK_SUJ 0x00000100 /* Softdep journaling enabled */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ #define MNTK_SUSPEND 0x08000000 /* request write suspension */ Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Sun Jul 24 18:16:14 2011 (r224293) +++ head/sys/ufs/ffs/ffs_softdep.c Sun Jul 24 18:27:09 2011 (r224294) @@ -2423,11 +2423,11 @@ softdep_unmount(mp) MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_SOFTDEP; - if ((mp->mnt_kern_flag & MNTK_SUJ) == 0) { + if ((mp->mnt_flag & MNT_SUJ) == 0) { MNT_IUNLOCK(mp); return; } - mp->mnt_kern_flag &= ~MNTK_SUJ; + mp->mnt_flag &= ~MNT_SUJ; MNT_IUNLOCK(mp); journal_unmount(mp); } @@ -2637,7 +2637,7 @@ journal_mount(mp, fs, cred) out: if (error == 0) { MNT_ILOCK(mp); - mp->mnt_kern_flag |= MNTK_SUJ; + mp->mnt_flag |= MNT_SUJ; MNT_IUNLOCK(mp); /* * Only validate the journal contents if the @@ -3060,7 +3060,7 @@ softdep_flushjournal(mp) struct jblocks *jblocks; struct ufsmount *ump; - if ((mp->mnt_kern_flag & MNTK_SUJ) == 0) + if ((mp->mnt_flag & MNT_SUJ) == 0) return; ump = VFSTOUFS(mp); jblocks = ump->softdep_jblocks; @@ -3096,7 +3096,7 @@ softdep_process_journal(mp, needwk, flag int off; int devbsize; - if ((mp->mnt_kern_flag & MNTK_SUJ) == 0) + if ((mp->mnt_flag & MNT_SUJ) == 0) return; ump = VFSTOUFS(mp); fs = ump->um_fs; @@ -3827,7 +3827,7 @@ newfreework(ump, freeblks, parent, lbn, freework->fw_blkno = nb; freework->fw_frags = frags; freework->fw_indir = NULL; - freework->fw_ref = ((UFSTOVFS(ump)->mnt_kern_flag & MNTK_SUJ) == 0 || + freework->fw_ref = ((UFSTOVFS(ump)->mnt_flag & MNT_SUJ) == 0 || lbn >= -NXADDR) ? 0 : NINDIR(ump->um_fs) + 1; freework->fw_start = freework->fw_off = off; if (journal) @@ -4681,7 +4681,7 @@ softdep_setup_inomapdep(bp, ip, newinum, * Allocate the journal reference add structure so that the bitmap * can be dependent on it. */ - if (mp->mnt_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { jaddref = newjaddref(ip, newinum, 0, 0, mode); jaddref->ja_state |= NEWBLOCK; } @@ -4734,7 +4734,7 @@ softdep_setup_blkmapdep(bp, mp, newblkno * Add it to the dependency list for the buffer holding * the cylinder group map from which it was allocated. */ - if (mp->mnt_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { jnewblk = malloc(sizeof(*jnewblk), M_JNEWBLK, M_SOFTDEP_FLAGS); workitem_alloc(&jnewblk->jn_list, D_JNEWBLK, mp); jnewblk->jn_jsegdep = newjsegdep(&jnewblk->jn_list); @@ -5199,7 +5199,7 @@ newfreefrag(ip, blkno, size, lbn) freefrag->ff_blkno = blkno; freefrag->ff_fragsize = size; - if ((ip->i_ump->um_mountp->mnt_kern_flag & MNTK_SUJ) != 0) { + if ((ip->i_ump->um_mountp->mnt_flag & MNT_SUJ) != 0) { freefrag->ff_jdep = (struct worklist *) newjfreefrag(freefrag, ip, blkno, size, lbn); } else { @@ -7254,7 +7254,7 @@ freework_freeblock(freework) freeblks = freework->fw_freeblks; ump = VFSTOUFS(freeblks->fb_list.wk_mp); fs = ump->um_fs; - needj = freeblks->fb_list.wk_mp->mnt_kern_flag & MNTK_SUJ; + needj = (freeblks->fb_list.wk_mp->mnt_flag & MNT_SUJ) != 0; bsize = lfragtosize(fs, freework->fw_frags); LIST_INIT(&wkhd); /* @@ -7674,7 +7674,7 @@ indir_trunc(freework, dbn, lbn) ufs1fmt = 0; } level = lbn_level(lbn); - needj = UFSTOVFS(ump)->mnt_kern_flag & MNTK_SUJ; + needj = (UFSTOVFS(ump)->mnt_flag & MNT_SUJ) != 0; lbnadd = lbn_offset(fs, level); nblocks = btodb(fs->fs_bsize); nfreework = freework; @@ -7860,7 +7860,7 @@ setup_newdir(dap, newinum, dinum, newdir mkdir2->md_state = ATTACHED | MKDIR_PARENT; mkdir2->md_diradd = dap; mkdir2->md_jaddref = NULL; - if ((mp->mnt_kern_flag & MNTK_SUJ) == 0) { + if ((mp->mnt_flag & MNT_SUJ) == 0) { mkdir1->md_state |= DEPCOMPLETE; mkdir2->md_state |= DEPCOMPLETE; } @@ -7900,7 +7900,7 @@ setup_newdir(dap, newinum, dinum, newdir * been satisfied and mkdir2 can be freed. */ inodedep_lookup(mp, dinum, 0, &inodedep); - if (mp->mnt_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { if (inodedep == NULL) panic("setup_newdir: Lost parent."); jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, @@ -8031,7 +8031,7 @@ softdep_setup_directory_add(bp, dp, diro * written place it on the bufwait list, otherwise do the post-inode * write processing to put it on the id_pendinghd list. */ - if (mp->mnt_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, inoreflst); KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number, @@ -8047,7 +8047,7 @@ softdep_setup_directory_add(bp, dp, diro * Add the journal entries for . and .. links now that the primary * link is written. */ - if (mkdir1 != NULL && mp->mnt_kern_flag & MNTK_SUJ) { + if (mkdir1 != NULL && (mp->mnt_flag & MNT_SUJ)) { jaddref = (struct jaddref *)TAILQ_PREV(&jaddref->ja_ref, inoreflst, if_deps); KASSERT(jaddref != NULL && @@ -8144,7 +8144,7 @@ softdep_change_directoryentry_offset(bp, * determine if any affected adds or removes are present in the * journal. */ - if (mp->mnt_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { flags = DEPALLOC; jmvref = newjmvref(dp, de->d_ino, dp->i_offset + (oldloc - base), @@ -8865,7 +8865,7 @@ softdep_setup_directory_change(bp, dp, i * processing to put it on the id_pendinghd list. */ inodedep_lookup(mp, newinum, DEPALLOC, &inodedep); - if (mp->mnt_kern_flag & MNTK_SUJ) { + if (mp->mnt_flag & MNT_SUJ) { jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, inoreflst); KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number, @@ -8928,7 +8928,7 @@ softdep_setup_sbupdate(ump, fs, bp) struct sbdep *sbdep; struct worklist *wk; - if ((ump->um_mountp->mnt_kern_flag & MNTK_SUJ) == 0) + if ((ump->um_mountp->mnt_flag & MNT_SUJ) == 0) return; LIST_FOREACH(wk, &bp->b_dep, wk_list) if (wk->wk_type == D_SBDEP) @@ -9046,7 +9046,7 @@ unlinked_inodedep(mp, inodedep) { struct ufsmount *ump; - if ((mp->mnt_kern_flag & MNTK_SUJ) == 0) + if ((mp->mnt_flag & MNT_SUJ) == 0) return; ump = VFSTOUFS(mp); ump->um_fs->fs_fmod = 1; Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Sun Jul 24 18:16:14 2011 (r224293) +++ head/sys/ufs/ffs/ffs_vfsops.c Sun Jul 24 18:27:09 2011 (r224294) @@ -1389,6 +1389,9 @@ ffs_statfs(mp, sbp) fs = ump->um_fs; if (fs->fs_magic != FS_UFS1_MAGIC && fs->fs_magic != FS_UFS2_MAGIC) panic("ffs_statfs"); + /* Don't export MNT_SOFTDEP when MNT_SUJ is in use */ + if ((sbp->f_flags & (MNT_SOFTDEP | MNT_SUJ)) == (MNT_SOFTDEP | MNT_SUJ)) + sbp->f_flags &= ~MNT_SOFTDEP; sbp->f_version = STATFS_VERSION; sbp->f_bsize = fs->fs_fsize; sbp->f_iosize = fs->fs_bsize; Modified: head/sys/ufs/ufs/inode.h ============================================================================== --- head/sys/ufs/ufs/inode.h Sun Jul 24 18:16:14 2011 (r224293) +++ head/sys/ufs/ufs/inode.h Sun Jul 24 18:27:09 2011 (r224294) @@ -176,7 +176,7 @@ struct indir { /* Determine if soft dependencies are being done */ #define DOINGSOFTDEP(vp) ((vp)->v_mount->mnt_flag & MNT_SOFTDEP) #define DOINGASYNC(vp) ((vp)->v_mount->mnt_kern_flag & MNTK_ASYNC) -#define DOINGSUJ(vp) ((vp)->v_mount->mnt_kern_flag & MNTK_SUJ) +#define DOINGSUJ(vp) ((vp)->v_mount->mnt_flag & MNT_SUJ) /* This overlays the fid structure (see mount.h). */ struct ufid { From owner-svn-src-head@FreeBSD.ORG Sun Jul 24 21:35:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EFB0106566B; Sun, 24 Jul 2011 21:35:17 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from agogare.doit.wisc.edu (agogare.doit.wisc.edu [144.92.197.211]) by mx1.freebsd.org (Postfix) with ESMTP id 4E9708FC18; Sun, 24 Jul 2011 21:35:17 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth2.wiscmail.wisc.edu by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0LOU00000XAS4H00@smtpauth2.wiscmail.wisc.edu>; Sun, 24 Jul 2011 16:35:16 -0500 (CDT) Received: from comporellon.tachypleus.net ([unknown] [76.210.68.180]) by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0LOU00CH9XAR6620@smtpauth2.wiscmail.wisc.edu>; Sun, 24 Jul 2011 16:35:15 -0500 (CDT) Date: Sun, 24 Jul 2011 16:35:14 -0500 From: Nathan Whitehorn In-reply-to: <201107191241.p6JCfvqw072816@svn.freebsd.org> To: Attilio Rao Message-id: <4E2C9012.602@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.210.68.180 X-Spam-PmxInfo: Server=avs-11, Version=5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.7.24.212414, SenderIP=76.210.68.180 References: <201107191241.p6JCfvqw072816@svn.freebsd.org> User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20110704 Thunderbird/5.0 X-Mailman-Approved-At: Mon, 25 Jul 2011 00:39:09 +0000 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, FreeBSD Release Engineering Team Subject: Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jul 2011 21:35:17 -0000 On 07/19/11 07:41, Attilio Rao wrote: > Author: attilio > Date: Tue Jul 19 12:41:57 2011 > New Revision: 224216 > URL: http://svn.freebsd.org/changeset/base/224216 > > Log: > On 64 bit architectures size_t is 8 bytes, thus it should use an 8 bytes > storage. > Fix the sintrcnt/sintrnames specification. > > No MFC is previewed for this patch. > These also need to be .long on 32-bit PowerPC, otherwise this change triggers kernel panics and faults in sysctl. Please change it as quickly as possible. -Nathan From owner-svn-src-head@FreeBSD.ORG Mon Jul 25 09:12:49 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D495106566B; Mon, 25 Jul 2011 09:12:49 +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 632D08FC15; Mon, 25 Jul 2011 09:12:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6P9CnnL046306; Mon, 25 Jul 2011 09:12:49 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6P9Cn0m046298; Mon, 25 Jul 2011 09:12:49 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201107250912.p6P9Cn0m046298@svn.freebsd.org> From: Andriy Gapon Date: Mon, 25 Jul 2011 09:12:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224307 - in head/sys: conf kern netgraph sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2011 09:12:49 -0000 Author: avg Date: Mon Jul 25 09:12:48 2011 New Revision: 224307 URL: http://svn.freebsd.org/changeset/base/224307 Log: remove RESTARTABLE_PANICS option This is done per request/suggestion from John Baldwin who introduced the option. Trying to resume normal system operation after a panic is very unpredictable and dangerous. It will become even more dangerous when we allow a thread in panic(9) to penetrate all lock contexts. I understand that the only purpose of this option was for testing scenarios potentially resulting in panic. Suggested by: jhb Reviewed by: attilio, jhb X-MFC-After: never Approved by: re (kib) Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/kern/kern_shutdown.c head/sys/netgraph/ng_ether.c head/sys/netgraph/ng_mppc.c head/sys/netgraph/ng_parse.c head/sys/sys/systm.h Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Jul 25 07:45:22 2011 (r224306) +++ head/sys/conf/NOTES Mon Jul 25 09:12:48 2011 (r224307) @@ -499,16 +499,6 @@ options DIAGNOSTIC options REGRESSION # -# RESTARTABLE_PANICS allows one to continue from a panic as if it were -# a call to the debugger to continue from a panic as instead. It is only -# useful if a kernel debugger is present. To restart from a panic, reset -# the panicstr variable to NULL and continue execution. This option is -# for development use only and should NOT be used in production systems -# to "workaround" a panic. -# -#options RESTARTABLE_PANICS - -# # This option lets some drivers co-exist that can't co-exist in a running # system. This is used to be able to compile all kernel code in one go for # quality assurance purposes (like this file, which the option takes it name Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Jul 25 07:45:22 2011 (r224306) +++ head/sys/conf/options Mon Jul 25 09:12:48 2011 (r224307) @@ -579,7 +579,6 @@ LOCK_PROFILING opt_global.h LOCK_PROFILING_FAST opt_global.h MSIZE opt_global.h REGRESSION opt_global.h -RESTARTABLE_PANICS opt_global.h RWLOCK_NOINLINE opt_global.h SX_NOINLINE opt_global.h VFS_BIO_DEBUG opt_global.h Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Mon Jul 25 07:45:22 2011 (r224306) +++ head/sys/kern/kern_shutdown.c Mon Jul 25 09:12:48 2011 (r224307) @@ -585,15 +585,6 @@ panic(const char *fmt, ...) kdb_backtrace(); if (debugger_on_panic) kdb_enter(KDB_WHY_PANIC, "panic"); -#ifdef RESTARTABLE_PANICS - /* See if the user aborted the panic, in which case we continue. */ - if (panicstr == NULL) { -#ifdef SMP - atomic_store_rel_int(&panic_cpu, NOCPU); -#endif - return; - } -#endif #endif /*thread_lock(td); */ td->td_flags |= TDF_INPANIC; Modified: head/sys/netgraph/ng_ether.c ============================================================================== --- head/sys/netgraph/ng_ether.c Mon Jul 25 07:45:22 2011 (r224306) +++ head/sys/netgraph/ng_ether.c Mon Jul 25 09:12:48 2011 (r224307) @@ -604,9 +604,6 @@ ng_ether_rcvdata(hook_p hook, item_p ite NG_FREE_ITEM(item); panic("%s: weird hook", __func__); -#ifdef RESTARTABLE_PANICS /* so we don't get an error msg in LINT */ - return (0); -#endif } /* Modified: head/sys/netgraph/ng_mppc.c ============================================================================== --- head/sys/netgraph/ng_mppc.c Mon Jul 25 07:45:22 2011 (r224306) +++ head/sys/netgraph/ng_mppc.c Mon Jul 25 09:12:48 2011 (r224307) @@ -404,9 +404,6 @@ ng_mppc_rcvdata(hook_p hook, item_p item /* Oops */ panic("%s: unknown hook", __func__); -#ifdef RESTARTABLE_PANICS - return (EINVAL); -#endif } /* Modified: head/sys/netgraph/ng_parse.c ============================================================================== --- head/sys/netgraph/ng_parse.c Mon Jul 25 07:45:22 2011 (r224306) +++ head/sys/netgraph/ng_parse.c Mon Jul 25 09:12:48 2011 (r224307) @@ -374,9 +374,6 @@ ng_int8_unparse(const struct ng_parse_ty break; default: panic("%s: unknown type", __func__); -#ifdef RESTARTABLE_PANICS - return(0); -#endif } if ((error = ng_parse_append(&cbuf, &cbuflen, fmt, fval)) != 0) return (error); @@ -473,9 +470,6 @@ ng_int16_unparse(const struct ng_parse_t break; default: panic("%s: unknown type", __func__); -#ifdef RESTARTABLE_PANICS - return(0); -#endif } if ((error = ng_parse_append(&cbuf, &cbuflen, fmt, fval)) != 0) return (error); @@ -575,9 +569,6 @@ ng_int32_unparse(const struct ng_parse_t break; default: panic("%s: unknown type", __func__); -#ifdef RESTARTABLE_PANICS - return(0); -#endif } if ((error = ng_parse_append(&cbuf, &cbuflen, fmt, fval)) != 0) return (error); @@ -673,9 +664,6 @@ ng_int64_unparse(const struct ng_parse_t break; default: panic("%s: unknown type", __func__); -#ifdef RESTARTABLE_PANICS - return(0); -#endif } if ((error = ng_parse_append(&cbuf, &cbuflen, fmt, fval)) != 0) return (error); Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Mon Jul 25 07:45:22 2011 (r224306) +++ head/sys/sys/systm.h Mon Jul 25 09:12:48 2011 (r224307) @@ -160,11 +160,7 @@ void *hashinit_flags(int count, struct m void *phashinit(int count, struct malloc_type *type, u_long *nentries); void g_waitidle(void); -#ifdef RESTARTABLE_PANICS -void panic(const char *, ...) __printflike(1, 2); -#else void panic(const char *, ...) __dead2 __printflike(1, 2); -#endif void cpu_boot(int); void cpu_flush_dcache(void *, size_t); From owner-svn-src-head@FreeBSD.ORG Mon Jul 25 18:51:57 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B5C41065675; Mon, 25 Jul 2011 18:51:57 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id B27178FC12; Mon, 25 Jul 2011 18:51:56 +0000 (UTC) Received: from deuterium.andreas.nets (dhclient-91-190-8-131.flashcable.ch [91.190.8.131]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id p6PIeino001810; Mon, 25 Jul 2011 20:40:45 +0200 (CEST) (envelope-from andreast@FreeBSD.org) Message-ID: <4E2DB8AC.3000703@FreeBSD.org> Date: Mon, 25 Jul 2011 20:40:44 +0200 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: Nathan Whitehorn References: <201107191241.p6JCfvqw072816@svn.freebsd.org> <4E2C9012.602@freebsd.org> In-Reply-To: <4E2C9012.602@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: Attilio Rao , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, FreeBSD Release Engineering Team Subject: Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2011 18:51:57 -0000 On 24.07.11 23:35, Nathan Whitehorn wrote: > On 07/19/11 07:41, Attilio Rao wrote: >> Author: attilio >> Date: Tue Jul 19 12:41:57 2011 >> New Revision: 224216 >> URL: http://svn.freebsd.org/changeset/base/224216 >> >> Log: >> On 64 bit architectures size_t is 8 bytes, thus it should use an 8 bytes >> storage. >> Fix the sintrcnt/sintrnames specification. >> >> No MFC is previewed for this patch. >> > > These also need to be .long on 32-bit PowerPC, otherwise this change > triggers kernel panics and faults in sysctl. Please change it as quickly > as possible. Like the below? I'll test and I could commit if ok. (Build and approval) Gruss, Andreas Index: locore32.S =================================================================== --- locore32.S (revision 224326) +++ locore32.S (working copy) @@ -91,13 +91,13 @@ GLOBAL(intrnames) .space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 GLOBAL(sintrnames) - .word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 + .long INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 .align 4 GLOBAL(intrcnt) .space INTRCNT_COUNT * 4 * 2 GLOBAL(sintrcnt) - .word INTRCNT_COUNT * 4 * 2 + .long INTRCNT_COUNT * 4 * 2 .text .globl btext From owner-svn-src-head@FreeBSD.ORG Mon Jul 25 18:58:09 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21C28106566B; Mon, 25 Jul 2011 18:58:09 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id BCC018FC17; Mon, 25 Jul 2011 18:58:08 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id F215E58135; Mon, 25 Jul 2011 13:58:07 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id sZ59Z806qkv3; Mon, 25 Jul 2011 13:58:07 -0500 (CDT) Received: from wanderer.tachypleus.net (i3-dhcp-172-16-223-128.icecube.wisc.edu [172.16.223.128]) by mail.icecube.wisc.edu (Postfix) with ESMTP id D26285811D; Mon, 25 Jul 2011 13:58:07 -0500 (CDT) Message-ID: <4E2DBCBF.2030402@freebsd.org> Date: Mon, 25 Jul 2011 13:58:07 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.18) Gecko/20110624 Thunderbird/3.1.11 MIME-Version: 1.0 To: Andreas Tobler References: <201107191241.p6JCfvqw072816@svn.freebsd.org> <4E2C9012.602@freebsd.org> <4E2DB8AC.3000703@FreeBSD.org> In-Reply-To: <4E2DB8AC.3000703@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Attilio Rao , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, FreeBSD Release Engineering Team Subject: Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2011 18:58:09 -0000 On 07/25/11 13:40, Andreas Tobler wrote: > On 24.07.11 23:35, Nathan Whitehorn wrote: >> On 07/19/11 07:41, Attilio Rao wrote: >>> Author: attilio >>> Date: Tue Jul 19 12:41:57 2011 >>> New Revision: 224216 >>> URL: http://svn.freebsd.org/changeset/base/224216 >>> >>> Log: >>> On 64 bit architectures size_t is 8 bytes, thus it should use an 8 bytes >>> storage. >>> Fix the sintrcnt/sintrnames specification. >>> >>> No MFC is previewed for this patch. >>> >> >> These also need to be .long on 32-bit PowerPC, otherwise this change >> triggers kernel panics and faults in sysctl. Please change it as quickly >> as possible. > > Like the below? > > I'll test and I could commit if ok. (Build and approval) > > Gruss, > Andreas > > Index: locore32.S > =================================================================== > --- locore32.S (revision 224326) > +++ locore32.S (working copy) > @@ -91,13 +91,13 @@ > GLOBAL(intrnames) > .space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 > GLOBAL(sintrnames) > - .word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 > + .long INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 > > .align 4 > GLOBAL(intrcnt) > .space INTRCNT_COUNT * 4 * 2 > GLOBAL(sintrcnt) > - .word INTRCNT_COUNT * 4 * 2 > + .long INTRCNT_COUNT * 4 * 2 > > .text > .globl btext Exactly like that. -Nathan From owner-svn-src-head@FreeBSD.ORG Mon Jul 25 19:29:16 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 292EF106564A; Mon, 25 Jul 2011 19:29:16 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7815D8FC22; Mon, 25 Jul 2011 19:29:15 +0000 (UTC) Received: by gwb15 with SMTP id 15so3399003gwb.13 for ; Mon, 25 Jul 2011 12:29:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=P/p+1Hnu7obJmzr0VAbTWU5AMKNRcjeJFJUssc5EaHc=; b=k8RqDuTMVcB41AF2+9K4GgW/8NrqsYtUAEELei1GZSnufSj0FIMFXQJWrNC3NKazbl rl3maj5xeSOdt5yTAm0mz77E1BoOaD9YDo54uGA9o41aD+oxy69zzxS/wjIq4SskHGMj PVi+IASHL2LTsMimGsyu6HAUebQmWFIaxvNAE= MIME-Version: 1.0 Received: by 10.236.9.100 with SMTP id 64mr6452817yhs.339.1311622154832; Mon, 25 Jul 2011 12:29:14 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.108.129 with HTTP; Mon, 25 Jul 2011 12:29:14 -0700 (PDT) In-Reply-To: <4E2DBCBF.2030402@freebsd.org> References: <201107191241.p6JCfvqw072816@svn.freebsd.org> <4E2C9012.602@freebsd.org> <4E2DB8AC.3000703@FreeBSD.org> <4E2DBCBF.2030402@freebsd.org> Date: Mon, 25 Jul 2011 21:29:14 +0200 X-Google-Sender-Auth: GhDILY6GDjb4uWHlMs1jaQ9Vra8 Message-ID: From: Attilio Rao To: Nathan Whitehorn Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, FreeBSD Release Engineering Team , Andreas Tobler Subject: Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2011 19:29:16 -0000 Guys, I'm a bit out of that for a couple of days, flying to another continent, I'm not entirely sure the patch is right because I think we need an unified approach for specifying a 32-bits value, but you can check-in as a showstopper for the moment, I will make a better one in a couple of days. Attilio 2011/7/25 Nathan Whitehorn : > On 07/25/11 13:40, Andreas Tobler wrote: >> >> On 24.07.11 23:35, Nathan Whitehorn wrote: >>> >>> On 07/19/11 07:41, Attilio Rao wrote: >>>> >>>> Author: attilio >>>> Date: Tue Jul 19 12:41:57 2011 >>>> New Revision: 224216 >>>> URL: http://svn.freebsd.org/changeset/base/224216 >>>> >>>> Log: >>>> On 64 bit architectures size_t is 8 bytes, thus it should use an 8 bytes >>>> storage. >>>> Fix the sintrcnt/sintrnames specification. >>>> >>>> No MFC is previewed for this patch. >>>> >>> >>> These also need to be .long on 32-bit PowerPC, otherwise this change >>> triggers kernel panics and faults in sysctl. Please change it as quickly >>> as possible. >> >> Like the below? >> >> I'll test and I could commit if ok. (Build and approval) >> >> Gruss, >> Andreas >> >> Index: locore32.S >> =================================================================== >> --- locore32.S (revision 224326) >> +++ locore32.S (working copy) >> @@ -91,13 +91,13 @@ >> GLOBAL(intrnames) >> .space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 >> GLOBAL(sintrnames) >> - .word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 >> + .long INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 >> >> .align 4 >> GLOBAL(intrcnt) >> .space INTRCNT_COUNT * 4 * 2 >> GLOBAL(sintrcnt) >> - .word INTRCNT_COUNT * 4 * 2 >> + .long INTRCNT_COUNT * 4 * 2 >> >> .text >> .globl btext > > Exactly like that. > -Nathan > -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Mon Jul 25 20:10:01 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AEE8106566C; Mon, 25 Jul 2011 20:10:01 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AFAD8FC17; Mon, 25 Jul 2011 20:10: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 p6PKA1R4075193; Mon, 25 Jul 2011 20:10:01 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6PKA1ww075191; Mon, 25 Jul 2011 20:10:01 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201107252010.p6PKA1ww075191@svn.freebsd.org> From: Andreas Tobler Date: Mon, 25 Jul 2011 20:10:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224400 - head/sys/powerpc/aim X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2011 20:10:01 -0000 Author: andreast Date: Mon Jul 25 20:10:01 2011 New Revision: 224400 URL: http://svn.freebsd.org/changeset/base/224400 Log: This a follow up commit from r224216 for powerpc 32-bit. Increase the storage size for sintrcnt/sintrnames to .long. Reviewed by: nwhitehorn Approved by: re (kib) Modified: head/sys/powerpc/aim/locore32.S Modified: head/sys/powerpc/aim/locore32.S ============================================================================== --- head/sys/powerpc/aim/locore32.S Mon Jul 25 20:09:09 2011 (r224399) +++ head/sys/powerpc/aim/locore32.S Mon Jul 25 20:10:01 2011 (r224400) @@ -91,13 +91,13 @@ GLOBAL(esym) GLOBAL(intrnames) .space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 GLOBAL(sintrnames) - .word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 + .long INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 .align 4 GLOBAL(intrcnt) .space INTRCNT_COUNT * 4 * 2 GLOBAL(sintrcnt) - .word INTRCNT_COUNT * 4 * 2 + .long INTRCNT_COUNT * 4 * 2 .text .globl btext From owner-svn-src-head@FreeBSD.ORG Mon Jul 25 21:52:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18A6F106566C; Mon, 25 Jul 2011 21:52:18 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 088AB8FC08; Mon, 25 Jul 2011 21:52: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 p6PLqHpv078644; Mon, 25 Jul 2011 21:52:17 GMT (envelope-from rodrigc@svn.freebsd.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6PLqHjX078642; Mon, 25 Jul 2011 21:52:17 GMT (envelope-from rodrigc@svn.freebsd.org) Message-Id: <201107252152.p6PLqHjX078642@svn.freebsd.org> From: Craig Rodrigues Date: Mon, 25 Jul 2011 21:52:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224408 - head/sys/boot/forth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2011 21:52:18 -0000 Author: rodrigc Date: Mon Jul 25 21:52:17 2011 New Revision: 224408 URL: http://svn.freebsd.org/changeset/base/224408 Log: Document the tftp.blksize variable added in src/lib/libstand/tftp.c. Approved by: re (kib) Requested by: maxim Modified: head/sys/boot/forth/loader.conf Modified: head/sys/boot/forth/loader.conf ============================================================================== --- head/sys/boot/forth/loader.conf Mon Jul 25 21:47:56 2011 (r224407) +++ head/sys/boot/forth/loader.conf Mon Jul 25 21:52:17 2011 (r224408) @@ -55,6 +55,11 @@ module_path="/boot/modules" # Set the mo #prompt="\\${interpret}" # Set the command prompt #root_disk_unit="0" # Force the root disk unit number #rootdev="disk1s1a" # Set the root filesystem +#tftp.blksize="1428" # Set the RFC 2348 TFTP block size. + # If the TFTP server does not support RFC 2348, + # the block size is set to 512. If the value + # is out of range ( < 8 || > 9008 ) an error is + # returned. ############################################################## From owner-svn-src-head@FreeBSD.ORG Mon Jul 25 22:32:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBE42106566B; Mon, 25 Jul 2011 22:32:24 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 88D568FC0C; Mon, 25 Jul 2011 22:32:24 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 5231D35931A; Tue, 26 Jul 2011 00:32:23 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 3B7E117399; Tue, 26 Jul 2011 00:32:23 +0200 (CEST) Date: Tue, 26 Jul 2011 00:32:23 +0200 From: Jilles Tjoelker To: Kirk McKusick Message-ID: <20110725223223.GA29846@stack.nl> References: <201107241827.p6OIR9Tj019524@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201107241827.p6OIR9Tj019524@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224294 - in head: sbin/mount sys/kern sys/sys sys/ufs/ffs sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2011 22:32:25 -0000 On Sun, Jul 24, 2011 at 06:27:09PM +0000, Kirk McKusick wrote: > Author: mckusick > Date: Sun Jul 24 18:27:09 2011 > New Revision: 224294 > URL: http://svn.freebsd.org/changeset/base/224294 > Log: > Move the MNTK_SUJ flag in mnt_kern_flag to MNT_SUJ in mnt_flag > so that it is visible to userland programs. This change enables > the `mount' command with no arguments to be able to show if a > filesystem is mounted using journaled soft updates as opposed > to just normal soft updates. > Approved by: re (bz) [snip] > Modified: head/sbin/mount/mount.c > ============================================================================== > --- head/sbin/mount/mount.c Sun Jul 24 18:16:14 2011 (r224293) > +++ head/sbin/mount/mount.c Sun Jul 24 18:27:09 2011 (r224294) [snip good change] > @@ -316,7 +317,7 @@ main(int argc, char *argv[]) > rval = 0; > switch (argc) { > case 0: > - if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) > + if ((mntsize = getmntinfo(&mntbuf, MNT_WAIT)) == 0) > err(1, "getmntinfo"); > if (all) { > while ((fs = getfsent()) != NULL) { > @@ -665,7 +666,7 @@ getmntpt(const char *name) > struct statfs *mntbuf; > int i, mntsize; > > - mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); > + mntsize = getmntinfo(&mntbuf, MNT_WAIT); > for (i = mntsize - 1; i >= 0; i--) { > if (strcmp(mntbuf[i].f_mntfromname, name) == 0 || > strcmp(mntbuf[i].f_mntonname, name) == 0) These two hunks make it impossible (or at least very hard) to do 'mount', 'mount -p' or 'mount -u ' while there is a non-responsive NFS filesystem. The effect of the lines appears to be avoiding both "soft-updates" and "journaled soft-updates" texts in mount output. This is because the code in kern_getfsstat() in sys/kern/vfs_syscalls.c copies mp->mnt_flag and subsequently calls VFS_STATFS in the MNT_WAIT case: % /* % * Set these in case the underlying filesystem % * fails to do so. % */ % sp->f_version = STATFS_VERSION; % sp->f_namemax = NAME_MAX; % sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; followed by code that will call VFS_STATFS(mp, sp) in the MNT_WAIT case. Only in the latter case is MNT_SOFTDEP turned off if MNT_SUJ is on. I don't think kern_getfsstat() should know about MNT_SOFTDEP and MNT_SUJ, which would suggest giving up on preventing MNT_SOFTDEP-with-MNT_SUJ in userland. However, what I care about is mount(8) working while there are unrelated hung filesystems. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Tue Jul 26 04:00:01 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0EC4106564A; Tue, 26 Jul 2011 04:00:00 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF4968FC17; Tue, 26 Jul 2011 04:00: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 p6Q400MY090282; Tue, 26 Jul 2011 04:00:00 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6Q400QC090279; Tue, 26 Jul 2011 04:00:00 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201107260400.p6Q400QC090279@svn.freebsd.org> From: Ken Smith Date: Tue, 26 Jul 2011 04:00:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224413 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2011 04:00:01 -0000 Author: kensmith Date: Tue Jul 26 04:00:00 2011 New Revision: 224413 URL: http://svn.freebsd.org/changeset/base/224413 Log: Looks like we're ready for 9.0-BETA1 builds. Approved by: re (implicit) Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Tue Jul 26 01:06:44 2011 (r224412) +++ head/sys/conf/newvers.sh Tue Jul 26 04:00:00 2011 (r224413) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.0" -BRANCH="CURRENT" +BRANCH="BETA1" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-head@FreeBSD.ORG Tue Jul 26 09:59:05 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18A5F106566C; Tue, 26 Jul 2011 09:59:05 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from mp2.macomnet.net (ipv6.irc.int.ru [IPv6:2a02:28:1:2::1b:2]) by mx1.freebsd.org (Postfix) with ESMTP id 7B95A8FC0C; Tue, 26 Jul 2011 09:59:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mp2.macomnet.net (8.14.4/8.14.3) with ESMTP id p6Q9x2kO032944; Tue, 26 Jul 2011 13:59:02 +0400 (MSD) (envelope-from maxim.konovalov@gmail.com) Date: Tue, 26 Jul 2011 13:59:02 +0400 (MSD) From: Maxim Konovalov To: Craig Rodrigues In-Reply-To: <201107252152.p6PLqHjX078642@svn.freebsd.org> Message-ID: References: <201107252152.p6PLqHjX078642@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r224408 - head/sys/boot/forth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2011 09:59:05 -0000 On Mon, 25 Jul 2011, 21:52-0000, Craig Rodrigues wrote: > Author: rodrigc > Date: Mon Jul 25 21:52:17 2011 > New Revision: 224408 > URL: http://svn.freebsd.org/changeset/base/224408 > > Log: > Document the tftp.blksize variable added in src/lib/libstand/tftp.c. > thanks! -- Maxim Konovalov From owner-svn-src-head@FreeBSD.ORG Tue Jul 26 13:41:53 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C5A0106566B; Tue, 26 Jul 2011 13:41:53 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from ixe-mta-27.emailfiltering.com (ixe-mta-27-tx.emailfiltering.com [194.116.199.158]) by mx1.freebsd.org (Postfix) with ESMTP id 5F47A8FC15; Tue, 26 Jul 2011 13:41:52 +0000 (UTC) Received: from mail-gw11.york.ac.uk ([144.32.129.150]) by ixe-mta-27.emailfiltering.com with emfmta (version 4.8.2.32) by TLS id 1203548846 for adrian@FreeBSD.org; e1b884cc25bd50d1; Tue, 26 Jul 2011 14:31:01 +0100 Received: from buffy-128.york.ac.uk ([144.32.128.160]:31623 helo=buffy.york.ac.uk) by mail-gw11.york.ac.uk with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Qlhiu-0001Zj-HN; Tue, 26 Jul 2011 14:31:00 +0100 Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.4/8.14.4) with ESMTP id p6QDV0VL034342; Tue, 26 Jul 2011 14:31:00 +0100 (BST) (envelope-from gavin@FreeBSD.org) Received: (from ga9@localhost) by buffy.york.ac.uk (8.14.4/8.14.4/Submit) id p6QDUxB9034341; Tue, 26 Jul 2011 14:30:59 +0100 (BST) (envelope-from gavin@FreeBSD.org) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson To: Adrian Chadd In-Reply-To: <201107220939.p6M9dnsR008517@svn.freebsd.org> References: <201107220939.p6M9dnsR008517@svn.freebsd.org> Content-Type: text/plain; charset="ASCII" Content-Transfer-Encoding: quoted-printable Date: Tue, 26 Jul 2011 14:30:58 +0100 Message-ID: <1311687058.3848.44.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224267 - head/sys/dev/ath/ath_dfs/null X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2011 13:41:53 -0000 On Fri, 2011-07-22 at 09:39 +0000, Adrian Chadd wrote: > Author: adrian > Date: Fri Jul 22 09:39:49 2011 > New Revision: 224267 > URL: http://svn.freebsd.org/changeset/base/224267 >=20 > Log: > Implement a basic radar parameter API in the dfs_null module. > =20 > Since no actual radar data is ever handled, this won't > do anything. It's mostly here as a reference for those who > wish to experiment with radar detection. >=20 > Modified: > head/sys/dev/ath/ath_dfs/null/dfs_null.c [...] > + indata =3D malloc(insize, M_TEMP, M_NOWAIT); > + if (indata =3D=3D NULL) { > + error =3D ENOMEM; > + goto bad; Here you return positive errors to indicate a failure... > + case DFS_SET_THRESH: > + if (insize < sizeof(HAL_PHYERR_PARAM)) { > + error =3D -EINVAL; > + break; > + } [...] > + default: > + error =3D -EINVAL; > + } [...] > + if (outdata && copyout(outdata, ad->ad_out_data, ad->ad_out_size)) > + error =3D -EFAULT; And for these, you return negative error values. Is this inconsistency intentional? Thanks, Gavin From owner-svn-src-head@FreeBSD.ORG Wed Jul 27 06:24:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01A04106564A; Wed, 27 Jul 2011 06:24:24 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 609388FC0C; Wed, 27 Jul 2011 06:24:23 +0000 (UTC) Received: by yxl31 with SMTP id 31so650356yxl.13 for ; Tue, 26 Jul 2011 23:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=TvkPTOAL5xfuAtC1TfF/6/g4vxKkBNRHdUuW+yY0Q+k=; b=K6EfmJbn1jilcGIcSr8lVsfWD7m+mD/FcOi7iaaxDfER0kRq68opsw1I+nLZOle8ZT RoEVF27DukWLBqUxg2uZqbKZKW1PtIPxdho6sGlwgfs+UVp31iwCtZkSeTOL0x/0yF5S kWet7YSSDDsb6WerqxvKLDCW6cRMhHgVKHK7c= MIME-Version: 1.0 Received: by 10.150.179.18 with SMTP id b18mr6256843ybf.130.1311747862275; Tue, 26 Jul 2011 23:24:22 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.150.200.3 with HTTP; Tue, 26 Jul 2011 23:24:21 -0700 (PDT) In-Reply-To: <201107210920.09604.jhb@freebsd.org> References: <201107191300.p6JD0UU7073447@svn.freebsd.org> <201107210920.09604.jhb@freebsd.org> Date: Wed, 27 Jul 2011 10:24:21 +0400 X-Google-Sender-Auth: 361zTEAcNqPB-kFnZqFPux-2rVI Message-ID: From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, Attilio Rao , Robert Watson , Pan Tsu , svn-src-head@freebsd.org, Sean Bruno Subject: Re: svn commit: r224217 - in head/sys: amd64/include ia64/include mips/conf sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2011 06:24:24 -0000 On 21 July 2011 17:20, John Baldwin wrote: > On Thursday, July 21, 2011 8:37:26 am Sergey Kandaurov wrote: >> On 21 July 2011 14:14, Attilio Rao wrote: >> > 2011/7/20 Pan Tsu : >> >> Attilio Rao writes: >> >> >> >>> Author: attilio >> >>> Date: Tue Jul 19 13:00:30 2011 >> >>> New Revision: 224217 >> >>> URL: http://svn.freebsd.org/changeset/base/224217 >> >>> >> >>> Log: >> >>> =A0 Bump MAXCPU for amd64, ia64 and XLP mips appropriately. >> >>> =A0 From now on, default values for FreeBSD will be 64 maxiumum supp= orted >> >>> =A0 CPUs on amd64 and ia64 and 128 for XLP. All the other architectu= res >> >>> =A0 seem already capped appropriately (with the exception of sparc64= which >> >>> =A0 needs further support on jalapeno flavour). >> >>> >> >>> =A0 Bump __FreeBSD_version in order to reflect KBI/KPI brekage intro= duced >> >>> =A0 during the infrastructure cleanup for supporting MAXCPU > 32. Th= is >> >>> =A0 covers cpumask_t retiral too. >> >>> >> >>> =A0 The switch is considered completed at the present time, so for > whatever >> >>> =A0 bug you may experience that is reconducible to that area, please > report >> >>> =A0 immediately. >> >>> >> >>> =A0 Requested by: =A0 =A0 =A0 marcel, jchandra >> >>> =A0 Tested by: =A0pluknet, sbruno >> >>> =A0 Approved by: =A0 =A0 =A0 =A0re (kib) >> >>> >> >>> Modified: >> >>> =A0 head/sys/amd64/include/param.h >> >>> =A0 head/sys/ia64/include/param.h >> >>> =A0 head/sys/mips/conf/XLP >> >>> =A0 head/sys/mips/conf/XLP64 >> >>> =A0 head/sys/mips/conf/XLPN32 >> >>> =A0 head/sys/sys/param.h >> >>> >> >>> Modified: head/sys/amd64/include/param.h >> >>> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> >>> --- head/sys/amd64/include/param.h =A0 =A0Tue Jul 19 12:41:57 2011 > =A0(r224216) >> >>> +++ head/sys/amd64/include/param.h =A0 =A0Tue Jul 19 13:00:30 2011 > =A0(r224217) >> >>> @@ -65,7 +65,7 @@ >> >>> >> >>> =A0#if defined(SMP) || defined(KLD_MODULE) >> >>> =A0#ifndef MAXCPU >> >>> -#define MAXCPU =A0 =A0 =A0 =A0 =A0 =A0 =A0 32 >> >>> +#define MAXCPU =A0 =A0 =A0 =A0 =A0 =A0 =A0 64 >> >>> =A0#endif >> >>> =A0#else >> >>> =A0#define MAXCPU =A0 =A0 =A0 =A0 =A0 =A0 =A0 1 >> >> >> >> Do you plan to bump MEMSTAT_MAXCPU, too? >> >> >> >> =A0$ vmstat -z >> >> =A0vmstat: memstat_sysctl_uma: Too many CPUs >> >> =A0$ vmstat -m >> >> =A0vmstat: memstat_sysctl_malloc: Too many CPUs >> >> >> >> =A0$ sysctl kern. | grep smp.\*cpus >> >> =A0kern.smp.maxcpus: 64 >> >> =A0kern.smp.cpus: 2 >> >> >> > >> > Jeeeez, we seriously need to fix this getting rid of the static values= . >> > >> > Anyway, can you try the following patch?: >> > http://www.freebsd.org/~attilio/memstat_maxcpu.diff >> > >> > It is going to add some memory overhead for i386 case. >> > >> >> Something like this should work (vmstat -z, vmstat -m both work). >> It gets rid of MEMSTAT_MAXCPU at the expense of malloc() at runtime. >> http://plukky.net/~pluknet/patches/libmemstat_nomaxcpu.diff >> >> Probably it should work with maxid, instead of maxcpu to save some memor= y. >> Though, using maxcpu is more safe. > > Actually, I would prefer that it use mp_maxid as that is the general vari= able > things should use. =A0mp_maxcpus is a concession for the few places that = may > need to know the MAXCPUS value (e.g. if using libkvm to access a structur= e in > a crashdump or live kernel that has a member array with MAXCPU elements). > Code that just wants to allocate memory to hold per-CPU data should use > mp_maxid whenever possible. > Hi, I changed the patch to use mp_maxid wherever possible. http://plukky.net/~pluknet/patches/libmemstat_nomaxcpu.2.diff To summarize: 1) malloc stats kern.malloc_stats uses internally MAXCPU, and we have to query MAXCPU from kernel, too. See kern/kern_malloc.c:sysctl_kern_malloc_stats(): 849 mtsh.mtsh_maxcpus =3D MAXCPU; 1a) memstat_sysctl_malloc() left unchanged, sysctl kern.smp.maxcpus 1b) memstat_kvm_malloc() left unchanged, _mp_maxcpus symbol 2) uma stats vm.zone_stats uses (mp_maxid + 1), vm/uma_core.c:sysctl_vm_zone_stats(): 3247 ush.ush_maxcpus =3D (mp_maxid + 1); 2a) memstat_sysctl_uma() Switched to query sysctl kern.smp.maxid 2b) memstat_kvm_uma() left unchanged, _mp_maxid symbol So, there's only one change in memstat_sysctl_uma(). A bad side of things is that libmemstat() now knows these vm_zone and malloc_stats internals. As Robert suggested me on IRC to query maxcpu value from uma_stream_header and malloc_type_stream_header structures respectively to be independent from kernel details. --=20 wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Wed Jul 27 12:50:34 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36D021065670; Wed, 27 Jul 2011 12:50:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 08A7A8FC17; Wed, 27 Jul 2011 12:50:34 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id AF1C146B62; Wed, 27 Jul 2011 08:50:33 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 2F5338A037; Wed, 27 Jul 2011 08:50:33 -0400 (EDT) From: John Baldwin To: Sergey Kandaurov Date: Wed, 27 Jul 2011 08:45:39 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110617; KDE/4.5.5; amd64; ; ) References: <201107191300.p6JD0UU7073447@svn.freebsd.org> <201107210920.09604.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201107270845.39419.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Wed, 27 Jul 2011 08:50:33 -0400 (EDT) Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, Attilio Rao , Robert Watson , Pan Tsu , svn-src-head@freebsd.org, Sean Bruno Subject: Re: svn commit: r224217 - in head/sys: amd64/include ia64/include mips/conf sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2011 12:50:34 -0000 On Wednesday, July 27, 2011 2:24:21 am Sergey Kandaurov wrote: > On 21 July 2011 17:20, John Baldwin wrote: > > On Thursday, July 21, 2011 8:37:26 am Sergey Kandaurov wrote: > >> On 21 July 2011 14:14, Attilio Rao wrote: > >> > 2011/7/20 Pan Tsu : > >> >> Attilio Rao writes: > >> >> > >> >>> Author: attilio > >> >>> Date: Tue Jul 19 13:00:30 2011 > >> >>> New Revision: 224217 > >> >>> URL: http://svn.freebsd.org/changeset/base/224217 > >> >>> > >> >>> Log: > >> >>> Bump MAXCPU for amd64, ia64 and XLP mips appropriately. > >> >>> From now on, default values for FreeBSD will be 64 maxiumum supported > >> >>> CPUs on amd64 and ia64 and 128 for XLP. All the other architectures > >> >>> seem already capped appropriately (with the exception of sparc64 which > >> >>> needs further support on jalapeno flavour). > >> >>> > >> >>> Bump __FreeBSD_version in order to reflect KBI/KPI brekage introduced > >> >>> during the infrastructure cleanup for supporting MAXCPU > 32. This > >> >>> covers cpumask_t retiral too. > >> >>> > >> >>> The switch is considered completed at the present time, so for > > whatever > >> >>> bug you may experience that is reconducible to that area, please > > report > >> >>> immediately. > >> >>> > >> >>> Requested by: marcel, jchandra > >> >>> Tested by: pluknet, sbruno > >> >>> Approved by: re (kib) > >> >>> > >> >>> Modified: > >> >>> head/sys/amd64/include/param.h > >> >>> head/sys/ia64/include/param.h > >> >>> head/sys/mips/conf/XLP > >> >>> head/sys/mips/conf/XLP64 > >> >>> head/sys/mips/conf/XLPN32 > >> >>> head/sys/sys/param.h > >> >>> > >> >>> Modified: head/sys/amd64/include/param.h > >> >>> > > ============================================================================== > >> >>> --- head/sys/amd64/include/param.h Tue Jul 19 12:41:57 2011 > > (r224216) > >> >>> +++ head/sys/amd64/include/param.h Tue Jul 19 13:00:30 2011 > > (r224217) > >> >>> @@ -65,7 +65,7 @@ > >> >>> > >> >>> #if defined(SMP) || defined(KLD_MODULE) > >> >>> #ifndef MAXCPU > >> >>> -#define MAXCPU 32 > >> >>> +#define MAXCPU 64 > >> >>> #endif > >> >>> #else > >> >>> #define MAXCPU 1 > >> >> > >> >> Do you plan to bump MEMSTAT_MAXCPU, too? > >> >> > >> >> $ vmstat -z > >> >> vmstat: memstat_sysctl_uma: Too many CPUs > >> >> $ vmstat -m > >> >> vmstat: memstat_sysctl_malloc: Too many CPUs > >> >> > >> >> $ sysctl kern. | grep smp.\*cpus > >> >> kern.smp.maxcpus: 64 > >> >> kern.smp.cpus: 2 > >> >> > >> > > >> > Jeeeez, we seriously need to fix this getting rid of the static values. > >> > > >> > Anyway, can you try the following patch?: > >> > http://www.freebsd.org/~attilio/memstat_maxcpu.diff > >> > > >> > It is going to add some memory overhead for i386 case. > >> > > >> > >> Something like this should work (vmstat -z, vmstat -m both work). > >> It gets rid of MEMSTAT_MAXCPU at the expense of malloc() at runtime. > >> http://plukky.net/~pluknet/patches/libmemstat_nomaxcpu.diff > >> > >> Probably it should work with maxid, instead of maxcpu to save some memory. > >> Though, using maxcpu is more safe. > > > > Actually, I would prefer that it use mp_maxid as that is the general variable > > things should use. mp_maxcpus is a concession for the few places that may > > need to know the MAXCPUS value (e.g. if using libkvm to access a structure in > > a crashdump or live kernel that has a member array with MAXCPU elements). > > Code that just wants to allocate memory to hold per-CPU data should use > > mp_maxid whenever possible. > > > > Hi, > > I changed the patch to use mp_maxid wherever possible. > http://plukky.net/~pluknet/patches/libmemstat_nomaxcpu.2.diff > > To summarize: > > 1) malloc stats > kern.malloc_stats uses internally MAXCPU, and we have to query MAXCPU > from kernel, too. See kern/kern_malloc.c:sysctl_kern_malloc_stats(): > 849 mtsh.mtsh_maxcpus = MAXCPU; > > 1a) memstat_sysctl_malloc() > left unchanged, sysctl kern.smp.maxcpus > 1b) memstat_kvm_malloc() > left unchanged, _mp_maxcpus symbol > > 2) uma stats > vm.zone_stats uses (mp_maxid + 1), vm/uma_core.c:sysctl_vm_zone_stats(): > 3247 ush.ush_maxcpus = (mp_maxid + 1); > > 2a) memstat_sysctl_uma() > Switched to query sysctl kern.smp.maxid > 2b) memstat_kvm_uma() > left unchanged, _mp_maxid symbol > > So, there's only one change in memstat_sysctl_uma(). > A bad side of things is that libmemstat() now knows these vm_zone > and malloc_stats internals. > As Robert suggested me on IRC to query maxcpu value from > uma_stream_header and malloc_type_stream_header structures > respectively to be independent from kernel details. Looks good to me, thanks! -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Jul 27 14:41:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC2FD106566B; Wed, 27 Jul 2011 14:41:22 +0000 (UTC) (envelope-from adrian.chadd@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 541578FC0A; Wed, 27 Jul 2011 14:41:22 +0000 (UTC) Received: by gyf3 with SMTP id 3so1380897gyf.13 for ; Wed, 27 Jul 2011 07:41:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=FmxLelklfaDYaKNlYz+OjwUukO1OdCLquioCCh1IwyI=; b=NhmWhivhyKOy+S/X5fFHZ8KX5ppzHNRCv2nyUX/SjAosOGroFTmdSH1LMTMrHLtovm 6UezbPknz8Ds68AxDq0dox+ojME8uYA12pDZ/IJDUZ8Rfz367Wb7Ly3zqLzz3uXcroSK Y2yNx/2Pzx4yRm7orAQ2LUivz8CYQgLdJ3blA= MIME-Version: 1.0 Received: by 10.151.86.11 with SMTP id o11mr89365ybl.386.1311777681614; Wed, 27 Jul 2011 07:41:21 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.150.197.5 with HTTP; Wed, 27 Jul 2011 07:41:21 -0700 (PDT) In-Reply-To: <1311687058.3848.44.camel@buffy.york.ac.uk> References: <201107220939.p6M9dnsR008517@svn.freebsd.org> <1311687058.3848.44.camel@buffy.york.ac.uk> Date: Wed, 27 Jul 2011 22:41:21 +0800 X-Google-Sender-Auth: v0_Il4_iKJ2ails1_vLG8mYJb3M Message-ID: From: Adrian Chadd To: Gavin Atkinson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224267 - head/sys/dev/ath/ath_dfs/null X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2011 14:41:22 -0000 Hm, nope. I'll double-check this against the reference code and commit a fi= x. Thanks for picking it up! adrian On 26 July 2011 21:30, Gavin Atkinson wrote: > On Fri, 2011-07-22 at 09:39 +0000, Adrian Chadd wrote: >> Author: adrian >> Date: Fri Jul 22 09:39:49 2011 >> New Revision: 224267 >> URL: http://svn.freebsd.org/changeset/base/224267 >> >> Log: >> =A0 Implement a basic radar parameter API in the dfs_null module. >> >> =A0 Since no actual radar data is ever handled, this won't >> =A0 do anything. It's mostly here as a reference for those who >> =A0 wish to experiment with radar detection. >> >> Modified: >> =A0 head/sys/dev/ath/ath_dfs/null/dfs_null.c > > [...] > >> + =A0 =A0 =A0 =A0 =A0 =A0 indata =3D malloc(insize, M_TEMP, M_NOWAIT); >> + =A0 =A0 =A0 =A0 =A0 =A0 if (indata =3D=3D NULL) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D ENOMEM; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto bad; > > Here you return positive errors to indicate a failure... > >> + =A0 =A0 =A0 =A0 =A0 =A0 case DFS_SET_THRESH: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (insize < sizeof(HAL_PHYERR= _PARAM)) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D -EIN= VAL; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > [...] >> + =A0 =A0 =A0 =A0 =A0 =A0 default: >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D -EINVAL; >> + =A0 =A0 } > [...] >> + =A0 =A0 if (outdata && copyout(outdata, ad->ad_out_data, ad->ad_out_si= ze)) >> + =A0 =A0 =A0 =A0 =A0 =A0 error =3D -EFAULT; > > And for these, you return negative error values. =A0Is this inconsistency > intentional? > > Thanks, > > Gavin > From owner-svn-src-head@FreeBSD.ORG Wed Jul 27 14:43:25 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2551B106566B; Wed, 27 Jul 2011 14:43:25 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-yi0-f54.google.com (mail-yi0-f54.google.com [209.85.218.54]) by mx1.freebsd.org (Postfix) with ESMTP id B1A748FC0C; Wed, 27 Jul 2011 14:43:24 +0000 (UTC) Received: by yic13 with SMTP id 13so1388029yic.13 for ; Wed, 27 Jul 2011 07:43:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=zqWsDOoLkRCEyTZZAX6Zq+Pch3xRDvgz3hqyNi0hAK0=; b=TUDURWgKEglLNXZFtru+COe/XvVqVKUfE0Fgf7UhxhltyLcrAw63AesX5rVPeFFlQI pRKb0QZz+lZpMHWSArgMV8w4jSp/rANfuSaalUTCDkxiNiNM+aGRv5Fihy5lqjuTg9Ch tz7SHP+aAVIoCob/kdQq2AlLP6sEvDqmR5UbE= MIME-Version: 1.0 Received: by 10.151.86.11 with SMTP id o11mr91417ybl.386.1311777803719; Wed, 27 Jul 2011 07:43:23 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.150.197.5 with HTTP; Wed, 27 Jul 2011 07:43:23 -0700 (PDT) In-Reply-To: <1311687058.3848.44.camel@buffy.york.ac.uk> References: <201107220939.p6M9dnsR008517@svn.freebsd.org> <1311687058.3848.44.camel@buffy.york.ac.uk> Date: Wed, 27 Jul 2011 22:43:23 +0800 X-Google-Sender-Auth: 7I1apHERPof02EiF8a2dtbR6vNY Message-ID: From: Adrian Chadd To: Gavin Atkinson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224267 - head/sys/dev/ath/ath_dfs/null X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2011 14:43:25 -0000 On 26 July 2011 21:30, Gavin Atkinson wrote: [snip code] > And for these, you return negative error values. =A0Is this inconsistency > intentional? Nope; this somehow was incorrectly picked up from the reference code. I wonder if it's due to Linuxisms there.. Thanks, Adrian From owner-svn-src-head@FreeBSD.ORG Wed Jul 27 17:19:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACA1E1065672; Wed, 27 Jul 2011 17:19:05 +0000 (UTC) (envelope-from seanbru@yahoo-inc.com) Received: from mrout2.yahoo.com (mrout2.yahoo.com [216.145.54.172]) by mx1.freebsd.org (Postfix) with ESMTP id 8900C8FC14; Wed, 27 Jul 2011 17:19:05 +0000 (UTC) Received: from [127.0.0.1] (cheese.corp.yahoo.com [216.145.50.99]) by mrout2.yahoo.com (8.14.4/8.14.4/y.out) with ESMTP id p6RH8EIt007926; Wed, 27 Jul 2011 10:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yahoo-inc.com; s=cobra; t=1311786494; bh=7k9rjDsUHxBRzWrHRpYqZPvOX4hsL9QmSJRa9bVb+zA=; h=Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date: Message-ID:Mime-Version:Content-Transfer-Encoding; b=fxe1d0Hp4mFZEr4DvqXrWTjd4kapsxniq7bmEx0F6VVW/SG0v1Bd9LEGKKLkF4Cns Bz5CETPTykFKRAc2/I1ee8bB2M8xzhk0O8EYDXVGvBAooTCvtHUR7KEeFijixmWHo5 G+WuYdHzmbo8Ywen/0z1V52Jiv7lqtDKS5rdt01U= From: Sean Bruno To: John Baldwin In-Reply-To: <201107270845.39419.jhb@freebsd.org> References: <201107191300.p6JD0UU7073447@svn.freebsd.org> <201107210920.09604.jhb@freebsd.org> <201107270845.39419.jhb@freebsd.org> Content-Type: text/plain; charset="UTF-8" Date: Wed, 27 Jul 2011 10:08:14 -0700 Message-ID: <1311786494.2592.5.camel@hitfishpass-lx.corp.yahoo.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 (2.32.2-1.fc14) Content-Transfer-Encoding: 7bit Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , Attilio Rao , Sergey Kandaurov , Robert Watson , Pan Tsu , "svn-src-head@freebsd.org" Subject: Re: svn commit: r224217 - in head/sys: amd64/include ia64/include mips/conf sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2011 17:19:05 -0000 On Wed, 2011-07-27 at 05:45 -0700, John Baldwin wrote: > On Wednesday, July 27, 2011 2:24:21 am Sergey Kandaurov wrote: > > On 21 July 2011 17:20, John Baldwin wrote: > > > On Thursday, July 21, 2011 8:37:26 am Sergey Kandaurov wrote: > > >> On 21 July 2011 14:14, Attilio Rao wrote: > > >> > 2011/7/20 Pan Tsu : > > >> >> Attilio Rao writes: > > >> >> > > >> >>> Author: attilio > > >> >>> Date: Tue Jul 19 13:00:30 2011 > > >> >>> New Revision: 224217 > > >> >>> URL: http://svn.freebsd.org/changeset/base/224217 > > >> >>> > > >> >>> Log: > > >> >>> Bump MAXCPU for amd64, ia64 and XLP mips appropriately. > > >> >>> From now on, default values for FreeBSD will be 64 maxiumum supported > > >> >>> CPUs on amd64 and ia64 and 128 for XLP. All the other architectures > > >> >>> seem already capped appropriately (with the exception of sparc64 which > > >> >>> needs further support on jalapeno flavour). > > >> >>> > > >> >>> Bump __FreeBSD_version in order to reflect KBI/KPI brekage introduced > > >> >>> during the infrastructure cleanup for supporting MAXCPU > 32. This > > >> >>> covers cpumask_t retiral too. > > >> >>> > > >> >>> The switch is considered completed at the present time, so for > > > whatever > > >> >>> bug you may experience that is reconducible to that area, please > > > report > > >> >>> immediately. > > >> >>> > > >> >>> Requested by: marcel, jchandra > > >> >>> Tested by: pluknet, sbruno > > >> >>> Approved by: re (kib) > > >> >>> > > >> >>> Modified: > > >> >>> head/sys/amd64/include/param.h > > >> >>> head/sys/ia64/include/param.h > > >> >>> head/sys/mips/conf/XLP > > >> >>> head/sys/mips/conf/XLP64 > > >> >>> head/sys/mips/conf/XLPN32 > > >> >>> head/sys/sys/param.h > > >> >>> > > >> >>> Modified: head/sys/amd64/include/param.h > > >> >>> > > > ============================================================================== > > >> >>> --- head/sys/amd64/include/param.h Tue Jul 19 12:41:57 2011 > > > (r224216) > > >> >>> +++ head/sys/amd64/include/param.h Tue Jul 19 13:00:30 2011 > > > (r224217) > > >> >>> @@ -65,7 +65,7 @@ > > >> >>> > > >> >>> #if defined(SMP) || defined(KLD_MODULE) > > >> >>> #ifndef MAXCPU > > >> >>> -#define MAXCPU 32 > > >> >>> +#define MAXCPU 64 > > >> >>> #endif > > >> >>> #else > > >> >>> #define MAXCPU 1 > > >> >> > > >> >> Do you plan to bump MEMSTAT_MAXCPU, too? > > >> >> > > >> >> $ vmstat -z > > >> >> vmstat: memstat_sysctl_uma: Too many CPUs > > >> >> $ vmstat -m > > >> >> vmstat: memstat_sysctl_malloc: Too many CPUs > > >> >> > > >> >> $ sysctl kern. | grep smp.\*cpus > > >> >> kern.smp.maxcpus: 64 > > >> >> kern.smp.cpus: 2 > > >> >> > > >> > > > >> > Jeeeez, we seriously need to fix this getting rid of the static values. > > >> > > > >> > Anyway, can you try the following patch?: > > >> > http://www.freebsd.org/~attilio/memstat_maxcpu.diff > > >> > > > >> > It is going to add some memory overhead for i386 case. > > >> > > > >> > > >> Something like this should work (vmstat -z, vmstat -m both work). > > >> It gets rid of MEMSTAT_MAXCPU at the expense of malloc() at runtime. > > >> http://plukky.net/~pluknet/patches/libmemstat_nomaxcpu.diff > > >> > > >> Probably it should work with maxid, instead of maxcpu to save some memory. > > >> Though, using maxcpu is more safe. > > > > > > Actually, I would prefer that it use mp_maxid as that is the general variable > > > things should use. mp_maxcpus is a concession for the few places that may > > > need to know the MAXCPUS value (e.g. if using libkvm to access a structure in > > > a crashdump or live kernel that has a member array with MAXCPU elements). > > > Code that just wants to allocate memory to hold per-CPU data should use > > > mp_maxid whenever possible. > > > > > > > Hi, > > > > I changed the patch to use mp_maxid wherever possible. > > http://plukky.net/~pluknet/patches/libmemstat_nomaxcpu.2.diff > > > > To summarize: > > > > 1) malloc stats > > kern.malloc_stats uses internally MAXCPU, and we have to query MAXCPU > > from kernel, too. See kern/kern_malloc.c:sysctl_kern_malloc_stats(): > > 849 mtsh.mtsh_maxcpus = MAXCPU; > > > > 1a) memstat_sysctl_malloc() > > left unchanged, sysctl kern.smp.maxcpus > > 1b) memstat_kvm_malloc() > > left unchanged, _mp_maxcpus symbol > > > > 2) uma stats > > vm.zone_stats uses (mp_maxid + 1), vm/uma_core.c:sysctl_vm_zone_stats(): > > 3247 ush.ush_maxcpus = (mp_maxid + 1); > > > > 2a) memstat_sysctl_uma() > > Switched to query sysctl kern.smp.maxid > > 2b) memstat_kvm_uma() > > left unchanged, _mp_maxid symbol > > > > So, there's only one change in memstat_sysctl_uma(). > > A bad side of things is that libmemstat() now knows these vm_zone > > and malloc_stats internals. > > As Robert suggested me on IRC to query maxcpu value from > > uma_stream_header and malloc_type_stream_header structures > > respectively to be independent from kernel details. > > Looks good to me, thanks! > Aye +1 here. I'll run this over to peter@ just to be sure though. I'm pretty sure that this will just work. I'll ask HP for their big machine again to validate. Sean From owner-svn-src-head@FreeBSD.ORG Wed Jul 27 17:30:39 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D498B106566B; Wed, 27 Jul 2011 17:30:39 +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 A9DBE8FC17; Wed, 27 Jul 2011 17:30:39 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 3081E46B2E; Wed, 27 Jul 2011 13:30:39 -0400 (EDT) Date: Wed, 27 Jul 2011 18:30:39 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Sean Bruno In-Reply-To: <1311786494.2592.5.camel@hitfishpass-lx.corp.yahoo.com> Message-ID: References: <201107191300.p6JD0UU7073447@svn.freebsd.org> <201107210920.09604.jhb@freebsd.org> <201107270845.39419.jhb@freebsd.org> <1311786494.2592.5.camel@hitfishpass-lx.corp.yahoo.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "src-committers@freebsd.org" , John Baldwin , "svn-src-all@freebsd.org" , Attilio Rao , Sergey Kandaurov , Pan Tsu , "svn-src-head@freebsd.org" Subject: Re: svn commit: r224217 - in head/sys: amd64/include ia64/include mips/conf sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2011 17:30:39 -0000 On Wed, 27 Jul 2011, Sean Bruno wrote: > Aye +1 here. I'll run this over to peter@ just to be sure though. I'm > pretty sure that this will just work. > > I'll ask HP for their big machine again to validate. As of (extremely recently) there's now an 80-core system in the Netperf cluster. I'm not sure that it's ready for production (which is to say, ready to be used in SMP scalability work) yet, but it's intended as a resource to help with these sorts of issues. This box was purchased by the FreeBSD Foundation and very helpful rates from iX Systems. Robert From owner-svn-src-head@FreeBSD.ORG Thu Jul 28 02:59:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BBA8106566B; Thu, 28 Jul 2011 02:59:33 +0000 (UTC) (envelope-from asmrookie@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 E9EE78FC08; Thu, 28 Jul 2011 02:59:32 +0000 (UTC) Received: by gyf3 with SMTP id 3so1942399gyf.13 for ; Wed, 27 Jul 2011 19:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=aAjfBZnqaueGj4T/eD9O8KM8z0RzFnZ1cJ/+bMUBzWI=; b=fGvpn4Wpa94HybPC2j5WxFzVZEYON5sb3+rXfzogN4fN0+DZken40CqKNvNu2kJY3x ZRIaHphL157aEWgmAgJx8FyYVWw6n+9Cva54VM9LG1NTL2wPfTGzVEExeJTXyRmNYsUH a98o6Ii4wSVduBrwZIuqDceYTzbozBDKdaMJQ= MIME-Version: 1.0 Received: by 10.236.175.35 with SMTP id y23mr345261yhl.495.1311821972006; Wed, 27 Jul 2011 19:59:32 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.108.129 with HTTP; Wed, 27 Jul 2011 19:59:31 -0700 (PDT) In-Reply-To: References: <201107191241.p6JCfvqw072816@svn.freebsd.org> <4E2C9012.602@freebsd.org> <4E2DB8AC.3000703@FreeBSD.org> <4E2DBCBF.2030402@freebsd.org> Date: Wed, 27 Jul 2011 22:59:31 -0400 X-Google-Sender-Auth: C5GCgNSijjRJyWnkavGYrtMAd5I Message-ID: From: Attilio Rao To: Nathan Whitehorn Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Sergey Kandaurov , Andreas Tobler Subject: Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2011 02:59:33 -0000 I think that the following patch may better reflect the definition of size_t: http://www.freebsd.org/~attilio/sintrcnt-fixup32.diff Do you think you can test it out? Thanks, Attilio 2011/7/25 Attilio Rao : > Guys, I'm a bit out of that for a couple of days, flying to another > continent, I'm not entirely sure the patch is right because I think we > need an unified approach for specifying a 32-bits value, but you can > check-in as a showstopper for the moment, I will make a better one in > a couple of days. > > Attilio > > 2011/7/25 Nathan Whitehorn : >> On 07/25/11 13:40, Andreas Tobler wrote: >>> >>> On 24.07.11 23:35, Nathan Whitehorn wrote: >>>> >>>> On 07/19/11 07:41, Attilio Rao wrote: >>>>> >>>>> Author: attilio >>>>> Date: Tue Jul 19 12:41:57 2011 >>>>> New Revision: 224216 >>>>> URL: http://svn.freebsd.org/changeset/base/224216 >>>>> >>>>> Log: >>>>> On 64 bit architectures size_t is 8 bytes, thus it should use an 8 bytes >>>>> storage. >>>>> Fix the sintrcnt/sintrnames specification. >>>>> >>>>> No MFC is previewed for this patch. >>>>> >>>> >>>> These also need to be .long on 32-bit PowerPC, otherwise this change >>>> triggers kernel panics and faults in sysctl. Please change it as quickly >>>> as possible. >>> >>> Like the below? >>> >>> I'll test and I could commit if ok. (Build and approval) >>> >>> Gruss, >>> Andreas >>> >>> Index: locore32.S >>> =================================================================== >>> --- locore32.S (revision 224326) >>> +++ locore32.S (working copy) >>> @@ -91,13 +91,13 @@ >>> GLOBAL(intrnames) >>> .space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 >>> GLOBAL(sintrnames) >>> - .word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 >>> + .long INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 >>> >>> .align 4 >>> GLOBAL(intrcnt) >>> .space INTRCNT_COUNT * 4 * 2 >>> GLOBAL(sintrcnt) >>> - .word INTRCNT_COUNT * 4 * 2 >>> + .long INTRCNT_COUNT * 4 * 2 >>> >>> .text >>> .globl btext >> >> Exactly like that. >> -Nathan >> > > > > -- > Peace can only be achieved by understanding - A. Einstein > -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Thu Jul 28 03:01:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A157106566B; Thu, 28 Jul 2011 03:01:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 889A78FC15; Thu, 28 Jul 2011 03:01:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6S31MCC082767; Thu, 28 Jul 2011 03:01:22 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6S31MlL082765; Thu, 28 Jul 2011 03:01:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201107280301.p6S31MlL082765@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 28 Jul 2011 03:01:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224470 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2011 03:01:22 -0000 Author: bz Date: Thu Jul 28 03:01:22 2011 New Revision: 224470 URL: http://svn.freebsd.org/changeset/base/224470 Log: To inet or not two inet. Unbreak static IPv4 configuration. If you tried you were stuck in an endless loop. Reported by: kensmith Approved by: re (kib) for BETA1 Pointy hat to: bz - wonder why I had not tested legacy IP thoroughly.. Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Wed Jul 27 22:54:40 2011 (r224469) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu Jul 28 03:01:22 2011 (r224470) @@ -78,7 +78,7 @@ echo $INTERFACE $IF_CONFIG | if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then . $BSDINSTALL_TMPETC/._rc.conf.net - ifconfig $INTERFACE inet `eval echo \\\$ifconfig_$INTERFACE` + ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE` route delete -inet default route add -inet default $defaultrouter fi From owner-svn-src-head@FreeBSD.ORG Thu Jul 28 03:04:02 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2B2D106564A; Thu, 28 Jul 2011 03:04:01 +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 A92018FC12; Thu, 28 Jul 2011 03:04:01 +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 C2E6325D389F; Thu, 28 Jul 2011 03:04:00 +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 17245BD3D17; Thu, 28 Jul 2011 03:04:00 +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 uqWMsPEH9Tn3; Thu, 28 Jul 2011 03:03:58 +0000 (UTC) Received: from [IPv6:::1] (shell.eq4-01.sbone.de [IPv6:fde9:577b:c1a9:3161::401:22]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id AB25FBD3C1C; Thu, 28 Jul 2011 03:03:48 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201107280301.p6S31MlL082765@svn.freebsd.org> Date: Thu, 28 Jul 2011 03:03:19 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201107280301.p6S31MlL082765@svn.freebsd.org> To: "Bjoern A. Zeeb" X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224470 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2011 03:04:02 -0000 On Jul 28, 2011, at 3:01 AM, Bjoern A. Zeeb wrote: Please not that HEAD is not open for other approved commits before BETA1 was publicly announced! So in case you have re@ approval already you must not yet commit! Sorry for the IPv4 problem, but it makes me wonder how many people are actually testing and using the new installer? /bz > Author: bz > Date: Thu Jul 28 03:01:22 2011 > New Revision: 224470 > URL: http://svn.freebsd.org/changeset/base/224470 >=20 > Log: > To inet or not two inet. Unbreak static IPv4 configuration. If you = tried > you were stuck in an endless loop. >=20 > Reported by: kensmith > Approved by: re (kib) for BETA1 > Pointy hat to: bz - wonder why I had not tested legacy IP = thoroughly.. >=20 > Modified: > head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 >=20 > Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Wed Jul 27 = 22:54:40 2011 (r224469) > +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu Jul 28 = 03:01:22 2011 (r224470) > @@ -78,7 +78,7 @@ echo $INTERFACE $IF_CONFIG |=20 >=20 > if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then > . $BSDINSTALL_TMPETC/._rc.conf.net > - ifconfig $INTERFACE inet `eval echo \\\$ifconfig_$INTERFACE` > + ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE` > route delete -inet default > route add -inet default $defaultrouter > fi --=20 Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-head@FreeBSD.ORG Thu Jul 28 11:41:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D099106564A; Thu, 28 Jul 2011 11:41:56 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E2B68FC0A; Thu, 28 Jul 2011 11:41: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 p6SBfu8M002115; Thu, 28 Jul 2011 11:41:56 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6SBfuZg002113; Thu, 28 Jul 2011 11:41:56 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201107281141.p6SBfuZg002113@svn.freebsd.org> From: Benedict Reuschling Date: Thu, 28 Jul 2011 11:41:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224475 - head/usr.sbin/jail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2011 11:41:56 -0000 Author: bcr (doc committer) Date: Thu Jul 28 11:41:55 2011 New Revision: 224475 URL: http://svn.freebsd.org/changeset/base/224475 Log: Add a section to the jail chapter that explains why it is not recommended to allow root users in the jail to access the host system. PR: docs/156853 Submitted by: crees Patch by: crees Approved by: re (kib) for BETA1 Modified: head/usr.sbin/jail/jail.8 Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Thu Jul 28 10:16:30 2011 (r224474) +++ head/usr.sbin/jail/jail.8 Thu Jul 28 11:41:55 2011 (r224475) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2011 +.Dd July 28, 2011 .Dt JAIL 8 .Os .Sh NAME @@ -914,3 +914,8 @@ directory that is moved out of the jail' access to the file space outside of the jail. It is recommended that directories always be copied, rather than moved, out of a jail. +.Pp +It is also not recommended that users allowed root in the jail be allowed +access to the host system. +For example, a root user in a jail can create a setuid root utility that +could be run in the host system to achieve elevated privileges. From owner-svn-src-head@FreeBSD.ORG Thu Jul 28 12:23:32 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E10C8106567D; Thu, 28 Jul 2011 12:23:32 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D22C18FC16; Thu, 28 Jul 2011 12:23: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 p6SCNWUf003493; Thu, 28 Jul 2011 12:23:32 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6SCNWn3003491; Thu, 28 Jul 2011 12:23:32 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201107281223.p6SCNWn3003491@svn.freebsd.org> From: Benedict Reuschling Date: Thu, 28 Jul 2011 12:23:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224477 - head/usr.sbin/jail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2011 12:23:33 -0000 Author: bcr (doc committer) Date: Thu Jul 28 12:23:32 2011 New Revision: 224477 URL: http://svn.freebsd.org/changeset/base/224477 Log: Revert my last change to this file, as BETA1 is not announced yet. Pointed out by: kib Pointy hat to: me Approved by: re (kib, implicit) Modified: head/usr.sbin/jail/jail.8 Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Thu Jul 28 12:08:13 2011 (r224476) +++ head/usr.sbin/jail/jail.8 Thu Jul 28 12:23:32 2011 (r224477) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 28, 2011 +.Dd July 23, 2011 .Dt JAIL 8 .Os .Sh NAME @@ -914,8 +914,3 @@ directory that is moved out of the jail' access to the file space outside of the jail. It is recommended that directories always be copied, rather than moved, out of a jail. -.Pp -It is also not recommended that users allowed root in the jail be allowed -access to the host system. -For example, a root user in a jail can create a setuid root utility that -could be run in the host system to achieve elevated privileges. From owner-svn-src-head@FreeBSD.ORG Thu Jul 28 15:12:16 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36288106566B; Thu, 28 Jul 2011 15:12:16 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id B4C0E8FC18; Thu, 28 Jul 2011 15:12:15 +0000 (UTC) Received: by gxk28 with SMTP id 28so2397120gxk.13 for ; Thu, 28 Jul 2011 08:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Wk4hVuhGnU980DWu+7Qx34zZTzeD/bxZ1PeUNV6TABY=; b=IAAgfnGuHZDh24DBiYRgIWBf2dEKAkJseWrUj0OZYXYEE2E59Y904mQQGgBDOsu5DQ b/UK7s8kJmx4H4MjoNIIf6aP9rFCQXaxfAugHVgSuAZTWy8kcONjPzGuWywoum4fvGov ulWZyRylB3ll+dxq2zO9B73V/IX3ZOYrM3QGs= MIME-Version: 1.0 Received: by 10.236.80.67 with SMTP id j43mr184765yhe.57.1311865934994; Thu, 28 Jul 2011 08:12:14 -0700 (PDT) Received: by 10.236.109.147 with HTTP; Thu, 28 Jul 2011 08:12:14 -0700 (PDT) In-Reply-To: <201107281141.p6SBfuZg002113@svn.freebsd.org> References: <201107281141.p6SBfuZg002113@svn.freebsd.org> Date: Thu, 28 Jul 2011 11:12:14 -0400 Message-ID: From: Ben Kaduk To: Benedict Reuschling , rwatson@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224475 - head/usr.sbin/jail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2011 15:12:16 -0000 On Thu, Jul 28, 2011 at 7:41 AM, Benedict Reuschling wrot= e: > Author: bcr (doc committer) > Date: Thu Jul 28 11:41:55 2011 > New Revision: 224475 > URL: http://svn.freebsd.org/changeset/base/224475 > > Log: > =A0Add a section to the jail chapter that explains why it is not > =A0recommended to allow root users in the jail to access the host system. > > =A0PR: =A0 =A0 =A0 =A0 =A0 docs/156853 > =A0Submitted by: crees > =A0Patch by: =A0 =A0 crees > =A0Approved by: =A0re (kib) for BETA1 > > Modified: > =A0head/usr.sbin/jail/jail.8 > > Modified: head/usr.sbin/jail/jail.8 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/jail/jail.8 =A0 Thu Jul 28 10:16:30 2011 =A0 =A0 =A0 = =A0(r224474) > +++ head/usr.sbin/jail/jail.8 =A0 Thu Jul 28 11:41:55 2011 =A0 =A0 =A0 = =A0(r224475) > @@ -34,7 +34,7 @@ > =A0.\" > =A0.\" $FreeBSD$ > =A0.\" > -.Dd July 23, 2011 > +.Dd July 28, 2011 > =A0.Dt JAIL 8 > =A0.Os > =A0.Sh NAME > @@ -914,3 +914,8 @@ directory that is moved out of the jail' > =A0access to the file space outside of the jail. > =A0It is recommended that directories always be copied, rather than moved= , out > =A0of a jail. > +.Pp > +It is also not recommended that users allowed root in the jail be allowe= d > +access to the host system. > +For example, a root user in a jail can create a setuid root utility that > +could be run in the host system to achieve elevated privileges. Per rwatson's comment on the other jail.8 thread we've got going, we might recommend that the separate file system for a jail might also be mounted nosuid, which would close off this class of attack. I don't have a good sense of whether suid applications are frequently useful/needed inside a jail, though. -Ben Kaduk From owner-svn-src-head@FreeBSD.ORG Thu Jul 28 15:28:46 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15219106566B; Thu, 28 Jul 2011 15:28:46 +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 E26038FC19; Thu, 28 Jul 2011 15:28:45 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 6B9D046B2A; Thu, 28 Jul 2011 11:28:45 -0400 (EDT) Date: Thu, 28 Jul 2011 16:28:45 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Ben Kaduk In-Reply-To: Message-ID: References: <201107281141.p6SBfuZg002113@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="621616949-478209871-1311866925=:24841" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Benedict Reuschling , src-committers@freebsd.org Subject: Re: svn commit: r224475 - head/usr.sbin/jail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2011 15:28:46 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --621616949-478209871-1311866925=:24841 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8BIT On Thu, 28 Jul 2011, Ben Kaduk wrote: >> @@ -914,3 +914,8 @@ directory that is moved out of the jail' >>  access to the file space outside of the jail. >>  It is recommended that directories always be copied, rather than moved, out >>  of a jail. >> +.Pp >> +It is also not recommended that users allowed root in the jail be allowed >> +access to the host system. >> +For example, a root user in a jail can create a setuid root utility that >> +could be run in the host system to achieve elevated privileges. > > Per rwatson's comment on the other jail.8 thread we've got going, we might > recommend that the separate file system for a jail might also be mounted > nosuid, which would close off this class of attack. Setting nosuid will break many common jail installations by turning off things like su(1), sudo, crontab, at, etc. I think that the better way to approach this may be to discuss, briefly, the philosophy behind Jail: it's not a virtualisation service, it's a subsetting service. A result of that is that the host system is a superset of the various containers, and has properties derived from each of them. You could imagine using various integrity/tainting schemes to avoid this issue -- a new nosuidjail (don't allow it to be setuid except in a jail), using some of our MAC-related schemes, etc. I would be tempted not to do things, but rather, to document the actual semantics and some of the implications. Robert --621616949-478209871-1311866925=:24841-- From owner-svn-src-head@FreeBSD.ORG Thu Jul 28 16:40:54 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 345EA1065670; Thu, 28 Jul 2011 16:40:54 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 65-241-43-4.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id A7669152409; Thu, 28 Jul 2011 16:40:53 +0000 (UTC) Message-ID: <4E319115.5050003@FreeBSD.org> Date: Thu, 28 Jul 2011 09:40:53 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:5.0) Gecko/20110723 Thunderbird/5.0 MIME-Version: 1.0 To: Robert Watson References: <201107281141.p6SBfuZg002113@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.2pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Benedict Reuschling , src-committers@freebsd.org, Ben Kaduk Subject: Re: svn commit: r224475 - head/usr.sbin/jail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2011 16:40:54 -0000 On 07/28/2011 08:28, Robert Watson wrote: > > On Thu, 28 Jul 2011, Ben Kaduk wrote: > >>> @@ -914,3 +914,8 @@ directory that is moved out of the jail' >>> access to the file space outside of the jail. >>> It is recommended that directories always be copied, rather than >>> moved, out >>> of a jail. >>> +.Pp >>> +It is also not recommended that users allowed root in the jail be >>> allowed >>> +access to the host system. >>> +For example, a root user in a jail can create a setuid root utility >>> that >>> +could be run in the host system to achieve elevated privileges. >> >> Per rwatson's comment on the other jail.8 thread we've got going, we >> might recommend that the separate file system for a jail might also be >> mounted nosuid, which would close off this class of attack. > > Setting nosuid will break many common jail installations by turning off > things like su(1), sudo, crontab, at, etc. > > I think that the better way to approach this may be to discuss, briefly, > the philosophy behind Jail: it's not a virtualisation service, it's a > subsetting service. A result of that is that the host system is a > superset of the various containers, and has properties derived from each > of them. You could imagine using various integrity/tainting schemes to > avoid this issue -- a new nosuidjail (don't allow it to be setuid except > in a jail), using some of our MAC-related schemes, etc. I would be > tempted not to do things, but rather, to document the actual semantics > and some of the implications. In my jail use case (package building systems) having to put them on separate file systems would significantly reduce their utility. My take on the previous discussion was "Don't allow untrusted jail users to have access to the host system" which seems like a fundamental security principle in any case. In the absence of that precaution I'm not sure how much more we can help. Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Fri Jul 29 06:42:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95137106564A; Fri, 29 Jul 2011 06:42:22 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-yi0-f54.google.com (mail-yi0-f54.google.com [209.85.218.54]) by mx1.freebsd.org (Postfix) with ESMTP id CBBE48FC0A; Fri, 29 Jul 2011 06:42:21 +0000 (UTC) Received: by yic13 with SMTP id 13so3008954yic.13 for ; Thu, 28 Jul 2011 23:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=CyNpUqRTio4wrAThCuhw5KLyi3LmsaIriw+SC0UxJxk=; b=plrRi2ROddyQjLt6b2ySvzJuM4ic6KQkJd6ItR47fFeUIYNDjuI2dG3rbfj1ojJ/uO dUt5l3V7um9DF6QpYAsYC0xXthZNSZ9yFDplIDq75E+BT7DP+NpdytC4mexVLYseoOWh 85uos0ouAlzapB50ISeA+Y+XLd/RchBu70Xhc= MIME-Version: 1.0 Received: by 10.150.238.19 with SMTP id l19mr348395ybh.301.1311921740943; Thu, 28 Jul 2011 23:42:20 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.150.200.3 with HTTP; Thu, 28 Jul 2011 23:42:20 -0700 (PDT) In-Reply-To: References: <201107191241.p6JCfvqw072816@svn.freebsd.org> <4E2C9012.602@freebsd.org> <4E2DB8AC.3000703@FreeBSD.org> <4E2DBCBF.2030402@freebsd.org> Date: Fri, 29 Jul 2011 10:42:20 +0400 X-Google-Sender-Auth: 9R0KnZ1jETAzC-w8FL7VMLMPG68 Message-ID: From: Sergey Kandaurov To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Nathan Whitehorn , Andreas Tobler Subject: Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 06:42:22 -0000 On 28 July 2011 06:59, Attilio Rao wrote: > I think that the following patch may better reflect the definition of size_t: > http://www.freebsd.org/~attilio/sintrcnt-fixup32.diff > > Do you think you can test it out? Hi. FYI, I just finished buildtesting the patch with make universe. No stopping build errors found (surely, that still doesn't indicate that it works). > > 2011/7/25 Attilio Rao : >> Guys, I'm a bit out of that for a couple of days, flying to another >> continent, I'm not entirely sure the patch is right because I think we >> need an unified approach for specifying a 32-bits value, but you can >> check-in as a showstopper for the moment, I will make a better one in >> a couple of days. >> >> Attilio >> >> 2011/7/25 Nathan Whitehorn : >>> On 07/25/11 13:40, Andreas Tobler wrote: >>>> >>>> On 24.07.11 23:35, Nathan Whitehorn wrote: >>>>> >>>>> On 07/19/11 07:41, Attilio Rao wrote: >>>>>> >>>>>> Author: attilio >>>>>> Date: Tue Jul 19 12:41:57 2011 >>>>>> New Revision: 224216 >>>>>> URL: http://svn.freebsd.org/changeset/base/224216 >>>>>> >>>>>> Log: >>>>>> On 64 bit architectures size_t is 8 bytes, thus it should use an 8 bytes >>>>>> storage. >>>>>> Fix the sintrcnt/sintrnames specification. >>>>>> >>>>>> No MFC is previewed for this patch. >>>>>> >>>>> >>>>> These also need to be .long on 32-bit PowerPC, otherwise this change >>>>> triggers kernel panics and faults in sysctl. Please change it as quickly >>>>> as possible. >>>> >>>> Like the below? >>>> >>>> I'll test and I could commit if ok. (Build and approval) >>>> >>>> Gruss, >>>> Andreas >>>> >>>> Index: locore32.S >>>> =================================================================== >>>> --- locore32.S (revision 224326) >>>> +++ locore32.S (working copy) >>>> @@ -91,13 +91,13 @@ >>>> GLOBAL(intrnames) >>>> .space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 >>>> GLOBAL(sintrnames) >>>> - .word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 >>>> + .long INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 >>>> >>>> .align 4 >>>> GLOBAL(intrcnt) >>>> .space INTRCNT_COUNT * 4 * 2 >>>> GLOBAL(sintrcnt) >>>> - .word INTRCNT_COUNT * 4 * 2 >>>> + .long INTRCNT_COUNT * 4 * 2 >>>> >>>> .text >>>> .globl btext >>> >>> Exactly like that. -- wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Fri Jul 29 18:35:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 861CF106566C; Fri, 29 Jul 2011 18:35:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73BE68FC13; Fri, 29 Jul 2011 18:35: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 p6TIZAOD061437; Fri, 29 Jul 2011 18:35:10 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6TIZA8g061428; Fri, 29 Jul 2011 18:35:10 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201107291835.p6TIZA8g061428@svn.freebsd.org> From: Marius Strobl Date: Fri, 29 Jul 2011 18:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224493 - head/sys/dev/mpt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 18:35:10 -0000 Author: marius Date: Fri Jul 29 18:35:10 2011 New Revision: 224493 URL: http://svn.freebsd.org/changeset/base/224493 Log: - Staticize functions as appropriate and comment out unused ones. - Sprinkle some const where appropriate. - Consistently use target_id_t for the target parameter of mpt_map_physdisk() and mpt_is_raid_volume(). - Fix some whitespace bugs. Approved by: re (kib) Modified: head/sys/dev/mpt/mpt.c head/sys/dev/mpt/mpt.h head/sys/dev/mpt/mpt_cam.c head/sys/dev/mpt/mpt_debug.c head/sys/dev/mpt/mpt_pci.c head/sys/dev/mpt/mpt_raid.c head/sys/dev/mpt/mpt_raid.h head/sys/dev/mpt/mpt_user.c Modified: head/sys/dev/mpt/mpt.c ============================================================================== --- head/sys/dev/mpt/mpt.c Fri Jul 29 10:51:56 2011 (r224492) +++ head/sys/dev/mpt/mpt.c Fri Jul 29 18:35:10 2011 (r224493) @@ -301,66 +301,75 @@ mpt_modevent(module_t mod, int type, voi return (error); } -int +static int mpt_stdload(struct mpt_personality *pers) { + /* Load is always successful. */ return (0); } -int +static int mpt_stdprobe(struct mpt_softc *mpt) { + /* Probe is always successful. */ return (0); } -int +static int mpt_stdattach(struct mpt_softc *mpt) { + /* Attach is always successful. */ return (0); } -int +static int mpt_stdenable(struct mpt_softc *mpt) { + /* Enable is always successful. */ return (0); } -void +static void mpt_stdready(struct mpt_softc *mpt) { -} +} -int +static int mpt_stdevent(struct mpt_softc *mpt, request_t *req, MSG_EVENT_NOTIFY_REPLY *msg) { + mpt_lprt(mpt, MPT_PRT_DEBUG, "mpt_stdevent: 0x%x\n", msg->Event & 0xFF); /* Event was not for us. */ return (0); } -void +static void mpt_stdreset(struct mpt_softc *mpt, int type) { + } -void +static void mpt_stdshutdown(struct mpt_softc *mpt) { + } -void +static void mpt_stddetach(struct mpt_softc *mpt) { + } -int +static int mpt_stdunload(struct mpt_personality *pers) { + /* Unload is always successful. */ return (0); } @@ -383,7 +392,6 @@ mpt_postattach(void *unused) } SYSINIT(mptdev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, mpt_postattach, NULL); - /******************************* Bus DMA Support ******************************/ void mpt_map_rquest(void *arg, bus_dma_segment_t *segs, int nseg, int error) @@ -478,6 +486,7 @@ static int mpt_default_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { + mpt_prt(mpt, "Default Handler Called: req=%p:%u reply_descriptor=%x frame=%p\n", req, req->serno, reply_desc, reply_frame); @@ -494,8 +503,8 @@ static int mpt_config_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { - if (req != NULL) { + if (req != NULL) { if (reply_frame != NULL) { MSG_CONFIG *cfgp; MSG_CONFIG_REPLY *reply; @@ -528,6 +537,7 @@ static int mpt_handshake_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { + /* Nothing to be done. */ return (TRUE); } @@ -650,6 +660,7 @@ static int mpt_core_event(struct mpt_softc *mpt, request_t *req, MSG_EVENT_NOTIFY_REPLY *msg) { + mpt_lprt(mpt, MPT_PRT_DEBUG, "mpt_core_event: 0x%x\n", msg->Event & 0xFF); switch(msg->Event & 0xFF) { @@ -870,6 +881,7 @@ mpt_complete_request_chain(struct mpt_so void mpt_dump_reply_frame(struct mpt_softc *mpt, MSG_DEFAULT_REPLY *reply_frame) { + mpt_prt(mpt, "Address Reply:\n"); mpt_print_reply(reply_frame); } @@ -881,12 +893,14 @@ static __inline uint32_t mpt_rd_intr(st static __inline uint32_t mpt_rd_db(struct mpt_softc *mpt) { + return mpt_read(mpt, MPT_OFFSET_DOORBELL); } static __inline uint32_t mpt_rd_intr(struct mpt_softc *mpt) { + return mpt_read(mpt, MPT_OFFSET_INTR_STATUS); } @@ -895,6 +909,7 @@ static int mpt_wait_db_ack(struct mpt_softc *mpt) { int i; + for (i=0; i < MPT_MAX_WAIT; i++) { if (!MPT_DB_IS_BUSY(mpt_rd_intr(mpt))) { maxwait_ack = i > maxwait_ack ? i : maxwait_ack; @@ -910,6 +925,7 @@ static int mpt_wait_db_int(struct mpt_softc *mpt) { int i; + for (i = 0; i < MPT_MAX_WAIT; i++) { if (MPT_DB_INTR(mpt_rd_intr(mpt))) { maxwait_int = i > maxwait_int ? i : maxwait_int; @@ -925,6 +941,7 @@ void mpt_check_doorbell(struct mpt_softc *mpt) { uint32_t db = mpt_rd_db(mpt); + if (MPT_STATE(db) != MPT_DB_STATE_RUNNING) { mpt_prt(mpt, "Device not running\n"); mpt_print_db(db); @@ -956,6 +973,7 @@ static int mpt_download_fw(struct mpt_so static int mpt_soft_reset(struct mpt_softc *mpt) { + mpt_lprt(mpt, MPT_PRT_DEBUG, "soft reset\n"); /* Have to use hard reset if we are not in Running state */ @@ -1019,6 +1037,7 @@ mpt_enable_diag_mode(struct mpt_softc *m static void mpt_disable_diag_mode(struct mpt_softc *mpt) { + mpt_write(mpt, MPT_OFFSET_SEQUENCE, 0xFFFFFFFF); } @@ -1094,6 +1113,7 @@ mpt_hard_reset(struct mpt_softc *mpt) static void mpt_core_ioc_reset(struct mpt_softc *mpt, int type) { + /* * Complete all pending requests with a status * appropriate for an IOC reset. @@ -1102,7 +1122,6 @@ mpt_core_ioc_reset(struct mpt_softc *mpt MPI_IOCSTATUS_INVALID_STATE); } - /* * Reset the IOC when needed. Try software command first then if needed * poke at the magic diagnostic reset. Note that a hard reset resets @@ -1263,6 +1282,7 @@ retry: void mpt_send_cmd(struct mpt_softc *mpt, request_t *req) { + if (mpt->verbose > MPT_PRT_DEBUG2) { mpt_dump_request(mpt, req); } @@ -2110,6 +2130,7 @@ mpt_send_event_request(struct mpt_softc void mpt_enable_ints(struct mpt_softc *mpt) { + /* Unmask every thing except door bell int */ mpt_write(mpt, MPT_OFFSET_INTR_MASK, MPT_INTR_DB_MASK); } @@ -2120,6 +2141,7 @@ mpt_enable_ints(struct mpt_softc *mpt) void mpt_disable_ints(struct mpt_softc *mpt) { + /* Mask all interrupts */ mpt_write(mpt, MPT_OFFSET_INTR_MASK, MPT_INTR_REPLY_MASK | MPT_INTR_DB_MASK); @@ -2219,7 +2241,7 @@ mpt_detach(struct mpt_softc *mpt) return (0); } -int +static int mpt_core_load(struct mpt_personality *pers) { int i; @@ -2245,7 +2267,7 @@ mpt_core_load(struct mpt_personality *pe * Initialize per-instance driver data and perform * initial controller configuration. */ -int +static int mpt_core_attach(struct mpt_softc *mpt) { int val, error; @@ -2276,9 +2298,10 @@ mpt_core_attach(struct mpt_softc *mpt) return (error); } -int +static int mpt_core_enable(struct mpt_softc *mpt) { + /* * We enter with the IOC enabled, but async events * not enabled, ports not enabled and interrupts @@ -2326,13 +2349,14 @@ mpt_core_enable(struct mpt_softc *mpt) return (0); } -void +static void mpt_core_shutdown(struct mpt_softc *mpt) { + mpt_disable_ints(mpt); } -void +static void mpt_core_detach(struct mpt_softc *mpt) { int val; @@ -2351,9 +2375,10 @@ mpt_core_detach(struct mpt_softc *mpt) mpt_dma_buf_free(mpt); } -int +static int mpt_core_unload(struct mpt_personality *pers) { + /* Unload is always successful. */ return (0); } @@ -2575,6 +2600,7 @@ static void mpt_dma_buf_free(struct mpt_softc *mpt) { int i; + if (mpt->request_dmat == 0) { mpt_lprt(mpt, MPT_PRT_DEBUG, "already released dma memory\n"); return; Modified: head/sys/dev/mpt/mpt.h ============================================================================== --- head/sys/dev/mpt/mpt.h Fri Jul 29 10:51:56 2011 (r224492) +++ head/sys/dev/mpt/mpt.h Fri Jul 29 18:35:10 2011 (r224493) @@ -1075,16 +1075,6 @@ mpt_complete_request_chain(struct mpt_so int mpt_reset(struct mpt_softc *, int /*reinit*/); /****************************** Debugging ************************************/ -typedef struct mpt_decode_entry { - char *name; - u_int value; - u_int mask; -} mpt_decode_entry_t; - -int mpt_decode_value(mpt_decode_entry_t *table, u_int num_entries, - const char *name, u_int value, u_int *cur_column, - u_int wrap_point); - void mpt_dump_data(struct mpt_softc *, const char *, void *, int); void mpt_dump_request(struct mpt_softc *, request_t *); @@ -1110,17 +1100,21 @@ do { \ mpt_prt(mpt, __VA_ARGS__); \ } while (0) +#if 0 #define mpt_lprtc(mpt, level, ...) \ do { \ if (level <= (mpt)->verbose) \ mpt_prtc(mpt, __VA_ARGS__); \ } while (0) +#endif #else void mpt_lprt(struct mpt_softc *, int, const char *, ...) __printflike(3, 4); +#if 0 void mpt_lprtc(struct mpt_softc *, int, const char *, ...) __printflike(3, 4); #endif +#endif void mpt_prt(struct mpt_softc *, const char *, ...) __printflike(2, 3); void mpt_prtc(struct mpt_softc *, const char *, ...) @@ -1277,7 +1271,6 @@ void mpt_check_doorbell(struct mpt_soft void mpt_dump_reply_frame(struct mpt_softc *mpt, MSG_DEFAULT_REPLY *reply_frame); -void mpt_set_config_regs(struct mpt_softc *); int mpt_issue_cfg_req(struct mpt_softc */*mpt*/, request_t */*req*/, cfgparms_t *params, bus_addr_t /*addr*/, bus_size_t/*len*/, @@ -1331,6 +1324,5 @@ char *mpt_ioc_diag(uint32_t diag); void mpt_req_state(mpt_req_state_t state); void mpt_print_config_request(void *vmsg); void mpt_print_request(void *vmsg); -void mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *msg); void mpt_dump_sgl(SGE_IO_UNION *se, int offset); #endif /* _MPT_H_ */ Modified: head/sys/dev/mpt/mpt_cam.c ============================================================================== --- head/sys/dev/mpt/mpt_cam.c Fri Jul 29 10:51:56 2011 (r224492) +++ head/sys/dev/mpt/mpt_cam.c Fri Jul 29 18:35:10 2011 (r224493) @@ -193,7 +193,7 @@ MODULE_DEPEND(mpt_cam, cam, 1, 1, 1); int mpt_enable_sata_wc = -1; TUNABLE_INT("hw.mpt.enable_sata_wc", &mpt_enable_sata_wc); -int +static int mpt_cam_probe(struct mpt_softc *mpt) { int role; @@ -215,7 +215,7 @@ mpt_cam_probe(struct mpt_softc *mpt) return (ENODEV); } -int +static int mpt_cam_attach(struct mpt_softc *mpt) { struct cam_devq *devq; @@ -509,7 +509,6 @@ mpt_read_config_info_fc(struct mpt_softc static int mpt_set_initial_config_fc(struct mpt_softc *mpt) { - CONFIG_PAGE_FC_PORT_1 fc; U32 fl; int r, doit = 0; @@ -881,8 +880,8 @@ static int mpt_sata_pass_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { - if (req != NULL) { + if (req != NULL) { if (reply_frame != NULL) { req->IOCStatus = le16toh(reply_frame->IOCStatus); } @@ -1114,7 +1113,7 @@ mpt_set_initial_config_spi(struct mpt_so return (0); } -int +static int mpt_cam_enable(struct mpt_softc *mpt) { int error; @@ -1151,9 +1150,10 @@ out: return (error); } -void +static void mpt_cam_ready(struct mpt_softc *mpt) { + /* * If we're in target mode, hang out resources now * so we don't cause the world to hang talking to us. @@ -1171,7 +1171,7 @@ mpt_cam_ready(struct mpt_softc *mpt) mpt->ready = 1; } -void +static void mpt_cam_detach(struct mpt_softc *mpt) { mpt_handler_t handler; @@ -1842,8 +1842,6 @@ bad: memset(se, 0,sizeof (*se)); se->Address = htole32(dm_segs->ds_addr); - - MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); tf = flags; if (seg == first_lim - 1) { @@ -1958,9 +1956,6 @@ bad: memset(se, 0, sizeof (*se)); se->Address = htole32(dm_segs->ds_addr); - - - MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); tf = flags; if (seg == this_seg_lim - 1) { @@ -3045,6 +3040,7 @@ mpt_fc_els_reply_handler(struct mpt_soft static void mpt_cam_ioc_reset(struct mpt_softc *mpt, int type) { + /* * The pending list is already run down by * the generic handler. Perform the same @@ -3974,6 +3970,7 @@ mpt_spawn_recovery_thread(struct mpt_sof static void mpt_terminate_recovery_thread(struct mpt_softc *mpt) { + if (mpt->recovery_thread == NULL) { return; } @@ -4377,6 +4374,7 @@ mpt_add_target_commands(struct mpt_softc static int mpt_enable_lun(struct mpt_softc *mpt, target_id_t tgt, lun_id_t lun) { + if (tgt == CAM_TARGET_WILDCARD && lun == CAM_LUN_WILDCARD) { mpt->twildcard = 1; } else if (lun >= MPT_MAX_LUNS) { @@ -4402,6 +4400,7 @@ static int mpt_disable_lun(struct mpt_softc *mpt, target_id_t tgt, lun_id_t lun) { int i; + if (tgt == CAM_TARGET_WILDCARD && lun == CAM_LUN_WILDCARD) { mpt->twildcard = 0; } else if (lun >= MPT_MAX_LUNS) { @@ -5286,6 +5285,7 @@ mpt_tgt_dump_tgt_state(struct mpt_softc static void mpt_tgt_dump_req_state(struct mpt_softc *mpt, request_t *req) { + mpt_prt(mpt, "req %p:%u index %u (%x) state %x\n", req, req->serno, req->index, req->index, req->state); mpt_tgt_dump_tgt_state(mpt, req); Modified: head/sys/dev/mpt/mpt_debug.c ============================================================================== --- head/sys/dev/mpt/mpt_debug.c Fri Jul 29 10:51:56 2011 (r224492) +++ head/sys/dev/mpt/mpt_debug.c Fri Jul 29 18:35:10 2011 (r224493) @@ -285,6 +285,7 @@ mpt_scsi_state(int code) } return buf; } + static char * mpt_scsi_status(int code) { @@ -298,10 +299,11 @@ mpt_scsi_status(int code) snprintf(buf, sizeof buf, "Unknown (0x%08x)", code); return buf; } -static char * + +static const char * mpt_who(int who_init) { - char *who; + const char *who; switch (who_init) { case MPT_DB_INIT_NOONE: who = "No One"; break; @@ -315,10 +317,10 @@ mpt_who(int who_init) return who; } -static char * +static const char * mpt_state(u_int32_t mb) { - char *text; + const char *text; switch (MPT_STATE(mb)) { case MPT_DB_STATE_RESET: text = "Reset"; break; @@ -347,6 +349,7 @@ mpt_scsi_tm_type(int code) void mpt_print_db(u_int32_t mb) { + printf("mpt mailbox: (0x%x) State %s WhoInit %s\n", mb, mpt_state(mb), mpt_who(MPT_WHO(mb))); } @@ -357,6 +360,7 @@ mpt_print_db(u_int32_t mb) static void mpt_print_reply_hdr(MSG_DEFAULT_REPLY *msg) { + printf("%s Reply @ %p\n", mpt_ioc_function(msg->Function), msg); printf("\tIOC Status %s\n", mpt_ioc_status(msg->IOCStatus)); printf("\tIOCLogInfo 0x%08x\n", msg->IOCLogInfo); @@ -368,6 +372,7 @@ mpt_print_reply_hdr(MSG_DEFAULT_REPLY *m static void mpt_print_init_reply(MSG_IOC_INIT_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); printf("\tWhoInit %s\n", mpt_who(msg->WhoInit)); printf("\tMaxDevices 0x%02x\n", msg->MaxDevices); @@ -377,6 +382,7 @@ mpt_print_init_reply(MSG_IOC_INIT_REPLY static void mpt_print_ioc_facts(MSG_IOC_FACTS_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); printf("\tIOCNumber %d\n", msg->IOCNumber); printf("\tMaxChainDepth %d\n", msg->MaxChainDepth); @@ -402,6 +408,7 @@ mpt_print_ioc_facts(MSG_IOC_FACTS_REPLY static void mpt_print_enable_reply(MSG_PORT_ENABLE_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); printf("\tPort: %d\n", msg->PortNumber); } @@ -409,6 +416,7 @@ mpt_print_enable_reply(MSG_PORT_ENABLE_R static void mpt_print_scsi_io_reply(MSG_SCSI_IO_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); printf("\tBus: %d\n", msg->Bus); printf("\tTargetID %d\n", msg->TargetID); @@ -420,11 +428,10 @@ mpt_print_scsi_io_reply(MSG_SCSI_IO_REPL printf("\tResponseInfo 0x%08x\n", msg->ResponseInfo); } - - static void mpt_print_event_notice(MSG_EVENT_NOTIFY_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); printf("\tEvent: %s\n", mpt_ioc_event(msg->Event)); printf("\tEventContext 0x%04x\n", msg->EventContext); @@ -517,7 +524,7 @@ mpt_print_request_hdr(MSG_REQUEST_HEADER printf("\tMsgContext 0x%08x\n", req->MsgContext); } -void +static void mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *orig_msg) { MSG_SCSI_IO_REQUEST local, *msg = &local; @@ -575,6 +582,7 @@ mpt_print_scsi_io_request(MSG_SCSI_IO_RE static void mpt_print_scsi_tmf_request(MSG_SCSI_TASK_MGMT *msg) { + mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg); printf("\tLun 0x%02x\n", msg->LUN[1]); printf("\tTaskType %s\n", mpt_scsi_tm_type(msg->TaskType)); @@ -585,6 +593,7 @@ mpt_print_scsi_tmf_request(MSG_SCSI_TASK static void mpt_print_scsi_target_assist_request(PTR_MSG_TARGET_ASSIST_REQUEST msg) { + mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg); printf("\tStatusCode 0x%02x\n", msg->StatusCode); printf("\tTargetAssist 0x%02x\n", msg->TargetAssistFlags); @@ -600,6 +609,7 @@ static void mpt_print_scsi_target_status_send_request(MSG_TARGET_STATUS_SEND_REQUEST *msg) { SGE_IO_UNION x; + mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg); printf("\tStatusCode 0x%02x\n", msg->StatusCode); printf("\tStatusFlags 0x%02x\n", msg->StatusFlags); @@ -637,7 +647,14 @@ mpt_print_request(void *vreq) } } -int +#if 0 +typedef struct mpt_decode_entry { + char *name; + u_int value; + u_int mask; +} mpt_decode_entry_t; + +static int mpt_decode_value(mpt_decode_entry_t *table, u_int num_entries, const char *name, u_int value, u_int *cur_column, u_int wrap_point) @@ -689,7 +706,7 @@ mpt_decode_value(mpt_decode_entry_t *tab return (printed); } -static mpt_decode_entry_t req_state_parse_table[] = { +static const mpt_decode_entry_t req_state_parse_table[] = { { "REQ_FREE", 0x00, 0xff }, { "REQ_ALLOCATED", 0x01, 0x01 }, { "REQ_QUEUED", 0x02, 0x02 }, @@ -698,13 +715,15 @@ static mpt_decode_entry_t req_state_pars { "REQ_NEED_WAKEUP", 0x10, 0x10 } }; -void +static void mpt_req_state(mpt_req_state_t state) { + mpt_decode_value(req_state_parse_table, NUM_ELEMENTS(req_state_parse_table), "REQ_STATE", state, NULL, 80); } +#endif #define LAST_SGE ( \ MPI_SGE_FLAGS_END_OF_LIST | \ @@ -805,6 +824,7 @@ mpt_dump_data(struct mpt_softc *mpt, con { int offset; uint8_t *cp = addr; + mpt_prt(mpt, "%s:", msg); for (offset = 0; offset < len; offset++) { if ((offset & 0xf) == 0) { @@ -820,6 +840,7 @@ mpt_dump_request(struct mpt_softc *mpt, { uint32_t *pReq = req->req_vbuf; int o; + #if __FreeBSD_version >= 500000 mpt_prt(mpt, "Send Request %d (%jx):", req->index, (uintmax_t) req->req_pbuf); @@ -850,6 +871,7 @@ mpt_lprt(struct mpt_softc *mpt, int leve } } +#if 0 void mpt_lprtc(struct mpt_softc *mpt, int level, const char *fmt, ...) { @@ -861,6 +883,7 @@ mpt_lprtc(struct mpt_softc *mpt, int lev } } #endif +#endif void mpt_prt(struct mpt_softc *mpt, const char *fmt, ...) Modified: head/sys/dev/mpt/mpt_pci.c ============================================================================== --- head/sys/dev/mpt/mpt_pci.c Fri Jul 29 10:51:56 2011 (r224492) +++ head/sys/dev/mpt/mpt_pci.c Fri Jul 29 18:35:10 2011 (r224493) @@ -201,6 +201,9 @@ static int mpt_pci_shutdown(device_t); static int mpt_dma_mem_alloc(struct mpt_softc *mpt); static void mpt_dma_mem_free(struct mpt_softc *mpt); static void mpt_read_config_regs(struct mpt_softc *mpt); +#if 0 +static void mpt_set_config_regs(struct mpt_softc *mpt); +#endif static void mpt_pci_intr(void *); static device_method_t mpt_methods[] = { @@ -404,6 +407,7 @@ mpt_link_peer(struct mpt_softc *mpt) static void mpt_unlink_peer(struct mpt_softc *mpt) { + if (mpt->mpt2) { mpt->mpt2->mpt2 = NULL; } @@ -654,6 +658,7 @@ bad: static void mpt_free_bus_resources(struct mpt_softc *mpt) { + if (mpt->ih) { bus_teardown_intr(mpt->dev, mpt->pci_irq, mpt->ih); mpt->ih = NULL; @@ -827,6 +832,7 @@ mpt_dma_mem_free(struct mpt_softc *mpt) static void mpt_read_config_regs(struct mpt_softc *mpt) { + mpt->pci_cfg.Command = pci_read_config(mpt->dev, PCIR_COMMAND, 2); mpt->pci_cfg.LatencyTimer_LineSize = pci_read_config(mpt->dev, PCIR_CACHELNSZ, 2); @@ -840,8 +846,9 @@ mpt_read_config_regs(struct mpt_softc *m mpt->pci_cfg.PMCSR = pci_read_config(mpt->dev, 0x44, 4); } +#if 0 /* Sets modifiable config registers */ -void +static void mpt_set_config_regs(struct mpt_softc *mpt) { uint32_t val; @@ -880,6 +887,7 @@ mpt_set_config_regs(struct mpt_softc *mp pci_write_config(mpt->dev, PCIR_INTLINE, mpt->pci_cfg.IntLine, 1); pci_write_config(mpt->dev, 0x44, mpt->pci_cfg.PMCSR, 4); } +#endif static void mpt_pci_intr(void *arg) Modified: head/sys/dev/mpt/mpt_raid.c ============================================================================== --- head/sys/dev/mpt/mpt_raid.c Fri Jul 29 10:51:56 2011 (r224492) +++ head/sys/dev/mpt/mpt_raid.c Fri Jul 29 18:35:10 2011 (r224493) @@ -81,7 +81,6 @@ struct mpt_raid_action_result #define REQ_IOCSTATUS(req) ((req)->IOCStatus & MPI_IOCSTATUS_MASK) - static mpt_probe_handler_t mpt_raid_probe; static mpt_attach_handler_t mpt_raid_attach; static mpt_enable_handler_t mpt_raid_enable; @@ -125,9 +124,25 @@ static void mpt_adjust_queue_depth(struc static void mpt_raid_sysctl_attach(struct mpt_softc *); #endif +static const char *mpt_vol_type(struct mpt_raid_volume *vol); +static const char *mpt_vol_state(struct mpt_raid_volume *vol); +static const char *mpt_disk_state(struct mpt_raid_disk *disk); +static void mpt_vol_prt(struct mpt_softc *mpt, struct mpt_raid_volume *vol, + const char *fmt, ...); +static void mpt_disk_prt(struct mpt_softc *mpt, struct mpt_raid_disk *disk, + const char *fmt, ...); + +static int mpt_issue_raid_req(struct mpt_softc *mpt, + struct mpt_raid_volume *vol, struct mpt_raid_disk *disk, request_t *req, + u_int Action, uint32_t ActionDataWord, bus_addr_t addr, bus_size_t len, + int write, int wait); + +static int mpt_refresh_raid_data(struct mpt_softc *mpt); +static void mpt_schedule_raid_refresh(struct mpt_softc *mpt); + static uint32_t raid_handler_id = MPT_HANDLER_ID_NONE; -const char * +static const char * mpt_vol_type(struct mpt_raid_volume *vol) { switch (vol->config_page->VolumeType) { @@ -142,7 +157,7 @@ mpt_vol_type(struct mpt_raid_volume *vol } } -const char * +static const char * mpt_vol_state(struct mpt_raid_volume *vol) { switch (vol->config_page->VolumeStatus.State) { @@ -157,7 +172,7 @@ mpt_vol_state(struct mpt_raid_volume *vo } } -const char * +static const char * mpt_disk_state(struct mpt_raid_disk *disk) { switch (disk->config_page.PhysDiskStatus.State) { @@ -182,7 +197,7 @@ mpt_disk_state(struct mpt_raid_disk *dis } } -void +static void mpt_vol_prt(struct mpt_softc *mpt, struct mpt_raid_volume *vol, const char *fmt, ...) { @@ -196,7 +211,7 @@ mpt_vol_prt(struct mpt_softc *mpt, struc va_end(ap); } -void +static void mpt_disk_prt(struct mpt_softc *mpt, struct mpt_raid_disk *disk, const char *fmt, ...) { @@ -254,16 +269,17 @@ mpt_raid_async(void *callback_arg, u_int } } -int +static int mpt_raid_probe(struct mpt_softc *mpt) { + if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) { return (ENODEV); } return (0); } -int +static int mpt_raid_attach(struct mpt_softc *mpt) { struct ccb_setasync csa; @@ -307,13 +323,14 @@ cleanup: return (error); } -int +static int mpt_raid_enable(struct mpt_softc *mpt) { + return (0); } -void +static void mpt_raid_detach(struct mpt_softc *mpt) { struct ccb_setasync csa; @@ -338,6 +355,7 @@ mpt_raid_detach(struct mpt_softc *mpt) static void mpt_raid_ioc_reset(struct mpt_softc *mpt, int type) { + /* Nothing to do yet. */ } @@ -570,7 +588,7 @@ mpt_raid_reply_frame_handler(struct mpt_ /* * Utiltity routine to perform a RAID action command; */ -int +static int mpt_issue_raid_req(struct mpt_softc *mpt, struct mpt_raid_volume *vol, struct mpt_raid_disk *disk, request_t *req, u_int Action, uint32_t ActionDataWord, bus_addr_t addr, bus_size_t len, @@ -719,6 +737,7 @@ mpt_raid_thread(void *arg) static void mpt_raid_quiesce_timeout(void *arg) { + /* Complete the CCB with error */ /* COWWWW */ } @@ -776,7 +795,7 @@ mpt_raid_quiesce_disk(struct mpt_softc * /* XXX Ignores that there may be multiple busses/IOCs involved. */ cam_status -mpt_map_physdisk(struct mpt_softc *mpt, union ccb *ccb, u_int *tgt) +mpt_map_physdisk(struct mpt_softc *mpt, union ccb *ccb, target_id_t *tgt) { struct mpt_raid_disk *mpt_disk; @@ -793,7 +812,7 @@ mpt_map_physdisk(struct mpt_softc *mpt, /* XXX Ignores that there may be multiple busses/IOCs involved. */ int -mpt_is_raid_volume(struct mpt_softc *mpt, int tgt) +mpt_is_raid_volume(struct mpt_softc *mpt, target_id_t tgt) { CONFIG_PAGE_IOC_2_RAID_VOL *ioc_vol; CONFIG_PAGE_IOC_2_RAID_VOL *ioc_last_vol; @@ -1305,7 +1324,7 @@ mpt_refresh_raid_vol(struct mpt_softc *m * be updated by our event handler. Interesting changes are displayed * to the console. */ -int +static int mpt_refresh_raid_data(struct mpt_softc *mpt) { CONFIG_PAGE_IOC_2_RAID_VOL *ioc_vol; @@ -1565,9 +1584,10 @@ mpt_raid_timer(void *arg) #endif } -void +static void mpt_schedule_raid_refresh(struct mpt_softc *mpt) { + callout_reset(&mpt->raid_timer, MPT_RAID_SYNC_REPORT_INTERVAL, mpt_raid_timer, mpt); } @@ -1719,7 +1739,8 @@ mpt_raid_set_vol_mwce(struct mpt_softc * MPT_UNLOCK(mpt); return (0); } -const char *mpt_vol_mwce_strs[] = + +static const char *mpt_vol_mwce_strs[] = { "On", "Off", Modified: head/sys/dev/mpt/mpt_raid.h ============================================================================== --- head/sys/dev/mpt/mpt_raid.h Fri Jul 29 10:51:56 2011 (r224492) +++ head/sys/dev/mpt/mpt_raid.h Fri Jul 29 18:35:10 2011 (r224493) @@ -53,29 +53,13 @@ typedef enum { MPT_RAID_MWCE_NC } mpt_raid_mwce_t; -const char *mpt_vol_type(struct mpt_raid_volume *); -const char *mpt_vol_state(struct mpt_raid_volume *); -const char *mpt_disk_state(struct mpt_raid_disk *); -void -mpt_vol_prt(struct mpt_softc *, struct mpt_raid_volume *, const char *fmt, ...); -void -mpt_disk_prt(struct mpt_softc *, struct mpt_raid_disk *, const char *, ...); - -int -mpt_issue_raid_req(struct mpt_softc *, struct mpt_raid_volume *, - struct mpt_raid_disk *, request_t *, u_int, uint32_t, bus_addr_t, - bus_size_t, int, int); - -cam_status -mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *); -int mpt_is_raid_volume(struct mpt_softc *, int); +cam_status mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *); +int mpt_is_raid_volume(struct mpt_softc *, target_id_t); #if 0 cam_status mpt_raid_quiesce_disk(struct mpt_softc *, struct mpt_raid_disk *, request_t *); #endif -int mpt_refresh_raid_data(struct mpt_softc *); -void mpt_schedule_raid_refresh(struct mpt_softc *); void mpt_raid_free_mem(struct mpt_softc *); static __inline void Modified: head/sys/dev/mpt/mpt_user.c ============================================================================== --- head/sys/dev/mpt/mpt_user.c Fri Jul 29 10:51:56 2011 (r224492) +++ head/sys/dev/mpt/mpt_user.c Fri Jul 29 18:35:10 2011 (r224493) @@ -94,7 +94,7 @@ static MALLOC_DEFINE(M_MPTUSER, "mpt_use static uint32_t user_handler_id = MPT_HANDLER_ID_NONE; -int +static int mpt_user_probe(struct mpt_softc *mpt) { @@ -102,7 +102,7 @@ mpt_user_probe(struct mpt_softc *mpt) return (0); } -int +static int mpt_user_attach(struct mpt_softc *mpt) { mpt_handler_t handler; @@ -131,19 +131,20 @@ mpt_user_attach(struct mpt_softc *mpt) return (0); } -int +static int mpt_user_enable(struct mpt_softc *mpt) { return (0); } -void +static void mpt_user_ready(struct mpt_softc *mpt) { + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Jul 29 18:38:32 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C9711065670; Fri, 29 Jul 2011 18:38:32 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B71C8FC12; Fri, 29 Jul 2011 18:38: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 p6TIcWHO061529; Fri, 29 Jul 2011 18:38:32 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6TIcVKo061525; Fri, 29 Jul 2011 18:38:31 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201107291838.p6TIcVKo061525@svn.freebsd.org> From: Marius Strobl Date: Fri, 29 Jul 2011 18:38:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224494 - head/sys/dev/mpt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 18:38:32 -0000 Author: marius Date: Fri Jul 29 18:38:31 2011 New Revision: 224494 URL: http://svn.freebsd.org/changeset/base/224494 Log: - Send the RELSIM_ADJUST_OPENINGS in response to a MPI_EVENT_QUEUE_FULL using the right SIM in case the HBA is RAID-capable but the target in question is not a hot spare or member of a RAID volume. - Report the loss and addition of SAS and SATA targets detected via PHY link status changes and signalled by MPI_EVENT_SAS_DEVICE_STATUS_CHANGE to cam(4) as lost devices and trigger rescans as appropriate. Without this it can take quite some time until a lost device actually is no longer tried to be used, if it ever stops. [1] - Handle MPI_EVENT_IR2, MPI_EVENT_LOG_ENTRY_ADDED, MPI_EVENT_SAS_DISCOVERY and MPI_EVENT_SAS_PHY_LINK_STATUS silently as these serve no additional purpose beyond adding cryptic entries to logs. Thanks to Hans-Joerg Sirtl for providing one of the HBAs these changes were developed with and RIP to the mainboard that didn't survive testing them. PR: 157534 [1] Approved by: re (kib) MFC after: 2 weeks Modified: head/sys/dev/mpt/mpt_cam.c head/sys/dev/mpt/mpt_raid.c head/sys/dev/mpt/mpt_raid.h Modified: head/sys/dev/mpt/mpt_cam.c ============================================================================== --- head/sys/dev/mpt/mpt_cam.c Fri Jul 29 18:35:10 2011 (r224493) +++ head/sys/dev/mpt/mpt_cam.c Fri Jul 29 18:38:31 2011 (r224494) @@ -2538,7 +2538,8 @@ mpt_cam_event(struct mpt_softc *mpt, req pqf->CurrentDepth = le16toh(pqf->CurrentDepth); mpt_prt(mpt, "QUEUE FULL EVENT: Bus 0x%02x Target 0x%02x Depth " "%d\n", pqf->Bus, pqf->TargetID, pqf->CurrentDepth); - if (mpt->phydisk_sim) { + if (mpt->phydisk_sim && mpt_is_raid_member(mpt, + pqf->TargetID) != 0) { sim = mpt->phydisk_sim; } else { sim = mpt->sim; @@ -2570,9 +2571,72 @@ mpt_cam_event(struct mpt_softc *mpt, req mpt_prt(mpt, "IR resync update %d completed\n", (data0 >> 16) & 0xff); break; + case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: + { + union ccb *ccb; + struct cam_sim *sim; + struct cam_path *tmppath; + PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE psdsc; + + psdsc = (PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE)msg->Data; + if (mpt->phydisk_sim && mpt_is_raid_member(mpt, + psdsc->TargetID) != 0) + sim = mpt->phydisk_sim; + else + sim = mpt->sim; + switch(psdsc->ReasonCode) { + case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: + MPTLOCK_2_CAMLOCK(mpt); + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + mpt_prt(mpt, + "unable to alloc CCB for rescan\n"); + CAMLOCK_2_MPTLOCK(mpt); + break; + } + if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + cam_sim_path(sim), psdsc->TargetID, + CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + CAMLOCK_2_MPTLOCK(mpt); + mpt_prt(mpt, + "unable to create path for rescan\n"); + xpt_free_ccb(ccb); + break; + } + xpt_rescan(ccb); + CAMLOCK_2_MPTLOCK(mpt); + break; + case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: + MPTLOCK_2_CAMLOCK(mpt); + if (xpt_create_path(&tmppath, NULL, cam_sim_path(sim), + psdsc->TargetID, CAM_LUN_WILDCARD) != + CAM_REQ_CMP) { + mpt_prt(mpt, + "unable to create path for async event"); + CAMLOCK_2_MPTLOCK(mpt); + break; + } + xpt_async(AC_LOST_DEVICE, tmppath, NULL); + xpt_free_path(tmppath); + CAMLOCK_2_MPTLOCK(mpt); + break; + case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET: + break; + default: + mpt_lprt(mpt, MPT_PRT_WARN, + "SAS device status change: Bus: 0x%02x TargetID: " + "0x%02x ReasonCode: 0x%02x\n", psdsc->TargetID, + psdsc->Bus, psdsc->ReasonCode); + break; + } + break; + } case MPI_EVENT_EVENT_CHANGE: case MPI_EVENT_INTEGRATED_RAID: - case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: + case MPI_EVENT_IR2: + case MPI_EVENT_LOG_ENTRY_ADDED: + case MPI_EVENT_SAS_DISCOVERY: + case MPI_EVENT_SAS_PHY_LINK_STATUS: case MPI_EVENT_SAS_SES: break; default: Modified: head/sys/dev/mpt/mpt_raid.c ============================================================================== --- head/sys/dev/mpt/mpt_raid.c Fri Jul 29 18:35:10 2011 (r224493) +++ head/sys/dev/mpt/mpt_raid.c Fri Jul 29 18:38:31 2011 (r224494) @@ -812,6 +812,25 @@ mpt_map_physdisk(struct mpt_softc *mpt, /* XXX Ignores that there may be multiple busses/IOCs involved. */ int +mpt_is_raid_member(struct mpt_softc *mpt, target_id_t tgt) +{ + struct mpt_raid_disk *mpt_disk; + int i; + + if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) + return (0); + for (i = 0; i < mpt->ioc_page2->MaxPhysDisks; i++) { + mpt_disk = &mpt->raid_disks[i]; + if ((mpt_disk->flags & MPT_RDF_ACTIVE) != 0 && + mpt_disk->config_page.PhysDiskID == tgt) + return (1); + } + return (0); + +} + +/* XXX Ignores that there may be multiple busses/IOCs involved. */ +int mpt_is_raid_volume(struct mpt_softc *mpt, target_id_t tgt) { CONFIG_PAGE_IOC_2_RAID_VOL *ioc_vol; Modified: head/sys/dev/mpt/mpt_raid.h ============================================================================== --- head/sys/dev/mpt/mpt_raid.h Fri Jul 29 18:35:10 2011 (r224493) +++ head/sys/dev/mpt/mpt_raid.h Fri Jul 29 18:38:31 2011 (r224494) @@ -54,6 +54,7 @@ typedef enum { } mpt_raid_mwce_t; cam_status mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *); +int mpt_is_raid_member(struct mpt_softc *, target_id_t); int mpt_is_raid_volume(struct mpt_softc *, target_id_t); #if 0 cam_status From owner-svn-src-head@FreeBSD.ORG Fri Jul 29 18:47:38 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21466106566B; Fri, 29 Jul 2011 18:47:38 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id 97BC68FC14; Fri, 29 Jul 2011 18:47:37 +0000 (UTC) Received: from deuterium.andreas.nets (dhclient-91-190-8-131.flashcable.ch [91.190.8.131]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id p6TIlECL000303; Fri, 29 Jul 2011 20:47:15 +0200 (CEST) (envelope-from andreast@FreeBSD.org) Message-ID: <4E330032.2030306@FreeBSD.org> Date: Fri, 29 Jul 2011 20:47:14 +0200 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: Attilio Rao References: <201107191241.p6JCfvqw072816@svn.freebsd.org> <4E2C9012.602@freebsd.org> <4E2DB8AC.3000703@FreeBSD.org> <4E2DBCBF.2030402@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Sergey Kandaurov , Nathan Whitehorn , svn-src-head@FreeBSD.org, Andreas Tobler Subject: Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 18:47:38 -0000 On 28.07.11 04:59, Attilio Rao wrote: > I think that the following patch may better reflect the definition of size_t: > http://www.freebsd.org/~attilio/sintrcnt-fixup32.diff > > Do you think you can test it out? PowerPC 32-bit built, booted and completed a buildworld. Thanks, Andreas From owner-svn-src-head@FreeBSD.ORG Fri Jul 29 18:51:42 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 282F41065674; Fri, 29 Jul 2011 18:51:42 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7480C8FC1B; Fri, 29 Jul 2011 18:51:41 +0000 (UTC) Received: by gxk28 with SMTP id 28so3515025gxk.13 for ; Fri, 29 Jul 2011 11:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=OiGQDTKSPuV8GpBIqjHbLJrEpmyhJ/YZRJPKsqH7Gh4=; b=V9Hv0U47gz3gGQS+8t8QSm2T1pzJ6QasVEcXg7V1EC2/YTK6ZDFsUOzp1M/fwiy45L 6lL9S2vGBZvJRz105s7wvLXzbmLDdbiLLUCnjPkqJP7H97msDvt2WWE6++Xah6Z87Y/x /sdIKKvvW5ALTKl34gCt2DgBszzuaKqsyEIuI= MIME-Version: 1.0 Received: by 10.236.157.102 with SMTP id n66mr706140yhk.361.1311965494486; Fri, 29 Jul 2011 11:51:34 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.110.139 with HTTP; Fri, 29 Jul 2011 11:51:34 -0700 (PDT) In-Reply-To: <4E330032.2030306@FreeBSD.org> References: <201107191241.p6JCfvqw072816@svn.freebsd.org> <4E2C9012.602@freebsd.org> <4E2DB8AC.3000703@FreeBSD.org> <4E2DBCBF.2030402@freebsd.org> <4E330032.2030306@FreeBSD.org> Date: Fri, 29 Jul 2011 14:51:34 -0400 X-Google-Sender-Auth: IO59Eu5kyeuG7UVQSSx6pvQ8SR0 Message-ID: From: Attilio Rao To: Andreas Tobler Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Sergey Kandaurov , Nathan Whitehorn Subject: Re: svn commit: r224216 - in head/sys: ia64/ia64 mips/mips powerpc/aim sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 18:51:42 -0000 2011/7/29 Andreas Tobler : > On 28.07.11 04:59, Attilio Rao wrote: >> >> I think that the following patch may better reflect the definition of >> size_t: >> http://www.freebsd.org/~attilio/sintrcnt-fixup32.diff >> >> Do you think you can test it out? > > PowerPC 32-bit built, booted and completed a buildworld. > Thanks a lot as usual. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Fri Jul 29 20:24:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 085031065674; Fri, 29 Jul 2011 20:24:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBDB18FC13; Fri, 29 Jul 2011 20:24: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 p6TKO4l1064684; Fri, 29 Jul 2011 20:24:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6TKO4vI064682; Fri, 29 Jul 2011 20:24:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201107292024.p6TKO4vI064682@svn.freebsd.org> From: John Baldwin Date: Fri, 29 Jul 2011 20:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224495 - head/usr.sbin/mfiutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 20:24:05 -0000 Author: jhb Date: Fri Jul 29 20:24:04 2011 New Revision: 224495 URL: http://svn.freebsd.org/changeset/base/224495 Log: Properly initialize an error variable to avoid returning uninitialized data when 'show drives' succeeds, often resulting in a failing exit code even though the command worked fine. Reviewed by: bz Approved by: re (kib) MFC after: 3 days Modified: head/usr.sbin/mfiutil/mfi_show.c Modified: head/usr.sbin/mfiutil/mfi_show.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_show.c Fri Jul 29 18:38:31 2011 (r224494) +++ head/usr.sbin/mfiutil/mfi_show.c Fri Jul 29 20:24:04 2011 (r224495) @@ -533,6 +533,7 @@ show_drives(int ac, char **av) MFI_DNAME_ES)); printf("\n"); } + error = 0; error: free(list); close(fd); From owner-svn-src-head@FreeBSD.ORG Fri Jul 29 20:30:28 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 852C7106566B; Fri, 29 Jul 2011 20:30:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69BF68FC1C; Fri, 29 Jul 2011 20:30: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 p6TKUSBT064897; Fri, 29 Jul 2011 20:30:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6TKUSaf064895; Fri, 29 Jul 2011 20:30:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201107292030.p6TKUSaf064895@svn.freebsd.org> From: Alexander Motin Date: Fri, 29 Jul 2011 20:30:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224496 - head/sys/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 20:30:28 -0000 Author: mav Date: Fri Jul 29 20:30:28 2011 New Revision: 224496 URL: http://svn.freebsd.org/changeset/base/224496 Log: In some cases failed SATA disks may report their presence, but don't respond to any commands. I've found that because of multiple command retries, each of which cause 30s timeout, bus reset and another retry or requeue for many commands, it may take ages to eventually drop the failed device. The odd thing is that those retries continue even after XPT considered device as dead and invalidated it. This patch makes cam_periph_error() to block any command retries after periph was marked as invalid. With that patch all activity completes in 1-2 minutes, just after several timeouts, required to consider device death. This should make ZFS, gmirror, graid, etc. operation more robust. Reviewed by: mjacob@ on scsi@ Approved by: re (kib) Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Fri Jul 29 20:24:04 2011 (r224495) +++ head/sys/cam/cam_periph.c Fri Jul 29 20:30:28 2011 (r224496) @@ -1550,7 +1550,8 @@ camperiphscsisenseerror(union ccb *ccb, * make sure we actually have retries available. */ if ((err_action & SSQ_DECREMENT_COUNT) != 0) { - if (ccb->ccb_h.retry_count > 0) + if (ccb->ccb_h.retry_count > 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) ccb->ccb_h.retry_count--; else { *action_string = "Retries exhausted"; @@ -1718,6 +1719,7 @@ int cam_periph_error(union ccb *ccb, cam_flags camflags, u_int32_t sense_flags, union ccb *save_ccb) { + struct cam_periph *periph; const char *action_string; cam_status status; int frozen; @@ -1725,7 +1727,8 @@ cam_periph_error(union ccb *ccb, cam_fla int openings; u_int32_t relsim_flags; u_int32_t timeout = 0; - + + periph = xpt_path_periph(ccb->ccb_h.path); action_string = NULL; status = ccb->ccb_h.status; frozen = (status & CAM_DEV_QFRZN) != 0; @@ -1787,9 +1790,9 @@ cam_periph_error(union ccb *ccb, cam_fla xpt_print(ccb->ccb_h.path, "Data overrun\n"); printed++; } - error = EIO; /* we have to kill the command */ /* decrement the number of retries */ - if (ccb->ccb_h.retry_count > 0) { + if (ccb->ccb_h.retry_count > 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) { ccb->ccb_h.retry_count--; error = ERESTART; } else { @@ -1808,7 +1811,8 @@ cam_periph_error(union ccb *ccb, cam_fla struct cam_path *newpath; if ((camflags & CAM_RETRY_SELTO) != 0) { - if (ccb->ccb_h.retry_count > 0) { + if (ccb->ccb_h.retry_count > 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) { ccb->ccb_h.retry_count--; error = ERESTART; @@ -1826,10 +1830,11 @@ cam_periph_error(union ccb *ccb, cam_fla timeout = periph_selto_delay; break; } + action_string = "Retries exhausted"; } error = ENXIO; /* Should we do more if we can't create the path?? */ - if (xpt_create_path(&newpath, xpt_path_periph(ccb->ccb_h.path), + if (xpt_create_path(&newpath, periph, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), CAM_LUN_WILDCARD) != CAM_REQ_CMP) @@ -1874,11 +1879,16 @@ cam_periph_error(union ccb *ccb, cam_fla /* FALLTHROUGH */ case CAM_REQUEUE_REQ: /* Unconditional requeue */ - error = ERESTART; if (bootverbose && printed == 0) { xpt_print(ccb->ccb_h.path, "Request requeued\n"); printed++; } + if ((periph->flags & CAM_PERIPH_INVALID) == 0) + error = ERESTART; + else { + action_string = "Retries exhausted"; + error = EIO; + } break; case CAM_RESRC_UNAVAIL: /* Wait a bit for the resource shortage to abate. */ @@ -1893,7 +1903,8 @@ cam_periph_error(union ccb *ccb, cam_fla /* FALLTHROUGH */ default: /* decrement the number of retries */ - if (ccb->ccb_h.retry_count > 0) { + if (ccb->ccb_h.retry_count > 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) { ccb->ccb_h.retry_count--; error = ERESTART; if (bootverbose && printed == 0) { From owner-svn-src-head@FreeBSD.ORG Fri Jul 29 20:32:28 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1548E1065672; Fri, 29 Jul 2011 20:32:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03F318FC29; Fri, 29 Jul 2011 20:32: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 p6TKWRGb065001; Fri, 29 Jul 2011 20:32:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6TKWRWl064999; Fri, 29 Jul 2011 20:32:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201107292032.p6TKWRWl064999@svn.freebsd.org> From: Alexander Motin Date: Fri, 29 Jul 2011 20:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224497 - head/sys/cam/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 20:32:28 -0000 Author: mav Date: Fri Jul 29 20:32:27 2011 New Revision: 224497 URL: http://svn.freebsd.org/changeset/base/224497 Log: Add control for ATA disk read-ahead, alike to the previously added write cache control. Some controller BIOS'es tend to disable read-ahead, that dramatically reduces read performance. Previously ata(4) always enabled read-ahead unconditionally. Approved by: re (kib) Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Fri Jul 29 20:30:28 2011 (r224496) +++ head/sys/cam/ata/ata_da.c Fri Jul 29 20:32:27 2011 (r224497) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #define ATA_MAX_28BIT_LBA 268435455UL typedef enum { + ADA_STATE_RAHEAD, ADA_STATE_WCACHE, ADA_STATE_NORMAL } ada_state; @@ -94,7 +95,8 @@ typedef enum { } ada_quirks; typedef enum { - ADA_CCB_WCACHE = 0x01, + ADA_CCB_RAHEAD = 0x01, + ADA_CCB_WCACHE = 0x02, ADA_CCB_BUFFER_IO = 0x03, ADA_CCB_WAITING = 0x04, ADA_CCB_DUMP = 0x05, @@ -132,6 +134,7 @@ struct ada_softc { int outstanding_cmds; int trim_max_ranges; int trim_running; + int read_ahead; int write_cache; #ifdef ADA_TEST_FAILURE int force_read_error; @@ -294,10 +297,19 @@ static void adaresume(void *arg); #define ADA_DEFAULT_SPINDOWN_SUSPEND 1 #endif +#ifndef ADA_DEFAULT_READ_AHEAD +#define ADA_DEFAULT_READ_AHEAD 1 +#endif + #ifndef ADA_DEFAULT_WRITE_CACHE #define ADA_DEFAULT_WRITE_CACHE 1 #endif +#define ADA_RA (softc->read_ahead >= 0 ? \ + softc->read_ahead : ada_read_ahead) +#define ADA_WC (softc->write_cache >= 0 ? \ + softc->write_cache : ada_write_cache) + /* * Most platforms map firmware geometry to actual, but some don't. If * not overridden, default to nothing. @@ -312,6 +324,7 @@ static int ada_default_timeout = ADA_DEF static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED; static int ada_spindown_shutdown = ADA_DEFAULT_SPINDOWN_SHUTDOWN; static int ada_spindown_suspend = ADA_DEFAULT_SPINDOWN_SUSPEND; +static int ada_read_ahead = ADA_DEFAULT_READ_AHEAD; static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE; SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, @@ -334,6 +347,9 @@ TUNABLE_INT("kern.cam.ada.spindown_shutd SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_suspend, CTLFLAG_RW, &ada_spindown_suspend, 0, "Spin down upon suspend"); TUNABLE_INT("kern.cam.ada.spindown_suspend", &ada_spindown_suspend); +SYSCTL_INT(_kern_cam_ada, OID_AUTO, read_ahead, CTLFLAG_RW, + &ada_read_ahead, 0, "Enable disk read-ahead"); +TUNABLE_INT("kern.cam.ada.read_ahead", &ada_read_ahead); SYSCTL_INT(_kern_cam_ada, OID_AUTO, write_cache, CTLFLAG_RW, &ada_write_cache, 0, "Enable disk write cache"); TUNABLE_INT("kern.cam.ada.write_cache", &ada_write_cache); @@ -737,16 +753,19 @@ adaasync(void *callback_arg, u_int32_t c softc = (struct ada_softc *)periph->softc; cam_periph_async(periph, code, path, arg); - if (ada_write_cache < 0 && softc->write_cache < 0) - break; if (softc->state != ADA_STATE_NORMAL) break; xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); - if ((cgd.ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) == 0) - break; - softc->state = ADA_STATE_WCACHE; + if (ADA_RA >= 0 && + cgd.ident_data.support.command1 & ATA_SUPPORT_LOOKAHEAD) + softc->state = ADA_STATE_RAHEAD; + else if (ADA_WC >= 0 && + cgd.ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) + softc->state = ADA_STATE_WCACHE; + else + break; cam_periph_acquire(periph); cam_freeze_devq_arg(periph->path, RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); @@ -789,6 +808,9 @@ adasysctlinit(void *context, int pending } SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "read_ahead", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->read_ahead, 0, "Enable disk read ahead."); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->write_cache, 0, "Enable disk write cache."); #ifdef ADA_TEST_FAILURE @@ -922,6 +944,10 @@ adaregister(struct cam_periph *periph, v quirks = softc->quirks; TUNABLE_INT_FETCH(announce_buf, &quirks); softc->quirks = quirks; + softc->read_ahead = -1; + snprintf(announce_buf, sizeof(announce_buf), + "kern.cam.ada.%d.read_ahead", periph->unit_number); + TUNABLE_INT_FETCH(announce_buf, &softc->read_ahead); softc->write_cache = -1; snprintf(announce_buf, sizeof(announce_buf), "kern.cam.ada.%d.write_cache", periph->unit_number); @@ -1044,7 +1070,14 @@ adaregister(struct cam_periph *periph, v (ADA_DEFAULT_TIMEOUT * hz) / ADA_ORDEREDTAG_INTERVAL, adasendorderedtag, softc); - if ((ada_write_cache >= 0 || softc->write_cache >= 0) && + if (ADA_RA >= 0 && + cgd->ident_data.support.command1 & ATA_SUPPORT_LOOKAHEAD) { + softc->state = ADA_STATE_RAHEAD; + cam_periph_acquire(periph); + cam_freeze_devq_arg(periph->path, + RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); + xpt_schedule(periph, CAM_PRIORITY_DEV); + } else if (ADA_WC >= 0 && cgd->ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) { softc->state = ADA_STATE_WCACHE; cam_periph_acquire(periph); @@ -1317,8 +1350,19 @@ out: adaschedule(periph); break; } + case ADA_STATE_RAHEAD: case ADA_STATE_WCACHE: { + if (softc->flags & ADA_FLAG_PACK_INVALID) { + softc->state = ADA_STATE_NORMAL; + xpt_release_ccb(start_ccb); + cam_release_devq(periph->path, + RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); + adaschedule(periph); + cam_periph_release_locked(periph); + return; + } + cam_fill_ataio(ataio, 1, adadone, @@ -1328,10 +1372,15 @@ out: 0, ada_default_timeout*1000); - ata_28bit_cmd(ataio, ATA_SETFEATURES, (softc->write_cache > 0 || - (softc->write_cache < 0 && ada_write_cache)) ? - ATA_SF_ENAB_WCACHE : ATA_SF_DIS_WCACHE, 0, 0); - start_ccb->ccb_h.ccb_state = ADA_CCB_WCACHE; + if (softc->state == ADA_STATE_RAHEAD) { + ata_28bit_cmd(ataio, ATA_SETFEATURES, ADA_RA ? + ATA_SF_ENAB_RCACHE : ATA_SF_DIS_RCACHE, 0, 0); + start_ccb->ccb_h.ccb_state = ADA_CCB_RAHEAD; + } else { + ata_28bit_cmd(ataio, ATA_SETFEATURES, ADA_WC ? + ATA_SF_ENAB_WCACHE : ATA_SF_DIS_WCACHE, 0, 0); + start_ccb->ccb_h.ccb_state = ADA_CCB_WCACHE; + } xpt_action(start_ccb); break; } @@ -1343,6 +1392,7 @@ adadone(struct cam_periph *periph, union { struct ada_softc *softc; struct ccb_ataio *ataio; + struct ccb_getdev *cgd; softc = (struct ada_softc *)periph->softc; ataio = &done_ccb->ataio; @@ -1423,6 +1473,47 @@ adadone(struct cam_periph *periph, union biodone(bp); break; } + case ADA_CCB_RAHEAD: + { + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (adaerror(done_ccb, 0, 0) == ERESTART) { + return; + } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + } + } + + /* + * Since our peripheral may be invalidated by an error + * above or an external event, we must release our CCB + * before releasing the reference on the peripheral. + * The peripheral will only go away once the last reference + * is removed, and we need it around for the CCB release + * operation. + */ + cgd = (struct ccb_getdev *)done_ccb; + xpt_setup_ccb(&cgd->ccb_h, periph->path, CAM_PRIORITY_NORMAL); + cgd->ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)cgd); + if (ADA_WC >= 0 && + cgd->ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) { + softc->state = ADA_STATE_WCACHE; + xpt_release_ccb(done_ccb); + xpt_schedule(periph, CAM_PRIORITY_DEV); + return; + } + softc->state = ADA_STATE_NORMAL; + xpt_release_ccb(done_ccb); + cam_release_devq(periph->path, + RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); + adaschedule(periph); + cam_periph_release_locked(periph); + return; + } case ADA_CCB_WCACHE: { if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { From owner-svn-src-head@FreeBSD.ORG Fri Jul 29 20:35:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AB3E106566B; Fri, 29 Jul 2011 20:35:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FC7D8FC16; Fri, 29 Jul 2011 20:35: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 p6TKZOYM065132; Fri, 29 Jul 2011 20:35:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6TKZOtY065129; Fri, 29 Jul 2011 20:35:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201107292035.p6TKZOtY065129@svn.freebsd.org> From: Alexander Motin Date: Fri, 29 Jul 2011 20:35:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224498 - head/sys/dev/ahci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 20:35:24 -0000 Author: mav Date: Fri Jul 29 20:35:23 2011 New Revision: 224498 URL: http://svn.freebsd.org/changeset/base/224498 Log: In some cases, at least on Marvell 88SE912x controllers, Current Command Slot field of the PxCMD register may point to an empty command slot. That breaks command timeout detection logic, making impossible to find what command actually caused timeout, and leading to infinite wait. Workaround that by checking whether pointed command slot is really used and can timeout in its time. And if not, fallback to the dumb algorithm used with FBS -- let all commands to time out and then fail all of them. Approved by: re (kib) MFC after: 1 week Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Fri Jul 29 20:32:27 2011 (r224497) +++ head/sys/dev/ahci/ahci.c Fri Jul 29 20:35:23 2011 (r224498) @@ -1879,12 +1879,13 @@ ahci_execute_transaction(struct ahci_slo device_printf(dev, "Poll timeout on slot %d port %d\n", slot->slot, port); device_printf(dev, "is %08x cs %08x ss %08x " - "rs %08x tfd %02x serr %08x\n", + "rs %08x tfd %02x serr %08x cmd %08x\n", ATA_INL(ch->r_mem, AHCI_P_IS), ATA_INL(ch->r_mem, AHCI_P_CI), ATA_INL(ch->r_mem, AHCI_P_SACT), ch->rslots, ATA_INL(ch->r_mem, AHCI_P_TFD), - ATA_INL(ch->r_mem, AHCI_P_SERR)); + ATA_INL(ch->r_mem, AHCI_P_SERR), + ATA_INL(ch->r_mem, AHCI_P_CMD)); et = AHCI_ERR_TIMEOUT; } @@ -1960,8 +1961,12 @@ ahci_timeout(struct ahci_slot *slot) ccs = (ATA_INL(ch->r_mem, AHCI_P_CMD) & AHCI_P_CMD_CCS_MASK) >> AHCI_P_CMD_CCS_SHIFT; if ((sstatus & (1 << slot->slot)) != 0 || ccs == slot->slot || - ch->fbs_enabled) + ch->fbs_enabled || ch->wrongccs) slot->state = AHCI_SLOT_EXECUTING; + else if ((ch->rslots & (1 << ccs)) == 0) { + ch->wrongccs = 1; + slot->state = AHCI_SLOT_EXECUTING; + } callout_reset(&slot->timeout, (int)slot->ccb->ccb_h.timeout * hz / 2000, @@ -1971,10 +1976,12 @@ ahci_timeout(struct ahci_slot *slot) device_printf(dev, "Timeout on slot %d port %d\n", slot->slot, slot->ccb->ccb_h.target_id & 0x0f); - device_printf(dev, "is %08x cs %08x ss %08x rs %08x tfd %02x serr %08x\n", + device_printf(dev, "is %08x cs %08x ss %08x rs %08x tfd %02x " + "serr %08x cmd %08x\n", ATA_INL(ch->r_mem, AHCI_P_IS), ATA_INL(ch->r_mem, AHCI_P_CI), ATA_INL(ch->r_mem, AHCI_P_SACT), ch->rslots, - ATA_INL(ch->r_mem, AHCI_P_TFD), ATA_INL(ch->r_mem, AHCI_P_SERR)); + ATA_INL(ch->r_mem, AHCI_P_TFD), ATA_INL(ch->r_mem, AHCI_P_SERR), + ATA_INL(ch->r_mem, AHCI_P_CMD)); /* Handle frozen command. */ if (ch->frozen) { @@ -1987,7 +1994,7 @@ ahci_timeout(struct ahci_slot *slot) } xpt_done(fccb); } - if (!ch->fbs_enabled) { + if (!ch->fbs_enabled && !ch->wrongccs) { /* Without FBS we know real timeout source. */ ch->fatalerr = 1; /* Handle command with timeout. */ @@ -2585,6 +2592,7 @@ ahci_reset(device_t dev) xpt_release_simq(ch->sim, TRUE); ch->eslots = 0; ch->toslots = 0; + ch->wrongccs = 0; ch->fatalerr = 0; /* Tell the XPT about the event */ xpt_async(AC_BUS_RESET, ch->path, NULL); Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Fri Jul 29 20:32:27 2011 (r224497) +++ head/sys/dev/ahci/ahci.h Fri Jul 29 20:35:23 2011 (r224498) @@ -426,6 +426,7 @@ struct ahci_channel { int resetting; /* Hard-reset in progress. */ int resetpolldiv; /* Hard-reset poll divider. */ int listening; /* SUD bit is cleared. */ + int wrongccs; /* CCS field in CMD was wrong */ union ccb *frozen; /* Frozen command */ struct callout pm_timer; /* Power management events */ struct callout reset_timer; /* Hard-reset timeout */ From owner-svn-src-head@FreeBSD.ORG Fri Jul 29 20:38:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFBEA1065670; Fri, 29 Jul 2011 20:38:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5D5A8FC1E; Fri, 29 Jul 2011 20:38:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6TKc6Wv065244; Fri, 29 Jul 2011 20:38:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6TKc6S3065242; Fri, 29 Jul 2011 20:38:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201107292038.p6TKc6S3065242@svn.freebsd.org> From: Alexander Motin Date: Fri, 29 Jul 2011 20:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224499 - head/sys/dev/usb/input X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 20:38:07 -0000 Author: mav Date: Fri Jul 29 20:38:06 2011 New Revision: 224499 URL: http://svn.freebsd.org/changeset/base/224499 Log: Make ums(4) driver more picky, not attaching to "mouses" with absolute coordinates, such as digitizers and touch-screens, leaving these devices to uhid(4) and user-level. Specially patched xf86-input-mouse driver can handle them, that isn't done and can't be done properly with ums(4) because of mouse(4) protocol limitations. Approved by: re (kib) Modified: head/sys/dev/usb/input/ums.c Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Fri Jul 29 20:35:23 2011 (r224498) +++ head/sys/dev/usb/input/ums.c Fri Jul 29 20:38:06 2011 (r224499) @@ -367,7 +367,9 @@ ums_probe(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); void *d_ptr; - int error; + struct hid_data *hd; + struct hid_item hi; + int error, mdepth, found; uint16_t d_len; DPRINTFN(11, "\n"); @@ -388,14 +390,44 @@ ums_probe(device_t dev) if (error) return (ENXIO); - if (hid_is_collection(d_ptr, d_len, - HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE))) - error = BUS_PROBE_DEFAULT; - else - error = ENXIO; - + hd = hid_start_parse(d_ptr, d_len, 1 << hid_input); + if (hd == NULL) + return (0); + mdepth = 0; + found = 0; + while (hid_get_item(hd, &hi)) { + switch (hi.kind) { + case hid_collection: + if (mdepth != 0) + mdepth++; + else if (hi.collection == 1 && + hi.usage == + HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)) + mdepth++; + break; + case hid_endcollection: + if (mdepth != 0) + mdepth--; + break; + case hid_input: + if (mdepth == 0) + break; + if (hi.usage == + HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X) && + (hi.flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) + found++; + if (hi.usage == + HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y) && + (hi.flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) + found++; + break; + default: + break; + } + } + hid_end_parse(hd); free(d_ptr, M_TEMP); - return (error); + return (found ? BUS_PROBE_DEFAULT : ENXIO); } static void From owner-svn-src-head@FreeBSD.ORG Fri Jul 29 23:55:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBD9A106566B; Fri, 29 Jul 2011 23:55:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCB438FC13; Fri, 29 Jul 2011 23:55:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6TNtHIp071277; Fri, 29 Jul 2011 23:55:17 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6TNtHcA071275; Fri, 29 Jul 2011 23:55:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107292355.p6TNtHcA071275@svn.freebsd.org> From: Adrian Chadd Date: Fri, 29 Jul 2011 23:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224502 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 23:55:18 -0000 Author: adrian Date: Fri Jul 29 23:55:17 2011 New Revision: 224502 URL: http://svn.freebsd.org/changeset/base/224502 Log: Reset the NIC if ANI is enabled or disabled. Although this may not be what the original sysctl was designed to do, it feels a bit more "expected". Before, if ANI is disabled, the initial ANI parameters are still written to the hardware, even if they're not enabled. "ANI enabled" would then adjust the noise immunity parameters dynamically. Disabling ANI would simply leave the existing noise immunity parameters where they are, and disable the dynamic part. The problem is that disabling ANI doesn't leave the hardware in a consistent, predictable state - so asking a user to disable ANI wouldn't actually reset the NIC to a consistent set of PHY signal detection parameters, resulting in an unpredictable/unreliable outcome. This makes it difficult to get reliable debugging information from the user. Approved by: re (kib) Modified: head/sys/dev/ath/if_ath_sysctl.c Modified: head/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- head/sys/dev/ath/if_ath_sysctl.c Fri Jul 29 22:11:05 2011 (r224501) +++ head/sys/dev/ath/if_ath_sysctl.c Fri Jul 29 23:55:17 2011 (r224502) @@ -354,7 +354,21 @@ ath_sysctl_intmit(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &intmit, 0, req); if (error || !req->newptr) return error; - return !ath_hal_setintmit(sc->sc_ah, intmit) ? EINVAL : 0; + + /* reusing error; 1 here means "good"; 0 means "fail" */ + error = ath_hal_setintmit(sc->sc_ah, intmit); + if (! error) + return EINVAL; + + /* + * Reset the hardware here - disabling ANI in the HAL + * doesn't reset ANI related registers, so it'll leave + * things in an inconsistent state. + */ + if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) + ath_reset(sc->sc_ifp); + + return 0; } #ifdef IEEE80211_SUPPORT_TDMA From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 00:43:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD895106566C; Sat, 30 Jul 2011 00:43:18 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD1538FC08; Sat, 30 Jul 2011 00:43: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 p6U0hIuG072670; Sat, 30 Jul 2011 00:43:18 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6U0hIq3072663; Sat, 30 Jul 2011 00:43:18 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201107300043.p6U0hIq3072663@svn.freebsd.org> From: Kirk McKusick Date: Sat, 30 Jul 2011 00:43:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224503 - in head: sbin/mount sys/ufs/ffs sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 00:43:19 -0000 Author: mckusick Date: Sat Jul 30 00:43:18 2011 New Revision: 224503 URL: http://svn.freebsd.org/changeset/base/224503 Log: Update to -r224294 to ensure that only one of MNT_SUJ or MNT_SOFTDEP is set so that mount can revert back to using MNT_NOWAIT when doing getmntinfo. Approved by: re (kib) Modified: head/sbin/mount/mount.c head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/ffs_vnops.c head/sys/ufs/ufs/inode.h Modified: head/sbin/mount/mount.c ============================================================================== --- head/sbin/mount/mount.c Fri Jul 29 23:55:17 2011 (r224502) +++ head/sbin/mount/mount.c Sat Jul 30 00:43:18 2011 (r224503) @@ -317,7 +317,7 @@ main(int argc, char *argv[]) rval = 0; switch (argc) { case 0: - if ((mntsize = getmntinfo(&mntbuf, MNT_WAIT)) == 0) + if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) err(1, "getmntinfo"); if (all) { while ((fs = getfsent()) != NULL) { @@ -666,7 +666,7 @@ getmntpt(const char *name) struct statfs *mntbuf; int i, mntsize; - mntsize = getmntinfo(&mntbuf, MNT_WAIT); + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); for (i = mntsize - 1; i >= 0; i--) { if (strcmp(mntbuf[i].f_mntfromname, name) == 0 || strcmp(mntbuf[i].f_mntonname, name) == 0) Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Fri Jul 29 23:55:17 2011 (r224502) +++ head/sys/ufs/ffs/ffs_alloc.c Sat Jul 30 00:43:18 2011 (r224503) @@ -1967,7 +1967,7 @@ ffs_blkfree_cg(ump, fs, devvp, bno, size ACTIVECLEAR(fs, cg); UFS_UNLOCK(ump); mp = UFSTOVFS(ump); - if (mp->mnt_flag & MNT_SOFTDEP && devvp->v_type != VREG) + if (MOUNTEDSOFTDEP(mp) && devvp->v_type != VREG) softdep_setup_blkfree(UFSTOVFS(ump), bp, bno, numfrags(fs, size), dephd); bdwrite(bp); @@ -2217,7 +2217,7 @@ ffs_freefile(ump, fs, devvp, ino, mode, fs->fs_fmod = 1; ACTIVECLEAR(fs, cg); UFS_UNLOCK(ump); - if (UFSTOVFS(ump)->mnt_flag & MNT_SOFTDEP && devvp->v_type != VREG) + if (MOUNTEDSOFTDEP(UFSTOVFS(ump)) && devvp->v_type != VREG) softdep_setup_inofree(UFSTOVFS(ump), bp, ino + cg * fs->fs_ipg, wkhd); bdwrite(bp); Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri Jul 29 23:55:17 2011 (r224502) +++ head/sys/ufs/ffs/ffs_softdep.c Sat Jul 30 00:43:18 2011 (r224503) @@ -1364,7 +1364,7 @@ softdep_flush(void) mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { nmp = TAILQ_NEXT(mp, mnt_list); - if ((mp->mnt_flag & MNT_SOFTDEP) == 0) + if (MOUNTEDSOFTDEP(mp) == 0) continue; if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) continue; @@ -2423,7 +2423,7 @@ softdep_unmount(mp) MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_SOFTDEP; - if ((mp->mnt_flag & MNT_SUJ) == 0) { + if (MOUNTEDSUJ(mp) == 0) { MNT_IUNLOCK(mp); return; } @@ -2638,6 +2638,7 @@ out: if (error == 0) { MNT_ILOCK(mp); mp->mnt_flag |= MNT_SUJ; + mp->mnt_flag &= ~MNT_SOFTDEP; MNT_IUNLOCK(mp); /* * Only validate the journal contents if the @@ -3060,7 +3061,7 @@ softdep_flushjournal(mp) struct jblocks *jblocks; struct ufsmount *ump; - if ((mp->mnt_flag & MNT_SUJ) == 0) + if (MOUNTEDSUJ(mp) == 0) return; ump = VFSTOUFS(mp); jblocks = ump->softdep_jblocks; @@ -3096,7 +3097,7 @@ softdep_process_journal(mp, needwk, flag int off; int devbsize; - if ((mp->mnt_flag & MNT_SUJ) == 0) + if (MOUNTEDSUJ(mp) == 0) return; ump = VFSTOUFS(mp); fs = ump->um_fs; @@ -3827,8 +3828,8 @@ newfreework(ump, freeblks, parent, lbn, freework->fw_blkno = nb; freework->fw_frags = frags; freework->fw_indir = NULL; - freework->fw_ref = ((UFSTOVFS(ump)->mnt_flag & MNT_SUJ) == 0 || - lbn >= -NXADDR) ? 0 : NINDIR(ump->um_fs) + 1; + freework->fw_ref = (MOUNTEDSUJ(UFSTOVFS(ump)) == 0 || lbn >= -NXADDR) + ? 0 : NINDIR(ump->um_fs) + 1; freework->fw_start = freework->fw_off = off; if (journal) newjfreeblk(freeblks, lbn, nb, frags); @@ -4681,7 +4682,7 @@ softdep_setup_inomapdep(bp, ip, newinum, * Allocate the journal reference add structure so that the bitmap * can be dependent on it. */ - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { jaddref = newjaddref(ip, newinum, 0, 0, mode); jaddref->ja_state |= NEWBLOCK; } @@ -4734,7 +4735,7 @@ softdep_setup_blkmapdep(bp, mp, newblkno * Add it to the dependency list for the buffer holding * the cylinder group map from which it was allocated. */ - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { jnewblk = malloc(sizeof(*jnewblk), M_JNEWBLK, M_SOFTDEP_FLAGS); workitem_alloc(&jnewblk->jn_list, D_JNEWBLK, mp); jnewblk->jn_jsegdep = newjsegdep(&jnewblk->jn_list); @@ -5199,7 +5200,7 @@ newfreefrag(ip, blkno, size, lbn) freefrag->ff_blkno = blkno; freefrag->ff_fragsize = size; - if ((ip->i_ump->um_mountp->mnt_flag & MNT_SUJ) != 0) { + if (MOUNTEDSUJ(UFSTOVFS(ip->i_ump))) { freefrag->ff_jdep = (struct worklist *) newjfreefrag(freefrag, ip, blkno, size, lbn); } else { @@ -7254,7 +7255,7 @@ freework_freeblock(freework) freeblks = freework->fw_freeblks; ump = VFSTOUFS(freeblks->fb_list.wk_mp); fs = ump->um_fs; - needj = (freeblks->fb_list.wk_mp->mnt_flag & MNT_SUJ) != 0; + needj = MOUNTEDSUJ(freeblks->fb_list.wk_mp) != 0; bsize = lfragtosize(fs, freework->fw_frags); LIST_INIT(&wkhd); /* @@ -7674,7 +7675,7 @@ indir_trunc(freework, dbn, lbn) ufs1fmt = 0; } level = lbn_level(lbn); - needj = (UFSTOVFS(ump)->mnt_flag & MNT_SUJ) != 0; + needj = MOUNTEDSUJ(UFSTOVFS(ump)) != 0; lbnadd = lbn_offset(fs, level); nblocks = btodb(fs->fs_bsize); nfreework = freework; @@ -7860,7 +7861,7 @@ setup_newdir(dap, newinum, dinum, newdir mkdir2->md_state = ATTACHED | MKDIR_PARENT; mkdir2->md_diradd = dap; mkdir2->md_jaddref = NULL; - if ((mp->mnt_flag & MNT_SUJ) == 0) { + if (MOUNTEDSUJ(mp) == 0) { mkdir1->md_state |= DEPCOMPLETE; mkdir2->md_state |= DEPCOMPLETE; } @@ -7900,7 +7901,7 @@ setup_newdir(dap, newinum, dinum, newdir * been satisfied and mkdir2 can be freed. */ inodedep_lookup(mp, dinum, 0, &inodedep); - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { if (inodedep == NULL) panic("setup_newdir: Lost parent."); jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, @@ -8031,7 +8032,7 @@ softdep_setup_directory_add(bp, dp, diro * written place it on the bufwait list, otherwise do the post-inode * write processing to put it on the id_pendinghd list. */ - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, inoreflst); KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number, @@ -8047,7 +8048,7 @@ softdep_setup_directory_add(bp, dp, diro * Add the journal entries for . and .. links now that the primary * link is written. */ - if (mkdir1 != NULL && (mp->mnt_flag & MNT_SUJ)) { + if (mkdir1 != NULL && MOUNTEDSUJ(mp)) { jaddref = (struct jaddref *)TAILQ_PREV(&jaddref->ja_ref, inoreflst, if_deps); KASSERT(jaddref != NULL && @@ -8144,7 +8145,7 @@ softdep_change_directoryentry_offset(bp, * determine if any affected adds or removes are present in the * journal. */ - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { flags = DEPALLOC; jmvref = newjmvref(dp, de->d_ino, dp->i_offset + (oldloc - base), @@ -8865,7 +8866,7 @@ softdep_setup_directory_change(bp, dp, i * processing to put it on the id_pendinghd list. */ inodedep_lookup(mp, newinum, DEPALLOC, &inodedep); - if (mp->mnt_flag & MNT_SUJ) { + if (MOUNTEDSUJ(mp)) { jaddref = (struct jaddref *)TAILQ_LAST(&inodedep->id_inoreflst, inoreflst); KASSERT(jaddref != NULL && jaddref->ja_parent == dp->i_number, @@ -8928,7 +8929,7 @@ softdep_setup_sbupdate(ump, fs, bp) struct sbdep *sbdep; struct worklist *wk; - if ((ump->um_mountp->mnt_flag & MNT_SUJ) == 0) + if (MOUNTEDSUJ(UFSTOVFS(ump)) == 0) return; LIST_FOREACH(wk, &bp->b_dep, wk_list) if (wk->wk_type == D_SBDEP) @@ -9046,7 +9047,7 @@ unlinked_inodedep(mp, inodedep) { struct ufsmount *ump; - if ((mp->mnt_flag & MNT_SUJ) == 0) + if (MOUNTEDSUJ(mp) == 0) return; ump = VFSTOUFS(mp); ump->um_fs->fs_fmod = 1; Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Fri Jul 29 23:55:17 2011 (r224502) +++ head/sys/ufs/ffs/ffs_vfsops.c Sat Jul 30 00:43:18 2011 (r224503) @@ -281,7 +281,7 @@ ffs_mount(struct mount *mp) flags = WRITECLOSE; if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; - if (mp->mnt_flag & MNT_SOFTDEP) { + if (MOUNTEDSOFTDEP(mp)) { error = softdep_flushfiles(mp, flags, td); } else { error = ffs_flushfiles(mp, flags, td); @@ -307,7 +307,7 @@ ffs_mount(struct mount *mp) vfs_write_resume(mp); return (error); } - if (mp->mnt_flag & MNT_SOFTDEP) + if (MOUNTEDSOFTDEP(mp)) softdep_unmount(mp); DROP_GIANT(); g_topology_lock(); @@ -411,7 +411,7 @@ ffs_mount(struct mount *mp) * Softdep_mount() clears it in an initial mount * or ro->rw remount. */ - if (mp->mnt_flag & MNT_SOFTDEP) { + if (MOUNTEDSOFTDEP(mp)) { /* XXX: Reset too late ? */ MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_ASYNC; @@ -443,7 +443,7 @@ ffs_mount(struct mount *mp) fs->fs_fsmnt); return (EINVAL); } - KASSERT((mp->mnt_flag & MNT_SOFTDEP) == 0, + KASSERT(MOUNTEDSOFTDEP(mp) == 0, ("soft updates enabled on read-only file system")); DROP_GIANT(); g_topology_lock(); @@ -530,7 +530,7 @@ ffs_mount(struct mount *mp) return (error); } if (fsckpid > 0) { - KASSERT((mp->mnt_flag & MNT_SOFTDEP) == 0, + KASSERT(MOUNTEDSOFTDEP(mp) == 0, ("soft updates enabled on read-only file system")); ump = VFSTOUFS(mp); fs = ump->um_fs; @@ -1247,7 +1247,7 @@ ffs_unmount(mp, mntflags) vn_start_write(NULL, &mp, V_WAIT); } } - if (mp->mnt_flag & MNT_SOFTDEP) + if (MOUNTEDSOFTDEP(mp)) error = softdep_flushfiles(mp, flags, td); else error = ffs_flushfiles(mp, flags, td); @@ -1389,9 +1389,6 @@ ffs_statfs(mp, sbp) fs = ump->um_fs; if (fs->fs_magic != FS_UFS1_MAGIC && fs->fs_magic != FS_UFS2_MAGIC) panic("ffs_statfs"); - /* Don't export MNT_SOFTDEP when MNT_SUJ is in use */ - if ((sbp->f_flags & (MNT_SOFTDEP | MNT_SUJ)) == (MNT_SOFTDEP | MNT_SUJ)) - sbp->f_flags &= ~MNT_SOFTDEP; sbp->f_version = STATFS_VERSION; sbp->f_bsize = fs->fs_fsize; sbp->f_iosize = fs->fs_bsize; Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Fri Jul 29 23:55:17 2011 (r224502) +++ head/sys/ufs/ffs/ffs_vnops.c Sat Jul 30 00:43:18 2011 (r224503) @@ -187,8 +187,7 @@ retry: error = ffs_syncvnode(vp, ap->a_waitfor); if (error) return (error); - if (ap->a_waitfor == MNT_WAIT && - (vp->v_mount->mnt_flag & MNT_SOFTDEP)) { + if (ap->a_waitfor == MNT_WAIT && DOINGSOFTDEP(vp)) { error = softdep_fsync(vp); if (error) return (error); Modified: head/sys/ufs/ufs/inode.h ============================================================================== --- head/sys/ufs/ufs/inode.h Fri Jul 29 23:55:17 2011 (r224502) +++ head/sys/ufs/ufs/inode.h Sat Jul 30 00:43:18 2011 (r224503) @@ -174,9 +174,11 @@ struct indir { #define ITOV(ip) ((ip)->i_vnode) /* Determine if soft dependencies are being done */ -#define DOINGSOFTDEP(vp) ((vp)->v_mount->mnt_flag & MNT_SOFTDEP) -#define DOINGASYNC(vp) ((vp)->v_mount->mnt_kern_flag & MNTK_ASYNC) -#define DOINGSUJ(vp) ((vp)->v_mount->mnt_flag & MNT_SUJ) +#define DOINGSOFTDEP(vp) ((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) +#define MOUNTEDSOFTDEP(mp) ((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) +#define DOINGASYNC(vp) ((vp)->v_mount->mnt_kern_flag & MNTK_ASYNC) +#define DOINGSUJ(vp) ((vp)->v_mount->mnt_flag & MNT_SUJ) +#define MOUNTEDSUJ(mp) ((mp)->mnt_flag & MNT_SUJ) /* This overlays the fid structure (see mount.h). */ struct ufid { From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 00:51:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F581106564A; Sat, 30 Jul 2011 00:51:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA99B8FC08; Sat, 30 Jul 2011 00:51:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6U0pa4T073014; Sat, 30 Jul 2011 00:51:36 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6U0paFj073011; Sat, 30 Jul 2011 00:51:36 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201107300051.p6U0paFj073011@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 30 Jul 2011 00:51:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224504 - in head/release: amd64 i386 powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 00:51:37 -0000 Author: nwhitehorn Date: Sat Jul 30 00:51:36 2011 New Revision: 224504 URL: http://svn.freebsd.org/changeset/base/224504 Log: Mount memsticks read-only by default to prevent them being filled by user modifications and subsequently preventing a functioning installation. Approved by: re (kib) Modified: head/release/amd64/make-memstick.sh head/release/i386/make-memstick.sh head/release/powerpc/make-memstick.sh Modified: head/release/amd64/make-memstick.sh ============================================================================== --- head/release/amd64/make-memstick.sh Sat Jul 30 00:43:18 2011 (r224503) +++ head/release/amd64/make-memstick.sh Sat Jul 30 00:51:36 2011 (r224504) @@ -32,7 +32,7 @@ if [ -e ${2} ]; then exit 1 fi -echo '/dev/gpt/FreeBSD_Install / ufs rw,noatime 1 1' > ${1}/etc/fstab +echo '/dev/gpt/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab rm -f ${tempfile} makefs -B little ${tempfile} ${1} if [ $? -ne 0 ]; then Modified: head/release/i386/make-memstick.sh ============================================================================== --- head/release/i386/make-memstick.sh Sat Jul 30 00:43:18 2011 (r224503) +++ head/release/i386/make-memstick.sh Sat Jul 30 00:51:36 2011 (r224504) @@ -32,7 +32,7 @@ if [ -e ${2} ]; then exit 1 fi -echo '/dev/gpt/FreeBSD_Install / ufs rw,noatime 1 1' > ${1}/etc/fstab +echo '/dev/gpt/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab rm -f ${tempfile} makefs -B little ${tempfile} ${1} if [ $? -ne 0 ]; then Modified: head/release/powerpc/make-memstick.sh ============================================================================== --- head/release/powerpc/make-memstick.sh Sat Jul 30 00:43:18 2011 (r224503) +++ head/release/powerpc/make-memstick.sh Sat Jul 30 00:51:36 2011 (r224504) @@ -32,7 +32,7 @@ if [ -e ${2} ]; then exit 1 fi -echo '/dev/da0s3 / ufs rw,noatime 1 1' > ${1}/etc/fstab +echo '/dev/da0s3 / ufs ro,noatime 1 1' > ${1}/etc/fstab rm -f ${tempfile} makefs -B big ${tempfile} ${1} if [ $? -ne 0 ]; then From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 00:52:13 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C013106566B; Sat, 30 Jul 2011 00:52:13 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C7118FC13; Sat, 30 Jul 2011 00:52: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 p6U0qDnX073072; Sat, 30 Jul 2011 00:52:13 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6U0qDVU073070; Sat, 30 Jul 2011 00:52:13 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201107300052.p6U0qDVU073070@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 30 Jul 2011 00:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224505 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 00:52:13 -0000 Author: nwhitehorn Date: Sat Jul 30 00:52:13 2011 New Revision: 224505 URL: http://svn.freebsd.org/changeset/base/224505 Log: Fix an error that could cause sysctl -a to enter an infinite loop in the event of a broken or busy fan due to returning incorrect error codes from the FCU sysctl handler. Reported by: Path Mather 1 Approved by: re (kib) Modified: head/sys/powerpc/powermac/fcu.c Modified: head/sys/powerpc/powermac/fcu.c ============================================================================== --- head/sys/powerpc/powermac/fcu.c Sat Jul 30 00:51:36 2011 (r224504) +++ head/sys/powerpc/powermac/fcu.c Sat Jul 30 00:52:13 2011 (r224505) @@ -282,14 +282,14 @@ fcu_fan_set_rpm(struct fcu_fan *fan, int fan->setpoint = rpm; } else { device_printf(fan->dev, "Unknown fan type: %d\n", fan->type); - return (-1); + return (ENXIO); } buf[0] = rpm >> (8 - fcu_rpm_shift); buf[1] = rpm << fcu_rpm_shift; if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2) < 0) - return (-1); + return (EIO); return (0); } @@ -377,7 +377,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int buf[0] = (pwm * 2550) / 1000; if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1) < 0) - return (-1); + return (EIO); return (0); } @@ -536,12 +536,12 @@ fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS) if (fan->type == FCU_FAN_RPM) { rpm = fcu_fan_get_rpm(fan); if (rpm < 0) - return (-1); + return (EIO); error = sysctl_handle_int(oidp, &rpm, 0, req); } else { error = fcu_fan_get_pwm(fcu, fan, &pwm, &rpm); if (error < 0) - return (-1); + return (EIO); switch (arg2 & 0xff00) { case FCU_PWM_SYSCTL_PWM: @@ -552,7 +552,7 @@ fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS) break; default: /* This should never happen */ - error = -1; + return (EINVAL); }; } From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 01:06:12 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A11BB1065674; Sat, 30 Jul 2011 01:06:12 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91F1B8FC16; Sat, 30 Jul 2011 01:06: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 p6U16ChJ073515; Sat, 30 Jul 2011 01:06:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6U16C17073512; Sat, 30 Jul 2011 01:06:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201107300106.p6U16C17073512@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 30 Jul 2011 01:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224506 - in head/sys: dev/re pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 01:06:12 -0000 Author: yongari Date: Sat Jul 30 01:06:12 2011 New Revision: 224506 URL: http://svn.freebsd.org/changeset/base/224506 Log: Add new device id of D-Link DGE-530T Rev. C controller. DGE-503T Rev A1 and B1 is supported by sk(4) but the DGE-530T Rev. C controller is re-branded RealTek 8169 controller. PR: kern/159116 Approved by: re (kib) Modified: head/sys/dev/re/if_re.c head/sys/pci/if_rlreg.h Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Sat Jul 30 00:52:13 2011 (r224505) +++ head/sys/dev/re/if_re.c Sat Jul 30 01:06:12 2011 (r224506) @@ -174,6 +174,8 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe static struct rl_type re_devs[] = { { DLINK_VENDORID, DLINK_DEVICEID_528T, 0, "D-Link DGE-528(T) Gigabit Ethernet Adapter" }, + { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0, + "D-Link DGE-530(T) Gigabit Ethernet Adapter" }, { RT_VENDORID, RT_DEVICEID_8139, 0, "RealTek 8139C+ 10/100BaseTX" }, { RT_VENDORID, RT_DEVICEID_8101E, 0, Modified: head/sys/pci/if_rlreg.h ============================================================================== --- head/sys/pci/if_rlreg.h Sat Jul 30 00:52:13 2011 (r224505) +++ head/sys/pci/if_rlreg.h Sat Jul 30 01:06:12 2011 (r224506) @@ -1042,6 +1042,7 @@ struct rl_softc { * D-Link DFE-5280T device ID */ #define DLINK_DEVICEID_528T 0x4300 +#define DLINK_DEVICEID_530T_REVC 0x4302 /* * D-Link DFE-690TXD device ID From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:18:48 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD75B106566B; Sat, 30 Jul 2011 13:18:48 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92A628FC0A; Sat, 30 Jul 2011 13:18:48 +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 p6UDImEF001242; Sat, 30 Jul 2011 13:18:48 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDImm1001240; Sat, 30 Jul 2011 13:18:48 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107301318.p6UDImm1001240@svn.freebsd.org> From: Adrian Chadd Date: Sat, 30 Jul 2011 13:18:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224509 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 13:18:48 -0000 Author: adrian Date: Sat Jul 30 13:18:48 2011 New Revision: 224509 URL: http://svn.freebsd.org/changeset/base/224509 Log: Fix the AR9280 initial AGC calibration code. It looks like this was mixed up with the AR9285 calibration code. This code is now more in line with what Linux ath9k and Atheros reference drivers do. Obtained from: Atheros Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Sat Jul 30 09:38:52 2011 (r224508) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Sat Jul 30 13:18:48 2011 (r224509) @@ -186,36 +186,22 @@ ar5416RunInitCals(struct ath_hal *ah, in } #endif + +/* + * AGC calibration for the AR5416, AR9130, AR9160, AR9280. + */ HAL_BOOL ar5416InitCalHardware(struct ath_hal *ah, const struct ieee80211_channel *chan) { - if (AR_SREV_MERLIN_10_OR_LATER(ah)) { - /* Enable Rx Filter Cal */ - OS_REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); - OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_FLTR_CAL); - - /* Clear the carrier leak cal bit */ - OS_REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE); - /* kick off the cal */ - OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL); - - /* Poll for offset calibration complete */ - if (!ath_hal_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL, 0)) { - HALDEBUG(ah, HAL_DEBUG_ANY, - "%s: offset calibration failed to complete in 1ms; " - "noisy environment?\n", __func__); - return AH_FALSE; - } + if (AR_SREV_MERLIN_10_OR_LATER(ah)) { + /* Disable ADC */ + OS_REG_CLR_BIT(ah, AR_PHY_ADC_CTL, + AR_PHY_ADC_CTL_OFF_PWDADC); - /* Set the cl cal bit and rerun the cal a 2nd time */ /* Enable Rx Filter Cal */ - OS_REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL); - - OS_REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE); } /* Calibrate the AGC */ @@ -229,6 +215,16 @@ ar5416InitCalHardware(struct ath_hal *ah return AH_FALSE; } + if (AR_SREV_MERLIN_10_OR_LATER(ah)) { + /* Enable ADC */ + OS_REG_SET_BIT(ah, AR_PHY_ADC_CTL, + AR_PHY_ADC_CTL_OFF_PWDADC); + + /* Disable Rx Filter Cal */ + OS_REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, + AR_PHY_AGC_CONTROL_FLTR_CAL); + } + return AH_TRUE; } @@ -247,7 +243,8 @@ ar5416InitCal(struct ath_hal *ah, const /* Do initial chipset-specific calibration */ if (! AH5416(ah)->ah_cal_initcal(ah, chan)) { - HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial chipset calibration did " + HALDEBUG(ah, HAL_DEBUG_ANY, + "%s: initial chipset calibration did " "not complete in time; noisy environment?\n", __func__); return AH_FALSE; } From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:21:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBEB8106564A; Sat, 30 Jul 2011 13:21:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB0198FC16; Sat, 30 Jul 2011 13:21: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 p6UDLXlP001364; Sat, 30 Jul 2011 13:21:33 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDLXZ2001362; Sat, 30 Jul 2011 13:21:33 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107301321.p6UDLXZ2001362@svn.freebsd.org> From: Adrian Chadd Date: Sat, 30 Jul 2011 13:21:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224510 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 13:21:34 -0000 Author: adrian Date: Sat Jul 30 13:21:33 2011 New Revision: 224510 URL: http://svn.freebsd.org/changeset/base/224510 Log: I noticed that the Merlin NICs I had (AR9220, AR9280) never completed the ADC calibrations if the NIC is in 5ghz 11a or 5ghz HT/20 modes. I've been told that the dual-ADC is only engaged in turbo/40mhz modes. Since Sowl (AR9160) seems to return valid-looking calibration data in 5ghz 20MHz modes, I'm only disabling it for Merlin for now. It may turn out I can disable it for all chipsets and only enable it for 40MHz modes. Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Sat Jul 30 13:18:48 2011 (r224509) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Sat Jul 30 13:21:33 2011 (r224510) @@ -73,8 +73,15 @@ ar5416IsCalSupp(struct ath_hal *ah, cons case ADC_GAIN_CAL: case ADC_DC_CAL: /* Run ADC Gain Cal for either 5ghz any or 2ghz HT40 */ - if (IEEE80211_IS_CHAN_5GHZ(chan)) - return AH_TRUE; + /* + * Merlin (AR9280) doesn't ever complete ADC calibrations + * in 5ghz non-HT40 mode (ie, HT20, 11a). For now, disable + * it for Merlin only until further information is + * available. + */ + if (! AR_SREV_MERLIN(ah)) + if (IEEE80211_IS_CHAN_5GHZ(chan)) + return AH_TRUE; if (IEEE80211_IS_CHAN_HT40(chan)) return AH_TRUE; return AH_FALSE; From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:22:44 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 786EA106566B; Sat, 30 Jul 2011 13:22:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 661798FC0A; Sat, 30 Jul 2011 13:22:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6UDMioF001446; Sat, 30 Jul 2011 13:22:44 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDMicQ001442; Sat, 30 Jul 2011 13:22:44 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201107301322.p6UDMicQ001442@svn.freebsd.org> From: Alexander Motin Date: Sat, 30 Jul 2011 13:22:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224511 - in head: lib/libusbhid usr.bin/usbhidaction usr.bin/usbhidctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 13:22:44 -0000 Author: mav Date: Sat Jul 30 13:22:44 2011 New Revision: 224511 URL: http://svn.freebsd.org/changeset/base/224511 Log: MFprojects/hid: - Fix usbhidctl and usbhidaction to handle HID devices with multiple report ids, such as multimedia keyboards. - Add collection type and report id to the `usbhidctl -r` output. They are important for proper device understanding and debugging. - Fix usbhidaction tool to properly handle items having report_count more then 1. Approved by: re (kib) MFC after: 2 weeks Modified: head/lib/libusbhid/parse.c head/usr.bin/usbhidaction/usbhidaction.c head/usr.bin/usbhidctl/usbhid.c Modified: head/lib/libusbhid/parse.c ============================================================================== --- head/lib/libusbhid/parse.c Sat Jul 30 13:21:33 2011 (r224510) +++ head/lib/libusbhid/parse.c Sat Jul 30 13:22:44 2011 (r224511) @@ -322,6 +322,8 @@ hid_get_item(hid_data_t s, hid_item_t *h * one and one item: */ c->report_count = 1; + c->usage_minimum = 0; + c->usage_maximum = 0; } else { s->ncount = 1; } @@ -512,13 +514,14 @@ hid_report_size(report_desc_t r, enum hi uint32_t temp; uint32_t hpos; uint32_t lpos; + int report_id = 0; hpos = 0; lpos = 0xFFFFFFFF; memset(&h, 0, sizeof h); for (d = hid_start_parse(r, 1 << k, id); hid_get_item(d, &h); ) { - if (h.report_ID == id && h.kind == k) { + if ((h.report_ID == id || id < 0) && h.kind == k) { /* compute minimum */ if (lpos > h.pos) lpos = h.pos; @@ -527,6 +530,8 @@ hid_report_size(report_desc_t r, enum hi /* compute maximum */ if (hpos < temp) hpos = temp; + if (h.report_ID != 0) + report_id = 1; } } hid_end_parse(d); @@ -537,11 +542,8 @@ hid_report_size(report_desc_t r, enum hi else temp = hpos - lpos; - if (id) - temp += 8; - /* return length in bytes rounded up */ - return ((temp + 7) / 8); + return ((temp + 7) / 8 + report_id); } int Modified: head/usr.bin/usbhidaction/usbhidaction.c ============================================================================== --- head/usr.bin/usbhidaction/usbhidaction.c Sat Jul 30 13:21:33 2011 (r224510) +++ head/usr.bin/usbhidaction/usbhidaction.c Sat Jul 30 13:22:44 2011 (r224511) @@ -92,12 +92,12 @@ main(int argc, char **argv) char buf[100]; char devnamebuf[PATH_MAX]; struct command *cmd; - int reportid; + int reportid = -1; demon = 1; ignore = 0; dieearly = 0; - while ((ch = getopt(argc, argv, "c:def:ip:t:v")) != -1) { + while ((ch = getopt(argc, argv, "c:def:ip:r:t:v")) != -1) { switch(ch) { case 'c': conf = optarg; @@ -117,6 +117,9 @@ main(int argc, char **argv) case 'p': pidfile = optarg; break; + case 'r': + reportid = atoi(optarg); + break; case 't': table = optarg; break; @@ -146,14 +149,13 @@ main(int argc, char **argv) fd = open(dev, O_RDWR); if (fd < 0) err(1, "%s", dev); - reportid = hid_get_report_id(fd); repd = hid_get_report_desc(fd); if (repd == NULL) err(1, "hid_get_report_desc() failed"); commands = parse_conf(conf, repd, reportid, ignore); - sz = (size_t)hid_report_size(repd, hid_input, reportid); + sz = (size_t)hid_report_size(repd, hid_input, -1); if (verbose) printf("report size %zu\n", sz); @@ -198,7 +200,23 @@ main(int argc, char **argv) } #endif for (cmd = commands; cmd; cmd = cmd->next) { - val = hid_get_data(buf, &cmd->item); + if (cmd->item.report_ID != 0 && + buf[0] != cmd->item.report_ID) + continue; + if (cmd->item.flags & HIO_VARIABLE) + val = hid_get_data(buf, &cmd->item); + else { + uint32_t pos = cmd->item.pos; + for (i = 0; i < cmd->item.report_count; i++) { + val = hid_get_data(buf, &cmd->item); + if (val == cmd->value) + break; + cmd->item.pos += cmd->item.report_size; + } + cmd->item.pos = pos; + val = (i < cmd->item.report_count) ? + cmd->value : -1; + } if (cmd->value != val && cmd->anyvalue == 0) goto next; if ((cmd->debounce == 0) || Modified: head/usr.bin/usbhidctl/usbhid.c ============================================================================== --- head/usr.bin/usbhidctl/usbhid.c Sat Jul 30 13:21:33 2011 (r224510) +++ head/usr.bin/usbhidctl/usbhid.c Sat Jul 30 13:22:44 2011 (r224511) @@ -46,7 +46,6 @@ int verbose = 0; int all = 0; int noname = 0; int hexdump = 0; -static int reportid; char **names; int nnames; @@ -101,11 +100,12 @@ dumpitem(const char *label, struct hid_i { if ((h->flags & HIO_CONST) && !verbose) return; - printf("%s size=%d count=%d page=%s usage=%s%s", label, - h->report_size, h->report_count, + printf("%s rid=%d size=%d count=%d page=%s usage=%s%s%s", label, + h->report_ID, h->report_size, h->report_count, hid_usage_page(HID_PAGE(h->usage)), hid_usage_in_page(h->usage), - h->flags & HIO_CONST ? " Const" : ""); + h->flags & HIO_CONST ? " Const" : "", + h->flags & HIO_VARIABLE ? "" : " Array"); printf(", logical range %d..%d", h->logical_minimum, h->logical_maximum); if (h->physical_minimum != h->physical_maximum) @@ -116,6 +116,24 @@ dumpitem(const char *label, struct hid_i printf("\n"); } +static const char * +hid_collection_type(int32_t type) +{ + static char num[8]; + + switch (type) { + case 0: return ("Physical"); + case 1: return ("Application"); + case 2: return ("Logical"); + case 3: return ("Report"); + case 4: return ("Named_Array"); + case 5: return ("Usage_Switch"); + case 6: return ("Usage_Modifier"); + } + snprintf(num, sizeof(num), "0x%02x", type); + return (num); +} + void dumpitems(report_desc_t r) { @@ -123,10 +141,11 @@ dumpitems(report_desc_t r) struct hid_item h; int size; - for (d = hid_start_parse(r, ~0, reportid); hid_get_item(d, &h); ) { + for (d = hid_start_parse(r, ~0, -1); hid_get_item(d, &h); ) { switch (h.kind) { case hid_collection: - printf("Collection page=%s usage=%s\n", + printf("Collection type=%s page=%s usage=%s\n", + hid_collection_type(h.collection), hid_usage_page(HID_PAGE(h.usage)), hid_usage_in_page(h.usage)); break; @@ -145,13 +164,13 @@ dumpitems(report_desc_t r) } } hid_end_parse(d); - size = hid_report_size(r, hid_input, 0); + size = hid_report_size(r, hid_input, -1); printf("Total input size %d bytes\n", size); - size = hid_report_size(r, hid_output, 0); + size = hid_report_size(r, hid_output, -1); printf("Total output size %d bytes\n", size); - size = hid_report_size(r, hid_feature, 0); + size = hid_report_size(r, hid_feature, -1); printf("Total feature size %d bytes\n", size); } @@ -180,14 +199,17 @@ prdata(u_char *buf, struct hid_item *h) pos = h->pos; for (i = 0; i < h->report_count; i++) { data = hid_get_data(buf, h); + if (i > 0) + printf(" "); if (h->logical_minimum < 0) printf("%d", (int)data); else printf("%u", data); if (hexdump) printf(" [0x%x]", data); - pos += h->report_size; + h->pos += h->report_size; } + h->pos = pos; } void @@ -202,7 +224,7 @@ dumpdata(int f, report_desc_t rd, int lo char namebuf[10000], *namep; hids = 0; - for (d = hid_start_parse(rd, 1<next) { + if (n->report_ID != 0 && dbuf[0] != n->report_ID) + continue; namep = namebuf; namep += sprintf(namep, "%s:%s.", hid_usage_page(HID_PAGE(n->collection)), @@ -242,7 +266,7 @@ dumpdata(int f, report_desc_t rd, int lo if (all || gotname(namebuf)) { if (!noname) printf("%s=", namebuf); - prdata(dbuf + (reportid != 0), n); + prdata(dbuf, n); printf("\n"); } } From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:25:12 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E056F106564A; Sat, 30 Jul 2011 13:25:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF4138FC13; Sat, 30 Jul 2011 13:25:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6UDPBdT001580; Sat, 30 Jul 2011 13:25:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDPBkA001576; Sat, 30 Jul 2011 13:25:11 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107301325.p6UDPBkA001576@svn.freebsd.org> From: Adrian Chadd Date: Sat, 30 Jul 2011 13:25:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224512 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 13:25:12 -0000 Author: adrian Date: Sat Jul 30 13:25:11 2011 New Revision: 224512 URL: http://svn.freebsd.org/changeset/base/224512 Log: Bring over AR5416 specific RX filter get/set routines. This in particular fixes radar PHY handling - on the AR5212 NIC, one enables the AR_PHY_ERR_RADAR bit in AR_PHY_ERR; the AR5416 and later also needs a bit set in AR_RX_FILTER. A follow-up commit is needed to convert the AR5416 ANI code to use this particular method, as it's currently using the AR5212 methods directly. Obtained from: Atheros Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Sat Jul 30 13:22:44 2011 (r224511) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Sat Jul 30 13:25:11 2011 (r224512) @@ -218,6 +218,8 @@ extern HAL_BOOL ar5416ResetKeyCacheEntry extern HAL_BOOL ar5416SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry, const HAL_KEYVAL *k, const uint8_t *mac, int xorKey); +extern uint32_t ar5416GetRxFilter(struct ath_hal *ah); +extern void ar5416SetRxFilter(struct ath_hal *ah, uint32_t bits); extern void ar5416StartPcuReceive(struct ath_hal *ah); extern void ar5416StopPcuReceive(struct ath_hal *ah); extern HAL_BOOL ar5416SetupRxDesc(struct ath_hal *, Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Sat Jul 30 13:22:44 2011 (r224511) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Sat Jul 30 13:25:11 2011 (r224512) @@ -117,6 +117,8 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_resetTxQueue = ar5416ResetTxQueue; /* Receive Functions */ + ah->ah_getRxFilter = ar5416GetRxFilter; + ah->ah_setRxFilter = ar5416SetRxFilter; ah->ah_startPcuReceive = ar5416StartPcuReceive; ah->ah_stopPcuReceive = ar5416StopPcuReceive; ah->ah_setupRxDesc = ar5416SetupRxDesc; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c Sat Jul 30 13:22:44 2011 (r224511) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c Sat Jul 30 13:25:11 2011 (r224512) @@ -27,6 +27,46 @@ #include "ar5416/ar5416desc.h" /* + * Get the receive filter. + */ +uint32_t +ar5416GetRxFilter(struct ath_hal *ah) +{ + uint32_t bits = OS_REG_READ(ah, AR_RX_FILTER); + uint32_t phybits = OS_REG_READ(ah, AR_PHY_ERR); + + if (phybits & AR_PHY_ERR_RADAR) + bits |= HAL_RX_FILTER_PHYRADAR; + if (phybits & (AR_PHY_ERR_OFDM_TIMING | AR_PHY_ERR_CCK_TIMING)) + bits |= HAL_RX_FILTER_PHYERR; + return bits; +} + +/* + * Set the receive filter. + */ +void +ar5416SetRxFilter(struct ath_hal *ah, u_int32_t bits) +{ + uint32_t phybits; + + OS_REG_WRITE(ah, AR_RX_FILTER, (bits & 0xffff)); + phybits = 0; + if (bits & HAL_RX_FILTER_PHYRADAR) + phybits |= AR_PHY_ERR_RADAR; + if (bits & HAL_RX_FILTER_PHYERR) + phybits |= AR_PHY_ERR_OFDM_TIMING | AR_PHY_ERR_CCK_TIMING; + OS_REG_WRITE(ah, AR_PHY_ERR, phybits); + if (phybits) { + OS_REG_WRITE(ah, AR_RXCFG, + OS_REG_READ(ah, AR_RXCFG) | AR_RXCFG_ZLFDMA); + } else { + OS_REG_WRITE(ah, AR_RXCFG, + OS_REG_READ(ah, AR_RXCFG) &~ AR_RXCFG_ZLFDMA); + } +} + +/* * Start receive at the PCU engine */ void From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:30:25 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EF3F106566C; Sat, 30 Jul 2011 13:30:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D0068FC15; Sat, 30 Jul 2011 13:30:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6UDUP2p001837; Sat, 30 Jul 2011 13:30:25 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDUPgN001834; Sat, 30 Jul 2011 13:30:25 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107301330.p6UDUPgN001834@svn.freebsd.org> From: Adrian Chadd Date: Sat, 30 Jul 2011 13:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224514 - in head/sys/dev/ath/ath_hal: ar5212 ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 13:30:25 -0000 Author: adrian Date: Sat Jul 30 13:30:24 2011 New Revision: 224514 URL: http://svn.freebsd.org/changeset/base/224514 Log: Fix ANI handling to work correctly when (trying) to receive radar errors. * Teach the AR5212/AR5416 ANI code to use the RX filter methods, rather than calling the RX filter routines directly. * Make HAL_ANI_PRESENT and HAL_ANI_MODE unconditionally available, regardless of whether ah_ani_function is masking it. * (Mostly) fully disable ANI if interference mitigation is disabled. When disabled, the ANI code doesn't touch any ANI/PHY registers, leaving them the default value. This is in line with what the Atheros reference driver does. * Correctly set the ANI parameters during ANI reset, rather than when ANI is enabled. In this way, if ANI is disabled or enabled whilst the NIC is not active (and there's no current channel), bogus parameters or a NULL pointer deference doesn't occur. There's still some lingering issues - notably, the MIB events/interrupts aren't fully disabled, so MIB interrupts still occur. I'll worry about that later. Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c Sat Jul 30 13:28:11 2011 (r224513) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c Sat Jul 30 13:30:24 2011 (r224514) @@ -222,7 +222,14 @@ ar5212AniControl(struct ath_hal *ah, HAL typedef int TABLE[]; struct ath_hal_5212 *ahp = AH5212(ah); struct ar5212AniState *aniState = ahp->ah_curani; - const struct ar5212AniParams *params = aniState->params; + const struct ar5212AniParams *params = AH_NULL; + + /* + * This function may be called before there's a current + * channel (eg to disable ANI.) + */ + if (aniState != AH_NULL) + params = aniState->params; OS_MARK(ah, AH_MARK_ANI_CONTROL, cmd); @@ -343,8 +350,8 @@ ar5212AniControl(struct ath_hal *ah, HAL ahp->ah_procPhyErr &= ~HAL_ANI_ENA; /* Turn off HW counters if we have them */ ar5212AniDetach(ah); - ar5212SetRxFilter(ah, - ar5212GetRxFilter(ah) &~ HAL_RX_FILTER_PHYERR); + ah->ah_setRxFilter(ah, + ah->ah_getRxFilter(ah) &~ HAL_RX_FILTER_PHYERR); } else { /* normal/auto mode */ /* don't mess with state if already enabled */ if (ahp->ah_procPhyErr & HAL_ANI_ENA) @@ -358,8 +365,8 @@ ar5212AniControl(struct ath_hal *ah, HAL ahp->ah_curani->params: &ahp->ah_aniParams24 /*XXX*/); } else { - ar5212SetRxFilter(ah, - ar5212GetRxFilter(ah) | HAL_RX_FILTER_PHYERR); + ah->ah_setRxFilter(ah, + ah->ah_getRxFilter(ah) | HAL_RX_FILTER_PHYERR); } ahp->ah_procPhyErr |= HAL_ANI_ENA; } @@ -609,8 +616,20 @@ ar5212AniReset(struct ath_hal *ah, const /* * Turn off PHY error frame delivery while we futz with settings. */ - rxfilter = ar5212GetRxFilter(ah); - ar5212SetRxFilter(ah, rxfilter &~ HAL_RX_FILTER_PHYERR); + rxfilter = ah->ah_getRxFilter(ah); + ah->ah_setRxFilter(ah, rxfilter &~ HAL_RX_FILTER_PHYERR); + + /* + * If ANI is disabled at this point, don't set the default + * ANI parameter settings - leave the HAL settings there. + * This is (currently) needed for reliable radar detection. + */ + if (! ANI_ENA(ah)) { + HALDEBUG(ah, HAL_DEBUG_ANI, "%s: ANI disabled\n", + __func__); + goto finish; + } + /* * Automatic processing is done only in station mode right now. */ @@ -644,10 +663,15 @@ ar5212AniReset(struct ath_hal *ah, const ar5212AniControl(ah, HAL_ANI_FIRSTEP_LEVEL, 0); ichan->privFlags |= CHANNEL_ANI_SETUP; } + /* + * In case the counters haven't yet been setup; set them up. + */ + enableAniMIBCounters(ah, ahp->ah_curani->params); ar5212AniRestart(ah, aniState); +finish: /* restore RX filter mask */ - ar5212SetRxFilter(ah, rxfilter); + ah->ah_setRxFilter(ah, rxfilter); } /* Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c Sat Jul 30 13:28:11 2011 (r224513) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c Sat Jul 30 13:30:24 2011 (r224514) @@ -156,6 +156,8 @@ ar5416AniAttach(struct ath_hal *ah, cons /* * Cleanup any ANI state setup. + * + * This doesn't restore registers to their default settings! */ void ar5416AniDetach(struct ath_hal *ah) @@ -173,7 +175,43 @@ ar5416AniControl(struct ath_hal *ah, HAL typedef int TABLE[]; struct ath_hal_5212 *ahp = AH5212(ah); struct ar5212AniState *aniState = ahp->ah_curani; - const struct ar5212AniParams *params = aniState->params; + const struct ar5212AniParams *params = AH_NULL; + + /* + * This function may be called before there's a current + * channel (eg to disable ANI.) + */ + if (aniState != AH_NULL) + params = aniState->params; + + OS_MARK(ah, AH_MARK_ANI_CONTROL, cmd); + + /* These commands can't be disabled */ + if (cmd == HAL_ANI_PRESENT) + return AH_TRUE; + + if (cmd == HAL_ANI_MODE) { + if (param == 0) { + ahp->ah_procPhyErr &= ~HAL_ANI_ENA; + /* Turn off HW counters if we have them */ + ar5416AniDetach(ah); + } else { /* normal/auto mode */ + /* don't mess with state if already enabled */ + if (! (ahp->ah_procPhyErr & HAL_ANI_ENA)) { + /* Enable MIB Counters */ + /* + * XXX use 2.4ghz params if no channel is + * available + */ + enableAniMIBCounters(ah, + ahp->ah_curani != AH_NULL ? + ahp->ah_curani->params: + &ahp->ah_aniParams24); + ahp->ah_procPhyErr |= HAL_ANI_ENA; + } + } + return AH_TRUE; + } /* Check whether the particular function is enabled */ if (((1 << cmd) & AH5416(ah)->ah_ani_function) == 0) { @@ -183,7 +221,6 @@ ar5416AniControl(struct ath_hal *ah, HAL return AH_FALSE; } - OS_MARK(ah, AH_MARK_ANI_CONTROL, cmd); switch (cmd) { case HAL_ANI_NOISE_IMMUNITY_LEVEL: { @@ -317,23 +354,6 @@ ar5416AniControl(struct ath_hal *ah, HAL aniState->spurImmunityLevel = level; break; } - case HAL_ANI_PRESENT: - break; - case HAL_ANI_MODE: - if (param == 0) { - ahp->ah_procPhyErr &= ~HAL_ANI_ENA; - /* Turn off HW counters if we have them */ - ar5416AniDetach(ah); - } else { /* normal/auto mode */ - /* don't mess with state if already enabled */ - if (ahp->ah_procPhyErr & HAL_ANI_ENA) - break; - /* Enable MIB Counters */ - enableAniMIBCounters(ah, ahp->ah_curani != AH_NULL ? - ahp->ah_curani->params: &ahp->ah_aniParams24 /*XXX*/); - ahp->ah_procPhyErr |= HAL_ANI_ENA; - } - break; #ifdef AH_PRIVATE_DIAG case HAL_ANI_PHYERR_RESET: ahp->ah_stats.ast_ani_ofdmerrs = 0; @@ -548,8 +568,21 @@ ar5416AniReset(struct ath_hal *ah, const /* * Turn off PHY error frame delivery while we futz with settings. */ - rxfilter = ar5212GetRxFilter(ah); - ar5212SetRxFilter(ah, rxfilter &~ HAL_RX_FILTER_PHYERR); + rxfilter = ah->ah_getRxFilter(ah); + ah->ah_setRxFilter(ah, rxfilter &~ HAL_RX_FILTER_PHYERR); + + /* + * If ANI is disabled at this point, don't set the default + * ANI parameter settings - leave the HAL settings there. + * This is (currently) needed for reliable radar detection. + */ + if (! ANI_ENA(ah)) { + HALDEBUG(ah, HAL_DEBUG_ANI, "%s: ANI disabled\n", + __func__); + goto finish; + } + + /* * Automatic processing is done only in station mode right now. */ @@ -583,10 +616,16 @@ ar5416AniReset(struct ath_hal *ah, const ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL, 0); ichan->privFlags |= CHANNEL_ANI_SETUP; } + + /* + * In case the counters haven't yet been setup; set them up. + */ + enableAniMIBCounters(ah, aniState->params); ar5416AniRestart(ah, aniState); +finish: /* restore RX filter mask */ - ar5212SetRxFilter(ah, rxfilter); + ah->ah_setRxFilter(ah, rxfilter); } /* From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:31:28 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 040851065670; Sat, 30 Jul 2011 13:31:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E70648FC1B; Sat, 30 Jul 2011 13:31:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6UDVRkl001907; Sat, 30 Jul 2011 13:31:27 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDVRJ5001905; Sat, 30 Jul 2011 13:31:27 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107301331.p6UDVRJ5001905@svn.freebsd.org> From: Adrian Chadd Date: Sat, 30 Jul 2011 13:31:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224515 - head/sys/dev/ath/ath_hal/ar9002 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 13:31:28 -0000 Author: adrian Date: Sat Jul 30 13:31:27 2011 New Revision: 224515 URL: http://svn.freebsd.org/changeset/base/224515 Log: Fix the initial calibration sample count when doing ADC calibrations. Obtained from: Atheros Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Sat Jul 30 13:30:24 2011 (r224514) +++ head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Sat Jul 30 13:31:27 2011 (r224515) @@ -42,14 +42,14 @@ static const HAL_PERCAL_DATA ar9280_iq_c static const HAL_PERCAL_DATA ar9280_adc_gain_cal = { /* single sample */ .calName = "ADC Gain", .calType = ADC_GAIN_CAL, .calNumSamples = MIN_CAL_SAMPLES, - .calCountMax = PER_MIN_LOG_COUNT, + .calCountMax = PER_MAX_LOG_COUNT, .calCollect = ar5416AdcGainCalCollect, .calPostProc = ar5416AdcGainCalibration }; static const HAL_PERCAL_DATA ar9280_adc_dc_cal = { /* single sample */ .calName = "ADC DC", .calType = ADC_DC_CAL, .calNumSamples = MIN_CAL_SAMPLES, - .calCountMax = PER_MIN_LOG_COUNT, + .calCountMax = PER_MAX_LOG_COUNT, .calCollect = ar5416AdcDcCalCollect, .calPostProc = ar5416AdcDcCalibration }; From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:33:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B252B106566C; Sat, 30 Jul 2011 13:33:05 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97A208FC13; Sat, 30 Jul 2011 13:33: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 p6UDX5wm002001; Sat, 30 Jul 2011 13:33:05 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDX5ca001997; Sat, 30 Jul 2011 13:33:05 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201107301333.p6UDX5ca001997@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 30 Jul 2011 13:33:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224516 - in head/sys: amd64/amd64 i386/i386 pc98/pc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 13:33:05 -0000 Author: bz Date: Sat Jul 30 13:33:05 2011 New Revision: 224516 URL: http://svn.freebsd.org/changeset/base/224516 Log: Introduce a tunable to disable the time consuming parts of bootup memtesting, which can easily save seconds to minutes of boot time. The tunable name is kept general to allow reusing the code in alternate frameworks. Requested by: many Discussed on: arch (a while a go) Obtained from: Sandvine Incorporated Reviewed by: sbruno Approved by: re (kib) MFC after: 2 weeks Modified: head/sys/amd64/amd64/machdep.c head/sys/i386/i386/machdep.c head/sys/pc98/pc98/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Sat Jul 30 13:31:27 2011 (r224515) +++ head/sys/amd64/amd64/machdep.c Sat Jul 30 13:33:05 2011 (r224516) @@ -1309,7 +1309,7 @@ getmemsize(caddr_t kmdp, u_int64_t first { int i, physmap_idx, pa_indx, da_indx; vm_paddr_t pa, physmap[PHYSMAP_SIZE]; - u_long physmem_tunable; + u_long physmem_tunable, memtest, tmpul; pt_entry_t *pte; struct bios_smap *smapbase, *smap, *smapend; u_int32_t smapsize; @@ -1372,6 +1372,14 @@ getmemsize(caddr_t kmdp, u_int64_t first Maxmem = atop(physmem_tunable); /* + * By default keep the memtest enabled. Use a general name so that + * one could eventually do more with the code than just disable it. + */ + memtest = 1; + if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) + memtest = tmpul; + + /* * Don't allow MAXMEM or hw.physmem to extend the amount of memory * in the system. */ @@ -1433,6 +1441,8 @@ getmemsize(caddr_t kmdp, u_int64_t first goto do_dump_avail; page_bad = FALSE; + if (memtest == 0) + goto skip_memtest; /* * map page into kernel: valid, read/write,non-cacheable @@ -1470,6 +1480,7 @@ getmemsize(caddr_t kmdp, u_int64_t first */ *(int *)ptr = tmp; +skip_memtest: /* * Adjust array of valid/good pages. */ Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Sat Jul 30 13:31:27 2011 (r224515) +++ head/sys/i386/i386/machdep.c Sat Jul 30 13:33:05 2011 (r224516) @@ -2132,7 +2132,7 @@ static void getmemsize(int first) { int has_smap, off, physmap_idx, pa_indx, da_indx; - u_long physmem_tunable; + u_long physmem_tunable, memtest, tmpul; vm_paddr_t physmap[PHYSMAP_SIZE]; pt_entry_t *pte; quad_t dcons_addr, dcons_size; @@ -2339,6 +2339,14 @@ physmap_done: if (has_smap && Maxmem > atop(physmap[physmap_idx + 1])) Maxmem = atop(physmap[physmap_idx + 1]); + /* + * By default keep the memtest enabled. Use a general name so that + * one could eventually do more with the code than just disable it. + */ + memtest = 1; + if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) + memtest = tmpul; + if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) printf("Physical memory use set to %ldK\n", Maxmem * 4); @@ -2402,6 +2410,8 @@ physmap_done: goto do_dump_avail; page_bad = FALSE; + if (memtest == 0) + goto skip_memtest; /* * map page into kernel: valid, read/write,non-cacheable @@ -2439,6 +2449,7 @@ physmap_done: */ *(int *)ptr = tmp; +skip_memtest: /* * Adjust array of valid/good pages. */ Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Sat Jul 30 13:31:27 2011 (r224515) +++ head/sys/pc98/pc98/machdep.c Sat Jul 30 13:33:05 2011 (r224516) @@ -1855,7 +1855,7 @@ static void getmemsize(int first) { int off, physmap_idx, pa_indx, da_indx; - u_long physmem_tunable; + u_long physmem_tunable, memtest, tmpul; vm_paddr_t physmap[PHYSMAP_SIZE]; pt_entry_t *pte; quad_t dcons_addr, dcons_size; @@ -1915,6 +1915,14 @@ getmemsize(int first) if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) Maxmem = atop(physmem_tunable); + /* + * By default keep the memtest enabled. Use a general name so that + * one could eventually do more with the code than just disable it. + */ + memtest = 1; + if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) + memtest = tmpul; + if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) printf("Physical memory use set to %ldK\n", Maxmem * 4); @@ -1991,6 +1999,8 @@ getmemsize(int first) goto do_dump_avail; page_bad = FALSE; + if (memtest == 0) + goto skip_memtest; /* * map page into kernel: valid, read/write,non-cacheable @@ -2028,6 +2038,7 @@ getmemsize(int first) */ *(int *)ptr = tmp; +skip_memtest: /* * Adjust array of valid/good pages. */ From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:34:58 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44EDC106566B; Sat, 30 Jul 2011 13:34:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A9EA8FC0C; Sat, 30 Jul 2011 13:34:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6UDYvYw002086; Sat, 30 Jul 2011 13:34:58 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDYvZG002084; Sat, 30 Jul 2011 13:34:57 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107301334.p6UDYvZG002084@svn.freebsd.org> From: Adrian Chadd Date: Sat, 30 Jul 2011 13:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224517 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 13:34:58 -0000 Author: adrian Date: Sat Jul 30 13:34:57 2011 New Revision: 224517 URL: http://svn.freebsd.org/changeset/base/224517 Log: Fix AR5416 radar parameter initialisation. * I messed up the order of parameter true/false; oops! * AR_PHY_RADAR_1 was being written at the wrong place, and was writing potential garbage to the hardware. Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Sat Jul 30 13:33:05 2011 (r224516) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Sat Jul 30 13:34:57 2011 (r224517) @@ -670,26 +670,27 @@ ar5416EnableDfs(struct ath_hal *ah, HAL_ OS_REG_WRITE(ah, AR_PHY_RADAR_0, val | AR_PHY_RADAR_0_ENA); - if (pe->pe_usefir128 == 0) - OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_USE_FIR128); - else if (pe->pe_usefir128 == 1) + if (pe->pe_usefir128 == 1) OS_REG_CLR_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_USE_FIR128); + else if (pe->pe_usefir128 == 0) + OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_USE_FIR128); - if (pe->pe_enmaxrssi == 0) + if (pe->pe_enmaxrssi == 1) OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_MAX_RRSSI); - else if (pe->pe_enmaxrssi == 1) + else if (pe->pe_enmaxrssi == 0) OS_REG_CLR_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_MAX_RRSSI); - if (pe->pe_blockradar == 0) + if (pe->pe_blockradar == 1) OS_REG_SET_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_BLOCK_CHECK); - else if (pe->pe_blockradar == 1) + else if (pe->pe_blockradar == 0) OS_REG_CLR_BIT(ah, AR_PHY_RADAR_1, AR_PHY_RADAR_1_BLOCK_CHECK); if (pe->pe_maxlen != HAL_PHYERR_PARAM_NOVAL) { + val = OS_REG_READ(ah, AR_PHY_RADAR_1); val &= ~AR_PHY_RADAR_1_MAXLEN; val |= SM(pe->pe_maxlen, AR_PHY_RADAR_1_MAXLEN); + OS_REG_WRITE(ah, AR_PHY_RADAR_1, val); } - OS_REG_WRITE(ah, AR_PHY_RADAR_1, val); /* * Enable HT/40 if the upper layer asks; From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:37:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C85CD106564A; Sat, 30 Jul 2011 13:37:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B73398FC0C; Sat, 30 Jul 2011 13:37:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6UDbcU6002198; Sat, 30 Jul 2011 13:37:38 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDbcM3002195; Sat, 30 Jul 2011 13:37:38 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107301337.p6UDbcM3002195@svn.freebsd.org> From: Adrian Chadd Date: Sat, 30 Jul 2011 13:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224518 - head/sys/dev/ath/ath_hal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 13:37:39 -0000 Author: adrian Date: Sat Jul 30 13:37:38 2011 New Revision: 224518 URL: http://svn.freebsd.org/changeset/base/224518 Log: Prepare for embedded use of the AR9285/AR9287. Calibration/PCI data that's written to flash (rather than EEPROM attached to the NIC) is typically already in host-endian. The existing checks end up swapping 16 bit words incorrectly - the correct solution would be to read the magic value and determine the EEPROM endianness from that. (This is what Linux does.) This doesn't completely enable embedded use of the AR9285/AR9287 - notably, the EEPROM read methods need to be made generic and available to all EEPROM drivers. I'll worry about that later. Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ah_eeprom_9287.c head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Modified: head/sys/dev/ath/ath_hal/ah_eeprom_9287.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_9287.c Sat Jul 30 13:34:57 2011 (r224517) +++ head/sys/dev/ath/ath_hal/ah_eeprom_9287.c Sat Jul 30 13:37:38 2011 (r224518) @@ -298,11 +298,18 @@ ath_hal_9287EepromAttach(struct ath_hal uint32_t sum; HALASSERT(ee == AH_NULL); - - if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { - HALDEBUG(ah, HAL_DEBUG_ANY, - "%s Error reading Eeprom MAGIC\n", __func__); - return HAL_EEREAD; + + /* + * Don't check magic if we're supplied with an EEPROM block, + * typically this is from Howl but it may also be from later + * boards w/ an embedded WMAC. + */ + if (ah->ah_eepromdata == NULL) { + if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "%s Error reading Eeprom MAGIC\n", __func__); + return HAL_EEREAD; + } } HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n", __func__, magic); @@ -328,7 +335,11 @@ ath_hal_9287EepromAttach(struct ath_hal } } /* Convert to eeprom native eeprom endian format */ - if (isBigEndian()) { + /* + * XXX this is likely incorrect but will do for now + * XXX to get embedded boards working. + */ + if (ah->ah_eepromdata == NULL && isBigEndian()) { for (w = 0; w < NW(HAL_EEPROM_9287); w++) eep_data[w] = __bswap16(eep_data[w]); } Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Sat Jul 30 13:34:57 2011 (r224517) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Sat Jul 30 13:37:38 2011 (r224518) @@ -288,11 +288,17 @@ ath_hal_v4kEepromAttach(struct ath_hal * uint32_t sum; HALASSERT(ee == AH_NULL); - - if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { - HALDEBUG(ah, HAL_DEBUG_ANY, - "%s Error reading Eeprom MAGIC\n", __func__); - return HAL_EEREAD; + /* + * Don't check magic if we're supplied with an EEPROM block, + * typically this is from Howl but it may also be from later + * boards w/ an embedded WMAC. + */ + if (ah->ah_eepromdata == NULL) { + if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "%s Error reading Eeprom MAGIC\n", __func__); + return HAL_EEREAD; + } } HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n", __func__, magic); @@ -318,7 +324,11 @@ ath_hal_v4kEepromAttach(struct ath_hal * } } /* Convert to eeprom native eeprom endian format */ - if (isBigEndian()) { + /* + * XXX this is likely incorrect but will do for now + * XXX to get embedded boards working. + */ + if (ah->ah_eepromdata == NULL && isBigEndian()) { for (w = 0; w < NW(struct ar5416eeprom_4k); w++) eep_data[w] = __bswap16(eep_data[w]); } From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:45:13 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D41A106566B; Sat, 30 Jul 2011 13:45:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 291928FC16; Sat, 30 Jul 2011 13:45: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 p6UDjCXb002466; Sat, 30 Jul 2011 13:45:12 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDjCOr002461; Sat, 30 Jul 2011 13:45:12 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107301345.p6UDjCOr002461@svn.freebsd.org> From: Adrian Chadd Date: Sat, 30 Jul 2011 13:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224519 - in head/sys/dev/ath/ath_hal: . ar9002 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 13:45:13 -0000 Author: adrian Date: Sat Jul 30 13:45:12 2011 New Revision: 224519 URL: http://svn.freebsd.org/changeset/base/224519 Log: Introduce the FRAC_5G EEPROM parameter. This seems to indicate whether to program the NIC for fractional 5ghz mode (ie, 5mhz spaced channels, rather than 10 or 20mhz spacing) or not. The default (0) seems to mean "only program fractional mode if needed". A different value (eg 1) seems to always enable fractional 5ghz mode regardless of the frequency. Obtained from: Atheros Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ah_eeprom.h head/sys/dev/ath/ath_hal/ah_eeprom_v14.c head/sys/dev/ath/ath_hal/ah_eeprom_v14.h head/sys/dev/ath/ath_hal/ar9002/ar9280.c Modified: head/sys/dev/ath/ath_hal/ah_eeprom.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom.h Sat Jul 30 13:37:38 2011 (r224518) +++ head/sys/dev/ath/ath_hal/ah_eeprom.h Sat Jul 30 13:45:12 2011 (r224519) @@ -104,6 +104,7 @@ enum { AR_EEP_PWDCLKIND, /* uint8_t* */ AR_EEP_TEMPSENSE_SLOPE, /* int8_t* */ AR_EEP_TEMPSENSE_SLOPE_PAL_ON, /* int8_t* */ + AR_EEP_FRAC_N_5G, /* uint8_t* */ }; typedef struct { Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v14.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v14.c Sat Jul 30 13:37:38 2011 (r224518) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v14.c Sat Jul 30 13:45:12 2011 (r224519) @@ -97,6 +97,12 @@ v14EepromGet(struct ath_hal *ah, int par return HAL_OK; } else return HAL_EIO; + case AR_EEP_FRAC_N_5G: + if (IS_VERS(>=, AR5416_EEP_MINOR_VER_22)) { + *(uint8_t *) val = pBase->frac_n_5g; + } else + *(uint8_t *) val = 0; + return HAL_OK; case AR_EEP_AMODE: HALASSERT(val == AH_NULL); return pBase->opCapFlags & AR5416_OPFLAGS_11A ? Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v14.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v14.h Sat Jul 30 13:37:38 2011 (r224518) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v14.h Sat Jul 30 13:45:12 2011 (r224519) @@ -187,7 +187,10 @@ typedef struct BaseEepHeader { uint8_t rcChainMask; /* "1" if the card is an HB93 1x2 */ uint8_t desiredScaleCCK; uint8_t pwr_table_offset; - uint8_t frac_n_5g; + uint8_t frac_n_5g; /* + * bit 0: indicates that fracN synth + * mode applies to all 5G channels + */ uint8_t futureBase[21]; } __packed BASE_EEP_HEADER; // 64 B Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9280.c Sat Jul 30 13:37:38 2011 (r224518) +++ head/sys/dev/ath/ath_hal/ar9002/ar9280.c Sat Jul 30 13:45:12 2011 (r224519) @@ -76,6 +76,7 @@ ar9280SetChannel(struct ath_hal *ah, con uint32_t freq, ndiv, channelSel = 0, channelFrac = 0, reg32 = 0; CHAN_CENTERS centers; uint32_t refDivA = 24; + uint8_t frac_n_5g; OS_MARK(ah, AH_MARK_SETCHANNEL, chan->ic_freq); @@ -85,6 +86,9 @@ ar9280SetChannel(struct ath_hal *ah, con reg32 = OS_REG_READ(ah, AR_PHY_SYNTH_CONTROL); reg32 &= 0xc0000000; + if (ath_hal_eepromGet(ah, AR_EEP_FRAC_N_5G, &frac_n_5g) != HAL_OK) + frac_n_5g = 0; + if (freq < 4800) { /* 2 GHz, fractional mode */ uint32_t txctl; @@ -106,11 +110,16 @@ ar9280SetChannel(struct ath_hal *ah, con bMode = 0; fracMode = 0; - if ((freq % 20) == 0) { - aModeRefSel = 3; - } else if ((freq % 10) == 0) { - aModeRefSel = 2; - } else { + switch (frac_n_5g) { + case 0: + if ((freq % 20) == 0) { + aModeRefSel = 3; + } else if ((freq % 10) == 0) { + aModeRefSel = 2; + } + if (aModeRefSel) break; + case 1: + default: aModeRefSel = 0; /* Enable 2G (fractional) mode for channels which are 5MHz spaced */ fracMode = 1; @@ -121,6 +130,7 @@ ar9280SetChannel(struct ath_hal *ah, con OS_A_REG_RMW_FIELD(ah, AR_AN_SYNTH9, AR_AN_SYNTH9_REFDIVA, refDivA); } + if (!fracMode) { ndiv = (freq * (refDivA >> aModeRefSel))/60; channelSel = ndiv & 0x1ff; From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 13:46:42 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0303C1065673; Sat, 30 Jul 2011 13:46:42 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E61DF8FC15; Sat, 30 Jul 2011 13:46: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 p6UDkfxC002549; Sat, 30 Jul 2011 13:46:41 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UDkfsq002547; Sat, 30 Jul 2011 13:46:41 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107301346.p6UDkfsq002547@svn.freebsd.org> From: Adrian Chadd Date: Sat, 30 Jul 2011 13:46:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224520 - head/sys/dev/ath/ath_dfs/null X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 13:46:42 -0000 Author: adrian Date: Sat Jul 30 13:46:41 2011 New Revision: 224520 URL: http://svn.freebsd.org/changeset/base/224520 Log: Fix incorrect error reporting during the dfs ioctl function. Approved by: re (kib) Modified: head/sys/dev/ath/ath_dfs/null/dfs_null.c Modified: head/sys/dev/ath/ath_dfs/null/dfs_null.c ============================================================================== --- head/sys/dev/ath/ath_dfs/null/dfs_null.c Sat Jul 30 13:45:12 2011 (r224519) +++ head/sys/dev/ath/ath_dfs/null/dfs_null.c Sat Jul 30 13:46:41 2011 (r224520) @@ -189,7 +189,7 @@ ath_ioctl_phyerr(struct ath_softc *sc, s switch (id) { case DFS_SET_THRESH: if (insize < sizeof(HAL_PHYERR_PARAM)) { - error = -EINVAL; + error = EINVAL; break; } pe = (HAL_PHYERR_PARAM *) indata; @@ -203,12 +203,12 @@ ath_ioctl_phyerr(struct ath_softc *sc, s memcpy(pe, &peout, sizeof(*pe)); break; default: - error = -EINVAL; + error = EINVAL; } if (outsize < ad->ad_out_size) ad->ad_out_size = outsize; if (outdata && copyout(outdata, ad->ad_out_data, ad->ad_out_size)) - error = -EFAULT; + error = EFAULT; bad: if ((ad->ad_id & ATH_DIAG_IN) && indata != NULL) free(indata, M_TEMP); From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 14:12:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AACCD106566C; Sat, 30 Jul 2011 14:12:37 +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 9A1DF8FC13; Sat, 30 Jul 2011 14:12: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 p6UECblV003299; Sat, 30 Jul 2011 14:12:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UECbXe003297; Sat, 30 Jul 2011 14:12:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201107301412.p6UECbXe003297@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 30 Jul 2011 14:12:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224521 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 14:12:37 -0000 Author: kib Date: Sat Jul 30 14:12:37 2011 New Revision: 224521 URL: http://svn.freebsd.org/changeset/base/224521 Log: Fix the devmtx lock leak from make_dev(9) when the old device cloning failed due to invalid or duplicated path being generated. Reviewed by: jh Approved by: re (kensmith) MFC after: 1 week Modified: head/sys/kern/kern_conf.c Modified: head/sys/kern/kern_conf.c ============================================================================== --- head/sys/kern/kern_conf.c Sat Jul 30 13:46:41 2011 (r224520) +++ head/sys/kern/kern_conf.c Sat Jul 30 14:12:37 2011 (r224521) @@ -764,7 +764,8 @@ make_dev_credv(int flags, struct cdev ** LIST_REMOVE(dev, si_list); dev_unlock(); devfs_free(dev); - } + } else + dev_unlock(); return (res); } } From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 14:13:58 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E281106564A; Sat, 30 Jul 2011 14:13:58 +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 1D62A8FC0A; Sat, 30 Jul 2011 14:13:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6UEDwKc003372; Sat, 30 Jul 2011 14:13:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UEDwtd003370; Sat, 30 Jul 2011 14:13:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201107301413.p6UEDwtd003370@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 30 Jul 2011 14:13:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224522 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 14:13:58 -0000 Author: kib Date: Sat Jul 30 14:13:57 2011 New Revision: 224522 URL: http://svn.freebsd.org/changeset/base/224522 Log: Fix a race in the device pager allocation. If another thread won and allocated the device pager for the given handle, then the object fictitious pages list and the object membership in the global object list still need to be initialized. Otherwise, dev_pager_dealloc() will traverse uninitialized pointers. Reported and tested by: pho Reviewed by: jhb Approved by: re (kensmith) MFC after: 1 week Modified: head/sys/vm/device_pager.c Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Sat Jul 30 14:12:37 2011 (r224521) +++ head/sys/vm/device_pager.c Sat Jul 30 14:13:57 2011 (r224522) @@ -147,6 +147,7 @@ dev_pager_alloc(void *handle, vm_ooffset object1 = vm_object_allocate(OBJT_DEVICE, pindex); object1->flags |= OBJ_COLORED; object1->pg_color = atop(paddr) - OFF_TO_IDX(off - PAGE_SIZE); + TAILQ_INIT(&object1->un_pager.devp.devp_pglist); mtx_lock(&dev_pager_mtx); object = vm_pager_object_lookup(&dev_pager_object_list, handle); if (object != NULL) { @@ -159,7 +160,6 @@ dev_pager_alloc(void *handle, vm_ooffset object = object1; object1 = NULL; object->handle = handle; - TAILQ_INIT(&object->un_pager.devp.devp_pglist); TAILQ_INSERT_TAIL(&dev_pager_object_list, object, pager_object_list); } @@ -169,7 +169,14 @@ dev_pager_alloc(void *handle, vm_ooffset } mtx_unlock(&dev_pager_mtx); dev_relthread(dev, ref); - vm_object_deallocate(object1); + if (object1 != NULL) { + object1->handle = object1; + mtx_lock(&dev_pager_mtx); + TAILQ_INSERT_TAIL(&dev_pager_object_list, object1, + pager_object_list); + mtx_unlock(&dev_pager_mtx); + vm_object_deallocate(object1); + } return (object); } From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 16:37:27 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C322F1065673; Sat, 30 Jul 2011 16:37:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 5C6418FC15; Sat, 30 Jul 2011 16:37:27 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p6UGbNXV060606 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 30 Jul 2011 19:37:23 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p6UGbNXK026978; Sat, 30 Jul 2011 19:37:23 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p6UGbNGf026977; Sat, 30 Jul 2011 19:37:23 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 30 Jul 2011 19:37:23 +0300 From: Kostik Belousov To: Alexander Motin Message-ID: <20110730163723.GZ17489@deviant.kiev.zoral.com.ua> References: <201107292030.p6TKUSaf064895@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lzwOWbZ6TxNmVMlX" Content-Disposition: inline In-Reply-To: <201107292030.p6TKUSaf064895@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224496 - head/sys/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 16:37:28 -0000 --lzwOWbZ6TxNmVMlX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 29, 2011 at 08:30:28PM +0000, Alexander Motin wrote: > Author: mav > Date: Fri Jul 29 20:30:28 2011 > New Revision: 224496 > URL: http://svn.freebsd.org/changeset/base/224496 >=20 > Log: > In some cases failed SATA disks may report their presence, but don't > respond to any commands. I've found that because of multiple command > retries, each of which cause 30s timeout, bus reset and another retry or > requeue for many commands, it may take ages to eventually drop the > failed device. The odd thing is that those retries continue even after > XPT considered device as dead and invalidated it. > =20 > This patch makes cam_periph_error() to block any command retries after > periph was marked as invalid. With that patch all activity completes in > 1-2 minutes, just after several timeouts, required to consider device > death. This should make ZFS, gmirror, graid, etc. operation more robust. > =20 > Reviewed by: mjacob@ on scsi@ > =20 > Approved by: re (kib) >=20 > Modified: > head/sys/cam/cam_periph.c Amusingly, this commit makes my test machine to not boot. This is Ibex Peak PCH, with two SATA disks on the channels 0 and 1. It seems that geom thread 100012 owns GEOM topology lock, while sleeping in adaclose->cam_periph_getccb() : db> bt 100012 Tracing pid 12 tid 100012 td 0xfffffe00028a2000 sched_switch() at 0xffffffff8034a0c7 =3D sched_switch+0x157 mi_switch() at 0xffffffff803291fb =3D mi_switch+0x2eb sleepq_switch() at 0xffffffff803631f3 =3D sleepq_switch+0x123 sleepq_wait() at 0xffffffff80363eed =3D sleepq_wait+0x4d _sleep() at 0xffffffff80329b59 =3D _sleep+0x3b9 cam_periph_getccb() at 0xffffffff817ffc50 =3D cam_periph_getccb+0xa0 adaclose() at 0xffffffff8182c484 =3D adaclose+0xc4 g_disk_access() at 0xffffffff802bea74 =3D g_disk_access+0x1e4 g_access() at 0xffffffff802c519a =3D g_access+0x1ba g_dev_attrchanged() at 0xffffffff802bd1f6 =3D g_dev_attrchanged+0x96 g_dev_taste() at 0xffffffff802bd574 =3D g_dev_taste+0x284 g_new_provider_event() at 0xffffffff802c4ecd =3D g_new_provider_event+0xad g_run_events() at 0xffffffff802c0750 =3D g_run_events+0x250 fork_exit() at 0xffffffff802f0d99 =3D fork_exit+0x189 fork_trampoline() at 0xffffffff804ee3be =3D fork_trampoline+0xe --- trap 0, rip =3D 0, rsp =3D 0xffffff800025fd00, rbp =3D 0 --- (gdb) list *cam_periph_getccb+0xa0 0x1c50 is in cam_periph_getccb (/usr/home/kostik/work/build/bsd/DEV/src/sys= /modules/cam/../../cam/cam_periph.c:883). 882 883 while (SLIST_FIRST(&periph->ccb_list) =3D=3D NULL) { 884 if (periph->immediate_priority > priority) Reverting the rev. or not loading ahci.ko allows machine to boot. --lzwOWbZ6TxNmVMlX Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk40M0MACgkQC3+MBN1Mb4hnowCfbdZicpeUrXDM+DM/ZVC38XNf 0EIAoIqCgEzxKP0tz9QkLpKKr4Y+/zBk =C6T3 -----END PGP SIGNATURE----- --lzwOWbZ6TxNmVMlX-- From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 17:27:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 921E6106566B; Sat, 30 Jul 2011 17:27:29 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81B968FC18; Sat, 30 Jul 2011 17:27: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 p6UHRTuX008858; Sat, 30 Jul 2011 17:27:29 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UHRTBr008855; Sat, 30 Jul 2011 17:27:29 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201107301727.p6UHRTBr008855@svn.freebsd.org> From: Martin Matuska Date: Sat, 30 Jul 2011 17:27:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224523 - head/contrib/gcc/cp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 17:27:29 -0000 Author: mm Date: Sat Jul 30 17:27:29 2011 New Revision: 224523 URL: http://svn.freebsd.org/changeset/base/224523 Log: Fix invalid assertion of C++ external static data member declarations as anonymous namespaces are local to the current translation. GCC PR: c++/33094 Reviewed by: uqs Approved by: re (kib) Obtained from: gcc (branches/redhat/gcc-4_1-branch, rev. 129554, GPLv2) MFC after: 1 week Modified: head/contrib/gcc/cp/ChangeLog head/contrib/gcc/cp/decl.c Modified: head/contrib/gcc/cp/ChangeLog ============================================================================== --- head/contrib/gcc/cp/ChangeLog Sat Jul 30 14:13:57 2011 (r224522) +++ head/contrib/gcc/cp/ChangeLog Sat Jul 30 17:27:29 2011 (r224523) @@ -1,3 +1,9 @@ +2007-09-29 Jason Merrill + + PR c++/33094 + * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member + constant to not have DECL_EXTERNAL if it's file-local. + 2007-08-24 Jakub Jelinek PR c++/31941 Modified: head/contrib/gcc/cp/decl.c ============================================================================== --- head/contrib/gcc/cp/decl.c Sat Jul 30 14:13:57 2011 (r224522) +++ head/contrib/gcc/cp/decl.c Sat Jul 30 17:27:29 2011 (r224523) @@ -4968,7 +4968,7 @@ make_rtl_for_nonlocal_decl (tree decl, t /* An in-class declaration of a static data member should be external; it is only a declaration, and not a definition. */ if (init == NULL_TREE) - gcc_assert (DECL_EXTERNAL (decl)); + gcc_assert (DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl)); } /* We don't create any RTL for local variables. */ From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 17:40:12 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E402106564A; Sat, 30 Jul 2011 17:40:12 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E04F8FC0C; Sat, 30 Jul 2011 17:40: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 p6UHeB48009250; Sat, 30 Jul 2011 17:40:11 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UHeBax009248; Sat, 30 Jul 2011 17:40:11 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201107301740.p6UHeBax009248@svn.freebsd.org> From: Martin Matuska Date: Sat, 30 Jul 2011 17:40:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224524 - head/contrib/gcc/cp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 17:40:12 -0000 Author: mm Date: Sat Jul 30 17:40:11 2011 New Revision: 224524 URL: http://svn.freebsd.org/changeset/base/224524 Log: Fix accidential dos-style endings to unix-style line endings from last commit (r224523) to match the version approved by re@ Approved by: re (implicit) Modified: head/contrib/gcc/cp/ChangeLog Modified: head/contrib/gcc/cp/ChangeLog ============================================================================== --- head/contrib/gcc/cp/ChangeLog Sat Jul 30 17:27:29 2011 (r224523) +++ head/contrib/gcc/cp/ChangeLog Sat Jul 30 17:40:11 2011 (r224524) @@ -1,9 +1,9 @@ -2007-09-29 Jason Merrill - - PR c++/33094 - * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member - constant to not have DECL_EXTERNAL if it's file-local. - +2007-09-29 Jason Merrill + + PR c++/33094 + * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member + constant to not have DECL_EXTERNAL if it's file-local. + 2007-08-24 Jakub Jelinek PR c++/31941 From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 17:44:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31344106566C; Sat, 30 Jul 2011 17:44:07 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2069F8FC13; Sat, 30 Jul 2011 17:44: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 p6UHi6eq009409; Sat, 30 Jul 2011 17:44:06 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UHi6s3009407; Sat, 30 Jul 2011 17:44:06 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201107301744.p6UHi6s3009407@svn.freebsd.org> From: Martin Matuska Date: Sat, 30 Jul 2011 17:44:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224525 - head/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 17:44:07 -0000 Author: mm Date: Sat Jul 30 17:44:06 2011 New Revision: 224525 URL: http://svn.freebsd.org/changeset/base/224525 Log: Fix wrong initialization of "cmd" for calling the jail/unjail ioctl. Reviewed by: pjd@, delphij@ Approved by: re (kib) MFC after: 3 days Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Jul 30 17:40:11 2011 (r224524) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Jul 30 17:44:06 2011 (r224525) @@ -4289,7 +4289,8 @@ zfs_jail(zfs_handle_t *zhp, int jailid, libzfs_handle_t *hdl = zhp->zfs_hdl; zfs_cmd_t zc = { 0 }; char errbuf[1024]; - int cmd, ret; + unsigned long cmd; + int ret; if (attach) { (void) snprintf(errbuf, sizeof (errbuf), From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 19:00:31 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 961B4106566B; Sat, 30 Jul 2011 19:00:31 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 848858FC0A; Sat, 30 Jul 2011 19:00: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 p6UJ0VTU011579; Sat, 30 Jul 2011 19:00:31 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UJ0VDw011576; Sat, 30 Jul 2011 19:00:31 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201107301900.p6UJ0VDw011576@svn.freebsd.org> From: Martin Matuska Date: Sat, 30 Jul 2011 19:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224526 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 19:00:31 -0000 Author: mm Date: Sat Jul 30 19:00:31 2011 New Revision: 224526 URL: http://svn.freebsd.org/changeset/base/224526 Log: Fix serious bug in ZIL that can lead to pool corruption in the case of a held dataset during remount. Detailed description is available at: https://www.illumos.org/issues/883 illumos-gate revision: 13380:161b964a0e10 Reviewed by: pjd Approved by: re (kib) Obtained from: Illumos (Bug #883) MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Jul 30 17:44:06 2011 (r224525) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Jul 30 19:00:31 2011 (r224526) @@ -205,6 +205,7 @@ typedef struct ztest_od { */ typedef struct ztest_ds { objset_t *zd_os; + rwlock_t zd_zilog_lock; zilog_t *zd_zilog; uint64_t zd_seq; ztest_od_t *zd_od; /* debugging aid */ @@ -238,6 +239,7 @@ ztest_func_t ztest_dmu_commit_callbacks; ztest_func_t ztest_zap; ztest_func_t ztest_zap_parallel; ztest_func_t ztest_zil_commit; +ztest_func_t ztest_zil_remount; ztest_func_t ztest_dmu_read_write_zcopy; ztest_func_t ztest_dmu_objset_create_destroy; ztest_func_t ztest_dmu_prealloc; @@ -273,6 +275,7 @@ ztest_info_t ztest_info[] = { { ztest_zap_parallel, 100, &zopt_always }, { ztest_split_pool, 1, &zopt_always }, { ztest_zil_commit, 1, &zopt_incessant }, + { ztest_zil_remount, 1, &zopt_sometimes }, { ztest_dmu_read_write_zcopy, 1, &zopt_often }, { ztest_dmu_objset_create_destroy, 1, &zopt_often }, { ztest_dsl_prop_get_set, 1, &zopt_often }, @@ -986,6 +989,7 @@ ztest_zd_init(ztest_ds_t *zd, objset_t * zd->zd_seq = 0; dmu_objset_name(os, zd->zd_name); + VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) == 0); VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0); for (int l = 0; l < ZTEST_OBJECT_LOCKS; l++) @@ -1965,6 +1969,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object if (ztest_random(2) == 0) io_type = ZTEST_IO_WRITE_TAG; + (void) rw_rdlock(&zd->zd_zilog_lock); + switch (io_type) { case ZTEST_IO_WRITE_TAG: @@ -2000,6 +2006,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object break; } + (void) rw_unlock(&zd->zd_zilog_lock); + umem_free(data, blocksize); } @@ -2054,6 +2062,8 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ { zilog_t *zilog = zd->zd_zilog; + (void) rw_rdlock(&zd->zd_zilog_lock); + zil_commit(zilog, ztest_random(ZTEST_OBJECTS)); /* @@ -2065,6 +2075,31 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ ASSERT(zd->zd_seq <= zilog->zl_commit_lr_seq); zd->zd_seq = zilog->zl_commit_lr_seq; mutex_exit(&zilog->zl_lock); + + (void) rw_unlock(&zd->zd_zilog_lock); +} + +/* + * This function is designed to simulate the operations that occur during a + * mount/unmount operation. We hold the dataset across these operations in an + * attempt to expose any implicit assumptions about ZIL management. + */ +/* ARGSUSED */ +void +ztest_zil_remount(ztest_ds_t *zd, uint64_t id) +{ + objset_t *os = zd->zd_os; + + (void) rw_wrlock(&zd->zd_zilog_lock); + + /* zfsvfs_teardown() */ + zil_close(zd->zd_zilog); + + /* zfsvfs_setup() */ + VERIFY(zil_open(os, ztest_get_data) == zd->zd_zilog); + zil_replay(os, zd, ztest_replay_vector); + + (void) rw_unlock(&zd->zd_zilog_lock); } /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Jul 30 17:44:06 2011 (r224525) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Jul 30 19:00:31 2011 (r224526) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -567,7 +568,7 @@ zil_destroy(zilog_t *zilog, boolean_t ke if (!list_is_empty(&zilog->zl_lwb_list)) { ASSERT(zh->zh_claim_txg == 0); - ASSERT(!keep_first); + VERIFY(!keep_first); while ((lwb = list_head(&zilog->zl_lwb_list)) != NULL) { list_remove(&zilog->zl_lwb_list, lwb); if (lwb->lwb_buf != NULL) @@ -1668,20 +1669,9 @@ zil_alloc(objset_t *os, zil_header_t *zh void zil_free(zilog_t *zilog) { - lwb_t *head_lwb; - zilog->zl_stop_sync = 1; - /* - * After zil_close() there should only be one lwb with a buffer. - */ - head_lwb = list_head(&zilog->zl_lwb_list); - if (head_lwb) { - ASSERT(head_lwb == list_tail(&zilog->zl_lwb_list)); - list_remove(&zilog->zl_lwb_list, head_lwb); - zio_buf_free(head_lwb->lwb_buf, head_lwb->lwb_sz); - kmem_cache_free(zil_lwb_cache, head_lwb); - } + ASSERT(list_is_empty(&zilog->zl_lwb_list)); list_destroy(&zilog->zl_lwb_list); avl_destroy(&zilog->zl_vdev_tree); @@ -1721,6 +1711,10 @@ zil_open(objset_t *os, zil_get_data_t *g { zilog_t *zilog = dmu_objset_zil(os); + ASSERT(zilog->zl_clean_taskq == NULL); + ASSERT(zilog->zl_get_data == NULL); + ASSERT(list_is_empty(&zilog->zl_lwb_list)); + zilog->zl_get_data = get_data; zilog->zl_clean_taskq = taskq_create("zil_clean", 1, minclsyspri, 2, 2, TASKQ_PREPOPULATE); @@ -1734,7 +1728,7 @@ zil_open(objset_t *os, zil_get_data_t *g void zil_close(zilog_t *zilog) { - lwb_t *tail_lwb; + lwb_t *lwb; uint64_t txg = 0; zil_commit(zilog, 0); /* commit all itx */ @@ -1746,9 +1740,9 @@ zil_close(zilog_t *zilog) * destroy the zl_clean_taskq. */ mutex_enter(&zilog->zl_lock); - tail_lwb = list_tail(&zilog->zl_lwb_list); - if (tail_lwb != NULL) - txg = tail_lwb->lwb_max_txg; + lwb = list_tail(&zilog->zl_lwb_list); + if (lwb != NULL) + txg = lwb->lwb_max_txg; mutex_exit(&zilog->zl_lock); if (txg) txg_wait_synced(zilog->zl_dmu_pool, txg); @@ -1756,6 +1750,19 @@ zil_close(zilog_t *zilog) taskq_destroy(zilog->zl_clean_taskq); zilog->zl_clean_taskq = NULL; zilog->zl_get_data = NULL; + + /* + * We should have only one LWB left on the list; remove it now. + */ + mutex_enter(&zilog->zl_lock); + lwb = list_head(&zilog->zl_lwb_list); + if (lwb != NULL) { + ASSERT(lwb == list_tail(&zilog->zl_lwb_list)); + list_remove(&zilog->zl_lwb_list, lwb); + zio_buf_free(lwb->lwb_buf, lwb->lwb_sz); + kmem_cache_free(zil_lwb_cache, lwb); + } + mutex_exit(&zilog->zl_lock); } /* From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 20:01:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 641FA106564A; Sat, 30 Jul 2011 20:01:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3A10A8FC0A; Sat, 30 Jul 2011 20:01:38 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id DCCC546B1A; Sat, 30 Jul 2011 16:01:37 -0400 (EDT) Received: from [192.168.1.55] (c-68-36-150-83.hsd1.nj.comcast.net [68.36.150.83]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 630778A02C; Sat, 30 Jul 2011 16:01:37 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: John Baldwin In-Reply-To: <201107301333.p6UDX5ca001997@svn.freebsd.org> Date: Sat, 30 Jul 2011 16:01:36 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201107301333.p6UDX5ca001997@svn.freebsd.org> To: Bjoern A. Zeeb X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Sat, 30 Jul 2011 16:01:37 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224516 - in head/sys: amd64/amd64 i386/i386 pc98/pc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 20:01:38 -0000 On Jul 30, 2011, at 9:33 AM, Bjoern A. Zeeb wrote: > Author: bz > Date: Sat Jul 30 13:33:05 2011 > New Revision: 224516 > URL: http://svn.freebsd.org/changeset/base/224516 >=20 > Log: > Introduce a tunable to disable the time consuming parts of bootup > memtesting, which can easily save seconds to minutes of boot time. > The tunable name is kept general to allow reusing the code in > alternate frameworks. Why the 'tmpul' variable? The TUNABLE_*_FETCH() macros will not modify = the parameter if the environment variable is missing or unparseable. Lots of places = depend on this all over the kernel already, so you can depend on it here. --=20 John Baldwin From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 20:29:40 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41A90106566B; Sat, 30 Jul 2011 20:29:40 +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 327508FC16; Sat, 30 Jul 2011 20:29:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6UKTebs014411; Sat, 30 Jul 2011 20:29:40 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UKTeGc014409; Sat, 30 Jul 2011 20:29:40 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201107302029.p6UKTeGc014409@svn.freebsd.org> From: Andriy Gapon Date: Sat, 30 Jul 2011 20:29:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224527 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 20:29:40 -0000 Author: avg Date: Sat Jul 30 20:29:39 2011 New Revision: 224527 URL: http://svn.freebsd.org/changeset/base/224527 Log: smp_rendezvous: master cpu should wait until all slaves are fully done This is a followup to r222032 and a reimplementation of it. While that revision fixed the race for the smp_rv_waiters[2] exit sentinel, it still left a possibility for a target CPU to access stale or wrong smp_rv_func_arg in smp_rv_teardown_func. To fix this race the slave CPUs signal when they are really fully done with the rendezvous and the master CPU waits until all slaves are done. Diagnosed by: kib Reviewed by: jhb, mlaier, neel Approved by: re (kib) MFC after: 2 weeks Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Sat Jul 30 19:00:31 2011 (r224526) +++ head/sys/kern/subr_smp.c Sat Jul 30 20:29:39 2011 (r224527) @@ -109,8 +109,7 @@ static void (*volatile smp_rv_setup_func static void (*volatile smp_rv_action_func)(void *arg); static void (*volatile smp_rv_teardown_func)(void *arg); static void *volatile smp_rv_func_arg; -static volatile int smp_rv_waiters[3]; -static volatile int smp_rv_generation; +static volatile int smp_rv_waiters[4]; /* * Shared mutex to restrict busywaits between smp_rendezvous() and @@ -321,7 +320,6 @@ smp_rendezvous_action(void) void (*local_setup_func)(void*); void (*local_action_func)(void*); void (*local_teardown_func)(void*); - int generation; #ifdef INVARIANTS int owepreempt; #endif @@ -336,7 +334,6 @@ smp_rendezvous_action(void) local_setup_func = smp_rv_setup_func; local_action_func = smp_rv_action_func; local_teardown_func = smp_rv_teardown_func; - generation = smp_rv_generation; /* * Use a nested critical section to prevent any preemptions @@ -382,32 +379,28 @@ smp_rendezvous_action(void) if (local_action_func != NULL) local_action_func(local_func_arg); - /* - * Signal that the main action has been completed. If a - * full exit rendezvous is requested, then all CPUs will - * wait here until all CPUs have finished the main action. - * - * Note that the write by the last CPU to finish the action - * may become visible to different CPUs at different times. - * As a result, the CPU that initiated the rendezvous may - * exit the rendezvous and drop the lock allowing another - * rendezvous to be initiated on the same CPU or a different - * CPU. In that case the exit sentinel may be cleared before - * all CPUs have noticed causing those CPUs to hang forever. - * Workaround this by using a generation count to notice when - * this race occurs and to exit the rendezvous in that case. - */ - MPASS(generation == smp_rv_generation); - atomic_add_int(&smp_rv_waiters[2], 1); if (local_teardown_func != smp_no_rendevous_barrier) { - while (smp_rv_waiters[2] < smp_rv_ncpus && - generation == smp_rv_generation) + /* + * Signal that the main action has been completed. If a + * full exit rendezvous is requested, then all CPUs will + * wait here until all CPUs have finished the main action. + */ + atomic_add_int(&smp_rv_waiters[2], 1); + while (smp_rv_waiters[2] < smp_rv_ncpus) cpu_spinwait(); if (local_teardown_func != NULL) local_teardown_func(local_func_arg); } + /* + * Signal that the rendezvous is fully completed by this CPU. + * This means that no member of smp_rv_* pseudo-structure will be + * accessed by this target CPU after this point; in particular, + * memory pointed by smp_rv_func_arg. + */ + atomic_add_int(&smp_rv_waiters[3], 1); + td->td_critnest--; KASSERT(owepreempt == td->td_owepreempt, ("rendezvous action changed td_owepreempt")); @@ -441,8 +434,6 @@ smp_rendezvous_cpus(cpuset_t map, mtx_lock_spin(&smp_ipi_mtx); - atomic_add_acq_int(&smp_rv_generation, 1); - /* Pass rendezvous parameters via global variables. */ smp_rv_ncpus = ncpus; smp_rv_setup_func = setup_func; @@ -451,6 +442,7 @@ smp_rendezvous_cpus(cpuset_t map, smp_rv_func_arg = arg; smp_rv_waiters[1] = 0; smp_rv_waiters[2] = 0; + smp_rv_waiters[3] = 0; atomic_store_rel_int(&smp_rv_waiters[0], 0); /* @@ -466,13 +458,13 @@ smp_rendezvous_cpus(cpuset_t map, smp_rendezvous_action(); /* - * If the caller did not request an exit barrier to be enforced - * on each CPU, ensure that this CPU waits for all the other - * CPUs to finish the rendezvous. + * Ensure that the master CPU waits for all the other + * CPUs to finish the rendezvous, so that smp_rv_* + * pseudo-structure and the arg are guaranteed to not + * be in use. */ - if (teardown_func == smp_no_rendevous_barrier) - while (atomic_load_acq_int(&smp_rv_waiters[2]) < ncpus) - cpu_spinwait(); + while (atomic_load_acq_int(&smp_rv_waiters[3]) < ncpus) + cpu_spinwait(); mtx_unlock_spin(&smp_ipi_mtx); } From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 20:42:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD283106564A; Sat, 30 Jul 2011 20:42:14 +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 A39358FC08; Sat, 30 Jul 2011 20:42: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 p6UKgEJa014782; Sat, 30 Jul 2011 20:42:14 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UKgEIV014778; Sat, 30 Jul 2011 20:42:14 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201107302042.p6UKgEIV014778@svn.freebsd.org> From: Andriy Gapon Date: Sat, 30 Jul 2011 20:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224528 - in head: release/doc/en_US.ISO8859-1/hardware share/man/man4 tools/tools/sysdoc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 20:42:14 -0000 Author: avg Date: Sat Jul 30 20:42:14 2011 New Revision: 224528 URL: http://svn.freebsd.org/changeset/base/224528 Log: update smp related documentation after recent changes Remove references to machdep.hlt_logical_cpus and machdep.hlt_cpus sysctls and tunables. Document machdep.hyperthreading_allowed and hint.lapic.X.disabled tunables. Prompted by: ru Proofreading: bf Reviewed by: jhb Approved by: re (kib) Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml head/share/man/man4/smp.4 head/tools/tools/sysdoc/tunables.mdoc Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Jul 30 20:29:39 2011 (r224527) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Jul 30 20:42:14 2011 (r224528) @@ -196,10 +196,8 @@ Because this naive scheduling can result in suboptimal performance, under certain circumstances it may be useful to disable the logical processors with the the - machdep.hlt_logical_cpus sysctl variable. - It is also possible to halt any CPU in the idle loop with the - machdep.hlt_cpus sysctl variable. The - &man.smp.4; manual page has more details. + machdep.hyperthreading_allowed tunable. + The &man.smp.4; manual page has more details. &os; will take advantage of Physical Address Extensions (PAE) support on CPUs that support this feature. A kernel Modified: head/share/man/man4/smp.4 ============================================================================== --- head/share/man/man4/smp.4 Sat Jul 30 20:29:39 2011 (r224527) +++ head/share/man/man4/smp.4 Sat Jul 30 20:42:14 2011 (r224528) @@ -63,10 +63,10 @@ the read-only sysctl variable .Pp .Fx allows specific CPUs on a multi-processor system to be disabled. -The sysctl variable -.Va machdep.hlt_cpus -is an integer bitmask denoting CPUs to halt, counting from 0. -Setting a bit to 1 will result in the corresponding CPU being +This can be done using the +.Va hint.lapic.X.disabled +tunable, where X is the APIC ID of a CPU. +Setting this tunable to 1 will result in the corresponding CPU being disabled. .Pp The @@ -122,12 +122,12 @@ tasks on CPUs that are closely grouped t supports hyperthreading on Intel CPU's on the i386 and AMD64 platforms. Since using logical CPUs can cause performance penalties under certain loads, the logical CPUs can be disabled by setting the -.Va machdep.hlt_logical_cpus -sysctl to one. -Note that this operation is different from the mechanism used by the +.Va machdep.hyperthreading_allowed +tunable to zero. .Xr cpuset 1 . .Sh SEE ALSO .Xr mptable 1 , +.Xr loader 8 , .Xr sysctl 8 , .Xr condvar 9 , .Xr msleep 9 , Modified: head/tools/tools/sysdoc/tunables.mdoc ============================================================================== --- head/tools/tools/sysdoc/tunables.mdoc Sat Jul 30 20:29:39 2011 (r224527) +++ head/tools/tools/sysdoc/tunables.mdoc Sat Jul 30 20:42:14 2011 (r224528) @@ -1233,24 +1233,12 @@ machdep.disable_mtrrs machdep.guessed_bootdev --- -machdep.hlt_cpus +machdep.hyperthreading_allowed bool -This option will permit the halting -of CPUs. -For instance, to halt CPU 0, -machdep.htl_cpus=1 can be used. -It is possible to halt two CPUs by providing -a comma separated list (i.e: cpu1,cpu2). - ---- -machdep.hlt_logical_cpus -bool - -This keeps the logical CPUs halted in the idle loop. -By default the logical CPUs are halted at startup. -It is also possible to halt any cpu in the idle loop now -using machdep.hlt_cpus. +Setting this tunable to zero disables +the use of additional logical processors +provided by Intel HTT technology. --- machdep.panic_on_nmi From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 21:08:34 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B03711065672; Sat, 30 Jul 2011 21:08:34 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: from vlakno.cz (lev.vlakno.cz [46.28.110.116]) by mx1.freebsd.org (Postfix) with ESMTP id 7162F8FC12; Sat, 30 Jul 2011 21:08:33 +0000 (UTC) Received: by vlakno.cz (Postfix, from userid 1002) id 90B8F7F38B0; Sat, 30 Jul 2011 23:08:31 +0200 (CEST) Date: Sat, 30 Jul 2011 23:08:31 +0200 From: Roman Divacky To: Martin Matuska Message-ID: <20110730210831.GA98105@freebsd.org> References: <201107301727.p6UHRTBr008855@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201107301727.p6UHRTBr008855@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224523 - head/contrib/gcc/cp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 21:08:34 -0000 Why are we compiling our in-tree gcc with assertions enabled in the first place? On Sat, Jul 30, 2011 at 05:27:29PM +0000, Martin Matuska wrote: > Author: mm > Date: Sat Jul 30 17:27:29 2011 > New Revision: 224523 > URL: http://svn.freebsd.org/changeset/base/224523 > > Log: > Fix invalid assertion of C++ external static data member declarations > as anonymous namespaces are local to the current translation. > > GCC PR: c++/33094 > > Reviewed by: uqs > Approved by: re (kib) > Obtained from: gcc (branches/redhat/gcc-4_1-branch, rev. 129554, GPLv2) > MFC after: 1 week > > Modified: > head/contrib/gcc/cp/ChangeLog > head/contrib/gcc/cp/decl.c > > Modified: head/contrib/gcc/cp/ChangeLog > ============================================================================== > --- head/contrib/gcc/cp/ChangeLog Sat Jul 30 14:13:57 2011 (r224522) > +++ head/contrib/gcc/cp/ChangeLog Sat Jul 30 17:27:29 2011 (r224523) > @@ -1,3 +1,9 @@ > +2007-09-29 Jason Merrill > + > + PR c++/33094 > + * decl.c (make_rtl_for_nonlocal_decl): It's ok for a member > + constant to not have DECL_EXTERNAL if it's file-local. > + > 2007-08-24 Jakub Jelinek > > PR c++/31941 > > Modified: head/contrib/gcc/cp/decl.c > ============================================================================== > --- head/contrib/gcc/cp/decl.c Sat Jul 30 14:13:57 2011 (r224522) > +++ head/contrib/gcc/cp/decl.c Sat Jul 30 17:27:29 2011 (r224523) > @@ -4968,7 +4968,7 @@ make_rtl_for_nonlocal_decl (tree decl, t > /* An in-class declaration of a static data member should be > external; it is only a declaration, and not a definition. */ > if (init == NULL_TREE) > - gcc_assert (DECL_EXTERNAL (decl)); > + gcc_assert (DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl)); > } > > /* We don't create any RTL for local variables. */ From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 21:09:35 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FCD9106566B; Sat, 30 Jul 2011 21:09:35 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 535D68FC12; Sat, 30 Jul 2011 21:09:33 +0000 (UTC) Received: by fxe4 with SMTP id 4so4641497fxe.13 for ; Sat, 30 Jul 2011 14:09:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type; bh=frUVb/KGMPGpqdzWFpDZy75+v0ECobOfk0Kukc0pa5Y=; b=xBvdYl28nZQZIe0+m+Tt2BK4gUGZKt3KaWEw8dG/liGwmcUAjykVtDWy8WRwA3PwFZ sTHcALFiz7agjzcumHEtuqVxNwPj85vYs5cwym8SO0D7XEofv+lsITgGx1PZa6zy5u7G Vz+mPPGK9Kwd2YtxEXEcsONjeClHgCbBuB0eg= Received: by 10.223.76.202 with SMTP id d10mr3868751fak.106.1312058870838; Sat, 30 Jul 2011 13:47:50 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id x2sm1696538fal.44.2011.07.30.13.47.46 (version=SSLv3 cipher=OTHER); Sat, 30 Jul 2011 13:47:48 -0700 (PDT) Sender: Alexander Motin Message-ID: <4E346DD9.5030902@FreeBSD.org> Date: Sat, 30 Jul 2011 23:47:21 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Kostik Belousov References: <201107292030.p6TKUSaf064895@svn.freebsd.org> <20110730163723.GZ17489@deviant.kiev.zoral.com.ua> In-Reply-To: <20110730163723.GZ17489@deviant.kiev.zoral.com.ua> X-Enigmail-Version: 0.96.0 Content-Type: multipart/mixed; boundary="------------020700080908040403090808" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r224496 - head/sys/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 21:09:35 -0000 This is a multi-part message in MIME format. --------------020700080908040403090808 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Kostik Belousov wrote: > On Fri, Jul 29, 2011 at 08:30:28PM +0000, Alexander Motin wrote: >> Author: mav >> Date: Fri Jul 29 20:30:28 2011 >> New Revision: 224496 >> URL: http://svn.freebsd.org/changeset/base/224496 >> >> Log: >> In some cases failed SATA disks may report their presence, but don't >> respond to any commands. I've found that because of multiple command >> retries, each of which cause 30s timeout, bus reset and another retry or >> requeue for many commands, it may take ages to eventually drop the >> failed device. The odd thing is that those retries continue even after >> XPT considered device as dead and invalidated it. >> >> This patch makes cam_periph_error() to block any command retries after >> periph was marked as invalid. With that patch all activity completes in >> 1-2 minutes, just after several timeouts, required to consider device >> death. This should make ZFS, gmirror, graid, etc. operation more robust. >> >> Reviewed by: mjacob@ on scsi@ >> >> Approved by: re (kib) >> >> Modified: >> head/sys/cam/cam_periph.c > Amusingly, this commit makes my test machine to not boot. > This is Ibex Peak PCH, with two SATA disks on the channels 0 and 1. > > It seems that geom thread 100012 owns GEOM topology lock, while sleeping > in adaclose->cam_periph_getccb() : > > db> bt 100012 > Tracing pid 12 tid 100012 td 0xfffffe00028a2000 > sched_switch() at 0xffffffff8034a0c7 = sched_switch+0x157 > mi_switch() at 0xffffffff803291fb = mi_switch+0x2eb > sleepq_switch() at 0xffffffff803631f3 = sleepq_switch+0x123 > sleepq_wait() at 0xffffffff80363eed = sleepq_wait+0x4d > _sleep() at 0xffffffff80329b59 = _sleep+0x3b9 > cam_periph_getccb() at 0xffffffff817ffc50 = cam_periph_getccb+0xa0 > adaclose() at 0xffffffff8182c484 = adaclose+0xc4 > g_disk_access() at 0xffffffff802bea74 = g_disk_access+0x1e4 > g_access() at 0xffffffff802c519a = g_access+0x1ba > g_dev_attrchanged() at 0xffffffff802bd1f6 = g_dev_attrchanged+0x96 > g_dev_taste() at 0xffffffff802bd574 = g_dev_taste+0x284 > g_new_provider_event() at 0xffffffff802c4ecd = g_new_provider_event+0xad > g_run_events() at 0xffffffff802c0750 = g_run_events+0x250 > fork_exit() at 0xffffffff802f0d99 = fork_exit+0x189 > fork_trampoline() at 0xffffffff804ee3be = fork_trampoline+0xe > --- trap 0, rip = 0, rsp = 0xffffff800025fd00, rbp = 0 --- > > (gdb) list *cam_periph_getccb+0xa0 > 0x1c50 is in cam_periph_getccb (/usr/home/kostik/work/build/bsd/DEV/src/sys/modules/cam/../../cam/cam_periph.c:883). > 882 > 883 while (SLIST_FIRST(&periph->ccb_list) == NULL) { > 884 if (periph->immediate_priority > priority) > > Reverting the rev. or not loading ahci.ko allows machine to boot. After many experiments I believe that problem is not related to this change. I've managed to reproduce it depending on GEOM modules registration order. After I disabled all GEOM modules and only geom_dev left, problem became persistent. Specifics of the geom_dev is that it opens device and closes it back without doing any I/O. That caused race condition between CCB allocation for FLUSHCACHE execution in adaclose() and higher-priority commands of device initialization sequence. Any I/O scheduled before adaclose() closed that race, making problem rare. The problem is specific to the ada, as for no other driver initialization and payload requests may intersect in time. Attached patch solved the problem for me. Please try it and approve commit if it works. -- Alexander Motin --------------020700080908040403090808 Content-Type: text/plain; name="adaschedule.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="adaschedule.patch" --- cam/ata/ata_da.c.prev 2011-07-30 22:22:21.000000000 +0300 +++ cam/ata/ata_da.c 2011-07-30 23:12:22.000000000 +0300 @@ -488,12 +488,20 @@ static void adaschedule(struct cam_periph *periph) { struct ada_softc *softc = (struct ada_softc *)periph->softc; + uint32_t prio; + /* Check if cam_periph_getccb() was called. */ + prio = periph->immediate_priority; + + /* Check if we have more work to do. */ if (bioq_first(&softc->bio_queue) || (!softc->trim_running && bioq_first(&softc->trim_queue))) { - /* Have more work to do, so ensure we stay scheduled */ - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + prio = CAM_PRIORITY_NORMAL; } + + /* Schedule CCB if any of above is true. */ + if (prio != CAM_PRIORITY_NONE) + xpt_schedule(periph, prio); } /* --------------020700080908040403090808-- From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 21:09:45 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 941A0106566B; Sat, 30 Jul 2011 21:09:45 +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 84B728FC16; Sat, 30 Jul 2011 21:09:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6UL9jmM015570; Sat, 30 Jul 2011 21:09:45 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UL9jsE015568; Sat, 30 Jul 2011 21:09:45 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201107302109.p6UL9jsE015568@svn.freebsd.org> From: Andriy Gapon Date: Sat, 30 Jul 2011 21:09:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224529 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 21:09:45 -0000 Author: avg Date: Sat Jul 30 21:09:45 2011 New Revision: 224529 URL: http://svn.freebsd.org/changeset/base/224529 Log: fix a typo/tautology in the release documentation Approved by: re (kib) MFC after: 1 week Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Jul 30 20:42:14 2011 (r224528) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Jul 30 21:09:45 2011 (r224529) @@ -195,7 +195,7 @@ resources between logical processors within the same CPU. Because this naive scheduling can result in suboptimal performance, under certain circumstances it may be useful to - disable the logical processors with the the + disable the logical processors with the machdep.hyperthreading_allowed tunable. The &man.smp.4; manual page has more details. From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 21:17:07 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1125B106566B; Sat, 30 Jul 2011 21:17:07 +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 CBEAB8FC13; Sat, 30 Jul 2011 21:17:05 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id AAA00500; Sun, 31 Jul 2011 00:17:03 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1QnGu7-0008PW-9c; Sun, 31 Jul 2011 00:17:03 +0300 Message-ID: <4E3474CE.5090301@FreeBSD.org> Date: Sun, 31 Jul 2011 00:17:02 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20110706 Thunderbird/5.0 MIME-Version: 1.0 To: Alexander Motin References: <201107292030.p6TKUSaf064895@svn.freebsd.org> <20110730163723.GZ17489@deviant.kiev.zoral.com.ua> <4E346DD9.5030902@FreeBSD.org> In-Reply-To: <4E346DD9.5030902@FreeBSD.org> X-Enigmail-Version: 1.2pre Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Cc: Kostik Belousov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224496 - head/sys/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 21:17:07 -0000 on 30/07/2011 23:47 Alexander Motin said the following: > Kostik Belousov wrote: >> On Fri, Jul 29, 2011 at 08:30:28PM +0000, Alexander Motin wrote: >>> Author: mav >>> Date: Fri Jul 29 20:30:28 2011 >>> New Revision: 224496 >>> URL: http://svn.freebsd.org/changeset/base/224496 >>> >>> Log: >>> In some cases failed SATA disks may report their presence, but don't >>> respond to any commands. I've found that because of multiple command >>> retries, each of which cause 30s timeout, bus reset and another retry or >>> requeue for many commands, it may take ages to eventually drop the >>> failed device. The odd thing is that those retries continue even after >>> XPT considered device as dead and invalidated it. >>> >>> This patch makes cam_periph_error() to block any command retries after >>> periph was marked as invalid. With that patch all activity completes in >>> 1-2 minutes, just after several timeouts, required to consider device >>> death. This should make ZFS, gmirror, graid, etc. operation more robust. >>> >>> Reviewed by: mjacob@ on scsi@ >>> >>> Approved by: re (kib) >>> >>> Modified: >>> head/sys/cam/cam_periph.c >> Amusingly, this commit makes my test machine to not boot. >> This is Ibex Peak PCH, with two SATA disks on the channels 0 and 1. >> >> It seems that geom thread 100012 owns GEOM topology lock, while sleeping >> in adaclose->cam_periph_getccb() : >> >> db> bt 100012 >> Tracing pid 12 tid 100012 td 0xfffffe00028a2000 >> sched_switch() at 0xffffffff8034a0c7 = sched_switch+0x157 >> mi_switch() at 0xffffffff803291fb = mi_switch+0x2eb >> sleepq_switch() at 0xffffffff803631f3 = sleepq_switch+0x123 >> sleepq_wait() at 0xffffffff80363eed = sleepq_wait+0x4d >> _sleep() at 0xffffffff80329b59 = _sleep+0x3b9 >> cam_periph_getccb() at 0xffffffff817ffc50 = cam_periph_getccb+0xa0 >> adaclose() at 0xffffffff8182c484 = adaclose+0xc4 >> g_disk_access() at 0xffffffff802bea74 = g_disk_access+0x1e4 >> g_access() at 0xffffffff802c519a = g_access+0x1ba >> g_dev_attrchanged() at 0xffffffff802bd1f6 = g_dev_attrchanged+0x96 >> g_dev_taste() at 0xffffffff802bd574 = g_dev_taste+0x284 >> g_new_provider_event() at 0xffffffff802c4ecd = g_new_provider_event+0xad >> g_run_events() at 0xffffffff802c0750 = g_run_events+0x250 >> fork_exit() at 0xffffffff802f0d99 = fork_exit+0x189 >> fork_trampoline() at 0xffffffff804ee3be = fork_trampoline+0xe >> --- trap 0, rip = 0, rsp = 0xffffff800025fd00, rbp = 0 --- >> >> (gdb) list *cam_periph_getccb+0xa0 >> 0x1c50 is in cam_periph_getccb (/usr/home/kostik/work/build/bsd/DEV/src/sys/modules/cam/../../cam/cam_periph.c:883). >> 882 >> 883 while (SLIST_FIRST(&periph->ccb_list) == NULL) { >> 884 if (periph->immediate_priority > priority) >> >> Reverting the rev. or not loading ahci.ko allows machine to boot. > > After many experiments I believe that problem is not related to this > change. I've managed to reproduce it depending on GEOM modules > registration order. After I disabled all GEOM modules and only geom_dev > left, problem became persistent. Specifics of the geom_dev is that it > opens device and closes it back without doing any I/O. That caused race > condition between CCB allocation for FLUSHCACHE execution in adaclose() > and higher-priority commands of device initialization sequence. Any I/O > scheduled before adaclose() closed that race, making problem rare. The > problem is specific to the ada, as for no other driver initialization > and payload requests may intersect in time. Alexander, somewhat contradicting your conclusions... can the following issue be also caused by similar mechanics? http://lists.freebsd.org/pipermail/freebsd-current/2010-October/020336.html > Attached patch solved the problem for me. Please try it and approve > commit if it works. > -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 21:42:54 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A1AA1065673; Sat, 30 Jul 2011 21:42:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4A848FC0A; Sat, 30 Jul 2011 21:42:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6ULgr9v016659; Sat, 30 Jul 2011 21:42:53 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6ULgrbL016657; Sat, 30 Jul 2011 21:42:53 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201107302142.p6ULgrbL016657@svn.freebsd.org> From: Alexander Motin Date: Sat, 30 Jul 2011 21:42:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224531 - head/sys/cam/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 21:42:54 -0000 Author: mav Date: Sat Jul 30 21:42:53 2011 New Revision: 224531 URL: http://svn.freebsd.org/changeset/base/224531 Log: Higher-priority initialization request can eat request scheduling done from adaclose(). Add immediate_priority check into adaschedule() to restore it. Approved by: re (kib) MFC after: 1 week Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Sat Jul 30 21:28:34 2011 (r224530) +++ head/sys/cam/ata/ata_da.c Sat Jul 30 21:42:53 2011 (r224531) @@ -484,12 +484,20 @@ static void adaschedule(struct cam_periph *periph) { struct ada_softc *softc = (struct ada_softc *)periph->softc; + uint32_t prio; + /* Check if cam_periph_getccb() was called. */ + prio = periph->immediate_priority; + + /* Check if we have more work to do. */ if (bioq_first(&softc->bio_queue) || (!softc->trim_running && bioq_first(&softc->trim_queue))) { - /* Have more work to do, so ensure we stay scheduled */ - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + prio = CAM_PRIORITY_NORMAL; } + + /* Schedule CCB if any of above is true. */ + if (prio != CAM_PRIORITY_NONE) + xpt_schedule(periph, prio); } /* From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 22:21:42 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B285A1065673; Sat, 30 Jul 2011 22:21:42 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id A932B8FC16; Sat, 30 Jul 2011 22:21:41 +0000 (UTC) Received: by fxe4 with SMTP id 4so4679438fxe.13 for ; Sat, 30 Jul 2011 15:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=svrrbO1T5fwIE/CZKzGJG8K96W1pZ/p0SkvY5YeXvgI=; b=k64bWIkVKpl23ZVpc23xTSUvWcNl6JiVECmeG4END4tpBIgVhXSghAzF2CbzivtW1A 6vMJXow37TRdsLsDc+/EL3jaY7pXyv6be3e33UkCaT5clCWDtE8RQb6BaRpGpInlbb2z JrXFcjp0dU4RiRvP1ILnB9i7d4KgfVUCtDHio= Received: by 10.223.76.17 with SMTP id a17mr3990825fak.32.1312064500404; Sat, 30 Jul 2011 15:21:40 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id g20sm1409032fai.45.2011.07.30.15.21.38 (version=SSLv3 cipher=OTHER); Sat, 30 Jul 2011 15:21:39 -0700 (PDT) Sender: Alexander Motin Message-ID: <4E3483D8.3060507@FreeBSD.org> Date: Sun, 31 Jul 2011 01:21:12 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Andriy Gapon References: <201107292030.p6TKUSaf064895@svn.freebsd.org> <20110730163723.GZ17489@deviant.kiev.zoral.com.ua> <4E346DD9.5030902@FreeBSD.org> <4E3474CE.5090301@FreeBSD.org> In-Reply-To: <4E3474CE.5090301@FreeBSD.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r224496 - head/sys/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 22:21:42 -0000 Andriy Gapon wrote: > on 30/07/2011 23:47 Alexander Motin said the following: >> After many experiments I believe that problem is not related to this >> change. I've managed to reproduce it depending on GEOM modules >> registration order. After I disabled all GEOM modules and only geom_dev >> left, problem became persistent. Specifics of the geom_dev is that it >> opens device and closes it back without doing any I/O. That caused race >> condition between CCB allocation for FLUSHCACHE execution in adaclose() >> and higher-priority commands of device initialization sequence. Any I/O >> scheduled before adaclose() closed that race, making problem rare. The >> problem is specific to the ada, as for no other driver initialization >> and payload requests may intersect in time. > > somewhat contradicting your conclusions... can the following issue be also > caused by similar mechanics? > http://lists.freebsd.org/pipermail/freebsd-current/2010-October/020336.html Not sure, At least not exactly the same. cd driver keeps hold on device until probe completes, effectively blocking cdopen(). Seems there was a window in case of CD changers (closed month ago at r223557), but it should not affect plain CDs. Also, as soon as cd driver sends requests from cdopen(), not cdclose(), there would be much more chances to hit some global problem, as it would not depend on GEOM taste order. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 22:57:39 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34143106564A; Sat, 30 Jul 2011 22:57:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23FB88FC15; Sat, 30 Jul 2011 22:57:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6UMvdNl018924; Sat, 30 Jul 2011 22:57:39 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UMvdWf018922; Sat, 30 Jul 2011 22:57:39 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201107302257.p6UMvdWf018922@svn.freebsd.org> From: Rick Macklem Date: Sat, 30 Jul 2011 22:57:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224532 - head/sys/fs/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 22:57:39 -0000 Author: rmacklem Date: Sat Jul 30 22:57:38 2011 New Revision: 224532 URL: http://svn.freebsd.org/changeset/base/224532 Log: The new NFS client failed to vput() the new vnode if a setattr failed after the file was created in nfs_create(). This would probably only happen during a forced dismount. The old NFS client does have a vput() for this case. Detected by pho during recent testing, where an open syscall returned with a vnode still locked. Tested by: pho Approved by: re (kib) MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Sat Jul 30 21:42:53 2011 (r224531) +++ head/sys/fs/nfsclient/nfs_clvnops.c Sat Jul 30 22:57:38 2011 (r224532) @@ -1596,6 +1596,8 @@ again: if (attrflag) (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL, 0, 1); + if (error != 0) + vput(newvp); } } if (!error) { From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 23:07:52 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52C20106566B; Sat, 30 Jul 2011 23:07:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id DD6A68FC13; Sat, 30 Jul 2011 23:07:51 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p6UN7iJr003120 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 31 Jul 2011 09:07:47 +1000 Date: Sun, 31 Jul 2011 09:07:44 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin In-Reply-To: Message-ID: <20110731081349.K1061@besplex.bde.org> References: <201107301333.p6UDX5ca001997@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, "Bjoern A. Zeeb" , src-committers@FreeBSD.org Subject: Re: svn commit: r224516 - in head/sys: amd64/amd64 i386/i386 pc98/pc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 23:07:52 -0000 On Sat, 30 Jul 2011, John Baldwin wrote: > > On Jul 30, 2011, at 9:33 AM, Bjoern A. Zeeb wrote: > >> Author: bz >> Date: Sat Jul 30 13:33:05 2011 >> New Revision: 224516 >> URL: http://svn.freebsd.org/changeset/base/224516 >> >> Log: >> Introduce a tunable to disable the time consuming parts of bootup >> memtesting, which can easily save seconds to minutes of boot time. >> The tunable name is kept general to allow reusing the code in >> alternate frameworks. > > Why the 'tmpul' variable? The TUNABLE_*_FETCH() macros will not modify the parameter > if the environment variable is missing or unparseable. Lots of places depend on this all over > the kernel already, so you can depend on it here. And why do it and `memtest' have type unsigned long? This is a strange type for a boolean variable. The dependency is visible on there being almost no other instances of checking the return value of TUNABLE_*_FETCH(). E.g., in kern/*.c in a checkout a few months ago, there are 50 lines matching TUNABLE.*FETCH. Only 1 of these lines has an 'if (' in it. This 1 is in sysv_shm.c and seems to be correct since it is checking that a tunable which should not be used (because it has been renamed) is in fact not used. In the whole kernel, 155 lines match TUNABLE.*FETCH and 14 of these match 'if ('. Some of the 14 are not wrong. About 1/3 of them are for dubious use in memory sizing. E.g., in amd64/machdep.c: % realmem = Maxmem; The unprobed Maxmem remains in realmem for printing a confusing value later in sysctls. % % /* % * Display physical memory if SMBIOS reports reasonable amount. % */ % memsize = 0; % sysenv = getenv("smbios.memory.enabled"); % if (sysenv != NULL) { % memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10; % freeenv(sysenv); % } First override for `memsize'. % if (memsize < ptoa((uintmax_t)cnt.v_free_count)) % memsize = ptoa((uintmax_t)Maxmem); `memsize' is normally (?) `Maxmem' in bytes, but not if SMBIOS set it. % printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); Code doesn't match comment. The display is unconditional, but the comment set that it is only done if SMBIOS reports a reasonable amount. `memsize' is not used after this point, so the only effect of the SMBIOS check is to possibly print a value that is different from all of the following: - the initial Maxmem in bytes - the final realmem in bytes (this equals the initial Maxmem in bytes) - the final Maxmem in bytes. The comment is also wrong in saying that SMBIOS is used. Only an environment string is used. Users can easily confuse themselves by putting garbage in this string. The above logic is also confused by the memory size being in cnt.v_free_cnt. If SMBIOS does't change memsize from 0, then we use Maxmem even if it is larger than cnt.v_free_cnt. % /* % * Maxmem isn't the "maximum memory", it's one larger than the % * highest page of the physical address space. It should be % * called something like "Maxphyspage". We may adjust this % * based on ``hw.physmem'' and the results of the memory test. % */ % Maxmem = atop(physmap[physmap_idx + 1]); Here we change Maxmem to another unprobed value. I think this value is more closely related to cnt.v_free_cnt. % % #ifdef MAXMEM % Maxmem = MAXMEM / 4; % #endif Then we optionally change MaxMem to a hard-configured value. % % if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) % Maxmem = atop(physmem_tunable); Then we use a temporary variable, since the primary variable has units of pages while the tunable has units of bytes. But this can be reorganized to: /* * memsize was Maxmem in bytes, but was not maintained when Maxmem * was changed about. Maintain it now. */ memsize = ptoa(Maxmem). * * XXX we also have a physmem variable, but this can't be used to * hole the result of the tunable any more than Maxmem can, since * it is in pages. memsize is not quite right either, since it * is a uintmax_t while the following assumes that it is u_long. * The u_long is too small for PAE on i386, but works for amd64. * The uintmax_t is needed on i386, but is not needed for amd64. */ TUNABLE_ULONG_FETCH("hw.physmem", &memsize); /* XXX sic */ Maxmem = atop(memsize); % /* % * Don't allow MAXMEM or hw.physmem to extend the amount of memory % * in the system. % */ % if (Maxmem > atop(physmap[physmap_idx + 1])) % Maxmem = atop(physmap[physmap_idx + 1]); After all these defaults and overrides for Maxmem, who knows its relationship to the "real memory" printed originally and printed later by sysctl? The memory size overrides and probes exist mainly to handle cases where the original value is wrong, so preserving the original value is a bug in most cases where it differs from the final value. Bruce From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 23:09:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30A761065675; Sat, 30 Jul 2011 23:09:53 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F87F8FC1E; Sat, 30 Jul 2011 23:09:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6UN9r3M019323; Sat, 30 Jul 2011 23:09:53 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6UN9rhJ019321; Sat, 30 Jul 2011 23:09:53 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201107302309.p6UN9rhJ019321@svn.freebsd.org> From: Joel Dahl Date: Sat, 30 Jul 2011 23:09:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224533 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 23:09:53 -0000 Author: joel (doc committer) Date: Sat Jul 30 23:09:52 2011 New Revision: 224533 URL: http://svn.freebsd.org/changeset/base/224533 Log: Add a better description, a few examples and a couple of minor fixes. Reviewed by: brueffer Approved by: re (kib) Modified: head/share/man/man4/pcm.4 Modified: head/share/man/man4/pcm.4 ============================================================================== --- head/share/man/man4/pcm.4 Sat Jul 30 22:57:38 2011 (r224532) +++ head/share/man/man4/pcm.4 Sat Jul 30 23:09:52 2011 (r224533) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 13, 2009 +.Dd July 31, 2011 .Dt SOUND 4 .Os .Sh NAME @@ -41,7 +41,121 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device sound" .Ed +.Sh DESCRIPTION +The +.Nm +driver is the main component of the +.Fx sound system. +It works in conjunction with a bridge device driver on supported devices +and provides PCM audio record and playback once it attaches. +Each bridge device driver supports a specific set of audio chipsets and +needs to be enabled together with the +.Nm +driver. +PCI and ISA PnP audio devices identify themselves so users are usually not +required to add anything to +.Pa /boot/device.hints . +.Pp +Some of the main features of the +.Nm +driver are: multichannel audio, per-application +volume control, dynamic mixing through virtual sound channels, true full +duplex operation, bit perfect audio, rate conversion and low latency +modes. +.Pp +The +.Nm +driver is enabled by default, along with several bridge device drivers. +Those not enabled by default can be loaded during runtime with +.Xr kldload 8 +or during boot via +.Xr loader.conf 5 . +The following bridge device drivers are available: .Pp +.Bl -bullet -compact +.It +.Xr snd_ad1816 4 +.It +.Xr snd_ai2s 4 (enabled by default on powerpc) +.It +.Xr snd_als4000 4 +.It +.Xr snd_atiixp 4 +.It +.Xr snd_audiocs 4 (enabled by default on sparc64) +.It +.Xr snd_cmi 4 +.It +.Xr snd_cs4281 4 +.It +.Xr snd_csa 4 +.It +.Xr snd_davbus 4 (enabled by default on powerpc) +.It +.Xr snd_ds1 4 +.It +.Xr snd_emu10k1 4 +.It +.Xr snd_emu10kx 4 +.It +.Xr snd_envy24 4 +.It +.Xr snd_envy24ht 4 +.It +.Xr snd_es137x 4 (enabled by default on amd64, i386, sparc64) +.It +.Xr snd_ess 4 +.It +.Xr snd_fm801 4 +.It +.Xr snd_gusc 4 +.It +.Xr snd_hda 4 (enabled by default on amd64, i386) +.It +.Xr snd_ich 4 (enabled by default on amd64, i386) +.It +.Xr snd_maestro 4 +.It +.Xr snd_maestro3 4 +.It +.Xr snd_mss 4 +.It +.Xr snd_neomagic 4 +.It +snd_sb16 +.It +snd_sb8 +.It +.Xr snd_sbc 4 +.It +.Xr snd_solo 4 +.It +.Xr snd_spicds 4 +.It +.Xr snd_t4dwave 4 (enabled by default on sparc64) +.It +.Xr snd_uaudio 4 (enabled by default on amd64, i386, powerpc, sparc64) +.It +.Xr snd_via8233 4 (enabled by default on amd64, i386) +.It +.Xr snd_via82c686 4 +.It +.Xr snd_vibes 4 +.El +.Pp +Refer to the manual page for each bridge device driver for driver specific +settings and information. +.Ss Legacy Hardware +For old legacy +.Tn ISA +cards, the driver looks for +.Tn MSS +cards at addresses +.Dv 0x530 +and +.Dv 0x604 . +These values can be overridden in +.Pa /boot/device.hints . Non-PnP sound cards require the following lines in .Xr device.hints 5 : .Bd -literal -offset indent @@ -50,33 +164,6 @@ hint.pcm.0.irq="5" hint.pcm.0.drq="1" hint.pcm.0.flags="0x0" .Ed -.Sh DESCRIPTION -The -.Nm -driver provides support for -.Tn PCM -audio play and capture. -This driver also supports various -.Tn PCI , -.Tn ISA , -.Tn WSS/MSS -compatible -sound cards, AC97 mixer and High Definition Audio. -Once the -.Nm -driver attaches, supported devices provide audio record and -playback channels. -The -.Fx -sound system provides dynamic mixing -.Dq VCHAN -and rate conversion -.Dq soft formats . -True full duplex operation is available on most sound cards. -.Pp -If the sound card is supported by a bridge driver, the -.Nm -driver works in conjunction with the bridge driver. .Pp Apart from the usual parameters, the flags field is used to specify the secondary @@ -85,24 +172,6 @@ channel (generally used for capture in f Flags are set to 0 for cards not using a secondary .Tn DMA channel, or to 0x10 + C to specify channel C. -.Pp -The driver does its best to recognize the installed hardware and drive -it correctly so the user is not required to add several lines in -.Pa /boot/device.hints . -For -.Tn PCI -and -.Tn ISA -.Tn PnP -cards this is actually easy -since they identify themselves. -For legacy -.Tn ISA -cards, the driver looks for -.Tn MSS -cards at addresses 0x530 and 0x604 (unless overridden -in -.Pa /boot/device.hints ) . .Ss Boot Variables In general, the module .Pa snd_foo @@ -119,17 +188,18 @@ utility. Options which can be specified in .Pa /boot/loader.conf include: -.Bl -tag -width ".Va snd_emu10k1_load" -offset indent +.Bl -tag -width ".Va snd_driver_load" -offset indent .It Va snd_driver_load .Pq Dq Li NO If set to .Dq Li YES , this option loads all available drivers. -.It Va snd_emu10k1_load +.It Va snd_hda_load .Pq Dq Li NO If set to .Dq Li YES , -only the SoundBlaster 5.1 driver and dependent modules will be loaded. +only the Intel High Definition Audio bridge device driver and dependent +modules will be loaded. .It Va snd_foo_load .Pq Dq Li NO If set to @@ -155,8 +225,9 @@ This provides a base interface for relat support. Multichannel audio works both with and without .Tn VCHANs . -Most bridge device drivers are still missing multichannel matrixing support -, but in most cases this should be trivial to implement. +.Pp +Most bridge device drivers are still missing multichannel matrixing +support, but in most cases this should be trivial to implement. Use the .Va dev.pcm.%d.[play|rec].vchanformat .Xr sysctl(8) @@ -173,7 +244,7 @@ controls (bass and treble). Commonly used for ear-candy or frequency compensation due to the vast difference in hardware quality. EQ is disabled by default, but can be enabled with the -.Va hint.pcm. Ns Ao Ar X Ac Ns Va .eq +.Va hint.pcm.%d.eq tunable. .Ss VCHANs Each device can optionally support more playback and recording channels @@ -208,13 +279,13 @@ driver. The following tunables can not be changed during runtime using .Xr sysctl 8 . .Bl -tag -width indent -.It Va hint.pcm. Ns Ao Ar X Ac Ns Va .eq +.It Va hint.pcm.%d.eq Set to 1 or 0 to explicitly enable (1) or disable (0) the equalizer. Requires a driver reload if changed. Enabling this will make bass and treble controls appear in mixer applications. This tunable is undefined by default. Equalizing is disabled by default. -.It Va hint.pcm. Ns Ao Ar X Ac Ns Va .vpc +.It Va hint.pcm.%d.vpc Set to 1 or 0 to explicitly enable (1) or disable (0) the .Tn VPC feature. @@ -512,6 +583,9 @@ On devices that have more than one recor there is a corresponding .Pa /dev/dsp%d.r%d device. +The +.Xr mixer 8 +utility can be used to start and stop recording from an specific device. .Ss Statistics Channel statistics are only kept while the device is open. So with situations involving overruns and underruns, consider the output @@ -586,6 +660,31 @@ For specific sound card access, please i .Pa /dev/dsp or .Pa /dev/dsp%d . +.Sh EXAMPLES +Use the sound metadriver to load all +.Nm +bridge device drivers at once +(for example if it is unclear which the correct driver to use is): +.Pp +.Dl kldload snd_driver +.Pp +Load a specific bridge device driver, in this case the Intel +High Definition Audio driver: +.Pp +.Dl kldload snd_hda +.Pp +Check the status of all detected +.Nm +devices: +.Pp +.Dl cat /dev/sndstat +.Pp +Change the default sound device, in this case to the second device. +This is handy if there are multiple +.Nm +devices available: +.Pp +.Dl sysctl hw.snd.default_unit=1 .Sh DIAGNOSTICS .Bl -diag .It pcm%d:play:%d:dsp%d.p%d: play interrupt timeout, channel dead @@ -596,12 +695,14 @@ A device node is not created properly. .El .Sh SEE ALSO .Xr snd_ad1816 4 , +.Xr snd_ai2s 4 , .Xr snd_als4000 4 , .Xr snd_atiixp 4 , .Xr snd_audiocs 4 , .Xr snd_cmi 4 , .Xr snd_cs4281 4 , .Xr snd_csa 4 , +.Xr snd_davbus 4 , .Xr snd_ds1 4 , .Xr snd_emu10k1 4 , .Xr snd_emu10kx 4 , @@ -630,6 +731,7 @@ A device node is not created properly. .Xr loader.conf 5 , .Xr dmesg 8 , .Xr kldload 8 , +.Xr mixer 8 , .Xr sysctl 8 .Rs .%T "Cookbook formulae for audio EQ biquad filter coefficients, by Robert Bristow-Johnson" From owner-svn-src-head@FreeBSD.ORG Sat Jul 30 23:21:53 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C156106566B; Sat, 30 Jul 2011 23:21:53 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 937E98FC0C; Sat, 30 Jul 2011 23:21:52 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p6UNLjsJ001468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 31 Jul 2011 09:21:48 +1000 Date: Sun, 31 Jul 2011 09:21:45 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans In-Reply-To: <20110731081349.K1061@besplex.bde.org> Message-ID: <20110731091237.R1216@besplex.bde.org> References: <201107301333.p6UDX5ca001997@svn.freebsd.org> <20110731081349.K1061@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, "Bjoern A. Zeeb" , John Baldwin , src-committers@FreeBSD.org Subject: Re: svn commit: r224516 - in head/sys: amd64/amd64 i386/i386 pc98/pc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2011 23:21:53 -0000 On Sun, 31 Jul 2011, Bruce Evans wrote: > ... In the > whole kernel, 155 lines match TUNABLE.*FETCH and 14 of these match 'if ('. > Some of the 14 are not wrong. About 1/3 of them are for dubious use in > memory sizing. E.g., in amd64/machdep.c: > > % realmem = Maxmem; > > The unprobed Maxmem remains in realmem for printing a confusing value later > in sysctls. Oops. This is actually the final (probed) value of Maxmem. I got confused by the file order being different from the dynamic order. > > % % /* > % * Display physical memory if SMBIOS reports reasonable amount. > % */ > % memsize = 0; > % sysenv = getenv("smbios.memory.enabled"); > % if (sysenv != NULL) { > % memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << > 10; > % freeenv(sysenv); > % } > > First override for `memsize'. > > % if (memsize < ptoa((uintmax_t)cnt.v_free_count)) > % memsize = ptoa((uintmax_t)Maxmem); > > `memsize' is normally (?) `Maxmem' in bytes, but not if SMBIOS set it. > > % printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); > > Code doesn't match comment. The display is unconditional, but the comment > set that it is only done if SMBIOS reports a reasonable amount. > > `memsize' is not used after this point, so the only effect of the SMBIOS > check is to possibly print a value that is different from all of the > following: > - the initial Maxmem in bytes > - the final realmem in bytes (this equals the initial Maxmem in bytes) > - the final Maxmem in bytes. > The comment is also wrong in saying that SMBIOS is used. Only an > environment string is used. Users can easily confuse themselves by putting > garbage in this string. > > The above logic is also confused by the memory size being in cnt.v_free_cnt. > If SMBIOS does't change memsize from 0, then we use Maxmem even if it is > larger than cnt.v_free_cnt. So realmem is the correct final value unless the SMBIOS non-call gives a different value; in the latter case, we print this different value above but the realmem sysctl can't recover it. > % /* > % * Maxmem isn't the "maximum memory", it's one larger than the > % * highest page of the physical address space. It should be > % * called something like "Maxphyspage". We may adjust this > % * based on ``hw.physmem'' and the results of the memory test. > % */ > % Maxmem = atop(physmap[physmap_idx + 1]); > > Here we change Maxmem to another unprobed value. I think this value is > more closely related to cnt.v_free_cnt. > > % % #ifdef MAXMEM > % Maxmem = MAXMEM / 4; > % #endif > > Then we optionally change MaxMem to a hard-configured value. > > % % if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) > % Maxmem = atop(physmem_tunable); > > Then we use a temporary variable, since the primary variable has > units of pages while the tunable has units of bytes. But this can > be reorganized to: > > /* > * memsize was Maxmem in bytes, but was not maintained when Maxmem > * was changed about. Maintain it now. > */ > memsize = ptoa(Maxmem). > * > * XXX we also have a physmem variable, but this can't be used to > * hole the result of the tunable any more than Maxmem can, since > * it is in pages. memsize is not quite right either, since it > * is a uintmax_t while the following assumes that it is u_long. > * The u_long is too small for PAE on i386, but works for amd64. > * The uintmax_t is needed on i386, but is not needed for amd64. > */ > TUNABLE_ULONG_FETCH("hw.physmem", &memsize); /* XXX sic */ > Maxmem = atop(memsize); > > % /* > % * Don't allow MAXMEM or hw.physmem to extend the amount of memory > % * in the system. > % */ > % if (Maxmem > atop(physmap[physmap_idx + 1])) > % Maxmem = atop(physmap[physmap_idx + 1]); Now we're in the getmemsize() function, which doesn't have a memsize variable. It should have one instead of the physmem_tunable variable, if only because the physmem tunable is actually for memsize in bytes and not for physmem in pages. Bruce