From owner-svn-src-all@freebsd.org Sun Aug 20 00:41:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AED8DCDB9A; Sun, 20 Aug 2017 00:41:51 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DECA26B9E3; Sun, 20 Aug 2017 00:41:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7K0foOk011926; Sun, 20 Aug 2017 00:41:50 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7K0foic011925; Sun, 20 Aug 2017 00:41:50 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708200041.v7K0foic011925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 20 Aug 2017 00:41:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322710 - head/sys/x86/cpufreq X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/x86/cpufreq X-SVN-Commit-Revision: 322710 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 00:41:51 -0000 Author: cem Date: Sun Aug 20 00:41:49 2017 New Revision: 322710 URL: https://svnweb.freebsd.org/changeset/base/322710 Log: hwpstate: Add support for family 17h pstate info from MSRs This information is normally available via acpi_perf, but in case it is not, add support for fetching the information via MSRs on AMD family 17h (Zen) processors. Zen uses a slightly different formula than previous generation AMD CPUs. This was inspired by, but does not fix, PR 221621. Reported by: Sean P. R. Reviewed by: mjoras@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12082 Modified: head/sys/x86/cpufreq/hwpstate.c Modified: head/sys/x86/cpufreq/hwpstate.c ============================================================================== --- head/sys/x86/cpufreq/hwpstate.c Sat Aug 19 23:13:33 2017 (r322709) +++ head/sys/x86/cpufreq/hwpstate.c Sun Aug 20 00:41:49 2017 (r322710) @@ -83,6 +83,10 @@ __FBSDID("$FreeBSD$"); #define AMD_10H_11H_CUR_DID(msr) (((msr) >> 6) & 0x07) #define AMD_10H_11H_CUR_FID(msr) ((msr) & 0x3F) +#define AMD_17H_CUR_VID(msr) (((msr) >> 14) & 0xFF) +#define AMD_17H_CUR_DID(msr) (((msr) >> 8) & 0x3F) +#define AMD_17H_CUR_FID(msr) ((msr) & 0xFF) + #define HWPSTATE_DEBUG(dev, msg...) \ do{ \ if(hwpstate_verbose) \ @@ -426,6 +430,15 @@ hwpstate_get_info_from_msr(device_t dev) case 0x15: case 0x16: hwpstate_set[i].freq = (100 * (fid + 0x10)) >> did; + break; + case 0x17: + did = AMD_17H_CUR_DID(msr); + if (did == 0) { + HWPSTATE_DEBUG(dev, "unexpected did: 0\n"); + did = 1; + } + fid = AMD_17H_CUR_FID(msr); + hwpstate_set[i].freq = (200 * fid) / did; break; default: HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family" From owner-svn-src-all@freebsd.org Sun Aug 20 01:08:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F4FCDCFBBC; Sun, 20 Aug 2017 01:08:25 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A53096C681; Sun, 20 Aug 2017 01:08:24 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7K18NnN021060; Sun, 20 Aug 2017 01:08:23 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7K18NYH021054; Sun, 20 Aug 2017 01:08:23 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708200108.v7K18NYH021054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 20 Aug 2017 01:08:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322711 - in stable/11/sys: conf fs/ext2fs modules/ext2fs X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in stable/11/sys: conf fs/ext2fs modules/ext2fs X-SVN-Commit-Revision: 322711 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 01:08:25 -0000 Author: pfg Date: Sun Aug 20 01:08:23 2017 New Revision: 322711 URL: https://svnweb.freebsd.org/changeset/base/322711 Log: MFC r316341, r317779, r319071, r319077, r319557, r319558, r319827, r319829: ext2fs: add read-write support for Extended Attributes and linux ACLs. Extended attributes and their particular implementation in linux are different from FreeBSD so in this case we have started diverging from the UFS EA implementation, which would be the natural reference. Support for linux ext2fs posix-draft ACLs. Submitted by: Fedor Uporov Reviewed by: pfg Include fixes from: cem, pluknet Added: stable/11/sys/fs/ext2fs/ext2_acl.c - copied, changed from r319071, head/sys/fs/ext2fs/ext2_acl.c stable/11/sys/fs/ext2fs/ext2_acl.h - copied unchanged from r319071, head/sys/fs/ext2fs/ext2_acl.h stable/11/sys/fs/ext2fs/ext2_extattr.c - copied, changed from r316341, head/sys/fs/ext2fs/ext2_extattr.c stable/11/sys/fs/ext2fs/ext2_extattr.h - copied, changed from r316341, head/sys/fs/ext2fs/ext2_extattr.h Modified: stable/11/sys/conf/files stable/11/sys/fs/ext2fs/ext2_alloc.c stable/11/sys/fs/ext2fs/ext2_extern.h stable/11/sys/fs/ext2fs/ext2_inode.c stable/11/sys/fs/ext2fs/ext2_inode_cnv.c stable/11/sys/fs/ext2fs/ext2_vnops.c stable/11/sys/fs/ext2fs/ext2fs.h stable/11/sys/fs/ext2fs/inode.h stable/11/sys/modules/ext2fs/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Sun Aug 20 00:41:49 2017 (r322710) +++ stable/11/sys/conf/files Sun Aug 20 01:08:23 2017 (r322711) @@ -3329,9 +3329,11 @@ geom/virstor/binstream.c optional geom_virstor geom/virstor/g_virstor.c optional geom_virstor geom/virstor/g_virstor_md.c optional geom_virstor geom/zero/g_zero.c optional geom_zero +fs/ext2fs/ext2_acl.c optional ext2fs fs/ext2fs/ext2_alloc.c optional ext2fs fs/ext2fs/ext2_balloc.c optional ext2fs fs/ext2fs/ext2_bmap.c optional ext2fs +fs/ext2fs/ext2_extattr.c optional ext2fs fs/ext2fs/ext2_extents.c optional ext2fs fs/ext2fs/ext2_inode.c optional ext2fs fs/ext2fs/ext2_inode_cnv.c optional ext2fs Copied and modified: stable/11/sys/fs/ext2fs/ext2_acl.c (from r319071, head/sys/fs/ext2fs/ext2_acl.c) ============================================================================== --- head/sys/fs/ext2fs/ext2_acl.c Sun May 28 15:39:11 2017 (r319071, copy source) +++ stable/11/sys/fs/ext2fs/ext2_acl.c Sun Aug 20 01:08:23 2017 (r322711) @@ -49,6 +49,8 @@ #include #include +#ifdef UFS_ACL + void ext2_sync_acl_from_inode(struct inode *ip, struct acl *acl) { @@ -127,13 +129,18 @@ ext2_sync_inode_from_acl(struct acl *acl, struct inode static int ext4_acl_from_disk(char *value, size_t size, struct acl *acl) { - const char *end = value + size; + const char *end; int n, count, s; + if (value == NULL) + return (EINVAL); + + end = value + size; + if (((struct ext2_acl_header *)value)->a_version != EXT4_ACL_VERSION) return (EINVAL); - if (!value || size < sizeof(struct ext2_acl_header)) + if (size < sizeof(struct ext2_acl_header)) return (EINVAL); s = size - sizeof(struct ext2_acl_header); @@ -210,11 +217,6 @@ ext2_getacl_posix1e(struct vop_getacl_args *ap) int len; int error; - len = sizeof(*ap->a_aclp) + sizeof(struct ext2_acl_header); - value = malloc(len, M_ACL, M_WAITOK); - if (!value) - return (ENOMEM); - switch (ap->a_type) { case ACL_TYPE_DEFAULT: attrnamespace = POSIX1E_ACL_DEFAULT_EXTATTR_NAMESPACE; @@ -228,10 +230,14 @@ ext2_getacl_posix1e(struct vop_getacl_args *ap) return (EINVAL); } + len = sizeof(*ap->a_aclp) + sizeof(struct ext2_acl_header); + value = malloc(len, M_ACL, M_WAITOK); + if (!value) + return (ENOMEM); + error = vn_extattr_get(ap->a_vp, IO_NODELOCKED, attrnamespace, attrname, &len, value, ap->a_td); - switch (error) { - case ENOATTR: + if (error == ENOATTR) { switch (ap->a_type) { case ACL_TYPE_ACCESS: ap->a_aclp->acl_cnt = 3; @@ -250,22 +256,21 @@ ext2_getacl_posix1e(struct vop_getacl_args *ap) ap->a_aclp->acl_cnt = 0; break; } - case 0: - if (!error) { - error = ext4_acl_from_disk(value, len, ap->a_aclp); - if (error) - goto out; - } + } else if (error != 0) + goto out; - if (error == ENOATTR) - error = 0; - - if (ap->a_type == ACL_TYPE_ACCESS) - ext2_sync_acl_from_inode(VTOI(ap->a_vp), ap->a_aclp); - default: - break; + if (!error) { + error = ext4_acl_from_disk(value, len, ap->a_aclp); + if (error) + goto out; } + if (error == ENOATTR) + error = 0; + + if (ap->a_type == ACL_TYPE_ACCESS) + ext2_sync_acl_from_inode(VTOI(ap->a_vp), ap->a_aclp); + out: free(value, M_TEMP); return (error); @@ -276,7 +281,7 @@ ext2_getacl(struct vop_getacl_args *ap) { if (((ap->a_vp->v_mount->mnt_flag & MNT_ACLS) == 0) || - ((ap->a_vp->v_mount->mnt_flag & MNT_NFS4ACLS) == 1)) + ((ap->a_vp->v_mount->mnt_flag & MNT_NFS4ACLS) != 0)) return (EOPNOTSUPP); if (ap->a_type == ACL_TYPE_NFS4) @@ -473,7 +478,7 @@ int ext2_setacl(struct vop_setacl_args *ap) { if (((ap->a_vp->v_mount->mnt_flag & MNT_ACLS) == 0) || - ((ap->a_vp->v_mount->mnt_flag & MNT_NFS4ACLS) == 1)) + ((ap->a_vp->v_mount->mnt_flag & MNT_NFS4ACLS) != 0)) return (EOPNOTSUPP); if (ap->a_type == ACL_TYPE_NFS4) @@ -490,7 +495,7 @@ ext2_aclcheck(struct vop_aclcheck_args *ap) { if (((ap->a_vp->v_mount->mnt_flag & MNT_ACLS) == 0) || - ((ap->a_vp->v_mount->mnt_flag & MNT_NFS4ACLS) == 1)) + ((ap->a_vp->v_mount->mnt_flag & MNT_NFS4ACLS) != 0)) return (EOPNOTSUPP); if (ap->a_type == ACL_TYPE_NFS4) @@ -518,4 +523,6 @@ ext2_aclcheck(struct vop_aclcheck_args *ap) } return (acl_posix1e_check(ap->a_aclp)); -} \ No newline at end of file +} + +#endif /* UFS_ACL */ Copied: stable/11/sys/fs/ext2fs/ext2_acl.h (from r319071, head/sys/fs/ext2fs/ext2_acl.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/fs/ext2fs/ext2_acl.h Sun Aug 20 01:08:23 2017 (r322711, copy of r319071, head/sys/fs/ext2fs/ext2_acl.h) @@ -0,0 +1,55 @@ +/*- + * Copyright (c) 2017, Fedor Uporov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _FS_EXT2FS_EXT2_ACL_H_ +#define _FS_EXT2FS_EXT2_ACL_H_ + +#define EXT4_ACL_VERSION 0x0001 + +struct ext2_acl_entry { + int16_t ae_tag; + int16_t ae_perm; + int32_t ae_id; +}; + +struct ext2_acl_entry_short { + int16_t ae_tag; + int16_t ae_perm; +}; + +struct ext2_acl_header { + int32_t a_version; +}; + +void ext2_sync_acl_from_inode(struct inode *ip, struct acl *acl); + +int ext2_getacl(struct vop_getacl_args *); +int ext2_setacl(struct vop_setacl_args *); +int ext2_aclcheck(struct vop_aclcheck_args *); + +#endif /* !_FS_EXT2FS_EXT2_ACL_H_ */ Modified: stable/11/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- stable/11/sys/fs/ext2fs/ext2_alloc.c Sun Aug 20 00:41:49 2017 (r322710) +++ stable/11/sys/fs/ext2fs/ext2_alloc.c Sun Aug 20 01:08:23 2017 (r322711) @@ -132,6 +132,25 @@ nospace: } /* + * Allocate EA's block for inode. + */ +daddr_t +ext2_allocfacl(struct inode *ip) +{ + struct m_ext2fs *fs; + daddr_t facl; + + fs = ip->i_e2fs; + + EXT2_LOCK(ip->i_ump); + facl = ext2_alloccg(ip, ino_to_cg(fs, ip->i_number), 0, fs->e2fs_bsize); + if (0 == facl) + EXT2_UNLOCK(ip->i_ump); + + return (facl); +} + +/* * Reallocate a sequence of blocks into a contiguous sequence of blocks. * * The vnode and an array of buffer pointers for a range of sequential Copied and modified: stable/11/sys/fs/ext2fs/ext2_extattr.c (from r316341, head/sys/fs/ext2fs/ext2_extattr.c) ============================================================================== --- head/sys/fs/ext2fs/ext2_extattr.c Sat Apr 1 01:00:36 2017 (r316341, copy source) +++ stable/11/sys/fs/ext2fs/ext2_extattr.c Sun Aug 20 01:08:23 2017 (r322711) @@ -44,24 +44,126 @@ #include #include #include +#include +static int +ext2_extattr_attrnamespace_to_bsd(int attrnamespace) +{ + switch (attrnamespace) { + case EXT4_XATTR_INDEX_SYSTEM: + return (EXTATTR_NAMESPACE_SYSTEM); + + case EXT4_XATTR_INDEX_USER: + return (EXTATTR_NAMESPACE_USER); + + case EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT: + return (POSIX1E_ACL_DEFAULT_EXTATTR_NAMESPACE); + + case EXT4_XATTR_INDEX_POSIX_ACL_ACCESS: + return (POSIX1E_ACL_ACCESS_EXTATTR_NAMESPACE); + } + + return (EXTATTR_NAMESPACE_EMPTY); +} + +static const char * +ext2_extattr_name_to_bsd(int attrnamespace, const char *name, int* name_len) +{ + + if (attrnamespace == EXT4_XATTR_INDEX_SYSTEM) + return (name); + else if (attrnamespace == EXT4_XATTR_INDEX_USER) + return (name); + else if (attrnamespace == EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT) { + *name_len = strlen(POSIX1E_ACL_DEFAULT_EXTATTR_NAME); + return (POSIX1E_ACL_DEFAULT_EXTATTR_NAME); + } else if (attrnamespace == EXT4_XATTR_INDEX_POSIX_ACL_ACCESS) { + *name_len = strlen(POSIX1E_ACL_ACCESS_EXTATTR_NAME); + return (POSIX1E_ACL_ACCESS_EXTATTR_NAME); + } + + /* + * XXX: Not all linux namespaces are mapped to bsd for now, + * return NULL, which will be converted to ENOTSUP on upper layer. + */ +#ifdef EXT2FS_DEBUG + printf("can not convert ext2fs name to bsd: namespace=%d\n", attrnamespace); +#endif + + return (NULL); +} + static int -ext2_extattr_index_to_bsd(int index) +ext2_extattr_attrnamespace_to_linux(int attrnamespace, const char *name) { - switch (index) { - case EXT4_XATTR_INDEX_USER: - return EXTATTR_NAMESPACE_USER; - case EXT4_XATTR_INDEX_SYSTEM: - return EXTATTR_NAMESPACE_SYSTEM; + if (attrnamespace == POSIX1E_ACL_DEFAULT_EXTATTR_NAMESPACE && + !strcmp(name, POSIX1E_ACL_DEFAULT_EXTATTR_NAME)) + return (EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT); - default: - return EXTATTR_NAMESPACE_EMPTY; + if (attrnamespace == POSIX1E_ACL_ACCESS_EXTATTR_NAMESPACE && + !strcmp(name, POSIX1E_ACL_ACCESS_EXTATTR_NAME)) + return (EXT4_XATTR_INDEX_POSIX_ACL_ACCESS); + + switch (attrnamespace) { + case EXTATTR_NAMESPACE_SYSTEM: + return (EXT4_XATTR_INDEX_SYSTEM); + + case EXTATTR_NAMESPACE_USER: + return (EXT4_XATTR_INDEX_USER); } + + /* + * In this case namespace conversion should be unique, + * so this point is unreachable. + */ + return (-1); } +static const char * +ext2_extattr_name_to_linux(int attrnamespace, const char *name) +{ + + if (attrnamespace == POSIX1E_ACL_DEFAULT_EXTATTR_NAMESPACE || + attrnamespace == POSIX1E_ACL_ACCESS_EXTATTR_NAMESPACE) + return (""); + else + return (name); +} + int +ext2_extattr_valid_attrname(int attrnamespace, const char *attrname) +{ + if (attrnamespace == EXTATTR_NAMESPACE_EMPTY) + return (EINVAL); + + if (strlen(attrname) == 0) + return (EINVAL); + + if (strlen(attrname) + 1 > EXT2_EXTATTR_NAMELEN_MAX) + return (ENAMETOOLONG); + + return (0); +} + +static int +ext2_extattr_check(struct ext2fs_extattr_entry *entry, char *end) +{ + struct ext2fs_extattr_entry *next; + + while (!EXT2_IS_LAST_ENTRY(entry)) { + next = EXT2_EXTATTR_NEXT(entry); + if ((char *)next >= end) + return (EIO); + + entry = next; + } + + return (0); +} + +int ext2_extattr_inode_list(struct inode *ip, int attrnamespace, struct uio *uio, size_t *size) { @@ -69,8 +171,8 @@ ext2_extattr_inode_list(struct inode *ip, int attrname struct buf *bp; struct ext2fs_extattr_dinode_header *header; struct ext2fs_extattr_entry *entry; - struct ext2fs_extattr_entry *next; - char *end; + const char *attr_name; + int name_len; int error; fs = ip->i_e2fs; @@ -95,38 +197,43 @@ ext2_extattr_inode_list(struct inode *ip, int attrname return (0); } - /* Check attributes integrity */ - entry = EXT2_IFIRST(header); - end = (char *)dinode + EXT2_INODE_SIZE(fs); - while (!EXT2_IS_LAST_ENTRY(entry)) { - next = EXT2_EXTATTR_NEXT(entry); - if ((char *)next >= end) { - brelse(bp); - return (EIO); - } - - entry = next; + error = ext2_extattr_check(EXT2_IFIRST(header), + (char *)dinode + EXT2_INODE_SIZE(fs)); + if (error) { + brelse(bp); + return (error); } for (entry = EXT2_IFIRST(header); !EXT2_IS_LAST_ENTRY(entry); - entry = EXT2_EXTATTR_NEXT(entry)) { - if (ext2_extattr_index_to_bsd(entry->e_name_index) != attrnamespace) + entry = EXT2_EXTATTR_NEXT(entry)) { + if (ext2_extattr_attrnamespace_to_bsd(entry->e_name_index) != + attrnamespace) continue; + name_len = entry->e_name_len; + attr_name = ext2_extattr_name_to_bsd(entry->e_name_index, + entry->e_name, &name_len); + if (!attr_name) { + brelse(bp); + return (ENOTSUP); + } + if (uio == NULL) - *size += entry->e_name_len + 1; + *size += name_len + 1; else { - char *attr_name = malloc(entry->e_name_len + 1, M_TEMP, M_WAITOK); - attr_name[0] = entry->e_name_len; - memcpy(&attr_name[1], entry->e_name, entry->e_name_len); - error = uiomove(attr_name, entry->e_name_len + 1, uio); - free(attr_name, M_TEMP); + char *name = malloc(name_len + 1, M_TEMP, M_WAITOK); + name[0] = name_len; + memcpy(&name[1], attr_name, name_len); + error = uiomove(name, name_len + 1, uio); + free(name, M_TEMP); + if (error) + break; } } brelse(bp); - return (0); + return (error); } int @@ -137,8 +244,8 @@ ext2_extattr_block_list(struct inode *ip, int attrname struct buf *bp; struct ext2fs_extattr_header *header; struct ext2fs_extattr_entry *entry; - struct ext2fs_extattr_entry *next; - char *end; + const char *attr_name; + int name_len; int error; fs = ip->i_e2fs; @@ -157,38 +264,42 @@ ext2_extattr_block_list(struct inode *ip, int attrname return (EINVAL); } - /* Check attributes integrity */ - end = bp->b_data + bp->b_bufsize; - entry = EXT2_FIRST_ENTRY(bp); - while (!EXT2_IS_LAST_ENTRY(entry)) { - next = EXT2_EXTATTR_NEXT(entry); - if ((char *)next >= end) { - brelse(bp); - return (EIO); - } - - entry = next; + error = ext2_extattr_check(EXT2_FIRST_ENTRY(bp), bp->b_data + bp->b_bufsize); + if (error) { + brelse(bp); + return (error); } for (entry = EXT2_FIRST_ENTRY(bp); !EXT2_IS_LAST_ENTRY(entry); entry = EXT2_EXTATTR_NEXT(entry)) { - if (ext2_extattr_index_to_bsd(entry->e_name_index) != attrnamespace) + if (ext2_extattr_attrnamespace_to_bsd(entry->e_name_index) != + attrnamespace) continue; + name_len = entry->e_name_len; + attr_name = ext2_extattr_name_to_bsd(entry->e_name_index, + entry->e_name, &name_len); + if (!attr_name) { + brelse(bp); + return (ENOTSUP); + } + if (uio == NULL) - *size += entry->e_name_len + 1; + *size += name_len + 1; else { - char *attr_name = malloc(entry->e_name_len + 1, M_TEMP, M_WAITOK); - attr_name[0] = entry->e_name_len; - memcpy(&attr_name[1], entry->e_name, entry->e_name_len); - error = uiomove(attr_name, entry->e_name_len + 1, uio); - free(attr_name, M_TEMP); + char *name = malloc(name_len + 1, M_TEMP, M_WAITOK); + name[0] = name_len; + memcpy(&name[1], attr_name, name_len); + error = uiomove(name, name_len + 1, uio); + free(name, M_TEMP); + if (error) + break; } } brelse(bp); - return (0); + return (error); } int @@ -199,8 +310,8 @@ ext2_extattr_inode_get(struct inode *ip, int attrnames struct buf *bp; struct ext2fs_extattr_dinode_header *header; struct ext2fs_extattr_entry *entry; - struct ext2fs_extattr_entry *next; - char *end; + const char *attr_name; + int name_len; int error; fs = ip->i_e2fs; @@ -222,45 +333,47 @@ ext2_extattr_inode_get(struct inode *ip, int attrnames if (header->h_magic != EXTATTR_MAGIC) { brelse(bp); - return (0); + return (ENOATTR); } - /* Check attributes integrity */ - entry = EXT2_IFIRST(header); - end = (char *)dinode + EXT2_INODE_SIZE(fs); - while (!EXT2_IS_LAST_ENTRY(entry)) { - next = EXT2_EXTATTR_NEXT(entry); - if ((char *)next >= end) { - brelse(bp); - return (EIO); - } - - entry = next; + error = ext2_extattr_check(EXT2_IFIRST(header), + (char *)dinode + EXT2_INODE_SIZE(fs)); + if (error) { + brelse(bp); + return (error); } for (entry = EXT2_IFIRST(header); !EXT2_IS_LAST_ENTRY(entry); entry = EXT2_EXTATTR_NEXT(entry)) { - if (ext2_extattr_index_to_bsd(entry->e_name_index) != attrnamespace) + if (ext2_extattr_attrnamespace_to_bsd(entry->e_name_index) != + attrnamespace) continue; - if (strlen(name) == entry->e_name_len && - 0 == strncmp(entry->e_name, name, entry->e_name_len)) { + name_len = entry->e_name_len; + attr_name = ext2_extattr_name_to_bsd(entry->e_name_index, + entry->e_name, &name_len); + if (!attr_name) { + brelse(bp); + return (ENOTSUP); + } + + if (strlen(name) == name_len && + 0 == strncmp(attr_name, name, name_len)) { if (uio == NULL) *size += entry->e_value_size; else { - error = uiomove(((char *)EXT2_IFIRST(header)) + entry->e_value_offs, - entry->e_value_size, uio); - if (error) { - brelse(bp); - return (error); - } + error = uiomove(((char *)EXT2_IFIRST(header)) + + entry->e_value_offs, entry->e_value_size, uio); } + + brelse(bp); + return (error); } } brelse(bp); - return (0); + return (ENOATTR); } int @@ -271,8 +384,8 @@ ext2_extattr_block_get(struct inode *ip, int attrnames struct buf *bp; struct ext2fs_extattr_header *header; struct ext2fs_extattr_entry *entry; - struct ext2fs_extattr_entry *next; - char *end; + const char *attr_name; + int name_len; int error; fs = ip->i_e2fs; @@ -291,40 +404,822 @@ ext2_extattr_block_get(struct inode *ip, int attrnames return (EINVAL); } - /* Check attributes integrity */ - end = bp->b_data + bp->b_bufsize; - entry = EXT2_FIRST_ENTRY(bp); - while (!EXT2_IS_LAST_ENTRY(entry)) { - next = EXT2_EXTATTR_NEXT(entry); - if ((char *)next >= end) { - brelse(bp); - return (EIO); - } - - entry = next; + error = ext2_extattr_check(EXT2_FIRST_ENTRY(bp), bp->b_data + bp->b_bufsize); + if (error) { + brelse(bp); + return (error); } for (entry = EXT2_FIRST_ENTRY(bp); !EXT2_IS_LAST_ENTRY(entry); entry = EXT2_EXTATTR_NEXT(entry)) { - if (ext2_extattr_index_to_bsd(entry->e_name_index) != attrnamespace) + if (ext2_extattr_attrnamespace_to_bsd(entry->e_name_index) != + attrnamespace) continue; - if (strlen(name) == entry->e_name_len && - 0 == strncmp(entry->e_name, name, entry->e_name_len)) { + name_len = entry->e_name_len; + attr_name = ext2_extattr_name_to_bsd(entry->e_name_index, + entry->e_name, &name_len); + if (!attr_name) { + brelse(bp); + return (ENOTSUP); + } + + if (strlen(name) == name_len && + 0 == strncmp(attr_name, name, name_len)) { if (uio == NULL) *size += entry->e_value_size; else { error = uiomove(bp->b_data + entry->e_value_offs, entry->e_value_size, uio); - if (error) { - brelse(bp); - return (error); - } } + + brelse(bp); + return (error); } } brelse(bp); + + return (ENOATTR); +} + +static uint16_t +ext2_extattr_delete_value(char *off, + struct ext2fs_extattr_entry *first_entry, + struct ext2fs_extattr_entry *entry, char *end) +{ + uint16_t min_offs; + struct ext2fs_extattr_entry *next; + + min_offs = end - off; + next = first_entry; + while (!EXT2_IS_LAST_ENTRY(next)) { + if (min_offs > next->e_value_offs && next->e_value_offs > 0) + min_offs = next->e_value_offs; + + next = EXT2_EXTATTR_NEXT(next); + } + + if (entry->e_value_size == 0) + return (min_offs); + + memmove(off + min_offs + EXT2_EXTATTR_SIZE(entry->e_value_size), + off + min_offs, entry->e_value_offs - min_offs); + + /* Adjust all value offsets */ + next = first_entry; + while (!EXT2_IS_LAST_ENTRY(next)) + { + if (next->e_value_offs > 0 && + next->e_value_offs < entry->e_value_offs) + next->e_value_offs += + EXT2_EXTATTR_SIZE(entry->e_value_size); + + next = EXT2_EXTATTR_NEXT(next); + } + + min_offs += EXT2_EXTATTR_SIZE(entry->e_value_size); + + return (min_offs); +} + +static void +ext2_extattr_delete_entry(char *off, + struct ext2fs_extattr_entry *first_entry, + struct ext2fs_extattr_entry *entry, char *end) +{ + char *pad; + struct ext2fs_extattr_entry *next; + + /* Clean entry value */ + ext2_extattr_delete_value(off, first_entry, entry, end); + + /* Clean the entry */ + next = first_entry; + while (!EXT2_IS_LAST_ENTRY(next)) + next = EXT2_EXTATTR_NEXT(next); + + pad = (char*)next + sizeof(uint32_t); + + memmove(entry, (char *)entry + EXT2_EXTATTR_LEN(entry->e_name_len), + pad - ((char *)entry + EXT2_EXTATTR_LEN(entry->e_name_len))); +} + +int +ext2_extattr_inode_delete(struct inode *ip, int attrnamespace, const char *name) +{ + struct m_ext2fs *fs; + struct buf *bp; + struct ext2fs_extattr_dinode_header *header; + struct ext2fs_extattr_entry *entry; + const char *attr_name; + int name_len; + int error; + + fs = ip->i_e2fs; + + if ((error = bread(ip->i_devvp, + fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), + (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) { + brelse(bp); + return (error); + } + + struct ext2fs_dinode *dinode = (struct ext2fs_dinode *) + ((char *)bp->b_data + + EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)); + + /* Check attributes magic value */ + header = (struct ext2fs_extattr_dinode_header *)((char *)dinode + + E2FS_REV0_INODE_SIZE + dinode->e2di_extra_isize); + + if (header->h_magic != EXTATTR_MAGIC) { + brelse(bp); + return (ENOATTR); + } + + error = ext2_extattr_check(EXT2_IFIRST(header), + (char *)dinode + EXT2_INODE_SIZE(fs)); + if (error) { + brelse(bp); + return (error); + } + + /* If I am last entry, just make magic zero */ + entry = EXT2_IFIRST(header); + if ((EXT2_IS_LAST_ENTRY(EXT2_EXTATTR_NEXT(entry))) && + (ext2_extattr_attrnamespace_to_bsd(entry->e_name_index) == + attrnamespace)) { + + name_len = entry->e_name_len; + attr_name = ext2_extattr_name_to_bsd(entry->e_name_index, + entry->e_name, &name_len); + if (!attr_name) { + brelse(bp); + return (ENOTSUP); + } + + if (strlen(name) == name_len && + 0 == strncmp(attr_name, name, name_len)) { + memset(header, 0, sizeof(struct ext2fs_extattr_dinode_header)); + + return (bwrite(bp)); + } + } + + for (entry = EXT2_IFIRST(header); !EXT2_IS_LAST_ENTRY(entry); + entry = EXT2_EXTATTR_NEXT(entry)) { + if (ext2_extattr_attrnamespace_to_bsd(entry->e_name_index) != + attrnamespace) + continue; + + name_len = entry->e_name_len; + attr_name = ext2_extattr_name_to_bsd(entry->e_name_index, + entry->e_name, &name_len); + if (!attr_name) { + brelse(bp); + return (ENOTSUP); + } + + if (strlen(name) == name_len && + 0 == strncmp(attr_name, name, name_len)) { + ext2_extattr_delete_entry((char *)EXT2_IFIRST(header), + EXT2_IFIRST(header), entry, + (char *)dinode + EXT2_INODE_SIZE(fs)); + + return (bwrite(bp)); + } + } + + brelse(bp); + + return (ENOATTR); +} + +static int +ext2_extattr_block_clone(struct inode *ip, struct buf **bpp) +{ + struct m_ext2fs *fs; + struct buf *sbp; + struct buf *cbp; + struct ext2fs_extattr_header *header; + uint64_t facl; + + fs = ip->i_e2fs; + sbp = *bpp; + + header = EXT2_HDR(sbp); + if (header->h_magic != EXTATTR_MAGIC || header->h_refcount == 1) + return (EINVAL); + + facl = ext2_allocfacl(ip); + if (!facl) + return (ENOSPC); + + cbp = getblk(ip->i_devvp, fsbtodb(fs, facl), fs->e2fs_bsize, 0, 0, 0); + if (!cbp) { + ext2_blkfree(ip, facl, fs->e2fs_bsize); + return (EIO); + } + + memcpy(cbp->b_data, sbp->b_data, fs->e2fs_bsize); + header->h_refcount--; + bwrite(sbp); + + ip->i_facl = facl; + ext2_update(ip->i_vnode, 1); + + header = EXT2_HDR(cbp); + header->h_refcount = 1; + + *bpp = cbp; + + return (0); +} + +int +ext2_extattr_block_delete(struct inode *ip, int attrnamespace, const char *name) +{ + struct m_ext2fs *fs; + struct buf *bp; + struct ext2fs_extattr_header *header; + struct ext2fs_extattr_entry *entry; + const char *attr_name; + int name_len; + int error; + + fs = ip->i_e2fs; + + error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl), + fs->e2fs_bsize, NOCRED, &bp); + if (error) { + brelse(bp); + return (error); + } + + /* Check attributes magic value */ + header = EXT2_HDR(bp); + if (header->h_magic != EXTATTR_MAGIC || header->h_blocks != 1) { + brelse(bp); + return (EINVAL); + } + + error = ext2_extattr_check(EXT2_FIRST_ENTRY(bp), bp->b_data + bp->b_bufsize); + if (error) { + brelse(bp); + return (error); + } + + if (header->h_refcount > 1) { + error = ext2_extattr_block_clone(ip, &bp); + if (error) { + brelse(bp); + return (error); + } + } + + /* If I am last entry, clean me and free the block */ + entry = EXT2_FIRST_ENTRY(bp); + if (EXT2_IS_LAST_ENTRY(EXT2_EXTATTR_NEXT(entry)) && + (ext2_extattr_attrnamespace_to_bsd(entry->e_name_index) == + attrnamespace)) { + + name_len = entry->e_name_len; + attr_name = ext2_extattr_name_to_bsd(entry->e_name_index, + entry->e_name, &name_len); + if (!attr_name) { + brelse(bp); + return (ENOTSUP); + } + + if (strlen(name) == name_len && + 0 == strncmp(attr_name, name, name_len)) { + ip->i_blocks -= btodb(fs->e2fs_bsize); + ext2_blkfree(ip, ip->i_facl, fs->e2fs_bsize); + ip->i_facl = 0; + error = ext2_update(ip->i_vnode, 1); + + brelse(bp); + return (error); + } + } + + for (entry = EXT2_FIRST_ENTRY(bp); !EXT2_IS_LAST_ENTRY(entry); + entry = EXT2_EXTATTR_NEXT(entry)) { + if (ext2_extattr_attrnamespace_to_bsd(entry->e_name_index) != + attrnamespace) + continue; + + name_len = entry->e_name_len; + attr_name = ext2_extattr_name_to_bsd(entry->e_name_index, + entry->e_name, &name_len); + if (!attr_name) { + brelse(bp); + return (ENOTSUP); + } + + if (strlen(name) == name_len && + 0 == strncmp(attr_name, name, name_len)) { + ext2_extattr_delete_entry(bp->b_data, + EXT2_FIRST_ENTRY(bp), entry, + bp->b_data + bp->b_bufsize); + + return (bwrite(bp)); + } + } + + brelse(bp); + + return (ENOATTR); +} + +static struct ext2fs_extattr_entry * +allocate_entry(const char *name, int attrnamespace, uint16_t offs, + uint32_t size, uint32_t hash) +{ + const char *attr_name; + int name_len; + struct ext2fs_extattr_entry *entry; + + attr_name = ext2_extattr_name_to_linux(attrnamespace, name); + name_len = strlen(attr_name); + + entry = malloc(sizeof(struct ext2fs_extattr_entry) + name_len, + M_TEMP, M_WAITOK); + + entry->e_name_len = name_len; + entry->e_name_index = ext2_extattr_attrnamespace_to_linux(attrnamespace, name); + entry->e_value_offs = offs; + entry->e_value_block = 0; + entry->e_value_size = size; + entry->e_hash = hash; + memcpy(entry->e_name, name, name_len); + + return (entry); +} + +static void +free_entry(struct ext2fs_extattr_entry *entry) +{ + + free(entry, M_TEMP); +} + +static int +ext2_extattr_get_size(struct ext2fs_extattr_entry *first_entry, + struct ext2fs_extattr_entry *exist_entry, int header_size, + int name_len, int new_size) +{ + struct ext2fs_extattr_entry *entry; + int size; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Aug 20 01:27:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53FD5DD17B2; Sun, 20 Aug 2017 01:27:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F4116D111; Sun, 20 Aug 2017 01:27:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7K1RYac028903; Sun, 20 Aug 2017 01:27:34 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7K1RXVl028896; Sun, 20 Aug 2017 01:27:33 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708200127.v7K1RXVl028896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 20 Aug 2017 01:27:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322712 - in stable/11/sys: conf fs/ext2fs modules/ext2fs X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in stable/11/sys: conf fs/ext2fs modules/ext2fs X-SVN-Commit-Revision: 322712 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 01:27:35 -0000 Author: pfg Date: Sun Aug 20 01:27:33 2017 New Revision: 322712 URL: https://svnweb.freebsd.org/changeset/base/322712 Log: MFC r320145: ext2fs: Add uninit_bg feature support. From the linux tune2fs(8) manpage: "Allow the kernel to initialize bitmaps and inode tables and keep a high watermark for the unused inodes in a filesystem, to reduce e2fsck(8) time. This first e2fsck run after enabling this feature will take the full time, but subsequent e2fsck runs will take only a fraction of the original time, depending on how full the file system is." Submitted by: Fedor Uporov Added: stable/11/sys/fs/ext2fs/ext2_csum.c - copied unchanged from r320145, head/sys/fs/ext2fs/ext2_csum.c Modified: stable/11/sys/conf/files stable/11/sys/fs/ext2fs/ext2_alloc.c stable/11/sys/fs/ext2fs/ext2_extern.h stable/11/sys/fs/ext2fs/ext2_vfsops.c stable/11/sys/fs/ext2fs/ext2fs.h stable/11/sys/modules/ext2fs/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Sun Aug 20 01:08:23 2017 (r322711) +++ stable/11/sys/conf/files Sun Aug 20 01:27:33 2017 (r322712) @@ -3333,6 +3333,7 @@ fs/ext2fs/ext2_acl.c optional ext2fs fs/ext2fs/ext2_alloc.c optional ext2fs fs/ext2fs/ext2_balloc.c optional ext2fs fs/ext2fs/ext2_bmap.c optional ext2fs +fs/ext2fs/ext2_csum.c optional ext2fs fs/ext2fs/ext2_extattr.c optional ext2fs fs/ext2fs/ext2_extents.c optional ext2fs fs/ext2fs/ext2_inode.c optional ext2fs Modified: stable/11/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- stable/11/sys/fs/ext2fs/ext2_alloc.c Sun Aug 20 01:08:23 2017 (r322711) +++ stable/11/sys/fs/ext2fs/ext2_alloc.c Sun Aug 20 01:27:33 2017 (r322712) @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -657,6 +658,135 @@ ext2_hashalloc(struct inode *ip, int cg, long pref, in return (0); } +static unsigned long +ext2_cg_num_gdb(struct m_ext2fs *fs, int cg) +{ + int gd_per_block, metagroup, first, last; + + gd_per_block = fs->e2fs_bsize / sizeof(struct ext2_gd); + metagroup = cg / gd_per_block; + first = metagroup * gd_per_block; + last = first + gd_per_block - 1; + + if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG) || + metagroup < fs->e2fs->e3fs_first_meta_bg) { + if (!ext2_cg_has_sb(fs, cg)) + return (0); + if (EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG)) + return (fs->e2fs->e3fs_first_meta_bg); + return (fs->e2fs_gdbcount); + } + + if (cg == first || cg == first + 1 || cg == last) + return (1); + return (0); + +} + +static int +ext2_num_base_meta_blocks(struct m_ext2fs *fs, int cg) +{ + int num, gd_per_block; + + gd_per_block = fs->e2fs_bsize / sizeof(struct ext2_gd); + num = ext2_cg_has_sb(fs, cg); + + if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG) || + cg < fs->e2fs->e3fs_first_meta_bg * gd_per_block) { + if (num) { + num += ext2_cg_num_gdb(fs, cg); + num += fs->e2fs->e2fs_reserved_ngdb; + } + } else { + num += ext2_cg_num_gdb(fs, cg); + } + + return (num); +} + +static int +ext2_get_cg_number(struct m_ext2fs *fs, daddr_t blk) +{ + int cg; + + if (fs->e2fs->e2fs_bpg == fs->e2fs_bsize * 8) + cg = (blk - fs->e2fs->e2fs_first_dblock) / (fs->e2fs_bsize * 8); + else + cg = blk - fs->e2fs->e2fs_first_dblock; + + return (cg); +} + +static void +ext2_mark_bitmap_end(int start_bit, int end_bit, char *bitmap) +{ + int i; + + if (start_bit >= end_bit) + return; + + for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++) + setbit(bitmap, i); + if (i < end_bit) + memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3); +} + +static int +ext2_cg_block_bitmap_init(struct m_ext2fs *fs, int cg, struct buf *bp) +{ + int bit, bit_max, inodes_per_block; + uint32_t start, tmp; + + if (!EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_GDT_CSUM) || + !(fs->e2fs_gd[cg].ext4bgd_flags & EXT2_BG_BLOCK_UNINIT)) + return (0); + + memset(bp->b_data, 0, fs->e2fs_bsize); + + bit_max = ext2_num_base_meta_blocks(fs, cg); + if ((bit_max >> 3) >= fs->e2fs_bsize) + return (EINVAL); + + for (bit = 0; bit < bit_max; bit++) + setbit(bp->b_data, bit); + + start = cg * fs->e2fs->e2fs_bpg + fs->e2fs->e2fs_first_dblock; + + /* Set bits for block and inode bitmaps, and inode table */ + tmp = fs->e2fs_gd[cg].ext2bgd_b_bitmap; + if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_FLEX_BG) || + tmp == ext2_get_cg_number(fs, cg)) + setbit(bp->b_data, tmp - start); + + tmp = fs->e2fs_gd[cg].ext2bgd_i_bitmap; + if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_FLEX_BG) || + tmp == ext2_get_cg_number(fs, cg)) + setbit(bp->b_data, tmp - start); + + tmp = fs->e2fs_gd[cg].ext2bgd_i_tables; + inodes_per_block = fs->e2fs_bsize/EXT2_INODE_SIZE(fs); + while( tmp < fs->e2fs_gd[cg].ext2bgd_i_tables + + fs->e2fs->e2fs_ipg / inodes_per_block ) { + if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_FLEX_BG) || + tmp == ext2_get_cg_number(fs, cg)) + setbit(bp->b_data, tmp - start); + tmp++; + } + + /* + * Also if the number of blocks within the group is less than + * the blocksize * 8 ( which is the size of bitmap ), set rest + * of the block bitmap to 1 + */ + ext2_mark_bitmap_end(fs->e2fs->e2fs_bpg, fs->e2fs_bsize * 8, + bp->b_data); + + /* Clean the flag */ + fs->e2fs_gd[cg].ext4bgd_flags &= ~EXT2_BG_BLOCK_UNINIT; + + return (0); +} + /* * Determine whether a block can be allocated. * @@ -686,6 +816,14 @@ ext2_alloccg(struct inode *ip, int cg, daddr_t bpref, EXT2_LOCK(ump); return (0); } + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_GDT_CSUM)) { + error = ext2_cg_block_bitmap_init(fs, cg, bp); + if (error) { + brelse(bp); + EXT2_LOCK(ump); + return (0); + } + } if (fs->e2fs_gd[cg].ext2bgd_nbfree == 0) { /* * Another thread allocated the last block in this @@ -899,6 +1037,41 @@ fail: return (0); } +static int +ext2_zero_inode_table(struct inode *ip, int cg) +{ + struct m_ext2fs *fs; + struct buf *bp; + int i, all_blks, used_blks; + + fs = ip->i_e2fs; + + if (fs->e2fs_gd[cg].ext4bgd_flags & EXT2_BG_INODE_ZEROED) + return (0); + + all_blks = fs->e2fs->e2fs_inode_size * fs->e2fs->e2fs_ipg / + fs->e2fs_bsize; + + used_blks = howmany(fs->e2fs->e2fs_ipg - + fs->e2fs_gd[cg].ext4bgd_i_unused, + fs->e2fs_bsize / EXT2_INODE_SIZE(fs)); + + for (i = 0; i < all_blks - used_blks; i++) { + bp = getblk(ip->i_devvp, fsbtodb(fs, + fs->e2fs_gd[cg].ext2bgd_i_tables + used_blks + i), + fs->e2fs_bsize, 0, 0, 0); + if (!bp) + return (EIO); + + vfs_bio_bzero_buf(bp, 0, fs->e2fs_bsize); + bawrite(bp); + } + + fs->e2fs_gd[cg].ext4bgd_flags |= EXT2_BG_INODE_ZEROED; + + return (0); +} + /* * Determine whether an inode can be allocated. * @@ -930,6 +1103,18 @@ ext2_nodealloccg(struct inode *ip, int cg, daddr_t ipr EXT2_LOCK(ump); return (0); } + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_GDT_CSUM)) { + if (fs->e2fs_gd[cg].ext4bgd_flags & EXT2_BG_INODE_UNINIT) { + memset(bp->b_data, 0, fs->e2fs_bsize); + fs->e2fs_gd[cg].ext4bgd_flags &= ~EXT2_BG_INODE_UNINIT; + } + error = ext2_zero_inode_table(ip, cg); + if (error) { + brelse(bp); + EXT2_LOCK(ump); + return (0); + } + } if (fs->e2fs_gd[cg].ext2bgd_nifree == 0) { /* * Another thread allocated the last i-node in this @@ -964,6 +1149,8 @@ gotit: setbit(ibp, ipref); EXT2_LOCK(ump); fs->e2fs_gd[cg].ext2bgd_nifree--; + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_GDT_CSUM)) + fs->e2fs_gd[cg].ext4bgd_i_unused--; fs->e2fs->e2fs_ficount--; fs->e2fs_fmod = 1; if ((mode & IFMT) == IFDIR) { @@ -1062,6 +1249,8 @@ ext2_vfree(struct vnode *pvp, ino_t ino, int mode) EXT2_LOCK(ump); fs->e2fs->e2fs_ficount++; fs->e2fs_gd[cg].ext2bgd_nifree++; + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_GDT_CSUM)) + fs->e2fs_gd[cg].ext4bgd_i_unused++; if ((mode & IFMT) == IFDIR) { fs->e2fs_gd[cg].ext2bgd_ndirs--; fs->e2fs_total_dir--; @@ -1122,16 +1311,31 @@ ext2_fserr(struct m_ext2fs *fs, uid_t uid, char *cp) } int -cg_has_sb(int i) +ext2_cg_has_sb(struct m_ext2fs *fs, int cg) { int a3, a5, a7; - if (i == 0 || i == 1) - return 1; + if (cg == 0) + return (1); + + if (EXT2_HAS_COMPAT_FEATURE(fs, EXT2F_COMPAT_SPARSESUPER2)) { + if (cg == fs->e2fs->e4fs_backup_bgs[0] || + cg == fs->e2fs->e4fs_backup_bgs[1]) + return (1); + return (0); + } + + if ((cg <= 1) || + !EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_SPARSESUPER)) + return (1); + + if (!(cg & 1)) + return (0); + for (a3 = 3, a5 = 5, a7 = 7; - a3 <= i || a5 <= i || a7 <= i; + a3 <= cg || a5 <= cg || a7 <= cg; a3 *= 3, a5 *= 5, a7 *= 7) - if (i == a3 || i == a5 || i == a7) - return 1; - return 0; + if (cg == a3 || cg == a5 || cg == a7) + return (1); + return (0); } Copied: stable/11/sys/fs/ext2fs/ext2_csum.c (from r320145, head/sys/fs/ext2fs/ext2_csum.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/fs/ext2fs/ext2_csum.c Sun Aug 20 01:27:33 2017 (r322712, copy of r320145, head/sys/fs/ext2fs/ext2_csum.c) @@ -0,0 +1,147 @@ +/*- + * Copyright (c) 2017, Fedor Uporov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +static uint16_t +ext2_crc16(uint16_t crc, const void *buffer, unsigned int len) +{ + const unsigned char *cp = buffer; + /* CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1). */ + static uint16_t const crc16_table[256] = { + 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, + 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, + 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, + 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, + 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, + 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, + 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, + 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, + 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, + 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, + 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, + 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, + 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, + 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, + 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, + 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, + 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, + 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, + 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, + 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, + 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, + 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, + 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, + 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, + 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, + 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, + 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, + 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, + 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, + 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, + 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, + 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 + }; + + while (len--) + crc = (((crc >> 8) & 0xffU) ^ + crc16_table[(crc ^ *cp++) & 0xffU]) & 0x0000ffffU; + return crc; +} + +static uint16_t +ext2_gd_csum(struct m_ext2fs *fs, uint32_t block_group, struct ext2_gd *gd) +{ + size_t offset; + uint16_t crc; + + offset = offsetof(struct ext2_gd, ext4bgd_csum); + + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_GDT_CSUM)) { + crc = ext2_crc16(~0, fs->e2fs->e2fs_uuid, + sizeof(fs->e2fs->e2fs_uuid)); + crc = ext2_crc16(crc, (uint8_t *)&block_group, + sizeof(block_group)); + crc = ext2_crc16(crc, (uint8_t *)gd, offset); + offset += sizeof(gd->ext4bgd_csum); /* skip checksum */ + if (EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_64BIT) && + offset < fs->e2fs->e3fs_desc_size) + crc = ext2_crc16(crc, (uint8_t *)gd + offset, + fs->e2fs->e3fs_desc_size - offset); + return (crc); + } + + return (0); +} + +int +ext2_gd_csum_verify(struct m_ext2fs *fs, struct cdev *dev) +{ + unsigned int i; + int error = 0; + + for (i = 0; i < fs->e2fs_gcount; i++) { + if (fs->e2fs_gd[i].ext4bgd_csum != + ext2_gd_csum(fs, i, &fs->e2fs_gd[i])) { + printf( +"WARNING: mount of %s denied due bad gd=%d csum=0x%x, expected=0x%x - run fsck\n", + devtoname(dev), i, fs->e2fs_gd[i].ext4bgd_csum, + ext2_gd_csum(fs, i, &fs->e2fs_gd[i])); + error = EINVAL; + break; + } + } + + return (error); +} + +void +ext2_gd_csum_set(struct m_ext2fs *fs) +{ + unsigned int i; + + for (i = 0; i < fs->e2fs_gcount; i++) + fs->e2fs_gd[i].ext4bgd_csum = + ext2_gd_csum(fs, i, &fs->e2fs_gd[i]); +} Modified: stable/11/sys/fs/ext2fs/ext2_extern.h ============================================================================== --- stable/11/sys/fs/ext2fs/ext2_extern.h Sun Aug 20 01:08:23 2017 (r322711) +++ stable/11/sys/fs/ext2fs/ext2_extern.h Sun Aug 20 01:27:33 2017 (r322712) @@ -85,7 +85,7 @@ int ext2_dirrewrite(struct inode *, struct inode *, struct componentname *); int ext2_dirempty(struct inode *, ino_t, struct ucred *); int ext2_checkpath(struct inode *, struct inode *, struct ucred *); -int cg_has_sb(int i); +int ext2_cg_has_sb(struct m_ext2fs *fs, int cg); int ext2_inactive(struct vop_inactive_args *); int ext2_htree_add_entry(struct vnode *, struct ext2fs_direct_2 *, struct componentname *); @@ -98,6 +98,8 @@ int ext2_htree_lookup(struct inode *, const char *, in int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *); int ext2_search_dirblock(struct inode *, void *, int *, const char *, int, int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *); +int ext2_gd_csum_verify(struct m_ext2fs *fs, struct cdev *dev); +void ext2_gd_csum_set(struct m_ext2fs *fs); /* Flags to low-level allocation routines. Modified: stable/11/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/11/sys/fs/ext2fs/ext2_vfsops.c Sun Aug 20 01:08:23 2017 (r322711) +++ stable/11/sys/fs/ext2fs/ext2_vfsops.c Sun Aug 20 01:27:33 2017 (r322712) @@ -349,6 +349,13 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es printf("ext2fs: no space for extra inode timestamps\n"); return (EINVAL); } + /* Check for group descriptor size */ + if (EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_64BIT) && + (es->e3fs_desc_size != sizeof(struct ext2_gd))) { + printf("ext2fs: group descriptor size unsupported %d\n", + es->e3fs_desc_size); + return (EINVAL); + } fs->e2fs_ipb = fs->e2fs_bsize / EXT2_INODE_SIZE(fs); fs->e2fs_itpg = fs->e2fs_ipg / fs->e2fs_ipb; @@ -387,6 +394,12 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es brelse(bp); bp = NULL; } + /* Verify cg csum */ + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_GDT_CSUM)) { + error = ext2_gd_csum_verify(fs, devvp->v_rdev); + if (error) + return (error); + } /* Initialization for the ext2 Orlov allocator variant. */ fs->e2fs_total_dir = 0; for (i = 0; i < fs->e2fs_gcount; i++) @@ -781,7 +794,7 @@ ext2_statfs(struct mount *mp, struct statfs *sbp) if (fs->e2fs->e2fs_rev > E2FS_REV0 && fs->e2fs->e2fs_features_rocompat & EXT2F_ROCOMPAT_SPARSESUPER) { for (i = 0, ngroups = 0; i < fs->e2fs_gcount; i++) { - if (cg_has_sb(i)) + if (ext2_cg_has_sb(fs, i)) ngroups++; } } else { @@ -1062,6 +1075,11 @@ ext2_cgupdate(struct ext2mount *mp, int waitfor) int i, error = 0, allerror = 0; allerror = ext2_sbupdate(mp, waitfor); + + /* Update gd csums */ + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_GDT_CSUM)) + ext2_gd_csum_set(fs); + for (i = 0; i < fs->e2fs_gdbcount; i++) { bp = getblk(mp->um_devvp, fsbtodb(fs, fs->e2fs->e2fs_first_dblock + Modified: stable/11/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/11/sys/fs/ext2fs/ext2fs.h Sun Aug 20 01:08:23 2017 (r322711) +++ stable/11/sys/fs/ext2fs/ext2fs.h Sun Aug 20 01:27:33 2017 (r322712) @@ -259,6 +259,7 @@ struct csum { #define EXT2F_COMPAT_SUPP EXT2F_COMPAT_DIRHASHINDEX #define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \ EXT2F_ROCOMPAT_LARGEFILE | \ + EXT2F_ROCOMPAT_GDT_CSUM | \ EXT2F_ROCOMPAT_HUGE_FILE | \ EXT2F_ROCOMPAT_EXTRA_ISIZE) #define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE @@ -293,6 +294,10 @@ struct csum { */ #define E2FS_SIGNED_HASH 0x0001 #define E2FS_UNSIGNED_HASH 0x0002 + +#define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ +#define EXT2_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */ +#define EXT2_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */ /* ext2 file system block group descriptor */ Modified: stable/11/sys/modules/ext2fs/Makefile ============================================================================== --- stable/11/sys/modules/ext2fs/Makefile Sun Aug 20 01:08:23 2017 (r322711) +++ stable/11/sys/modules/ext2fs/Makefile Sun Aug 20 01:27:33 2017 (r322712) @@ -3,8 +3,9 @@ .PATH: ${SRCTOP}/sys/fs/ext2fs KMOD= ext2fs SRCS= opt_ddb.h opt_directio.h opt_quota.h opt_suiddir.h vnode_if.h \ - ext2_acl.c ext2_alloc.c ext2_balloc.c ext2_bmap.c ext2_extattr.c \ - ext2_extents.c ext2_hash.c ext2_htree.c ext2_inode.c ext2_inode_cnv.c \ - ext2_lookup.c ext2_subr.c ext2_vfsops.c ext2_vnops.c + ext2_acl.c ext2_alloc.c ext2_balloc.c ext2_bmap.c ext2_csum.c \ + ext2_extattr.c ext2_extents.c ext2_hash.c ext2_htree.c \ + ext2_inode.c ext2_inode_cnv.c ext2_lookup.c ext2_subr.c \ + ext2_vfsops.c ext2_vnops.c .include From owner-svn-src-all@freebsd.org Sun Aug 20 01:40:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB771DD2869; Sun, 20 Aug 2017 01:40:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87AE96D97F; Sun, 20 Aug 2017 01:40:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7K1eOu8033312; Sun, 20 Aug 2017 01:40:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7K1eOXN033310; Sun, 20 Aug 2017 01:40:24 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708200140.v7K1eOXN033310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 20 Aug 2017 01:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322713 - in head/sys/compat/linuxkpi/common/include: asm linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common/include: asm linux X-SVN-Commit-Revision: 322713 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 01:40:25 -0000 Author: markj Date: Sun Aug 20 01:40:24 2017 New Revision: 322713 URL: https://svnweb.freebsd.org/changeset/base/322713 Log: Add a couple of trivial headers to the LinuxKPI. MFC after: 1 week Added: head/sys/compat/linuxkpi/common/include/asm/msr.h (contents, props changed) head/sys/compat/linuxkpi/common/include/linux/atomic.h (contents, props changed) Added: head/sys/compat/linuxkpi/common/include/asm/msr.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/asm/msr.h Sun Aug 20 01:40:24 2017 (r322713) @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2017 Mark Johnston + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ASM_MSR_H_ +#define _ASM_MSR_H_ + +#include + +#define rdmsrl(msr, val) ((val) = rdmsr(msr)) + +#endif /* _ASM_MSR_H_ */ Added: head/sys/compat/linuxkpi/common/include/linux/atomic.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/linux/atomic.h Sun Aug 20 01:40:24 2017 (r322713) @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2017 Mark Johnston + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUX_ATOMIC_H_ +#define _LINUX_ATOMIC_H_ + +#include +#include + +#endif /* _LINUX_ATOMIC_H_ */ From owner-svn-src-all@freebsd.org Sun Aug 20 01:42:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E31A5DD2BD5; Sun, 20 Aug 2017 01:42:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1A2B6DCE6; Sun, 20 Aug 2017 01:42:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7K1g1W3036912; Sun, 20 Aug 2017 01:42:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7K1g1D4036911; Sun, 20 Aug 2017 01:42:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708200142.v7K1g1D4036911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 20 Aug 2017 01:42:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322714 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 322714 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 01:42:03 -0000 Author: markj Date: Sun Aug 20 01:42:01 2017 New Revision: 322714 URL: https://svnweb.freebsd.org/changeset/base/322714 Log: Define prefetch() only if it hasn't already been defined. MFC after: 1 week Modified: head/sys/compat/linuxkpi/common/include/linux/list.h Modified: head/sys/compat/linuxkpi/common/include/linux/list.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/list.h Sun Aug 20 01:40:24 2017 (r322713) +++ head/sys/compat/linuxkpi/common/include/linux/list.h Sun Aug 20 01:42:01 2017 (r322714) @@ -70,7 +70,9 @@ #include #include +#ifndef prefetch #define prefetch(x) +#endif #define LINUX_LIST_HEAD_INIT(name) { &(name), &(name) } From owner-svn-src-all@freebsd.org Sun Aug 20 06:07:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E11C8DE1B10; Sun, 20 Aug 2017 06:07:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9BDF374CBC; Sun, 20 Aug 2017 06:07:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7K67fWO042778; Sun, 20 Aug 2017 06:07:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7K67eZN042764; Sun, 20 Aug 2017 06:07:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708200607.v7K67eZN042764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 20 Aug 2017 06:07:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322715 - in stable/11: etc/mtree lib/libcasper lib/libcasper/services lib/libcasper/services/cap_dns lib/libcasper/services/cap_dns/tests lib/libcasper/services/cap_grp lib/libcasper/s... X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/11: etc/mtree lib/libcasper lib/libcasper/services lib/libcasper/services/cap_dns lib/libcasper/services/cap_dns/tests lib/libcasper/services/cap_grp lib/libcasper/services/cap_grp/tests lib... X-SVN-Commit-Revision: 322715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 06:07:43 -0000 Author: ngie Date: Sun Aug 20 06:07:40 2017 New Revision: 322715 URL: https://svnweb.freebsd.org/changeset/base/322715 Log: MFC r305626,r305629,r307863,r322447,r322448,r322449,r322450,r322451: r305626 (by oshogbo): Move libcasper tests from regression/capsicum/libcasper/ to lib/libcasper/service/${service_name}/tests. r305629 (by jkim): Add new directories added in r305626 to fix "make installworld". r307863 (by emaste): Set SHLIBDIR before .including src.opts.mk in libcapser services bsd.own.mk (included from src.opts.mk) sets SHLIBDIR?=${LIBDIR}, so SHLIBDIR must be set before including either one of them. MFC with: 305626 r322447: Fix result printing - Flushing stdout prevents the buffer from being printed twice, fixing issues with stdout printing out the testplan, etc, twice. - Don't print out raw source/line numbers; hide them behind comments. r322448: Make root-privileges a requirement for the test Some of the testcases try to manipulate sysctls that require root privileges, e.g., "kern.sync_on_panic". Make root-privileges a hard requirement so the tests don't raise false positives due to privilege issues when calling sysctlbyname(3) on writable sysctls. r322449: Use hardcoded IPv4/IPv6 addresses for google-public-dns-a.google.com instead of freefall.freebsd.org to unbreak the DNS tests The address allocations for freefall.freebsd.org have changed in the past 4 years. Use a more stable set of hardcoded addresses for now to make the tests succeed reliably. The hostname should be resolved dynamically instead of hardcoding the addresses in the future. This is just a bandaid. r322450: Integrate the tests moved in r305626 in to the FreeBSD test suite The reachover Kyuafiles were never added, and thus the tests were installed as standalone tests, and not integrated into the full suite. MFC with: r305626, 305629, r307863, r322447, r322448, r322449 r322451: TESTSDIR isn't required; remove it MFC with: r322450 Added: stable/11/lib/libcasper/services/cap_dns/tests/ - copied from r305626, head/lib/libcasper/services/cap_dns/tests/ stable/11/lib/libcasper/services/cap_grp/tests/ - copied from r305626, head/lib/libcasper/services/cap_grp/tests/ stable/11/lib/libcasper/services/cap_pwd/tests/ - copied from r305626, head/lib/libcasper/services/cap_pwd/tests/ stable/11/lib/libcasper/services/cap_sysctl/tests/ - copied from r305626, head/lib/libcasper/services/cap_sysctl/tests/ stable/11/lib/libcasper/services/tests/ - copied from r322450, head/lib/libcasper/services/tests/ stable/11/lib/libcasper/tests/ - copied from r322450, head/lib/libcasper/tests/ Deleted: stable/11/tools/regression/capsicum/libcasper/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/lib/libcasper/Makefile stable/11/lib/libcasper/services/Makefile stable/11/lib/libcasper/services/cap_dns/Makefile stable/11/lib/libcasper/services/cap_dns/tests/dns_test.c stable/11/lib/libcasper/services/cap_grp/Makefile stable/11/lib/libcasper/services/cap_grp/tests/grp_test.c stable/11/lib/libcasper/services/cap_pwd/Makefile stable/11/lib/libcasper/services/cap_pwd/tests/pwd_test.c stable/11/lib/libcasper/services/cap_sysctl/Makefile stable/11/lib/libcasper/services/cap_sysctl/tests/Makefile stable/11/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c stable/11/lib/libcasper/services/tests/Makefile stable/11/lib/libcasper/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Sun Aug 20 01:42:01 2017 (r322714) +++ stable/11/etc/mtree/BSD.tests.dist Sun Aug 20 06:07:40 2017 (r322715) @@ -316,6 +316,18 @@ .. libcam .. + libcasper + services + cap_dns + .. + cap_grp + .. + cap_pwd + .. + cap_sysctl + .. + .. + .. libcrypt .. libdevdctl Modified: stable/11/lib/libcasper/Makefile ============================================================================== --- stable/11/lib/libcasper/Makefile Sun Aug 20 01:42:01 2017 (r322714) +++ stable/11/lib/libcasper/Makefile Sun Aug 20 06:07:40 2017 (r322715) @@ -3,6 +3,8 @@ SUBDIR= libcasper SUBDIR+= services +SUBDIR.${MK_TESTS}+= tests + SUBDIR_PARALLEL= .include Modified: stable/11/lib/libcasper/services/Makefile ============================================================================== --- stable/11/lib/libcasper/services/Makefile Sun Aug 20 01:42:01 2017 (r322714) +++ stable/11/lib/libcasper/services/Makefile Sun Aug 20 06:07:40 2017 (r322715) @@ -6,6 +6,8 @@ SUBDIR+= cap_pwd SUBDIR+= cap_random SUBDIR+= cap_sysctl +SUBDIR.${MK_TESTS}+= tests + SUBDIR_PARALLEL= .include Modified: stable/11/lib/libcasper/services/cap_dns/Makefile ============================================================================== --- stable/11/lib/libcasper/services/cap_dns/Makefile Sun Aug 20 01:42:01 2017 (r322714) +++ stable/11/lib/libcasper/services/cap_dns/Makefile Sun Aug 20 06:07:40 2017 (r322715) @@ -1,10 +1,13 @@ # $FreeBSD$ +SHLIBDIR?= /lib/casper + +.include + PACKAGE=libcasper LIB= cap_dns SHLIB_MAJOR= 0 -SHLIBDIR?= /lib/casper INCSDIR?= ${INCLUDEDIR}/casper SRCS= cap_dns.c @@ -14,5 +17,9 @@ INCS= cap_dns.h LIBADD= nv CFLAGS+=-I${.CURDIR} + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Modified: stable/11/lib/libcasper/services/cap_dns/tests/dns_test.c ============================================================================== --- head/lib/libcasper/services/cap_dns/tests/dns_test.c Thu Sep 8 20:01:26 2016 (r305626) +++ stable/11/lib/libcasper/services/cap_dns/tests/dns_test.c Sun Aug 20 06:07:40 2017 (r322715) @@ -52,18 +52,20 @@ static int ntest = 1; #define CHECK(expr) do { \ if ((expr)) \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ else \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ + fflush(stdout); \ ntest++; \ } while (0) #define CHECKX(expr) do { \ if ((expr)) { \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ } else { \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ exit(1); \ } \ + fflush(stdout); \ ntest++; \ } while (0) @@ -295,32 +297,26 @@ runtest(cap_channel_t *capdns) freeaddrinfo(aic); } - /* - * 8.8.178.135 is IPv4 address of freefall.freebsd.org - * as of 27 October 2013. - */ - inet_pton(AF_INET, "8.8.178.135", &ip4); + /* XXX: hardcoded addresses for "google-public-dns-a.google.com". */ +#define GOOGLE_DNS_IPV4 "8.8.8.8" +#define GOOGLE_DNS_IPV6 "2001:4860:4860::8888" + + inet_pton(AF_INET, GOOGLE_DNS_IPV4, &ip4); hps = gethostbyaddr(&ip4, sizeof(ip4), AF_INET); if (hps == NULL) - fprintf(stderr, "Unable to resolve %s.\n", "8.8.178.135"); + fprintf(stderr, "Unable to resolve %s.\n", GOOGLE_DNS_IPV4); hpc = cap_gethostbyaddr(capdns, &ip4, sizeof(ip4), AF_INET); if (hostent_compare(hps, hpc)) result |= GETHOSTBYADDR_AF_INET; - /* - * 2001:1900:2254:206c::16:87 is IPv6 address of freefall.freebsd.org - * as of 27 October 2013. - */ - inet_pton(AF_INET6, "2001:1900:2254:206c::16:87", &ip6); + inet_pton(AF_INET6, GOOGLE_DNS_IPV6, &ip6); hps = gethostbyaddr(&ip6, sizeof(ip6), AF_INET6); if (hps == NULL) { - fprintf(stderr, "Unable to resolve %s.\n", - "2001:1900:2254:206c::16:87"); + fprintf(stderr, "Unable to resolve %s.\n", GOOGLE_DNS_IPV6); } hpc = cap_gethostbyaddr(capdns, &ip6, sizeof(ip6), AF_INET6); if (hostent_compare(hps, hpc)) result |= GETHOSTBYADDR_AF_INET6; - return (result); } @@ -332,6 +328,7 @@ main(void) int families[2]; printf("1..91\n"); + fflush(stdout); capcas = cap_init(); CHECKX(capcas != NULL); Modified: stable/11/lib/libcasper/services/cap_grp/Makefile ============================================================================== --- stable/11/lib/libcasper/services/cap_grp/Makefile Sun Aug 20 01:42:01 2017 (r322714) +++ stable/11/lib/libcasper/services/cap_grp/Makefile Sun Aug 20 06:07:40 2017 (r322715) @@ -1,10 +1,13 @@ # $FreeBSD$ +SHLIBDIR?= /lib/casper + +.include + PACKAGE=libcasper LIB= cap_grp SHLIB_MAJOR= 0 -SHLIBDIR?= /lib/casper INCSDIR?= ${INCLUDEDIR}/casper SRCS= cap_grp.c @@ -14,5 +17,9 @@ INCS= cap_grp.h LIBADD= nv CFLAGS+=-I${.CURDIR} + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Modified: stable/11/lib/libcasper/services/cap_grp/tests/grp_test.c ============================================================================== --- head/lib/libcasper/services/cap_grp/tests/grp_test.c Thu Sep 8 20:01:26 2016 (r305626) +++ stable/11/lib/libcasper/services/cap_grp/tests/grp_test.c Sun Aug 20 06:07:40 2017 (r322715) @@ -52,6 +52,7 @@ static int ntest = 1; printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ else \ printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + fflush(stdout); \ ntest++; \ } while (0) #define CHECKX(expr) do { \ @@ -61,6 +62,7 @@ static int ntest = 1; printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ exit(1); \ } \ + fflush(stdout); \ ntest++; \ } while (0) @@ -1524,6 +1526,7 @@ main(void) cap_channel_t *capcas, *capgrp; printf("1..199\n"); + fflush(stdout); capcas = cap_init(); CHECKX(capcas != NULL); Modified: stable/11/lib/libcasper/services/cap_pwd/Makefile ============================================================================== --- stable/11/lib/libcasper/services/cap_pwd/Makefile Sun Aug 20 01:42:01 2017 (r322714) +++ stable/11/lib/libcasper/services/cap_pwd/Makefile Sun Aug 20 06:07:40 2017 (r322715) @@ -1,10 +1,13 @@ # $FreeBSD$ +SHLIBDIR?= /lib/casper + +.include + PACKAGE=libcasper LIB= cap_pwd SHLIB_MAJOR= 0 -SHLIBDIR?= /lib/casper INCSDIR?= ${INCLUDEDIR}/casper SRCS= cap_pwd.c @@ -14,5 +17,9 @@ INCS= cap_pwd.h LIBADD= nv CFLAGS+=-I${.CURDIR} + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Modified: stable/11/lib/libcasper/services/cap_pwd/tests/pwd_test.c ============================================================================== --- head/lib/libcasper/services/cap_pwd/tests/pwd_test.c Thu Sep 8 20:01:26 2016 (r305626) +++ stable/11/lib/libcasper/services/cap_pwd/tests/pwd_test.c Sun Aug 20 06:07:40 2017 (r322715) @@ -49,18 +49,20 @@ static int ntest = 1; #define CHECK(expr) do { \ if ((expr)) \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ else \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__);\ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ + fflush(stdout); \ ntest++; \ } while (0) #define CHECKX(expr) do { \ if ((expr)) { \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ } else { \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__);\ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ exit(1); \ } \ + fflush(stdout); \ ntest++; \ } while (0) @@ -1510,6 +1512,7 @@ main(void) cap_channel_t *capcas, *cappwd; printf("1..188\n"); + fflush(stdout); capcas = cap_init(); CHECKX(capcas != NULL); Modified: stable/11/lib/libcasper/services/cap_sysctl/Makefile ============================================================================== --- stable/11/lib/libcasper/services/cap_sysctl/Makefile Sun Aug 20 01:42:01 2017 (r322714) +++ stable/11/lib/libcasper/services/cap_sysctl/Makefile Sun Aug 20 06:07:40 2017 (r322715) @@ -1,10 +1,13 @@ # $FreeBSD$ +SHLIBDIR?= /lib/casper + +.include + PACKAGE=libcasper LIB= cap_sysctl SHLIB_MAJOR= 0 -SHLIBDIR?= /lib/casper INCSDIR?= ${INCLUDEDIR}/casper SRCS= cap_sysctl.c @@ -14,5 +17,9 @@ INCS= cap_sysctl.h LIBADD= nv CFLAGS+=-I${.CURDIR} + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Modified: stable/11/lib/libcasper/services/cap_sysctl/tests/Makefile ============================================================================== --- head/lib/libcasper/services/cap_sysctl/tests/Makefile Thu Sep 8 20:01:26 2016 (r305626) +++ stable/11/lib/libcasper/services/cap_sysctl/tests/Makefile Sun Aug 20 06:07:40 2017 (r322715) @@ -8,4 +8,6 @@ LIBADD+= nv WARNS?= 3 +TEST_METADATA.sysctl_test+= required_user="root" + .include Modified: stable/11/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c ============================================================================== --- head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c Thu Sep 8 20:01:26 2016 (r305626) +++ stable/11/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c Sun Aug 20 06:07:40 2017 (r322715) @@ -61,18 +61,20 @@ static int ntest = 1; #define CHECK(expr) do { \ if ((expr)) \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ else \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ + fflush(stdout); \ ntest++; \ } while (0) #define CHECKX(expr) do { \ if ((expr)) { \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ } else { \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ exit(1); \ } \ + fflush(stdout); \ ntest++; \ } while (0) @@ -1472,6 +1474,7 @@ main(void) size_t scsize; printf("1..256\n"); + fflush(stdout); scsize = sizeof(scvalue0); CHECKX(sysctlbyname(SYSCTL0_NAME, &scvalue0, &scsize, NULL, 0) == 0); Modified: stable/11/lib/libcasper/services/tests/Makefile ============================================================================== --- head/lib/libcasper/services/tests/Makefile Sun Aug 13 01:04:44 2017 (r322450) +++ stable/11/lib/libcasper/services/tests/Makefile Sun Aug 20 06:07:40 2017 (r322715) @@ -1,7 +1,5 @@ # $FreeBSD$ -TESTSDIR= ${TESTSBASE}/lib/libcasper/services - .PATH: ${SRCTOP}/tests KYUAFILE= yes Modified: stable/11/lib/libcasper/tests/Makefile ============================================================================== --- head/lib/libcasper/tests/Makefile Sun Aug 13 01:04:44 2017 (r322450) +++ stable/11/lib/libcasper/tests/Makefile Sun Aug 20 06:07:40 2017 (r322715) @@ -1,7 +1,5 @@ # $FreeBSD$ -TESTSDIR= ${TESTSBASE}/lib/libcasper - .PATH: ${SRCTOP}/tests KYUAFILE= yes From owner-svn-src-all@freebsd.org Sun Aug 20 07:04:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 391A8DE3F6B; Sun, 20 Aug 2017 07:04:25 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED2477664D; Sun, 20 Aug 2017 07:04:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7K74OGK066765; Sun, 20 Aug 2017 07:04:24 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7K74OMW066764; Sun, 20 Aug 2017 07:04:24 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708200704.v7K74OMW066764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 20 Aug 2017 07:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322716 - stable/11/sys/mips/atheros X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/sys/mips/atheros X-SVN-Commit-Revision: 322716 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 07:04:25 -0000 Author: delphij Date: Sun Aug 20 07:04:23 2017 New Revision: 322716 URL: https://svnweb.freebsd.org/changeset/base/322716 Log: MFC r322527: Plug memory leak in arge_encap(). Reported by: Ilja Van Sprundel Submitted by: Domagoj Stolfa Reviewed by: adrian Modified: stable/11/sys/mips/atheros/if_arge.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/mips/atheros/if_arge.c ============================================================================== --- stable/11/sys/mips/atheros/if_arge.c Sun Aug 20 06:07:40 2017 (r322715) +++ stable/11/sys/mips/atheros/if_arge.c Sun Aug 20 07:04:23 2017 (r322716) @@ -1515,6 +1515,7 @@ arge_encap(struct arge_softc *sc, struct mbuf **m_head sc->stats.tx_pkts_unaligned++; m = m_defrag(*m_head, M_NOWAIT); if (m == NULL) { + m_freem(*m_head); *m_head = NULL; return (ENOBUFS); } From owner-svn-src-all@freebsd.org Sun Aug 20 09:03:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B412DE8A80; Sun, 20 Aug 2017 09:03:24 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C966A7DEA6; Sun, 20 Aug 2017 09:03:23 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 793442600D6; Sun, 20 Aug 2017 11:03:12 +0200 (CEST) Subject: Re: svn commit: r322714 - head/sys/compat/linuxkpi/common/include/linux To: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201708200142.v7K1g1D4036911@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Sun, 20 Aug 2017 11:00:55 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <201708200142.v7K1g1D4036911@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 09:03:24 -0000 On 08/20/17 03:42, Mark Johnston wrote: > +#ifndef prefetch > #define prefetch(x) > +#endif Shouldn't this macro have a do { } while (0) body? --HPS From owner-svn-src-all@freebsd.org Sun Aug 20 09:39:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 798D2DEA1DE; Sun, 20 Aug 2017 09:39:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 473DF7EC94; Sun, 20 Aug 2017 09:39:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7K9dAUg028138; Sun, 20 Aug 2017 09:39:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7K9dAAv028137; Sun, 20 Aug 2017 09:39:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708200939.v7K9dAAv028137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 20 Aug 2017 09:39:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322718 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 322718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 09:39:11 -0000 Author: kib Date: Sun Aug 20 09:39:10 2017 New Revision: 322718 URL: https://svnweb.freebsd.org/changeset/base/322718 Log: Use ANSI C declaration for trap_pfault(). Style. Reviewed by: bde Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Sun Aug 20 07:06:13 2017 (r322717) +++ head/sys/amd64/amd64/trap.c Sun Aug 20 09:39:10 2017 (r322718) @@ -609,17 +609,20 @@ trap_check(struct trapframe *frame) } static int -trap_pfault(frame, usermode) - struct trapframe *frame; - int usermode; +trap_pfault(struct trapframe *frame, int usermode) { - vm_offset_t va; + struct thread *td; + struct proc *p; vm_map_t map; - int rv = 0; + vm_offset_t va; + int rv; vm_prot_t ftype; - struct thread *td = curthread; - struct proc *p = td->td_proc; - vm_offset_t eva = frame->tf_addr; + vm_offset_t eva; + + td = curthread; + p = td->td_proc; + eva = frame->tf_addr; + rv = 0; if (__predict_false((td->td_pflags & TDP_NOFAULTING) != 0)) { /* From owner-svn-src-all@freebsd.org Sun Aug 20 09:42:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 811B2DEA48E; Sun, 20 Aug 2017 09:42:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9127F010; Sun, 20 Aug 2017 09:42:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7K9g9BD032206; Sun, 20 Aug 2017 09:42:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7K9g9N1032205; Sun, 20 Aug 2017 09:42:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708200942.v7K9g9N1032205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 20 Aug 2017 09:42:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322719 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 322719 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 09:42:10 -0000 Author: kib Date: Sun Aug 20 09:42:09 2017 New Revision: 322719 URL: https://svnweb.freebsd.org/changeset/base/322719 Log: Trim excessive 'extern' and remove unused declaration. Reviewed by: bde Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Sun Aug 20 09:39:10 2017 (r322718) +++ head/sys/amd64/amd64/trap.c Sun Aug 20 09:42:09 2017 (r322719) @@ -99,9 +99,8 @@ PMC_SOFT_DEFINE( , , page_fault, write); #include #endif -extern void __noinline trap(struct trapframe *frame); -extern void trap_check(struct trapframe *frame); -extern void syscall(struct trapframe *frame); +void __noinline trap(struct trapframe *frame); +void trap_check(struct trapframe *frame); void dblfault_handler(struct trapframe *frame); static int trap_pfault(struct trapframe *, int); From owner-svn-src-all@freebsd.org Sun Aug 20 09:52:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEC96DEAA2D; Sun, 20 Aug 2017 09:52:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9AE3B7F59F; Sun, 20 Aug 2017 09:52:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7K9qPVN036385; Sun, 20 Aug 2017 09:52:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7K9qPP4036384; Sun, 20 Aug 2017 09:52:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708200952.v7K9qPP4036384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 20 Aug 2017 09:52:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322720 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 322720 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 09:52:26 -0000 Author: kib Date: Sun Aug 20 09:52:25 2017 New Revision: 322720 URL: https://svnweb.freebsd.org/changeset/base/322720 Log: Simplify amd64 trap(). - Use more relevant name 'signo' instead of 'i' for the local variable which contains a signal number to send for the current exception. - Eliminate two labels 'userout' and 'out' which point to the very end of the trap() function. Instead use return directly. - Re-indent the prot_fault_translation block by reducing if() nesting. - Some more monor style changes. Requested and reviewed by: bde Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Sun Aug 20 09:42:09 2017 (r322719) +++ head/sys/amd64/amd64/trap.c Sun Aug 20 09:52:25 2017 (r322720) @@ -172,12 +172,12 @@ trap(struct trapframe *frame) #ifdef KDB register_t dr6; #endif - int i, ucode; + int signo, ucode; u_int type; td = curthread; p = td->td_proc; - i = 0; + signo = 0; ucode = 0; addr = 0; @@ -186,22 +186,20 @@ trap(struct trapframe *frame) #ifdef SMP /* Handler for NMI IPIs used for stopping CPUs. */ - if (type == T_NMI) { - if (ipi_nmi_handler() == 0) - goto out; - } -#endif /* SMP */ + if (type == T_NMI && ipi_nmi_handler() == 0) + return; +#endif #ifdef KDB if (kdb_active) { kdb_reenter(); - goto out; + return; } #endif if (type == T_RESERVED) { trap_fatal(frame, 0); - goto out; + return; } if (type == T_NMI) { @@ -214,18 +212,18 @@ trap(struct trapframe *frame) */ if (pmc_intr != NULL && (*pmc_intr)(PCPU_GET(cpuid), frame) != 0) - goto out; + return; #endif #ifdef STACK if (stack_nmi_handler(frame) != 0) - goto out; + return; #endif } if (type == T_MCHK) { mca_intr(); - goto out; + return; } if ((frame->tf_rflags & PSL_I) == 0) { @@ -269,7 +267,7 @@ trap(struct trapframe *frame) switch (type) { case T_PRIVINFLT: /* privileged instruction fault */ - i = SIGILL; + signo = SIGILL; ucode = ILL_PRVOPC; break; @@ -281,41 +279,41 @@ trap(struct trapframe *frame) fill_frame_regs(frame, ®s); if (dtrace_pid_probe_ptr != NULL && dtrace_pid_probe_ptr(®s) == 0) - goto out; + return; } #endif frame->tf_rflags &= ~PSL_T; - i = SIGTRAP; + signo = SIGTRAP; ucode = (type == T_TRCTRAP ? TRAP_TRACE : TRAP_BRKPT); break; case T_ARITHTRAP: /* arithmetic trap */ ucode = fputrap_x87(); if (ucode == -1) - goto userout; - i = SIGFPE; + return; + signo = SIGFPE; break; case T_PROTFLT: /* general protection fault */ - i = SIGBUS; + signo = SIGBUS; ucode = BUS_OBJERR; break; case T_STKFLT: /* stack fault */ case T_SEGNPFLT: /* segment not present fault */ - i = SIGBUS; + signo = SIGBUS; ucode = BUS_ADRERR; break; case T_TSSFLT: /* invalid TSS fault */ - i = SIGBUS; + signo = SIGBUS; ucode = BUS_OBJERR; break; case T_ALIGNFLT: - i = SIGBUS; + signo = SIGBUS; ucode = BUS_ADRALN; break; case T_DOUBLEFLT: /* double fault */ default: - i = SIGBUS; + signo = SIGBUS; ucode = BUS_OBJERR; break; @@ -325,67 +323,64 @@ trap(struct trapframe *frame) */ if (*p->p_sysent->sv_trap != NULL && (*p->p_sysent->sv_trap)(td) == 0) - goto userout; + return; addr = frame->tf_addr; - i = trap_pfault(frame, TRUE); - if (i == -1) - goto userout; - if (i == 0) - goto user; - - if (i == SIGSEGV) + signo = trap_pfault(frame, TRUE); + if (signo == -1) + return; + if (signo == 0) + goto userret; + if (signo == SIGSEGV) { ucode = SEGV_MAPERR; - else { - if (prot_fault_translation == 0) { - /* - * Autodetect. - * This check also covers the images - * without the ABI-tag ELF note. - */ - if (SV_CURPROC_ABI() == SV_ABI_FREEBSD - && p->p_osrel >= P_OSREL_SIGSEGV) { - i = SIGSEGV; - ucode = SEGV_ACCERR; - } else { - i = SIGBUS; - ucode = BUS_PAGE_FAULT; - } - } else if (prot_fault_translation == 1) { - /* - * Always compat mode. - */ - i = SIGBUS; - ucode = BUS_PAGE_FAULT; - } else { - /* - * Always SIGSEGV mode. - */ - i = SIGSEGV; + } else if (prot_fault_translation == 0) { + /* + * Autodetect. This check also covers + * the images without the ABI-tag ELF + * note. + */ + if (SV_CURPROC_ABI() == SV_ABI_FREEBSD && + p->p_osrel >= P_OSREL_SIGSEGV) { + signo = SIGSEGV; ucode = SEGV_ACCERR; + } else { + signo = SIGBUS; + ucode = BUS_PAGE_FAULT; } + } else if (prot_fault_translation == 1) { + /* + * Always compat mode. + */ + signo = SIGBUS; + ucode = BUS_PAGE_FAULT; + } else { + /* + * Always SIGSEGV mode. + */ + signo = SIGSEGV; + ucode = SEGV_ACCERR; } break; case T_DIVIDE: /* integer divide fault */ ucode = FPE_INTDIV; - i = SIGFPE; + signo = SIGFPE; break; #ifdef DEV_ISA case T_NMI: nmi_handle_intr(type, frame); - goto out; -#endif /* DEV_ISA */ + return; +#endif case T_OFLOW: /* integer overflow fault */ ucode = FPE_INTOVF; - i = SIGFPE; + signo = SIGFPE; break; case T_BOUND: /* bounds check fault */ ucode = FPE_FLTSUB; - i = SIGFPE; + signo = SIGFPE; break; case T_DNA: @@ -393,18 +388,18 @@ trap(struct trapframe *frame) KASSERT(PCB_USER_FPU(td->td_pcb), ("kernel FPU ctx has leaked")); fpudna(); - goto userout; + return; case T_FPOPFLT: /* FPU operand fetch fault */ ucode = ILL_COPROC; - i = SIGILL; + signo = SIGILL; break; case T_XMMFLT: /* SIMD floating-point exception */ ucode = fputrap_sse(); if (ucode == -1) - goto userout; - i = SIGFPE; + return; + signo = SIGFPE; break; #ifdef KDTRACE_HOOKS case T_DTRACE_RET: @@ -412,8 +407,8 @@ trap(struct trapframe *frame) fill_frame_regs(frame, ®s); if (dtrace_return_probe_ptr != NULL && dtrace_return_probe_ptr(®s) == 0) - goto out; - goto userout; + return; + return; #endif } } else { @@ -424,13 +419,13 @@ trap(struct trapframe *frame) switch (type) { case T_PAGEFLT: /* page fault */ (void) trap_pfault(frame, FALSE); - goto out; + return; case T_DNA: if (PCB_USER_FPU(td->td_pcb)) panic("Unregistered use of FPU in kernel"); fpudna(); - goto out; + return; case T_ARITHTRAP: /* arithmetic trap */ case T_XMMFLT: /* SIMD floating-point exception */ @@ -440,7 +435,7 @@ trap(struct trapframe *frame) * registration for FPU traps is overkill. */ trap_fatal(frame, 0); - goto out; + return; case T_STKFLT: /* stack fault */ case T_PROTFLT: /* general protection fault */ @@ -460,35 +455,35 @@ trap(struct trapframe *frame) */ if (frame->tf_rip == (long)doreti_iret) { frame->tf_rip = (long)doreti_iret_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_ds) { frame->tf_rip = (long)ds_load_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_es) { frame->tf_rip = (long)es_load_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_fs) { frame->tf_rip = (long)fs_load_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_gs) { frame->tf_rip = (long)gs_load_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_gsbase) { frame->tf_rip = (long)gsbase_load_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_fsbase) { frame->tf_rip = (long)fsbase_load_fault; - goto out; + return; } if (curpcb->pcb_onfault != NULL) { frame->tf_rip = (long)curpcb->pcb_onfault; - goto out; + return; } break; @@ -504,7 +499,7 @@ trap(struct trapframe *frame) */ if (frame->tf_rflags & PSL_NT) { frame->tf_rflags &= ~PSL_NT; - goto out; + return; } break; @@ -525,7 +520,7 @@ trap(struct trapframe *frame) * processor doesn't */ load_dr6(rdr6() & ~0xf); - goto out; + return; } /* * FALLTHROUGH (TRCTRAP kernel mode, kernel address) @@ -540,27 +535,27 @@ trap(struct trapframe *frame) dr6 = rdr6(); load_dr6(dr6 & ~0x4000); if (kdb_trap(type, dr6, frame)) - goto out; + return; #endif break; #ifdef DEV_ISA case T_NMI: nmi_handle_intr(type, frame); - goto out; -#endif /* DEV_ISA */ + return; +#endif } trap_fatal(frame, 0); - goto out; + return; } /* Translate fault for emulators (e.g. Linux) */ - if (*p->p_sysent->sv_transtrap) - i = (*p->p_sysent->sv_transtrap)(i, type); + if (*p->p_sysent->sv_transtrap != NULL) + signo = (*p->p_sysent->sv_transtrap)(signo, type); ksiginfo_init_trap(&ksi); - ksi.ksi_signo = i; + ksi.ksi_signo = signo; ksi.ksi_code = ucode; ksi.ksi_trapno = type; ksi.ksi_addr = (void *)addr; @@ -568,8 +563,8 @@ trap(struct trapframe *frame) uprintf("pid %d comm %s: signal %d err %lx code %d type %d " "addr 0x%lx rsp 0x%lx rip 0x%lx " "<%02x %02x %02x %02x %02x %02x %02x %02x>\n", - p->p_pid, p->p_comm, i, frame->tf_err, ucode, type, addr, - frame->tf_rsp, frame->tf_rip, + p->p_pid, p->p_comm, signo, frame->tf_err, ucode, type, + addr, frame->tf_rsp, frame->tf_rip, fubyte((void *)(frame->tf_rip + 0)), fubyte((void *)(frame->tf_rip + 1)), fubyte((void *)(frame->tf_rip + 2)), @@ -581,14 +576,10 @@ trap(struct trapframe *frame) } KASSERT((read_rflags() & PSL_I) != 0, ("interrupts disabled")); trapsignal(td, &ksi); - -user: +userret: userret(td, frame); KASSERT(PCB_USER_FPU(td->td_pcb), ("Return from trap with kernel FPU ctx leaked")); -userout: -out: - return; } /* From owner-svn-src-all@freebsd.org Sun Aug 20 10:07:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9F4FDEB2EE; Sun, 20 Aug 2017 10:07:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A78987FAF3; Sun, 20 Aug 2017 10:07:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KA7jOO040592; Sun, 20 Aug 2017 10:07:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KA7jZP040590; Sun, 20 Aug 2017 10:07:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708201007.v7KA7jZP040590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 20 Aug 2017 10:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322721 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 322721 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 10:07:47 -0000 Author: kib Date: Sun Aug 20 10:07:45 2017 New Revision: 322721 URL: https://svnweb.freebsd.org/changeset/base/322721 Log: Allow vinvalbuf() to operate with the shared vnode lock. This mode allows other clean buffers to arrive while we flush the buf lists for the vnode, which is fine for the targeted use. We only need that all buffers existed at the time of the function start were flushed. In fact, only one assert has to be relaxed. In collaboration with: pho Reviewed by: rmacklem Sponsored by: The FreeBSD Foundation MFC after: 2 weeks X-Differential revision: https://reviews.freebsd.org/D12083 Modified: head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sun Aug 20 09:52:25 2017 (r322720) +++ head/sys/kern/vfs_subr.c Sun Aug 20 10:07:45 2017 (r322721) @@ -1698,9 +1698,13 @@ bufobj_invalbuf(struct bufobj *bo, int flags, int slpf #ifdef INVARIANTS BO_LOCK(bo); - if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY | V_VMIO)) == 0 && - (bo->bo_dirty.bv_cnt > 0 || bo->bo_clean.bv_cnt > 0)) + if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY | V_VMIO | + V_ALLOWCLEAN)) == 0 && (bo->bo_dirty.bv_cnt > 0 || + bo->bo_clean.bv_cnt > 0)) panic("vinvalbuf: flush failed"); + if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY | V_VMIO)) == 0 && + bo->bo_dirty.bv_cnt > 0) + panic("vinvalbuf: flush dirty failed"); BO_UNLOCK(bo); #endif return (0); Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sun Aug 20 09:52:25 2017 (r322720) +++ head/sys/sys/vnode.h Sun Aug 20 10:07:45 2017 (r322721) @@ -399,6 +399,7 @@ extern int vttoif_tab[]; #define V_NORMAL 0x0004 /* vinvalbuf: invalidate only regular bufs */ #define V_CLEANONLY 0x0008 /* vinvalbuf: invalidate only clean bufs */ #define V_VMIO 0x0010 /* vinvalbuf: called during pageout */ +#define V_ALLOWCLEAN 0x0020 /* vinvalbuf: allow clean buffers after flush */ #define REVOKEALL 0x0001 /* vop_revoke: revoke all aliases */ #define V_WAIT 0x0001 /* vn_start_write: sleep for suspend */ #define V_NOWAIT 0x0002 /* vn_start_write: don't sleep for suspend */ From owner-svn-src-all@freebsd.org Sun Aug 20 10:08:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FBDBDEB3CA; Sun, 20 Aug 2017 10:08:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C65A7FC40; Sun, 20 Aug 2017 10:08:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KA8kWh040672; Sun, 20 Aug 2017 10:08:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KA8jRv040666; Sun, 20 Aug 2017 10:08:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708201008.v7KA8jRv040666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 20 Aug 2017 10:08:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322722 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 322722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 10:08:47 -0000 Author: kib Date: Sun Aug 20 10:08:45 2017 New Revision: 322722 URL: https://svnweb.freebsd.org/changeset/base/322722 Log: Do not drop NFS vnode lock when performing consistency checks. Currently several paths in the NFS client upgrade the shared vnode lock to exclusive, which might cause temporal dropping of the lock. This action appears to be fatal for nullfs mounts over NFS. If the operation is performed over nullfs vnode, then bypassed down to NFS VOP, and the lock is dropped, other thread might reclaim the upper nullfs vnode. Since on reclaim the nullfs vnode lock and NFS vnode lock are split, the original lock state of the nullfs vnode is not restored. As result, VFS operations receive not locked vnode after a VOP call. Stop upgrading the vnode lock when we check the consistency or flush buffers as result of detected inconsistency. Instead, allocate a new lockmgr lock for each NFS node, which is locked exclusive instead of the vnode lock upgrade. In other words, the other parallel modification of the vnode are excluded by either vnode lock conflict or exclusivity of the new lock when the vnode lock is shared. Also revert r316529 because now the vnode cannot be reclaimed during ncl_vinvalbuf(). In collaboration with: pho Reviewed by: rmacklem Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D12083 Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nfsclient/nfs_clnode.c head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clsubs.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsclient/nfsnode.h Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Sun Aug 20 10:07:45 2017 (r322721) +++ head/sys/fs/nfsclient/nfs_clbio.c Sun Aug 20 10:08:45 2017 (r322722) @@ -365,20 +365,13 @@ nfs_bioread_check_cons(struct vnode *vp, struct thread int error = 0; struct vattr vattr; struct nfsnode *np = VTONFS(vp); - int old_lock; + bool old_lock; /* - * Grab the exclusive lock before checking whether the cache is - * consistent. - * XXX - We can make this cheaper later (by acquiring cheaper locks). - * But for now, this suffices. + * Ensure the exclusove access to the node before checking + * whether the cache is consistent. */ - old_lock = ncl_upgrade_vnlock(vp); - if (vp->v_iflag & VI_DOOMED) { - error = EBADF; - goto out; - } - + old_lock = ncl_excl_start(vp); mtx_lock(&np->n_mtx); if (np->n_flag & NMODIFIED) { mtx_unlock(&np->n_mtx); @@ -386,9 +379,7 @@ nfs_bioread_check_cons(struct vnode *vp, struct thread if (vp->v_type != VDIR) panic("nfs: bioread, not dir"); ncl_invaldir(vp); - error = ncl_vinvalbuf(vp, V_SAVE, td, 1); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) - error = EBADF; + error = ncl_vinvalbuf(vp, V_SAVE | V_ALLOWCLEAN, td, 1); if (error != 0) goto out; } @@ -404,16 +395,14 @@ nfs_bioread_check_cons(struct vnode *vp, struct thread mtx_unlock(&np->n_mtx); error = VOP_GETATTR(vp, &vattr, cred); if (error) - return (error); + goto out; mtx_lock(&np->n_mtx); if ((np->n_flag & NSIZECHANGED) || (NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime))) { mtx_unlock(&np->n_mtx); if (vp->v_type == VDIR) ncl_invaldir(vp); - error = ncl_vinvalbuf(vp, V_SAVE, td, 1); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) - error = EBADF; + error = ncl_vinvalbuf(vp, V_SAVE | V_ALLOWCLEAN, td, 1); if (error != 0) goto out; mtx_lock(&np->n_mtx); @@ -423,7 +412,7 @@ nfs_bioread_check_cons(struct vnode *vp, struct thread mtx_unlock(&np->n_mtx); } out: - ncl_downgrade_vnlock(vp, old_lock); + ncl_excl_finish(vp, old_lock); return (error); } @@ -608,8 +597,6 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int iof while (error == NFSERR_BAD_COOKIE) { ncl_invaldir(vp); error = ncl_vinvalbuf(vp, 0, td, 1); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) - return (EBADF); /* * Yuck! The directory has been modified on the @@ -933,8 +920,6 @@ ncl_write(struct vop_write_args *ap) KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); error = ncl_vinvalbuf(vp, V_SAVE | ((ioflag & IO_VMIO) != 0 ? V_VMIO : 0), td, 1); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) - error = EBADF; if (error != 0) return (error); } else @@ -1016,9 +1001,6 @@ ncl_write(struct vop_write_args *ap) KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); error = ncl_vinvalbuf(vp, V_SAVE | ((ioflag & IO_VMIO) != 0 ? V_VMIO : 0), td, 1); - if (error == 0 && - (vp->v_iflag & VI_DOOMED) != 0) - error = EBADF; if (error != 0) return (error); wouldcommit = biosize; @@ -1336,7 +1318,7 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thre struct nfsnode *np = VTONFS(vp); struct nfsmount *nmp = VFSTONFS(vp->v_mount); int error = 0, slpflag, slptimeo; - int old_lock = 0; + bool old_lock; ASSERT_VOP_LOCKED(vp, "ncl_vinvalbuf"); @@ -1352,16 +1334,9 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thre slptimeo = 0; } - old_lock = ncl_upgrade_vnlock(vp); - if (vp->v_iflag & VI_DOOMED) { - /* - * Since vgonel() uses the generic vinvalbuf() to flush - * dirty buffers and it does not call this function, it - * is safe to just return OK when VI_DOOMED is set. - */ - ncl_downgrade_vnlock(vp, old_lock); - return (0); - } + old_lock = ncl_excl_start(vp); + if (old_lock) + flags |= V_ALLOWCLEAN; /* * Now, flush as required. @@ -1400,7 +1375,7 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thre np->n_flag &= ~NMODIFIED; mtx_unlock(&np->n_mtx); out: - ncl_downgrade_vnlock(vp, old_lock); + ncl_excl_finish(vp, old_lock); return error; } Modified: head/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnode.c Sun Aug 20 10:07:45 2017 (r322721) +++ head/sys/fs/nfsclient/nfs_clnode.c Sun Aug 20 10:08:45 2017 (r322722) @@ -141,6 +141,9 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize * happened to return an error no special casing is needed). */ mtx_init(&np->n_mtx, "NEWNFSnode lock", NULL, MTX_DEF | MTX_DUPOK); + lockinit(&np->n_excl, PVFS, "nfsupg", VLKTIMEOUT, LK_NOSHARE | + LK_CANRECURSE); + /* * NFS supports recursive and shared locking. */ @@ -167,6 +170,7 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize *npp = NULL; FREE((caddr_t)np->n_fhp, M_NFSFH); mtx_destroy(&np->n_mtx); + lockdestroy(&np->n_excl); uma_zfree(newnfsnode_zone, np); return (error); } @@ -332,6 +336,7 @@ ncl_reclaim(struct vop_reclaim_args *ap) if (np->n_v4 != NULL) FREE((caddr_t)np->n_v4, M_NFSV4NODE); mtx_destroy(&np->n_mtx); + lockdestroy(&np->n_excl); uma_zfree(newnfsnode_zone, vp->v_data); vp->v_data = NULL; return (0); Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Sun Aug 20 10:07:45 2017 (r322721) +++ head/sys/fs/nfsclient/nfs_clport.c Sun Aug 20 10:08:45 2017 (r322722) @@ -230,6 +230,8 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru * happened to return an error no special casing is needed). */ mtx_init(&np->n_mtx, "NEWNFSnode lock", NULL, MTX_DEF | MTX_DUPOK); + lockinit(&np->n_excl, PVFS, "nfsupg", VLKTIMEOUT, LK_NOSHARE | + LK_CANRECURSE); /* * Are we getting the root? If so, make sure the vnode flags @@ -271,6 +273,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru if (error != 0) { *npp = NULL; mtx_destroy(&np->n_mtx); + lockdestroy(&np->n_excl); FREE((caddr_t)nfhp, M_NFSFH); if (np->n_v4 != NULL) FREE((caddr_t)np->n_v4, M_NFSV4NODE); Modified: head/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clsubs.c Sun Aug 20 10:07:45 2017 (r322721) +++ head/sys/fs/nfsclient/nfs_clsubs.c Sun Aug 20 10:08:45 2017 (r322722) @@ -135,30 +135,33 @@ ncl_dircookie_unlock(struct nfsnode *np) mtx_unlock(&np->n_mtx); } -int -ncl_upgrade_vnlock(struct vnode *vp) +bool +ncl_excl_start(struct vnode *vp) { - int old_lock; + struct nfsnode *np; + int vn_lk; - ASSERT_VOP_LOCKED(vp, "ncl_upgrade_vnlock"); - old_lock = NFSVOPISLOCKED(vp); - if (old_lock != LK_EXCLUSIVE) { - KASSERT(old_lock == LK_SHARED, - ("ncl_upgrade_vnlock: wrong old_lock %d", old_lock)); - /* Upgrade to exclusive lock, this might block */ - NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY); - } - return (old_lock); + ASSERT_VOP_LOCKED(vp, "ncl_excl_start"); + vn_lk = NFSVOPISLOCKED(vp); + if (vn_lk == LK_EXCLUSIVE) + return (false); + KASSERT(vn_lk == LK_SHARED, + ("ncl_excl_start: wrong vnode lock %d", vn_lk)); + /* Ensure exclusive access, this might block */ + np = VTONFS(vp); + lockmgr(&np->n_excl, LK_EXCLUSIVE, NULL); + return (true); } void -ncl_downgrade_vnlock(struct vnode *vp, int old_lock) +ncl_excl_finish(struct vnode *vp, bool old_lock) { - if (old_lock != LK_EXCLUSIVE) { - KASSERT(old_lock == LK_SHARED, ("wrong old_lock %d", old_lock)); - /* Downgrade from exclusive lock. */ - NFSVOPLOCK(vp, LK_DOWNGRADE | LK_RETRY); - } + struct nfsnode *np; + + if (!old_lock) + return; + np = VTONFS(vp); + lockmgr(&np->n_excl, LK_RELEASE, NULL); } #ifdef NFS_ACDEBUG Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Sun Aug 20 10:07:45 2017 (r322721) +++ head/sys/fs/nfsclient/nfs_clvnops.c Sun Aug 20 10:08:45 2017 (r322722) @@ -520,8 +520,6 @@ nfs_open(struct vop_open_args *ap) if (np->n_flag & NMODIFIED) { mtx_unlock(&np->n_mtx); error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) - return (EBADF); if (error == EINTR || error == EIO) { if (NFS_ISV4(vp)) (void) nfsrpc_close(vp, 0, ap->a_td); @@ -558,8 +556,6 @@ nfs_open(struct vop_open_args *ap) np->n_direofoffset = 0; mtx_unlock(&np->n_mtx); error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) - return (EBADF); if (error == EINTR || error == EIO) { if (NFS_ISV4(vp)) (void) nfsrpc_close(vp, 0, ap->a_td); @@ -580,8 +576,6 @@ nfs_open(struct vop_open_args *ap) if (np->n_directio_opens == 0) { mtx_unlock(&np->n_mtx); error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) - return (EBADF); if (error) { if (NFS_ISV4(vp)) (void) nfsrpc_close(vp, 0, ap->a_td); @@ -722,8 +716,6 @@ nfs_close(struct vop_close_args *ap) } } else { error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) - return (EBADF); } mtx_lock(&np->n_mtx); } @@ -942,9 +934,7 @@ nfs_setattr(struct vop_setattr_args *ap) mtx_unlock(&np->n_mtx); error = ncl_vinvalbuf(vp, vap->va_size == 0 ? 0 : V_SAVE, td, 1); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) - error = EBADF; - if (error != 0) { + if (error != 0) { vnode_pager_setsize(vp, tsize); return (error); } @@ -971,8 +961,6 @@ nfs_setattr(struct vop_setattr_args *ap) (np->n_flag & NMODIFIED) && vp->v_type == VREG) { mtx_unlock(&np->n_mtx); error = ncl_vinvalbuf(vp, V_SAVE, td, 1); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) - return (EBADF); if (error == EINTR || error == EIO) return (error); } else @@ -1676,9 +1664,7 @@ nfs_remove(struct vop_remove_args *ap) * unnecessary delayed writes later. */ error = ncl_vinvalbuf(vp, 0, cnp->cn_thread, 1); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) - error = EBADF; - else if (error != EINTR && error != EIO) + if (error != EINTR && error != EIO) /* Do the rpc */ error = nfs_removerpc(dvp, vp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_cred, cnp->cn_thread); @@ -3089,10 +3075,6 @@ nfs_advlock(struct vop_advlock_args *ap) if ((np->n_flag & NMODIFIED) || ret || np->n_change != va.va_filerev) { (void) ncl_vinvalbuf(vp, V_SAVE, td, 1); - if ((vp->v_iflag & VI_DOOMED) != 0) { - NFSVOPUNLOCK(vp, 0); - return (EBADF); - } np->n_attrstamp = 0; KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); ret = VOP_GETATTR(vp, &va, cred); Modified: head/sys/fs/nfsclient/nfsnode.h ============================================================================== --- head/sys/fs/nfsclient/nfsnode.h Sun Aug 20 10:07:45 2017 (r322721) +++ head/sys/fs/nfsclient/nfsnode.h Sun Aug 20 10:08:45 2017 (r322722) @@ -92,6 +92,8 @@ struct nfs_accesscache { */ struct nfsnode { struct mtx n_mtx; /* Protects all of these members */ + struct lock n_excl; /* Exclusive helper for shared + vnode lock */ u_quad_t n_size; /* Current size of file */ u_quad_t n_brev; /* Modify rev when cached */ u_quad_t n_lrev; /* Modify rev for lease */ @@ -184,8 +186,8 @@ int ncl_removeit(struct sillyrename *, struct vnode *) int ncl_nget(struct mount *, u_int8_t *, int, struct nfsnode **, int); nfsuint64 *ncl_getcookie(struct nfsnode *, off_t, int); void ncl_invaldir(struct vnode *); -int ncl_upgrade_vnlock(struct vnode *); -void ncl_downgrade_vnlock(struct vnode *, int); +bool ncl_excl_start(struct vnode *); +void ncl_excl_finish(struct vnode *, bool old_lock); void ncl_dircookie_lock(struct nfsnode *); void ncl_dircookie_unlock(struct nfsnode *); From owner-svn-src-all@freebsd.org Sun Aug 20 10:42:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B494DC62FF for ; Sun, 20 Aug 2017 10:42:04 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-vk0-x22b.google.com (mail-vk0-x22b.google.com [IPv6:2607:f8b0:400c:c05::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D568981578 for ; Sun, 20 Aug 2017 10:42:03 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-vk0-x22b.google.com with SMTP id j189so43175207vka.0 for ; Sun, 20 Aug 2017 03:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NE5iCSOAIbrnJdgvywOLVWbIvVIeRgdSs9uPpUjwjcc=; b=b45Vr2OsMe+r4GMyuIr/upKFhTdunx7Uf1sZaJw1PXo9Xj2N+EX9X/WTmD6wgT94hQ OfG+pVxUt3vzECFQjz7Kk4jVzibZsYz6wEbTMRb+QrcVn4MHVYcQvk9pfExkRqoGNsos eH8xpFnKwlyj73I18TiSNwlbf6u4mLoKsoA/whwpadAve/kGBWfKPAZLqnrdKy25axjK 2/sV6xkDQ6/W5Bvl6mC5nGBKGWN8h8fC0/FNbl8fZfy46GQe7DGpngdAFIgicIzyhNgZ dUQceYUDyhKg8HYtWcG063XJSro2g4Ob2g93exatQ8ikmpxBp7TMpp/4leFCPvMejP4Y gFdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NE5iCSOAIbrnJdgvywOLVWbIvVIeRgdSs9uPpUjwjcc=; b=Gn4yhe9BlW/5M7K1ssn7b+/FBN8HSSvr83BjjLeiAWMUih97vJRmDEqGL3eWhgmjzO SQf/UNHcMduF9ILUdA5PrJxhBe4gbkPS8bs61/CYDOcgKgvwO6XI/0m/T4MtNCk31rdK fRnNA9m6r5aSoXwZHwntfHxCOxLGGJ3BrlczNFJHJMIYPa3sxGZlhJYrpu4+hgrKHynT WStE7syTkJ3tnrdk5RdrQOCXgySt5puZwldBVxL238ZyUi2gwghyqrCrEN/5Ue8mcSH7 PB3Pn78H7iXSoYUkc7gxehlltxGQ1Z1FbKTVZBMrpag5D4HJ10XdDzFPo8p8rwhOB2tf TTmQ== X-Gm-Message-State: AHYfb5g8veEBP9L2zNrDJEOu5dvX/oHh6NfiteZFlTfo1JWdEL6oOn2l hw1dSWV1Kra3sDkwc9mZl1xAXjFllDVD X-Received: by 10.31.16.196 with SMTP id 65mr4215295vkq.37.1503225722309; Sun, 20 Aug 2017 03:42:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.8.70 with HTTP; Sun, 20 Aug 2017 03:42:01 -0700 (PDT) In-Reply-To: <201708200952.v7K9qPP4036384@repo.freebsd.org> References: <201708200952.v7K9qPP4036384@repo.freebsd.org> From: Oliver Pinter Date: Sun, 20 Aug 2017 12:42:01 +0200 Message-ID: Subject: Re: svn commit: r322720 - head/sys/amd64/amd64 To: Konstantin Belousov Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 10:42:04 -0000 On Sunday, August 20, 2017, Konstantin Belousov wrote: > Author: kib > Date: Sun Aug 20 09:52:25 2017 > New Revision: 322720 > URL: https://svnweb.freebsd.org/changeset/base/322720 > > Log: > Simplify amd64 trap(). > > - Use more relevant name 'signo' instead of 'i' for the local variable > which contains a signal number to send for the current exception. > - Eliminate two labels 'userout' and 'out' which point to the very end > of the trap() function. Instead use return directly. > - Re-indent the prot_fault_translation block by reducing if() nesting. > - Some more monor style changes. > > Requested and reviewed by: bde > Tested by: pho > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > Modified: > head/sys/amd64/amd64/trap.c > > Modified: head/sys/amd64/amd64/trap.c > ============================================================ > ================== > --- head/sys/amd64/amd64/trap.c Sun Aug 20 09:42:09 2017 (r322719) > +++ head/sys/amd64/amd64/trap.c Sun Aug 20 09:52:25 2017 (r322720) > @@ -172,12 +172,12 @@ trap(struct trapframe *frame) > #ifdef KDB > register_t dr6; > #endif > - int i, ucode; > + int signo, ucode; > u_int type; > > td = curthread; > p = td->td_proc; > - i = 0; > + signo = 0; > ucode = 0; > addr = 0; > > @@ -186,22 +186,20 @@ trap(struct trapframe *frame) > > #ifdef SMP > /* Handler for NMI IPIs used for stopping CPUs. */ > - if (type == T_NMI) { > - if (ipi_nmi_handler() == 0) > - goto out; > - } > -#endif /* SMP */ > + if (type == T_NMI && ipi_nmi_handler() == 0) > + return; > +#endif > > #ifdef KDB > if (kdb_active) { > kdb_reenter(); > - goto out; > + return; > } > #endif > > if (type == T_RESERVED) { > trap_fatal(frame, 0); > - goto out; > + return; > } > > if (type == T_NMI) { > @@ -214,18 +212,18 @@ trap(struct trapframe *frame) > */ > if (pmc_intr != NULL && > (*pmc_intr)(PCPU_GET(cpuid), frame) != 0) > - goto out; > + return; > #endif > > #ifdef STACK > if (stack_nmi_handler(frame) != 0) > - goto out; > + return; > #endif > } > > if (type == T_MCHK) { > mca_intr(); > - goto out; > + return; > } > > if ((frame->tf_rflags & PSL_I) == 0) { > @@ -269,7 +267,7 @@ trap(struct trapframe *frame) > > switch (type) { > case T_PRIVINFLT: /* privileged instruction fault */ > - i = SIGILL; > + signo = SIGILL; > ucode = ILL_PRVOPC; > break; > > @@ -281,41 +279,41 @@ trap(struct trapframe *frame) > fill_frame_regs(frame, ®s); > if (dtrace_pid_probe_ptr != NULL && > dtrace_pid_probe_ptr(®s) == 0) > - goto out; > + return; > } > #endif > frame->tf_rflags &= ~PSL_T; > - i = SIGTRAP; > + signo = SIGTRAP; > ucode = (type == T_TRCTRAP ? TRAP_TRACE : > TRAP_BRKPT); > break; > > case T_ARITHTRAP: /* arithmetic trap */ > ucode = fputrap_x87(); > if (ucode == -1) > - goto userout; > - i = SIGFPE; > + return; > + signo = SIGFPE; > break; > > case T_PROTFLT: /* general protection fault */ > - i = SIGBUS; > + signo = SIGBUS; > ucode = BUS_OBJERR; > break; > case T_STKFLT: /* stack fault */ > case T_SEGNPFLT: /* segment not present fault */ > - i = SIGBUS; > + signo = SIGBUS; > ucode = BUS_ADRERR; > break; > case T_TSSFLT: /* invalid TSS fault */ > - i = SIGBUS; > + signo = SIGBUS; > ucode = BUS_OBJERR; > break; > case T_ALIGNFLT: > - i = SIGBUS; > + signo = SIGBUS; > ucode = BUS_ADRALN; > break; > case T_DOUBLEFLT: /* double fault */ > default: > - i = SIGBUS; > + signo = SIGBUS; > ucode = BUS_OBJERR; > break; > > @@ -325,67 +323,64 @@ trap(struct trapframe *frame) > */ > if (*p->p_sysent->sv_trap != NULL && > (*p->p_sysent->sv_trap)(td) == 0) > - goto userout; > + return; > > addr = frame->tf_addr; > - i = trap_pfault(frame, TRUE); > - if (i == -1) > - goto userout; > - if (i == 0) > - goto user; > - > - if (i == SIGSEGV) > + signo = trap_pfault(frame, TRUE); > + if (signo == -1) > + return; > + if (signo == 0) > + goto userret; > + if (signo == SIGSEGV) { > ucode = SEGV_MAPERR; > - else { > - if (prot_fault_translation == 0) { > - /* > - * Autodetect. > - * This check also covers the > images > - * without the ABI-tag ELF note. > - */ > - if (SV_CURPROC_ABI() == > SV_ABI_FREEBSD > - && p->p_osrel >= > P_OSREL_SIGSEGV) { > - i = SIGSEGV; > - ucode = SEGV_ACCERR; > - } else { > - i = SIGBUS; > - ucode = BUS_PAGE_FAULT; > - } > - } else if (prot_fault_translation == 1) { > - /* > - * Always compat mode. > - */ > - i = SIGBUS; > - ucode = BUS_PAGE_FAULT; > - } else { > - /* > - * Always SIGSEGV mode. > - */ > - i = SIGSEGV; > + } else if (prot_fault_translation == 0) { > + /* > + * Autodetect. This check also covers > + * the images without the ABI-tag ELF > + * note. > + */ > + if (SV_CURPROC_ABI() == SV_ABI_FREEBSD && > + p->p_osrel >= P_OSREL_SIGSEGV) { > + signo = SIGSEGV; > ucode = SEGV_ACCERR; > + } else { > + signo = SIGBUS; > + ucode = BUS_PAGE_FAULT; > } > + } else if (prot_fault_translation == 1) { > + /* > + * Always compat mode. > + */ > + signo = SIGBUS; > + ucode = BUS_PAGE_FAULT; > + } else { > + /* > + * Always SIGSEGV mode. > + */ > + signo = SIGSEGV; > + ucode = SEGV_ACCERR; > } > break; > > case T_DIVIDE: /* integer divide fault */ > ucode = FPE_INTDIV; > - i = SIGFPE; > + signo = SIGFPE; > break; > > #ifdef DEV_ISA > case T_NMI: > nmi_handle_intr(type, frame); > - goto out; > -#endif /* DEV_ISA */ > + return; > +#endif > > case T_OFLOW: /* integer overflow fault */ > ucode = FPE_INTOVF; > - i = SIGFPE; > + signo = SIGFPE; > break; > > case T_BOUND: /* bounds check fault */ > ucode = FPE_FLTSUB; > - i = SIGFPE; > + signo = SIGFPE; > break; > > case T_DNA: > @@ -393,18 +388,18 @@ trap(struct trapframe *frame) > KASSERT(PCB_USER_FPU(td->td_pcb), > ("kernel FPU ctx has leaked")); > fpudna(); > - goto userout; > + return; > > case T_FPOPFLT: /* FPU operand fetch fault */ > ucode = ILL_COPROC; > - i = SIGILL; > + signo = SIGILL; > break; > > case T_XMMFLT: /* SIMD floating-point exception */ > ucode = fputrap_sse(); > if (ucode == -1) > - goto userout; > - i = SIGFPE; > + return; > + signo = SIGFPE; > break; > #ifdef KDTRACE_HOOKS > case T_DTRACE_RET: > @@ -412,8 +407,8 @@ trap(struct trapframe *frame) > fill_frame_regs(frame, ®s); > if (dtrace_return_probe_ptr != NULL && > dtrace_return_probe_ptr(®s) == 0) > - goto out; > - goto userout; > + return; > + return; This part of code - the double return - looks weird. Probably it was left here to document the original "behavior". > #endif > } > } else { > @@ -424,13 +419,13 @@ trap(struct trapframe *frame) > switch (type) { > case T_PAGEFLT: /* page fault */ > (void) trap_pfault(frame, FALSE); > - goto out; > + return; > > case T_DNA: > if (PCB_USER_FPU(td->td_pcb)) > panic("Unregistered use of FPU in kernel"); > fpudna(); > - goto out; > + return; > > case T_ARITHTRAP: /* arithmetic trap */ > case T_XMMFLT: /* SIMD floating-point exception */ > @@ -440,7 +435,7 @@ trap(struct trapframe *frame) > * registration for FPU traps is overkill. > */ > trap_fatal(frame, 0); > - goto out; > + return; > > case T_STKFLT: /* stack fault */ > case T_PROTFLT: /* general protection fault */ > @@ -460,35 +455,35 @@ trap(struct trapframe *frame) > */ > if (frame->tf_rip == (long)doreti_iret) { > frame->tf_rip = (long)doreti_iret_fault; > - goto out; > + return; > } > if (frame->tf_rip == (long)ld_ds) { > frame->tf_rip = (long)ds_load_fault; > - goto out; > + return; > } > if (frame->tf_rip == (long)ld_es) { > frame->tf_rip = (long)es_load_fault; > - goto out; > + return; > } > if (frame->tf_rip == (long)ld_fs) { > frame->tf_rip = (long)fs_load_fault; > - goto out; > + return; > } > if (frame->tf_rip == (long)ld_gs) { > frame->tf_rip = (long)gs_load_fault; > - goto out; > + return; > } > if (frame->tf_rip == (long)ld_gsbase) { > frame->tf_rip = (long)gsbase_load_fault; > - goto out; > + return; > } > if (frame->tf_rip == (long)ld_fsbase) { > frame->tf_rip = (long)fsbase_load_fault; > - goto out; > + return; > } > if (curpcb->pcb_onfault != NULL) { > frame->tf_rip = (long)curpcb->pcb_onfault; > - goto out; > + return; > } > break; > > @@ -504,7 +499,7 @@ trap(struct trapframe *frame) > */ > if (frame->tf_rflags & PSL_NT) { > frame->tf_rflags &= ~PSL_NT; > - goto out; > + return; > } > break; > > @@ -525,7 +520,7 @@ trap(struct trapframe *frame) > * processor doesn't > */ > load_dr6(rdr6() & ~0xf); > - goto out; > + return; > } > /* > * FALLTHROUGH (TRCTRAP kernel mode, kernel > address) > @@ -540,27 +535,27 @@ trap(struct trapframe *frame) > dr6 = rdr6(); > load_dr6(dr6 & ~0x4000); > if (kdb_trap(type, dr6, frame)) > - goto out; > + return; > #endif > break; > > #ifdef DEV_ISA > case T_NMI: > nmi_handle_intr(type, frame); > - goto out; > -#endif /* DEV_ISA */ > + return; > +#endif > } > > trap_fatal(frame, 0); > - goto out; > + return; > } > > /* Translate fault for emulators (e.g. Linux) */ > - if (*p->p_sysent->sv_transtrap) > - i = (*p->p_sysent->sv_transtrap)(i, type); > + if (*p->p_sysent->sv_transtrap != NULL) > + signo = (*p->p_sysent->sv_transtrap)(signo, type); > > ksiginfo_init_trap(&ksi); > - ksi.ksi_signo = i; > + ksi.ksi_signo = signo; > ksi.ksi_code = ucode; > ksi.ksi_trapno = type; > ksi.ksi_addr = (void *)addr; > @@ -568,8 +563,8 @@ trap(struct trapframe *frame) > uprintf("pid %d comm %s: signal %d err %lx code %d type %d > " > "addr 0x%lx rsp 0x%lx rip 0x%lx " > "<%02x %02x %02x %02x %02x %02x %02x %02x>\n", > - p->p_pid, p->p_comm, i, frame->tf_err, ucode, type, > addr, > - frame->tf_rsp, frame->tf_rip, > + p->p_pid, p->p_comm, signo, frame->tf_err, ucode, type, > + addr, frame->tf_rsp, frame->tf_rip, > fubyte((void *)(frame->tf_rip + 0)), > fubyte((void *)(frame->tf_rip + 1)), > fubyte((void *)(frame->tf_rip + 2)), > @@ -581,14 +576,10 @@ trap(struct trapframe *frame) > } > KASSERT((read_rflags() & PSL_I) != 0, ("interrupts disabled")); > trapsignal(td, &ksi); > - > -user: > +userret: > userret(td, frame); > KASSERT(PCB_USER_FPU(td->td_pcb), > ("Return from trap with kernel FPU ctx leaked")); > -userout: > -out: > - return; > } > > /* > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org > " > From owner-svn-src-all@freebsd.org Sun Aug 20 11:18:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1445FDC8394; Sun, 20 Aug 2017 11:18:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D21D4826AB; Sun, 20 Aug 2017 11:18:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KBIGYZ069413; Sun, 20 Aug 2017 11:18:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KBIGxH069412; Sun, 20 Aug 2017 11:18:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708201118.v7KBIGxH069412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 20 Aug 2017 11:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322723 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 322723 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 11:18:18 -0000 Author: kib Date: Sun Aug 20 11:18:16 2017 New Revision: 322723 URL: https://svnweb.freebsd.org/changeset/base/322723 Log: Simplify the code. Noted by: Oliver Pinter Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Sun Aug 20 10:08:45 2017 (r322722) +++ head/sys/amd64/amd64/trap.c Sun Aug 20 11:18:16 2017 (r322723) @@ -405,9 +405,8 @@ trap(struct trapframe *frame) case T_DTRACE_RET: enable_intr(); fill_frame_regs(frame, ®s); - if (dtrace_return_probe_ptr != NULL && - dtrace_return_probe_ptr(®s) == 0) - return; + if (dtrace_return_probe_ptr != NULL) + dtrace_return_probe_ptr(®s); return; #endif } From owner-svn-src-all@freebsd.org Sun Aug 20 11:19:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D094FDC8469; Sun, 20 Aug 2017 11:19:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C342827F0; Sun, 20 Aug 2017 11:19:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v7KBIsp6058495 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 20 Aug 2017 14:18:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v7KBIsp6058495 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v7KBIsS8058494; Sun, 20 Aug 2017 14:18:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 20 Aug 2017 14:18:54 +0300 From: Konstantin Belousov To: Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322720 - head/sys/amd64/amd64 Message-ID: <20170820111854.GA1700@kib.kiev.ua> References: <201708200952.v7K9qPP4036384@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 11:19:03 -0000 On Sun, Aug 20, 2017 at 12:42:01PM +0200, Oliver Pinter wrote: > > @@ -412,8 +407,8 @@ trap(struct trapframe *frame) > > fill_frame_regs(frame, ®s); > > if (dtrace_return_probe_ptr != NULL && > > dtrace_return_probe_ptr(®s) == 0) > > - goto out; > > - goto userout; > > + return; > > + return; > > > This part of code - the double return - looks weird. Probably it was left > here to document the original "behavior". Indeed it is weird. I think that the original code was written at the time when userout and out were different return paths. Another possibility was that it actually wanted to do goto userret instead of goto userout, i.e. to call userret() before returning to usermode. Anyway, I cleaned this up without changing the algorithm. From owner-svn-src-all@freebsd.org Sun Aug 20 16:52:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D27DDDF731; Sun, 20 Aug 2017 16:52:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E82826B701; Sun, 20 Aug 2017 16:52:28 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KGqRhl014309; Sun, 20 Aug 2017 16:52:27 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KGqRNo014303; Sun, 20 Aug 2017 16:52:27 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708201652.v7KGqRNo014303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 20 Aug 2017 16:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322724 - in stable/10/sys: arm/broadcom/bcm2835 conf dev/usb/controller dev/usb/net X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/10/sys: arm/broadcom/bcm2835 conf dev/usb/controller dev/usb/net X-SVN-Commit-Revision: 322724 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 16:52:29 -0000 Author: marius Date: Sun Aug 20 16:52:27 2017 New Revision: 322724 URL: https://svnweb.freebsd.org/changeset/base/322724 Log: MFC: r266470, r273546, r276017, r277932, r279153, r279778, r279780, r278797, r278861, r280283, r280284, r280294, r280452, r280558, r280571, r281863, r282049, r282357, r282440, r282441, r282358, r282359, r283550, r283918, r290171, r290667, r290381, r290533, r290666, r292483, r295659, r297545, r298305, r298383, r298428, r306489, r306557, r307067, r307068, r307087, r307088, r307089, r307091, r307092, r307093, r307098, r307115, r307154, r307240, r307241, r315967, r316476 Unbreak BCM2835/RPI-B support by bringing it in line with stable/11 and head: - Optimise reading of pending interrupt registers. - Fix a bug where some DTS layouts could cause the premature ending of the search (i.e. without returning any result) and you would end up with a random MAC address. - Reduce the diff between head and arm_intrng with the bcm2835 interrupt controller. - Allow the retrieving of the reserved pins state. - Add support to the bcm2835 mailbox driver to work before interrupts are enabled. This will be needed to enable the power on devices early on in the boot process. - Add support for enabling the USB on the Raspberry Pi boards when it hasn't been done by U-Boot. This allows the USB to work when we load the kernel directly. - Call config_intrhook_disestablish on failure of the bcm2835 fb and fbd intr hooks. With this we can get through the boot even if these functions fail. - Add the structures needed to get/set the power state. These can be used when, for example, we boot without U-Boot and wish to enable USB, or to suspend an unneeded device. - Add a mask to match only the relative base address of BSC controllers. - Move the code to set the device power to the bcm2835 mailbox driver so it can be reused by other drivers. - Add the SOC_BCM2835 and SOC_BCM2836 options for the arm kernel and add the former to std.bcm2835. - Add a helper function to read clock frequencies from videocore and use this to get the default frequency of the sdhci device. - Add partial support for the Raspberry Pi 2. - Remove a debug #error from the bcm2835 sdhci driver. - Fetch the SDHCI frequency from videocore (our prefered source) and only if it fails, fetch the clock-frequency from DTB. If both methods fail, use the hardcoded default. - Pass the supplied buffer length instead of a fixed size. - Add the routines to query and setup the framebuffer state using the BCM2835_MBOX_CHAN_PROP channel. The old channel (BCM2835_MBOX_CHAN_FB) seems deprecated on recent firmware versions and is causing a freeze on RPi 2. - Fix DMA on RPi 2. BCM2836 has a different base address for peripherals. - Enable DMA for sdhci on RPi 2 (BCM2836). - Add a missing wakeup when releasing ownership of the SPI hardware. - Fix framebuffer compatibility with new RPi firmware. - Refactor bcm2835_cpufreq to use bcm2835_mbox_property API. - Fix the sc(4) framebuffer driver on RPi 2. - Fix the vt(4) framebuffer driver on RPi 2. - Remove unused mutex and softc variables. - Refactor mailbox property API to make it usable for /dev/vcio driver. - Replace semaphore-base locking with sleep/wait synchronization. - Fix infinite loop if response from VideoCore never received. - Set have_message in interrupt to handle "response before READ" case. - Serialize access to property channel when using bcm2835_mbox_property. - Force framebuffer virtual viewport to be the same as physical. - Use proper type of tag in bcm2835_mbox_fb_init. - bcm2835_cpufreq: Only attach driver if we correcly match on the machine compatible string. - Add dev.fb.X.resync sysctl to resync ARM framebuffer with VideoCore. - Do not use DMA channels used by GPU. - Define local-intc for BCM2836 platform (RPI2) and make BCM2835 intc a child of it. - Fix build for Pi kernels with syscons enabled. - Use VM_MEMATTR_WRITE_COMBINING memattr for mmap(2) on framebuffer. - Make intc driver compatible with upstream DTS. - Make Rapsberry Pi watchdog driver compatible with upstream DTS. - Make sure intc is attached before interrupt consumers. - Make framebuffer driver compatible with upstream DT. - Add one more heuristic to determine MAC address of the SMSC device. - Add compatibility strings from upstream DT. - Fix spelling mistake, BCM2835_PASWORD -> BCM2835_PASSWORD. Approved by: re (kib) Added: stable/10/sys/arm/broadcom/bcm2835/bcm2836.c - copied unchanged from r280558, head/sys/arm/broadcom/bcm2835/bcm2836.c stable/10/sys/arm/broadcom/bcm2835/bcm2836.h - copied unchanged from r280558, head/sys/arm/broadcom/bcm2835/bcm2836.h stable/10/sys/arm/broadcom/bcm2835/bcm283x_dwc_fdt.c - copied, changed from r279778, head/sys/arm/broadcom/bcm2835/bcm283x_dwc_fdt.c stable/10/sys/arm/broadcom/bcm2835/files.bcm2836 - copied unchanged from r280558, head/sys/arm/broadcom/bcm2835/files.bcm2836 stable/10/sys/arm/broadcom/bcm2835/std.bcm2836 - copied unchanged from r280558, head/sys/arm/broadcom/bcm2835/std.bcm2836 stable/10/sys/dev/usb/controller/dwc_otg_fdt.h - copied unchanged from r279778, head/sys/dev/usb/controller/dwc_otg_fdt.h Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h stable/10/sys/arm/broadcom/bcm2835/bcm2835_common.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_dma.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_dma.h stable/10/sys/arm/broadcom/bcm2835/bcm2835_fb.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_fbd.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_gpio.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_intr.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_mbox.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h stable/10/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_spi.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h stable/10/sys/arm/broadcom/bcm2835/bcm2835_wdog.c stable/10/sys/arm/broadcom/bcm2835/files.bcm2835 stable/10/sys/arm/broadcom/bcm2835/std.bcm2835 stable/10/sys/conf/options.arm stable/10/sys/dev/usb/controller/dwc_otg_fdt.c stable/10/sys/dev/usb/net/if_smsc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Sun Aug 20 11:18:16 2017 (r322723) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Sun Aug 20 16:52:27 2017 (r322724) @@ -52,6 +52,13 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-bsc", 1}, + {"brcm,bcm2708-i2c", 1}, + {"brcm,bcm2835-i2c", 1}, + {NULL, 0} +}; + static void bcm_bsc_intr(void *); static int bcm_bsc_detach(device_t); @@ -214,7 +221,7 @@ bcm_bsc_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-bsc")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "BCM2708/2835 BSC controller"); @@ -247,7 +254,7 @@ bcm_bsc_attach(device_t dev) /* Check the unit we are attaching by its base address. */ start = rman_get_start(sc->sc_mem_res); for (i = 0; i < nitems(bcm_bsc_pins); i++) { - if (bcm_bsc_pins[i].start == start) + if (bcm_bsc_pins[i].start == (start & BCM_BSC_BASE_MASK)) break; } if (i == nitems(bcm_bsc_pins)) { Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Sun Aug 20 11:18:16 2017 (r322723) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Sun Aug 20 16:52:27 2017 (r322724) @@ -35,9 +35,10 @@ struct { uint32_t scl; unsigned long start; } bcm_bsc_pins[] = { - { 0, 1, 0x20205000 }, /* BSC0 GPIO pins and base address. */ - { 2, 3, 0x20804000 } /* BSC1 GPIO pins and base address. */ + { 0, 1, 0x205000 }, /* BSC0 GPIO pins and base address. */ + { 2, 3, 0x804000 } /* BSC1 GPIO pins and base address. */ }; +#define BCM_BSC_BASE_MASK 0x00ffffff struct bcm_bsc_softc { device_t sc_dev; Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_common.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_common.c Sun Aug 20 11:18:16 2017 (r322723) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_common.c Sun Aug 20 16:52:27 2017 (r322724) @@ -58,14 +58,22 @@ fdt_intc_decode_ic(phandle_t node, pcell_t *intr, int int *pol) { - if (!fdt_is_compatible(node, "broadcom,bcm2835-armctrl-ic")) - return (ENXIO); - - *interrupt = fdt32_to_cpu(intr[0]); - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - - return (0); + if (fdt_is_compatible(node, "broadcom,bcm2835-armctrl-ic") || + fdt_is_compatible(node, "brcm,bcm2836-armctrl-ic")) { + *interrupt = fdt32_to_cpu(intr[0]); + *trig = INTR_TRIGGER_CONFORM; + *pol = INTR_POLARITY_CONFORM; + return (0); + } +#ifdef SOC_BCM2836 + if (fdt_is_compatible(node, "brcm,bcm2836-l1-intc")) { + *interrupt = fdt32_to_cpu(intr[0]) + 72; + *trig = INTR_TRIGGER_CONFORM; + *pol = INTR_POLARITY_CONFORM; + return (0); + } +#endif + return (ENXIO); } Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Sun Aug 20 11:18:16 2017 (r322723) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Sun Aug 20 16:52:27 2017 (r322724) @@ -44,6 +44,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include + +#include +#include + #include #include #include @@ -108,17 +113,17 @@ struct bcm2835_cpufreq_softc { int voltage_sdram_p; int turbo_mode; - /* mbox buffer (physical address) */ - bus_dma_tag_t dma_tag; - bus_dmamap_t dma_map; - bus_size_t dma_size; - void *dma_buf; - bus_addr_t dma_phys; - /* initial hook for waiting mbox intr */ struct intr_config_hook init_hook; }; +static struct ofw_compat_data compat_data[] = { + { "broadcom,bcm2835-vc", 1 }, + { "broadcom,bcm2708-vc", 1 }, + { "brcm,bcm2709", 1 }, + { NULL, 0 } +}; + static int cpufreq_verbose = 0; TUNABLE_INT("hw.bcm2835.cpufreq.verbose", &cpufreq_verbose); static int cpufreq_lowest_freq = DEFAULT_LOWEST_FREQ; @@ -144,84 +149,10 @@ bcm2835_dump(const void *data, int len) #endif static int -bcm2835_mbox_call_prop(struct bcm2835_cpufreq_softc *sc) -{ - struct bcm2835_mbox_hdr *msg = (struct bcm2835_mbox_hdr *)sc->dma_buf; - struct bcm2835_mbox_tag_hdr *tag, *last; - uint8_t *up; - device_t mbox; - size_t hdr_size; - int idx; - int err; - - /* - * For multiple calls, locking is not here. The caller must have - * VC semaphore. - */ - - /* get mbox device */ - mbox = devclass_get_device(devclass_find("mbox"), 0); - if (mbox == NULL) { - device_printf(sc->dev, "can't find mbox\n"); - return (-1); - } - - /* go mailbox property */ -#ifdef PROP_DEBUG - bcm2835_dump(msg, 64); -#endif - bus_dmamap_sync(sc->dma_tag, sc->dma_map, - BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); - MBOX_WRITE(mbox, BCM2835_MBOX_CHAN_PROP, (uint32_t)sc->dma_phys); - MBOX_READ(mbox, BCM2835_MBOX_CHAN_PROP, &err); - bus_dmamap_sync(sc->dma_tag, sc->dma_map, BUS_DMASYNC_POSTREAD); -#ifdef PROP_DEBUG - bcm2835_dump(msg, 64); -#endif - - /* check response code */ - if (msg->code != BCM2835_MBOX_CODE_RESP_SUCCESS) { - device_printf(sc->dev, "mbox response error\n"); - return (-1); - } - - /* tag = first tag */ - up = (uint8_t *)msg; - hdr_size = sizeof(struct bcm2835_mbox_hdr); - tag = (struct bcm2835_mbox_tag_hdr *)(up + hdr_size); - /* last = end of buffer specified by header */ - last = (struct bcm2835_mbox_tag_hdr *)(up + msg->buf_size); - - /* loop unitl end tag (=0x0) */ - hdr_size = sizeof(struct bcm2835_mbox_tag_hdr); - for (idx = 0; tag->tag != 0; idx++) { - if ((tag->val_len & BCM2835_MBOX_TAG_VAL_LEN_RESPONSE) == 0) { - device_printf(sc->dev, "tag%d response error\n", idx); - return (-1); - } - /* clear response bit */ - tag->val_len &= ~BCM2835_MBOX_TAG_VAL_LEN_RESPONSE; - - /* get next tag */ - up = (uint8_t *)tag; - tag = (struct bcm2835_mbox_tag_hdr *)(up + hdr_size + - tag->val_buf_size); - - /* check buffer size of header */ - if (tag > last) { - device_printf(sc->dev, "mbox buffer size error\n"); - return (-1); - } - } - - return (0); -} - -static int bcm2835_cpufreq_get_clock_rate(struct bcm2835_cpufreq_softc *sc, uint32_t clock_id) { - struct msg_get_clock_rate *msg; + struct msg_get_clock_rate msg; int rate; int err; @@ -239,26 +170,18 @@ bcm2835_cpufreq_get_clock_rate(struct bcm2835_cpufreq_ * u32: rate (in Hz) */ - /* using DMA buffer for VC */ - msg = (struct msg_get_clock_rate *)sc->dma_buf; - if (sizeof(*msg) > sc->dma_size) { - device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n", - sizeof(*msg), sc->dma_size); - return (MSG_ERROR); - } - /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_GET_CLOCK_RATE; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.clock_id = clock_id; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_GET_CLOCK_RATE; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.clock_id = clock_id; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't get clock rate (id=%u)\n", clock_id); @@ -266,7 +189,7 @@ bcm2835_cpufreq_get_clock_rate(struct bcm2835_cpufreq_ } /* result (Hz) */ - rate = (int)msg->body.resp.rate_hz; + rate = (int)msg.body.resp.rate_hz; DPRINTF("clock = %d(Hz)\n", rate); return (rate); } @@ -275,7 +198,7 @@ static int bcm2835_cpufreq_get_max_clock_rate(struct bcm2835_cpufreq_softc *sc, uint32_t clock_id) { - struct msg_get_max_clock_rate *msg; + struct msg_get_max_clock_rate msg; int rate; int err; @@ -293,26 +216,18 @@ bcm2835_cpufreq_get_max_clock_rate(struct bcm2835_cpuf * u32: rate (in Hz) */ - /* using DMA buffer for VC */ - msg = (struct msg_get_max_clock_rate *)sc->dma_buf; - if (sizeof(*msg) > sc->dma_size) { - device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n", - sizeof(*msg), sc->dma_size); - return (MSG_ERROR); - } - /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_GET_MAX_CLOCK_RATE; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.clock_id = clock_id; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_GET_MAX_CLOCK_RATE; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.clock_id = clock_id; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't get max clock rate (id=%u)\n", clock_id); @@ -320,7 +235,7 @@ bcm2835_cpufreq_get_max_clock_rate(struct bcm2835_cpuf } /* result (Hz) */ - rate = (int)msg->body.resp.rate_hz; + rate = (int)msg.body.resp.rate_hz; DPRINTF("clock = %d(Hz)\n", rate); return (rate); } @@ -329,7 +244,7 @@ static int bcm2835_cpufreq_get_min_clock_rate(struct bcm2835_cpufreq_softc *sc, uint32_t clock_id) { - struct msg_get_min_clock_rate *msg; + struct msg_get_min_clock_rate msg; int rate; int err; @@ -347,26 +262,18 @@ bcm2835_cpufreq_get_min_clock_rate(struct bcm2835_cpuf * u32: rate (in Hz) */ - /* using DMA buffer for VC */ - msg = (struct msg_get_min_clock_rate *)sc->dma_buf; - if (sizeof(*msg) > sc->dma_size) { - device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n", - sizeof(*msg), sc->dma_size); - return (MSG_ERROR); - } - /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_GET_MIN_CLOCK_RATE; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.clock_id = clock_id; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_GET_MIN_CLOCK_RATE; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.clock_id = clock_id; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't get min clock rate (id=%u)\n", clock_id); @@ -374,7 +281,7 @@ bcm2835_cpufreq_get_min_clock_rate(struct bcm2835_cpuf } /* result (Hz) */ - rate = (int)msg->body.resp.rate_hz; + rate = (int)msg.body.resp.rate_hz; DPRINTF("clock = %d(Hz)\n", rate); return (rate); } @@ -383,7 +290,7 @@ static int bcm2835_cpufreq_set_clock_rate(struct bcm2835_cpufreq_softc *sc, uint32_t clock_id, uint32_t rate_hz) { - struct msg_set_clock_rate *msg; + struct msg_set_clock_rate msg; int rate; int err; @@ -402,27 +309,19 @@ bcm2835_cpufreq_set_clock_rate(struct bcm2835_cpufreq_ * u32: rate (in Hz) */ - /* using DMA buffer for VC */ - msg = (struct msg_set_clock_rate *)sc->dma_buf; - if (sizeof(*msg) > sc->dma_size) { - device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n", - sizeof(*msg), sc->dma_size); - return (MSG_ERROR); - } - /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_SET_CLOCK_RATE; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.clock_id = clock_id; - msg->body.req.rate_hz = rate_hz; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_SET_CLOCK_RATE; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.clock_id = clock_id; + msg.body.req.rate_hz = rate_hz; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't set clock rate (id=%u)\n", clock_id); @@ -440,18 +339,18 @@ bcm2835_cpufreq_set_clock_rate(struct bcm2835_cpufreq_ */ /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_SET_CLOCK_RATE; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.clock_id = clock_id; - msg->body.req.rate_hz = rate_hz; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_SET_CLOCK_RATE; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.clock_id = clock_id; + msg.body.req.rate_hz = rate_hz; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't set clock rate (id=%u)\n", clock_id); @@ -460,7 +359,7 @@ bcm2835_cpufreq_set_clock_rate(struct bcm2835_cpufreq_ } /* result (Hz) */ - rate = (int)msg->body.resp.rate_hz; + rate = (int)msg.body.resp.rate_hz; DPRINTF("clock = %d(Hz)\n", rate); return (rate); } @@ -468,7 +367,7 @@ bcm2835_cpufreq_set_clock_rate(struct bcm2835_cpufreq_ static int bcm2835_cpufreq_get_turbo(struct bcm2835_cpufreq_softc *sc) { - struct msg_get_turbo *msg; + struct msg_get_turbo msg; int level; int err; @@ -486,33 +385,25 @@ bcm2835_cpufreq_get_turbo(struct bcm2835_cpufreq_softc * u32: level */ - /* using DMA buffer for VC */ - msg = (struct msg_get_turbo *)sc->dma_buf; - if (sizeof(*msg) > sc->dma_size) { - device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n", - sizeof(*msg), sc->dma_size); - return (MSG_ERROR); - } - /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_GET_TURBO; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.id = 0; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_GET_TURBO; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.id = 0; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't get turbo\n"); return (MSG_ERROR); } /* result 0=non-turbo, 1=turbo */ - level = (int)msg->body.resp.level; + level = (int)msg.body.resp.level; DPRINTF("level = %d\n", level); return (level); } @@ -520,7 +411,7 @@ bcm2835_cpufreq_get_turbo(struct bcm2835_cpufreq_softc static int bcm2835_cpufreq_set_turbo(struct bcm2835_cpufreq_softc *sc, uint32_t level) { - struct msg_set_turbo *msg; + struct msg_set_turbo msg; int value; int err; @@ -539,38 +430,30 @@ bcm2835_cpufreq_set_turbo(struct bcm2835_cpufreq_softc * u32: level */ - /* using DMA buffer for VC */ - msg = (struct msg_set_turbo *)sc->dma_buf; - if (sizeof(*msg) > sc->dma_size) { - device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n", - sizeof(*msg), sc->dma_size); - return (MSG_ERROR); - } - /* replace unknown value to OFF */ if (level != BCM2835_MBOX_TURBO_ON && level != BCM2835_MBOX_TURBO_OFF) level = BCM2835_MBOX_TURBO_OFF; /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_SET_TURBO; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.id = 0; - msg->body.req.level = level; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_SET_TURBO; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.id = 0; + msg.body.req.level = level; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't set turbo\n"); return (MSG_ERROR); } /* result 0=non-turbo, 1=turbo */ - value = (int)msg->body.resp.level; + value = (int)msg.body.resp.level; DPRINTF("level = %d\n", value); return (value); } @@ -579,7 +462,7 @@ static int bcm2835_cpufreq_get_voltage(struct bcm2835_cpufreq_softc *sc, uint32_t voltage_id) { - struct msg_get_voltage *msg; + struct msg_get_voltage msg; int value; int err; @@ -597,33 +480,25 @@ bcm2835_cpufreq_get_voltage(struct bcm2835_cpufreq_sof * u32: value (offset from 1.2V in units of 0.025V) */ - /* using DMA buffer for VC */ - msg = (struct msg_get_voltage *)sc->dma_buf; - if (sizeof(*msg) > sc->dma_size) { - device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n", - sizeof(*msg), sc->dma_size); - return (MSG_ERROR); - } - /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_GET_VOLTAGE; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.voltage_id = voltage_id; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_GET_VOLTAGE; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.voltage_id = voltage_id; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't get voltage\n"); return (MSG_ERROR); } /* result (offset from 1.2V) */ - value = (int)msg->body.resp.value; + value = (int)msg.body.resp.value; DPRINTF("value = %d\n", value); return (value); } @@ -632,7 +507,7 @@ static int bcm2835_cpufreq_get_max_voltage(struct bcm2835_cpufreq_softc *sc, uint32_t voltage_id) { - struct msg_get_max_voltage *msg; + struct msg_get_max_voltage msg; int value; int err; @@ -650,33 +525,25 @@ bcm2835_cpufreq_get_max_voltage(struct bcm2835_cpufreq * u32: value (offset from 1.2V in units of 0.025V) */ - /* using DMA buffer for VC */ - msg = (struct msg_get_max_voltage *)sc->dma_buf; - if (sizeof(*msg) > sc->dma_size) { - device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n", - sizeof(*msg), sc->dma_size); - return (MSG_ERROR); - } - /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_GET_MAX_VOLTAGE; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.voltage_id = voltage_id; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_GET_MAX_VOLTAGE; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.voltage_id = voltage_id; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't get max voltage\n"); return (MSG_ERROR); } /* result (offset from 1.2V) */ - value = (int)msg->body.resp.value; + value = (int)msg.body.resp.value; DPRINTF("value = %d\n", value); return (value); } @@ -684,7 +551,7 @@ static int bcm2835_cpufreq_get_min_voltage(struct bcm2835_cpufreq_softc *sc, uint32_t voltage_id) { - struct msg_get_min_voltage *msg; + struct msg_get_min_voltage msg; int value; int err; @@ -702,33 +569,25 @@ bcm2835_cpufreq_get_min_voltage(struct bcm2835_cpufreq * u32: value (offset from 1.2V in units of 0.025V) */ - /* using DMA buffer for VC */ - msg = (struct msg_get_min_voltage *)sc->dma_buf; - if (sizeof(*msg) > sc->dma_size) { - device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n", - sizeof(*msg), sc->dma_size); - return (MSG_ERROR); - } - /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_GET_MIN_VOLTAGE; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.voltage_id = voltage_id; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_GET_MIN_VOLTAGE; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.voltage_id = voltage_id; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't get min voltage\n"); return (MSG_ERROR); } /* result (offset from 1.2V) */ - value = (int)msg->body.resp.value; + value = (int)msg.body.resp.value; DPRINTF("value = %d\n", value); return (value); } @@ -737,7 +596,7 @@ static int bcm2835_cpufreq_set_voltage(struct bcm2835_cpufreq_softc *sc, uint32_t voltage_id, int32_t value) { - struct msg_set_voltage *msg; + struct msg_set_voltage msg; int err; /* @@ -766,34 +625,26 @@ bcm2835_cpufreq_set_voltage(struct bcm2835_cpufreq_sof return (MSG_ERROR); } - /* using DMA buffer for VC */ - msg = (struct msg_set_voltage *)sc->dma_buf; - if (sizeof(*msg) > sc->dma_size) { - device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n", - sizeof(*msg), sc->dma_size); - return (MSG_ERROR); - } - /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_SET_VOLTAGE; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.voltage_id = voltage_id; - msg->body.req.value = (uint32_t)value; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_SET_VOLTAGE; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.voltage_id = voltage_id; + msg.body.req.value = (uint32_t)value; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't set voltage\n"); return (MSG_ERROR); } /* result (offset from 1.2V) */ - value = (int)msg->body.resp.value; + value = (int)msg.body.resp.value; DPRINTF("value = %d\n", value); return (value); } @@ -801,7 +652,7 @@ bcm2835_cpufreq_set_voltage(struct bcm2835_cpufreq_sof static int bcm2835_cpufreq_get_temperature(struct bcm2835_cpufreq_softc *sc) { - struct msg_get_temperature *msg; + struct msg_get_temperature msg; int value; int err; @@ -819,33 +670,25 @@ bcm2835_cpufreq_get_temperature(struct bcm2835_cpufreq * u32: value */ - /* using DMA buffer for VC */ - msg = (struct msg_get_temperature *)sc->dma_buf; - if (sizeof(*msg) > sc->dma_size) { - device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n", - sizeof(*msg), sc->dma_size); - return (MSG_ERROR); - } - /* setup single tag buffer */ - memset(msg, 0, sizeof(*msg)); - msg->hdr.buf_size = sizeof(*msg); - msg->hdr.code = BCM2835_MBOX_CODE_REQ; - msg->tag_hdr.tag = BCM2835_MBOX_TAG_GET_TEMPERATURE; - msg->tag_hdr.val_buf_size = sizeof(msg->body); - msg->tag_hdr.val_len = sizeof(msg->body.req); - msg->body.req.temperature_id = 0; - msg->end_tag = 0; + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_GET_TEMPERATURE; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body.req); + msg.body.req.temperature_id = 0; + msg.end_tag = 0; /* call mailbox property */ - err = bcm2835_mbox_call_prop(sc); + err = bcm2835_mbox_property(&msg, sizeof(msg)); if (err) { device_printf(sc->dev, "can't get temperature\n"); return (MSG_ERROR); } /* result (temperature of degree C) */ - value = (int)msg->body.resp.value; + value = (int)msg.body.resp.value; DPRINTF("value = %d\n", value); return (value); } @@ -1406,7 +1249,17 @@ bcm2835_cpufreq_init(void *arg) static void bcm2835_cpufreq_identify(driver_t *driver, device_t parent) { + const struct ofw_compat_data *compat; + phandle_t root; + root = OF_finddevice("/"); + for (compat = compat_data; compat->ocd_str != NULL; compat++) + if (fdt_is_compatible(root, compat->ocd_str)) + break; + + if (compat->ocd_data == 0) + return; + DPRINTF("driver=%p, parent=%p\n", driver, parent); if (device_find_child(parent, "bcm2835_cpufreq", -1) != NULL) return; @@ -1422,23 +1275,11 @@ bcm2835_cpufreq_probe(device_t dev) return (0); } -static void -bcm2835_cpufreq_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err) -{ - bus_addr_t *addr; - - if (err) - return; - addr = (bus_addr_t *)arg; - *addr = PHYS_TO_VCBUS(segs[0].ds_addr); -} - static int bcm2835_cpufreq_attach(device_t dev) { struct bcm2835_cpufreq_softc *sc; struct sysctl_oid *oid; - int err; /* set self dev */ sc = device_get_softc(dev); @@ -1454,41 +1295,6 @@ bcm2835_cpufreq_attach(device_t dev) sc->max_voltage_core = 0; sc->min_voltage_core = 0; - /* create VC mbox buffer */ - sc->dma_size = PAGE_SIZE; - err = bus_dma_tag_create( - bus_get_dma_tag(sc->dev), - PAGE_SIZE, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - sc->dma_size, 1, /* maxsize, nsegments */ - sc->dma_size, 0, /* maxsegsize, flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->dma_tag); - if (err) { - device_printf(dev, "can't create DMA tag\n"); - return (ENXIO); - } - - err = bus_dmamem_alloc(sc->dma_tag, (void **)&sc->dma_buf, 0, - &sc->dma_map); - if (err) { - bus_dma_tag_destroy(sc->dma_tag); - device_printf(dev, "can't allocate dmamem\n"); - return (ENXIO); - } - - err = bus_dmamap_load(sc->dma_tag, sc->dma_map, sc->dma_buf, - sc->dma_size, bcm2835_cpufreq_cb, &sc->dma_phys, 0); - if (err) { - bus_dmamem_free(sc->dma_tag, sc->dma_buf, sc->dma_map); - bus_dma_tag_destroy(sc->dma_tag); - device_printf(dev, "can't load DMA map\n"); - return (ENXIO); - } - /* OK, ready to use VC buffer */ - /* setup sysctl at first device */ if (device_get_unit(dev) == 0) { sysctl_ctx_init(&bcm2835_sysctl_ctx); @@ -1558,9 +1364,6 @@ bcm2835_cpufreq_attach(device_t dev) sc->init_hook.ich_arg = sc; if (config_intrhook_establish(&sc->init_hook) != 0) { - bus_dmamap_unload(sc->dma_tag, sc->dma_map); - bus_dmamem_free(sc->dma_tag, sc->dma_buf, sc->dma_map); - bus_dma_tag_destroy(sc->dma_tag); device_printf(dev, "config_intrhook_establish failed\n"); return (ENOMEM); } @@ -1579,13 +1382,6 @@ bcm2835_cpufreq_detach(device_t dev) sc = device_get_softc(dev); sema_destroy(&vc_sema); - - if (sc->dma_phys != 0) - bus_dmamap_unload(sc->dma_tag, sc->dma_map); - if (sc->dma_buf != NULL) - bus_dmamem_free(sc->dma_tag, sc->dma_buf, sc->dma_map); - if (sc->dma_tag != NULL) - bus_dma_tag_destroy(sc->dma_tag); return (cpufreq_unregister(dev)); } Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_dma.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_dma.c Sun Aug 20 11:18:16 2017 (r322723) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_dma.c Sun Aug 20 16:52:27 2017 (r322724) @@ -104,6 +104,15 @@ __FBSDID("$FreeBSD$"); /* relative offset from BCM_VC_DMA0_BASE (p.39) */ #define BCM_DMA_CH(n) (0x100*(n)) +/* channels used by GPU */ +#define BCM_DMA_CH_BULK 0 +#define BCM_DMA_CH_FAST1 2 +#define BCM_DMA_CH_FAST2 3 + +#define BCM_DMA_CH_GPU_MASK ((1 << BCM_DMA_CH_BULK) | \ + (1 << BCM_DMA_CH_FAST1) | \ + (1 << BCM_DMA_CH_FAST2)) + /* DMA Control Block - 256bit aligned (p.40) */ struct bcm_dma_cb { uint32_t info; /* Transfer Information */ @@ -143,7 +152,14 @@ struct bcm_dma_softc { }; static struct bcm_dma_softc *bcm_dma_sc = NULL; +static uint32_t bcm_dma_channel_mask; +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-dma", 1}, + {"brcm,bcm2835-dma", 1}, + {NULL, 0} +}; + static void bcm_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err) @@ -205,16 +221,32 @@ static int bcm_dma_init(device_t dev) { struct bcm_dma_softc *sc = device_get_softc(dev); - uint32_t mask; + uint32_t reg; struct bcm_dma_ch *ch; void *cb_virt; vm_paddr_t cb_phys; int err; int i; - /* disable and clear interrupt status */ - bus_write_4(sc->sc_mem, BCM_DMA_ENABLE, 0); - bus_write_4(sc->sc_mem, BCM_DMA_INT_STATUS, 0); + /* + * Only channels set in bcm_dma_channel_mask can be controlled by us. + * The others are out of our control as well as the corresponding bits + * in both BCM_DMA_ENABLE and BCM_DMA_INT_STATUS global registers. As + * these registers are RW ones, there is no safe way how to write only + * the bits which can be controlled by us. + * + * Fortunately, after reset, all channels are enabled in BCM_DMA_ENABLE + * register and all statuses are cleared in BCM_DMA_INT_STATUS one. + * Not touching these registers is a trade off between correct + * initialization which does not count on anything and not messing up + * something we have no control over. + */ + reg = bus_read_4(sc->sc_mem, BCM_DMA_ENABLE); + if ((reg & bcm_dma_channel_mask) != bcm_dma_channel_mask) + device_printf(dev, "channels are not enabled\n"); + reg = bus_read_4(sc->sc_mem, BCM_DMA_INT_STATUS); + if ((reg & bcm_dma_channel_mask) != 0) + device_printf(dev, "statuses are not cleared\n"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Aug 20 19:21:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3ACD2DE7B94; Sun, 20 Aug 2017 19:21:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09A9A6FD2C; Sun, 20 Aug 2017 19:21:06 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KJL64b072149; Sun, 20 Aug 2017 19:21:06 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KJL6XI072148; Sun, 20 Aug 2017 19:21:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708201921.v7KJL6XI072148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 20 Aug 2017 19:21:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322725 - stable/10/sys/mips/atheros X-SVN-Group: stable-10 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/10/sys/mips/atheros X-SVN-Commit-Revision: 322725 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 19:21:07 -0000 Author: delphij Date: Sun Aug 20 19:21:06 2017 New Revision: 322725 URL: https://svnweb.freebsd.org/changeset/base/322725 Log: MFC r322527: Plug memory leak in arge_encap(). Reported by: Ilja Van Sprundel Submitted by: Domagoj Stolfa Reviewed by: adrian Approved by: re (kib) Modified: stable/10/sys/mips/atheros/if_arge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/mips/atheros/if_arge.c ============================================================================== --- stable/10/sys/mips/atheros/if_arge.c Sun Aug 20 16:52:27 2017 (r322724) +++ stable/10/sys/mips/atheros/if_arge.c Sun Aug 20 19:21:06 2017 (r322725) @@ -1111,6 +1111,7 @@ arge_encap(struct arge_softc *sc, struct mbuf **m_head sc->stats.tx_pkts_unaligned++; m = m_defrag(*m_head, M_NOWAIT); if (m == NULL) { + m_freem(*m_head); *m_head = NULL; return (ENOBUFS); } From owner-svn-src-all@freebsd.org Sun Aug 20 20:38:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC4C8DEC29F; Sun, 20 Aug 2017 20:38:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98E227233A; Sun, 20 Aug 2017 20:38:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KKcF5G003817; Sun, 20 Aug 2017 20:38:15 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KKcF9d003816; Sun, 20 Aug 2017 20:38:15 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708202038.v7KKcF9d003816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 20 Aug 2017 20:38:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322726 - head/etc/periodic/daily X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/etc/periodic/daily X-SVN-Commit-Revision: 322726 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 20:38:16 -0000 Author: marius Date: Sun Aug 20 20:38:15 2017 New Revision: 322726 URL: https://svnweb.freebsd.org/changeset/base/322726 Log: Bring back the much more readable unified format for differences in /etc/{group,master.passwd}. This was originally turned on for all of /etc/{aliases,group,master.passwd} in r55196, but then backed out only for the latter two in r56697, as the adaption of the sed(1)ing done in r56308 was incorrect. This left us with inconsistent diff(1) formats in the daily output of periodic(8) ever since, despite in r56697 having been promised to be revisited. So properly adapt the password hash filtering to the unified format and turn the later on again for /etc/{group,master.passwd}, too. Modified: head/etc/periodic/daily/200.backup-passwd Modified: head/etc/periodic/daily/200.backup-passwd ============================================================================== --- head/etc/periodic/daily/200.backup-passwd Sun Aug 20 19:21:06 2017 (r322725) +++ head/etc/periodic/daily/200.backup-passwd Sun Aug 20 20:38:15 2017 (r322726) @@ -41,8 +41,8 @@ case "$daily_backup_passwd_enable" in then [ $rc -lt 1 ] && rc=1 echo "$host passwd diffs:" - diff -I '^#' $bak/master.passwd.bak /etc/master.passwd |\ - sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/' + diff -uI '^#' $bak/master.passwd.bak /etc/master.passwd |\ + sed 's/^\([-+][^-+:]*\):[^:]*:/\1:(password):/' mv $bak/master.passwd.bak $bak/master.passwd.bak2 cp -p /etc/master.passwd $bak/master.passwd.bak || rc=3 fi @@ -58,7 +58,7 @@ case "$daily_backup_passwd_enable" in then [ $rc -lt 1 ] && rc=1 echo "$host group diffs:" - diff $bak/group.bak /etc/group + diff -u $bak/group.bak /etc/group mv $bak/group.bak $bak/group.bak2 cp -p /etc/group $bak/group.bak || rc=3 fi From owner-svn-src-all@freebsd.org Sun Aug 20 21:02:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD596DC88A6; Sun, 20 Aug 2017 21:02:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3CE1E72EEB; Sun, 20 Aug 2017 21:02:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KL2lN8015350; Sun, 20 Aug 2017 21:02:47 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KL2ia0015324; Sun, 20 Aug 2017 21:02:44 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708202102.v7KL2ia0015324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 20 Aug 2017 21:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322727 - in vendor/llvm/dist: . docs include/llvm/CodeGen include/llvm/ExecutionEngine/Orc include/llvm/Object lib/Analysis lib/CodeGen lib/CodeGen/SelectionDAG lib/DebugInfo/DWARF lib... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm/dist: . docs include/llvm/CodeGen include/llvm/ExecutionEngine/Orc include/llvm/Object lib/Analysis lib/CodeGen lib/CodeGen/SelectionDAG lib/DebugInfo/DWARF lib/Object lib/Target/AArch6... X-SVN-Commit-Revision: 322727 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 21:02:48 -0000 Author: dim Date: Sun Aug 20 21:02:43 2017 New Revision: 322727 URL: https://svnweb.freebsd.org/changeset/base/322727 Log: Vendor import of llvm release_50 branch r311219: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311219 Added: vendor/llvm/dist/test/Analysis/ScalarEvolution/max-addrec-size.ll vendor/llvm/dist/test/CodeGen/AArch64/arm64-ldst-unscaled-pre-post.mir vendor/llvm/dist/test/CodeGen/ARM/virtregrewriter-subregliveness.mir vendor/llvm/dist/test/CodeGen/X86/pr33349.ll vendor/llvm/dist/test/CodeGen/X86/pr34088.ll vendor/llvm/dist/test/CodeGen/X86/select-mmx.ll vendor/llvm/dist/test/Instrumentation/DataFlowSanitizer/Inputs/shadow-args-abilist.txt (contents, props changed) vendor/llvm/dist/test/Instrumentation/DataFlowSanitizer/shadow-args-zext.ll vendor/llvm/dist/test/Transforms/BDCE/invalidate-assumptions.ll vendor/llvm/dist/test/Transforms/SimplifyCFG/pr34131.ll vendor/llvm/dist/utils/lit/tests/Inputs/max-failures/ vendor/llvm/dist/utils/lit/tests/Inputs/max-failures/lit.cfg Modified: vendor/llvm/dist/CMakeLists.txt vendor/llvm/dist/docs/LangRef.rst vendor/llvm/dist/docs/ReleaseNotes.rst vendor/llvm/dist/include/llvm/CodeGen/SelectionDAG.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h vendor/llvm/dist/include/llvm/Object/COFFImportFile.h vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp vendor/llvm/dist/lib/Analysis/ValueTracking.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAG.cpp vendor/llvm/dist/lib/CodeGen/VirtRegMap.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFContext.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFVerifier.cpp vendor/llvm/dist/lib/Object/COFFImportFile.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp vendor/llvm/dist/lib/Target/ARM/ARMExpandPseudoInsts.cpp vendor/llvm/dist/lib/Target/ARM/ARMInstrInfo.td vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td vendor/llvm/dist/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp vendor/llvm/dist/lib/Transforms/Scalar/BDCE.cpp vendor/llvm/dist/test/CodeGen/ARM/cmpxchg-O0.ll vendor/llvm/dist/test/CodeGen/X86/adx-intrinsics.ll vendor/llvm/dist/test/CodeGen/X86/avx512bw-intrinsics.ll vendor/llvm/dist/test/CodeGen/X86/avx512bwvl-intrinsics.ll vendor/llvm/dist/test/CodeGen/X86/vector-shuffle-128-v16.ll vendor/llvm/dist/test/CodeGen/X86/vector-shuffle-128-v8.ll vendor/llvm/dist/test/CodeGen/X86/vector-shuffle-256-v16.ll vendor/llvm/dist/test/CodeGen/X86/vector-shuffle-256-v32.ll vendor/llvm/dist/test/CodeGen/X86/vector-shuffle-512-v32.ll vendor/llvm/dist/test/CodeGen/X86/vector-shuffle-512-v64.ll vendor/llvm/dist/test/Instrumentation/DataFlowSanitizer/abilist.ll vendor/llvm/dist/test/Transforms/IndVarSimplify/exit_value_test2.ll vendor/llvm/dist/tools/llvm-objdump/llvm-objdump.cpp vendor/llvm/dist/utils/lit/lit/LitConfig.py vendor/llvm/dist/utils/lit/lit/TestRunner.py vendor/llvm/dist/utils/lit/lit/formats/__init__.py vendor/llvm/dist/utils/lit/lit/formats/base.py vendor/llvm/dist/utils/lit/lit/formats/shtest.py vendor/llvm/dist/utils/lit/lit/run.py vendor/llvm/dist/utils/lit/tests/max-failures.py vendor/llvm/dist/utils/lit/tests/selecting.py vendor/llvm/dist/utils/release/test-release.sh Modified: vendor/llvm/dist/CMakeLists.txt ============================================================================== --- vendor/llvm/dist/CMakeLists.txt Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/CMakeLists.txt Sun Aug 20 21:02:43 2017 (r322727) @@ -314,6 +314,7 @@ set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) set(LLVM_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include) +# List of all targets to be built by default: set(LLVM_ALL_TARGETS AArch64 AMDGPU @@ -325,7 +326,6 @@ set(LLVM_ALL_TARGETS MSP430 NVPTX PowerPC - RISCV Sparc SystemZ X86 Modified: vendor/llvm/dist/docs/LangRef.rst ============================================================================== --- vendor/llvm/dist/docs/LangRef.rst Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/docs/LangRef.rst Sun Aug 20 21:02:43 2017 (r322727) @@ -5369,6 +5369,10 @@ The following behaviors are supported: nodes. However, duplicate entries in the second list are dropped during the append operation. + * - 7 + - **Max** + Takes the max of the two values, which are required to be integers. + It is an error for a particular unique flag ID to have multiple behaviors, except in the case of **Require** (which adds restrictions on another metadata value) or **Override**. Modified: vendor/llvm/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/llvm/dist/docs/ReleaseNotes.rst Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/docs/ReleaseNotes.rst Sun Aug 20 21:02:43 2017 (r322727) @@ -117,6 +117,18 @@ Changes to the X86 Target * Added support for AMD Lightweight Profiling (LWP) instructions. +* Avoid using slow LEA instructions. + +* Use alternative sequences for multiply by constant. + +* Improved lowering of strided shuffles. + +* Improved the AVX512 cost model used by the vectorizer. + +* Fix scalar code performance when AVX512 is enabled by making i1's illegal. + +* Fixed many inline assembly bugs. + Changes to the AMDGPU Target ----------------------------- @@ -160,7 +172,29 @@ Changes to the C API External Open Source Projects Using LLVM 5 ========================================== -* A project... +Zig Programming Language +------------------------ + +`Zig `_ is an open-source programming language designed +for robustness, optimality, and clarity. It integrates closely with C and is +intended to eventually take the place of C. It uses LLVM to produce highly +optimized native code and to cross-compile for any target out of the box. Zig +is in alpha; with a beta release expected in September. + +LDC - the LLVM-based D compiler +------------------------------- + +`D `_ is a language with C-like syntax and static typing. It +pragmatically combines efficiency, control, and modeling power, with safety and +programmer productivity. D supports powerful concepts like Compile-Time Function +Execution (CTFE) and Template Meta-Programming, provides an innovative approach +to concurrency and offers many classical paradigms. + +`LDC `_ uses the frontend from the reference compiler +combined with LLVM as backend to produce efficient native code. LDC targets +x86/x86_64 systems like Linux, OS X, FreeBSD and Windows and also Linux on ARM +and PowerPC (32/64 bit). Ports to other architectures like AArch64 and MIPS64 +are underway. Additional Information Modified: vendor/llvm/dist/include/llvm/CodeGen/SelectionDAG.h ============================================================================== --- vendor/llvm/dist/include/llvm/CodeGen/SelectionDAG.h Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/include/llvm/CodeGen/SelectionDAG.h Sun Aug 20 21:02:43 2017 (r322727) @@ -1220,8 +1220,9 @@ class SelectionDAG { (public) /// If an existing load has uses of its chain, create a token factor node with /// that chain and the new memory node's chain and update users of the old /// chain to the token factor. This ensures that the new memory node will have - /// the same relative memory dependency position as the old load. - void makeEquivalentMemoryOrdering(LoadSDNode *Old, SDValue New); + /// the same relative memory dependency position as the old load. Returns the + /// new merged load chain. + SDValue makeEquivalentMemoryOrdering(LoadSDNode *Old, SDValue New); /// Topological-sort the AllNodes list and a /// assign a unique node id for each node in the DAG based on their Modified: vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h ============================================================================== --- vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h Sun Aug 20 21:02:43 2017 (r322727) @@ -94,9 +94,9 @@ template class LazyEmittingLayer llvm_unreachable("Invalid emit-state."); } - void removeModuleFromBaseLayer(BaseLayerT &BaseLayer) { - if (EmitState != NotEmitted) - BaseLayer.removeModule(Handle); + Error removeModuleFromBaseLayer(BaseLayerT& BaseLayer) { + return EmitState != NotEmitted ? BaseLayer.removeModule(Handle) + : Error::success(); } void emitAndFinalize(BaseLayerT &BaseLayer) { @@ -226,9 +226,9 @@ template class LazyEmittingLayer /// This method will free the memory associated with the given module, both /// in this layer, and the base layer. Error removeModule(ModuleHandleT H) { - (*H)->removeModuleFromBaseLayer(BaseLayer); + Error Err = (*H)->removeModuleFromBaseLayer(BaseLayer); ModuleList.erase(H); - return Error::success(); + return Err; } /// @brief Search for the given named symbol. Modified: vendor/llvm/dist/include/llvm/Object/COFFImportFile.h ============================================================================== --- vendor/llvm/dist/include/llvm/Object/COFFImportFile.h Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/include/llvm/Object/COFFImportFile.h Sun Aug 20 21:02:43 2017 (r322727) @@ -73,6 +73,7 @@ class COFFImportFile : public SymbolicFile { (private) struct COFFShortExport { std::string Name; std::string ExtName; + std::string SymbolName; uint16_t Ordinal = 0; bool Noname = false; @@ -98,7 +99,8 @@ struct COFFShortExport { std::error_code writeImportLibrary(StringRef ImportName, StringRef Path, ArrayRef Exports, - COFF::MachineTypes Machine); + COFF::MachineTypes Machine, + bool MakeWeakAliases); } // namespace object } // namespace llvm Modified: vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp ============================================================================== --- vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -162,6 +162,11 @@ static cl::opt cl::desc("Maximum depth of recursive SExt/ZExt"), cl::init(8)); +static cl::opt + MaxAddRecSize("scalar-evolution-max-add-rec-size", cl::Hidden, + cl::desc("Max coefficients in AddRec during evolving"), + cl::init(16)); + //===----------------------------------------------------------------------===// // SCEV class definitions //===----------------------------------------------------------------------===// @@ -2878,6 +2883,12 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImp if (!OtherAddRec || OtherAddRec->getLoop() != AddRecLoop) continue; + // Limit max number of arguments to avoid creation of unreasonably big + // SCEVAddRecs with very complex operands. + if (AddRec->getNumOperands() + OtherAddRec->getNumOperands() - 1 > + MaxAddRecSize) + continue; + bool Overflow = false; Type *Ty = AddRec->getType(); bool LargerThan64Bits = getTypeSizeInBits(Ty) > 64; @@ -7582,6 +7593,25 @@ const SCEV *ScalarEvolution::computeSCEVAtScope(const const SCEV *BackedgeTakenCount = getBackedgeTakenCount(LI); if (const SCEVConstant *BTCC = dyn_cast(BackedgeTakenCount)) { + + // This trivial case can show up in some degenerate cases where + // the incoming IR has not yet been fully simplified. + if (BTCC->getValue()->isZero()) { + Value *InitValue = nullptr; + bool MultipleInitValues = false; + for (unsigned i = 0; i < PN->getNumIncomingValues(); i++) { + if (!LI->contains(PN->getIncomingBlock(i))) { + if (!InitValue) + InitValue = PN->getIncomingValue(i); + else if (InitValue != PN->getIncomingValue(i)) { + MultipleInitValues = true; + break; + } + } + if (!MultipleInitValues && InitValue) + return getSCEV(InitValue); + } + } // Okay, we know how many times the containing loop executes. If // this is a constant evolving PHI node, get the final value at // the specified iteration number. Modified: vendor/llvm/dist/lib/Analysis/ValueTracking.cpp ============================================================================== --- vendor/llvm/dist/lib/Analysis/ValueTracking.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/Analysis/ValueTracking.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -4458,6 +4458,10 @@ Optional llvm::isImpliedCondition(const Value *L unsigned Depth, AssumptionCache *AC, const Instruction *CxtI, const DominatorTree *DT) { + // Bail out when we hit the limit. + if (Depth == MaxDepth) + return None; + // A mismatch occurs when we compare a scalar cmp to a vector cmp, for example. if (LHS->getType() != RHS->getType()) return None; Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -302,7 +302,21 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_SCALAR_TO_VE } SDValue DAGTypeLegalizer::ScalarizeVecRes_VSELECT(SDNode *N) { - SDValue Cond = GetScalarizedVector(N->getOperand(0)); + SDValue Cond = N->getOperand(0); + EVT OpVT = Cond.getValueType(); + SDLoc DL(N); + // The vselect result and true/value operands needs scalarizing, but it's + // not a given that the Cond does. For instance, in AVX512 v1i1 is legal. + // See the similar logic in ScalarizeVecRes_VSETCC + if (getTypeAction(OpVT) == TargetLowering::TypeScalarizeVector) { + Cond = GetScalarizedVector(Cond); + } else { + EVT VT = OpVT.getVectorElementType(); + Cond = DAG.getNode( + ISD::EXTRACT_VECTOR_ELT, DL, VT, Cond, + DAG.getConstant(0, DL, TLI.getVectorIdxTy(DAG.getDataLayout()))); + } + SDValue LHS = GetScalarizedVector(N->getOperand(1)); TargetLowering::BooleanContent ScalarBool = TLI.getBooleanContents(false, false); Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAG.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -7262,22 +7262,23 @@ void SelectionDAG::TransferDbgValues(SDValue From, SDV AddDbgValue(I, ToNode, false); } -void SelectionDAG::makeEquivalentMemoryOrdering(LoadSDNode *OldLoad, - SDValue NewMemOp) { +SDValue SelectionDAG::makeEquivalentMemoryOrdering(LoadSDNode *OldLoad, + SDValue NewMemOp) { assert(isa(NewMemOp.getNode()) && "Expected a memop node"); - if (!OldLoad->hasAnyUseOfValue(1)) - return; - // The new memory operation must have the same position as the old load in // terms of memory dependency. Create a TokenFactor for the old load and new // memory operation and update uses of the old load's output chain to use that // TokenFactor. SDValue OldChain = SDValue(OldLoad, 1); SDValue NewChain = SDValue(NewMemOp.getNode(), 1); + if (!OldLoad->hasAnyUseOfValue(1)) + return NewChain; + SDValue TokenFactor = getNode(ISD::TokenFactor, SDLoc(OldLoad), MVT::Other, OldChain, NewChain); ReplaceAllUsesOfValueWith(OldChain, TokenFactor); UpdateNodeOperands(TokenFactor.getNode(), OldChain, NewChain); + return TokenFactor; } //===----------------------------------------------------------------------===// Modified: vendor/llvm/dist/lib/CodeGen/VirtRegMap.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/VirtRegMap.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/CodeGen/VirtRegMap.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -180,6 +180,7 @@ class VirtRegRewriter : public MachineFunctionPass { void addLiveInsForSubRanges(const LiveInterval &LI, unsigned PhysReg) const; void handleIdentityCopy(MachineInstr &MI) const; void expandCopyBundle(MachineInstr &MI) const; + bool subRegLiveThrough(const MachineInstr &MI, unsigned SuperPhysReg) const; public: static char ID; @@ -415,6 +416,32 @@ void VirtRegRewriter::expandCopyBundle(MachineInstr &M } } +/// Check whether (part of) \p SuperPhysReg is live through \p MI. +/// \pre \p MI defines a subregister of a virtual register that +/// has been assigned to \p SuperPhysReg. +bool VirtRegRewriter::subRegLiveThrough(const MachineInstr &MI, + unsigned SuperPhysReg) const { + SlotIndex MIIndex = LIS->getInstructionIndex(MI); + SlotIndex BeforeMIUses = MIIndex.getBaseIndex(); + SlotIndex AfterMIDefs = MIIndex.getBoundaryIndex(); + for (MCRegUnitIterator Unit(SuperPhysReg, TRI); Unit.isValid(); ++Unit) { + const LiveRange &UnitRange = LIS->getRegUnit(*Unit); + // If the regunit is live both before and after MI, + // we assume it is live through. + // Generally speaking, this is not true, because something like + // "RU = op RU" would match that description. + // However, we know that we are trying to assess whether + // a def of a virtual reg, vreg, is live at the same time of RU. + // If we are in the "RU = op RU" situation, that means that vreg + // is defined at the same time as RU (i.e., "vreg, RU = op RU"). + // Thus, vreg and RU interferes and vreg cannot be assigned to + // SuperPhysReg. Therefore, this situation cannot happen. + if (UnitRange.liveAt(AfterMIDefs) && UnitRange.liveAt(BeforeMIUses)) + return true; + } + return false; +} + void VirtRegRewriter::rewrite() { bool NoSubRegLiveness = !MRI->subRegLivenessEnabled(); SmallVector SuperDeads; @@ -452,7 +479,8 @@ void VirtRegRewriter::rewrite() { // A virtual register kill refers to the whole register, so we may // have to add operands for the super-register. A // partial redef always kills and redefines the super-register. - if (MO.readsReg() && (MO.isDef() || MO.isKill())) + if ((MO.readsReg() && (MO.isDef() || MO.isKill())) || + (MO.isDef() && subRegLiveThrough(*MI, PhysReg))) SuperKills.push_back(PhysReg); if (MO.isDef()) { Modified: vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFContext.cpp ============================================================================== --- vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFContext.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFContext.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -134,13 +134,13 @@ dumpDWARFv5StringOffsetsSection(raw_ostream &OS, Strin uint64_t StringOffset = StrOffsetExt.getRelocatedValue(EntrySize, &Offset); if (Format == DWARF32) { - OS << format("%8.8x ", StringOffset); uint32_t StringOffset32 = (uint32_t)StringOffset; + OS << format("%8.8x ", StringOffset32); const char *S = StrData.getCStr(&StringOffset32); if (S) OS << format("\"%s\"", S); } else - OS << format("%16.16x ", StringOffset); + OS << format("%16.16" PRIx64 " ", StringOffset); OS << "\n"; } } Modified: vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFVerifier.cpp ============================================================================== --- vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFVerifier.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFVerifier.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -196,7 +196,7 @@ unsigned DWARFVerifier::verifyDebugInfoAttribute(const ++NumErrors; OS << "error: DW_AT_stmt_list offset is beyond .debug_line " "bounds: " - << format("0x%08" PRIx32, *SectionOffset) << "\n"; + << format("0x%08" PRIx64, *SectionOffset) << "\n"; Die.dump(OS, 0); OS << "\n"; } @@ -234,7 +234,7 @@ unsigned DWARFVerifier::verifyDebugInfoForm(const DWAR if (CUOffset >= CUSize) { ++NumErrors; OS << "error: " << FormEncodingString(Form) << " CU offset " - << format("0x%08" PRIx32, CUOffset) + << format("0x%08" PRIx64, CUOffset) << " is invalid (must be less than CU size of " << format("0x%08" PRIx32, CUSize) << "):\n"; Die.dump(OS, 0); @@ -366,7 +366,7 @@ void DWARFVerifier::verifyDebugLineRows() { if (Row.Address < PrevAddress) { ++NumDebugLineErrors; OS << "error: .debug_line[" - << format("0x%08" PRIx32, + << format("0x%08" PRIx64, *toSectionOffset(Die.find(DW_AT_stmt_list))) << "] row[" << RowIndex << "] decreases in address from previous row:\n"; @@ -381,7 +381,7 @@ void DWARFVerifier::verifyDebugLineRows() { if (Row.File > MaxFileIndex) { ++NumDebugLineErrors; OS << "error: .debug_line[" - << format("0x%08" PRIx32, + << format("0x%08" PRIx64, *toSectionOffset(Die.find(DW_AT_stmt_list))) << "][" << RowIndex << "] has invalid file index " << Row.File << " (valid values are [1," << MaxFileIndex << "]):\n"; Modified: vendor/llvm/dist/lib/Object/COFFImportFile.cpp ============================================================================== --- vendor/llvm/dist/lib/Object/COFFImportFile.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/Object/COFFImportFile.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -557,7 +557,7 @@ NewArchiveMember ObjectFactory::createWeakExternal(Str std::error_code writeImportLibrary(StringRef ImportName, StringRef Path, ArrayRef Exports, - MachineTypes Machine) { + MachineTypes Machine, bool MakeWeakAliases) { std::vector Members; ObjectFactory OF(llvm::sys::path::filename(ImportName), Machine); @@ -575,7 +575,7 @@ std::error_code writeImportLibrary(StringRef ImportNam if (E.Private) continue; - if (E.isWeak()) { + if (E.isWeak() && MakeWeakAliases) { Members.push_back(OF.createWeakExternal(E.Name, E.ExtName, false)); Members.push_back(OF.createWeakExternal(E.Name, E.ExtName, true)); continue; @@ -587,7 +587,7 @@ std::error_code writeImportLibrary(StringRef ImportNam if (E.Constant) ImportType = IMPORT_CONST; - StringRef SymbolName = E.isWeak() ? E.ExtName : E.Name; + StringRef SymbolName = E.SymbolName.empty() ? E.Name : E.SymbolName; ImportNameType NameType = getNameType(SymbolName, E.Name, Machine); Expected Name = E.ExtName.empty() ? SymbolName Modified: vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -388,6 +388,10 @@ static unsigned isMatchingStore(MachineInstr &LoadInst } static unsigned getPreIndexedOpcode(unsigned Opc) { + // FIXME: We don't currently support creating pre-indexed loads/stores when + // the load or store is the unscaled version. If we decide to perform such an + // optimization in the future the cases for the unscaled loads/stores will + // need to be added here. switch (Opc) { default: llvm_unreachable("Opcode has no pre-indexed equivalent!"); @@ -451,32 +455,42 @@ static unsigned getPostIndexedOpcode(unsigned Opc) { default: llvm_unreachable("Opcode has no post-indexed wise equivalent!"); case AArch64::STRSui: + case AArch64::STURSi: return AArch64::STRSpost; case AArch64::STRDui: + case AArch64::STURDi: return AArch64::STRDpost; case AArch64::STRQui: + case AArch64::STURQi: return AArch64::STRQpost; case AArch64::STRBBui: return AArch64::STRBBpost; case AArch64::STRHHui: return AArch64::STRHHpost; case AArch64::STRWui: + case AArch64::STURWi: return AArch64::STRWpost; case AArch64::STRXui: + case AArch64::STURXi: return AArch64::STRXpost; case AArch64::LDRSui: + case AArch64::LDURSi: return AArch64::LDRSpost; case AArch64::LDRDui: + case AArch64::LDURDi: return AArch64::LDRDpost; case AArch64::LDRQui: + case AArch64::LDURQi: return AArch64::LDRQpost; case AArch64::LDRBBui: return AArch64::LDRBBpost; case AArch64::LDRHHui: return AArch64::LDRHHpost; case AArch64::LDRWui: + case AArch64::LDURWi: return AArch64::LDRWpost; case AArch64::LDRXui: + case AArch64::LDURXi: return AArch64::LDRXpost; case AArch64::LDRSWui: return AArch64::LDRSWpost; @@ -1694,8 +1708,9 @@ bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBl ++NumPostFolded; break; } - // Don't know how to handle pre/post-index versions, so move to the next - // instruction. + + // Don't know how to handle unscaled pre/post-index versions below, so + // move to the next instruction. if (TII->isUnscaledLdSt(Opc)) { ++MBBI; break; Modified: vendor/llvm/dist/lib/Target/ARM/ARMExpandPseudoInsts.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/ARM/ARMExpandPseudoInsts.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/Target/ARM/ARMExpandPseudoInsts.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -769,8 +769,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock MachineInstr &MI = *MBBI; DebugLoc DL = MI.getDebugLoc(); const MachineOperand &Dest = MI.getOperand(0); - unsigned StatusReg = MI.getOperand(1).getReg(); - bool StatusDead = MI.getOperand(1).isDead(); + unsigned TempReg = MI.getOperand(1).getReg(); // Duplicating undef operands into 2 instructions does not guarantee the same // value on both; However undef should be replaced by xzr anyway. assert(!MI.getOperand(2).isUndef() && "cannot handle undef"); @@ -797,23 +796,9 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock } // .Lloadcmp: - // mov wStatus, #0 // ldrex rDest, [rAddr] // cmp rDest, rDesired // bne .Ldone - if (!StatusDead) { - if (IsThumb) { - BuildMI(LoadCmpBB, DL, TII->get(ARM::tMOVi8), StatusReg) - .addDef(ARM::CPSR, RegState::Dead) - .addImm(0) - .add(predOps(ARMCC::AL)); - } else { - BuildMI(LoadCmpBB, DL, TII->get(ARM::MOVi), StatusReg) - .addImm(0) - .add(predOps(ARMCC::AL)) - .add(condCodeOp()); - } - } MachineInstrBuilder MIB; MIB = BuildMI(LoadCmpBB, DL, TII->get(LdrexOp), Dest.getReg()); @@ -836,10 +821,10 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock LoadCmpBB->addSuccessor(StoreBB); // .Lstore: - // strex rStatus, rNew, [rAddr] - // cmp rStatus, #0 + // strex rTempReg, rNew, [rAddr] + // cmp rTempReg, #0 // bne .Lloadcmp - MIB = BuildMI(StoreBB, DL, TII->get(StrexOp), StatusReg) + MIB = BuildMI(StoreBB, DL, TII->get(StrexOp), TempReg) .addReg(NewReg) .addReg(AddrReg); if (StrexOp == ARM::t2STREX) @@ -848,7 +833,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock unsigned CMPri = IsThumb ? ARM::t2CMPri : ARM::CMPri; BuildMI(StoreBB, DL, TII->get(CMPri)) - .addReg(StatusReg, getKillRegState(StatusDead)) + .addReg(TempReg, RegState::Kill) .addImm(0) .add(predOps(ARMCC::AL)); BuildMI(StoreBB, DL, TII->get(Bcc)) @@ -904,8 +889,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP_64(MachineBasicBl MachineInstr &MI = *MBBI; DebugLoc DL = MI.getDebugLoc(); MachineOperand &Dest = MI.getOperand(0); - unsigned StatusReg = MI.getOperand(1).getReg(); - bool StatusDead = MI.getOperand(1).isDead(); + unsigned TempReg = MI.getOperand(1).getReg(); // Duplicating undef operands into 2 instructions does not guarantee the same // value on both; However undef should be replaced by xzr anyway. assert(!MI.getOperand(2).isUndef() && "cannot handle undef"); @@ -931,7 +915,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP_64(MachineBasicBl // .Lloadcmp: // ldrexd rDestLo, rDestHi, [rAddr] // cmp rDestLo, rDesiredLo - // sbcs rStatus, rDestHi, rDesiredHi + // sbcs rTempReg, rDestHi, rDesiredHi // bne .Ldone unsigned LDREXD = IsThumb ? ARM::t2LDREXD : ARM::LDREXD; MachineInstrBuilder MIB; @@ -959,17 +943,17 @@ bool ARMExpandPseudo::ExpandCMP_SWAP_64(MachineBasicBl LoadCmpBB->addSuccessor(StoreBB); // .Lstore: - // strexd rStatus, rNewLo, rNewHi, [rAddr] - // cmp rStatus, #0 + // strexd rTempReg, rNewLo, rNewHi, [rAddr] + // cmp rTempReg, #0 // bne .Lloadcmp unsigned STREXD = IsThumb ? ARM::t2STREXD : ARM::STREXD; - MIB = BuildMI(StoreBB, DL, TII->get(STREXD), StatusReg); + MIB = BuildMI(StoreBB, DL, TII->get(STREXD), TempReg); addExclusiveRegPair(MIB, New, 0, IsThumb, TRI); MIB.addReg(AddrReg).add(predOps(ARMCC::AL)); unsigned CMPri = IsThumb ? ARM::t2CMPri : ARM::CMPri; BuildMI(StoreBB, DL, TII->get(CMPri)) - .addReg(StatusReg, getKillRegState(StatusDead)) + .addReg(TempReg, RegState::Kill) .addImm(0) .add(predOps(ARMCC::AL)); BuildMI(StoreBB, DL, TII->get(Bcc)) Modified: vendor/llvm/dist/lib/Target/ARM/ARMInstrInfo.td ============================================================================== --- vendor/llvm/dist/lib/Target/ARM/ARMInstrInfo.td Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/Target/ARM/ARMInstrInfo.td Sun Aug 20 21:02:43 2017 (r322727) @@ -6053,21 +6053,21 @@ def SPACE : PseudoInst<(outs GPR:$Rd), (ins i32imm:$si // significantly more naive than the standard expansion: we conservatively // assume seq_cst, strong cmpxchg and omit clrex on failure. -let Constraints = "@earlyclobber $Rd,@earlyclobber $status", +let Constraints = "@earlyclobber $Rd,@earlyclobber $temp", mayLoad = 1, mayStore = 1 in { -def CMP_SWAP_8 : PseudoInst<(outs GPR:$Rd, GPR:$status), +def CMP_SWAP_8 : PseudoInst<(outs GPR:$Rd, GPR:$temp), (ins GPR:$addr, GPR:$desired, GPR:$new), NoItinerary, []>, Sched<[]>; -def CMP_SWAP_16 : PseudoInst<(outs GPR:$Rd, GPR:$status), +def CMP_SWAP_16 : PseudoInst<(outs GPR:$Rd, GPR:$temp), (ins GPR:$addr, GPR:$desired, GPR:$new), NoItinerary, []>, Sched<[]>; -def CMP_SWAP_32 : PseudoInst<(outs GPR:$Rd, GPR:$status), +def CMP_SWAP_32 : PseudoInst<(outs GPR:$Rd, GPR:$temp), (ins GPR:$addr, GPR:$desired, GPR:$new), NoItinerary, []>, Sched<[]>; -def CMP_SWAP_64 : PseudoInst<(outs GPRPair:$Rd, GPR:$status), +def CMP_SWAP_64 : PseudoInst<(outs GPRPair:$Rd, GPR:$temp), (ins GPR:$addr, GPRPair:$desired, GPRPair:$new), NoItinerary, []>, Sched<[]>; } Modified: vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -419,6 +419,11 @@ X86TargetLowering::X86TargetLowering(const X86TargetMa setOperationAction(ISD::SELECT, VT, Custom); setOperationAction(ISD::SETCC, VT, Custom); } + + // Custom action for SELECT MMX and expand action for SELECT_CC MMX + setOperationAction(ISD::SELECT, MVT::x86mmx, Custom); + setOperationAction(ISD::SELECT_CC, MVT::x86mmx, Expand); + setOperationAction(ISD::EH_RETURN , MVT::Other, Custom); // NOTE: EH_SJLJ_SETJMP/_LONGJMP supported here is NOT intended to support // SjLj exception handling but a light-weight setjmp/longjmp replacement to @@ -1383,7 +1388,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMa // (result) is 256-bit but the source is 512-bit wide. // 128-bit was made Custom under AVX1. for (auto VT : { MVT::v32i8, MVT::v16i16, MVT::v8i32, MVT::v4i64, - MVT::v8f32, MVT::v4f64 }) + MVT::v8f32, MVT::v4f64, MVT::v1i1 }) setOperationAction(ISD::EXTRACT_SUBVECTOR, VT, Custom); for (auto VT : { MVT::v2i1, MVT::v4i1, MVT::v8i1, MVT::v16i1, MVT::v32i1, MVT::v64i1 }) @@ -14570,6 +14575,21 @@ static SDValue LowerEXTRACT_SUBVECTOR(SDValue Op, cons unsigned IdxVal = cast(Idx)->getZExtValue(); MVT ResVT = Op.getSimpleValueType(); + // When v1i1 is legal a scalarization of a vselect with a vXi1 Cond + // would result with: v1i1 = extract_subvector(vXi1, idx). + // Lower these into extract_vector_elt which is already selectable. + if (ResVT == MVT::v1i1) { + assert(Subtarget.hasAVX512() && + "Boolean EXTRACT_SUBVECTOR requires AVX512"); + + MVT EltVT = ResVT.getVectorElementType(); + const TargetLowering &TLI = DAG.getTargetLoweringInfo(); + MVT LegalVT = + (TLI.getTypeToTransformTo(*DAG.getContext(), EltVT)).getSimpleVT(); + SDValue Res = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, LegalVT, In, Idx); + return DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, ResVT, Res); + } + assert((In.getSimpleValueType().is256BitVector() || In.getSimpleValueType().is512BitVector()) && "Can only extract from 256-bit or 512-bit vectors"); @@ -20651,8 +20671,8 @@ static SDValue LowerINTRINSIC_W_CHAIN(SDValue Op, cons } // ADC/ADCX/SBB case ADX: { - SDVTList CFVTs = DAG.getVTList(Op->getValueType(0), MVT::Other); - SDVTList VTs = DAG.getVTList(Op.getOperand(3)->getValueType(0), MVT::Other); + SDVTList CFVTs = DAG.getVTList(Op->getValueType(0), MVT::i32); + SDVTList VTs = DAG.getVTList(Op.getOperand(3)->getValueType(0), MVT::i32); SDValue GenCF = DAG.getNode(X86ISD::ADD, dl, CFVTs, Op.getOperand(2), DAG.getConstant(-1, dl, MVT::i8)); SDValue Res = DAG.getNode(IntrData->Opc0, dl, VTs, Op.getOperand(3), @@ -30663,6 +30683,14 @@ static SDValue combineSelect(SDNode *N, SelectionDAG & return SDValue(N, 0); } + // Custom action for SELECT MMX + if (VT == MVT::x86mmx) { + LHS = DAG.getBitcast(MVT::i64, LHS); + RHS = DAG.getBitcast(MVT::i64, RHS); + SDValue newSelect = DAG.getNode(ISD::SELECT, DL, MVT::i64, Cond, LHS, RHS); + return DAG.getBitcast(VT, newSelect); + } + return SDValue(); } @@ -33358,7 +33386,8 @@ static SDValue combineStore(SDNode *N, SelectionDAG &D SDValue NewLd = DAG.getLoad(LdVT, LdDL, Ld->getChain(), Ld->getBasePtr(), Ld->getPointerInfo(), Ld->getAlignment(), Ld->getMemOperand()->getFlags()); - SDValue NewChain = NewLd.getValue(1); + // Make sure new load is placed in same chain order. + SDValue NewChain = DAG.makeEquivalentMemoryOrdering(Ld, NewLd); if (TokenFactorIndex >= 0) { Ops.push_back(NewChain); NewChain = DAG.getNode(ISD::TokenFactor, LdDL, MVT::Other, Ops); @@ -33379,11 +33408,12 @@ static SDValue combineStore(SDNode *N, SelectionDAG &D Ld->getPointerInfo().getWithOffset(4), MinAlign(Ld->getAlignment(), 4), Ld->getMemOperand()->getFlags()); + // Make sure new loads are placed in same chain order. + SDValue NewChain = DAG.makeEquivalentMemoryOrdering(Ld, LoLd); + NewChain = DAG.makeEquivalentMemoryOrdering(Ld, HiLd); - SDValue NewChain = LoLd.getValue(1); if (TokenFactorIndex >= 0) { - Ops.push_back(LoLd); - Ops.push_back(HiLd); + Ops.push_back(NewChain); NewChain = DAG.getNode(ISD::TokenFactor, LdDL, MVT::Other, Ops); } Modified: vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td Sun Aug 20 21:02:43 2017 (r322727) @@ -978,6 +978,44 @@ multiclass avx512_int_broadcast_reg opc, X86Ve (_.VT (OpNode SrcRC:$src))>, T8PD, EVEX; } +multiclass avx512_int_broadcastbw_reg opc, string Name, + X86VectorVTInfo _, SDPatternOperator OpNode, + RegisterClass SrcRC, SubRegIndex Subreg> { + let ExeDomain = _.ExeDomain in + defm r : AVX512_maskable_custom, T8PD, EVEX; + + def : Pat <(_.VT (OpNode SrcRC:$src)), + (!cast(Name#r) + (i32 (INSERT_SUBREG (i32 (IMPLICIT_DEF)), SrcRC:$src, Subreg)))>; + + def : Pat <(vselect _.KRCWM:$mask, (_.VT (OpNode SrcRC:$src)), _.RC:$src0), + (!cast(Name#rk) _.RC:$src0, _.KRCWM:$mask, + (i32 (INSERT_SUBREG (i32 (IMPLICIT_DEF)), SrcRC:$src, Subreg)))>; + + def : Pat <(vselect _.KRCWM:$mask, (_.VT (OpNode SrcRC:$src)), _.ImmAllZerosV), + (!cast(Name#rkz) _.KRCWM:$mask, + (i32 (INSERT_SUBREG (i32 (IMPLICIT_DEF)), SrcRC:$src, Subreg)))>; +} + +multiclass avx512_int_broadcastbw_reg_vl opc, string Name, + AVX512VLVectorVTInfo _, SDPatternOperator OpNode, + RegisterClass SrcRC, SubRegIndex Subreg, Predicate prd> { + let Predicates = [prd] in + defm Z : avx512_int_broadcastbw_reg, EVEX_V512; + let Predicates = [prd, HasVLX] in { + defm Z256 : avx512_int_broadcastbw_reg, EVEX_V256; + defm Z128 : avx512_int_broadcastbw_reg, EVEX_V128; + } +} + multiclass avx512_int_broadcast_reg_vl opc, AVX512VLVectorVTInfo _, SDPatternOperator OpNode, RegisterClass SrcRC, Predicate prd> { @@ -989,18 +1027,11 @@ multiclass avx512_int_broadcast_reg_vl opc, AV } } -let isCodeGenOnly = 1 in { -defm VPBROADCASTBr : avx512_int_broadcast_reg_vl<0x7A, avx512vl_i8_info, - X86VBroadcast, GR8, HasBWI>; -defm VPBROADCASTWr : avx512_int_broadcast_reg_vl<0x7B, avx512vl_i16_info, - X86VBroadcast, GR16, HasBWI>; -} -let isAsmParserOnly = 1 in { - defm VPBROADCASTBr_Alt : avx512_int_broadcast_reg_vl<0x7A, avx512vl_i8_info, - null_frag, GR32, HasBWI>; - defm VPBROADCASTWr_Alt : avx512_int_broadcast_reg_vl<0x7B, avx512vl_i16_info, - null_frag, GR32, HasBWI>; -} +defm VPBROADCASTBr : avx512_int_broadcastbw_reg_vl<0x7A, "VPBROADCASTBr", + avx512vl_i8_info, X86VBroadcast, GR8, sub_8bit, HasBWI>; +defm VPBROADCASTWr : avx512_int_broadcastbw_reg_vl<0x7B, "VPBROADCASTWr", + avx512vl_i16_info, X86VBroadcast, GR16, sub_16bit, + HasBWI>; defm VPBROADCASTDr : avx512_int_broadcast_reg_vl<0x7C, avx512vl_i32_info, X86VBroadcast, GR32, HasAVX512>; defm VPBROADCASTQr : avx512_int_broadcast_reg_vl<0x7C, avx512vl_i64_info, Modified: vendor/llvm/dist/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp ============================================================================== --- vendor/llvm/dist/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -60,11 +60,13 @@ std::vector> OwningMBs; // Opens a file. Path has to be resolved already. // Newly created memory buffers are owned by this driver. -MemoryBufferRef openFile(StringRef Path) { +Optional openFile(StringRef Path) { ErrorOr> MB = MemoryBuffer::getFile(Path); - if (std::error_code EC = MB.getError()) + if (std::error_code EC = MB.getError()) { llvm::errs() << "fail openFile: " << EC.message() << "\n"; + return None; + } MemoryBufferRef MBRef = MB.get()->getMemBufferRef(); OwningMBs.push_back(std::move(MB.get())); // take ownership @@ -114,11 +116,16 @@ int llvm::dlltoolDriverMain(llvm::ArrayRefgetSpelling() << "\n"; - MemoryBufferRef MB; - if (auto *Arg = Args.getLastArg(OPT_d)) - MB = openFile(Arg->getValue()); + if (!Args.hasArg(OPT_d)) { + llvm::errs() << "no definition file specified\n"; + return 1; + } - if (!MB.getBufferSize()) { + Optional MB = openFile(Args.getLastArg(OPT_d)->getValue()); + if (!MB) + return 1; + + if (!MB->getBufferSize()) { llvm::errs() << "definition file empty\n"; return 1; } @@ -133,7 +140,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef Def = - parseCOFFModuleDefinition(MB, Machine, true); + parseCOFFModuleDefinition(*MB, Machine, true); if (!Def) { llvm::errs() << "error parsing definition\n" @@ -154,7 +161,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRefOutputFile); - if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine)) + if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine, true)) return 1; return 0; } Modified: vendor/llvm/dist/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -1470,6 +1470,7 @@ void DFSanVisitor::visitCallSite(CallSite CS) { } i = CS.arg_begin(); + const unsigned ShadowArgStart = Args.size(); for (unsigned n = FT->getNumParams(); n != 0; ++i, --n) Args.push_back(DFSF.getShadow(*i)); @@ -1504,6 +1505,15 @@ void DFSanVisitor::visitCallSite(CallSite CS) { CallInst *CustomCI = IRB.CreateCall(CustomF, Args); CustomCI->setCallingConv(CI->getCallingConv()); CustomCI->setAttributes(CI->getAttributes()); + + // Update the parameter attributes of the custom call instruction to + // zero extend the shadow parameters. This is required for targets + // which consider ShadowTy an illegal type. + for (unsigned n = 0; n < FT->getNumParams(); n++) { + const unsigned ArgNo = ShadowArgStart + n; + if (CustomCI->getArgOperand(ArgNo)->getType() == DFSF.DFS.ShadowTy) + CustomCI->addParamAttr(ArgNo, Attribute::ZExt); + } if (!FT->getReturnType()->isVoidTy()) { LoadInst *LabelLoad = IRB.CreateLoad(DFSF.LabelReturnAlloca); Modified: vendor/llvm/dist/lib/Transforms/Scalar/BDCE.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/BDCE.cpp Sun Aug 20 20:38:15 2017 (r322726) +++ vendor/llvm/dist/lib/Transforms/Scalar/BDCE.cpp Sun Aug 20 21:02:43 2017 (r322727) @@ -15,6 +15,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar/BDCE.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/DemandedBits.h" @@ -35,6 +36,46 @@ using namespace llvm; STATISTIC(NumRemoved, "Number of instructions removed (unused)"); STATISTIC(NumSimplified, "Number of instructions trivialized (dead bits)"); +/// If an instruction is trivialized (dead), then the chain of users of that +/// instruction may need to be cleared of assumptions that can no longer be +/// guaranteed correct. +static void clearAssumptionsOfUsers(Instruction *I, DemandedBits &DB) { + assert(I->getType()->isIntegerTy() && "Trivializing a non-integer value?"); + + // Initialize the worklist with eligible direct users. + SmallVector WorkList; + for (User *JU : I->users()) { + // If all bits of a user are demanded, then we know that nothing below that + // in the def-use chain needs to be changed. + auto *J = dyn_cast(JU); + if (J && !DB.getDemandedBits(J).isAllOnesValue()) + WorkList.push_back(J); + } + + // DFS through subsequent users while tracking visits to avoid cycles. + SmallPtrSet Visited; + while (!WorkList.empty()) { + Instruction *J = WorkList.pop_back_val(); + + // NSW, NUW, and exact are based on operands that might have changed. + J->dropPoisonGeneratingFlags(); + + // We do not have to worry about llvm.assume or range metadata: + // 1. llvm.assume demands its operand, so trivializing can't change it. + // 2. range metadata only applies to memory accesses which demand all bits. + + Visited.insert(J); + + for (User *KU : J->users()) { + // If all bits of a user are demanded, then we know that nothing below + // that in the def-use chain needs to be changed. + auto *K = dyn_cast(KU); + if (K && !Visited.count(K) && !DB.getDemandedBits(K).isAllOnesValue()) + WorkList.push_back(K); + } + } +} + static bool bitTrackingDCE(Function &F, DemandedBits &DB) { SmallVector Worklist; bool Changed = false; @@ -51,6 +92,9 @@ static bool bitTrackingDCE(Function &F, DemandedBits & // replacing all uses with something else. Then, if they don't need to // remain live (because they have side effects, etc.) we can remove them. DEBUG(dbgs() << "BDCE: Trivializing: " << I << " (all bits dead)\n"); + + clearAssumptionsOfUsers(&I, DB); + // FIXME: In theory we could substitute undef here instead of zero. // This should be reconsidered once we settle on the semantics of // undef, poison, etc. Added: vendor/llvm/dist/test/Analysis/ScalarEvolution/max-addrec-size.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/Analysis/ScalarEvolution/max-addrec-size.ll Sun Aug 20 21:02:43 2017 (r322727) @@ -0,0 +1,33 @@ +; RUN: opt -analyze -scalar-evolution -scalar-evolution-max-add-rec-size=3 < %s | FileCheck %s + +; Show that we are able to avoid creation of huge SCEVs by capping the max +; AddRec size. +define i32 @test_01(i32 %a, i32 %b) { + +; CHECK-LABEL: Classifying expressions for: @test_01 +; CHECK-NEXT: %iv = phi i32 [ %a, %entry ], [ %iv.next, %loop ] +; CHECK-NEXT: --> {%a,+,%b}<%loop> U: full-set S: full-set +; CHECK-NEXT: %iv.next = add i32 %iv, %b +; CHECK-NEXT: --> {(%a + %b),+,%b}<%loop> U: full-set S: full-set +; CHECK-NEXT: %x1 = mul i32 %iv, %iv.next +; CHECK-NEXT: --> {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> U: full-set S: full-set +; CHECK-NEXT: %x2 = mul i32 %x1, %x1 +; CHECK-NEXT: --> ({((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> * {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop>) U: full-set S: full-set +; CHECK-NEXT: %x3 = mul i32 %x2, %x1 +; CHECK-NEXT: --> ({((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> * {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> * {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop>) U: full-set S: full-set + +entry: + br label %loop + +loop: + %iv = phi i32 [ %a, %entry ], [ %iv.next, %loop ] + %iv.next = add i32 %iv, %b + %cond = icmp slt i32 %iv.next, 1000 + br i1 %cond, label %loop, label %exit + +exit: + %x1 = mul i32 %iv, %iv.next + %x2 = mul i32 %x1, %x1 + %x3 = mul i32 %x2, %x1 + ret i32 %x3 +} Added: vendor/llvm/dist/test/CodeGen/AArch64/arm64-ldst-unscaled-pre-post.mir ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/CodeGen/AArch64/arm64-ldst-unscaled-pre-post.mir Sun Aug 20 21:02:43 2017 (r322727) @@ -0,0 +1,115 @@ +# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass aarch64-ldst-opt -verify-machineinstrs -o - %s | FileCheck %s +--- +# CHECK-LABEL: name: test_LDURSi_post +# CHECK: LDRSpost %x0, -4 +name: test_LDURSi_post +body: | + bb.0.entry: + liveins: %x0 + + %s0 = LDURSi %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_LDURDi_post +# CHECK: LDRDpost %x0, -4 +name: test_LDURDi_post +body: | + bb.0.entry: + liveins: %x0 + + %d0 = LDURDi %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_LDURQi_post +# CHECK: LDRQpost %x0, -4 +name: test_LDURQi_post +body: | + bb.0.entry: + liveins: %x0 + + %q0 = LDURQi %x0, 0 + %x0 = SUBXri %x0, 4, 0 + RET_ReallyLR implicit %x0 +... +# CHECK-LABEL: name: test_LDURWi_post +# CHECK: LDRWpost %x0, -4 +name: test_LDURWi_post +body: | + bb.0.entry: + liveins: %x0 + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Aug 20 21:02:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E55BEDC88B1; Sun, 20 Aug 2017 21:02:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A66F72EEC; Sun, 20 Aug 2017 21:02:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KL2pYC015397; Sun, 20 Aug 2017 21:02:51 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KL2pp1015396; Sun, 20 Aug 2017 21:02:51 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708202102.v7KL2pp1015396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 20 Aug 2017 21:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322728 - vendor/llvm/llvm-release_50-r311219 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm/llvm-release_50-r311219 X-SVN-Commit-Revision: 322728 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 21:02:53 -0000 Author: dim Date: Sun Aug 20 21:02:51 2017 New Revision: 322728 URL: https://svnweb.freebsd.org/changeset/base/322728 Log: Tag llvm release_50 branch r311219. Added: vendor/llvm/llvm-release_50-r311219/ - copied from r322727, vendor/llvm/dist/ From owner-svn-src-all@freebsd.org Sun Aug 20 21:03:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43B4DDC89C0; Sun, 20 Aug 2017 21:03:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB0D473132; Sun, 20 Aug 2017 21:03:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KL3ZpH015501; Sun, 20 Aug 2017 21:03:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KL3VPd015461; Sun, 20 Aug 2017 21:03:31 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708202103.v7KL3VPd015461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 20 Aug 2017 21:03:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322729 - in vendor/clang/dist: docs include/clang-c include/clang/AST include/clang/Basic include/clang/Driver include/clang/Frontend lib/AST lib/Basic lib/CodeGen lib/Driver lib/Drive... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist: docs include/clang-c include/clang/AST include/clang/Basic include/clang/Driver include/clang/Frontend lib/AST lib/Basic lib/CodeGen lib/Driver lib/Driver/ToolChains lib/Driver/T... X-SVN-Commit-Revision: 322729 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 21:03:36 -0000 Author: dim Date: Sun Aug 20 21:03:30 2017 New Revision: 322729 URL: https://svnweb.freebsd.org/changeset/base/322729 Log: Vendor import of clang release_50 branch r311219: https://llvm.org/svn/llvm-project/cfe/branches/release_50@311219 Added: vendor/clang/dist/test/CodeCompletion/uninstantiated_params.cpp (contents, props changed) vendor/clang/dist/test/CodeGen/arm-float-helpers.c (contents, props changed) vendor/clang/dist/test/CodeGen/mips-madd4.c (contents, props changed) vendor/clang/dist/test/CodeGenCXX/pr34163.cpp (contents, props changed) vendor/clang/dist/test/Modules/Inputs/innerstructredef.h (contents, props changed) vendor/clang/dist/test/Modules/inner-struct-redefines-invisible.m Deleted: vendor/clang/dist/test/CodeGen/mips-aggregate-arg.c Modified: vendor/clang/dist/docs/ReleaseNotes.rst vendor/clang/dist/include/clang-c/Index.h vendor/clang/dist/include/clang/AST/Decl.h vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Driver/Options.td vendor/clang/dist/include/clang/Driver/ToolChain.h vendor/clang/dist/include/clang/Frontend/LangStandards.def vendor/clang/dist/lib/AST/DeclCXX.cpp vendor/clang/dist/lib/AST/ExprCXX.cpp vendor/clang/dist/lib/AST/ExprConstant.cpp vendor/clang/dist/lib/Basic/Targets.cpp vendor/clang/dist/lib/CodeGen/TargetInfo.cpp vendor/clang/dist/lib/Driver/ToolChain.cpp vendor/clang/dist/lib/Driver/ToolChains/Arch/Mips.cpp vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp vendor/clang/dist/lib/Driver/ToolChains/CrossWindows.cpp vendor/clang/dist/lib/Driver/ToolChains/CrossWindows.h vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp vendor/clang/dist/lib/Driver/ToolChains/Darwin.h vendor/clang/dist/lib/Driver/ToolChains/Gnu.cpp vendor/clang/dist/lib/Driver/ToolChains/Gnu.h vendor/clang/dist/lib/Driver/ToolChains/MSVC.cpp vendor/clang/dist/lib/Driver/ToolChains/MSVC.h vendor/clang/dist/lib/Driver/ToolChains/MinGW.cpp vendor/clang/dist/lib/Driver/ToolChains/MinGW.h vendor/clang/dist/lib/Driver/ToolChains/NetBSD.h vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp vendor/clang/dist/lib/Parse/ParseCXXInlineMethods.cpp vendor/clang/dist/lib/Sema/SemaCast.cpp vendor/clang/dist/lib/Sema/SemaCodeComplete.cpp vendor/clang/dist/lib/Sema/SemaDecl.cpp vendor/clang/dist/lib/Sema/SemaTemplateInstantiateDecl.cpp vendor/clang/dist/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp vendor/clang/dist/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp vendor/clang/dist/test/CXX/drs/dr0xx.cpp vendor/clang/dist/test/CXX/drs/dr13xx.cpp vendor/clang/dist/test/CXX/drs/dr1xx.cpp vendor/clang/dist/test/CXX/drs/dr20xx.cpp vendor/clang/dist/test/CXX/drs/dr2xx.cpp vendor/clang/dist/test/CXX/drs/dr4xx.cpp vendor/clang/dist/test/CXX/drs/dr5xx.cpp vendor/clang/dist/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp vendor/clang/dist/test/CodeGen/complex-math.c vendor/clang/dist/test/Driver/clang-translation.c vendor/clang/dist/test/Driver/darwin-version.c vendor/clang/dist/test/Driver/unknown-std.cpp vendor/clang/dist/test/FixIt/fixit.cpp vendor/clang/dist/test/Lexer/cxx-features.cpp vendor/clang/dist/test/Lexer/hexfloat.cpp vendor/clang/dist/test/Modules/Inputs/module.map vendor/clang/dist/test/Parser/cxx0x-attributes.cpp vendor/clang/dist/test/Parser/cxx1z-constexpr-lambdas.cpp vendor/clang/dist/test/Parser/cxx1z-nested-namespace-definition.cpp vendor/clang/dist/test/Preprocessor/init.c vendor/clang/dist/test/SemaCUDA/function-overload.cu vendor/clang/dist/test/SemaCUDA/no-destructor-overload.cu vendor/clang/dist/test/SemaCXX/constant-expression-cxx1y.cpp vendor/clang/dist/test/SemaCXX/cxx0x-compat.cpp vendor/clang/dist/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp vendor/clang/dist/test/SemaCXX/cxx1z-init-statement.cpp vendor/clang/dist/test/SemaCXX/deprecated.cpp vendor/clang/dist/test/SemaCXX/inline.cpp vendor/clang/dist/test/SemaCXX/static-assert.cpp vendor/clang/dist/test/SemaCXX/warn-c++1z-extensions.cpp vendor/clang/dist/test/SemaCXX/warn-shadow.cpp vendor/clang/dist/test/SemaObjC/illegal-nonarc-bridged-cast.m vendor/clang/dist/test/SemaTemplate/temp_arg_nontype_cxx11.cpp vendor/clang/dist/www/cxx_dr_status.html vendor/clang/dist/www/cxx_status.html vendor/clang/dist/www/make_cxx_dr_status Modified: vendor/clang/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/clang/dist/docs/ReleaseNotes.rst Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/docs/ReleaseNotes.rst Sun Aug 20 21:03:30 2017 (r322729) @@ -61,7 +61,7 @@ Improvements to Clang's diagnostics New Compiler Flags ------------------ -The option .... +- --autocomplete was implemented to obtain a list of flags and its arguments. This is used for shell autocompletion. Deprecated Compiler Flags ------------------------- @@ -200,7 +200,13 @@ libclang Static Analyzer --------------- -... +- The static analyzer now supports using the + `z3 theorem prover `_ from Microsoft Research + as an external constraint solver. This allows reasoning over more complex + queries, but performance is ~15x slower than the default range-based + constraint solver. To enable the z3 solver backend, clang must be built with + the ``CLANG_ANALYZER_BUILD_Z3=ON`` option, and the + ``-Xanalyzer -analyzer-constraints=z3`` arguments passed at runtime. Undefined Behavior Sanitizer (UBSan) ------------------------------------ @@ -240,7 +246,19 @@ New Issues Found Python Binding Changes ---------------------- +Python bindings now support both Python 2 and Python 3. + The following methods have been added: + +- ``is_scoped_enum`` has been added to ``Cursor``. + +- ``exception_specification_kind`` has been added to ``Cursor``. + +- ``get_address_space`` has been added to ``Type``. + +- ``get_typedef_name`` has been added to ``Type``. + +- ``get_exception_specification_kind`` has been added to ``Type``. - ... Modified: vendor/clang/dist/include/clang-c/Index.h ============================================================================== --- vendor/clang/dist/include/clang-c/Index.h Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/include/clang-c/Index.h Sun Aug 20 21:03:30 2017 (r322729) @@ -3206,6 +3206,8 @@ enum CXCallingConv { CXCallingConv_X86RegCall = 8, CXCallingConv_IntelOclBicc = 9, CXCallingConv_Win64 = 10, + /* Alias for compatibility with older versions of API. */ + CXCallingConv_X86_64Win64 = CXCallingConv_Win64, CXCallingConv_X86_64SysV = 11, CXCallingConv_X86VectorCall = 12, CXCallingConv_Swift = 13, Modified: vendor/clang/dist/include/clang/AST/Decl.h ============================================================================== --- vendor/clang/dist/include/clang/AST/Decl.h Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/include/clang/AST/Decl.h Sun Aug 20 21:03:30 2017 (r322729) @@ -1666,8 +1666,7 @@ class FunctionDecl : public DeclaratorDecl, public Dec unsigned HasSkippedBody : 1; /// Indicates if the function declaration will have a body, once we're done - /// parsing it. (We don't set it to false when we're done parsing, in the - /// hopes this is simpler.) + /// parsing it. unsigned WillHaveBody : 1; /// \brief End part of this FunctionDecl's source range. Modified: vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td Sun Aug 20 21:03:30 2017 (r322729) @@ -138,9 +138,10 @@ def err_drv_cc_print_options_failure : Error< def err_drv_lto_without_lld : Error<"LTO requires -fuse-ld=lld">; def err_drv_preamble_format : Error< "incorrect format for -preamble-bytes=N,END">; -def err_invalid_ios_deployment_target : Error< +def warn_invalid_ios_deployment_target : Warning< "invalid iOS deployment version '%0', iOS 10 is the maximum deployment " - "target for 32-bit targets">; + "target for 32-bit targets">, InGroup, + DefaultError; def err_drv_conflicting_deployment_targets : Error< "conflicting deployment targets, both '%0' and '%1' are present in environment">; def err_arc_unsupported_on_runtime : Error< Modified: vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td Sun Aug 20 21:03:30 2017 (r322729) @@ -151,9 +151,13 @@ def GNUFlexibleArrayUnionMember : DiagGroup<"gnu-flexi def GNUFoldingConstant : DiagGroup<"gnu-folding-constant">; def FormatExtraArgs : DiagGroup<"format-extra-args">; def FormatZeroLength : DiagGroup<"format-zero-length">; -def CXX1zCompatMangling : DiagGroup<"c++1z-compat-mangling">; + +def InvalidIOSDeploymentTarget : DiagGroup<"invalid-ios-deployment-target">; + +def CXX17CompatMangling : DiagGroup<"c++17-compat-mangling">; +def : DiagGroup<"c++1z-compat-mangling", [CXX17CompatMangling]>; // Name of this warning in GCC. -def NoexceptType : DiagGroup<"noexcept-type", [CXX1zCompatMangling]>; +def NoexceptType : DiagGroup<"noexcept-type", [CXX17CompatMangling]>; // Warnings for C++1y code which is not compatible with prior C++ standards. def CXXPre14Compat : DiagGroup<"c++98-c++11-compat">; @@ -215,9 +219,10 @@ def CXX14Compat : DiagGroup<"c++14-compat", [CXXPre1zC def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic", [CXXPre1zCompatPedantic]>; -def CXX1zCompat : DiagGroup<"c++1z-compat", [DeprecatedRegister, +def CXX17Compat : DiagGroup<"c++17-compat", [DeprecatedRegister, DeprecatedIncrementBool, - CXX1zCompatMangling]>; + CXX17CompatMangling]>; +def : DiagGroup<"c++1z-compat", [CXX17Compat]>; def ExitTimeDestructors : DiagGroup<"exit-time-destructors">; def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">; @@ -769,10 +774,11 @@ def CXX14 : DiagGroup<"c++14-extensions", [CXX14Binary // A warning group for warnings about using C++1z features as extensions in // earlier C++ versions. -def CXX1z : DiagGroup<"c++1z-extensions">; +def CXX17 : DiagGroup<"c++17-extensions">; def : DiagGroup<"c++0x-extensions", [CXX11]>; def : DiagGroup<"c++1y-extensions", [CXX14]>; +def : DiagGroup<"c++1z-extensions", [CXX17]>; def DelegatingCtorCycles : DiagGroup<"delegating-ctor-cycles">; Modified: vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td Sun Aug 20 21:03:30 2017 (r322729) @@ -181,10 +181,10 @@ def err_hex_constant_requires : Error< def ext_hex_constant_invalid : Extension< "hexadecimal floating constants are a C99 feature">, InGroup; def ext_hex_literal_invalid : Extension< - "hexadecimal floating literals are a C++1z feature">, InGroup; + "hexadecimal floating literals are a C++17 feature">, InGroup; def warn_cxx1z_hex_literal : Warning< "hexadecimal floating literals are incompatible with " - "C++ standards before C++1z">, + "C++ standards before C++17">, InGroup, DefaultIgnore; def ext_binary_literal : Extension< "binary integer literals are a GNU extension">, InGroup; @@ -208,7 +208,7 @@ def warn_cxx98_compat_unicode_literal : Warning< "unicode literals are incompatible with C++98">, InGroup, DefaultIgnore; def warn_cxx14_compat_u8_character_literal : Warning< - "unicode literals are incompatible with C++ standards before C++1z">, + "unicode literals are incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def warn_cxx11_compat_user_defined_literal : Warning< "identifier after literal will be treated as a user-defined literal suffix " Modified: vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td Sun Aug 20 21:03:30 2017 (r322729) @@ -211,10 +211,10 @@ def err_inline_namespace_alias : Error<"namespace alia def err_namespace_nonnamespace_scope : Error< "namespaces can only be defined in global or namespace scope">; def ext_nested_namespace_definition : ExtWarn< - "nested namespace definition is a C++1z extension; " - "define each namespace separately">, InGroup; + "nested namespace definition is a C++17 extension; " + "define each namespace separately">, InGroup; def warn_cxx14_compat_nested_namespace_definition : Warning< - "nested namespace definition is incompatible with C++ standards before C++1z">, + "nested namespace definition is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def err_inline_nested_namespace_definition : Error< "nested namespace definition cannot be 'inline'">; @@ -358,7 +358,7 @@ def err_expected_coloncolon_after_super : Error< "expected '::' after '__super'">; def ext_decomp_decl_empty : ExtWarn< - "ISO C++1z does not allow a decomposition group to be empty">, + "ISO C++17 does not allow a decomposition group to be empty">, InGroup>; /// Objective-C parser diagnostics @@ -522,16 +522,16 @@ def err_function_is_not_record : Error< def err_super_in_using_declaration : Error< "'__super' cannot be used with a using declaration">; def ext_constexpr_if : ExtWarn< - "constexpr if is a C++1z extension">, InGroup; + "constexpr if is a C++17 extension">, InGroup; def warn_cxx14_compat_constexpr_if : Warning< - "constexpr if is incompatible with C++ standards before C++1z">, + "constexpr if is incompatible with C++ standards before C++17">, DefaultIgnore, InGroup; def ext_init_statement : ExtWarn< - "'%select{if|switch}0' initialization statements are a C++1z extension">, - InGroup; + "'%select{if|switch}0' initialization statements are a C++17 extension">, + InGroup; def warn_cxx14_compat_init_statement : Warning< "%select{if|switch}0 initialization statements are incompatible with " - "C++ standards before C++1z">, DefaultIgnore, InGroup; + "C++ standards before C++17">, DefaultIgnore, InGroup; // C++ derived classes def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">; @@ -560,7 +560,7 @@ def warn_cxx98_compat_nullptr : Warning< def warn_cxx14_compat_attribute : Warning< "attributes on %select{a namespace|an enumerator}0 declaration are " - "incompatible with C++ standards before C++1z">, + "incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">, InGroup, DefaultIgnore; @@ -577,10 +577,10 @@ def err_cxx11_attribute_repeated : Error< "attribute %0 cannot appear multiple times in an attribute specifier">; def warn_cxx14_compat_using_attribute_ns : Warning< "default scope specifier for attributes is incompatible with C++ standards " - "before C++1z">, InGroup, DefaultIgnore; + "before C++17">, InGroup, DefaultIgnore; def ext_using_attribute_ns : ExtWarn< - "default scope specifier for attributes is a C++1z extension">, - InGroup; + "default scope specifier for attributes is a C++17 extension">, + InGroup; def err_using_attribute_ns_conflict : Error< "attribute with scope specifier cannot follow default scope specifier">; def err_attributes_not_allowed : Error<"an attribute list cannot appear here">; @@ -617,11 +617,11 @@ def err_expected_comma_greater : Error< def err_class_on_template_template_param : Error< "template template parameter requires 'class' after the parameter list">; def ext_template_template_param_typename : ExtWarn< - "template template parameter using 'typename' is a C++1z extension">, - InGroup; + "template template parameter using 'typename' is a C++17 extension">, + InGroup; def warn_cxx14_compat_template_template_param_typename : Warning< "template template parameter using 'typename' is " - "incompatible with C++ standards before C++1z">, + "incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def err_template_spec_syntax_non_template : Error< "identifier followed by '<' indicates a class template specialization but " @@ -695,10 +695,10 @@ def err_default_template_template_parameter_not_templa "template">; def ext_fold_expression : ExtWarn< - "pack fold expression is a C++1z extension">, - InGroup; + "pack fold expression is a C++17 extension">, + InGroup; def warn_cxx14_compat_fold_expression : Warning< - "pack fold expression is incompatible with C++ standards before C++1z">, + "pack fold expression is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def err_expected_fold_operator : Error< "expected a foldable binary operator in fold expression">; @@ -751,16 +751,16 @@ def err_alias_declaration_pack_expansion : Error< // C++1z using-declaration pack expansions def ext_multi_using_declaration : ExtWarn< "use of multiple declarators in a single using declaration is " - "a C++1z extension">, InGroup; + "a C++17 extension">, InGroup; def warn_cxx1z_compat_multi_using_declaration : Warning< "use of multiple declarators in a single using declaration is " - "incompatible with C++ standards before C++1z">, + "incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def ext_using_declaration_pack : ExtWarn< - "pack expansion of using declaration is a C++1z extension">, InGroup; + "pack expansion of using declaration is a C++17 extension">, InGroup; def warn_cxx1z_compat_using_declaration_pack : Warning< "pack expansion using declaration is incompatible with C++ standards " - "before C++1z">, InGroup, DefaultIgnore; + "before C++17">, InGroup, DefaultIgnore; // C++11 override control def ext_override_control_keyword : ExtWarn< @@ -817,10 +817,10 @@ def err_expected_star_this_capture : Error< // C++1z constexpr lambda expressions def warn_cxx14_compat_constexpr_on_lambda : Warning< - "constexpr on lambda expressions is incompatible with C++ standards before C++1z">, + "constexpr on lambda expressions is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def ext_constexpr_on_lambda_cxx1z : ExtWarn< - "'constexpr' on lambda expressions is a C++1z extension">, InGroup; + "'constexpr' on lambda expressions is a C++17 extension">, InGroup; // Availability attribute def err_expected_version : Error< Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Sun Aug 20 21:03:30 2017 (r322729) @@ -211,9 +211,9 @@ def warn_auto_storage_class : Warning< def warn_deprecated_register : Warning< "'register' storage class specifier is deprecated " - "and incompatible with C++1z">, InGroup; + "and incompatible with C++17">, InGroup; def ext_register_storage_class : ExtWarn< - "ISO C++1z does not allow 'register' storage class specifier">, + "ISO C++17 does not allow 'register' storage class specifier">, DefaultError, InGroup; def err_invalid_decl_spec_combination : Error< @@ -391,9 +391,9 @@ def err_decomp_decl_context : Error< "decomposition declaration not permitted in this context">; def warn_cxx14_compat_decomp_decl : Warning< "decomposition declarations are incompatible with " - "C++ standards before C++1z">, DefaultIgnore, InGroup; + "C++ standards before C++17">, DefaultIgnore, InGroup; def ext_decomp_decl : ExtWarn< - "decomposition declarations are a C++1z extension">, InGroup; + "decomposition declarations are a C++17 extension">, InGroup; def err_decomp_decl_spec : Error< "decomposition declaration cannot be declared " "%plural{1:'%1'|:with '%1' specifiers}0">; @@ -494,7 +494,7 @@ def err_access_decl : Error< "ISO C++11 does not allow access declarations; " "use using declarations instead">; def ext_dynamic_exception_spec : ExtWarn< - "ISO C++1z does not allow dynamic exception specifications">, + "ISO C++17 does not allow dynamic exception specifications">, InGroup, DefaultError; def warn_exception_spec_deprecated : Warning< "dynamic exception specifications are deprecated">, @@ -507,7 +507,7 @@ def warn_deprecated_copy_operation : Warning< InGroup, DefaultIgnore; def warn_cxx1z_compat_exception_spec_in_signature : Warning< "mangled name of %0 will change in C++17 due to non-throwing exception " - "specification in function signature">, InGroup; + "specification in function signature">, InGroup; def warn_global_constructor : Warning< "declaration requires a global constructor">, @@ -1200,15 +1200,15 @@ def err_static_assert_expression_is_not_constant : Err "static_assert expression is not an integral constant expression">; def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">; def ext_static_assert_no_message : ExtWarn< - "static_assert with no message is a C++1z extension">, InGroup; + "static_assert with no message is a C++17 extension">, InGroup; def warn_cxx14_compat_static_assert_no_message : Warning< - "static_assert with no message is incompatible with C++ standards before C++1z">, + "static_assert with no message is incompatible with C++ standards before C++17">, DefaultIgnore, InGroup; def ext_inline_variable : ExtWarn< - "inline variables are a C++1z extension">, InGroup; + "inline variables are a C++17 extension">, InGroup; def warn_cxx14_compat_inline_variable : Warning< - "inline variables are incompatible with C++ standards before C++1z">, + "inline variables are incompatible with C++ standards before C++17">, DefaultIgnore, InGroup; def warn_inline_namespace_reopened_noninline : Warning< @@ -1922,7 +1922,7 @@ def err_auto_not_allowed : Error< "|in non-static struct member|in struct member" "|in non-static union member|in union member" "|in non-static class member|in interface member" - "|in exception declaration|in template parameter until C++1z|in block literal" + "|in exception declaration|in template parameter until C++17|in block literal" "|in template argument|in typedef|in type alias|in function return type" "|in conversion function type|here|in lambda parameter" "|in type allocated by 'new'|in K&R-style function parameter" @@ -2147,11 +2147,11 @@ def err_for_range_iter_deduction_failure : Error< def err_for_range_member_begin_end_mismatch : Error< "range type %0 has '%select{begin|end}1' member but no '%select{end|begin}1' member">; def ext_for_range_begin_end_types_differ : ExtWarn< - "'begin' and 'end' returning different types (%0 and %1) is a C++1z extension">, - InGroup; + "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">, + InGroup; def warn_for_range_begin_end_types_differ : Warning< "'begin' and 'end' returning different types (%0 and %1) is incompatible " - "with C++ standards before C++1z">, InGroup, DefaultIgnore; + "with C++ standards before C++17">, InGroup, DefaultIgnore; def note_in_for_range: Note< "when looking up '%select{begin|end}0' function for range expression " "of type %1">; @@ -3905,7 +3905,7 @@ def err_template_nontype_parm_bad_type : Error< "a non-type template parameter cannot have type %0">; def warn_cxx14_compat_template_nontype_parm_auto_type : Warning< "non-type template parameters declared with %0 are incompatible with C++ " - "standards before C++1z">, + "standards before C++17">, DefaultIgnore, InGroup; def err_template_param_default_arg_redefinition : Error< "template parameter redefines default argument">; @@ -6337,9 +6337,9 @@ def note_member_first_declared_here : Note< def err_decrement_bool : Error<"cannot decrement expression of type bool">; def warn_increment_bool : Warning< "incrementing expression of type bool is deprecated and " - "incompatible with C++1z">, InGroup; + "incompatible with C++17">, InGroup; def ext_increment_bool : ExtWarn< - "ISO C++1z does not allow incrementing expression of type bool">, + "ISO C++17 does not allow incrementing expression of type bool">, DefaultError, InGroup; def err_increment_decrement_enum : Error< "cannot %select{decrement|increment}0 expression of enum type %1">; @@ -6528,10 +6528,10 @@ let CategoryName = "Lambda Issue" in { // C++1z '*this' captures. def warn_cxx14_compat_star_this_lambda_capture : Warning< - "by value capture of '*this' is incompatible with C++ standards before C++1z">, + "by value capture of '*this' is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def ext_star_this_lambda_capture_cxx1z : ExtWarn< - "capture of '*this' by copy is a C++1z extension">, InGroup; + "capture of '*this' by copy is a C++17 extension">, InGroup; } def err_return_in_captured_stmt : Error< @@ -7200,7 +7200,7 @@ def warn_unused_volatile : Warning< def ext_cxx14_attr : Extension< "use of the %0 attribute is a C++14 extension">, InGroup; def ext_cxx1z_attr : Extension< - "use of the %0 attribute is a C++1z extension">, InGroup; + "use of the %0 attribute is a C++17 extension">, InGroup; def warn_unused_comparison : Warning< "%select{%select{|in}1equality|relational}0 comparison result unused">, Modified: vendor/clang/dist/include/clang/Driver/Options.td ============================================================================== --- vendor/clang/dist/include/clang/Driver/Options.td Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/include/clang/Driver/Options.td Sun Aug 20 21:03:30 2017 (r322729) @@ -2019,6 +2019,10 @@ def mdspr2 : Flag<["-"], "mdspr2">, Group; def mno_dspr2 : Flag<["-"], "mno-dspr2">, Group; def msingle_float : Flag<["-"], "msingle-float">, Group; def mdouble_float : Flag<["-"], "mdouble-float">, Group; +def mmadd4 : Flag<["-"], "mmadd4">, Group, + HelpText<"Enable the generation of 4-operand madd.s, madd.d and related instructions.">; +def mno_madd4 : Flag<["-"], "mno-madd4">, Group, + HelpText<"Disable the generation of 4-operand madd.s, madd.d and related instructions.">; def mmsa : Flag<["-"], "mmsa">, Group, HelpText<"Enable MSA ASE (MIPS only)">; def mno_msa : Flag<["-"], "mno-msa">, Group, Modified: vendor/clang/dist/include/clang/Driver/ToolChain.h ============================================================================== --- vendor/clang/dist/include/clang/Driver/ToolChain.h Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/include/clang/Driver/ToolChain.h Sun Aug 20 21:03:30 2017 (r322729) @@ -315,7 +315,7 @@ class ToolChain { (public) /// IsUnwindTablesDefault - Does this tool chain use -funwind-tables /// by default. - virtual bool IsUnwindTablesDefault() const; + virtual bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const; /// \brief Test whether this toolchain defaults to PIC. virtual bool isPICDefault() const = 0; Modified: vendor/clang/dist/include/clang/Frontend/LangStandards.def ============================================================================== --- vendor/clang/dist/include/clang/Frontend/LangStandards.def Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/include/clang/Frontend/LangStandards.def Sun Aug 20 21:03:30 2017 (r322729) @@ -109,15 +109,17 @@ LANGSTANDARD(gnucxx14, "gnu++14", GNUMode) LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y") -LANGSTANDARD(cxx1z, "c++1z", - CXX, "Working draft for ISO C++ 2017", +LANGSTANDARD(cxx17, "c++17", + CXX, "ISO C++ 2017 with amendments", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus1z | Digraphs | HexFloat) +LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z") -LANGSTANDARD(gnucxx1z, "gnu++1z", - CXX, "Working draft for ISO C++ 2017 with GNU extensions", +LANGSTANDARD(gnucxx17, "gnu++17", + CXX, "ISO C++ 2017 with amendments and GNU extensions", LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus1z | Digraphs | HexFloat | GNUMode) +LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z") LANGSTANDARD(cxx2a, "c++2a", CXX, "Working draft for ISO C++ 2020", Modified: vendor/clang/dist/lib/AST/DeclCXX.cpp ============================================================================== --- vendor/clang/dist/lib/AST/DeclCXX.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/AST/DeclCXX.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -1837,9 +1837,10 @@ bool CXXMethodDecl::hasInlineBody() const { const FunctionDecl *CheckFn = getTemplateInstantiationPattern(); if (!CheckFn) CheckFn = this; - + const FunctionDecl *fn; - return CheckFn->hasBody(fn) && !fn->isOutOfLine(); + return CheckFn->isDefined(fn) && !fn->isOutOfLine() && + (fn->doesThisDeclarationHaveABody() || fn->willHaveBody()); } bool CXXMethodDecl::isLambdaStaticInvoker() const { Modified: vendor/clang/dist/lib/AST/ExprCXX.cpp ============================================================================== --- vendor/clang/dist/lib/AST/ExprCXX.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/AST/ExprCXX.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -1052,7 +1052,9 @@ CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr :Type->getType()->isRValueReferenceType()? VK_XValue :VK_RValue), OK_Ordinary, - Type->getType()->isDependentType(), true, true, + Type->getType()->isDependentType() || + Type->getType()->getContainedDeducedType(), + true, true, Type->getType()->containsUnexpandedParameterPack()), Type(Type), LParenLoc(LParenLoc), Modified: vendor/clang/dist/lib/AST/ExprConstant.cpp ============================================================================== --- vendor/clang/dist/lib/AST/ExprConstant.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/AST/ExprConstant.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -9788,6 +9788,8 @@ class VoidExprEvaluator (public) bool Success(const APValue &V, const Expr *e) { return true; } + bool ZeroInitialization(const Expr *E) { return true; } + bool VisitCastExpr(const CastExpr *E) { switch (E->getCastKind()) { default: Modified: vendor/clang/dist/lib/Basic/Targets.cpp ============================================================================== --- vendor/clang/dist/lib/Basic/Targets.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Basic/Targets.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -8050,6 +8050,7 @@ class MipsTargetInfo : public TargetInfo { NoDSP, DSP1, DSP2 } DspRev; bool HasMSA; + bool DisableMadd4; protected: bool HasFP64; @@ -8060,7 +8061,7 @@ class MipsTargetInfo : public TargetInfo { : TargetInfo(Triple), IsMips16(false), IsMicromips(false), IsNan2008(false), IsSingleFloat(false), IsNoABICalls(false), CanUseBSDABICalls(false), FloatABI(HardFloat), DspRev(NoDSP), - HasMSA(false), HasFP64(false) { + HasMSA(false), DisableMadd4(false), HasFP64(false) { TheCXXABI.set(TargetCXXABI::GenericMIPS); setABI((getTriple().getArch() == llvm::Triple::mips || @@ -8306,6 +8307,9 @@ class MipsTargetInfo : public TargetInfo { if (HasMSA) Builder.defineMacro("__mips_msa", Twine(1)); + if (DisableMadd4) + Builder.defineMacro("__mips_no_madd4", Twine(1)); + Builder.defineMacro("_MIPS_SZPTR", Twine(getPointerWidth(0))); Builder.defineMacro("_MIPS_SZINT", Twine(getIntWidth())); Builder.defineMacro("_MIPS_SZLONG", Twine(getLongWidth())); @@ -8468,6 +8472,8 @@ class MipsTargetInfo : public TargetInfo { DspRev = std::max(DspRev, DSP2); else if (Feature == "+msa") HasMSA = true; + else if (Feature == "+nomadd4") + DisableMadd4 = true; else if (Feature == "+fp64") HasFP64 = true; else if (Feature == "-fp64") Modified: vendor/clang/dist/lib/CodeGen/TargetInfo.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/TargetInfo.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/CodeGen/TargetInfo.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -5573,17 +5573,14 @@ void ARMABIInfo::setCCs() { // AAPCS apparently requires runtime support functions to be soft-float, but // that's almost certainly for historic reasons (Thumb1 not supporting VFP // most likely). It's more convenient for AAPCS16_VFP to be hard-float. - switch (getABIKind()) { - case APCS: - case AAPCS16_VFP: - if (abiCC != getLLVMDefaultCC()) + + // The Run-time ABI for the ARM Architecture section 4.1.2 requires + // AEABI-complying FP helper functions to use the base AAPCS. + // These AEABI functions are expanded in the ARM llvm backend, all the builtin + // support functions emitted by clang such as the _Complex helpers follow the + // abiCC. + if (abiCC != getLLVMDefaultCC()) BuiltinCC = abiCC; - break; - case AAPCS: - case AAPCS_VFP: - BuiltinCC = llvm::CallingConv::ARM_AAPCS; - break; - } } ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, @@ -6753,14 +6750,6 @@ MipsABIInfo::classifyArgumentType(QualType Ty, uint64_ Offset = OrigOffset + MinABIStackAlignInBytes; return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); } - - // Use indirect if the aggregate cannot fit into registers for - // passing arguments according to the ABI - unsigned Threshold = IsO32 ? 16 : 64; - - if(getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(Threshold)) - return ABIArgInfo::getIndirect(CharUnits::fromQuantity(Align), true, - getContext().getTypeAlign(Ty) / 8 > Align); // If we have reached here, aggregates are passed directly by coercing to // another structure type. Padding is inserted if the offset of the Modified: vendor/clang/dist/lib/Driver/ToolChain.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChain.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChain.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -217,7 +217,7 @@ StringRef ToolChain::getDefaultUniversalArchName() con } } -bool ToolChain::IsUnwindTablesDefault() const { +bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const { return false; } Modified: vendor/clang/dist/lib/Driver/ToolChains/Arch/Mips.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/Arch/Mips.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/Arch/Mips.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -297,6 +297,8 @@ void mips::getMIPSTargetFeatures(const Driver &D, cons AddTargetFeature(Args, Features, options::OPT_mno_odd_spreg, options::OPT_modd_spreg, "nooddspreg"); + AddTargetFeature(Args, Features, options::OPT_mno_madd4, options::OPT_mmadd4, + "nomadd4"); AddTargetFeature(Args, Features, options::OPT_mlong_calls, options::OPT_mno_long_calls, "long-calls"); AddTargetFeature(Args, Features, options::OPT_mmt, options::OPT_mno_mt,"mt"); Modified: vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -2538,7 +2538,7 @@ void Clang::ConstructJob(Compilation &C, const JobActi bool AsynchronousUnwindTables = Args.hasFlag(options::OPT_fasynchronous_unwind_tables, options::OPT_fno_asynchronous_unwind_tables, - (getToolChain().IsUnwindTablesDefault() || + (getToolChain().IsUnwindTablesDefault(Args) || getToolChain().getSanitizerArgs().needsUnwindTables()) && !KernelOrKext); if (Args.hasFlag(options::OPT_funwind_tables, options::OPT_fno_unwind_tables, Modified: vendor/clang/dist/lib/Driver/ToolChains/CrossWindows.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/CrossWindows.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/CrossWindows.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -214,7 +214,7 @@ CrossWindowsToolChain::CrossWindowsToolChain(const Dri } } -bool CrossWindowsToolChain::IsUnwindTablesDefault() const { +bool CrossWindowsToolChain::IsUnwindTablesDefault(const ArgList &Args) const { // FIXME: all non-x86 targets need unwind tables, however, LLVM currently does // not know how to emit them. return getArch() == llvm::Triple::x86_64; Modified: vendor/clang/dist/lib/Driver/ToolChains/CrossWindows.h ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/CrossWindows.h Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/CrossWindows.h Sun Aug 20 21:03:30 2017 (r322729) @@ -56,7 +56,7 @@ class LLVM_LIBRARY_VISIBILITY CrossWindowsToolChain : const llvm::opt::ArgList &Args); bool IsIntegratedAssemblerDefault() const override { return true; } - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; Modified: vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -1174,14 +1174,13 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) unsigned Major, Minor, Micro; bool HadExtra; - // iOS 10 is the maximum deployment target for 32-bit targets. - if (iOSVersion && getTriple().isArch32Bit() && - Driver::GetReleaseVersion(iOSVersion->getValue(), Major, Minor, Micro, - HadExtra) && - Major > 10) - getDriver().Diag(diag::err_invalid_ios_deployment_target) - << iOSVersion->getAsString(Args); + // The iOS deployment target that is explicitly specified via a command line + // option or an environment variable. + std::string ExplicitIOSDeploymentTargetStr; + if (iOSVersion) + ExplicitIOSDeploymentTargetStr = iOSVersion->getAsString(Args); + // Add a macro to differentiate between m(iphone|tv|watch)os-version-min=X.Y and // -m(iphone|tv|watch)simulator-version-min=X.Y. if (Args.hasArg(options::OPT_mios_simulator_version_min_EQ) || @@ -1223,13 +1222,9 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) if (char *env = ::getenv("WATCHOS_DEPLOYMENT_TARGET")) WatchOSTarget = env; - // iOS 10 is the maximum deployment target for 32-bit targets. - if (!iOSTarget.empty() && getTriple().isArch32Bit() && - Driver::GetReleaseVersion(iOSTarget.c_str(), Major, Minor, Micro, - HadExtra) && - Major > 10) - getDriver().Diag(diag::err_invalid_ios_deployment_target) - << std::string("IPHONEOS_DEPLOYMENT_TARGET=") + iOSTarget; + if (!iOSTarget.empty()) + ExplicitIOSDeploymentTargetStr = + std::string("IPHONEOS_DEPLOYMENT_TARGET=") + iOSTarget; // If there is no command-line argument to specify the Target version and // no environment variable defined, see if we can set the default based @@ -1393,12 +1388,19 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) HadExtra || Major >= 100 || Minor >= 100 || Micro >= 100) getDriver().Diag(diag::err_drv_invalid_version_number) << iOSVersion->getAsString(Args); - // iOS 10 is the maximum deployment target for 32-bit targets. If the - // inferred deployment target is iOS 11 or later, set it to 10.99. + // For 32-bit targets, the deployment target for iOS has to be earlier than + // iOS 11. if (getTriple().isArch32Bit() && Major >= 11) { - Major = 10; - Minor = 99; - Micro = 99; + // If the deployment target is explicitly specified, print a diagnostic. + if (!ExplicitIOSDeploymentTargetStr.empty()) { + getDriver().Diag(diag::warn_invalid_ios_deployment_target) + << ExplicitIOSDeploymentTargetStr; + // Otherwise, set it to 10.99.99. + } else { + Major = 10; + Minor = 99; + Micro = 99; + } } } else if (Platform == TvOS) { if (!Driver::GetReleaseVersion(TvOSVersion->getValue(), Major, Minor, @@ -1834,8 +1836,8 @@ Darwin::TranslateArgs(const DerivedArgList &Args, Stri return DAL; } -bool MachO::IsUnwindTablesDefault() const { - return getArch() == llvm::Triple::x86_64; +bool MachO::IsUnwindTablesDefault(const ArgList &Args) const { + return !UseSjLjExceptions(Args); } bool MachO::UseDwarfDebugFlags() const { Modified: vendor/clang/dist/lib/Driver/ToolChains/Darwin.h ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/Darwin.h Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/Darwin.h Sun Aug 20 21:03:30 2017 (r322729) @@ -216,7 +216,7 @@ class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain bool UseObjCMixedDispatch() const override { return true; } - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; RuntimeLibType GetDefaultRuntimeLibType() const override { return ToolChain::RLT_CompilerRT; Modified: vendor/clang/dist/lib/Driver/ToolChains/Gnu.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/Gnu.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/Gnu.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -2291,7 +2291,7 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) co CudaInstallation.print(OS); } -bool Generic_GCC::IsUnwindTablesDefault() const { +bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { return getArch() == llvm::Triple::x86_64; } Modified: vendor/clang/dist/lib/Driver/ToolChains/Gnu.h ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/Gnu.h Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/Gnu.h Sun Aug 20 21:03:30 2017 (r322729) @@ -284,7 +284,7 @@ class LLVM_LIBRARY_VISIBILITY Generic_GCC : public Too void printVerboseInfo(raw_ostream &OS) const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; Modified: vendor/clang/dist/lib/Driver/ToolChains/MSVC.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/MSVC.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/MSVC.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -699,7 +699,7 @@ bool MSVCToolChain::IsIntegratedAssemblerDefault() con return true; } -bool MSVCToolChain::IsUnwindTablesDefault() const { +bool MSVCToolChain::IsUnwindTablesDefault(const ArgList &Args) const { // Emit unwind tables by default on Win64. All non-x86_32 Windows platforms // such as ARM and PPC actually require unwind tables, but LLVM doesn't know // how to generate them yet. Modified: vendor/clang/dist/lib/Driver/ToolChains/MSVC.h ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/MSVC.h Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/MSVC.h Sun Aug 20 21:03:30 2017 (r322729) @@ -73,7 +73,7 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public T Action::OffloadKind DeviceOffloadKind) const override; bool IsIntegratedAssemblerDefault() const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; Modified: vendor/clang/dist/lib/Driver/ToolChains/MinGW.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/MinGW.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/MinGW.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -347,7 +347,7 @@ Tool *toolchains::MinGW::buildLinker() const { return new tools::MinGW::Linker(*this); } -bool toolchains::MinGW::IsUnwindTablesDefault() const { +bool toolchains::MinGW::IsUnwindTablesDefault(const ArgList &Args) const { return getArch() == llvm::Triple::x86_64; } Modified: vendor/clang/dist/lib/Driver/ToolChains/MinGW.h ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/MinGW.h Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/MinGW.h Sun Aug 20 21:03:30 2017 (r322729) @@ -60,7 +60,7 @@ class LLVM_LIBRARY_VISIBILITY MinGW : public ToolChain const llvm::opt::ArgList &Args); bool IsIntegratedAssemblerDefault() const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; Modified: vendor/clang/dist/lib/Driver/ToolChains/NetBSD.h ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/NetBSD.h Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Driver/ToolChains/NetBSD.h Sun Aug 20 21:03:30 2017 (r322729) @@ -65,7 +65,10 @@ class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; - bool IsUnwindTablesDefault() const override { return true; } + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override { + return true; + } + SanitizerMask getSupportedSanitizers() const override; protected: Modified: vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp ============================================================================== --- vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -497,6 +497,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const Builder.defineMacro("__cpp_ref_qualifiers", "200710"); Builder.defineMacro("__cpp_alias_templates", "200704"); } + if (LangOpts.ThreadsafeStatics) + Builder.defineMacro("__cpp_threadsafe_static_init", "200806"); // C++14 features. if (LangOpts.CPlusPlus14) { @@ -519,6 +521,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const Builder.defineMacro("__cpp_noexcept_function_type", "201510"); Builder.defineMacro("__cpp_capture_star_this", "201603"); Builder.defineMacro("__cpp_if_constexpr", "201606"); + Builder.defineMacro("__cpp_deduction_guides", "201611"); Builder.defineMacro("__cpp_template_auto", "201606"); Builder.defineMacro("__cpp_namespace_attributes", "201411"); Builder.defineMacro("__cpp_enumerator_attributes", "201411"); @@ -528,8 +531,6 @@ static void InitializeCPlusPlusFeatureTestMacros(const Builder.defineMacro("__cpp_structured_bindings", "201606"); Builder.defineMacro("__cpp_nontype_template_args", "201411"); Builder.defineMacro("__cpp_fold_expressions", "201603"); - // FIXME: This is not yet listed in SD-6. - Builder.defineMacro("__cpp_deduction_guides", "201611"); } if (LangOpts.AlignedAllocation) Builder.defineMacro("__cpp_aligned_new", "201606"); Modified: vendor/clang/dist/lib/Parse/ParseCXXInlineMethods.cpp ============================================================================== --- vendor/clang/dist/lib/Parse/ParseCXXInlineMethods.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Parse/ParseCXXInlineMethods.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -166,20 +166,11 @@ NamedDecl *Parser::ParseCXXInlineMethodDef(AccessSpeci } if (FnD) { - // If this is a friend function, mark that it's late-parsed so that - // it's still known to be a definition even before we attach the - // parsed body. Sema needs to treat friend function definitions - // differently during template instantiation, and it's possible for - // the containing class to be instantiated before all its member - // function definitions are parsed. - // - // If you remove this, you can remove the code that clears the flag - // after parsing the member. - if (D.getDeclSpec().isFriendSpecified()) { - FunctionDecl *FD = FnD->getAsFunction(); - Actions.CheckForFunctionRedefinition(FD); - FD->setLateTemplateParsed(true); - } + FunctionDecl *FD = FnD->getAsFunction(); + // Track that this function will eventually have a body; Sema needs + // to know this. + Actions.CheckForFunctionRedefinition(FD); + FD->setWillHaveBody(true); } else { // If semantic analysis could not build a function declaration, // just throw away the late-parsed declaration. @@ -557,10 +548,6 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) { "current template being instantiated!"); ParseFunctionStatementBody(LM.D, FnScope); - - // Clear the late-template-parsed bit if we set it before. - if (LM.D) - LM.D->getAsFunction()->setLateTemplateParsed(false); while (Tok.isNot(tok::eof)) ConsumeAnyToken(); Modified: vendor/clang/dist/lib/Sema/SemaCast.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaCast.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Sema/SemaCast.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -552,7 +552,14 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualT Qualifiers SrcQuals, DestQuals; Self.Context.getUnqualifiedArrayType(UnwrappedSrcType, SrcQuals); Self.Context.getUnqualifiedArrayType(UnwrappedDestType, DestQuals); - + + // We do not meaningfully track object const-ness of Objective-C object + // types. Remove const from the source type if either the source or + // the destination is an Objective-C object type. + if (UnwrappedSrcType->isObjCObjectType() || + UnwrappedDestType->isObjCObjectType()) + SrcQuals.removeConst(); + Qualifiers RetainedSrcQuals, RetainedDestQuals; if (CheckCVR) { RetainedSrcQuals.setCVRQualifiers(SrcQuals.getCVRQualifiers()); Modified: vendor/clang/dist/lib/Sema/SemaCodeComplete.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaCodeComplete.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Sema/SemaCodeComplete.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -2401,10 +2401,7 @@ formatBlockPlaceholder(const PrintingPolicy &Policy, c static std::string GetDefaultValueString(const ParmVarDecl *Param, const SourceManager &SM, const LangOptions &LangOpts) { - const Expr *defaultArg = Param->getDefaultArg(); - if (!defaultArg) - return ""; - const SourceRange SrcRange = defaultArg->getSourceRange(); + const SourceRange SrcRange = Param->getDefaultArgRange(); CharSourceRange CharSrcRange = CharSourceRange::getTokenRange(SrcRange); bool Invalid = CharSrcRange.isInvalid(); if (Invalid) Modified: vendor/clang/dist/lib/Sema/SemaDecl.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaDecl.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Sema/SemaDecl.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -6999,6 +6999,21 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *Shadow return; } } + + if (cast(ShadowedDecl)->hasLocalStorage()) { + // A variable can't shadow a local variable in an enclosing scope, if + // they are separated by a non-capturing declaration context. + for (DeclContext *ParentDC = NewDC; + ParentDC && !ParentDC->Equals(OldDC); + ParentDC = getLambdaAwareParentOfDeclContext(ParentDC)) { + // Only block literals, captured statements, and lambda expressions + // can capture; other scopes don't. + if (!isa(ParentDC) && !isa(ParentDC) && + !isLambdaCallOperator(ParentDC)) { + return; + } + } + } } } @@ -12075,8 +12090,9 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope FD->setInvalidDecl(); } - // See if this is a redefinition. - if (!FD->isLateTemplateParsed()) { + // See if this is a redefinition. If 'will have body' is already set, then + // these checks were already performed when it was set. + if (!FD->willHaveBody() && !FD->isLateTemplateParsed()) { CheckForFunctionRedefinition(FD, nullptr, SkipBody); // If we're skipping the body, we're done. Don't enter the scope. @@ -13278,6 +13294,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUs AddMsStructLayoutForRecord(RD); } } + New->setLexicalDeclContext(CurContext); return New; }; Modified: vendor/clang/dist/lib/Sema/SemaTemplateInstantiateDecl.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaTemplateInstantiateDecl.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/lib/Sema/SemaTemplateInstantiateDecl.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -3771,6 +3771,8 @@ void Sema::InstantiateFunctionDefinition(SourceLocatio if (PatternDef) { Pattern = PatternDef->getBody(PatternDef); PatternDecl = PatternDef; + if (PatternDef->willHaveBody()) + PatternDef = nullptr; } // FIXME: We need to track the instantiation stack in order to know which Modified: vendor/clang/dist/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp ============================================================================== --- vendor/clang/dist/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++1z -verify -Wc++1z-extensions %s -// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -DEXT -Wc++1z-extensions %s +// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify -Wc++17-extensions %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -DEXT -Wc++17-extensions %s struct [[nodiscard]] S {}; S get_s(); @@ -23,7 +23,7 @@ void f() { } #ifdef EXT -// expected-warning@4 {{use of the 'nodiscard' attribute is a C++1z extension}} -// expected-warning@8 {{use of the 'nodiscard' attribute is a C++1z extension}} -// expected-warning@11 {{use of the 'nodiscard' attribute is a C++1z extension}} +// expected-warning@4 {{use of the 'nodiscard' attribute is a C++17 extension}} +// expected-warning@8 {{use of the 'nodiscard' attribute is a C++17 extension}} +// expected-warning@11 {{use of the 'nodiscard' attribute is a C++17 extension}} #endif Modified: vendor/clang/dist/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp ============================================================================== --- vendor/clang/dist/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp Sun Aug 20 21:02:51 2017 (r322728) +++ vendor/clang/dist/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp Sun Aug 20 21:03:30 2017 (r322729) @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++1z -Wc++1z-extensions -verify %s -// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++11 -Wc++1z-extensions -verify -DEXT %s +// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++17 -Wc++17-extensions -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++11 -Wc++17-extensions -verify -DEXT %s static_assert(__has_cpp_attribute(maybe_unused) == 201603, ""); @@ -20,7 +20,7 @@ void f() { } #ifdef EXT -// expected-warning@6 {{use of the 'maybe_unused' attribute is a C++1z extension}} -// expected-warning@13 {{use of the 'maybe_unused' attribute is a C++1z extension}} -// expected-warning@14 {{use of the 'maybe_unused' attribute is a C++1z extension}} +// expected-warning@6 {{use of the 'maybe_unused' attribute is a C++17 extension}} +// expected-warning@13 {{use of the 'maybe_unused' attribute is a C++17 extension}} +// expected-warning@14 {{use of the 'maybe_unused' attribute is a C++17 extension}} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Aug 20 21:03:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 826FADC8A11; Sun, 20 Aug 2017 21:03:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 347897316C; Sun, 20 Aug 2017 21:03:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KL3iQ1015596; Sun, 20 Aug 2017 21:03:44 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KL3inT015595; Sun, 20 Aug 2017 21:03:44 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708202103.v7KL3inT015595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 20 Aug 2017 21:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322731 - vendor/compiler-rt/compiler-rt-release_50-r311219 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-release_50-r311219 X-SVN-Commit-Revision: 322731 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 21:03:45 -0000 Author: dim Date: Sun Aug 20 21:03:44 2017 New Revision: 322731 URL: https://svnweb.freebsd.org/changeset/base/322731 Log: Tag compiler-rt release_50 branch r311219. Added: vendor/compiler-rt/compiler-rt-release_50-r311219/ - copied from r322730, vendor/compiler-rt/dist/ From owner-svn-src-all@freebsd.org Sun Aug 20 21:03:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E62BDC89E1; Sun, 20 Aug 2017 21:03:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 051C17313C; Sun, 20 Aug 2017 21:03:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KL3fxT015549; Sun, 20 Aug 2017 21:03:41 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KL3fEp015548; Sun, 20 Aug 2017 21:03:41 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708202103.v7KL3fEp015548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 20 Aug 2017 21:03:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322730 - vendor/clang/clang-release_50-r311219 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/clang/clang-release_50-r311219 X-SVN-Commit-Revision: 322730 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 21:03:42 -0000 Author: dim Date: Sun Aug 20 21:03:40 2017 New Revision: 322730 URL: https://svnweb.freebsd.org/changeset/base/322730 Log: Tag clang release_50 branch r311219. Added: vendor/clang/clang-release_50-r311219/ - copied from r322729, vendor/clang/dist/ From owner-svn-src-all@freebsd.org Sun Aug 20 21:03:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F29CBDC8A73; Sun, 20 Aug 2017 21:03:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAA11731F7; Sun, 20 Aug 2017 21:03:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KL3nvo015645; Sun, 20 Aug 2017 21:03:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KL3nJs015644; Sun, 20 Aug 2017 21:03:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708202103.v7KL3nJs015644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 20 Aug 2017 21:03:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322732 - vendor/libc++/dist/include X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/dist/include X-SVN-Commit-Revision: 322732 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 21:03:51 -0000 Author: dim Date: Sun Aug 20 21:03:49 2017 New Revision: 322732 URL: https://svnweb.freebsd.org/changeset/base/322732 Log: Vendor import of libc++ release_50 branch r311219: https://llvm.org/svn/llvm-project/libcxx/branches/release_50@311219 Modified: vendor/libc++/dist/include/string Modified: vendor/libc++/dist/include/string ============================================================================== --- vendor/libc++/dist/include/string Sun Aug 20 21:03:44 2017 (r322731) +++ vendor/libc++/dist/include/string Sun Aug 20 21:03:49 2017 (r322732) @@ -556,6 +556,8 @@ template operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y); +_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+, allocator >(char const*, string const&)) + template class _LIBCPP_TEMPLATE_VIS __basic_string_common { @@ -3999,7 +4001,6 @@ basic_string<_CharT, _Traits, _Allocator>::__subscript _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+, allocator >(char const*, string const&)) #if _LIBCPP_STD_VER > 11 // Literal suffixes for basic_string [basic.string.literals] From owner-svn-src-all@freebsd.org Sun Aug 20 21:03:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17192DC8AAF; Sun, 20 Aug 2017 21:03:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B924973244; Sun, 20 Aug 2017 21:03:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KL3qHJ015693; Sun, 20 Aug 2017 21:03:52 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KL3qKg015692; Sun, 20 Aug 2017 21:03:52 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708202103.v7KL3qKg015692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 20 Aug 2017 21:03:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322733 - vendor/libc++/libc++-release_50-r311219 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-release_50-r311219 X-SVN-Commit-Revision: 322733 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 21:03:54 -0000 Author: dim Date: Sun Aug 20 21:03:52 2017 New Revision: 322733 URL: https://svnweb.freebsd.org/changeset/base/322733 Log: Tag libc++ release_50 branch r311219. Added: vendor/libc++/libc++-release_50-r311219/ - copied from r322732, vendor/libc++/dist/ From owner-svn-src-all@freebsd.org Sun Aug 20 21:04:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82418DC8B63; Sun, 20 Aug 2017 21:04:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B3E473317; Sun, 20 Aug 2017 21:04:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KL40K6015797; Sun, 20 Aug 2017 21:04:00 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KL40Dh015796; Sun, 20 Aug 2017 21:04:00 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708202104.v7KL40Dh015796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 20 Aug 2017 21:04:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322735 - vendor/lld/lld-release_50-r311219 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-release_50-r311219 X-SVN-Commit-Revision: 322735 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 21:04:01 -0000 Author: dim Date: Sun Aug 20 21:04:00 2017 New Revision: 322735 URL: https://svnweb.freebsd.org/changeset/base/322735 Log: Tag lld release_50 branch r311219. Added: vendor/lld/lld-release_50-r311219/ - copied from r322734, vendor/lld/dist/ From owner-svn-src-all@freebsd.org Sun Aug 20 21:04:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6756FDC8BB6; Sun, 20 Aug 2017 21:04:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1672773391; Sun, 20 Aug 2017 21:04:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KL44Ys015845; Sun, 20 Aug 2017 21:04:04 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KL44cP015844; Sun, 20 Aug 2017 21:04:04 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708202104.v7KL44cP015844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 20 Aug 2017 21:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322736 - vendor/lldb/lldb-release_50-r311219 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-release_50-r311219 X-SVN-Commit-Revision: 322736 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 21:04:05 -0000 Author: dim Date: Sun Aug 20 21:04:03 2017 New Revision: 322736 URL: https://svnweb.freebsd.org/changeset/base/322736 Log: Tag lldb release_50 branch r311219. Added: vendor/lldb/lldb-release_50-r311219/ - copied from r322735, vendor/lldb/dist/ From owner-svn-src-all@freebsd.org Sun Aug 20 21:03:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A9A5DC8AE4; Sun, 20 Aug 2017 21:03:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E767873296; Sun, 20 Aug 2017 21:03:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KL3uaD015746; Sun, 20 Aug 2017 21:03:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KL3t98015740; Sun, 20 Aug 2017 21:03:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708202103.v7KL3t98015740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 20 Aug 2017 21:03:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322734 - in vendor/lld/dist: COFF ELF test/COFF test/ELF X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lld/dist: COFF ELF test/COFF test/ELF X-SVN-Commit-Revision: 322734 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 21:03:57 -0000 Author: dim Date: Sun Aug 20 21:03:55 2017 New Revision: 322734 URL: https://svnweb.freebsd.org/changeset/base/322734 Log: Vendor import of lld release_50 branch r311219: https://llvm.org/svn/llvm-project/lld/branches/release_50@311219 Added: vendor/lld/dist/test/ELF/icf-none.s (contents, props changed) Modified: vendor/lld/dist/COFF/Driver.cpp vendor/lld/dist/ELF/Driver.cpp vendor/lld/dist/ELF/Options.td vendor/lld/dist/test/COFF/def-export-stdcall.s vendor/lld/dist/test/COFF/export.test Modified: vendor/lld/dist/COFF/Driver.cpp ============================================================================== --- vendor/lld/dist/COFF/Driver.cpp Sun Aug 20 21:03:52 2017 (r322733) +++ vendor/lld/dist/COFF/Driver.cpp Sun Aug 20 21:03:55 2017 (r322734) @@ -458,8 +458,8 @@ static void createImportLibrary(bool AsLib) { std::vector Exports; for (Export &E1 : Config->Exports) { COFFShortExport E2; - // Use SymbolName, which will have any stdcall or fastcall qualifiers. - E2.Name = E1.SymbolName; + E2.Name = E1.Name; + E2.SymbolName = E1.SymbolName; E2.ExtName = E1.ExtName; E2.Ordinal = E1.Ordinal; E2.Noname = E1.Noname; @@ -470,7 +470,7 @@ static void createImportLibrary(bool AsLib) { } writeImportLibrary(getImportName(AsLib), getImplibPath(), Exports, - Config->Machine); + Config->Machine, false); } static void parseModuleDefs(StringRef Path) { Modified: vendor/lld/dist/ELF/Driver.cpp ============================================================================== --- vendor/lld/dist/ELF/Driver.cpp Sun Aug 20 21:03:52 2017 (r322733) +++ vendor/lld/dist/ELF/Driver.cpp Sun Aug 20 21:03:55 2017 (r322734) @@ -638,7 +638,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args Config->Fini = Args.getLastArgValue(OPT_fini, "_fini"); Config->GcSections = getArg(Args, OPT_gc_sections, OPT_no_gc_sections, false); Config->GdbIndex = Args.hasArg(OPT_gdb_index); - Config->ICF = Args.hasArg(OPT_icf); + Config->ICF = getArg(Args, OPT_icf_all, OPT_icf_none, false); Config->Init = Args.getLastArgValue(OPT_init, "_init"); Config->LTOAAPipeline = Args.getLastArgValue(OPT_lto_aa_pipeline); Config->LTONewPmPasses = Args.getLastArgValue(OPT_lto_newpm_passes); Modified: vendor/lld/dist/ELF/Options.td ============================================================================== --- vendor/lld/dist/ELF/Options.td Sun Aug 20 21:03:52 2017 (r322733) +++ vendor/lld/dist/ELF/Options.td Sun Aug 20 21:03:55 2017 (r322734) @@ -126,7 +126,9 @@ def hash_style: S<"hash-style">, def help: F<"help">, HelpText<"Print option help">; -def icf: F<"icf=all">, HelpText<"Enable identical code folding">; +def icf_all: F<"icf=all">, HelpText<"Enable identical code folding">; + +def icf_none: F<"icf=none">, HelpText<"Disable identical code folding">; def image_base : J<"image-base=">, HelpText<"Set the base address">; Modified: vendor/lld/dist/test/COFF/def-export-stdcall.s ============================================================================== --- vendor/lld/dist/test/COFF/def-export-stdcall.s Sun Aug 20 21:03:52 2017 (r322733) +++ vendor/lld/dist/test/COFF/def-export-stdcall.s Sun Aug 20 21:03:55 2017 (r322734) @@ -2,7 +2,8 @@ # RUN: llvm-mc -filetype=obj -triple=i686-windows-msvc %s -o %t.obj # RUN: echo -e "LIBRARY foo\nEXPORTS\n stdcall" > %t.def # RUN: lld-link -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib -# RUN: llvm-nm %t.lib | FileCheck %s +# RUN: llvm-readobj %t.lib | FileCheck %s +# CHECK: Name type: undecorate # CHECK: __imp__stdcall@8 # CHECK: _stdcall@8 Modified: vendor/lld/dist/test/COFF/export.test ============================================================================== --- vendor/lld/dist/test/COFF/export.test Sun Aug 20 21:03:52 2017 (r322733) +++ vendor/lld/dist/test/COFF/export.test Sun Aug 20 21:03:55 2017 (r322734) @@ -39,8 +39,9 @@ CHECK3-NEXT: 4 0 CHECK3-NEXT: 5 0x1008 CHECK3-NEXT: 6 0x1010 exportfn2 -# RUN: lld-link /out:%t.dll /dll %t.obj /export:f1=exportfn1 /export:f2=exportfn2 +# RUN: lld-link /out:%t.dll /dll %t.obj /export:f1=exportfn1 /export:f2=exportfn2 /implib:%t.lib # RUN: llvm-objdump -p %t.dll | FileCheck -check-prefix=CHECK4 %s +# RUN: llvm-nm %t.lib | FileCheck -check-prefix=CHECK4-NM %s CHECK4: Export Table: CHECK4: DLL name: export.test.tmp.dll @@ -49,6 +50,8 @@ CHECK4-NEXT: 0 0 CHECK4-NEXT: 1 0x1010 exportfn3 CHECK4-NEXT: 2 0x1008 f1 CHECK4-NEXT: 3 0x1010 f2 +CHECK4-NM: 00000000 T f1 +CHECK4-NM: 00000000 T f2 # RUN: echo "EXPORTS exportfn1 @3" > %t.def # RUN: echo "fn2=exportfn2 @2" >> %t.def Added: vendor/lld/dist/test/ELF/icf-none.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/test/ELF/icf-none.s Sun Aug 20 21:03:55 2017 (r322734) @@ -0,0 +1,22 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld %t -o %t2 --icf=all --icf=none --verbose | FileCheck %s + +# CHECK-NOT: selected .text.f1 + +.globl _start, f1, f2 +_start: + ret + +.section .text.f1, "ax" +f1: + mov $60, %rax + mov $42, %rdi + syscall + +.section .text.f2, "ax" +f2: + mov $60, %rax + mov $42, %rdi + syscall From owner-svn-src-all@freebsd.org Sun Aug 20 21:21:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27683DCC239; Sun, 20 Aug 2017 21:21:48 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E853B7425C; Sun, 20 Aug 2017 21:21:47 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KLLlZW022633; Sun, 20 Aug 2017 21:21:47 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KLLkLY022631; Sun, 20 Aug 2017 21:21:46 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708202121.v7KLLkLY022631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 20 Aug 2017 21:21:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322737 - in stable/10: etc/pkg release/pkg_repos X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/10: etc/pkg release/pkg_repos X-SVN-Commit-Revision: 322737 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 21:21:48 -0000 Author: marius Date: Sun Aug 20 21:21:46 2017 New Revision: 322737 URL: https://svnweb.freebsd.org/changeset/base/322737 Log: Switch the pkg(8) configuration for the default installation and the dvd1.iso to use the quarterly set, i. e. 2017Q3, during the 10.4-BETA phase. Approved by: re (implicit) Modified: stable/10/etc/pkg/FreeBSD.conf stable/10/release/pkg_repos/release-dvd.conf Modified: stable/10/etc/pkg/FreeBSD.conf ============================================================================== --- stable/10/etc/pkg/FreeBSD.conf Sun Aug 20 21:04:03 2017 (r322736) +++ stable/10/etc/pkg/FreeBSD.conf Sun Aug 20 21:21:46 2017 (r322737) @@ -8,7 +8,7 @@ # FreeBSD: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", Modified: stable/10/release/pkg_repos/release-dvd.conf ============================================================================== --- stable/10/release/pkg_repos/release-dvd.conf Sun Aug 20 21:04:03 2017 (r322736) +++ stable/10/release/pkg_repos/release-dvd.conf Sun Aug 20 21:21:46 2017 (r322737) @@ -1,6 +1,6 @@ # $FreeBSD$ release: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", From owner-svn-src-all@freebsd.org Sun Aug 20 23:05:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 216BDDD3D0E; Sun, 20 Aug 2017 23:05:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF4B177060; Sun, 20 Aug 2017 23:05:37 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7KN5b2l064715; Sun, 20 Aug 2017 23:05:37 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7KN5bmT064713; Sun, 20 Aug 2017 23:05:37 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708202305.v7KN5bmT064713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 20 Aug 2017 23:05:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322738 - stable/11/sys/fs/ext2fs X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/sys/fs/ext2fs X-SVN-Commit-Revision: 322738 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 23:05:38 -0000 Author: pfg Date: Sun Aug 20 23:05:36 2017 New Revision: 322738 URL: https://svnweb.freebsd.org/changeset/base/322738 Log: MFC r320578: ext2fs: be more verbose about unsupported ext2fs features. It is useful to know exactly what features may be lacking when trying to mount ext4 filesystems. Submitted by: Fedor Uporov Modified: stable/11/sys/fs/ext2fs/ext2_vfsops.c stable/11/sys/fs/ext2fs/ext2fs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/11/sys/fs/ext2fs/ext2_vfsops.c Sun Aug 20 21:21:46 2017 (r322737) +++ stable/11/sys/fs/ext2fs/ext2_vfsops.c Sun Aug 20 23:05:36 2017 (r322738) @@ -279,6 +279,7 @@ ext2_mount(struct mount *mp) static int ext2_check_sb_compat(struct ext2fs *es, struct cdev *dev, int ronly) { + uint32_t i, mask; if (es->e2fs_magic != E2FS_MAGIC) { printf("ext2fs: %s: wrong magic number %#x (expected %#x)\n", @@ -286,17 +287,29 @@ ext2_check_sb_compat(struct ext2fs *es, struct cdev *d return (1); } if (es->e2fs_rev > E2FS_REV0) { - if (es->e2fs_features_incompat & ~(EXT2F_INCOMPAT_SUPP | - EXT4F_RO_INCOMPAT_SUPP)) { - printf( -"WARNING: mount of %s denied due to unsupported optional features\n", - devtoname(dev)); + mask = es->e2fs_features_incompat & ~(EXT2F_INCOMPAT_SUPP | + EXT4F_RO_INCOMPAT_SUPP); + if (mask) { + printf("WARNING: mount of %s denied due to " + "unsupported optional features:\n", devtoname(dev)); + for (i = 0; + i < sizeof(incompat)/sizeof(struct ext2_feature); + i++) + if (mask & incompat[i].mask) + printf("%s ", incompat[i].name); + printf("\n"); return (1); } - if (!ronly && - (es->e2fs_features_rocompat & ~EXT2F_ROCOMPAT_SUPP)) { + mask = es->e2fs_features_rocompat & ~EXT2F_ROCOMPAT_SUPP; + if (!ronly && mask) { printf("WARNING: R/W mount of %s denied due to " - "unsupported optional features\n", devtoname(dev)); + "unsupported optional features:\n", devtoname(dev)); + for (i = 0; + i < sizeof(ro_compat)/sizeof(struct ext2_feature); + i++) + if (mask & ro_compat[i].mask) + printf("%s ", ro_compat[i].name); + printf("\n"); return (1); } } Modified: stable/11/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/11/sys/fs/ext2fs/ext2fs.h Sun Aug 20 21:21:46 2017 (r322737) +++ stable/11/sys/fs/ext2fs/ext2fs.h Sun Aug 20 23:05:36 2017 (r322738) @@ -203,10 +203,13 @@ struct csum { * compatible/incompatible features */ #define EXT2F_COMPAT_PREALLOC 0x0001 +#define EXT2F_COMPAT_IMAGIC_INODES 0x0002 #define EXT2F_COMPAT_HASJOURNAL 0x0004 #define EXT2F_COMPAT_EXT_ATTR 0x0008 #define EXT2F_COMPAT_RESIZE 0x0010 #define EXT2F_COMPAT_DIRHASHINDEX 0x0020 +#define EXT2F_COMPAT_LAZY_BG 0x0040 +#define EXT2F_COMPAT_EXCLUDE_BITMAP 0x0100 #define EXT2F_COMPAT_SPARSESUPER2 0x0200 #define EXT2F_ROCOMPAT_SPARSESUPER 0x0001 @@ -216,15 +219,18 @@ struct csum { #define EXT2F_ROCOMPAT_GDT_CSUM 0x0010 #define EXT2F_ROCOMPAT_DIR_NLINK 0x0020 #define EXT2F_ROCOMPAT_EXTRA_ISIZE 0x0040 +#define EXT2F_ROCOMPAT_HAS_SNAPSHOT 0x0080 #define EXT2F_ROCOMPAT_QUOTA 0x0100 #define EXT2F_ROCOMPAT_BIGALLOC 0x0200 #define EXT2F_ROCOMPAT_METADATA_CKSUM 0x0400 +#define EXT2F_ROCOMPAT_REPLICA 0x0800 #define EXT2F_ROCOMPAT_READONLY 0x1000 #define EXT2F_ROCOMPAT_PROJECT 0x2000 #define EXT2F_INCOMPAT_COMP 0x0001 #define EXT2F_INCOMPAT_FTYPE 0x0002 #define EXT2F_INCOMPAT_RECOVER 0x0004 +#define EXT2F_INCOMPAT_JOURNAL_DEV 0x0008 #define EXT2F_INCOMPAT_META_BG 0x0010 #define EXT2F_INCOMPAT_EXTENTS 0x0040 #define EXT2F_INCOMPAT_64BIT 0x0080 @@ -236,6 +242,58 @@ struct csum { #define EXT2F_INCOMPAT_LARGEDIR 0x4000 #define EXT2F_INCOMPAT_INLINE_DATA 0x8000 #define EXT2F_INCOMPAT_ENCRYPT 0x10000 + +struct ext2_feature +{ + int mask; + const char *name; +}; + +static const struct ext2_feature compat[] = { + { EXT2F_COMPAT_PREALLOC, "dir_prealloc" }, + { EXT2F_COMPAT_IMAGIC_INODES, "imagic_inodes" }, + { EXT2F_COMPAT_HASJOURNAL, "has_journal" }, + { EXT2F_COMPAT_EXT_ATTR, "ext_attr" }, + { EXT2F_COMPAT_RESIZE, "resize_inode" }, + { EXT2F_COMPAT_DIRHASHINDEX, "dir_index" }, + { EXT2F_COMPAT_EXCLUDE_BITMAP, "snapshot_bitmap" }, + { EXT2F_COMPAT_SPARSESUPER2, "sparse_super2" } +}; + +static const struct ext2_feature ro_compat[] = { + { EXT2F_ROCOMPAT_SPARSESUPER, "sparse_super" }, + { EXT2F_ROCOMPAT_LARGEFILE, "large_file" }, + { EXT2F_ROCOMPAT_BTREE_DIR, "btree_dir" }, + { EXT2F_ROCOMPAT_HUGE_FILE, "huge_file" }, + { EXT2F_ROCOMPAT_GDT_CSUM, "uninit_groups" }, + { EXT2F_ROCOMPAT_DIR_NLINK, "dir_nlink" }, + { EXT2F_ROCOMPAT_EXTRA_ISIZE, "extra_isize" }, + { EXT2F_ROCOMPAT_HAS_SNAPSHOT, "snapshot" }, + { EXT2F_ROCOMPAT_QUOTA, "quota" }, + { EXT2F_ROCOMPAT_BIGALLOC, "bigalloc" }, + { EXT2F_ROCOMPAT_METADATA_CKSUM, "metadata_csum" }, + { EXT2F_ROCOMPAT_REPLICA, "replica" }, + { EXT2F_ROCOMPAT_READONLY, "ro" }, + { EXT2F_ROCOMPAT_PROJECT, "project" } +}; + +static const struct ext2_feature incompat[] = { + { EXT2F_INCOMPAT_COMP, "compression" }, + { EXT2F_INCOMPAT_FTYPE, "filetype" }, + { EXT2F_INCOMPAT_RECOVER, "needs_recovery" }, + { EXT2F_INCOMPAT_JOURNAL_DEV, "journal_dev" }, + { EXT2F_INCOMPAT_META_BG, "meta_bg" }, + { EXT2F_INCOMPAT_EXTENTS, "extents" }, + { EXT2F_INCOMPAT_64BIT, "64bit" }, + { EXT2F_INCOMPAT_MMP, "mmp" }, + { EXT2F_INCOMPAT_FLEX_BG, "flex_bg" }, + { EXT2F_INCOMPAT_EA_INODE, "ea_inode" }, + { EXT2F_INCOMPAT_DIRDATA, "dirdata" }, + { EXT2F_INCOMPAT_CSUM_SEED, "metadata_csum_seed" }, + { EXT2F_INCOMPAT_LARGEDIR, "large_dir" }, + { EXT2F_INCOMPAT_INLINE_DATA, "inline_data" }, + { EXT2F_INCOMPAT_ENCRYPT, "encrypt" } +}; /* * Features supported in this implementation From owner-svn-src-all@freebsd.org Mon Aug 21 05:25:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13D46DE982E; Mon, 21 Aug 2017 05:25:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE12CC4E; Mon, 21 Aug 2017 05:25:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7L5PV1H019028; Mon, 21 Aug 2017 05:25:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7L5PVO9019026; Mon, 21 Aug 2017 05:25:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708210525.v7L5PVO9019026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 21 Aug 2017 05:25:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322739 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/10/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 322739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 05:25:32 -0000 Author: sephe Date: Mon Aug 21 05:25:30 2017 New Revision: 322739 URL: https://svnweb.freebsd.org/changeset/base/322739 Log: MFC 322299,322483,322485-322487 322299 hyperv/hn: Implement transparent mode network VF. How network VF works with hn(4) on Hyper-V in transparent mode: - Each network VF has a cooresponding hn(4). - The network VF and the it's cooresponding hn(4) have the same hardware address. - Once the network VF is attached, the cooresponding hn(4) waits several seconds to make sure that the network VF attach routing completes, then: o Set the intersection of the network VF's if_capabilities and the cooresponding hn(4)'s if_capabilities to the cooresponding hn(4)'s if_capabilities. And adjust the cooresponding hn(4) if_capable and if_hwassist accordingly. (*) o Make sure that the cooresponding hn(4)'s TSO parameters meet the constraints posed by both the network VF and the cooresponding hn(4). (*) o The network VF's if_input is overridden. The overriding if_input changes the input packet's rcvif to the cooreponding hn(4). The network layers are tricked into thinking that all packets are neceived by the cooresponding hn(4). o If the cooresponding hn(4) was brought up, bring up the network VF. The transmission dispatched to the cooresponding hn(4) are redispatched to the network VF. o Bringing down the cooresponding hn(4) also brings down the network VF. o All IOCTLs issued to the cooresponding hn(4) are pass-through'ed to the network VF; the cooresponding hn(4) changes its internal state if necessary. o The media status of the cooresponding hn(4) solely relies on the network VF. o If there are multicast filters on the cooresponding hn(4), allmulti will be enabled on the network VF. (**) - Once the network VF is detached. Undo all damages did to the cooresponding hn(4) in the above item. NOTE: No operation should be issued directly to the network VF, if the network VF transparent mode is enabled. The network VF transparent mode can be enabled by setting tunable hw.hn.vf_transparent to 1. The network VF transparent mode is _not_ enabled by default, as of this commit. The benefit of the network VF transparent mode is that the network VF attachment and detachment are transparent to all network layers; e.g. live migration detaches and reattaches the network VF. The major drawbacks of the network VF transparent mode: - The netmap(4) support is lost, even if the VF supports it. - ALTQ does not work, since if_start method cannot be properly supported. (*) These decisions were made so that things will not be messed up too much during the transition period. (**) This does _not_ need to go through the fancy multicast filter management stuffs like what vlan(4) has, at least currently: - As of this write, multicast does not work in Azure. - As of this write, multicast packets go through the cooresponding hn(4). Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11803 322483 hyperv/hn: Update VF's ibytes properly under transparent VF mode. While, I'm here add comment about why updating VF's imcast stat is not necessary. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11948 322485 hyperv/hn: Fix/enhance receiving path when VF is activated. - Update hn(4)'s stats properly for non-transparent mode VF. - Allow BPF tapping to hn(4) for non-transparent mode VF. - Don't setup mbuf hash, if 'options RSS' is set. In Azure, when VF is activated, TCP SYN and SYN|ACK go through hn(4) while the rest of segments and ACKs belonging to the same TCP 4-tuple go through the VF. So don't setup mbuf hash, if a VF is activated and 'options RSS' is not enabled. hn(4) and the VF may use neither the same RSS hash key nor the same RSS hash function, so the hash value for packets belonging to the same flow could be different! - Disable LRO. hn(4) will only receive broadcast packets, multicast packets, TCP SYN and SYN|ACK (in Azure), LRO is useless for these packet types. For non-transparent, we definitely _cannot_ enable LRO at all, since the LRO flush will use hn(4) as the receiving interface; i.e. hn_ifp->if_input(hn_ifp, m). While I'm here, remove unapplied comment and minor style change. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11978 322486 hyperv/hn: Minor cleanup Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11979 322487 hyperv/hn: Re-set datapath after synthetic parts reattached. Do this even for non-transparent mode VF. Better safe than sorry. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11981 Approved by: re (delphij) Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c stable/10/sys/dev/hyperv/netvsc/if_hnreg.h stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hn.c Sun Aug 20 23:05:36 2017 (r322738) +++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 21 05:25:30 2017 (r322739) @@ -122,6 +122,8 @@ __FBSDID("$FreeBSD$"); #define HN_VFMAP_SIZE_DEF 8 +#define HN_XPNT_VF_ATTWAIT_MIN 2 /* seconds */ + /* YYY should get it from the underlying channel */ #define HN_TX_DESC_CNT 512 @@ -258,6 +260,7 @@ static void hn_ifnet_event(void *, struct ifnet *, i static void hn_ifaddr_event(void *, struct ifnet *); static void hn_ifnet_attevent(void *, struct ifnet *); static void hn_ifnet_detevent(void *, struct ifnet *); +static void hn_ifnet_lnkevent(void *, struct ifnet *, int); static bool hn_ismyvf(const struct hn_softc *, const struct ifnet *); @@ -265,6 +268,17 @@ static void hn_rxvf_change(struct hn_softc *, struct ifnet *, bool); static void hn_rxvf_set(struct hn_softc *, struct ifnet *); static void hn_rxvf_set_task(void *, int); +static void hn_xpnt_vf_input(struct ifnet *, struct mbuf *); +static int hn_xpnt_vf_iocsetflags(struct hn_softc *); +static int hn_xpnt_vf_iocsetcaps(struct hn_softc *, + struct ifreq *); +static void hn_xpnt_vf_saveifflags(struct hn_softc *); +static bool hn_xpnt_vf_isready(struct hn_softc *); +static void hn_xpnt_vf_setready(struct hn_softc *); +static void hn_xpnt_vf_init_taskfunc(void *, int); +static void hn_xpnt_vf_init(struct hn_softc *); +static void hn_xpnt_vf_setenable(struct hn_softc *); +static void hn_xpnt_vf_setdisable(struct hn_softc *, bool); static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); @@ -315,6 +329,8 @@ static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vflist_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_xpnt_vf_accbpf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_xpnt_vf_enabled_sysctl(SYSCTL_HANDLER_ARGS); static void hn_stop(struct hn_softc *, bool); static void hn_init_locked(struct hn_softc *); @@ -345,6 +361,7 @@ static void hn_disable_rx(struct hn_softc *); static void hn_drain_rxtx(struct hn_softc *, int); static void hn_polling(struct hn_softc *, u_int); static void hn_chan_polling(struct vmbus_channel *, u_int); +static void hn_mtu_change_fixup(struct hn_softc *); static void hn_update_link_status(struct hn_softc *); static void hn_change_network(struct hn_softc *); @@ -520,6 +537,22 @@ SYSCTL_PROC(_hw_hn, OID_AUTO, vflist, CTLFLAG_RD | CTL SYSCTL_PROC(_hw_hn, OID_AUTO, vfmap, CTLFLAG_RD | CTLTYPE_STRING, 0, 0, hn_vfmap_sysctl, "A", "VF mapping"); +/* Transparent VF */ +static int hn_xpnt_vf = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_transparent, CTLFLAG_RDTUN, + &hn_xpnt_vf, 0, "Transparent VF mod"); + +/* Accurate BPF support for Transparent VF */ +static int hn_xpnt_vf_accbpf = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_xpnt_accbpf, CTLFLAG_RDTUN, + &hn_xpnt_vf_accbpf, 0, "Accurate BPF for transparent VF"); + +/* Extra wait for transparent VF attach routing; unit seconds. */ +static int hn_xpnt_vf_attwait = HN_XPNT_VF_ATTWAIT_MIN; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_xpnt_attwait, CTLFLAG_RWTUN, + &hn_xpnt_vf_attwait, 0, + "Extra wait for transparent VF attach routing; unit: seconds"); + static u_int hn_cpu_index; /* next CPU for channel */ static struct taskqueue **hn_tx_taskque;/* shared TX taskqueues */ @@ -536,6 +569,12 @@ hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa }; +static const struct hyperv_guid hn_guid = { + .hv_guid = { + 0x63, 0x51, 0x61, 0xf8, 0x3e, 0xdf, 0xc5, 0x46, + 0x91, 0x3f, 0xf2, 0xd2, 0xf9, 0x65, 0xed, 0x0e } +}; + static device_method_t hn_methods[] = { /* Device interface */ DEVMETHOD(device_probe, hn_probe), @@ -796,8 +835,12 @@ hn_rxfilter_config(struct hn_softc *sc) HN_LOCK_ASSERT(sc); - if ((ifp->if_flags & IFF_PROMISC) || - (sc->hn_flags & HN_FLAG_RXVF)) { + /* + * If the non-transparent mode VF is activated, we don't know how + * its RX filter is configured, so stick the synthetic device in + * the promiscous mode. + */ + if ((ifp->if_flags & IFF_PROMISC) || (sc->hn_flags & HN_FLAG_RXVF)) { filter = NDIS_PACKET_TYPE_PROMISCUOUS; } else { filter = NDIS_PACKET_TYPE_DIRECTED; @@ -1073,7 +1116,7 @@ hn_rxvf_change(struct hn_softc *sc, struct ifnet *ifp, } hn_nvs_set_datapath(sc, - rxvf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTHETIC); + rxvf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTH); hn_rxvf_set(sc, rxvf ? ifp : NULL); @@ -1113,7 +1156,376 @@ hn_ifaddr_event(void *arg, struct ifnet *ifp) hn_rxvf_change(arg, ifp, ifp->if_flags & IFF_UP); } +static int +hn_xpnt_vf_iocsetcaps(struct hn_softc *sc, struct ifreq *ifr) +{ + struct ifnet *ifp, *vf_ifp; + uint64_t tmp; + int error; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + vf_ifp = sc->hn_vf_ifp; + + /* + * Fix up requested capabilities w/ supported capabilities, + * since the supported capabilities could have been changed. + */ + ifr->ifr_reqcap &= ifp->if_capabilities; + /* Pass SIOCSIFCAP to VF. */ + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFCAP, (caddr_t)ifr); + + /* + * NOTE: + * The error will be propagated to the callers, however, it + * is _not_ useful here. + */ + + /* + * Merge VF's enabled capabilities. + */ + ifp->if_capenable = vf_ifp->if_capenable & ifp->if_capabilities; + + tmp = vf_ifp->if_hwassist & HN_CSUM_IP_HWASSIST(sc); + if (ifp->if_capenable & IFCAP_TXCSUM) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & HN_CSUM_IP6_HWASSIST(sc); + if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & CSUM_IP_TSO; + if (ifp->if_capenable & IFCAP_TSO4) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & CSUM_IP6_TSO; + if (ifp->if_capenable & IFCAP_TSO6) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + return (error); +} + +static int +hn_xpnt_vf_iocsetflags(struct hn_softc *sc) +{ + struct ifnet *vf_ifp; + struct ifreq ifr; + + HN_LOCK_ASSERT(sc); + vf_ifp = sc->hn_vf_ifp; + + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_flags = vf_ifp->if_flags & 0xffff; + ifr.ifr_flagshigh = vf_ifp->if_flags >> 16; + return (vf_ifp->if_ioctl(vf_ifp, SIOCSIFFLAGS, (caddr_t)&ifr)); +} + static void +hn_xpnt_vf_saveifflags(struct hn_softc *sc) +{ + struct ifnet *ifp = sc->hn_ifp; + int allmulti = 0; + + HN_LOCK_ASSERT(sc); + + /* XXX vlan(4) style mcast addr maintenance */ + if (!TAILQ_EMPTY(&ifp->if_multiaddrs)) + allmulti = IFF_ALLMULTI; + + /* Always set the VF's if_flags */ + sc->hn_vf_ifp->if_flags = ifp->if_flags | allmulti; +} + +static void +hn_xpnt_vf_input(struct ifnet *vf_ifp, struct mbuf *m) +{ + struct rm_priotracker pt; + struct ifnet *hn_ifp = NULL; + struct mbuf *mn; + + /* + * XXX racy, if hn(4) ever detached. + */ + rm_rlock(&hn_vfmap_lock, &pt); + if (vf_ifp->if_index < hn_vfmap_size) + hn_ifp = hn_vfmap[vf_ifp->if_index]; + rm_runlock(&hn_vfmap_lock, &pt); + + if (hn_ifp != NULL) { + for (mn = m; mn != NULL; mn = mn->m_nextpkt) { + /* + * Allow tapping on the VF. + */ + ETHER_BPF_MTAP(vf_ifp, mn); + + /* + * Update VF stats. + */ + if ((vf_ifp->if_capenable & IFCAP_HWSTATS) == 0) { + if_inc_counter(vf_ifp, IFCOUNTER_IBYTES, + mn->m_pkthdr.len); + } + /* + * XXX IFCOUNTER_IMCAST + * This stat updating is kinda invasive, since it + * requires two checks on the mbuf: the length check + * and the ethernet header check. As of this write, + * all multicast packets go directly to hn(4), which + * makes imcast stat updating in the VF a try in vian. + */ + + /* + * Fix up rcvif and increase hn(4)'s ipackets. + */ + mn->m_pkthdr.rcvif = hn_ifp; + if_inc_counter(hn_ifp, IFCOUNTER_IPACKETS, 1); + } + /* + * Go through hn(4)'s if_input. + */ + hn_ifp->if_input(hn_ifp, m); + } else { + /* + * In the middle of the transition; free this + * mbuf chain. + */ + while (m != NULL) { + mn = m->m_nextpkt; + m->m_nextpkt = NULL; + m_freem(m); + m = mn; + } + } +} + +static void +hn_mtu_change_fixup(struct hn_softc *sc) +{ + struct ifnet *ifp; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + + hn_set_tso_maxsize(sc, hn_tso_maxlen, ifp->if_mtu); +#if __FreeBSD_version >= 1100099 + if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < HN_LRO_LENLIM_MIN(ifp)) + hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); +#endif +} + +static void +hn_xpnt_vf_setready(struct hn_softc *sc) +{ + struct ifnet *ifp, *vf_ifp; + struct ifreq ifr; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + vf_ifp = sc->hn_vf_ifp; + + /* + * Mark the VF ready. + */ + sc->hn_vf_rdytick = 0; + + /* + * Save information for restoration. + */ + sc->hn_saved_caps = ifp->if_capabilities; + sc->hn_saved_tsomax = ifp->if_hw_tsomax; + sc->hn_saved_tsosegcnt = ifp->if_hw_tsomaxsegcount; + sc->hn_saved_tsosegsz = ifp->if_hw_tsomaxsegsize; + + /* + * Intersect supported/enabled capabilities. + * + * NOTE: + * if_hwassist is not changed here. + */ + ifp->if_capabilities &= vf_ifp->if_capabilities; + ifp->if_capenable &= ifp->if_capabilities; + + /* + * Fix TSO settings. + */ + if (ifp->if_hw_tsomax > vf_ifp->if_hw_tsomax) + ifp->if_hw_tsomax = vf_ifp->if_hw_tsomax; + if (ifp->if_hw_tsomaxsegcount > vf_ifp->if_hw_tsomaxsegcount) + ifp->if_hw_tsomaxsegcount = vf_ifp->if_hw_tsomaxsegcount; + if (ifp->if_hw_tsomaxsegsize > vf_ifp->if_hw_tsomaxsegsize) + ifp->if_hw_tsomaxsegsize = vf_ifp->if_hw_tsomaxsegsize; + + /* + * Change VF's enabled capabilities. + */ + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_reqcap = ifp->if_capenable; + hn_xpnt_vf_iocsetcaps(sc, &ifr); + + if (ifp->if_mtu != ETHERMTU) { + int error; + + /* + * Change VF's MTU. + */ + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_mtu = ifp->if_mtu; + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFMTU, (caddr_t)&ifr); + if (error) { + if_printf(ifp, "%s SIOCSIFMTU %lu failed\n", + vf_ifp->if_xname, ifp->if_mtu); + if (ifp->if_mtu > ETHERMTU) { + if_printf(ifp, "change MTU to %d\n", ETHERMTU); + + /* + * XXX + * No need to adjust the synthetic parts' MTU; + * failure of the adjustment will cause us + * infinite headache. + */ + ifp->if_mtu = ETHERMTU; + hn_mtu_change_fixup(sc); + } + } + } +} + +static bool +hn_xpnt_vf_isready(struct hn_softc *sc) +{ + + HN_LOCK_ASSERT(sc); + + if (!hn_xpnt_vf || sc->hn_vf_ifp == NULL) + return (false); + + if (sc->hn_vf_rdytick == 0) + return (true); + + if (sc->hn_vf_rdytick > ticks) + return (false); + + /* Mark VF as ready. */ + hn_xpnt_vf_setready(sc); + return (true); +} + +static void +hn_xpnt_vf_setenable(struct hn_softc *sc) +{ + int i; + + HN_LOCK_ASSERT(sc); + + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + sc->hn_xvf_flags |= HN_XVFFLAG_ENABLED; + rm_wunlock(&sc->hn_vf_lock); + + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) + sc->hn_rx_ring[i].hn_rx_flags |= HN_RX_FLAG_XPNT_VF; +} + +static void +hn_xpnt_vf_setdisable(struct hn_softc *sc, bool clear_vf) +{ + int i; + + HN_LOCK_ASSERT(sc); + + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + sc->hn_xvf_flags &= ~HN_XVFFLAG_ENABLED; + if (clear_vf) + sc->hn_vf_ifp = NULL; + rm_wunlock(&sc->hn_vf_lock); + + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) + sc->hn_rx_ring[i].hn_rx_flags &= ~HN_RX_FLAG_XPNT_VF; +} + +static void +hn_xpnt_vf_init(struct hn_softc *sc) +{ + int error; + + HN_LOCK_ASSERT(sc); + + KASSERT((sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) == 0, + ("%s: transparent VF was enabled", sc->hn_ifp->if_xname)); + + if (bootverbose) { + if_printf(sc->hn_ifp, "try bringing up %s\n", + sc->hn_vf_ifp->if_xname); + } + + /* + * Bring the VF up. + */ + hn_xpnt_vf_saveifflags(sc); + sc->hn_vf_ifp->if_flags |= IFF_UP; + error = hn_xpnt_vf_iocsetflags(sc); + if (error) { + if_printf(sc->hn_ifp, "bringing up %s failed: %d\n", + sc->hn_vf_ifp->if_xname, error); + return; + } + + /* + * NOTE: + * Datapath setting must happen _after_ bringing the VF up. + */ + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_VF); + + /* Mark transparent mode VF as enabled. */ + hn_xpnt_vf_setenable(sc); +} + +static void +hn_xpnt_vf_init_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + HN_LOCK(sc); + + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) + goto done; + if (sc->hn_vf_ifp == NULL) + goto done; + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + goto done; + + if (sc->hn_vf_rdytick != 0) { + /* Mark VF as ready. */ + hn_xpnt_vf_setready(sc); + } + + if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) { + /* + * Delayed VF initialization. + */ + if (bootverbose) { + if_printf(sc->hn_ifp, "delayed initialize %s\n", + sc->hn_vf_ifp->if_xname); + } + hn_xpnt_vf_init(sc); + } +done: + HN_UNLOCK(sc); +} + +static void hn_ifnet_attevent(void *xsc, struct ifnet *ifp) { struct hn_softc *sc = xsc; @@ -1132,6 +1544,16 @@ hn_ifnet_attevent(void *xsc, struct ifnet *ifp) goto done; } + if (hn_xpnt_vf && ifp->if_start != NULL) { + /* + * ifnet.if_start is _not_ supported by transparent + * mode VF; mainly due to the IFF_DRV_OACTIVE flag. + */ + if_printf(sc->hn_ifp, "%s uses if_start, which is unsupported " + "in transparent VF mode.\n", ifp->if_xname); + goto done; + } + rm_wlock(&hn_vfmap_lock); if (ifp->if_index >= hn_vfmap_size) { @@ -1155,7 +1577,37 @@ hn_ifnet_attevent(void *xsc, struct ifnet *ifp) rm_wunlock(&hn_vfmap_lock); + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + KASSERT((sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) == 0, + ("%s: transparent VF was enabled", sc->hn_ifp->if_xname)); sc->hn_vf_ifp = ifp; + rm_wunlock(&sc->hn_vf_lock); + + if (hn_xpnt_vf) { + int wait_ticks; + + /* + * Install if_input for vf_ifp, which does vf_ifp -> hn_ifp. + * Save vf_ifp's current if_input for later restoration. + */ + sc->hn_vf_input = ifp->if_input; + ifp->if_input = hn_xpnt_vf_input; + + /* + * Stop link status management; use the VF's. + */ + hn_suspend_mgmt(sc); + + /* + * Give VF sometime to complete its attach routing. + */ + wait_ticks = hn_xpnt_vf_attwait * hz; + sc->hn_vf_rdytick = ticks + wait_ticks; + + taskqueue_enqueue_timeout(sc->hn_vf_taskq, &sc->hn_vf_init, + wait_ticks); + } done: HN_UNLOCK(sc); } @@ -1173,8 +1625,59 @@ hn_ifnet_detevent(void *xsc, struct ifnet *ifp) if (!hn_ismyvf(sc, ifp)) goto done; - sc->hn_vf_ifp = NULL; + if (hn_xpnt_vf) { + /* + * Make sure that the delayed initialization is not running. + * + * NOTE: + * - This lock _must_ be released, since the hn_vf_init task + * will try holding this lock. + * - It is safe to release this lock here, since the + * hn_ifnet_attevent() is interlocked by the hn_vf_ifp. + * + * XXX racy, if hn(4) ever detached. + */ + HN_UNLOCK(sc); + taskqueue_drain_timeout(sc->hn_vf_taskq, &sc->hn_vf_init); + HN_LOCK(sc); + KASSERT(sc->hn_vf_input != NULL, ("%s VF input is not saved", + sc->hn_ifp->if_xname)); + ifp->if_input = sc->hn_vf_input; + sc->hn_vf_input = NULL; + + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_SYNTH); + + if (sc->hn_vf_rdytick == 0) { + /* + * The VF was ready; restore some settings. + */ + sc->hn_ifp->if_capabilities = sc->hn_saved_caps; + /* + * NOTE: + * There is _no_ need to fixup if_capenable and + * if_hwassist, since the if_capabilities before + * restoration was an intersection of the VF's + * if_capabilites and the synthetic device's + * if_capabilites. + */ + sc->hn_ifp->if_hw_tsomax = sc->hn_saved_tsomax; + sc->hn_ifp->if_hw_tsomaxsegcount = + sc->hn_saved_tsosegcnt; + sc->hn_ifp->if_hw_tsomaxsegsize = sc->hn_saved_tsosegsz; + } + + /* + * Resume link status management, which was suspended + * by hn_ifnet_attevent(). + */ + hn_resume_mgmt(sc); + } + + /* Mark transparent mode VF as disabled. */ + hn_xpnt_vf_setdisable(sc, true /* clear hn_vf_ifp */); + rm_wlock(&hn_vfmap_lock); KASSERT(ifp->if_index < hn_vfmap_size, @@ -1192,18 +1695,20 @@ done: HN_UNLOCK(sc); } -/* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ -static const struct hyperv_guid g_net_vsc_device_type = { - .hv_guid = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, - 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} -}; +static void +hn_ifnet_lnkevent(void *xsc, struct ifnet *ifp, int link_state) +{ + struct hn_softc *sc = xsc; + if (sc->hn_vf_ifp == ifp) + if_link_state_change(sc->hn_ifp, link_state); +} + static int hn_probe(device_t dev) { - if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, - &g_net_vsc_device_type) == 0) { + if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &hn_guid) == 0) { device_set_desc(dev, "Hyper-V Network Interface"); return BUS_PROBE_DEFAULT; } @@ -1223,6 +1728,9 @@ hn_attach(device_t dev) sc->hn_dev = dev; sc->hn_prichan = vmbus_get_channel(dev); HN_LOCK_INIT(sc); + rm_init(&sc->hn_vf_lock, "hnvf"); + if (hn_xpnt_vf && hn_xpnt_vf_accbpf) + sc->hn_xvf_flags |= HN_XVFFLAG_ACCBPF; /* * Initialize these tunables once. @@ -1262,6 +1770,18 @@ hn_attach(device_t dev) TIMEOUT_TASK_INIT(sc->hn_mgmt_taskq0, &sc->hn_netchg_status, 0, hn_netchg_status_taskfunc, sc); + if (hn_xpnt_vf) { + /* + * Setup taskqueue for VF tasks, e.g. delayed VF bringing up. + */ + sc->hn_vf_taskq = taskqueue_create("hn_vf", M_WAITOK, + taskqueue_thread_enqueue, &sc->hn_vf_taskq); + taskqueue_start_threads(&sc->hn_vf_taskq, 1, PI_NET, "%s vf", + device_get_nameunit(dev)); + TIMEOUT_TASK_INIT(sc->hn_vf_taskq, &sc->hn_vf_init, 0, + hn_xpnt_vf_init_taskfunc, sc); + } + /* * Allocate ifnet and setup its name earlier, so that if_printf * can be used by functions, which will be called after @@ -1384,6 +1904,14 @@ hn_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "hwassist", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_hwassist_sysctl, "A", "hwassist"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_max", + CTLFLAG_RD, &ifp->if_hw_tsomax, 0, "max TSO size"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_maxsegcnt", + CTLFLAG_RD, &ifp->if_hw_tsomaxsegcount, 0, + "max # of TSO segments"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_maxsegsz", + CTLFLAG_RD, &ifp->if_hw_tsomaxsegsize, 0, + "max size of TSO segment"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_rxfilter_sysctl, "A", "rxfilter"); @@ -1423,9 +1951,20 @@ hn_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_vf_sysctl, "A", "Virtual Function's name"); - SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxvf", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, - hn_rxvf_sysctl, "A", "activated Virtual Function's name"); + if (!hn_xpnt_vf) { + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxvf", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rxvf_sysctl, "A", "activated Virtual Function's name"); + } else { + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf_xpnt_enabled", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_xpnt_vf_enabled_sysctl, "I", + "Transparent VF enabled"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf_xpnt_accbpf", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_xpnt_vf_accbpf_sysctl, "I", + "Accurate BPF for transparent VF"); + } /* * Setup the ifmedia, which has been initialized earlier. @@ -1463,7 +2002,7 @@ hn_attach(device_t dev) ifp->if_qflush = hn_xmit_qflush; } - ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_LRO; + ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_LRO | IFCAP_LINKSTATE; #ifdef foo /* We can't diff IPv6 packets from IPv4 packets on RX path. */ ifp->if_capabilities |= IFCAP_RXCSUM_IPV6; @@ -1498,7 +2037,13 @@ hn_attach(device_t dev) ifp->if_hwassist &= ~(HN_CSUM_IP6_MASK | CSUM_IP6_TSO); if (ifp->if_capabilities & (IFCAP_TSO6 | IFCAP_TSO4)) { + /* + * Lock hn_set_tso_maxsize() to simplify its + * internal logic. + */ + HN_LOCK(sc); hn_set_tso_maxsize(sc, hn_tso_maxlen, ETHERMTU); + HN_UNLOCK(sc); ifp->if_hw_tsomaxsegcount = HN_TX_DATA_SEGCNT_MAX; ifp->if_hw_tsomaxsegsize = PAGE_SIZE; } @@ -1519,10 +2064,15 @@ hn_attach(device_t dev) sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; hn_update_link_status(sc); - sc->hn_ifnet_evthand = EVENTHANDLER_REGISTER(ifnet_event, - hn_ifnet_event, sc, EVENTHANDLER_PRI_ANY); - sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, - hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + if (!hn_xpnt_vf) { + sc->hn_ifnet_evthand = EVENTHANDLER_REGISTER(ifnet_event, + hn_ifnet_event, sc, EVENTHANDLER_PRI_ANY); + sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, + hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + } else { + sc->hn_ifnet_lnkhand = EVENTHANDLER_REGISTER(ifnet_link_event, + hn_ifnet_lnkevent, sc, EVENTHANDLER_PRI_ANY); + } /* * NOTE: @@ -1549,6 +2099,14 @@ hn_detach(device_t dev) struct hn_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->hn_ifp, *vf_ifp; + if (sc->hn_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { + /* + * In case that the vmbus missed the orphan handler + * installation. + */ + vmbus_xact_ctx_orphan(sc->hn_xact); + } + if (sc->hn_ifaddr_evthand != NULL) EVENTHANDLER_DEREGISTER(ifaddr_event, sc->hn_ifaddr_evthand); if (sc->hn_ifnet_evthand != NULL) @@ -1561,20 +2119,14 @@ hn_detach(device_t dev) EVENTHANDLER_DEREGISTER(ifnet_departure_event, sc->hn_ifnet_dethand); } + if (sc->hn_ifnet_lnkhand != NULL) + EVENTHANDLER_DEREGISTER(ifnet_link_event, sc->hn_ifnet_lnkhand); vf_ifp = sc->hn_vf_ifp; __compiler_membar(); if (vf_ifp != NULL) hn_ifnet_detevent(sc, vf_ifp); - if (sc->hn_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { - /* - * In case that the vmbus missed the orphan handler - * installation. - */ - vmbus_xact_ctx_orphan(sc->hn_xact); - } - if (device_is_attached(dev)) { HN_LOCK(sc); if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) { @@ -1604,6 +2156,8 @@ hn_detach(device_t dev) free(sc->hn_tx_taskqs, M_DEVBUF); } taskqueue_free(sc->hn_mgmt_taskq0); + if (sc->hn_vf_taskq != NULL) + taskqueue_free(sc->hn_vf_taskq); if (sc->hn_xact != NULL) { /* @@ -1617,6 +2171,7 @@ hn_detach(device_t dev) if_free(ifp); HN_LOCK_DESTROY(sc); + rm_destroy(&sc->hn_vf_lock); return (0); } @@ -2458,13 +3013,16 @@ static int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_rxinfo *info) { - struct ifnet *ifp; + struct ifnet *ifp, *hn_ifp = rxr->hn_ifp; struct mbuf *m_new; int size, do_lro = 0, do_csum = 1; int hash_type = M_HASHTYPE_OPAQUE; - /* If the VF is active, inject the packet through the VF */ - ifp = rxr->hn_rxvf_ifp ? rxr->hn_rxvf_ifp : rxr->hn_ifp; + /* + * If the non-transparent mode VF is active, inject this packet + * into the VF. + */ + ifp = rxr->hn_rxvf_ifp ? rxr->hn_rxvf_ifp : hn_ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { /* @@ -2478,10 +3036,15 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int return (0); } + if (__predict_false(dlen < ETHER_HDR_LEN)) { + if_inc_counter(hn_ifp, IFCOUNTER_IERRORS, 1); + return (0); + } + if (dlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { - if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); return (0); } memcpy(mtod(m_new, void *), data, dlen); @@ -2502,7 +3065,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size); if (m_new == NULL) { - if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); return (0); } @@ -2510,7 +3073,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int } m_new->m_pkthdr.rcvif = ifp; - if (__predict_false((ifp->if_capenable & IFCAP_RXCSUM) == 0)) + if (__predict_false((hn_ifp->if_capenable & IFCAP_RXCSUM) == 0)) do_csum = 0; /* receive side checksum offload */ @@ -2551,8 +3114,9 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int int hoff; hoff = sizeof(*eh); - if (m_new->m_len < hoff) - goto skip; + /* Checked at the beginning of this function. */ + KASSERT(m_new->m_len >= hoff, ("not ethernet frame")); + eh = mtod(m_new, struct ether_header *); etype = ntohs(eh->ether_type); if (etype == ETHERTYPE_VLAN) { @@ -2607,6 +3171,37 @@ skip: m_new->m_flags |= M_VLANTAG; } + /* + * If VF is activated (tranparent/non-transparent mode does not + * matter here). + * + * - Don't setup mbuf hash, if 'options RSS' is set. + * + * In Azure, when VF is activated, TCP SYN and SYN|ACK go + * through hn(4) while the rest of segments and ACKs belonging + * to the same TCP 4-tuple go through the VF. So don't setup + * mbuf hash, if a VF is activated and 'options RSS' is not + * enabled. hn(4) and the VF may use neither the same RSS + * hash key nor the same RSS hash function, so the hash value + * for packets belonging to the same flow could be different! + * + * - Disable LRO + * + * hn(4) will only receive broadcast packets, multicast packets, + * TCP SYN and SYN|ACK (in Azure), LRO is useless for these + * packet types. + * + * For non-transparent, we definitely _cannot_ enable LRO at + * all, since the LRO flush will use hn(4) as the receiving + * interface; i.e. hn_ifp->if_input(hn_ifp, m). + */ + if (hn_ifp != ifp || (rxr->hn_rx_flags & HN_RX_FLAG_XPNT_VF)) { + do_lro = 0; /* disable LRO. */ +#ifndef RSS + goto skip_hash; /* skip mbuf hash setup */ +#endif + } + if (info->hash_info != HN_NDIS_HASH_INFO_INVALID) { rxr->hn_rss_pkts++; m_new->m_pkthdr.flowid = info->hash_value; @@ -2654,15 +3249,36 @@ skip: } M_HASHTYPE_SET(m_new, hash_type); - /* - * Note: Moved RX completion back to hv_nv_on_receive() so all - * messages (not just data messages) will trigger a response. - */ +#ifndef RSS +skip_hash: +#endif + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); + if (hn_ifp != ifp) { + const struct ether_header *eh; - ifp->if_ipackets++; + /* + * Non-transparent mode VF is activated. + */ + + /* + * Allow tapping on hn(4). + */ + ETHER_BPF_MTAP(hn_ifp, m_new); + + /* + * Update hn(4)'s stats. + */ + if_inc_counter(hn_ifp, IFCOUNTER_IPACKETS, 1); + if_inc_counter(hn_ifp, IFCOUNTER_IBYTES, m_new->m_pkthdr.len); + /* Checked at the beginning of this function. */ + KASSERT(m_new->m_len >= ETHER_HDR_LEN, ("not ethernet frame")); + eh = mtod(m_new, struct ether_header *); + if (ETHER_IS_MULTICAST(eh->ether_dhost)) + if_inc_counter(hn_ifp, IFCOUNTER_IMCASTS, 1); + } rxr->hn_pkts++; - if ((ifp->if_capenable & IFCAP_LRO) && do_lro) { + if ((hn_ifp->if_capenable & IFCAP_LRO) && do_lro) { #if defined(INET) || defined(INET6) struct lro_ctrl *lro = &rxr->hn_lro; @@ -2675,10 +3291,8 @@ skip: } #endif } + ifp->if_input(ifp, m_new); - /* We're not holding the lock here, so don't release it */ - (*ifp->if_input)(ifp, m_new); - return (0); } @@ -2686,7 +3300,8 @@ static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct hn_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; + struct ifreq *ifr = (struct ifreq *)data, ifr_vf; + struct ifnet *vf_ifp; int mask, error = 0; switch (cmd) { @@ -2715,6 +3330,21 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } + if (hn_xpnt_vf_isready(sc)) { + vf_ifp = sc->hn_vf_ifp; + ifr_vf = *ifr; + strlcpy(ifr_vf.ifr_name, vf_ifp->if_xname, + sizeof(ifr_vf.ifr_name)); + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFMTU, + (caddr_t)&ifr_vf); + if (error) { + HN_UNLOCK(sc); + if_printf(ifp, "%s SIOCSIFMTU %d failed: %d\n", + vf_ifp->if_xname, ifr->ifr_mtu, error); + break; + } + } + /* * Suspend this interface before the synthetic parts * are ripped. @@ -2743,23 +3373,33 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_mtu = ifr->ifr_mtu; /* - * Make sure that various parameters based on MTU are - * still valid, after the MTU change. + * Synthetic parts' reattach may change the chimney *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Aug 21 07:03:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3A7DDEC39C; Mon, 21 Aug 2017 07:03:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4279E36B5; Mon, 21 Aug 2017 07:03:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7L736pW059746; Mon, 21 Aug 2017 07:03:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7L732rA059718; Mon, 21 Aug 2017 07:03:02 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708210703.v7L732rA059718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 21 Aug 2017 07:03:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322740 - in head: contrib/libc++/include contrib/llvm/include/llvm/CodeGen contrib/llvm/include/llvm/ExecutionEngine/Orc contrib/llvm/include/llvm/Object contrib/llvm/lib/Analysis cont... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/libc++/include contrib/llvm/include/llvm/CodeGen contrib/llvm/include/llvm/ExecutionEngine/Orc contrib/llvm/include/llvm/Object contrib/llvm/lib/Analysis contrib/llvm/lib/CodeGen cont... X-SVN-Commit-Revision: 322740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 07:03:07 -0000 Author: dim Date: Mon Aug 21 07:03:02 2017 New Revision: 322740 URL: https://svnweb.freebsd.org/changeset/base/322740 Log: Upgrade our copies of clang, llvm, lld and libc++ to r311219 from the upstream release_50 branch. MFC after: 2 months X-MFC-with: r321369 Modified: head/contrib/libc++/include/string head/contrib/llvm/include/llvm/CodeGen/SelectionDAG.h head/contrib/llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h head/contrib/llvm/include/llvm/Object/COFFImportFile.h head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp head/contrib/llvm/lib/Analysis/ValueTracking.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp head/contrib/llvm/lib/CodeGen/VirtRegMap.cpp head/contrib/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp head/contrib/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp head/contrib/llvm/lib/Object/COFFImportFile.cpp head/contrib/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp head/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp head/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp head/contrib/llvm/lib/Target/X86/X86InstrAVX512.td head/contrib/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp head/contrib/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp head/contrib/llvm/lib/Transforms/Scalar/BDCE.cpp head/contrib/llvm/tools/clang/include/clang-c/Index.h head/contrib/llvm/tools/clang/include/clang/AST/Decl.h head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticLexKinds.td head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td head/contrib/llvm/tools/clang/include/clang/Driver/Options.td head/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h head/contrib/llvm/tools/clang/include/clang/Frontend/LangStandards.def head/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp head/contrib/llvm/tools/clang/lib/AST/ExprCXX.cpp head/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/CrossWindows.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/CrossWindows.h head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Darwin.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Darwin.h head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.h head/contrib/llvm/tools/clang/lib/Driver/ToolChains/MSVC.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/MSVC.h head/contrib/llvm/tools/clang/lib/Driver/ToolChains/MinGW.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/MinGW.h head/contrib/llvm/tools/clang/lib/Driver/ToolChains/NetBSD.h head/contrib/llvm/tools/clang/lib/Frontend/InitPreprocessor.cpp head/contrib/llvm/tools/clang/lib/Parse/ParseCXXInlineMethods.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaCast.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp head/contrib/llvm/tools/lld/COFF/Driver.cpp head/contrib/llvm/tools/lld/ELF/Driver.cpp head/contrib/llvm/tools/lld/ELF/Options.td head/contrib/llvm/tools/llvm-objdump/llvm-objdump.cpp head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/include/lld/Config/Version.inc head/lib/clang/include/llvm/Support/VCSRevision.h Directory Properties: head/contrib/compiler-rt/ (props changed) head/contrib/libc++/ (props changed) head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) head/contrib/llvm/tools/lld/ (props changed) head/contrib/llvm/tools/lldb/ (props changed) Modified: head/contrib/libc++/include/string ============================================================================== --- head/contrib/libc++/include/string Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/libc++/include/string Mon Aug 21 07:03:02 2017 (r322740) @@ -556,6 +556,8 @@ template operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y); +_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+, allocator >(char const*, string const&)) + template class _LIBCPP_TEMPLATE_VIS __basic_string_common { @@ -3999,7 +4001,6 @@ basic_string<_CharT, _Traits, _Allocator>::__subscript _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string) -_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+, allocator >(char const*, string const&)) #if _LIBCPP_STD_VER > 11 // Literal suffixes for basic_string [basic.string.literals] Modified: head/contrib/llvm/include/llvm/CodeGen/SelectionDAG.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/SelectionDAG.h Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/include/llvm/CodeGen/SelectionDAG.h Mon Aug 21 07:03:02 2017 (r322740) @@ -1220,8 +1220,9 @@ class SelectionDAG { (public) /// If an existing load has uses of its chain, create a token factor node with /// that chain and the new memory node's chain and update users of the old /// chain to the token factor. This ensures that the new memory node will have - /// the same relative memory dependency position as the old load. - void makeEquivalentMemoryOrdering(LoadSDNode *Old, SDValue New); + /// the same relative memory dependency position as the old load. Returns the + /// new merged load chain. + SDValue makeEquivalentMemoryOrdering(LoadSDNode *Old, SDValue New); /// Topological-sort the AllNodes list and a /// assign a unique node id for each node in the DAG based on their Modified: head/contrib/llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h ============================================================================== --- head/contrib/llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h Mon Aug 21 07:03:02 2017 (r322740) @@ -94,9 +94,9 @@ template class LazyEmittingLayer llvm_unreachable("Invalid emit-state."); } - void removeModuleFromBaseLayer(BaseLayerT &BaseLayer) { - if (EmitState != NotEmitted) - BaseLayer.removeModule(Handle); + Error removeModuleFromBaseLayer(BaseLayerT& BaseLayer) { + return EmitState != NotEmitted ? BaseLayer.removeModule(Handle) + : Error::success(); } void emitAndFinalize(BaseLayerT &BaseLayer) { @@ -226,9 +226,9 @@ template class LazyEmittingLayer /// This method will free the memory associated with the given module, both /// in this layer, and the base layer. Error removeModule(ModuleHandleT H) { - (*H)->removeModuleFromBaseLayer(BaseLayer); + Error Err = (*H)->removeModuleFromBaseLayer(BaseLayer); ModuleList.erase(H); - return Error::success(); + return Err; } /// @brief Search for the given named symbol. Modified: head/contrib/llvm/include/llvm/Object/COFFImportFile.h ============================================================================== --- head/contrib/llvm/include/llvm/Object/COFFImportFile.h Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/include/llvm/Object/COFFImportFile.h Mon Aug 21 07:03:02 2017 (r322740) @@ -73,6 +73,7 @@ class COFFImportFile : public SymbolicFile { (private) struct COFFShortExport { std::string Name; std::string ExtName; + std::string SymbolName; uint16_t Ordinal = 0; bool Noname = false; @@ -98,7 +99,8 @@ struct COFFShortExport { std::error_code writeImportLibrary(StringRef ImportName, StringRef Path, ArrayRef Exports, - COFF::MachineTypes Machine); + COFF::MachineTypes Machine, + bool MakeWeakAliases); } // namespace object } // namespace llvm Modified: head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp ============================================================================== --- head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -162,6 +162,11 @@ static cl::opt cl::desc("Maximum depth of recursive SExt/ZExt"), cl::init(8)); +static cl::opt + MaxAddRecSize("scalar-evolution-max-add-rec-size", cl::Hidden, + cl::desc("Max coefficients in AddRec during evolving"), + cl::init(16)); + //===----------------------------------------------------------------------===// // SCEV class definitions //===----------------------------------------------------------------------===// @@ -2878,6 +2883,12 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImp if (!OtherAddRec || OtherAddRec->getLoop() != AddRecLoop) continue; + // Limit max number of arguments to avoid creation of unreasonably big + // SCEVAddRecs with very complex operands. + if (AddRec->getNumOperands() + OtherAddRec->getNumOperands() - 1 > + MaxAddRecSize) + continue; + bool Overflow = false; Type *Ty = AddRec->getType(); bool LargerThan64Bits = getTypeSizeInBits(Ty) > 64; @@ -7582,6 +7593,25 @@ const SCEV *ScalarEvolution::computeSCEVAtScope(const const SCEV *BackedgeTakenCount = getBackedgeTakenCount(LI); if (const SCEVConstant *BTCC = dyn_cast(BackedgeTakenCount)) { + + // This trivial case can show up in some degenerate cases where + // the incoming IR has not yet been fully simplified. + if (BTCC->getValue()->isZero()) { + Value *InitValue = nullptr; + bool MultipleInitValues = false; + for (unsigned i = 0; i < PN->getNumIncomingValues(); i++) { + if (!LI->contains(PN->getIncomingBlock(i))) { + if (!InitValue) + InitValue = PN->getIncomingValue(i); + else if (InitValue != PN->getIncomingValue(i)) { + MultipleInitValues = true; + break; + } + } + if (!MultipleInitValues && InitValue) + return getSCEV(InitValue); + } + } // Okay, we know how many times the containing loop executes. If // this is a constant evolving PHI node, get the final value at // the specified iteration number. Modified: head/contrib/llvm/lib/Analysis/ValueTracking.cpp ============================================================================== --- head/contrib/llvm/lib/Analysis/ValueTracking.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/Analysis/ValueTracking.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -4458,6 +4458,10 @@ Optional llvm::isImpliedCondition(const Value *L unsigned Depth, AssumptionCache *AC, const Instruction *CxtI, const DominatorTree *DT) { + // Bail out when we hit the limit. + if (Depth == MaxDepth) + return None; + // A mismatch occurs when we compare a scalar cmp to a vector cmp, for example. if (LHS->getType() != RHS->getType()) return None; Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -302,7 +302,21 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_SCALAR_TO_VE } SDValue DAGTypeLegalizer::ScalarizeVecRes_VSELECT(SDNode *N) { - SDValue Cond = GetScalarizedVector(N->getOperand(0)); + SDValue Cond = N->getOperand(0); + EVT OpVT = Cond.getValueType(); + SDLoc DL(N); + // The vselect result and true/value operands needs scalarizing, but it's + // not a given that the Cond does. For instance, in AVX512 v1i1 is legal. + // See the similar logic in ScalarizeVecRes_VSETCC + if (getTypeAction(OpVT) == TargetLowering::TypeScalarizeVector) { + Cond = GetScalarizedVector(Cond); + } else { + EVT VT = OpVT.getVectorElementType(); + Cond = DAG.getNode( + ISD::EXTRACT_VECTOR_ELT, DL, VT, Cond, + DAG.getConstant(0, DL, TLI.getVectorIdxTy(DAG.getDataLayout()))); + } + SDValue LHS = GetScalarizedVector(N->getOperand(1)); TargetLowering::BooleanContent ScalarBool = TLI.getBooleanContents(false, false); Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -7262,22 +7262,23 @@ void SelectionDAG::TransferDbgValues(SDValue From, SDV AddDbgValue(I, ToNode, false); } -void SelectionDAG::makeEquivalentMemoryOrdering(LoadSDNode *OldLoad, - SDValue NewMemOp) { +SDValue SelectionDAG::makeEquivalentMemoryOrdering(LoadSDNode *OldLoad, + SDValue NewMemOp) { assert(isa(NewMemOp.getNode()) && "Expected a memop node"); - if (!OldLoad->hasAnyUseOfValue(1)) - return; - // The new memory operation must have the same position as the old load in // terms of memory dependency. Create a TokenFactor for the old load and new // memory operation and update uses of the old load's output chain to use that // TokenFactor. SDValue OldChain = SDValue(OldLoad, 1); SDValue NewChain = SDValue(NewMemOp.getNode(), 1); + if (!OldLoad->hasAnyUseOfValue(1)) + return NewChain; + SDValue TokenFactor = getNode(ISD::TokenFactor, SDLoc(OldLoad), MVT::Other, OldChain, NewChain); ReplaceAllUsesOfValueWith(OldChain, TokenFactor); UpdateNodeOperands(TokenFactor.getNode(), OldChain, NewChain); + return TokenFactor; } //===----------------------------------------------------------------------===// Modified: head/contrib/llvm/lib/CodeGen/VirtRegMap.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/VirtRegMap.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/CodeGen/VirtRegMap.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -180,6 +180,7 @@ class VirtRegRewriter : public MachineFunctionPass { void addLiveInsForSubRanges(const LiveInterval &LI, unsigned PhysReg) const; void handleIdentityCopy(MachineInstr &MI) const; void expandCopyBundle(MachineInstr &MI) const; + bool subRegLiveThrough(const MachineInstr &MI, unsigned SuperPhysReg) const; public: static char ID; @@ -415,6 +416,32 @@ void VirtRegRewriter::expandCopyBundle(MachineInstr &M } } +/// Check whether (part of) \p SuperPhysReg is live through \p MI. +/// \pre \p MI defines a subregister of a virtual register that +/// has been assigned to \p SuperPhysReg. +bool VirtRegRewriter::subRegLiveThrough(const MachineInstr &MI, + unsigned SuperPhysReg) const { + SlotIndex MIIndex = LIS->getInstructionIndex(MI); + SlotIndex BeforeMIUses = MIIndex.getBaseIndex(); + SlotIndex AfterMIDefs = MIIndex.getBoundaryIndex(); + for (MCRegUnitIterator Unit(SuperPhysReg, TRI); Unit.isValid(); ++Unit) { + const LiveRange &UnitRange = LIS->getRegUnit(*Unit); + // If the regunit is live both before and after MI, + // we assume it is live through. + // Generally speaking, this is not true, because something like + // "RU = op RU" would match that description. + // However, we know that we are trying to assess whether + // a def of a virtual reg, vreg, is live at the same time of RU. + // If we are in the "RU = op RU" situation, that means that vreg + // is defined at the same time as RU (i.e., "vreg, RU = op RU"). + // Thus, vreg and RU interferes and vreg cannot be assigned to + // SuperPhysReg. Therefore, this situation cannot happen. + if (UnitRange.liveAt(AfterMIDefs) && UnitRange.liveAt(BeforeMIUses)) + return true; + } + return false; +} + void VirtRegRewriter::rewrite() { bool NoSubRegLiveness = !MRI->subRegLivenessEnabled(); SmallVector SuperDeads; @@ -452,7 +479,8 @@ void VirtRegRewriter::rewrite() { // A virtual register kill refers to the whole register, so we may // have to add operands for the super-register. A // partial redef always kills and redefines the super-register. - if (MO.readsReg() && (MO.isDef() || MO.isKill())) + if ((MO.readsReg() && (MO.isDef() || MO.isKill())) || + (MO.isDef() && subRegLiveThrough(*MI, PhysReg))) SuperKills.push_back(PhysReg); if (MO.isDef()) { Modified: head/contrib/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp ============================================================================== --- head/contrib/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -134,13 +134,13 @@ dumpDWARFv5StringOffsetsSection(raw_ostream &OS, Strin uint64_t StringOffset = StrOffsetExt.getRelocatedValue(EntrySize, &Offset); if (Format == DWARF32) { - OS << format("%8.8x ", StringOffset); uint32_t StringOffset32 = (uint32_t)StringOffset; + OS << format("%8.8x ", StringOffset32); const char *S = StrData.getCStr(&StringOffset32); if (S) OS << format("\"%s\"", S); } else - OS << format("%16.16x ", StringOffset); + OS << format("%16.16" PRIx64 " ", StringOffset); OS << "\n"; } } Modified: head/contrib/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp ============================================================================== --- head/contrib/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -196,7 +196,7 @@ unsigned DWARFVerifier::verifyDebugInfoAttribute(const ++NumErrors; OS << "error: DW_AT_stmt_list offset is beyond .debug_line " "bounds: " - << format("0x%08" PRIx32, *SectionOffset) << "\n"; + << format("0x%08" PRIx64, *SectionOffset) << "\n"; Die.dump(OS, 0); OS << "\n"; } @@ -234,7 +234,7 @@ unsigned DWARFVerifier::verifyDebugInfoForm(const DWAR if (CUOffset >= CUSize) { ++NumErrors; OS << "error: " << FormEncodingString(Form) << " CU offset " - << format("0x%08" PRIx32, CUOffset) + << format("0x%08" PRIx64, CUOffset) << " is invalid (must be less than CU size of " << format("0x%08" PRIx32, CUSize) << "):\n"; Die.dump(OS, 0); @@ -366,7 +366,7 @@ void DWARFVerifier::verifyDebugLineRows() { if (Row.Address < PrevAddress) { ++NumDebugLineErrors; OS << "error: .debug_line[" - << format("0x%08" PRIx32, + << format("0x%08" PRIx64, *toSectionOffset(Die.find(DW_AT_stmt_list))) << "] row[" << RowIndex << "] decreases in address from previous row:\n"; @@ -381,7 +381,7 @@ void DWARFVerifier::verifyDebugLineRows() { if (Row.File > MaxFileIndex) { ++NumDebugLineErrors; OS << "error: .debug_line[" - << format("0x%08" PRIx32, + << format("0x%08" PRIx64, *toSectionOffset(Die.find(DW_AT_stmt_list))) << "][" << RowIndex << "] has invalid file index " << Row.File << " (valid values are [1," << MaxFileIndex << "]):\n"; Modified: head/contrib/llvm/lib/Object/COFFImportFile.cpp ============================================================================== --- head/contrib/llvm/lib/Object/COFFImportFile.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/Object/COFFImportFile.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -557,7 +557,7 @@ NewArchiveMember ObjectFactory::createWeakExternal(Str std::error_code writeImportLibrary(StringRef ImportName, StringRef Path, ArrayRef Exports, - MachineTypes Machine) { + MachineTypes Machine, bool MakeWeakAliases) { std::vector Members; ObjectFactory OF(llvm::sys::path::filename(ImportName), Machine); @@ -575,7 +575,7 @@ std::error_code writeImportLibrary(StringRef ImportNam if (E.Private) continue; - if (E.isWeak()) { + if (E.isWeak() && MakeWeakAliases) { Members.push_back(OF.createWeakExternal(E.Name, E.ExtName, false)); Members.push_back(OF.createWeakExternal(E.Name, E.ExtName, true)); continue; @@ -587,7 +587,7 @@ std::error_code writeImportLibrary(StringRef ImportNam if (E.Constant) ImportType = IMPORT_CONST; - StringRef SymbolName = E.isWeak() ? E.ExtName : E.Name; + StringRef SymbolName = E.SymbolName.empty() ? E.Name : E.SymbolName; ImportNameType NameType = getNameType(SymbolName, E.Name, Machine); Expected Name = E.ExtName.empty() ? SymbolName Modified: head/contrib/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -388,6 +388,10 @@ static unsigned isMatchingStore(MachineInstr &LoadInst } static unsigned getPreIndexedOpcode(unsigned Opc) { + // FIXME: We don't currently support creating pre-indexed loads/stores when + // the load or store is the unscaled version. If we decide to perform such an + // optimization in the future the cases for the unscaled loads/stores will + // need to be added here. switch (Opc) { default: llvm_unreachable("Opcode has no pre-indexed equivalent!"); @@ -451,32 +455,42 @@ static unsigned getPostIndexedOpcode(unsigned Opc) { default: llvm_unreachable("Opcode has no post-indexed wise equivalent!"); case AArch64::STRSui: + case AArch64::STURSi: return AArch64::STRSpost; case AArch64::STRDui: + case AArch64::STURDi: return AArch64::STRDpost; case AArch64::STRQui: + case AArch64::STURQi: return AArch64::STRQpost; case AArch64::STRBBui: return AArch64::STRBBpost; case AArch64::STRHHui: return AArch64::STRHHpost; case AArch64::STRWui: + case AArch64::STURWi: return AArch64::STRWpost; case AArch64::STRXui: + case AArch64::STURXi: return AArch64::STRXpost; case AArch64::LDRSui: + case AArch64::LDURSi: return AArch64::LDRSpost; case AArch64::LDRDui: + case AArch64::LDURDi: return AArch64::LDRDpost; case AArch64::LDRQui: + case AArch64::LDURQi: return AArch64::LDRQpost; case AArch64::LDRBBui: return AArch64::LDRBBpost; case AArch64::LDRHHui: return AArch64::LDRHHpost; case AArch64::LDRWui: + case AArch64::LDURWi: return AArch64::LDRWpost; case AArch64::LDRXui: + case AArch64::LDURXi: return AArch64::LDRXpost; case AArch64::LDRSWui: return AArch64::LDRSWpost; @@ -1694,8 +1708,9 @@ bool AArch64LoadStoreOpt::optimizeBlock(MachineBasicBl ++NumPostFolded; break; } - // Don't know how to handle pre/post-index versions, so move to the next - // instruction. + + // Don't know how to handle unscaled pre/post-index versions below, so + // move to the next instruction. if (TII->isUnscaledLdSt(Opc)) { ++MBBI; break; Modified: head/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -769,8 +769,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock MachineInstr &MI = *MBBI; DebugLoc DL = MI.getDebugLoc(); const MachineOperand &Dest = MI.getOperand(0); - unsigned StatusReg = MI.getOperand(1).getReg(); - bool StatusDead = MI.getOperand(1).isDead(); + unsigned TempReg = MI.getOperand(1).getReg(); // Duplicating undef operands into 2 instructions does not guarantee the same // value on both; However undef should be replaced by xzr anyway. assert(!MI.getOperand(2).isUndef() && "cannot handle undef"); @@ -797,23 +796,9 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock } // .Lloadcmp: - // mov wStatus, #0 // ldrex rDest, [rAddr] // cmp rDest, rDesired // bne .Ldone - if (!StatusDead) { - if (IsThumb) { - BuildMI(LoadCmpBB, DL, TII->get(ARM::tMOVi8), StatusReg) - .addDef(ARM::CPSR, RegState::Dead) - .addImm(0) - .add(predOps(ARMCC::AL)); - } else { - BuildMI(LoadCmpBB, DL, TII->get(ARM::MOVi), StatusReg) - .addImm(0) - .add(predOps(ARMCC::AL)) - .add(condCodeOp()); - } - } MachineInstrBuilder MIB; MIB = BuildMI(LoadCmpBB, DL, TII->get(LdrexOp), Dest.getReg()); @@ -836,10 +821,10 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock LoadCmpBB->addSuccessor(StoreBB); // .Lstore: - // strex rStatus, rNew, [rAddr] - // cmp rStatus, #0 + // strex rTempReg, rNew, [rAddr] + // cmp rTempReg, #0 // bne .Lloadcmp - MIB = BuildMI(StoreBB, DL, TII->get(StrexOp), StatusReg) + MIB = BuildMI(StoreBB, DL, TII->get(StrexOp), TempReg) .addReg(NewReg) .addReg(AddrReg); if (StrexOp == ARM::t2STREX) @@ -848,7 +833,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP(MachineBasicBlock unsigned CMPri = IsThumb ? ARM::t2CMPri : ARM::CMPri; BuildMI(StoreBB, DL, TII->get(CMPri)) - .addReg(StatusReg, getKillRegState(StatusDead)) + .addReg(TempReg, RegState::Kill) .addImm(0) .add(predOps(ARMCC::AL)); BuildMI(StoreBB, DL, TII->get(Bcc)) @@ -904,8 +889,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP_64(MachineBasicBl MachineInstr &MI = *MBBI; DebugLoc DL = MI.getDebugLoc(); MachineOperand &Dest = MI.getOperand(0); - unsigned StatusReg = MI.getOperand(1).getReg(); - bool StatusDead = MI.getOperand(1).isDead(); + unsigned TempReg = MI.getOperand(1).getReg(); // Duplicating undef operands into 2 instructions does not guarantee the same // value on both; However undef should be replaced by xzr anyway. assert(!MI.getOperand(2).isUndef() && "cannot handle undef"); @@ -931,7 +915,7 @@ bool ARMExpandPseudo::ExpandCMP_SWAP_64(MachineBasicBl // .Lloadcmp: // ldrexd rDestLo, rDestHi, [rAddr] // cmp rDestLo, rDesiredLo - // sbcs rStatus, rDestHi, rDesiredHi + // sbcs rTempReg, rDestHi, rDesiredHi // bne .Ldone unsigned LDREXD = IsThumb ? ARM::t2LDREXD : ARM::LDREXD; MachineInstrBuilder MIB; @@ -959,17 +943,17 @@ bool ARMExpandPseudo::ExpandCMP_SWAP_64(MachineBasicBl LoadCmpBB->addSuccessor(StoreBB); // .Lstore: - // strexd rStatus, rNewLo, rNewHi, [rAddr] - // cmp rStatus, #0 + // strexd rTempReg, rNewLo, rNewHi, [rAddr] + // cmp rTempReg, #0 // bne .Lloadcmp unsigned STREXD = IsThumb ? ARM::t2STREXD : ARM::STREXD; - MIB = BuildMI(StoreBB, DL, TII->get(STREXD), StatusReg); + MIB = BuildMI(StoreBB, DL, TII->get(STREXD), TempReg); addExclusiveRegPair(MIB, New, 0, IsThumb, TRI); MIB.addReg(AddrReg).add(predOps(ARMCC::AL)); unsigned CMPri = IsThumb ? ARM::t2CMPri : ARM::CMPri; BuildMI(StoreBB, DL, TII->get(CMPri)) - .addReg(StatusReg, getKillRegState(StatusDead)) + .addReg(TempReg, RegState::Kill) .addImm(0) .add(predOps(ARMCC::AL)); BuildMI(StoreBB, DL, TII->get(Bcc)) Modified: head/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td Mon Aug 21 07:03:02 2017 (r322740) @@ -6053,21 +6053,21 @@ def SPACE : PseudoInst<(outs GPR:$Rd), (ins i32imm:$si // significantly more naive than the standard expansion: we conservatively // assume seq_cst, strong cmpxchg and omit clrex on failure. -let Constraints = "@earlyclobber $Rd,@earlyclobber $status", +let Constraints = "@earlyclobber $Rd,@earlyclobber $temp", mayLoad = 1, mayStore = 1 in { -def CMP_SWAP_8 : PseudoInst<(outs GPR:$Rd, GPR:$status), +def CMP_SWAP_8 : PseudoInst<(outs GPR:$Rd, GPR:$temp), (ins GPR:$addr, GPR:$desired, GPR:$new), NoItinerary, []>, Sched<[]>; -def CMP_SWAP_16 : PseudoInst<(outs GPR:$Rd, GPR:$status), +def CMP_SWAP_16 : PseudoInst<(outs GPR:$Rd, GPR:$temp), (ins GPR:$addr, GPR:$desired, GPR:$new), NoItinerary, []>, Sched<[]>; -def CMP_SWAP_32 : PseudoInst<(outs GPR:$Rd, GPR:$status), +def CMP_SWAP_32 : PseudoInst<(outs GPR:$Rd, GPR:$temp), (ins GPR:$addr, GPR:$desired, GPR:$new), NoItinerary, []>, Sched<[]>; -def CMP_SWAP_64 : PseudoInst<(outs GPRPair:$Rd, GPR:$status), +def CMP_SWAP_64 : PseudoInst<(outs GPRPair:$Rd, GPR:$temp), (ins GPR:$addr, GPRPair:$desired, GPRPair:$new), NoItinerary, []>, Sched<[]>; } Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -419,6 +419,11 @@ X86TargetLowering::X86TargetLowering(const X86TargetMa setOperationAction(ISD::SELECT, VT, Custom); setOperationAction(ISD::SETCC, VT, Custom); } + + // Custom action for SELECT MMX and expand action for SELECT_CC MMX + setOperationAction(ISD::SELECT, MVT::x86mmx, Custom); + setOperationAction(ISD::SELECT_CC, MVT::x86mmx, Expand); + setOperationAction(ISD::EH_RETURN , MVT::Other, Custom); // NOTE: EH_SJLJ_SETJMP/_LONGJMP supported here is NOT intended to support // SjLj exception handling but a light-weight setjmp/longjmp replacement to @@ -1383,7 +1388,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMa // (result) is 256-bit but the source is 512-bit wide. // 128-bit was made Custom under AVX1. for (auto VT : { MVT::v32i8, MVT::v16i16, MVT::v8i32, MVT::v4i64, - MVT::v8f32, MVT::v4f64 }) + MVT::v8f32, MVT::v4f64, MVT::v1i1 }) setOperationAction(ISD::EXTRACT_SUBVECTOR, VT, Custom); for (auto VT : { MVT::v2i1, MVT::v4i1, MVT::v8i1, MVT::v16i1, MVT::v32i1, MVT::v64i1 }) @@ -14570,6 +14575,21 @@ static SDValue LowerEXTRACT_SUBVECTOR(SDValue Op, cons unsigned IdxVal = cast(Idx)->getZExtValue(); MVT ResVT = Op.getSimpleValueType(); + // When v1i1 is legal a scalarization of a vselect with a vXi1 Cond + // would result with: v1i1 = extract_subvector(vXi1, idx). + // Lower these into extract_vector_elt which is already selectable. + if (ResVT == MVT::v1i1) { + assert(Subtarget.hasAVX512() && + "Boolean EXTRACT_SUBVECTOR requires AVX512"); + + MVT EltVT = ResVT.getVectorElementType(); + const TargetLowering &TLI = DAG.getTargetLoweringInfo(); + MVT LegalVT = + (TLI.getTypeToTransformTo(*DAG.getContext(), EltVT)).getSimpleVT(); + SDValue Res = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, LegalVT, In, Idx); + return DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, ResVT, Res); + } + assert((In.getSimpleValueType().is256BitVector() || In.getSimpleValueType().is512BitVector()) && "Can only extract from 256-bit or 512-bit vectors"); @@ -20651,8 +20671,8 @@ static SDValue LowerINTRINSIC_W_CHAIN(SDValue Op, cons } // ADC/ADCX/SBB case ADX: { - SDVTList CFVTs = DAG.getVTList(Op->getValueType(0), MVT::Other); - SDVTList VTs = DAG.getVTList(Op.getOperand(3)->getValueType(0), MVT::Other); + SDVTList CFVTs = DAG.getVTList(Op->getValueType(0), MVT::i32); + SDVTList VTs = DAG.getVTList(Op.getOperand(3)->getValueType(0), MVT::i32); SDValue GenCF = DAG.getNode(X86ISD::ADD, dl, CFVTs, Op.getOperand(2), DAG.getConstant(-1, dl, MVT::i8)); SDValue Res = DAG.getNode(IntrData->Opc0, dl, VTs, Op.getOperand(3), @@ -30663,6 +30683,14 @@ static SDValue combineSelect(SDNode *N, SelectionDAG & return SDValue(N, 0); } + // Custom action for SELECT MMX + if (VT == MVT::x86mmx) { + LHS = DAG.getBitcast(MVT::i64, LHS); + RHS = DAG.getBitcast(MVT::i64, RHS); + SDValue newSelect = DAG.getNode(ISD::SELECT, DL, MVT::i64, Cond, LHS, RHS); + return DAG.getBitcast(VT, newSelect); + } + return SDValue(); } @@ -33358,7 +33386,8 @@ static SDValue combineStore(SDNode *N, SelectionDAG &D SDValue NewLd = DAG.getLoad(LdVT, LdDL, Ld->getChain(), Ld->getBasePtr(), Ld->getPointerInfo(), Ld->getAlignment(), Ld->getMemOperand()->getFlags()); - SDValue NewChain = NewLd.getValue(1); + // Make sure new load is placed in same chain order. + SDValue NewChain = DAG.makeEquivalentMemoryOrdering(Ld, NewLd); if (TokenFactorIndex >= 0) { Ops.push_back(NewChain); NewChain = DAG.getNode(ISD::TokenFactor, LdDL, MVT::Other, Ops); @@ -33379,11 +33408,12 @@ static SDValue combineStore(SDNode *N, SelectionDAG &D Ld->getPointerInfo().getWithOffset(4), MinAlign(Ld->getAlignment(), 4), Ld->getMemOperand()->getFlags()); + // Make sure new loads are placed in same chain order. + SDValue NewChain = DAG.makeEquivalentMemoryOrdering(Ld, LoLd); + NewChain = DAG.makeEquivalentMemoryOrdering(Ld, HiLd); - SDValue NewChain = LoLd.getValue(1); if (TokenFactorIndex >= 0) { - Ops.push_back(LoLd); - Ops.push_back(HiLd); + Ops.push_back(NewChain); NewChain = DAG.getNode(ISD::TokenFactor, LdDL, MVT::Other, Ops); } Modified: head/contrib/llvm/lib/Target/X86/X86InstrAVX512.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrAVX512.td Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/Target/X86/X86InstrAVX512.td Mon Aug 21 07:03:02 2017 (r322740) @@ -978,6 +978,44 @@ multiclass avx512_int_broadcast_reg opc, X86Ve (_.VT (OpNode SrcRC:$src))>, T8PD, EVEX; } +multiclass avx512_int_broadcastbw_reg opc, string Name, + X86VectorVTInfo _, SDPatternOperator OpNode, + RegisterClass SrcRC, SubRegIndex Subreg> { + let ExeDomain = _.ExeDomain in + defm r : AVX512_maskable_custom, T8PD, EVEX; + + def : Pat <(_.VT (OpNode SrcRC:$src)), + (!cast(Name#r) + (i32 (INSERT_SUBREG (i32 (IMPLICIT_DEF)), SrcRC:$src, Subreg)))>; + + def : Pat <(vselect _.KRCWM:$mask, (_.VT (OpNode SrcRC:$src)), _.RC:$src0), + (!cast(Name#rk) _.RC:$src0, _.KRCWM:$mask, + (i32 (INSERT_SUBREG (i32 (IMPLICIT_DEF)), SrcRC:$src, Subreg)))>; + + def : Pat <(vselect _.KRCWM:$mask, (_.VT (OpNode SrcRC:$src)), _.ImmAllZerosV), + (!cast(Name#rkz) _.KRCWM:$mask, + (i32 (INSERT_SUBREG (i32 (IMPLICIT_DEF)), SrcRC:$src, Subreg)))>; +} + +multiclass avx512_int_broadcastbw_reg_vl opc, string Name, + AVX512VLVectorVTInfo _, SDPatternOperator OpNode, + RegisterClass SrcRC, SubRegIndex Subreg, Predicate prd> { + let Predicates = [prd] in + defm Z : avx512_int_broadcastbw_reg, EVEX_V512; + let Predicates = [prd, HasVLX] in { + defm Z256 : avx512_int_broadcastbw_reg, EVEX_V256; + defm Z128 : avx512_int_broadcastbw_reg, EVEX_V128; + } +} + multiclass avx512_int_broadcast_reg_vl opc, AVX512VLVectorVTInfo _, SDPatternOperator OpNode, RegisterClass SrcRC, Predicate prd> { @@ -989,18 +1027,11 @@ multiclass avx512_int_broadcast_reg_vl opc, AV } } -let isCodeGenOnly = 1 in { -defm VPBROADCASTBr : avx512_int_broadcast_reg_vl<0x7A, avx512vl_i8_info, - X86VBroadcast, GR8, HasBWI>; -defm VPBROADCASTWr : avx512_int_broadcast_reg_vl<0x7B, avx512vl_i16_info, - X86VBroadcast, GR16, HasBWI>; -} -let isAsmParserOnly = 1 in { - defm VPBROADCASTBr_Alt : avx512_int_broadcast_reg_vl<0x7A, avx512vl_i8_info, - null_frag, GR32, HasBWI>; - defm VPBROADCASTWr_Alt : avx512_int_broadcast_reg_vl<0x7B, avx512vl_i16_info, - null_frag, GR32, HasBWI>; -} +defm VPBROADCASTBr : avx512_int_broadcastbw_reg_vl<0x7A, "VPBROADCASTBr", + avx512vl_i8_info, X86VBroadcast, GR8, sub_8bit, HasBWI>; +defm VPBROADCASTWr : avx512_int_broadcastbw_reg_vl<0x7B, "VPBROADCASTWr", + avx512vl_i16_info, X86VBroadcast, GR16, sub_16bit, + HasBWI>; defm VPBROADCASTDr : avx512_int_broadcast_reg_vl<0x7C, avx512vl_i32_info, X86VBroadcast, GR32, HasAVX512>; defm VPBROADCASTQr : avx512_int_broadcast_reg_vl<0x7C, avx512vl_i64_info, Modified: head/contrib/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp ============================================================================== --- head/contrib/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -60,11 +60,13 @@ std::vector> OwningMBs; // Opens a file. Path has to be resolved already. // Newly created memory buffers are owned by this driver. -MemoryBufferRef openFile(StringRef Path) { +Optional openFile(StringRef Path) { ErrorOr> MB = MemoryBuffer::getFile(Path); - if (std::error_code EC = MB.getError()) + if (std::error_code EC = MB.getError()) { llvm::errs() << "fail openFile: " << EC.message() << "\n"; + return None; + } MemoryBufferRef MBRef = MB.get()->getMemBufferRef(); OwningMBs.push_back(std::move(MB.get())); // take ownership @@ -114,11 +116,16 @@ int llvm::dlltoolDriverMain(llvm::ArrayRefgetSpelling() << "\n"; - MemoryBufferRef MB; - if (auto *Arg = Args.getLastArg(OPT_d)) - MB = openFile(Arg->getValue()); + if (!Args.hasArg(OPT_d)) { + llvm::errs() << "no definition file specified\n"; + return 1; + } - if (!MB.getBufferSize()) { + Optional MB = openFile(Args.getLastArg(OPT_d)->getValue()); + if (!MB) + return 1; + + if (!MB->getBufferSize()) { llvm::errs() << "definition file empty\n"; return 1; } @@ -133,7 +140,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef Def = - parseCOFFModuleDefinition(MB, Machine, true); + parseCOFFModuleDefinition(*MB, Machine, true); if (!Def) { llvm::errs() << "error parsing definition\n" @@ -154,7 +161,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRefOutputFile); - if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine)) + if (writeImportLibrary(Def->OutputFile, Path, Def->Exports, Machine, true)) return 1; return 0; } Modified: head/contrib/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -1470,6 +1470,7 @@ void DFSanVisitor::visitCallSite(CallSite CS) { } i = CS.arg_begin(); + const unsigned ShadowArgStart = Args.size(); for (unsigned n = FT->getNumParams(); n != 0; ++i, --n) Args.push_back(DFSF.getShadow(*i)); @@ -1504,6 +1505,15 @@ void DFSanVisitor::visitCallSite(CallSite CS) { CallInst *CustomCI = IRB.CreateCall(CustomF, Args); CustomCI->setCallingConv(CI->getCallingConv()); CustomCI->setAttributes(CI->getAttributes()); + + // Update the parameter attributes of the custom call instruction to + // zero extend the shadow parameters. This is required for targets + // which consider ShadowTy an illegal type. + for (unsigned n = 0; n < FT->getNumParams(); n++) { + const unsigned ArgNo = ShadowArgStart + n; + if (CustomCI->getArgOperand(ArgNo)->getType() == DFSF.DFS.ShadowTy) + CustomCI->addParamAttr(ArgNo, Attribute::ZExt); + } if (!FT->getReturnType()->isVoidTy()) { LoadInst *LabelLoad = IRB.CreateLoad(DFSF.LabelReturnAlloca); Modified: head/contrib/llvm/lib/Transforms/Scalar/BDCE.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Scalar/BDCE.cpp Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/lib/Transforms/Scalar/BDCE.cpp Mon Aug 21 07:03:02 2017 (r322740) @@ -15,6 +15,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar/BDCE.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/DemandedBits.h" @@ -35,6 +36,46 @@ using namespace llvm; STATISTIC(NumRemoved, "Number of instructions removed (unused)"); STATISTIC(NumSimplified, "Number of instructions trivialized (dead bits)"); +/// If an instruction is trivialized (dead), then the chain of users of that +/// instruction may need to be cleared of assumptions that can no longer be +/// guaranteed correct. +static void clearAssumptionsOfUsers(Instruction *I, DemandedBits &DB) { + assert(I->getType()->isIntegerTy() && "Trivializing a non-integer value?"); + + // Initialize the worklist with eligible direct users. + SmallVector WorkList; + for (User *JU : I->users()) { + // If all bits of a user are demanded, then we know that nothing below that + // in the def-use chain needs to be changed. + auto *J = dyn_cast(JU); + if (J && !DB.getDemandedBits(J).isAllOnesValue()) + WorkList.push_back(J); + } + + // DFS through subsequent users while tracking visits to avoid cycles. + SmallPtrSet Visited; + while (!WorkList.empty()) { + Instruction *J = WorkList.pop_back_val(); + + // NSW, NUW, and exact are based on operands that might have changed. + J->dropPoisonGeneratingFlags(); + + // We do not have to worry about llvm.assume or range metadata: + // 1. llvm.assume demands its operand, so trivializing can't change it. + // 2. range metadata only applies to memory accesses which demand all bits. + + Visited.insert(J); + + for (User *KU : J->users()) { + // If all bits of a user are demanded, then we know that nothing below + // that in the def-use chain needs to be changed. + auto *K = dyn_cast(KU); + if (K && !Visited.count(K) && !DB.getDemandedBits(K).isAllOnesValue()) + WorkList.push_back(K); + } + } +} + static bool bitTrackingDCE(Function &F, DemandedBits &DB) { SmallVector Worklist; bool Changed = false; @@ -51,6 +92,9 @@ static bool bitTrackingDCE(Function &F, DemandedBits & // replacing all uses with something else. Then, if they don't need to // remain live (because they have side effects, etc.) we can remove them. DEBUG(dbgs() << "BDCE: Trivializing: " << I << " (all bits dead)\n"); + + clearAssumptionsOfUsers(&I, DB); + // FIXME: In theory we could substitute undef here instead of zero. // This should be reconsidered once we settle on the semantics of // undef, poison, etc. Modified: head/contrib/llvm/tools/clang/include/clang-c/Index.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang-c/Index.h Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/tools/clang/include/clang-c/Index.h Mon Aug 21 07:03:02 2017 (r322740) @@ -3206,6 +3206,8 @@ enum CXCallingConv { CXCallingConv_X86RegCall = 8, CXCallingConv_IntelOclBicc = 9, CXCallingConv_Win64 = 10, + /* Alias for compatibility with older versions of API. */ + CXCallingConv_X86_64Win64 = CXCallingConv_Win64, CXCallingConv_X86_64SysV = 11, CXCallingConv_X86VectorCall = 12, CXCallingConv_Swift = 13, Modified: head/contrib/llvm/tools/clang/include/clang/AST/Decl.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/AST/Decl.h Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/tools/clang/include/clang/AST/Decl.h Mon Aug 21 07:03:02 2017 (r322740) @@ -1666,8 +1666,7 @@ class FunctionDecl : public DeclaratorDecl, public Dec unsigned HasSkippedBody : 1; /// Indicates if the function declaration will have a body, once we're done - /// parsing it. (We don't set it to false when we're done parsing, in the - /// hopes this is simpler.) + /// parsing it. unsigned WillHaveBody : 1; /// \brief End part of this FunctionDecl's source range. Modified: head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td Mon Aug 21 07:03:02 2017 (r322740) @@ -138,9 +138,10 @@ def err_drv_cc_print_options_failure : Error< def err_drv_lto_without_lld : Error<"LTO requires -fuse-ld=lld">; def err_drv_preamble_format : Error< "incorrect format for -preamble-bytes=N,END">; -def err_invalid_ios_deployment_target : Error< +def warn_invalid_ios_deployment_target : Warning< "invalid iOS deployment version '%0', iOS 10 is the maximum deployment " - "target for 32-bit targets">; + "target for 32-bit targets">, InGroup, + DefaultError; def err_drv_conflicting_deployment_targets : Error< "conflicting deployment targets, both '%0' and '%1' are present in environment">; def err_arc_unsupported_on_runtime : Error< Modified: head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td Mon Aug 21 07:03:02 2017 (r322740) @@ -151,9 +151,13 @@ def GNUFlexibleArrayUnionMember : DiagGroup<"gnu-flexi def GNUFoldingConstant : DiagGroup<"gnu-folding-constant">; def FormatExtraArgs : DiagGroup<"format-extra-args">; def FormatZeroLength : DiagGroup<"format-zero-length">; -def CXX1zCompatMangling : DiagGroup<"c++1z-compat-mangling">; + +def InvalidIOSDeploymentTarget : DiagGroup<"invalid-ios-deployment-target">; + +def CXX17CompatMangling : DiagGroup<"c++17-compat-mangling">; +def : DiagGroup<"c++1z-compat-mangling", [CXX17CompatMangling]>; // Name of this warning in GCC. -def NoexceptType : DiagGroup<"noexcept-type", [CXX1zCompatMangling]>; +def NoexceptType : DiagGroup<"noexcept-type", [CXX17CompatMangling]>; // Warnings for C++1y code which is not compatible with prior C++ standards. def CXXPre14Compat : DiagGroup<"c++98-c++11-compat">; @@ -215,9 +219,10 @@ def CXX14Compat : DiagGroup<"c++14-compat", [CXXPre1zC def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic", [CXXPre1zCompatPedantic]>; -def CXX1zCompat : DiagGroup<"c++1z-compat", [DeprecatedRegister, +def CXX17Compat : DiagGroup<"c++17-compat", [DeprecatedRegister, DeprecatedIncrementBool, - CXX1zCompatMangling]>; + CXX17CompatMangling]>; +def : DiagGroup<"c++1z-compat", [CXX17Compat]>; def ExitTimeDestructors : DiagGroup<"exit-time-destructors">; def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">; @@ -769,10 +774,11 @@ def CXX14 : DiagGroup<"c++14-extensions", [CXX14Binary // A warning group for warnings about using C++1z features as extensions in // earlier C++ versions. -def CXX1z : DiagGroup<"c++1z-extensions">; +def CXX17 : DiagGroup<"c++17-extensions">; def : DiagGroup<"c++0x-extensions", [CXX11]>; def : DiagGroup<"c++1y-extensions", [CXX14]>; +def : DiagGroup<"c++1z-extensions", [CXX17]>; def DelegatingCtorCycles : DiagGroup<"delegating-ctor-cycles">; Modified: head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticLexKinds.td ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticLexKinds.td Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticLexKinds.td Mon Aug 21 07:03:02 2017 (r322740) @@ -181,10 +181,10 @@ def err_hex_constant_requires : Error< def ext_hex_constant_invalid : Extension< "hexadecimal floating constants are a C99 feature">, InGroup; def ext_hex_literal_invalid : Extension< - "hexadecimal floating literals are a C++1z feature">, InGroup; + "hexadecimal floating literals are a C++17 feature">, InGroup; def warn_cxx1z_hex_literal : Warning< "hexadecimal floating literals are incompatible with " - "C++ standards before C++1z">, + "C++ standards before C++17">, InGroup, DefaultIgnore; def ext_binary_literal : Extension< "binary integer literals are a GNU extension">, InGroup; @@ -208,7 +208,7 @@ def warn_cxx98_compat_unicode_literal : Warning< "unicode literals are incompatible with C++98">, InGroup, DefaultIgnore; def warn_cxx14_compat_u8_character_literal : Warning< - "unicode literals are incompatible with C++ standards before C++1z">, + "unicode literals are incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def warn_cxx11_compat_user_defined_literal : Warning< "identifier after literal will be treated as a user-defined literal suffix " Modified: head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td Mon Aug 21 05:25:30 2017 (r322739) +++ head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td Mon Aug 21 07:03:02 2017 (r322740) @@ -211,10 +211,10 @@ def err_inline_namespace_alias : Error<"namespace alia def err_namespace_nonnamespace_scope : Error< "namespaces can only be defined in global or namespace scope">; def ext_nested_namespace_definition : ExtWarn< - "nested namespace definition is a C++1z extension; " - "define each namespace separately">, InGroup; + "nested namespace definition is a C++17 extension; " + "define each namespace separately">, InGroup; def warn_cxx14_compat_nested_namespace_definition : Warning< - "nested namespace definition is incompatible with C++ standards before C++1z">, + "nested namespace definition is incompatible with C++ standards before C++17">, InGroup, DefaultIgnore; def err_inline_nested_namespace_definition : Error< "nested namespace definition cannot be 'inline'">; @@ -358,7 +358,7 @@ def err_expected_coloncolon_after_super : Error< "expected '::' after '__super'">; def ext_decomp_decl_empty : ExtWarn< - "ISO C++1z does not allow a decomposition group to be empty">, + "ISO C++17 does not allow a decomposition group to be empty">, InGroup>; /// Objective-C parser diagnostics @@ -522,16 +522,16 @@ def err_function_is_not_record : Error< def err_super_in_using_declaration : Error< "'__super' cannot be used with a using declaration">; def ext_constexpr_if : ExtWarn< - "constexpr if is a C++1z extension">, InGroup; + "constexpr if is a C++17 extension">, InGroup; def warn_cxx14_compat_constexpr_if : Warning< - "constexpr if is incompatible with C++ standards before C++1z">, + "constexpr if is incompatible with C++ standards before C++17">, DefaultIgnore, InGroup; def ext_init_statement : ExtWarn< - "'%select{if|switch}0' initialization statements are a C++1z extension">, - InGroup; + "'%select{if|switch}0' initialization statements are a C++17 extension">, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Aug 21 09:03:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F6E9DEFFBB; Mon, 21 Aug 2017 09:03:22 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 087EA65BFB; Mon, 21 Aug 2017 09:03:21 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7L93LoJ009085; Mon, 21 Aug 2017 09:03:21 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7L93KuH009080; Mon, 21 Aug 2017 09:03:20 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708210903.v7L93KuH009080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 21 Aug 2017 09:03:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322741 - in stable/11/sys: net netipsec X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/11/sys: net netipsec X-SVN-Commit-Revision: 322741 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 09:03:22 -0000 Author: ae Date: Mon Aug 21 09:03:20 2017 New Revision: 322741 URL: https://svnweb.freebsd.org/changeset/base/322741 Log: MFC r321779: Add inpcb pointer to struct ipsec_ctx_data and pass it to the pfil hook from enc_hhook(). This should solve the problem when pf is used with if_enc(4) interface, and outbound packet with existing PCB checked by pf, and this leads to deadlock due to pf does its own PCB lookup and tries to take rlock when wlock is already held. Now we pass PCB pointer if it is known to the pfil hook, this helps to avoid extra PCB lookup and thus rlock acquiring is not needed. For inbound packets it is safe to pass NULL, because we do not held any PCB locks yet. PR: 220217 Sponsored by: Yandex LLC Modified: stable/11/sys/net/if_enc.c stable/11/sys/net/if_enc.h stable/11/sys/netipsec/ipsec.h stable/11/sys/netipsec/ipsec_input.c stable/11/sys/netipsec/ipsec_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_enc.c ============================================================================== --- stable/11/sys/net/if_enc.c Mon Aug 21 07:03:02 2017 (r322740) +++ stable/11/sys/net/if_enc.c Mon Aug 21 09:03:20 2017 (r322741) @@ -284,7 +284,7 @@ enc_hhook(int32_t hhook_type, int32_t hhook_id, void * /* Make a packet looks like it was received on enc(4) */ rcvif = (*ctx->mp)->m_pkthdr.rcvif; (*ctx->mp)->m_pkthdr.rcvif = ifp; - if (pfil_run_hooks(ph, ctx->mp, ifp, pdir, NULL) != 0 || + if (pfil_run_hooks(ph, ctx->mp, ifp, pdir, ctx->inp) != 0 || *ctx->mp == NULL) { *ctx->mp = NULL; /* consumed by filter */ return (EACCES); Modified: stable/11/sys/net/if_enc.h ============================================================================== --- stable/11/sys/net/if_enc.h Mon Aug 21 07:03:02 2017 (r322740) +++ stable/11/sys/net/if_enc.h Mon Aug 21 09:03:20 2017 (r322741) @@ -33,6 +33,7 @@ struct ipsec_ctx_data { struct mbuf **mp; struct secasvar *sav; + struct inpcb *inp; uint8_t af; #define IPSEC_ENC_BEFORE 0x01 #define IPSEC_ENC_AFTER 0x02 Modified: stable/11/sys/netipsec/ipsec.h ============================================================================== --- stable/11/sys/netipsec/ipsec.h Mon Aug 21 07:03:02 2017 (r322740) +++ stable/11/sys/netipsec/ipsec.h Mon Aug 21 09:03:20 2017 (r322741) @@ -253,8 +253,9 @@ struct ipsecstat { #include struct ipsec_ctx_data; -#define IPSEC_INIT_CTX(_ctx, _mp, _sav, _af, _enc) do { \ +#define IPSEC_INIT_CTX(_ctx, _mp, _inp, _sav, _af, _enc) do { \ (_ctx)->mp = (_mp); \ + (_ctx)->inp = (_inp); \ (_ctx)->sav = (_sav); \ (_ctx)->af = (_af); \ (_ctx)->enc = (_enc); \ Modified: stable/11/sys/netipsec/ipsec_input.c ============================================================================== --- stable/11/sys/netipsec/ipsec_input.c Mon Aug 21 07:03:02 2017 (r322740) +++ stable/11/sys/netipsec/ipsec_input.c Mon Aug 21 09:03:20 2017 (r322741) @@ -325,7 +325,7 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar (prot == IPPROTO_UDP || prot == IPPROTO_TCP)) udp_ipsec_adjust_cksum(m, sav, prot, skip); - IPSEC_INIT_CTX(&ctx, &m, sav, AF_INET, IPSEC_ENC_BEFORE); + IPSEC_INIT_CTX(&ctx, &m, NULL, sav, AF_INET, IPSEC_ENC_BEFORE); if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_IN)) != 0) goto bad; ip = mtod(m, struct ip *); /* update pointer */ @@ -416,7 +416,7 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar goto bad; } - IPSEC_INIT_CTX(&ctx, &m, sav, af, IPSEC_ENC_AFTER); + IPSEC_INIT_CTX(&ctx, &m, NULL, sav, af, IPSEC_ENC_AFTER); if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_IN)) != 0) goto bad; @@ -522,7 +522,7 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar goto bad; } - IPSEC_INIT_CTX(&ctx, &m, sav, af, IPSEC_ENC_BEFORE); + IPSEC_INIT_CTX(&ctx, &m, NULL, sav, af, IPSEC_ENC_BEFORE); if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_IN)) != 0) goto bad; @@ -593,7 +593,7 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar else #endif af = AF_INET6; - IPSEC_INIT_CTX(&ctx, &m, sav, af, IPSEC_ENC_AFTER); + IPSEC_INIT_CTX(&ctx, &m, NULL, sav, af, IPSEC_ENC_AFTER); if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_IN)) != 0) goto bad; if (skip == 0) { Modified: stable/11/sys/netipsec/ipsec_output.c ============================================================================== --- stable/11/sys/netipsec/ipsec_output.c Mon Aug 21 07:03:02 2017 (r322740) +++ stable/11/sys/netipsec/ipsec_output.c Mon Aug 21 09:03:20 2017 (r322741) @@ -181,7 +181,8 @@ next: * IPsec output logic for IPv4. */ static int -ipsec4_perform_request(struct mbuf *m, struct secpolicy *sp, u_int idx) +ipsec4_perform_request(struct mbuf *m, struct secpolicy *sp, + struct inpcb *inp, u_int idx) { struct ipsec_ctx_data ctx; union sockaddr_union *dst; @@ -211,7 +212,7 @@ ipsec4_perform_request(struct mbuf *m, struct secpolic /* * XXXAE: most likely ip_sum at this point is wrong. */ - IPSEC_INIT_CTX(&ctx, &m, sav, AF_INET, IPSEC_ENC_BEFORE); + IPSEC_INIT_CTX(&ctx, &m, inp, sav, AF_INET, IPSEC_ENC_BEFORE); if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_OUT)) != 0) goto bad; @@ -235,9 +236,10 @@ ipsec4_perform_request(struct mbuf *m, struct secpolic /* XXXAE: IPSEC_OSTAT_INC(tunnel); */ goto bad; } + inp = NULL; } - IPSEC_INIT_CTX(&ctx, &m, sav, dst->sa.sa_family, IPSEC_ENC_AFTER); + IPSEC_INIT_CTX(&ctx, &m, inp, sav, dst->sa.sa_family, IPSEC_ENC_AFTER); if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_OUT)) != 0) goto bad; @@ -285,7 +287,7 @@ ipsec4_process_packet(struct mbuf *m, struct secpolicy struct inpcb *inp) { - return (ipsec4_perform_request(m, sp, 0)); + return (ipsec4_perform_request(m, sp, inp, 0)); } static int @@ -491,7 +493,8 @@ next: * IPsec output logic for IPv6. */ static int -ipsec6_perform_request(struct mbuf *m, struct secpolicy *sp, u_int idx) +ipsec6_perform_request(struct mbuf *m, struct secpolicy *sp, + struct inpcb *inp, u_int idx) { struct ipsec_ctx_data ctx; union sockaddr_union *dst; @@ -514,7 +517,7 @@ ipsec6_perform_request(struct mbuf *m, struct secpolic ip6 = mtod(m, struct ip6_hdr *); ip6->ip6_plen = htons(m->m_pkthdr.len - sizeof(*ip6)); - IPSEC_INIT_CTX(&ctx, &m, sav, AF_INET6, IPSEC_ENC_BEFORE); + IPSEC_INIT_CTX(&ctx, &m, inp, sav, AF_INET6, IPSEC_ENC_BEFORE); if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_OUT)) != 0) goto bad; @@ -540,9 +543,10 @@ ipsec6_perform_request(struct mbuf *m, struct secpolic /* XXXAE: IPSEC_OSTAT_INC(tunnel); */ goto bad; } + inp = NULL; } - IPSEC_INIT_CTX(&ctx, &m, sav, dst->sa.sa_family, IPSEC_ENC_AFTER); + IPSEC_INIT_CTX(&ctx, &m, inp, sav, dst->sa.sa_family, IPSEC_ENC_AFTER); if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_OUT)) != 0) goto bad; @@ -585,7 +589,7 @@ ipsec6_process_packet(struct mbuf *m, struct secpolicy struct inpcb *inp) { - return (ipsec6_perform_request(m, sp, 0)); + return (ipsec6_perform_request(m, sp, inp, 0)); } static int @@ -750,14 +754,14 @@ ipsec_process_done(struct mbuf *m, struct secpolicy *s case AF_INET: key_freesav(&sav); IPSECSTAT_INC(ips_out_bundlesa); - return (ipsec4_perform_request(m, sp, idx)); + return (ipsec4_perform_request(m, sp, NULL, idx)); /* NOTREACHED */ #endif #ifdef INET6 case AF_INET6: key_freesav(&sav); IPSEC6STAT_INC(ips_out_bundlesa); - return (ipsec6_perform_request(m, sp, idx)); + return (ipsec6_perform_request(m, sp, NULL, idx)); /* NOTREACHED */ #endif /* INET6 */ default: From owner-svn-src-all@freebsd.org Mon Aug 21 09:04:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4B7BDC817D; Mon, 21 Aug 2017 09:04:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFEDC65E37; Mon, 21 Aug 2017 09:04:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7L94hwT009193; Mon, 21 Aug 2017 09:04:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7L94hfE009192; Mon, 21 Aug 2017 09:04:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708210904.v7L94hfE009192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 21 Aug 2017 09:04:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322742 - stable/11/sys/amd64/include X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/include X-SVN-Commit-Revision: 322742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 09:04:45 -0000 Author: kib Date: Mon Aug 21 09:04:43 2017 New Revision: 322742 URL: https://svnweb.freebsd.org/changeset/base/322742 Log: MFC r322495: Add {rd,wr}{fs,gs}base C wrappers for instructions. Modified: stable/11/sys/amd64/include/cpufunc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/cpufunc.h ============================================================================== --- stable/11/sys/amd64/include/cpufunc.h Mon Aug 21 09:03:20 2017 (r322741) +++ stable/11/sys/amd64/include/cpufunc.h Mon Aug 21 09:04:43 2017 (r322742) @@ -651,6 +651,38 @@ load_gs(u_short sel) } #endif +static __inline uint64_t +rdfsbase(void) +{ + uint64_t x; + + __asm __volatile("rdfsbase %0" : "=r" (x)); + return (x); +} + +static __inline void +wrfsbase(uint64_t x) +{ + + __asm __volatile("wrfsbase %0" : : "r" (x)); +} + +static __inline uint64_t +rdgsbase(void) +{ + uint64_t x; + + __asm __volatile("rdgsbase %0" : "=r" (x)); + return (x); +} + +static __inline void +wrgsbase(uint64_t x) +{ + + __asm __volatile("wrgsbase %0" : : "r" (x)); +} + static __inline void bare_lgdt(struct region_descriptor *addr) { From owner-svn-src-all@freebsd.org Mon Aug 21 09:52:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ABA3DCCFA7; Mon, 21 Aug 2017 09:52:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D9B16778D; Mon, 21 Aug 2017 09:52:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7L9qFQi028596; Mon, 21 Aug 2017 09:52:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7L9qF6K028595; Mon, 21 Aug 2017 09:52:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708210952.v7L9qF6K028595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 21 Aug 2017 09:52:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322743 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 322743 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 09:52:16 -0000 Author: kib Date: Mon Aug 21 09:52:15 2017 New Revision: 322743 URL: https://svnweb.freebsd.org/changeset/base/322743 Log: MFC r322496: Print whole machine state on double fault. Modified: stable/11/sys/amd64/amd64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Mon Aug 21 09:04:43 2017 (r322742) +++ stable/11/sys/amd64/amd64/trap.c Mon Aug 21 09:52:15 2017 (r322743) @@ -822,10 +822,24 @@ dblfault_handler(struct trapframe *frame) if (dtrace_doubletrap_func != NULL) (*dtrace_doubletrap_func)(); #endif - printf("\nFatal double fault\n"); - printf("rip = 0x%lx\n", frame->tf_rip); - printf("rsp = 0x%lx\n", frame->tf_rsp); - printf("rbp = 0x%lx\n", frame->tf_rbp); + printf("\nFatal double fault\n" + "rip %#lx rsp %#lx rbp %#lx\n" + "rax %#lx rdx %#lx rbx %#lx\n" + "rcx %#lx rsi %#lx rdi %#lx\n" + "r8 %#lx r9 %#lx r10 %#lx\n" + "r11 %#lx r12 %#lx r13 %#lx\n" + "r14 %#lx r15 %#lx rflags %#lx\n" + "cs %#lx ss %#lx ds %#hx es %#hx fs %#hx gs %#hx\n" + "fsbase %#lx gsbase %#lx kgsbase %#lx\n", + frame->tf_rip, frame->tf_rsp, frame->tf_rbp, + frame->tf_rax, frame->tf_rdx, frame->tf_rbx, + frame->tf_rcx, frame->tf_rdi, frame->tf_rsi, + frame->tf_r8, frame->tf_r9, frame->tf_r10, + frame->tf_r11, frame->tf_r12, frame->tf_r13, + frame->tf_r14, frame->tf_r15, frame->tf_rflags, + frame->tf_cs, frame->tf_ss, frame->tf_ds, frame->tf_es, + frame->tf_fs, frame->tf_gs, + rdmsr(MSR_FSBASE), rdmsr(MSR_GSBASE), rdmsr(MSR_KGSBASE)); #ifdef SMP /* two separate prints in case of a trap on an unmapped page */ printf("cpuid = %d; ", PCPU_GET(cpuid)); From owner-svn-src-all@freebsd.org Mon Aug 21 10:07:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6006FDCDBB6; Mon, 21 Aug 2017 10:07:14 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A3A86811A; Mon, 21 Aug 2017 10:07:14 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LA7Dcv033339; Mon, 21 Aug 2017 10:07:13 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LA7DvM033335; Mon, 21 Aug 2017 10:07:13 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708211007.v7LA7DvM033335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 21 Aug 2017 10:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322744 - in stable/10: share/man/man4 sys/conf sys/modules/geom/geom_map X-SVN-Group: stable-10 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/10: share/man/man4 sys/conf sys/modules/geom/geom_map X-SVN-Commit-Revision: 322744 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 10:07:14 -0000 Author: ae Date: Mon Aug 21 10:07:12 2017 New Revision: 322744 URL: https://svnweb.freebsd.org/changeset/base/322744 Log: MFC r284152: Add makefile to build geom_map kld. Document some GEOM_* options in NOTES and geom(4). PR: 197766 Approved by: re (kib) Added: stable/10/sys/modules/geom/geom_map/ - copied from r284152, head/sys/modules/geom/geom_map/ Modified: stable/10/share/man/man4/geom.4 stable/10/share/man/man4/geom_map.4 stable/10/sys/conf/NOTES stable/10/sys/conf/options Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/geom.4 ============================================================================== --- stable/10/share/man/man4/geom.4 Mon Aug 21 09:52:15 2017 (r322743) +++ stable/10/share/man/man4/geom.4 Mon Aug 21 10:07:12 2017 (r322744) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 10, 2013 +.Dd June 8, 2015 .Dt GEOM 4 .Os .Sh NAME @@ -52,12 +52,14 @@ .Cd options GEOM_JOURNAL .Cd options GEOM_LABEL .Cd options GEOM_LINUX_LVM +.Cd options GEOM_MAP .Cd options GEOM_MBR .Cd options GEOM_MIRROR .Cd options GEOM_MULTIPATH .Cd options GEOM_NOP .Cd options GEOM_PART_APM .Cd options GEOM_PART_BSD +.Cd options GEOM_PART_BSD64 .Cd options GEOM_PART_EBR .Cd options GEOM_PART_EBR_COMPAT .Cd options GEOM_PART_GPT @@ -71,6 +73,7 @@ .Cd options GEOM_SHSEC .Cd options GEOM_STRIPE .Cd options GEOM_SUNLABEL +.Cd options GEOM_UNCOMPRESS .Cd options GEOM_UZIP .Cd options GEOM_VIRSTOR .Cd options GEOM_VOL Modified: stable/10/share/man/man4/geom_map.4 ============================================================================== --- stable/10/share/man/man4/geom_map.4 Mon Aug 21 09:52:15 2017 (r322743) +++ stable/10/share/man/man4/geom_map.4 Mon Aug 21 10:07:12 2017 (r322744) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 2011 +.Dd June 8, 2015 .Dt GEOM_MAP 4 .Os .Sh NAME @@ -36,7 +36,7 @@ To compile this driver into the kernel, place the following line in your kernel configuration file: .Bd -ragged -offset indent -.Cd "device geom_map" +.Cd "options geom_map" .Ed .Sh DESCRIPTION The Modified: stable/10/sys/conf/NOTES ============================================================================== --- stable/10/sys/conf/NOTES Mon Aug 21 09:52:15 2017 (r322743) +++ stable/10/sys/conf/NOTES Mon Aug 21 10:07:12 2017 (r322744) @@ -156,6 +156,7 @@ options GEOM_GATE # Userland services. options GEOM_JOURNAL # Journaling. options GEOM_LABEL # Providers labelization. options GEOM_LINUX_LVM # Linux LVM2 volumes +options GEOM_MAP # Map based partitioning options GEOM_MBR # DOS/MBR partitioning options GEOM_MIRROR # Disk mirroring. options GEOM_MULTIPATH # Disk multipath @@ -176,6 +177,7 @@ options GEOM_RAID3 # RAID3 functionality. options GEOM_SHSEC # Shared secret. options GEOM_STRIPE # Disk striping. options GEOM_SUNLABEL # Sun/Solaris partitioning +options GEOM_UNCOMPRESS # Read-only compressed disks (lzma, zip) options GEOM_UZIP # Read-only compressed disks options GEOM_VINUM # Vinum logical volume manager options GEOM_VIRSTOR # Virtual storage. Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Mon Aug 21 09:52:15 2017 (r322743) +++ stable/10/sys/conf/options Mon Aug 21 10:07:12 2017 (r322744) @@ -104,6 +104,7 @@ GEOM_GATE opt_geom.h GEOM_JOURNAL opt_geom.h GEOM_LABEL opt_geom.h GEOM_LINUX_LVM opt_geom.h +GEOM_MAP opt_geom.h GEOM_MBR opt_geom.h GEOM_MIRROR opt_geom.h GEOM_MOUNTVER opt_geom.h From owner-svn-src-all@freebsd.org Mon Aug 21 10:26:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5C77DD00B5; Mon, 21 Aug 2017 10:26:12 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81DDA691F7; Mon, 21 Aug 2017 10:26:12 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LAQBHE041555; Mon, 21 Aug 2017 10:26:11 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LAQBNW041554; Mon, 21 Aug 2017 10:26:11 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201708211026.v7LAQBNW041554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Mon, 21 Aug 2017 10:26:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322745 - stable/11/share/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/11/share/mk X-SVN-Commit-Revision: 322745 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 10:26:12 -0000 Author: lwhsu (ports committer) Date: Mon Aug 21 10:26:11 2017 New Revision: 322745 URL: https://svnweb.freebsd.org/changeset/base/322745 Log: MFC r322434: Re-remove excess / for installing SYMLINKS This excess / was introduced in r280129, and fixed in r295230, but got re-introduced while merging another branch in r298107. Approved by: gjb Differential Revision: https://reviews.freebsd.org/D11995 Modified: stable/11/share/mk/bsd.links.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/bsd.links.mk ============================================================================== --- stable/11/share/mk/bsd.links.mk Mon Aug 21 10:07:12 2017 (r322744) +++ stable/11/share/mk/bsd.links.mk Mon Aug 21 10:26:11 2017 (r322745) @@ -20,5 +20,5 @@ _installlinks: .endfor .for s t in ${SYMLINKS} @${ECHO} "${t} -> ${s}" ;\ - ${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}/${t} + ${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}${t} .endfor From owner-svn-src-all@freebsd.org Mon Aug 21 11:51:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C656DD53F1; Mon, 21 Aug 2017 11:51:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 290BA6C1A3; Mon, 21 Aug 2017 11:51:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LBpeYI077808; Mon, 21 Aug 2017 11:51:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LBpeH2077807; Mon, 21 Aug 2017 11:51:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708211151.v7LBpeH2077807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 21 Aug 2017 11:51:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322746 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 322746 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 11:51:41 -0000 Author: hselasky Date: Mon Aug 21 11:51:40 2017 New Revision: 322746 URL: https://svnweb.freebsd.org/changeset/base/322746 Log: Fix for deadlock situation in the LinuxKPI's RCU synchronize API. Deadlock condition: The return value of TDQ_LOCKPTR(td) is the same for two threads. 1) The first thread signals a wakeup while keeping the rcu_read_lock(). This invokes sched_add() which in turn will try to lock TDQ_LOCK(). 2) The second thread is calling synchronize_rcu() calling mi_switch() over and over again trying to yield(). This prevents the first thread from running and releasing the RCU reader lock. Solution: Release the thread lock while yielding to allow other threads to acquire the lock pointed to by TDQ_LOCKPTR(td). Found by: KrishnamRaju ErapaRaju MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_rcu.c Mon Aug 21 10:26:11 2017 (r322745) +++ head/sys/compat/linuxkpi/common/src/linux_rcu.c Mon Aug 21 11:51:40 2017 (r322746) @@ -258,6 +258,15 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, c sched_prio(td, prio); /* task switch */ mi_switch(SW_VOL | SWT_RELINQUISH, NULL); + + /* + * Release the thread lock while yielding to + * allow other threads to acquire the lock + * pointed to by TDQ_LOCKPTR(td). Else a + * deadlock like situation might happen. + */ + thread_unlock(td); + thread_lock(td); } } else { /* From owner-svn-src-all@freebsd.org Mon Aug 21 12:23:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF759DD7B7D; Mon, 21 Aug 2017 12:23:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7DCD06D59D; Mon, 21 Aug 2017 12:23:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LCNBgE090869; Mon, 21 Aug 2017 12:23:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LCNBbN090868; Mon, 21 Aug 2017 12:23:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708211223.v7LCNBbN090868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 21 Aug 2017 12:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322748 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/arm64/arm64 X-SVN-Commit-Revision: 322748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 12:23:12 -0000 Author: emaste Date: Mon Aug 21 12:23:11 2017 New Revision: 322748 URL: https://svnweb.freebsd.org/changeset/base/322748 Log: MFC r322627: arm64: return error instead of panic in unimplemented ptrace ops We don't need a panic as a reminder that these need to be implemented. Reported by: Shawn Webb Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/arm64/arm64/machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/machdep.c ============================================================================== --- stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 11:56:47 2017 (r322747) +++ stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 12:23:11 2017 (r322748) @@ -242,22 +242,24 @@ int fill_dbregs(struct thread *td, struct dbreg *regs) { - panic("ARM64TODO: fill_dbregs"); + printf("ARM64TODO: fill_dbregs"); + return (EDOOFUS); } int set_dbregs(struct thread *td, struct dbreg *regs) { - panic("ARM64TODO: set_dbregs"); + printf("ARM64TODO: set_dbregs"); + return (EDOOFUS); } int ptrace_set_pc(struct thread *td, u_long addr) { - panic("ARM64TODO: ptrace_set_pc"); - return (0); + printf("ARM64TODO: ptrace_set_pc"); + return (EDOOFUS); } int From owner-svn-src-all@freebsd.org Mon Aug 21 12:42:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAFC9DD8B4A; Mon, 21 Aug 2017 12:42:06 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A956C6DD4B; Mon, 21 Aug 2017 12:42:06 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LCg5LI098004; Mon, 21 Aug 2017 12:42:05 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LCg53G098003; Mon, 21 Aug 2017 12:42:05 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201708211242.v7LCg53G098003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 21 Aug 2017 12:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322749 - head/kerberos5/libexec/kpasswdd X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/kerberos5/libexec/kpasswdd X-SVN-Commit-Revision: 322749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 12:42:07 -0000 Author: cy Date: Mon Aug 21 12:42:05 2017 New Revision: 322749 URL: https://svnweb.freebsd.org/changeset/base/322749 Log: Replace the include path using CURDIR with KRB5DIR. This is consistent with the rest of the Makefiles in kerberos5/. MFC after: 1 week Modified: head/kerberos5/libexec/kpasswdd/Makefile Modified: head/kerberos5/libexec/kpasswdd/Makefile ============================================================================== --- head/kerberos5/libexec/kpasswdd/Makefile Mon Aug 21 12:23:11 2017 (r322748) +++ head/kerberos5/libexec/kpasswdd/Makefile Mon Aug 21 12:42:05 2017 (r322749) @@ -2,7 +2,7 @@ PROG= kpasswdd MAN= kpasswdd.8 -CFLAGS+=-I${KRB5DIR}/lib/roken -I${.CURDIR:H:H}/lib/libhdb ${LDAPCFLAGS} +CFLAGS+=-I${KRB5DIR}/lib/roken -I${KRB5DIR}/lib/libhdb ${LDAPCFLAGS} LIBADD= kadm5srv hdb krb5 roken vers asn1 DPADD= ${LDAPDPADD} LDADD= ${LDAPLDADD} From owner-svn-src-all@freebsd.org Mon Aug 21 13:49:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71CCADDCAB1; Mon, 21 Aug 2017 13:49:43 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x235.google.com (mail-it0-x235.google.com [IPv6:2607:f8b0:4001:c0b::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A12D70626; Mon, 21 Aug 2017 13:49:43 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x235.google.com with SMTP id 76so32685209ith.0; Mon, 21 Aug 2017 06:49:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=dqTROEsrc28jO2oUofNX9X5cvIXjG3vHOdCE7SUB8b4=; b=BJvjPnZ7NPlTdKaU4r9hsiNrRWV122F6TlHco90ViGxlpVpZtIvZ0P4RtwCmtsf1ar +yE5XZV7bvatK70hM/TIMLoGc2vF/3nMAofl7QVHBHlo64BvZ4nxBdzEWvXLJfjZex9L smzLr6yXGETrFrxQFFZKKJy6ymbuOCaa6vcjfVhaQsm8JZk6GB3O1YbfrIQWQ7/lgQkP tYJEcQuC+e3wdtAcJf0lQVlJ0SnBC2QP3gweG9zD70mdLoRL6CgNfMxClGJO7pJBzSYP jmbUQaJ1JFbu2vlPre4pJoBb/Up1CdsVXh2b8w3aI9f3qA1fOlx7DFG9biJWKFxfZ09x WDIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=dqTROEsrc28jO2oUofNX9X5cvIXjG3vHOdCE7SUB8b4=; b=B/yFkBcz0/oWseaMvZQmf44iBvPkFoASWnttcEqxw81SKiSiT+aXnAIULD4xRasbPf r1sAraECU9M7VTIA9H9XHfgcbHPvcF1UMLHMwQuhWbXr0vMYZIVmK9iGTP5dJDlc3d+n MEXct5P4T85fKkTddraOqC4KpS+BCug6xCsDllX7ius4ef9gy/FjroVMKxU7RHIfvF4P 5b7QJmL1TQPR5V5e1gEDAJTYIKbrkRBToQE43N9tP//cflSCp34W2N3PHQUYbw2/5CNj cFdvkN0k6baIUetGSmxwt5fx0RGIH7SsaEMh2Tb5NhiEWwgBwOgxRqWdHiJ8ItQNKTKm 8rgQ== X-Gm-Message-State: AHYfb5gCP0bh4WxU+SEeooZKP+zShMoFVBdtgBt11LF4BJgVn2imzN84 Y4sXGhDp30FL9T7ijPD+6kulRbj1Ng== X-Received: by 10.36.19.11 with SMTP id 11mr184741itz.153.1503323382597; Mon, 21 Aug 2017 06:49:42 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.24.66 with HTTP; Mon, 21 Aug 2017 06:49:22 -0700 (PDT) In-Reply-To: References: <201708190032.v7J0WQAa017551@repo.freebsd.org> From: Ed Maste Date: Mon, 21 Aug 2017 09:49:22 -0400 X-Google-Sender-Auth: 6FYH1XUVSxrT3vQMkYWXJT8F0vo Message-ID: Subject: Re: svn commit: r322678 - in head/usr.sbin/pw: . tests To: "Ngie Cooper (yaneurabeya)" Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 13:49:43 -0000 On 18 August 2017 at 21:08, Ngie Cooper (yaneurabeya) wrote: > >> On Aug 18, 2017, at 17:32, Ed Maste wrote: >> >> Author: emaste >> Date: Sat Aug 19 00:32:26 2017 >> New Revision: 322678 >> URL: https://svnweb.freebsd.org/changeset/base/322678 >> >> Log: >> pw useradd: Validate the user name before creating the entry >> >> Previouly it was possible to create users with spaces in the name with: >> pw useradd -u 1234 -g 1234 -n 'test user' >> >> The "-g 1234" is relevant, without it the name was already rejected >> as expected: ... > > Usernames with passwords are permitted in some cases, e.g., AD. I assume you meant "usernames with spaces"? Note that this change only addresses the discrepancy between "pw useradd 'test user'" (which was previously rejected) and "pw useradd 'test user' -g " (which was accepted prior to this change). From owner-svn-src-all@freebsd.org Mon Aug 21 13:52:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85F51DDCE4B; Mon, 21 Aug 2017 13:52:22 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61C1370A07; Mon, 21 Aug 2017 13:52:22 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LDqLOM033413; Mon, 21 Aug 2017 13:52:21 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LDqLjW033409; Mon, 21 Aug 2017 13:52:21 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708211352.v7LDqLjW033409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 21 Aug 2017 13:52:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322750 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 322750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 13:52:22 -0000 Author: ae Date: Mon Aug 21 13:52:21 2017 New Revision: 322750 URL: https://svnweb.freebsd.org/changeset/base/322750 Log: Fix the regression introduced in r275710. When a security policy should match TCP connection with specific ports, the SYN+ACK segment send by syncache_respond() is considered as forwarded packet, because at this moment TCP connection does not have PCB structure, and ip_output() is called without inpcb pointer. In this case SPIDX filled for SP lookup will not contain TCP ports and security policy will not be found. This can lead to unencrypted SYN+ACK on the wire. This patch restores the old behavior, when ports will not be filled only for forwarded packets. Reported by: Dewayne Geraghty MFC after: 1 week Modified: head/sys/netipsec/ipsec.c head/sys/netipsec/ipsec.h head/sys/netipsec/ipsec6.h head/sys/netipsec/ipsec_output.c Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Mon Aug 21 12:42:05 2017 (r322749) +++ head/sys/netipsec/ipsec.c Mon Aug 21 13:52:21 2017 (r322750) @@ -563,7 +563,8 @@ ipsec4_setspidx_ipaddr(const struct mbuf *m, struct se } static struct secpolicy * -ipsec4_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir) +ipsec4_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir, + int needport) { struct secpolicyindex spidx; struct secpolicy *sp; @@ -573,7 +574,7 @@ ipsec4_getpolicy(const struct mbuf *m, struct inpcb *i /* Make an index to look for a policy. */ ipsec4_setspidx_ipaddr(m, &spidx); /* Fill ports in spidx if we have inpcb. */ - ipsec4_get_ulp(m, &spidx, inp != NULL); + ipsec4_get_ulp(m, &spidx, needport); spidx.dir = dir; sp = key_allocsp(&spidx, dir); } @@ -586,12 +587,13 @@ ipsec4_getpolicy(const struct mbuf *m, struct inpcb *i * Check security policy for *OUTBOUND* IPv4 packet. */ struct secpolicy * -ipsec4_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error) +ipsec4_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error, + int needport) { struct secpolicy *sp; *error = 0; - sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_OUTBOUND); + sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_OUTBOUND, needport); if (sp != NULL) sp = ipsec_checkpolicy(sp, inp, error); if (sp == NULL) { @@ -623,7 +625,7 @@ ipsec4_in_reject(const struct mbuf *m, struct inpcb *i struct secpolicy *sp; int result; - sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_INBOUND); + sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_INBOUND, 0); result = ipsec_in_reject(sp, inp, m); key_freesp(&sp); if (result != 0) @@ -731,7 +733,8 @@ ipsec6_setspidx_ipaddr(const struct mbuf *m, struct se } static struct secpolicy * -ipsec6_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir) +ipsec6_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir, + int needport) { struct secpolicyindex spidx; struct secpolicy *sp; @@ -741,7 +744,7 @@ ipsec6_getpolicy(const struct mbuf *m, struct inpcb *i /* Make an index to look for a policy. */ ipsec6_setspidx_ipaddr(m, &spidx); /* Fill ports in spidx if we have inpcb. */ - ipsec6_get_ulp(m, &spidx, inp != NULL); + ipsec6_get_ulp(m, &spidx, needport); spidx.dir = dir; sp = key_allocsp(&spidx, dir); } @@ -754,12 +757,13 @@ ipsec6_getpolicy(const struct mbuf *m, struct inpcb *i * Check security policy for *OUTBOUND* IPv6 packet. */ struct secpolicy * -ipsec6_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error) +ipsec6_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error, + int needport) { struct secpolicy *sp; *error = 0; - sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_OUTBOUND); + sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_OUTBOUND, needport); if (sp != NULL) sp = ipsec_checkpolicy(sp, inp, error); if (sp == NULL) { @@ -791,7 +795,7 @@ ipsec6_in_reject(const struct mbuf *m, struct inpcb *i struct secpolicy *sp; int result; - sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_INBOUND); + sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_INBOUND, 0); result = ipsec_in_reject(sp, inp, m); key_freesp(&sp); if (result) Modified: head/sys/netipsec/ipsec.h ============================================================================== --- head/sys/netipsec/ipsec.h Mon Aug 21 12:42:05 2017 (r322749) +++ head/sys/netipsec/ipsec.h Mon Aug 21 13:52:21 2017 (r322750) @@ -320,7 +320,7 @@ int ipsec_if_input(struct mbuf *, struct secasvar *, u struct ipsecrequest *ipsec_newisr(void); void ipsec_delisr(struct ipsecrequest *); struct secpolicy *ipsec4_checkpolicy(const struct mbuf *, struct inpcb *, - int *); + int *, int); u_int ipsec_get_reqlevel(struct secpolicy *, u_int); Modified: head/sys/netipsec/ipsec6.h ============================================================================== --- head/sys/netipsec/ipsec6.h Mon Aug 21 12:42:05 2017 (r322749) +++ head/sys/netipsec/ipsec6.h Mon Aug 21 13:52:21 2017 (r322750) @@ -60,7 +60,7 @@ VNET_DECLARE(int, ip6_ipsec_ecn); struct inpcb; struct secpolicy *ipsec6_checkpolicy(const struct mbuf *, - struct inpcb *, int *); + struct inpcb *, int *, int); void ipsec6_setsockaddrs(const struct mbuf *, union sockaddr_union *, union sockaddr_union *); Modified: head/sys/netipsec/ipsec_output.c ============================================================================== --- head/sys/netipsec/ipsec_output.c Mon Aug 21 12:42:05 2017 (r322749) +++ head/sys/netipsec/ipsec_output.c Mon Aug 21 13:52:21 2017 (r322750) @@ -297,7 +297,7 @@ ipsec4_common_output(struct mbuf *m, struct inpcb *inp int error; /* Lookup for the corresponding outbound security policy */ - sp = ipsec4_checkpolicy(m, inp, &error); + sp = ipsec4_checkpolicy(m, inp, &error, !forwarding); if (sp == NULL) { if (error == -EINVAL) { /* Discarded by policy. */ @@ -599,7 +599,7 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp int error; /* Lookup for the corresponding outbound security policy */ - sp = ipsec6_checkpolicy(m, inp, &error); + sp = ipsec6_checkpolicy(m, inp, &error, !forwarding); if (sp == NULL) { if (error == -EINVAL) { /* Discarded by policy. */ From owner-svn-src-all@freebsd.org Mon Aug 21 13:54:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45B44DDD066; Mon, 21 Aug 2017 13:54:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F66270C9D; Mon, 21 Aug 2017 13:54:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LDsUDY033522; Mon, 21 Aug 2017 13:54:30 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LDsUIL033521; Mon, 21 Aug 2017 13:54:30 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708211354.v7LDsUIL033521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 21 Aug 2017 13:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322751 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 322751 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 13:54:31 -0000 Author: ae Date: Mon Aug 21 13:54:29 2017 New Revision: 322751 URL: https://svnweb.freebsd.org/changeset/base/322751 Log: Remove stale comments. MFC after: 1 week Modified: head/sys/netipsec/ipsec.c Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Mon Aug 21 13:52:21 2017 (r322750) +++ head/sys/netipsec/ipsec.c Mon Aug 21 13:54:29 2017 (r322751) @@ -573,7 +573,6 @@ ipsec4_getpolicy(const struct mbuf *m, struct inpcb *i if (sp == NULL && key_havesp(dir)) { /* Make an index to look for a policy. */ ipsec4_setspidx_ipaddr(m, &spidx); - /* Fill ports in spidx if we have inpcb. */ ipsec4_get_ulp(m, &spidx, needport); spidx.dir = dir; sp = key_allocsp(&spidx, dir); @@ -743,7 +742,6 @@ ipsec6_getpolicy(const struct mbuf *m, struct inpcb *i if (sp == NULL && key_havesp(dir)) { /* Make an index to look for a policy. */ ipsec6_setspidx_ipaddr(m, &spidx); - /* Fill ports in spidx if we have inpcb. */ ipsec6_get_ulp(m, &spidx, needport); spidx.dir = dir; sp = key_allocsp(&spidx, dir); From owner-svn-src-all@freebsd.org Mon Aug 21 14:14:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09AEDDDE539; Mon, 21 Aug 2017 14:14:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBD3A71949; Mon, 21 Aug 2017 14:14:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LEEEuJ041690; Mon, 21 Aug 2017 14:14:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LEEEiJ041689; Mon, 21 Aug 2017 14:14:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708211414.v7LEEEiJ041689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 21 Aug 2017 14:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322752 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 322752 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 14:14:15 -0000 Author: gjb Date: Mon Aug 21 14:14:13 2017 New Revision: 322752 URL: https://svnweb.freebsd.org/changeset/base/322752 Log: Update the tests(7) manual page to note the test suite is installed by default as of 11.0-RELEASE. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/share/man/man7/tests.7 Modified: head/share/man/man7/tests.7 ============================================================================== --- head/share/man/man7/tests.7 Mon Aug 21 13:54:29 2017 (r322751) +++ head/share/man/man7/tests.7 Mon Aug 21 14:14:13 2017 (r322752) @@ -26,7 +26,7 @@ .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 22, 2017 +.Dd August 21, 2017 .Dt TESTS 7 .Os .Sh NAME @@ -59,10 +59,9 @@ hierarchy. This manual page describes how to run the test suite and how to configure some of its optional features. .Ss Installing the test suite -The test suite is not yet installed by default as part of -.Fx , -but this is bound to change during the development of -.Fx 11.0 . +The test suite is installed by default as of +.Fx +11.0-RELEASE. .Pp If the .Pa /usr/tests From owner-svn-src-all@freebsd.org Mon Aug 21 15:11:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAB4ADE1BAE; Mon, 21 Aug 2017 15:11:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78E07739AC; Mon, 21 Aug 2017 15:11:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LFBwiq066130; Mon, 21 Aug 2017 15:11:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LFBwC9066129; Mon, 21 Aug 2017 15:11:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708211511.v7LFBwC9066129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 21 Aug 2017 15:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322753 - stable/11/sys/i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/i386/i386 X-SVN-Commit-Revision: 322753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 15:11:59 -0000 Author: kib Date: Mon Aug 21 15:11:58 2017 New Revision: 322753 URL: https://svnweb.freebsd.org/changeset/base/322753 Log: MFC r322667,r322706: Improve i386 #UD low-level kdtrace hook. Modified: stable/11/sys/i386/i386/exception.s Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/i386/exception.s ============================================================================== --- stable/11/sys/i386/i386/exception.s Mon Aug 21 14:14:13 2017 (r322752) +++ stable/11/sys/i386/i386/exception.s Mon Aug 21 15:11:58 2017 (r322753) @@ -183,21 +183,29 @@ calltrap: #ifdef KDTRACE_HOOKS SUPERALIGN_TEXT IDTVEC(ill) - /* Check if there is no DTrace hook registered. */ - cmpl $0,dtrace_invop_jump_addr + /* + * Check if a DTrace hook is registered. The default (data) segment + * cannot be used for this since %ds is not known good until we + * verify that the entry was from kernel mode. + */ + cmpl $0,%ss:dtrace_invop_jump_addr je norm_ill - /* Check if this is a user fault. */ - cmpl $GSEL_KPL, 4(%esp) /* Check the code segment. */ - - /* If so, just handle it as a normal trap. */ + /* + * Check if this is a user fault. If so, just handle it as a normal + * trap. + */ + cmpl $GSEL_KPL, 4(%esp) /* Check the code segment */ jne norm_ill + testl $PSL_VM, 8(%esp) /* and vm86 mode. */ + jnz norm_ill /* * This is a kernel instruction fault that might have been caused * by a DTrace provider. */ - pushal /* Push all registers onto the stack. */ + pushal + cld /* * Set our jump address for the jump back in the event that From owner-svn-src-all@freebsd.org Mon Aug 21 15:44:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F207DE3843; Mon, 21 Aug 2017 15:44:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DB4374CE7; Mon, 21 Aug 2017 15:44:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LFivsE078701; Mon, 21 Aug 2017 15:44:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LFivHB078700; Mon, 21 Aug 2017 15:44:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708211544.v7LFivHB078700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 21 Aug 2017 15:44:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322755 - stable/10/sys/i386/i386 X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/i386/i386 X-SVN-Commit-Revision: 322755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 15:44:58 -0000 Author: kib Date: Mon Aug 21 15:44:57 2017 New Revision: 322755 URL: https://svnweb.freebsd.org/changeset/base/322755 Log: MFC r322667,r322706: Improve i386 #UD low-level kdtrace hook. Approved by: re (marius) Modified: stable/10/sys/i386/i386/exception.s Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/i386/i386/exception.s ============================================================================== --- stable/10/sys/i386/i386/exception.s Mon Aug 21 15:39:48 2017 (r322754) +++ stable/10/sys/i386/i386/exception.s Mon Aug 21 15:44:57 2017 (r322755) @@ -185,21 +185,29 @@ calltrap: #ifdef KDTRACE_HOOKS SUPERALIGN_TEXT IDTVEC(ill) - /* Check if there is no DTrace hook registered. */ - cmpl $0,dtrace_invop_jump_addr + /* + * Check if a DTrace hook is registered. The default (data) segment + * cannot be used for this since %ds is not known good until we + * verify that the entry was from kernel mode. + */ + cmpl $0,%ss:dtrace_invop_jump_addr je norm_ill - /* Check if this is a user fault. */ - cmpl $GSEL_KPL, 4(%esp) /* Check the code segment. */ - - /* If so, just handle it as a normal trap. */ + /* + * Check if this is a user fault. If so, just handle it as a normal + * trap. + */ + cmpl $GSEL_KPL, 4(%esp) /* Check the code segment */ jne norm_ill + testl $PSL_VM, 8(%esp) /* and vm86 mode. */ + jnz norm_ill /* * This is a kernel instruction fault that might have been caused * by a DTrace provider. */ - pushal /* Push all registers onto the stack. */ + pushal + cld /* * Set our jump address for the jump back in the event that From owner-svn-src-all@freebsd.org Mon Aug 21 16:16:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56322DE58B1; Mon, 21 Aug 2017 16:16:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 239D9760A8; Mon, 21 Aug 2017 16:16:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LGG26q090803; Mon, 21 Aug 2017 16:16:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LGG2XM090802; Mon, 21 Aug 2017 16:16:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708211616.v7LGG2XM090802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 21 Aug 2017 16:16:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322756 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 322756 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 16:16:03 -0000 Author: kib Date: Mon Aug 21 16:16:02 2017 New Revision: 322756 URL: https://svnweb.freebsd.org/changeset/base/322756 Log: Style. Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Mon Aug 21 15:44:57 2017 (r322755) +++ head/sys/ufs/ffs/ffs_softdep.c Mon Aug 21 16:16:02 2017 (r322756) @@ -14059,7 +14059,7 @@ softdep_count_dependencies(bp, wantcount) } out: FREE_LOCK(ump); - return retval; + return (retval); } /* From owner-svn-src-all@freebsd.org Mon Aug 21 16:23:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA64FDE623F; Mon, 21 Aug 2017 16:23:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9F9C7663F; Mon, 21 Aug 2017 16:23:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LGNixF094839; Mon, 21 Aug 2017 16:23:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LGNiuc094838; Mon, 21 Aug 2017 16:23:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708211623.v7LGNiuc094838@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 21 Aug 2017 16:23:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322757 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 322757 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 16:23:46 -0000 Author: kib Date: Mon Aug 21 16:23:44 2017 New Revision: 322757 URL: https://svnweb.freebsd.org/changeset/base/322757 Log: Avoid dereferencing potentially freed workitem in softdep_count_dependencies(). Buffer's b_dep list is protected by the SU mount lock. Owning the buffer lock is not enough to guarantee the stability of the list. Calculation of the UFS mount owning the workitems from the buffer must be much more careful to not dereference the work item which might be freed meantime. To get to ump, use the pointers chain which does not involve workitems at all. Reported and tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Mon Aug 21 16:16:02 2017 (r322756) +++ head/sys/ufs/ffs/ffs_softdep.c Mon Aug 21 16:23:44 2017 (r322757) @@ -13919,12 +13919,36 @@ softdep_count_dependencies(bp, wantcount) struct newblk *newblk; struct mkdir *mkdir; struct diradd *dap; + struct vnode *vp; + struct mount *mp; int i, retval; retval = 0; - if ((wk = LIST_FIRST(&bp->b_dep)) == NULL) + if (LIST_EMPTY(&bp->b_dep)) return (0); - ump = VFSTOUFS(wk->wk_mp); + vp = bp->b_vp; + + /* + * The ump mount point is stable after we get a correct + * pointer, since bp is locked and this prevents unmount from + * proceed. But to get to it, we cannot dereference bp->b_dep + * head wk_mp, because we do not yet own SU ump lock and + * workitem might be freed while dereferenced. + */ +retry: + if (vp->v_type == VCHR) { + VOP_LOCK(vp, LK_RETRY | LK_EXCLUSIVE); + mp = vp->v_type == VCHR ? vp->v_rdev->si_mountpt : NULL; + VOP_UNLOCK(vp, 0); + if (mp == NULL) + goto retry; + } else if (vp->v_type == VREG) { + mp = vp->v_mount; + } else { + return (0); + } + ump = VFSTOUFS(mp); + ACQUIRE_LOCK(ump); LIST_FOREACH(wk, &bp->b_dep, wk_list) { switch (wk->wk_type) { From owner-svn-src-all@freebsd.org Mon Aug 21 17:20:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87781DE9011; Mon, 21 Aug 2017 17:20:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 548E27C34F; Mon, 21 Aug 2017 17:20:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LHKVB0015475; Mon, 21 Aug 2017 17:20:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LHKVFq015474; Mon, 21 Aug 2017 17:20:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708211720.v7LHKVFq015474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 21 Aug 2017 17:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322759 - stable/10/bin/chmod/tests X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/bin/chmod/tests X-SVN-Commit-Revision: 322759 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 17:20:32 -0000 Author: gjb Date: Mon Aug 21 17:20:31 2017 New Revision: 322759 URL: https://svnweb.freebsd.org/changeset/base/322759 Log: MFC r321949, r321950, r322101: r321949 (ngie): Add expected failures for ZFS - :f_flag fails on ZFS because UF_IMMUTABLE isn't supported. - :v_flag fails on ZFS because the mode for foo is [always] updated unnecessarily. get_filesystem(..) (supporting function that was added to the test script) is based on equivalent logic in usr.bin/extattr/tests/extattr_test.sh . r321950 (ngie): Always use first parameter passed to get_filesystem(..) instead of discarding it and using `.` instead. r322101 (ngie): Don't check result of chflags in f_flag_cleanup() This will prevent false positives from occurring if the test is run on ZFS since ZFS doesn't support fflags throbbing like UFS. PR: 221188, 221189 Approved by: re (marius) Sponsored by: The FreeBSD Foundation Modified: stable/10/bin/chmod/tests/chmod_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/chmod/tests/chmod_test.sh ============================================================================== --- stable/10/bin/chmod/tests/chmod_test.sh Mon Aug 21 17:05:43 2017 (r322758) +++ stable/10/bin/chmod/tests/chmod_test.sh Mon Aug 21 17:20:31 2017 (r322759) @@ -25,6 +25,13 @@ # # $FreeBSD$ +get_filesystem() +{ + local mountpoint=$1 + + df -T $mountpoint | tail -n 1 | cut -wf 2 +} + atf_test_case RH_flag RH_flag_head() { @@ -94,6 +101,11 @@ f_flag_body() { atf_check truncate -s 0 foo bar atf_check chmod 0750 foo bar + case "$(get_filesystem .)" in + zfs) + atf_expect_fail "ZFS doesn't support UF_IMMUTABLE; returns EPERM - bug 221189" + ;; + esac atf_check chflags uchg foo atf_check -e not-empty -s not-exit:0 chmod 0700 foo bar atf_check -o inline:'100750\n100700\n' stat -f '%p' foo bar @@ -103,7 +115,7 @@ f_flag_body() f_flag_cleanup() { - atf_check chflags 0 foo + chflags 0 foo || : } atf_test_case h_flag @@ -140,6 +152,11 @@ v_flag_body() atf_check truncate -s 0 foo bar atf_check chmod 0600 foo atf_check chmod 0750 bar + case "$(get_filesystem .)" in + zfs) + atf_expect_fail "ZFS updates mode for foo unnecessarily - bug 221188" + ;; + esac atf_check -o 'inline:bar\n' chmod -v 0600 foo bar atf_check chmod -v 0600 foo bar for f in foo bar; do From owner-svn-src-all@freebsd.org Mon Aug 21 17:29:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DB8FDE990E; Mon, 21 Aug 2017 17:29:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0D7F7C9FE; Mon, 21 Aug 2017 17:29:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LHTcAt019558; Mon, 21 Aug 2017 17:29:38 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LHTcV8019557; Mon, 21 Aug 2017 17:29:38 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708211729.v7LHTcV8019557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 21 Aug 2017 17:29:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322760 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/arm64/arm64 X-SVN-Commit-Revision: 322760 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 17:29:39 -0000 Author: jhb Date: Mon Aug 21 17:29:37 2017 New Revision: 322760 URL: https://svnweb.freebsd.org/changeset/base/322760 Log: MFC 322436: Don't panic for PT_GETFPREGS. Only fetch the VFP state from the CPU if the thread whose registers are being requested is the current thread. If a stopped thread's registers are being fetched by a debugger, the saved state in the PCB is already valid. Modified: stable/11/sys/arm64/arm64/machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/machdep.c ============================================================================== --- stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 17:20:31 2017 (r322759) +++ stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 17:29:37 2017 (r322760) @@ -213,7 +213,8 @@ fill_fpregs(struct thread *td, struct fpreg *regs) * If we have just been running VFP instructions we will * need to save the state to memcpy it below. */ - vfp_save_state(td, pcb); + if (td == curthread) + vfp_save_state(td, pcb); memcpy(regs->fp_q, pcb->pcb_vfp, sizeof(regs->fp_q)); regs->fp_cr = pcb->pcb_fpcr; From owner-svn-src-all@freebsd.org Mon Aug 21 17:35:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14C4DDE9FF9; Mon, 21 Aug 2017 17:35:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E288B7CEE0; Mon, 21 Aug 2017 17:35:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LHZ45A023566; Mon, 21 Aug 2017 17:35:04 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LHZ4UG023562; Mon, 21 Aug 2017 17:35:04 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708211735.v7LHZ4UG023562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 21 Aug 2017 17:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322761 - in stable/11/sys/arm64: arm64 include X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11/sys/arm64: arm64 include X-SVN-Commit-Revision: 322761 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 17:35:06 -0000 Author: jhb Date: Mon Aug 21 17:35:04 2017 New Revision: 322761 URL: https://svnweb.freebsd.org/changeset/base/322761 Log: MFC 322437: Reliably enable debug exceptions on all CPUs. Previously, debug exceptions were only enabled on the boot CPU if DDB was enabled in the dbg_monitor_init() function. APs also called this function, but since mp_machdep.c doesn't include opt_ddb.h, the APs ended up calling an empty stub defined in instead of the real function. Also, if DDB was not enabled in the kernel, the boot CPU would not enable debug exceptions. Fix this by adding a new dbg_init() function that always clears the OS lock to enable debug exceptions which the boot CPU and the APs call. This function also calls dbg_monitor_init() to enable hardware breakpoints from DDB on all CPUs if DDB is enabled. Eventually base support for hardware breakpoints/watchpoints will need to move out of the DDB-only debug_monitor.c for use by userland debuggers. Modified: stable/11/sys/arm64/arm64/debug_monitor.c stable/11/sys/arm64/arm64/machdep.c stable/11/sys/arm64/arm64/mp_machdep.c stable/11/sys/arm64/include/machdep.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/debug_monitor.c ============================================================================== --- stable/11/sys/arm64/arm64/debug_monitor.c Mon Aug 21 17:29:37 2017 (r322760) +++ stable/11/sys/arm64/arm64/debug_monitor.c Mon Aug 21 17:35:04 2017 (r322761) @@ -453,15 +453,12 @@ dbg_monitor_init(void) { u_int i; - /* Clear OS lock */ - WRITE_SPECIALREG(OSLAR_EL1, 0); - /* Find out many breakpoints and watchpoints we can use */ dbg_watchpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 20) & 0xf) + 1; dbg_breakpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 12) & 0xf) + 1; if (bootverbose && PCPU_GET(cpuid) == 0) { - db_printf("%d watchpoints and %d breakpoints supported\n", + printf("%d watchpoints and %d breakpoints supported\n", dbg_watchpoint_num, dbg_breakpoint_num); } Modified: stable/11/sys/arm64/arm64/machdep.c ============================================================================== --- stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 17:29:37 2017 (r322760) +++ stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 17:35:04 2017 (r322761) @@ -970,11 +970,24 @@ initarm(struct arm64_bootparams *abp) mutex_init(); init_param2(physmem); - dbg_monitor_init(); + dbg_init(); kdb_init(); pan_enable(); early_boot = 0; +} + +void +dbg_init(void) +{ + + /* Clear OS lock */ + WRITE_SPECIALREG(OSLAR_EL1, 0); + + /* This permits DDB to use debug registers for watchpoints. */ + dbg_monitor_init(); + + /* TODO: Eventually will need to initialize debug registers here. */ } #ifdef DDB Modified: stable/11/sys/arm64/arm64/mp_machdep.c ============================================================================== --- stable/11/sys/arm64/arm64/mp_machdep.c Mon Aug 21 17:29:37 2017 (r322760) +++ stable/11/sys/arm64/arm64/mp_machdep.c Mon Aug 21 17:35:04 2017 (r322761) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #ifdef VFP @@ -277,7 +276,7 @@ init_secondary(uint64_t cpu) vfp_init(); #endif - dbg_monitor_init(); + dbg_init(); pan_enable(); /* Enable interrupts */ Modified: stable/11/sys/arm64/include/machdep.h ============================================================================== --- stable/11/sys/arm64/include/machdep.h Mon Aug 21 17:29:37 2017 (r322760) +++ stable/11/sys/arm64/include/machdep.h Mon Aug 21 17:35:04 2017 (r322761) @@ -40,6 +40,7 @@ struct arm64_bootparams { extern vm_paddr_t physmap[]; extern u_int physmap_idx; +void dbg_init(void); void initarm(struct arm64_bootparams *); extern void (*pagezero)(void *); From owner-svn-src-all@freebsd.org Mon Aug 21 17:38:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D46A6DEA2AD; Mon, 21 Aug 2017 17:38:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 879207D08A; Mon, 21 Aug 2017 17:38:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LHc3oK023720; Mon, 21 Aug 2017 17:38:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LHc2Li023711; Mon, 21 Aug 2017 17:38:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708211738.v7LHc2Li023711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 21 Aug 2017 17:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322762 - in head/sys: amd64/amd64 amd64/include sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include sys X-SVN-Commit-Revision: 322762 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 17:38:04 -0000 Author: kib Date: Mon Aug 21 17:38:02 2017 New Revision: 322762 URL: https://svnweb.freebsd.org/changeset/base/322762 Log: Make WRFSBASE and WRGSBASE instructions functional. Right now, we enable the CR4.FSGSBASE bit on CPUs which support the facility (Ivy and later), to allow usermode to read fs and gs bases without syscalls. This bit also controls the write access to bases from userspace, but WRFSBASE and WRGSBASE instructions currently cannot be used, because return path from both exceptions or interrupts overrides bases with the values from pcb. Supporting the instructions is useful because this means that usermode can implement green-threads completely in userspace without issuing syscalls to change all of the machine context. Support is implemented by saving the fs base and user gs base when PCB_FULL_IRET flag is set. The flag is set on the context switch, which potentially causes clobber of the bases due to activation of another context, and when explicit modification of the user context by a syscall or exception handler is performed. In particular, the patch moves setting of the flag before syscalls change context. The changes to doreti_exit and PUSH_FRAME to clear PCB_FULL_IRET on entry from userspace can be considered a bug fixes on its own. Reviewed by: jhb (previous version) Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D12023 Modified: head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/exception.S head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/ptrace_machdep.c head/sys/amd64/amd64/sys_machdep.c head/sys/amd64/amd64/vm_machdep.c head/sys/amd64/include/asmacros.h head/sys/amd64/include/pcb.h head/sys/sys/param.h Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Mon Aug 21 17:35:04 2017 (r322761) +++ head/sys/amd64/amd64/cpu_switch.S Mon Aug 21 17:38:02 2017 (r322762) @@ -87,7 +87,6 @@ END(cpu_throw) ENTRY(cpu_switch) /* Switch to new thread. First, save context. */ movq TD_PCB(%rdi),%r8 - orl $PCB_FULL_IRET,PCB_FLAGS(%r8) movq (%rsp),%rax /* Hardware registers */ movq %r15,PCB_R15(%r8) @@ -99,6 +98,30 @@ ENTRY(cpu_switch) movq %rbx,PCB_RBX(%r8) movq %rax,PCB_RIP(%r8) + testl $PCB_FULL_IRET,PCB_FLAGS(%r8) + jnz 2f + orl $PCB_FULL_IRET,PCB_FLAGS(%r8) + testl $TDP_KTHREAD,TD_PFLAGS(%rdi) + jnz 2f + testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) + jz 2f + movl %fs,%eax + cmpl $KUF32SEL,%eax + jne 1f + rdfsbaseq %rax + movq %rax,PCB_FSBASE(%r8) +1: movl %gs,%eax + cmpl $KUG32SEL,%eax + jne 2f + movq %rdx,%r12 + movl $MSR_KGSBASE,%ecx /* Read user gs base */ + rdmsr + shlq $32,%rdx + orq %rdx,%rax + movq %rax,PCB_GSBASE(%r8) + movq %r12,%rdx + +2: testl $PCB_DBREGS,PCB_FLAGS(%r8) jnz store_dr /* static predict not taken */ done_store_dr: Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Mon Aug 21 17:35:04 2017 (r322761) +++ head/sys/amd64/amd64/exception.S Mon Aug 21 17:38:02 2017 (r322762) @@ -187,12 +187,13 @@ alltraps_testi: jz alltraps_pushregs_no_rdi sti alltraps_pushregs_no_rdi: - movq %rsi,TF_RSI(%rsp) movq %rdx,TF_RDX(%rsp) + movq %rax,TF_RAX(%rsp) +alltraps_pushregs_no_rax: + movq %rsi,TF_RSI(%rsp) movq %rcx,TF_RCX(%rsp) movq %r8,TF_R8(%rsp) movq %r9,TF_R9(%rsp) - movq %rax,TF_RAX(%rsp) movq %rbx,TF_RBX(%rsp) movq %rbp,TF_RBP(%rsp) movq %r10,TF_R10(%rsp) @@ -326,31 +327,53 @@ IDTVEC(prot) prot_addrf: movq $0,TF_ADDR(%rsp) movq %rdi,TF_RDI(%rsp) /* free up a GP register */ + movq %rax,TF_RAX(%rsp) + movq %rdx,TF_RDX(%rsp) + movw %fs,TF_FS(%rsp) + movw %gs,TF_GS(%rsp) leaq doreti_iret(%rip),%rdi cmpq %rdi,TF_RIP(%rsp) - je 1f /* kernel but with user gsbase!! */ + je 5f /* kernel but with user gsbase!! */ testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz 2f /* already running with kernel GS.base */ -1: swapgs -2: movq PCPU(CURPCB),%rdi - orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ - movw %fs,TF_FS(%rsp) - movw %gs,TF_GS(%rsp) + jz 6f /* already running with kernel GS.base */ + testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) + jz 2f + cmpw $KUF32SEL,TF_FS(%rsp) + jne 1f + rdfsbaseq %rax +1: cmpw $KUG32SEL,TF_GS(%rsp) + jne 2f + rdgsbaseq %rdx +2: swapgs + movq PCPU(CURPCB),%rdi + testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) + jz 4f + cmpw $KUF32SEL,TF_FS(%rsp) + jne 3f + movq %rax,PCB_FSBASE(%rdi) +3: cmpw $KUG32SEL,TF_GS(%rsp) + jne 4f + movq %rdx,PCB_GSBASE(%rdi) +4: orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) testl $PSL_I,TF_RFLAGS(%rsp) - jz alltraps_pushregs_no_rdi + jz alltraps_pushregs_no_rax sti - jmp alltraps_pushregs_no_rdi + jmp alltraps_pushregs_no_rax +5: swapgs +6: movq PCPU(CURPCB),%rdi + jmp 4b + /* * Fast syscall entry point. We enter here with just our new %cs/%ss set, * and the new privilige level. We are still running on the old user stack * pointer. We have to juggle a few things around to find our stack etc. * swapgs gives us access to our PCPU space only. * - * We do not support invoking this from a custom %cs or %ss (e.g. using - * entries from an LDT). + * We do not support invoking this from a custom segment registers, + * esp. %cs, %ss, %fs, %gs, e.g. using entries from an LDT. */ IDTVEC(fast_syscall) swapgs @@ -503,6 +526,23 @@ IDTVEC(nmi) nmi_fromuserspace: incl %ebx swapgs + testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) + jz 2f + movq PCPU(CURPCB),%rdi + testq %rdi,%rdi + jz 2f + cmpw $KUF32SEL,TF_FS(%rsp) + jne 1f + rdfsbaseq %rax + movq %rax,PCB_FSBASE(%rdi) +1: cmpw $KUG32SEL,TF_GS(%rsp) + jne 2f + movl $MSR_KGSBASE,%ecx + rdmsr + shlq $32,%rdx + orq %rdx,%rax + movq %rax,PCB_GSBASE(%rdi) +2: /* Note: this label is also used by ddb and gdb: */ nmi_calltrap: FAKE_MCOUNT(TF_RIP(%rsp)) @@ -705,6 +745,7 @@ doreti_exit: jz ld_regs testl $PCB_FULL_IRET,PCB_FLAGS(%r8) jz ld_regs + andl $~PCB_FULL_IRET,PCB_FLAGS(%r8) testl $TF_HASSEGS,TF_FLAGS(%rsp) je set_segs Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Mon Aug 21 17:35:04 2017 (r322761) +++ head/sys/amd64/amd64/machdep.c Mon Aug 21 17:38:02 2017 (r322762) @@ -372,6 +372,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); fpstate_drop(td); + update_pcb_bases(pcb); sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase; sf.sf_uc.uc_mcontext.mc_gsbase = pcb->pcb_gsbase; bzero(sf.sf_uc.uc_mcontext.mc_spare, @@ -442,7 +443,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask regs->tf_fs = _ufssel; regs->tf_gs = _ugssel; regs->tf_flags = TF_HASSEGS; - set_pcb_flags(pcb, PCB_FULL_IRET); PROC_LOCK(p); mtx_lock(&psp->ps_mtx); } @@ -548,6 +548,7 @@ sys_sigreturn(td, uap) return (ret); } bcopy(&ucp->uc_mcontext.mc_rdi, regs, sizeof(*regs)); + update_pcb_bases(pcb); pcb->pcb_fsbase = ucp->uc_mcontext.mc_fsbase; pcb->pcb_gsbase = ucp->uc_mcontext.mc_gsbase; @@ -559,7 +560,6 @@ sys_sigreturn(td, uap) #endif kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); - set_pcb_flags(pcb, PCB_FULL_IRET); return (EJUSTRETURN); } @@ -587,11 +587,11 @@ exec_setregs(struct thread *td, struct image_params *i else mtx_unlock(&dt_lock); + update_pcb_bases(pcb); pcb->pcb_fsbase = 0; pcb->pcb_gsbase = 0; clear_pcb_flags(pcb, PCB_32BIT); pcb->pcb_initial_fpucw = __INITIAL_FPUCW__; - set_pcb_flags(pcb, PCB_FULL_IRET); bzero((char *)regs, sizeof(struct trapframe)); regs->tf_rip = imgp->entry_addr; @@ -2135,6 +2135,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int f mcp->mc_flags = tp->tf_flags; mcp->mc_len = sizeof(*mcp); get_fpcontext(td, mcp, NULL, 0); + update_pcb_bases(pcb); mcp->mc_fsbase = pcb->pcb_fsbase; mcp->mc_gsbase = pcb->pcb_gsbase; mcp->mc_xfpustate = 0; @@ -2205,11 +2206,11 @@ set_mcontext(struct thread *td, mcontext_t *mcp) tp->tf_fs = mcp->mc_fs; tp->tf_gs = mcp->mc_gs; } + set_pcb_flags(pcb, PCB_FULL_IRET); if (mcp->mc_flags & _MC_HASBASES) { pcb->pcb_fsbase = mcp->mc_fsbase; pcb->pcb_gsbase = mcp->mc_gsbase; } - set_pcb_flags(pcb, PCB_FULL_IRET); return (0); } @@ -2478,6 +2479,71 @@ user_dbreg_trap(void) * None of the breakpoints are in user space. */ return 0; +} + +/* + * The pcb_flags is only modified by current thread, or by other threads + * when current thread is stopped. However, current thread may change it + * from the interrupt context in cpu_switch(), or in the trap handler. + * When we read-modify-write pcb_flags from C sources, compiler may generate + * code that is not atomic regarding the interrupt handler. If a trap or + * interrupt happens and any flag is modified from the handler, it can be + * clobbered with the cached value later. Therefore, we implement setting + * and clearing flags with single-instruction functions, which do not race + * with possible modification of the flags from the trap or interrupt context, + * because traps and interrupts are executed only on instruction boundary. + */ +void +set_pcb_flags_raw(struct pcb *pcb, const u_int flags) +{ + + __asm __volatile("orl %1,%0" + : "=m" (pcb->pcb_flags) : "ir" (flags), "m" (pcb->pcb_flags) + : "cc", "memory"); + +} + +/* + * The support for RDFSBASE, WRFSBASE and similar instructions for %gs + * base requires that kernel saves MSR_FSBASE and MSR_{K,}GSBASE into + * pcb if user space modified the bases. We must save on the context + * switch or if the return to usermode happens through the doreti. + * + * Tracking of both events is performed by the pcb flag PCB_FULL_IRET, + * which have a consequence that the base MSRs must be saved each time + * the PCB_FULL_IRET flag is set. We disable interrupts to sync with + * context switches. + */ +void +set_pcb_flags(struct pcb *pcb, const u_int flags) +{ + register_t r; + + if (curpcb == pcb && + (flags & PCB_FULL_IRET) != 0 && + (pcb->pcb_flags & PCB_FULL_IRET) == 0 && + (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0) { + r = intr_disable(); + if ((pcb->pcb_flags & PCB_FULL_IRET) == 0) { + if (rfs() == _ufssel) + pcb->pcb_fsbase = rdfsbase(); + if (rgs() == _ugssel) + pcb->pcb_gsbase = rdmsr(MSR_KGSBASE); + } + set_pcb_flags_raw(pcb, flags); + intr_restore(r); + } else { + set_pcb_flags_raw(pcb, flags); + } +} + +void +clear_pcb_flags(struct pcb *pcb, const u_int flags) +{ + + __asm __volatile("andl %1,%0" + : "=m" (pcb->pcb_flags) : "ir" (~flags), "m" (pcb->pcb_flags) + : "cc", "memory"); } #ifdef KDB Modified: head/sys/amd64/amd64/ptrace_machdep.c ============================================================================== --- head/sys/amd64/amd64/ptrace_machdep.c Mon Aug 21 17:35:04 2017 (r322761) +++ head/sys/amd64/amd64/ptrace_machdep.c Mon Aug 21 17:38:02 2017 (r322762) @@ -117,15 +117,17 @@ cpu_ptrace_xstate(struct thread *td, int req, void *ad static void cpu_ptrace_setbase(struct thread *td, int req, register_t r) { + struct pcb *pcb; + pcb = td->td_pcb; + set_pcb_flags(pcb, PCB_FULL_IRET); if (req == PT_SETFSBASE) { - td->td_pcb->pcb_fsbase = r; + pcb->pcb_fsbase = r; td->td_frame->tf_fs = _ufssel; } else { - td->td_pcb->pcb_gsbase = r; + pcb->pcb_gsbase = r; td->td_frame->tf_gs = _ugssel; } - set_pcb_flags(td->td_pcb, PCB_FULL_IRET); } #ifdef COMPAT_FREEBSD32 @@ -136,6 +138,7 @@ static int cpu32_ptrace(struct thread *td, int req, void *addr, int data) { struct savefpu *fpstate; + struct pcb *pcb; uint32_t r; int error; @@ -167,8 +170,10 @@ cpu32_ptrace(struct thread *td, int req, void *addr, i error = EINVAL; break; } - r = req == PT_GETFSBASE ? td->td_pcb->pcb_fsbase : - td->td_pcb->pcb_gsbase; + pcb = td->td_pcb; + if (td == curthread) + update_pcb_bases(pcb); + r = req == PT_GETFSBASE ? pcb->pcb_fsbase : pcb->pcb_gsbase; error = copyout(&r, addr, sizeof(r)); break; @@ -197,6 +202,7 @@ int cpu_ptrace(struct thread *td, int req, void *addr, int data) { register_t *r, rv; + struct pcb *pcb; int error; #ifdef COMPAT_FREEBSD32 @@ -221,8 +227,10 @@ cpu_ptrace(struct thread *td, int req, void *addr, int case PT_GETFSBASE: case PT_GETGSBASE: - r = req == PT_GETFSBASE ? &td->td_pcb->pcb_fsbase : - &td->td_pcb->pcb_gsbase; + pcb = td->td_pcb; + if (td == curthread) + update_pcb_bases(pcb); + r = req == PT_GETFSBASE ? &pcb->pcb_fsbase : &pcb->pcb_gsbase; error = copyout(r, addr, sizeof(*r)); break; Modified: head/sys/amd64/amd64/sys_machdep.c ============================================================================== --- head/sys/amd64/amd64/sys_machdep.c Mon Aug 21 17:35:04 2017 (r322761) +++ head/sys/amd64/amd64/sys_machdep.c Mon Aug 21 17:38:02 2017 (r322762) @@ -254,39 +254,45 @@ sysarch(struct thread *td, struct sysarch_args *uap) error = amd64_set_ioperm(td, &iargs); break; case I386_GET_FSBASE: + update_pcb_bases(pcb); i386base = pcb->pcb_fsbase; error = copyout(&i386base, uap->parms, sizeof(i386base)); break; case I386_SET_FSBASE: error = copyin(uap->parms, &i386base, sizeof(i386base)); if (!error) { + set_pcb_flags(pcb, PCB_FULL_IRET); pcb->pcb_fsbase = i386base; td->td_frame->tf_fs = _ufssel; update_gdt_fsbase(td, i386base); } break; case I386_GET_GSBASE: + update_pcb_bases(pcb); i386base = pcb->pcb_gsbase; error = copyout(&i386base, uap->parms, sizeof(i386base)); break; case I386_SET_GSBASE: error = copyin(uap->parms, &i386base, sizeof(i386base)); if (!error) { + set_pcb_flags(pcb, PCB_FULL_IRET); pcb->pcb_gsbase = i386base; td->td_frame->tf_gs = _ugssel; update_gdt_gsbase(td, i386base); } break; case AMD64_GET_FSBASE: - error = copyout(&pcb->pcb_fsbase, uap->parms, sizeof(pcb->pcb_fsbase)); + update_pcb_bases(pcb); + error = copyout(&pcb->pcb_fsbase, uap->parms, + sizeof(pcb->pcb_fsbase)); break; case AMD64_SET_FSBASE: error = copyin(uap->parms, &a64base, sizeof(a64base)); if (!error) { if (a64base < VM_MAXUSER_ADDRESS) { - pcb->pcb_fsbase = a64base; set_pcb_flags(pcb, PCB_FULL_IRET); + pcb->pcb_fsbase = a64base; td->td_frame->tf_fs = _ufssel; } else error = EINVAL; @@ -294,15 +300,17 @@ sysarch(struct thread *td, struct sysarch_args *uap) break; case AMD64_GET_GSBASE: - error = copyout(&pcb->pcb_gsbase, uap->parms, sizeof(pcb->pcb_gsbase)); + update_pcb_bases(pcb); + error = copyout(&pcb->pcb_gsbase, uap->parms, + sizeof(pcb->pcb_gsbase)); break; case AMD64_SET_GSBASE: error = copyin(uap->parms, &a64base, sizeof(a64base)); if (!error) { if (a64base < VM_MAXUSER_ADDRESS) { - pcb->pcb_gsbase = a64base; set_pcb_flags(pcb, PCB_FULL_IRET); + pcb->pcb_gsbase = a64base; td->td_frame->tf_gs = _ugssel; } else error = EINVAL; Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Mon Aug 21 17:35:04 2017 (r322761) +++ head/sys/amd64/amd64/vm_machdep.c Mon Aug 21 17:38:02 2017 (r322762) @@ -238,7 +238,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t pcb2->pcb_tssp = NULL; /* New segment registers. */ - set_pcb_flags(pcb2, PCB_FULL_IRET); + set_pcb_flags_raw(pcb2, PCB_FULL_IRET); /* Copy the LDT, if necessary. */ mdp1 = &td1->td_proc->p_md; @@ -439,7 +439,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, cpu_max_ext_state_size); - set_pcb_flags(pcb2, PCB_FULL_IRET); + set_pcb_flags_raw(pcb2, PCB_FULL_IRET); /* * Create a new fresh stack for the new thread. Modified: head/sys/amd64/include/asmacros.h ============================================================================== --- head/sys/amd64/include/asmacros.h Mon Aug 21 17:35:04 2017 (r322761) +++ head/sys/amd64/include/asmacros.h Mon Aug 21 17:38:02 2017 (r322762) @@ -177,7 +177,12 @@ movw %es,TF_ES(%rsp) ; \ movw %ds,TF_DS(%rsp) ; \ movl $TF_HASSEGS,TF_FLAGS(%rsp) ; \ - cld + cld ; \ + testb $SEL_RPL_MASK,TF_CS(%rsp) ; /* come from kernel ? */ \ + jz 2f ; /* yes, leave PCB_FULL_IRET alone */ \ + movq PCPU(CURPCB),%r8 ; \ + andl $~PCB_FULL_IRET,PCB_FLAGS(%r8) ; \ +2: #define POP_FRAME \ movq TF_RDI(%rsp),%rdi ; \ Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Mon Aug 21 17:35:04 2017 (r322761) +++ head/sys/amd64/include/pcb.h Mon Aug 21 17:38:02 2017 (r322762) @@ -119,40 +119,15 @@ struct susppcb { #ifdef _KERNEL struct trapframe; -/* - * The pcb_flags is only modified by current thread, or by other threads - * when current thread is stopped. However, current thread may change it - * from the interrupt context in cpu_switch(), or in the trap handler. - * When we read-modify-write pcb_flags from C sources, compiler may generate - * code that is not atomic regarding the interrupt handler. If a trap or - * interrupt happens and any flag is modified from the handler, it can be - * clobbered with the cached value later. Therefore, we implement setting - * and clearing flags with single-instruction functions, which do not race - * with possible modification of the flags from the trap or interrupt context, - * because traps and interrupts are executed only on instruction boundary. - */ -static __inline void -set_pcb_flags(struct pcb *pcb, const u_int flags) -{ - - __asm __volatile("orl %1,%0" - : "=m" (pcb->pcb_flags) : "ir" (flags), "m" (pcb->pcb_flags) - : "cc"); -} - -static __inline void -clear_pcb_flags(struct pcb *pcb, const u_int flags) -{ - - __asm __volatile("andl %1,%0" - : "=m" (pcb->pcb_flags) : "ir" (~flags), "m" (pcb->pcb_flags) - : "cc"); -} - +void clear_pcb_flags(struct pcb *pcb, const u_int flags); void makectx(struct trapframe *, struct pcb *); +void set_pcb_flags(struct pcb *pcb, const u_int flags); +void set_pcb_flags_raw(struct pcb *pcb, const u_int flags); int savectx(struct pcb *) __returns_twice; void resumectx(struct pcb *); +/* Ensure that pcb_gsbase and pcb_fsbase are up to date */ +#define update_pcb_bases(pcb) set_pcb_flags((pcb), PCB_FULL_IRET) #endif #endif /* _AMD64_PCB_H_ */ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Aug 21 17:35:04 2017 (r322761) +++ head/sys/sys/param.h Mon Aug 21 17:38:02 2017 (r322762) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200040 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200041 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, @@ -83,6 +83,7 @@ #define P_OSREL_MAP_FSTRICT 1100036 #define P_OSREL_SHUTDOWN_ENOTCONN 1100077 #define P_OSREL_MAP_GUARD 1200035 +#define P_OSREL_WRFSBASE 1200041 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif From owner-svn-src-all@freebsd.org Mon Aug 21 17:39:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5713DEA383; Mon, 21 Aug 2017 17:39:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F94F7D1E5; Mon, 21 Aug 2017 17:39:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LHdDlG023812; Mon, 21 Aug 2017 17:39:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LHdD6k023805; Mon, 21 Aug 2017 17:39:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708211739.v7LHdD6k023805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 21 Aug 2017 17:39:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322763 - head/lib/libc/amd64/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/amd64/sys X-SVN-Commit-Revision: 322763 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 17:39:14 -0000 Author: kib Date: Mon Aug 21 17:39:12 2017 New Revision: 322763 URL: https://svnweb.freebsd.org/changeset/base/322763 Log: Optimize libc to get and set TLS using the RDFSBASE and RDGSBASE instructions, if supported both by CPU and kernel. Reviewed by: jhb (previous version) Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D12023 Added: head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c (contents, props changed) head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h (contents, props changed) Modified: head/lib/libc/amd64/sys/Makefile.inc head/lib/libc/amd64/sys/amd64_get_fsbase.c head/lib/libc/amd64/sys/amd64_get_gsbase.c head/lib/libc/amd64/sys/amd64_set_fsbase.c head/lib/libc/amd64/sys/amd64_set_gsbase.c Modified: head/lib/libc/amd64/sys/Makefile.inc ============================================================================== --- head/lib/libc/amd64/sys/Makefile.inc Mon Aug 21 17:38:02 2017 (r322762) +++ head/lib/libc/amd64/sys/Makefile.inc Mon Aug 21 17:39:12 2017 (r322763) @@ -1,7 +1,11 @@ # from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp # $FreeBSD$ -SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \ +SRCS+= \ + amd64_detect_rdfsgsbase.c \ + amd64_get_fsbase.c \ + amd64_get_gsbase.c \ + amd64_set_fsbase.c \ amd64_set_gsbase.c MDASM= vfork.S brk.S cerror.S exect.S getcontext.S \ Added: head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c Mon Aug 21 17:39:12 2017 (r322763) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2017 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#define IN_RTLD 1 +#include +#undef IN_RTLD +#include +#include +#include "amd64_detect_rdfsgsbase.h" +#include "libc_private.h" + +static int state = RDFSGS_UNKNOWN; + +int +amd64_detect_rdfsgsbase(void) +{ + u_int p[4]; + + if (__predict_true(state != RDFSGS_UNKNOWN)) + return (state); + + if (__getosreldate() >= P_OSREL_WRFSBASE) { + do_cpuid(0x0, p); + if (p[0] >= 0x7) { + cpuid_count(0x7, 0x0, p); + if ((p[1] & CPUID_STDEXT_FSGSBASE) != 0) { + state = RDFSGS_SUPPORTED; + return (state); + } + } + } + state = RDFSGS_UNSUPPORTED; + return (state); +} Added: head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h Mon Aug 21 17:39:12 2017 (r322763) @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2017 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _AMD64_DETECT_RDFSGSBASE_H_ +#define _AMD64_DETECT_RDFSGSBASE_H_ + +enum { + RDFSGS_UNKNOWN, + RDFSGS_SUPPORTED, + RDFSGS_UNSUPPORTED, +}; + +int amd64_detect_rdfsgsbase(void); + +#endif Modified: head/lib/libc/amd64/sys/amd64_get_fsbase.c ============================================================================== --- head/lib/libc/amd64/sys/amd64_get_fsbase.c Mon Aug 21 17:38:02 2017 (r322762) +++ head/lib/libc/amd64/sys/amd64_get_fsbase.c Mon Aug 21 17:39:12 2017 (r322763) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2003 Peter Wemm + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -27,11 +31,18 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include +#include "amd64_detect_rdfsgsbase.h" int amd64_get_fsbase(void **addr) { + if (amd64_detect_rdfsgsbase() == RDFSGS_SUPPORTED) { + *addr = (void *)rdfsbase(); + return (0); + } return (sysarch(AMD64_GET_FSBASE, addr)); } Modified: head/lib/libc/amd64/sys/amd64_get_gsbase.c ============================================================================== --- head/lib/libc/amd64/sys/amd64_get_gsbase.c Mon Aug 21 17:38:02 2017 (r322762) +++ head/lib/libc/amd64/sys/amd64_get_gsbase.c Mon Aug 21 17:39:12 2017 (r322763) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2003 Peter Wemm + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -27,11 +31,18 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include +#include "amd64_detect_rdfsgsbase.h" int amd64_get_gsbase(void **addr) { + if (amd64_detect_rdfsgsbase() == RDFSGS_SUPPORTED) { + *addr = (void *)rdgsbase(); + return (0); + } return (sysarch(AMD64_GET_GSBASE, addr)); } Modified: head/lib/libc/amd64/sys/amd64_set_fsbase.c ============================================================================== --- head/lib/libc/amd64/sys/amd64_set_fsbase.c Mon Aug 21 17:38:02 2017 (r322762) +++ head/lib/libc/amd64/sys/amd64_set_fsbase.c Mon Aug 21 17:39:12 2017 (r322763) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2003 Peter Wemm + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -27,11 +31,18 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include +#include "amd64_detect_rdfsgsbase.h" int amd64_set_fsbase(void *addr) { + if (amd64_detect_rdfsgsbase() == RDFSGS_SUPPORTED) { + wrfsbase((uintptr_t)addr); + return (0); + } return (sysarch(AMD64_SET_FSBASE, &addr)); } Modified: head/lib/libc/amd64/sys/amd64_set_gsbase.c ============================================================================== --- head/lib/libc/amd64/sys/amd64_set_gsbase.c Mon Aug 21 17:38:02 2017 (r322762) +++ head/lib/libc/amd64/sys/amd64_set_gsbase.c Mon Aug 21 17:39:12 2017 (r322763) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2003 Peter Wemm + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -27,11 +31,18 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include +#include "amd64_detect_rdfsgsbase.h" int amd64_set_gsbase(void *addr) { + if (amd64_detect_rdfsgsbase() == RDFSGS_SUPPORTED) { + wrgsbase((uintptr_t)addr); + return (0); + } return (sysarch(AMD64_SET_GSBASE, &addr)); } From owner-svn-src-all@freebsd.org Mon Aug 21 17:40:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E7F6DEA515; Mon, 21 Aug 2017 17:40:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D8DE7D398; Mon, 21 Aug 2017 17:40:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LHepo2024660; Mon, 21 Aug 2017 17:40:51 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LHepx1024659; Mon, 21 Aug 2017 17:40:51 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201708211740.v7LHepx1024659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Aug 2017 17:40:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322764 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 322764 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 17:40:52 -0000 Author: glebius Date: Mon Aug 21 17:40:51 2017 New Revision: 322764 URL: https://svnweb.freebsd.org/changeset/base/322764 Log: Merge r322321: Plug uninitialized stack variable leak in sendfile(2). Reported by: Ilja Van Sprundel Submitted by: Domagoj Stolfa Security: uninitialized stack variable leak Modified: stable/11/sys/kern/kern_sendfile.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_sendfile.c ============================================================================== --- stable/11/sys/kern/kern_sendfile.c Mon Aug 21 17:39:12 2017 (r322763) +++ stable/11/sys/kern/kern_sendfile.c Mon Aug 21 17:40:51 2017 (r322764) @@ -930,6 +930,7 @@ sendfile(struct thread *td, struct sendfile_args *uap, if (uap->offset < 0) return (EINVAL); + sbytes = 0; hdr_uio = trl_uio = NULL; if (uap->hdtr != NULL) { From owner-svn-src-all@freebsd.org Mon Aug 21 17:45:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB43DDEA919; Mon, 21 Aug 2017 17:45:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87A3B7D796; Mon, 21 Aug 2017 17:45:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LHj6t5027647; Mon, 21 Aug 2017 17:45:06 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LHj686027646; Mon, 21 Aug 2017 17:45:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708211745.v7LHj686027646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 21 Aug 2017 17:45:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322765 - head/sys/cddl/contrib/opensolaris/uts/common/sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/sys X-SVN-Commit-Revision: 322765 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 17:45:07 -0000 Author: jhb Date: Mon Aug 21 17:45:06 2017 New Revision: 322765 URL: https://svnweb.freebsd.org/changeset/base/322765 Log: Add a guard around _ILP32 for mips. This is already done for other architectures in this file and fixes the build with clang. Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Mon Aug 21 17:40:51 2017 (r322764) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Mon Aug 21 17:45:06 2017 (r322765) @@ -525,7 +525,9 @@ extern "C" { /* * Define the appropriate "implementation choices". */ +#if !defined(_ILP32) #define _ILP32 +#endif #if !defined(_I32LPx) && defined(_KERNEL) #define _I32LPx #endif From owner-svn-src-all@freebsd.org Mon Aug 21 17:49:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F7A9DEAD5D; Mon, 21 Aug 2017 17:49:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D6C77DB93; Mon, 21 Aug 2017 17:49:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LHn1JJ027911; Mon, 21 Aug 2017 17:49:01 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LHn1q7027907; Mon, 21 Aug 2017 17:49:01 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708211749.v7LHn1q7027907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 21 Aug 2017 17:49:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322766 - in head/lib: libc/mips libcompiler_rt X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/lib: libc/mips libcompiler_rt X-SVN-Commit-Revision: 322766 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 17:49:02 -0000 Author: jhb Date: Mon Aug 21 17:49:01 2017 New Revision: 322766 URL: https://svnweb.freebsd.org/changeset/base/322766 Log: Include {u,}{div,mod}si3() on mips in libcompiler_rt. These builtins were listed in the mips-specific Symbol.map for libc but were not implemented. Compiling mips with recent clang requires these symbols. Sponsored by: DARPA / AFRL Modified: head/lib/libc/mips/Symbol.map head/lib/libcompiler_rt/Makefile.inc Modified: head/lib/libc/mips/Symbol.map ============================================================================== --- head/lib/libc/mips/Symbol.map Mon Aug 21 17:45:06 2017 (r322765) +++ head/lib/libc/mips/Symbol.map Mon Aug 21 17:49:01 2017 (r322766) @@ -43,10 +43,6 @@ FBSDprivate_1.0 { _set_tp; ___longjmp; - __umodsi3; - __modsi3; - __udivsi3; - __divsi3; __makecontext; __longjmp; signalcontext; Modified: head/lib/libcompiler_rt/Makefile.inc ============================================================================== --- head/lib/libcompiler_rt/Makefile.inc Mon Aug 21 17:45:06 2017 (r322765) +++ head/lib/libcompiler_rt/Makefile.inc Mon Aug 21 17:49:01 2017 (r322766) @@ -32,6 +32,7 @@ SRCF+= divdi3 SRCF+= divmoddi4 SRCF+= divmodsi4 SRCF+= divsc3 +SRCF+= divsi3 SRCF+= divtc3 SRCF+= divti3 SRCF+= divxc3 @@ -78,6 +79,7 @@ SRCF+= int_util SRCF+= lshrdi3 SRCF+= lshrti3 SRCF+= moddi3 +SRCF+= modsi3 SRCF+= modti3 SRCF+= muldc3 SRCF+= muldi3 @@ -120,8 +122,10 @@ SRCF+= udivdi3 SRCF+= udivmoddi4 SRCF+= udivmodsi4 SRCF+= udivmodti4 +SRCF+= udivsi3 SRCF+= udivti3 SRCF+= umoddi3 +SRCF+= umodsi3 SRCF+= umodti3 # __cpu_model support, only used on x86 @@ -174,13 +178,6 @@ SRCF+= truncdfsf2 .if ${MACHINE_CPUARCH} != "arm" SRCF+= comparedf2 SRCF+= comparesf2 -.endif - -.if ${MACHINE_CPUARCH} != "mips" -SRCF+= divsi3 -SRCF+= modsi3 -SRCF+= udivsi3 -SRCF+= umodsi3 .endif # FreeBSD-specific atomic intrinsics. From owner-svn-src-all@freebsd.org Mon Aug 21 17:52:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 251D3DEB18C; Mon, 21 Aug 2017 17:52:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6F367DF99; Mon, 21 Aug 2017 17:52:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LHq9Uf030880; Mon, 21 Aug 2017 17:52:09 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LHq9rD030879; Mon, 21 Aug 2017 17:52:09 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708211752.v7LHq9rD030879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 21 Aug 2017 17:52:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322767 - head/contrib/top X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/contrib/top X-SVN-Commit-Revision: 322767 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 17:52:11 -0000 Author: jhb Date: Mon Aug 21 17:52:09 2017 New Revision: 322767 URL: https://svnweb.freebsd.org/changeset/base/322767 Log: Fix FreeBSD-presence macro to fix the build on mips with clang. GCC doesn't define 'mips' which is why it doesn't trip over this. Sponsored by: DARPA / AFRL Modified: head/contrib/top/loadavg.h Modified: head/contrib/top/loadavg.h ============================================================================== --- head/contrib/top/loadavg.h Mon Aug 21 17:49:01 2017 (r322766) +++ head/contrib/top/loadavg.h Mon Aug 21 17:52:09 2017 (r322767) @@ -19,7 +19,7 @@ * * Defined types: load_avg for load averages, pctcpu for cpu percentages. */ -#if defined(mips) && !(defined(NetBSD) || defined(FreeBSD)) +#if defined(mips) && !(defined(NetBSD) || defined(__FreeBSD__)) # include # if defined(FBITS) && !defined(FSCALE) # define FSCALE (1 << FBITS) /* RISC/os on mips */ From owner-svn-src-all@freebsd.org Mon Aug 21 18:00:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14318DEB73E; Mon, 21 Aug 2017 18:00:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7DF97E3C4; Mon, 21 Aug 2017 18:00:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LI0RGB032113; Mon, 21 Aug 2017 18:00:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LI0Q3s032111; Mon, 21 Aug 2017 18:00:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708211800.v7LI0Q3s032111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 21 Aug 2017 18:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r322768 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 322768 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 18:00:28 -0000 Author: jhb Date: Mon Aug 21 18:00:26 2017 New Revision: 322768 URL: https://svnweb.freebsd.org/changeset/base/322768 Log: Add Alexander Richardson (arichardson@) as a source committer. Alex has been working on MIPS LLD support as well as cross-building FreeBSD from Linux and OS X hosts. Brooks and I will co-mentor. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Mon Aug 21 17:52:09 2017 (r322767) +++ svnadmin/conf/access Mon Aug 21 18:00:26 2017 (r322768) @@ -29,6 +29,7 @@ andrew anish antoine araujo +arichardson arybchik asomers avatar Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Mon Aug 21 17:52:09 2017 (r322767) +++ svnadmin/conf/mentors Mon Aug 21 18:00:26 2017 (r322768) @@ -12,6 +12,7 @@ # Mentee Mentor Optional comment achim scottl Co-mentor: emaste anish neel Co-mentor: grehan +arichardson jhb Co-mentor: brooks dab vangyzen def pjd eri ae Co-mentor: thompsa From owner-svn-src-all@freebsd.org Mon Aug 21 18:12:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CC35DEC267; Mon, 21 Aug 2017 18:12:33 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5BE7B7EB5B; Mon, 21 Aug 2017 18:12:33 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LICW8t039996; Mon, 21 Aug 2017 18:12:32 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LICWEO039995; Mon, 21 Aug 2017 18:12:32 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708211812.v7LICWEO039995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 21 Aug 2017 18:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322769 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 322769 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 18:12:33 -0000 Author: andrew Date: Mon Aug 21 18:12:32 2017 New Revision: 322769 URL: https://svnweb.freebsd.org/changeset/base/322769 Log: Improve the performance of the arm64 thread switching code. The full system memory barrier around a TLB invalidation is stricter than required. It needs to wait on accesses to main memory, with just the weaker store variant before the invalidate. As such use the dsb istst, tlbi, dlb ish sequence already used in pmap. The tlbi instruction in this sequence is also unnecessarily using a broadcast invalidate when it just needs to invalidate the local CPUs TLB. Switch to a non-broadcast variant of this instruction. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/swtch.S Modified: head/sys/arm64/arm64/swtch.S ============================================================================== --- head/sys/arm64/arm64/swtch.S Mon Aug 21 18:00:26 2017 (r322768) +++ head/sys/arm64/arm64/swtch.S Mon Aug 21 18:12:32 2017 (r322769) @@ -91,9 +91,9 @@ ENTRY(cpu_throw) isb /* Invalidate the TLB */ - dsb sy - tlbi vmalle1is - dsb sy + dsb ishst + tlbi vmalle1 + dsb ish isb /* If we are single stepping, enable it */ @@ -192,9 +192,9 @@ ENTRY(cpu_switch) isb /* Invalidate the TLB */ - dsb sy - tlbi vmalle1is - dsb sy + dsb ishst + tlbi vmalle1 + dsb ish isb /* From owner-svn-src-all@freebsd.org Mon Aug 21 20:23:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BEA4DCF45E; Mon, 21 Aug 2017 20:23:07 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDDFF8345C; Mon, 21 Aug 2017 20:23:06 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LKN6hf093358; Mon, 21 Aug 2017 20:23:06 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LKN654093357; Mon, 21 Aug 2017 20:23:06 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708212023.v7LKN654093357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 21 Aug 2017 20:23:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322770 - head/usr.sbin/chown/tests X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/usr.sbin/chown/tests X-SVN-Commit-Revision: 322770 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 20:23:07 -0000 Author: gjb Date: Mon Aug 21 20:23:05 2017 New Revision: 322770 URL: https://svnweb.freebsd.org/changeset/base/322770 Log: Apply changes from bin/chmod/tests/chmod_test.sh (r321949, r321950, and r322101), adding atf_expect_fail() before chflags(8) is invoked if the filesystem is ZFS, which does not support UF_IMMUTABLE. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/chown/tests/chown_test.sh Modified: head/usr.sbin/chown/tests/chown_test.sh ============================================================================== --- head/usr.sbin/chown/tests/chown_test.sh Mon Aug 21 18:12:32 2017 (r322769) +++ head/usr.sbin/chown/tests/chown_test.sh Mon Aug 21 20:23:05 2017 (r322770) @@ -25,6 +25,13 @@ # # $FreeBSD$ +get_filesystem() +{ + local mountpoint=$1 + + df -T $mountpoint | tail -n 1 | cut -wf 2 +} + atf_test_case RH_flag RH_flag_head() { @@ -98,6 +105,11 @@ f_flag_body() { atf_check truncate -s 0 foo bar atf_check chown 0:0 foo bar + case "$(get_filesystem .)" in + zfs) + atf_expect_fail "ZFS does not support UF_IMMUTABLE; returns EPERM" + ;; + esac atf_check chflags uchg foo atf_check -e not-empty -s not-exit:0 chown 42:42 foo bar atf_check -o inline:'0:0\n42:42\n' stat -f '%u:%g' foo bar @@ -107,7 +119,7 @@ f_flag_body() f_flag_cleanup() { - atf_check chflags 0 foo + chflags 0 foo || : } atf_test_case h_flag @@ -144,6 +156,11 @@ v_flag_body() atf_check truncate -s 0 foo bar atf_check chown 0:0 foo atf_check chown 42:42 bar + case "$(get_filesystem .)" in + zfs) + atf_expect_fail "ZFS updates mode for foo unnecessarily" + ;; + esac atf_check -o 'inline:bar\n' chown -v 0:0 foo bar atf_check chown -v 0:0 foo bar for f in foo bar; do From owner-svn-src-all@freebsd.org Mon Aug 21 20:27:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FACBDCFB07; Mon, 21 Aug 2017 20:27:47 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2690838D0; Mon, 21 Aug 2017 20:27:46 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LKRkg7093696; Mon, 21 Aug 2017 20:27:46 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LKRjHk093691; Mon, 21 Aug 2017 20:27:45 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201708212027.v7LKRjHk093691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Mon, 21 Aug 2017 20:27:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322771 - in head/sys: dev/qlxgbe modules/qlxgbe X-SVN-Group: head X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: in head/sys: dev/qlxgbe modules/qlxgbe X-SVN-Commit-Revision: 322771 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 20:27:47 -0000 Author: davidcs Date: Mon Aug 21 20:27:45 2017 New Revision: 322771 URL: https://svnweb.freebsd.org/changeset/base/322771 Log: Upgrade FW to 5.4.66 sysctls to display stats, stats polled every 2 seconds Modify QLA_LOCK()/QLA_UNLOCK() to not sleep after acquiring mtx_lock Add support to turn OFF/ON error recovery following heartbeat failure for debug purposes. Set default max values to 32 Tx/Rx/SDS rings MFC after:5 days Modified: head/sys/dev/qlxgbe/README.txt head/sys/dev/qlxgbe/ql_boot.c head/sys/dev/qlxgbe/ql_def.h head/sys/dev/qlxgbe/ql_fw.c head/sys/dev/qlxgbe/ql_glbl.h head/sys/dev/qlxgbe/ql_hw.c head/sys/dev/qlxgbe/ql_hw.h head/sys/dev/qlxgbe/ql_inline.h head/sys/dev/qlxgbe/ql_ioctl.c head/sys/dev/qlxgbe/ql_isr.c head/sys/dev/qlxgbe/ql_minidump.c head/sys/dev/qlxgbe/ql_os.c head/sys/dev/qlxgbe/ql_os.h head/sys/dev/qlxgbe/ql_reset.c head/sys/dev/qlxgbe/ql_ver.h head/sys/modules/qlxgbe/Makefile Modified: head/sys/dev/qlxgbe/README.txt ============================================================================== --- head/sys/dev/qlxgbe/README.txt Mon Aug 21 20:23:05 2017 (r322770) +++ head/sys/dev/qlxgbe/README.txt Mon Aug 21 20:27:45 2017 (r322771) @@ -61,14 +61,17 @@ following OS platforms: - kldunload if_qlxgbe 5. Parameters to set prior to installing the driver + Please run "sysctl kern.ipc" and "sysctl net.inet.tcp" and see if these + values are already greater than shown below. Change only those which + are less than shown below. - Add the following lines to /etc/sysctl.conf and reboot the machine prior to installing the driver - kern.ipc.nmbjumbo9=262144 + kern.ipc.nmbjumbo9=2000000 + kern.ipc.nmbclusters=1000000 net.inet.tcp.recvbuf_max=262144 net.inet.tcp.recvbuf_inc=16384 - kern.ipc.nmbclusters=1000000 kern.ipc.maxsockbuf=2097152 net.inet.tcp.recvspace=131072 net.inet.tcp.sendbuf_max=262144 @@ -78,10 +81,10 @@ following OS platforms: login or su to root - sysctl kern.ipc.nmbjumbo9=262144 + sysctl kern.ipc.nmbjumbo9=2000000 + sysctl kern.ipc.nmbclusters=1000000 sysctl net.inet.tcp.recvbuf_max=262144 sysctl net.inet.tcp.recvbuf_inc=16384 - sysctl kern.ipc.nmbclusters=1000000 sysctl kern.ipc.maxsockbuf=2097152 sysctl net.inet.tcp.recvspace=131072 sysctl net.inet.tcp.sendbuf_max=262144 Modified: head/sys/dev/qlxgbe/ql_boot.c ============================================================================== --- head/sys/dev/qlxgbe/ql_boot.c Mon Aug 21 20:23:05 2017 (r322770) +++ head/sys/dev/qlxgbe/ql_boot.c Mon Aug 21 20:27:45 2017 (r322771) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); unsigned int ql83xx_bootloader_version_major = 5; unsigned int ql83xx_bootloader_version_minor = 4; -unsigned int ql83xx_bootloader_version_sub = 64; +unsigned int ql83xx_bootloader_version_sub = 66; unsigned char ql83xx_bootloader[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -10957,9 +10957,8 @@ unsigned char ql83xx_bootloader[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x02, 0x00, 0x40, 0x40, 0x05, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x40, 0x40, 0x05, 0x04, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x9b, 0x64, 0x95, 0x0e + 0x00, 0x00, 0x00, 0x00, 0x9b, 0x64, 0x93, 0x0e }; unsigned int ql83xx_bootloader_len = 131072; - Modified: head/sys/dev/qlxgbe/ql_def.h ============================================================================== --- head/sys/dev/qlxgbe/ql_def.h Mon Aug 21 20:23:05 2017 (r322770) +++ head/sys/dev/qlxgbe/ql_def.h Mon Aug 21 20:27:45 2017 (r322771) @@ -110,6 +110,7 @@ typedef struct qla_ivec qla_ivec_t; typedef struct _qla_tx_ring { qla_tx_buf_t tx_buf[NUM_TX_DESCRIPTORS]; uint64_t count; + uint64_t iscsi_pkt_count; } qla_tx_ring_t; typedef struct _qla_tx_fp { @@ -123,25 +124,26 @@ typedef struct _qla_tx_fp { } qla_tx_fp_t; /* - * Adapter structure contains the hardware independent information of the + * Adapter structure contains the hardware independant information of the * pci function. */ struct qla_host { volatile struct { volatile uint32_t - qla_interface_up :1, qla_callout_init :1, qla_watchdog_active :1, - qla_watchdog_exit :1, - qla_watchdog_pause :1, - stop_rcv :1, parent_tag :1, lock_init :1; } flags; + volatile uint32_t qla_interface_up; + volatile uint32_t stop_rcv; + volatile uint32_t qla_watchdog_exit; volatile uint32_t qla_watchdog_exited; + volatile uint32_t qla_watchdog_pause; volatile uint32_t qla_watchdog_paused; volatile uint32_t qla_initiate_recovery; + volatile uint32_t qla_detach_active; device_t pci_dev; @@ -182,6 +184,7 @@ struct qla_host { struct mtx hw_lock; volatile uint32_t hw_lock_held; + uint64_t hw_lock_failed; /* transmit and receive buffers */ uint32_t txr_idx; /* index of the current tx ring */ @@ -221,6 +224,9 @@ struct qla_host { uint64_t tx_tso_frames; uint64_t hw_vlan_tx_frames; + struct task stats_task; + struct taskqueue *stats_tq; + uint32_t fw_ver_major; uint32_t fw_ver_minor; uint32_t fw_ver_sub; @@ -260,9 +266,7 @@ typedef struct qla_host qla_host_t; #define QL_ALIGN(size, align) (size + (align - 1)) & ~(align - 1); #define QL_MIN(x, y) ((x < y) ? x : y) -#define QL_RUNNING(ifp) \ - ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == \ - IFF_DRV_RUNNING) +#define QL_RUNNING(ifp) (ifp->if_drv_flags & IFF_DRV_RUNNING) /* Return 0, if identical, else 1 */ #define QL_MAC_CMP(mac1, mac2) \ Modified: head/sys/dev/qlxgbe/ql_fw.c ============================================================================== --- head/sys/dev/qlxgbe/ql_fw.c Mon Aug 21 20:23:05 2017 (r322770) +++ head/sys/dev/qlxgbe/ql_fw.c Mon Aug 21 20:27:45 2017 (r322771) @@ -35,32 +35,32 @@ __FBSDID("$FreeBSD$"); unsigned int ql83xx_firmware_version_major = 5; unsigned int ql83xx_firmware_version_minor = 4; -unsigned int ql83xx_firmware_version_sub = 64; +unsigned int ql83xx_firmware_version_sub = 66; unsigned char ql83xx_firmware[] = { - 0x03, 0x00, 0x40, 0x40, 0x05, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xe4, 0x42, 0x1b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5f, 0x7e, 0x74, 0x37, 0x27, 0xc9, 0xab, 0x39, + 0x03, 0x00, 0x40, 0x40, 0x05, 0x04, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe8, 0x46, 0x1b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x64, 0x27, 0xbc, 0x1f, 0xfc, 0x30, 0xf6, 0x92, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xe0, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0xef, 0x03, 0x00, + 0xe0, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0xf2, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x20, 0x44, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x52, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, 0xf9, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x9f, 0x90, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x46, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x9f, 0x4e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xfc, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf7, 0x90, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x54, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xa1, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xfc, 0x89, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x73, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x65, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xab, 0x8d, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -69,118 +69,118 @@ unsigned char ql83xx_firmware[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x6f, 0x94, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7d, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x65, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x98, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7c, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xec, 0xa9, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x04, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x9b, 0xad, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xd0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0xae, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xde, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf8, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x22, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0xb2, 0x17, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x9a, 0xb9, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x1a, 0x66, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5a, 0xbd, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2a, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9f, 0xd8, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0xea, 0x0b, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5d, 0xdc, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x0b, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0xe4, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xbe, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xa0, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x17, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0xe8, 0x17, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbd, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xb0, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0xeb, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x73, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x66, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0xef, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x71, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xba, 0x0e, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0b, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x73, 0x12, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0b, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x19, 0x18, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x84, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x40, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x55, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x1d, 0x18, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x81, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x50, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x45, 0x36, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x29, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x67, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xfc, 0x39, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2a, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x6e, 0x3f, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x26, 0x43, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc4, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x47, 0x18, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x52, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xcc, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x4b, 0x18, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x51, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xdc, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xd3, 0x4a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x25, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x67, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x8e, 0x4e, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x26, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf8, 0x4c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0x0a, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xb4, 0x50, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc9, 0x0a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x57, 0x18, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xb7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x6d, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x5b, 0x18, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbb, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x18, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x79, 0x78, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x44, 0xa1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x7c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7c, 0xa1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xbd, 0x19, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xb4, 0x1d, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x77, 0x1a, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3e, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xd1, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x6e, 0x1e, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x48, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xd1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -189,7 +189,7 @@ unsigned char ql83xx_firmware[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x8c, 0x8c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x8c, 0x8c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xb5, 0x3f, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xb6, 0x43, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x58, 0xe0, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -232,9 +232,9 @@ unsigned char ql83xx_firmware[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x49, 0x1a, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xcb, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe8, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x92, 0x05, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x4d, 0x1a, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xcc, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf8, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x92, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -249,143325 +249,143383 @@ unsigned char ql83xx_firmware[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xda, 0xec, 0x3d, - 0x0b, 0x70, 0x5c, 0xd5, 0x75, 0xf7, 0x7d, 0x76, 0xf7, 0x69, 0x3f, 0xd2, - 0x1a, 0x64, 0x22, 0x84, 0x1c, 0x3f, 0xd9, 0xc6, 0x16, 0xdf, 0xac, 0x8d, - 0x6d, 0x8c, 0x31, 0xf5, 0x93, 0x2c, 0x3b, 0xb6, 0x23, 0x11, 0x01, 0x29, - 0xff, 0x8f, 0x48, 0x5a, 0x2a, 0x13, 0x82, 0xc5, 0x94, 0xa4, 0x32, 0x50, - 0xfc, 0x24, 0x4b, 0xb2, 0x09, 0x72, 0x22, 0x63, 0xc7, 0x38, 0x84, 0x86, - 0x95, 0x8c, 0x29, 0x6d, 0x99, 0x74, 0x99, 0x64, 0x02, 0xd3, 0x76, 0x86, - 0xc5, 0xce, 0x04, 0x93, 0xe2, 0xd4, 0x9d, 0x0e, 0x6d, 0x08, 0x43, 0xb3, - 0x9d, 0x94, 0x19, 0x95, 0x10, 0xb2, 0xed, 0x74, 0x88, 0x9c, 0xd4, 0xd0, - 0x7b, 0xee, 0xe7, 0x7d, 0xee, 0xbe, 0xf7, 0x76, 0xaf, 0x2c, 0x3b, 0xd3, - 0x8e, 0x95, 0x99, 0xa0, 0xe3, 0x7b, 0xef, 0x79, 0xe7, 0x9e, 0x7b, 0xee, - 0xf9, 0xbf, 0x27, 0xa4, 0x20, 0xfa, 0xa3, 0x23, 0x0d, 0xa9, 0xe8, 0x6e, - 0x74, 0x16, 0xfe, 0xbf, 0x09, 0xd3, 0x9f, 0x5e, 0x06, 0x1f, 0x7f, 0xef, - 0x1d, 0xf2, 0xbf, 0x2f, 0x55, 0xc0, 0xfe, 0x9f, 0x82, 0x00, 0xe7, 0x25, - 0x61, 0x5b, 0x45, 0x26, 0xf9, 0x65, 0x6f, 0x82, 0xfc, 0xa7, 0xbf, 0x62, - 0xbe, 0x82, 0x6c, 0x2b, 0xeb, 0x81, 0xd9, 0xef, 0x66, 0x3e, 0x4d, 0xe9, - 0x45, 0x45, 0x8d, 0x93, 0x8e, 0x50, 0x5d, 0x5e, 0xa7, 0x40, 0xcf, 0xad, - 0xf4, 0xe7, 0xde, 0xb0, 0xe7, 0x6d, 0x44, 0x21, 0xcf, 0x93, 0x84, 0x39, - 0xbe, 0x63, 0xb3, 0x8c, 0x6f, 0x91, 0x32, 0xbb, 0xf8, 0x96, 0xcd, 0x32, - 0xbe, 0xad, 0xea, 0xcc, 0xf0, 0xf1, 0xf5, 0xb7, 0xe9, 0x33, 0x5a, 0x1f, - 0x20, 0x6f, 0x39, 0x1b, 0x50, 0x5d, 0xb4, 0xec, 0xce, 0x4d, 0x73, 0xd0, - 0xf0, 0x37, 0x30, 0x4a, 0x80, 0x8f, 0xb7, 0x0d, 0xbf, 0xf9, 0xa3, 0x2e, - 0x25, 0xbb, 0x07, 0x2f, 0x01, 0x38, 0x7f, 0xdf, 0xbc, 0x35, 0xab, 0x11, - 0x19, 0x2f, 0xf3, 0xf1, 0xf7, 0xef, 0x57, 0xf2, 0x78, 0x3c, 0x37, 0x08, - 0xeb, 0xef, 0xbd, 0xe1, 0xb5, 0xcb, 0x17, 0xd2, 0xf5, 0x83, 0x6c, 0xbc, - 0x7e, 0x8f, 0x92, 0x7b, 0x02, 0xaf, 0x1f, 0xe4, 0xf8, 0xff, 0x91, 0xae, - 0x1f, 0xf4, 0xe3, 0xcf, 0x0d, 0x61, 0xb8, 0x67, 0xd3, 0xe5, 0xb1, 0x8b, - 0x2e, 0xa3, 0xeb, 0x87, 0xd8, 0xf8, 0xf5, 0x6f, 0x2a, 0x3d, 0x7b, 0xf1, - 0x7a, 0x80, 0x7b, 0x57, 0xdf, 0xfa, 0xdc, 0x7d, 0x71, 0xba, 0x9e, 0x8f, - 0x3f, 0xf8, 0x6b, 0xa5, 0x77, 0x1c, 0xaf, 0xdf, 0xe1, 0xe0, 0x57, 0xc8, - 0xfa, 0x1d, 0x02, 0xfd, 0x00, 0xe7, 0x5f, 0xf9, 0xcf, 0x45, 0x2b, 0x0d, - 0xba, 0x9e, 0x8f, 0xbf, 0x7c, 0x35, 0xea, 0x81, 0xe7, 0x0f, 0x63, 0xb8, - 0x3f, 0xfb, 0x9a, 0xd5, 0x48, 0xf7, 0xd7, 0x3f, 0xcc, 0xc6, 0x7f, 0x7a, - 0xc7, 0xa3, 0x06, 0xc6, 0x5f, 0x00, 0xb8, 0x37, 0x3d, 0x9a, 0xcb, 0x36, - 0xd3, 0xf5, 0x7c, 0x7c, 0xcd, 0xe7, 0x1f, 0xdd, 0x05, 0xcf, 0x1f, 0x01, - 0xfa, 0x8d, 0xf5, 0x66, 0x9a, 0xed, 0x7f, 0x84, 0x8d, 0x77, 0x0c, 0x3f, - 0x6a, 0xc0, 0xf3, 0x01, 0xb6, 0x74, 0x3d, 0x6b, 0xa4, 0xe9, 0x7a, 0x3e, - 0xfe, 0x07, 0xcf, 0x3d, 0xba, 0x0b, 0x9e, 0x3f, 0xaa, 0xbb, 0xe7, 0x81, - 0xf1, 0xf5, 0x0b, 0x70, 0x41, 0x80, 0xcb, 0x02, 0x9c, 0xdb, 0x29, 0xac, - 0x17, 0xe0, 0x82, 0x00, 0x97, 0x05, 0x38, 0xb7, 0x0b, 0xe8, 0x6b, 0xdc, - 0x70, 0x77, 0x8b, 0x99, 0x5d, 0xf1, 0x14, 0x5e, 0x0f, 0x70, 0x3e, 0xf7, - 0x79, 0xfd, 0x92, 0xad, 0xdb, 0x61, 0x7f, 0x05, 0x80, 0x7b, 0x9a, 0x76, - 0x3e, 0xd0, 0x78, 0x11, 0x19, 0x2f, 0xf3, 0xf1, 0xee, 0x3d, 0xdb, 0x61, - 0x7f, 0xb9, 0xc7, 0x80, 0x3f, 0x2d, 0x87, 0x15, 0x7d, 0x19, 0x5d, 0xff, - 0x18, 0x1b, 0xdf, 0xfa, 0xdd, 0xed, 0xb0, 0xbf, 0x02, 0xc0, 0xfd, 0x2d, - 0x4a, 0xd6, 0xb8, 0x9a, 0xae, 0xe7, 0xe3, 0x7b, 0xde, 0xdc, 0x6e, 0x60, - 0xf9, 0xc8, 0x7d, 0x95, 0xd2, 0xb3, 0xb8, 0xc5, 0xa4, 0xf4, 0x13, 0x38, - 0x95, 0x46, 0x46, 0xf7, 0xdd, 0x84, 0x7e, 0x36, 0xbe, 0x9c, 0x8d, 0x97, - 0x09, 0xfc, 0xb8, 0xc2, 0xc7, 0x73, 0x8f, 0x0b, 0xfb, 0x17, 0xe0, 0x82, - 0x00, 0x97, 0x05, 0x38, 0x37, 0x26, 0xac, 0x17, 0xe0, 0x82, 0x00, 0x97, - 0x05, 0x38, 0xb7, 0x5b, 0x58, 0x2f, 0xc0, 0x05, 0x01, 0x2e, 0x0b, 0x70, - 0xee, 0x6b, 0xc2, 0x7a, 0x01, 0x2e, 0x08, 0x70, 0x59, 0x80, 0x73, 0x5f, - 0x17, 0xd6, 0x0b, 0x70, 0x41, 0x80, 0xcb, 0x02, 0x9c, 0xb3, 0x30, 0x6c, - 0xf7, 0xbd, 0x1f, 0xe7, 0xeb, 0x01, 0x2e, 0x2d, 0xfc, 0xe9, 0x57, 0xf8, - 0x7a, 0x80, 0x8b, 0xbf, 0x39, 0x3a, 0xaa, 0xb1, 0xf5, 0x00, 0xe7, 0x5f, - 0xfc, 0xe8, 0x43, 0x06, 0xe7, 0xda, 0x31, 0x9c, 0xdd, 0xbd, 0xa2, 0xce, - 0x62, 0xeb, 0x01, 0xee, 0xef, 0x5c, 0xb8, 0x8d, 0xc1, 0x05, 0x80, 0x7b, - 0xe6, 0xef, 0xd9, 0xbd, 0x8e, 0xad, 0x07, 0x38, 0xf7, 0xcf, 0x3b, 0x4f, - 0x32, 0x38, 0xd7, 0x21, 0xd0, 0x2f, 0xc0, 0x05, 0x01, 0x2e, 0x0b, 0x70, - 0x6e, 0x9d, 0xb0, 0x5e, 0x80, 0x0b, 0x02, 0x5c, 0x16, 0xe0, 0x5c, 0xa7, - 0xb0, 0x5e, 0x80, 0x0b, 0x02, 0x5c, 0x16, 0xe0, 0xdc, 0x7a, 0x61, 0xbd, - 0x00, 0x17, 0x04, 0xb8, 0x2c, 0xc0, 0xb9, 0x0d, 0xc2, 0x7a, 0x01, 0x2e, - 0x08, 0x70, 0x59, 0x80, 0x73, 0x9f, 0x16, 0xd6, 0x0b, 0x70, 0x41, 0x80, - 0xcb, 0x02, 0x9c, 0xdb, 0x08, 0xe7, 0xf3, 0xfb, 0x6f, 0xf2, 0xf3, 0xec, - 0x07, 0xf8, 0xf8, 0x97, 0xdf, 0xe1, 0x70, 0x81, 0x8c, 0xef, 0x7f, 0x97, - 0xc3, 0x65, 0x32, 0xfe, 0xfd, 0x5f, 0x3a, 0xe7, 0xbf, 0x09, 0xee, 0xff, - 0xd5, 0x7f, 0x75, 0x92, 0xaf, 0x27, 0xf0, 0x6d, 0xdf, 0xe3, 0x70, 0x81, - 0xc0, 0x0f, 0x8f, 0x70, 0xb8, 0x0c, 0x70, 0xf9, 0x99, 0xaf, 0x71, 0x38, - 0xb7, 0x19, 0xe0, 0x57, 0xc6, 0x9d, 0xf5, 0x04, 0xfe, 0xd9, 0x37, 0x9d, - 0xf5, 0x00, 0xa3, 0x39, 0x0b, 0x4e, 0xf0, 0xf5, 0x00, 0x8f, 0xaf, 0xb8, - 0x84, 0xc3, 0xb9, 0xcf, 0x60, 0xd8, 0xec, 0xd0, 0x39, 0xdc, 0x0f, 0x70, - 0xe1, 0x9e, 0x0c, 0x87, 0x0b, 0x00, 0x5b, 0xbb, 0xb2, 0xce, 0x7a, 0x80, - 0x8f, 0xbf, 0x70, 0xbe, 0xb3, 0xbe, 0x0b, 0xf0, 0x17, 0x5f, 0x73, 0xf6, - 0xdf, 0x45, 0xf9, 0x53, 0xe6, 0xeb, 0x05, 0xb8, 0x2c, 0xc0, 0xb9, 0x6e, - 0x3f, 0xdc, 0x2f, 0xc0, 0x05, 0x01, 0x2e, 0x0b, 0x70, 0xee, 0x5a, 0x61, - 0xbd, 0x00, 0x17, 0x04, 0xb8, 0x2c, 0xc0, 0xb9, 0xcf, 0x0a, 0xeb, 0x05, - 0xb8, 0x20, 0xc0, 0x65, 0x01, 0xf6, 0xfb, 0x77, 0x95, 0xfe, 0xc1, 0x1c, - 0x2f, 0x5c, 0xd5, 0xdf, 0x30, 0xf9, 0x6f, 0x0a, 0x73, 0x2a, 0xd9, 0xc3, - 0x1a, 0x14, 0xc7, 0xc9, 0xac, 0xe2, 0xaf, 0xf4, 0x2b, 0x96, 0x47, 0x3e, - 0x29, 0xbe, 0x58, 0x0c, 0xeb, 0x7f, 0xf0, 0xb9, 0xf1, 0xf8, 0xad, 0x31, - 0x36, 0xf6, 0xd1, 0x7c, 0x64, 0xf6, 0x54, 0xc7, 0x27, 0x47, 0x3f, 0xbb, - 0x1b, 0xa5, 0x8f, 0xe9, 0xcf, 0x56, 0x79, 0x7f, 0x6a, 0x56, 0xe1, 0x42, - 0xf5, 0xf3, 0x91, 0x83, 0xd9, 0xfe, 0xca, 0x21, 0xfb, 0xab, 0xfa, 0xbc, - 0x2a, 0xeb, 0xab, 0xc6, 0x2b, 0x92, 0xcf, 0xb3, 0x1d, 0x5d, 0x65, 0x71, - 0xf9, 0xc9, 0xb0, 0x78, 0xa5, 0x0f, 0x8f, 0x2a, 0x4e, 0x3c, 0x83, 0x90, - 0x41, 0xc6, 0x5d, 0xe5, 0x6c, 0xa2, 0x03, 0x47, 0x94, 0x41, 0x94, 0x2d, - 0x22, 0xa3, 0x89, 0xce, 0x37, 0x87, 0xf0, 0x7c, 0x74, 0xa9, 0xca, 0x50, - 0x7f, 0x1c, 0x2c, 0x3f, 0x69, 0x3f, 0x7e, 0xf4, 0x06, 0x1b, 0x9a, 0x62, - 0xf0, 0xef, 0xf6, 0xfc, 0xaa, 0xf1, 0xeb, 0x2c, 0x7c, 0x6a, 0xf7, 0xff, - 0xf4, 0xc3, 0xb3, 0x4b, 0x8f, 0x89, 0x84, 0xfc, 0x03, 0xfe, 0x87, 0xdf, - 0x6b, 0xf6, 0xcc, 0x67, 0xfa, 0xd7, 0x19, 0x47, 0x3f, 0x40, 0x7e, 0xf9, - 0xce, 0xa6, 0xfd, 0x30, 0xdc, 0xa8, 0x38, 0x72, 0xef, 0x15, 0x5e, 0x94, - 0xcc, 0x0d, 0x77, 0xb4, 0xb7, 0x51, 0xfe, 0x62, 0xfc, 0xc9, 0x66, 0x7a, - 0xbf, 0x4c, 0xd5, 0xab, 0x8f, 0xed, 0x93, 0xa7, 0x43, 0x1f, 0x57, 0x87, - 0x1b, 0x3c, 0x60, 0x2d, 0xcf, 0xe7, 0xf3, 0xed, 0x7a, 0xb9, 0xf9, 0x68, - 0x9e, 0x24, 0xfe, 0x4b, 0x24, 0xf1, 0xaf, 0x96, 0xc4, 0xbf, 0x51, 0x12, - 0xff, 0x4d, 0x92, 0xf8, 0xff, 0x50, 0x12, 0xff, 0x83, 0x92, 0xf8, 0x87, - 0x24, 0xf1, 0xef, 0x91, 0xc4, 0xff, 0x8c, 0x24, 0xfe, 0xef, 0x48, 0xe2, - 0xff, 0x3b, 0x49, 0xfc, 0x7f, 0x2f, 0x89, 0xff, 0x2d, 0x49, 0xfc, 0x53, - 0x92, 0xf8, 0x3f, 0x94, 0xc4, 0x1f, 0x53, 0xe4, 0xf0, 0x9f, 0x2b, 0x37, - 0x1f, 0x2d, 0x90, 0xc4, 0x9f, 0x93, 0xc4, 0xbf, 0x56, 0x12, 0x7f, 0xb7, - 0x24, 0xfe, 0xdb, 0x25, 0xf1, 0xdf, 0x2b, 0x89, 0x7f, 0x9b, 0x24, 0xfe, - 0x9d, 0x92, 0xf8, 0xf7, 0x4b, 0xe2, 0x7f, 0x56, 0x12, 0xff, 0x77, 0x25, - 0xf1, 0xbf, 0x2a, 0x89, 0xff, 0xb8, 0x24, 0xfe, 0x7f, 0x95, 0xc4, 0xff, - 0x4b, 0x49, 0xfc, 0xbf, 0x95, 0xc4, 0x9f, 0x54, 0xe5, 0xf0, 0x37, 0xc9, - 0xcd, 0x47, 0x4b, 0x24, 0xf1, 0xaf, 0x90, 0xc4, 0xdf, 0x29, 0x89, 0xff, - 0x7a, 0x49, 0xfc, 0x77, 0x4b, 0xe2, 0xdf, 0x2a, 0x89, 0xff, 0x51, 0x49, - 0xfc, 0x63, 0x92, 0xf8, 0xbf, 0x25, 0x89, 0xff, 0x2f, 0x24, 0xf1, 0xbf, - 0x2c, 0x89, 0xff, 0x87, 0x92, 0xf8, 0xdf, 0x94, 0xc4, 0xff, 0x73, 0x49, - 0xfc, 0xff, 0x25, 0x89, 0x1f, 0x69, 0x72, 0xf8, 0x1b, 0xe4, 0xe6, 0xdb, - 0xf3, 0x24, 0xf1, 0x5f, 0x2a, 0x89, 0x7f, 0xb5, 0x24, 0xfe, 0x4d, 0x92, - 0xf8, 0x6f, 0x92, 0xc4, 0x7f, 0x8f, 0x24, 0xfe, 0x07, 0x25, 0xf1, 0xef, - 0x90, 0xc4, 0xbf, 0x47, 0x12, 0x7f, 0x5e, 0x3b, 0x13, 0xf1, 0x87, 0xdd, - 0x8d, 0x2e, 0xff, 0x24, 0xfc, 0xfa, 0x8b, 0xb5, 0x88, 0xe4, 0x13, 0x8e, - 0xb1, 0x0a, 0x70, 0x5f, 0x8c, 0xc6, 0x4f, 0x19, 0x96, 0x5f, 0x98, 0xd2, - 0x01, 0xe6, 0xf5, 0xba, 0x97, 0xae, 0xe3, 0xcf, 0xdb, 0xcd, 0xf3, 0x0b, - 0x3a, 0x9b, 0xcf, 0xe3, 0x31, 0x05, 0x0d, 0x2a, 0x79, 0x1a, 0x76, 0x3d, - 0x85, 0xa3, 0xb6, 0xc5, 0xa8, 0xa4, 0xbb, 0xf5, 0xda, 0xbc, 0x75, 0x15, - 0x09, 0xc5, 0xf0, 0x3f, 0x35, 0xb6, 0x69, 0xa8, 0x05, 0x48, 0xc9, 0x1f, - 0x51, 0x06, 0x39, 0xfe, 0xb7, 0x27, 0x29, 0x7e, 0x03, 0x29, 0xc8, 0x82, - 0x54, 0xfe, 0xcd, 0x03, 0x88, 0xd2, 0xe7, 0xa7, 0x9f, 0xcf, 0x6f, 0xff, - 0x4a, 0xf0, 0xfe, 0x4d, 0x03, 0x21, 0x2b, 0x69, 0xa6, 0xd0, 0xf4, 0x95, - 0xa8, 0x94, 0x40, 0x07, 0x91, 0xca, 0xf2, 0x3d, 0x57, 0x92, 0x04, 0x4c, - 0xaf, 0x13, 0x60, 0xb7, 0x59, 0x8c, 0x1e, 0x6b, 0x2e, 0xa6, 0xe7, 0xe9, - 0x1f, 0x2e, 0x6a, 0x8a, 0x2f, 0x6d, 0x1c, 0xb5, 0x0d, 0xb4, 0x7b, 0x70, - 0x2f, 0x29, 0x25, 0x4c, 0x69, 0xde, 0xfd, 0x73, 0xfa, 0x90, 0xd2, 0x7d, - 0x84, 0xd6, 0xa3, 0xfb, 0x54, 0xb2, 0x7f, 0x96, 0xec, 0xb3, 0x52, 0x84, - 0x0f, 0xbd, 0x90, 0xc5, 0x21, 0xf4, 0x1b, 0x39, 0x84, 0x9f, 0xcd, 0xf3, - 0x4d, 0xe8, 0x46, 0x56, 0xaf, 0x36, 0x76, 0x4c, 0xa4, 0x40, 0x38, 0x5a, - 0x99, 0x90, 0x54, 0xe2, 0xaf, 0x3b, 0xcc, 0xf0, 0xfb, 0xf2, 0x43, 0xed, - 0x0c, 0x3f, 0x6c, 0xc7, 0x52, 0x2b, 0xf1, 0xdf, 0xc4, 0xf0, 0x27, 0x07, - 0x27, 0x80, 0x04, 0xfb, 0xa2, 0x50, 0xfc, 0x8a, 0x1f, 0xbf, 0x95, 0x39, - 0xdc, 0xda, 0xc2, 0xce, 0x0f, 0xc3, 0x46, 0x05, 0x7f, 0xe8, 0xcf, 0xcd, - 0x0c, 0x7f, 0x05, 0x3e, 0x47, 0x1e, 0xa6, 0xd8, 0xfa, 0xdd, 0x1a, 0xd9, - 0x3f, 0xc3, 0xc7, 0xe7, 0x7f, 0xea, 0x20, 0x9d, 0xaf, 0x0b, 0xf8, 0x11, - 0x1a, 0xe3, 0xee, 0x3f, 0xe1, 0xb7, 0x85, 0xde, 0x50, 0x2c, 0x78, 0x54, - 0xd3, 0x7d, 0x2a, 0xe4, 0xbb, 0x18, 0x3d, 0xf6, 0x2d, 0xbc, 0xde, 0x4f, - 0xce, 0x73, 0xb4, 0x0e, 0xf2, 0xa9, 0x76, 0x0c, 0x0b, 0x51, 0x7b, 0xf7, - 0x61, 0xa5, 0x05, 0x9f, 0xfa, 0xf4, 0x56, 0xad, 0x34, 0xa2, 0x4c, 0xdc, - 0x7e, 0xad, 0xad, 0x97, 0xd0, 0x2a, 0x55, 0x41, 0xcf, 0xc7, 0x7e, 0x84, - 0xd0, 0x4e, 0x7c, 0x5e, 0x87, 0x33, 0x59, 0x97, 0xbe, 0x4a, 0xfa, 0xb9, - 0xbc, 0xf3, 0xfd, 0x1f, 0x53, 0xd6, 0x04, 0xd0, 0xcf, 0xe7, 0x33, 0xfa, - 0xed, 0x3b, 0x38, 0x3d, 0x20, 0x6f, 0xe7, 0x01, 0xbd, 0xf4, 0x3c, 0x80, - 0xde, 0x38, 0xf4, 0x32, 0x1c, 0xa5, 0x30, 0x42, 0xab, 0x12, 0x6c, 0x49, - 0x3c, 0x38, 0x5e, 0x71, 0xee, 0x9f, 0x42, 0xef, 0x53, 0x17, 0xbf, 0x5f, - 0x84, 0x1f, 0x9c, 0x5f, 0x77, 0x85, 0xf0, 0xdf, 0x40, 0xdd, 0x1a, 0xa5, - 0x97, 0xee, 0x8f, 0xd3, 0xb7, 0x3e, 0x74, 0xbe, 0x9f, 0x9f, 0x8e, 0xbc, - 0x0a, 0xf7, 0xeb, 0x9c, 0x98, 0x6f, 0xbf, 0x3d, 0x0a, 0x4d, 0xc4, 0xf4, - 0xba, 0xf9, 0xc5, 0x29, 0x35, 0x28, 0x9f, 0x08, 0xac, 0xb6, 0x00, 0xe9, - 0x81, 0x05, 0x6c, 0xff, 0x5d, 0x9c, 0xa4, 0x58, 0x2d, 0xf1, 0x5a, 0x08, - 0xbf, 0xd1, 0x17, 0x18, 0xbd, 0xa7, 0x7b, 0x7f, 0x06, 0xd6, 0x67, 0x84, - 0x9f, 0xd3, 0xdb, 0xa2, 0xce, 0x1f, 0xdd, 0xe3, 0xf4, 0x9f, 0x04, 0xd3, - 0x7f, 0xb0, 0x9e, 0xce, 0x87, 0x59, 0x6b, 0x74, 0x53, 0x03, 0x79, 0x2d, - 0xc5, 0xd0, 0x04, 0xd5, 0x17, 0x93, 0xf5, 0x8e, 0x7e, 0x44, 0xf5, 0xc8, - 0xb9, 0xaa, 0x12, 0xfc, 0x79, 0x07, 0xb9, 0xf4, 0x40, 0x41, 0x13, 0xb5, - 0x71, 0x79, 0x73, 0xee, 0x93, 0xea, 0xa5, 0x7f, 0x5b, 0xb2, 0x36, 0x7b, - 0xc1, 0xe7, 0xdf, 0x95, 0x92, 0x9b, 0x2f, 0xde, 0x8f, 0xbe, 0x2a, 0xfc, - 0x59, 0x74, 0x8a, 0xf8, 0xb7, 0x38, 0xf8, 0xbb, 0xf8, 0x7e, 0x63, 0xc1, - 0xf9, 0xed, 0x31, 0xc1, 0x5e, 0xd9, 0x3a, 0xf6, 0xa4, 0xa0, 0xa4, 0xa6, - 0xbc, 0x7c, 0x04, 0x0d, 0x56, 0xd8, 0x53, 0x6c, 0x20, 0xea, 0x89, 0x7d, - 0x5c, 0xc8, 0xf8, 0x29, 0xe2, 0xd3, 0x3d, 0xe5, 0xc7, 0x8a, 0xfa, 0x93, - 0xc7, 0xbe, 0x9e, 0x20, 0xf6, 0xd5, 0xc4, 0xa7, 0x6a, 0x9d, 0xb3, 0x2f, - 0x86, 0xcc, 0x1c, 0x2a, 0x26, 0xf0, 0xf9, 0xa3, 0x5b, 0x98, 0x34, 0xda, - 0x8d, 0x70, 0xde, 0x36, 0x3a, 0xd6, 0x6e, 0xd5, 0x7b, 0xee, 0x3f, 0x13, - 0xe0, 0x5f, 0xfd, 0x39, 0xdb, 0x1f, 0x79, 0xda, 0x48, 0x12, 0xe4, 0xc7, - 0xf4, 0xd8, 0x53, 0x74, 0x00, 0xd4, 0x37, 0xa5, 0x0f, 0x0b, 0xad, 0x5e, - 0x7b, 0x3e, 0xf9, 0xdc, 0x48, 0xff, 0xc1, 0xb9, 0x2f, 0x3f, 0x59, 0x1c, - 0xb8, 0x7f, 0x7e, 0x1e, 0xf6, 0x5d, 0x71, 0xdf, 0x7d, 0xb0, 0x91, 0xa5, - 0x79, 0xed, 0x85, 0x6a, 0x6f, 0xd0, 0xbc, 0xf7, 0x93, 0xcf, 0x67, 0xdb, - 0x2b, 0x7c, 0xe9, 0x02, 0x14, 0x28, 0x1f, 0xfc, 0x97, 0xa7, 0xd5, 0xda, - 0xe8, 0x0b, 0xa7, 0xa7, 0x5d, 0x3b, 0xbd, 0xf8, 0x3b, 0x4e, 0x33, 0xfe, - 0x75, 0xa7, 0x19, 0xff, 0x67, 0xd8, 0xf9, 0xa0, 0x62, 0xbb, 0x1a, 0xe5, - 0x3f, 0xbe, 0x21, 0xd8, 0xa7, 0xb0, 0xfb, 0xb2, 0x34, 0xf8, 0xbe, 0xf0, - 0xfb, 0x60, 0xbd, 0x2f, 0xf8, 0x9b, 0x53, 0x09, 0xc0, 0x97, 0xc5, 0xf6, - 0x97, 0xd8, 0x8b, 0xa6, 0xad, 0x89, 0xe2, 0x90, 0xab, 0xaf, 0xfe, 0xed, - 0x73, 0x5c, 0x7f, 0xee, 0xd6, 0xea, 0xe3, 0xc3, 0x58, 0x97, 0x9d, 0x8c, - 0xe7, 0x47, 0xf1, 0x7a, 0x42, 0xeb, 0x64, 0x9d, 0xab, 0x3f, 0xeb, 0x14, - 0xaf, 0x7d, 0x81, 0xd5, 0xcb, 0x92, 0xbe, 0xfb, 0xcf, 0xed, 0x7b, 0x1c, - 0x95, 0xe8, 0xfd, 0x22, 0xf6, 0x7a, 0xfa, 0x0a, 0x4a, 0x2f, 0xd6, 0xc7, - 0x8b, 0xe7, 0xc1, 0x72, 0x46, 0x3f, 0xef, 0x87, 0x1c, 0xd7, 0xa0, 0x06, - 0x8c, 0xef, 0xeb, 0xcd, 0xd1, 0xfa, 0x99, 0xfb, 0x7f, 0xeb, 0xae, 0xf2, - 0xc9, 0xf3, 0xf7, 0x9d, 0xf3, 0x79, 0x8c, 0xfb, 0xd3, 0x19, 0x9f, 0xbf, - 0xc8, 0xe6, 0xb3, 0xfb, 0xd0, 0x9f, 0x98, 0x58, 0xc4, 0xd6, 0xbf, 0x8e, - 0x7c, 0xf3, 0xd1, 0x51, 0xc5, 0x0b, 0x73, 0xfd, 0x67, 0x3f, 0xa0, 0xf9, - 0xec, 0x1f, 0xe7, 0x97, 0x81, 0x5e, 0x57, 0xea, 0xe1, 0xa8, 0xed, 0x13, - 0xd4, 0x7f, 0x26, 0xfa, 0x62, 0x32, 0xed, 0xf2, 0x2b, 0xed, 0xe3, 0x17, - 0x10, 0xb7, 0xca, 0x77, 0xfe, 0x8e, 0xff, 0x41, 0xf9, 0x45, 0xf4, 0x97, - 0xcb, 0x2f, 0x20, 0x7f, 0x41, 0xc6, 0xc3, 0x2f, 0xd8, 0x40, 0xfe, 0xda, - 0x94, 0xbb, 0xfe, 0x02, 0x29, 0x7b, 0xc6, 0x7f, 0x39, 0xea, 0xf0, 0x6b, - 0x13, 0xf7, 0x2f, 0xea, 0xc9, 0xfe, 0x59, 0xdf, 0x62, 0xe2, 0x55, 0xce, - 0x9f, 0x3a, 0xd5, 0x3b, 0x0e, 0x8f, 0xa7, 0xfb, 0x5d, 0xea, 0x93, 0x77, - 0xce, 0x0f, 0xc6, 0x2f, 0x8b, 0xf3, 0x8b, 0x6a, 0xca, 0xc9, 0xa4, 0xcb, - 0x8f, 0x64, 0x85, 0xfc, 0x2c, 0x4f, 0x06, 0xca, 0x3f, 0xe5, 0x07, 0xe6, - 0xa7, 0xd5, 0xe4, 0xf2, 0x03, 0xd8, 0xdb, 0x56, 0xe7, 0xe1, 0x07, 0xdb, - 0xc7, 0x73, 0x3a, 0x5f, 0x7f, 0xcb, 0x8c, 0xf8, 0xf1, 0x96, 0xc3, 0x8f, - 0xd7, 0xf9, 0xf3, 0xeb, 0xa9, 0x7f, 0xcc, 0xf8, 0xf1, 0x22, 0xe7, 0xc7, - 0x63, 0xbe, 0xf1, 0x1a, 0xf9, 0x81, 0x86, 0x39, 0x3f, 0x88, 0x00, 0x4e, - 0xa6, 0x5c, 0x7e, 0xa4, 0x2a, 0xe4, 0x63, 0x65, 0x94, 0x7c, 0xe0, 0xd9, - 0x24, 0x9e, 0xe0, 0xf7, 0x09, 0x9a, 0x59, 0xe6, 0x7a, 0xf8, 0xc1, 0xed, - 0xd5, 0xf3, 0xe0, 0x8e, 0xc0, 0x7d, 0x6a, 0x99, 0x11, 0x3f, 0x7e, 0x51, - 0x21, 0x1f, 0x7d, 0x0d, 0x54, 0x7f, 0x30, 0x7f, 0xb3, 0x09, 0xef, 0x53, - 0xe3, 0xfc, 0x1f, 0xc6, 0x27, 0x92, 0x03, 0xbf, 0x08, 0xaf, 0xdf, 0xa4, - 0x7a, 0xe7, 0xd7, 0x2a, 0x2f, 0xb5, 0xf2, 0x07, 0x56, 0xaf, 0xf4, 0xeb, - 0x1b, 0x9f, 0xbc, 0x38, 0xfa, 0x98, 0xf3, 0x87, 0x8c, 0xee, 0x35, 0x80, - 0x3e, 0x04, 0xfe, 0x20, 0xf6, 0x4a, 0xf6, 0x34, 0x7a, 0xd7, 0xdf, 0x3a, - 0x23, 0xfe, 0xfc, 0x8f, 0xab, 0x6f, 0xf8, 0xf3, 0xb3, 0x9e, 0xf8, 0xd1, - 0xd4, 0x0c, 0x6e, 0x6f, 0xeb, 0x34, 0xef, 0x78, 0x8d, 0xfc, 0xb0, 0x1d, - 0x7e, 0x90, 0xe1, 0xc9, 0x8c, 0xcb, 0x8f, 0x4c, 0x85, 0xbc, 0xac, 0xf6, - 0xcb, 0x4b, 0xa4, 0xfe, 0x05, 0x07, 0x65, 0x71, 0x83, 0xa0, 0x7f, 0xcd, - 0xcf, 0x1a, 0xee, 0xfa, 0xa6, 0x19, 0xf1, 0x83, 0x75, 0x59, 0xf4, 0xbb, - 0xe7, 0x3f, 0xd5, 0xe0, 0x89, 0x6f, 0xb3, 0x2e, 0x3f, 0x1c, 0x7d, 0xdb, - 0x10, 0xe4, 0x3f, 0x72, 0x7e, 0xfc, 0xf8, 0xc6, 0x90, 0x7c, 0x03, 0xf9, - 0xcf, 0x64, 0x8c, 0xf3, 0x83, 0xf1, 0xab, 0x38, 0x18, 0xaa, 0x9f, 0x37, - 0x51, 0xfd, 0x5c, 0xdc, 0xc6, 0xf2, 0x1b, 0x5c, 0x5e, 0xa6, 0xbc, 0xf1, - 0x9e, 0x1d, 0xba, 0x5e, 0x81, 0xf3, 0x1a, 0x35, 0x50, 0x71, 0x29, 0x94, - 0xb9, 0x27, 0x3c, 0xf1, 0x18, 0x59, 0x0f, 0xd3, 0xad, 0x66, 0xbf, 0x7e, - 0xba, 0xb8, 0xce, 0xb5, 0xcf, 0xfb, 0x99, 0xbb, 0x1c, 0x47, 0xab, 0x96, - 0xef, 0xd3, 0xd0, 0xce, 0x7e, 0x4b, 0x73, 0x36, 0x63, 0xa9, 0x0a, 0xf6, - 0x87, 0x51, 0x8b, 0x99, 0xd9, 0x11, 0xe6, 0x4f, 0xe6, 0x87, 0xb0, 0x25, - 0xb1, 0x56, 0x9a, 0x89, 0x6c, 0x06, 0x2a, 0xe8, 0xe8, 0x59, 0xf5, 0xd5, - 0x89, 0xed, 0xf8, 0xdf, 0x1b, 0x5f, 0x7d, 0x80, 0x30, 0x74, 0xa4, 0xd1, - 0x7c, 0x9e, 0x0a, 0x83, 0x71, 0x29, 0x5d, 0x6f, 0x72, 0x7f, 0x15, 0x3f, - 0x9c, 0xf8, 0xab, 0x3c, 0x5f, 0x84, 0x6f, 0x6b, 0xe0, 0x79, 0xb2, 0x71, - 0x6b, 0xc0, 0x17, 0xcf, 0xae, 0x63, 0xf6, 0x92, 0xf3, 0xa3, 0xf1, 0xa0, - 0x3f, 0xde, 0x53, 0x3d, 0xf1, 0x9e, 0x57, 0x9e, 0xb9, 0xfe, 0xe9, 0x5c, - 0x77, 0x95, 0x37, 0x7e, 0xb4, 0x38, 0x7f, 0x91, 0x63, 0xf0, 0x07, 0x90, - 0x37, 0x5e, 0xe2, 0xfc, 0xc6, 0xf7, 0x85, 0x49, 0xcc, 0xc0, 0x1c, 0xd7, - 0x1e, 0x4d, 0x1a, 0xae, 0xfc, 0x1b, 0x15, 0xfa, 0x20, 0x17, 0xa1, 0x0f, - 0x1c, 0x7d, 0xc5, 0xf5, 0x01, 0x91, 0xce, 0x7d, 0x75, 0x5e, 0x7d, 0xb0, - 0x77, 0x16, 0xf4, 0xc1, 0x1a, 0x4d, 0xd4, 0x07, 0x53, 0x94, 0x7e, 0xbe, - 0x9f, 0x03, 0x27, 0xe6, 0x48, 0xdc, 0xff, 0xe2, 0xce, 0xea, 0xfa, 0x30, - 0x5e, 0x93, 0xbd, 0xa8, 0x4a, 0xff, 0x3c, 0xfe, 0xbb, 0x1e, 0xb4, 0x5f, - 0x1b, 0xec, 0x4d, 0xc1, 0x4c, 0x40, 0x3c, 0x45, 0xfd, 0xcd, 0x81, 0xf8, - 0x4c, 0xf8, 0x73, 0xad, 0x56, 0x61, 0x4f, 0x14, 0x1f, 0x7f, 0xb2, 0x03, - 0x0c, 0x36, 0x04, 0xff, 0x57, 0xc0, 0x47, 0xf7, 0x6a, 0x6b, 0x3c, 0x3f, - 0x41, 0xfc, 0x03, 0xec, 0xaf, 0x1a, 0x39, 0x64, 0xc6, 0xc1, 0x1e, 0x66, - 0x6c, 0x03, 0xec, 0xa1, 0xf9, 0x4b, 0x26, 0xcf, 0x96, 0x02, 0xf9, 0xcf, - 0x51, 0x34, 0xbd, 0xf6, 0x62, 0x1c, 0x7f, 0x5a, 0xa8, 0x5b, 0x5d, 0x45, - 0x44, 0xfe, 0x7e, 0xa5, 0x84, 0xf5, 0x01, 0xd6, 0x76, 0x07, 0xba, 0x74, - 0xf4, 0xf4, 0x97, 0xf7, 0xd2, 0xfc, 0x28, 0xac, 0xec, 0x35, 0x0e, 0xc6, - 0x00, 0xf5, 0xcd, 0x01, 0xf9, 0x52, 0xec, 0x4f, 0x73, 0xfd, 0xaa, 0x7a, - 0xef, 0xcb, 0xe3, 0xa1, 0xfa, 0x47, 0xb8, 0x1f, 0xd2, 0xfa, 0x3c, 0x1d, - 0x69, 0xff, 0xe1, 0x57, 0x53, 0xf4, 0x87, 0xec, 0xae, 0x3a, 0x77, 0xfd, - 0xf9, 0x33, 0x92, 0xe7, 0x2d, 0xce, 0x79, 0x39, 0xf6, 0xab, 0xd1, 0x77, - 0x5e, 0x03, 0x03, 0x8d, 0x32, 0xf2, 0xfc, 0x78, 0x55, 0x7f, 0x30, 0x4c, - 0x3f, 0xf9, 0xef, 0x73, 0x18, 0xbd, 0x0f, 0x56, 0xde, 0x3f, 0x3f, 0xbd, - 0x68, 0x5a, 0x86, 0x5e, 0x34, 0x56, 0xf5, 0xfe, 0x85, 0xd1, 0x5b, 0xdb, - 0xfd, 0xdb, 0x5e, 0x79, 0x1f, 0xe6, 0xfa, 0xe9, 0x1d, 0x98, 0x1b, 0x65, - 0x1f, 0xdd, 0xfa, 0x40, 0x88, 0x3e, 0x47, 0x1f, 0x10, 0xf9, 0xa7, 0x06, - 0x65, 0x32, 0xc1, 0xe9, 0xe7, 0xfa, 0x9b, 0xdf, 0x9f, 0x66, 0x2a, 0xff, - 0x2d, 0x0a, 0xd6, 0xc7, 0x24, 0x7f, 0x8b, 0x15, 0x74, 0x6f, 0x7d, 0x02, - 0x5a, 0xfc, 0x63, 0xab, 0xe8, 0x7d, 0x38, 0x4e, 0xfb, 0xbb, 0x0c, 0x13, - 0xc5, 0x4d, 0x14, 0x70, 0x1f, 0x14, 0xef, 0x7d, 0x00, 0xf1, 0xab, 0x87, - 0xff, 0xcb, 0x2f, 0x75, 0xfc, 0x0d, 0x50, 0xc1, 0x9c, 0x9f, 0x59, 0xd4, - 0x8d, 0xd6, 0x18, 0x9e, 0xfc, 0x91, 0x92, 0x51, 0x58, 0x7e, 0x3c, 0x2e, - 0xf4, 0x4f, 0xc6, 0x82, 0xec, 0x03, 0x3d, 0x9f, 0x67, 0x54, 0xf7, 0x3c, - 0x3c, 0xfc, 0xb6, 0xa3, 0xe2, 0x2f, 0x7e, 0x5e, 0xbc, 0x1d, 0x78, 0xfa, - 0x3c, 0xfa, 0x3c, 0xc7, 0x1f, 0xa8, 0x51, 0x5f, 0x8e, 0xf0, 0xf9, 0xe7, - 0xf1, 0xfc, 0x51, 0x12, 0xfc, 0x2b, 0x8b, 0xea, 0xc7, 0x2c, 0x8c, 0x66, - 0x4d, 0x1d, 0x19, 0xcb, 0xa9, 0x3e, 0x42, 0x1b, 0x79, 0x3e, 0xfa, 0xc4, - 0x7c, 0x9a, 0x7f, 0xc2, 0xb4, 0x27, 0x12, 0xa0, 0x47, 0xad, 0x61, 0x90, - 0x47, 0x96, 0xff, 0xb4, 0xee, 0x53, 0xcc, 0x88, 0xf3, 0x6e, 0x14, 0xf2, - 0xf9, 0x47, 0x9c, 0xf8, 0x77, 0x17, 0xaf, 0x07, 0x21, 0xa0, 0x9f, 0xcf, - 0xef, 0xb8, 0xc9, 0x6f, 0xaf, 0xdf, 0x76, 0xe6, 0xf3, 0xfc, 0x5d, 0x9f, - 0x41, 0xf7, 0xef, 0x59, 0x4f, 0xf9, 0xa1, 0x39, 0xfc, 0xa0, 0xf4, 0x24, - 0x68, 0xfe, 0xae, 0x14, 0x9d, 0xbf, 0xb3, 0x16, 0x51, 0xfd, 0xc3, 0xf3, - 0x0f, 0xc5, 0x13, 0x2c, 0xff, 0x90, 0xf1, 0xe9, 0x4b, 0x37, 0xff, 0xe6, - 0xcf, 0x97, 0x7e, 0xe7, 0xba, 0xe0, 0xfa, 0x86, 0x68, 0xff, 0xf9, 0x7e, - 0x92, 0x21, 0xf9, 0x68, 0xce, 0x9f, 0x94, 0x90, 0xbf, 0x4e, 0x57, 0xc9, - 0x5f, 0x67, 0xd8, 0x78, 0x96, 0x27, 0x0b, 0x85, 0xf5, 0x73, 0x3d, 0xfe, - 0x0e, 0xfc, 0x7c, 0x22, 0xb4, 0x3e, 0x93, 0x51, 0xfc, 0xf5, 0x8d, 0xe0, - 0x7c, 0xf8, 0xdb, 0xd7, 0xf9, 0xfd, 0xfd, 0xa4, 0x7a, 0x9e, 0x1e, 0x95, - 0x3f, 0x17, 0xe6, 0x17, 0x25, 0xe7, 0xa3, 0x14, 0x9b, 0xcf, 0x9f, 0x77, - 0x0e, 0x83, 0xc5, 0xf9, 0x6c, 0x7f, 0xa5, 0x87, 0x26, 0x3e, 0x88, 0x45, - 0xe5, 0x93, 0xaf, 0xbc, 0x43, 0x2e, 0x9f, 0xfc, 0xee, 0x1f, 0xd7, 0x5a, - 0x3f, 0x75, 0xfc, 0x3b, 0xa9, 0xfc, 0xfc, 0xd5, 0xad, 0x72, 0xf4, 0x4c, - 0xaa, 0x72, 0xf3, 0x8f, 0x5d, 0x23, 0x4b, 0x7f, 0xb0, 0x3f, 0xe5, 0xd4, - 0x0f, 0x04, 0xfc, 0x47, 0x6f, 0xf7, 0xf1, 0x1f, 0xe5, 0x5b, 0x33, 0x91, - 0xf9, 0xda, 0x77, 0xb5, 0x60, 0x7a, 0x6a, 0xc5, 0x6f, 0x9b, 0x99, 0xc8, - 0x7a, 0xc1, 0xb9, 0x7f, 0x22, 0xbd, 0xdf, 0x84, 0x54, 0xbd, 0xe9, 0x36, - 0xa1, 0x3e, 0x59, 0x85, 0x9e, 0xdf, 0x2a, 0x72, 0xe7, 0x75, 0xf7, 0x53, - 0x7e, 0xfc, 0xd5, 0xf8, 0x99, 0xd4, 0xe5, 0xf0, 0xaf, 0x0d, 0xad, 0xef, - 0xa4, 0x84, 0x7a, 0x05, 0xb7, 0xc7, 0xb4, 0xbe, 0xc5, 0xe3, 0xa3, 0xd2, - 0x47, 0xe7, 0x53, 0xfb, 0xbb, 0xd7, 0x24, 0xd9, 0xdc, 0x4f, 0xb7, 0xf6, - 0x29, 0x41, 0xf1, 0x9f, 0x58, 0xcf, 0x4d, 0xf3, 0xfb, 0x8e, 0x83, 0x3b, - 0x4b, 0x62, 0xff, 0xd5, 0xce, 0xfb, 0xc6, 0xeb, 0xe5, 0xf6, 0xff, 0x0f, - 0x4f, 0x56, 0xc9, 0x87, 0xa3, 0xa5, 0x51, 0xf9, 0x70, 0x1c, 0x56, 0xd0, - 0xfa, 0x45, 0xed, 0xf3, 0xdb, 0xfd, 0xf3, 0xcb, 0xb9, 0xc8, 0xf9, 0x08, - 0xb5, 0x4a, 0xe9, 0x47, 0x85, 0xe9, 0xc3, 0xb0, 0xfd, 0xa6, 0x57, 0xc8, - 0xf1, 0x67, 0x49, 0x83, 0x1f, 0xff, 0x7f, 0xdf, 0xa1, 0x44, 0xf2, 0xff, - 0xaf, 0x97, 0x55, 0xb9, 0xcf, 0x79, 0xff, 0x7e, 0xb7, 0xa7, 0xfc, 0xf7, - 0xf9, 0x5f, 0xfe, 0x14, 0x39, 0xf6, 0x8a, 0xcc, 0xef, 0xf5, 0xcf, 0x1f, - 0x17, 0xe6, 0xff, 0xf8, 0xa8, 0x16, 0x49, 0xcf, 0xbd, 0xcb, 0xe5, 0xf6, - 0x7b, 0x63, 0x9d, 0xdc, 0xfc, 0x0f, 0xcf, 0x95, 0x9b, 0xff, 0x85, 0x6b, - 0xe4, 0xe6, 0xff, 0xad, 0x64, 0xbd, 0xf3, 0x44, 0x46, 0x6e, 0xfe, 0xd0, - 0x06, 0xc9, 0xfa, 0x6e, 0xcf, 0xcc, 0xfa, 0x87, 0xf8, 0xfa, 0x72, 0x97, - 0xa4, 0xfc, 0x1d, 0xd3, 0xa4, 0xe6, 0x37, 0xfc, 0x93, 0xdc, 0xfc, 0x9d, - 0x6f, 0xc8, 0xcd, 0xff, 0xc6, 0x5a, 0x39, 0xfa, 0xb7, 0xe4, 0xe5, 0xf0, - 0x0f, 0x49, 0xea, 0xef, 0xc9, 0x78, 0xf0, 0x7c, 0x15, 0x8d, 0x1d, 0xa1, - 0xf5, 0x39, 0xe6, 0x7f, 0xa2, 0xb4, 0xcf, 0x7f, 0x75, 0xeb, 0x13, 0xbc, - 0x1f, 0x23, 0xc4, 0x1f, 0x2e, 0x2e, 0xf5, 0xfb, 0xc3, 0x16, 0xf7, 0x87, - 0xfd, 0xf5, 0x6c, 0x8f, 0x3f, 0xac, 0x44, 0xc5, 0x7b, 0xbf, 0x32, 0x18, - 0x7e, 0x0b, 0xfc, 0xe3, 0x7d, 0x78, 0xc5, 0x80, 0x52, 0x1c, 0x51, 0x26, - 0x42, 0xcf, 0x53, 0xf2, 0x3e, 0xfe, 0x7b, 0x5c, 0xe8, 0x6f, 0x90, 0x9d, - 0x6f, 0xe4, 0x22, 0xeb, 0xd7, 0xaf, 0xd6, 0xfc, 0xfd, 0x89, 0xfa, 0x19, - 0xf9, 0x7f, 0x7f, 0x19, 0xe2, 0x0f, 0x39, 0x95, 0x7a, 0xe6, 0xaf, 0x43, - 0x3d, 0x27, 0x0d, 0x77, 0x9d, 0xf5, 0x0f, 0x11, 0x7b, 0x6c, 0xc5, 0xd3, - 0x5e, 0xfc, 0x32, 0xf5, 0x7d, 0x15, 0x5d, 0x11, 0x59, 0xdf, 0xaf, 0xac, - 0xf7, 0x8e, 0x09, 0xf9, 0x2f, 0x47, 0x9e, 0x82, 0xf3, 0x5d, 0x82, 0x7c, - 0xe9, 0x4c, 0xbe, 0xb2, 0xed, 0xd5, 0xea, 0xbf, 0x4c, 0xde, 0xb2, 0xbc, - 0x20, 0xc7, 0xed, 0xff, 0x6e, 0xdf, 0xf3, 0xed, 0x8e, 0x63, 0x8a, 0xd5, - 0x72, 0x7e, 0x62, 0x5c, 0xa7, 0xcf, 0xb7, 0x90, 0x45, 0xfb, 0xc1, 0xa6, - 0xb7, 0xa2, 0xd2, 0x41, 0x5a, 0x8f, 0x54, 0xcf, 0x21, 0x0e, 0x1a, 0x7b, - 0x7f, 0x6b, 0x0b, 0x4f, 0x60, 0xd3, 0xf7, 0x21, 0x7b, 0xb0, 0x44, 0x92, - 0x12, 0x93, 0x62, 0xdb, 0x73, 0x4c, 0xb7, 0xde, 0x00, 0xe7, 0xa2, 0xa2, - 0x09, 0x9e, 0x8f, 0xb6, 0x06, 0x79, 0x3f, 0x5d, 0xd6, 0x20, 0xfd, 0x74, - 0x80, 0x7f, 0x47, 0xeb, 0x04, 0xcc, 0x8f, 0x9f, 0xe7, 0xc5, 0x7f, 0x81, - 0x1f, 0x7f, 0x2f, 0xb2, 0xc7, 0x00, 0xbf, 0xa5, 0xd8, 0x79, 0xc0, 0x5f, - 0xad, 0x1f, 0x24, 0x30, 0x5f, 0xd8, 0x45, 0xf2, 0xbd, 0x26, 0xad, 0x5f, - 0xf3, 0xa3, 0x4c, 0x05, 0xc9, 0x17, 0xab, 0xf7, 0x95, 0x3f, 0x56, 0x79, - 0xbd, 0xe2, 0x8b, 0xdc, 0xa5, 0x08, 0xc9, 0xf7, 0x00, 0x87, 0xe1, 0x8b, - 0x06, 0x06, 0x22, 0xcf, 0x12, 0xf6, 0xa3, 0x56, 0xe0, 0xe3, 0xfb, 0xb3, - 0x3f, 0x0a, 0xda, 0x9f, 0x98, 0xaf, 0x86, 0x7e, 0x96, 0x95, 0xd0, 0xcf, - 0x02, 0xf4, 0xc7, 0x48, 0x3f, 0x0b, 0xa7, 0xc7, 0x08, 0xa3, 0x9f, 0x9e, - 0xdf, 0x15, 0x4e, 0x7f, 0x1c, 0x42, 0xfb, 0x35, 0x77, 0x3d, 0x64, 0xe0, - 0x2d, 0x85, 0xd0, 0x6b, 0x54, 0xd2, 0x8b, 0x23, 0x29, 0x91, 0xff, 0xf4, - 0xfd, 0xbd, 0x71, 0xcd, 0x2e, 0x6a, 0x66, 0xa8, 0xbd, 0x7a, 0x51, 0x0f, - 0xf7, 0x5f, 0xe0, 0xe7, 0x67, 0x93, 0xd1, 0xf1, 0xf7, 0xcf, 0x27, 0x67, - 0xd6, 0x3f, 0x56, 0xed, 0x7e, 0xe9, 0xf8, 0x7e, 0xad, 0xd1, 0xbd, 0xf7, - 0x2b, 0x2c, 0x7f, 0x11, 0x7c, 0x9f, 0x9c, 0xf3, 0x30, 0x5a, 0x89, 0x3c, - 0xc3, 0x03, 0xad, 0xa4, 0x59, 0xd7, 0x91, 0x5a, 0x8e, 0x4a, 0x0d, 0xe8, - 0xa0, 0x99, 0x4e, 0x6b, 0x6a, 0x6a, 0xe4, 0x8b, 0xca, 0xc8, 0x80, 0x62, - 0x8e, 0x2a, 0x13, 0xcd, 0x4f, 0x99, 0xa5, 0x1d, 0x7f, 0xb3, 0xc8, 0xee, - 0xc0, 0xd1, 0xd0, 0x81, 0x39, 0x31, 0x3b, 0x09, 0x79, 0x46, 0xd8, 0x87, - 0xd1, 0x96, 0x25, 0x79, 0x88, 0x91, 0x56, 0xa0, 0xcf, 0xfe, 0x1e, 0xd5, - 0x24, 0xb6, 0xfe, 0x4d, 0xb3, 0xa4, 0x41, 0x3c, 0x6e, 0x70, 0xfd, 0x72, - 0x83, 0xef, 0x7d, 0xf6, 0xaa, 0xfd, 0xc7, 0x4e, 0xff, 0xd3, 0x7b, 0xe4, - 0xbe, 0xbb, 0xaf, 0x61, 0xae, 0xa2, 0xf2, 0xc6, 0xf2, 0xe5, 0xb1, 0xfb, - 0x9d, 0x7e, 0x09, 0xad, 0x44, 0xf2, 0x7b, 0x79, 0x54, 0xa4, 0xf9, 0x3d, - 0xb5, 0xd8, 0x90, 0x18, 0xd6, 0xa8, 0x84, 0xef, 0x44, 0x68, 0x13, 0xbf, - 0x1f, 0x59, 0x22, 0x5f, 0x8a, 0x7f, 0x3d, 0x9c, 0x86, 0x95, 0xf4, 0xf7, - 0x27, 0x60, 0xeb, 0x1e, 0x87, 0x7e, 0x29, 0xcc, 0xec, 0x09, 0xa6, 0x39, - 0x4b, 0x4b, 0x62, 0xfc, 0x3c, 0x92, 0x68, 0x26, 0xfa, 0x5c, 0xcc, 0xe7, - 0xc4, 0x0f, 0x09, 0xfd, 0x9f, 0xbc, 0x1f, 0x57, 0x41, 0xc5, 0x56, 0xd8, - 0x74, 0x71, 0x38, 0x69, 0x65, 0x41, 0x3e, 0xdb, 0x12, 0xde, 0x7c, 0x3a, - 0x0e, 0x92, 0x6c, 0xab, 0x45, 0xfa, 0x79, 0x76, 0xf2, 0x90, 0x2f, 0xff, - 0x83, 0xe6, 0x1c, 0x8a, 0x96, 0xdf, 0x73, 0x0f, 0xcd, 0xb0, 0xbf, 0x53, - 0xa8, 0x1f, 0x1a, 0x01, 0xe7, 0x97, 0x04, 0x5f, 0xf9, 0x79, 0xbf, 0x3f, - 0xff, 0x92, 0xce, 0xf1, 0x75, 0xab, 0xd4, 0x5e, 0x73, 0x7b, 0xb2, 0x5b, - 0xb0, 0x2f, 0x4e, 0x7f, 0xb9, 0xaf, 0xbe, 0x37, 0x37, 0x7a, 0x3f, 0xce, - 0xf3, 0x5d, 0x83, 0xb7, 0x9a, 0xdf, 0x37, 0x1f, 0xec, 0x7e, 0xcf, 0x8c, - 0xc1, 0x6e, 0xfd, 0x38, 0xcb, 0xf8, 0xef, 0x1b, 0xaf, 0xd0, 0x6f, 0x64, - 0x8c, 0xea, 0x37, 0x56, 0x8f, 0x83, 0x9f, 0xe3, 0xb3, 0x2d, 0x3f, 0xcd, - 0xe2, 0xf9, 0x70, 0xf9, 0xb1, 0x50, 0xf1, 0xb2, 0x96, 0x1d, 0x2a, 0x7b, - 0x3e, 0xc6, 0x77, 0xb9, 0x5f, 0x7e, 0xc4, 0xef, 0xa1, 0xd5, 0x28, 0x3f, - 0x9f, 0x3c, 0x53, 0xf2, 0x23, 0xf4, 0xc7, 0x18, 0xe2, 0xf9, 0xe0, 0xe5, - 0x06, 0xb4, 0x08, 0xd9, 0xa1, 0xf2, 0xa3, 0x51, 0xff, 0x6d, 0x40, 0x11, - 0xf2, 0xb5, 0x82, 0x3c, 0xf9, 0xe4, 0x07, 0x5d, 0x58, 0x55, 0x7e, 0x56, - 0x0b, 0xf9, 0x66, 0x56, 0x2f, 0xaf, 0xac, 0xef, 0x68, 0x7e, 0xff, 0x1a, - 0x9f, 0x33, 0xc9, 0x37, 0x17, 0x51, 0x74, 0xbf, 0xe8, 0x82, 0x68, 0xff, - 0xc7, 0x7e, 0x2f, 0xcc, 0xdf, 0x56, 0x88, 0xbf, 0x3d, 0xfd, 0xb0, 0x0e, - 0xe3, 0xc9, 0x27, 0x5b, 0x41, 0x9b, 0xd8, 0x2f, 0x3c, 0x51, 0x44, 0x65, - 0xa2, 0x0f, 0x9d, 0xfe, 0x36, 0x85, 0xf4, 0x8b, 0xb6, 0x67, 0x86, 0xac, - 0xfa, 0x7d, 0xab, 0xb2, 0x89, 0x69, 0x0d, 0xfc, 0x6d, 0x7a, 0x1f, 0x40, - 0xbb, 0x2f, 0x47, 0x56, 0xcc, 0x5b, 0x6f, 0x19, 0xf0, 0xf5, 0x2f, 0xef, - 0x5a, 0xe8, 0xc9, 0xd7, 0x40, 0x3f, 0xf2, 0xf4, 0x12, 0x28, 0xa3, 0xb8, - 0xf3, 0x8d, 0x1a, 0xe7, 0xeb, 0x30, 0xdf, 0xc4, 0x97, 0xe0, 0x11, 0x05, - 0x0d, 0x07, 0xcf, 0xd7, 0xb1, 0x6c, 0x8c, 0x6f, 0x63, 0xfe, 0xac, 0x91, - 0x61, 0xfa, 0x91, 0x9e, 0x67, 0xd0, 0xfc, 0xb8, 0x77, 0x7e, 0x98, 0xbf, - 0x1e, 0x92, 0x9f, 0xae, 0xe8, 0x9f, 0xcf, 0x82, 0x7c, 0x80, 0xf1, 0xfe, - 0x40, 0x29, 0x0d, 0xbb, 0xf2, 0x71, 0x71, 0xa8, 0x7c, 0x64, 0xb4, 0x5c, - 0xdc, 0x1b, 0x3f, 0x75, 0x45, 0xf6, 0xb7, 0x07, 0xd4, 0xb7, 0xb8, 0xc6, - 0xc9, 0x04, 0xd6, 0xab, 0x69, 0x74, 0x9a, 0x80, 0xfb, 0x6c, 0xbb, 0xfd, - 0x21, 0x0e, 0xfd, 0xf4, 0x2a, 0x3b, 0x9f, 0x34, 0xca, 0x07, 0xf7, 0xcb, - 0x3e, 0xab, 0x79, 0xea, 0x4b, 0x8a, 0x1c, 0x7d, 0x77, 0x72, 0xfa, 0x62, - 0x61, 0xfd, 0x8b, 0xf5, 0xc4, 0xdf, 0xe3, 0xf2, 0xbb, 0x4b, 0xf1, 0xd6, - 0x5f, 0xc4, 0xfc, 0x7e, 0x70, 0x7e, 0xfe, 0x39, 0x0f, 0x7d, 0xc1, 0xf4, - 0x74, 0xc7, 0xc2, 0xf3, 0x73, 0x5d, 0x44, 0xc3, 0xe1, 0xf5, 0x6a, 0xf5, - 0xfa, 0x82, 0x2c, 0xfe, 0xd0, 0x78, 0x11, 0xd5, 0x9c, 0x4f, 0x8e, 0xd4, - 0xf7, 0xa2, 0xfe, 0x0e, 0xc9, 0xff, 0x15, 0x35, 0x4f, 0x7f, 0xb4, 0x3f, - 0x3e, 0x6d, 0x9b, 0x25, 0xfc, 0xed, 0xbc, 0x9f, 0x97, 0xbe, 0x1f, 0x94, - 0xe5, 0xf8, 0x9b, 0x66, 0x09, 0x3f, 0xed, 0x77, 0x06, 0x79, 0x26, 0xfa, - 0xaa, 0xc9, 0xe9, 0xbf, 0x98, 0x25, 0xfc, 0xb4, 0xdf, 0xd9, 0xb1, 0xc7, - 0x4e, 0x7f, 0xc7, 0xc6, 0x59, 0xc2, 0x4f, 0xfb, 0x9d, 0xb9, 0xfd, 0x2f, - 0x3a, 0xf5, 0xc7, 0x8d, 0xdc, 0xbe, 0xe8, 0x11, 0xf7, 0xc9, 0x5e, 0xb7, - 0xd8, 0x98, 0xee, 0xe9, 0x85, 0x68, 0xf7, 0x21, 0xfe, 0xbd, 0x10, 0x9d, - 0xfb, 0xa3, 0xb5, 0xd8, 0x63, 0xe3, 0x25, 0x4f, 0x7e, 0x22, 0xe6, 0xca, - 0x3b, 0x21, 0x27, 0xed, 0x91, 0x07, 0x72, 0xfb, 0xbe, 0xed, 0xe9, 0x2f, - 0x1a, 0xe0, 0xdf, 0xfb, 0xa9, 0xe9, 0xfb, 0x24, 0xd5, 0xe5, 0xdb, 0xb1, - 0x7f, 0x7a, 0x15, 0xfb, 0xc7, 0xec, 0x23, 0xf6, 0xc2, 0x89, 0xfd, 0x43, - 0xd1, 0xf5, 0x56, 0x9b, 0xea, 0x8f, 0x2c, 0xb1, 0x77, 0x38, 0xb2, 0x2d, - 0x9e, 0x5c, 0x8b, 0xe3, 0x8f, 0xbc, 0xe3, 0x9f, 0x1b, 0x34, 0x9e, 0xb3, - 0x74, 0xb0, 0xe7, 0xc3, 0x5f, 0x6d, 0x5f, 0xf7, 0x88, 0x6a, 0x8f, 0x29, - 0x13, 0x28, 0x89, 0xf5, 0xb5, 0xd5, 0xf1, 0xf8, 0xe1, 0x4b, 0xa7, 0x15, - 0xac, 0x7a, 0xf2, 0x97, 0x6f, 0x18, 0x54, 0x21, 0x1e, 0xf8, 0x41, 0xfb, - 0x46, 0xf4, 0x13, 0x1a, 0x0f, 0x04, 0xee, 0xef, 0x99, 0x84, 0xcb, 0xcf, - 0x9c, 0x37, 0x3f, 0x44, 0xce, 0x62, 0x73, 0xda, 0xfd, 0xde, 0x96, 0x53, - 0x6f, 0x0f, 0xf9, 0xde, 0x16, 0xaf, 0xef, 0xfb, 0xdf, 0xf7, 0x3a, 0xe4, - 0xe2, 0x2f, 0xb6, 0xd7, 0x90, 0x7f, 0xe2, 0xf3, 0x69, 0x3d, 0x24, 0xa1, - 0x42, 0xbd, 0x9d, 0xda, 0x57, 0xa7, 0xbe, 0x5d, 0xc5, 0xdf, 0x70, 0xf2, - 0x2d, 0xcc, 0xdf, 0xc8, 0x47, 0xfb, 0x1b, 0x2c, 0x9f, 0x47, 0x9f, 0xbe, - 0x23, 0xc6, 0xed, 0x8b, 0x45, 0xf9, 0x1f, 0x07, 0xfe, 0x5b, 0xa3, 0x9e, - 0xfe, 0x7a, 0xa3, 0x8f, 0xbc, 0x4f, 0x67, 0xab, 0x60, 0x2f, 0x87, 0x13, - 0x47, 0x3a, 0x4f, 0xaa, 0xd6, 0x18, 0x86, 0x75, 0xcc, 0x7f, 0xb3, 0xe3, - 0x37, 0x93, 0x1a, 0xaf, 0x6f, 0xef, 0x86, 0x7e, 0x00, 0x03, 0xfc, 0x07, - 0x73, 0x38, 0x3c, 0xff, 0x17, 0xca, 0x7f, 0xa2, 0x2e, 0x37, 0xa7, 0x5c, - 0xfe, 0xa7, 0xfe, 0x5f, 0xf3, 0x5f, 0xec, 0x2f, 0xd0, 0x1d, 0x65, 0xb5, - 0x5e, 0xf3, 0xfb, 0x27, 0xdc, 0x5e, 0xfb, 0xfb, 0x0f, 0x2a, 0xed, 0x3d, - 0x7b, 0x7f, 0x32, 0x3b, 0x4d, 0xfc, 0x25, 0x47, 0xbf, 0x65, 0xa3, 0xf5, - 0x1b, 0x7f, 0x9e, 0xee, 0x34, 0x97, 0xac, 0x8f, 0x7a, 0xff, 0xc6, 0x24, - 0xf1, 0x85, 0x57, 0xdf, 0x72, 0xfd, 0xe3, 0xf0, 0x9a, 0x7e, 0x8f, 0xcc, - 0xc4, 0x0a, 0xca, 0x6a, 0x19, 0x8e, 0x81, 0xbe, 0xb7, 0x13, 0xbe, 0x7e, - 0xc4, 0x39, 0x44, 0xff, 0xa9, 0xfe, 0xf9, 0x8e, 0xb9, 0xe4, 0x30, 0xff, - 0xd2, 0x6f, 0x58, 0x3d, 0x96, 0xc7, 0x0b, 0xfc, 0xf9, 0xa6, 0x7f, 0x3d, - 0x21, 0x0d, 0xce, 0xb6, 0xc0, 0xed, 0xc1, 0x35, 0xfc, 0xf9, 0x19, 0x1e, - 0xcf, 0x91, 0x78, 0xda, 0xf3, 0x3e, 0xac, 0xd7, 0xbe, 0x52, 0xf2, 0x86, - 0x14, 0x90, 0xc7, 0xde, 0x98, 0xaf, 0xff, 0x2c, 0xe5, 0x5b, 0x9f, 0xcd, - 0x85, 0xbc, 0xef, 0x45, 0x7f, 0xde, 0x0a, 0xf1, 0x2f, 0x1c, 0x7b, 0xe8, - 0xd3, 0xdf, 0x2e, 0xfd, 0xd4, 0x34, 0xc0, 0x27, 0x6b, 0xd9, 0xfb, 0xaa, - 0xae, 0x3d, 0x4b, 0xf8, 0x9e, 0xcf, 0xed, 0x9d, 0xb0, 0x1f, 0x27, 0x3f, - 0x7c, 0x9c, 0xd3, 0xb7, 0x05, 0x09, 0xf9, 0x04, 0x3a, 0xbf, 0x4d, 0x58, - 0x5f, 0x25, 0xfe, 0xbc, 0x4c, 0x88, 0x07, 0x3f, 0x55, 0x25, 0x1e, 0x5c, - 0x3a, 0xd3, 0x78, 0x90, 0xfd, 0xc3, 0x3d, 0x0f, 0x2b, 0xbe, 0xfe, 0x95, - 0x2a, 0xf2, 0x49, 0xde, 0xbf, 0xe9, 0xf5, 0xe4, 0xeb, 0x1a, 0xa2, 0xe7, - 0xe7, 0xd1, 0x2e, 0xc3, 0x4f, 0x5f, 0x71, 0x09, 0xcb, 0x77, 0x06, 0xdf, - 0x17, 0x9d, 0xdf, 0x4f, 0xbe, 0xc1, 0x87, 0x33, 0x3e, 0xfa, 0x12, 0x6c, - 0x1c, 0x86, 0x37, 0x80, 0xfc, 0xb5, 0xf9, 0xfd, 0x53, 0x8e, 0x0f, 0x9f, - 0x77, 0xd1, 0x6b, 0xff, 0x61, 0x7e, 0x2e, 0x80, 0x3f, 0xe2, 0xf3, 0x39, - 0x7e, 0xc7, 0x3e, 0xb6, 0x2d, 0x80, 0xcd, 0x55, 0xcc, 0xa7, 0xfa, 0x6c, - 0x84, 0xe4, 0x03, 0x20, 0xbe, 0x0b, 0xe3, 0xbf, 0x80, 0x1f, 0x4b, 0xc1, - 0x7a, 0x2d, 0xea, 0xbc, 0x2a, 0xeb, 0xd9, 0xc1, 0xf3, 0xc3, 0xf4, 0xad, - 0xb8, 0x1f, 0xbe, 0x5e, 0xf4, 0x87, 0x08, 0x3e, 0x8f, 0x7f, 0xef, 0xd6, - 0xc3, 0x83, 0xcf, 0x13, 0x53, 0x5e, 0xf4, 0xca, 0x2f, 0xac, 0x5f, 0x53, - 0x9d, 0x7e, 0xa4, 0x8a, 0xf4, 0x47, 0xfb, 0x83, 0x96, 0xab, 0x9f, 0x83, - 0xf7, 0xb7, 0x3f, 0x6c, 0xbe, 0x89, 0x6c, 0xab, 0x39, 0x30, 0xfe, 0x0b, - 0xb4, 0x6f, 0x8e, 0x3f, 0x8e, 0xe3, 0xe7, 0x5e, 0xae, 0x1f, 0xb2, 0x5e, - 0xff, 0xbf, 0x89, 0xe7, 0xb7, 0x7f, 0x3d, 0x3f, 0xa4, 0x3f, 0x87, 0xfa, - 0xaf, 0xd1, 0xf7, 0xa5, 0xf4, 0xca, 0xbd, 0xfe, 0xfd, 0xdb, 0xb5, 0xc9, - 0xbf, 0xa3, 0xbf, 0x58, 0xbe, 0x86, 0xef, 0x37, 0x5e, 0x85, 0x3f, 0xfe, - 0xe7, 0x3f, 0x49, 0xf2, 0xf9, 0x48, 0x47, 0x13, 0x35, 0xf2, 0x13, 0xbb, - 0xbc, 0xeb, 0x35, 0x57, 0x3f, 0xc2, 0x27, 0x91, 0x69, 0xbe, 0x4b, 0x1c, - 0xaf, 0x21, 0x1e, 0xfe, 0x1d, 0xd9, 0xf7, 0xce, 0x59, 0xb1, 0xef, 0xae, - 0xbd, 0xee, 0x3c, 0x6b, 0xaf, 0x67, 0xd1, 0x5e, 0x7f, 0x2e, 0xa4, 0x9e, - 0xee, 0xe8, 0xa7, 0x10, 0xfe, 0xd9, 0xd4, 0xd8, 0x78, 0xbe, 0xdf, 0xf0, - 0x90, 0x94, 0xbd, 0x06, 0xd4, 0xe9, 0x3a, 0xaf, 0xbd, 0xde, 0x34, 0x1b, - 0xf6, 0xda, 0x5e, 0x26, 0x69, 0xaf, 0x97, 0xcf, 0xd0, 0x5e, 0x3b, 0xf5, - 0xba, 0x5d, 0xbe, 0xef, 0x8b, 0xd8, 0x5c, 0x3e, 0x29, 0x9b, 0x46, 0x53, - 0xfc, 0xbe, 0x86, 0xda, 0xef, 0x03, 0xd4, 0x7e, 0x3b, 0xcf, 0xb7, 0x16, - 0x56, 0xd1, 0x47, 0x9d, 0x32, 0xf6, 0x0a, 0xdb, 0xcf, 0x4e, 0xbf, 0xfd, - 0xdc, 0x15, 0xfc, 0xbe, 0xb3, 0xd7, 0x7e, 0xf6, 0x4a, 0xd9, 0xcf, 0x4e, - 0x49, 0xfb, 0x29, 0x47, 0x3f, 0x9f, 0x5f, 0xbb, 0xbd, 0xec, 0x9c, 0x65, - 0x7b, 0xd9, 0x29, 0x69, 0x2f, 0x3b, 0x25, 0xed, 0x65, 0xe7, 0x29, 0xdb, - 0x4b, 0xf3, 0x94, 0xec, 0x65, 0x67, 0xb4, 0xbd, 0x7c, 0x46, 0xb0, 0x97, - 0xa8, 0x36, 0xf9, 0x14, 0xdf, 0x77, 0x71, 0xed, 0x65, 0xf8, 0xf3, 0x4c, - 0x72, 0x9e, 0xbc, 0x9e, 0x7b, 0x86, 0xec, 0x15, 0xfb, 0xfe, 0x84, 0xf8, - 0x7d, 0x89, 0xb0, 0xf3, 0x42, 0x4e, 0x7e, 0xf7, 0xd4, 0xbe, 0x07, 0x40, - 0xfb, 0x41, 0x36, 0x63, 0x0c, 0x2b, 0xe0, 0xfb, 0x4b, 0x9e, 0xfa, 0x47, - 0x70, 0xbf, 0x91, 0x03, 0xb8, 0xf9, 0x5d, 0x05, 0xea, 0xbf, 0x29, 0xc3, - 0xc6, 0xfb, 0x75, 0xdf, 0x77, 0xe2, 0xf4, 0xa2, 0xf6, 0x8c, 0x6a, 0xb5, - 0xec, 0xc3, 0x6c, 0x9d, 0x0e, 0xec, 0x37, 0xc2, 0x8a, 0x55, 0xf1, 0xe9, - 0xeb, 0x1a, 0xf3, 0x65, 0x61, 0xfc, 0x30, 0xe3, 0x58, 0x7e, 0xcf, 0xd9, - 0x9c, 0x1c, 0xbf, 0x78, 0x39, 0x2a, 0x65, 0x50, 0xde, 0xc4, 0x67, 0xbf, - 0xaf, 0x29, 0x16, 0x83, 0xfc, 0x02, 0xf9, 0xbe, 0x14, 0x22, 0x1f, 0xc9, - 0xb6, 0x15, 0xda, 0xb1, 0x60, 0xa2, 0x36, 0x64, 0xb5, 0x63, 0x79, 0x1f, - 0x8f, 0xb9, 0xf9, 0x10, 0x56, 0x5a, 0x47, 0xbd, 0x83, 0x25, 0xa5, 0x42, - 0xfe, 0x3b, 0x11, 0x6a, 0x84, 0xf7, 0xc3, 0x0e, 0x0c, 0x22, 0xe8, 0x67, - 0x00, 0x79, 0x59, 0x56, 0x83, 0xbe, 0xe1, 0xfd, 0xa4, 0x6e, 0x7f, 0x58, - 0x9f, 0xd0, 0x1f, 0x36, 0x25, 0xf4, 0x1b, 0xf4, 0x45, 0xf7, 0x87, 0xd9, - 0x4b, 0x23, 0xed, 0x69, 0x65, 0x7d, 0x9f, 0x7d, 0xdf, 0x84, 0x1e, 0x5e, - 0x0c, 0xea, 0x5f, 0xf0, 0x71, 0xaf, 0xac, 0x7e, 0x4c, 0xb1, 0x8c, 0xe6, - 0x24, 0x79, 0x7f, 0x8e, 0x9c, 0xf7, 0x66, 0xcd, 0x51, 0x39, 0x50, 0xbf, - 0x4a, 0x8e, 0x61, 0x79, 0x1c, 0xb9, 0x7a, 0x5c, 0x1f, 0xd0, 0xac, 0x11, - 0xde, 0x0f, 0xa4, 0xa6, 0x51, 0xe9, 0x42, 0xb2, 0x1e, 0xf8, 0x65, 0x7c, - 0x02, 0x39, 0xfd, 0xa5, 0x95, 0xf4, 0xf8, 0xeb, 0x61, 0xc0, 0x9e, 0x51, - 0xd0, 0x2f, 0xa6, 0xfb, 0x3e, 0x1b, 0x81, 0x43, 0xbe, 0x47, 0x11, 0x64, - 0x1f, 0x56, 0xeb, 0x6e, 0xfd, 0x62, 0xb6, 0xbf, 0x87, 0x51, 0xc1, 0x9f, - 0x21, 0x92, 0x9f, 0x5b, 0x34, 0xae, 0x9f, 0x20, 0xf9, 0x51, 0xf7, 0x7d, - 0x2b, 0xca, 0x9f, 0xa2, 0x0e, 0xf7, 0x75, 0x64, 0x65, 0x36, 0x36, 0xa0, - 0x10, 0xfe, 0x10, 0x85, 0xa5, 0xa6, 0x38, 0x7f, 0xc0, 0x3e, 0xc7, 0x33, - 0x51, 0xfc, 0x49, 0xfa, 0xf9, 0x43, 0xf8, 0xbb, 0x21, 0x0d, 0xf6, 0xaf, - 0x08, 0xfe, 0xb9, 0x07, 0xb6, 0x6b, 0xf4, 0xd7, 0x57, 0xe9, 0x51, 0xfd, - 0x63, 0xa7, 0xc6, 0x9f, 0x4a, 0xfd, 0xe0, 0xef, 0x0f, 0xf0, 0xe8, 0x2f, - 0x9f, 0x3f, 0xed, 0xe4, 0x1f, 0xdb, 0xb1, 0x3f, 0xdd, 0x62, 0xaa, 0x17, - 0xa6, 0x1f, 0x51, 0x8a, 0x5f, 0xf7, 0xf4, 0x9b, 0x60, 0x77, 0xcb, 0x76, - 0xde, 0xcf, 0x7e, 0x3a, 0xe6, 0x9e, 0x6f, 0x40, 0xbe, 0x50, 0x47, 0x3d, - 0x13, 0xff, 0xc1, 0xed, 0x5f, 0xf4, 0x7d, 0xf2, 0xec, 0xaf, 0xb6, 0xfb, - 0x74, 0x46, 0xf6, 0x87, 0xac, 0x17, 0x54, 0x6f, 0xbf, 0xd8, 0x9f, 0xc5, - 0xab, 0xec, 0xb7, 0xf7, 0xd0, 0xe9, 0xde, 0x2f, 0xeb, 0xf7, 0x1b, 0x27, - 0xfb, 0x6b, 0xd6, 0xc5, 0xef, 0xaf, 0x39, 0xfb, 0xb3, 0xf0, 0xfe, 0xf4, - 0xae, 0x7a, 0x34, 0xf5, 0x88, 0x82, 0xbc, 0xf5, 0x02, 0xd3, 0xcd, 0x7f, - 0xa1, 0xe2, 0x48, 0xdc, 0xdf, 0x3f, 0xf7, 0xed, 0xba, 0xc8, 0xfd, 0x2d, - 0xea, 0xd0, 0xd0, 0x94, 0x13, 0x4f, 0x48, 0xf6, 0x3b, 0x56, 0xe9, 0xc7, - 0x22, 0xf7, 0xb7, 0xb9, 0x8e, 0xeb, 0x3f, 0x4f, 0xff, 0x1e, 0xb9, 0x6f, - 0x79, 0xb2, 0x5f, 0x33, 0xc6, 0xfa, 0x61, 0xdd, 0xfd, 0x94, 0xa3, 0xeb, - 0xdb, 0x9e, 0x7c, 0xba, 0xd5, 0x7e, 0x3a, 0xef, 0x1b, 0x1a, 0x4e, 0xf8, - 0xfb, 0x15, 0x47, 0x13, 0x32, 0xfd, 0x8b, 0x71, 0x33, 0xff, 0x9a, 0xb9, - 0xa5, 0x15, 0xad, 0x6f, 0x33, 0xa6, 0xa9, 0x1d, 0x5a, 0x9d, 0x88, 0xce, - 0xef, 0x47, 0xf7, 0x8f, 0x86, 0xf7, 0x4b, 0x9c, 0x10, 0xbf, 0x4f, 0x49, - 0xe5, 0x4f, 0xcd, 0x0c, 0x91, 0xef, 0xd1, 0x38, 0xe7, 0x55, 0xc7, 0x9f, - 0xaf, 0xd3, 0xfe, 0x08, 0xb8, 0x2f, 0xcd, 0x4d, 0xe3, 0x5a, 0x5f, 0x64, - 0xff, 0xf2, 0x05, 0x21, 0x7f, 0x6f, 0x10, 0xe2, 0xe7, 0x74, 0x0b, 0x3e, - 0x3f, 0xc7, 0xdf, 0xbc, 0x33, 0x1e, 0xed, 0xaf, 0x9e, 0xa6, 0xfb, 0x13, - 0xf2, 0xbe, 0x62, 0x65, 0xbe, 0xc1, 0xdf, 0x0f, 0x53, 0xf1, 0xfe, 0xa2, - 0xb2, 0x9b, 0xc5, 0x17, 0x8c, 0x3e, 0x15, 0xfc, 0x99, 0x20, 0x7b, 0x0a, - 0x85, 0x68, 0xfa, 0xfd, 0x02, 0x2b, 0x59, 0xbd, 0x3e, 0x23, 0xc6, 0xa7, - 0x2b, 0x0e, 0x45, 0x7f, 0xef, 0x6d, 0x7f, 0x88, 0xff, 0xe2, 0xc4, 0x9b, - 0xbe, 0x78, 0x7c, 0x34, 0x09, 0xf6, 0xa9, 0x14, 0x63, 0xf5, 0x24, 0x6b, - 0xb3, 0xe7, 0xfb, 0x42, 0x29, 0x7f, 0x3c, 0x3d, 0xc3, 0xfe, 0xab, 0x95, - 0x92, 0xf1, 0xf4, 0xaa, 0x43, 0xa7, 0xfa, 0xbd, 0x44, 0xc6, 0x7f, 0xaa, - 0xa0, 0xad, 0xf9, 0xec, 0x7d, 0x17, 0xdd, 0x11, 0xde, 0x38, 0xe1, 0x47, - 0x73, 0x57, 0x9e, 0xbc, 0x77, 0xd5, 0xd9, 0x4a, 0x26, 0xd8, 0x47, 0x49, - 0x59, 0x1f, 0xaf, 0xfc, 0x23, 0x7a, 0xdf, 0xaa, 0xc5, 0x7f, 0x6e, 0xbd, - 0xd5, 0xff, 0x7d, 0x50, 0x8e, 0x9f, 0xee, 0x67, 0x84, 0xe4, 0xeb, 0x8a, - 0xc1, 0xf1, 0x7b, 0x71, 0x2c, 0x1e, 0x10, 0x8f, 0x31, 0x7c, 0xd4, 0x97, - 0x1d, 0xa4, 0xfd, 0x2c, 0xb1, 0x9a, 0xfd, 0x69, 0xe7, 0xf9, 0x74, 0xfb, - 0x93, 0x8e, 0x7d, 0x62, 0xf9, 0x97, 0x7e, 0x4f, 0x7f, 0x1d, 0x97, 0xc7, - 0x94, 0xcc, 0xf9, 0x5e, 0xe8, 0xa9, 0x47, 0x92, 0x7c, 0x52, 0x4f, 0xce, - 0xf1, 0xbf, 0x08, 0x3f, 0xf2, 0x21, 0xf1, 0x24, 0x86, 0x73, 0x73, 0xdc, - 0x78, 0x1b, 0xa1, 0x9b, 0x79, 0x3f, 0xf4, 0x89, 0xf9, 0x33, 0x97, 0x2f, - 0xfb, 0xaa, 0x33, 0x26, 0x5f, 0xc1, 0xf4, 0xf5, 0x86, 0xfd, 0x3d, 0x55, - 0x51, 0x1e, 0xc3, 0xea, 0x59, 0xa1, 0xf9, 0xb5, 0x47, 0xfc, 0xfd, 0x44, - 0xbc, 0x5f, 0x54, 0xcc, 0xaf, 0x49, 0xc6, 0x5b, 0x8e, 0x7c, 0x82, 0x80, - 0xb4, 0x98, 0x1a, 0xc4, 0x57, 0xbd, 0x71, 0x8a, 0xaf, 0xcb, 0x77, 0x3e, - 0xce, 0xf7, 0x54, 0x69, 0x3f, 0x04, 0x41, 0xe7, 0x7e, 0xbf, 0xc2, 0x91, - 0xd7, 0x55, 0x1e, 0xff, 0x01, 0x0d, 0xc6, 0xb9, 0xbc, 0xe3, 0xe9, 0xf6, - 0xb7, 0x92, 0x41, 0xfd, 0x10, 0xb3, 0x13, 0x8f, 0xd3, 0xf8, 0x77, 0x9e, - 0xea, 0xc4, 0xe3, 0x95, 0xf1, 0x4b, 0x95, 0xf7, 0x05, 0x04, 0x7c, 0x90, - 0x1d, 0x87, 0xb3, 0x2f, 0x2d, 0x99, 0x35, 0x7c, 0x4f, 0x44, 0xbc, 0x1f, - 0x53, 0x0d, 0x06, 0xfe, 0xf9, 0xed, 0x83, 0x38, 0xbf, 0x43, 0xae, 0x5f, - 0x5c, 0x1a, 0xff, 0x0d, 0xa7, 0x84, 0x1f, 0x5e, 0x36, 0x88, 0x96, 0xcf, - 0x65, 0x91, 0xf8, 0x40, 0xb4, 0x72, 0x6a, 0xed, 0xfc, 0x9a, 0xe1, 0xdf, - 0x6f, 0x73, 0xfe, 0x7e, 0xb1, 0x21, 0xc0, 0x59, 0x01, 0x36, 0x05, 0xd8, - 0x12, 0x60, 0x96, 0xef, 0x77, 0x61, 0x5d, 0x80, 0x0d, 0x01, 0xce, 0x0a, - 0xb0, 0x29, 0xc0, 0x67, 0xf6, 0xef, 0x51, 0xd9, 0x02, 0x5c, 0xf5, 0xef, - 0xad, 0xcd, 0x32, 0x7d, 0x67, 0x7f, 0xce, 0xfe, 0x9c, 0xfd, 0x89, 0xf8, - 0xf9, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xec, 0x5d, 0x7b, 0x90, 0x1c, - 0x47, 0x79, 0xef, 0xee, 0x79, 0xec, 0xec, 0xde, 0xde, 0x6a, 0x75, 0x3e, - 0x89, 0xf5, 0x59, 0xb2, 0xe6, 0x24, 0x59, 0x3a, 0x52, 0x46, 0x75, 0x16, - 0xb2, 0x39, 0x9b, 0x8b, 0x99, 0x93, 0x4e, 0x46, 0x32, 0x12, 0x11, 0x06, - 0x82, 0x4c, 0x01, 0xd9, 0xc3, 0x45, 0x95, 0x6c, 0x1c, 0xd9, 0x24, 0x0e, - 0x39, 0x63, 0xa7, 0xdc, 0x7b, 0xb7, 0xf7, 0x30, 0xe8, 0x5c, 0x67, 0x61, - 0x8c, 0x30, 0xc6, 0xec, 0x49, 0x32, 0x56, 0x61, 0x2a, 0x50, 0xe5, 0xa4, - 0xca, 0xf0, 0x47, 0xb2, 0xd6, 0x83, 0x08, 0x4a, 0xaa, 0x3a, 0x70, 0xe2, - 0x22, 0x29, 0x2a, 0x59, 0x3b, 0x29, 0x47, 0x3c, 0xa2, 0x28, 0x01, 0x93, - 0x33, 0x18, 0x94, 0x7e, 0xcf, 0x74, 0xef, 0xcc, 0xec, 0x9e, 0x24, 0x53, - 0x24, 0x70, 0x7f, 0xd8, 0x1e, 0xcf, 0x6c, 0x4f, 0x4f, 0xf7, 0xd7, 0xdf, - 0xfb, 0xfb, 0x7d, 0xfd, 0x4c, 0xbf, 0xe2, 0xf8, 0x32, 0x34, 0xdf, 0xca, - 0x43, 0x79, 0x8b, 0xd8, 0x17, 0xf3, 0x0f, 0xc2, 0x3d, 0xb0, 0x3e, 0x0e, - 0x0f, 0xbd, 0x07, 0x9c, 0xc2, 0xfb, 0xed, 0xea, 0x26, 0x68, 0x71, 0x7f, - 0x6d, 0x0e, 0x3c, 0x42, 0xcf, 0xec, 0x0a, 0xb7, 0xd7, 0x83, 0x5f, 0x1b, - 0x70, 0x30, 0xe7, 0x57, 0x37, 0xb9, 0xcc, 0x7b, 0x4a, 0xe4, 0x77, 0xb9, - 0x08, 0x82, 0x07, 0x73, 0xe3, 0x57, 0x77, 0x58, 0xdc, 0x3f, 0x95, 0x7f, - 0x74, 0xce, 0x2e, 0x23, 0x04, 0x96, 0x2e, 0x05, 0x6e, 0xb9, 0x34, 0xa9, - 0xf4, 0xdf, 0xa2, 0xa8, 0x3f, 0x1d, 0xa6, 0xf6, 0x72, 0x75, 0xb3, 0xf2, - 0x0f, 0xac, 0x23, 0xfa, 0x6b, 0x80, 0x96, 0x6d, 0x5d, 0x03, 0x65, 0xfe, - 0xd9, 0x2d, 0xa9, 0xfd, 0x38, 0x73, 0x98, 0xa9, 0x13, 0xb5, 0xcd, 0xef, - 0xed, 0xa3, 0xb7, 0x70, 0x0e, 0x67, 0xf9, 0xb5, 0xe8, 0x17, 0x27, 0xef, - 0x7b, 0x75, 0xc6, 0x48, 0xa7, 0x0f, 0xfb, 0x3a, 0xbf, 0xf1, 0xfb, 0xa8, - 0xbc, 0xf2, 0x3b, 0x66, 0x0b, 0x9b, 0x68, 0xd0, 0x9a, 0xfa, 0xf3, 0x62, - 0xde, 0xf7, 0x5e, 0x47, 0x7e, 0x1f, 0x00, 0xef, 0x30, 0xe4, 0x97, 0xc2, - 0xdb, 0x62, 0xf6, 0xa5, 0xef, 0x8b, 0xe7, 0x77, 0x23, 0x5c, 0x73, 0xfc, - 0x8b, 0x95, 0x27, 0xaf, 0xfb, 0x5f, 0x51, 0xbf, 0x1c, 0x91, 0xff, 0xb1, - 0x56, 0xec, 0x8f, 0xcf, 0x9a, 0x73, 0xfb, 0x8e, 0xa4, 0x0f, 0x9a, 0x2b, - 0x18, 0x78, 0xbe, 0x53, 0x74, 0xf8, 0xfa, 0x47, 0xe9, 0xa5, 0x41, 0xe8, - 0x65, 0x98, 0xda, 0x9b, 0xfe, 0xcd, 0x1b, 0xa1, 0xc8, 0x47, 0x94, 0xf2, - 0x0d, 0x89, 0x7a, 0x45, 0x2a, 0xbb, 0xbd, 0xeb, 0xdf, 0xe9, 0x4a, 0x7c, - 0x23, 0x93, 0x5e, 0xec, 0x2e, 0x80, 0xa7, 0xed, 0xc9, 0xfc, 0x6c, 0x9e, - 0x5c, 0xe7, 0xa9, 0x7f, 0x73, 0xbb, 0xb1, 0xde, 0xca, 0x7f, 0xcc, 0xea, - 0x09, 0x99, 0x38, 0xc4, 0x9b, 0xa5, 0x44, 0xaf, 0x31, 0x54, 0x55, 0xb0, - 0x6c, 0x6b, 0x6f, 0x9b, 0xf4, 0x13, 0xa9, 0x07, 0x12, 0xf8, 0x2a, 0xac, - 0xff, 0x6b, 0x31, 0x7c, 0x1f, 0x53, 0xb9, 0xfc, 0x48, 0xbc, 0x23, 0x48, - 0xcb, 0x67, 0xf4, 0x11, 0xa3, 0xa7, 0x6c, 0x38, 0x7e, 0xfa, 0xfc, 0x2f, - 0xb1, 0xfe, 0x71, 0x11, 0xe7, 0xbf, 0xff, 0xd7, 0x7a, 0xfe, 0xff, 0xe0, - 0x12, 0x9d, 0xff, 0xe6, 0xfd, 0x4a, 0x5f, 0xaf, 0xff, 0x6b, 0xfb, 0xf3, - 0xff, 0x95, 0xff, 0xef, 0xf5, 0x22, 0xf6, 0x70, 0xe4, 0xfc, 0xca, 0xfd, - 0xef, 0x5d, 0x24, 0xff, 0x97, 0xfc, 0xbd, 0x49, 0x9f, 0x94, 0xf8, 0xd7, - 0xca, 0x5e, 0xfa, 0xed, 0xde, 0xef, 0xe6, 0xbf, 0x53, 0x46, 0x7d, 0x5e, - 0x5e, 0xb3, 0x97, 0x4d, 0x7b, 0x2e, 0x87, 0xdf, 0xc4, 0xfe, 0xdd, 0x23, - 0xea, 0x8b, 0x65, 0x3d, 0xf2, 0x58, 0xa0, 0xcb, 0xdb, 0xa3, 0xfa, 0xb5, - 0xe4, 0x9f, 0x78, 0x35, 0xf7, 0xff, 0xf9, 0x49, 0xfa, 0x7f, 0x18, 0x6f, - 0x93, 0xf5, 0xf5, 0x71, 0xf2, 0xd8, 0x52, 0xf7, 0x73, 0xb8, 0x2f, 0x6e, - 0x3c, 0xfc, 0x9e, 0xf9, 0x70, 0xff, 0xf7, 0x6b, 0xfb, 0xaf, 0xfc, 0xa5, - 0xbf, 0xfc, 0xed, 0xdc, 0x6f, 0xfd, 0xaf, 0xd9, 0x5e, 0x7f, 0x77, 0xcc, - 0x7a, 0x23, 0xf3, 0xbc, 0x5d, 0xb2, 0xfd, 0x6c, 0xb9, 0xfe, 0xc9, 0xfb, - 0xf7, 0xab, 0xdf, 0xed, 0xdf, 0xaf, 0xe5, 0xfc, 0x0b, 0xef, 0xa5, 0xdc, - 0x7f, 0x7e, 0xfe, 0x8f, 0x0e, 0xf7, 0x69, 0xe7, 0xbf, 0x4b, 0xf1, 0x83, - 0x8c, 0xc1, 0x1f, 0x16, 0x4d, 0x2f, 0x06, 0x3d, 0x36, 0x9d, 0xff, 0xba, - 0xce, 0x8f, 0x7e, 0x77, 0xfe, 0x2f, 0xf2, 0xfc, 0x6b, 0xfb, 0x1b, 0x73, - 0xfe, 0x0d, 0xfe, 0xbf, 0xb8, 0xfd, 0xfc, 0xcd, 0x3b, 0xef, 0x06, 0xde, - 0x8b, 0x8a, 0xd7, 0xfd, 0xd0, 0xec, 0x6f, 0x62, 0x8b, 0x78, 0x25, 0xe2, - 0xf8, 0xde, 0xa3, 0x36, 0xcf, 0x57, 0xca, 0x1a, 0xf1, 0x8d, 0x19, 0x0d, - 0xbf, 0x5d, 0x7d, 0xab, 0xc0, 0x07, 0x0a, 0x17, 0x44, 0x8f, 0x1f, 0x3c, - 0xad, 0xe3, 0xef, 0xdd, 0xdd, 0xf1, 0x46, 0x89, 0x1f, 0x34, 0x03, 0x78, - 0xfd, 0xf3, 0x5e, 0x8b, 0xd6, 0x3f, 0x03, 0xd8, 0x69, 0x05, 0x91, 0xfe, - 0x67, 0x32, 0xff, 0xcd, 0x92, 0xf9, 0x56, 0xf4, 0x85, 0x14, 0x72, 0xdb, - 0x57, 0xf9, 0xab, 0xf5, 0xbc, 0xd7, 0x46, 0xbc, 0xe3, 0x5d, 0xe1, 0xfb, - 0x01, 0x38, 0x3c, 0xf6, 0x3c, 0x5c, 0x07, 0x1a, 0x79, 0x85, 0x87, 0x1d, - 0xc8, 0xf1, 0x7d, 0x19, 0x3f, 0x9c, 0x7e, 0x0e, 0xd6, 0xa2, 0xf1, 0x43, - 0xad, 0xbe, 0xf7, 0x49, 0x85, 0x9f, 0xbb, 0x99, 0xf6, 0xaf, 0x42, 0xbe, - 0x0b, 0xbc, 0x51, 0x8b, 0xd6, 0xaf, 0xf1, 0x7a, 0x9a, 0xcf, 0x45, 0xea, - 0x21, 0xf7, 0xc8, 0x7c, 0x99, 0x9f, 0x73, 0xfc, 0x5a, 0x3e, 0xaf, 0x71, - 0xab, 0xc9, 0x9f, 0xdf, 0xa2, 0x1f, 0x94, 0xaa, 0xff, 0x17, 0xfd, 0xa0, - 0xfc, 0xf4, 0xfa, 0xc6, 0xfa, 0xea, 0x84, 0x7c, 0x0e, 0x23, 0x3e, 0x0d, - 0x32, 0x46, 0x7e, 0x5b, 0x1d, 0x63, 0x07, 0xae, 0x20, 0x1f, 0xb8, 0xe1, - 0x1f, 0x00, 0x98, 0xca, 0x7d, 0xb6, 0x97, 0xfd, 0x7a, 0xcb, 0x08, 0x53, - 0x35, 0xf1, 0x30, 0xdb, 0xff, 0x89, 0x2f, 0x59, 0xf0, 0x7e, 0x88, 0x23, - 0xf5, 0xf4, 0xb2, 0xde, 0x1d, 0x04, 0x2c, 0xfe, 0x1b, 0x58, 0x99, 0x28, - 0xfe, 0x2c, 0xa8, 0xab, 0xfd, 0x63, 0x5f, 0x93, 0xf1, 0xbe, 0x63, 0x93, - 0xf5, 0xf1, 0xe2, 0xea, 0xe5, 0xb7, 0x23, 0x5e, 0x9f, 0x27, 0xf0, 0x74, - 0x4d, 0xfc, 0x68, 0x5b, 0xdf, 0xaf, 0xe6, 0xdf, 0x7f, 0x0b, 0x81, 0x20, - 0x83, 0xc2, 0xfa, 0x7a, 0x7e, 0x2e, 0xd5, 0xfb, 0xfd, 0x93, 0x22, 0xfe, - 0xb2, 0x17, 0x30, 0x7a, 0x0b, 0xfb, 0xb7, 0x68, 0x78, 0xfa, 0x21, 0xbd, - 0x7c, 0x8b, 0xa6, 0xe6, 0x8d, 0x7d, 0x07, 0x9e, 0x85, 0x8d, 0x69, 0x9e, - 0xff, 0xde, 0x6f, 0x27, 0xd3, 0x97, 0xc4, 0x7f, 0x7d, 0xfa, 0x47, 0x5f, - 0xcd, 0x03, 0x1d, 0xbf, 0x01, 0xb5, 0xa8, 0x5f, 0x15, 0xf2, 0x08, 0x43, - 0xbe, 0xbf, 0x38, 0x3d, 0x7f, 0x52, 0xe5, 0xbf, 0x25, 0x9c, 0x6f, 0x81, - 0x67, 0x23, 0xcf, 0x67, 0xe3, 0x16, 0x5e, 0x2f, 0x54, 0x78, 0x64, 0xe4, - 0x89, 0x17, 0x0b, 0x99, 0xea, 0xd1, 0x11, 0x96, 0x77, 0x88, 0xbf, 0xef, - 0x20, 0x8a, 0x5f, 0x63, 0xd3, 0xa9, 0x96, 0xd9, 0xfb, 0x54, 0xbe, 0x0f, - 0xd2, 0xfb, 0x65, 0x8e, 0xaa, 0xf8, 0x5b, 0xe0, 0x55, 0xd9, 0xf3, 0x45, - 0xf2, 0xbc, 0xfc, 0xfe, 0x40, 0xd8, 0x37, 0x1e, 0xec, 0xc4, 0x41, 0xd1, - 0xb7, 0xc0, 0xc0, 0x6b, 0x0c, 0x6f, 0x21, 0xe9, 0x3c, 0x5e, 0x1b, 0xb5, - 0x87, 0x22, 0xfe, 0x12, 0x00, 0x4e, 0x82, 0xe8, 0x7e, 0x84, 0xf5, 0xce, - 0x82, 0x9e, 0xec, 0x69, 0x10, 0xd0, 0x7e, 0x03, 0x0b, 0xf7, 0xb1, 0x7e, - 0x14, 0x3d, 0xfb, 0x59, 0x8a, 0x11, 0xde, 0xca, 0xeb, 0xd2, 0x31, 0x2a, - 0x02, 0xbc, 0xee, 0xd9, 0x77, 0xc0, 0x70, 0x7d, 0x57, 0x48, 0xbc, 0x7d, - 0x11, 0x7f, 0xff, 0x96, 0x36, 0x9e, 0x84, 0xf7, 0x0a, 0xcf, 0xbf, 0x1e, - 0x8f, 0xe6, 0xeb, 0x37, 0xe1, 0x8a, 0x7e, 0x78, 0x35, 0x8c, 0x1e, 0x24, - 0xd7, 0x53, 0xff, 0x3e, 0x67, 0x2f, 0xc0, 0xa0, 0x1a, 0x47, 0x2f, 0xdb, - 0xd1, 0xe6, 0x0c, 0xa1, 0x77, 0x78, 0x16, 0x34, 0xc6, 0x92, 0xf1, 0x0e, - 0xde, 0x91, 0x80, 0x2f, 0xc7, 0xf9, 0x03, 0xc7, 0x5f, 0xe0, 0xfd, 0x60, - 0xe4, 0x7a, 0x10, 0x3e, 0xd2, 0x50, 0xf1, 0x78, 0x6c, 0x25, 0xe0, 0x1b, - 0xb0, 0xf5, 0xac, 0x67, 0x50, 0xf8, 0xbe, 0x0b, 0xc3, 0x0f, 0x81, 0xee, - 0xa5, 0xc2, 0x0f, 0x99, 0xd1, 0xea, 0xb3, 0xc3, 0xfa, 0xde, 0x05, 0x8b, - 0xdd, 0x1f, 0xa2, 0xf8, 0x69, 0x55, 0x5a, 0xbf, 0x6b, 0xfb, 0x13, 0x12, - 0x6f, 0x9d, 0xfe, 0x09, 0xfc, 0x1e, 0x49, 0x7f, 0xe5, 0x05, 0x13, 0x9f, - 0x87, 0xcf, 0xd7, 0xa7, 0xfc, 0x2c, 0xd3, 0x29, 0xe9, 0x35, 0x07, 0x82, - 0x2c, 0xed, 0x57, 0x40, 0x03, 0xf6, 0x97, 0x41, 0x56, 0xc8, 0xc8, 0xfe, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Aug 21 21:48:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B418DD592E; Mon, 21 Aug 2017 21:48:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67E633898; Mon, 21 Aug 2017 21:48:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LLmOoF027895; Mon, 21 Aug 2017 21:48:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LLmOTh027894; Mon, 21 Aug 2017 21:48:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708212148.v7LLmOTh027894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 21 Aug 2017 21:48:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322772 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 322772 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 21:48:25 -0000 Author: jhb Date: Mon Aug 21 21:48:24 2017 New Revision: 322772 URL: https://svnweb.freebsd.org/changeset/base/322772 Log: Enable hardfloat CPU instructions in the FP exception handler. This permits compiling with clang's integrated assembler. Sponsored by: DARPA / AFRL Modified: head/sys/mips/mips/exception.S Modified: head/sys/mips/mips/exception.S ============================================================================== --- head/sys/mips/mips/exception.S Mon Aug 21 20:27:45 2017 (r322771) +++ head/sys/mips/mips/exception.S Mon Aug 21 21:48:24 2017 (r322772) @@ -1102,6 +1102,8 @@ END(MipsTLBMissException) *---------------------------------------------------------------------------- */ NESTED(MipsFPTrap, CALLFRAME_SIZ, ra) + .set push + .set hardfloat PTR_SUBU sp, sp, CALLFRAME_SIZ mfc0 t0, MIPS_COP_0_STATUS HAZARD_DELAY @@ -1201,6 +1203,7 @@ FPReturn: ITLBNOPFIX j ra PTR_ADDU sp, sp, CALLFRAME_SIZ + .set pop END(MipsFPTrap) #ifndef INTRNG From owner-svn-src-all@freebsd.org Mon Aug 21 21:56:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23CFEDD611C; Mon, 21 Aug 2017 21:56:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E63CA3D7E; Mon, 21 Aug 2017 21:56:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LLu21p031940; Mon, 21 Aug 2017 21:56:02 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LLu2kZ031939; Mon, 21 Aug 2017 21:56:02 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708212156.v7LLu2kZ031939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 21 Aug 2017 21:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322773 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 322773 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 21:56:04 -0000 Author: markj Date: Mon Aug 21 21:56:02 2017 New Revision: 322773 URL: https://svnweb.freebsd.org/changeset/base/322773 Log: Fix an off-by-two in the llquantize() action parameter validation. The aggregation created by llquantize() partitions values into buckets; the lower bound of the bucket containing the largest values is b^{m+1}, where b and m are the second and fourth parameters to the action, respectively. Bucket bounds are stored in a 64-bit integer, and so the llquantize() validation checks need to verify that b^{m+1} fits in 64 bits. However, it was only verifying that b^{m-1} fits in 64 bits, so certain parameter combinations could trigger assertion failures in libdtrace. PR: 219451 MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Mon Aug 21 21:48:24 2017 (r322772) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Mon Aug 21 21:56:02 2017 (r322773) @@ -1503,7 +1503,7 @@ dt_compile_agg(dtrace_hdl_t *dtp, dt_node_t *dnp, dtra "divide a power of the factor\n"); } - for (i = 0, order = 1; i < args[2].value; i++) { + for (i = 0, order = 1; i <= args[2].value + 1; i++) { if (order * args[0].value > order) { order *= args[0].value; continue; @@ -1511,7 +1511,7 @@ dt_compile_agg(dtrace_hdl_t *dtp, dt_node_t *dnp, dtra dnerror(dnp, D_LLQUANT_MAGTOOBIG, "llquantize( ) " "factor (%d) raised to power of high magnitude " - "(%d) overflows 64-bits\n", args[0].value, + "(%d) plus 1 overflows 64-bits\n", args[0].value, args[2].value); } From owner-svn-src-all@freebsd.org Mon Aug 21 21:58:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9FA9DD63DE; Mon, 21 Aug 2017 21:58:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5FCE3FB3; Mon, 21 Aug 2017 21:58:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LLwgMx032086; Mon, 21 Aug 2017 21:58:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LLwgXC032084; Mon, 21 Aug 2017 21:58:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708212158.v7LLwgXC032084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 21 Aug 2017 21:58:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322774 - in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize usr.sbin/dtrace/tests/common/llquantize X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize usr.sbin/dtrace/tests/common/llquantize X-SVN-Commit-Revision: 322774 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 21:58:44 -0000 Author: markj Date: Mon Aug 21 21:58:42 2017 New Revision: 322774 URL: https://svnweb.freebsd.org/changeset/base/322774 Log: Add a regression test for r322773. MFC after: 1 week Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d (contents, props changed) Modified: head/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d Mon Aug 21 21:58:42 2017 (r322774) @@ -0,0 +1,35 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2017 Mark Johnston + */ + +/* + * A regression test for FreeBSD r322773. 100^9 fits in 64 bits, but + * llquantize() will create buckets up to 100^{10}, which does not fit. + */ + +BEGIN +{ + @ = llquantize(0, 100, 0, 9, 100); + exit(0); +} Modified: head/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile Mon Aug 21 21:56:02 2017 (r322773) +++ head/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile Mon Aug 21 21:58:42 2017 (r322774) @@ -22,6 +22,7 @@ ${PACKAGE}FILES= \ err.D_LLQUANT_LOWVAL.d \ err.D_LLQUANT_MAGRANGE.d \ err.D_LLQUANT_MAGTOOBIG.d \ + err.D_LLQUANT_MAGTOOBIG.offbyone.d \ err.D_LLQUANT_NSTEPMATCH.d \ err.D_LLQUANT_NSTEPTYPE.d \ err.D_LLQUANT_NSTEPVAL.d \ From owner-svn-src-all@freebsd.org Mon Aug 21 22:26:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80405DD7EB4; Mon, 21 Aug 2017 22:26:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E5C063F3F; Mon, 21 Aug 2017 22:26:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7LMQnd0044183; Mon, 21 Aug 2017 22:26:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7LMQn5N044182; Mon, 21 Aug 2017 22:26:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708212226.v7LMQn5N044182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 21 Aug 2017 22:26:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322775 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize X-SVN-Commit-Revision: 322775 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 22:26:50 -0000 Author: markj Date: Mon Aug 21 22:26:49 2017 New Revision: 322775 URL: https://svnweb.freebsd.org/changeset/base/322775 Log: Use an updated copy of the CDDL header boilerplate from illumos. Reported by: Yuri Pankov X-MFC with: r322774 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d Mon Aug 21 21:58:42 2017 (r322774) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d Mon Aug 21 22:26:49 2017 (r322775) @@ -1,26 +1,16 @@ /* - * CDDL HEADER START + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms version + * 1.0 of the CDDL. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. */ /* - * Copyright (c) 2017 Mark Johnston + * Copyright 2017 Mark Johnston */ /* From owner-svn-src-all@freebsd.org Tue Aug 22 00:10:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A5F9DDDF3A; Tue, 22 Aug 2017 00:10:17 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 037F366F26; Tue, 22 Aug 2017 00:10:16 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7M0AGOn084600; Tue, 22 Aug 2017 00:10:16 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7M0AFV4084597; Tue, 22 Aug 2017 00:10:15 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708220010.v7M0AFV4084597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 22 Aug 2017 00:10:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322776 - in head/sys: kern sys x86/x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: kern sys x86/x86 X-SVN-Commit-Revision: 322776 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 00:10:17 -0000 Author: cem Date: Tue Aug 22 00:10:15 2017 New Revision: 322776 URL: https://svnweb.freebsd.org/changeset/base/322776 Log: subr_smp: Clean up topology analysis, add additional layers Rather than repeatedly nesting loops, separate concerns with a single loop per call stack level. Use a table to drive the recursive routine. Handle missing topology layers more gracefully (infer a single unit). Analyze some additional optional layers which may be present on e.g. AMD Zen systems (groups, aka dies, per package; and cachegroups, aka CCXes, per group). Display that additional information in the boot-time topology information, when it is relevent (non-one). Reviewed by: markj@, mjoras@ (earlier version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12019 Modified: head/sys/kern/subr_smp.c head/sys/sys/smp.h head/sys/x86/x86/mp_x86.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Mon Aug 21 22:26:49 2017 (r322775) +++ head/sys/kern/subr_smp.c Tue Aug 22 00:10:15 2017 (r322776) @@ -993,7 +993,7 @@ topo_next_node(struct topo_node *top, struct topo_node if ((next = TAILQ_NEXT(node, siblings)) != NULL) return (next); - while ((node = node->parent) != top) + while (node != top && (node = node->parent) != top) if ((next = TAILQ_NEXT(node, siblings)) != NULL) return (next); @@ -1012,7 +1012,7 @@ topo_next_nonchild_node(struct topo_node *top, struct if ((next = TAILQ_NEXT(node, siblings)) != NULL) return (next); - while ((node = node->parent) != top) + while (node != top && (node = node->parent) != top) if ((next = TAILQ_NEXT(node, siblings)) != NULL) return (next); @@ -1044,105 +1044,99 @@ topo_set_pu_id(struct topo_node *node, cpuid_t id) } } -/* - * Check if the topology is uniform, that is, each package has the same number - * of cores in it and each core has the same number of threads (logical - * processors) in it. If so, calculate the number of package, the number of - * cores per package and the number of logical processors per core. - * 'all' parameter tells whether to include administratively disabled logical - * processors into the analysis. - */ -int -topo_analyze(struct topo_node *topo_root, int all, - int *pkg_count, int *cores_per_pkg, int *thrs_per_core) +static struct topology_spec { + topo_node_type type; + bool match_subtype; + uintptr_t subtype; +} topology_level_table[TOPO_LEVEL_COUNT] = { + [TOPO_LEVEL_PKG] = { .type = TOPO_TYPE_PKG, }, + [TOPO_LEVEL_GROUP] = { .type = TOPO_TYPE_GROUP, }, + [TOPO_LEVEL_CACHEGROUP] = { + .type = TOPO_TYPE_CACHE, + .match_subtype = true, + .subtype = CG_SHARE_L3, + }, + [TOPO_LEVEL_CORE] = { .type = TOPO_TYPE_CORE, }, + [TOPO_LEVEL_THREAD] = { .type = TOPO_TYPE_PU, }, +}; + +static bool +topo_analyze_table(struct topo_node *root, int all, enum topo_level level, + struct topo_analysis *results) { - struct topo_node *pkg_node; - struct topo_node *core_node; - struct topo_node *pu_node; - int thrs_per_pkg; - int cpp_counter; - int tpc_counter; - int tpp_counter; + struct topology_spec *spec; + struct topo_node *node; + int count; - *pkg_count = 0; - *cores_per_pkg = -1; - *thrs_per_core = -1; - thrs_per_pkg = -1; - pkg_node = topo_root; - while (pkg_node != NULL) { - if (pkg_node->type != TOPO_TYPE_PKG) { - pkg_node = topo_next_node(topo_root, pkg_node); + if (level >= TOPO_LEVEL_COUNT) + return (true); + + spec = &topology_level_table[level]; + count = 0; + node = topo_next_node(root, root); + + while (node != NULL) { + if (node->type != spec->type || + (spec->match_subtype && node->subtype != spec->subtype)) { + node = topo_next_node(root, node); continue; } - if (!all && CPU_EMPTY(&pkg_node->cpuset)) { - pkg_node = topo_next_nonchild_node(topo_root, pkg_node); + if (!all && CPU_EMPTY(&node->cpuset)) { + node = topo_next_nonchild_node(root, node); continue; } - (*pkg_count)++; + count++; - cpp_counter = 0; - tpp_counter = 0; - core_node = pkg_node; - while (core_node != NULL) { - if (core_node->type == TOPO_TYPE_CORE) { - if (!all && CPU_EMPTY(&core_node->cpuset)) { - core_node = - topo_next_nonchild_node(pkg_node, - core_node); - continue; - } + if (!topo_analyze_table(node, all, level + 1, results)) + return (false); - cpp_counter++; + node = topo_next_nonchild_node(root, node); + } - tpc_counter = 0; - pu_node = core_node; - while (pu_node != NULL) { - if (pu_node->type == TOPO_TYPE_PU && - (all || !CPU_EMPTY(&pu_node->cpuset))) - tpc_counter++; - pu_node = topo_next_node(core_node, - pu_node); - } + /* No explicit subgroups is essentially one subgroup. */ + if (count == 0) { + count = 1; - if (*thrs_per_core == -1) - *thrs_per_core = tpc_counter; - else if (*thrs_per_core != tpc_counter) - return (0); + if (!topo_analyze_table(root, all, level + 1, results)) + return (false); + } - core_node = topo_next_nonchild_node(pkg_node, - core_node); - } else { - /* PU node directly under PKG. */ - if (core_node->type == TOPO_TYPE_PU && - (all || !CPU_EMPTY(&core_node->cpuset))) - tpp_counter++; - core_node = topo_next_node(pkg_node, - core_node); - } - } + if (results->entities[level] == -1) + results->entities[level] = count; + else if (results->entities[level] != count) + return (false); - if (*cores_per_pkg == -1) - *cores_per_pkg = cpp_counter; - else if (*cores_per_pkg != cpp_counter) - return (0); - if (thrs_per_pkg == -1) - thrs_per_pkg = tpp_counter; - else if (thrs_per_pkg != tpp_counter) - return (0); + return (true); +} - pkg_node = topo_next_nonchild_node(topo_root, pkg_node); - } +/* + * Check if the topology is uniform, that is, each package has the same number + * of cores in it and each core has the same number of threads (logical + * processors) in it. If so, calculate the number of packages, the number of + * groups per package, the number of cachegroups per group, and the number of + * logical processors per cachegroup. 'all' parameter tells whether to include + * administratively disabled logical processors into the analysis. + */ +int +topo_analyze(struct topo_node *topo_root, int all, + struct topo_analysis *results) +{ - KASSERT(*pkg_count > 0, + results->entities[TOPO_LEVEL_PKG] = -1; + results->entities[TOPO_LEVEL_CORE] = -1; + results->entities[TOPO_LEVEL_THREAD] = -1; + results->entities[TOPO_LEVEL_GROUP] = -1; + results->entities[TOPO_LEVEL_CACHEGROUP] = -1; + + if (!topo_analyze_table(topo_root, all, TOPO_LEVEL_PKG, results)) + return (0); + + KASSERT(results->entities[TOPO_LEVEL_PKG] > 0, ("bug in topology or analysis")); - if (*cores_per_pkg == 0) { - KASSERT(*thrs_per_core == -1 && thrs_per_pkg > 0, - ("bug in topology or analysis")); - *thrs_per_core = thrs_per_pkg; - } return (1); } + #endif /* SMP */ Modified: head/sys/sys/smp.h ============================================================================== --- head/sys/sys/smp.h Mon Aug 21 22:26:49 2017 (r322775) +++ head/sys/sys/smp.h Tue Aug 22 00:10:15 2017 (r322776) @@ -120,8 +120,25 @@ struct topo_node * topo_next_node(struct topo_node *to struct topo_node * topo_next_nonchild_node(struct topo_node *top, struct topo_node *node); void topo_set_pu_id(struct topo_node *node, cpuid_t id); -int topo_analyze(struct topo_node *topo_root, int all, int *pkg_count, - int *cores_per_pkg, int *thrs_per_core); + +enum topo_level { + TOPO_LEVEL_PKG = 0, + /* + * Some systems have useful sub-package core organizations. On these, + * a package has one or more subgroups. Each subgroup contains one or + * more cache groups (cores that share a last level cache). + */ + TOPO_LEVEL_GROUP, + TOPO_LEVEL_CACHEGROUP, + TOPO_LEVEL_CORE, + TOPO_LEVEL_THREAD, + TOPO_LEVEL_COUNT /* Must be last */ +}; +struct topo_analysis { + int entities[TOPO_LEVEL_COUNT]; +}; +int topo_analyze(struct topo_node *topo_root, int all, + struct topo_analysis *results); #define TOPO_FOREACH(i, root) \ for (i = root; i != NULL; i = topo_next_node(root, i)) Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Mon Aug 21 22:26:49 2017 (r322775) +++ head/sys/x86/x86/mp_x86.c Tue Aug 22 00:10:15 2017 (r322776) @@ -662,18 +662,23 @@ cpu_mp_announce(void) { struct topo_node *node; const char *hyperthread; - int pkg_count; - int cores_per_pkg; - int thrs_per_core; + struct topo_analysis topology; printf("FreeBSD/SMP: "); - if (topo_analyze(&topo_root, 1, &pkg_count, - &cores_per_pkg, &thrs_per_core)) { - printf("%d package(s)", pkg_count); - if (cores_per_pkg > 0) - printf(" x %d core(s)", cores_per_pkg); - if (thrs_per_core > 1) - printf(" x %d hardware threads", thrs_per_core); + if (topo_analyze(&topo_root, 1, &topology)) { + printf("%d package(s)", topology.entities[TOPO_LEVEL_PKG]); + if (topology.entities[TOPO_LEVEL_GROUP] > 1) + printf(" x %d groups", + topology.entities[TOPO_LEVEL_GROUP]); + if (topology.entities[TOPO_LEVEL_CACHEGROUP] > 1) + printf(" x %d cache groups", + topology.entities[TOPO_LEVEL_CACHEGROUP]); + if (topology.entities[TOPO_LEVEL_CORE] > 0) + printf(" x %d core(s)", + topology.entities[TOPO_LEVEL_CORE]); + if (topology.entities[TOPO_LEVEL_THREAD] > 1) + printf(" x %d hardware threads", + topology.entities[TOPO_LEVEL_THREAD]); } else { printf("Non-uniform topology"); } @@ -681,13 +686,21 @@ cpu_mp_announce(void) if (disabled_cpus) { printf("FreeBSD/SMP Online: "); - if (topo_analyze(&topo_root, 0, &pkg_count, - &cores_per_pkg, &thrs_per_core)) { - printf("%d package(s)", pkg_count); - if (cores_per_pkg > 0) - printf(" x %d core(s)", cores_per_pkg); - if (thrs_per_core > 1) - printf(" x %d hardware threads", thrs_per_core); + if (topo_analyze(&topo_root, 0, &topology)) { + printf("%d package(s)", + topology.entities[TOPO_LEVEL_PKG]); + if (topology.entities[TOPO_LEVEL_GROUP] > 1) + printf(" x %d groups", + topology.entities[TOPO_LEVEL_GROUP]); + if (topology.entities[TOPO_LEVEL_CACHEGROUP] > 1) + printf(" x %d cache groups", + topology.entities[TOPO_LEVEL_CACHEGROUP]); + if (topology.entities[TOPO_LEVEL_CORE] > 0) + printf(" x %d core(s)", + topology.entities[TOPO_LEVEL_CORE]); + if (topology.entities[TOPO_LEVEL_THREAD] > 1) + printf(" x %d hardware threads", + topology.entities[TOPO_LEVEL_THREAD]); } else { printf("Non-uniform topology"); } From owner-svn-src-all@freebsd.org Tue Aug 22 02:03:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0731DE6376; Tue, 22 Aug 2017 02:03:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD0F36B8A8; Tue, 22 Aug 2017 02:03:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7M231Bf032472; Tue, 22 Aug 2017 02:03:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7M231OI032470; Tue, 22 Aug 2017 02:03:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708220203.v7M231OI032470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 22 Aug 2017 02:03:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322777 - in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Commit-Revision: 322777 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 02:03:03 -0000 Author: kevans Date: Tue Aug 22 02:03:01 2017 New Revision: 322777 URL: https://svnweb.freebsd.org/changeset/base/322777 Log: MFC r321450: bsdgrep(1): Don't exit before processing every file Given an empty pattern (i.e. grep "" A B), bsdgrep(1) would previously exit() with the appropriate exit code upon encountering an empty file. Likely intended as an optimization, but this behavior is technically incorrect since an empty pattern should match every line. PR: 220924 Approved by: emaste (mentor, blanket MFC) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/11/usr.bin/grep/util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue Aug 22 00:10:15 2017 (r322776) +++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue Aug 22 02:03:01 2017 (r322777) @@ -667,6 +667,24 @@ mmap_eof_not_eol_body() atf_check -s exit:0 -o not-empty \ env MALLOC_CONF="redzone:true" grep --mmap -e " " test2 } + +atf_test_case matchall +matchall_head() +{ + atf_set "descr" "Check proper behavior of matching all with an empty string" +} +matchall_body() +{ + printf "" > test1 + printf "A" > test2 + printf "A\nB" > test3 + + atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test1 test2 test3 + atf_check -o inline:"test3:A\ntest3:B\ntest2:A\n" grep "" test3 test1 test2 + atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test2 test3 test1 + + atf_check -s exit:1 grep "" test1 +} # End FreeBSD atf_init_test_cases() @@ -707,5 +725,6 @@ atf_init_test_cases() atf_add_test_case badcontext atf_add_test_case mmap atf_add_test_case mmap_eof_not_eol + atf_add_test_case matchall # End FreeBSD } Modified: stable/11/usr.bin/grep/util.c ============================================================================== --- stable/11/usr.bin/grep/util.c Tue Aug 22 00:10:15 2017 (r322776) +++ stable/11/usr.bin/grep/util.c Tue Aug 22 02:03:01 2017 (r322777) @@ -259,16 +259,8 @@ procfile(const char *fn) pc.ln.boff = 0; pc.ln.off += pc.ln.len + 1; if ((pc.ln.dat = grep_fgetln(f, &pc.ln.len)) == NULL || - pc.ln.len == 0) { - if (pc.ln.line_no == 0 && matchall) - /* - * An empty file with an empty pattern and the - * -w flag does not match - */ - exit(matchall && wflag ? 1 : 0); - else - break; - } + pc.ln.len == 0) + break; if (pc.ln.len > 0 && pc.ln.dat[pc.ln.len - 1] == fileeol) --pc.ln.len; From owner-svn-src-all@freebsd.org Tue Aug 22 03:59:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9846DDEDC0C; Tue, 22 Aug 2017 03:59:15 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x22c.google.com (mail-pf0-x22c.google.com [IPv6:2607:f8b0:400e:c00::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 680006FD1A; Tue, 22 Aug 2017 03:59:15 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x22c.google.com with SMTP id c28so19770631pfe.3; Mon, 21 Aug 2017 20:59:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=j8SERZSE/hSx8wO4K/+lYH5YEEnmZZ2dEKl3LRvYEZ0=; b=lc5++42WlmrHetiYSkpahjZP718FkEuTvA/vACIKACe78jhIpzeEpY6tHc6PnTPvtH /S7on4s0yY0nqLa5Qhwg7zcgLo1Yzdi9tDQNrD6kPiaxFVfCxdHLDmSD7fp+3TL88yGr rbTpGa/v52PEaFGjWgRMVmOMjqQcVHS4axGQp0a5QOogy2klW1wz9hAG4chYyYjRPmKy kzX0ZSnFzsJY7tCIx0fTDPi5+LwEe0eGarwXLu1ugWpHS0T7GiaodF5m+l9H7NNLyEdU d7zp4zZCugPXGab2HA09jIxvOouidvrQoX0cKkwC3mRweb4wUGkxq6Js9Y1wnOhAbT2b /yvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=j8SERZSE/hSx8wO4K/+lYH5YEEnmZZ2dEKl3LRvYEZ0=; b=TLC2CIpf7/B7HRVeQuVVSI7Ls2XFYzgoSFxBw7S2w2cwXeEk2HQi8n2ZPzSs/5Jd6m 4Vb8RCThWWqPiRObcrL5hD7WoAW7M6AUBUhOD0LKU6lm+wjKkepg97EPTyKhTeIXJWEB jGMvm+ntsxI4S8swbXI0nv/oQXatDjyn+auV66sc43YB8o+h3eP3Baz90wF4cYxy5lJ3 kytfa7cu99y2zgFsf0hjx4Ng8zEB/Rs+Lnw/5gWGSU+bJzvMOA3ScvBGMnyiCH+9fM5t wK1NYTU7czGBIDUE/qzbsPjKY3f4wEvjAMgHgju0+ZnEvE1bHxgQ4URTto33cUiglOq4 ajqw== X-Gm-Message-State: AHYfb5hnlxwJdJR/LzG0oRIipu2WhdpXy6XPv+kWbYdZ8FSaVhJx1ZoF NQio2L5Nv0qrRstj0AM= X-Received: by 10.84.217.86 with SMTP id e22mr2856944plj.22.1503374354508; Mon, 21 Aug 2017 20:59:14 -0700 (PDT) Received: from [10.0.1.119] ([12.37.166.67]) by smtp.gmail.com with ESMTPSA id z8sm20457541pgc.93.2017.08.21.20.59.13 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Aug 2017 20:59:13 -0700 (PDT) Subject: Re: svn commit: r322770 - head/usr.sbin/chown/tests Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_0FF3CA10-F1A0-4E96-8F62-C0CD695C5D94"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201708212023.v7LKN654093357@repo.freebsd.org> Date: Mon, 21 Aug 2017 20:59:10 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201708212023.v7LKN654093357@repo.freebsd.org> To: Glen Barber X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 03:59:15 -0000 --Apple-Mail=_0FF3CA10-F1A0-4E96-8F62-C0CD695C5D94 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On Aug 21, 2017, at 13:23, Glen Barber wrote: > > Author: gjb > Date: Mon Aug 21 20:23:05 2017 > New Revision: 322770 > URL: https://svnweb.freebsd.org/changeset/base/322770 > > Log: > Apply changes from bin/chmod/tests/chmod_test.sh (r321949, r321950, > and r322101), adding atf_expect_fail() before chflags(8) is invoked > if the filesystem is ZFS, which does not support UF_IMMUTABLE. > > MFC after: 3 days > Sponsored by: The FreeBSD Foundation Ah, thanks :)! -Ngie --Apple-Mail=_0FF3CA10-F1A0-4E96-8F62-C0CD695C5D94 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZm6wOAAoJEPWDqSZpMIYVKHUQAJdWqf9oq1PyQoR9KbtLaGuL aCNLwGvl99ZFsd5g0IAZ5HLBj/Ag7c8dgFBNj/ChPpDUyTKQVPp+ybH6oiP70/Oh +3w22pVOaiLqCOG1U/9VGei2McIRPNNnY6duDhq6IN/Y68VUxmcGt5ALsFf3rGXz +8CqMQ2m9s8xrxXBnZ4Cr6ImSVVGLuq2HO6BGQkcVPS9whddyscA0afpOYUs8vr5 EfaNYUBPEUtOFdd0lziYdJ8OYwHhzpAMp+iZZkVZyPBNvQ18DmmNTzOyTqpBoVkj WaVErgAVl7JOUYXvYxB5BT++c2/B2rSxTN+6EYFLrUoAmsgApLkTOJEx8xIc97Nb zuuVxzbdddOnvxmXIBSxRJaT962V5hRl2gQifYCg4IOlEVSqJeJm1Sml0TdetMtx nj8gQwIsAasQ3HIx7FwEdJVcl8w2m0EZbsvndougitrCAjS+9M3REGrhdwhRwrHW siNIX1zbqvLGPUKpj7dJ3/KeKjscZvvPGseFZR7KKqHT8rMHi/RR2sd7vDSZWsUV 7nP3LykG4ZpVfWluzGt8buos4V/sST9zx5MILSkrvj4589/GagfCLCoeWL9nSxdA 3wbOO6qtgA2B7uUQNeo6PTHRhdWL5P4ITomxWzkk1r83pzJuvOisQs5xfB96GGvV ndDb4+10doAMRrhVyk80 =C/Ee -----END PGP SIGNATURE----- --Apple-Mail=_0FF3CA10-F1A0-4E96-8F62-C0CD695C5D94-- From owner-svn-src-all@freebsd.org Tue Aug 22 03:59:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B059FDEDC9A; Tue, 22 Aug 2017 03:59:38 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x22e.google.com (mail-pg0-x22e.google.com [IPv6:2607:f8b0:400e:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 767066FE52; Tue, 22 Aug 2017 03:59:38 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x22e.google.com with SMTP id m133so28330856pga.5; Mon, 21 Aug 2017 20:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=kK8mEkF+7Vo6Y7b48fNt+CeDhLtkzAnpTRF1zQqfu54=; b=PWCE4TrG36Q7wMaf/iEGYa3xGPoRRPB6TkF+tvmgfhvA7RNvVxkC219qXCMS7vmP9H f+vQOLr4Zp6V893roAI/kHmO3jDREWJWp96/A4Q9UjFIEky0mqPzWZrRKyjiJ2G7GPNa 8+JSnqp8RnSx9SGVVzGBj9Lpx8qDRu/X/rkRvQ9PUEEqZ4J+bHCiVya1aybC3vGch+r/ mcyV2pIdLYiIIiRQmymAVGa6hgsJHsTQqOeT6aQSg17DdoNlMA2C0EYjLvR+mjbsl8R7 RFisoGoOFcr9UzncoJy+CLW7B2L5nAWtgE8/ZUXzBrNGzszAeWjxKdITuDeEONwFHR3x KDUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=kK8mEkF+7Vo6Y7b48fNt+CeDhLtkzAnpTRF1zQqfu54=; b=oDIFcR3+CtND7iuN+/4nliu/dVhp0oKBJJOBPVpIufu+KkP6jyTgXVVxPATI+sZMKm m8Rhnmt9tp8UisKaTyz0YICSnNV4UpNK9uq0G0P9/9d9K379rBPXG07gfMASDUy/3606 Q/lGNcJRoaoXV3bmU1rLnqXwrd38FJiAq9nWk+ZR1eJgZvYkkvllQOxX2zlANQrpFijs bgQ0NcHi1xlR1c6ECbsUYfuqjo+4SJbZiuX1nlTWQMw7jl4jX3Qo1JglK9d1+1wNayHD ZwJ/YyQC9h0tVMvZTWAud07Mow9o5Iumfuo5tE4XzcLYgMwLpyYaPNodqCY4dXv8hk2k 5Pxg== X-Gm-Message-State: AHYfb5get5x8WD0Nry7FcCNrKmj4f6Otl+h/CniUKJXwrEbUY3spHNFs xhlFfQBca4u5PoK281Q= X-Received: by 10.98.55.134 with SMTP id e128mr19549083pfa.176.1503374377758; Mon, 21 Aug 2017 20:59:37 -0700 (PDT) Received: from [10.0.1.119] ([12.37.166.67]) by smtp.gmail.com with ESMTPSA id z8sm20457541pgc.93.2017.08.21.20.59.36 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Aug 2017 20:59:37 -0700 (PDT) Subject: Re: svn commit: r322759 - stable/10/bin/chmod/tests Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_62A078E9-33ED-4997-88F8-EF1398CB460E"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201708211720.v7LHKVFq015474@repo.freebsd.org> Date: Mon, 21 Aug 2017 20:59:34 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Message-Id: <7CF71981-566F-4990-A230-86C5C020ACBD@gmail.com> References: <201708211720.v7LHKVFq015474@repo.freebsd.org> To: Glen Barber X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 03:59:38 -0000 --Apple-Mail=_62A078E9-33ED-4997-88F8-EF1398CB460E Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On Aug 21, 2017, at 10:20, Glen Barber wrote: > > Author: gjb > Date: Mon Aug 21 17:20:31 2017 > New Revision: 322759 > URL: https://svnweb.freebsd.org/changeset/base/322759 > > Log: > MFC r321949, r321950, r322101: Thanks Glen! -Ngie --Apple-Mail=_62A078E9-33ED-4997-88F8-EF1398CB460E Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZm6wnAAoJEPWDqSZpMIYVZeUP/RCcChqkJJ3pijUP1B8xy8Dw GVjqJwKv9NspEjPETsHNtL/QVvH2qjXAAvbE/CpNKpckYXNViNoWb1Y2KBOqu/F6 Wx4+F82GNy0Fl8Xx7fYBWufjFbsGFG0uJYhdR7gXN37c7ldk9Px2d/l+4OvPgwfL mY3HiPjb9MeyDTr+aVm6gi53dgoG4BH7OPh2OFc89VVfRNuKcExhfjN3kSgT0kk0 moScYVmA/bwKwboX9s8jXEPT2rh7P2elGBquXjYrNEIUHAjw6Kuvig25JF8VbEzK +P3Tt7INMoqSTxr2ViYQcrz4htopL7b4Xv+lWWs8lnca9oVZi31ns9MxxmcoHoYe tOMaknL+vqX/56glSCkGeYn3lBKxe80NIsj+leDb5n1786tv23vCCfWjO3mFsHOo lvamvTjMjkZW5tOhkkLSKdhJz6o36xwrlQLcMPHC9PzR2FHU3AGUC1GxtAcYyJiF 2G4KynXMhtj+916cAZ0AVXFQmJ92/ZBUP2bbw52fCLj51gB6SMvCAtu3jjLJjlUw lgooUYoHK9Fe4RAAUW6NYxrJ7/oEuJERZbw14Ytsp2ALx4atDlufpjuDKYBDy4Pu le7S3C2ydGL6gwMXfpaoC5ivWyNYuXdCCbdHgRjBTZCVrnY+jQ4wuMcLF1mSuzla IiVXEHy+gdYhjavoxIzO =M+04 -----END PGP SIGNATURE----- --Apple-Mail=_62A078E9-33ED-4997-88F8-EF1398CB460E-- From owner-svn-src-all@freebsd.org Tue Aug 22 11:03:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B615DE1D7A; Tue, 22 Aug 2017 11:03:01 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F4C8809A1; Tue, 22 Aug 2017 11:03:01 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MB30Nl051074; Tue, 22 Aug 2017 11:03:00 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MB2xPi051058; Tue, 22 Aug 2017 11:02:59 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201708221102.v7MB2xPi051058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 22 Aug 2017 11:02:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322779 - in vendor/zstd/dist: . doc doc/educational_decoder lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests tests/files tests/fuzz z... X-SVN-Group: vendor X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in vendor/zstd/dist: . doc doc/educational_decoder lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests tests/files tests/fuzz zlibWrapper zlibWrapper/ex... X-SVN-Commit-Revision: 322779 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 11:03:01 -0000 Author: bapt Date: Tue Aug 22 11:02:59 2017 New Revision: 322779 URL: https://svnweb.freebsd.org/changeset/base/322779 Log: Import zstd 1.3.1 Added: vendor/zstd/dist/tests/files/ vendor/zstd/dist/tests/files/huffman-compressed-larger (contents, props changed) vendor/zstd/dist/tests/fuzz/ vendor/zstd/dist/tests/fuzz/Makefile (contents, props changed) vendor/zstd/dist/tests/fuzz/README.md vendor/zstd/dist/tests/fuzz/fuzz.h (contents, props changed) vendor/zstd/dist/tests/fuzz/fuzz_helpers.h (contents, props changed) vendor/zstd/dist/tests/fuzz/regression_driver.c (contents, props changed) vendor/zstd/dist/tests/fuzz/simple_decompress.c (contents, props changed) vendor/zstd/dist/tests/fuzz/simple_round_trip.c (contents, props changed) vendor/zstd/dist/tests/fuzz/stream_decompress.c (contents, props changed) vendor/zstd/dist/tests/fuzz/stream_round_trip.c (contents, props changed) vendor/zstd/dist/tests/poolTests.c (contents, props changed) Deleted: vendor/zstd/dist/PATENTS vendor/zstd/dist/tests/pool.c Modified: vendor/zstd/dist/CONTRIBUTING.md vendor/zstd/dist/Makefile vendor/zstd/dist/NEWS vendor/zstd/dist/README.md vendor/zstd/dist/circle.yml vendor/zstd/dist/doc/educational_decoder/harness.c vendor/zstd/dist/doc/educational_decoder/zstd_decompress.c vendor/zstd/dist/doc/educational_decoder/zstd_decompress.h vendor/zstd/dist/doc/zstd_compression_format.md vendor/zstd/dist/doc/zstd_manual.html vendor/zstd/dist/lib/common/bitstream.h vendor/zstd/dist/lib/common/error_private.c vendor/zstd/dist/lib/common/error_private.h vendor/zstd/dist/lib/common/fse.h vendor/zstd/dist/lib/common/fse_decompress.c vendor/zstd/dist/lib/common/huf.h vendor/zstd/dist/lib/common/mem.h vendor/zstd/dist/lib/common/pool.c vendor/zstd/dist/lib/common/pool.h vendor/zstd/dist/lib/common/threading.h vendor/zstd/dist/lib/common/xxhash.c vendor/zstd/dist/lib/common/zstd_common.c vendor/zstd/dist/lib/common/zstd_errors.h vendor/zstd/dist/lib/common/zstd_internal.h vendor/zstd/dist/lib/compress/fse_compress.c vendor/zstd/dist/lib/compress/huf_compress.c vendor/zstd/dist/lib/compress/zstd_compress.c vendor/zstd/dist/lib/compress/zstd_opt.h vendor/zstd/dist/lib/compress/zstdmt_compress.c vendor/zstd/dist/lib/compress/zstdmt_compress.h vendor/zstd/dist/lib/decompress/huf_decompress.c vendor/zstd/dist/lib/decompress/zstd_decompress.c vendor/zstd/dist/lib/deprecated/zbuff.h vendor/zstd/dist/lib/deprecated/zbuff_common.c vendor/zstd/dist/lib/deprecated/zbuff_compress.c vendor/zstd/dist/lib/deprecated/zbuff_decompress.c vendor/zstd/dist/lib/dictBuilder/cover.c vendor/zstd/dist/lib/dictBuilder/zdict.c vendor/zstd/dist/lib/dictBuilder/zdict.h vendor/zstd/dist/lib/legacy/zstd_legacy.h vendor/zstd/dist/lib/legacy/zstd_v01.c vendor/zstd/dist/lib/legacy/zstd_v01.h vendor/zstd/dist/lib/legacy/zstd_v02.c vendor/zstd/dist/lib/legacy/zstd_v02.h vendor/zstd/dist/lib/legacy/zstd_v03.c vendor/zstd/dist/lib/legacy/zstd_v03.h vendor/zstd/dist/lib/legacy/zstd_v04.c vendor/zstd/dist/lib/legacy/zstd_v04.h vendor/zstd/dist/lib/legacy/zstd_v05.c vendor/zstd/dist/lib/legacy/zstd_v05.h vendor/zstd/dist/lib/legacy/zstd_v06.c vendor/zstd/dist/lib/legacy/zstd_v06.h vendor/zstd/dist/lib/legacy/zstd_v07.c vendor/zstd/dist/lib/legacy/zstd_v07.h vendor/zstd/dist/lib/zstd.h vendor/zstd/dist/programs/.gitignore vendor/zstd/dist/programs/Makefile vendor/zstd/dist/programs/README.md vendor/zstd/dist/programs/bench.c vendor/zstd/dist/programs/bench.h vendor/zstd/dist/programs/datagen.c vendor/zstd/dist/programs/datagen.h vendor/zstd/dist/programs/dibio.c vendor/zstd/dist/programs/dibio.h vendor/zstd/dist/programs/fileio.c vendor/zstd/dist/programs/fileio.h vendor/zstd/dist/programs/platform.h vendor/zstd/dist/programs/util.h vendor/zstd/dist/programs/zstd.1 vendor/zstd/dist/programs/zstd.1.md vendor/zstd/dist/programs/zstdcli.c vendor/zstd/dist/tests/Makefile vendor/zstd/dist/tests/datagencli.c vendor/zstd/dist/tests/decodecorpus.c vendor/zstd/dist/tests/fullbench.c vendor/zstd/dist/tests/fuzzer.c vendor/zstd/dist/tests/invalidDictionaries.c vendor/zstd/dist/tests/legacy.c vendor/zstd/dist/tests/longmatch.c vendor/zstd/dist/tests/namespaceTest.c vendor/zstd/dist/tests/paramgrill.c vendor/zstd/dist/tests/playTests.sh vendor/zstd/dist/tests/roundTripCrash.c vendor/zstd/dist/tests/symbols.c vendor/zstd/dist/tests/zbufftest.c vendor/zstd/dist/tests/zstreamtest.c vendor/zstd/dist/zlibWrapper/examples/zwrapbench.c vendor/zstd/dist/zlibWrapper/gzcompatibility.h vendor/zstd/dist/zlibWrapper/gzlib.c vendor/zstd/dist/zlibWrapper/gzread.c vendor/zstd/dist/zlibWrapper/gzwrite.c vendor/zstd/dist/zlibWrapper/zstd_zlibwrapper.c vendor/zstd/dist/zlibWrapper/zstd_zlibwrapper.h Modified: vendor/zstd/dist/CONTRIBUTING.md ============================================================================== --- vendor/zstd/dist/CONTRIBUTING.md Tue Aug 22 05:02:42 2017 (r322778) +++ vendor/zstd/dist/CONTRIBUTING.md Tue Aug 22 11:02:59 2017 (r322779) @@ -39,4 +39,4 @@ outlined on that page and do not file a public issue. ## License By contributing to Zstandard, you agree that your contributions will be licensed -under the [LICENSE](LICENSE) file in the root directory of this source tree. +under both the [LICENSE](LICENSE) file and the [COPYING](COPYING) file in the root directory of this source tree. Modified: vendor/zstd/dist/Makefile ============================================================================== --- vendor/zstd/dist/Makefile Tue Aug 22 05:02:42 2017 (r322778) +++ vendor/zstd/dist/Makefile Tue Aug 22 11:02:59 2017 (r322779) @@ -74,14 +74,11 @@ zstdmt: zlibwrapper: $(MAKE) -C $(ZWRAPDIR) test -.PHONY: shortest -shortest: +.PHONY: test shortest +test shortest: + $(MAKE) -C $(PRGDIR) allVariants $(MAKE) -C $(TESTDIR) $@ -.PHONY: test -test: - $(MAKE) -C $(TESTDIR) $@ - .PHONY: examples examples: CPPFLAGS=-I../lib LDFLAGS=-L../lib $(MAKE) -C examples/ all @@ -146,6 +143,11 @@ gcc6build: clean gcc-6 -v CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror" +.PHONY: gcc7build +gcc7build: clean + gcc-7 -v + CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror" + .PHONY: clangbuild clangbuild: clean clang -v @@ -180,7 +182,7 @@ ppc64fuzz: clean CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest gpptest: clean - CC=g++ $(MAKE) -C $(PRGDIR) all CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" + CC=$(CXX) $(MAKE) -C $(PRGDIR) all CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" gcc5test: clean gcc-5 -v Modified: vendor/zstd/dist/NEWS ============================================================================== --- vendor/zstd/dist/NEWS Tue Aug 22 05:02:42 2017 (r322778) +++ vendor/zstd/dist/NEWS Tue Aug 22 11:02:59 2017 (r322779) @@ -1,3 +1,18 @@ +v1.3.1 +New license : BSD + GPLv2 +perf: substantially decreased memory usage in Multi-threading mode, thanks to reports by Tino Reichardt (@mcmilk) +perf: Multi-threading supports up to 256 threads. Cap at 256 when more are requested (#760) +cli : improved and fixed --list command, by @ib (#772) +cli : command -vV to list supported formats, by @ib (#771) +build : fixed binary variants, reported by @svenha (#788) +build : fix Visual compilation for non x86/x64 targets, reported by Greg Slazinski (@GregSlazinski) (#718) +API exp : breaking change : ZSTD_getframeHeader() provides more information +API exp : breaking change : pinned down values of error codes +doc : fixed huffman example, by Ulrich Kunitz (@ulikunitz) +new : contrib/adaptive-compression, I/O driven compression strength, by Paul Cruz (@paulcruz74) +new : contrib/long_distance_matching, statistics by Stella Lau (@stellamplau) +updated : contrib/linux-kernel, by Nick Terrell (@terrelln) + v1.3.0 cli : new : `--list` command, by Paul Cruz cli : changed : xz/lzma support enabled by default Modified: vendor/zstd/dist/README.md ============================================================================== --- vendor/zstd/dist/README.md Tue Aug 22 05:02:42 2017 (r322778) +++ vendor/zstd/dist/README.md Tue Aug 22 11:02:59 2017 (r322779) @@ -134,12 +134,12 @@ Going into `build` directory, you will find additional ### Status -Zstandard is currently deployed within Facebook. It is used daily to compress and decompress very large amounts of data in multiple formats and use cases. +Zstandard is currently deployed within Facebook. It is used continuously to compress large amounts of data in multiple formats and use cases. Zstandard is considered safe for production environments. ### License -Zstandard is [BSD-licensed](LICENSE). We also provide an [additional patent grant](PATENTS). +Zstandard is dual-licensed under [BSD](LICENSE) and [GPLv2](COPYING). ### Contributing Modified: vendor/zstd/dist/circle.yml ============================================================================== --- vendor/zstd/dist/circle.yml Tue Aug 22 05:02:42 2017 (r322778) +++ vendor/zstd/dist/circle.yml Tue Aug 22 11:02:59 2017 (r322779) @@ -3,7 +3,7 @@ dependencies: - sudo dpkg --add-architecture i386 - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; sudo apt-get -y -qq update - sudo apt-get -y install gcc-powerpc-linux-gnu gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross - - sudo apt-get -y install libstdc++-6-dev clang gcc g++ gcc-5 gcc-6 zlib1g-dev liblzma-dev + - sudo apt-get -y install libstdc++-7-dev clang gcc g++ gcc-5 gcc-6 gcc-7 zlib1g-dev liblzma-dev - sudo apt-get -y install linux-libc-dev:i386 libc6-dev-i386 test: @@ -45,7 +45,7 @@ test: parallel: true - ? | if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make ppc64build && make clean; fi && - if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then true && make clean; fi #could add another test here + if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make gcc7build && make clean; fi #could add another test here : parallel: true - ? | @@ -64,7 +64,7 @@ test: #- gcc -v; make -C tests test32 MOREFLAGS="-I/usr/include/x86_64-linux-gnu" && make clean #- make uasan && make clean #- make asan32 && make clean - #- make -C tests test32 CC=clang MOREFLAGS="-g -fsanitize=address -I/usr/include/x86_64-linux-gnu" + #- make -C tests test32 CC=clang MOREFLAGS="-g -fsanitize=address -I/usr/include/x86_64-linux-gnu" # Valgrind tests #- CFLAGS="-O1 -g" make -C zlibWrapper valgrindTest && make clean #- make -C tests valgrindTest && make clean Modified: vendor/zstd/dist/doc/educational_decoder/harness.c ============================================================================== --- vendor/zstd/dist/doc/educational_decoder/harness.c Tue Aug 22 05:02:42 2017 (r322778) +++ vendor/zstd/dist/doc/educational_decoder/harness.c Tue Aug 22 11:02:59 2017 (r322779) @@ -87,7 +87,7 @@ int main(int argc, char **argv) { } size_t decompressed_size = ZSTD_get_decompressed_size(input, input_size); - if (decompressed_size == -1) { + if (decompressed_size == (size_t)-1) { decompressed_size = MAX_COMPRESSION_RATIO * input_size; fprintf(stderr, "WARNING: Compressed data does not contain " "decompressed size, going to assume the compression " @@ -106,10 +106,16 @@ int main(int argc, char **argv) { return 1; } + dictionary_t* const parsed_dict = create_dictionary(); + if (dict) { + parse_dictionary(parsed_dict, dict, dict_size); + } size_t decompressed = ZSTD_decompress_with_dict(output, decompressed_size, - input, input_size, dict, dict_size); + input, input_size, parsed_dict); + free_dictionary(parsed_dict); + write_file(argv[2], output, decompressed); free(input); @@ -117,4 +123,3 @@ int main(int argc, char **argv) { free(dict); input = output = dict = NULL; } - Modified: vendor/zstd/dist/doc/educational_decoder/zstd_decompress.c ============================================================================== --- vendor/zstd/dist/doc/educational_decoder/zstd_decompress.c Tue Aug 22 05:02:42 2017 (r322778) +++ vendor/zstd/dist/doc/educational_decoder/zstd_decompress.c Tue Aug 22 11:02:59 2017 (r322779) @@ -14,22 +14,8 @@ #include #include #include +#include "zstd_decompress.h" -/// Zstandard decompression functions. -/// `dst` must point to a space at least as large as the reconstructed output. -size_t ZSTD_decompress(void *const dst, const size_t dst_len, - const void *const src, const size_t src_len); -/// If `dict != NULL` and `dict_len >= 8`, does the same thing as -/// `ZSTD_decompress` but uses the provided dict -size_t ZSTD_decompress_with_dict(void *const dst, const size_t dst_len, - const void *const src, const size_t src_len, - const void *const dict, const size_t dict_len); - -/// Get the decompressed size of an input stream so memory can be allocated in -/// advance -/// Returns -1 if the size can't be determined -size_t ZSTD_get_decompressed_size(const void *const src, const size_t src_len); - /******* UTILITY MACROS AND TYPES *********************************************/ // Max block size decompressed size is 128 KB and literal blocks can't be // larger than their block @@ -108,10 +94,10 @@ static inline size_t IO_istream_len(const istream_t *c /// Advances the stream by `len` bytes, and returns a pointer to the chunk that /// was skipped. The stream must be byte aligned. -static inline const u8 *IO_read_bytes(istream_t *const in, size_t len); +static inline const u8 *IO_get_read_ptr(istream_t *const in, size_t len); /// Advances the stream by `len` bytes, and returns a pointer to the chunk that /// was skipped so it can be written to. -static inline u8 *IO_write_bytes(ostream_t *const out, size_t len); +static inline u8 *IO_get_write_ptr(ostream_t *const out, size_t len); /// Advance the inner state by `len` bytes. The stream must be byte aligned. static inline void IO_advance_input(istream_t *const in, size_t len); @@ -307,7 +293,7 @@ typedef struct { /// The decoded contents of a dictionary so that it doesn't have to be repeated /// for each frame that uses it -typedef struct { +struct dictionary_s { // Entropy tables HUF_dtable literals_dtable; FSE_dtable ll_dtable; @@ -322,7 +308,7 @@ typedef struct { u64 previous_offsets[3]; u32 dictionary_id; -} dictionary_t; +}; /// A tuple containing the parts necessary to decode and execute a ZSTD sequence /// command @@ -367,27 +353,36 @@ static void execute_sequences(frame_context_t *const c const sequence_command_t *const sequences, const size_t num_sequences); -// Parse a provided dictionary blob for use in decompression -static void parse_dictionary(dictionary_t *const dict, const u8 *src, - size_t src_len); -static void free_dictionary(dictionary_t *const dict); +// Copies literals and returns the total literal length that was copied +static u32 copy_literals(const size_t seq, istream_t *litstream, + ostream_t *const out); + +// Given an offset code from a sequence command (either an actual offset value +// or an index for previous offset), computes the correct offset and udpates +// the offset history +static size_t compute_offset(sequence_command_t seq, u64 *const offset_hist); + +// Given an offset, match length, and total output, as well as the frame +// context for the dictionary, determines if the dictionary is used and +// executes the copy operation +static void execute_match_copy(frame_context_t *const ctx, size_t offset, + size_t match_length, size_t total_output, + ostream_t *const out); + /******* END ZSTD HELPER STRUCTS AND PROTOTYPES *******************************/ size_t ZSTD_decompress(void *const dst, const size_t dst_len, const void *const src, const size_t src_len) { - return ZSTD_decompress_with_dict(dst, dst_len, src, src_len, NULL, 0); + dictionary_t* uninit_dict = create_dictionary(); + size_t const decomp_size = ZSTD_decompress_with_dict(dst, dst_len, src, + src_len, uninit_dict); + free_dictionary(uninit_dict); + return decomp_size; } size_t ZSTD_decompress_with_dict(void *const dst, const size_t dst_len, const void *const src, const size_t src_len, - const void *const dict, - const size_t dict_len) { - dictionary_t parsed_dict; - memset(&parsed_dict, 0, sizeof(dictionary_t)); - // dict_len < 8 is not a valid dictionary - if (dict && dict_len > 8) { - parse_dictionary(&parsed_dict, (const u8 *)dict, dict_len); - } + dictionary_t* parsed_dict) { istream_t in = IO_make_istream(src, src_len); ostream_t out = IO_make_ostream(dst, dst_len); @@ -396,11 +391,9 @@ size_t ZSTD_decompress_with_dict(void *const dst, cons // Multiple frames can be appended into a single file or stream. A frame is // totally independent, has a defined beginning and end, and a set of // parameters which tells the decoder how to decompress it." - while (IO_istream_len(&in) > 0) { - decode_frame(&out, &in, &parsed_dict); - } - free_dictionary(&parsed_dict); + /* this decoder assumes decompression of a single frame */ + decode_frame(&out, &in, parsed_dict); return out.ptr - (u8 *)dst; } @@ -424,30 +417,6 @@ static void decompress_data(frame_context_t *const ctx static void decode_frame(ostream_t *const out, istream_t *const in, const dictionary_t *const dict) { const u32 magic_number = IO_read_bits(in, 32); - - // Skippable frame - // - // "Magic_Number - // - // 4 Bytes, little-endian format. Value : 0x184D2A5?, which means any value - // from 0x184D2A50 to 0x184D2A5F. All 16 values are valid to identify a - // skippable frame." - if ((magic_number & ~0xFU) == 0x184D2A50U) { - // "Skippable frames allow the insertion of user-defined data into a - // flow of concatenated frames. Its design is pretty straightforward, - // with the sole objective to allow the decoder to quickly skip over - // user-defined data and continue decoding. - // - // Skippable frames defined in this specification are compatible with - // LZ4 ones." - const size_t frame_size = IO_read_bits(in, 32); - - // skip over frame - IO_advance_input(in, frame_size); - - return; - } - // Zstandard frame // // "Magic_Number @@ -460,8 +429,8 @@ static void decode_frame(ostream_t *const out, istream return; } - // not a real frame - ERROR("Invalid magic number"); + // not a real frame or a skippable frame + ERROR("Tried to decode non-ZSTD frame"); } /// Decode a frame that contains compressed data. Not all frames do as there @@ -672,8 +641,8 @@ static void decompress_data(frame_context_t *const ctx case 0: { // "Raw_Block - this is an uncompressed block. Block_Size is the // number of bytes to read and copy." - const u8 *const read_ptr = IO_read_bytes(in, block_len); - u8 *const write_ptr = IO_write_bytes(out, block_len); + const u8 *const read_ptr = IO_get_read_ptr(in, block_len); + u8 *const write_ptr = IO_get_write_ptr(out, block_len); // Copy the raw data into the output memcpy(write_ptr, read_ptr, block_len); @@ -685,8 +654,8 @@ static void decompress_data(frame_context_t *const ctx // "RLE_Block - this is a single byte, repeated N times. In which // case, Block_Size is the size to regenerate, while the // "compressed" block is just 1 byte (the byte to repeat)." - const u8 *const read_ptr = IO_read_bytes(in, 1); - u8 *const write_ptr = IO_write_bytes(out, block_len); + const u8 *const read_ptr = IO_get_read_ptr(in, 1); + u8 *const write_ptr = IO_get_write_ptr(out, block_len); // Copy `block_len` copies of `read_ptr[0]` to the output memset(write_ptr, read_ptr[0], block_len); @@ -832,13 +801,13 @@ static size_t decode_literals_simple(istream_t *const switch (block_type) { case 0: { // "Raw_Literals_Block - Literals are stored uncompressed." - const u8 *const read_ptr = IO_read_bytes(in, size); + const u8 *const read_ptr = IO_get_read_ptr(in, size); memcpy(*literals, read_ptr, size); break; } case 1: { // "RLE_Literals_Block - Literals consist of a single byte value repeated N times." - const u8 *const read_ptr = IO_read_bytes(in, 1); + const u8 *const read_ptr = IO_get_read_ptr(in, 1); memset(*literals, read_ptr[0], size); break; } @@ -949,7 +918,7 @@ static void decode_huf_table(HUF_dtable *const dtable, num_symbs = header - 127; const size_t bytes = (num_symbs + 1) / 2; - const u8 *const weight_src = IO_read_bytes(in, bytes); + const u8 *const weight_src = IO_get_read_ptr(in, bytes); for (int i = 0; i < num_symbs; i++) { // "They are encoded forward, 2 @@ -1157,7 +1126,7 @@ static void decompress_sequences(frame_context_t *cons } const size_t len = IO_istream_len(in); - const u8 *const src = IO_read_bytes(in, len); + const u8 *const src = IO_get_read_ptr(in, len); // "After writing the last bit containing information, the compressor writes // a single 1-bit and then fills the byte with 0-7 0 bits of padding." @@ -1262,7 +1231,7 @@ static void decode_seq_table(FSE_dtable *const table, } case seq_rle: { // "RLE_Mode : it's a single code, repeated Number_of_Sequences times." - const u8 symb = IO_read_bytes(in, 1)[0]; + const u8 symb = IO_get_read_ptr(in, 1)[0]; FSE_init_dtable_rle(table, symb); break; } @@ -1303,145 +1272,146 @@ static void execute_sequences(frame_context_t *const c for (size_t i = 0; i < num_sequences; i++) { const sequence_command_t seq = sequences[i]; - { - // If the sequence asks for more literals than are left, the - // sequence must be corrupted - if (seq.literal_length > IO_istream_len(&litstream)) { - CORRUPTION(); - } + const u32 literals_size = copy_literals(seq.literal_length, &litstream, out); + total_output += literals_size; + } - u8 *const write_ptr = IO_write_bytes(out, seq.literal_length); - const u8 *const read_ptr = - IO_read_bytes(&litstream, seq.literal_length); - // Copy literals to output - memcpy(write_ptr, read_ptr, seq.literal_length); + size_t const offset = compute_offset(seq, offset_hist); - total_output += seq.literal_length; - } + size_t const match_length = seq.match_length; - size_t offset; + execute_match_copy(ctx, offset, match_length, total_output, out); - // Offsets are special, we need to handle the repeat offsets - if (seq.offset <= 3) { - // "The first 3 values define a repeated offset and we will call - // them Repeated_Offset1, Repeated_Offset2, and Repeated_Offset3. - // They are sorted in recency order, with Repeated_Offset1 meaning - // 'most recent one'". + total_output += match_length; + } - // Use 0 indexing for the array - u32 idx = seq.offset - 1; - if (seq.literal_length == 0) { - // "There is an exception though, when current sequence's - // literals length is 0. In this case, repeated offsets are - // shifted by one, so Repeated_Offset1 becomes Repeated_Offset2, - // Repeated_Offset2 becomes Repeated_Offset3, and - // Repeated_Offset3 becomes Repeated_Offset1 - 1_byte." - idx++; - } + // Copy any leftover literals + { + size_t len = IO_istream_len(&litstream); + copy_literals(len, &litstream, out); + total_output += len; + } - if (idx == 0) { - offset = offset_hist[0]; - } else { - // If idx == 3 then literal length was 0 and the offset was 3, - // as per the exception listed above - offset = idx < 3 ? offset_hist[idx] : offset_hist[0] - 1; + ctx->current_total_output = total_output; +} - // If idx == 1 we don't need to modify offset_hist[2], since - // we're using the second-most recent code - if (idx > 1) { - offset_hist[2] = offset_hist[1]; - } - offset_hist[1] = offset_hist[0]; - offset_hist[0] = offset; - } +static u32 copy_literals(const size_t literal_length, istream_t *litstream, + ostream_t *const out) { + // If the sequence asks for more literals than are left, the + // sequence must be corrupted + if (literal_length > IO_istream_len(litstream)) { + CORRUPTION(); + } + + u8 *const write_ptr = IO_get_write_ptr(out, literal_length); + const u8 *const read_ptr = + IO_get_read_ptr(litstream, literal_length); + // Copy literals to output + memcpy(write_ptr, read_ptr, literal_length); + + return literal_length; +} + +static size_t compute_offset(sequence_command_t seq, u64 *const offset_hist) { + size_t offset; + // Offsets are special, we need to handle the repeat offsets + if (seq.offset <= 3) { + // "The first 3 values define a repeated offset and we will call + // them Repeated_Offset1, Repeated_Offset2, and Repeated_Offset3. + // They are sorted in recency order, with Repeated_Offset1 meaning + // 'most recent one'". + + // Use 0 indexing for the array + u32 idx = seq.offset - 1; + if (seq.literal_length == 0) { + // "There is an exception though, when current sequence's + // literals length is 0. In this case, repeated offsets are + // shifted by one, so Repeated_Offset1 becomes Repeated_Offset2, + // Repeated_Offset2 becomes Repeated_Offset3, and + // Repeated_Offset3 becomes Repeated_Offset1 - 1_byte." + idx++; + } + + if (idx == 0) { + offset = offset_hist[0]; } else { - // When it's not a repeat offset: - // "if (Offset_Value > 3) offset = Offset_Value - 3;" - offset = seq.offset - 3; + // If idx == 3 then literal length was 0 and the offset was 3, + // as per the exception listed above + offset = idx < 3 ? offset_hist[idx] : offset_hist[0] - 1; - // Shift back history - offset_hist[2] = offset_hist[1]; + // If idx == 1 we don't need to modify offset_hist[2], since + // we're using the second-most recent code + if (idx > 1) { + offset_hist[2] = offset_hist[1]; + } offset_hist[1] = offset_hist[0]; offset_hist[0] = offset; } + } else { + // When it's not a repeat offset: + // "if (Offset_Value > 3) offset = Offset_Value - 3;" + offset = seq.offset - 3; - size_t match_length = seq.match_length; + // Shift back history + offset_hist[2] = offset_hist[1]; + offset_hist[1] = offset_hist[0]; + offset_hist[0] = offset; + } + return offset; +} - u8 *write_ptr = IO_write_bytes(out, match_length); - if (total_output <= ctx->header.window_size) { - // In this case offset might go back into the dictionary - if (offset > total_output + ctx->dict_content_len) { - // The offset goes beyond even the dictionary - CORRUPTION(); - } - - if (offset > total_output) { - // "The rest of the dictionary is its content. The content act - // as a "past" in front of data to compress or decompress, so it - // can be referenced in sequence commands." - const size_t dict_copy = - MIN(offset - total_output, match_length); - const size_t dict_offset = - ctx->dict_content_len - (offset - total_output); - - memcpy(write_ptr, ctx->dict_content + dict_offset, dict_copy); - write_ptr += dict_copy; - match_length -= dict_copy; - } - } else if (offset > ctx->header.window_size) { +static void execute_match_copy(frame_context_t *const ctx, size_t offset, + size_t match_length, size_t total_output, + ostream_t *const out) { + u8 *write_ptr = IO_get_write_ptr(out, match_length); + if (total_output <= ctx->header.window_size) { + // In this case offset might go back into the dictionary + if (offset > total_output + ctx->dict_content_len) { + // The offset goes beyond even the dictionary CORRUPTION(); } - // We must copy byte by byte because the match length might be larger - // than the offset - // ex: if the output so far was "abc", a command with offset=3 and - // match_length=6 would produce "abcabcabc" as the new output - for (size_t i = 0; i < match_length; i++) { - *write_ptr = *(write_ptr - offset); - write_ptr++; - } + if (offset > total_output) { + // "The rest of the dictionary is its content. The content act + // as a "past" in front of data to compress or decompress, so it + // can be referenced in sequence commands." + const size_t dict_copy = + MIN(offset - total_output, match_length); + const size_t dict_offset = + ctx->dict_content_len - (offset - total_output); - total_output += seq.match_length; + memcpy(write_ptr, ctx->dict_content + dict_offset, dict_copy); + write_ptr += dict_copy; + match_length -= dict_copy; + } + } else if (offset > ctx->header.window_size) { + CORRUPTION(); } - // Copy any leftover literals - { - size_t len = IO_istream_len(&litstream); - u8 *const write_ptr = IO_write_bytes(out, len); - const u8 *const read_ptr = IO_read_bytes(&litstream, len); - memcpy(write_ptr, read_ptr, len); - - total_output += len; + // We must copy byte by byte because the match length might be larger + // than the offset + // ex: if the output so far was "abc", a command with offset=3 and + // match_length=6 would produce "abcabcabc" as the new output + for (size_t j = 0; j < match_length; j++) { + *write_ptr = *(write_ptr - offset); + write_ptr++; } - - ctx->current_total_output = total_output; } /******* END SEQUENCE EXECUTION ***********************************************/ /******* OUTPUT SIZE COUNTING *************************************************/ -static void traverse_frame(const frame_header_t *const header, istream_t *const in); - /// Get the decompressed size of an input stream so memory can be allocated in /// advance. -/// This is more complex than the implementation in the reference -/// implementation, as this API allows for the decompression of multiple -/// concatenated frames. +/// This implementation assumes `src` points to a single ZSTD-compressed frame size_t ZSTD_get_decompressed_size(const void *src, const size_t src_len) { istream_t in = IO_make_istream(src, src_len); - size_t dst_size = 0; - // Each frame header only gives us the size of its frame, so iterate over - // all - // frames - while (IO_istream_len(&in) > 0) { + // get decompressed size from ZSTD frame header + { const u32 magic_number = IO_read_bits(&in, 32); - if ((magic_number & ~0xFU) == 0x184D2A50U) { - // skippable frame, this has no impact on output size - const size_t frame_size = IO_read_bits(&in, 32); - IO_advance_input(&in, frame_size); - } else if (magic_number == 0xFD2FB528U) { + if (magic_number == 0xFD2FB528U) { // ZSTD frame frame_header_t header; parse_frame_header(&header, &in); @@ -1451,68 +1421,42 @@ size_t ZSTD_get_decompressed_size(const void *src, con return -1; } - dst_size += header.frame_content_size; - - // Consume the input from the frame to reach the start of the next - traverse_frame(&header, &in); + return header.frame_content_size; } else { - // not a real frame - ERROR("Invalid magic number"); + // not a real frame or skippable frame + ERROR("ZSTD frame magic number did not match"); } } - - return dst_size; } +/******* END OUTPUT SIZE COUNTING *********************************************/ -/// Iterate over each block in a frame to find the end of it, to get to the -/// start of the next frame -static void traverse_frame(const frame_header_t *const header, istream_t *const in) { - int last_block = 0; +/******* DICTIONARY PARSING ***************************************************/ +#define DICT_SIZE_ERROR() ERROR("Dictionary size cannot be less than 8 bytes") +#define NULL_SRC() ERROR("Tried to create dictionary with pointer to null src"); - do { - // Parse the block header - last_block = IO_read_bits(in, 1); - const int block_type = IO_read_bits(in, 2); - const size_t block_len = IO_read_bits(in, 21); - - switch (block_type) { - case 0: // Raw block, block_len bytes - IO_advance_input(in, block_len); - break; - case 1: // RLE block, 1 byte - IO_advance_input(in, 1); - break; - case 2: // Compressed block, compressed size is block_len - IO_advance_input(in, block_len); - break; - case 3: - // Reserved block type - CORRUPTION(); - break; - default: - IMPOSSIBLE(); - } - } while (!last_block); - - if (header->content_checksum_flag) { - IO_advance_input(in, 4); +dictionary_t* create_dictionary() { + dictionary_t* dict = calloc(1, sizeof(dictionary_t)); + if (!dict) { + BAD_ALLOC(); } + return dict; } -/******* END OUTPUT SIZE COUNTING *********************************************/ - -/******* DICTIONARY PARSING ***************************************************/ static void init_dictionary_content(dictionary_t *const dict, istream_t *const in); -static void parse_dictionary(dictionary_t *const dict, const u8 *src, +void parse_dictionary(dictionary_t *const dict, const void *src, size_t src_len) { + const u8 *byte_src = (const u8 *)src; memset(dict, 0, sizeof(dictionary_t)); + if (src == NULL) { /* cannot initialize dictionary with null src */ + NULL_SRC(); + } if (src_len < 8) { - INP_SIZE(); + DICT_SIZE_ERROR(); } - istream_t in = IO_make_istream(src, src_len); + istream_t in = IO_make_istream(byte_src, src_len); const u32 magic_number = IO_read_bits(&in, 32); if (magic_number != 0xEC30A437) { @@ -1564,13 +1508,13 @@ static void init_dictionary_content(dictionary_t *cons BAD_ALLOC(); } - const u8 *const content = IO_read_bytes(in, dict->content_size); + const u8 *const content = IO_get_read_ptr(in, dict->content_size); memcpy(dict->content, content, dict->content_size); } /// Free an allocated dictionary -static void free_dictionary(dictionary_t *const dict) { +void free_dictionary(dictionary_t *const dict) { HUF_free_dtable(&dict->literals_dtable); FSE_free_dtable(&dict->ll_dtable); FSE_free_dtable(&dict->of_dtable); @@ -1579,6 +1523,8 @@ static void free_dictionary(dictionary_t *const dict) free(dict->content); memset(dict, 0, sizeof(dictionary_t)); + + free(dict); } /******* END DICTIONARY PARSING ***********************************************/ @@ -1657,7 +1603,7 @@ static inline size_t IO_istream_len(const istream_t *c /// Returns a pointer where `len` bytes can be read, and advances the internal /// state. The stream must be byte aligned. -static inline const u8 *IO_read_bytes(istream_t *const in, size_t len) { +static inline const u8 *IO_get_read_ptr(istream_t *const in, size_t len) { if (len > in->len) { INP_SIZE(); } @@ -1671,7 +1617,7 @@ static inline const u8 *IO_read_bytes(istream_t *const return ptr; } /// Returns a pointer to write `len` bytes to, and advances the internal state -static inline u8 *IO_write_bytes(ostream_t *const out, size_t len) { +static inline u8 *IO_get_write_ptr(ostream_t *const out, size_t len) { if (len > out->len) { OUT_SIZE(); } @@ -1710,7 +1656,7 @@ static inline istream_t IO_make_istream(const u8 *in, /// `in` must be byte aligned static inline istream_t IO_make_sub_istream(istream_t *const in, size_t len) { // Consume `len` bytes of the parent stream - const u8 *const ptr = IO_read_bytes(in, len); + const u8 *const ptr = IO_get_read_ptr(in, len); // Make a substream using the pointer to those `len` bytes return IO_make_istream(ptr, len); @@ -1814,7 +1760,7 @@ static size_t HUF_decompress_1stream(const HUF_dtable if (len == 0) { INP_SIZE(); } - const u8 *const src = IO_read_bytes(in, len); + const u8 *const src = IO_get_read_ptr(in, len); // "Each bitstream must be read backward, that is starting from the end down // to the beginning. Therefore it's necessary to know the size of each @@ -2065,7 +2011,7 @@ static size_t FSE_decompress_interleaved2(const FSE_dt if (len == 0) { INP_SIZE(); } - const u8 *const src = IO_read_bytes(in, len); + const u8 *const src = IO_get_read_ptr(in, len); // "Each bitstream must be read backward, that is starting from the end down // to the beginning. Therefore it's necessary to know the size of each @@ -2192,7 +2138,7 @@ static void FSE_init_dtable(FSE_dtable *const dtable, } // Now we can fill baseline and num bits - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { u8 symbol = dtable->symbols[i]; u16 next_state_desc = state_desc[symbol]++; // Fills in the table appropriately, next_state_desc increases by symbol @@ -2355,4 +2301,3 @@ static void FSE_copy_dtable(FSE_dtable *const dst, con memcpy(dst->new_state_base, src->new_state_base, size * sizeof(u16)); } /******* END FSE PRIMITIVES ***************************************************/ - Modified: vendor/zstd/dist/doc/educational_decoder/zstd_decompress.h ============================================================================== --- vendor/zstd/dist/doc/educational_decoder/zstd_decompress.h Tue Aug 22 05:02:42 2017 (r322778) +++ vendor/zstd/dist/doc/educational_decoder/zstd_decompress.h Tue Aug 22 11:02:59 2017 (r322779) @@ -7,10 +7,52 @@ * of patent rights can be found in the PATENTS file in the same directory. */ +/******* EXPOSED TYPES ********************************************************/ +/* +* Contains the parsed contents of a dictionary +* This includes Huffman and FSE tables used for decoding and data on offsets +*/ +typedef struct dictionary_s dictionary_t; +/******* END EXPOSED TYPES ****************************************************/ + +/******* DECOMPRESSION FUNCTIONS **********************************************/ +/// Zstandard decompression functions. +/// `dst` must point to a space at least as large as the reconstructed output. size_t ZSTD_decompress(void *const dst, const size_t dst_len, - const void *const src, const size_t src_len); + const void *const src, const size_t src_len); + +/// If `dict != NULL` and `dict_len >= 8`, does the same thing as +/// `ZSTD_decompress` but uses the provided dict size_t ZSTD_decompress_with_dict(void *const dst, const size_t dst_len, - const void *const src, const size_t src_len, - const void *const dict, const size_t dict_len); + const void *const src, const size_t src_len, + dictionary_t* parsed_dict); + +/// Get the decompressed size of an input stream so memory can be allocated in +/// advance +/// Returns -1 if the size can't be determined +/// Assumes decompression of a single frame size_t ZSTD_get_decompressed_size(const void *const src, const size_t src_len); +/******* END DECOMPRESSION FUNCTIONS ******************************************/ +/******* DICTIONARY MANAGEMENT ***********************************************/ +/* + * Return a valid dictionary_t pointer for use with dictionary initialization + * or decompression + */ +dictionary_t* create_dictionary(); + +/* + * Parse a provided dictionary blob for use in decompression + * `src` -- must point to memory space representing the dictionary + * `src_len` -- must provide the dictionary size + * `dict` -- will contain the parsed contents of the dictionary and + * can be used for decompression + */ +void parse_dictionary(dictionary_t *const dict, const void *src, + size_t src_len); + +/* + * Free internal Huffman tables, FSE tables, and dictionary content + */ +void free_dictionary(dictionary_t *const dict); +/******* END DICTIONARY MANAGEMENT *******************************************/ Modified: vendor/zstd/dist/doc/zstd_compression_format.md ============================================================================== --- vendor/zstd/dist/doc/zstd_compression_format.md Tue Aug 22 05:02:42 2017 (r322778) +++ vendor/zstd/dist/doc/zstd_compression_format.md Tue Aug 22 11:02:59 2017 (r322779) @@ -16,7 +16,7 @@ Distribution of this document is unlimited. ### Version -0.2.5 (31/03/17) +0.2.6 (19/08/17) Introduction @@ -106,7 +106,7 @@ The structure of a single Zstandard frame is following | `Magic_Number` | `Frame_Header` |`Data_Block`| [More data blocks] | [`Content_Checksum`] | |:--------------:|:--------------:|:----------:| ------------------ |:--------------------:| -| 4 bytes | 2-14 bytes | n bytes | | 0-4 bytes | +| 4 bytes | 2-14 bytes | n bytes | | 0-4 bytes | __`Magic_Number`__ @@ -1249,23 +1249,30 @@ Consequently, a last byte of `0` is not possible. And the final-bit-flag itself is not part of the useful bitstream. Hence, the last byte contains between 0 and 7 useful bits. -For example, if the literal sequence "0145" was encoded using the prefix codes above, -it would be encoded as: -``` -00000001 01110000 -``` +Starting from the end, +it's possible to read the bitstream in a __little-endian__ fashion, +keeping track of already used bits. Since the bitstream is encoded in reverse +order, starting from the end read symbols in forward order. +For example, if the literal sequence "0145" was encoded using above prefix code, +it would be encoded (in reverse order) as: + |Symbol | 5 | 4 | 1 | 0 | Padding | |--------|------|------|----|---|---------| -|Encoding|`0000`|`0001`|`01`|`1`| `10000` | +|Encoding|`0000`|`0001`|`01`|`1`| `00001` | -Starting from the end, -it's possible to read the bitstream in a __little-endian__ fashion, -keeping track of already used bits. Since the bitstream is encoded in reverse -order, by starting at the end the symbols can be read in forward order. +Resulting in following 2-bytes bitstream : +``` +00010000 00001101 +``` -Reading the last `Max_Number_of_Bits` bits, -it's then possible to compare extracted value to decoding table, +Here is an alternative representation with the symbol codes separated by underscore: +``` +0001_0000 00001_1_01 +``` + +Reading highest `Max_Number_of_Bits` bits, +it's possible to compare extracted value to decoding table, determining the symbol to decode and number of bits to discard. The process continues up to reading the required number of symbols per stream. @@ -1516,12 +1523,13 @@ to crosscheck that an implementation build its decodin Version changes --------------- +- 0.2.6 : fixed an error in huffman example, by Ulrich Kunitz - 0.2.5 : minor typos and clarifications - 0.2.4 : section restructuring, by Sean Purcell - 0.2.3 : clarified several details, by Sean Purcell - 0.2.2 : added predefined codes, by Johannes Rudolph - 0.2.1 : clarify field names, by Przemyslaw Skibinski -- 0.2.0 : numerous format adjustments for zstd v0.8 +- 0.2.0 : numerous format adjustments for zstd v0.8+ - 0.1.2 : limit Huffman tree depth to 11 bits - 0.1.1 : reserved dictID ranges - 0.1.0 : initial release Modified: vendor/zstd/dist/doc/zstd_manual.html ============================================================================== --- vendor/zstd/dist/doc/zstd_manual.html Tue Aug 22 05:02:42 2017 (r322778) +++ vendor/zstd/dist/doc/zstd_manual.html Tue Aug 22 11:02:59 2017 (r322779) @@ -1,10 +1,10 @@ -zstd 1.3.0 Manual +zstd 1.3.1 Manual -

zstd 1.3.0 Manual

+

zstd 1.3.1 Manual


Contents

    @@ -73,29 +73,43 @@ or an errorCode if it fails (which can be tested using ZSTD_isError()).


    -
    unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize);
    -

    NOTE: This function is planned to be obsolete, in favor of ZSTD_getFrameContentSize(). - ZSTD_getFrameContentSize() works the same way, - returning the decompressed size of a single frame, - but distinguishes empty frames from frames with an unknown size, or errors. - - 'src' is the start of a zstd compressed frame. - @return : content size to be decompressed, as a 64-bits value _if known_, 0 otherwise. - note 1 : decompressed size is an optional field, it may not be present, typically in streaming mode. - When `return==0`, data to decompress could be any size. +

    #define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
    +#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
    +unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize);
    +

    `src` should point to the start of a ZSTD encoded frame. + `srcSize` must be at least as large as the frame header. + hint : any size >= `ZSTD_frameHeaderSize_max` is large enough. + @return : - decompressed size of the frame in `src`, if known + - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined + - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small) + note 1 : a 0 return value means the frame is valid but "empty". + note 2 : decompressed size is an optional field, it may not be present, typically in streaming mode. + When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size. In which case, it's necessary to use streaming mode to decompress data. - Optionally, application can use ZSTD_decompress() while relying on implied limits. - (For example, data may be necessarily cut into blocks <= 16 KB). - note 2 : decompressed size is always present when compression is done with ZSTD_compress() - note 3 : decompressed size can be very large (64-bits value), + Optionally, application can rely on some implicit limit, + as ZSTD_decompress() only needs an upper bound of decompressed size. + (For example, data could be necessarily cut into blocks <= 16 KB). + note 3 : decompressed size is always present when compression is done with ZSTD_compress() + note 4 : decompressed size can be very large (64-bits value), potentially larger than what local system can handle as a single memory segment. In which case, it's necessary to use streaming mode to decompress data. - note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified. - Always ensure result fits within application's authorized limits. + note 5 : If source is untrusted, decompressed size could be wrong or intentionally modified. + Always ensure return value fits within application's authorized limits. Each application can set its own limits. - note 5 : when `return==0`, if precise failure cause is needed, use ZSTD_getFrameHeader() to know more. + note 6 : This function replaces ZSTD_getDecompressedSize()


    *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Aug 22 11:03:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96CF3DE1E83; Tue, 22 Aug 2017 11:03:52 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 406B280AE4; Tue, 22 Aug 2017 11:03:52 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MB3pMB051165; Tue, 22 Aug 2017 11:03:51 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MB3oB4051158; Tue, 22 Aug 2017 11:03:50 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201708221103.v7MB3oB4051158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 22 Aug 2017 11:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322780 - in vendor/zstd/1.3.1: . doc doc/educational_decoder examples lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests tests/files te... X-SVN-Group: vendor X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in vendor/zstd/1.3.1: . doc doc/educational_decoder examples lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests tests/files tests/fuzz zlibWrapper zlib... X-SVN-Commit-Revision: 322780 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 11:03:52 -0000 Author: bapt Date: Tue Aug 22 11:03:50 2017 New Revision: 322780 URL: https://svnweb.freebsd.org/changeset/base/322780 Log: Tag import of zstandard 1.3.1 Added: vendor/zstd/1.3.1/ - copied from r322652, vendor/zstd/dist/ vendor/zstd/1.3.1/tests/files/ - copied from r322779, vendor/zstd/dist/tests/files/ vendor/zstd/1.3.1/tests/fuzz/ - copied from r322779, vendor/zstd/dist/tests/fuzz/ vendor/zstd/1.3.1/tests/poolTests.c - copied unchanged from r322779, vendor/zstd/dist/tests/poolTests.c Replaced: vendor/zstd/1.3.1/CONTRIBUTING.md - copied unchanged from r322779, vendor/zstd/dist/CONTRIBUTING.md vendor/zstd/1.3.1/Makefile - copied unchanged from r322779, vendor/zstd/dist/Makefile vendor/zstd/1.3.1/NEWS - copied unchanged from r322779, vendor/zstd/dist/NEWS vendor/zstd/1.3.1/README.md - copied unchanged from r322779, vendor/zstd/dist/README.md vendor/zstd/1.3.1/circle.yml - copied unchanged from r322779, vendor/zstd/dist/circle.yml vendor/zstd/1.3.1/doc/educational_decoder/harness.c - copied unchanged from r322779, vendor/zstd/dist/doc/educational_decoder/harness.c vendor/zstd/1.3.1/doc/educational_decoder/zstd_decompress.c - copied unchanged from r322779, vendor/zstd/dist/doc/educational_decoder/zstd_decompress.c vendor/zstd/1.3.1/doc/educational_decoder/zstd_decompress.h - copied unchanged from r322779, vendor/zstd/dist/doc/educational_decoder/zstd_decompress.h vendor/zstd/1.3.1/doc/zstd_compression_format.md - copied unchanged from r322779, vendor/zstd/dist/doc/zstd_compression_format.md vendor/zstd/1.3.1/doc/zstd_manual.html - copied unchanged from r322779, vendor/zstd/dist/doc/zstd_manual.html vendor/zstd/1.3.1/lib/common/bitstream.h - copied unchanged from r322779, vendor/zstd/dist/lib/common/bitstream.h vendor/zstd/1.3.1/lib/common/error_private.c - copied unchanged from r322779, vendor/zstd/dist/lib/common/error_private.c vendor/zstd/1.3.1/lib/common/error_private.h - copied unchanged from r322779, vendor/zstd/dist/lib/common/error_private.h vendor/zstd/1.3.1/lib/common/fse.h - copied unchanged from r322779, vendor/zstd/dist/lib/common/fse.h vendor/zstd/1.3.1/lib/common/fse_decompress.c - copied unchanged from r322779, vendor/zstd/dist/lib/common/fse_decompress.c vendor/zstd/1.3.1/lib/common/huf.h - copied unchanged from r322779, vendor/zstd/dist/lib/common/huf.h vendor/zstd/1.3.1/lib/common/mem.h - copied unchanged from r322779, vendor/zstd/dist/lib/common/mem.h vendor/zstd/1.3.1/lib/common/pool.c - copied unchanged from r322779, vendor/zstd/dist/lib/common/pool.c vendor/zstd/1.3.1/lib/common/pool.h - copied unchanged from r322779, vendor/zstd/dist/lib/common/pool.h vendor/zstd/1.3.1/lib/common/threading.h - copied unchanged from r322779, vendor/zstd/dist/lib/common/threading.h vendor/zstd/1.3.1/lib/common/xxhash.c - copied unchanged from r322779, vendor/zstd/dist/lib/common/xxhash.c vendor/zstd/1.3.1/lib/common/zstd_common.c - copied unchanged from r322779, vendor/zstd/dist/lib/common/zstd_common.c vendor/zstd/1.3.1/lib/common/zstd_errors.h - copied unchanged from r322779, vendor/zstd/dist/lib/common/zstd_errors.h vendor/zstd/1.3.1/lib/common/zstd_internal.h - copied unchanged from r322779, vendor/zstd/dist/lib/common/zstd_internal.h vendor/zstd/1.3.1/lib/compress/fse_compress.c - copied unchanged from r322779, vendor/zstd/dist/lib/compress/fse_compress.c vendor/zstd/1.3.1/lib/compress/huf_compress.c - copied unchanged from r322779, vendor/zstd/dist/lib/compress/huf_compress.c vendor/zstd/1.3.1/lib/compress/zstd_compress.c - copied unchanged from r322779, vendor/zstd/dist/lib/compress/zstd_compress.c vendor/zstd/1.3.1/lib/compress/zstd_opt.h - copied unchanged from r322779, vendor/zstd/dist/lib/compress/zstd_opt.h vendor/zstd/1.3.1/lib/compress/zstdmt_compress.c - copied unchanged from r322779, vendor/zstd/dist/lib/compress/zstdmt_compress.c vendor/zstd/1.3.1/lib/compress/zstdmt_compress.h - copied unchanged from r322779, vendor/zstd/dist/lib/compress/zstdmt_compress.h vendor/zstd/1.3.1/lib/decompress/huf_decompress.c - copied unchanged from r322779, vendor/zstd/dist/lib/decompress/huf_decompress.c vendor/zstd/1.3.1/lib/decompress/zstd_decompress.c - copied unchanged from r322779, vendor/zstd/dist/lib/decompress/zstd_decompress.c vendor/zstd/1.3.1/lib/deprecated/zbuff.h - copied unchanged from r322779, vendor/zstd/dist/lib/deprecated/zbuff.h vendor/zstd/1.3.1/lib/deprecated/zbuff_common.c - copied unchanged from r322779, vendor/zstd/dist/lib/deprecated/zbuff_common.c vendor/zstd/1.3.1/lib/deprecated/zbuff_compress.c - copied unchanged from r322779, vendor/zstd/dist/lib/deprecated/zbuff_compress.c vendor/zstd/1.3.1/lib/deprecated/zbuff_decompress.c - copied unchanged from r322779, vendor/zstd/dist/lib/deprecated/zbuff_decompress.c vendor/zstd/1.3.1/lib/dictBuilder/cover.c - copied unchanged from r322779, vendor/zstd/dist/lib/dictBuilder/cover.c vendor/zstd/1.3.1/lib/dictBuilder/zdict.c - copied unchanged from r322779, vendor/zstd/dist/lib/dictBuilder/zdict.c vendor/zstd/1.3.1/lib/dictBuilder/zdict.h - copied unchanged from r322779, vendor/zstd/dist/lib/dictBuilder/zdict.h vendor/zstd/1.3.1/lib/legacy/zstd_legacy.h - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_legacy.h vendor/zstd/1.3.1/lib/legacy/zstd_v01.c - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v01.c vendor/zstd/1.3.1/lib/legacy/zstd_v01.h - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v01.h vendor/zstd/1.3.1/lib/legacy/zstd_v02.c - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v02.c vendor/zstd/1.3.1/lib/legacy/zstd_v02.h - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v02.h vendor/zstd/1.3.1/lib/legacy/zstd_v03.c - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v03.c vendor/zstd/1.3.1/lib/legacy/zstd_v03.h - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v03.h vendor/zstd/1.3.1/lib/legacy/zstd_v04.c - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v04.c vendor/zstd/1.3.1/lib/legacy/zstd_v04.h - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v04.h vendor/zstd/1.3.1/lib/legacy/zstd_v05.c - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v05.c vendor/zstd/1.3.1/lib/legacy/zstd_v05.h - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v05.h vendor/zstd/1.3.1/lib/legacy/zstd_v06.c - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v06.c vendor/zstd/1.3.1/lib/legacy/zstd_v06.h - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v06.h vendor/zstd/1.3.1/lib/legacy/zstd_v07.c - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v07.c vendor/zstd/1.3.1/lib/legacy/zstd_v07.h - copied unchanged from r322779, vendor/zstd/dist/lib/legacy/zstd_v07.h vendor/zstd/1.3.1/lib/zstd.h - copied unchanged from r322779, vendor/zstd/dist/lib/zstd.h vendor/zstd/1.3.1/programs/.gitignore - copied unchanged from r322779, vendor/zstd/dist/programs/.gitignore vendor/zstd/1.3.1/programs/Makefile - copied unchanged from r322779, vendor/zstd/dist/programs/Makefile vendor/zstd/1.3.1/programs/README.md - copied unchanged from r322779, vendor/zstd/dist/programs/README.md vendor/zstd/1.3.1/programs/bench.c - copied unchanged from r322779, vendor/zstd/dist/programs/bench.c vendor/zstd/1.3.1/programs/bench.h - copied unchanged from r322779, vendor/zstd/dist/programs/bench.h vendor/zstd/1.3.1/programs/datagen.c - copied unchanged from r322779, vendor/zstd/dist/programs/datagen.c vendor/zstd/1.3.1/programs/datagen.h - copied unchanged from r322779, vendor/zstd/dist/programs/datagen.h vendor/zstd/1.3.1/programs/dibio.c - copied unchanged from r322779, vendor/zstd/dist/programs/dibio.c vendor/zstd/1.3.1/programs/dibio.h - copied unchanged from r322779, vendor/zstd/dist/programs/dibio.h vendor/zstd/1.3.1/programs/fileio.c - copied unchanged from r322779, vendor/zstd/dist/programs/fileio.c vendor/zstd/1.3.1/programs/fileio.h - copied unchanged from r322779, vendor/zstd/dist/programs/fileio.h vendor/zstd/1.3.1/programs/platform.h - copied unchanged from r322779, vendor/zstd/dist/programs/platform.h vendor/zstd/1.3.1/programs/util.h - copied unchanged from r322779, vendor/zstd/dist/programs/util.h vendor/zstd/1.3.1/programs/zstd.1 - copied unchanged from r322779, vendor/zstd/dist/programs/zstd.1 vendor/zstd/1.3.1/programs/zstd.1.md - copied unchanged from r322779, vendor/zstd/dist/programs/zstd.1.md vendor/zstd/1.3.1/programs/zstdcli.c - copied unchanged from r322779, vendor/zstd/dist/programs/zstdcli.c vendor/zstd/1.3.1/tests/Makefile - copied unchanged from r322779, vendor/zstd/dist/tests/Makefile vendor/zstd/1.3.1/tests/datagencli.c - copied unchanged from r322779, vendor/zstd/dist/tests/datagencli.c vendor/zstd/1.3.1/tests/decodecorpus.c - copied unchanged from r322779, vendor/zstd/dist/tests/decodecorpus.c vendor/zstd/1.3.1/tests/fullbench.c - copied unchanged from r322779, vendor/zstd/dist/tests/fullbench.c vendor/zstd/1.3.1/tests/fuzzer.c - copied unchanged from r322779, vendor/zstd/dist/tests/fuzzer.c vendor/zstd/1.3.1/tests/invalidDictionaries.c - copied unchanged from r322779, vendor/zstd/dist/tests/invalidDictionaries.c vendor/zstd/1.3.1/tests/legacy.c - copied unchanged from r322779, vendor/zstd/dist/tests/legacy.c vendor/zstd/1.3.1/tests/longmatch.c - copied unchanged from r322779, vendor/zstd/dist/tests/longmatch.c vendor/zstd/1.3.1/tests/namespaceTest.c - copied unchanged from r322779, vendor/zstd/dist/tests/namespaceTest.c vendor/zstd/1.3.1/tests/paramgrill.c - copied unchanged from r322779, vendor/zstd/dist/tests/paramgrill.c vendor/zstd/1.3.1/tests/playTests.sh - copied unchanged from r322779, vendor/zstd/dist/tests/playTests.sh vendor/zstd/1.3.1/tests/roundTripCrash.c - copied unchanged from r322779, vendor/zstd/dist/tests/roundTripCrash.c vendor/zstd/1.3.1/tests/symbols.c - copied unchanged from r322779, vendor/zstd/dist/tests/symbols.c vendor/zstd/1.3.1/tests/zbufftest.c - copied unchanged from r322779, vendor/zstd/dist/tests/zbufftest.c vendor/zstd/1.3.1/tests/zstreamtest.c - copied unchanged from r322779, vendor/zstd/dist/tests/zstreamtest.c vendor/zstd/1.3.1/zlibWrapper/examples/zwrapbench.c - copied unchanged from r322779, vendor/zstd/dist/zlibWrapper/examples/zwrapbench.c vendor/zstd/1.3.1/zlibWrapper/gzcompatibility.h - copied unchanged from r322779, vendor/zstd/dist/zlibWrapper/gzcompatibility.h vendor/zstd/1.3.1/zlibWrapper/gzlib.c - copied unchanged from r322779, vendor/zstd/dist/zlibWrapper/gzlib.c vendor/zstd/1.3.1/zlibWrapper/gzread.c - copied unchanged from r322779, vendor/zstd/dist/zlibWrapper/gzread.c vendor/zstd/1.3.1/zlibWrapper/gzwrite.c - copied unchanged from r322779, vendor/zstd/dist/zlibWrapper/gzwrite.c vendor/zstd/1.3.1/zlibWrapper/zstd_zlibwrapper.c - copied unchanged from r322779, vendor/zstd/dist/zlibWrapper/zstd_zlibwrapper.c vendor/zstd/1.3.1/zlibWrapper/zstd_zlibwrapper.h - copied unchanged from r322779, vendor/zstd/dist/zlibWrapper/zstd_zlibwrapper.h Deleted: vendor/zstd/1.3.1/PATENTS vendor/zstd/1.3.1/examples/ vendor/zstd/1.3.1/tests/pool.c Copied: vendor/zstd/1.3.1/CONTRIBUTING.md (from r322779, vendor/zstd/dist/CONTRIBUTING.md) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/zstd/1.3.1/CONTRIBUTING.md Tue Aug 22 11:03:50 2017 (r322780, copy of r322779, vendor/zstd/dist/CONTRIBUTING.md) @@ -0,0 +1,42 @@ +# Contributing to Zstandard +We want to make contributing to this project as easy and transparent as +possible. + +## Our Development Process +New versions are being developed in the "dev" branch, +or in their own feature branch. +When they are deemed ready for a release, they are merged into "master". + +As a consequences, all contributions must stage first through "dev" +or their own feature branch. + +## Pull Requests +We actively welcome your pull requests. + +1. Fork the repo and create your branch from `dev`. +2. If you've added code that should be tested, add tests. +3. If you've changed APIs, update the documentation. +4. Ensure the test suite passes. +5. Make sure your code lints. +6. If you haven't already, complete the Contributor License Agreement ("CLA"). + +## Contributor License Agreement ("CLA") +In order to accept your pull request, we need you to submit a CLA. You only need +to do this once to work on any of Facebook's open source projects. + +Complete your CLA here: + +## Issues +We use GitHub issues to track public bugs. Please ensure your description is +clear and has sufficient instructions to be able to reproduce the issue. + +Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe +disclosure of security bugs. In those cases, please go through the process +outlined on that page and do not file a public issue. + +## Coding Style +* 4 spaces for indentation rather than tabs + +## License +By contributing to Zstandard, you agree that your contributions will be licensed +under both the [LICENSE](LICENSE) file and the [COPYING](COPYING) file in the root directory of this source tree. Copied: vendor/zstd/1.3.1/Makefile (from r322779, vendor/zstd/dist/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/zstd/1.3.1/Makefile Tue Aug 22 11:03:50 2017 (r322780, copy of r322779, vendor/zstd/dist/Makefile) @@ -0,0 +1,334 @@ +# ################################################################ +# Copyright (c) 2016-present, Yann Collet, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. An additional grant +# of patent rights can be found in the PATENTS file in the same directory. +# ################################################################ + +PRGDIR = programs +ZSTDDIR = lib +BUILDIR = build +ZWRAPDIR = zlibWrapper +TESTDIR = tests + +# Define nul output +VOID = /dev/null + +ifneq (,$(filter Windows%,$(OS))) +EXT =.exe +else +EXT = +endif + +.PHONY: default +default: lib-release zstd-release + +.PHONY: all +all: | allmost examples manual + +.PHONY: allmost +allmost: + $(MAKE) -C $(ZSTDDIR) all + $(MAKE) -C $(PRGDIR) all + $(MAKE) -C $(TESTDIR) all + $(MAKE) -C $(ZWRAPDIR) all + +#skip zwrapper, can't build that on alternate architectures without the proper zlib installed +.PHONY: allarch +allarch: + $(MAKE) -C $(ZSTDDIR) all + $(MAKE) -C $(PRGDIR) all + $(MAKE) -C $(TESTDIR) all + +.PHONY: all32 +all32: + $(MAKE) -C $(PRGDIR) zstd32 + $(MAKE) -C $(TESTDIR) all32 + +.PHONY: lib +lib: + @$(MAKE) -C $(ZSTDDIR) $@ + +.PHONY: lib-release +lib-release: + @$(MAKE) -C $(ZSTDDIR) + +.PHONY: zstd +zstd: + @$(MAKE) -C $(PRGDIR) $@ + cp $(PRGDIR)/zstd$(EXT) . + +.PHONY: zstd-release +zstd-release: + @$(MAKE) -C $(PRGDIR) + cp $(PRGDIR)/zstd$(EXT) . + +.PHONY: zstdmt +zstdmt: + @$(MAKE) -C $(PRGDIR) $@ + cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT) + +.PHONY: zlibwrapper +zlibwrapper: + $(MAKE) -C $(ZWRAPDIR) test + +.PHONY: test shortest +test shortest: + $(MAKE) -C $(PRGDIR) allVariants + $(MAKE) -C $(TESTDIR) $@ + +.PHONY: examples +examples: + CPPFLAGS=-I../lib LDFLAGS=-L../lib $(MAKE) -C examples/ all + +.PHONY: manual +manual: + $(MAKE) -C contrib/gen_html $@ + +.PHONY: cleanTabs +cleanTabs: + cd contrib; ./cleanTabs + +.PHONY: clean +clean: + @$(MAKE) -C $(ZSTDDIR) $@ > $(VOID) + @$(MAKE) -C $(PRGDIR) $@ > $(VOID) + @$(MAKE) -C $(TESTDIR) $@ > $(VOID) + @$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID) + @$(MAKE) -C examples/ $@ > $(VOID) + @$(MAKE) -C contrib/gen_html $@ > $(VOID) + @$(RM) zstd$(EXT) zstdmt$(EXT) tmp* + @echo Cleaning completed + +#------------------------------------------------------------------------------ +# make install is validated only for Linux, OSX, Hurd and some BSD targets +#------------------------------------------------------------------------------ +ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD MSYS_NT)) + +HOST_OS = POSIX +CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON + +.PHONY: list +list: + @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs + +.PHONY: install clangtest gpptest armtest usan asan uasan +install: + @$(MAKE) -C $(ZSTDDIR) $@ + @$(MAKE) -C $(PRGDIR) $@ + +.PHONY: uninstall +uninstall: + @$(MAKE) -C $(ZSTDDIR) $@ + @$(MAKE) -C $(PRGDIR) $@ + +.PHONY: travis-install +travis-install: + $(MAKE) install PREFIX=~/install_test_dir + +.PHONY: gppbuild +gppbuild: clean + g++ -v + CC=g++ $(MAKE) -C programs all CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" + +.PHONY: gcc5build +gcc5build: clean + gcc-5 -v + CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror" + +.PHONY: gcc6build +gcc6build: clean + gcc-6 -v + CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror" + +.PHONY: gcc7build +gcc7build: clean + gcc-7 -v + CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror" + +.PHONY: clangbuild +clangbuild: clean + clang -v + CXX=clang++ CC=clang $(MAKE) all MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" + +m32build: clean + gcc -v + $(MAKE) all32 + +armbuild: clean + CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allarch + +aarch64build: clean + CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allarch + +ppcbuild: clean + CC=powerpc-linux-gnu-gcc CLAGS="-m32 -Wno-attributes -Werror" $(MAKE) allarch + +ppc64build: clean + CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allarch + +armfuzz: clean + CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest + +aarch64fuzz: clean + CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest + +ppcfuzz: clean + CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest + +ppc64fuzz: clean + CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest + +gpptest: clean + CC=$(CXX) $(MAKE) -C $(PRGDIR) all CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" + +gcc5test: clean + gcc-5 -v + $(MAKE) all CC=gcc-5 MOREFLAGS="-Werror" + +gcc6test: clean + gcc-6 -v + $(MAKE) all CC=gcc-6 MOREFLAGS="-Werror" + +clangtest: clean + clang -v + $(MAKE) all CXX=clang-++ CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" + +armtest: clean + $(MAKE) -C $(TESTDIR) datagen # use native, faster + $(MAKE) -C $(TESTDIR) test CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests + +aarch64test: + $(MAKE) -C $(TESTDIR) datagen # use native, faster + $(MAKE) -C $(TESTDIR) test CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests + +ppctest: clean + $(MAKE) -C $(TESTDIR) datagen # use native, faster + $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" FUZZER_FLAGS=--no-big-tests + +ppc64test: clean + $(MAKE) -C $(TESTDIR) datagen # use native, faster + $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests + +arm-ppc-compilation: + $(MAKE) -C $(PRGDIR) clean zstd CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" + $(MAKE) -C $(PRGDIR) clean zstd CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static" + $(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" + $(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" + +# run UBsan with -fsanitize-recover=signed-integer-overflow +# due to a bug in UBsan when doing pointer subtraction +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303 + +usan: clean + $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=undefined" + +asan: clean + $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address" + +asan-%: clean + LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address" $(MAKE) -C $(TESTDIR) $* + +msan: clean + $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=memory -fno-omit-frame-pointer" HAVE_LZMA=0 # datagen.c fails this test for no obvious reason + +msan-%: clean + LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) HAVE_LZMA=0 $* + +asan32: clean + $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address" + +uasan: clean + $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined" + +uasan-%: clean + LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined" $(MAKE) -C $(TESTDIR) $* + +tsan-%: clean + LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests + +apt-install: + sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES) + +apt-add-repo: + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + sudo apt-get update -y -qq + +ppcinstall: + APT_PACKAGES="qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu" $(MAKE) apt-install + +arminstall: + APT_PACKAGES="qemu-system-arm qemu-user-static gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross" $(MAKE) apt-install + +valgrindinstall: + APT_PACKAGES="valgrind" $(MAKE) apt-install + +libc6install: + APT_PACKAGES="libc6-dev-i386 gcc-multilib" $(MAKE) apt-install + +gcc6install: apt-add-repo + APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-6 gcc-6-multilib" $(MAKE) apt-install + +gpp6install: apt-add-repo + APT_PACKAGES="libc6-dev-i386 g++-multilib gcc-6 g++-6 g++-6-multilib" $(MAKE) apt-install + +clang38install: + APT_PACKAGES="clang-3.8" $(MAKE) apt-install + +endif + + +ifneq (,$(filter MSYS%,$(shell uname))) +HOST_OS = MSYS +CMAKE_PARAMS = -G"MSYS Makefiles" -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON +endif + + +#------------------------------------------------------------------------ +#make tests validated only for MSYS, Linux, OSX, kFreeBSD and Hurd targets +#------------------------------------------------------------------------ +ifneq (,$(filter $(HOST_OS),MSYS POSIX)) +cmakebuild: + cmake --version + $(RM) -r $(BUILDIR)/cmake/build + mkdir $(BUILDIR)/cmake/build + cd $(BUILDIR)/cmake/build ; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) .. ; $(MAKE) install ; $(MAKE) uninstall + +c90build: clean + gcc -v + CFLAGS="-std=c90" $(MAKE) allmost # will fail, due to missing support for `long long` + +gnu90build: clean + gcc -v + CFLAGS="-std=gnu90" $(MAKE) allmost + +c99build: clean + gcc -v + CFLAGS="-std=c99" $(MAKE) allmost + +gnu99build: clean + gcc -v + CFLAGS="-std=gnu99" $(MAKE) allmost + +c11build: clean + gcc -v + CFLAGS="-std=c11" $(MAKE) allmost + +bmix64build: clean + gcc -v + CFLAGS="-O3 -mbmi -Werror" $(MAKE) -C $(TESTDIR) test + +bmix32build: clean + gcc -v + CFLAGS="-O3 -mbmi -mx32 -Werror" $(MAKE) -C $(TESTDIR) test + +bmi32build: clean + gcc -v + CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(TESTDIR) test + +staticAnalyze: clean + gcc -v + CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) all +endif Copied: vendor/zstd/1.3.1/NEWS (from r322779, vendor/zstd/dist/NEWS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/zstd/1.3.1/NEWS Tue Aug 22 11:03:50 2017 (r322780, copy of r322779, vendor/zstd/dist/NEWS) @@ -0,0 +1,313 @@ +v1.3.1 +New license : BSD + GPLv2 +perf: substantially decreased memory usage in Multi-threading mode, thanks to reports by Tino Reichardt (@mcmilk) +perf: Multi-threading supports up to 256 threads. Cap at 256 when more are requested (#760) +cli : improved and fixed --list command, by @ib (#772) +cli : command -vV to list supported formats, by @ib (#771) +build : fixed binary variants, reported by @svenha (#788) +build : fix Visual compilation for non x86/x64 targets, reported by Greg Slazinski (@GregSlazinski) (#718) +API exp : breaking change : ZSTD_getframeHeader() provides more information +API exp : breaking change : pinned down values of error codes +doc : fixed huffman example, by Ulrich Kunitz (@ulikunitz) +new : contrib/adaptive-compression, I/O driven compression strength, by Paul Cruz (@paulcruz74) +new : contrib/long_distance_matching, statistics by Stella Lau (@stellamplau) +updated : contrib/linux-kernel, by Nick Terrell (@terrelln) + +v1.3.0 +cli : new : `--list` command, by Paul Cruz +cli : changed : xz/lzma support enabled by default +cli : changed : `-t *` continue processing list after a decompression error +API : added : ZSTD_versionString() +API : promoted to stable status : ZSTD_getFrameContentSize(), by Sean Purcell +API exp : new advanced API : ZSTD_compress_generic(), ZSTD_CCtx_setParameter() +API exp : new : API for static or external allocation : ZSTD_initStatic?Ctx() +API exp : added : ZSTD_decompressBegin_usingDDict(), requested by Guy Riddle (#700) +API exp : clarified memory estimation / measurement functions. +API exp : changed : strongest strategy renamed ZSTD_btultra, fastest strategy ZSTD_fast set to 1 +tools : decodecorpus can generate random dictionary-compressed samples, by Paul Cruz +new : contrib/seekable_format, demo and API, by Sean Purcell +changed : contrib/linux-kernel, updated version and license, by Nick Terrell + +v1.2.0 +cli : changed : Multithreading enabled by default (use target zstd-nomt or HAVE_THREAD=0 to disable) +cli : new : command -T0 means "detect and use nb of cores", by Sean Purcell +cli : new : zstdmt symlink hardwired to `zstd -T0` +cli : new : command --threads=# (#671) +cli : changed : cover dictionary builder by default, for improved quality, by Nick Terrell +cli : new : commands --train-cover and --train-legacy, to select dictionary algorithm and parameters +cli : experimental targets `zstd4` and `xzstd4`, with support for lz4 format, by Sean Purcell +cli : fix : does not output compressed data on console +cli : fix : ignore symbolic links unless --force specified, +API : breaking change : ZSTD_createCDict_advanced(), only use compressionParameters as argument +API : added : prototypes ZSTD_*_usingCDict_advanced(), for direct control over frameParameters. +API : improved: ZSTDMT_compressCCtx() reduced memory usage +API : fix : ZSTDMT_compressCCtx() now provides srcSize in header (#634) +API : fix : src size stored in frame header is controlled at end of frame +API : fix : enforced consistent rules for pledgedSrcSize==0 (#641) +API : fix : error code "GENERIC" replaced by "dstSizeTooSmall" when appropriate +build: improved cmake script, by @Majlen +build: enabled Multi-threading support for *BSD, by Baptiste Daroussin +tools: updated Paramgrill. Command -O# provides best parameters for sample and speed target. +new : contrib/linux-kernel version, by Nick Terrell + +v1.1.4 +cli : new : can compress in *.gz format, using --format=gzip command, by Przemyslaw Skibinski +cli : new : advanced benchmark command --priority=rt +cli : fix : write on sparse-enabled file systems in 32-bits mode, by @ds77 +cli : fix : --rm remains silent when input is stdin +cli : experimental : xzstd, with support for xz/lzma decoding, by Przemyslaw Skibinski +speed : improved decompression speed in streaming mode for single shot scenarios (+5%) +memory: DDict (decompression dictionary) memory usage down from 150 KB to 20 KB +arch: 32-bits variant able to generate and decode very long matches (>32 MB), by Sean Purcell +API : new : ZSTD_findFrameCompressedSize(), ZSTD_getFrameContentSize(), ZSTD_findDecompressedSize() +API : changed : dropped support of legacy versions <= v0.3 (can be changed by modifying ZSTD_LEGACY_SUPPORT value) +build : new: meson build system in contrib/meson, by Dima Krasner +build : improved cmake script, by @Majlen +build : added -Wformat-security flag, as recommended by Padraig Brady +doc : new : educational decoder, by Sean Purcell + +v1.1.3 +cli : zstd can decompress .gz files (can be disabled with `make zstd-nogz` or `make HAVE_ZLIB=0`) +cli : new : experimental target `make zstdmt`, with multi-threading support +cli : new : improved dictionary builder "cover" (experimental), by Nick Terrell, based on prior work by Giuseppe Ottaviano. +cli : new : advanced commands for detailed parameters, by Przemyslaw Skibinski +cli : fix zstdless on Mac OS-X, by Andrew Janke +cli : fix #232 "compress non-files" +dictBuilder : improved dictionary generation quality, thanks to Nick Terrell +API : new : lib/compress/ZSTDMT_compress.h multithreading API (experimental) +API : new : ZSTD_create?Dict_byReference(), requested by Bartosz Taudul +API : new : ZDICT_finalizeDictionary() +API : fix : ZSTD_initCStream_usingCDict() properly writes dictID into frame header, by Gregory Szorc (#511) +API : fix : all symbols properly exposed in libzstd, by Nick Terrell +build : support for Solaris target, by Przemyslaw Skibinski +doc : clarified specification, by Sean Purcell + +v1.1.2 +API : streaming : decompression : changed : automatic implicit reset when chain-decoding new frames without init +API : experimental : added : dictID retrieval functions, and ZSTD_initCStream_srcSize() +API : zbuff : changed : prototypes now generate deprecation warnings +lib : improved : faster decompression speed at ultra compression settings and 32-bits mode +lib : changed : only public ZSTD_ symbols are now exposed +lib : changed : reduced usage of stack memory +lib : fixed : several corner case bugs, by Nick Terrell +cli : new : gzstd, experimental version able to decode .gz files, by Przemyslaw Skibinski +cli : new : preserve file attributes +cli : new : added zstdless and zstdgrep tools +cli : fixed : status displays total amount decoded, even for file consisting of multiple frames (like pzstd) +cli : fixed : zstdcat +zlib_wrapper : added support for gz* functions, by Przemyslaw Skibinski +install : better compatibility with FreeBSD, by Dimitry Andric +source tree : changed : zbuff source files moved to lib/deprecated + +v1.1.1 +New : command -M#, --memory=, --memlimit=, --memlimit-decompress= to limit allowed memory consumption +New : doc/zstd_manual.html, by Przemyslaw Skibinski +Improved : slightly better compression ratio at --ultra levels (>= 20) +Improved : better memory usage when using streaming compression API, thanks to @Rogier-5 report +Added : API : ZSTD_initCStream_usingCDict(), ZSTD_initDStream_usingDDict() (experimental section) +Added : example/multiple_streaming_compression.c +Changed : zstd_errors.h is now installed within /include (and replaces errors_public.h) +Updated man page +Fixed : zstd-small, zstd-compress and zstd-decompress compilation targets + +v1.1.0 +New : contrib/pzstd, parallel version of zstd, by Nick Terrell +added : NetBSD install target (#338) +Improved : speed for batches of small files +Improved : speed of zlib wrapper, by Przemyslaw Skibinski +Changed : libzstd on Windows supports legacy formats, by Christophe Chevalier +Fixed : CLI -d output to stdout by default when input is stdin (#322) +Fixed : CLI correctly detects console on Mac OS-X +Fixed : CLI supports recursive mode `-r` on Mac OS-X +Fixed : Legacy decoders use unified error codes, reported by benrg (#341), fixed by Przemyslaw Skibinski +Fixed : compatibility with OpenBSD, reported by Juan Francisco Cantero Hurtado (#319) +Fixed : compatibility with Hurd, by Przemyslaw Skibinski (#365) +Fixed : zstd-pgo, reported by octoploid (#329) + +v1.0.0 +Change Licensing, all project is now BSD, Copyright Facebook +Small decompression speed improvement +API : Streaming API supports legacy format +API : ZDICT_getDictID(), ZSTD_sizeof_{CCtx, DCtx, CStream, DStream}(), ZSTD_setDStreamParamter() +CLI supports legacy formats v0.4+ +Fixed : compression fails on certain huge files, reported by Jesse McGrew +Enhanced documentation, by Przemyslaw Skibinski + +v0.8.1 +New streaming API +Changed : --ultra now enables levels beyond 19 +Changed : -i# now selects benchmark time in second +Fixed : ZSTD_compress* can now compress > 4 GB in a single pass, reported by Nick Terrell +Fixed : speed regression on specific patterns (#272) +Fixed : support for Z_SYNC_FLUSH, by Dmitry Krot (#291) +Fixed : ICC compilation, by Przemyslaw Skibinski + +v0.8.0 +Improved : better speed on clang and gcc -O2, thanks to Eric Biggers +New : Build on FreeBSD and DragonFly, thanks to JrMarino +Changed : modified API : ZSTD_compressEnd() +Fixed : legacy mode with ZSTD_HEAPMODE=0, by Christopher Bergqvist +Fixed : premature end of frame when zero-sized raw block, reported by Eric Biggers +Fixed : large dictionaries (> 384 KB), reported by Ilona Papava +Fixed : checksum correctly checked in single-pass mode +Fixed : combined --test amd --rm, reported by Andreas M. Nilsson +Modified : minor compression level adaptations +Updated : compression format specification to v0.2.0 +changed : zstd.h moved to /lib directory + +v0.7.5 +Transition version, supporting decoding of v0.8.x + +v0.7.4 +Added : homebrew for Mac, by Daniel Cade +Added : more examples +Fixed : segfault when using small dictionaries, reported by Felix Handte +Modified : default compression level for CLI is now 3 +Updated : specification, to v0.1.1 + +v0.7.3 +New : compression format specification +New : `--` separator, stating that all following arguments are file names. Suggested by Chip Turner. +New : `ZSTD_getDecompressedSize()` +New : OpenBSD target, by Juan Francisco Cantero Hurtado +New : `examples` directory +fixed : dictBuilder using HC levels, reported by Bartosz Taudul +fixed : legacy support from ZSTD_decompress_usingDDict(), reported by Felix Handte +fixed : multi-blocks decoding with intermediate uncompressed blocks, reported by Greg Slazinski +modified : removed "mem.h" and "error_public.h" dependencies from "zstd.h" (experimental section) +modified : legacy functions no longer need magic number + +v0.7.2 +fixed : ZSTD_decompressBlock() using multiple consecutive blocks. Reported by Greg Slazinski. +fixed : potential segfault on very large files (many gigabytes). Reported by Chip Turner. +fixed : CLI displays system error message when destination file cannot be created (#231). Reported by Chip Turner. + +v0.7.1 +fixed : ZBUFF_compressEnd() called multiple times with too small `dst` buffer, reported by Christophe Chevalier +fixed : dictBuilder fails if first sample is too small, reported by РуÑлан Ковалёв +fixed : corruption issue, reported by cj +modified : checksum enabled by default in command line mode + +v0.7.0 +New : Support for directory compression, using `-r`, thanks to Przemyslaw Skibinski +New : Command `--rm`, to remove source file after successful de/compression +New : Visual build scripts, by Christophe Chevalier +New : Support for Sparse File-systems (do not use space for zero-filled sectors) +New : Frame checksum support +New : Support pass-through mode (when using `-df`) +API : more efficient Dictionary API : `ZSTD_compress_usingCDict()`, `ZSTD_decompress_usingDDict()` +API : create dictionary files from custom content, by Giuseppe Ottaviano +API : support for custom malloc/free functions +New : controllable Dictionary ID +New : Support for skippable frames + +v0.6.1 +New : zlib wrapper API, thanks to Przemyslaw Skibinski +New : Ability to compile compressor / decompressor separately +Changed : new lib directory structure +Fixed : Legacy codec v0.5 compatible with dictionary decompression +Fixed : Decoder corruption error (#173) +Fixed : null-string roundtrip (#176) +New : benchmark mode can select directory as input +Experimental : midipix support, VMS support + +v0.6.0 +Stronger high compression modes, thanks to Przemyslaw Skibinski +API : ZSTD_getFrameParams() provides size of decompressed content +New : highest compression modes require `--ultra` command to fully unleash their capacity +Fixed : zstd cli return error code > 0 and removes dst file artifact when decompression fails, thanks to Chip Turner + +v0.5.1 +New : Optimal parsing => Very high compression modes, thanks to Przemyslaw Skibinski +Changed : Dictionary builder integrated into libzstd and zstd cli +Changed (!) : zstd cli now uses "multiple input files" as default mode. See `zstd -h`. +Fix : high compression modes for big-endian platforms +New : zstd cli : `-t` | `--test` command + +v0.5.0 +New : dictionary builder utility +Changed : streaming & dictionary API +Improved : better compression of small data + +v0.4.7 +Improved : small compression speed improvement in HC mode +Changed : `zstd_decompress.c` has ZSTD_LEGACY_SUPPORT to 0 by default +fix : bt search bug + +v0.4.6 +fix : fast compression mode on Windows +New : cmake configuration file, thanks to Artyom Dymchenko +Improved : high compression mode on repetitive data +New : block-level API +New : ZSTD_duplicateCCtx() + +v0.4.5 +new : -m/--multiple : compress/decompress multiple files + +v0.4.4 +Fixed : high compression modes for Windows 32 bits +new : external dictionary API extended to buffered mode and accessible through command line +new : windows DLL project, thanks to Christophe Chevalier + +v0.4.3 : +new : external dictionary API +new : zstd-frugal + +v0.4.2 : +Generic minor improvements for small blocks +Fixed : big-endian compatibility, by Peter Harris (#85) + +v0.4.1 +Fixed : ZSTD_LEGACY_SUPPORT=0 build mode (reported by Luben) +removed `zstd.c` + +v0.4.0 +Command line utility compatible with high compression levels +Removed zstdhc => merged into zstd +Added : ZBUFF API (see zstd_buffered.h) +Rolling buffer support + +v0.3.6 +small blocks params + +v0.3.5 +minor generic compression improvements + +v0.3.4 +Faster fast cLevels + +v0.3.3 +Small compression ratio improvement + +v0.3.2 +Fixed Visual Studio + +v0.3.1 : +Small compression ratio improvement + +v0.3 +HC mode : compression levels 2-26 + +v0.2.2 +Fix : Visual Studio 2013 & 2015 release compilation, by Christophe Chevalier + +v0.2.1 +Fix : Read errors, advanced fuzzer tests, by Hanno Böck + +v0.2.0 +**Breaking format change** +Faster decompression speed +Can still decode v0.1 format + +v0.1.3 +fix uninitialization warning, reported by Evan Nemerson + +v0.1.2 +frame concatenation support + +v0.1.1 +fix compression bug +detects write-flush errors + +v0.1.0 +first release Copied: vendor/zstd/1.3.1/README.md (from r322779, vendor/zstd/dist/README.md) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/zstd/1.3.1/README.md Tue Aug 22 11:03:50 2017 (r322780, copy of r322779, vendor/zstd/dist/README.md) @@ -0,0 +1,153 @@ + __Zstandard__, or `zstd` as short version, is a fast lossless compression algorithm, + targeting real-time compression scenarios at zlib-level and better compression ratios. + +It is provided as an open-source BSD-licensed **C** library, +and a command line utility producing and decoding `.zst` and `.gz` files. +For other programming languages, +you can consult a list of known ports on [Zstandard homepage](http://www.zstd.net/#other-languages). + +| dev branch status | +|-------------------| +| [![Build Status][travisDevBadge]][travisLink] [![Build status][AppveyorDevBadge]][AppveyorLink] [![Build status][CircleDevBadge]][CircleLink] + +[travisDevBadge]: https://travis-ci.org/facebook/zstd.svg?branch=dev "Continuous Integration test suite" +[travisLink]: https://travis-ci.org/facebook/zstd +[AppveyorDevBadge]: https://ci.appveyor.com/api/projects/status/xt38wbdxjk5mrbem/branch/dev?svg=true "Windows test suite" +[AppveyorLink]: https://ci.appveyor.com/project/YannCollet/zstd-p0yf0 +[CircleDevBadge]: https://circleci.com/gh/facebook/zstd/tree/dev.svg?style=shield "Short test suite" +[CircleLink]: https://circleci.com/gh/facebook/zstd + + +As a reference, several fast compression algorithms were tested and compared +on a server running Linux Debian (`Linux version 4.8.0-1-amd64`), +with a Core i7-6700K CPU @ 4.0GHz, +using [lzbench], an open-source in-memory benchmark by @inikep +compiled with GCC 6.3.0, +on the [Silesia compression corpus]. + +[lzbench]: https://github.com/inikep/lzbench +[Silesia compression corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia + +| Compressor name | Ratio | Compression| Decompress.| +| --------------- | ------| -----------| ---------- | +| **zstd 1.1.3 -1** | 2.877 | 430 MB/s | 1110 MB/s | +| zlib 1.2.8 -1 | 2.743 | 110 MB/s | 400 MB/s | +| brotli 0.5.2 -0 | 2.708 | 400 MB/s | 430 MB/s | +| quicklz 1.5.0 -1 | 2.238 | 550 MB/s | 710 MB/s | +| lzo1x 2.09 -1 | 2.108 | 650 MB/s | 830 MB/s | +| lz4 1.7.5 | 2.101 | 720 MB/s | 3600 MB/s | +| snappy 1.1.3 | 2.091 | 500 MB/s | 1650 MB/s | +| lzf 3.6 -1 | 2.077 | 400 MB/s | 860 MB/s | + +[zlib]:http://www.zlib.net/ +[LZ4]: http://www.lz4.org/ + +Zstd can also offer stronger compression ratios at the cost of compression speed. +Speed vs Compression trade-off is configurable by small increments. Decompression speed is preserved and remains roughly the same at all settings, a property shared by most LZ compression algorithms, such as [zlib] or lzma. + +The following tests were run +on a server running Linux Debian (`Linux version 4.8.0-1-amd64`) +with a Core i7-6700K CPU @ 4.0GHz, +using [lzbench], an open-source in-memory benchmark by @inikep +compiled with GCC 6.3.0, +on the [Silesia compression corpus]. + +Compression Speed vs Ratio | Decompression Speed +---------------------------|-------------------- +![Compression Speed vs Ratio](doc/images/Cspeed4.png "Compression Speed vs Ratio") | ![Decompression Speed](doc/images/Dspeed4.png "Decompression Speed") + +Several algorithms can produce higher compression ratios, but at slower speeds, falling outside of the graph. +For a larger picture including very slow modes, [click on this link](doc/images/DCspeed5.png) . + + +### The case for Small Data compression + +Previous charts provide results applicable to typical file and stream scenarios (several MB). Small data comes with different perspectives. + +The smaller the amount of data to compress, the more difficult it is to compress. This problem is common to all compression algorithms, and reason is, compression algorithms learn from past data how to compress future data. But at the beginning of a new data set, there is no "past" to build upon. + +To solve this situation, Zstd offers a __training mode__, which can be used to tune the algorithm for a selected type of data. +Training Zstandard is achieved by providing it with a few samples (one file per sample). The result of this training is stored in a file called "dictionary", which must be loaded before compression and decompression. +Using this dictionary, the compression ratio achievable on small data improves dramatically. + +The following example uses the `github-users` [sample set](https://github.com/facebook/zstd/releases/tag/v1.1.3), created from [github public API](https://developer.github.com/v3/users/#get-all-users). +It consists of roughly 10K records weighing about 1KB each. + +Compression Ratio | Compression Speed | Decompression Speed +------------------|-------------------|-------------------- +![Compression Ratio](doc/images/dict-cr.png "Compression Ratio") | ![Compression Speed](doc/images/dict-cs.png "Compression Speed") | ![Decompression Speed](doc/images/dict-ds.png "Decompression Speed") + + +These compression gains are achieved while simultaneously providing _faster_ compression and decompression speeds. + +Training works if there is some correlation in a family of small data samples. The more data-specific a dictionary is, the more efficient it is (there is no _universal dictionary_). +Hence, deploying one dictionary per type of data will provide the greatest benefits. +Dictionary gains are mostly effective in the first few KB. Then, the compression algorithm will gradually use previously decoded content to better compress the rest of the file. + +#### Dictionary compression How To : + +1) Create the dictionary + +`zstd --train FullPathToTrainingSet/* -o dictionaryName` + +2) Compress with dictionary + +`zstd -D dictionaryName FILE` + +3) Decompress with dictionary + +`zstd -D dictionaryName --decompress FILE.zst` + + +### Build + +Once you have the repository cloned, there are multiple ways provided to build Zstandard. + +#### Makefile + +If your system is compatible with a standard `make` (or `gmake`) binary generator, +you can simply run it at the root directory. +It will generate `zstd` within root directory. + +Other available options include : +- `make install` : create and install zstd binary, library and man page +- `make test` : create and run `zstd` and test tools on local platform + +#### cmake + +A `cmake` project generator is provided within `build/cmake`. +It can generate Makefiles or other build scripts +to create `zstd` binary, and `libzstd` dynamic and static libraries. + +#### Meson + +A Meson project is provided within `contrib/meson`. + +#### Visual Studio (Windows) + +Going into `build` directory, you will find additional possibilities : +- Projects for Visual Studio 2005, 2008 and 2010 + + VS2010 project is compatible with VS2012, VS2013 and VS2015 +- Automated build scripts for Visual compiler by @KrzysFR , in `build/VS_scripts`, + which will build `zstd` cli and `libzstd` library without any need to open Visual Studio solution. + + +### Status + +Zstandard is currently deployed within Facebook. It is used continuously to compress large amounts of data in multiple formats and use cases. +Zstandard is considered safe for production environments. + +### License + +Zstandard is dual-licensed under [BSD](LICENSE) and [GPLv2](COPYING). + +### Contributing + +The "dev" branch is the one where all contributions will be merged before reaching "master". +If you plan to propose a patch, please commit into the "dev" branch or its own feature branch. +Direct commit to "master" are not permitted. +For more information, please read [CONTRIBUTING](CONTRIBUTING.md). + +### Miscellaneous + +Zstd entropy stage is provided by [Huff0 and FSE, from Finite State Entropy library](https://github.com/Cyan4973/FiniteStateEntropy). Copied: vendor/zstd/1.3.1/circle.yml (from r322779, vendor/zstd/dist/circle.yml) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/zstd/1.3.1/circle.yml Tue Aug 22 11:03:50 2017 (r322780, copy of r322779, vendor/zstd/dist/circle.yml) @@ -0,0 +1,75 @@ +dependencies: + override: + - sudo dpkg --add-architecture i386 + - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; sudo apt-get -y -qq update + - sudo apt-get -y install gcc-powerpc-linux-gnu gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross + - sudo apt-get -y install libstdc++-7-dev clang gcc g++ gcc-5 gcc-6 gcc-7 zlib1g-dev liblzma-dev + - sudo apt-get -y install linux-libc-dev:i386 libc6-dev-i386 + +test: + override: + - ? | + if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then cc -v; make all && make clean; fi && + if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make gnu90build && make clean; fi + : + parallel: true + - ? | + if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make c99build && make clean; fi && + if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make gnu99build && make clean; fi + : + parallel: true + - ? | + if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make c11build && make clean; fi && + if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make cmakebuild && make clean; fi + : + parallel: true + - ? | + if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make gppbuild && make clean; fi && + if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make gcc5build && make clean; fi + : + parallel: true + - ? | + if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make gcc6build && make clean; fi && + if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make clangbuild && make clean; fi + : + parallel: true + - ? | + if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make m32build && make clean; fi && + if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make armbuild && make clean; fi + : + parallel: true + - ? | + if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make aarch64build && make clean; fi && + if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make ppcbuild && make clean; fi + : + parallel: true + - ? | + if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make ppc64build && make clean; fi && + if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make gcc7build && make clean; fi #could add another test here + : + parallel: true + - ? | + if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make shortest && make clean; fi && + if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make -C tests test-legacy test-longmatch test-symbols && make clean; fi + : + parallel: true + + post: + - echo Circle CI tests finished + + # Longer tests + #- make -C tests test-zstd-nolegacy && make clean + #- pyenv global 3.4.4; make -C tests versionsTest && make clean + #- make zlibwrapper && make clean + #- gcc -v; make -C tests test32 MOREFLAGS="-I/usr/include/x86_64-linux-gnu" && make clean + #- make uasan && make clean + #- make asan32 && make clean + #- make -C tests test32 CC=clang MOREFLAGS="-g -fsanitize=address -I/usr/include/x86_64-linux-gnu" + # Valgrind tests + #- CFLAGS="-O1 -g" make -C zlibWrapper valgrindTest && make clean + #- make -C tests valgrindTest && make clean + # ARM, AArch64, PowerPC, PowerPC64 tests + #- make ppctest && make clean + #- make ppc64test && make clean + #- make armtest && make clean + #- make aarch64test && make clean Copied: vendor/zstd/1.3.1/doc/educational_decoder/harness.c (from r322779, vendor/zstd/dist/doc/educational_decoder/harness.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/zstd/1.3.1/doc/educational_decoder/harness.c Tue Aug 22 11:03:50 2017 (r322780, copy of r322779, vendor/zstd/dist/doc/educational_decoder/harness.c) @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2017-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#include +#include + +#include "zstd_decompress.h" + +typedef unsigned char u8; + +// If the data doesn't have decompressed size with it, fallback on assuming the +// compression ratio is at most 16 +#define MAX_COMPRESSION_RATIO (16) + +// Protect against allocating too much memory for output +#define MAX_OUTPUT_SIZE ((size_t)1024 * 1024 * 1024) + +u8 *input; +u8 *output; +u8 *dict; + +size_t read_file(const char *path, u8 **ptr) { + FILE *f = fopen(path, "rb"); + if (!f) { + fprintf(stderr, "failed to open file %s\n", path); + exit(1); + } + + fseek(f, 0L, SEEK_END); + size_t size = ftell(f); + rewind(f); + + *ptr = malloc(size); + if (!ptr) { + fprintf(stderr, "failed to allocate memory to hold %s\n", path); + exit(1); + } + + size_t pos = 0; + while (!feof(f)) { + size_t read = fread(&(*ptr)[pos], 1, size, f); + if (ferror(f)) { + fprintf(stderr, "error while reading file %s\n", path); + exit(1); + } + pos += read; + } + + fclose(f); + + return pos; +} + +void write_file(const char *path, const u8 *ptr, size_t size) { + FILE *f = fopen(path, "wb"); + + size_t written = 0; + while (written < size) { + written += fwrite(&ptr[written], 1, size, f); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Aug 22 11:09:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E03CDE2311; Tue, 22 Aug 2017 11:09:17 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68ADF80D1F; Tue, 22 Aug 2017 11:09:17 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MB9Gup051407; Tue, 22 Aug 2017 11:09:16 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MB9GF1051406; Tue, 22 Aug 2017 11:09:16 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201708221109.v7MB9GF1051406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 22 Aug 2017 11:09:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322781 - vendor/zstd/dist/lib/common X-SVN-Group: vendor X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: vendor/zstd/dist/lib/common X-SVN-Commit-Revision: 322781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 11:09:17 -0000 Author: bapt Date: Tue Aug 22 11:09:16 2017 New Revision: 322781 URL: https://svnweb.freebsd.org/changeset/base/322781 Log: Add missing compiler.h Added: vendor/zstd/dist/lib/common/compiler.h (contents, props changed) Added: vendor/zstd/dist/lib/common/compiler.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/zstd/dist/lib/common/compiler.h Tue Aug 22 11:09:16 2017 (r322781) @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + */ + +#ifndef ZSTD_COMPILER_H +#define ZSTD_COMPILER_H + +/*-******************************************************* +* Compiler specifics +*********************************************************/ +/* force inlining */ +#if defined (__GNUC__) || defined(__cplusplus) || defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define INLINE_KEYWORD inline +#else +# define INLINE_KEYWORD +#endif + +#if defined(__GNUC__) +# define FORCE_INLINE_ATTR __attribute__((always_inline)) +#elif defined(_MSC_VER) +# define FORCE_INLINE_ATTR __forceinline +#else +# define FORCE_INLINE_ATTR +#endif + +/** + * FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant + * parameters. They must be inlined for the compiler to elimininate the constant + * branches. + */ +#define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR +/** + * HINT_INLINE is used to help the compiler generate better code. It is *not* + * used for "templates", so it can be tweaked based on the compilers + * performance. + * + * gcc-4.8 and gcc-4.9 have been shown to benefit from leaving off the + * always_inline attribute. + * + * clang up to 5.0.0 (trunk) benefit tremendously from the always_inline + * attribute. + */ +#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 && __GNUC__ < 5 +# define HINT_INLINE static INLINE_KEYWORD +#else +# define HINT_INLINE static INLINE_KEYWORD FORCE_INLINE_ATTR +#endif + +/* force no inlining */ +#ifdef _MSC_VER +# define FORCE_NOINLINE static __declspec(noinline) +#else +# ifdef __GNUC__ +# define FORCE_NOINLINE static __attribute__((__noinline__)) +# else +# define FORCE_NOINLINE static +# endif +#endif + +/* prefetch */ +#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */ +# include /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ +# define PREFETCH(ptr) _mm_prefetch((const char*)ptr, _MM_HINT_T0) +#elif defined(__GNUC__) +# define PREFETCH(ptr) __builtin_prefetch(ptr, 0, 0) +#else +# define PREFETCH(ptr) /* disabled */ +#endif + +/* disable warnings */ +#ifdef _MSC_VER /* Visual Studio */ +# include /* For Visual 2005 */ +# pragma warning(disable : 4100) /* disable: C4100: unreferenced formal parameter */ +# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ +# pragma warning(disable : 4204) /* disable: C4204: non-constant aggregate initializer */ +# pragma warning(disable : 4214) /* disable: C4214: non-int bitfields */ +# pragma warning(disable : 4324) /* disable: C4324: padded structure */ +#endif + +#endif /* ZSTD_COMPILER_H */ From owner-svn-src-all@freebsd.org Tue Aug 22 11:09:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2384ADE23AA; Tue, 22 Aug 2017 11:09:53 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C830280E4E; Tue, 22 Aug 2017 11:09:52 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MB9phf051471; Tue, 22 Aug 2017 11:09:51 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MB9pGt051470; Tue, 22 Aug 2017 11:09:51 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201708221109.v7MB9pGt051470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 22 Aug 2017 11:09:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322782 - vendor/zstd/1.3.1 X-SVN-Group: vendor X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: vendor/zstd/1.3.1 X-SVN-Commit-Revision: 322782 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 11:09:53 -0000 Author: bapt Date: Tue Aug 22 11:09:51 2017 New Revision: 322782 URL: https://svnweb.freebsd.org/changeset/base/322782 Log: Remove tag for zstandard 1.3.1 which was not imported properly Deleted: vendor/zstd/1.3.1/ From owner-svn-src-all@freebsd.org Tue Aug 22 11:11:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01105DE2614; Tue, 22 Aug 2017 11:11:12 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC7CF81004; Tue, 22 Aug 2017 11:11:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MBBA5G053005; Tue, 22 Aug 2017 11:11:10 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MBBA2o053004; Tue, 22 Aug 2017 11:11:10 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201708221111.v7MBBA2o053004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 22 Aug 2017 11:11:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322783 - vendor/zstd/1.3.1 X-SVN-Group: vendor X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: vendor/zstd/1.3.1 X-SVN-Commit-Revision: 322783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 11:11:12 -0000 Author: bapt Date: Tue Aug 22 11:11:10 2017 New Revision: 322783 URL: https://svnweb.freebsd.org/changeset/base/322783 Log: Tag import of zstandard 1.3.1 Added: vendor/zstd/1.3.1/ - copied from r322782, vendor/zstd/dist/ From owner-svn-src-all@freebsd.org Tue Aug 22 11:11:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 585B6DE27EE; Tue, 22 Aug 2017 11:11:52 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3A388130C; Tue, 22 Aug 2017 11:11:51 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MBBpRa055392; Tue, 22 Aug 2017 11:11:51 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MBBoTZ055381; Tue, 22 Aug 2017 11:11:50 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201708221111.v7MBBoTZ055381@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 22 Aug 2017 11:11:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322784 - in head/contrib/zstd: . doc doc/educational_decoder lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests tests/files tests/fuzz ... X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in head/contrib/zstd: . doc doc/educational_decoder lib lib/common lib/compress lib/decompress lib/deprecated lib/dictBuilder lib/legacy programs tests tests/files tests/fuzz zlibWrapper zlibWrapper/e... X-SVN-Commit-Revision: 322784 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 11:11:52 -0000 Author: bapt Date: Tue Aug 22 11:11:49 2017 New Revision: 322784 URL: https://svnweb.freebsd.org/changeset/base/322784 Log: Import zstandard 1.3.1 Added: head/contrib/zstd/lib/common/compiler.h - copied unchanged from r322782, vendor/zstd/dist/lib/common/compiler.h head/contrib/zstd/tests/files/ - copied from r322780, vendor/zstd/dist/tests/files/ head/contrib/zstd/tests/fuzz/ - copied from r322780, vendor/zstd/dist/tests/fuzz/ head/contrib/zstd/tests/poolTests.c - copied unchanged from r322780, vendor/zstd/dist/tests/poolTests.c Deleted: head/contrib/zstd/PATENTS head/contrib/zstd/tests/pool.c Modified: head/contrib/zstd/CONTRIBUTING.md head/contrib/zstd/Makefile head/contrib/zstd/NEWS head/contrib/zstd/README.md head/contrib/zstd/circle.yml head/contrib/zstd/doc/educational_decoder/harness.c head/contrib/zstd/doc/educational_decoder/zstd_decompress.c head/contrib/zstd/doc/educational_decoder/zstd_decompress.h head/contrib/zstd/doc/zstd_compression_format.md head/contrib/zstd/doc/zstd_manual.html head/contrib/zstd/lib/common/bitstream.h head/contrib/zstd/lib/common/error_private.c head/contrib/zstd/lib/common/error_private.h head/contrib/zstd/lib/common/fse.h head/contrib/zstd/lib/common/fse_decompress.c head/contrib/zstd/lib/common/huf.h head/contrib/zstd/lib/common/mem.h head/contrib/zstd/lib/common/pool.c head/contrib/zstd/lib/common/pool.h head/contrib/zstd/lib/common/threading.h head/contrib/zstd/lib/common/xxhash.c head/contrib/zstd/lib/common/zstd_common.c head/contrib/zstd/lib/common/zstd_errors.h head/contrib/zstd/lib/common/zstd_internal.h head/contrib/zstd/lib/compress/fse_compress.c head/contrib/zstd/lib/compress/huf_compress.c head/contrib/zstd/lib/compress/zstd_compress.c head/contrib/zstd/lib/compress/zstd_opt.h head/contrib/zstd/lib/compress/zstdmt_compress.c head/contrib/zstd/lib/compress/zstdmt_compress.h head/contrib/zstd/lib/decompress/huf_decompress.c head/contrib/zstd/lib/decompress/zstd_decompress.c head/contrib/zstd/lib/deprecated/zbuff.h head/contrib/zstd/lib/deprecated/zbuff_common.c head/contrib/zstd/lib/deprecated/zbuff_compress.c head/contrib/zstd/lib/deprecated/zbuff_decompress.c head/contrib/zstd/lib/dictBuilder/cover.c head/contrib/zstd/lib/dictBuilder/zdict.c head/contrib/zstd/lib/dictBuilder/zdict.h head/contrib/zstd/lib/legacy/zstd_legacy.h head/contrib/zstd/lib/legacy/zstd_v01.c head/contrib/zstd/lib/legacy/zstd_v01.h head/contrib/zstd/lib/legacy/zstd_v02.c head/contrib/zstd/lib/legacy/zstd_v02.h head/contrib/zstd/lib/legacy/zstd_v03.c head/contrib/zstd/lib/legacy/zstd_v03.h head/contrib/zstd/lib/legacy/zstd_v04.c head/contrib/zstd/lib/legacy/zstd_v04.h head/contrib/zstd/lib/legacy/zstd_v05.c head/contrib/zstd/lib/legacy/zstd_v05.h head/contrib/zstd/lib/legacy/zstd_v06.c head/contrib/zstd/lib/legacy/zstd_v06.h head/contrib/zstd/lib/legacy/zstd_v07.c head/contrib/zstd/lib/legacy/zstd_v07.h head/contrib/zstd/lib/zstd.h head/contrib/zstd/programs/.gitignore head/contrib/zstd/programs/Makefile head/contrib/zstd/programs/README.md head/contrib/zstd/programs/bench.c head/contrib/zstd/programs/bench.h head/contrib/zstd/programs/datagen.c head/contrib/zstd/programs/datagen.h head/contrib/zstd/programs/dibio.c head/contrib/zstd/programs/dibio.h head/contrib/zstd/programs/fileio.c head/contrib/zstd/programs/fileio.h head/contrib/zstd/programs/platform.h head/contrib/zstd/programs/util.h head/contrib/zstd/programs/zstd.1 head/contrib/zstd/programs/zstd.1.md head/contrib/zstd/programs/zstdcli.c head/contrib/zstd/tests/Makefile head/contrib/zstd/tests/datagencli.c head/contrib/zstd/tests/decodecorpus.c head/contrib/zstd/tests/fullbench.c head/contrib/zstd/tests/fuzzer.c head/contrib/zstd/tests/invalidDictionaries.c head/contrib/zstd/tests/legacy.c head/contrib/zstd/tests/longmatch.c head/contrib/zstd/tests/namespaceTest.c head/contrib/zstd/tests/paramgrill.c head/contrib/zstd/tests/playTests.sh head/contrib/zstd/tests/roundTripCrash.c head/contrib/zstd/tests/symbols.c head/contrib/zstd/tests/zbufftest.c head/contrib/zstd/tests/zstreamtest.c head/contrib/zstd/zlibWrapper/examples/zwrapbench.c head/contrib/zstd/zlibWrapper/gzcompatibility.h head/contrib/zstd/zlibWrapper/gzlib.c head/contrib/zstd/zlibWrapper/gzread.c head/contrib/zstd/zlibWrapper/gzwrite.c head/contrib/zstd/zlibWrapper/zstd_zlibwrapper.c head/contrib/zstd/zlibWrapper/zstd_zlibwrapper.h Directory Properties: head/contrib/zstd/ (props changed) Modified: head/contrib/zstd/CONTRIBUTING.md ============================================================================== --- head/contrib/zstd/CONTRIBUTING.md Tue Aug 22 11:11:10 2017 (r322783) +++ head/contrib/zstd/CONTRIBUTING.md Tue Aug 22 11:11:49 2017 (r322784) @@ -39,4 +39,4 @@ outlined on that page and do not file a public issue. ## License By contributing to Zstandard, you agree that your contributions will be licensed -under the [LICENSE](LICENSE) file in the root directory of this source tree. +under both the [LICENSE](LICENSE) file and the [COPYING](COPYING) file in the root directory of this source tree. Modified: head/contrib/zstd/Makefile ============================================================================== --- head/contrib/zstd/Makefile Tue Aug 22 11:11:10 2017 (r322783) +++ head/contrib/zstd/Makefile Tue Aug 22 11:11:49 2017 (r322784) @@ -74,14 +74,11 @@ zstdmt: zlibwrapper: $(MAKE) -C $(ZWRAPDIR) test -.PHONY: shortest -shortest: +.PHONY: test shortest +test shortest: + $(MAKE) -C $(PRGDIR) allVariants $(MAKE) -C $(TESTDIR) $@ -.PHONY: test -test: - $(MAKE) -C $(TESTDIR) $@ - .PHONY: examples examples: CPPFLAGS=-I../lib LDFLAGS=-L../lib $(MAKE) -C examples/ all @@ -146,6 +143,11 @@ gcc6build: clean gcc-6 -v CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror" +.PHONY: gcc7build +gcc7build: clean + gcc-7 -v + CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror" + .PHONY: clangbuild clangbuild: clean clang -v @@ -180,7 +182,7 @@ ppc64fuzz: clean CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest gpptest: clean - CC=g++ $(MAKE) -C $(PRGDIR) all CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" + CC=$(CXX) $(MAKE) -C $(PRGDIR) all CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" gcc5test: clean gcc-5 -v Modified: head/contrib/zstd/NEWS ============================================================================== --- head/contrib/zstd/NEWS Tue Aug 22 11:11:10 2017 (r322783) +++ head/contrib/zstd/NEWS Tue Aug 22 11:11:49 2017 (r322784) @@ -1,3 +1,18 @@ +v1.3.1 +New license : BSD + GPLv2 +perf: substantially decreased memory usage in Multi-threading mode, thanks to reports by Tino Reichardt (@mcmilk) +perf: Multi-threading supports up to 256 threads. Cap at 256 when more are requested (#760) +cli : improved and fixed --list command, by @ib (#772) +cli : command -vV to list supported formats, by @ib (#771) +build : fixed binary variants, reported by @svenha (#788) +build : fix Visual compilation for non x86/x64 targets, reported by Greg Slazinski (@GregSlazinski) (#718) +API exp : breaking change : ZSTD_getframeHeader() provides more information +API exp : breaking change : pinned down values of error codes +doc : fixed huffman example, by Ulrich Kunitz (@ulikunitz) +new : contrib/adaptive-compression, I/O driven compression strength, by Paul Cruz (@paulcruz74) +new : contrib/long_distance_matching, statistics by Stella Lau (@stellamplau) +updated : contrib/linux-kernel, by Nick Terrell (@terrelln) + v1.3.0 cli : new : `--list` command, by Paul Cruz cli : changed : xz/lzma support enabled by default Modified: head/contrib/zstd/README.md ============================================================================== --- head/contrib/zstd/README.md Tue Aug 22 11:11:10 2017 (r322783) +++ head/contrib/zstd/README.md Tue Aug 22 11:11:49 2017 (r322784) @@ -134,12 +134,12 @@ Going into `build` directory, you will find additional ### Status -Zstandard is currently deployed within Facebook. It is used daily to compress and decompress very large amounts of data in multiple formats and use cases. +Zstandard is currently deployed within Facebook. It is used continuously to compress large amounts of data in multiple formats and use cases. Zstandard is considered safe for production environments. ### License -Zstandard is [BSD-licensed](LICENSE). We also provide an [additional patent grant](PATENTS). +Zstandard is dual-licensed under [BSD](LICENSE) and [GPLv2](COPYING). ### Contributing Modified: head/contrib/zstd/circle.yml ============================================================================== --- head/contrib/zstd/circle.yml Tue Aug 22 11:11:10 2017 (r322783) +++ head/contrib/zstd/circle.yml Tue Aug 22 11:11:49 2017 (r322784) @@ -3,7 +3,7 @@ dependencies: - sudo dpkg --add-architecture i386 - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; sudo apt-get -y -qq update - sudo apt-get -y install gcc-powerpc-linux-gnu gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross - - sudo apt-get -y install libstdc++-6-dev clang gcc g++ gcc-5 gcc-6 zlib1g-dev liblzma-dev + - sudo apt-get -y install libstdc++-7-dev clang gcc g++ gcc-5 gcc-6 gcc-7 zlib1g-dev liblzma-dev - sudo apt-get -y install linux-libc-dev:i386 libc6-dev-i386 test: @@ -45,7 +45,7 @@ test: parallel: true - ? | if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make ppc64build && make clean; fi && - if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then true && make clean; fi #could add another test here + if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make gcc7build && make clean; fi #could add another test here : parallel: true - ? | @@ -64,7 +64,7 @@ test: #- gcc -v; make -C tests test32 MOREFLAGS="-I/usr/include/x86_64-linux-gnu" && make clean #- make uasan && make clean #- make asan32 && make clean - #- make -C tests test32 CC=clang MOREFLAGS="-g -fsanitize=address -I/usr/include/x86_64-linux-gnu" + #- make -C tests test32 CC=clang MOREFLAGS="-g -fsanitize=address -I/usr/include/x86_64-linux-gnu" # Valgrind tests #- CFLAGS="-O1 -g" make -C zlibWrapper valgrindTest && make clean #- make -C tests valgrindTest && make clean Modified: head/contrib/zstd/doc/educational_decoder/harness.c ============================================================================== --- head/contrib/zstd/doc/educational_decoder/harness.c Tue Aug 22 11:11:10 2017 (r322783) +++ head/contrib/zstd/doc/educational_decoder/harness.c Tue Aug 22 11:11:49 2017 (r322784) @@ -87,7 +87,7 @@ int main(int argc, char **argv) { } size_t decompressed_size = ZSTD_get_decompressed_size(input, input_size); - if (decompressed_size == -1) { + if (decompressed_size == (size_t)-1) { decompressed_size = MAX_COMPRESSION_RATIO * input_size; fprintf(stderr, "WARNING: Compressed data does not contain " "decompressed size, going to assume the compression " @@ -106,10 +106,16 @@ int main(int argc, char **argv) { return 1; } + dictionary_t* const parsed_dict = create_dictionary(); + if (dict) { + parse_dictionary(parsed_dict, dict, dict_size); + } size_t decompressed = ZSTD_decompress_with_dict(output, decompressed_size, - input, input_size, dict, dict_size); + input, input_size, parsed_dict); + free_dictionary(parsed_dict); + write_file(argv[2], output, decompressed); free(input); @@ -117,4 +123,3 @@ int main(int argc, char **argv) { free(dict); input = output = dict = NULL; } - Modified: head/contrib/zstd/doc/educational_decoder/zstd_decompress.c ============================================================================== --- head/contrib/zstd/doc/educational_decoder/zstd_decompress.c Tue Aug 22 11:11:10 2017 (r322783) +++ head/contrib/zstd/doc/educational_decoder/zstd_decompress.c Tue Aug 22 11:11:49 2017 (r322784) @@ -14,22 +14,8 @@ #include #include #include +#include "zstd_decompress.h" -/// Zstandard decompression functions. -/// `dst` must point to a space at least as large as the reconstructed output. -size_t ZSTD_decompress(void *const dst, const size_t dst_len, - const void *const src, const size_t src_len); -/// If `dict != NULL` and `dict_len >= 8`, does the same thing as -/// `ZSTD_decompress` but uses the provided dict -size_t ZSTD_decompress_with_dict(void *const dst, const size_t dst_len, - const void *const src, const size_t src_len, - const void *const dict, const size_t dict_len); - -/// Get the decompressed size of an input stream so memory can be allocated in -/// advance -/// Returns -1 if the size can't be determined -size_t ZSTD_get_decompressed_size(const void *const src, const size_t src_len); - /******* UTILITY MACROS AND TYPES *********************************************/ // Max block size decompressed size is 128 KB and literal blocks can't be // larger than their block @@ -108,10 +94,10 @@ static inline size_t IO_istream_len(const istream_t *c /// Advances the stream by `len` bytes, and returns a pointer to the chunk that /// was skipped. The stream must be byte aligned. -static inline const u8 *IO_read_bytes(istream_t *const in, size_t len); +static inline const u8 *IO_get_read_ptr(istream_t *const in, size_t len); /// Advances the stream by `len` bytes, and returns a pointer to the chunk that /// was skipped so it can be written to. -static inline u8 *IO_write_bytes(ostream_t *const out, size_t len); +static inline u8 *IO_get_write_ptr(ostream_t *const out, size_t len); /// Advance the inner state by `len` bytes. The stream must be byte aligned. static inline void IO_advance_input(istream_t *const in, size_t len); @@ -307,7 +293,7 @@ typedef struct { /// The decoded contents of a dictionary so that it doesn't have to be repeated /// for each frame that uses it -typedef struct { +struct dictionary_s { // Entropy tables HUF_dtable literals_dtable; FSE_dtable ll_dtable; @@ -322,7 +308,7 @@ typedef struct { u64 previous_offsets[3]; u32 dictionary_id; -} dictionary_t; +}; /// A tuple containing the parts necessary to decode and execute a ZSTD sequence /// command @@ -367,27 +353,36 @@ static void execute_sequences(frame_context_t *const c const sequence_command_t *const sequences, const size_t num_sequences); -// Parse a provided dictionary blob for use in decompression -static void parse_dictionary(dictionary_t *const dict, const u8 *src, - size_t src_len); -static void free_dictionary(dictionary_t *const dict); +// Copies literals and returns the total literal length that was copied +static u32 copy_literals(const size_t seq, istream_t *litstream, + ostream_t *const out); + +// Given an offset code from a sequence command (either an actual offset value +// or an index for previous offset), computes the correct offset and udpates +// the offset history +static size_t compute_offset(sequence_command_t seq, u64 *const offset_hist); + +// Given an offset, match length, and total output, as well as the frame +// context for the dictionary, determines if the dictionary is used and +// executes the copy operation +static void execute_match_copy(frame_context_t *const ctx, size_t offset, + size_t match_length, size_t total_output, + ostream_t *const out); + /******* END ZSTD HELPER STRUCTS AND PROTOTYPES *******************************/ size_t ZSTD_decompress(void *const dst, const size_t dst_len, const void *const src, const size_t src_len) { - return ZSTD_decompress_with_dict(dst, dst_len, src, src_len, NULL, 0); + dictionary_t* uninit_dict = create_dictionary(); + size_t const decomp_size = ZSTD_decompress_with_dict(dst, dst_len, src, + src_len, uninit_dict); + free_dictionary(uninit_dict); + return decomp_size; } size_t ZSTD_decompress_with_dict(void *const dst, const size_t dst_len, const void *const src, const size_t src_len, - const void *const dict, - const size_t dict_len) { - dictionary_t parsed_dict; - memset(&parsed_dict, 0, sizeof(dictionary_t)); - // dict_len < 8 is not a valid dictionary - if (dict && dict_len > 8) { - parse_dictionary(&parsed_dict, (const u8 *)dict, dict_len); - } + dictionary_t* parsed_dict) { istream_t in = IO_make_istream(src, src_len); ostream_t out = IO_make_ostream(dst, dst_len); @@ -396,11 +391,9 @@ size_t ZSTD_decompress_with_dict(void *const dst, cons // Multiple frames can be appended into a single file or stream. A frame is // totally independent, has a defined beginning and end, and a set of // parameters which tells the decoder how to decompress it." - while (IO_istream_len(&in) > 0) { - decode_frame(&out, &in, &parsed_dict); - } - free_dictionary(&parsed_dict); + /* this decoder assumes decompression of a single frame */ + decode_frame(&out, &in, parsed_dict); return out.ptr - (u8 *)dst; } @@ -424,30 +417,6 @@ static void decompress_data(frame_context_t *const ctx static void decode_frame(ostream_t *const out, istream_t *const in, const dictionary_t *const dict) { const u32 magic_number = IO_read_bits(in, 32); - - // Skippable frame - // - // "Magic_Number - // - // 4 Bytes, little-endian format. Value : 0x184D2A5?, which means any value - // from 0x184D2A50 to 0x184D2A5F. All 16 values are valid to identify a - // skippable frame." - if ((magic_number & ~0xFU) == 0x184D2A50U) { - // "Skippable frames allow the insertion of user-defined data into a - // flow of concatenated frames. Its design is pretty straightforward, - // with the sole objective to allow the decoder to quickly skip over - // user-defined data and continue decoding. - // - // Skippable frames defined in this specification are compatible with - // LZ4 ones." - const size_t frame_size = IO_read_bits(in, 32); - - // skip over frame - IO_advance_input(in, frame_size); - - return; - } - // Zstandard frame // // "Magic_Number @@ -460,8 +429,8 @@ static void decode_frame(ostream_t *const out, istream return; } - // not a real frame - ERROR("Invalid magic number"); + // not a real frame or a skippable frame + ERROR("Tried to decode non-ZSTD frame"); } /// Decode a frame that contains compressed data. Not all frames do as there @@ -672,8 +641,8 @@ static void decompress_data(frame_context_t *const ctx case 0: { // "Raw_Block - this is an uncompressed block. Block_Size is the // number of bytes to read and copy." - const u8 *const read_ptr = IO_read_bytes(in, block_len); - u8 *const write_ptr = IO_write_bytes(out, block_len); + const u8 *const read_ptr = IO_get_read_ptr(in, block_len); + u8 *const write_ptr = IO_get_write_ptr(out, block_len); // Copy the raw data into the output memcpy(write_ptr, read_ptr, block_len); @@ -685,8 +654,8 @@ static void decompress_data(frame_context_t *const ctx // "RLE_Block - this is a single byte, repeated N times. In which // case, Block_Size is the size to regenerate, while the // "compressed" block is just 1 byte (the byte to repeat)." - const u8 *const read_ptr = IO_read_bytes(in, 1); - u8 *const write_ptr = IO_write_bytes(out, block_len); + const u8 *const read_ptr = IO_get_read_ptr(in, 1); + u8 *const write_ptr = IO_get_write_ptr(out, block_len); // Copy `block_len` copies of `read_ptr[0]` to the output memset(write_ptr, read_ptr[0], block_len); @@ -832,13 +801,13 @@ static size_t decode_literals_simple(istream_t *const switch (block_type) { case 0: { // "Raw_Literals_Block - Literals are stored uncompressed." - const u8 *const read_ptr = IO_read_bytes(in, size); + const u8 *const read_ptr = IO_get_read_ptr(in, size); memcpy(*literals, read_ptr, size); break; } case 1: { // "RLE_Literals_Block - Literals consist of a single byte value repeated N times." - const u8 *const read_ptr = IO_read_bytes(in, 1); + const u8 *const read_ptr = IO_get_read_ptr(in, 1); memset(*literals, read_ptr[0], size); break; } @@ -949,7 +918,7 @@ static void decode_huf_table(HUF_dtable *const dtable, num_symbs = header - 127; const size_t bytes = (num_symbs + 1) / 2; - const u8 *const weight_src = IO_read_bytes(in, bytes); + const u8 *const weight_src = IO_get_read_ptr(in, bytes); for (int i = 0; i < num_symbs; i++) { // "They are encoded forward, 2 @@ -1157,7 +1126,7 @@ static void decompress_sequences(frame_context_t *cons } const size_t len = IO_istream_len(in); - const u8 *const src = IO_read_bytes(in, len); + const u8 *const src = IO_get_read_ptr(in, len); // "After writing the last bit containing information, the compressor writes // a single 1-bit and then fills the byte with 0-7 0 bits of padding." @@ -1262,7 +1231,7 @@ static void decode_seq_table(FSE_dtable *const table, } case seq_rle: { // "RLE_Mode : it's a single code, repeated Number_of_Sequences times." - const u8 symb = IO_read_bytes(in, 1)[0]; + const u8 symb = IO_get_read_ptr(in, 1)[0]; FSE_init_dtable_rle(table, symb); break; } @@ -1303,145 +1272,146 @@ static void execute_sequences(frame_context_t *const c for (size_t i = 0; i < num_sequences; i++) { const sequence_command_t seq = sequences[i]; - { - // If the sequence asks for more literals than are left, the - // sequence must be corrupted - if (seq.literal_length > IO_istream_len(&litstream)) { - CORRUPTION(); - } + const u32 literals_size = copy_literals(seq.literal_length, &litstream, out); + total_output += literals_size; + } - u8 *const write_ptr = IO_write_bytes(out, seq.literal_length); - const u8 *const read_ptr = - IO_read_bytes(&litstream, seq.literal_length); - // Copy literals to output - memcpy(write_ptr, read_ptr, seq.literal_length); + size_t const offset = compute_offset(seq, offset_hist); - total_output += seq.literal_length; - } + size_t const match_length = seq.match_length; - size_t offset; + execute_match_copy(ctx, offset, match_length, total_output, out); - // Offsets are special, we need to handle the repeat offsets - if (seq.offset <= 3) { - // "The first 3 values define a repeated offset and we will call - // them Repeated_Offset1, Repeated_Offset2, and Repeated_Offset3. - // They are sorted in recency order, with Repeated_Offset1 meaning - // 'most recent one'". + total_output += match_length; + } - // Use 0 indexing for the array - u32 idx = seq.offset - 1; - if (seq.literal_length == 0) { - // "There is an exception though, when current sequence's - // literals length is 0. In this case, repeated offsets are - // shifted by one, so Repeated_Offset1 becomes Repeated_Offset2, - // Repeated_Offset2 becomes Repeated_Offset3, and - // Repeated_Offset3 becomes Repeated_Offset1 - 1_byte." - idx++; - } + // Copy any leftover literals + { + size_t len = IO_istream_len(&litstream); + copy_literals(len, &litstream, out); + total_output += len; + } - if (idx == 0) { - offset = offset_hist[0]; - } else { - // If idx == 3 then literal length was 0 and the offset was 3, - // as per the exception listed above - offset = idx < 3 ? offset_hist[idx] : offset_hist[0] - 1; + ctx->current_total_output = total_output; +} - // If idx == 1 we don't need to modify offset_hist[2], since - // we're using the second-most recent code - if (idx > 1) { - offset_hist[2] = offset_hist[1]; - } - offset_hist[1] = offset_hist[0]; - offset_hist[0] = offset; - } +static u32 copy_literals(const size_t literal_length, istream_t *litstream, + ostream_t *const out) { + // If the sequence asks for more literals than are left, the + // sequence must be corrupted + if (literal_length > IO_istream_len(litstream)) { + CORRUPTION(); + } + + u8 *const write_ptr = IO_get_write_ptr(out, literal_length); + const u8 *const read_ptr = + IO_get_read_ptr(litstream, literal_length); + // Copy literals to output + memcpy(write_ptr, read_ptr, literal_length); + + return literal_length; +} + +static size_t compute_offset(sequence_command_t seq, u64 *const offset_hist) { + size_t offset; + // Offsets are special, we need to handle the repeat offsets + if (seq.offset <= 3) { + // "The first 3 values define a repeated offset and we will call + // them Repeated_Offset1, Repeated_Offset2, and Repeated_Offset3. + // They are sorted in recency order, with Repeated_Offset1 meaning + // 'most recent one'". + + // Use 0 indexing for the array + u32 idx = seq.offset - 1; + if (seq.literal_length == 0) { + // "There is an exception though, when current sequence's + // literals length is 0. In this case, repeated offsets are + // shifted by one, so Repeated_Offset1 becomes Repeated_Offset2, + // Repeated_Offset2 becomes Repeated_Offset3, and + // Repeated_Offset3 becomes Repeated_Offset1 - 1_byte." + idx++; + } + + if (idx == 0) { + offset = offset_hist[0]; } else { - // When it's not a repeat offset: - // "if (Offset_Value > 3) offset = Offset_Value - 3;" - offset = seq.offset - 3; + // If idx == 3 then literal length was 0 and the offset was 3, + // as per the exception listed above + offset = idx < 3 ? offset_hist[idx] : offset_hist[0] - 1; - // Shift back history - offset_hist[2] = offset_hist[1]; + // If idx == 1 we don't need to modify offset_hist[2], since + // we're using the second-most recent code + if (idx > 1) { + offset_hist[2] = offset_hist[1]; + } offset_hist[1] = offset_hist[0]; offset_hist[0] = offset; } + } else { + // When it's not a repeat offset: + // "if (Offset_Value > 3) offset = Offset_Value - 3;" + offset = seq.offset - 3; - size_t match_length = seq.match_length; + // Shift back history + offset_hist[2] = offset_hist[1]; + offset_hist[1] = offset_hist[0]; + offset_hist[0] = offset; + } + return offset; +} - u8 *write_ptr = IO_write_bytes(out, match_length); - if (total_output <= ctx->header.window_size) { - // In this case offset might go back into the dictionary - if (offset > total_output + ctx->dict_content_len) { - // The offset goes beyond even the dictionary - CORRUPTION(); - } - - if (offset > total_output) { - // "The rest of the dictionary is its content. The content act - // as a "past" in front of data to compress or decompress, so it - // can be referenced in sequence commands." - const size_t dict_copy = - MIN(offset - total_output, match_length); - const size_t dict_offset = - ctx->dict_content_len - (offset - total_output); - - memcpy(write_ptr, ctx->dict_content + dict_offset, dict_copy); - write_ptr += dict_copy; - match_length -= dict_copy; - } - } else if (offset > ctx->header.window_size) { +static void execute_match_copy(frame_context_t *const ctx, size_t offset, + size_t match_length, size_t total_output, + ostream_t *const out) { + u8 *write_ptr = IO_get_write_ptr(out, match_length); + if (total_output <= ctx->header.window_size) { + // In this case offset might go back into the dictionary + if (offset > total_output + ctx->dict_content_len) { + // The offset goes beyond even the dictionary CORRUPTION(); } - // We must copy byte by byte because the match length might be larger - // than the offset - // ex: if the output so far was "abc", a command with offset=3 and - // match_length=6 would produce "abcabcabc" as the new output - for (size_t i = 0; i < match_length; i++) { - *write_ptr = *(write_ptr - offset); - write_ptr++; - } + if (offset > total_output) { + // "The rest of the dictionary is its content. The content act + // as a "past" in front of data to compress or decompress, so it + // can be referenced in sequence commands." + const size_t dict_copy = + MIN(offset - total_output, match_length); + const size_t dict_offset = + ctx->dict_content_len - (offset - total_output); - total_output += seq.match_length; + memcpy(write_ptr, ctx->dict_content + dict_offset, dict_copy); + write_ptr += dict_copy; + match_length -= dict_copy; + } + } else if (offset > ctx->header.window_size) { + CORRUPTION(); } - // Copy any leftover literals - { - size_t len = IO_istream_len(&litstream); - u8 *const write_ptr = IO_write_bytes(out, len); - const u8 *const read_ptr = IO_read_bytes(&litstream, len); - memcpy(write_ptr, read_ptr, len); - - total_output += len; + // We must copy byte by byte because the match length might be larger + // than the offset + // ex: if the output so far was "abc", a command with offset=3 and + // match_length=6 would produce "abcabcabc" as the new output + for (size_t j = 0; j < match_length; j++) { + *write_ptr = *(write_ptr - offset); + write_ptr++; } - - ctx->current_total_output = total_output; } /******* END SEQUENCE EXECUTION ***********************************************/ /******* OUTPUT SIZE COUNTING *************************************************/ -static void traverse_frame(const frame_header_t *const header, istream_t *const in); - /// Get the decompressed size of an input stream so memory can be allocated in /// advance. -/// This is more complex than the implementation in the reference -/// implementation, as this API allows for the decompression of multiple -/// concatenated frames. +/// This implementation assumes `src` points to a single ZSTD-compressed frame size_t ZSTD_get_decompressed_size(const void *src, const size_t src_len) { istream_t in = IO_make_istream(src, src_len); - size_t dst_size = 0; - // Each frame header only gives us the size of its frame, so iterate over - // all - // frames - while (IO_istream_len(&in) > 0) { + // get decompressed size from ZSTD frame header + { const u32 magic_number = IO_read_bits(&in, 32); - if ((magic_number & ~0xFU) == 0x184D2A50U) { - // skippable frame, this has no impact on output size - const size_t frame_size = IO_read_bits(&in, 32); - IO_advance_input(&in, frame_size); - } else if (magic_number == 0xFD2FB528U) { + if (magic_number == 0xFD2FB528U) { // ZSTD frame frame_header_t header; parse_frame_header(&header, &in); @@ -1451,68 +1421,42 @@ size_t ZSTD_get_decompressed_size(const void *src, con return -1; } - dst_size += header.frame_content_size; - - // Consume the input from the frame to reach the start of the next - traverse_frame(&header, &in); + return header.frame_content_size; } else { - // not a real frame - ERROR("Invalid magic number"); + // not a real frame or skippable frame + ERROR("ZSTD frame magic number did not match"); } } - - return dst_size; } +/******* END OUTPUT SIZE COUNTING *********************************************/ -/// Iterate over each block in a frame to find the end of it, to get to the -/// start of the next frame -static void traverse_frame(const frame_header_t *const header, istream_t *const in) { - int last_block = 0; +/******* DICTIONARY PARSING ***************************************************/ +#define DICT_SIZE_ERROR() ERROR("Dictionary size cannot be less than 8 bytes") +#define NULL_SRC() ERROR("Tried to create dictionary with pointer to null src"); - do { - // Parse the block header - last_block = IO_read_bits(in, 1); - const int block_type = IO_read_bits(in, 2); - const size_t block_len = IO_read_bits(in, 21); - - switch (block_type) { - case 0: // Raw block, block_len bytes - IO_advance_input(in, block_len); - break; - case 1: // RLE block, 1 byte - IO_advance_input(in, 1); - break; - case 2: // Compressed block, compressed size is block_len - IO_advance_input(in, block_len); - break; - case 3: - // Reserved block type - CORRUPTION(); - break; - default: - IMPOSSIBLE(); - } - } while (!last_block); - - if (header->content_checksum_flag) { - IO_advance_input(in, 4); +dictionary_t* create_dictionary() { + dictionary_t* dict = calloc(1, sizeof(dictionary_t)); + if (!dict) { + BAD_ALLOC(); } + return dict; } -/******* END OUTPUT SIZE COUNTING *********************************************/ - -/******* DICTIONARY PARSING ***************************************************/ static void init_dictionary_content(dictionary_t *const dict, istream_t *const in); -static void parse_dictionary(dictionary_t *const dict, const u8 *src, +void parse_dictionary(dictionary_t *const dict, const void *src, size_t src_len) { + const u8 *byte_src = (const u8 *)src; memset(dict, 0, sizeof(dictionary_t)); + if (src == NULL) { /* cannot initialize dictionary with null src */ + NULL_SRC(); + } if (src_len < 8) { - INP_SIZE(); + DICT_SIZE_ERROR(); } - istream_t in = IO_make_istream(src, src_len); + istream_t in = IO_make_istream(byte_src, src_len); const u32 magic_number = IO_read_bits(&in, 32); if (magic_number != 0xEC30A437) { @@ -1564,13 +1508,13 @@ static void init_dictionary_content(dictionary_t *cons BAD_ALLOC(); } - const u8 *const content = IO_read_bytes(in, dict->content_size); + const u8 *const content = IO_get_read_ptr(in, dict->content_size); memcpy(dict->content, content, dict->content_size); } /// Free an allocated dictionary -static void free_dictionary(dictionary_t *const dict) { +void free_dictionary(dictionary_t *const dict) { HUF_free_dtable(&dict->literals_dtable); FSE_free_dtable(&dict->ll_dtable); FSE_free_dtable(&dict->of_dtable); @@ -1579,6 +1523,8 @@ static void free_dictionary(dictionary_t *const dict) free(dict->content); memset(dict, 0, sizeof(dictionary_t)); + + free(dict); } /******* END DICTIONARY PARSING ***********************************************/ @@ -1657,7 +1603,7 @@ static inline size_t IO_istream_len(const istream_t *c /// Returns a pointer where `len` bytes can be read, and advances the internal /// state. The stream must be byte aligned. -static inline const u8 *IO_read_bytes(istream_t *const in, size_t len) { +static inline const u8 *IO_get_read_ptr(istream_t *const in, size_t len) { if (len > in->len) { INP_SIZE(); } @@ -1671,7 +1617,7 @@ static inline const u8 *IO_read_bytes(istream_t *const return ptr; } /// Returns a pointer to write `len` bytes to, and advances the internal state -static inline u8 *IO_write_bytes(ostream_t *const out, size_t len) { +static inline u8 *IO_get_write_ptr(ostream_t *const out, size_t len) { if (len > out->len) { OUT_SIZE(); } @@ -1710,7 +1656,7 @@ static inline istream_t IO_make_istream(const u8 *in, /// `in` must be byte aligned static inline istream_t IO_make_sub_istream(istream_t *const in, size_t len) { // Consume `len` bytes of the parent stream - const u8 *const ptr = IO_read_bytes(in, len); + const u8 *const ptr = IO_get_read_ptr(in, len); // Make a substream using the pointer to those `len` bytes return IO_make_istream(ptr, len); @@ -1814,7 +1760,7 @@ static size_t HUF_decompress_1stream(const HUF_dtable if (len == 0) { INP_SIZE(); } - const u8 *const src = IO_read_bytes(in, len); + const u8 *const src = IO_get_read_ptr(in, len); // "Each bitstream must be read backward, that is starting from the end down // to the beginning. Therefore it's necessary to know the size of each @@ -2065,7 +2011,7 @@ static size_t FSE_decompress_interleaved2(const FSE_dt if (len == 0) { INP_SIZE(); } - const u8 *const src = IO_read_bytes(in, len); + const u8 *const src = IO_get_read_ptr(in, len); // "Each bitstream must be read backward, that is starting from the end down // to the beginning. Therefore it's necessary to know the size of each @@ -2192,7 +2138,7 @@ static void FSE_init_dtable(FSE_dtable *const dtable, } // Now we can fill baseline and num bits - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { u8 symbol = dtable->symbols[i]; u16 next_state_desc = state_desc[symbol]++; // Fills in the table appropriately, next_state_desc increases by symbol @@ -2355,4 +2301,3 @@ static void FSE_copy_dtable(FSE_dtable *const dst, con memcpy(dst->new_state_base, src->new_state_base, size * sizeof(u16)); } /******* END FSE PRIMITIVES ***************************************************/ - Modified: head/contrib/zstd/doc/educational_decoder/zstd_decompress.h ============================================================================== --- head/contrib/zstd/doc/educational_decoder/zstd_decompress.h Tue Aug 22 11:11:10 2017 (r322783) +++ head/contrib/zstd/doc/educational_decoder/zstd_decompress.h Tue Aug 22 11:11:49 2017 (r322784) @@ -7,10 +7,52 @@ * of patent rights can be found in the PATENTS file in the same directory. */ +/******* EXPOSED TYPES ********************************************************/ +/* +* Contains the parsed contents of a dictionary +* This includes Huffman and FSE tables used for decoding and data on offsets +*/ +typedef struct dictionary_s dictionary_t; +/******* END EXPOSED TYPES ****************************************************/ + +/******* DECOMPRESSION FUNCTIONS **********************************************/ +/// Zstandard decompression functions. +/// `dst` must point to a space at least as large as the reconstructed output. size_t ZSTD_decompress(void *const dst, const size_t dst_len, - const void *const src, const size_t src_len); + const void *const src, const size_t src_len); + +/// If `dict != NULL` and `dict_len >= 8`, does the same thing as +/// `ZSTD_decompress` but uses the provided dict size_t ZSTD_decompress_with_dict(void *const dst, const size_t dst_len, - const void *const src, const size_t src_len, - const void *const dict, const size_t dict_len); + const void *const src, const size_t src_len, + dictionary_t* parsed_dict); + +/// Get the decompressed size of an input stream so memory can be allocated in +/// advance +/// Returns -1 if the size can't be determined +/// Assumes decompression of a single frame size_t ZSTD_get_decompressed_size(const void *const src, const size_t src_len); +/******* END DECOMPRESSION FUNCTIONS ******************************************/ +/******* DICTIONARY MANAGEMENT ***********************************************/ +/* + * Return a valid dictionary_t pointer for use with dictionary initialization + * or decompression + */ +dictionary_t* create_dictionary(); + +/* + * Parse a provided dictionary blob for use in decompression + * `src` -- must point to memory space representing the dictionary + * `src_len` -- must provide the dictionary size + * `dict` -- will contain the parsed contents of the dictionary and + * can be used for decompression + */ +void parse_dictionary(dictionary_t *const dict, const void *src, + size_t src_len); + +/* + * Free internal Huffman tables, FSE tables, and dictionary content + */ +void free_dictionary(dictionary_t *const dict); +/******* END DICTIONARY MANAGEMENT *******************************************/ Modified: head/contrib/zstd/doc/zstd_compression_format.md ============================================================================== --- head/contrib/zstd/doc/zstd_compression_format.md Tue Aug 22 11:11:10 2017 (r322783) +++ head/contrib/zstd/doc/zstd_compression_format.md Tue Aug 22 11:11:49 2017 (r322784) @@ -16,7 +16,7 @@ Distribution of this document is unlimited. ### Version -0.2.5 (31/03/17) +0.2.6 (19/08/17) Introduction @@ -106,7 +106,7 @@ The structure of a single Zstandard frame is following | `Magic_Number` | `Frame_Header` |`Data_Block`| [More data blocks] | [`Content_Checksum`] | |:--------------:|:--------------:|:----------:| ------------------ |:--------------------:| -| 4 bytes | 2-14 bytes | n bytes | | 0-4 bytes | +| 4 bytes | 2-14 bytes | n bytes | | 0-4 bytes | __`Magic_Number`__ @@ -1249,23 +1249,30 @@ Consequently, a last byte of `0` is not possible. And the final-bit-flag itself is not part of the useful bitstream. Hence, the last byte contains between 0 and 7 useful bits. -For example, if the literal sequence "0145" was encoded using the prefix codes above, -it would be encoded as: -``` -00000001 01110000 -``` +Starting from the end, +it's possible to read the bitstream in a __little-endian__ fashion, +keeping track of already used bits. Since the bitstream is encoded in reverse +order, starting from the end read symbols in forward order. +For example, if the literal sequence "0145" was encoded using above prefix code, +it would be encoded (in reverse order) as: + |Symbol | 5 | 4 | 1 | 0 | Padding | |--------|------|------|----|---|---------| -|Encoding|`0000`|`0001`|`01`|`1`| `10000` | +|Encoding|`0000`|`0001`|`01`|`1`| `00001` | -Starting from the end, -it's possible to read the bitstream in a __little-endian__ fashion, -keeping track of already used bits. Since the bitstream is encoded in reverse -order, by starting at the end the symbols can be read in forward order. +Resulting in following 2-bytes bitstream : +``` +00010000 00001101 +``` -Reading the last `Max_Number_of_Bits` bits, -it's then possible to compare extracted value to decoding table, +Here is an alternative representation with the symbol codes separated by underscore: +``` +0001_0000 00001_1_01 +``` + +Reading highest `Max_Number_of_Bits` bits, +it's possible to compare extracted value to decoding table, determining the symbol to decode and number of bits to discard. The process continues up to reading the required number of symbols per stream. @@ -1516,12 +1523,13 @@ to crosscheck that an implementation build its decodin Version changes --------------- +- 0.2.6 : fixed an error in huffman example, by Ulrich Kunitz - 0.2.5 : minor typos and clarifications - 0.2.4 : section restructuring, by Sean Purcell - 0.2.3 : clarified several details, by Sean Purcell - 0.2.2 : added predefined codes, by Johannes Rudolph - 0.2.1 : clarify field names, by Przemyslaw Skibinski -- 0.2.0 : numerous format adjustments for zstd v0.8 +- 0.2.0 : numerous format adjustments for zstd v0.8+ - 0.1.2 : limit Huffman tree depth to 11 bits - 0.1.1 : reserved dictID ranges - 0.1.0 : initial release Modified: head/contrib/zstd/doc/zstd_manual.html ============================================================================== --- head/contrib/zstd/doc/zstd_manual.html Tue Aug 22 11:11:10 2017 (r322783) +++ head/contrib/zstd/doc/zstd_manual.html Tue Aug 22 11:11:49 2017 (r322784) @@ -1,10 +1,10 @@ -zstd 1.3.0 Manual +zstd 1.3.1 Manual -

    zstd 1.3.0 Manual

    +

    zstd 1.3.1 Manual


    Contents

      @@ -73,29 +73,43 @@ or an errorCode if it fails (which can be tested using ZSTD_isError()).


    -
    unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize);
    -

    NOTE: This function is planned to be obsolete, in favor of ZSTD_getFrameContentSize(). - ZSTD_getFrameContentSize() works the same way, - returning the decompressed size of a single frame, - but distinguishes empty frames from frames with an unknown size, or errors. - - 'src' is the start of a zstd compressed frame. - @return : content size to be decompressed, as a 64-bits value _if known_, 0 otherwise. - note 1 : decompressed size is an optional field, it may not be present, typically in streaming mode. - When `return==0`, data to decompress could be any size. +

    #define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
    +#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
    +unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize);
    +

    `src` should point to the start of a ZSTD encoded frame. + `srcSize` must be at least as large as the frame header. + hint : any size >= `ZSTD_frameHeaderSize_max` is large enough. + @return : - decompressed size of the frame in `src`, if known + - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined + - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small) + note 1 : a 0 return value means the frame is valid but "empty". + note 2 : decompressed size is an optional field, it may not be present, typically in streaming mode. + When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size. In which case, it's necessary to use streaming mode to decompress data. - Optionally, application can use ZSTD_decompress() while relying on implied limits. - (For example, data may be necessarily cut into blocks <= 16 KB). - note 2 : decompressed size is always present when compression is done with ZSTD_compress() - note 3 : decompressed size can be very large (64-bits value), + Optionally, application can rely on some implicit limit, + as ZSTD_decompress() only needs an upper bound of decompressed size. + (For example, data could be necessarily cut into blocks <= 16 KB). + note 3 : decompressed size is always present when compression is done with ZSTD_compress() + note 4 : decompressed size can be very large (64-bits value), potentially larger than what local system can handle as a single memory segment. In which case, it's necessary to use streaming mode to decompress data. - note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified. - Always ensure result fits within application's authorized limits. + note 5 : If source is untrusted, decompressed size could be wrong or intentionally modified. + Always ensure return value fits within application's authorized limits. Each application can set its own limits. - note 5 : when `return==0`, if precise failure cause is needed, use ZSTD_getFrameHeader() to know more. + note 6 : This function replaces ZSTD_getDecompressedSize()


    *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Aug 22 13:08:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC2A8DEA1F0; Tue, 22 Aug 2017 13:08:23 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BC7F1055; Tue, 22 Aug 2017 13:08:23 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MD8MVS001891; Tue, 22 Aug 2017 13:08:22 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MD8MXs001890; Tue, 22 Aug 2017 13:08:22 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708221308.v7MD8MXs001890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Tue, 22 Aug 2017 13:08:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322785 - head/usr.sbin/camdd X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: head/usr.sbin/camdd X-SVN-Commit-Revision: 322785 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 13:08:23 -0000 Author: ken Date: Tue Aug 22 13:08:22 2017 New Revision: 322785 URL: https://svnweb.freebsd.org/changeset/base/322785 Log: Restructure camdd(8) slightly to make it easier to add support for additional protocols. Submitted by: Chuck Tuffli MFC after: 1 week Differential Revision: D11230 Modified: head/usr.sbin/camdd/camdd.c Modified: head/usr.sbin/camdd/camdd.c ============================================================================== --- head/usr.sbin/camdd/camdd.c Tue Aug 22 11:11:49 2017 (r322784) +++ head/usr.sbin/camdd/camdd.c Tue Aug 22 13:08:22 2017 (r322785) @@ -260,6 +260,7 @@ struct camdd_buf { struct camdd_dev_pass { int scsi_dev_type; + int protocol; struct cam_device *dev; uint64_t max_sector; uint32_t block_len; @@ -477,6 +478,9 @@ uint32_t camdd_buf_get_len(struct camdd_buf *buf); void camdd_buf_add_child(struct camdd_buf *buf, struct camdd_buf *child_buf); int camdd_probe_tape(int fd, char *filename, uint64_t *max_iosize, uint64_t *max_blk, uint64_t *min_blk, uint64_t *blk_gran); +int camdd_probe_pass_scsi(struct cam_device *cam_dev, union ccb *ccb, + camdd_argmask arglist, int probe_retry_count, + int probe_timeout, uint64_t *maxsector, uint32_t *block_len); struct camdd_dev *camdd_probe_file(int fd, struct camdd_io_opts *io_opts, int retry_count, int timeout); struct camdd_dev *camdd_probe_pass(struct cam_device *cam_dev, @@ -485,7 +489,8 @@ struct camdd_dev *camdd_probe_pass(struct cam_device * int probe_timeout, int io_retry_count, int io_timeout); void *camdd_file_worker(void *arg); -camdd_buf_status camdd_ccb_status(union ccb *ccb); +camdd_buf_status camdd_ccb_status(union ccb *ccb, int protocol); +int camdd_get_cgd(struct cam_device *device, struct ccb_getdev *cgd); int camdd_queue_peer_buf(struct camdd_dev *dev, struct camdd_buf *buf); int camdd_complete_peer_buf(struct camdd_dev *dev, struct camdd_buf *peer_buf); void camdd_peer_done(struct camdd_buf *buf); @@ -1248,56 +1253,59 @@ bailout_error: } /* - * Need to implement this. Do a basic probe: - * - Check the inquiry data, make sure we're talking to a device that we - * can reasonably expect to talk to -- direct, RBC, CD, WORM. - * - Send a test unit ready, make sure the device is available. - * - Get the capacity and block size. + * Get a get device CCB for the specified device. */ -struct camdd_dev * -camdd_probe_pass(struct cam_device *cam_dev, struct camdd_io_opts *io_opts, - camdd_argmask arglist, int probe_retry_count, - int probe_timeout, int io_retry_count, int io_timeout) +int +camdd_get_cgd(struct cam_device *device, struct ccb_getdev *cgd) { - union ccb *ccb; - uint64_t maxsector; - uint32_t cpi_maxio, max_iosize, pass_numblocks; - uint32_t block_len; - struct scsi_read_capacity_data rcap; - struct scsi_read_capacity_data_long rcaplong; - struct camdd_dev *dev; - struct camdd_dev_pass *pass_dev; - struct kevent ke; - int scsi_dev_type; + union ccb *ccb; + int retval = 0; - dev = NULL; + ccb = cam_getccb(device); + + if (ccb == NULL) { + warnx("%s: couldn't allocate CCB", __func__); + return -1; + } - scsi_dev_type = SID_TYPE(&cam_dev->inq_data); - maxsector = 0; - block_len = 0; + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cgd); - /* - * For devices that support READ CAPACITY, we'll attempt to get the - * capacity. Otherwise, we really don't support tape or other - * devices via SCSI passthrough, so just return an error in that case. - */ - switch (scsi_dev_type) { - case T_DIRECT: - case T_WORM: - case T_CDROM: - case T_OPTICAL: - case T_RBC: - case T_ZBC_HM: - break; - default: - errx(1, "Unsupported SCSI device type %d", scsi_dev_type); - break; /*NOTREACHED*/ + ccb->ccb_h.func_code = XPT_GDEV_TYPE; + + if (cam_send_ccb(device, ccb) < 0) { + warn("%s: error sending Get Device Information CCB", __func__); + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + retval = -1; + goto bailout; } - ccb = cam_getccb(cam_dev); + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + retval = -1; + goto bailout; + } + bcopy(&ccb->cgd, cgd, sizeof(struct ccb_getdev)); + +bailout: + cam_freeccb(ccb); + + return retval; +} + +int +camdd_probe_pass_scsi(struct cam_device *cam_dev, union ccb *ccb, + camdd_argmask arglist, int probe_retry_count, + int probe_timeout, uint64_t *maxsector, uint32_t *block_len) +{ + struct scsi_read_capacity_data rcap; + struct scsi_read_capacity_data_long rcaplong; + int retval = -1; + if (ccb == NULL) { - warnx("%s: error allocating ccb", __func__); + warnx("%s: error passed ccb is NULL", __func__); goto bailout; } @@ -1331,16 +1339,18 @@ camdd_probe_pass(struct cam_device *cam_dev, struct ca goto bailout; } - maxsector = scsi_4btoul(rcap.addr); - block_len = scsi_4btoul(rcap.length); + *maxsector = scsi_4btoul(rcap.addr); + *block_len = scsi_4btoul(rcap.length); /* * A last block of 2^32-1 means that the true capacity is over 2TB, * and we need to issue the long READ CAPACITY to get the real * capacity. Otherwise, we're all set. */ - if (maxsector != 0xffffffff) - goto rcap_done; + if (*maxsector != 0xffffffff) { + retval = 0; + goto bailout; + } scsi_read_capacity_16(&ccb->csio, /*retries*/ probe_retry_count, @@ -1372,10 +1382,83 @@ camdd_probe_pass(struct cam_device *cam_dev, struct ca goto bailout; } - maxsector = scsi_8btou64(rcaplong.addr); - block_len = scsi_4btoul(rcaplong.length); + *maxsector = scsi_8btou64(rcaplong.addr); + *block_len = scsi_4btoul(rcaplong.length); -rcap_done: + retval = 0; + +bailout: + return retval; +} + +/* + * Need to implement this. Do a basic probe: + * - Check the inquiry data, make sure we're talking to a device that we + * can reasonably expect to talk to -- direct, RBC, CD, WORM. + * - Send a test unit ready, make sure the device is available. + * - Get the capacity and block size. + */ +struct camdd_dev * +camdd_probe_pass(struct cam_device *cam_dev, struct camdd_io_opts *io_opts, + camdd_argmask arglist, int probe_retry_count, + int probe_timeout, int io_retry_count, int io_timeout) +{ + union ccb *ccb; + uint64_t maxsector = 0; + uint32_t cpi_maxio, max_iosize, pass_numblocks; + uint32_t block_len = 0; + struct camdd_dev *dev = NULL; + struct camdd_dev_pass *pass_dev; + struct kevent ke; + struct ccb_getdev cgd; + int retval; + int scsi_dev_type; + + if ((retval = camdd_get_cgd(cam_dev, &cgd)) != 0) { + warnx("%s: error retrieving CGD", __func__); + return NULL; + } + + ccb = cam_getccb(cam_dev); + + if (ccb == NULL) { + warnx("%s: error allocating ccb", __func__); + goto bailout; + } + + switch (cgd.protocol) { + case PROTO_SCSI: + scsi_dev_type = SID_TYPE(&cam_dev->inq_data); + + /* + * For devices that support READ CAPACITY, we'll attempt to get the + * capacity. Otherwise, we really don't support tape or other + * devices via SCSI passthrough, so just return an error in that case. + */ + switch (scsi_dev_type) { + case T_DIRECT: + case T_WORM: + case T_CDROM: + case T_OPTICAL: + case T_RBC: + case T_ZBC_HM: + break; + default: + errx(1, "Unsupported SCSI device type %d", scsi_dev_type); + break; /*NOTREACHED*/ + } + + if ((retval = camdd_probe_pass_scsi(cam_dev, ccb, probe_retry_count, + arglist, probe_timeout, &maxsector, + &block_len))) { + goto bailout; + } + break; + default: + errx(1, "Unsupported PROTO type %d", cgd.protocol); + break; /*NOTREACHED*/ + } + if (block_len == 0) { warnx("Sector size for %s%u is 0, cannot continue", cam_dev->device_name, cam_dev->dev_unit_num); @@ -1405,6 +1488,7 @@ rcap_done: pass_dev = &dev->dev_spec.pass; pass_dev->scsi_dev_type = scsi_dev_type; + pass_dev->protocol = cgd.protocol; pass_dev->dev = cam_dev; pass_dev->max_sector = maxsector; pass_dev->block_len = block_len; @@ -1715,43 +1799,50 @@ bailout: * Simplistic translation of CCB status to our local status. */ camdd_buf_status -camdd_ccb_status(union ccb *ccb) +camdd_ccb_status(union ccb *ccb, int protocol) { camdd_buf_status status = CAMDD_STATUS_NONE; cam_status ccb_status; ccb_status = ccb->ccb_h.status & CAM_STATUS_MASK; - switch (ccb_status) { - case CAM_REQ_CMP: { - if (ccb->csio.resid == 0) { - status = CAMDD_STATUS_OK; - } else if (ccb->csio.dxfer_len > ccb->csio.resid) { - status = CAMDD_STATUS_SHORT_IO; - } else { - status = CAMDD_STATUS_EOF; + switch (protocol) { + case PROTO_SCSI: + switch (ccb_status) { + case CAM_REQ_CMP: { + if (ccb->csio.resid == 0) { + status = CAMDD_STATUS_OK; + } else if (ccb->csio.dxfer_len > ccb->csio.resid) { + status = CAMDD_STATUS_SHORT_IO; + } else { + status = CAMDD_STATUS_EOF; + } + break; } - break; - } - case CAM_SCSI_STATUS_ERROR: { - switch (ccb->csio.scsi_status) { - case SCSI_STATUS_OK: - case SCSI_STATUS_COND_MET: - case SCSI_STATUS_INTERMED: - case SCSI_STATUS_INTERMED_COND_MET: - status = CAMDD_STATUS_OK; + case CAM_SCSI_STATUS_ERROR: { + switch (ccb->csio.scsi_status) { + case SCSI_STATUS_OK: + case SCSI_STATUS_COND_MET: + case SCSI_STATUS_INTERMED: + case SCSI_STATUS_INTERMED_COND_MET: + status = CAMDD_STATUS_OK; + break; + case SCSI_STATUS_CMD_TERMINATED: + case SCSI_STATUS_CHECK_COND: + case SCSI_STATUS_QUEUE_FULL: + case SCSI_STATUS_BUSY: + case SCSI_STATUS_RESERV_CONFLICT: + default: + status = CAMDD_STATUS_ERROR; + break; + } break; - case SCSI_STATUS_CMD_TERMINATED: - case SCSI_STATUS_CHECK_COND: - case SCSI_STATUS_QUEUE_FULL: - case SCSI_STATUS_BUSY: - case SCSI_STATUS_RESERV_CONFLICT: + } default: status = CAMDD_STATUS_ERROR; break; } break; - } default: status = CAMDD_STATUS_ERROR; break; @@ -2149,11 +2240,18 @@ camdd_pass_fetch(struct camdd_dev *dev) CAM_EPF_ALL, stderr); } - data->resid = ccb.csio.resid; - dev->bytes_transferred += (ccb.csio.dxfer_len - ccb.csio.resid); + switch (pass_dev->protocol) { + case PROTO_SCSI: + data->resid = ccb.csio.resid; + dev->bytes_transferred += (ccb.csio.dxfer_len - ccb.csio.resid); + break; + default: + return -1; + break; + } if (buf->status == CAMDD_STATUS_NONE) - buf->status = camdd_ccb_status(&ccb); + buf->status = camdd_ccb_status(&ccb, pass_dev->protocol); if (buf->status == CAMDD_STATUS_ERROR) error_count++; else if (buf->status == CAMDD_STATUS_EOF) { @@ -2433,9 +2531,6 @@ camdd_pass_run(struct camdd_dev *dev) data = &buf->buf_type_spec.data; - ccb = &data->ccb; - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - /* * In almost every case the number of blocks should be the device * block size. The exception may be at the end of an I/O stream @@ -2446,22 +2541,37 @@ camdd_pass_run(struct camdd_dev *dev) else num_blocks = data->fill_len / pass_dev->block_len; - scsi_read_write(&ccb->csio, - /*retries*/ dev->retry_count, - /*cbfcnp*/ NULL, - /*tag_action*/ MSG_SIMPLE_Q_TAG, - /*readop*/ (dev->write_dev == 0) ? SCSI_RW_READ : - SCSI_RW_WRITE, - /*byte2*/ 0, - /*minimum_cmd_size*/ dev->min_cmd_size, - /*lba*/ buf->lba, - /*block_count*/ num_blocks, - /*data_ptr*/ (data->sg_count != 0) ? - (uint8_t *)data->segs : data->buf, - /*dxfer_len*/ (num_blocks * pass_dev->block_len), - /*sense_len*/ SSD_FULL_SIZE, - /*timeout*/ dev->io_timeout); + ccb = &data->ccb; + switch (pass_dev->protocol) { + case PROTO_SCSI: + CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); + + scsi_read_write(&ccb->csio, + /*retries*/ dev->retry_count, + /*cbfcnp*/ NULL, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*readop*/ (dev->write_dev == 0) ? SCSI_RW_READ : + SCSI_RW_WRITE, + /*byte2*/ 0, + /*minimum_cmd_size*/ dev->min_cmd_size, + /*lba*/ buf->lba, + /*block_count*/ num_blocks, + /*data_ptr*/ (data->sg_count != 0) ? + (uint8_t *)data->segs : data->buf, + /*dxfer_len*/ (num_blocks * pass_dev->block_len), + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ dev->io_timeout); + + if (data->sg_count != 0) { + ccb->csio.sglist_cnt = data->sg_count; + } + break; + default: + retval = -1; + goto bailout; + } + /* Disable freezing the device queue */ ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; @@ -2469,7 +2579,6 @@ camdd_pass_run(struct camdd_dev *dev) ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (data->sg_count != 0) { - ccb->csio.sglist_cnt = data->sg_count; ccb->ccb_h.flags |= CAM_DATA_SG; } From owner-svn-src-all@freebsd.org Tue Aug 22 13:16:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8AC4DEA854; Tue, 22 Aug 2017 13:16:15 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C20531620; Tue, 22 Aug 2017 13:16:15 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MDGECA005963; Tue, 22 Aug 2017 13:16:14 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MDGEP0005957; Tue, 22 Aug 2017 13:16:14 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708221316.v7MDGEP0005957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 22 Aug 2017 13:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322786 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 322786 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 13:16:16 -0000 Author: andrew Date: Tue Aug 22 13:16:14 2017 New Revision: 322786 URL: https://svnweb.freebsd.org/changeset/base/322786 Log: Move the l0 pagetable address to struct mdproc. It is a property of the whole process so should live there. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/genassym.c head/sys/arm64/arm64/pmap.c head/sys/arm64/arm64/swtch.S head/sys/arm64/arm64/vm_machdep.c head/sys/arm64/include/pcb.h head/sys/arm64/include/proc.h Modified: head/sys/arm64/arm64/genassym.c ============================================================================== --- head/sys/arm64/arm64/genassym.c Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/arm64/genassym.c Tue Aug 22 13:16:14 2017 (r322786) @@ -50,12 +50,15 @@ ASSYM(PCB_SINGLE_STEP_SHIFT, PCB_SINGLE_STEP_SHIFT); ASSYM(PCB_REGS, offsetof(struct pcb, pcb_x)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0)); -ASSYM(PCB_L0ADDR, offsetof(struct pcb, pcb_l0addr)); ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); +ASSYM(P_MD, offsetof(struct proc, p_md)); +ASSYM(MD_L0ADDR, offsetof(struct mdproc, md_l0addr)); + ASSYM(SF_UC, offsetof(struct sigframe, sf_uc)); +ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); ASSYM(TD_FRAME, offsetof(struct thread, td_frame)); Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/arm64/pmap.c Tue Aug 22 13:16:14 2017 (r322786) @@ -4662,8 +4662,9 @@ pmap_activate(struct thread *td) critical_enter(); pmap = vmspace_pmap(td->td_proc->p_vmspace); - td->td_pcb->pcb_l0addr = vtophys(pmap->pm_l0); - __asm __volatile("msr ttbr0_el1, %0" : : "r"(td->td_pcb->pcb_l0addr)); + td->td_proc->p_md.md_l0addr = vtophys(pmap->pm_l0); + __asm __volatile("msr ttbr0_el1, %0" : : + "r"(td->td_proc->p_md.md_l0addr)); pmap_invalidate_all(pmap); critical_exit(); } Modified: head/sys/arm64/arm64/swtch.S ============================================================================== --- head/sys/arm64/arm64/swtch.S Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/arm64/swtch.S Tue Aug 22 13:16:14 2017 (r322786) @@ -86,7 +86,8 @@ ENTRY(cpu_throw) */ /* Switch to the new pmap */ - ldr x5, [x4, #PCB_L0ADDR] + ldr x28, [x1, #TD_PROC] + ldr x5, [x28, #(P_MD + MD_L0ADDR)] msr ttbr0_el1, x5 isb @@ -186,8 +187,15 @@ ENTRY(cpu_switch) * to a user process. */ + /* + * Load the proc pointers. If these are the same then we are in the + * same process so don't need to switch page tables or issue a + * TLB invalidate. + */ + ldr x28, [x1, #TD_PROC] + /* Switch to the new pmap */ - ldr x5, [x4, #PCB_L0ADDR] + ldr x5, [x28, #(P_MD + MD_L0ADDR)] msr ttbr0_el1, x5 isb Modified: head/sys/arm64/arm64/vm_machdep.c ============================================================================== --- head/sys/arm64/arm64/vm_machdep.c Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/arm64/vm_machdep.c Tue Aug 22 13:16:14 2017 (r322786) @@ -91,7 +91,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t td2->td_pcb = pcb2; bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); - td2->td_pcb->pcb_l0addr = + td2->td_proc->p_md.md_l0addr = vtophys(vmspace_pmap(td2->td_proc->p_vmspace)->pm_l0); tf = (struct trapframe *)STACKALIGN((struct trapframe *)pcb2 - 1); Modified: head/sys/arm64/include/pcb.h ============================================================================== --- head/sys/arm64/include/pcb.h Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/include/pcb.h Tue Aug 22 13:16:14 2017 (r322786) @@ -43,7 +43,6 @@ struct pcb { uint64_t pcb_sp; uint64_t pcb_tpidr_el0; uint64_t pcb_tpidrro_el0; - vm_offset_t pcb_l0addr; /* Fault handler, the error value is passed in x0 */ vm_offset_t pcb_onfault; Modified: head/sys/arm64/include/proc.h ============================================================================== --- head/sys/arm64/include/proc.h Tue Aug 22 13:08:22 2017 (r322785) +++ head/sys/arm64/include/proc.h Tue Aug 22 13:16:14 2017 (r322786) @@ -40,7 +40,7 @@ struct mdthread { }; struct mdproc { - int dummy; + vm_offset_t md_l0addr; }; #define KINFO_PROC_SIZE 1088 From owner-svn-src-all@freebsd.org Tue Aug 22 13:53:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F343EDECAD3; Tue, 22 Aug 2017 13:53:54 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2B313030; Tue, 22 Aug 2017 13:53:54 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MDrsb4022435; Tue, 22 Aug 2017 13:53:54 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MDrscO022434; Tue, 22 Aug 2017 13:53:54 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708221353.v7MDrscO022434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 22 Aug 2017 13:53:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322787 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 322787 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 13:53:55 -0000 Author: andrew Date: Tue Aug 22 13:53:53 2017 New Revision: 322787 URL: https://svnweb.freebsd.org/changeset/base/322787 Log: Fix a comment on uncommitted work. Modified: head/sys/arm64/arm64/swtch.S Modified: head/sys/arm64/arm64/swtch.S ============================================================================== --- head/sys/arm64/arm64/swtch.S Tue Aug 22 13:16:14 2017 (r322786) +++ head/sys/arm64/arm64/swtch.S Tue Aug 22 13:53:53 2017 (r322787) @@ -187,11 +187,7 @@ ENTRY(cpu_switch) * to a user process. */ - /* - * Load the proc pointers. If these are the same then we are in the - * same process so don't need to switch page tables or issue a - * TLB invalidate. - */ + /* Load the new proc address */ ldr x28, [x1, #TD_PROC] /* Switch to the new pmap */ From owner-svn-src-all@freebsd.org Tue Aug 22 13:59:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC6F7DECF8F; Tue, 22 Aug 2017 13:59:51 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B74D63359; Tue, 22 Aug 2017 13:59:51 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MDxoXW022709; Tue, 22 Aug 2017 13:59:50 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MDxo32022708; Tue, 22 Aug 2017 13:59:50 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708221359.v7MDxo32022708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Tue, 22 Aug 2017 13:59:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322788 - stable/11/usr.bin/mt X-SVN-Group: stable-11 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: stable/11/usr.bin/mt X-SVN-Commit-Revision: 322788 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 13:59:52 -0000 Author: ken Date: Tue Aug 22 13:59:50 2017 New Revision: 322788 URL: https://svnweb.freebsd.org/changeset/base/322788 Log: MFC r322410: ------------------------------------------------------------------------ r322410 | ken | 2017-08-11 12:43:52 -0600 (Fri, 11 Aug 2017) | 16 lines Add historical notes on QIC tape drives and fix a couple of issues in mt(1). o Density code 0x5 is also known as QIC-11, and should have a footnote reference. o Add notes on QIC tape drives from the bug report. These may help anyone trying to use a QIC drive. o Take out a "more more" instance found by igor. o Bump the man page date. The PR is 14 years old, so it's past time to retire it. PR: doc/53596 Submitted by: tedm@toybox.placo.com Reviewed by: bcr Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/11/usr.bin/mt/mt.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/mt/mt.1 ============================================================================== --- stable/11/usr.bin/mt/mt.1 Tue Aug 22 13:53:53 2017 (r322787) +++ stable/11/usr.bin/mt/mt.1 Tue Aug 22 13:59:50 2017 (r322788) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd August 3, 2017 +.Dd August 11, 2017 .Dt MT 1 .Os .Sh NAME @@ -333,7 +333,7 @@ The default protection method used is Reed-Solomon CRC 1), as specified in ECMA-319. The default protection information length used with Reed-Solomon CRC is 4 bytes. -To enable all settings except one more more settings, specify the +To enable all settings except one more setting, specify the .Fl e argument and then explicitly disable settings that you do not wish to enable. @@ -463,7 +463,7 @@ Value Width Tracks Density Code Typ 0x01 12.7 (0.5) 9 32 (800) NRZI R X3.22-1983 2 0x02 12.7 (0.5) 9 63 (1,600) PE R X3.39-1986 2 0x03 12.7 (0.5) 9 246 (6,250) GCR R X3.54-1986 2 -0x05 6.3 (0.25) 4/9 315 (8,000) GCR C X3.136-1986 1 +0x05 6.3 (0.25) 4/9 315 (8,000) GCR C X3.136-1986 1,3 0x06 12.7 (0.5) 9 126 (3,200) PE R X3.157-1987 2 0x07 6.3 (0.25) 4 252 (6,400) IMFM C X3.116-1986 1 0x08 3.81 (0.15) 4 315 (8,000) GCR CS X3.158-1987 1 @@ -566,6 +566,60 @@ NOTES density code is 0x8c. 13. This density code (0x48) was also used for DAT-160. .Ed +.Bd -literal -offset 2n +NOTE ON QIC STREAMERS + +The following is a table of Data Cartridge types as used in the 1/4 inch +tape drives such as the Archive Viper 150, Wangtek 5525ES, and Tandberg +TDC4220 tape drives: + +Value Reference Format Cartridge Type Capacity Tracks Length +----- --------- ------ -------------- -------- ------ ------ + +0x05 QIC-11 DC300 15MB 4 300ft +0x05 QIC-11 DC300XL/P 20MB 4 450ft +0x05 QIC-11 DC600 27MB 4 600ft +0x05 X3.136-1986 QIC-24 DC615A 15MB 9 150ft +0x05 X3.136-1986 QIC-24 DC300XL/P 45MB 9 450ft +0x05 X3.136-1986 QIC-24 DC600A 60MB 9 600ft +0x0F QIC-120 QIC-120 DC600A/DC6150 120MB 15 620ft +0x10 QIC-150 QIC-150 DC600XTD/DC6150 150MB 18 620ft +0x10 QIC-150 QIC-150 DC6250 250MB 18 1,020ft +0x11 QIC-320 QIC-525 DC6320 320MB 26 620ft +0x11 QIC-320 QIC-525 DC6525 525MB 26 1,020ft +0x1E QIC-1000C QIC-1000 DC9100/DL9135 1.0GB 30 760ft +0x1E QIC-1000C QIC-1000 DC9150 1.2GB 30 950ft +0x22 QIC-2GB(C) QIC-2GB DC9200 2.0GB 42 950ft +0x22 QIC-2GB(C) QIC-2GB DC9250 2.5GB 42 1,200ft +.Ed +.Pp +Notes: +.Pp +QIC-24, QIC-120, QIC-150 use fixed blocksize of 512 bytes, QIC-525, QIC-1000 +and QIC-2GB can use blocksize of 1,024 bytes. +DDS (DAT) drives generally use variable blocks. +.Pp +QIC-02 and QIC-36 are interface standards for tape drives. +The QIC-02 and QIC-36 streamers such as the Wangtek 5250EQ are otherwise +identical to their SCSI versions (i.e.: Wangtek 5250ES). +.Pp +It seems that the 150MB and larger streamers cannot write QIC-24 9 track +formats, only read them. +.Pp +DC600A cartridges marked "10,000ftpi" can only be used as QIC-11, QIC-24, +and QIC-120 format. +DC600A cartridges marked 12,500ftpi can be used as both QIC-120 and QIC-150 +format. +.Pp +Some manufacturers do not use "DC" on their cartridges. +Verbatim uses DL, Maxell uses MC, Sony uses QD, Quill uses DQ. +.Pp +3M/Imation & Fuji use DC. +Thus a DL6250, MC-6250, QD6250, DQ6250 are all identical media to a DC6250. +.Pp +QIC tape media is not "connected" to the take up reels and will de-spool +if the tape drive has dust covering the light sensor that looks for the end +of tape holes in the media. .Sh ENVIRONMENT .Bl -tag -width ".Ev TAPE" .It Ev TAPE From owner-svn-src-all@freebsd.org Tue Aug 22 14:40:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19C58DEF3D7; Tue, 22 Aug 2017 14:40:58 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E546263CBF; Tue, 22 Aug 2017 14:40:57 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MEevKA039109; Tue, 22 Aug 2017 14:40:57 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MEevsh039108; Tue, 22 Aug 2017 14:40:57 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708221440.v7MEevsh039108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Tue, 22 Aug 2017 14:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322790 - stable/10/usr.bin/mt X-SVN-Group: stable-10 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: stable/10/usr.bin/mt X-SVN-Commit-Revision: 322790 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 14:40:58 -0000 Author: ken Date: Tue Aug 22 14:40:56 2017 New Revision: 322790 URL: https://svnweb.freebsd.org/changeset/base/322790 Log: MFC r322410: ------------------------------------------------------------------------ r322410 | ken | 2017-08-11 12:43:52 -0600 (Fri, 11 Aug 2017) | 16 lines Add historical notes on QIC tape drives and fix a couple of issues in mt(1). o Density code 0x5 is also known as QIC-11, and should have a footnote reference. o Add notes on QIC tape drives from the bug report. These may help anyone trying to use a QIC drive. o Take out a "more more" instance found by igor. o Bump the man page date. The PR is 14 years old, so it's past time to retire it. PR: doc/53596 Submitted by: tedm@toybox.placo.com Reviewed by: bcr Sponsored by: Spectra Logic ------------------------------------------------------------------------ Approved by: re (gjb) Modified: stable/10/usr.bin/mt/mt.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/mt/mt.1 ============================================================================== --- stable/10/usr.bin/mt/mt.1 Tue Aug 22 14:06:43 2017 (r322789) +++ stable/10/usr.bin/mt/mt.1 Tue Aug 22 14:40:56 2017 (r322790) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd August 3, 2017 +.Dd August 11, 2017 .Dt MT 1 .Os .Sh NAME @@ -333,7 +333,7 @@ The default protection method used is Reed-Solomon CRC 1), as specified in ECMA-319. The default protection information length used with Reed-Solomon CRC is 4 bytes. -To enable all settings except one more more settings, specify the +To enable all settings except one more setting, specify the .Fl e argument and then explicitly disable settings that you do not wish to enable. @@ -463,7 +463,7 @@ Value Width Tracks Density Code Typ 0x01 12.7 (0.5) 9 32 (800) NRZI R X3.22-1983 2 0x02 12.7 (0.5) 9 63 (1,600) PE R X3.39-1986 2 0x03 12.7 (0.5) 9 246 (6,250) GCR R X3.54-1986 2 -0x05 6.3 (0.25) 4/9 315 (8,000) GCR C X3.136-1986 1 +0x05 6.3 (0.25) 4/9 315 (8,000) GCR C X3.136-1986 1,3 0x06 12.7 (0.5) 9 126 (3,200) PE R X3.157-1987 2 0x07 6.3 (0.25) 4 252 (6,400) IMFM C X3.116-1986 1 0x08 3.81 (0.15) 4 315 (8,000) GCR CS X3.158-1987 1 @@ -566,6 +566,60 @@ NOTES density code is 0x8c. 13. This density code (0x48) was also used for DAT-160. .Ed +.Bd -literal -offset 2n +NOTE ON QIC STREAMERS + +The following is a table of Data Cartridge types as used in the 1/4 inch +tape drives such as the Archive Viper 150, Wangtek 5525ES, and Tandberg +TDC4220 tape drives: + +Value Reference Format Cartridge Type Capacity Tracks Length +----- --------- ------ -------------- -------- ------ ------ + +0x05 QIC-11 DC300 15MB 4 300ft +0x05 QIC-11 DC300XL/P 20MB 4 450ft +0x05 QIC-11 DC600 27MB 4 600ft +0x05 X3.136-1986 QIC-24 DC615A 15MB 9 150ft +0x05 X3.136-1986 QIC-24 DC300XL/P 45MB 9 450ft +0x05 X3.136-1986 QIC-24 DC600A 60MB 9 600ft +0x0F QIC-120 QIC-120 DC600A/DC6150 120MB 15 620ft +0x10 QIC-150 QIC-150 DC600XTD/DC6150 150MB 18 620ft +0x10 QIC-150 QIC-150 DC6250 250MB 18 1,020ft +0x11 QIC-320 QIC-525 DC6320 320MB 26 620ft +0x11 QIC-320 QIC-525 DC6525 525MB 26 1,020ft +0x1E QIC-1000C QIC-1000 DC9100/DL9135 1.0GB 30 760ft +0x1E QIC-1000C QIC-1000 DC9150 1.2GB 30 950ft +0x22 QIC-2GB(C) QIC-2GB DC9200 2.0GB 42 950ft +0x22 QIC-2GB(C) QIC-2GB DC9250 2.5GB 42 1,200ft +.Ed +.Pp +Notes: +.Pp +QIC-24, QIC-120, QIC-150 use fixed blocksize of 512 bytes, QIC-525, QIC-1000 +and QIC-2GB can use blocksize of 1,024 bytes. +DDS (DAT) drives generally use variable blocks. +.Pp +QIC-02 and QIC-36 are interface standards for tape drives. +The QIC-02 and QIC-36 streamers such as the Wangtek 5250EQ are otherwise +identical to their SCSI versions (i.e.: Wangtek 5250ES). +.Pp +It seems that the 150MB and larger streamers cannot write QIC-24 9 track +formats, only read them. +.Pp +DC600A cartridges marked "10,000ftpi" can only be used as QIC-11, QIC-24, +and QIC-120 format. +DC600A cartridges marked 12,500ftpi can be used as both QIC-120 and QIC-150 +format. +.Pp +Some manufacturers do not use "DC" on their cartridges. +Verbatim uses DL, Maxell uses MC, Sony uses QD, Quill uses DQ. +.Pp +3M/Imation & Fuji use DC. +Thus a DL6250, MC-6250, QD6250, DQ6250 are all identical media to a DC6250. +.Pp +QIC tape media is not "connected" to the take up reels and will de-spool +if the tape drive has dust covering the light sensor that looks for the end +of tape holes in the media. .Sh ENVIRONMENT .Bl -tag -width ".Ev TAPE" .It Ev TAPE From owner-svn-src-all@freebsd.org Tue Aug 22 15:16:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29228DC8963; Tue, 22 Aug 2017 15:16:11 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E69A265B54; Tue, 22 Aug 2017 15:16:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MFGA41056351; Tue, 22 Aug 2017 15:16:10 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MFGAwl056350; Tue, 22 Aug 2017 15:16:10 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708221516.v7MFGAwl056350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 22 Aug 2017 15:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322791 - stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil X-SVN-Commit-Revision: 322791 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 15:16:11 -0000 Author: ngie Date: Tue Aug 22 15:16:09 2017 New Revision: 322791 URL: https://svnweb.freebsd.org/changeset/base/322791 Log: MFC r321387: Don't use incorrect hardcoded path to ksh -- use /usr/bin/env to find ksh instead Modified: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/man.CoalesceTrace.d Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/man.CoalesceTrace.d ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/man.CoalesceTrace.d Tue Aug 22 14:40:56 2017 (r322790) +++ stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/man.CoalesceTrace.d Tue Aug 22 15:16:09 2017 (r322791) @@ -1,4 +1,4 @@ -#!/bin/ksh -p +#!/usr/bin/env ksh -p /* * CDDL HEADER START From owner-svn-src-all@freebsd.org Tue Aug 22 15:20:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE941DC8F7D; Tue, 22 Aug 2017 15:20:49 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B385365F58; Tue, 22 Aug 2017 15:20:49 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MFKmhH056608; Tue, 22 Aug 2017 15:20:48 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MFKmJ7056606; Tue, 22 Aug 2017 15:20:48 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708221520.v7MFKmJ7056606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 22 Aug 2017 15:20:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322792 - stable/11/sys/geom/journal X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/11/sys/geom/journal X-SVN-Commit-Revision: 322792 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 15:20:50 -0000 Author: mckusick Date: Tue Aug 22 15:20:48 2017 New Revision: 322792 URL: https://svnweb.freebsd.org/changeset/base/322792 Log: MFC of 322179, 322463, and 322464: 322179: Correct ordering of bio's in gjournal queue 322463: Eliminate a variable that is set-only in g_journal.c 322464: Correct check for reads in gjournal Submitted by: Dr. Andreas Longwitz Discussed with: kib Modified: stable/11/sys/geom/journal/g_journal.c stable/11/sys/geom/journal/g_journal.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/journal/g_journal.c ============================================================================== --- stable/11/sys/geom/journal/g_journal.c Tue Aug 22 15:16:09 2017 (r322791) +++ stable/11/sys/geom/journal/g_journal.c Tue Aug 22 15:20:48 2017 (r322792) @@ -1236,7 +1236,7 @@ g_journal_flush(struct g_journal_softc *sc) struct g_provider *pp; struct bio **bioq; struct bio *bp, *fbp, *pbp; - off_t joffset, size; + off_t joffset; u_char *data, hash[16]; MD5_CTX ctx; u_int i; @@ -1244,7 +1244,6 @@ g_journal_flush(struct g_journal_softc *sc) if (sc->sc_current_count == 0) return; - size = 0; pp = sc->sc_jprovider; GJ_VALIDATE_OFFSET(sc->sc_journal_offset, sc); joffset = sc->sc_journal_offset; @@ -1261,7 +1260,7 @@ g_journal_flush(struct g_journal_softc *sc) strlcpy(hdr.jrh_magic, GJ_RECORD_HEADER_MAGIC, sizeof(hdr.jrh_magic)); bioq = &sc->sc_active.jj_queue; - pbp = sc->sc_flush_queue; + GJQ_LAST(sc->sc_flush_queue, pbp); fbp = g_alloc_bio(); fbp->bio_parent = NULL; @@ -1294,7 +1293,6 @@ g_journal_flush(struct g_journal_softc *sc) ent->je_offset = bp->bio_offset; ent->je_joffset = joffset; ent->je_length = bp->bio_length; - size += ent->je_length; data = bp->bio_data; if (sc->sc_flags & GJF_DEVICE_CHECKSUM) @@ -1516,49 +1514,10 @@ g_journal_read_find(struct bio *head, int sorted, stru } /* - * Try to find requested data in cache. - */ -static struct bio * -g_journal_read_queue_find(struct bio_queue *head, struct bio *pbp, off_t ostart, - off_t oend) -{ - off_t cstart, cend; - struct bio *bp; - - TAILQ_FOREACH(bp, head, bio_queue) { - cstart = MAX(ostart, bp->bio_offset); - cend = MIN(oend, bp->bio_offset + bp->bio_length); - if (cend <= ostart) - continue; - else if (cstart >= oend) - continue; - KASSERT(bp->bio_data != NULL, - ("%s: bio_data == NULL", __func__)); - GJ_DEBUG(3, "READ(%p): (%jd, %jd) (bp=%p)", head, cstart, cend, - bp); - bcopy(bp->bio_data + cstart - bp->bio_offset, - pbp->bio_data + cstart - pbp->bio_offset, cend - cstart); - pbp->bio_completed += cend - cstart; - if (pbp->bio_completed == pbp->bio_length) { - /* - * Cool, the whole request was in cache, deliver happy - * message. - */ - g_io_deliver(pbp, 0); - return (pbp); - } - break; - } - return (bp); -} - -/* - * This function is used for colecting data on read. + * This function is used for collecting data on read. * The complexity is because parts of the data can be stored in four different * places: - * - in delayed requests * - in memory - the data not yet send to the active journal provider - * - in requests which are going to be sent to the active journal * - in the active journal * - in the inactive journal * - in the data provider @@ -1576,20 +1535,14 @@ g_journal_read(struct g_journal_softc *sc, struct bio cstart = cend = -1; bp = NULL; head = NULL; - for (i = 0; i <= 5; i++) { + for (i = 1; i <= 5; i++) { switch (i) { - case 0: /* Delayed requests. */ - head = NULL; - sorted = 0; - break; case 1: /* Not-yet-send data. */ head = sc->sc_current_queue; sorted = 1; break; - case 2: /* In-flight to the active journal. */ - head = sc->sc_flush_queue; - sorted = 0; - break; + case 2: /* Skip flush queue as they are also in active queue */ + continue; case 3: /* Active journal. */ head = sc->sc_active.jj_queue; sorted = 1; @@ -1608,10 +1561,7 @@ g_journal_read(struct g_journal_softc *sc, struct bio default: panic("gjournal %s: i=%d", __func__, i); } - if (i == 0) - bp = g_journal_read_queue_find(&sc->sc_delayed_queue.queue, pbp, ostart, oend); - else - bp = g_journal_read_find(head, sorted, pbp, ostart, oend); + bp = g_journal_read_find(head, sorted, pbp, ostart, oend); if (bp == pbp) { /* Got the whole request. */ GJ_DEBUG(2, "Got the whole request from %u.", i); return; Modified: stable/11/sys/geom/journal/g_journal.h ============================================================================== --- stable/11/sys/geom/journal/g_journal.h Tue Aug 22 15:16:09 2017 (r322791) +++ stable/11/sys/geom/journal/g_journal.h Tue Aug 22 15:20:48 2017 (r322792) @@ -182,6 +182,17 @@ struct g_journal_softc { (pbp)->bio_next = (bp); \ } \ } while (0) +#define GJQ_LAST(head, bp) do { \ + struct bio *_bp; \ + \ + if ((head) == NULL) { \ + (bp) = (head); \ + break; \ + } \ + for (_bp = (head); _bp->bio_next != NULL; _bp = _bp->bio_next) \ + continue; \ + (bp) = (_bp); \ +} while (0) #define GJQ_FIRST(head) (head) #define GJQ_REMOVE(head, bp) do { \ struct bio *_bp; \ From owner-svn-src-all@freebsd.org Tue Aug 22 15:26:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BE59DCB8C4; Tue, 22 Aug 2017 15:26:48 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65F9C66530; Tue, 22 Aug 2017 15:26:48 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MFQlkk060561; Tue, 22 Aug 2017 15:26:47 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MFQl6Q060559; Tue, 22 Aug 2017 15:26:47 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708221526.v7MFQl6Q060559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 22 Aug 2017 15:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322793 - stable/10/sys/geom/journal X-SVN-Group: stable-10 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/10/sys/geom/journal X-SVN-Commit-Revision: 322793 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 15:26:48 -0000 Author: mckusick Date: Tue Aug 22 15:26:47 2017 New Revision: 322793 URL: https://svnweb.freebsd.org/changeset/base/322793 Log: MFC of 269692, 322179, 322463, and 322464: 269692: cswitch is unsigned, so don't compare it < 0 322179: Correct ordering of bio's in gjournal queue 322463: Eliminate a variable that is set-only in g_journal.c 322464: Correct check for reads in gjournal Submitted by: Dr. Andreas Longwitz Discussed with: kib Approved by: re (marius) Modified: stable/10/sys/geom/journal/g_journal.c stable/10/sys/geom/journal/g_journal.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/journal/g_journal.c ============================================================================== --- stable/10/sys/geom/journal/g_journal.c Tue Aug 22 15:20:48 2017 (r322792) +++ stable/10/sys/geom/journal/g_journal.c Tue Aug 22 15:26:47 2017 (r322793) @@ -175,7 +175,7 @@ g_journal_cache_switch_sysctl(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &cswitch, 0, req); if (error != 0 || req->newptr == NULL) return (error); - if (cswitch < 0 || cswitch > 100) + if (cswitch > 100) return (EINVAL); g_journal_cache_switch = cswitch; g_journal_cache_low = (g_journal_cache_limit / 100) * cswitch; @@ -1239,7 +1239,7 @@ g_journal_flush(struct g_journal_softc *sc) struct g_provider *pp; struct bio **bioq; struct bio *bp, *fbp, *pbp; - off_t joffset, size; + off_t joffset; u_char *data, hash[16]; MD5_CTX ctx; u_int i; @@ -1247,7 +1247,6 @@ g_journal_flush(struct g_journal_softc *sc) if (sc->sc_current_count == 0) return; - size = 0; pp = sc->sc_jprovider; GJ_VALIDATE_OFFSET(sc->sc_journal_offset, sc); joffset = sc->sc_journal_offset; @@ -1264,7 +1263,7 @@ g_journal_flush(struct g_journal_softc *sc) strlcpy(hdr.jrh_magic, GJ_RECORD_HEADER_MAGIC, sizeof(hdr.jrh_magic)); bioq = &sc->sc_active.jj_queue; - pbp = sc->sc_flush_queue; + GJQ_LAST(sc->sc_flush_queue, pbp); fbp = g_alloc_bio(); fbp->bio_parent = NULL; @@ -1297,7 +1296,6 @@ g_journal_flush(struct g_journal_softc *sc) ent->je_offset = bp->bio_offset; ent->je_joffset = joffset; ent->je_length = bp->bio_length; - size += ent->je_length; data = bp->bio_data; if (sc->sc_flags & GJF_DEVICE_CHECKSUM) @@ -1519,49 +1517,10 @@ g_journal_read_find(struct bio *head, int sorted, stru } /* - * Try to find requested data in cache. - */ -static struct bio * -g_journal_read_queue_find(struct bio_queue *head, struct bio *pbp, off_t ostart, - off_t oend) -{ - off_t cstart, cend; - struct bio *bp; - - TAILQ_FOREACH(bp, head, bio_queue) { - cstart = MAX(ostart, bp->bio_offset); - cend = MIN(oend, bp->bio_offset + bp->bio_length); - if (cend <= ostart) - continue; - else if (cstart >= oend) - continue; - KASSERT(bp->bio_data != NULL, - ("%s: bio_data == NULL", __func__)); - GJ_DEBUG(3, "READ(%p): (%jd, %jd) (bp=%p)", head, cstart, cend, - bp); - bcopy(bp->bio_data + cstart - bp->bio_offset, - pbp->bio_data + cstart - pbp->bio_offset, cend - cstart); - pbp->bio_completed += cend - cstart; - if (pbp->bio_completed == pbp->bio_length) { - /* - * Cool, the whole request was in cache, deliver happy - * message. - */ - g_io_deliver(pbp, 0); - return (pbp); - } - break; - } - return (bp); -} - -/* - * This function is used for colecting data on read. + * This function is used for collecting data on read. * The complexity is because parts of the data can be stored in four different * places: - * - in delayed requests * - in memory - the data not yet send to the active journal provider - * - in requests which are going to be sent to the active journal * - in the active journal * - in the inactive journal * - in the data provider @@ -1579,20 +1538,14 @@ g_journal_read(struct g_journal_softc *sc, struct bio cstart = cend = -1; bp = NULL; head = NULL; - for (i = 0; i <= 5; i++) { + for (i = 1; i <= 5; i++) { switch (i) { - case 0: /* Delayed requests. */ - head = NULL; - sorted = 0; - break; case 1: /* Not-yet-send data. */ head = sc->sc_current_queue; sorted = 1; break; - case 2: /* In-flight to the active journal. */ - head = sc->sc_flush_queue; - sorted = 0; - break; + case 2: /* Skip flush queue as they are also in active queue */ + continue; case 3: /* Active journal. */ head = sc->sc_active.jj_queue; sorted = 1; @@ -1611,10 +1564,7 @@ g_journal_read(struct g_journal_softc *sc, struct bio default: panic("gjournal %s: i=%d", __func__, i); } - if (i == 0) - bp = g_journal_read_queue_find(&sc->sc_delayed_queue.queue, pbp, ostart, oend); - else - bp = g_journal_read_find(head, sorted, pbp, ostart, oend); + bp = g_journal_read_find(head, sorted, pbp, ostart, oend); if (bp == pbp) { /* Got the whole request. */ GJ_DEBUG(2, "Got the whole request from %u.", i); return; Modified: stable/10/sys/geom/journal/g_journal.h ============================================================================== --- stable/10/sys/geom/journal/g_journal.h Tue Aug 22 15:20:48 2017 (r322792) +++ stable/10/sys/geom/journal/g_journal.h Tue Aug 22 15:26:47 2017 (r322793) @@ -182,6 +182,17 @@ struct g_journal_softc { (pbp)->bio_next = (bp); \ } \ } while (0) +#define GJQ_LAST(head, bp) do { \ + struct bio *_bp; \ + \ + if ((head) == NULL) { \ + (bp) = (head); \ + break; \ + } \ + for (_bp = (head); _bp->bio_next != NULL; _bp = _bp->bio_next) \ + continue; \ + (bp) = (_bp); \ +} while (0) #define GJQ_FIRST(head) (head) #define GJQ_REMOVE(head, bp) do { \ struct bio *_bp; \ From owner-svn-src-all@freebsd.org Tue Aug 22 15:34:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BA01DCC22B; Tue, 22 Aug 2017 15:34:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFAB366A69; Tue, 22 Aug 2017 15:34:27 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MFYRbx064702; Tue, 22 Aug 2017 15:34:27 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MFYR9E064701; Tue, 22 Aug 2017 15:34:27 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708221534.v7MFYR9E064701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 22 Aug 2017 15:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322794 - head/release/tools X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/tools X-SVN-Commit-Revision: 322794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 15:34:28 -0000 Author: gjb Date: Tue Aug 22 15:34:27 2017 New Revision: 322794 URL: https://svnweb.freebsd.org/changeset/base/322794 Log: Use py-google-compute-engine instead for releasing Google Compute Engine (GCE) images with an updated version of Google's tools. PR: 221714 Submitted by: helen _dot_ koike _@_ collabora_dot_com (original) MFC after: 5 days Sponsored by: The FreeBSD Foundation Modified: head/release/tools/gce.conf Modified: head/release/tools/gce.conf ============================================================================== --- head/release/tools/gce.conf Tue Aug 22 15:26:47 2017 (r322793) +++ head/release/tools/gce.conf Tue Aug 22 15:34:27 2017 (r322794) @@ -5,12 +5,15 @@ # Set to a list of packages to install. export VM_EXTRA_PACKAGES="firstboot-freebsd-update firstboot-pkgs \ - google-cloud-sdk google-daemon panicmail sudo firstboot-growfs \ - google-startup-scripts" + google-cloud-sdk panicmail sudo firstboot-growfs \ + sysutils/py-google-compute-engine" # Set to a list of third-party software to enable in rc.conf(5). export VM_RC_LIST="google_accounts_manager ntpd sshd firstboot_growfs \ - firstboot_pkgs firstboot_freebsd_update google_startup" + firstboot_pkgs firstboot_freebsd_update google_startup \ + google_accounts_daemon google_clock_skew_daemon + google_instance_setup google_ip_forwarding_daemon + google_network_setup" vm_extra_install_base() { echo 'search google.internal' > ${DESTDIR}/etc/resolv.conf From owner-svn-src-all@freebsd.org Tue Aug 22 15:59:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94637DCDE2D; Tue, 22 Aug 2017 15:59:42 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 755B96797C; Tue, 22 Aug 2017 15:59:42 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1129) id C5E6F18E7; Tue, 22 Aug 2017 15:59:41 +0000 (UTC) Date: Tue, 22 Aug 2017 15:59:41 +0000 From: Li-Wen Hsu To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r322761 - in stable/11/sys/arm64: arm64 include Message-ID: <20170822155941.GA52559@freefall.freebsd.org> References: <201708211735.v7LHZ4UG023562@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201708211735.v7LHZ4UG023562@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 15:59:42 -0000 On Mon, Aug 21, 2017 at 17:35:04 +0000, John Baldwin wrote: > Author: jhb > Date: Mon Aug 21 17:35:04 2017 > New Revision: 322761 > URL: https://svnweb.freebsd.org/changeset/base/322761 > > Log: > MFC 322437: Reliably enable debug exceptions on all CPUs. > > Previously, debug exceptions were only enabled on the boot CPU if > DDB was enabled in the dbg_monitor_init() function. APs also called > this function, but since mp_machdep.c doesn't include opt_ddb.h, the > APs ended up calling an empty stub defined in > instead of the real function. Also, if DDB was not enabled in the kernel, > the boot CPU would not enable debug exceptions. > > Fix this by adding a new dbg_init() function that always clears the OS > lock to enable debug exceptions which the boot CPU and the APs call. > This function also calls dbg_monitor_init() to enable hardware breakpoints > from DDB on all CPUs if DDB is enabled. Eventually base support for > hardware breakpoints/watchpoints will need to move out of the DDB-only > debug_monitor.c for use by userland debuggers. > > Modified: > stable/11/sys/arm64/arm64/debug_monitor.c > stable/11/sys/arm64/arm64/machdep.c > stable/11/sys/arm64/arm64/mp_machdep.c > stable/11/sys/arm64/include/machdep.h > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/sys/arm64/arm64/mp_machdep.c > ============================================================================== > --- stable/11/sys/arm64/arm64/mp_machdep.c Mon Aug 21 17:29:37 2017 (r322760) > +++ stable/11/sys/arm64/arm64/mp_machdep.c Mon Aug 21 17:35:04 2017 (r322761) > @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); > #include > #include > > -#include > #include > #include > #ifdef VFP > @@ -277,7 +276,7 @@ init_secondary(uint64_t cpu) > vfp_init(); > #endif > > - dbg_monitor_init(); > + dbg_init(); > pan_enable(); > > /* Enable interrupts */ > Hi, This seems breaking aarch64 build: https://ci.freebsd.org/job/FreeBSD-stable-11-aarch64-build/1504/console --- mp_machdep.o --- /usr/src/sys/arm64/arm64/mp_machdep.c:279:2: error: implicit declaration of function 'dbg_init' is invalid in C99 [-Werror,-Wimplicit-function-declaration] dbg_init(); ^ /usr/src/sys/arm64/arm64/mp_machdep.c:279:2: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] 2 errors generated. *** [mp_machdep.o] Error code 1 make[2]: stopped in /usr/obj/arm64.aarch64/usr/src/sys/GENERIC Forgot including? Plase check, thanks! Best, Li-Wen -- Li-Wen Hsu https://lwhsu.org From owner-svn-src-all@freebsd.org Tue Aug 22 17:13:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82CA4DD56AF; Tue, 22 Aug 2017 17:13:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5BDE46C0EC; Tue, 22 Aug 2017 17:13:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MHDT2a008409; Tue, 22 Aug 2017 17:13:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MHDTUl008404; Tue, 22 Aug 2017 17:13:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708221713.v7MHDTUl008404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Aug 2017 17:13:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322795 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 322795 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 17:13:30 -0000 Author: markj Date: Tue Aug 22 17:13:28 2017 New Revision: 322795 URL: https://svnweb.freebsd.org/changeset/base/322795 Log: Add some miscellaneous definitions to support the DRM drivers. MFC after: 1 week Modified: head/sys/compat/linuxkpi/common/include/linux/device.h head/sys/compat/linuxkpi/common/include/linux/fs.h head/sys/compat/linuxkpi/common/include/linux/kobject.h head/sys/compat/linuxkpi/common/include/linux/lockdep.h head/sys/compat/linuxkpi/common/include/linux/module.h Modified: head/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/device.h Tue Aug 22 15:34:27 2017 (r322794) +++ head/sys/compat/linuxkpi/common/include/linux/device.h Tue Aug 22 17:13:28 2017 (r322795) @@ -50,12 +50,14 @@ enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED, IRQ_WAKE_T typedef enum irqreturn irqreturn_t; struct device; +struct fwnode_handle; struct class { const char *name; struct module *owner; struct kobject kobj; devclass_t bsdclass; + const struct dev_pm_ops *pm; void (*class_release)(struct class *class); void (*dev_release)(struct device *dev); char * (*devnode)(struct device *dev, umode_t *mode); @@ -113,6 +115,7 @@ struct device { unsigned int msix; unsigned int msix_max; const struct attribute_group **groups; + struct fwnode_handle *fwnode; spinlock_t devres_lock; struct list_head devres_head; @@ -179,6 +182,7 @@ show_class_attr_string(struct class *class, #define dev_warn(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) #define dev_info(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) #define dev_notice(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) +#define dev_dbg(dev, fmt, ...) do { } while (0) #define dev_printk(lvl, dev, fmt, ...) \ device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/fs.h Tue Aug 22 15:34:27 2017 (r322794) +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Tue Aug 22 17:13:28 2017 (r322795) @@ -53,9 +53,11 @@ struct pipe_inode_info; struct vm_area_struct; struct poll_table_struct; struct files_struct; +struct pfs_node; #define inode vnode #define i_cdev v_rdev +#define i_private v_data #define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH) #define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH) @@ -65,6 +67,7 @@ typedef struct files_struct *fl_owner_t; struct dentry { struct inode *d_inode; + struct pfs_node *d_pfs_node; }; struct file_operations; Modified: head/sys/compat/linuxkpi/common/include/linux/kobject.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kobject.h Tue Aug 22 15:34:27 2017 (r322794) +++ head/sys/compat/linuxkpi/common/include/linux/kobject.h Tue Aug 22 17:13:28 2017 (r322795) @@ -135,6 +135,11 @@ kobject_create_and_add(const char *name, struct kobjec return (NULL); } +static inline void +kobject_del(struct kobject *kobj __unused) +{ +} + static inline char * kobject_name(const struct kobject *kobj) { Modified: head/sys/compat/linuxkpi/common/include/linux/lockdep.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/lockdep.h Tue Aug 22 15:34:27 2017 (r322794) +++ head/sys/compat/linuxkpi/common/include/linux/lockdep.h Tue Aug 22 17:13:28 2017 (r322795) @@ -47,4 +47,6 @@ struct lock_class_key { #define lockdep_is_held(m) (sx_xholder(&(m)->sx) == curthread) +#define might_lock(m) do { } while (0) + #endif /* _LINUX_LOCKDEP_H_ */ Modified: head/sys/compat/linuxkpi/common/include/linux/module.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/module.h Tue Aug 22 15:34:27 2017 (r322794) +++ head/sys/compat/linuxkpi/common/include/linux/module.h Tue Aug 22 17:13:28 2017 (r322795) @@ -102,4 +102,6 @@ _module_run(void *arg) #define module_put(module) #define try_module_get(module) 1 +#define postcore_initcall(fn) module_init(fn) + #endif /* _LINUX_MODULE_H_ */ From owner-svn-src-all@freebsd.org Tue Aug 22 17:23:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41078DD6136; Tue, 22 Aug 2017 17:23:30 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FA556C850; Tue, 22 Aug 2017 17:23:29 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MHNTtu012519; Tue, 22 Aug 2017 17:23:29 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MHNTv4012518; Tue, 22 Aug 2017 17:23:29 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708221723.v7MHNTv4012518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 22 Aug 2017 17:23:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322796 - head/usr.sbin/chown/tests X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/usr.sbin/chown/tests X-SVN-Commit-Revision: 322796 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 17:23:30 -0000 Author: gjb Date: Tue Aug 22 17:23:29 2017 New Revision: 322796 URL: https://svnweb.freebsd.org/changeset/base/322796 Log: Revert part of r322770 in usr.sbin/chown/tests/chown_test.sh, which incorrectly adds atf_expect_fail() where there is no failure case. MFC after: 3 days MFC with: r322770 Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/chown/tests/chown_test.sh Modified: head/usr.sbin/chown/tests/chown_test.sh ============================================================================== --- head/usr.sbin/chown/tests/chown_test.sh Tue Aug 22 17:13:28 2017 (r322795) +++ head/usr.sbin/chown/tests/chown_test.sh Tue Aug 22 17:23:29 2017 (r322796) @@ -156,11 +156,6 @@ v_flag_body() atf_check truncate -s 0 foo bar atf_check chown 0:0 foo atf_check chown 42:42 bar - case "$(get_filesystem .)" in - zfs) - atf_expect_fail "ZFS updates mode for foo unnecessarily" - ;; - esac atf_check -o 'inline:bar\n' chown -v 0:0 foo bar atf_check chown -v 0:0 foo bar for f in foo bar; do From owner-svn-src-all@freebsd.org Tue Aug 22 17:38:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53935DD716F; Tue, 22 Aug 2017 17:38:07 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2129C6D3C7; Tue, 22 Aug 2017 17:38:07 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MHc6Ro017333; Tue, 22 Aug 2017 17:38:06 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MHc6UH017332; Tue, 22 Aug 2017 17:38:06 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708221738.v7MHc6UH017332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 22 Aug 2017 17:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322797 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 322797 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 17:38:07 -0000 Author: andrew Date: Tue Aug 22 17:38:06 2017 New Revision: 322797 URL: https://svnweb.freebsd.org/changeset/base/322797 Log: Fix a bug in pmap_protect where we invalidate the wrong page. With this we can now remove an unneeded call to invalidate all entries. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Aug 22 17:23:29 2017 (r322796) +++ head/sys/arm64/arm64/pmap.c Tue Aug 22 17:38:06 2017 (r322797) @@ -2620,13 +2620,10 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t pmap_set(l3p, nbits); /* XXX: Use pmap_invalidate_range */ - pmap_invalidate_page(pmap, va); + pmap_invalidate_page(pmap, sva); } } PMAP_UNLOCK(pmap); - - /* TODO: Only invalidate entries we are touching */ - pmap_invalidate_all(pmap); } /* From owner-svn-src-all@freebsd.org Tue Aug 22 17:57:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D089DD86B4; Tue, 22 Aug 2017 17:57:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 174DB6E0E6; Tue, 22 Aug 2017 17:57:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MHvZcr025594; Tue, 22 Aug 2017 17:57:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MHvZ5c025593; Tue, 22 Aug 2017 17:57:35 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708221757.v7MHvZ5c025593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 22 Aug 2017 17:57:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322798 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 322798 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 17:57:36 -0000 Author: emaste Date: Tue Aug 22 17:57:34 2017 New Revision: 322798 URL: https://svnweb.freebsd.org/changeset/base/322798 Log: newvers.sh: accommodate `git worktree` newvers.sh looks for a .vcs subdirectory (e.g. .git, .svn) to determine which vcs info tool to run (e.g., git rev-parse, svn info). (As of r308789 if a .vcs subdirectory is not found at ${TOPDIR} then newvers.sh walks up successive parent directories, testing for the .vcs subdirectory at each step. This is done in case the FreeBSD source is built in a subdirectory as part of some larger project, but either way newvers.sh still tests for the .vcs subdirectory.) However, when using git worktree there is no .git subdirectory but rather a plain text .git file which contains a reference to the main working tree. Change findvcs() to test that the .vcs entry exists, regardless of type. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Tue Aug 22 17:38:06 2017 (r322797) +++ head/sys/conf/newvers.sh Tue Aug 22 17:57:34 2017 (r322798) @@ -62,7 +62,7 @@ findvcs() savedir=$(pwd) cd ${SYSDIR}/.. while [ $(pwd) != "/" ]; do - if [ -d "./$1" ]; then + if [ -e "./$1" ]; then VCSDIR=$(pwd)"/$1" cd ${savedir} return 0 From owner-svn-src-all@freebsd.org Tue Aug 22 17:58:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92376DD877C; Tue, 22 Aug 2017 17:58:22 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 44DD06E239; Tue, 22 Aug 2017 17:58:21 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from dhcp-10-248-113-1.eduroam.wireless.private.cam.ac.uk (global-5-143.nat-2.net.cam.ac.uk [131.111.5.143]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 601484E769; Tue, 22 Aug 2017 17:49:13 +0000 (UTC) From: Andrew Turner Message-Id: Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r322761 - in stable/11/sys/arm64: arm64 include Date: Tue, 22 Aug 2017 18:49:12 +0100 In-Reply-To: <20170822155941.GA52559@freefall.freebsd.org> Cc: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org To: Li-Wen Hsu References: <201708211735.v7LHZ4UG023562@repo.freebsd.org> <20170822155941.GA52559@freefall.freebsd.org> X-Mailer: Apple Mail (2.3273) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 17:58:22 -0000 > On 22 Aug 2017, at 16:59, Li-Wen Hsu wrote: >=20 > On Mon, Aug 21, 2017 at 17:35:04 +0000, John Baldwin wrote: >> Author: jhb >> Date: Mon Aug 21 17:35:04 2017 >> New Revision: 322761 >> URL: https://svnweb.freebsd.org/changeset/base/322761 >>=20 >> Log: >> MFC 322437: Reliably enable debug exceptions on all CPUs. >>=20 >> Previously, debug exceptions were only enabled on the boot CPU if >> DDB was enabled in the dbg_monitor_init() function. APs also called >> this function, but since mp_machdep.c doesn't include opt_ddb.h, the >> APs ended up calling an empty stub defined in = >> instead of the real function. Also, if DDB was not enabled in the = kernel, >> the boot CPU would not enable debug exceptions. >>=20 >> Fix this by adding a new dbg_init() function that always clears the = OS >> lock to enable debug exceptions which the boot CPU and the APs call. >> This function also calls dbg_monitor_init() to enable hardware = breakpoints >> from DDB on all CPUs if DDB is enabled. Eventually base support for >> hardware breakpoints/watchpoints will need to move out of the = DDB-only >> debug_monitor.c for use by userland debuggers. >>=20 >> Modified: >> stable/11/sys/arm64/arm64/debug_monitor.c >> stable/11/sys/arm64/arm64/machdep.c >> stable/11/sys/arm64/arm64/mp_machdep.c >> stable/11/sys/arm64/include/machdep.h >> Directory Properties: >> stable/11/ (props changed) >>=20 >> Modified: stable/11/sys/arm64/arm64/mp_machdep.c >> = =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 >> --- stable/11/sys/arm64/arm64/mp_machdep.c Mon Aug 21 17:29:37 2017 = (r322760) >> +++ stable/11/sys/arm64/arm64/mp_machdep.c Mon Aug 21 17:35:04 2017 = (r322761) >> @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >>=20 >> -#include >> #include >> #include >> #ifdef VFP >> @@ -277,7 +276,7 @@ init_secondary(uint64_t cpu) >> vfp_init(); >> #endif >>=20 >> - dbg_monitor_init(); >> + dbg_init(); >> pan_enable(); >>=20 >> /* Enable interrupts */ >>=20 >=20 > Hi, >=20 > This seems breaking aarch64 build: >=20 > = https://ci.freebsd.org/job/FreeBSD-stable-11-aarch64-build/1504/console = >=20 > --- mp_machdep.o --- > /usr/src/sys/arm64/arm64/mp_machdep.c:279:2: error: implicit = declaration of function 'dbg_init' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > dbg_init(); > ^ > /usr/src/sys/arm64/arm64/mp_machdep.c:279:2: error: this function = declaration is not a prototype [-Werror,-Wstrict-prototypes] > 2 errors generated. > *** [mp_machdep.o] Error code 1 >=20 > make[2]: stopped in /usr/obj/arm64.aarch64/usr/src/sys/GENERIC >=20 >=20 > Forgot including? Plase check, thanks! mp_machdep.c includes machine/machdep.h in head, but not stable/11. It = was added in a change that wasn=E2=80=99t (and shouldn=E2=80=99t be) = MFCd. Andrew From owner-svn-src-all@freebsd.org Tue Aug 22 18:15:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99464DD9D4A; Tue, 22 Aug 2017 18:15:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66E706F14C; Tue, 22 Aug 2017 18:15:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MIFl1Y033720; Tue, 22 Aug 2017 18:15:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MIFlI2033719; Tue, 22 Aug 2017 18:15:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708221815.v7MIFlI2033719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 22 Aug 2017 18:15:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322799 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 322799 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 18:15:48 -0000 Author: kib Date: Tue Aug 22 18:15:47 2017 New Revision: 322799 URL: https://svnweb.freebsd.org/changeset/base/322799 Log: Ensure that fs/gs bases are stored in pcb before copying the pcb for new process or thread. Reported and tested by: ae, dhw Sponsored by: The FreeBSD Foundation MFC after: 20 days Modified: head/sys/amd64/amd64/vm_machdep.c Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Tue Aug 22 17:57:34 2017 (r322798) +++ head/sys/amd64/amd64/vm_machdep.c Tue Aug 22 18:15:47 2017 (r322799) @@ -172,6 +172,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t /* Ensure that td1's pcb is up to date. */ fpuexit(td1); + update_pcb_bases(td1->td_pcb); /* Point the pcb to the top of the stack */ pcb2 = get_pcb_td(td2); @@ -433,6 +434,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Those not loaded individually below get their default * values here. */ + update_pcb_bases(td0->td_pcb); bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | PCB_KERNFPU); From owner-svn-src-all@freebsd.org Tue Aug 22 18:20:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 707E7DDA194; Tue, 22 Aug 2017 18:20:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D4466F360; Tue, 22 Aug 2017 18:20:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MIKPpd034044; Tue, 22 Aug 2017 18:20:25 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MIKPt1034043; Tue, 22 Aug 2017 18:20:25 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708221820.v7MIKPt1034043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 22 Aug 2017 18:20:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322800 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 322800 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 18:20:26 -0000 Author: andrew Date: Tue Aug 22 18:20:25 2017 New Revision: 322800 URL: https://svnweb.freebsd.org/changeset/base/322800 Log: Remove an unneeded call to pmap_invalidate_all. This was never called as the anyvalid variable is never set. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Aug 22 18:15:47 2017 (r322799) +++ head/sys/arm64/arm64/pmap.c Tue Aug 22 18:20:25 2017 (r322800) @@ -2331,7 +2331,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t pd_entry_t *l0, *l1, *l2; pt_entry_t l3_paddr, *l3; struct spglist free; - int anyvalid; /* * Perform an unsynchronized read. This is, however, safe. @@ -2339,7 +2338,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t if (pmap->pm_stats.resident_count == 0) return; - anyvalid = 0; SLIST_INIT(&free); PMAP_LOCK(pmap); @@ -2429,8 +2427,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t } if (lock != NULL) rw_wunlock(lock); - if (anyvalid) - pmap_invalidate_all(pmap); PMAP_UNLOCK(pmap); pmap_free_zero_pages(&free); } From owner-svn-src-all@freebsd.org Tue Aug 22 19:48:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB20BDDFBB0; Tue, 22 Aug 2017 19:48:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 955ED726B6; Tue, 22 Aug 2017 19:48:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MJmXlA071343; Tue, 22 Aug 2017 19:48:33 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MJmXkK071342; Tue, 22 Aug 2017 19:48:33 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708221948.v7MJmXkK071342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 22 Aug 2017 19:48:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322801 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/sys/arm64/arm64 X-SVN-Commit-Revision: 322801 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 19:48:34 -0000 Author: jhb Date: Tue Aug 22 19:48:33 2017 New Revision: 322801 URL: https://svnweb.freebsd.org/changeset/base/322801 Log: Add missing #include to fix build after r322761. Reported by: lwhsu Pointy hat to: jhb Modified: stable/11/sys/arm64/arm64/mp_machdep.c Modified: stable/11/sys/arm64/arm64/mp_machdep.c ============================================================================== --- stable/11/sys/arm64/arm64/mp_machdep.c Tue Aug 22 18:20:25 2017 (r322800) +++ stable/11/sys/arm64/arm64/mp_machdep.c Tue Aug 22 19:48:33 2017 (r322801) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef VFP From owner-svn-src-all@freebsd.org Tue Aug 22 19:56:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2779DDE03D8; Tue, 22 Aug 2017 19:56:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB69172C5A; Tue, 22 Aug 2017 19:56:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MJuVDs075291; Tue, 22 Aug 2017 19:56:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MJuVXi075290; Tue, 22 Aug 2017 19:56:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708221956.v7MJuVXi075290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 22 Aug 2017 19:56:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322802 - head/sys/x86/acpica X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/x86/acpica X-SVN-Commit-Revision: 322802 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 19:56:32 -0000 Author: mav Date: Tue Aug 22 19:56:30 2017 New Revision: 322802 URL: https://svnweb.freebsd.org/changeset/base/322802 Log: Fix off-by-one error when parsing SRAT table. Reviewed by: jhb MFC after: 1 week Modified: head/sys/x86/acpica/srat.c Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Tue Aug 22 19:48:33 2017 (r322801) +++ head/sys/x86/acpica/srat.c Tue Aug 22 19:56:30 2017 (r322802) @@ -172,7 +172,7 @@ overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end) int i; for (i = 0; phys_avail[i] != 0 && phys_avail[i + 1] != 0; i += 2) { - if (phys_avail[i + 1] < start) + if (phys_avail[i + 1] <= start) continue; if (phys_avail[i] < end) return (1); From owner-svn-src-all@freebsd.org Tue Aug 22 20:46:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94E64DE30B9; Tue, 22 Aug 2017 20:46:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 640CD74971; Tue, 22 Aug 2017 20:46:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MKkTcW095628; Tue, 22 Aug 2017 20:46:29 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MKkTAQ095627; Tue, 22 Aug 2017 20:46:29 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201708222046.v7MKkTAQ095627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 22 Aug 2017 20:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322803 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 20:46:30 -0000 Author: jkim Date: Tue Aug 22 20:46:29 2017 New Revision: 322803 URL: https://svnweb.freebsd.org/changeset/base/322803 Log: Fix size to copyout(9) for cpuset_getid(2). MFC after: 3 days Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Tue Aug 22 19:56:30 2017 (r322802) +++ head/sys/kern/kern_cpuset.c Tue Aug 22 20:46:29 2017 (r322803) @@ -1062,7 +1062,7 @@ kern_cpuset_getid(struct thread *td, cpulevel_t level, tmpid = set->cs_id; cpuset_rel(set); if (error == 0) - error = copyout(&tmpid, setid, sizeof(id)); + error = copyout(&tmpid, setid, sizeof(tmpid)); return (error); } From owner-svn-src-all@freebsd.org Tue Aug 22 23:55:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DA0FDED34A; Tue, 22 Aug 2017 23:55:10 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C8F77E8C7; Tue, 22 Aug 2017 23:55:10 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MNt9Nh073071; Tue, 22 Aug 2017 23:55:09 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7MNt9e8073070; Tue, 22 Aug 2017 23:55:09 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201708222355.v7MNt9e8073070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Tue, 22 Aug 2017 23:55:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322804 - head/usr.sbin/ctladm X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/usr.sbin/ctladm X-SVN-Commit-Revision: 322804 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 23:55:10 -0000 Author: benno Date: Tue Aug 22 23:55:09 2017 New Revision: 322804 URL: https://svnweb.freebsd.org/changeset/base/322804 Log: Correct typo in usage string. Submitted by: peterpakos (GitHub username) MFC after: 1 day Modified: head/usr.sbin/ctladm/ctladm.c Modified: head/usr.sbin/ctladm/ctladm.c ============================================================================== --- head/usr.sbin/ctladm/ctladm.c Tue Aug 22 20:46:29 2017 (r322803) +++ head/usr.sbin/ctladm/ctladm.c Tue Aug 22 23:55:09 2017 (r322804) @@ -3963,7 +3963,7 @@ usage(int error) "-q : omit header in list output\n" "-x : output port list in XML format\n" "portlist options:\n" -"-f fronetnd : specify frontend type\n" +"-f frontend : specify frontend type\n" "-i : report target and initiators addresses\n" "-l : report LUN mapping\n" "-p targ_port : specify target port number\n" From owner-svn-src-all@freebsd.org Wed Aug 23 04:35:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C093DDA8AB; Wed, 23 Aug 2017 04:35:05 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 153B61E1F; Wed, 23 Aug 2017 04:35:05 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7N4Z4re086386; Wed, 23 Aug 2017 04:35:04 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7N4Z4l4086383; Wed, 23 Aug 2017 04:35:04 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708230435.v7N4Z4l4086383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 23 Aug 2017 04:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322806 - in stable/11: sbin/fsck_ffs sbin/newfs sys/ufs/ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in stable/11: sbin/fsck_ffs sbin/newfs sys/ufs/ffs X-SVN-Commit-Revision: 322806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 04:35:05 -0000 Author: mckusick Date: Wed Aug 23 04:35:03 2017 New Revision: 322806 URL: https://svnweb.freebsd.org/changeset/base/322806 Log: MFC of 322200, 322201, 322271, and 322297 322200: Remove (broken) search for alternate superblocks 322201: Show differences when alternate superblock fails to match 322271: Cleanup for 322200. 322297: Restore fsck_ffs ability to find alternate superblocks Discussed with: kib, imp Differential Revision: https://reviews.freebsd.org/D11589 Modified: stable/11/sbin/fsck_ffs/setup.c stable/11/sbin/newfs/mkfs.c stable/11/sys/ufs/ffs/fs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsck_ffs/setup.c ============================================================================== --- stable/11/sbin/fsck_ffs/setup.c Wed Aug 23 03:54:34 2017 (r322805) +++ stable/11/sbin/fsck_ffs/setup.c Wed Aug 23 04:35:03 2017 (r322806) @@ -58,7 +58,9 @@ struct bufarea asblk; #define altsblock (*asblk.b_un.b_fs) #define POWEROF2(num) (((num) & ((num) - 1)) == 0) -static void badsb(int listerr, const char *s); +static int calcsb(char *dev, int devfd, struct fs *fs); +static void saverecovery(int readfd, int writefd); +static int chkrecovery(int devfd); /* * Read in a superblock finding an alternate if necessary. @@ -176,7 +178,7 @@ setup(char *dev) */ if (readsb(1) == 0) { skipclean = 0; - if (bflag || preen) + if (bflag || preen || calcsb(dev, fsreadfd, &proto) == 0) return(0); if (reply("LOOK FOR ALTERNATE SUPERBLOCKS") == 0) return (0); @@ -234,6 +236,10 @@ setup(char *dev) memmove(&altsblock, &sblock, (size_t)sblock.fs_sbsize); flush(fswritefd, &asblk); } + if (preen == 0 && yflag == 0 && sblock.fs_magic == FS_UFS2_MAGIC && + fswritefd != -1 && chkrecovery(fsreadfd) == 0 && + reply("SAVE DATA TO FIND ALTERNATE SUPERBLOCKS") != 0) + saverecovery(fsreadfd, fswritefd); /* * read in the summary info. */ @@ -313,7 +319,7 @@ int readsb(int listerr) { ufs2_daddr_t super; - int i; + int i, bad; if (bflag) { super = bflag; @@ -363,40 +369,57 @@ readsb(int listerr) dev_bsize = sblock.fs_fsize / fsbtodb(&sblock, 1); sblk.b_bno = super / dev_bsize; sblk.b_size = SBLOCKSIZE; - if (bflag) - goto out; /* * Compare all fields that should not differ in alternate super block. * When an alternate super-block is specified this check is skipped. */ + if (bflag) + goto out; getblk(&asblk, cgsblock(&sblock, sblock.fs_ncg - 1), sblock.fs_sbsize); if (asblk.b_errs) return (0); - if (altsblock.fs_sblkno != sblock.fs_sblkno || - altsblock.fs_cblkno != sblock.fs_cblkno || - altsblock.fs_iblkno != sblock.fs_iblkno || - altsblock.fs_dblkno != sblock.fs_dblkno || - altsblock.fs_ncg != sblock.fs_ncg || - altsblock.fs_bsize != sblock.fs_bsize || - altsblock.fs_fsize != sblock.fs_fsize || - altsblock.fs_frag != sblock.fs_frag || - altsblock.fs_bmask != sblock.fs_bmask || - altsblock.fs_fmask != sblock.fs_fmask || - altsblock.fs_bshift != sblock.fs_bshift || - altsblock.fs_fshift != sblock.fs_fshift || - altsblock.fs_fragshift != sblock.fs_fragshift || - altsblock.fs_fsbtodb != sblock.fs_fsbtodb || - altsblock.fs_sbsize != sblock.fs_sbsize || - altsblock.fs_nindir != sblock.fs_nindir || - altsblock.fs_inopb != sblock.fs_inopb || - altsblock.fs_cssize != sblock.fs_cssize || - altsblock.fs_ipg != sblock.fs_ipg || - altsblock.fs_fpg != sblock.fs_fpg || - altsblock.fs_magic != sblock.fs_magic) { - badsb(listerr, - "VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE"); - return (0); + bad = 0; +#define CHK(x, y) \ + if (altsblock.x != sblock.x) { \ + bad++; \ + if (listerr && debug) \ + printf("SUPER BLOCK VS ALTERNATE MISMATCH %s: " y " vs " y "\n", \ + #x, (intmax_t)sblock.x, (intmax_t)altsblock.x); \ } + CHK(fs_sblkno, "%jd"); + CHK(fs_cblkno, "%jd"); + CHK(fs_iblkno, "%jd"); + CHK(fs_dblkno, "%jd"); + CHK(fs_ncg, "%jd"); + CHK(fs_bsize, "%jd"); + CHK(fs_fsize, "%jd"); + CHK(fs_frag, "%jd"); + CHK(fs_bmask, "%#jx"); + CHK(fs_fmask, "%#jx"); + CHK(fs_bshift, "%jd"); + CHK(fs_fshift, "%jd"); + CHK(fs_fragshift, "%jd"); + CHK(fs_fsbtodb, "%jd"); + CHK(fs_sbsize, "%jd"); + CHK(fs_nindir, "%jd"); + CHK(fs_inopb, "%jd"); + CHK(fs_cssize, "%jd"); + CHK(fs_ipg, "%jd"); + CHK(fs_fpg, "%jd"); + CHK(fs_magic, "%#jx"); +#undef CHK + if (bad) { + if (listerr == 0) + return (0); + if (preen) + printf("%s: ", cdevname); + printf( + "VALUES IN SUPER BLOCK LSB=%jd DISAGREE WITH THOSE IN\n" + "LAST ALTERNATE LSB=%jd\n", + sblk.b_bno, asblk.b_bno); + if (reply("IGNORE ALTERNATE SUPER BLOCK") == 0) + return (0); + } out: /* * If not yet done, update UFS1 superblock with new wider fields. @@ -417,17 +440,6 @@ out: return (1); } -static void -badsb(int listerr, const char *s) -{ - - if (!listerr) - return; - if (preen) - printf("%s: ", cdevname); - pfatal("BAD SUPER BLOCK: %s\n", s); -} - void sblock_init(void) { @@ -442,4 +454,74 @@ sblock_init(void) if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL) errx(EEXIT, "cannot allocate space for superblock"); dev_bsize = secsize = DEV_BSIZE; +} + +/* + * Calculate a prototype superblock based on information in the boot area. + * When done the cgsblock macro can be calculated and the fs_ncg field + * can be used. Do NOT attempt to use other macros without verifying that + * their needed information is available! + */ +static int +calcsb(char *dev, int devfd, struct fs *fs) +{ + struct fsrecovery fsr; + + /* + * We need fragments-per-group and the partition-size. + * + * Newfs stores these details at the end of the boot block area + * at the start of the filesystem partition. If they have been + * overwritten by a boot block, we fail. But usually they are + * there and we can use them. + */ + if (blread(devfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)) || + fsr.fsr_magic != FS_UFS2_MAGIC) + return (0); + memset(fs, 0, sizeof(struct fs)); + fs->fs_fpg = fsr.fsr_fpg; + fs->fs_fsbtodb = fsr.fsr_fsbtodb; + fs->fs_sblkno = fsr.fsr_sblkno; + fs->fs_magic = fsr.fsr_magic; + fs->fs_ncg = fsr.fsr_ncg; + return (1); +} + +/* + * Check to see if recovery information exists. + */ +static int +chkrecovery(int devfd) +{ + struct fsrecovery fsr; + + if (blread(devfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)) || + fsr.fsr_magic != FS_UFS2_MAGIC) + return (0); + return (1); +} + +/* + * Read the last sector of the boot block, replace the last + * 20 bytes with the recovery information, then write it back. + * The recovery information only works for UFS2 filesystems. + */ +static void +saverecovery(int readfd, int writefd) +{ + struct fsrecovery fsr; + + if (sblock.fs_magic != FS_UFS2_MAGIC || + blread(readfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr))) + return; + fsr.fsr_magic = sblock.fs_magic; + fsr.fsr_fpg = sblock.fs_fpg; + fsr.fsr_fsbtodb = sblock.fs_fsbtodb; + fsr.fsr_sblkno = sblock.fs_sblkno; + fsr.fsr_ncg = sblock.fs_ncg; + blwrite(writefd, (char *)&fsr, (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, + sizeof(fsr)); } Modified: stable/11/sbin/newfs/mkfs.c ============================================================================== --- stable/11/sbin/newfs/mkfs.c Wed Aug 23 03:54:34 2017 (r322805) +++ stable/11/sbin/newfs/mkfs.c Wed Aug 23 04:35:03 2017 (r322806) @@ -121,6 +121,7 @@ mkfs(struct partition *pp, char *fsys) ino_t maxinum; int minfragsperinode; /* minimum ratio of frags to inodes */ char tmpbuf[100]; /* XXX this will break in about 2,500 years */ + struct fsrecovery fsr; union { struct fs fdummy; char cdummy[SBLOCKSIZE]; @@ -615,6 +616,25 @@ restart: wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)), MIN(sblock.fs_cssize - i, sblock.fs_bsize), ((char *)fscs) + i); + /* + * Read the last sector of the boot block, replace the last + * 20 bytes with the recovery information, then write it back. + * The recovery information only works for UFS2 filesystems. + */ + if (sblock.fs_magic == FS_UFS2_MAGIC) { + i = bread(&disk, + part_ofs + (SBLOCK_UFS2 - sizeof(fsr)) / disk.d_bsize, + (char *)&fsr, sizeof(fsr)); + if (i == -1) + err(1, "can't read recovery area: %s", disk.d_error); + fsr.fsr_magic = sblock.fs_magic; + fsr.fsr_fpg = sblock.fs_fpg; + fsr.fsr_fsbtodb = sblock.fs_fsbtodb; + fsr.fsr_sblkno = sblock.fs_sblkno; + fsr.fsr_ncg = sblock.fs_ncg; + wtfs((SBLOCK_UFS2 - sizeof(fsr)) / disk.d_bsize, sizeof(fsr), + (char *)&fsr); + } /* * Update information about this partition in pack * label, to that it may be updated on disk. Modified: stable/11/sys/ufs/ffs/fs.h ============================================================================== --- stable/11/sys/ufs/ffs/fs.h Wed Aug 23 03:54:34 2017 (r322805) +++ stable/11/sys/ufs/ffs/fs.h Wed Aug 23 04:35:03 2017 (r322806) @@ -234,6 +234,20 @@ struct fsck_cmd { }; /* + * A recovery structure placed at the end of the boot block area by newfs + * that can be used by fsck to search for alternate superblocks. + */ +#define RESID (4096 - 20) /* disk sector size minus recovery area size */ +struct fsrecovery { + char block[RESID]; /* unused part of sector */ + int32_t fsr_magic; /* magic number */ + int32_t fsr_fsbtodb; /* fsbtodb and dbtofsb shift constant */ + int32_t fsr_sblkno; /* offset of super-block in filesys */ + int32_t fsr_fpg; /* blocks per group * fs_frag */ + u_int32_t fsr_ncg; /* number of cylinder groups */ +}; + +/* * Per cylinder group information; summarized in blocks allocated * from first cylinder group data blocks. These blocks have to be * read in from fs_csaddr (size fs_cssize) in addition to the From owner-svn-src-all@freebsd.org Wed Aug 23 04:43:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 690A7DDB284; Wed, 23 Aug 2017 04:43:51 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3485C2547; Wed, 23 Aug 2017 04:43:51 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7N4ho3q090467; Wed, 23 Aug 2017 04:43:50 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7N4hoNY090466; Wed, 23 Aug 2017 04:43:50 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708230443.v7N4hoNY090466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 23 Aug 2017 04:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322807 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 322807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 04:43:51 -0000 Author: mckusick Date: Wed Aug 23 04:43:50 2017 New Revision: 322807 URL: https://svnweb.freebsd.org/changeset/base/322807 Log: MFC of 322298 noting MFC 322806 in UPDATING Modified: stable/11/UPDATING Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Wed Aug 23 04:35:03 2017 (r322806) +++ stable/11/UPDATING Wed Aug 23 04:43:50 2017 (r322807) @@ -16,6 +16,19 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20170822: + Since the switch to GPT disk labels, fsck for UFS/FFS has been + unable to automatically find alternate superblocks. As of r322806, + the information needed to find alternate superblocks has been + moved to the end of the area reserved for the boot block. + Filesystems created with a newfs of this vintage or later + will create the recovery information. If you have a filesystem + created prior to this change and wish to have a recovery block + created for your filesystem, you can do so by running fsck in + forground mode (i.e., do not use the -p or -y options). As it + starts, fsck will ask ``SAVE DATA TO FIND ALTERNATE SUPERBLOCKS'' + to which you should answer yes. + 20170518: arm64 builds now use the base system LLD 4.0.0 linker by default, instead of requiring that the aarch64-binutils port or package be From owner-svn-src-all@freebsd.org Wed Aug 23 08:56:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41340DE1BB6; Wed, 23 Aug 2017 08:56:20 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CE63679FE; Wed, 23 Aug 2017 08:56:20 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7N8uJAM091886; Wed, 23 Aug 2017 08:56:19 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7N8uJg1091884; Wed, 23 Aug 2017 08:56:19 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708230856.v7N8uJg1091884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 23 Aug 2017 08:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322808 - in stable/11: share/man/man4 sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/net X-SVN-Commit-Revision: 322808 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 08:56:20 -0000 Author: ae Date: Wed Aug 23 08:56:18 2017 New Revision: 322808 URL: https://svnweb.freebsd.org/changeset/base/322808 Log: MFC r322310: Add to if_enc(4) ability to capture packets via BPF after pfil processing. New flag 0x4 can be configured in net.enc.[in|out].ipsec_bpf_mask. When it is set, if_enc(4) additionally captures a packet via BPF after invoking pfil hook. This may be useful for debugging. Sponsored by: Yandex LLC Modified: stable/11/share/man/man4/enc.4 stable/11/sys/net/if_enc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/enc.4 ============================================================================== --- stable/11/share/man/man4/enc.4 Wed Aug 23 04:43:50 2017 (r322807) +++ stable/11/share/man/man4/enc.4 Wed Aug 23 08:56:18 2017 (r322808) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 28, 2007 +.Dd August 9, 2017 .Dt ENC 4 .Os .Sh NAME @@ -44,6 +44,13 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device enc" .Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_enc_load="YES" +.Ed .Sh DESCRIPTION The .Nm @@ -115,6 +122,11 @@ outgoing path Most people will want to run with the suggested defaults for .Cm ipsec_filter_mask and rely on the security policy database for the outer headers. +.Pp +Note that packets are captured by BPF before firewall processing. +The special value 0x4 can be configured in the +.Ar ipsec_bpf_mask +and packets will be also captured after firewall processing. .Sh EXAMPLES To see the packets the processed via .Xr ipsec 4 , Modified: stable/11/sys/net/if_enc.c ============================================================================== --- stable/11/sys/net/if_enc.c Wed Aug 23 04:43:50 2017 (r322807) +++ stable/11/sys/net/if_enc.c Wed Aug 23 08:56:18 2017 (r322808) @@ -99,9 +99,15 @@ static void enc_remove_hhooks(struct enc_softc *); static const char encname[] = "enc"; +#define IPSEC_ENC_AFTER_PFIL 0x04 /* * Before and after are relative to when we are stripping the * outer IP header. + * + * AFTER_PFIL flag used only for bpf_mask_*. It enables BPF capturing + * after PFIL hook execution. It might be useful when PFIL hook does + * some changes to the packet, e.g. address translation. If PFIL hook + * consumes mbuf, nothing will be captured. */ static VNET_DEFINE(int, filter_mask_in) = IPSEC_ENC_BEFORE; static VNET_DEFINE(int, bpf_mask_in) = IPSEC_ENC_BEFORE; @@ -194,6 +200,30 @@ enc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (0); } +static void +enc_bpftap(struct ifnet *ifp, struct mbuf *m, const struct secasvar *sav, + int32_t hhook_type, uint8_t enc, uint8_t af) +{ + struct enchdr hdr; + + if (hhook_type == HHOOK_TYPE_IPSEC_IN && + (enc & V_bpf_mask_in) == 0) + return; + else if (hhook_type == HHOOK_TYPE_IPSEC_OUT && + (enc & V_bpf_mask_out) == 0) + return; + if (bpf_peers_present(ifp->if_bpf) == 0) + return; + hdr.af = af; + hdr.spi = sav->spi; + hdr.flags = 0; + if (sav->alg_enc != SADB_EALG_NONE) + hdr.flags |= M_CONF; + if (sav->alg_auth != SADB_AALG_NONE) + hdr.flags |= M_AUTH; + bpf_mtap2(ifp->if_bpf, &hdr, sizeof(hdr), m); +} + /* * One helper hook function is used by any hook points. * + from hhook_type we can determine the packet direction: @@ -206,7 +236,6 @@ static int enc_hhook(int32_t hhook_type, int32_t hhook_id, void *udata, void *ctx_data, void *hdata, struct osd *hosd) { - struct enchdr hdr; struct ipsec_ctx_data *ctx; struct enc_softc *sc; struct ifnet *ifp, *rcvif; @@ -223,21 +252,7 @@ enc_hhook(int32_t hhook_type, int32_t hhook_id, void * if (ctx->af != hhook_id) return (EPFNOSUPPORT); - if (((hhook_type == HHOOK_TYPE_IPSEC_IN && - (ctx->enc & V_bpf_mask_in) != 0) || - (hhook_type == HHOOK_TYPE_IPSEC_OUT && - (ctx->enc & V_bpf_mask_out) != 0)) && - bpf_peers_present(ifp->if_bpf) != 0) { - hdr.af = ctx->af; - hdr.spi = ctx->sav->spi; - hdr.flags = 0; - if (ctx->sav->alg_enc != SADB_EALG_NONE) - hdr.flags |= M_CONF; - if (ctx->sav->alg_auth != SADB_AALG_NONE) - hdr.flags |= M_AUTH; - bpf_mtap2(ifp->if_bpf, &hdr, sizeof(hdr), *ctx->mp); - } - + enc_bpftap(ifp, *ctx->mp, ctx->sav, hhook_type, ctx->enc, ctx->af); switch (hhook_type) { case HHOOK_TYPE_IPSEC_IN: if (ctx->enc == IPSEC_ENC_BEFORE) { @@ -290,6 +305,8 @@ enc_hhook(int32_t hhook_type, int32_t hhook_id, void * return (EACCES); } (*ctx->mp)->m_pkthdr.rcvif = rcvif; + enc_bpftap(ifp, *ctx->mp, ctx->sav, hhook_type, + IPSEC_ENC_AFTER_PFIL, ctx->af); return (0); } From owner-svn-src-all@freebsd.org Wed Aug 23 12:09:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA04FDE58A5; Wed, 23 Aug 2017 12:09:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93DC36D5A9; Wed, 23 Aug 2017 12:09:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NC9bA6070341; Wed, 23 Aug 2017 12:09:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NC9bBJ070335; Wed, 23 Aug 2017 12:09:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708231209.v7NC9bBJ070335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 23 Aug 2017 12:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322810 - in head: share/man/man4 sys/conf sys/dev/mlx5/mlx5_ib sys/modules sys/modules/mlx5ib X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/dev/mlx5/mlx5_ib sys/modules sys/modules/mlx5ib X-SVN-Commit-Revision: 322810 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 12:09:39 -0000 Author: hselasky Date: Wed Aug 23 12:09:37 2017 New Revision: 322810 URL: https://svnweb.freebsd.org/changeset/base/322810 Log: Add new mlx5ib(4) driver to the kernel source tree which supports Remote DMA over Converged Ethernet, RoCE, for the ConnectX-4 series of PCI express network cards. There is currently no user-space support and this driver only supports kernel side non-routable RoCE V1. The krping kernel module can be used to test this driver. Full user-space support including RoCE V2 will be added as part of the ongoing upgrade to ibcore from Linux 4.9. Otherwise this driver is feature equivalent to mlx4ib(4). The mlx5ib(4) kernel module will only be built when WITH_OFED=YES is specified. MFC after: 2 weeks Sponsored by: Mellanox Technologies Added: head/share/man/man4/mlx5ib.4 (contents, props changed) head/sys/dev/mlx5/mlx5_ib/ head/sys/dev/mlx5/mlx5_ib/mlx5_ib.h (contents, props changed) head/sys/dev/mlx5/mlx5_ib/mlx5_ib_ah.c (contents, props changed) head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c (contents, props changed) head/sys/dev/mlx5/mlx5_ib/mlx5_ib_doorbell.c (contents, props changed) head/sys/dev/mlx5/mlx5_ib/mlx5_ib_mad.c (contents, props changed) head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c (contents, props changed) head/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c (contents, props changed) head/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c (contents, props changed) head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c (contents, props changed) head/sys/dev/mlx5/mlx5_ib/mlx5_ib_roce.c (contents, props changed) head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c (contents, props changed) head/sys/dev/mlx5/mlx5_ib/user.h (contents, props changed) head/sys/modules/mlx5ib/ head/sys/modules/mlx5ib/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/conf/files head/sys/modules/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Aug 23 11:52:02 2017 (r322809) +++ head/share/man/man4/Makefile Wed Aug 23 12:09:37 2017 (r322810) @@ -888,6 +888,7 @@ MAN+= iser.4 .if ${MK_OFED} != "no" MAN+= mlx4ib.4 +MAN+= mlx5ib.4 .endif .if ${MK_TESTS} != "no" Added: head/share/man/man4/mlx5ib.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/mlx5ib.4 Wed Aug 23 12:09:37 2017 (r322810) @@ -0,0 +1,124 @@ +.\" Copyright (c) 2017 Mellanox Technologies +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 23, 2017 +.Dt MLX5IB 4 +.Os +.Sh NAME +.Nm mlx5ib +.Nd "Mellanox ConnectX-4 and ConnectX-4 LX based 100Gb, 50Gb, 40Gb, 25Gb and 10Gb network adapter driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place these lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "options COMPAT_LINUXKPI" +.Cd "device mlx5" +.Cd "device mlx5ib" +.Ed +.Pp +To load the driver as a module at run-time, +run this command as root: +.Bd -literal -offset indent +kldload mlx5ib +.Ed +.Pp +To load the driver as a +module at boot time, place this line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +mlx5ib_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for infiniband and Remote DMA over Converged Ethernet, +RoCE, for PCI Express network adapters based on ConnectX-4 and ConnectX-4 LX. +.br +For further hardware information and questions related to hardware +requirements, see +.Pa http://www.mellanox.com/ . +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver supports 100Gb, 50Gb, 40Gb, 25Gb and 10Gb network adapters. +ConnectX-4 supports: 10/20/25/40/50/56/100Gb/s speeds. +ConnectX-4 LX supports: 10/25/40/50Gb/s speeds (and reduced power consumption): +.Pp +.Bl -bullet -compact +.It +Mellanox MCX455A-ECAT +.It +Mellanox MCX456A-ECAT +.It +Mellanox MCX415A-CCAT +.It +Mellanox MCX416A-CCAT +.It +Mellanox MCX455A-FCAT +.It +Mellanox MCX456A-FCAT +.It +Mellanox MCX415A-BCAT +.It +Mellanox MCX416A-BCAT +.It +Mellanox MCX4131A-GCAT +.It +Mellanox MCX4131A-BCAT +.It +Mellanox MCX4121A-ACAT +.It +Mellanox MCX4111A-ACAT +.It +Mellanox MCX4121A-XCAT +.It +Mellanox MCX4111A-XCAT +.El +.Sh SUPPORT +For general information and support, +go to the Mellanox support website at: +.Pa http://www.mellanox.com/ . +.Pp +If an issue is identified with this driver with a supported adapter, +email all the specific information related to the issue to +.Aq Mt freebsd-drivers@mellanox.com . +.Sh SEE ALSO +.Xr mlx5en 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 12.x . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Mellanox Technologies . Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Aug 23 11:52:02 2017 (r322809) +++ head/sys/conf/files Wed Aug 23 12:09:37 2017 (r322810) @@ -4508,6 +4508,27 @@ dev/mlx4/mlx4_en/mlx4_en_rx.c optional mlx4en pci in dev/mlx4/mlx4_en/mlx4_en_tx.c optional mlx4en pci inet inet6 \ compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_ah.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_cq.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_doorbell.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_mad.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_main.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_mem.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_mr.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_qp.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_roce.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_srq.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" + dev/mlx5/mlx5_core/mlx5_alloc.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_cmd.c optional mlx5 pci \ Added: head/sys/dev/mlx5/mlx5_ib/mlx5_ib.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Wed Aug 23 12:09:37 2017 (r322810) @@ -0,0 +1,790 @@ +/*- + * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef MLX5_IB_H +#define MLX5_IB_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define mlx5_ib_dbg(dev, format, arg...) \ +pr_debug("mlx5_dbg:%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ + __LINE__, curthread->td_proc->p_pid, ##arg) + +#define mlx5_ib_err(dev, format, arg...) \ +printf("mlx5_ib: ERR: ""mlx5_err:%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ + __LINE__, curthread->td_proc->p_pid, ##arg) + +#define mlx5_ib_warn(dev, format, arg...) \ +printf("mlx5_ib: WARN: ""mlx5_warn:%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ + __LINE__, curthread->td_proc->p_pid, ##arg) +#define BF_ENABLE 0 + +extern struct workqueue_struct *mlx5_ib_wq; + +enum { + MLX5_IB_MMAP_CMD_SHIFT = 8, + MLX5_IB_MMAP_CMD_MASK = 0xff, +}; + +enum mlx5_ib_mmap_cmd { + MLX5_IB_MMAP_REGULAR_PAGE = 0, + MLX5_IB_MMAP_GET_CONTIGUOUS_PAGES = 1, + MLX5_IB_MMAP_WC_PAGE = 2, + MLX5_IB_MMAP_NC_PAGE = 3, + MLX5_IB_MMAP_MAP_DC_INFO_PAGE = 4, + + /* Use EXP mmap commands until it is pushed to upstream */ + MLX5_IB_EXP_MMAP_CORE_CLOCK = 0xFB, + MLX5_IB_EXP_MMAP_GET_CONTIGUOUS_PAGES_CPU_NUMA = 0xFC, + MLX5_IB_EXP_MMAP_GET_CONTIGUOUS_PAGES_DEV_NUMA = 0xFD, + MLX5_IB_EXP_ALLOC_N_MMAP_WC = 0xFE, +}; + +enum { + MLX5_RES_SCAT_DATA32_CQE = 0x1, + MLX5_RES_SCAT_DATA64_CQE = 0x2, + MLX5_REQ_SCAT_DATA32_CQE = 0x11, + MLX5_REQ_SCAT_DATA64_CQE = 0x22, +}; + +enum { + MLX5_DCT_CS_RES_64 = 2, + MLX5_CNAK_RX_POLL_CQ_QUOTA = 256, +}; + +enum mlx5_ib_latency_class { + MLX5_IB_LATENCY_CLASS_LOW, + MLX5_IB_LATENCY_CLASS_MEDIUM, + MLX5_IB_LATENCY_CLASS_HIGH, + MLX5_IB_LATENCY_CLASS_FAST_PATH +}; + +enum mlx5_ib_mad_ifc_flags { + MLX5_MAD_IFC_IGNORE_MKEY = 1, + MLX5_MAD_IFC_IGNORE_BKEY = 2, + MLX5_MAD_IFC_NET_VIEW = 4, +}; + +enum { + MLX5_CROSS_CHANNEL_UUAR = 0, +}; + +enum { + MLX5_IB_MAX_CTX_DYNAMIC_UARS = 256, + MLX5_IB_INVALID_UAR_INDEX = -1U +}; + +enum { + MLX5_MAX_SINGLE_STRIDE_LOG_NUM_BYTES = 13, + MLX5_MIN_SINGLE_STRIDE_LOG_NUM_BYTES = 6, + MLX5_MAX_SINGLE_WQE_LOG_NUM_STRIDES = 16, + MLX5_MIN_SINGLE_WQE_LOG_NUM_STRIDES = 9, +}; + +struct mlx5_ib_ucontext { + struct ib_ucontext ibucontext; + struct list_head db_page_list; + + /* protect doorbell record alloc/free + */ + struct mutex db_page_mutex; + struct mlx5_uuar_info uuari; + u32 dynamic_wc_uar_index[MLX5_IB_MAX_CTX_DYNAMIC_UARS]; + /* Transport Domain number */ + u32 tdn; +}; + +static inline struct mlx5_ib_ucontext *to_mucontext(struct ib_ucontext *ibucontext) +{ + return container_of(ibucontext, struct mlx5_ib_ucontext, ibucontext); +} + +struct mlx5_ib_pd { + struct ib_pd ibpd; + u32 pdn; + u32 pa_lkey; +}; + +struct wr_list { + u16 opcode; + u16 next; +}; + +struct mlx5_swr_ctx { + u64 wrid; + u32 wr_data; + struct wr_list w_list; + u32 wqe_head; + u8 sig_piped; + u8 rsvd[11]; +}; + +struct mlx5_rwr_ctx { + u64 wrid; +}; + +struct mlx5_ib_wq { + union { + struct mlx5_swr_ctx *swr_ctx; + struct mlx5_rwr_ctx *rwr_ctx; + }; + u16 unsig_count; + + /* serialize post to the work queue + */ + spinlock_t lock; + int wqe_cnt; + int max_post; + int max_gs; + int offset; + int wqe_shift; + unsigned head; + unsigned tail; + u16 cur_post; + u16 last_poll; + void *qend; +}; + +enum { + MLX5_QP_USER, + MLX5_QP_KERNEL, + MLX5_QP_EMPTY +}; + +enum { + MLX5_WQ_USER, + MLX5_WQ_KERNEL +}; + +struct mlx5_ib_sqd { + struct mlx5_ib_qp *qp; + struct work_struct work; +}; + +struct mlx5_ib_mc_flows_list { + struct list_head flows_list; + /*Protect the flows_list*/ + struct mutex lock; +}; + +struct mlx5_ib_qp { + struct ib_qp ibqp; + struct mlx5_core_qp mqp; + struct mlx5_core_qp mrq; + struct mlx5_core_qp msq; + u32 tisn; + u32 tirn; + struct mlx5_buf buf; + + struct mlx5_db db; + struct mlx5_ib_wq rq; + + u32 doorbell_qpn; + u8 sq_signal_bits; + u8 fm_cache; + int sq_max_wqes_per_wr; + int sq_spare_wqes; + struct mlx5_ib_wq sq; + + struct ib_umem *umem; + int buf_size; + /* Raw Ethernet QP's SQ is allocated seperately + * from the RQ's buffer in user-space. + */ + struct ib_umem *sq_umem; + int sq_buf_size; + u64 sq_buf_addr; + int allow_mp_wqe; + + /* serialize qp state modifications + */ + struct mutex mutex; + u16 xrcdn; + u32 flags; + u8 port; + u8 alt_port; + u8 atomic_rd_en; + u8 resp_depth; + u8 state; + /* Raw Ethernet QP's SQ and RQ states */ + u8 rq_state; + u8 sq_state; + int mlx_type; + int wq_sig; + int scat_cqe; + int max_inline_data; + struct mlx5_bf *bf; + int has_rq; + + /* only for user space QPs. For kernel + * we have it from the bf object + */ + int uuarn; + + int create_type; + u32 pa_lkey; + + /* Store signature errors */ + bool signature_en; + + struct list_head qps_list; + struct list_head cq_recv_list; + struct list_head cq_send_list; + + struct mlx5_ib_mc_flows_list mc_flows_list; +}; + +struct mlx5_ib_cq_buf { + struct mlx5_buf buf; + struct ib_umem *umem; + int cqe_size; + int nent; +}; + +enum mlx5_ib_qp_flags { + MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK = 1 << 0, + MLX5_IB_QP_SIGNATURE_HANDLING = 1 << 1, + MLX5_IB_QP_CAP_RX_END_PADDING = 1 << 5, +}; + +struct mlx5_umr_wr { + union { + u64 virt_addr; + u64 offset; + } target; + struct ib_pd *pd; + unsigned int page_shift; + unsigned int npages; + u64 length; + int access_flags; + u32 mkey; +}; + +struct mlx5_shared_mr_info { + int mr_id; + struct ib_umem *umem; +}; + +struct mlx5_ib_cq { + struct ib_cq ibcq; + struct mlx5_core_cq mcq; + struct mlx5_ib_cq_buf buf; + struct mlx5_db db; + + /* serialize access to the CQ + */ + spinlock_t lock; + + /* protect resize cq + */ + struct mutex resize_mutex; + struct mlx5_ib_cq_buf *resize_buf; + struct ib_umem *resize_umem; + int cqe_size; + struct list_head list_send_qp; + struct list_head list_recv_qp; +}; + +struct mlx5_ib_srq { + struct ib_srq ibsrq; + struct mlx5_core_srq msrq; + struct mlx5_buf buf; + struct mlx5_db db; + u64 *wrid; + /* protect SRQ hanlding + */ + spinlock_t lock; + int head; + int tail; + u16 wqe_ctr; + struct ib_umem *umem; + /* serialize arming a SRQ + */ + struct mutex mutex; + int wq_sig; +}; + +struct mlx5_ib_xrcd { + struct ib_xrcd ibxrcd; + u32 xrcdn; +}; + +enum mlx5_ib_mtt_access_flags { + MLX5_IB_MTT_READ = (1 << 0), + MLX5_IB_MTT_WRITE = (1 << 1), +}; + +#define MLX5_IB_MTT_PRESENT (MLX5_IB_MTT_READ | MLX5_IB_MTT_WRITE) + +struct mlx5_ib_mr { + struct ib_mr ibmr; + struct mlx5_core_mr mmr; + struct ib_umem *umem; + struct mlx5_shared_mr_info *smr_info; + struct list_head list; + int order; + int umred; + dma_addr_t dma; + int npages; + struct mlx5_ib_dev *dev; + struct mlx5_create_mkey_mbox_out out; + struct mlx5_core_sig_ctx *sig; + u32 max_reg_descriptors; + u64 size; + u64 page_count; + struct mlx5_ib_mr **children; + int nchild; +}; + +struct mlx5_ib_fast_reg_page_list { + struct ib_fast_reg_page_list ibfrpl; + __be64 *mapped_page_list; + dma_addr_t map; +}; + +struct mlx5_ib_umr_context { + enum ib_wc_status status; + struct completion done; +}; + +static inline void mlx5_ib_init_umr_context(struct mlx5_ib_umr_context *context) +{ + context->status = -1; + init_completion(&context->done); +} + +struct umr_common { + struct ib_pd *pd; + struct ib_mr *mr; +}; + +enum { + MLX5_FMR_INVALID, + MLX5_FMR_VALID, + MLX5_FMR_BUSY, +}; + +struct mlx5_ib_fmr { + struct ib_fmr ibfmr; + struct mlx5_core_mr mr; + int access_flags; + int state; + /* protect fmr state + */ + spinlock_t lock; + u64 wrid; + struct ib_send_wr wr[2]; + u8 page_shift; + struct ib_fast_reg_page_list page_list; +}; + +struct cache_order { + struct kobject kobj; + int order; + int index; + struct mlx5_ib_dev *dev; +}; + +struct mlx5_cache_ent { + struct list_head head; + /* sync access to the cahce entry + */ + spinlock_t lock; + + + u32 order; + u32 size; + u32 cur; + u32 miss; + u32 limit; + + struct mlx5_ib_dev *dev; + struct work_struct work; + struct delayed_work dwork; + int pending; + struct cache_order co; +}; + +struct mlx5_mr_cache { + struct workqueue_struct *wq; + struct mlx5_cache_ent ent[MAX_MR_CACHE_ENTRIES]; + int stopped; + struct dentry *root; + int last_add; + int rel_timeout; + int rel_imm; +}; + +struct mlx5_ib_resources { + struct ib_cq *c0; + struct ib_xrcd *x0; + struct ib_xrcd *x1; + struct ib_pd *p0; + struct ib_srq *s0; + struct ib_srq *s1; +}; + +struct mlx5_dc_tracer { + struct page *pg; + dma_addr_t dma; + int size; + int order; +}; + +struct mlx5_dc_desc { + dma_addr_t dma; + void *buf; +}; + +enum mlx5_op { + MLX5_WR_OP_MLX = 1, +}; + +struct mlx5_mlx_wr { + u8 sl; + u16 dlid; + int icrc; +}; + +struct mlx5_send_wr { + struct ib_send_wr wr; + union { + struct mlx5_mlx_wr mlx; + } sel; +}; + +struct mlx5_dc_data { + struct ib_mr *mr; + struct ib_qp *dcqp; + struct ib_cq *rcq; + struct ib_cq *scq; + unsigned int rx_npages; + unsigned int tx_npages; + struct mlx5_dc_desc *rxdesc; + struct mlx5_dc_desc *txdesc; + unsigned int max_wqes; + unsigned int cur_send; + unsigned int last_send_completed; + int tx_pending; + struct mlx5_ib_dev *dev; + int port; + int initialized; + struct kobject kobj; + unsigned long connects; + unsigned long cnaks; + unsigned long discards; + struct ib_wc wc_tbl[MLX5_CNAK_RX_POLL_CQ_QUOTA]; +}; + +struct mlx5_ib_port_sysfs_group { + struct kobject kobj; + bool enabled; + struct attribute_group counters; +}; + +#define MLX5_IB_GID_MAX 16 + +struct mlx5_ib_port { + struct mlx5_ib_dev *dev; + u8 port_num; /* 0 based */ + u8 port_gone; /* set when gone */ + u16 q_cnt_id; + struct mlx5_ib_port_sysfs_group group; + union ib_gid gid_table[MLX5_IB_GID_MAX]; +}; + +struct mlx5_ib_dev { + struct ib_device ib_dev; + struct mlx5_core_dev *mdev; + MLX5_DECLARE_DOORBELL_LOCK(uar_lock); + int num_ports; + /* serialize update of capability mask + */ + struct mutex cap_mask_mutex; + bool ib_active; + struct umr_common umrc; + /* sync used page count stats + */ + struct mlx5_ib_resources devr; + struct mutex slow_path_mutex; + int enable_atomic_resp; + enum ib_atomic_cap atomic_cap; + struct mlx5_mr_cache cache; + struct kobject mr_cache; + /* protect resources needed as part of reset flow */ + spinlock_t reset_flow_resource_lock; + struct list_head qp_list; + struct timer_list delay_timer; + int fill_delay; + struct mlx5_dc_tracer dctr; + struct mlx5_dc_data dcd[MLX5_MAX_PORTS]; + struct kobject *dc_kobj; + /* Array with num_ports elements */ + struct mlx5_ib_port *port; + struct kobject *ports_parent; +}; + +static inline struct mlx5_ib_cq *to_mibcq(struct mlx5_core_cq *mcq) +{ + return container_of(mcq, struct mlx5_ib_cq, mcq); +} + +static inline struct mlx5_ib_xrcd *to_mxrcd(struct ib_xrcd *ibxrcd) +{ + return container_of(ibxrcd, struct mlx5_ib_xrcd, ibxrcd); +} + +static inline struct mlx5_ib_dev *to_mdev(struct ib_device *ibdev) +{ + return container_of(ibdev, struct mlx5_ib_dev, ib_dev); +} + +static inline struct mlx5_ib_fmr *to_mfmr(struct ib_fmr *ibfmr) +{ + return container_of(ibfmr, struct mlx5_ib_fmr, ibfmr); +} + +static inline struct mlx5_ib_cq *to_mcq(struct ib_cq *ibcq) +{ + return container_of(ibcq, struct mlx5_ib_cq, ibcq); +} + +static inline struct mlx5_ib_qp *to_mibqp(struct mlx5_core_qp *mqp) +{ + return container_of(mqp, struct mlx5_ib_qp, mqp); +} + +static inline struct mlx5_ib_qp *sq_to_mibqp(struct mlx5_core_qp *msq) +{ + return container_of(msq, struct mlx5_ib_qp, msq); +} + +static inline struct mlx5_ib_qp *rq_to_mibqp(struct mlx5_core_qp *mrq) +{ + return container_of(mrq, struct mlx5_ib_qp, mrq); +} + +static inline struct mlx5_ib_mr *to_mibmr(struct mlx5_core_mr *mmr) +{ + return container_of(mmr, struct mlx5_ib_mr, mmr); +} + +static inline struct mlx5_ib_pd *to_mpd(struct ib_pd *ibpd) +{ + return container_of(ibpd, struct mlx5_ib_pd, ibpd); +} + +static inline struct mlx5_ib_srq *to_msrq(struct ib_srq *ibsrq) +{ + return container_of(ibsrq, struct mlx5_ib_srq, ibsrq); +} + +static inline struct mlx5_ib_qp *to_mqp(struct ib_qp *ibqp) +{ + return container_of(ibqp, struct mlx5_ib_qp, ibqp); +} + +static inline struct mlx5_ib_srq *to_mibsrq(struct mlx5_core_srq *msrq) +{ + return container_of(msrq, struct mlx5_ib_srq, msrq); +} + +static inline struct mlx5_ib_mr *to_mmr(struct ib_mr *ibmr) +{ + return container_of(ibmr, struct mlx5_ib_mr, ibmr); +} + +static inline struct mlx5_ib_fast_reg_page_list *to_mfrpl(struct ib_fast_reg_page_list *ibfrpl) +{ + return container_of(ibfrpl, struct mlx5_ib_fast_reg_page_list, ibfrpl); +} + +struct mlx5_ib_ah { + struct ib_ah ibah; + struct mlx5_av av; +}; + +static inline struct mlx5_ib_ah *to_mah(struct ib_ah *ibah) +{ + return container_of(ibah, struct mlx5_ib_ah, ibah); +} + +int mlx5_ib_db_map_user(struct mlx5_ib_ucontext *context, uintptr_t virt, + struct mlx5_db *db); +void mlx5_ib_db_unmap_user(struct mlx5_ib_ucontext *context, struct mlx5_db *db); +void __mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 qpn, struct mlx5_ib_srq *srq); +void mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 qpn, struct mlx5_ib_srq *srq); +void mlx5_ib_free_srq_wqe(struct mlx5_ib_srq *srq, int wqe_index); +int mlx5_MAD_IFC(struct mlx5_ib_dev *dev, int ignore_mkey, int ignore_bkey, + u8 port, struct ib_wc *in_wc, struct ib_grh *in_grh, + void *in_mad, void *response_mad); +struct ib_ah *create_ib_ah(struct mlx5_ib_dev *dev, struct ib_ah_attr *ah_attr, + struct mlx5_ib_ah *ah, enum rdma_link_layer ll); +struct ib_ah *mlx5_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr); +int mlx5_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr); +int mlx5_ib_destroy_ah(struct ib_ah *ah); +struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, + struct ib_srq_init_attr *init_attr, + struct ib_udata *udata); +int mlx5_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, + enum ib_srq_attr_mask attr_mask, struct ib_udata *udata); +int mlx5_ib_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr); +int mlx5_ib_destroy_srq(struct ib_srq *srq); +int mlx5_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, + struct ib_recv_wr **bad_wr); +struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, + struct ib_qp_init_attr *init_attr, + struct ib_udata *udata); +int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, + int attr_mask, struct ib_udata *udata); +int mlx5_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask, + struct ib_qp_init_attr *qp_init_attr); +int mlx5_ib_destroy_qp(struct ib_qp *qp); +int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, + struct ib_send_wr **bad_wr); +int mlx5_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, + struct ib_recv_wr **bad_wr); +void *mlx5_get_send_wqe(struct mlx5_ib_qp *qp, int n); +struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, + struct ib_cq_init_attr *attr, + struct ib_ucontext *context, + struct ib_udata *udata); +int mlx5_ib_destroy_cq(struct ib_cq *cq); +int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc); +int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags); +int mlx5_ib_modify_cq(struct ib_cq *cq, struct ib_cq_attr *attr, int cq_attr_mask); +int mlx5_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata); +struct ib_mr *mlx5_ib_get_dma_mr(struct ib_pd *pd, int acc); +struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, + u64 virt_addr, int access_flags, + struct ib_udata *udata, int mr_id); +struct ib_mr *mlx5_ib_reg_phys_mr(struct ib_pd *pd, + struct ib_phys_buf *buffer_list, + int num_phys_buf, + int access_flags, + u64 *virt_addr); +int mlx5_ib_dereg_mr(struct ib_mr *ibmr); +int mlx5_ib_destroy_mr(struct ib_mr *ibmr); +struct ib_mr *mlx5_ib_alloc_fast_reg_mr(struct ib_pd *pd, + int max_page_list_len); +struct ib_fast_reg_page_list *mlx5_ib_alloc_fast_reg_page_list(struct ib_device *ibdev, + int page_list_len); +void mlx5_ib_free_fast_reg_page_list(struct ib_fast_reg_page_list *page_list); + +struct ib_fmr *mlx5_ib_fmr_alloc(struct ib_pd *pd, int acc, + struct ib_fmr_attr *fmr_attr); +int mlx5_ib_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list, + int npages, u64 iova); +int mlx5_ib_unmap_fmr(struct list_head *fmr_list); +int mlx5_ib_fmr_dealloc(struct ib_fmr *ibfmr); +int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, + struct ib_wc *in_wc, struct ib_grh *in_grh, + struct ib_mad *in_mad, struct ib_mad *out_mad); +struct ib_xrcd *mlx5_ib_alloc_xrcd(struct ib_device *ibdev, + struct ib_ucontext *context, + struct ib_udata *udata); +int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd); +int mlx5_ib_get_buf_offset(u64 addr, int page_shift, u32 *offset); +int mlx5_query_ext_port_caps(struct mlx5_ib_dev *dev, u8 port); +int mlx5_query_smp_attr_node_info_mad_ifc(struct ib_device *ibdev, + struct ib_smp *out_mad); +int mlx5_query_system_image_guid_mad_ifc(struct ib_device *ibdev, + __be64 *sys_image_guid); +int mlx5_query_max_pkeys_mad_ifc(struct ib_device *ibdev, + u16 *max_pkeys); +int mlx5_query_vendor_id_mad_ifc(struct ib_device *ibdev, + u32 *vendor_id); +int mlx5_query_pkey_mad_ifc(struct ib_device *ibdev, u8 port, u16 index, + u16 *pkey); +int mlx5_query_node_desc_mad_ifc(struct mlx5_ib_dev *dev, char *node_desc); +int mlx5_query_node_guid_mad_ifc(struct mlx5_ib_dev *dev, u64 *node_guid); +int mlx5_query_gids_mad_ifc(struct ib_device *ibdev, u8 port, int index, + union ib_gid *gid); +int mlx5_query_port_mad_ifc(struct ib_device *ibdev, u8 port, + struct ib_port_attr *props); +int mlx5_ib_query_port(struct ib_device *ibdev, u8 port, + struct ib_port_attr *props); +int mlx5_ib_init_fmr(struct mlx5_ib_dev *dev); +void mlx5_ib_cleanup_fmr(struct mlx5_ib_dev *dev); +void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, + int *ncont, int *order); +void mlx5_ib_populate_pas(struct mlx5_ib_dev *dev, struct ib_umem *umem, + int page_shift, __be64 *pas, int umr); +void mlx5_ib_copy_pas(u64 *old, u64 *new, int step, int num); +int mlx5_ib_get_cqe_size(struct mlx5_ib_dev *dev, struct ib_cq *ibcq); +int mlx5_mr_cache_init(struct mlx5_ib_dev *dev); +int mlx5_mr_cache_cleanup(struct mlx5_ib_dev *dev); +int mlx5_mr_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift); +void mlx5_umr_cq_handler(struct ib_cq *cq, void *cq_context); +int mlx5_query_port_roce(struct ib_device *ibdev, u8 port, + struct ib_port_attr *props); +__be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port, int index, + __be16 ah_udp_s_port); +int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port, + int index, int *gid_type); +struct net_device *mlx5_ib_get_netdev(struct ib_device *ib_dev, u8 port); +int modify_gid_roce(struct ib_device *ib_dev, u8 port, unsigned int index, + const union ib_gid *gid, struct net_device *ndev); +int query_gid_roce(struct ib_device *ib_dev, u8 port, int index, + union ib_gid *gid); +int mlx5_process_mad_mad_ifc(struct ib_device *ibdev, int mad_flags, + u8 port_num, struct ib_wc *in_wc, + struct ib_grh *in_grh, struct ib_mad *in_mad, + struct ib_mad *out_mad); + +static inline void init_query_mad(struct ib_smp *mad) +{ + mad->base_version = 1; + mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; + mad->class_version = 1; + mad->method = IB_MGMT_METHOD_GET; +} + +static inline u8 convert_access(int acc) +{ + return (acc & IB_ACCESS_REMOTE_ATOMIC ? MLX5_PERM_ATOMIC : 0) | + (acc & IB_ACCESS_REMOTE_WRITE ? MLX5_PERM_REMOTE_WRITE : 0) | + (acc & IB_ACCESS_REMOTE_READ ? MLX5_PERM_REMOTE_READ : 0) | + (acc & IB_ACCESS_LOCAL_WRITE ? MLX5_PERM_LOCAL_WRITE : 0) | + MLX5_PERM_LOCAL_READ; +} + +#define MLX5_MAX_UMR_SHIFT 16 +#define MLX5_MAX_UMR_PAGES (1 << MLX5_MAX_UMR_SHIFT) + +#endif /* MLX5_IB_H */ Added: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_ah.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_ah.c Wed Aug 23 12:09:37 2017 (r322810) @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "mlx5_ib.h" + +#define IPV6_DEFAULT_HOPLIMIT 64 + +struct ib_ah *create_ib_ah(struct mlx5_ib_dev *dev, + struct ib_ah_attr *ah_attr, + struct mlx5_ib_ah *ah, enum rdma_link_layer ll) +{ + int err; + int gid_type; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Aug 23 12:47:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E95F5DE67F1; Wed, 23 Aug 2017 12:47:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B74206EACF; Wed, 23 Aug 2017 12:47:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NClAEO086623; Wed, 23 Aug 2017 12:47:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NClAJI086622; Wed, 23 Aug 2017 12:47:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708231247.v7NClAJI086622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 23 Aug 2017 12:47:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322811 - head X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 12:47:12 -0000 Author: emaste Date: Wed Aug 23 12:47:10 2017 New Revision: 322811 URL: https://svnweb.freebsd.org/changeset/base/322811 Log: Set MK_LLD_IS_LD to MK_LLD_BOOTSTRAP for cross-tools LLD_BOOTSTRAP is intended to control the linker used to link world and kernel, while LLD_IS_LD is intended to control the linker installed in that world. Force LLD_IS_LD equal to LLD_BOOTSTRAP for the cross-tools build and install phase, so that lld will be installed as the ld to run on the host, when LLD_BOOTSTRAP is set. PR: 221543 Reviewed by: dim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12072 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Aug 23 12:09:37 2017 (r322810) +++ head/Makefile.inc1 Wed Aug 23 12:47:10 2017 (r322811) @@ -557,7 +557,7 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - MK_GDB=no MK_TESTS=no + MK_GDB=no MK_LLD_IS_LD=${MK_LLD_BOOTSTRAP} MK_TESTS=no # kernel-tools stage KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ From owner-svn-src-all@freebsd.org Wed Aug 23 14:50:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D4AEDE8E90; Wed, 23 Aug 2017 14:50:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A179732CC; Wed, 23 Aug 2017 14:50:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NEo8Oa038159; Wed, 23 Aug 2017 14:50:08 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NEo8iH038158; Wed, 23 Aug 2017 14:50:08 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201708231450.v7NEo8iH038158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 23 Aug 2017 14:50:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322812 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 322812 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 14:50:09 -0000 Author: tuexen Date: Wed Aug 23 14:50:08 2017 New Revision: 322812 URL: https://svnweb.freebsd.org/changeset/base/322812 Log: Avoid TCP log messages which are false positives. The check for timestamps are too early to handle SYN-ACK correctly. So move it down after the corresponing processing has been done. PR: 216832 Obtained from: antonfb@hesiod.org MFC after: 1 week Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Wed Aug 23 12:47:10 2017 (r322811) +++ head/sys/netinet/tcp_input.c Wed Aug 23 14:50:08 2017 (r322812) @@ -1694,25 +1694,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru to.to_tsecr = 0; } /* - * If timestamps were negotiated during SYN/ACK they should - * appear on every segment during this session and vice versa. - */ - if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - } - } - if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp not expected, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - } - } - - /* * Process options only when we get SYN/ACK back. The SYN case * for incoming connections is handled in tcp_syncache. * According to RFC1323 the window field in a SYN (i.e., a @@ -1740,6 +1721,25 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru if ((tp->t_flags & TF_SACK_PERMIT) && (to.to_flags & TOF_SACKPERM) == 0) tp->t_flags &= ~TF_SACK_PERMIT; + } + + /* + * If timestamps were negotiated during SYN/ACK they should + * appear on every segment during this session and vice versa. + */ + if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "no action\n", s, __func__); + free(s, M_TCPLOG); + } + } + if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp not expected, " + "no action\n", s, __func__); + free(s, M_TCPLOG); + } } /* From owner-svn-src-all@freebsd.org Wed Aug 23 15:08:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A0A4DE94A6; Wed, 23 Aug 2017 15:08:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E855173F23; Wed, 23 Aug 2017 15:08:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NF8q42046464; Wed, 23 Aug 2017 15:08:52 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NF8qdK046463; Wed, 23 Aug 2017 15:08:52 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201708231508.v7NF8qdK046463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 23 Aug 2017 15:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322813 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 322813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 15:08:53 -0000 Author: tuexen Date: Wed Aug 23 15:08:51 2017 New Revision: 322813 URL: https://svnweb.freebsd.org/changeset/base/322813 Log: Avoid TCP log messages which are false positives. This is https://svnweb.freebsd.org/changeset/base/322812, just for alternate TCP stacks. XMFC with: 322812 Modified: head/sys/netinet/tcp_stacks/fastpath.c Modified: head/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- head/sys/netinet/tcp_stacks/fastpath.c Wed Aug 23 14:50:08 2017 (r322812) +++ head/sys/netinet/tcp_stacks/fastpath.c Wed Aug 23 15:08:51 2017 (r322813) @@ -1831,24 +1831,6 @@ tcp_do_segment_fastslow(struct mbuf *m, struct tcphdr if (TSTMP_GT(to.to_tsecr, tcp_ts_getticks())) to.to_tsecr = 0; } - /* - * If timestamps were negotiated during SYN/ACK they should - * appear on every segment during this session and vice versa. - */ - if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - } - } - if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp not expected, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - } - } /* * Process options only when we get SYN/ACK back. The SYN case @@ -1879,6 +1861,26 @@ tcp_do_segment_fastslow(struct mbuf *m, struct tcphdr (to.to_flags & TOF_SACKPERM) == 0) tp->t_flags &= ~TF_SACK_PERMIT; } + + /* + * If timestamps were negotiated during SYN/ACK they should + * appear on every segment during this session and vice versa. + */ + if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "no action\n", s, __func__); + free(s, M_TCPLOG); + } + } + if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp not expected, " + "no action\n", s, __func__); + free(s, M_TCPLOG); + } + } + can_enter = 0; if (__predict_true((tlen == 0))) { /* @@ -2306,24 +2308,6 @@ tcp_do_segment_fastack(struct mbuf *m, struct tcphdr * if (TSTMP_GT(to.to_tsecr, tcp_ts_getticks())) to.to_tsecr = 0; } - /* - * If timestamps were negotiated during SYN/ACK they should - * appear on every segment during this session and vice versa. - */ - if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - } - } - if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp not expected, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - } - } /* * Process options only when we get SYN/ACK back. The SYN case @@ -2354,6 +2338,26 @@ tcp_do_segment_fastack(struct mbuf *m, struct tcphdr * (to.to_flags & TOF_SACKPERM) == 0) tp->t_flags &= ~TF_SACK_PERMIT; } + + /* + * If timestamps were negotiated during SYN/ACK they should + * appear on every segment during this session and vice versa. + */ + if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "no action\n", s, __func__); + free(s, M_TCPLOG); + } + } + if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp not expected, " + "no action\n", s, __func__); + free(s, M_TCPLOG); + } + } + /* * Header prediction: check for the two common cases * of a uni-directional data xfer. If the packet has From owner-svn-src-all@freebsd.org Wed Aug 23 15:44:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DCC5DE9EF8; Wed, 23 Aug 2017 15:44:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BF767512F; Wed, 23 Aug 2017 15:44:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NFhxoq062396; Wed, 23 Aug 2017 15:43:59 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NFhxVY062394; Wed, 23 Aug 2017 15:43:59 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708231543.v7NFhxVY062394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 23 Aug 2017 15:43:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322814 - stable/11/sys/fs/ext2fs X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/sys/fs/ext2fs X-SVN-Commit-Revision: 322814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 15:44:00 -0000 Author: pfg Date: Wed Aug 23 15:43:59 2017 New Revision: 322814 URL: https://svnweb.freebsd.org/changeset/base/322814 Log: MFC r320146, r320170, 320842: Minor grammar changes and cleanups in order to facilitate future merges. Modified: stable/11/sys/fs/ext2fs/ext2_inode_cnv.c stable/11/sys/fs/ext2fs/ext2fs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- stable/11/sys/fs/ext2fs/ext2_inode_cnv.c Wed Aug 23 15:08:51 2017 (r322813) +++ stable/11/sys/fs/ext2fs/ext2_inode_cnv.c Wed Aug 23 15:43:59 2017 (r322814) @@ -126,7 +126,7 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) ip->i_gid = ei->e2di_gid; ip->i_uid |= (uint32_t)ei->e2di_uid_high << 16; ip->i_gid |= (uint32_t)ei->e2di_gid_high << 16; - /* XXX use memcpy */ + for (i = 0; i < NDADDR; i++) ip->i_db[i] = ei->e2di_blocks[i]; for (i = 0; i < NIADDR; i++) @@ -176,7 +176,7 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) ei->e2di_uid_high = ip->i_uid >> 16 & 0xffff; ei->e2di_gid = ip->i_gid & 0xffff; ei->e2di_gid_high = ip->i_gid >> 16 & 0xffff; - /* XXX use memcpy */ + for (i = 0; i < NDADDR; i++) ei->e2di_blocks[i] = ip->i_db[i]; for (i = 0; i < NIADDR; i++) Modified: stable/11/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/11/sys/fs/ext2fs/ext2fs.h Wed Aug 23 15:08:51 2017 (r322813) +++ stable/11/sys/fs/ext2fs/ext2fs.h Wed Aug 23 15:43:59 2017 (r322814) @@ -374,9 +374,8 @@ struct ext2_gd { uint16_t ext4bgd_csum; /* group descriptor checksum */ }; - -/* EXT2FS metadatas are stored in little-endian byte order. These macros - * helps reading these metadatas +/* EXT2FS metadata is stored in little-endian byte order. These macros + * help reading it. */ #define e2fs_cgload(old, new, size) memcpy((new), (old), (size)); From owner-svn-src-all@freebsd.org Wed Aug 23 15:47:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7411DEA05D; Wed, 23 Aug 2017 15:47:43 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5CAA7537A; Wed, 23 Aug 2017 15:47:43 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NFlgKG062612; Wed, 23 Aug 2017 15:47:42 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NFlgxG062611; Wed, 23 Aug 2017 15:47:42 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201708231547.v7NFlgxG062611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Wed, 23 Aug 2017 15:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322815 - stable/11/usr.sbin/ctladm X-SVN-Group: stable-11 X-SVN-Commit-Author: benno X-SVN-Commit-Paths: stable/11/usr.sbin/ctladm X-SVN-Commit-Revision: 322815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 15:47:44 -0000 Author: benno Date: Wed Aug 23 15:47:42 2017 New Revision: 322815 URL: https://svnweb.freebsd.org/changeset/base/322815 Log: MFC r322804: Correct typo in usage string. Submitted by: peterpakos (GitHub username) Modified: stable/11/usr.sbin/ctladm/ctladm.c Modified: stable/11/usr.sbin/ctladm/ctladm.c ============================================================================== --- stable/11/usr.sbin/ctladm/ctladm.c Wed Aug 23 15:43:59 2017 (r322814) +++ stable/11/usr.sbin/ctladm/ctladm.c Wed Aug 23 15:47:42 2017 (r322815) @@ -3958,7 +3958,7 @@ usage(int error) "-q : omit header in list output\n" "-x : output port list in XML format\n" "portlist options:\n" -"-f fronetnd : specify frontend type\n" +"-f frontend : specify frontend type\n" "-i : report target and initiators addresses\n" "-l : report LUN mapping\n" "-p targ_port : specify target port number\n" From owner-svn-src-all@freebsd.org Wed Aug 23 16:50:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2E8ADEB0B0; Wed, 23 Aug 2017 16:50:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B058276F7C; Wed, 23 Aug 2017 16:50:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NGoAsf087598; Wed, 23 Aug 2017 16:50:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NGoApe087597; Wed, 23 Aug 2017 16:50:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708231650.v7NGoApe087597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Aug 2017 16:50:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322816 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 322816 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 16:50:12 -0000 Author: markj Date: Wed Aug 23 16:50:10 2017 New Revision: 322816 URL: https://svnweb.freebsd.org/changeset/base/322816 Log: Set the bus number field when attaching a PCI device. MFC after: 1 week Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Aug 23 15:47:42 2017 (r322815) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Aug 23 16:50:10 2017 (r322816) @@ -167,6 +167,7 @@ linux_pci_attach(device_t dev) if (pdev->bus == NULL) { pbus = malloc(sizeof(*pbus), M_DEVBUF, M_WAITOK | M_ZERO); pbus->self = pdev; + pbus->number = pci_get_bus(dev); pdev->bus = pbus; } From owner-svn-src-all@freebsd.org Wed Aug 23 17:12:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBE48DEB8A6; Wed, 23 Aug 2017 17:12:27 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B88977B5C; Wed, 23 Aug 2017 17:12:27 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NHCQNJ099422; Wed, 23 Aug 2017 17:12:26 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NHCQ6H099421; Wed, 23 Aug 2017 17:12:26 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708231712.v7NHCQ6H099421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 23 Aug 2017 17:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322817 - stable/11/release X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release X-SVN-Commit-Revision: 322817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 17:12:27 -0000 Author: gjb Date: Wed Aug 23 17:12:26 2017 New Revision: 322817 URL: https://svnweb.freebsd.org/changeset/base/322817 Log: MFC r322544: Always expand the full path to the configuration file specified with the '-c' flag. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/release.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/release/release.sh ============================================================================== --- stable/11/release/release.sh Wed Aug 23 16:50:10 2017 (r322816) +++ stable/11/release/release.sh Wed Aug 23 17:12:26 2017 (r322817) @@ -390,7 +390,7 @@ main() { while getopts c: opt; do case ${opt} in c) - RELEASECONF="${OPTARG}" + RELEASECONF="$(realpath ${OPTARG})" ;; \?) usage From owner-svn-src-all@freebsd.org Wed Aug 23 17:47:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5543DEBFED; Wed, 23 Aug 2017 17:47:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4C527CBAA; Wed, 23 Aug 2017 17:47:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NHlvPY012138; Wed, 23 Aug 2017 17:47:57 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NHlvGm012137; Wed, 23 Aug 2017 17:47:57 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708231747.v7NHlvGm012137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 23 Aug 2017 17:47:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322818 - stable/10/release X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/release X-SVN-Commit-Revision: 322818 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 17:47:59 -0000 Author: gjb Date: Wed Aug 23 17:47:57 2017 New Revision: 322818 URL: https://svnweb.freebsd.org/changeset/base/322818 Log: MFC r322544: Always expand the full path to the configuration file specified with the '-c' flag. This fixes an issue where the configuration file would not properly be located intermittently. Approved by: re (kib, marius) Sponsored by: The FreeBSD Foundation Modified: stable/10/release/release.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/release/release.sh ============================================================================== --- stable/10/release/release.sh Wed Aug 23 17:12:26 2017 (r322817) +++ stable/10/release/release.sh Wed Aug 23 17:47:57 2017 (r322818) @@ -384,7 +384,7 @@ main() { while getopts c: opt; do case ${opt} in c) - RELEASECONF="${OPTARG}" + RELEASECONF="$(realpath ${OPTARG})" ;; \?) usage From owner-svn-src-all@freebsd.org Wed Aug 23 17:52:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20754DEC226; Wed, 23 Aug 2017 17:52:51 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E16997CFF1; Wed, 23 Aug 2017 17:52:50 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NHqoer016078; Wed, 23 Aug 2017 17:52:50 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NHqoRk016077; Wed, 23 Aug 2017 17:52:50 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708231752.v7NHqoRk016077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 23 Aug 2017 17:52:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322819 - head/usr.sbin/camdd X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: head/usr.sbin/camdd X-SVN-Commit-Revision: 322819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 17:52:51 -0000 Author: ken Date: Wed Aug 23 17:52:49 2017 New Revision: 322819 URL: https://svnweb.freebsd.org/changeset/base/322819 Log: Fix a resource leak in an error case in camdd_buf_sg_create(). Submitted by: Coverity CID: 1341622 MFC after: 3 days Sponsored by: Spectra Logic Modified: head/usr.sbin/camdd/camdd.c Modified: head/usr.sbin/camdd/camdd.c ============================================================================== --- head/usr.sbin/camdd/camdd.c Wed Aug 23 17:47:57 2017 (r322818) +++ head/usr.sbin/camdd/camdd.c Wed Aug 23 17:52:49 2017 (r322819) @@ -824,6 +824,7 @@ camdd_buf_sg_create(struct camdd_buf *buf, int iovec, struct camdd_buf_data *data; uint8_t *extra_buf = NULL; size_t extra_buf_len = 0; + int extra_buf_attached = 0; int i, retval = 0; data = &buf->buf_type_spec.data; @@ -913,6 +914,7 @@ camdd_buf_sg_create(struct camdd_buf *buf, int iovec, data->iovec[i].iov_base = extra_buf; data->iovec[i].iov_len = extra_buf_len; } + extra_buf_attached = 1; i++; } if ((tmp_buf != NULL) || (i != data->sg_count)) { @@ -926,6 +928,14 @@ bailout: if (retval == 0) { *num_sectors_used = (data->fill_len + extra_buf_len) / sector_size; + } else if (extra_buf_attached == 0) { + /* + * If extra_buf isn't attached yet, we need to free it + * to avoid leaking. + */ + free(extra_buf); + data->extra_buf = 0; + data->sg_count--; } return (retval); } From owner-svn-src-all@freebsd.org Wed Aug 23 17:56:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D0E1DEC3F5; Wed, 23 Aug 2017 17:56:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59E5A7D1EB; Wed, 23 Aug 2017 17:56:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NHutiU016264; Wed, 23 Aug 2017 17:56:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NHutQM016263; Wed, 23 Aug 2017 17:56:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708231756.v7NHutQM016263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 23 Aug 2017 17:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322820 - head/contrib/top X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/top X-SVN-Commit-Revision: 322820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 17:56:56 -0000 Author: emaste Date: Wed Aug 23 17:56:55 2017 New Revision: 322820 URL: https://svnweb.freebsd.org/changeset/base/322820 Log: top: use __mips__ and __NetBSD__ for consistency r322767 fixed the mips64 build failure with Clang with a minimal change to use __FreeBSD__ instead of FreeBSD in a #if test. For consistency and to facilitate possible upstreaming change the other macros in the test to their canonical form. Discussed with: jhb Modified: head/contrib/top/loadavg.h Modified: head/contrib/top/loadavg.h ============================================================================== --- head/contrib/top/loadavg.h Wed Aug 23 17:52:49 2017 (r322819) +++ head/contrib/top/loadavg.h Wed Aug 23 17:56:55 2017 (r322820) @@ -19,7 +19,7 @@ * * Defined types: load_avg for load averages, pctcpu for cpu percentages. */ -#if defined(mips) && !(defined(NetBSD) || defined(__FreeBSD__)) +#if defined(__mips__) && !(defined(__NetBSD__) || defined(__FreeBSD__)) # include # if defined(FBITS) && !defined(FSCALE) # define FSCALE (1 << FBITS) /* RISC/os on mips */ From owner-svn-src-all@freebsd.org Wed Aug 23 19:00:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8947BDED22F; Wed, 23 Aug 2017 19:00:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58BE17EA0D; Wed, 23 Aug 2017 19:00:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NJ06b7040951; Wed, 23 Aug 2017 19:00:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NJ06K5040950; Wed, 23 Aug 2017 19:00:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708231900.v7NJ06K5040950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 23 Aug 2017 19:00:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322821 - head/sys/dev/isp X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/isp X-SVN-Commit-Revision: 322821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 19:00:07 -0000 Author: mav Date: Wed Aug 23 19:00:06 2017 New Revision: 322821 URL: https://svnweb.freebsd.org/changeset/base/322821 Log: Add missing restart_queue initialization. MFC after: 1 week Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Wed Aug 23 17:56:55 2017 (r322820) +++ head/sys/dev/isp/isp_freebsd.c Wed Aug 23 19:00:06 2017 (r322821) @@ -971,6 +971,7 @@ create_lun_state(ispsoftc_t *isp, int bus, struct cam_ tptr->ts_lun = lun; SLIST_INIT(&tptr->atios); SLIST_INIT(&tptr->inots); + STAILQ_INIT(&tptr->restart_queue); ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(lun)], lhp); SLIST_INSERT_HEAD(lhp, tptr, next); *rslt = tptr; From owner-svn-src-all@freebsd.org Wed Aug 23 21:49:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DD71DEF926; Wed, 23 Aug 2017 21:49:57 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 550AB82CE6; Wed, 23 Aug 2017 21:49:57 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NLnuh2011777; Wed, 23 Aug 2017 21:49:56 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NLnudw011776; Wed, 23 Aug 2017 21:49:56 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201708232149.v7NLnudw011776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 23 Aug 2017 21:49:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322823 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 322823 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 21:49:57 -0000 Author: sbruno Date: Wed Aug 23 21:49:56 2017 New Revision: 322823 URL: https://svnweb.freebsd.org/changeset/base/322823 Log: iflib: call device's if_init function during vlan initialization. Submitted by: bhargava.marreddy@broadcom.com Reviewed by: shurd Sponsored by: Broadcom Differential Revision: https://reviews.freebsd.org/D12098 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Aug 23 20:28:25 2017 (r322822) +++ head/sys/net/iflib.c Wed Aug 23 21:49:56 2017 (r322823) @@ -3927,7 +3927,7 @@ iflib_vlan_register(void *arg, if_t ifp, uint16_t vtag IFDI_VLAN_REGISTER(ctx, vtag); /* Re-init to load the changes */ if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) - iflib_init_locked(ctx); + iflib_if_init_locked(ctx); CTX_UNLOCK(ctx); } @@ -3946,7 +3946,7 @@ iflib_vlan_unregister(void *arg, if_t ifp, uint16_t vt IFDI_VLAN_UNREGISTER(ctx, vtag); /* Re-init to load the changes */ if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) - iflib_init_locked(ctx); + iflib_if_init_locked(ctx); CTX_UNLOCK(ctx); } From owner-svn-src-all@freebsd.org Wed Aug 23 23:30:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FD43DF0C8D; Wed, 23 Aug 2017 23:30:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B580135B; Wed, 23 Aug 2017 23:30:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7NNUQnN052281; Wed, 23 Aug 2017 23:30:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7NNUPpV052276; Wed, 23 Aug 2017 23:30:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708232330.v7NNUPpV052276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 23 Aug 2017 23:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322824 - in head: lib/clang share/mk usr.bin/clang X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: lib/clang share/mk usr.bin/clang X-SVN-Commit-Revision: 322824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 23:30:27 -0000 Author: jhb Date: Wed Aug 23 23:30:25 2017 New Revision: 322824 URL: https://svnweb.freebsd.org/changeset/base/322824 Log: Improve the coverage of debug symbols for MK_DEBUG_FILES. - Include debug symbols in static libraries. This permits binaries to include debug symbols for functions obtained from static libraries. - Permit the C/C++ compiler flags added for MK_DEBUG_FILES to be overridden by setting DEBUG_FILES_CFLAGS. Use this to limit the debug information for llvm libraries and binaries. Reviewed by: emaste Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D12025 Added: head/lib/clang/Makefile.inc (contents, props changed) Modified: head/share/mk/bsd.lib.mk head/share/mk/bsd.prog.mk head/share/mk/bsd.sys.mk head/usr.bin/clang/Makefile.inc Added: head/lib/clang/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/clang/Makefile.inc Wed Aug 23 23:30:25 2017 (r322824) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.include + +.if ${COMPILER_TYPE} == "clang" +DEBUG_FILES_CFLAGS= -gline-tables-only +.else +DEBUG_FILES_CFLAGS= -g1 +.endif Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Wed Aug 23 21:49:56 2017 (r322823) +++ head/share/mk/bsd.lib.mk Wed Aug 23 23:30:25 2017 (r322824) @@ -69,8 +69,8 @@ TAG_ARGS= -T ${TAGS:[*]:S/ /,/g} .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ empty(DEBUG_FLAGS:M-gdwarf*) -SHARED_CFLAGS+= -g -SHARED_CXXFLAGS+= -g +CFLAGS+= ${DEBUG_FILES_CFLAGS} +CXXFLAGS+= ${DEBUG_FILES_CFLAGS} CTFFLAGS+= -g .endif Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Wed Aug 23 21:49:56 2017 (r322823) +++ head/share/mk/bsd.prog.mk Wed Aug 23 23:30:25 2017 (r322824) @@ -39,7 +39,7 @@ CFLAGS+=${CRUNCH_CFLAGS} .else .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ empty(DEBUG_FLAGS:M-gdwarf-*) -CFLAGS+= -g +CFLAGS+= ${DEBUG_FILES_CFLAGS} CTFFLAGS+= -g .endif .endif Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Wed Aug 23 21:49:56 2017 (r322823) +++ head/share/mk/bsd.sys.mk Wed Aug 23 23:30:25 2017 (r322824) @@ -212,6 +212,10 @@ SSP_CFLAGS?= -fstack-protector CFLAGS+= ${SSP_CFLAGS} .endif # SSP && !ARM && !MIPS +# Additional flags passed in CFLAGS and CXXFLAGS when MK_DEBUG_FILES is +# enabled. +DEBUG_FILES_CFLAGS?= -g + # Allow user-specified additional warning flags, plus compiler and file # specific flag overrides, unless we've overriden this... .if ${MK_WARNS} != "no" Modified: head/usr.bin/clang/Makefile.inc ============================================================================== --- head/usr.bin/clang/Makefile.inc Wed Aug 23 21:49:56 2017 (r322823) +++ head/usr.bin/clang/Makefile.inc Wed Aug 23 23:30:25 2017 (r322824) @@ -2,4 +2,12 @@ WARNS?= 0 +.include + +.if ${COMPILER_TYPE} == "clang" +DEBUG_FILES_CFLAGS= -gline-tables-only +.else +DEBUG_FILES_CFLAGS= -g1 +.endif + .include "../Makefile.inc" From owner-svn-src-all@freebsd.org Thu Aug 24 00:04:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C025DF172C; Thu, 24 Aug 2017 00:04:55 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 046F422C1; Thu, 24 Aug 2017 00:04:55 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x22b.google.com with SMTP id f135so5608455ita.0; Wed, 23 Aug 2017 17:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=52z7XYk1x9iTadOpV2tT+1dCM1KagU7GE0Z3RFF0T+A=; b=a7XiYuHCttCxlzBSIOiXJ7Vo9odNWX7CItGi1bnwHCc2IB1Cax6c7DKyGCOkVSqYLo v64lEKuEqwHTI+Y17qYZw3T9NKPnW8NNnRUOHKutl8BTzqA7I0TECl/2ZbtIMZp2YlQR FfcJC/pc0gumQIsYFixPXLIvvnuOMWCMmvkcgDV06YC4XWE+46l7Fjc2Z/kWOylyVN6s D5XYHwJaU+8qKRFqzor9NeA92MbXOAcnoGW2K7RPXmfskIq5AyaymciTCEi89hWwusSB xQODjLA3qfNFHu1roI2ZD97OVekDahKerOedlTTTl0C24M2jy6YL2uZONvUOIUnMRs3c PmWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=52z7XYk1x9iTadOpV2tT+1dCM1KagU7GE0Z3RFF0T+A=; b=lI9cu+AngboysHhsesz90hTbSoEvWnxPHCz37/53+VD+T9FfWG7Bv0EAMgWEgJc5kA Y0Fl8J5Ipu6zrxu8a4skp2GxDZWiuMAGcRUCTwlD0RD2ei2yO8qqoMwG8eCsR88D5lux LEUspUs5yyyyUMf0Qi+vP6vQF+Zn1jry7oGoa/jVLv/pOM3x4gTB5JbzPbngXF3rLLDU OhthQn6jXC3ZsmjdMOU9by+uQV6FxU5UTXvIV9i2Cww2fEAZvx7bB0pSv5uqUJ2p8tiQ txeMAGIYog6w3L1Ic9AmaOOZeN3kQrsQgYSSMSFJvODwz7pC0yGVroJ4uci/QbUXxgQG R8Pw== X-Gm-Message-State: AHYfb5iq0V5jcDjS2ArMsUsmKoR8HwJbhIxzDRF1JE4uyweZOSZEkV+g 85bRzkBqxPSszSVJgdRB7i+WYSFiE4WiiCs= X-Received: by 10.36.37.143 with SMTP id g137mr4608260itg.35.1503533094186; Wed, 23 Aug 2017 17:04:54 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.24.66 with HTTP; Wed, 23 Aug 2017 17:04:33 -0700 (PDT) In-Reply-To: <201708231209.v7NC9bBJ070335@repo.freebsd.org> References: <201708231209.v7NC9bBJ070335@repo.freebsd.org> From: Ed Maste Date: Wed, 23 Aug 2017 20:04:33 -0400 X-Google-Sender-Auth: 1rbfkwdaUaHiQZbvPWv5AKFkqM0 Message-ID: Subject: Re: svn commit: r322810 - in head: share/man/man4 sys/conf sys/dev/mlx5/mlx5_ib sys/modules sys/modules/mlx5ib To: Hans Petter Selasky Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 00:04:55 -0000 On 23 August 2017 at 08:09, Hans Petter Selasky wrote: > Author: hselasky > Date: Wed Aug 23 12:09:37 2017 > New Revision: 322810 > URL: https://svnweb.freebsd.org/changeset/base/322810 > > Log: > Add new mlx5ib(4) driver to the kernel source tree which supports > Remote DMA over Converged Ethernet, RoCE, for the ConnectX-4 series of > PCI express network cards. i386 lint kernel is now failing with: /scratch/tmp/emaste/freebsd/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c:58:21: error: incompatible pointer types passing 'uintptr_t *' (aka 'unsigned int *') to parameter of type 'const unsigned long *' [-Werror,-Wincompatible-pointer-types] m = find_first_bit(&tmp, 8 * sizeof(tmp)); ^~~~ /scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/bitops.h:111:37: note: passing argument to parameter 'addr' here find_first_bit(const unsigned long *addr, unsigned long size) ^ /scratch/tmp/emaste/freebsd/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c:70:23: error: incompatible pointer types passing 'uintptr_t *' (aka 'unsigned int *') to parameter of type 'const unsigned long *' [-Werror,-Wincompatible-pointer-types] find_first_bit(&tmp, 8 * sizeof(tmp))); ^~~~ /scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/kernel.h:366:17: note: expanded from macro 'min_t' type __min2 = (y); \ ^ /scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/bitops.h:111:37: note: passing argument to parameter 'addr' here find_first_bit(const unsigned long *addr, unsigned long size) ^ /scratch/tmp/emaste/freebsd/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c:78:25: error: incompatible pointer types passing 'uintptr_t *' (aka 'unsigned int *') to parameter of type 'const unsigned long *' [-Werror,-Wincompatible-pointer-types] m = find_first_bit(&tmp, 8 * sizeof(tmp)); ^~~~ /scratch/tmp/emaste/freebsd/sys/compat/linuxkpi/common/include/linux/bitops.h:111:37: note: passing argument to parameter 'addr' here find_first_bit(const unsigned long *addr, unsigned long size) ^ 3 errors generated. From owner-svn-src-all@freebsd.org Thu Aug 24 01:20:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D8E0DF2DF4; Thu, 24 Aug 2017 01:20:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D083A63663; Thu, 24 Aug 2017 01:20:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7O1KqYx096744; Thu, 24 Aug 2017 01:20:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7O1Kq2Z096743; Thu, 24 Aug 2017 01:20:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708240120.v7O1Kq2Z096743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Aug 2017 01:20:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322825 - head/contrib/netbsd-tests/usr.bin/grep X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/contrib/netbsd-tests/usr.bin/grep X-SVN-Commit-Revision: 322825 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 01:20:54 -0000 Author: kevans Date: Thu Aug 24 01:20:52 2017 New Revision: 322825 URL: https://svnweb.freebsd.org/changeset/base/322825 Log: bsdgrep: add some additional tests for fgrep Previously added tests only check that fgrep is somewhat sane and works. Add some more tests that check that the implementation is basically functional and not producing incorrect results with various flags. Reviewed by: cem, emaste, ngie Approved by: emaste (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12056 Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Aug 23 23:30:25 2017 (r322824) +++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Thu Aug 24 01:20:52 2017 (r322825) @@ -687,6 +687,59 @@ matchall_body() atf_check -s exit:1 grep "" test1 } + +atf_test_case fgrep_multipattern +fgrep_multipattern_head() +{ + atf_set "descr" "Check proper behavior with multiple patterns supplied to fgrep" +} +fgrep_multipattern_body() +{ + printf "Foo\nBar\nBaz" > test1 + + atf_check -o inline:"Foo\nBaz\n" grep -F -e "Foo" -e "Baz" test1 + atf_check -o inline:"Foo\nBaz\n" grep -F -e "Baz" -e "Foo" test1 + atf_check -o inline:"Bar\nBaz\n" grep -F -e "Bar" -e "Baz" test1 +} + +atf_test_case fgrep_icase +fgrep_icase_head() +{ + atf_set "descr" "Check proper handling of -i supplied to fgrep" +} +fgrep_icase_body() +{ + printf "Foo\nBar\nBaz" > test1 + + atf_check -o inline:"Foo\nBaz\n" grep -Fi -e "foo" -e "baz" test1 + atf_check -o inline:"Foo\nBaz\n" grep -Fi -e "baz" -e "foo" test1 + atf_check -o inline:"Bar\nBaz\n" grep -Fi -e "bar" -e "baz" test1 + atf_check -o inline:"Bar\nBaz\n" grep -Fi -e "BAR" -e "bAz" test1 +} + +atf_test_case fgrep_oflag +fgrep_oflag_head() +{ + atf_set "descr" "Check proper handling of -o supplied to fgrep" +} +fgrep_oflag_body() +{ + printf "abcdefghi\n" > test1 + + atf_check -o inline:"a\n" grep -Fo "a" test1 + atf_check -o inline:"i\n" grep -Fo "i" test1 + atf_check -o inline:"abc\n" grep -Fo "abc" test1 + atf_check -o inline:"fgh\n" grep -Fo "fgh" test1 + atf_check -o inline:"cde\n" grep -Fo "cde" test1 + atf_check -o inline:"bcd\n" grep -Fo -e "bcd" -e "cde" test1 + atf_check -o inline:"bcd\nefg\n" grep -Fo -e "bcd" -e "efg" test1 + + atf_check -s exit:1 grep -Fo "xabc" test1 + atf_check -s exit:1 grep -Fo "abcx" test1 + atf_check -s exit:1 grep -Fo "xghi" test1 + atf_check -s exit:1 grep -Fo "ghix" test1 + atf_check -s exit:1 grep -Fo "abcdefghiklmnopqrstuvwxyz" test1 +} # End FreeBSD atf_init_test_cases() @@ -728,5 +781,8 @@ atf_init_test_cases() atf_add_test_case mmap atf_add_test_case mmap_eof_not_eol atf_add_test_case matchall + atf_add_test_case fgrep_multipattern + atf_add_test_case fgrep_icase + atf_add_test_case fgrep_oflag # End FreeBSD } From owner-svn-src-all@freebsd.org Thu Aug 24 01:23:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6902DCB09B; Thu, 24 Aug 2017 01:23:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0DB063A07; Thu, 24 Aug 2017 01:23:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7O1NXCM000505; Thu, 24 Aug 2017 01:23:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7O1NXTx000502; Thu, 24 Aug 2017 01:23:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708240123.v7O1NXTx000502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Aug 2017 01:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322826 - head/usr.bin/grep X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/grep X-SVN-Commit-Revision: 322826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 01:23:35 -0000 Author: kevans Date: Thu Aug 24 01:23:33 2017 New Revision: 322826 URL: https://svnweb.freebsd.org/changeset/base/322826 Log: bsdgrep: add a primitive literal matcher fgrep/grep -F will error out at runtime if compiled with a regex(3) that does not define REG_NOSPEC or REG_LITERAL. glibc is one such regex(3) implementation, and as it turns out they don't support literal matching at all. Provide a primitive literal matcher for use with glibc and other implementations that don't support literal matching so that we don't completely lose fgrep/grep -F if compiled against libgnuregex on stable/10, stable/11, or other systems that we don't necessarily support. This is a wholly unoptimized implementation with no plans to optimize it as of now. This is due to both its use-case being primarily on unsupported systems in the near-distant future and that it's reinventing the wheel that we already have available as a feature of regex(3). Reviewed by: cem, emaste, ngie Approved by: emaste (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12056 Modified: head/usr.bin/grep/grep.c head/usr.bin/grep/grep.h head/usr.bin/grep/util.c Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Thu Aug 24 01:20:52 2017 (r322825) +++ head/usr.bin/grep/grep.c Thu Aug 24 01:23:33 2017 (r322826) @@ -720,12 +720,19 @@ main(int argc, char *argv[]) case GREP_BASIC: break; case GREP_FIXED: + /* + * regex(3) implementations that support fixed-string searches generally + * define either REG_NOSPEC or REG_LITERAL. Set the appropriate flag + * here. If neither are defined, GREP_FIXED later implies that the + * internal literal matcher should be used. Other cflags that have + * the same interpretation as REG_NOSPEC and REG_LITERAL should be + * similarly added here, and grep.h should be amended to take this into + * consideration when defining WITH_INTERNAL_NOSPEC. + */ #if defined(REG_NOSPEC) cflags |= REG_NOSPEC; #elif defined(REG_LITERAL) cflags |= REG_LITERAL; -#else - errx(2, "literal expressions not supported at compile time"); #endif break; case GREP_EXTENDED: @@ -742,7 +749,11 @@ main(int argc, char *argv[]) r_pattern = grep_calloc(patterns, sizeof(*r_pattern)); /* Don't process any patterns if we have a blank one */ +#ifdef WITH_INTERNAL_NOSPEC + if (!matchall && grepbehave != GREP_FIXED) { +#else if (!matchall) { +#endif /* Check if cheating is allowed (always is for fgrep). */ for (i = 0; i < patterns; ++i) { #ifndef WITHOUT_FASTMATCH Modified: head/usr.bin/grep/grep.h ============================================================================== --- head/usr.bin/grep/grep.h Thu Aug 24 01:20:52 2017 (r322825) +++ head/usr.bin/grep/grep.h Thu Aug 24 01:23:33 2017 (r322826) @@ -57,6 +57,10 @@ extern const char *errstr[]; #define GREP_BASIC 1 #define GREP_EXTENDED 2 +#if !defined(REG_NOSPEC) && !defined(REG_LITERAL) +#define WITH_INTERNAL_NOSPEC +#endif + #define BINFILE_BIN 0 #define BINFILE_SKIP 1 #define BINFILE_TEXT 2 Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Thu Aug 24 01:20:52 2017 (r322825) +++ head/usr.bin/grep/util.c Thu Aug 24 01:23:33 2017 (r322826) @@ -70,7 +70,10 @@ struct parsec { bool binary; /* Binary file? */ }; - +#ifdef WITH_INTERNAL_NOSPEC +static int litexec(const struct pat *pat, const char *string, + size_t nmatch, regmatch_t pmatch[]); +#endif static int procline(struct parsec *pc); static void printline(struct parsec *pc, int sep); static void printline_metadata(struct str *line, int sep); @@ -350,6 +353,67 @@ procfile(const char *fn) return (c); } +#ifdef WITH_INTERNAL_NOSPEC +/* + * Internal implementation of literal string search within a string, modeled + * after regexec(3), for use when the regex(3) implementation doesn't offer + * either REG_NOSPEC or REG_LITERAL. This does not apply in the default FreeBSD + * config, but in other scenarios such as building against libgnuregex or on + * some non-FreeBSD OSes. + */ +static int +litexec(const struct pat *pat, const char *string, size_t nmatch, + regmatch_t pmatch[]) +{ + char *(*strstr_fn)(const char *, const char *); + char *sub, *subject; + const char *search; + size_t idx, n, ofs, stringlen; + + if (cflags & REG_ICASE) + strstr_fn = strcasestr; + else + strstr_fn = strstr; + idx = 0; + ofs = pmatch[0].rm_so; + stringlen = pmatch[0].rm_eo; + if (ofs >= stringlen) + return (REG_NOMATCH); + subject = strndup(string, stringlen); + if (subject == NULL) + return (REG_ESPACE); + for (n = 0; ofs < stringlen;) { + search = (subject + ofs); + if ((unsigned long)pat->len > strlen(search)) + break; + sub = strstr_fn(search, pat->pat); + /* + * Ignoring the empty string possibility due to context: grep optimizes + * for empty patterns and will never reach this point. + */ + if (sub == NULL) + break; + ++n; + /* Fill in pmatch if necessary */ + if (nmatch > 0) { + pmatch[idx].rm_so = ofs + (sub - search); + pmatch[idx].rm_eo = pmatch[idx].rm_so + pat->len; + if (++idx == nmatch) + break; + ofs = pmatch[idx].rm_so + 1; + } else + /* We only needed to know if we match or not */ + break; + } + free(subject); + if (n > 0 && nmatch > 0) + for (n = idx; n < nmatch; ++n) + pmatch[n].rm_so = pmatch[n].rm_eo = -1; + + return (n > 0 ? 0 : REG_NOMATCH); +} +#endif /* WITH_INTERNAL_NOSPEC */ + #define iswword(x) (iswalnum((x)) || (x) == L'_') /* @@ -400,6 +464,11 @@ procline(struct parsec *pc) for (i = 0; i < patterns; i++) { pmatch.rm_so = st; pmatch.rm_eo = pc->ln.len; +#ifdef WITH_INTERNAL_NOSPEC + if (grepbehave == GREP_FIXED) + r = litexec(&pattern[i], pc->ln.dat, 1, &pmatch); + else +#endif #ifndef WITHOUT_FASTMATCH if (fg_pattern[i].pattern) r = fastexec(&fg_pattern[i], From owner-svn-src-all@freebsd.org Thu Aug 24 01:45:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1106DDCC9C8 for ; Thu, 24 Aug 2017 01:45:56 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 93E15649A6 for ; Thu, 24 Aug 2017 01:45:55 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-wm0-x235.google.com with SMTP id l19so10408894wmi.1 for ; Wed, 23 Aug 2017 18:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=C3ylXMMp73LoOi1oZX2U5T28YsmZTR50Y42ubNMoV/s=; b=WryNm53mPkQPnlLOXJke9qR3r4xylYjZMQ5m34XuaoQtsVJ6bUFu8MtneDA+D50dX7 2DDTP1siEodB7mMt135du/2TM9PT33w9mAavbgGINHO9OUYdHsO7udFIq4tnOu5sLEkC GtElL+CnawWiQPLe8Lch17uyCQSiiqW318tFAIiRR3WyyrUo2gewZNDixSTCx1GzMjpE Qm9tR5A1EGxESNYdUQIxQSb2a2eGvw8EaekYU1KUykphDZphwNnWmAuXXa3gni5N3CAx w8cpf1eU7Zrqy4rPhnAfGfw4WWiwo1U6hV3L6hXrfYHu3QO04ied3lcDTDLwqQacYm3X X+EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=C3ylXMMp73LoOi1oZX2U5T28YsmZTR50Y42ubNMoV/s=; b=VZ+wCym69oDo297PJh4/VqwUNJljOYRr0sGHwsgaiLNHYvrno91/coTd/k29C/o5xl Xp0Go5euZ58lgl0w45tx9GBZJPlHL0OujDFfBYf7xN8BFB1ywXRr9WolBcdPQxCpMPZ4 zz2CvHMlwqUb663y46wOis7an9BN8njZlUtIkpteHMLPDjyQ4uEeEDSx7kz/647FhY7v aR6OAmifoCxDnt3otUECaSu9xae/iI9po3AMHcT6W5PWrYvJs3TTok38KwQ7UhRwfStV qNhaQ3Lc4rfRIcASPObp5MgDiCBOe71VrFiBkdrj5/plINsW9jqoxADSrMIfQWmrPmvJ X8zw== X-Gm-Message-State: AHYfb5hbBfUKXmmmFg9s69HLiyuHX3iEmVWiUHHFRRBEAADFHuUMM02O vqI88bMJW/YlnVkg X-Received: by 10.28.178.130 with SMTP id b124mr2745430wmf.164.1503539153903; Wed, 23 Aug 2017 18:45:53 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-230-154.bltmmd.fios.verizon.net. [100.16.230.154]) by smtp.gmail.com with ESMTPSA id 3sm2177888wmi.46.2017.08.23.18.45.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Aug 2017 18:45:53 -0700 (PDT) Date: Wed, 23 Aug 2017 21:45:50 -0400 From: Shawn Webb To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322763 - head/lib/libc/amd64/sys Message-ID: <20170824014550.z7su35lezsmfyzw7@mutt-hbsd> References: <201708211739.v7LHdD6k023805@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pf7xt3lyykoqli3k" Content-Disposition: inline In-Reply-To: <201708211739.v7LHdD6k023805@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hbsd 12.0-CURRENT FreeBSD 12.0-CURRENT X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: NeoMutt/20170714 (1.8.3) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 01:45:56 -0000 --pf7xt3lyykoqli3k Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 21, 2017 at 05:39:13PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Mon Aug 21 17:39:12 2017 > New Revision: 322763 > URL: https://svnweb.freebsd.org/changeset/base/322763 >=20 > Log: > Optimize libc to get and set TLS using the RDFSBASE and RDGSBASE > instructions, if supported both by CPU and kernel. > =20 > Reviewed by: jhb (previous version) > Tested by: pho (previous version) > Sponsored by: The FreeBSD Foundation > MFC after: 3 weeks > Differential revision: https://reviews.freebsd.org/D12023 >=20 > Added: > head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c (contents, props ch= anged) > head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h (contents, props ch= anged) > Modified: > head/lib/libc/amd64/sys/Makefile.inc > head/lib/libc/amd64/sys/amd64_get_fsbase.c > head/lib/libc/amd64/sys/amd64_get_gsbase.c > head/lib/libc/amd64/sys/amd64_set_fsbase.c > head/lib/libc/amd64/sys/amd64_set_gsbase.c Hey kib, This commit breaks booting in UEFI mode under bhyve. The VM gets stuck when the kernel launches /sbin/init. Here's a screenshot of a verbose boot at a recent HEAD: https://imgur.com/PiJhfll Note, the screenshot depicts HardenedBSD, not FreeBSD. Another user attempting to boot a recent vanilla FreeBSD 12-CURRENT/amd64 snapshot reported to me the same behavior, though, so the issue is certainly not specific to HardenedBSD. Reverting just this commit enabled booting in a bhyve VM again. Thanks, --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --pf7xt3lyykoqli3k Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAlmeL8wACgkQaoRlj1JF bu5N/g//bOpZRqzHMIZp5ljqG5McGvfhjHwpUmdxqCLjT2nVEs6+qKjQQP1QnpQV caHrBmwoxhDiXQg7tdFykxBu3gMKMqAYuoM36RUYjcfpSRHQhScUXU67/IhpRaTQ Y2RYsPW7IZ3T4CIeqU3ICgwV1P6hE+Oc3a2oBFYb49ASRiNCXwPYAFY+JzrLKdAl nn0edjdT/ELnA2QfBya7t0PzKtitix8Eelw+fSAwxj3+sDa4kd3BC9zZwlrCHxu+ Y0Sm8Y2N0aSZjEdgJFIoVf4vRJX+OaMpx0tEuGcF6jxysS+nBZYZclyMGS0obdzw iutBaFpa8B8VZa1H6y3GGw1q+IeHfX7VjLHsjnLgr0HM/EyJuVvIczbTzMGcMLE0 c8AxGEr7cNqHyY/Qiex0Dne3cWbsAP00lThTZHJjSV2QMJY+EfaFc5bECvCoqejG EfMQI+L02lduMj6jSLwQRmc7VqyXyeJtS64ZtVTwNUwTf3DNeDcZNnkQn7OTijvb 01accHIHLGMFFAArAE8LJZbAsIk76lDo0pHhcmbY7xH8hZa3TIInHd4DsfI136rZ U08HLWL5RqWS10eRzAR5eoSDHZVH6S42leh08b/j31Sre9X3suPaiCzMzlNlJi5q wqFjRKKmcFfcV540tuWhBP86WpotjJdmZeAj5amIEYL/1VmvXmk= =3J8K -----END PGP SIGNATURE----- --pf7xt3lyykoqli3k-- From owner-svn-src-all@freebsd.org Thu Aug 24 02:08:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2106ADD0185; Thu, 24 Aug 2017 02:08:54 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E33B165731; Thu, 24 Aug 2017 02:08:53 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7O28qZx017153; Thu, 24 Aug 2017 02:08:52 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7O28qeY017151; Thu, 24 Aug 2017 02:08:52 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201708240208.v7O28qeY017151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 24 Aug 2017 02:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322827 - head/sys/boot/fdt/dts/arm X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/boot/fdt/dts/arm X-SVN-Commit-Revision: 322827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 02:08:54 -0000 Author: gonzo Date: Thu Aug 24 02:08:52 2017 New Revision: 322827 URL: https://svnweb.freebsd.org/changeset/base/322827 Log: Add "xlnx,zynq-7000" to zedboard and zybo compatible property This property is required to boot CURRENT on zedboard and zybo PR: 221208 Submitted by: Thomas Skibo Modified: head/sys/boot/fdt/dts/arm/zedboard.dts head/sys/boot/fdt/dts/arm/zybo.dts Modified: head/sys/boot/fdt/dts/arm/zedboard.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/zedboard.dts Thu Aug 24 01:23:33 2017 (r322826) +++ head/sys/boot/fdt/dts/arm/zedboard.dts Thu Aug 24 02:08:52 2017 (r322827) @@ -30,7 +30,7 @@ / { model = "zedboard"; - compatible = "digilent,zedboard"; + compatible = "digilent,zedboard", "xlnx,zynq-7000"; memory { // First megabyte isn't accessible by all interconnect masters. Modified: head/sys/boot/fdt/dts/arm/zybo.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/zybo.dts Thu Aug 24 01:23:33 2017 (r322826) +++ head/sys/boot/fdt/dts/arm/zybo.dts Thu Aug 24 02:08:52 2017 (r322827) @@ -30,7 +30,7 @@ / { model = "zybo"; - compatible = "digilent,zybo"; + compatible = "digilent,zybo", "xlnx,zynq-7000"; memory { // First megabyte isn't accessible by all interconnect masters. From owner-svn-src-all@freebsd.org Thu Aug 24 07:36:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 250ABDD8544; Thu, 24 Aug 2017 07:36:31 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFDB26DB1C; Thu, 24 Aug 2017 07:36:30 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 82569260117; Thu, 24 Aug 2017 09:36:28 +0200 (CEST) Subject: Re: svn commit: r322810 - in head: share/man/man4 sys/conf sys/dev/mlx5/mlx5_ib sys/modules sys/modules/mlx5ib To: Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <201708231209.v7NC9bBJ070335@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <2bf96e9d-8c7a-cc98-a51e-c38465181ab5@selasky.org> Date: Thu, 24 Aug 2017 09:34:10 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 07:36:31 -0000 On 08/24/17 02:04, Ed Maste wrote: > On 23 August 2017 at 08:09, Hans Petter Selasky wrote: >> Author: hselasky >> Date: Wed Aug 23 12:09:37 2017 >> New Revision: 322810 >> URL: https://svnweb.freebsd.org/changeset/base/322810 >> >> Log: >> Add new mlx5ib(4) driver to the kernel source tree which supports >> Remote DMA over Converged Ethernet, RoCE, for the ConnectX-4 series of >> PCI express network cards. > > i386 lint kernel is now failing with: > I'll fix shortly. --HPS From owner-svn-src-all@freebsd.org Thu Aug 24 08:02:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 301C4DD906A; Thu, 24 Aug 2017 08:02:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F07FF6E79F; Thu, 24 Aug 2017 08:02:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7O82RbR061978; Thu, 24 Aug 2017 08:02:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7O82Rs1061977; Thu, 24 Aug 2017 08:02:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708240802.v7O82Rs1061977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 24 Aug 2017 08:02:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322829 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/ufs/ffs X-SVN-Commit-Revision: 322829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 08:02:28 -0000 Author: kib Date: Thu Aug 24 08:02:26 2017 New Revision: 322829 URL: https://svnweb.freebsd.org/changeset/base/322829 Log: MFC r322756: Style. Modified: stable/11/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_softdep.c Thu Aug 24 07:05:42 2017 (r322828) +++ stable/11/sys/ufs/ffs/ffs_softdep.c Thu Aug 24 08:02:26 2017 (r322829) @@ -14051,7 +14051,7 @@ softdep_count_dependencies(bp, wantcount) } out: FREE_LOCK(ump); - return retval; + return (retval); } /* From owner-svn-src-all@freebsd.org Thu Aug 24 08:09:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78A6ADD9142; Thu, 24 Aug 2017 08:09:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A2FA6E93A; Thu, 24 Aug 2017 08:09:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7O89hVo062240; Thu, 24 Aug 2017 08:09:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7O89hxF062238; Thu, 24 Aug 2017 08:09:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708240809.v7O89hxF062238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 24 Aug 2017 08:09:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322830 - head/sys/dev/mlx5/mlx5_ib X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 322830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 08:09:44 -0000 Author: hselasky Date: Thu Aug 24 08:09:42 2017 New Revision: 322830 URL: https://svnweb.freebsd.org/changeset/base/322830 Log: Compile fixes for LINT on 32-bit platforms. MFC after: 2 weeks Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c head/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 24 08:02:26 2017 (r322829) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Aug 24 08:09:42 2017 (r322830) @@ -856,7 +856,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(stru else if (reqlen == sizeof(struct mlx5_ib_alloc_ucontext_req_v2)) ver = 2; else { - mlx5_ib_err(dev, "request malformed, reqlen: %ld\n", reqlen); + mlx5_ib_err(dev, "request malformed, reqlen: %ld\n", (long)reqlen); return ERR_PTR(-EINVAL); } Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c Thu Aug 24 08:02:26 2017 (r322829) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c Thu Aug 24 08:09:42 2017 (r322830) @@ -29,6 +29,8 @@ #include #include "mlx5_ib.h" +CTASSERT(sizeof(uintptr_t) == sizeof(unsigned long)); + /* @umem: umem object to scan * @addr: ib virtual address requested by the user * @count: number of PAGE_SIZE pages covered by umem @@ -40,7 +42,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, int *ncont, int *order) { - uintptr_t tmp; + unsigned long tmp; unsigned long m; int i, k; u64 base = 0; From owner-svn-src-all@freebsd.org Thu Aug 24 08:20:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84AD2DD949A; Thu, 24 Aug 2017 08:20:24 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5229F6EE7A; Thu, 24 Aug 2017 08:20:24 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7O8KNsi066183; Thu, 24 Aug 2017 08:20:23 GMT (envelope-from lstewart@FreeBSD.org) Received: (from lstewart@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7O8KNh3066182; Thu, 24 Aug 2017 08:20:23 GMT (envelope-from lstewart@FreeBSD.org) Message-Id: <201708240820.v7O8KNh3066182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lstewart set sender to lstewart@FreeBSD.org using -f From: Lawrence Stewart Date: Thu, 24 Aug 2017 08:20:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322831 - head/bin/pkill X-SVN-Group: head X-SVN-Commit-Author: lstewart X-SVN-Commit-Paths: head/bin/pkill X-SVN-Commit-Revision: 322831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 08:20:24 -0000 Author: lstewart Date: Thu Aug 24 08:20:23 2017 New Revision: 322831 URL: https://svnweb.freebsd.org/changeset/base/322831 Log: Only emit the trailing new line added in r322613 when not operating in quiet mode. Reported by: pho MFC after: 1 week X-MFC-with: r322210 Modified: head/bin/pkill/pkill.c Modified: head/bin/pkill/pkill.c ============================================================================== --- head/bin/pkill/pkill.c Thu Aug 24 08:09:42 2017 (r322830) +++ head/bin/pkill/pkill.c Thu Aug 24 08:20:23 2017 (r322831) @@ -568,7 +568,7 @@ main(int argc, char **argv) continue; rv |= (*action)(kp); } - if (rv && pgrep) + if (rv && pgrep && !quiet) putchar('\n'); if (!did_action && !pgrep && longfmt) fprintf(stderr, From owner-svn-src-all@freebsd.org Thu Aug 24 10:49:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0ABBDDC883; Thu, 24 Aug 2017 10:49:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8387173809; Thu, 24 Aug 2017 10:49:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OAnr7l028558; Thu, 24 Aug 2017 10:49:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OAnrrl028557; Thu, 24 Aug 2017 10:49:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708241049.v7OAnrrl028557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 24 Aug 2017 10:49:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322832 - head/sys/amd64/vmm/intel X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/vmm/intel X-SVN-Commit-Revision: 322832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 10:49:54 -0000 Author: kib Date: Thu Aug 24 10:49:53 2017 New Revision: 322832 URL: https://svnweb.freebsd.org/changeset/base/322832 Log: Save KGSBASE in pcb before overriding it with the guest value. Reported by: lwhsu, mjoras Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 18 days Modified: head/sys/amd64/vmm/intel/vmx_msr.c Modified: head/sys/amd64/vmm/intel/vmx_msr.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx_msr.c Thu Aug 24 08:20:23 2017 (r322831) +++ head/sys/amd64/vmm/intel/vmx_msr.c Thu Aug 24 10:49:53 2017 (r322832) @@ -31,10 +31,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include +#include #include #include @@ -356,7 +358,8 @@ vmx_msr_guest_enter(struct vmx *vmx, int vcpuid) { uint64_t *guest_msrs = vmx->guest_msrs[vcpuid]; - /* Save host MSRs (if any) and restore guest MSRs */ + /* Save host MSRs (in particular, KGSBASE) and restore guest MSRs */ + update_pcb_bases(curpcb); wrmsr(MSR_LSTAR, guest_msrs[IDX_MSR_LSTAR]); wrmsr(MSR_CSTAR, guest_msrs[IDX_MSR_CSTAR]); wrmsr(MSR_STAR, guest_msrs[IDX_MSR_STAR]); From owner-svn-src-all@freebsd.org Thu Aug 24 10:57:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADD5ADDCAD9; Thu, 24 Aug 2017 10:57:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AAF773C22; Thu, 24 Aug 2017 10:57:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OAvYr2032492; Thu, 24 Aug 2017 10:57:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OAvYgU032491; Thu, 24 Aug 2017 10:57:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708241057.v7OAvYgU032491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 24 Aug 2017 10:57:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322833 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 322833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 10:57:35 -0000 Author: kib Date: Thu Aug 24 10:57:34 2017 New Revision: 322833 URL: https://svnweb.freebsd.org/changeset/base/322833 Log: Stop masking FSGSBASE and SMEP features under monitors. Not enabling FSGSBASE in %cr4 does not prevent reporting of the feature by the CPUID instruction (blame Int*l). As result, kernels which were run under monitors pretended that usermode cannot modify TLS base without the syscall, while libc noted right combination of capable CPU and the new kernel version, trying to use the WRFSBASE instruction. Really old hypervisors that cannot handle enablement of these features in %cr4 would require the manual configuration, by setting the loader tunable hw.cpu_stdext_disable=0x81 Reported by: lwhsu, mjoras Sponsored by: The FreeBSD Foundation MFC after: 18 days Modified: head/sys/x86/x86/identcpu.c Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Thu Aug 24 10:49:53 2017 (r322832) +++ head/sys/x86/x86/identcpu.c Thu Aug 24 10:57:34 2017 (r322833) @@ -1423,18 +1423,15 @@ finishidentcpu(void) cpu_stdext_feature = regs[1]; /* - * Some hypervisors fail to filter out unsupported - * extended features. For now, disable the + * Some hypervisors failed to filter out unsupported + * extended features. Allow to disable the * extensions, activation of which requires setting a * bit in CR4, and which VM monitors do not support. */ - if (cpu_feature2 & CPUID2_HV) { - cpu_stdext_disable = CPUID_STDEXT_FSGSBASE | - CPUID_STDEXT_SMEP; - } else - cpu_stdext_disable = 0; + cpu_stdext_disable = 0; TUNABLE_INT_FETCH("hw.cpu_stdext_disable", &cpu_stdext_disable); cpu_stdext_feature &= ~cpu_stdext_disable; + cpu_stdext_feature2 = regs[2]; } From owner-svn-src-all@freebsd.org Thu Aug 24 11:33:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07291DDD2F6; Thu, 24 Aug 2017 11:33:55 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF3FE748E3; Thu, 24 Aug 2017 11:33:54 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x233.google.com with SMTP id c73so4313269itb.1; Thu, 24 Aug 2017 04:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Fk+7mUQEa9/0v1KAMct2dFKW3RgoImlQ8yl8o3DYSwo=; b=CwIx3EztKd8NSJ6TuaEmfejtxZkOyjl+jVSP8GV1Aq3JUL5DXZtgp8go5bSrkg0WU9 5EDY8ZIXZNBot9Z/L5Ox/gjiWxLB2Cv9jpkIPVF/pz0PC3n84aevo68TrYJpkYG7HHKK S8yTYOJmmjbw2QZPgMuaPf4/VP63tHvboDtPWHSCNYdTe7b10d3Bt9rgoKcqxredVD5F nE9fKQl7EZYJwc0tR9FIvLCkvTs+d4orRDGrLLi1um8g50gnBQ6NjlXIghG0DAzJSFn7 rj6PAijUvXFTNV7SAXEWGDde2NvMJxb65ohCNQcZ4YqipDoRVYSXKfOzWDaIjN+BFVP/ vaKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Fk+7mUQEa9/0v1KAMct2dFKW3RgoImlQ8yl8o3DYSwo=; b=RN/flK141NjMPmCz6aFRfbSfZmKXRY+pSQVGEihgs0CcgctU17SEc6glpC6MRJbOx5 mhR2iUoWFIm+M8Je1hI9TZChq0PdEnH1C9K4U8yW3cTNIH27R+9wIcoHYdA9ePEXSBcT g1AJPWc2HmEGh3aTa6TBtbZBZW31EifW0Mw3o90cjIJgx91s+AJRMRZipkMZz0UluFX+ 4U+urxrDvwT6z+om/9r3JiWyseDuTsqVT8g+GbG+XAZg9aek1JE5i2TAcIcjIEfukpi+ vBFr7JdkF9r2B++AtZoMDCp+Uwp3DSlVnEKQMuKcj7PJHudr+uCYttvsZqcIPjij1Ypo 6QuQ== X-Gm-Message-State: AHYfb5hIQbAh+5fS0HX6ipHl3gFILzX6d8ijAIg8+nW1Rlb8sTaksFF2 jdD/c3rKTEiCzifyb/CB5A3SjRkhFkRg X-Received: by 10.36.11.196 with SMTP id 187mr5658954itd.7.1503574434083; Thu, 24 Aug 2017 04:33:54 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.24.66 with HTTP; Thu, 24 Aug 2017 04:33:33 -0700 (PDT) In-Reply-To: <20170824014550.z7su35lezsmfyzw7@mutt-hbsd> References: <201708211739.v7LHdD6k023805@repo.freebsd.org> <20170824014550.z7su35lezsmfyzw7@mutt-hbsd> From: Ed Maste Date: Thu, 24 Aug 2017 07:33:33 -0400 X-Google-Sender-Auth: X8OYslHUlEf5O6O5iwpLSKMwWBU Message-ID: Subject: Re: svn commit: r322763 - head/lib/libc/amd64/sys To: Shawn Webb Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 11:33:55 -0000 On 23 August 2017 at 21:45, Shawn Webb wrote: > On Mon, Aug 21, 2017 at 05:39:13PM +0000, Konstantin Belousov wrote: >> Author: kib >> Date: Mon Aug 21 17:39:12 2017 >> New Revision: 322763 >> URL: https://svnweb.freebsd.org/changeset/base/322763 >> ... > > Hey kib, > > This commit breaks booting in UEFI mode under bhyve. The VM gets stuck > when the kernel launches /sbin/init. What svn rev did you try? (There was a followup fix to this.) From owner-svn-src-all@freebsd.org Thu Aug 24 13:37:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDC2CDDFB7F; Thu, 24 Aug 2017 13:37:23 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8A157C3C8; Thu, 24 Aug 2017 13:37:23 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ODbMR3097183; Thu, 24 Aug 2017 13:37:22 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ODbMev097182; Thu, 24 Aug 2017 13:37:22 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708241337.v7ODbMev097182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 24 Aug 2017 13:37:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322834 - stable/11/usr.sbin/chown/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/usr.sbin/chown/tests X-SVN-Commit-Revision: 322834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 13:37:24 -0000 Author: gjb Date: Thu Aug 24 13:37:22 2017 New Revision: 322834 URL: https://svnweb.freebsd.org/changeset/base/322834 Log: MFC r322770, r322796: r322770: Apply changes from bin/chmod/tests/chmod_test.sh, adding atf_expect_fail() before chflags(8) is invoked if the filesystem is ZFS, which does not support UF_IMMUTABLE. r322796: Revert part of r322770 in usr.sbin/chown/tests/chown_test.sh, which incorrectly adds atf_expect_fail() where there is no failure case. Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/chown/tests/chown_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/chown/tests/chown_test.sh ============================================================================== --- stable/11/usr.sbin/chown/tests/chown_test.sh Thu Aug 24 10:57:34 2017 (r322833) +++ stable/11/usr.sbin/chown/tests/chown_test.sh Thu Aug 24 13:37:22 2017 (r322834) @@ -25,6 +25,13 @@ # # $FreeBSD$ +get_filesystem() +{ + local mountpoint=$1 + + df -T $mountpoint | tail -n 1 | cut -wf 2 +} + atf_test_case RH_flag RH_flag_head() { @@ -98,6 +105,11 @@ f_flag_body() { atf_check truncate -s 0 foo bar atf_check chown 0:0 foo bar + case "$(get_filesystem .)" in + zfs) + atf_expect_fail "ZFS does not support UF_IMMUTABLE; returns EPERM" + ;; + esac atf_check chflags uchg foo atf_check -e not-empty -s not-exit:0 chown 42:42 foo bar atf_check -o inline:'0:0\n42:42\n' stat -f '%u:%g' foo bar @@ -107,7 +119,7 @@ f_flag_body() f_flag_cleanup() { - atf_check chflags 0 foo + chflags 0 foo || : } atf_test_case h_flag From owner-svn-src-all@freebsd.org Thu Aug 24 13:39:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 975BADDFC04; Thu, 24 Aug 2017 13:39:25 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 662C57C6B0; Thu, 24 Aug 2017 13:39:25 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ODdOsa097293; Thu, 24 Aug 2017 13:39:24 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ODdOIU097292; Thu, 24 Aug 2017 13:39:24 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708241339.v7ODdOIU097292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 24 Aug 2017 13:39:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322835 - stable/10/usr.sbin/chown/tests X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/usr.sbin/chown/tests X-SVN-Commit-Revision: 322835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 13:39:25 -0000 Author: gjb Date: Thu Aug 24 13:39:24 2017 New Revision: 322835 URL: https://svnweb.freebsd.org/changeset/base/322835 Log: MFC r322770, r322796: r322770: Apply changes from bin/chmod/tests/chmod_test.sh, adding atf_expect_fail() before chflags(8) is invoked if the filesystem is ZFS, which does not support UF_IMMUTABLE. r322796: Revert part of r322770 in usr.sbin/chown/tests/chown_test.sh, which incorrectly adds atf_expect_fail() where there is no failure case. Approved by: re (marius) Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/chown/tests/chown_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/chown/tests/chown_test.sh ============================================================================== --- stable/10/usr.sbin/chown/tests/chown_test.sh Thu Aug 24 13:37:22 2017 (r322834) +++ stable/10/usr.sbin/chown/tests/chown_test.sh Thu Aug 24 13:39:24 2017 (r322835) @@ -25,6 +25,13 @@ # # $FreeBSD$ +get_filesystem() +{ + local mountpoint=$1 + + df -T $mountpoint | tail -n 1 | cut -wf 2 +} + atf_test_case RH_flag RH_flag_head() { @@ -98,6 +105,11 @@ f_flag_body() { atf_check truncate -s 0 foo bar atf_check chown 0:0 foo bar + case "$(get_filesystem .)" in + zfs) + atf_expect_fail "ZFS does not support UF_IMMUTABLE; returns EPERM" + ;; + esac atf_check chflags uchg foo atf_check -e not-empty -s not-exit:0 chown 42:42 foo bar atf_check -o inline:'0:0\n42:42\n' stat -f '%u:%g' foo bar @@ -107,7 +119,7 @@ f_flag_body() f_flag_cleanup() { - atf_check chflags 0 foo + chflags 0 foo || : } atf_test_case h_flag From owner-svn-src-all@freebsd.org Thu Aug 24 15:12:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59444DE1935; Thu, 24 Aug 2017 15:12:18 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E4E680218; Thu, 24 Aug 2017 15:12:18 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OFCHOP040483; Thu, 24 Aug 2017 15:12:17 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OFCHiA040482; Thu, 24 Aug 2017 15:12:17 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708241512.v7OFCHiA040482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 24 Aug 2017 15:12:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322836 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322836 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 15:12:18 -0000 Author: cem Date: Thu Aug 24 15:12:16 2017 New Revision: 322836 URL: https://svnweb.freebsd.org/changeset/base/322836 Log: Merge print_lockchain and print_sleepchain When debugging a deadlock, it is useful to follow the full chain of locks as far as possible. Reviewed by: jhb Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12115 Modified: head/sys/kern/subr_turnstile.c Modified: head/sys/kern/subr_turnstile.c ============================================================================== --- head/sys/kern/subr_turnstile.c Thu Aug 24 13:39:24 2017 (r322835) +++ head/sys/kern/subr_turnstile.c Thu Aug 24 15:12:16 2017 (r322836) @@ -1096,7 +1096,7 @@ found: /* * Show all the threads a particular thread is waiting on based on - * non-sleepable and non-spin locks. + * non-spin locks. */ static void print_lockchain(struct thread *td, const char *prefix) @@ -1104,10 +1104,11 @@ print_lockchain(struct thread *td, const char *prefix) struct lock_object *lock; struct lock_class *class; struct turnstile *ts; + struct thread *owner; /* * Follow the chain. We keep walking as long as the thread is - * blocked on a turnstile that has an owner. + * blocked on a lock that has an owner. */ while (!db_pager_quit) { db_printf("%sthread %d (pid %d, %s) ", prefix, td->td_tid, @@ -1136,6 +1137,17 @@ print_lockchain(struct thread *td, const char *prefix) return; td = ts->ts_owner; break; + } else if (TD_ON_SLEEPQ(td)) { + if (!lockmgr_chain(td, &owner) && + !sx_chain(td, &owner)) { + db_printf("sleeping on %p \"%s\"\n", + td->td_wchan, td->td_wmesg); + return; + } + if (owner == NULL) + return; + td = owner; + break; } db_printf("inhibited\n"); return; @@ -1158,6 +1170,7 @@ DB_SHOW_COMMAND(lockchain, db_show_lockchain) print_lockchain(td, ""); } +DB_SHOW_ALIAS(sleepchain, db_show_lockchain); DB_SHOW_ALL_COMMAND(chains, db_show_allchains) { @@ -1168,84 +1181,17 @@ DB_SHOW_ALL_COMMAND(chains, db_show_allchains) i = 1; FOREACH_PROC_IN_SYSTEM(p) { FOREACH_THREAD_IN_PROC(p, td) { - if (TD_ON_LOCK(td) && LIST_EMPTY(&td->td_contested)) { + if ((TD_ON_LOCK(td) && LIST_EMPTY(&td->td_contested)) + || (TD_IS_INHIBITED(td) && TD_ON_SLEEPQ(td))) { db_printf("chain %d:\n", i++); print_lockchain(td, " "); } - if (TD_IS_INHIBITED(td) && TD_ON_SLEEPQ(td)) { - db_printf("chain %d:\n", i++); - print_sleepchain(td, " "); - } if (db_pager_quit) return; } } } DB_SHOW_ALIAS(allchains, db_show_allchains) - -/* - * Show all the threads a particular thread is waiting on based on - * sleepable locks. - */ -static void -print_sleepchain(struct thread *td, const char *prefix) -{ - struct thread *owner; - - /* - * Follow the chain. We keep walking as long as the thread is - * blocked on a sleep lock that has an owner. - */ - while (!db_pager_quit) { - db_printf("%sthread %d (pid %d, %s) ", prefix, td->td_tid, - td->td_proc->p_pid, td->td_name); - switch (td->td_state) { - case TDS_INACTIVE: - db_printf("is inactive\n"); - return; - case TDS_CAN_RUN: - db_printf("can run\n"); - return; - case TDS_RUNQ: - db_printf("is on a run queue\n"); - return; - case TDS_RUNNING: - db_printf("running on CPU %d\n", td->td_oncpu); - return; - case TDS_INHIBITED: - if (TD_ON_SLEEPQ(td)) { - if (lockmgr_chain(td, &owner) || - sx_chain(td, &owner)) { - if (owner == NULL) - return; - td = owner; - break; - } - db_printf("sleeping on %p \"%s\"\n", - td->td_wchan, td->td_wmesg); - return; - } - db_printf("inhibited\n"); - return; - default: - db_printf("??? (%#x)\n", td->td_state); - return; - } - } -} - -DB_SHOW_COMMAND(sleepchain, db_show_sleepchain) -{ - struct thread *td; - - /* Figure out which thread to start with. */ - if (have_addr) - td = db_lookup_thread(addr, true); - else - td = kdb_thread; - - print_sleepchain(td, ""); -} static void print_waiters(struct turnstile *ts, int indent); From owner-svn-src-all@freebsd.org Thu Aug 24 16:35:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AAACDE3826; Thu, 24 Aug 2017 16:35:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2349F83037; Thu, 24 Aug 2017 16:35:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OGZ4PF073864; Thu, 24 Aug 2017 16:35:04 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OGZ3b2073851; Thu, 24 Aug 2017 16:35:03 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708241635.v7OGZ3b2073851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 24 Aug 2017 16:35:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322837 - in vendor/llvm/dist: docs include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/ExecutionEngine lib/IR lib/Object lib/Target/ARM lib/Target/X86 lib/ToolDrivers/llvm-dlltool lib/Tr... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm/dist: docs include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/ExecutionEngine lib/IR lib/Object lib/Target/ARM lib/Target/X86 lib/ToolDrivers/llvm-dlltool lib/Transforms/Scalar lib/Trans... X-SVN-Commit-Revision: 322837 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 16:35:05 -0000 Author: dim Date: Thu Aug 24 16:35:02 2017 New Revision: 322837 URL: https://svnweb.freebsd.org/changeset/base/322837 Log: Vendor import of llvm release_50 branch r311606: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311606 Added: vendor/llvm/dist/test/CodeGen/ARM/Windows/vla-cpsr.ll vendor/llvm/dist/test/CodeGen/X86/pr34139.ll vendor/llvm/dist/test/CodeGen/X86/pr34177.ll vendor/llvm/dist/test/CodeGen/X86/pr34271-1.ll vendor/llvm/dist/test/CodeGen/X86/pr34271.ll vendor/llvm/dist/test/DllTool/coff-decorated.def Deleted: vendor/llvm/dist/test/CodeGen/X86/f16c-schedule.ll vendor/llvm/dist/test/CodeGen/X86/lea32-schedule.ll vendor/llvm/dist/test/CodeGen/X86/lea64-schedule.ll vendor/llvm/dist/test/CodeGen/X86/popcnt-schedule.ll Modified: vendor/llvm/dist/docs/ReleaseNotes.rst vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeTypes.h vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAG.cpp vendor/llvm/dist/lib/ExecutionEngine/CMakeLists.txt vendor/llvm/dist/lib/IR/AutoUpgrade.cpp vendor/llvm/dist/lib/Object/COFFModuleDefinition.cpp vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td vendor/llvm/dist/lib/Target/X86/X86SchedSandyBridge.td vendor/llvm/dist/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp vendor/llvm/dist/lib/ToolDrivers/llvm-dlltool/Options.td vendor/llvm/dist/lib/Transforms/Scalar/LowerAtomic.cpp vendor/llvm/dist/lib/Transforms/Scalar/Reassociate.cpp vendor/llvm/dist/lib/Transforms/Utils/CloneFunction.cpp vendor/llvm/dist/test/Bitcode/upgrade-module-flag.ll vendor/llvm/dist/test/CodeGen/ARM/vzip.ll vendor/llvm/dist/test/CodeGen/X86/avx-schedule.ll vendor/llvm/dist/test/CodeGen/X86/avx512-extract-subvector.ll vendor/llvm/dist/test/CodeGen/X86/extractelement-legalization-store-ordering.ll vendor/llvm/dist/test/CodeGen/X86/fp128-i128.ll vendor/llvm/dist/test/CodeGen/X86/gather-addresses.ll vendor/llvm/dist/test/CodeGen/X86/recip-fastmath.ll vendor/llvm/dist/test/CodeGen/X86/recip-fastmath2.ll vendor/llvm/dist/test/CodeGen/X86/sse-schedule.ll vendor/llvm/dist/test/CodeGen/X86/sse2-schedule.ll vendor/llvm/dist/test/CodeGen/X86/sse3-schedule.ll vendor/llvm/dist/test/CodeGen/X86/sse41-schedule.ll vendor/llvm/dist/test/CodeGen/X86/sse42-schedule.ll vendor/llvm/dist/test/CodeGen/X86/ssse3-schedule.ll vendor/llvm/dist/test/Feature/optnone-opt.ll vendor/llvm/dist/test/Linker/module-flags-pic-1-a.ll vendor/llvm/dist/test/Transforms/Inline/recursive.ll vendor/llvm/dist/test/Transforms/LowerAtomic/atomic-swap.ll vendor/llvm/dist/test/Transforms/Reassociate/canonicalize-neg-const.ll Modified: vendor/llvm/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/llvm/dist/docs/ReleaseNotes.rst Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/docs/ReleaseNotes.rst Thu Aug 24 16:35:02 2017 (r322837) @@ -77,12 +77,34 @@ Changes to the LLVM IR * Added speculatable attribute indicating a function which does has no side-effects which could inhibit hoisting of calls. -Changes to the ARM Backend +Changes to the Arm Targets -------------------------- - During this release ... +During this release the AArch64 target has: +* A much improved Global ISel at O0. +* Support for ARMv8.1 8.2 and 8.3 instructions. +* New scheduler information for ThunderX2. +* Some SVE type changes but not much more than that. +* Made instruction fusion more aggressive, resulting in speedups + for code making use of AArch64 AES instructions. AES fusion has been + enabled for most Cortex-A cores and the AArch64MacroFusion pass was moved + to the generic MacroFusion pass. +* Added preferred function alignments for most Cortex-A cores. +* OpenMP "offload-to-self" base support. +During this release the ARM target has: + +* Improved, but still mostly broken, Global ISel. +* Scheduling models update, new schedule for Cortex-A57. +* Hardware breakpoint support in LLDB. +* New assembler error handling, with spelling corrections and multiple + suggestions on how to fix problems. +* Improved mixed ARM/Thumb code generation. Some cases in which wrong + relocations were emitted have been fixed. +* Added initial support for mixed ARM/Thumb link-time optimization, using the + thumb-mode target feature. + Changes to the MIPS Target -------------------------- @@ -92,7 +114,29 @@ Changes to the MIPS Target Changes to the PowerPC Target ----------------------------- - During this release ... +* Additional support and exploitation of POWER ISA 3.0: vabsdub, vabsduh, + vabsduw, modsw, moduw, modsd, modud, lxv, stxv, vextublx, vextubrx, vextuhlx, + vextuhrx, vextuwlx, vextuwrx, vextsb2w, vextsb2d, vextsh2w, vextsh2d, and + vextsw2d + +* Implemented Optimal Code Sequences from The PowerPC Compiler Writer's Guide. + +* Enable -fomit-frame-pointer by default. + +* Improved handling of bit reverse intrinsic. + +* Improved handling of memcpy and memcmp functions. + +* Improved handling of branches with static branch hints. + +* Improved codegen for atomic load_acquire. + +* Improved block placement during code layout + +* Many improvements to instruction selection and code generation + + + Changes to the X86 Target ------------------------- Modified: vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h ============================================================================== --- vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h Thu Aug 24 16:35:02 2017 (r322837) @@ -85,7 +85,10 @@ namespace ISD { /// If N is a BUILD_VECTOR node whose elements are all the same constant or /// undefined, return true and return the constant value in \p SplatValue. - bool isConstantSplatVector(const SDNode *N, APInt &SplatValue); + /// This sets \p SplatValue to the smallest possible splat unless AllowShrink + /// is set to false. + bool isConstantSplatVector(const SDNode *N, APInt &SplatValue, + bool AllowShrink = true); /// Return true if the specified node is a BUILD_VECTOR where all of the /// elements are ~0 or undef. Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeTypes.h ============================================================================== --- vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeTypes.h Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeTypes.h Thu Aug 24 16:35:02 2017 (r322837) @@ -627,6 +627,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer { (priv SDValue ScalarizeVecOp_CONCAT_VECTORS(SDNode *N); SDValue ScalarizeVecOp_EXTRACT_VECTOR_ELT(SDNode *N); SDValue ScalarizeVecOp_VSELECT(SDNode *N); + SDValue ScalarizeVecOp_VSETCC(SDNode *N); SDValue ScalarizeVecOp_STORE(StoreSDNode *N, unsigned OpNo); SDValue ScalarizeVecOp_FP_ROUND(SDNode *N, unsigned OpNo); Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Thu Aug 24 16:35:02 2017 (r322837) @@ -484,6 +484,9 @@ bool DAGTypeLegalizer::ScalarizeVectorOperand(SDNode * case ISD::VSELECT: Res = ScalarizeVecOp_VSELECT(N); break; + case ISD::SETCC: + Res = ScalarizeVecOp_VSETCC(N); + break; case ISD::STORE: Res = ScalarizeVecOp_STORE(cast(N), OpNo); break; @@ -558,6 +561,36 @@ SDValue DAGTypeLegalizer::ScalarizeVecOp_VSELECT(SDNod return DAG.getNode(ISD::SELECT, SDLoc(N), VT, ScalarCond, N->getOperand(1), N->getOperand(2)); +} + +/// If the operand is a vector that needs to be scalarized then the +/// result must be v1i1, so just convert to a scalar SETCC and wrap +/// with a scalar_to_vector since the res type is legal if we got here +SDValue DAGTypeLegalizer::ScalarizeVecOp_VSETCC(SDNode *N) { + assert(N->getValueType(0).isVector() && + N->getOperand(0).getValueType().isVector() && + "Operand types must be vectors"); + assert(N->getValueType(0) == MVT::v1i1 && "Expected v1i1 type"); + + EVT VT = N->getValueType(0); + SDValue LHS = GetScalarizedVector(N->getOperand(0)); + SDValue RHS = GetScalarizedVector(N->getOperand(1)); + + EVT OpVT = N->getOperand(0).getValueType(); + EVT NVT = VT.getVectorElementType(); + SDLoc DL(N); + // Turn it into a scalar SETCC. + SDValue Res = DAG.getNode(ISD::SETCC, DL, MVT::i1, LHS, RHS, + N->getOperand(2)); + + // Vectors may have a different boolean contents to scalars. Promote the + // value appropriately. + ISD::NodeType ExtendCode = + TargetLowering::getExtendForContent(TLI.getBooleanContents(OpVT)); + + Res = DAG.getNode(ExtendCode, DL, NVT, Res); + + return DAG.getNode(ISD::SCALAR_TO_VECTOR, DL, VT, Res); } /// If the value to store is a vector that needs to be scalarized, it must be Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAG.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Aug 24 16:35:02 2017 (r322837) @@ -116,7 +116,8 @@ bool ConstantFPSDNode::isValueValidForType(EVT VT, // ISD Namespace //===----------------------------------------------------------------------===// -bool ISD::isConstantSplatVector(const SDNode *N, APInt &SplatVal) { +bool ISD::isConstantSplatVector(const SDNode *N, APInt &SplatVal, + bool AllowShrink) { auto *BV = dyn_cast(N); if (!BV) return false; @@ -124,9 +125,11 @@ bool ISD::isConstantSplatVector(const SDNode *N, APInt APInt SplatUndef; unsigned SplatBitSize; bool HasUndefs; - EVT EltVT = N->getValueType(0).getVectorElementType(); - return BV->isConstantSplat(SplatVal, SplatUndef, SplatBitSize, HasUndefs) && - EltVT.getSizeInBits() >= SplatBitSize; + unsigned EltSize = N->getValueType(0).getVectorElementType().getSizeInBits(); + unsigned MinSplatBits = AllowShrink ? 0 : EltSize; + return BV->isConstantSplat(SplatVal, SplatUndef, SplatBitSize, HasUndefs, + MinSplatBits) && + EltSize >= SplatBitSize; } // FIXME: AllOnes and AllZeros duplicate a lot of code. Could these be Modified: vendor/llvm/dist/lib/ExecutionEngine/CMakeLists.txt ============================================================================== --- vendor/llvm/dist/lib/ExecutionEngine/CMakeLists.txt Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/lib/ExecutionEngine/CMakeLists.txt Thu Aug 24 16:35:02 2017 (r322837) @@ -14,6 +14,10 @@ add_llvm_library(LLVMExecutionEngine intrinsics_gen ) +if(BUILD_SHARED_LIBS) + target_link_libraries(LLVMExecutionEngine PUBLIC LLVMRuntimeDyld) +endif() + add_subdirectory(Interpreter) add_subdirectory(MCJIT) add_subdirectory(Orc) Modified: vendor/llvm/dist/lib/IR/AutoUpgrade.cpp ============================================================================== --- vendor/llvm/dist/lib/IR/AutoUpgrade.cpp Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/lib/IR/AutoUpgrade.cpp Thu Aug 24 16:35:02 2017 (r322837) @@ -2239,14 +2239,14 @@ bool llvm::UpgradeDebugInfo(Module &M) { } bool llvm::UpgradeModuleFlags(Module &M) { - const NamedMDNode *ModFlags = M.getModuleFlagsMetadata(); + NamedMDNode *ModFlags = M.getModuleFlagsMetadata(); if (!ModFlags) return false; - bool HasObjCFlag = false, HasClassProperties = false; + bool HasObjCFlag = false, HasClassProperties = false, Changed = false; for (unsigned I = 0, E = ModFlags->getNumOperands(); I != E; ++I) { MDNode *Op = ModFlags->getOperand(I); - if (Op->getNumOperands() < 2) + if (Op->getNumOperands() != 3) continue; MDString *ID = dyn_cast_or_null(Op->getOperand(1)); if (!ID) @@ -2255,7 +2255,24 @@ bool llvm::UpgradeModuleFlags(Module &M) { HasObjCFlag = true; if (ID->getString() == "Objective-C Class Properties") HasClassProperties = true; + // Upgrade PIC/PIE Module Flags. The module flag behavior for these two + // field was Error and now they are Max. + if (ID->getString() == "PIC Level" || ID->getString() == "PIE Level") { + if (auto *Behavior = + mdconst::dyn_extract_or_null(Op->getOperand(0))) { + if (Behavior->getLimitedValue() == Module::Error) { + Type *Int32Ty = Type::getInt32Ty(M.getContext()); + Metadata *Ops[3] = { + ConstantAsMetadata::get(ConstantInt::get(Int32Ty, Module::Max)), + MDString::get(M.getContext(), ID->getString()), + Op->getOperand(2)}; + ModFlags->setOperand(I, MDNode::get(M.getContext(), Ops)); + Changed = true; + } + } + } } + // "Objective-C Class Properties" is recently added for Objective-C. We // upgrade ObjC bitcodes to contain a "Objective-C Class Properties" module // flag of value 0, so we can correclty downgrade this flag when trying to @@ -2264,9 +2281,10 @@ bool llvm::UpgradeModuleFlags(Module &M) { if (HasObjCFlag && !HasClassProperties) { M.addModuleFlag(llvm::Module::Override, "Objective-C Class Properties", (uint32_t)0); - return true; + Changed = true; } - return false; + + return Changed; } static bool isOldLoopArgument(Metadata *MD) { Modified: vendor/llvm/dist/lib/Object/COFFModuleDefinition.cpp ============================================================================== --- vendor/llvm/dist/lib/Object/COFFModuleDefinition.cpp Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/lib/Object/COFFModuleDefinition.cpp Thu Aug 24 16:35:02 2017 (r322837) @@ -232,7 +232,13 @@ class Parser { (private) for (;;) { read(); if (Tok.K == Identifier && Tok.Value[0] == '@') { - Tok.Value.drop_front().getAsInteger(10, E.Ordinal); + if (Tok.Value.drop_front().getAsInteger(10, E.Ordinal)) { + // Not an ordinal modifier at all, but the next export (fastcall + // decorated) - complete the current one. + unget(); + Info.Exports.push_back(E); + return Error::success(); + } read(); if (Tok.K == KwNoname) { E.Noname = true; Modified: vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp Thu Aug 24 16:35:02 2017 (r322837) @@ -5901,7 +5901,10 @@ static bool isVUZPMask(ArrayRef M, EVT VT, unsign return false; for (unsigned i = 0; i < M.size(); i += NumElts) { - WhichResult = M[i] == 0 ? 0 : 1; + if (M.size() == NumElts * 2) + WhichResult = i / NumElts; + else + WhichResult = M[i] == 0 ? 0 : 1; for (unsigned j = 0; j < NumElts; ++j) { if (M[i+j] >= 0 && (unsigned) M[i+j] != 2 * j + WhichResult) return false; @@ -5932,7 +5935,10 @@ static bool isVUZP_v_undef_Mask(ArrayRef M, EVT V unsigned Half = NumElts / 2; for (unsigned i = 0; i < M.size(); i += NumElts) { - WhichResult = M[i] == 0 ? 0 : 1; + if (M.size() == NumElts * 2) + WhichResult = i / NumElts; + else + WhichResult = M[i] == 0 ? 0 : 1; for (unsigned j = 0; j < NumElts; j += Half) { unsigned Idx = WhichResult; for (unsigned k = 0; k < Half; ++k) { @@ -5972,7 +5978,10 @@ static bool isVZIPMask(ArrayRef M, EVT VT, unsign return false; for (unsigned i = 0; i < M.size(); i += NumElts) { - WhichResult = M[i] == 0 ? 0 : 1; + if (M.size() == NumElts * 2) + WhichResult = i / NumElts; + else + WhichResult = M[i] == 0 ? 0 : 1; unsigned Idx = WhichResult * NumElts / 2; for (unsigned j = 0; j < NumElts; j += 2) { if ((M[i+j] >= 0 && (unsigned) M[i+j] != Idx) || @@ -6005,7 +6014,10 @@ static bool isVZIP_v_undef_Mask(ArrayRef M, EVT V return false; for (unsigned i = 0; i < M.size(); i += NumElts) { - WhichResult = M[i] == 0 ? 0 : 1; + if (M.size() == NumElts * 2) + WhichResult = i / NumElts; + else + WhichResult = M[i] == 0 ? 0 : 1; unsigned Idx = WhichResult * NumElts / 2; for (unsigned j = 0; j < NumElts; j += 2) { if ((M[i+j] >= 0 && (unsigned) M[i+j] != Idx) || @@ -8793,6 +8805,8 @@ ARMTargetLowering::EmitLowered__chkstk(MachineInstr &M .addReg(ARM::R4, RegState::Implicit | RegState::Kill) .addReg(ARM::R4, RegState::Implicit | RegState::Define) .addReg(ARM::R12, + RegState::Implicit | RegState::Define | RegState::Dead) + .addReg(ARM::CPSR, RegState::Implicit | RegState::Define | RegState::Dead); break; case CodeModel::Large: @@ -8808,6 +8822,8 @@ ARMTargetLowering::EmitLowered__chkstk(MachineInstr &M .addReg(ARM::R4, RegState::Implicit | RegState::Kill) .addReg(ARM::R4, RegState::Implicit | RegState::Define) .addReg(ARM::R12, + RegState::Implicit | RegState::Define | RegState::Dead) + .addReg(ARM::CPSR, RegState::Implicit | RegState::Define | RegState::Dead); break; } Modified: vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Thu Aug 24 16:35:02 2017 (r322837) @@ -29540,8 +29540,9 @@ static bool detectZextAbsDiff(const SDValue &Select, S // In SetLT case, The second operand of the comparison can be either 1 or 0. APInt SplatVal; if ((CC == ISD::SETLT) && - !((ISD::isConstantSplatVector(SetCC.getOperand(1).getNode(), SplatVal) && - SplatVal == 1) || + !((ISD::isConstantSplatVector(SetCC.getOperand(1).getNode(), SplatVal, + /*AllowShrink*/false) && + SplatVal.isOneValue()) || (ISD::isBuildVectorAllZeros(SetCC.getOperand(1).getNode())))) return false; @@ -30628,6 +30629,9 @@ static SDValue combineSelect(SDNode *N, SelectionDAG & // Byte blends are only available in AVX2 if (VT == MVT::v32i8 && !Subtarget.hasAVX2()) return SDValue(); + // There are no 512-bit blend instructions that use sign bits. + if (VT.is512BitVector()) + return SDValue(); assert(BitWidth >= 8 && BitWidth <= 64 && "Invalid mask size"); APInt DemandedMask(APInt::getSignMask(BitWidth)); @@ -32058,7 +32062,8 @@ static SDValue combineAndMaskToShift(SDNode *N, Select return SDValue(); APInt SplatVal; - if (!ISD::isConstantSplatVector(Op1.getNode(), SplatVal) || + if (!ISD::isConstantSplatVector(Op1.getNode(), SplatVal, + /*AllowShrink*/false) || !SplatVal.isMask()) return SDValue(); @@ -32642,7 +32647,8 @@ static SDValue detectUSatPattern(SDValue In, EVT VT) { "Unexpected types for truncate operation"); APInt C; - if (ISD::isConstantSplatVector(In.getOperand(1).getNode(), C)) { + if (ISD::isConstantSplatVector(In.getOperand(1).getNode(), C, + /*AllowShrink*/false)) { // C should be equal to UINT32_MAX / UINT16_MAX / UINT8_MAX according // the element size of the destination type. return C.isMask(VT.getScalarSizeInBits()) ? In.getOperand(0) : @@ -35346,7 +35352,8 @@ static SDValue combineIncDecVector(SDNode *N, Selectio SDNode *N1 = N->getOperand(1).getNode(); APInt SplatVal; - if (!ISD::isConstantSplatVector(N1, SplatVal) || !SplatVal.isOneValue()) + if (!ISD::isConstantSplatVector(N1, SplatVal, /*AllowShrink*/false) || + !SplatVal.isOneValue()) return SDValue(); SDValue AllOnesVec = getOnesVector(VT, DAG, SDLoc(N)); Modified: vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td Thu Aug 24 16:35:02 2017 (r322837) @@ -3619,8 +3619,8 @@ let Predicates = [HasVLX] in { def : Pat<(alignedstore256 (v4f64 (extract_subvector (v8f64 VR512:$src), (iPTR 0))), addr:$dst), (VMOVAPDZ256mr addr:$dst, (v4f64 (EXTRACT_SUBREG VR512:$src,sub_ymm)))>; - def : Pat<(alignedstore (v8f32 (extract_subvector - (v16f32 VR512:$src), (iPTR 0))), addr:$dst), + def : Pat<(alignedstore256 (v8f32 (extract_subvector + (v16f32 VR512:$src), (iPTR 0))), addr:$dst), (VMOVAPSZ256mr addr:$dst, (v8f32 (EXTRACT_SUBREG VR512:$src,sub_ymm)))>; def : Pat<(alignedstore256 (v4i64 (extract_subvector (v8i64 VR512:$src), (iPTR 0))), addr:$dst), Modified: vendor/llvm/dist/lib/Target/X86/X86SchedSandyBridge.td ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86SchedSandyBridge.td Thu Aug 24 15:12:16 2017 (r322836) +++ vendor/llvm/dist/lib/Target/X86/X86SchedSandyBridge.td Thu Aug 24 16:35:02 2017 (r322837) @@ -24,8 +24,8 @@ def SandyBridgeModel : SchedMachineModel { // Based on the LSD (loop-stream detector) queue size. let LoopMicroOpBufferSize = 28; - // This flag is set to allow the scheduler to assign - // a default model to unrecognized opcodes. + // FIXME: SSE4 and AVX are unimplemented. This flag is set to allow + // the scheduler to assign a default model to unrecognized opcodes. let CompleteModel = 0; } @@ -48,7 +48,6 @@ def SBPort23 : ProcResource<2>; def SBPort4 : ProcResource<1>; // Many micro-ops are capable of issuing on multiple ports. -def SBPort01 : ProcResGroup<[SBPort0, SBPort1]>; def SBPort05 : ProcResGroup<[SBPort0, SBPort5]>; def SBPort15 : ProcResGroup<[SBPort1, SBPort5]>; def SBPort015 : ProcResGroup<[SBPort0, SBPort1, SBPort5]>; @@ -116,10 +115,10 @@ def : WriteRes; defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; // 10-14 cycles. defm : SBWriteResPair; defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; defm : SBWriteResPair; defm : SBWriteResPair; defm : SBWriteResPair; @@ -135,11 +134,11 @@ def : WriteRes; -defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; +defm : SBWriteResPair; +defm : SBWriteResPair; defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; defm : SBWriteResPair; def : WriteRes { let Latency = 2; @@ -149,15 +148,13 @@ def : WriteRes { - let Latency = 5; - let NumMicroOps = 3; - let ResourceCycles = [1,2]; +def : WriteRes { + let Latency = 6; + let ResourceCycles = [1, 1, 1]; } -def : WriteRes { - let Latency = 11; - let NumMicroOps = 4; - let ResourceCycles = [1,1,2]; +def : WriteRes { + let Latency = 6; + let ResourceCycles = [1, 1, 1, 1]; } //////////////////////////////////////////////////////////////////////////////// @@ -207,15 +204,13 @@ def : WriteRes { - let Latency = 11; - let NumMicroOps = 3; +def : WriteRes { + let Latency = 3; let ResourceCycles = [3]; } -def : WriteRes { - let Latency = 17; - let NumMicroOps = 4; - let ResourceCycles = [3,1]; +def : WriteRes { + let Latency = 3; + let ResourceCycles = [3, 1]; } // Packed Compare Explicit Length Strings, Return Index @@ -229,26 +224,22 @@ def : WriteRes { - let Latency = 7; - let NumMicroOps = 2; - let ResourceCycles = [1,1]; +def : WriteRes { + let Latency = 8; + let ResourceCycles = [2]; } -def : WriteRes { - let Latency = 13; - let NumMicroOps = 3; - let ResourceCycles = [1,1,1]; +def : WriteRes { + let Latency = 8; + let ResourceCycles = [2, 1]; } -def : WriteRes { - let Latency = 12; - let NumMicroOps = 2; +def : WriteRes { + let Latency = 8; let ResourceCycles = [2]; } -def : WriteRes { - let Latency = 18; - let NumMicroOps = 3; - let ResourceCycles = [2,1]; +def : WriteRes { + let Latency = 8; + let ResourceCycles = [2, 1]; } def : WriteRes { @@ -281,2407 +272,4 @@ def : WriteRes; defm : SBWriteResPair; defm : SBWriteResPair; defm : SBWriteResPair; - -// Remaining SNB instrs. - -def SBWriteResGroup0 : SchedWriteRes<[SBPort0]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup0], (instregex "CVTSS2SDrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSLLDri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSLLQri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSLLWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSRADri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSRAWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSRLDri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSRLQri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSRLWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VCVTSS2SDrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPMOVMSKBrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSLLDri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSLLQri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSLLWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSRADri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSRAWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSRLDri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSRLQri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSRLWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VTESTPDYrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "VTESTPDrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "VTESTPSYrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "VTESTPSrr")>; - -def SBWriteResGroup1 : SchedWriteRes<[SBPort1]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup1], (instregex "COMP_FST0r")>; -def: InstRW<[SBWriteResGroup1], (instregex "COM_FST0r")>; -def: InstRW<[SBWriteResGroup1], (instregex "UCOM_FPr")>; -def: InstRW<[SBWriteResGroup1], (instregex "UCOM_Fr")>; - -def SBWriteResGroup2 : SchedWriteRes<[SBPort5]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup2], (instregex "ANDNPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ANDNPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ANDPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ANDPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "FDECSTP")>; -def: InstRW<[SBWriteResGroup2], (instregex "FFREE")>; -def: InstRW<[SBWriteResGroup2], (instregex "FINCSTP")>; -def: InstRW<[SBWriteResGroup2], (instregex "FNOP")>; -def: InstRW<[SBWriteResGroup2], (instregex "INSERTPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "JMP64r")>; -def: InstRW<[SBWriteResGroup2], (instregex "LD_Frr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOV64toPQIrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVAPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVAPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVDDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVDI2PDIrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVHLPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVLHPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVSDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVSHDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVSLDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVSSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVUPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVUPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ORPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ORPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "RETQ")>; -def: InstRW<[SBWriteResGroup2], (instregex "SHUFPDrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "SHUFPSrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "ST_FPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ST_Frr")>; -def: InstRW<[SBWriteResGroup2], (instregex "UNPCKHPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "UNPCKHPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "UNPCKLPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "UNPCKLPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDNPDYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDNPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDNPSYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDNPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VEXTRACTF128rr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VINSERTF128rr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VINSERTPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOV64toPQIrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOV64toPQIrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVAPDYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVAPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVAPSYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVAPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVDDUPYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVDDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVHLPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVHLPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSHDUPYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSHDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSLDUPYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSLDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVUPDYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVUPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVUPSYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVUPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VORPDYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VORPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VORPSYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VORPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPDri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPDrm")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPSri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPSrm")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VSHUFPDYrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VSHUFPDrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VSHUFPSYrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VSHUFPSrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKHPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKHPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKLPDYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKLPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKLPSYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKLPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VXORPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VXORPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "XORPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "XORPSrr")>; - -def SBWriteResGroup3 : SchedWriteRes<[SBPort01]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup3], (instregex "LEA64_32r")>; - -def SBWriteResGroup4 : SchedWriteRes<[SBPort0]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup4], (instregex "BLENDPDrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "BLENDPSrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "BT32ri8")>; -def: InstRW<[SBWriteResGroup4], (instregex "BT32rr")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTC32ri8")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTC32rr")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTR32ri8")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTR32rr")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTS32ri8")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTS32rr")>; -def: InstRW<[SBWriteResGroup4], (instregex "CDQ")>; -def: InstRW<[SBWriteResGroup4], (instregex "CQO")>; -def: InstRW<[SBWriteResGroup4], (instregex "LAHF")>; -def: InstRW<[SBWriteResGroup4], (instregex "SAHF")>; -def: InstRW<[SBWriteResGroup4], (instregex "SAR32ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "SAR8ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETAEr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETBr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETEr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETGEr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETGr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETLEr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETLr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETNEr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETNOr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETNPr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETNSr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETOr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETPr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETSr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHL32ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHL64r1")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHL8r1")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHL8ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHR32ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHR8ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "VBLENDPDYrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "VBLENDPDrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "VBLENDPSYrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "VBLENDPSrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "VMOVDQAYrr")>; -def: InstRW<[SBWriteResGroup4], (instregex "VMOVDQArr")>; -def: InstRW<[SBWriteResGroup4], (instregex "VMOVDQUYrr")>; -def: InstRW<[SBWriteResGroup4], (instregex "VMOVDQUrr")>; - -def SBWriteResGroup5 : SchedWriteRes<[SBPort15]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup5], (instregex "KORTESTBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PABSBrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PABSDrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PABSWrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PADDQirr")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PALIGNR64irr")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PSHUFBrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PSIGNBrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PSIGNDrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PSIGNWrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "PABSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PABSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PABSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PACKSSDWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PACKSSWBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PACKUSDWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PACKUSWBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDUSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDUSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PALIGNRrri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PAVGBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PAVGWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PBLENDWrri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPEQBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPEQDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPEQQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPEQWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPGTBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPGTDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPGTWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXUBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXUDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXUWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINUBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINUDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINUWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXWQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXWQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSHUFBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSHUFDri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSHUFHWri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSHUFLWri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSIGNBrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSIGNDrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSIGNWrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSLLDQri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSRLDQri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBUSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBUSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKHBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKHDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKHQDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKHWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKLBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKLDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKLQDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKLWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VMASKMOVPSYrm")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPABSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPABSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPABSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPACKSSDWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPACKSSWBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPACKUSDWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPACKUSWBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPADDBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPADDDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPADDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPADDUSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPADDUSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPALIGNRrri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPAVGBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPAVGWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPBLENDWrri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPEQBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPEQDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPEQWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPGTBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPGTDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPGTWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXUBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXUDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXUWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINUBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINUDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINUWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXWQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXWQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSHUFBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSHUFDri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSHUFLWri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSIGNBrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSIGNDrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSIGNWrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSLLDQri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSRLDQri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBUSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBUSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKHBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKHDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKHWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKLDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKLQDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKLWDrr")>; - -def SBWriteResGroup6 : SchedWriteRes<[SBPort015]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup6], (instregex "ADD32ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "ADD32rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "ADD8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "ADD8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "AND32ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "AND64ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "AND64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "AND8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "AND8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "CBW")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMC")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMP16ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMP32i32")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMP64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMP8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMP8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "CWDE")>; -def: InstRW<[SBWriteResGroup6], (instregex "DEC64r")>; -def: InstRW<[SBWriteResGroup6], (instregex "DEC8r")>; -def: InstRW<[SBWriteResGroup6], (instregex "INC64r")>; -def: InstRW<[SBWriteResGroup6], (instregex "INC8r")>; -def: InstRW<[SBWriteResGroup6], (instregex "MMX_MOVD64from64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MMX_MOVQ2DQrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOV32rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOV8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOV8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVDQArr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVDQUrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVPQI2QIrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVSX32rr16")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVSX32rr8")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVZX32rr16")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVZX32rr8")>; -def: InstRW<[SBWriteResGroup6], (instregex "NEG64r")>; -def: InstRW<[SBWriteResGroup6], (instregex "NEG8r")>; -def: InstRW<[SBWriteResGroup6], (instregex "NOT64r")>; -def: InstRW<[SBWriteResGroup6], (instregex "NOT8r")>; -def: InstRW<[SBWriteResGroup6], (instregex "OR64ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "OR64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "OR8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "OR8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "PANDNrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "PANDrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "PORrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "PXORrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "STC")>; -def: InstRW<[SBWriteResGroup6], (instregex "SUB64ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "SUB64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "SUB8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "SUB8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "TEST64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "TEST8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "TEST8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VMOVPQI2QIrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VMOVZPQILo2PQIrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VPANDNrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VPANDrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VPORrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VPXORrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "XOR32rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "XOR64ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "XOR8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "XOR8rr")>; - -def SBWriteResGroup7 : SchedWriteRes<[SBPort0]> { - let Latency = 2; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup7], (instregex "MOVMSKPDrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "MOVMSKPSrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "MOVPDI2DIrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "MOVPQIto64rr")>; -def: InstRW<[SBWriteResGroup7], (instregex "PMOVMSKBrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "VMOVMSKPDYrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "VMOVMSKPDrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "VMOVMSKPSrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "VMOVPDI2DIrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "VMOVPQIto64rr")>; - -def SBWriteResGroup9 : SchedWriteRes<[SBPort0]> { - let Latency = 2; - let NumMicroOps = 2; - let ResourceCycles = [2]; -} -def: InstRW<[SBWriteResGroup9], (instregex "BLENDVPDrr0")>; -def: InstRW<[SBWriteResGroup9], (instregex "BLENDVPSrr0")>; -def: InstRW<[SBWriteResGroup9], (instregex "ROL32ri")>; -def: InstRW<[SBWriteResGroup9], (instregex "ROL8ri")>; -def: InstRW<[SBWriteResGroup9], (instregex "ROR32ri")>; -def: InstRW<[SBWriteResGroup9], (instregex "ROR8ri")>; -def: InstRW<[SBWriteResGroup9], (instregex "SETAr")>; -def: InstRW<[SBWriteResGroup9], (instregex "SETBEr")>; -def: InstRW<[SBWriteResGroup9], (instregex "VBLENDVPDYrr")>; -def: InstRW<[SBWriteResGroup9], (instregex "VBLENDVPDrr")>; -def: InstRW<[SBWriteResGroup9], (instregex "VBLENDVPSYrr")>; -def: InstRW<[SBWriteResGroup9], (instregex "VBLENDVPSrr")>; - -def SBWriteResGroup10 : SchedWriteRes<[SBPort15]> { - let Latency = 2; - let NumMicroOps = 2; - let ResourceCycles = [2]; -} -def: InstRW<[SBWriteResGroup10], (instregex "VPBLENDVBrr")>; - -def SBWriteResGroup11 : SchedWriteRes<[SBPort015]> { - let Latency = 2; - let NumMicroOps = 2; - let ResourceCycles = [2]; -} -def: InstRW<[SBWriteResGroup11], (instregex "SCASB")>; -def: InstRW<[SBWriteResGroup11], (instregex "SCASL")>; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Aug 24 16:35:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E920DDE382D; Thu, 24 Aug 2017 16:35:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D1AD83041; Thu, 24 Aug 2017 16:35:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OGZ9La073913; Thu, 24 Aug 2017 16:35:09 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OGZ9M5073912; Thu, 24 Aug 2017 16:35:09 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708241635.v7OGZ9M5073912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 24 Aug 2017 16:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322838 - vendor/llvm/llvm-release_50-r311606 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm/llvm-release_50-r311606 X-SVN-Commit-Revision: 322838 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 16:35:11 -0000 Author: dim Date: Thu Aug 24 16:35:09 2017 New Revision: 322838 URL: https://svnweb.freebsd.org/changeset/base/322838 Log: Tag llvm release_50 branch r311606. Added: vendor/llvm/llvm-release_50-r311606/ - copied from r322837, vendor/llvm/dist/ From owner-svn-src-all@freebsd.org Thu Aug 24 16:35:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE190DE3884; Thu, 24 Aug 2017 16:35:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8104C83113; Thu, 24 Aug 2017 16:35:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OGZKTZ074023; Thu, 24 Aug 2017 16:35:20 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OGZKRf074022; Thu, 24 Aug 2017 16:35:20 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708241635.v7OGZKRf074022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 24 Aug 2017 16:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322840 - vendor/clang/clang-release_50-r311606 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/clang/clang-release_50-r311606 X-SVN-Commit-Revision: 322840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 16:35:22 -0000 Author: dim Date: Thu Aug 24 16:35:20 2017 New Revision: 322840 URL: https://svnweb.freebsd.org/changeset/base/322840 Log: Tag clang release_50 branch r311606. Added: vendor/clang/clang-release_50-r311606/ - copied from r322839, vendor/clang/dist/ From owner-svn-src-all@freebsd.org Thu Aug 24 16:35:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AC6DDE3869; Thu, 24 Aug 2017 16:35:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E97A83099; Thu, 24 Aug 2017 16:35:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OGZFUY073977; Thu, 24 Aug 2017 16:35:15 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OGZEeO073962; Thu, 24 Aug 2017 16:35:14 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708241635.v7OGZEeO073962@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 24 Aug 2017 16:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322839 - in vendor/clang/dist: docs include/clang/AST include/clang/Lex lib/AST lib/CodeGen lib/Driver/ToolChains lib/Format lib/Headers lib/Lex lib/Parse lib/Sema lib/Serialization li... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist: docs include/clang/AST include/clang/Lex lib/AST lib/CodeGen lib/Driver/ToolChains lib/Format lib/Headers lib/Lex lib/Parse lib/Sema lib/Serialization lib/StaticAnalyzer/Core tes... X-SVN-Commit-Revision: 322839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 16:35:17 -0000 Author: dim Date: Thu Aug 24 16:35:14 2017 New Revision: 322839 URL: https://svnweb.freebsd.org/changeset/base/322839 Log: Vendor import of clang release_50 branch r311606: https://llvm.org/svn/llvm-project/cfe/branches/release_50@311606 Added: vendor/clang/dist/test/Index/preamble-conditionals-crash.cpp (contents, props changed) vendor/clang/dist/test/Index/preamble-conditionals.cpp (contents, props changed) Modified: vendor/clang/dist/docs/ReleaseNotes.rst vendor/clang/dist/include/clang/AST/DeclCXX.h vendor/clang/dist/include/clang/Lex/Preprocessor.h vendor/clang/dist/lib/AST/ASTImporter.cpp vendor/clang/dist/lib/AST/DeclCXX.cpp vendor/clang/dist/lib/CodeGen/CGCXXABI.cpp vendor/clang/dist/lib/CodeGen/ItaniumCXXABI.cpp vendor/clang/dist/lib/CodeGen/MicrosoftCXXABI.cpp vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp vendor/clang/dist/lib/Driver/ToolChains/MSVC.cpp vendor/clang/dist/lib/Driver/ToolChains/MSVC.h vendor/clang/dist/lib/Format/WhitespaceManager.cpp vendor/clang/dist/lib/Headers/unwind.h vendor/clang/dist/lib/Lex/PPLexerChange.cpp vendor/clang/dist/lib/Lex/Preprocessor.cpp vendor/clang/dist/lib/Parse/Parser.cpp vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp vendor/clang/dist/lib/Sema/SemaObjCProperty.cpp vendor/clang/dist/lib/Serialization/ASTReaderDecl.cpp vendor/clang/dist/lib/Serialization/ASTWriter.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/RegionStore.cpp vendor/clang/dist/test/Analysis/ctor.mm vendor/clang/dist/test/CodeGenCXX/uncopyable-args.cpp vendor/clang/dist/test/Driver/clang-translation.c vendor/clang/dist/test/SemaObjC/arc-property-decl-attrs.m vendor/clang/dist/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp vendor/clang/dist/unittests/Format/FormatTestComments.cpp Modified: vendor/clang/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/clang/dist/docs/ReleaseNotes.rst Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/docs/ReleaseNotes.rst Thu Aug 24 16:35:14 2017 (r322839) @@ -49,6 +49,15 @@ Major New Features - ... +C++ coroutines +^^^^^^^^^^^^^^ +`C++ coroutines TS +`_ +implementation has landed. Use ``-fcoroutines-ts -stdlib=libc++`` to enable +coroutine support. Here is `an example +`_ to get you started. + + Improvements to Clang's diagnostics ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -58,6 +67,25 @@ Improvements to Clang's diagnostics - -Wunused-lambda-capture warns when a variable explicitly captured by a lambda is not used in the body of the lambda. +- -Wstrict-prototypes is a new warning that warns about non-prototype + function and block declarations and types in C and Objective-C. + +- -Wunguarded-availability is a new warning that warns about uses of new + APIs that were introduced in a system whose version is newer than the + deployment target version. A new Objective-C expression ``@available`` has + been introduced to perform system version checking at runtime. This warning + is off by default to prevent unexpected warnings in existing projects. + However, its less strict sibling -Wunguarded-availability-new is on by + default. It warns about unguarded uses of APIs only when they were introduced + in or after macOS 10.13, iOS 11, tvOS 11 or watchOS 4. + +- The -Wdocumentation warning now allows the use of ``\param`` and + ``\returns`` documentation directives in the documentation comments for + declarations with a function or a block pointer type. + +- The compiler no longer warns about unreachable ``__builtin_unreachable`` + statements. + New Compiler Flags ------------------ @@ -76,8 +104,12 @@ future versions of Clang. New Pragmas in Clang ----------------------- -Clang now supports the ... +- Clang now supports the ``clang attribute`` pragma that allows users to apply + an attribute to multiple declarations. +- ``pragma pack`` directives that are included in a precompiled header are now + applied correctly to the declarations in the compilation unit that includes + that precompiled header. Attribute Changes in Clang -------------------------- @@ -85,6 +117,8 @@ Attribute Changes in Clang - The ``overloadable`` attribute now allows at most one function with a given name to lack the ``overloadable`` attribute. This unmarked function will not have its name mangled. +- The ```ms_abi`` attribute and the ``__builtin_ms_va_list`` types and builtins + are now supported on AArch64. Windows Support --------------- @@ -95,8 +129,42 @@ Clang's support for building native Windows programs . C Language Changes in Clang --------------------------- -- ... +- Added near complete support for implicit scalar to vector conversion, a GNU + C/C++ language extension. With this extension, the following code is + considered valid: +.. code-block:: c + + typedef unsigned v4i32 __attribute__((vector_size(16))); + + v4i32 foo(v4i32 a) { + // Here 5 is implicitly casted to an unsigned value and replicated into a + // vector with as many elements as 'a'. + return a + 5; + } + +The implicit conversion of a scalar value to a vector value--in the context of +a vector expression--occurs when: + +- The type of the vector is that of a ``__attribute__((vector_size(size)))`` + vector, not an OpenCL ``__attribute__((ext_vector_type(size)))`` vector type. + +- The scalar value can be casted to that of the vector element's type without + the loss of precision based on the type of the scalar and the type of the + vector's elements. + +- For compile time constant values, the above rule is weakened to consider the + value of the scalar constant rather than the constant's type. + +- Floating point constants with precise integral representations are not + implicitly converted to integer values, this is for compatability with GCC. + + +Currently the basic integer and floating point types with the following +operators are supported: ``+``, ``/``, ``-``, ``*``, ``%``, ``>``, ``<``, +``>=``, ``<=``, ``==``, ``!=``, ``&``, ``|``, ``^`` and the corresponding +assignment operators where applicable. + ... C11 Feature Support @@ -107,6 +175,10 @@ C11 Feature Support C++ Language Changes in Clang ----------------------------- +- As mentioned in `C Language Changes in Clang`_, Clang's support for + implicit scalar to vector conversions also applies to C++. Additionally + the following operators are also supported: ``&&`` and ``||``. + ... C++1z Feature Support @@ -117,13 +189,57 @@ C++1z Feature Support Objective-C Language Changes in Clang ------------------------------------- -... +- Clang now guarantees that a ``readwrite`` property is synthesized when an + ambiguous property (i.e. a property that's declared in multiple protocols) + is synthesized. The ``-Wprotocol-property-synthesis-ambiguity`` warning that + warns about incompatible property types is now promoted to an error when + there's an ambiguity between ``readwrite`` and ``readonly`` properties. +- Clang now prohibits synthesis of ambiguous properties with incompatible + explicit property attributes. The following property attributes are + checked for differences: ``copy``, ``retain``/``strong``, ``atomic``, + ``getter`` and ``setter``. + OpenCL C Language Changes in Clang ---------------------------------- -... +Various bug fixes and improvements: +- Extended OpenCL-related Clang tests. + +- Improved diagnostics across several areas: scoped address space + qualified variables, function pointers, atomics, type rank for overloading, + block captures, ``reserve_id_t``. + +- Several address space related fixes for constant address space function scope variables, + IR generation, mangling of ``generic`` and alloca (post-fix from general Clang + refactoring of address spaces). + +- Several improvements in extensions: fixed OpenCL version for ``cl_khr_mipmap_image``, + added missing ``cl_khr_3d_image_writes``. + +- Improvements in ``enqueue_kernel``, especially the implementation of ``ndrange_t`` and blocks. + +- OpenCL type related fixes: global samplers, the ``pipe_t`` size, internal type redefinition, + and type compatibility checking in ternary and other operations. + +- The OpenCL header has been extended with missing extension guards, and direct mapping of ``as_type`` + to ``__builtin_astype``. + +- Fixed ``kernel_arg_type_qual`` and OpenCL/SPIR version in metadata. + +- Added proper use of the kernel calling convention to various targets. + +The following new functionalities have been added: + +- Added documentation on OpenCL to Clang user manual. + +- Extended Clang builtins with required ``cl_khr_subgroups`` support. + +- Add ``intel_reqd_sub_group_size`` attribute support. + +- Added OpenCL types to ``CIndex``. + OpenMP Support in Clang ---------------------------------- @@ -194,8 +310,30 @@ clang-format libclang -------- -... +- Libclang now provides code-completion results for more C++ constructs + and keywords. The following keywords/identifiers are now included in the + code-completion results: ``static_assert``, ``alignas``, ``constexpr``, + ``final``, ``noexcept``, ``override`` and ``thread_local``. +- Libclang now provides code-completion results for members from dependent + classes. For example: + + .. code-block:: c++ + + template + void appendValue(std::vector &dest, const T &value) { + dest. // Relevant completion results are now shown after '.' + } + + Note that code-completion results are still not provided when the member + expression includes a dependent base expression. For example: + + .. code-block:: c++ + + template + void appendValue(std::vector> &dest, const T &value) { + dest.at(0). // Libclang fails to provide completion results after '.' + } Static Analyzer --------------- Modified: vendor/clang/dist/include/clang/AST/DeclCXX.h ============================================================================== --- vendor/clang/dist/include/clang/AST/DeclCXX.h Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/include/clang/AST/DeclCXX.h Thu Aug 24 16:35:14 2017 (r322839) @@ -375,6 +375,7 @@ class CXXRecordDecl : public RecordDecl { /// \brief These flags are \c true if a defaulted corresponding special /// member can't be fully analyzed without performing overload resolution. /// @{ + unsigned NeedOverloadResolutionForCopyConstructor : 1; unsigned NeedOverloadResolutionForMoveConstructor : 1; unsigned NeedOverloadResolutionForMoveAssignment : 1; unsigned NeedOverloadResolutionForDestructor : 1; @@ -383,6 +384,7 @@ class CXXRecordDecl : public RecordDecl { /// \brief These flags are \c true if an implicit defaulted corresponding /// special member would be defined as deleted. /// @{ + unsigned DefaultedCopyConstructorIsDeleted : 1; unsigned DefaultedMoveConstructorIsDeleted : 1; unsigned DefaultedMoveAssignmentIsDeleted : 1; unsigned DefaultedDestructorIsDeleted : 1; @@ -415,6 +417,12 @@ class CXXRecordDecl : public RecordDecl { /// constructor. unsigned HasDefaultedDefaultConstructor : 1; + /// \brief True if this class can be passed in a non-address-preserving + /// fashion (such as in registers) according to the C++ language rules. + /// This does not imply anything about how the ABI in use will actually + /// pass an object of this class. + unsigned CanPassInRegisters : 1; + /// \brief True if a defaulted default constructor for this class would /// be constexpr. unsigned DefaultedDefaultConstructorIsConstexpr : 1; @@ -811,18 +819,50 @@ class CXXRecordDecl : public RecordDecl { return data().FirstFriend.isValid(); } + /// \brief \c true if a defaulted copy constructor for this class would be + /// deleted. + bool defaultedCopyConstructorIsDeleted() const { + assert((!needsOverloadResolutionForCopyConstructor() || + (data().DeclaredSpecialMembers & SMF_CopyConstructor)) && + "this property has not yet been computed by Sema"); + return data().DefaultedCopyConstructorIsDeleted; + } + + /// \brief \c true if a defaulted move constructor for this class would be + /// deleted. + bool defaultedMoveConstructorIsDeleted() const { + assert((!needsOverloadResolutionForMoveConstructor() || + (data().DeclaredSpecialMembers & SMF_MoveConstructor)) && + "this property has not yet been computed by Sema"); + return data().DefaultedMoveConstructorIsDeleted; + } + + /// \brief \c true if a defaulted destructor for this class would be deleted. + bool defaultedDestructorIsDeleted() const { + return !data().DefaultedDestructorIsDeleted; + } + /// \brief \c true if we know for sure that this class has a single, + /// accessible, unambiguous copy constructor that is not deleted. + bool hasSimpleCopyConstructor() const { + return !hasUserDeclaredCopyConstructor() && + !data().DefaultedCopyConstructorIsDeleted; + } + + /// \brief \c true if we know for sure that this class has a single, /// accessible, unambiguous move constructor that is not deleted. bool hasSimpleMoveConstructor() const { return !hasUserDeclaredMoveConstructor() && hasMoveConstructor() && !data().DefaultedMoveConstructorIsDeleted; } + /// \brief \c true if we know for sure that this class has a single, /// accessible, unambiguous move assignment operator that is not deleted. bool hasSimpleMoveAssignment() const { return !hasUserDeclaredMoveAssignment() && hasMoveAssignment() && !data().DefaultedMoveAssignmentIsDeleted; } + /// \brief \c true if we know for sure that this class has an accessible /// destructor that is not deleted. bool hasSimpleDestructor() const { @@ -878,7 +918,16 @@ class CXXRecordDecl : public RecordDecl { /// \brief Determine whether we need to eagerly declare a defaulted copy /// constructor for this class. bool needsOverloadResolutionForCopyConstructor() const { - return data().HasMutableFields; + // C++17 [class.copy.ctor]p6: + // If the class definition declares a move constructor or move assignment + // operator, the implicitly declared copy constructor is defined as + // deleted. + // In MSVC mode, sometimes a declared move assignment does not delete an + // implicit copy constructor, so defer this choice to Sema. + if (data().UserDeclaredSpecialMembers & + (SMF_MoveConstructor | SMF_MoveAssignment)) + return true; + return data().NeedOverloadResolutionForCopyConstructor; } /// \brief Determine whether an implicit copy constructor for this type @@ -919,8 +968,17 @@ class CXXRecordDecl : public RecordDecl { needsImplicitMoveConstructor(); } - /// \brief Set that we attempted to declare an implicitly move + /// \brief Set that we attempted to declare an implicit copy /// constructor, but overload resolution failed so we deleted it. + void setImplicitCopyConstructorIsDeleted() { + assert((data().DefaultedCopyConstructorIsDeleted || + needsOverloadResolutionForCopyConstructor()) && + "Copy constructor should not be deleted"); + data().DefaultedCopyConstructorIsDeleted = true; + } + + /// \brief Set that we attempted to declare an implicit move + /// constructor, but overload resolution failed so we deleted it. void setImplicitMoveConstructorIsDeleted() { assert((data().DefaultedMoveConstructorIsDeleted || needsOverloadResolutionForMoveConstructor()) && @@ -1314,6 +1372,18 @@ class CXXRecordDecl : public RecordDecl { /// and will call only irrelevant destructors. bool hasIrrelevantDestructor() const { return data().HasIrrelevantDestructor; + } + + /// \brief Determine whether this class has at least one trivial, non-deleted + /// copy or move constructor. + bool canPassInRegisters() const { + return data().CanPassInRegisters; + } + + /// \brief Set that we can pass this RecordDecl in registers. + // FIXME: This should be set as part of completeDefinition. + void setCanPassInRegisters(bool CanPass) { + data().CanPassInRegisters = CanPass; } /// \brief Determine whether this class has a non-literal or/ volatile type Modified: vendor/clang/dist/include/clang/Lex/Preprocessor.h ============================================================================== --- vendor/clang/dist/include/clang/Lex/Preprocessor.h Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/include/clang/Lex/Preprocessor.h Thu Aug 24 16:35:14 2017 (r322839) @@ -1048,10 +1048,6 @@ class Preprocessor { (public) /// which implicitly adds the builtin defines etc. void EnterMainSourceFile(); - /// \brief After parser warm-up, initialize the conditional stack from - /// the preamble. - void replayPreambleConditionalStack(); - /// \brief Inform the preprocessor callbacks that processing is complete. void EndSourceFile(); @@ -2025,6 +2021,10 @@ class Preprocessor { (public) } private: + /// \brief After processing predefined file, initialize the conditional stack from + /// the preamble. + void replayPreambleConditionalStack(); + // Macro handling. void HandleDefineDirective(Token &Tok, bool ImmediatelyAfterTopLevelIfndef); void HandleUndefDirective(); Modified: vendor/clang/dist/lib/AST/ASTImporter.cpp ============================================================================== --- vendor/clang/dist/lib/AST/ASTImporter.cpp Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/lib/AST/ASTImporter.cpp Thu Aug 24 16:35:14 2017 (r322839) @@ -956,12 +956,16 @@ bool ASTNodeImporter::ImportDefinition(RecordDecl *Fro ToData.HasUninitializedFields = FromData.HasUninitializedFields; ToData.HasInheritedConstructor = FromData.HasInheritedConstructor; ToData.HasInheritedAssignment = FromData.HasInheritedAssignment; + ToData.NeedOverloadResolutionForCopyConstructor + = FromData.NeedOverloadResolutionForCopyConstructor; ToData.NeedOverloadResolutionForMoveConstructor = FromData.NeedOverloadResolutionForMoveConstructor; ToData.NeedOverloadResolutionForMoveAssignment = FromData.NeedOverloadResolutionForMoveAssignment; ToData.NeedOverloadResolutionForDestructor = FromData.NeedOverloadResolutionForDestructor; + ToData.DefaultedCopyConstructorIsDeleted + = FromData.DefaultedCopyConstructorIsDeleted; ToData.DefaultedMoveConstructorIsDeleted = FromData.DefaultedMoveConstructorIsDeleted; ToData.DefaultedMoveAssignmentIsDeleted @@ -973,6 +977,7 @@ bool ASTNodeImporter::ImportDefinition(RecordDecl *Fro = FromData.HasConstexprNonCopyMoveConstructor; ToData.HasDefaultedDefaultConstructor = FromData.HasDefaultedDefaultConstructor; + ToData.CanPassInRegisters = FromData.CanPassInRegisters; ToData.DefaultedDefaultConstructorIsConstexpr = FromData.DefaultedDefaultConstructorIsConstexpr; ToData.HasConstexprDefaultConstructor Modified: vendor/clang/dist/lib/AST/DeclCXX.cpp ============================================================================== --- vendor/clang/dist/lib/AST/DeclCXX.cpp Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/lib/AST/DeclCXX.cpp Thu Aug 24 16:35:14 2017 (r322839) @@ -55,15 +55,18 @@ CXXRecordDecl::DefinitionData::DefinitionData(CXXRecor HasOnlyCMembers(true), HasInClassInitializer(false), HasUninitializedReferenceMember(false), HasUninitializedFields(false), HasInheritedConstructor(false), HasInheritedAssignment(false), + NeedOverloadResolutionForCopyConstructor(false), NeedOverloadResolutionForMoveConstructor(false), NeedOverloadResolutionForMoveAssignment(false), NeedOverloadResolutionForDestructor(false), + DefaultedCopyConstructorIsDeleted(false), DefaultedMoveConstructorIsDeleted(false), DefaultedMoveAssignmentIsDeleted(false), DefaultedDestructorIsDeleted(false), HasTrivialSpecialMembers(SMF_All), DeclaredNonTrivialSpecialMembers(0), HasIrrelevantDestructor(true), HasConstexprNonCopyMoveConstructor(false), HasDefaultedDefaultConstructor(false), + CanPassInRegisters(true), DefaultedDefaultConstructorIsConstexpr(true), HasConstexprDefaultConstructor(false), HasNonLiteralTypeFieldsOrBases(false), ComputedVisibleConversions(false), @@ -352,8 +355,10 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const setHasVolatileMember(true); // Keep track of the presence of mutable fields. - if (BaseClassDecl->hasMutableFields()) + if (BaseClassDecl->hasMutableFields()) { data().HasMutableFields = true; + data().NeedOverloadResolutionForCopyConstructor = true; + } if (BaseClassDecl->hasUninitializedReferenceMember()) data().HasUninitializedReferenceMember = true; @@ -406,6 +411,8 @@ void CXXRecordDecl::addedClassSubobject(CXXRecordDecl // -- a direct or virtual base class B that cannot be copied/moved [...] // -- a non-static data member of class type M (or array thereof) // that cannot be copied or moved [...] + if (!Subobj->hasSimpleCopyConstructor()) + data().NeedOverloadResolutionForCopyConstructor = true; if (!Subobj->hasSimpleMoveConstructor()) data().NeedOverloadResolutionForMoveConstructor = true; @@ -426,6 +433,7 @@ void CXXRecordDecl::addedClassSubobject(CXXRecordDecl // -- any non-static data member has a type with a destructor // that is deleted or inaccessible from the defaulted [ctor or dtor]. if (!Subobj->hasSimpleDestructor()) { + data().NeedOverloadResolutionForCopyConstructor = true; data().NeedOverloadResolutionForMoveConstructor = true; data().NeedOverloadResolutionForDestructor = true; } @@ -711,8 +719,10 @@ void CXXRecordDecl::addedMember(Decl *D) { data().IsStandardLayout = false; // Keep track of the presence of mutable fields. - if (Field->isMutable()) + if (Field->isMutable()) { data().HasMutableFields = true; + data().NeedOverloadResolutionForCopyConstructor = true; + } // C++11 [class.union]p8, DR1460: // If X is a union, a non-static data member of X that is not an anonymous @@ -756,6 +766,12 @@ void CXXRecordDecl::addedMember(Decl *D) { // A standard-layout class is a class that: // -- has no non-static data members of type [...] reference, data().IsStandardLayout = false; + + // C++1z [class.copy.ctor]p10: + // A defaulted copy constructor for a class X is defined as deleted if X has: + // -- a non-static data member of rvalue reference type + if (T->isRValueReferenceType()) + data().DefaultedCopyConstructorIsDeleted = true; } if (!Field->hasInClassInitializer() && !Field->isMutable()) { @@ -809,6 +825,10 @@ void CXXRecordDecl::addedMember(Decl *D) { // We may need to perform overload resolution to determine whether a // field can be moved if it's const or volatile qualified. if (T.getCVRQualifiers() & (Qualifiers::Const | Qualifiers::Volatile)) { + // We need to care about 'const' for the copy constructor because an + // implicit copy constructor might be declared with a non-const + // parameter. + data().NeedOverloadResolutionForCopyConstructor = true; data().NeedOverloadResolutionForMoveConstructor = true; data().NeedOverloadResolutionForMoveAssignment = true; } @@ -819,6 +839,8 @@ void CXXRecordDecl::addedMember(Decl *D) { // -- X is a union-like class that has a variant member with a // non-trivial [corresponding special member] if (isUnion()) { + if (FieldRec->hasNonTrivialCopyConstructor()) + data().DefaultedCopyConstructorIsDeleted = true; if (FieldRec->hasNonTrivialMoveConstructor()) data().DefaultedMoveConstructorIsDeleted = true; if (FieldRec->hasNonTrivialMoveAssignment()) @@ -830,6 +852,8 @@ void CXXRecordDecl::addedMember(Decl *D) { // For an anonymous union member, our overload resolution will perform // overload resolution for its members. if (Field->isAnonymousStructOrUnion()) { + data().NeedOverloadResolutionForCopyConstructor |= + FieldRec->data().NeedOverloadResolutionForCopyConstructor; data().NeedOverloadResolutionForMoveConstructor |= FieldRec->data().NeedOverloadResolutionForMoveConstructor; data().NeedOverloadResolutionForMoveAssignment |= @@ -915,8 +939,10 @@ void CXXRecordDecl::addedMember(Decl *D) { } // Keep track of the presence of mutable fields. - if (FieldRec->hasMutableFields()) + if (FieldRec->hasMutableFields()) { data().HasMutableFields = true; + data().NeedOverloadResolutionForCopyConstructor = true; + } // C++11 [class.copy]p13: // If the implicitly-defined constructor would satisfy the @@ -1450,7 +1476,7 @@ void CXXRecordDecl::completeDefinition() { void CXXRecordDecl::completeDefinition(CXXFinalOverriderMap *FinalOverriders) { RecordDecl::completeDefinition(); - + // If the class may be abstract (but hasn't been marked as such), check for // any pure final overriders. if (mayBeAbstract()) { Modified: vendor/clang/dist/lib/CodeGen/CGCXXABI.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGCXXABI.cpp Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/lib/CodeGen/CGCXXABI.cpp Thu Aug 24 16:35:14 2017 (r322839) @@ -30,38 +30,9 @@ void CGCXXABI::ErrorUnsupportedABI(CodeGenFunction &CG } bool CGCXXABI::canCopyArgument(const CXXRecordDecl *RD) const { - // If RD has a non-trivial move or copy constructor, we cannot copy the - // argument. - if (RD->hasNonTrivialCopyConstructor() || RD->hasNonTrivialMoveConstructor()) - return false; - - // If RD has a non-trivial destructor, we cannot copy the argument. - if (RD->hasNonTrivialDestructor()) - return false; - // We can only copy the argument if there exists at least one trivial, // non-deleted copy or move constructor. - // FIXME: This assumes that all lazily declared copy and move constructors are - // not deleted. This assumption might not be true in some corner cases. - bool CopyDeleted = false; - bool MoveDeleted = false; - for (const CXXConstructorDecl *CD : RD->ctors()) { - if (CD->isCopyConstructor() || CD->isMoveConstructor()) { - assert(CD->isTrivial()); - // We had at least one undeleted trivial copy or move ctor. Return - // directly. - if (!CD->isDeleted()) - return true; - if (CD->isCopyConstructor()) - CopyDeleted = true; - else - MoveDeleted = true; - } - } - - // If all trivial copy and move constructors are deleted, we cannot copy the - // argument. - return !(CopyDeleted && MoveDeleted); + return RD->canPassInRegisters(); } llvm::Constant *CGCXXABI::GetBogusMemberPointer(QualType T) { Modified: vendor/clang/dist/lib/CodeGen/ItaniumCXXABI.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/ItaniumCXXABI.cpp Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/lib/CodeGen/ItaniumCXXABI.cpp Thu Aug 24 16:35:14 2017 (r322839) @@ -63,11 +63,8 @@ class ItaniumCXXABI : public CodeGen::CGCXXABI { (publ bool classifyReturnType(CGFunctionInfo &FI) const override; RecordArgABI getRecordArgABI(const CXXRecordDecl *RD) const override { - // Structures with either a non-trivial destructor or a non-trivial - // copy constructor are always indirect. - // FIXME: Use canCopyArgument() when it is fixed to handle lazily declared - // special members. - if (RD->hasNonTrivialDestructor() || RD->hasNonTrivialCopyConstructor()) + // If C++ prohibits us from making a copy, pass by address. + if (!canCopyArgument(RD)) return RAA_Indirect; return RAA_Default; } @@ -998,10 +995,8 @@ bool ItaniumCXXABI::classifyReturnType(CGFunctionInfo if (!RD) return false; - // Return indirectly if we have a non-trivial copy ctor or non-trivial dtor. - // FIXME: Use canCopyArgument() when it is fixed to handle lazily declared - // special members. - if (RD->hasNonTrivialDestructor() || RD->hasNonTrivialCopyConstructor()) { + // If C++ prohibits us from making a copy, return by address. + if (!canCopyArgument(RD)) { auto Align = CGM.getContext().getTypeAlignInChars(FI.getReturnType()); FI.getReturnInfo() = ABIArgInfo::getIndirect(Align, /*ByVal=*/false); return true; Modified: vendor/clang/dist/lib/CodeGen/MicrosoftCXXABI.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/MicrosoftCXXABI.cpp Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/lib/CodeGen/MicrosoftCXXABI.cpp Thu Aug 24 16:35:14 2017 (r322839) @@ -819,46 +819,44 @@ MicrosoftCXXABI::getRecordArgABI(const CXXRecordDecl * return RAA_Default; case llvm::Triple::x86_64: - // Win64 passes objects with non-trivial copy ctors indirectly. - if (RD->hasNonTrivialCopyConstructor()) - return RAA_Indirect; - - // If an object has a destructor, we'd really like to pass it indirectly + // If a class has a destructor, we'd really like to pass it indirectly // because it allows us to elide copies. Unfortunately, MSVC makes that // impossible for small types, which it will pass in a single register or // stack slot. Most objects with dtors are large-ish, so handle that early. // We can't call out all large objects as being indirect because there are // multiple x64 calling conventions and the C++ ABI code shouldn't dictate // how we pass large POD types. + // + // Note: This permits small classes with nontrivial destructors to be + // passed in registers, which is non-conforming. if (RD->hasNonTrivialDestructor() && getContext().getTypeSize(RD->getTypeForDecl()) > 64) return RAA_Indirect; - // If this is true, the implicit copy constructor that Sema would have - // created would not be deleted. FIXME: We should provide a more direct way - // for CodeGen to ask whether the constructor was deleted. - if (!RD->hasUserDeclaredCopyConstructor() && - !RD->hasUserDeclaredMoveConstructor() && - !RD->needsOverloadResolutionForMoveConstructor() && - !RD->hasUserDeclaredMoveAssignment() && - !RD->needsOverloadResolutionForMoveAssignment()) - return RAA_Default; - - // Otherwise, Sema should have created an implicit copy constructor if - // needed. - assert(!RD->needsImplicitCopyConstructor()); - - // We have to make sure the trivial copy constructor isn't deleted. - for (const CXXConstructorDecl *CD : RD->ctors()) { - if (CD->isCopyConstructor()) { - assert(CD->isTrivial()); - // We had at least one undeleted trivial copy ctor. Return directly. - if (!CD->isDeleted()) - return RAA_Default; + // If a class has at least one non-deleted, trivial copy constructor, it + // is passed according to the C ABI. Otherwise, it is passed indirectly. + // + // Note: This permits classes with non-trivial copy or move ctors to be + // passed in registers, so long as they *also* have a trivial copy ctor, + // which is non-conforming. + if (RD->needsImplicitCopyConstructor()) { + // If the copy ctor has not yet been declared, we can read its triviality + // off the AST. + if (!RD->defaultedCopyConstructorIsDeleted() && + RD->hasTrivialCopyConstructor()) + return RAA_Default; + } else { + // Otherwise, we need to find the copy constructor(s) and ask. + for (const CXXConstructorDecl *CD : RD->ctors()) { + if (CD->isCopyConstructor()) { + // We had at least one nondeleted trivial copy ctor. Return directly. + if (!CD->isDeleted() && CD->isTrivial()) + return RAA_Default; + } } } - // The trivial copy constructor was deleted. Return indirectly. + // We have no trivial, non-deleted copy constructor. return RAA_Indirect; } Modified: vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp Thu Aug 24 16:35:14 2017 (r322839) @@ -1837,7 +1837,12 @@ Darwin::TranslateArgs(const DerivedArgList &Args, Stri } bool MachO::IsUnwindTablesDefault(const ArgList &Args) const { - return !UseSjLjExceptions(Args); + // Unwind tables are not emitted if -fno-exceptions is supplied (except when + // targeting x86_64). + return getArch() == llvm::Triple::x86_64 || + (!UseSjLjExceptions(Args) && + Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions, + true)); } bool MachO::UseDwarfDebugFlags() const { Modified: vendor/clang/dist/lib/Driver/ToolChains/MSVC.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/MSVC.cpp Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/lib/Driver/ToolChains/MSVC.cpp Thu Aug 24 16:35:14 2017 (r322839) @@ -76,7 +76,7 @@ static bool getSystemRegistryString(const char *keyPat // Check various environment variables to try and find a toolchain. static bool findVCToolChainViaEnvironment(std::string &Path, - bool &IsVS2017OrNewer) { + MSVCToolChain::ToolsetLayout &VSLayout) { // These variables are typically set by vcvarsall.bat // when launching a developer command prompt. if (llvm::Optional VCToolsInstallDir = @@ -84,7 +84,7 @@ static bool findVCToolChainViaEnvironment(std::string // This is only set by newer Visual Studios, and it leads straight to // the toolchain directory. Path = std::move(*VCToolsInstallDir); - IsVS2017OrNewer = true; + VSLayout = MSVCToolChain::ToolsetLayout::VS2017OrNewer; return true; } if (llvm::Optional VCInstallDir = @@ -94,7 +94,7 @@ static bool findVCToolChainViaEnvironment(std::string // so this check has to appear second. // In older Visual Studios, the VC directory is the toolchain. Path = std::move(*VCInstallDir); - IsVS2017OrNewer = false; + VSLayout = MSVCToolChain::ToolsetLayout::OlderVS; return true; } @@ -134,11 +134,18 @@ static bool findVCToolChainViaEnvironment(std::string } if (IsBin) { llvm::StringRef ParentPath = llvm::sys::path::parent_path(TestPath); - if (llvm::sys::path::filename(ParentPath) == "VC") { + llvm::StringRef ParentFilename = llvm::sys::path::filename(ParentPath); + if (ParentFilename == "VC") { Path = ParentPath; - IsVS2017OrNewer = false; + VSLayout = MSVCToolChain::ToolsetLayout::OlderVS; return true; } + if (ParentFilename == "x86ret" || ParentFilename == "x86chk" + || ParentFilename == "amd64ret" || ParentFilename == "amd64chk") { + Path = ParentPath; + VSLayout = MSVCToolChain::ToolsetLayout::DevDivInternal; + return true; + } } else { // This could be a new (>=VS2017) toolchain. If it is, we should find @@ -165,7 +172,7 @@ static bool findVCToolChainViaEnvironment(std::string ToolChainPath = llvm::sys::path::parent_path(ToolChainPath); Path = ToolChainPath; - IsVS2017OrNewer = true; + VSLayout = MSVCToolChain::ToolsetLayout::VS2017OrNewer; return true; } @@ -181,7 +188,7 @@ static bool findVCToolChainViaEnvironment(std::string // This is the preferred way to discover new Visual Studios, as they're no // longer listed in the registry. static bool findVCToolChainViaSetupConfig(std::string &Path, - bool &IsVS2017OrNewer) { + MSVCToolChain::ToolsetLayout &VSLayout) { #if !defined(USE_MSVC_SETUP_API) return false; #else @@ -263,7 +270,7 @@ static bool findVCToolChainViaSetupConfig(std::string return false; Path = ToolchainPath.str(); - IsVS2017OrNewer = true; + VSLayout = MSVCToolChain::ToolsetLayout::VS2017OrNewer; return true; #endif } @@ -272,7 +279,7 @@ static bool findVCToolChainViaSetupConfig(std::string // a toolchain path. VS2017 and newer don't get added to the registry. // So if we find something here, we know that it's an older version. static bool findVCToolChainViaRegistry(std::string &Path, - bool &IsVS2017OrNewer) { + MSVCToolChain::ToolsetLayout &VSLayout) { std::string VSInstallPath; if (getSystemRegistryString(R"(SOFTWARE\Microsoft\VisualStudio\$VERSION)", "InstallDir", VSInstallPath, nullptr) || @@ -284,7 +291,7 @@ static bool findVCToolChainViaRegistry(std::string &Pa llvm::sys::path::append(VCPath, "VC"); Path = VCPath.str(); - IsVS2017OrNewer = false; + VSLayout = MSVCToolChain::ToolsetLayout::OlderVS; return true; } } @@ -475,6 +482,7 @@ void visualstudio::Linker::ConstructJob(Compilation &C // native target bin directory. // e.g. when compiling for x86 on an x64 host, PATH should start with: // /bin/HostX64/x86;/bin/HostX64/x64 + // This doesn't attempt to handle ToolsetLayout::DevDivInternal. if (TC.getIsVS2017OrNewer() && llvm::Triple(llvm::sys::getProcessTriple()).getArch() != TC.getArch()) { auto HostArch = llvm::Triple(llvm::sys::getProcessTriple()).getArch(); @@ -677,9 +685,9 @@ MSVCToolChain::MSVCToolChain(const Driver &D, const ll // what they want to use. // Failing that, just try to find the newest Visual Studio version we can // and use its default VC toolchain. - findVCToolChainViaEnvironment(VCToolChainPath, IsVS2017OrNewer) || - findVCToolChainViaSetupConfig(VCToolChainPath, IsVS2017OrNewer) || - findVCToolChainViaRegistry(VCToolChainPath, IsVS2017OrNewer); + findVCToolChainViaEnvironment(VCToolChainPath, VSLayout) || + findVCToolChainViaSetupConfig(VCToolChainPath, VSLayout) || + findVCToolChainViaRegistry(VCToolChainPath, VSLayout); } Tool *MSVCToolChain::buildLinker() const { @@ -766,6 +774,21 @@ static const char *llvmArchToLegacyVCArch(llvm::Triple } } +// Similar to the above function, but for DevDiv internal builds. +static const char *llvmArchToDevDivInternalArch(llvm::Triple::ArchType Arch) { + using ArchType = llvm::Triple::ArchType; + switch (Arch) { + case ArchType::x86: + return "i386"; + case ArchType::x86_64: + return "amd64"; + case ArchType::arm: + return "arm"; + default: + return ""; + } +} + // Get the path to a specific subdirectory in the current toolchain for // a given target architecture. // VS2017 changed the VC toolchain layout, so this should be used instead @@ -773,26 +796,40 @@ static const char *llvmArchToLegacyVCArch(llvm::Triple std::string MSVCToolChain::getSubDirectoryPath(SubDirectoryType Type, llvm::Triple::ArchType TargetArch) const { + const char *SubdirName; + const char *IncludeName; + switch (VSLayout) { + case ToolsetLayout::OlderVS: + SubdirName = llvmArchToLegacyVCArch(TargetArch); + IncludeName = "include"; + break; + case ToolsetLayout::VS2017OrNewer: + SubdirName = llvmArchToWindowsSDKArch(TargetArch); + IncludeName = "include"; + break; + case ToolsetLayout::DevDivInternal: + SubdirName = llvmArchToDevDivInternalArch(TargetArch); + IncludeName = "inc"; + break; + } + llvm::SmallString<256> Path(VCToolChainPath); switch (Type) { case SubDirectoryType::Bin: - if (IsVS2017OrNewer) { - bool HostIsX64 = + if (VSLayout == ToolsetLayout::VS2017OrNewer) { + const bool HostIsX64 = llvm::Triple(llvm::sys::getProcessTriple()).isArch64Bit(); - llvm::sys::path::append(Path, "bin", (HostIsX64 ? "HostX64" : "HostX86"), - llvmArchToWindowsSDKArch(TargetArch)); - - } else { - llvm::sys::path::append(Path, "bin", llvmArchToLegacyVCArch(TargetArch)); + const char *const HostName = HostIsX64 ? "HostX64" : "HostX86"; + llvm::sys::path::append(Path, "bin", HostName, SubdirName); + } else { // OlderVS or DevDivInternal + llvm::sys::path::append(Path, "bin", SubdirName); } break; case SubDirectoryType::Include: - llvm::sys::path::append(Path, "include"); + llvm::sys::path::append(Path, IncludeName); break; case SubDirectoryType::Lib: - llvm::sys::path::append( - Path, "lib", IsVS2017OrNewer ? llvmArchToWindowsSDKArch(TargetArch) - : llvmArchToLegacyVCArch(TargetArch)); + llvm::sys::path::append(Path, "lib", SubdirName); break; } return Path.str(); Modified: vendor/clang/dist/lib/Driver/ToolChains/MSVC.h ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains/MSVC.h Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/lib/Driver/ToolChains/MSVC.h Thu Aug 24 16:35:14 2017 (r322839) @@ -92,7 +92,12 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public T return getSubDirectoryPath(Type, getArch()); } - bool getIsVS2017OrNewer() const { return IsVS2017OrNewer; } + enum class ToolsetLayout { + OlderVS, + VS2017OrNewer, + DevDivInternal, + }; + bool getIsVS2017OrNewer() const { return VSLayout == ToolsetLayout::VS2017OrNewer; } void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, @@ -130,7 +135,7 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public T Tool *buildAssembler() const override; private: std::string VCToolChainPath; - bool IsVS2017OrNewer = false; + ToolsetLayout VSLayout = ToolsetLayout::OlderVS; CudaInstallationDetector CudaInstallation; }; Modified: vendor/clang/dist/lib/Format/WhitespaceManager.cpp ============================================================================== --- vendor/clang/dist/lib/Format/WhitespaceManager.cpp Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/lib/Format/WhitespaceManager.cpp Thu Aug 24 16:35:14 2017 (r322839) @@ -472,9 +472,14 @@ void WhitespaceManager::alignTrailingComments() { continue; unsigned ChangeMinColumn = Changes[i].StartOfTokenColumn; - unsigned ChangeMaxColumn = Style.ColumnLimit >= Changes[i].TokenLength - ? Style.ColumnLimit - Changes[i].TokenLength - : ChangeMinColumn; + unsigned ChangeMaxColumn; + + if (Style.ColumnLimit == 0) + ChangeMaxColumn = UINT_MAX; + else if (Style.ColumnLimit >= Changes[i].TokenLength) + ChangeMaxColumn = Style.ColumnLimit - Changes[i].TokenLength; + else + ChangeMaxColumn = ChangeMinColumn; // If we don't create a replacement for this change, we have to consider // it to be immovable. Modified: vendor/clang/dist/lib/Headers/unwind.h ============================================================================== --- vendor/clang/dist/lib/Headers/unwind.h Thu Aug 24 16:35:09 2017 (r322838) +++ vendor/clang/dist/lib/Headers/unwind.h Thu Aug 24 16:35:14 2017 (r322839) @@ -76,13 +76,7 @@ typedef intptr_t _sleb128_t; typedef uintptr_t _uleb128_t; struct _Unwind_Context; -#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH___)) -struct _Unwind_Control_Block; -typedef struct _Unwind_Control_Block _Unwind_Exception; /* Alias */ -#else struct _Unwind_Exception; -typedef struct _Unwind_Exception _Unwind_Exception; -#endif typedef enum { _URC_NO_REASON = 0, #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ @@ -115,42 +109,8 @@ typedef enum { } _Unwind_Action; typedef void (*_Unwind_Exception_Cleanup_Fn)(_Unwind_Reason_Code, - _Unwind_Exception *); + struct _Unwind_Exception *); -#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH___)) -typedef struct _Unwind_Control_Block _Unwind_Control_Block; -typedef uint32_t _Unwind_EHT_Header; - -struct _Unwind_Control_Block { - uint64_t exception_class; - void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *); - /* unwinder cache (private fields for the unwinder's use) */ - struct { - uint32_t reserved1; /* forced unwind stop function, 0 if not forced */ - uint32_t reserved2; /* personality routine */ - uint32_t reserved3; /* callsite */ - uint32_t reserved4; /* forced unwind stop argument */ - uint32_t reserved5; - } unwinder_cache; - /* propagation barrier cache (valid after phase 1) */ - struct { - uint32_t sp; - uint32_t bitpattern[5]; - } barrier_cache; - /* cleanup cache (preserved over cleanup) */ - struct { - uint32_t bitpattern[4]; - } cleanup_cache; - /* personality cache (for personality's benefit) */ - struct { - uint32_t fnstart; /* function start address */ - _Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */ - uint32_t additional; /* additional data */ - uint32_t reserved1; - } pr_cache; - long long int : 0; /* force alignment of next item to 8-byte boundary */ -}; -#else struct _Unwind_Exception { _Unwind_Exception_Class exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; @@ -160,24 +120,23 @@ struct _Unwind_Exception { * aligned". GCC has interpreted this to mean "use the maximum useful * alignment for the target"; so do we. */ } __attribute__((__aligned__)); -#endif typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(int, _Unwind_Action, _Unwind_Exception_Class, - _Unwind_Exception *, + struct _Unwind_Exception *, struct _Unwind_Context *, void *); -typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(int, _Unwind_Action, - _Unwind_Exception_Class, - _Unwind_Exception *, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Aug 24 16:35:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E24D0DE38F3; Thu, 24 Aug 2017 16:35:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 909EE831C6; Thu, 24 Aug 2017 16:35:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OGZRFs074122; Thu, 24 Aug 2017 16:35:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OGZRlq074121; Thu, 24 Aug 2017 16:35:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708241635.v7OGZRlq074121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 24 Aug 2017 16:35:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322842 - vendor/compiler-rt/compiler-rt-release_50-r311606 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-release_50-r311606 X-SVN-Commit-Revision: 322842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 16:35:29 -0000 Author: dim Date: Thu Aug 24 16:35:27 2017 New Revision: 322842 URL: https://svnweb.freebsd.org/changeset/base/322842 Log: Tag compiler-rt release_50 branch r311606. Added: vendor/compiler-rt/compiler-rt-release_50-r311606/ - copied from r322841, vendor/compiler-rt/dist/ From owner-svn-src-all@freebsd.org Thu Aug 24 16:35:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A654BDE38AF; Thu, 24 Aug 2017 16:35:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D6E483154; Thu, 24 Aug 2017 16:35:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OGZNJZ074074; Thu, 24 Aug 2017 16:35:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OGZNP5074070; Thu, 24 Aug 2017 16:35:23 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708241635.v7OGZNP5074070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 24 Aug 2017 16:35:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322841 - in vendor/compiler-rt/dist/lib: builtins/arm esan profile X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/compiler-rt/dist/lib: builtins/arm esan profile X-SVN-Commit-Revision: 322841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 16:35:24 -0000 Author: dim Date: Thu Aug 24 16:35:23 2017 New Revision: 322841 URL: https://svnweb.freebsd.org/changeset/base/322841 Log: Vendor import of compiler-rt release_50 branch r311606: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_50@311606 Modified: vendor/compiler-rt/dist/lib/builtins/arm/aeabi_dcmp.S vendor/compiler-rt/dist/lib/builtins/arm/aeabi_fcmp.S vendor/compiler-rt/dist/lib/esan/esan_sideline_linux.cpp vendor/compiler-rt/dist/lib/profile/InstrProfilingNameVar.c Modified: vendor/compiler-rt/dist/lib/builtins/arm/aeabi_dcmp.S ============================================================================== --- vendor/compiler-rt/dist/lib/builtins/arm/aeabi_dcmp.S Thu Aug 24 16:35:20 2017 (r322840) +++ vendor/compiler-rt/dist/lib/builtins/arm/aeabi_dcmp.S Thu Aug 24 16:35:23 2017 (r322841) @@ -18,11 +18,20 @@ // } // } +#if defined(COMPILER_RT_ARMHF_TARGET) +# define CONVERT_DCMP_ARGS_TO_DF2_ARGS \ + vmov d0, r0, r1 SEPARATOR \ + vmov d1, r2, r3 +#else +# define CONVERT_DCMP_ARGS_TO_DF2_ARGS +#endif + #define DEFINE_AEABI_DCMP(cond) \ .syntax unified SEPARATOR \ .p2align 2 SEPARATOR \ DEFINE_COMPILERRT_FUNCTION(__aeabi_dcmp ## cond) \ push { r4, lr } SEPARATOR \ + CONVERT_DCMP_ARGS_TO_DF2_ARGS SEPARATOR \ bl SYMBOL_NAME(__ ## cond ## df2) SEPARATOR \ cmp r0, #0 SEPARATOR \ b ## cond 1f SEPARATOR \ Modified: vendor/compiler-rt/dist/lib/builtins/arm/aeabi_fcmp.S ============================================================================== --- vendor/compiler-rt/dist/lib/builtins/arm/aeabi_fcmp.S Thu Aug 24 16:35:20 2017 (r322840) +++ vendor/compiler-rt/dist/lib/builtins/arm/aeabi_fcmp.S Thu Aug 24 16:35:23 2017 (r322841) @@ -18,11 +18,20 @@ // } // } +#if defined(COMPILER_RT_ARMHF_TARGET) +# define CONVERT_FCMP_ARGS_TO_SF2_ARGS \ + vmov s0, r0 SEPARATOR \ + vmov s1, r1 +#else +# define CONVERT_FCMP_ARGS_TO_SF2_ARGS +#endif + #define DEFINE_AEABI_FCMP(cond) \ .syntax unified SEPARATOR \ .p2align 2 SEPARATOR \ DEFINE_COMPILERRT_FUNCTION(__aeabi_fcmp ## cond) \ push { r4, lr } SEPARATOR \ + CONVERT_FCMP_ARGS_TO_SF2_ARGS SEPARATOR \ bl SYMBOL_NAME(__ ## cond ## sf2) SEPARATOR \ cmp r0, #0 SEPARATOR \ b ## cond 1f SEPARATOR \ Modified: vendor/compiler-rt/dist/lib/esan/esan_sideline_linux.cpp ============================================================================== --- vendor/compiler-rt/dist/lib/esan/esan_sideline_linux.cpp Thu Aug 24 16:35:20 2017 (r322840) +++ vendor/compiler-rt/dist/lib/esan/esan_sideline_linux.cpp Thu Aug 24 16:35:23 2017 (r322841) @@ -70,7 +70,7 @@ int SidelineThread::runSideline(void *Arg) { // Set up a signal handler on an alternate stack for safety. InternalScopedBuffer StackMap(SigAltStackSize); - struct sigaltstack SigAltStack; + stack_t SigAltStack; SigAltStack.ss_sp = StackMap.data(); SigAltStack.ss_size = SigAltStackSize; SigAltStack.ss_flags = 0; Modified: vendor/compiler-rt/dist/lib/profile/InstrProfilingNameVar.c ============================================================================== --- vendor/compiler-rt/dist/lib/profile/InstrProfilingNameVar.c Thu Aug 24 16:35:20 2017 (r322840) +++ vendor/compiler-rt/dist/lib/profile/InstrProfilingNameVar.c Thu Aug 24 16:35:23 2017 (r322841) @@ -1,11 +1,11 @@ -//===- InstrProfilingNameVar.c - profile name variable setup --------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// +/*===- InstrProfilingNameVar.c - profile name variable setup -------------===*\ +|* +|* The LLVM Compiler Infrastructure +|* +|* This file is distributed under the University of Illinois Open Source +|* License. See LICENSE.TXT for details. +|* +\*===----------------------------------------------------------------------===*/ #include "InstrProfiling.h" From owner-svn-src-all@freebsd.org Thu Aug 24 16:35:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C12C1DE3987; Thu, 24 Aug 2017 16:35:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73759832AF; Thu, 24 Aug 2017 16:35:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OGZZtG074217; Thu, 24 Aug 2017 16:35:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OGZZGo074216; Thu, 24 Aug 2017 16:35:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708241635.v7OGZZGo074216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 24 Aug 2017 16:35:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322844 - vendor/lld/lld-release_50-r311606 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-release_50-r311606 X-SVN-Commit-Revision: 322844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 16:35:37 -0000 Author: dim Date: Thu Aug 24 16:35:35 2017 New Revision: 322844 URL: https://svnweb.freebsd.org/changeset/base/322844 Log: Tag lld release_50 branch r311606. Added: vendor/lld/lld-release_50-r311606/ - copied from r322843, vendor/lld/dist/ From owner-svn-src-all@freebsd.org Thu Aug 24 16:35:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12981DE39AD; Thu, 24 Aug 2017 16:35:40 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCF6483311; Thu, 24 Aug 2017 16:35:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OGZd4Q074270; Thu, 24 Aug 2017 16:35:39 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OGZc6d074263; Thu, 24 Aug 2017 16:35:38 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708241635.v7OGZc6d074263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 24 Aug 2017 16:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322845 - in vendor/lldb/dist: packages/Python/lldbsuite/test/functionalities/register/register_command source/Core source/Host source/Plugins/Process/Utility unittests X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lldb/dist: packages/Python/lldbsuite/test/functionalities/register/register_command source/Core source/Host source/Plugins/Process/Utility unittests X-SVN-Commit-Revision: 322845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 16:35:40 -0000 Author: dim Date: Thu Aug 24 16:35:38 2017 New Revision: 322845 URL: https://svnweb.freebsd.org/changeset/base/322845 Log: Vendor import of lldb release_50 branch r311606: https://llvm.org/svn/llvm-project/lldb/branches/release_50@311606 Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py vendor/lldb/dist/source/Core/CMakeLists.txt vendor/lldb/dist/source/Host/CMakeLists.txt vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContext_x86.h vendor/lldb/dist/unittests/CMakeLists.txt Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py Thu Aug 24 16:35:35 2017 (r322844) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py Thu Aug 24 16:35:38 2017 (r322845) @@ -256,7 +256,7 @@ class RegisterCommandsTestCase(TestBase): self.expect( "register read ftag", substrs=[ 'ftag' + ' = ', str( - "0x%0.2x" % + "0x%0.4x" % (reg_value_ftag_initial | ( 1 << fstat_top_pointer_initial)))]) reg_value_ftag_initial = reg_value_ftag_initial | ( Modified: vendor/lldb/dist/source/Core/CMakeLists.txt ============================================================================== --- vendor/lldb/dist/source/Core/CMakeLists.txt Thu Aug 24 16:35:35 2017 (r322844) +++ vendor/lldb/dist/source/Core/CMakeLists.txt Thu Aug 24 16:35:38 2017 (r322845) @@ -1,3 +1,12 @@ +set(LLDB_CURSES_LIBS) + +if (NOT LLDB_DISABLE_CURSES) + list(APPEND LLDB_CURSES_LIBS ${CURSES_LIBRARIES}) + if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO) + list(APPEND LLDB_CURSES_LIBS ${TERMINFO_LIBS}) + endif() +endif() + add_lldb_library(lldbCore Address.cpp AddressRange.cpp @@ -62,6 +71,7 @@ add_lldb_library(lldbCore lldbPluginCPlusPlusLanguage lldbPluginObjCLanguage lldbPluginObjectFileJIT + ${LLDB_CURSES_LIBS} LINK_COMPONENTS BinaryFormat Modified: vendor/lldb/dist/source/Host/CMakeLists.txt ============================================================================== --- vendor/lldb/dist/source/Host/CMakeLists.txt Thu Aug 24 16:35:35 2017 (r322844) +++ vendor/lldb/dist/source/Host/CMakeLists.txt Thu Aug 24 16:35:38 2017 (r322845) @@ -156,9 +156,23 @@ if (${get_python_libdir}) endif() endif() +set(EXTRA_LIBS) if (CMAKE_SYSTEM_NAME MATCHES "NetBSD") - set(EXTRA_LIBS kvm) + list(APPEND EXTRA_LIBS kvm) endif () +if (APPLE) + list(APPEND EXTRA_LIBS xml2) +else () + if (LIBXML2_FOUND) + list(APPEND EXTRA_LIBS ${LIBXML2_LIBRARIES}) + endif() +endif () +if (HAVE_LIBDL) + list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS}) +endif() +if (NOT LLDB_DISABLE_LIBEDIT) + list(APPEND EXTRA_LIBS edit) +endif() add_lldb_library(lldbHost ${HOST_SOURCES} Modified: vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp Thu Aug 24 16:35:35 2017 (r322844) +++ vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp Thu Aug 24 16:35:38 2017 (r322845) @@ -36,8 +36,7 @@ struct GPR { struct FPR_i386 { uint16_t fctrl; // FPU Control Word (fcw) uint16_t fstat; // FPU Status Word (fsw) - uint8_t ftag; // FPU Tag Word (ftw) - uint8_t reserved_1; // Reserved + uint16_t ftag; // FPU Tag Word (ftw) uint16_t fop; // Last Instruction Opcode (fop) union { struct { Modified: vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContext_x86.h ============================================================================== --- vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContext_x86.h Thu Aug 24 16:35:35 2017 (r322844) +++ vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContext_x86.h Thu Aug 24 16:35:38 2017 (r322845) @@ -257,8 +257,7 @@ struct XMMReg { struct FXSAVE { uint16_t fctrl; // FPU Control Word (fcw) uint16_t fstat; // FPU Status Word (fsw) - uint8_t ftag; // FPU Tag Word (ftw) - uint8_t reserved_1; // Reserved + uint16_t ftag; // FPU Tag Word (ftw) uint16_t fop; // Last Instruction Opcode (fop) union { struct { Modified: vendor/lldb/dist/unittests/CMakeLists.txt ============================================================================== --- vendor/lldb/dist/unittests/CMakeLists.txt Thu Aug 24 16:35:35 2017 (r322844) +++ vendor/lldb/dist/unittests/CMakeLists.txt Thu Aug 24 16:35:38 2017 (r322845) @@ -19,6 +19,12 @@ if (LLDB_BUILT_STANDALONE) if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET gtest) add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest) endif() + # LLVMTestingSupport library is needed for Process/gdb-remote. + if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support + AND NOT TARGET LLVMTestingSupport) + add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support + lib/Testing/Support) + endif() endif() function(add_lldb_unittest test_name) From owner-svn-src-all@freebsd.org Thu Aug 24 16:35:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56214DE3935; Thu, 24 Aug 2017 16:35:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0904283231; Thu, 24 Aug 2017 16:35:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OGZVSV074169; Thu, 24 Aug 2017 16:35:31 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OGZVEb074168; Thu, 24 Aug 2017 16:35:31 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708241635.v7OGZVEb074168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 24 Aug 2017 16:35:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322843 - vendor/libc++/libc++-release_50-r311606 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-release_50-r311606 X-SVN-Commit-Revision: 322843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 16:35:32 -0000 Author: dim Date: Thu Aug 24 16:35:30 2017 New Revision: 322843 URL: https://svnweb.freebsd.org/changeset/base/322843 Log: Tag libc++ release_50 branch r311606. Added: vendor/libc++/libc++-release_50-r311606/ - copied from r322842, vendor/libc++/dist/ From owner-svn-src-all@freebsd.org Thu Aug 24 16:35:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65005DE3A05; Thu, 24 Aug 2017 16:35:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 192E983398; Thu, 24 Aug 2017 16:35:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OGZhvh074318; Thu, 24 Aug 2017 16:35:43 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OGZht1074317; Thu, 24 Aug 2017 16:35:43 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708241635.v7OGZht1074317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 24 Aug 2017 16:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322846 - vendor/lldb/lldb-release_50-r311606 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-release_50-r311606 X-SVN-Commit-Revision: 322846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 16:35:44 -0000 Author: dim Date: Thu Aug 24 16:35:42 2017 New Revision: 322846 URL: https://svnweb.freebsd.org/changeset/base/322846 Log: Tag lldb release_50 branch r311606. Added: vendor/lldb/lldb-release_50-r311606/ - copied from r322845, vendor/lldb/dist/ From owner-svn-src-all@freebsd.org Thu Aug 24 16:49:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65B9CDE3E0C; Thu, 24 Aug 2017 16:49:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C5D8840E5; Thu, 24 Aug 2017 16:49:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OGnYd5078719; Thu, 24 Aug 2017 16:49:34 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OGnYBD078718; Thu, 24 Aug 2017 16:49:34 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708241649.v7OGnYBD078718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 24 Aug 2017 16:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322847 - stable/11/share/man/man7 X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/share/man/man7 X-SVN-Commit-Revision: 322847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 16:49:35 -0000 Author: gjb Date: Thu Aug 24 16:49:34 2017 New Revision: 322847 URL: https://svnweb.freebsd.org/changeset/base/322847 Log: MFC r322752: Update the tests(7) manual page to note the test suite is installed by default as of 11.0-RELEASE. Sponsored by: The FreeBSD Foundation Modified: stable/11/share/man/man7/tests.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/tests.7 ============================================================================== --- stable/11/share/man/man7/tests.7 Thu Aug 24 16:35:42 2017 (r322846) +++ stable/11/share/man/man7/tests.7 Thu Aug 24 16:49:34 2017 (r322847) @@ -26,7 +26,7 @@ .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 22, 2017 +.Dd August 21, 2017 .Dt TESTS 7 .Os .Sh NAME @@ -59,10 +59,9 @@ hierarchy. This manual page describes how to run the test suite and how to configure some of its optional features. .Ss Installing the test suite -The test suite is not yet installed by default as part of -.Fx , -but this is bound to change during the development of -.Fx 11.0 . +The test suite is installed by default as of +.Fx +11.0-RELEASE. .Pp If the .Pa /usr/tests From owner-svn-src-all@freebsd.org Thu Aug 24 17:25:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5742FDE4664; Thu, 24 Aug 2017 17:25:18 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 287CC84F85; Thu, 24 Aug 2017 17:25:18 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OHPHbx094944; Thu, 24 Aug 2017 17:25:17 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OHPHf1094942; Thu, 24 Aug 2017 17:25:17 GMT (envelope-from will@FreeBSD.org) Message-Id: <201708241725.v7OHPHf1094942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Thu, 24 Aug 2017 17:25:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322848 - in stable/10: etc sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: will X-SVN-Commit-Paths: in stable/10: etc sys/kern X-SVN-Commit-Revision: 322848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 17:25:18 -0000 Author: will Date: Thu Aug 24 17:25:16 2017 New Revision: 322848 URL: https://svnweb.freebsd.org/changeset/base/322848 Log: MFC r278479,278494,278525,278545,278592,279237,280410: This change merges devctl notification for userland coredumps. r278479 (rpaulo): Notify devd(8) when a process crashed. This change implements a notification (via devctl) to userland when the kernel produces coredumps after a process has crashed. devd can then run a specific command to produce a human readable crash report. The command is most usually a helper that runs gdb/lldb commands on the file/coredump pair. It's possible to use this functionality for implementing automatic generation of crash reports. devd(8) will be notified of the full path of the binary that crashed and the full path of the coredump file. r278494 (rpaulo): Sanitise the coredump file names sent to devd. While there, add a sysctl to turn this feature off as requested by kib@. r278525 (rpaulo): Remove a printf and an strlen() from the coredump code. r278545 (rpaulo): Restore the data array in coredump(), but use a different style to calculate the length. r278592 (rpaulo): Remove check against NULL after M_WAITOK. r279237 (kib): Keep a reference on the coredump vnode for vn_fullpath() call. Do it by moving vn_close() after the point where notification is sent. r280410 (rpaulo): Disable coredump_devctl because it could lead to leaking paths to jails. Approved by: re Modified: stable/10/etc/devd.conf stable/10/sys/kern/kern_sig.c Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/devd.conf ============================================================================== --- stable/10/etc/devd.conf Thu Aug 24 16:49:34 2017 (r322847) +++ stable/10/etc/devd.conf Thu Aug 24 17:25:16 2017 (r322848) @@ -324,4 +324,16 @@ notify 100 { action "/usr/sbin/automount -c"; }; +# Handle userland coredumps. +# This commented out handler makes it possible to run an +# automated debugging session after the core dump is generated. +# Replace action with a proper coredump handler, but be aware that +# it will run with elevated privileges. +notify 10 { + match "system" "kernel"; + match "subsystem" "signal"; + match "type" "coredump"; + action "logger $comm $core"; +}; + */ Modified: stable/10/sys/kern/kern_sig.c ============================================================================== --- stable/10/sys/kern/kern_sig.c Thu Aug 24 16:49:34 2017 (r322847) +++ stable/10/sys/kern/kern_sig.c Thu Aug 24 17:25:16 2017 (r322848) @@ -44,10 +44,12 @@ __FBSDID("$FreeBSD$"); #include "opt_procdesc.h" #include +#include #include #include #include #include +#include #include #include #include @@ -183,6 +185,10 @@ static int set_core_nodump_flag = 0; SYSCTL_INT(_kern, OID_AUTO, nodump_coredump, CTLFLAG_RW, &set_core_nodump_flag, 0, "Enable setting the NODUMP flag on coredump files"); +static int coredump_devctl = 0; +SYSCTL_INT(_kern, OID_AUTO, coredump_devctl, CTLFLAG_RW, &coredump_devctl, + 0, "Generate a devctl notification when processes coredump"); + /* * Signal properties and actions. * The array below categorizes the signals and their default actions @@ -3317,6 +3323,24 @@ out: return (0); } +static int +coredump_sanitise_path(const char *path) +{ + size_t i; + + /* + * Only send a subset of ASCII to devd(8) because it + * might pass these strings to sh -c. + */ + for (i = 0; path[i]; i++) + if (!(isalpha(path[i]) || isdigit(path[i])) && + path[i] != '/' && path[i] != '.' && + path[i] != '-') + return (0); + + return (1); +} + /* * Dump a process' core. The main routine does some * policy checking, and creates the name of the coredump; @@ -3338,6 +3362,11 @@ coredump(struct thread *td) char *name; /* name of corefile */ off_t limit; int compress; + char *data = NULL; + char *fullpath, *freepath = NULL; + size_t len; + static const char comm_name[] = "comm="; + static const char core_name[] = "core="; #ifdef COMPRESS_USER_CORES compress = compress_user_cores; @@ -3380,7 +3409,7 @@ restart: vattr.va_nlink != 1) { VOP_UNLOCK(vp, 0); error = EFAULT; - goto close; + goto out; } VOP_UNLOCK(vp, 0); @@ -3425,14 +3454,39 @@ restart: lf.l_type = F_UNLCK; VOP_ADVLOCK(vp, (caddr_t)p, F_UNLCK, &lf, F_FLOCK); } -close: + + /* + * Notify the userland helper that a process triggered a core dump. + * This allows the helper to run an automated debugging session. + */ + if (error != 0 || coredump_devctl == 0) + goto out; + len = MAXPATHLEN * 2 + sizeof(comm_name) - 1 + + sizeof(' ') + sizeof(core_name) - 1; + data = malloc(len, M_TEMP, M_WAITOK); + if (vn_fullpath_global(td, p->p_textvp, &fullpath, &freepath) != 0) + goto out; + if (!coredump_sanitise_path(fullpath)) + goto out; + snprintf(data, len, "%s%s ", comm_name, fullpath); + free(freepath, M_TEMP); + freepath = NULL; + if (vn_fullpath_global(td, vp, &fullpath, &freepath) != 0) + goto out; + if (!coredump_sanitise_path(fullpath)) + goto out; + strlcat(data, core_name, len); + strlcat(data, fullpath, len); + devctl_notify("kernel", "signal", "coredump", data); +out: error1 = vn_close(vp, FWRITE, cred, td); if (error == 0) error = error1; -out: #ifdef AUDIT audit_proc_coredump(td, name, error); #endif + free(freepath, M_TEMP); + free(data, M_TEMP); free(name, M_TEMP); return (error); } From owner-svn-src-all@freebsd.org Thu Aug 24 17:36:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6555DE4903; Thu, 24 Aug 2017 17:36:11 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85F6B66D; Thu, 24 Aug 2017 17:36:11 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OHaAjZ099036; Thu, 24 Aug 2017 17:36:10 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OHaATM099032; Thu, 24 Aug 2017 17:36:10 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201708241736.v7OHaATM099032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Thu, 24 Aug 2017 17:36:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322849 - in stable/11/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Group: stable-11 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: in stable/11/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Commit-Revision: 322849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 17:36:12 -0000 Author: davidcs Date: Thu Aug 24 17:36:10 2017 New Revision: 322849 URL: https://svnweb.freebsd.org/changeset/base/322849 Log: MFC r322331 Provide compile option to choose receive processing in either Ithread or Taskqueue Thread. Modified: stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c stable/11/sys/dev/qlnx/qlnxe/qlnx_ver.h stable/11/sys/modules/qlnx/qlnxe/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 17:25:16 2017 (r322848) +++ stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 17:36:10 2017 (r322849) @@ -397,10 +397,14 @@ qlnx_fp_taskqueue(void *context, int pending) struct ifnet *ifp; struct mbuf *mp; int ret; + struct thread *cthread; + +#ifdef QLNX_RCV_IN_TASKQ int lro_enable; int rx_int = 0, total_rx_count = 0; - struct thread *cthread; +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ + fp = context; if (fp == NULL) @@ -419,55 +423,60 @@ qlnx_fp_taskqueue(void *context, int pending) ifp = ha->ifp; - lro_enable = ha->ifp->if_capenable & IFCAP_LRO; +#ifdef QLNX_RCV_IN_TASKQ + { + lro_enable = ifp->if_capenable & IFCAP_LRO; - rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); - if (rx_int) { - fp->rx_pkts += rx_int; - total_rx_count += rx_int; - } + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } #ifdef QLNX_SOFT_LRO - { - struct lro_ctrl *lro; + { + struct lro_ctrl *lro; + + lro = &fp->rxq->lro; - lro = &fp->rxq->lro; + if (lro_enable && total_rx_count) { - if (lro_enable && total_rx_count) { - #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) - if (ha->dbg_trace_lro_cnt) { - if (lro->lro_mbuf_count & ~1023) - fp->lro_cnt_1024++; - else if (lro->lro_mbuf_count & ~511) - fp->lro_cnt_512++; - else if (lro->lro_mbuf_count & ~255) - fp->lro_cnt_256++; - else if (lro->lro_mbuf_count & ~127) - fp->lro_cnt_128++; - else if (lro->lro_mbuf_count & ~63) - fp->lro_cnt_64++; - } - tcp_lro_flush_all(lro); + if (ha->dbg_trace_lro_cnt) { + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; + } + tcp_lro_flush_all(lro); #else - struct lro_entry *queued; + struct lro_entry *queued; - while ((!SLIST_EMPTY(&lro->lro_active))) { - queued = SLIST_FIRST(&lro->lro_active); - SLIST_REMOVE_HEAD(&lro->lro_active, next); - tcp_lro_flush(lro, queued); - } + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, next); + tcp_lro_flush(lro, queued); + } #endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + } } - } #endif /* #ifdef QLNX_SOFT_LRO */ - ecore_sb_update_sb_idx(fp->sb_info); - rmb(); + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); + } +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ + mtx_lock(&fp->tx_mtx); if (((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != @@ -477,10 +486,6 @@ qlnx_fp_taskqueue(void *context, int pending) goto qlnx_fp_taskqueue_exit; } -// for (tc = 0; tc < ha->num_tc; tc++) { -// (void)qlnx_tx_int(ha, fp, fp->txq[tc]); -// } - mp = drbr_peek(ifp, fp->tx_br); while (mp != NULL) { @@ -516,13 +521,11 @@ qlnx_fp_taskqueue(void *context, int pending) mp = drbr_peek(ifp, fp->tx_br); } -// for (tc = 0; tc < ha->num_tc; tc++) { -// (void)qlnx_tx_int(ha, fp, fp->txq[tc]); -// } - mtx_unlock(&fp->tx_mtx); qlnx_fp_taskqueue_exit: + +#ifdef QLNX_RCV_IN_TASKQ if (rx_int) { if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); @@ -532,6 +535,7 @@ qlnx_fp_taskqueue_exit: } ecore_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1); } +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ QL_DPRINT2(ha, "exit ret = %d\n", ret); return; @@ -4262,6 +4266,7 @@ next_cqe: /* don't consume bd rx buffer */ return rx_pkt; } + /* * fast path interrupt */ @@ -4292,9 +4297,82 @@ qlnx_fp_isr(void *arg) if (fp == NULL) { ha->err_fp_null++; } else { + +#ifdef QLNX_RCV_IN_TASKQ ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0); if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); +#else + int rx_int = 0, total_rx_count = 0; + int lro_enable, tc; + + lro_enable = ha->ifp->if_capenable & IFCAP_LRO; + + ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0); + + do { + for (tc = 0; tc < ha->num_tc; tc++) { + if (mtx_trylock(&fp->tx_mtx)) { + qlnx_tx_int(ha, fp, fp->txq[tc]); + mtx_unlock(&fp->tx_mtx); + } + } + + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, + lro_enable); + + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } + + } while (rx_int); + + +#ifdef QLNX_SOFT_LRO + { + struct lro_ctrl *lro; + + lro = &fp->rxq->lro; + + if (lro_enable && total_rx_count) { + +#if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) + +#ifdef QLNX_TRACE_LRO_CNT + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; +#endif /* #ifdef QLNX_TRACE_LRO_CNT */ + + tcp_lro_flush_all(lro); + +#else + struct lro_entry *queued; + + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, \ + next); + tcp_lro_flush(lro, queued); + } +#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + } + } +#endif /* #ifdef QLNX_SOFT_LRO */ + + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); + ecore_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1); + +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ } return; Modified: stable/11/sys/dev/qlnx/qlnxe/qlnx_ver.h ============================================================================== --- stable/11/sys/dev/qlnx/qlnxe/qlnx_ver.h Thu Aug 24 17:25:16 2017 (r322848) +++ stable/11/sys/dev/qlnx/qlnxe/qlnx_ver.h Thu Aug 24 17:36:10 2017 (r322849) @@ -39,5 +39,5 @@ #define QLNX_VERSION_MAJOR 1 #define QLNX_VERSION_MINOR 4 -#define QLNX_VERSION_BUILD 5 +#define QLNX_VERSION_BUILD 6 Modified: stable/11/sys/modules/qlnx/qlnxe/Makefile ============================================================================== --- stable/11/sys/modules/qlnx/qlnxe/Makefile Thu Aug 24 17:25:16 2017 (r322848) +++ stable/11/sys/modules/qlnx/qlnxe/Makefile Thu Aug 24 17:36:10 2017 (r322849) @@ -63,6 +63,7 @@ CFLAGS += -DECORE_CONFIG_DIRECT_HWFN #CFLAGS += -DQLNX_SOFT_LRO #CFLAGS += -DQLNX_QSORT_LRO #CFLAGS += -DQLNX_MAX_COALESCE +#CFLAGS += -DQLNX_RCV_IN_TASKQ .include From owner-svn-src-all@freebsd.org Thu Aug 24 18:01:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BB29DE5189; Thu, 24 Aug 2017 18:01:19 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25BB112F9; Thu, 24 Aug 2017 18:01:19 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OI1I9c007513; Thu, 24 Aug 2017 18:01:18 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OI1IRY007510; Thu, 24 Aug 2017 18:01:18 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201708241801.v7OI1IRY007510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Thu, 24 Aug 2017 18:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322850 - in stable/10/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Group: stable-10 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: in stable/10/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Commit-Revision: 322850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 18:01:19 -0000 Author: davidcs Date: Thu Aug 24 18:01:17 2017 New Revision: 322850 URL: https://svnweb.freebsd.org/changeset/base/322850 Log: MFC r322331 Provide compile option to choose receive processing in either Ithread or Taskqueue Thread. Approved by: re(marius) Modified: stable/10/sys/dev/qlnx/qlnxe/qlnx_os.c stable/10/sys/dev/qlnx/qlnxe/qlnx_ver.h stable/10/sys/modules/qlnx/qlnxe/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- stable/10/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 17:36:10 2017 (r322849) +++ stable/10/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 18:01:17 2017 (r322850) @@ -397,10 +397,14 @@ qlnx_fp_taskqueue(void *context, int pending) struct ifnet *ifp; struct mbuf *mp; int ret; + struct thread *cthread; + +#ifdef QLNX_RCV_IN_TASKQ int lro_enable; int rx_int = 0, total_rx_count = 0; - struct thread *cthread; +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ + fp = context; if (fp == NULL) @@ -419,55 +423,60 @@ qlnx_fp_taskqueue(void *context, int pending) ifp = ha->ifp; - lro_enable = ha->ifp->if_capenable & IFCAP_LRO; +#ifdef QLNX_RCV_IN_TASKQ + { + lro_enable = ifp->if_capenable & IFCAP_LRO; - rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); - if (rx_int) { - fp->rx_pkts += rx_int; - total_rx_count += rx_int; - } + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } #ifdef QLNX_SOFT_LRO - { - struct lro_ctrl *lro; + { + struct lro_ctrl *lro; + + lro = &fp->rxq->lro; - lro = &fp->rxq->lro; + if (lro_enable && total_rx_count) { - if (lro_enable && total_rx_count) { - #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) - if (ha->dbg_trace_lro_cnt) { - if (lro->lro_mbuf_count & ~1023) - fp->lro_cnt_1024++; - else if (lro->lro_mbuf_count & ~511) - fp->lro_cnt_512++; - else if (lro->lro_mbuf_count & ~255) - fp->lro_cnt_256++; - else if (lro->lro_mbuf_count & ~127) - fp->lro_cnt_128++; - else if (lro->lro_mbuf_count & ~63) - fp->lro_cnt_64++; - } - tcp_lro_flush_all(lro); + if (ha->dbg_trace_lro_cnt) { + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; + } + tcp_lro_flush_all(lro); #else - struct lro_entry *queued; + struct lro_entry *queued; - while ((!SLIST_EMPTY(&lro->lro_active))) { - queued = SLIST_FIRST(&lro->lro_active); - SLIST_REMOVE_HEAD(&lro->lro_active, next); - tcp_lro_flush(lro, queued); - } + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, next); + tcp_lro_flush(lro, queued); + } #endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + } } - } #endif /* #ifdef QLNX_SOFT_LRO */ - ecore_sb_update_sb_idx(fp->sb_info); - rmb(); + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); + } +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ + mtx_lock(&fp->tx_mtx); if (((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != @@ -477,10 +486,6 @@ qlnx_fp_taskqueue(void *context, int pending) goto qlnx_fp_taskqueue_exit; } -// for (tc = 0; tc < ha->num_tc; tc++) { -// (void)qlnx_tx_int(ha, fp, fp->txq[tc]); -// } - mp = drbr_peek(ifp, fp->tx_br); while (mp != NULL) { @@ -516,13 +521,11 @@ qlnx_fp_taskqueue(void *context, int pending) mp = drbr_peek(ifp, fp->tx_br); } -// for (tc = 0; tc < ha->num_tc; tc++) { -// (void)qlnx_tx_int(ha, fp, fp->txq[tc]); -// } - mtx_unlock(&fp->tx_mtx); qlnx_fp_taskqueue_exit: + +#ifdef QLNX_RCV_IN_TASKQ if (rx_int) { if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); @@ -532,6 +535,7 @@ qlnx_fp_taskqueue_exit: } ecore_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1); } +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ QL_DPRINT2(ha, "exit ret = %d\n", ret); return; @@ -4262,6 +4266,7 @@ next_cqe: /* don't consume bd rx buffer */ return rx_pkt; } + /* * fast path interrupt */ @@ -4292,9 +4297,82 @@ qlnx_fp_isr(void *arg) if (fp == NULL) { ha->err_fp_null++; } else { + +#ifdef QLNX_RCV_IN_TASKQ ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0); if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); +#else + int rx_int = 0, total_rx_count = 0; + int lro_enable, tc; + + lro_enable = ha->ifp->if_capenable & IFCAP_LRO; + + ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0); + + do { + for (tc = 0; tc < ha->num_tc; tc++) { + if (mtx_trylock(&fp->tx_mtx)) { + qlnx_tx_int(ha, fp, fp->txq[tc]); + mtx_unlock(&fp->tx_mtx); + } + } + + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, + lro_enable); + + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } + + } while (rx_int); + + +#ifdef QLNX_SOFT_LRO + { + struct lro_ctrl *lro; + + lro = &fp->rxq->lro; + + if (lro_enable && total_rx_count) { + +#if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) + +#ifdef QLNX_TRACE_LRO_CNT + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; +#endif /* #ifdef QLNX_TRACE_LRO_CNT */ + + tcp_lro_flush_all(lro); + +#else + struct lro_entry *queued; + + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, \ + next); + tcp_lro_flush(lro, queued); + } +#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + } + } +#endif /* #ifdef QLNX_SOFT_LRO */ + + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); + ecore_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1); + +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ } return; Modified: stable/10/sys/dev/qlnx/qlnxe/qlnx_ver.h ============================================================================== --- stable/10/sys/dev/qlnx/qlnxe/qlnx_ver.h Thu Aug 24 17:36:10 2017 (r322849) +++ stable/10/sys/dev/qlnx/qlnxe/qlnx_ver.h Thu Aug 24 18:01:17 2017 (r322850) @@ -39,5 +39,5 @@ #define QLNX_VERSION_MAJOR 1 #define QLNX_VERSION_MINOR 4 -#define QLNX_VERSION_BUILD 5 +#define QLNX_VERSION_BUILD 6 Modified: stable/10/sys/modules/qlnx/qlnxe/Makefile ============================================================================== --- stable/10/sys/modules/qlnx/qlnxe/Makefile Thu Aug 24 17:36:10 2017 (r322849) +++ stable/10/sys/modules/qlnx/qlnxe/Makefile Thu Aug 24 18:01:17 2017 (r322850) @@ -63,6 +63,7 @@ CFLAGS += -DECORE_CONFIG_DIRECT_HWFN #CFLAGS += -DQLNX_SOFT_LRO #CFLAGS += -DQLNX_QSORT_LRO #CFLAGS += -DQLNX_MAX_COALESCE +#CFLAGS += -DQLNX_RCV_IN_TASKQ .include From owner-svn-src-all@freebsd.org Thu Aug 24 18:51:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11DA0DE6082; Thu, 24 Aug 2017 18:51:58 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44B2C2D31; Thu, 24 Aug 2017 18:51:57 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OIpub6030308; Thu, 24 Aug 2017 18:51:56 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OIpume030304; Thu, 24 Aug 2017 18:51:56 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201708241851.v7OIpume030304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Thu, 24 Aug 2017 18:51:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322851 - in stable/11/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Group: stable-11 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: in stable/11/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Commit-Revision: 322851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 18:51:58 -0000 Author: davidcs Date: Thu Aug 24 18:51:55 2017 New Revision: 322851 URL: https://svnweb.freebsd.org/changeset/base/322851 Log: MFC r322408 Performance enhancements to reduce CPU utililization for large number of TCP connections (order of tens of thousands), with predominantly Transmits. Submitted by: Vaishali.Kulkarni@cavium.com Modified: stable/11/sys/dev/qlnx/qlnxe/qlnx_def.h stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c stable/11/sys/dev/qlnx/qlnxe/qlnx_ver.h stable/11/sys/modules/qlnx/qlnxe/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/qlnx/qlnxe/qlnx_def.h ============================================================================== --- stable/11/sys/dev/qlnx/qlnxe/qlnx_def.h Thu Aug 24 18:01:17 2017 (r322850) +++ stable/11/sys/dev/qlnx/qlnxe/qlnx_def.h Thu Aug 24 18:51:55 2017 (r322851) @@ -50,9 +50,10 @@ struct qlnx_ivec { typedef struct qlnx_ivec qlnx_ivec_t; -//#define QLNX_MAX_RSS 30 -#define QLNX_MAX_RSS 16 -#define QLNX_MAX_TC 1 +//#define QLNX_MAX_RSS 30 +#define QLNX_MAX_RSS 36 +#define QLNX_DEFAULT_RSS 16 +#define QLNX_MAX_TC 1 enum QLNX_STATE { QLNX_STATE_CLOSED, @@ -201,6 +202,17 @@ struct qlnx_fastpath { uint64_t tx_pkts_freed; uint64_t tx_pkts_transmitted; uint64_t tx_pkts_completed; + uint64_t tx_tso_pkts; + uint64_t tx_non_tso_pkts; + +#ifdef QLNX_TRACE_PERF_DATA + uint64_t tx_pkts_trans_ctx; + uint64_t tx_pkts_compl_ctx; + uint64_t tx_pkts_trans_fp; + uint64_t tx_pkts_compl_fp; + uint64_t tx_pkts_compl_intr; +#endif + uint64_t tx_lso_wnd_min_len; uint64_t tx_defrag; uint64_t tx_nsegs_gt_elem_left; @@ -209,6 +221,13 @@ struct qlnx_fastpath { uint32_t tx_tso_max_pkt_len; uint32_t tx_tso_min_pkt_len; uint64_t tx_pkts[QLNX_FP_MAX_SEGS]; + +#ifdef QLNX_TRACE_PERF_DATA + uint64_t tx_pkts_hist[QLNX_FP_MAX_SEGS]; + uint64_t tx_comInt[QLNX_FP_MAX_SEGS]; + uint64_t tx_pkts_q[QLNX_FP_MAX_SEGS]; +#endif + uint64_t err_tx_nsegs_gt_elem_left; uint64_t err_tx_dmamap_create; uint64_t err_tx_defrag_dmamap_load; @@ -301,8 +320,13 @@ typedef struct qlnx_link_output qlnx_link_output_t; #define QLNX_MFW_VERSION_LENGTH 32 #define QLNX_STORMFW_VERSION_LENGTH 32 -#define QLNX_TX_ELEM_RESERVE 2 +#define QLNX_TX_ELEM_RESERVE 2 +#define QLNX_TX_ELEM_THRESH 128 +#define QLNX_TX_ELEM_MAX_THRESH 512 +#define QLNX_TX_ELEM_MIN_THRESH 32 +#define QLNX_TX_COMPL_THRESH 32 + #define QLNX_TPA_MAX_AGG_BUFFERS (20) #define QLNX_MAX_NUM_MULTICAST_ADDRS ECORE_MAX_MC_ADDRS @@ -454,6 +478,7 @@ struct qlnx_host { qlnx_storm_stats_t storm_stats[QLNX_STORM_STATS_TOTAL]; uint32_t storm_stats_index; uint32_t storm_stats_enable; + uint32_t storm_stats_gather; uint32_t personality; }; @@ -470,8 +495,11 @@ typedef struct qlnx_host qlnx_host_t; #define QLNX_MAX_MTU 9000 #define QLNX_MAX_SEGMENTS_NON_TSO (ETH_TX_MAX_BDS_PER_NON_LSO_PACKET - 1) -#define QLNX_MAX_TSO_FRAME_SIZE ((64 * 1024 - 1) + 22) +//#define QLNX_MAX_TSO_FRAME_SIZE ((64 * 1024 - 1) + 22) +#define QLNX_MAX_TSO_FRAME_SIZE 65536 +#define QLNX_MAX_TX_MBUF_SIZE 65536 /* bytes - bd_len = 16bits */ + #define QL_MAC_CMP(mac1, mac2) \ ((((*(uint32_t *) mac1) == (*(uint32_t *) mac2) && \ (*(uint16_t *)(mac1 + 4)) == (*(uint16_t *)(mac2 + 4)))) ? 0 : 1) @@ -702,6 +730,18 @@ extern void qlnx_fill_link(struct ecore_hwfn *hwfn, #define CQE_HAS_VLAN(flags) \ ((flags) & (PARSING_AND_ERR_FLAGS_TAG8021QEXIST_MASK \ << PARSING_AND_ERR_FLAGS_TAG8021QEXIST_SHIFT)) + +#if defined(__i386__) || defined(__amd64__) + +static __inline +void prefetch(void *x) +{ + __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); +} + +#else +#define prefetch(x) +#endif #endif /* #ifndef _QLNX_DEF_H_ */ Modified: stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 18:01:17 2017 (r322850) +++ stable/11/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 18:51:55 2017 (r322851) @@ -94,6 +94,8 @@ static int qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha); static uint32_t qlnx_get_optics(qlnx_host_t *ha, struct qlnx_link_output *if_link); static int qlnx_transmit(struct ifnet *ifp, struct mbuf *mp); +static int qlnx_transmit_locked(struct ifnet *ifp, struct qlnx_fastpath *fp, + struct mbuf *mp); static void qlnx_qflush(struct ifnet *ifp); static int qlnx_alloc_parent_dma_tag(qlnx_host_t *ha); @@ -133,6 +135,8 @@ static void qlnx_timer(void *arg); static int qlnx_alloc_tx_br(qlnx_host_t *ha, struct qlnx_fastpath *fp); static void qlnx_free_tx_br(qlnx_host_t *ha, struct qlnx_fastpath *fp); static void qlnx_trigger_dump(qlnx_host_t *ha); +static uint16_t qlnx_num_tx_compl(qlnx_host_t *ha, struct qlnx_fastpath *fp, + struct qlnx_tx_queue *txq); static void qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, struct qlnx_tx_queue *txq); static int qlnx_rx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, int budget, @@ -215,6 +219,12 @@ char qlnx_name_str[NAME_SIZE]; #define QLOGIC_PCI_DEVICE_ID_8070 0x8070 #endif +SYSCTL_NODE(_hw, OID_AUTO, qlnxe, CTLFLAG_RD, 0, "qlnxe driver parameters"); +/* Number of Queues: 0 (Auto) or 1 to 32 (fixed queue number) */ +static int qlnxe_queue_count = QLNX_DEFAULT_RSS; +SYSCTL_INT(_hw_qlnxe, OID_AUTO, queue_count, CTLFLAG_RDTUN, + &qlnxe_queue_count, 0, "Multi-Queue queue count"); + static int qlnx_valid_device(device_t dev) { @@ -302,7 +312,26 @@ qlnx_pci_probe(device_t dev) return (BUS_PROBE_DEFAULT); } +static uint16_t +qlnx_num_tx_compl(qlnx_host_t *ha, struct qlnx_fastpath *fp, + struct qlnx_tx_queue *txq) +{ + u16 hw_bd_cons; + u16 ecore_cons_idx; + uint16_t diff; + hw_bd_cons = le16toh(*txq->hw_cons_ptr); + + ecore_cons_idx = ecore_chain_get_cons_idx(&txq->tx_pbl); + if (hw_bd_cons < ecore_cons_idx) { + diff = (1 << 16) - (ecore_cons_idx - hw_bd_cons); + } else { + diff = hw_bd_cons - ecore_cons_idx; + } + return diff; +} + + static void qlnx_sp_intr(void *arg) { @@ -395,14 +424,11 @@ qlnx_fp_taskqueue(void *context, int pending) struct qlnx_fastpath *fp; qlnx_host_t *ha; struct ifnet *ifp; - struct mbuf *mp; - int ret; - struct thread *cthread; #ifdef QLNX_RCV_IN_TASKQ int lro_enable; int rx_int = 0, total_rx_count = 0; - + struct thread *cthread; #endif /* #ifdef QLNX_RCV_IN_TASKQ */ fp = context; @@ -410,6 +436,12 @@ qlnx_fp_taskqueue(void *context, int pending) if (fp == NULL) return; + ha = (qlnx_host_t *)fp->edev; + + ifp = ha->ifp; + +#ifdef QLNX_RCV_IN_TASKQ + cthread = curthread; thread_lock(cthread); @@ -419,112 +451,81 @@ qlnx_fp_taskqueue(void *context, int pending) thread_unlock(cthread); - ha = (qlnx_host_t *)fp->edev; + lro_enable = ifp->if_capenable & IFCAP_LRO; - ifp = ha->ifp; + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); -#ifdef QLNX_RCV_IN_TASKQ - { - lro_enable = ifp->if_capenable & IFCAP_LRO; + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } - rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); - - if (rx_int) { - fp->rx_pkts += rx_int; - total_rx_count += rx_int; - } - #ifdef QLNX_SOFT_LRO - { - struct lro_ctrl *lro; - - lro = &fp->rxq->lro; + { + struct lro_ctrl *lro; - if (lro_enable && total_rx_count) { + lro = &fp->rxq->lro; + if (lro_enable && total_rx_count) { + #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) - if (ha->dbg_trace_lro_cnt) { - if (lro->lro_mbuf_count & ~1023) - fp->lro_cnt_1024++; - else if (lro->lro_mbuf_count & ~511) - fp->lro_cnt_512++; - else if (lro->lro_mbuf_count & ~255) - fp->lro_cnt_256++; - else if (lro->lro_mbuf_count & ~127) - fp->lro_cnt_128++; - else if (lro->lro_mbuf_count & ~63) - fp->lro_cnt_64++; - } - tcp_lro_flush_all(lro); + if (ha->dbg_trace_lro_cnt) { + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; + } + tcp_lro_flush_all(lro); #else - struct lro_entry *queued; + struct lro_entry *queued; - while ((!SLIST_EMPTY(&lro->lro_active))) { - queued = SLIST_FIRST(&lro->lro_active); - SLIST_REMOVE_HEAD(&lro->lro_active, next); - tcp_lro_flush(lro, queued); - } -#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, next); + tcp_lro_flush(lro, queued); } +#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ } + } #endif /* #ifdef QLNX_SOFT_LRO */ - ecore_sb_update_sb_idx(fp->sb_info); - rmb(); - } + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); #endif /* #ifdef QLNX_RCV_IN_TASKQ */ - mtx_lock(&fp->tx_mtx); + if(ifp->if_drv_flags & IFF_DRV_RUNNING) { - if (((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) || (!ha->link_up)) { + if (!drbr_empty(ifp, fp->tx_br)) { - mtx_unlock(&fp->tx_mtx); - goto qlnx_fp_taskqueue_exit; - } + if(mtx_trylock(&fp->tx_mtx)) { - mp = drbr_peek(ifp, fp->tx_br); +#ifdef QLNX_TRACE_PERF_DATA + tx_pkts = fp->tx_pkts_transmitted; + tx_compl = fp->tx_pkts_completed; +#endif - while (mp != NULL) { + qlnx_transmit_locked(ifp, fp, NULL); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - ret = qlnx_send(ha, fp, &mp); - } else { - ret = -1; - } - - if (ret) { - - if (mp != NULL) { - drbr_putback(ifp, fp->tx_br, mp); - } else { - fp->tx_pkts_processed++; - drbr_advance(ifp, fp->tx_br); +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_trans_fp += + (fp->tx_pkts_transmitted - tx_pkts); + fp->tx_pkts_compl_fp += + (fp->tx_pkts_completed - tx_compl); +#endif + mtx_unlock(&fp->tx_mtx); } - - mtx_unlock(&fp->tx_mtx); - - goto qlnx_fp_taskqueue_exit; - - } else { - drbr_advance(ifp, fp->tx_br); - fp->tx_pkts_transmitted++; - fp->tx_pkts_processed++; } - - if (fp->tx_ring_full) - break; - - mp = drbr_peek(ifp, fp->tx_br); } - mtx_unlock(&fp->tx_mtx); - -qlnx_fp_taskqueue_exit: - #ifdef QLNX_RCV_IN_TASKQ if (rx_int) { if (fp->fp_taskqueue != NULL) @@ -537,7 +538,7 @@ qlnx_fp_taskqueue_exit: } #endif /* #ifdef QLNX_RCV_IN_TASKQ */ - QL_DPRINT2(ha, "exit ret = %d\n", ret); + QL_DPRINT2(ha, "exit \n"); return; } @@ -611,6 +612,17 @@ qlnx_drain_fp_taskqueues(qlnx_host_t *ha) return; } +static void +qlnx_get_params(qlnx_host_t *ha) +{ + if ((qlnxe_queue_count < 0) || (qlnxe_queue_count > QLNX_MAX_RSS)) { + device_printf(ha->pci_dev, "invalid queue_count value (%d)\n", + qlnxe_queue_count); + qlnxe_queue_count = 0; + } + return; +} + /* * Name: qlnx_pci_attach * Function: attaches the device to the operating system @@ -706,10 +718,21 @@ qlnx_pci_attach(device_t dev) if (qlnx_init_hw(ha) != 0) goto qlnx_pci_attach_err; + qlnx_get_params(ha); + + if((pci_get_device(dev) == QLOGIC_PCI_DEVICE_ID_1644) && + (qlnxe_queue_count == QLNX_DEFAULT_RSS)) { + qlnxe_queue_count = QLNX_MAX_RSS; + } + /* * Allocate MSI-x vectors */ - ha->num_rss = QLNX_MAX_RSS; + if(qlnxe_queue_count == 0) + ha->num_rss = QLNX_DEFAULT_RSS; + else + ha->num_rss = qlnxe_queue_count; + ha->num_tc = QLNX_MAX_TC; ha->msix_count = pci_msix_count(dev); @@ -1236,6 +1259,44 @@ qlnx_add_fp_stats_sysctls(qlnx_host_t *ha) CTLFLAG_RD, &ha->fp_array[i].tx_pkts_completed, "No. of transmit completions"); + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_non_tso_pkts", + CTLFLAG_RD, &ha->fp_array[i].tx_non_tso_pkts, + "No. of non LSO transmited packets"); + +#ifdef QLNX_TRACE_PERF_DATA + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_trans_ctx", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_trans_ctx, + "No. of transmitted packets in transmit context"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_ctx", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_ctx, + "No. of transmit completions in transmit context"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_trans_fp", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_trans_fp, + "No. of transmitted packets in taskqueue"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_fp", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_fp, + "No. of transmit completions in taskqueue"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_intr", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_intr, + "No. of transmit completions in interrupt ctx"); +#endif + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_tso_pkts", + CTLFLAG_RD, &ha->fp_array[i].tx_tso_pkts, + "No. of LSO transmited packets"); + SYSCTL_ADD_QUAD(ctx, node_children, OID_AUTO, "tx_lso_wnd_min_len", CTLFLAG_RD, &ha->fp_array[i].tx_lso_wnd_min_len, @@ -1284,6 +1345,39 @@ qlnx_add_fp_stats_sysctls(qlnx_host_t *ha) &ha->fp_array[i].tx_pkts[j], name_str); } +#ifdef QLNX_TRACE_PERF_DATA + for (j = 0; j < 18; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_pkts_hist_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_pkts_hist[j], name_str); + } + for (j = 0; j < 5; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_comInt_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_comInt[j], name_str); + } + for (j = 0; j < 18; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_pkts_q_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_pkts_q[j], name_str); + } +#endif + SYSCTL_ADD_QUAD(ctx, node_children, OID_AUTO, "err_tx_nsegs_gt_elem_left", CTLFLAG_RD, &ha->fp_array[i].err_tx_nsegs_gt_elem_left, @@ -1979,6 +2073,12 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) ifp->if_capabilities |= IFCAP_TSO6; ifp->if_capabilities |= IFCAP_LRO; + ifp->if_hw_tsomax = QLNX_MAX_TSO_FRAME_SIZE - + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + ifp->if_hw_tsomaxsegcount = QLNX_MAX_SEGMENTS - 1 /* hdr */; + ifp->if_hw_tsomaxsegsize = QLNX_MAX_TX_MBUF_SIZE; + + ifp->if_capenable = ifp->if_capabilities; ifp->if_hwassist = CSUM_IP; @@ -2543,6 +2643,7 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, u16 hw_bd_cons; u16 ecore_cons_idx; uint16_t diff; + uint16_t idx, idx2; hw_bd_cons = le16toh(*txq->hw_cons_ptr); @@ -2580,6 +2681,11 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, qlnx_trigger_dump(ha); } + idx = (txq->sw_tx_cons + 1) & (TX_RING_SIZE - 1); + idx2 = (txq->sw_tx_cons + 2) & (TX_RING_SIZE - 1); + prefetch(txq->sw_tx_ring[idx].mp); + prefetch(txq->sw_tx_ring[idx2].mp); + qlnx_free_tx_pkt(ha, fp, txq); txq->sw_tx_cons = (txq->sw_tx_cons + 1) & (TX_RING_SIZE - 1); @@ -2588,12 +2694,71 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, } static int +qlnx_transmit_locked(struct ifnet *ifp,struct qlnx_fastpath *fp, struct mbuf *mp) +{ + int ret = 0; + struct qlnx_tx_queue *txq; + qlnx_host_t * ha; + uint16_t elem_left; + + txq = fp->txq[0]; + ha = (qlnx_host_t *)fp->edev; + + + if ((!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || (!ha->link_up)) { + if(mp != NULL) + ret = drbr_enqueue(ifp, fp->tx_br, mp); + return (ret); + } + + if(mp != NULL) + ret = drbr_enqueue(ifp, fp->tx_br, mp); + + mp = drbr_peek(ifp, fp->tx_br); + + while (mp != NULL) { + + if (qlnx_send(ha, fp, &mp)) { + + if (mp != NULL) { + drbr_putback(ifp, fp->tx_br, mp); + } else { + fp->tx_pkts_processed++; + drbr_advance(ifp, fp->tx_br); + } + goto qlnx_transmit_locked_exit; + + } else { + drbr_advance(ifp, fp->tx_br); + fp->tx_pkts_transmitted++; + fp->tx_pkts_processed++; + } + + mp = drbr_peek(ifp, fp->tx_br); + } + +qlnx_transmit_locked_exit: + if((qlnx_num_tx_compl(ha,fp, fp->txq[0]) > QLNX_TX_COMPL_THRESH) || + ((int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl)) + < QLNX_TX_ELEM_MAX_THRESH)) + (void)qlnx_tx_int(ha, fp, fp->txq[0]); + + QL_DPRINT2(ha, "%s: exit ret = %d\n", __func__, ret); + return ret; +} + + +static int qlnx_transmit(struct ifnet *ifp, struct mbuf *mp) { qlnx_host_t *ha = (qlnx_host_t *)ifp->if_softc; struct qlnx_fastpath *fp; int rss_id = 0, ret = 0; +#ifdef QLNX_TRACEPERF_DATA + uint64_t tx_pkts = 0, tx_compl = 0; +#endif + QL_DPRINT2(ha, "enter\n"); #if __FreeBSD_version >= 1100000 @@ -2611,15 +2776,27 @@ qlnx_transmit(struct ifnet *ifp, struct mbuf *mp) goto qlnx_transmit_exit; } - if (mp != NULL) { - ret = drbr_enqueue(ifp, fp->tx_br, mp); - } + if (mtx_trylock(&fp->tx_mtx)) { - if (fp->fp_taskqueue != NULL) - taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); +#ifdef QLNX_TRACEPERF_DATA + tx_pkts = fp->tx_pkts_transmitted; + tx_compl = fp->tx_pkts_completed; +#endif - ret = 0; + ret = qlnx_transmit_locked(ifp, fp, mp); +#ifdef QLNX_TRACEPERF_DATA + fp->tx_pkts_trans_ctx += (fp->tx_pkts_transmitted - tx_pkts); + fp->tx_pkts_compl_ctx += (fp->tx_pkts_completed - tx_compl); +#endif + mtx_unlock(&fp->tx_mtx); + } else { + if (mp != NULL && (fp->fp_taskqueue != NULL)) { + ret = drbr_enqueue(ifp, fp->tx_br, mp); + taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); + } + } + qlnx_transmit_exit: QL_DPRINT2(ha, "exit ret = %d\n", ret); @@ -2799,6 +2976,10 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s uint32_t nbds_in_hdr = 0; uint32_t offset = 0; +#ifdef QLNX_TRACE_PERF_DATA + uint16_t bd_used; +#endif + QL_DPRINT8(ha, "enter\n"); if (!ha->link_up) @@ -2811,15 +2992,15 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s txq = fp->txq[0]; - if (fp->tx_ring_full) { - elem_left = ecore_chain_get_elem_left(&txq->tx_pbl); + if ((int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl)) < + QLNX_TX_ELEM_MIN_THRESH) { - if (elem_left < (TX_RING_SIZE >> 4)) - return (-1); - else - fp->tx_ring_full = 0; - } + fp->tx_nsegs_gt_elem_left++; + fp->err_tx_nsegs_gt_elem_left++; + return (ENOBUFS); + } + idx = txq->sw_tx_prod; map = txq->sw_tx_ring[idx].map; @@ -2829,14 +3010,18 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s BUS_DMA_NOWAIT); if (ha->dbg_trace_tso_pkt_len) { - if (!fp->tx_tso_min_pkt_len) { - fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - } else { - if (fp->tx_tso_min_pkt_len > m_head->m_pkthdr.len) + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + if (!fp->tx_tso_min_pkt_len) { fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - if (fp->tx_tso_max_pkt_len < m_head->m_pkthdr.len) - fp->tx_tso_max_pkt_len = m_head->m_pkthdr.len; + fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; + } else { + if (fp->tx_tso_min_pkt_len > m_head->m_pkthdr.len) + fp->tx_tso_min_pkt_len = + m_head->m_pkthdr.len; + if (fp->tx_tso_max_pkt_len < m_head->m_pkthdr.len) + fp->tx_tso_max_pkt_len = + m_head->m_pkthdr.len; + } } } @@ -2923,6 +3108,105 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s fp->tx_pkts[(QLNX_FP_MAX_SEGS - 1)]++; } +#ifdef QLNX_TRACE_PERF_DATA + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + if(m_head->m_pkthdr.len <= 2048) + fp->tx_pkts_hist[0]++; + else if((m_head->m_pkthdr.len > 2048) && + (m_head->m_pkthdr.len <= 4096)) + fp->tx_pkts_hist[1]++; + else if((m_head->m_pkthdr.len > 4096) && + (m_head->m_pkthdr.len <= 8192)) + fp->tx_pkts_hist[2]++; + else if((m_head->m_pkthdr.len > 8192) && + (m_head->m_pkthdr.len <= 12288 )) + fp->tx_pkts_hist[3]++; + else if((m_head->m_pkthdr.len > 11288) && + (m_head->m_pkthdr.len <= 16394)) + fp->tx_pkts_hist[4]++; + else if((m_head->m_pkthdr.len > 16384) && + (m_head->m_pkthdr.len <= 20480)) + fp->tx_pkts_hist[5]++; + else if((m_head->m_pkthdr.len > 20480) && + (m_head->m_pkthdr.len <= 24576)) + fp->tx_pkts_hist[6]++; + else if((m_head->m_pkthdr.len > 24576) && + (m_head->m_pkthdr.len <= 28672)) + fp->tx_pkts_hist[7]++; + else if((m_head->m_pkthdr.len > 28762) && + (m_head->m_pkthdr.len <= 32768)) + fp->tx_pkts_hist[8]++; + else if((m_head->m_pkthdr.len > 32768) && + (m_head->m_pkthdr.len <= 36864)) + fp->tx_pkts_hist[9]++; + else if((m_head->m_pkthdr.len > 36864) && + (m_head->m_pkthdr.len <= 40960)) + fp->tx_pkts_hist[10]++; + else if((m_head->m_pkthdr.len > 40960) && + (m_head->m_pkthdr.len <= 45056)) + fp->tx_pkts_hist[11]++; + else if((m_head->m_pkthdr.len > 45056) && + (m_head->m_pkthdr.len <= 49152)) + fp->tx_pkts_hist[12]++; + else if((m_head->m_pkthdr.len > 49512) && + m_head->m_pkthdr.len <= 53248)) + fp->tx_pkts_hist[13]++; + else if((m_head->m_pkthdr.len > 53248) && + (m_head->m_pkthdr.len <= 57344)) + fp->tx_pkts_hist[14]++; + else if((m_head->m_pkthdr.len > 53248) && + (m_head->m_pkthdr.len <= 57344)) + fp->tx_pkts_hist[15]++; + else if((m_head->m_pkthdr.len > 57344) && + (m_head->m_pkthdr.len <= 61440)) + fp->tx_pkts_hist[16]++; + else + fp->tx_pkts_hist[17]++; + } + + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + + elem_left = ecore_chain_get_elem_left(&txq->tx_pbl); + bd_used = TX_RING_SIZE - elem_left; + + if(bd_used <= 100) + fp->tx_pkts_q[0]++; + else if((bd_used > 100) && (bd_used <= 500)) + fp->tx_pkts_q[1]++; + else if((bd_used > 500) && (bd_used <= 1000)) + fp->tx_pkts_q[2]++; + else if((bd_used > 1000) && (bd_used <= 2000)) + fp->tx_pkts_q[3]++; + else if((bd_used > 3000) && (bd_used <= 4000)) + fp->tx_pkts_q[4]++; + else if((bd_used > 4000) && (bd_used <= 5000)) + fp->tx_pkts_q[5]++; + else if((bd_used > 6000) && (bd_used <= 7000)) + fp->tx_pkts_q[6]++; + else if((bd_used > 7000) && (bd_used <= 8000)) + fp->tx_pkts_q[7]++; + else if((bd_used > 8000) && (bd_used <= 9000)) + fp->tx_pkts_q[8]++; + else if((bd_used > 9000) && (bd_used <= 10000)) + fp->tx_pkts_q[9]++; + else if((bd_used > 10000) && (bd_used <= 11000)) + fp->tx_pkts_q[10]++; + else if((bd_used > 11000) && (bd_used <= 12000)) + fp->tx_pkts_q[11]++; + else if((bd_used > 12000) && (bd_used <= 13000)) + fp->tx_pkts_q[12]++; + else if((bd_used > 13000) && (bd_used <= 14000)) + fp->tx_pkts_q[13]++; + else if((bd_used > 14000) && (bd_used <= 15000)) + fp->tx_pkts_q[14]++; + else if((bd_used > 15000) && (bd_used <= 16000)) + fp->tx_pkts_q[15]++; + else + fp->tx_pkts_q[16]++; + } + +#endif /* end of QLNX_TRACE_PERF_DATA */ + if ((nsegs + QLNX_TX_ELEM_RESERVE) > (int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl))) { @@ -2943,7 +3227,8 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s fp->err_tx_nsegs_gt_elem_left++; fp->tx_ring_full = 1; - ha->storm_stats_enable = 1; + if (ha->storm_stats_enable) + ha->storm_stats_gather = 1; return (ENOBUFS); } } @@ -3131,6 +3416,7 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s third_bd->data.bitfields |= (nbds_in_hdr<tx_tso_pkts++; } else { segs++; for (seg_idx = 1; seg_idx < nsegs; seg_idx++) { @@ -3147,6 +3433,7 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s << ETH_TX_DATA_1ST_BD_PKT_LEN_SHIFT; first_bd->data.bitfields = htole16(first_bd->data.bitfields); + fp->tx_non_tso_pkts++; } @@ -4303,8 +4590,10 @@ qlnx_fp_isr(void *arg) if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); #else - int rx_int = 0, total_rx_count = 0; - int lro_enable, tc; + int rx_int = 0, total_rx_count = 0; + int lro_enable, tc; + struct qlnx_tx_queue *txq; + uint16_t elem_left; lro_enable = ha->ifp->if_capenable & IFCAP_LRO; @@ -4312,10 +4601,36 @@ qlnx_fp_isr(void *arg) do { for (tc = 0; tc < ha->num_tc; tc++) { - if (mtx_trylock(&fp->tx_mtx)) { - qlnx_tx_int(ha, fp, fp->txq[tc]); - mtx_unlock(&fp->tx_mtx); - } + + txq = fp->txq[tc]; + + if((int)(elem_left = + ecore_chain_get_elem_left(&txq->tx_pbl)) < + QLNX_TX_ELEM_THRESH) { + + if (mtx_trylock(&fp->tx_mtx)) { +#ifdef QLNX_TRACE_PERF_DATA + tx_compl = fp->tx_pkts_completed; +#endif + + qlnx_tx_int(ha, fp, fp->txq[tc]); +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_compl_intr += + (fp->tx_pkts_completed - tx_compl); + if ((fp->tx_pkts_completed - tx_compl) <= 32) + fp->tx_comInt[0]++; + else if (((fp->tx_pkts_completed - tx_compl) > 32) && + ((fp->tx_pkts_completed - tx_compl) <= 64)) + fp->tx_comInt[1]++; + else if(((fp->tx_pkts_completed - tx_compl) > 64) && + ((fp->tx_pkts_completed - tx_compl) <= 128)) + fp->tx_comInt[2]++; + else if(((fp->tx_pkts_completed - tx_compl) > 128)) + fp->tx_comInt[3]++; +#endif + mtx_unlock(&fp->tx_mtx); + } + } } rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, @@ -4328,7 +4643,6 @@ qlnx_fp_isr(void *arg) } while (rx_int); - #ifdef QLNX_SOFT_LRO { struct lro_ctrl *lro; @@ -4608,8 +4922,8 @@ qlnx_alloc_tx_dma_tag(qlnx_host_t *ha) NULL, NULL, /* filter, filterarg */ QLNX_MAX_TSO_FRAME_SIZE, /* maxsize */ QLNX_MAX_SEGMENTS, /* nsegments */ - (PAGE_SIZE * 4), /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + QLNX_MAX_TX_MBUF_SIZE, /* maxsegsize */ + 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ &ha->tx_tag)) { @@ -4642,7 +4956,7 @@ qlnx_alloc_rx_dma_tag(qlnx_host_t *ha) MJUM9BYTES, /* maxsize */ 1, /* nsegments */ MJUM9BYTES, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ &ha->rx_tag)) { @@ -5255,6 +5569,14 @@ qlnx_init_fp(qlnx_host_t *ha) fp->tx_pkts_freed = 0; fp->tx_pkts_transmitted = 0; fp->tx_pkts_completed = 0; + +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_trans_ctx = 0; + fp->tx_pkts_compl_ctx = 0; + fp->tx_pkts_trans_fp = 0; + fp->tx_pkts_compl_fp = 0; + fp->tx_pkts_compl_intr = 0; +#endif fp->tx_lso_wnd_min_len = 0; fp->tx_defrag = 0; fp->tx_nsegs_gt_elem_left = 0; @@ -6606,7 +6928,7 @@ qlnx_timer(void *arg) ecore_get_vport_stats(&ha->cdev, &ha->hw_stats); - if (ha->storm_stats_enable) + if (ha->storm_stats_gather) qlnx_sample_storm_stats(ha); callout_reset(&ha->qlnx_callout, hz, qlnx_timer, ha); @@ -6855,7 +7177,7 @@ qlnx_sample_storm_stats(qlnx_host_t *ha) struct ecore_hwfn *hwfn; if (ha->storm_stats_index >= QLNX_STORM_STATS_SAMPLES_PER_HWFN) { - ha->storm_stats_enable = 0; + ha->storm_stats_gather = 0; return; } Modified: stable/11/sys/dev/qlnx/qlnxe/qlnx_ver.h ============================================================================== --- stable/11/sys/dev/qlnx/qlnxe/qlnx_ver.h Thu Aug 24 18:01:17 2017 (r322850) +++ stable/11/sys/dev/qlnx/qlnxe/qlnx_ver.h Thu Aug 24 18:51:55 2017 (r322851) @@ -39,5 +39,5 @@ #define QLNX_VERSION_MAJOR 1 #define QLNX_VERSION_MINOR 4 -#define QLNX_VERSION_BUILD 6 +#define QLNX_VERSION_BUILD 7 Modified: stable/11/sys/modules/qlnx/qlnxe/Makefile ============================================================================== --- stable/11/sys/modules/qlnx/qlnxe/Makefile Thu Aug 24 18:01:17 2017 (r322850) +++ stable/11/sys/modules/qlnx/qlnxe/Makefile Thu Aug 24 18:51:55 2017 (r322851) @@ -52,7 +52,7 @@ SRCS+= pci_if.h CWARNEXTRA += -Wno-cast-qual -CFLAGS += -DQLNX_DEBUG +#CFLAGS += -DQLNX_DEBUG CFLAGS += -DECORE_PACKAGE CFLAGS += -DCONFIG_ECORE_L2 CFLAGS += -DECORE_CONFIG_DIRECT_HWFN From owner-svn-src-all@freebsd.org Thu Aug 24 19:09:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A33F3DE6366; Thu, 24 Aug 2017 19:09:43 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71EF8355E; Thu, 24 Aug 2017 19:09:43 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OJ9giY037062; Thu, 24 Aug 2017 19:09:42 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OJ9gHD037061; Thu, 24 Aug 2017 19:09:42 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201708241909.v7OJ9gHD037061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Thu, 24 Aug 2017 19:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322852 - head/sys/dev/qlnx/qlnxe X-SVN-Group: head X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: head/sys/dev/qlnx/qlnxe X-SVN-Commit-Revision: 322852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 19:09:43 -0000 Author: davidcs Date: Thu Aug 24 19:09:42 2017 New Revision: 322852 URL: https://svnweb.freebsd.org/changeset/base/322852 Log: Fix qlnx_tso_check() so that every window of (ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr) has atleast ETH_TX_LSO_WINDOW_MIN_LEN bytes MFC after:5 days Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 18:51:55 2017 (r322851) +++ head/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 19:09:42 2017 (r322852) @@ -2921,25 +2921,35 @@ qlnx_tso_check(struct qlnx_fastpath *fp, bus_dma_segme { int i; uint32_t sum, nbds_in_hdr = 1; - bus_dma_segment_t *t_segs = segs; + uint32_t window; + bus_dma_segment_t *s_seg; - /* count the number of segments spanned by TCP header */ + /* If the header spans mulitple segments, skip those segments */ + if (nsegs < ETH_TX_LSO_WINDOW_BDS_NUM) + return (0); + i = 0; - while ((i < nsegs) && (offset > t_segs->ds_len)) { - nbds_in_hdr++; - offset = offset - t_segs->ds_len; - t_segs++; + + while ((i < nsegs) && (offset >= segs->ds_len)) { + offset = offset - segs->ds_len; + segs++; i++; + nbds_in_hdr++; } - while (nsegs >= QLNX_MAX_SEGMENTS_NON_TSO) { + window = ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr; + nsegs = nsegs - i; + + while (nsegs >= window) { + sum = 0; + s_seg = segs; - for (i = 0; i < (ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr); i++){ - sum += segs->ds_len; - segs++; + for (i = 0; i < window; i++){ + sum += s_seg->ds_len; + s_seg++; } if (sum < ETH_TX_LSO_WINDOW_MIN_LEN) { @@ -2947,7 +2957,8 @@ qlnx_tso_check(struct qlnx_fastpath *fp, bus_dma_segme return (-1); } - nsegs -= QLNX_MAX_SEGMENTS_NON_TSO; + nsegs = nsegs - 1; + segs++; } return (0); From owner-svn-src-all@freebsd.org Thu Aug 24 19:16:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE5E5DE65BF; Thu, 24 Aug 2017 19:16:26 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7DD033A0F; Thu, 24 Aug 2017 19:16:26 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OJGPxf040966; Thu, 24 Aug 2017 19:16:25 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OJGPfw040964; Thu, 24 Aug 2017 19:16:25 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708241916.v7OJGPfw040964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 24 Aug 2017 19:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322853 - in head: share/man/man4 sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man4 sys/kern X-SVN-Commit-Revision: 322853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 19:16:26 -0000 Author: cem Date: Thu Aug 24 19:16:25 2017 New Revision: 322853 URL: https://svnweb.freebsd.org/changeset/base/322853 Log: Remove unused declaration and update ddb.4 A follow-up to r322836. Warnings for the unused declaration were breaking some second tier architectures, but did not show up in Clang on x86. Reported by: markj (ddb.4), emaste (declaration) Sponsored by: Dell EMC Isilon Modified: head/share/man/man4/ddb.4 head/sys/kern/subr_turnstile.c Modified: head/share/man/man4/ddb.4 ============================================================================== --- head/share/man/man4/ddb.4 Thu Aug 24 19:09:42 2017 (r322852) +++ head/share/man/man4/ddb.4 Thu Aug 24 19:16:25 2017 (r322853) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 3, 2017 +.Dd August 24, 2017 .Dt DDB 4 .Os .Sh NAME @@ -782,7 +782,7 @@ Lock owner. .It Ic show Cm lockchain Ar addr Show all threads a particular thread at address .Ar addr -is waiting on based on non-sleepable and non-spin locks. +is waiting on based on non-spin locks. .\" .Pp .It Ic show Cm lockedbufs @@ -960,8 +960,9 @@ Useful for long debugging sessions. .\" .Pp .It Ic show Cm sleepchain -Show all the threads a particular thread is waiting on based on -sleepable locks. +Deprecated. +Now an alias for +.Ic show Cm lockchain . .\" .Pp .It Ic show Cm sleepq Modified: head/sys/kern/subr_turnstile.c ============================================================================== --- head/sys/kern/subr_turnstile.c Thu Aug 24 19:09:42 2017 (r322852) +++ head/sys/kern/subr_turnstile.c Thu Aug 24 19:16:25 2017 (r322853) @@ -157,9 +157,6 @@ static void init_turnstile0(void *dummy); #ifdef TURNSTILE_PROFILING static void init_turnstile_profiling(void *arg); #endif -#ifdef DDB -static void print_sleepchain(struct thread *td, const char *prefix); -#endif static void propagate_priority(struct thread *td); static int turnstile_adjust_thread(struct turnstile *ts, struct thread *td); From owner-svn-src-all@freebsd.org Thu Aug 24 19:43:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91282DE6DD1; Thu, 24 Aug 2017 19:43:50 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2795963B12; Thu, 24 Aug 2017 19:43:50 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-wm0-x22c.google.com with SMTP id b189so3149022wmd.0; Thu, 24 Aug 2017 12:43:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=y/0fwu3Xl4bqXMxVANB+aKACcKCWJD6hBBkf5WnueSE=; b=vaVlETX9ke4S5s8RBgwrKx8AS2H1K18wziDozIGszTGIQoGNvECKz3yxYLXdlSmNZv Zp8MYBJ4ZVWuK5Kp+h25raz4ZLx5nG627YQ8fSSCgzRXZAveGStDBxAUKAEW1simKcd5 BPfuwXgmO74hAgoXu1rZpMcnsYW2SDdPZK01fz1mwxWm3lemfXa1Toc4IDYs/oD9xIk4 Oa2PIcKYm7XHM1RAxLz4cUlsir+wyi0exHQA0c0d5x6UybPkb3Q3wCqXAvrmg+sa8Ezk xt5CYsRTCCRLEV9cVxQDjKNKihURXCt1Li209j6k8kNVnEX73X8hX8EDnwsjUPthB2oT IJrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=y/0fwu3Xl4bqXMxVANB+aKACcKCWJD6hBBkf5WnueSE=; b=b9qGNf1GQG82aSuvxHewvbpqpGEY1vjKPfrfQyoyAj/exFmVab8ZsDcjx+8p1ybFnz aEJXVN6muh49SqbOPo5kcWfoAzv0dwPio1nHZrvBfi8rxL5UlJ+iJZjb2KGzrLq8xZzP yKxTbxzsAKrFQCibIRAYekdClfDsr2CJf2WRJL1xUbdgik/h0GEyifSZQgOCCCj7KlLA SjnNUuI+Ryru5t10eJUkMa1W1YgDDnpwJoicYPp4s+fb6FI3N5bIpi1YjqNlPeD9+KRM SzAtOyCkhIPy98dSLwnrbdDILyWZL03L0CAKC1/KaPgdqeBmD3sSWlucwLe3bI6swnEB C0Jg== X-Gm-Message-State: AHYfb5hibtHz0I92mbTAVBWofUJFLcJ7RBrHJdJI6OkQWL0HhE6H+Xli lNK7B4raXWtYh4UQLBuZAp2PVEygiF9+ X-Received: by 10.28.98.66 with SMTP id w63mr4343968wmb.34.1503603828264; Thu, 24 Aug 2017 12:43:48 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.28.56.194 with HTTP; Thu, 24 Aug 2017 12:43:47 -0700 (PDT) In-Reply-To: <20170809141608.I1096@besplex.bde.org> References: <201708081614.v78GEVGY066448@repo.freebsd.org> <20170809141608.I1096@besplex.bde.org> From: Alan Somers Date: Thu, 24 Aug 2017 13:43:47 -0600 X-Google-Sender-Auth: g3YuGXWyus_al5iZstj16XhjgrA Message-ID: Subject: Re: svn commit: r322258 - head/sys/kern To: Bruce Evans Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 19:43:50 -0000 On Wed, Aug 9, 2017 at 1:05 AM, Bruce Evans wrote: > On Tue, 8 Aug 2017, Alan Somers wrote: > >> Log: >> Make p1003_1b.aio_listio_max a tunable >> >> p1003_1b.aio_listio_max is now a tunable. Its value is reflected in the >> sysctl of the same name, and the sysconf(3) variable _SC_AIO_LISTIO_MAX. >> Its value will be bounded from below by the compile-time constant >> AIO_LISTIO_MAX and from above by the compile-time constant >> MAX_AIO_QUEUE_PER_PROC and the tunable vfs.aio.max_aio_queue. > > > I don't like tunables or sysctls being limited or silently limiting them. > This is not done for more important sysctls like kern.maxfilesperproc. > Lots of silent runtime limiting is done for a few more important limits > like kern.maxfilesperproc. > > The limiting is also buggy: > - vfs.aio.max_aio_queue isn't a tunable as stated. It is a r/w sysctl > - if vfs.aio.max_aio_queue were a r/o tunable, then there would be a > solvable ordering problem initializing it before using it > - since vfs.aio.max_aio_queue is only a sysctl, it is unusable at boot > time (and module load time), but it is used there. > > Other bugs in vfs.aio.max_aio_queue: > - its name is too long, yet not very descriptive > - its name repeats "aio" > - its name but doesn't say "len", so it looks like it limits a number of > queues and not the length of a single queue. This is backwards relative > to the corresponding variable name. That is missing "aio" when it > is needed, but only spells "length" badly as "count". It is > max_queue_count, but should be something like aio_max_qlen. All > sysctl variables should have an aio_ prefix which is removed in the > leaf name in the sysctl tree. > Other names have similar or worse bugs. Bugs start with parameter names > MAX_AIO_* instead of AIO_*_MAX, and variable names track this. There is > some ambiguity from global vs per-process limits and counts, and the > noise word "num" is sprinkled to get names which differ without describing > any difference. > >> Modified: head/sys/kern/vfs_aio.c >> >> ============================================================================== >> --- head/sys/kern/vfs_aio.c Tue Aug 8 16:06:16 2017 (r322257) >> +++ head/sys/kern/vfs_aio.c Tue Aug 8 16:14:31 2017 (r322258) >> @@ -102,6 +102,7 @@ static uint64_t jobseqno; >> #endif >> >> FEATURE(aio, "Asynchronous I/O"); >> +SYSCTL_DECL(_p1003_1b); >> >> static MALLOC_DEFINE(M_LIO, "lio", "listio aio control block list"); >> >> @@ -168,6 +169,11 @@ static int max_buf_aio = MAX_BUF_AIO; >> SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0, >> "Maximum buf aio requests per process (stored in the process)"); >> >> +static int aio_listio_max = AIO_LISTIO_MAX; >> +SYSCTL_INT(_p1003_1b, CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max, >> + CTLFLAG_RDTUN | CTLFLAG_CAPRD, &aio_listio_max, 0, >> + "Maximum aio requests for a single lio_listio call"); >> + > > > The POSIX namespace is missing all of the bugs described above. It has > aio first (except, for historical reasons it unfortunately has p10031b > instead of vfs.aio for the sysctl prefix), and max last. > >> #ifdef COMPAT_FREEBSD6 >> typedef struct oaiocb { >> int aio_fildes; /* File descriptor */ >> @@ -388,6 +394,11 @@ static int >> aio_onceonly(void) >> { >> >> + if (aio_listio_max < AIO_LISTIO_MAX) >> + aio_listio_max = AIO_LISTIO_MAX; >> + if (aio_listio_max > MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count)) >> + aio_listio_max = MIN(MAX_AIO_QUEUE_PER_PROC, >> max_queue_count); >> + > > > max_queue_count is not initialized here, except to a default at compile > time. Except for module (re)load, it always has the default value > MAX_AIO_QUEUE = 1024 > (this 1024 is bogusly ifdefed. MAX_AIO_QUEUE is not defined in any > header file and is not a supported option, and the tunable makes the > option less needed than before). > MAX_AIO_QUEUE_PER_PROC = 256, modulo a similar unsupported option. > Thus MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count) is an obfuscated spelling > of 256. > > MAX_AIO_QUEUE_PER_PROC is also just the default for a variable > (max_aio_queue_per_proc), so using it here has the same bugs except for > the obfuscation. > > Using MIN() instead of imin() is a style bug. > > OTOH, AIO_LISTIO_MAX is defined (as 16) in a header file, and is not > bogusly ifdefed. It is 1 of 3 aio limits specified by POSIX. > > The checking would be buggy if it were done later, since max_queue_count > is not checked and limiting to it can corrupt aio_listio_max (when it is > negative or just too small). > > The compile-time definition of AIO_LISTIO_MAX seems to be broken. I think > POSIX species that AIO_LISTIO_MAX shall not be defined if the value of > {AIO_LISTIO_MAX} varies at runtime, but it is still defined. FreeBSD > has this bug for many other sysconf() variables, e.g., {OPEN_MAX}. > Perhaps AIO_LISTIO_MAX is easier to fix since it is not hard-coded as > often as OPEN_MAX. What you describe is Linux's behavior, but the POSIX requirement is a bit more general. All POSIX says is that "The value returned [by sysconf(3)] shall not be more restrictive than the corresponding value described to the application when it was compiled with the implementation's or ". > > AIO_LISTIO_MAX is now just the FreeBSD default, but the first check in > the above restricts {AIO_LISTIO_MAX} to this default (16) instead of to > the POSIX limit of _POSIX_IO_LISTIO_MAX (2). Relaxing this check would > cause more problems with hard-coded AIO_LISTIO_MAX. > > If the second check in the above were done at runtime so that it worked > for changed max_queue_count, then it would reduce aio_listio_max below > the POSIX limit of 2 slightly before it reduces to garbage zero and negative > values. The first check should be large, or if you want to give a > preference > for >= the old limit of 16 and a hard limit of the POSIX limit of 2, check > keep checking the old limit first and the POSIX limit last. > >> exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, >> NULL, >> EVENTHANDLER_PRI_ANY); >> exec_tag = EVENTHANDLER_REGISTER(process_exec, >> aio_proc_rundown_exec, >> @@ -405,14 +416,13 @@ aio_onceonly(void) >> NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); >> aiocb_zone = uma_zcreate("AIOCB", sizeof(struct kaiocb), NULL, >> NULL, >> NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); >> - aiol_zone = uma_zcreate("AIOL", AIO_LISTIO_MAX*sizeof(intptr_t) , >> NULL, >> - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); >> + aiol_zone = uma_zcreate("AIOL", aio_listio_max * sizeof(intptr_t) >> , >> + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); > > > Allocations like this are hard to adjust later (I forget if the size limit > is hard or soft, but it should be hard). The user must be allowed to set > aio_listio_max to value larger than the default, so as to prepare for > expansion of the other limits later. However, this doesn't work, since > it leaves the other limits inconsistent until they are expanded. > > It seems best to adjust all the other limits based on the aio_listio_max > tunable. Usually this is not set. Use the old parameters then, but remove > all the macros and compile-time initializers for them. Do onceonly > initialization like > > if (aio_listio_max == 16) { > max_queue_count = 1024; /* historical MAX_AIO_QUEUE */ > ... > } > > When aio_listio_max != 16, calculate the parameters somehow. I don't know > how to do this. At least make them consistent. > > After initialization, the other parameters are still restricted by the > choice for aio_listio_max. Leave it to the user to not choose bad > combinations. > > The aio sysctls seem to already break many of the POSIX sysctls. E.g., > MAX_AIO_QUEUE is used as the default for the r/w sysctl > vfs.aio.max_aio_queue and as the value for the sysctl r/o sysctl > p1003_1b.aio_max. Any change to the first sysctl breaks the second > sysctl. > > The 3 POSIX (2001) aio sysctls thus have quite different invariance > bugs: > - {AIO_MAX}: AIO_MAX is correctly not defined. {AIO_MAX} is variable > by a low-level sysctl but the p1003 sysctl used to report {AIO_MAX} > doesn't see the change. > - {AIO_PRIO_DELTA_MAX}: no low-level sysctl or variable to break it > (value is always 0) > - {AIO_LISTIO_MAX}: was constant until this commit. There is not > low-level sysctl for it, and the low-level variable for it is > correctly exported, but AIO_LISTIO_MAX was incorrectly defined > so it is hard to change now. {AIO_LISTIO_MAX} is inconsistent > with the macro whenever the tunable is used to change its default. > > Bruce I dug deeper and found that there wasn't any good reason for the aio_listio_max limit to exist in the first place. This DR eliminates it, which I think will satisfy most of your concerns. https://reviews.freebsd.org/D12120 -Alan From owner-svn-src-all@freebsd.org Thu Aug 24 19:48:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A158CDE6E60; Thu, 24 Aug 2017 19:48:43 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6DDED63CC0; Thu, 24 Aug 2017 19:48:43 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OJmghX053469; Thu, 24 Aug 2017 19:48:42 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OJmgNR053466; Thu, 24 Aug 2017 19:48:42 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708241948.v7OJmgNR053466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 24 Aug 2017 19:48:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322854 - in head/cddl: contrib/opensolaris/lib/libzfs/common usr.sbin/zfsd X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head/cddl: contrib/opensolaris/lib/libzfs/common usr.sbin/zfsd X-SVN-Commit-Revision: 322854 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 19:48:43 -0000 Author: asomers Date: Thu Aug 24 19:48:41 2017 New Revision: 322854 URL: https://svnweb.freebsd.org/changeset/base/322854 Log: zfsd(8): Close a race condition when onlining a disk paritition When inserting a partitioned disk, devfs and geom will announce the whole disk before they announce the partition. If the partition containing ZFS extends to one of the disk's extents, then zfsd will see a ZFS label on the whole disk and attempt to online it. ZFS is smart enough to activate the partition instead of the whole disk, but only if GEOM has already created the partition's provider. cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Add a zpool_read_all_labels method. It's similar to zpool_read_label, but it will return the number of labels found. cddl/usr.sbin/zfsd/zfsd_event.cc When processing a DevFS CREATE event, only online a VDEV if we can read all four ZFS labels. Reviewed by: mav MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11920 Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c head/cddl/usr.sbin/zfsd/zfsd_event.cc Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Aug 24 19:16:25 2017 (r322853) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Aug 24 19:48:41 2017 (r322854) @@ -772,6 +772,7 @@ extern int zpool_in_use(libzfs_handle_t *, int, pool_s * Label manipulation. */ extern int zpool_read_label(int, nvlist_t **); +extern int zpool_read_all_labels(int, nvlist_t **); extern int zpool_clear_label(int); /* is this zvol valid for use as a dump device? */ Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Aug 24 19:16:25 2017 (r322853) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Aug 24 19:48:41 2017 (r322854) @@ -914,6 +914,65 @@ zpool_read_label(int fd, nvlist_t **config) return (0); } +/* + * Given a file descriptor, read the label information and return an nvlist + * describing the configuration, if there is one. + * returns the number of valid labels found + */ +int +zpool_read_all_labels(int fd, nvlist_t **config) +{ + struct stat64 statbuf; + int l; + vdev_label_t *label; + uint64_t state, txg, size; + int nlabels = 0; + + *config = NULL; + + if (fstat64(fd, &statbuf) == -1) + return (0); + size = P2ALIGN_TYPED(statbuf.st_size, sizeof (vdev_label_t), uint64_t); + + if ((label = malloc(sizeof (vdev_label_t))) == NULL) + return (0); + + for (l = 0; l < VDEV_LABELS; l++) { + nvlist_t *temp = NULL; + + /* TODO: use aio_read so we can read al 4 labels in parallel */ + if (pread64(fd, label, sizeof (vdev_label_t), + label_offset(size, l)) != sizeof (vdev_label_t)) + continue; + + if (nvlist_unpack(label->vl_vdev_phys.vp_nvlist, + sizeof (label->vl_vdev_phys.vp_nvlist), &temp, 0) != 0) + continue; + + if (nvlist_lookup_uint64(temp, ZPOOL_CONFIG_POOL_STATE, + &state) != 0 || state > POOL_STATE_L2CACHE) { + nvlist_free(temp); + temp = NULL; + continue; + } + + if (state != POOL_STATE_SPARE && state != POOL_STATE_L2CACHE && + (nvlist_lookup_uint64(temp, ZPOOL_CONFIG_POOL_TXG, + &txg) != 0 || txg == 0)) { + nvlist_free(temp); + temp = NULL; + continue; + } + if (temp) + *config = temp; + + nlabels++; + } + + free(label); + return (nlabels); +} + typedef struct rdsk_node { char *rn_name; int rn_dfd; Modified: head/cddl/usr.sbin/zfsd/zfsd_event.cc ============================================================================== --- head/cddl/usr.sbin/zfsd/zfsd_event.cc Thu Aug 24 19:16:25 2017 (r322853) +++ head/cddl/usr.sbin/zfsd/zfsd_event.cc Thu Aug 24 19:48:41 2017 (r322854) @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -93,6 +94,7 @@ DevfsEvent::ReadLabel(int devFd, bool &inUse, bool &de pool_state_t poolState; char *poolName; boolean_t b_inuse; + int nlabels; inUse = false; degraded = false; @@ -105,8 +107,16 @@ DevfsEvent::ReadLabel(int devFd, bool &inUse, bool &de if (poolName != NULL) free(poolName); - if (zpool_read_label(devFd, &devLabel) != 0 - || devLabel == NULL) + nlabels = zpool_read_all_labels(devFd, &devLabel); + /* + * If we find a disk with fewer than the maximum number of + * labels, it might be the whole disk of a partitioned disk + * where ZFS resides on a partition. In that case, we should do + * nothing and wait for the partition to appear. Or, the disk + * might be damaged. In that case, zfsd should do nothing and + * wait for the sysadmin to decide. + */ + if (nlabels != VDEV_LABELS || devLabel == NULL) return (NULL); try { From owner-svn-src-all@freebsd.org Thu Aug 24 20:19:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9AECDE776D; Thu, 24 Aug 2017 20:19:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 791DD64BCC; Thu, 24 Aug 2017 20:19:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OKJT1Z065717; Thu, 24 Aug 2017 20:19:29 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OKJSZc065702; Thu, 24 Aug 2017 20:19:28 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708242019.v7OKJSZc065702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 24 Aug 2017 20:19:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322855 - in head: contrib/compiler-rt/lib/builtins/arm contrib/compiler-rt/lib/esan contrib/compiler-rt/lib/profile contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen/Selection... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/compiler-rt/lib/builtins/arm contrib/compiler-rt/lib/esan contrib/compiler-rt/lib/profile contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen/SelectionDAG contrib/llvm/lib/IR c... X-SVN-Commit-Revision: 322855 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 20:19:31 -0000 Author: dim Date: Thu Aug 24 20:19:27 2017 New Revision: 322855 URL: https://svnweb.freebsd.org/changeset/base/322855 Log: Upgrade our copies of clang, llvm, lldb and compiler-rt to r311606 from the upstream release_50 branch. As of this version, lib/msun's trig test should also work correctly again (see bug 220989 for more information). PR: 220989 MFC after: 2 months X-MFC-with: r321369 Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_dcmp.S head/contrib/compiler-rt/lib/builtins/arm/aeabi_fcmp.S head/contrib/compiler-rt/lib/esan/esan_sideline_linux.cpp head/contrib/compiler-rt/lib/profile/InstrProfilingNameVar.c head/contrib/llvm/include/llvm/CodeGen/SelectionDAGNodes.h head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp head/contrib/llvm/lib/IR/AutoUpgrade.cpp head/contrib/llvm/lib/Object/COFFModuleDefinition.cpp head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp head/contrib/llvm/lib/Target/X86/X86InstrAVX512.td head/contrib/llvm/lib/Target/X86/X86SchedSandyBridge.td head/contrib/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp head/contrib/llvm/lib/ToolDrivers/llvm-dlltool/Options.td head/contrib/llvm/lib/Transforms/Scalar/LowerAtomic.cpp head/contrib/llvm/lib/Transforms/Scalar/Reassociate.cpp head/contrib/llvm/lib/Transforms/Utils/CloneFunction.cpp head/contrib/llvm/tools/clang/include/clang/AST/DeclCXX.h head/contrib/llvm/tools/clang/include/clang/Lex/Preprocessor.h head/contrib/llvm/tools/clang/lib/AST/ASTImporter.cpp head/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGCXXABI.cpp head/contrib/llvm/tools/clang/lib/CodeGen/ItaniumCXXABI.cpp head/contrib/llvm/tools/clang/lib/CodeGen/MicrosoftCXXABI.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Darwin.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/MSVC.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/MSVC.h head/contrib/llvm/tools/clang/lib/Format/WhitespaceManager.cpp head/contrib/llvm/tools/clang/lib/Headers/unwind.h head/contrib/llvm/tools/clang/lib/Lex/PPLexerChange.cpp head/contrib/llvm/tools/clang/lib/Lex/Preprocessor.cpp head/contrib/llvm/tools/clang/lib/Parse/Parser.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp head/contrib/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp head/contrib/llvm/tools/clang/lib/Serialization/ASTWriter.cpp head/contrib/llvm/tools/clang/lib/StaticAnalyzer/Core/RegionStore.cpp head/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp head/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/RegisterContext_x86.h head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/include/lld/Config/Version.inc head/lib/clang/include/llvm/Support/VCSRevision.h Directory Properties: head/contrib/compiler-rt/ (props changed) head/contrib/libc++/ (props changed) head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) head/contrib/llvm/tools/lld/ (props changed) head/contrib/llvm/tools/lldb/ (props changed) Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_dcmp.S ============================================================================== --- head/contrib/compiler-rt/lib/builtins/arm/aeabi_dcmp.S Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/compiler-rt/lib/builtins/arm/aeabi_dcmp.S Thu Aug 24 20:19:27 2017 (r322855) @@ -18,11 +18,20 @@ // } // } +#if defined(COMPILER_RT_ARMHF_TARGET) +# define CONVERT_DCMP_ARGS_TO_DF2_ARGS \ + vmov d0, r0, r1 SEPARATOR \ + vmov d1, r2, r3 +#else +# define CONVERT_DCMP_ARGS_TO_DF2_ARGS +#endif + #define DEFINE_AEABI_DCMP(cond) \ .syntax unified SEPARATOR \ .p2align 2 SEPARATOR \ DEFINE_COMPILERRT_FUNCTION(__aeabi_dcmp ## cond) \ push { r4, lr } SEPARATOR \ + CONVERT_DCMP_ARGS_TO_DF2_ARGS SEPARATOR \ bl SYMBOL_NAME(__ ## cond ## df2) SEPARATOR \ cmp r0, #0 SEPARATOR \ b ## cond 1f SEPARATOR \ Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_fcmp.S ============================================================================== --- head/contrib/compiler-rt/lib/builtins/arm/aeabi_fcmp.S Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/compiler-rt/lib/builtins/arm/aeabi_fcmp.S Thu Aug 24 20:19:27 2017 (r322855) @@ -18,11 +18,20 @@ // } // } +#if defined(COMPILER_RT_ARMHF_TARGET) +# define CONVERT_FCMP_ARGS_TO_SF2_ARGS \ + vmov s0, r0 SEPARATOR \ + vmov s1, r1 +#else +# define CONVERT_FCMP_ARGS_TO_SF2_ARGS +#endif + #define DEFINE_AEABI_FCMP(cond) \ .syntax unified SEPARATOR \ .p2align 2 SEPARATOR \ DEFINE_COMPILERRT_FUNCTION(__aeabi_fcmp ## cond) \ push { r4, lr } SEPARATOR \ + CONVERT_FCMP_ARGS_TO_SF2_ARGS SEPARATOR \ bl SYMBOL_NAME(__ ## cond ## sf2) SEPARATOR \ cmp r0, #0 SEPARATOR \ b ## cond 1f SEPARATOR \ Modified: head/contrib/compiler-rt/lib/esan/esan_sideline_linux.cpp ============================================================================== --- head/contrib/compiler-rt/lib/esan/esan_sideline_linux.cpp Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/compiler-rt/lib/esan/esan_sideline_linux.cpp Thu Aug 24 20:19:27 2017 (r322855) @@ -70,7 +70,7 @@ int SidelineThread::runSideline(void *Arg) { // Set up a signal handler on an alternate stack for safety. InternalScopedBuffer StackMap(SigAltStackSize); - struct sigaltstack SigAltStack; + stack_t SigAltStack; SigAltStack.ss_sp = StackMap.data(); SigAltStack.ss_size = SigAltStackSize; SigAltStack.ss_flags = 0; Modified: head/contrib/compiler-rt/lib/profile/InstrProfilingNameVar.c ============================================================================== --- head/contrib/compiler-rt/lib/profile/InstrProfilingNameVar.c Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/compiler-rt/lib/profile/InstrProfilingNameVar.c Thu Aug 24 20:19:27 2017 (r322855) @@ -1,11 +1,11 @@ -//===- InstrProfilingNameVar.c - profile name variable setup --------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// +/*===- InstrProfilingNameVar.c - profile name variable setup -------------===*\ +|* +|* The LLVM Compiler Infrastructure +|* +|* This file is distributed under the University of Illinois Open Source +|* License. See LICENSE.TXT for details. +|* +\*===----------------------------------------------------------------------===*/ #include "InstrProfiling.h" Modified: head/contrib/llvm/include/llvm/CodeGen/SelectionDAGNodes.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/SelectionDAGNodes.h Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/llvm/include/llvm/CodeGen/SelectionDAGNodes.h Thu Aug 24 20:19:27 2017 (r322855) @@ -85,7 +85,10 @@ namespace ISD { /// If N is a BUILD_VECTOR node whose elements are all the same constant or /// undefined, return true and return the constant value in \p SplatValue. - bool isConstantSplatVector(const SDNode *N, APInt &SplatValue); + /// This sets \p SplatValue to the smallest possible splat unless AllowShrink + /// is set to false. + bool isConstantSplatVector(const SDNode *N, APInt &SplatValue, + bool AllowShrink = true); /// Return true if the specified node is a BUILD_VECTOR where all of the /// elements are ~0 or undef. Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h Thu Aug 24 20:19:27 2017 (r322855) @@ -627,6 +627,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer { (priv SDValue ScalarizeVecOp_CONCAT_VECTORS(SDNode *N); SDValue ScalarizeVecOp_EXTRACT_VECTOR_ELT(SDNode *N); SDValue ScalarizeVecOp_VSELECT(SDNode *N); + SDValue ScalarizeVecOp_VSETCC(SDNode *N); SDValue ScalarizeVecOp_STORE(StoreSDNode *N, unsigned OpNo); SDValue ScalarizeVecOp_FP_ROUND(SDNode *N, unsigned OpNo); Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Thu Aug 24 20:19:27 2017 (r322855) @@ -484,6 +484,9 @@ bool DAGTypeLegalizer::ScalarizeVectorOperand(SDNode * case ISD::VSELECT: Res = ScalarizeVecOp_VSELECT(N); break; + case ISD::SETCC: + Res = ScalarizeVecOp_VSETCC(N); + break; case ISD::STORE: Res = ScalarizeVecOp_STORE(cast(N), OpNo); break; @@ -558,6 +561,36 @@ SDValue DAGTypeLegalizer::ScalarizeVecOp_VSELECT(SDNod return DAG.getNode(ISD::SELECT, SDLoc(N), VT, ScalarCond, N->getOperand(1), N->getOperand(2)); +} + +/// If the operand is a vector that needs to be scalarized then the +/// result must be v1i1, so just convert to a scalar SETCC and wrap +/// with a scalar_to_vector since the res type is legal if we got here +SDValue DAGTypeLegalizer::ScalarizeVecOp_VSETCC(SDNode *N) { + assert(N->getValueType(0).isVector() && + N->getOperand(0).getValueType().isVector() && + "Operand types must be vectors"); + assert(N->getValueType(0) == MVT::v1i1 && "Expected v1i1 type"); + + EVT VT = N->getValueType(0); + SDValue LHS = GetScalarizedVector(N->getOperand(0)); + SDValue RHS = GetScalarizedVector(N->getOperand(1)); + + EVT OpVT = N->getOperand(0).getValueType(); + EVT NVT = VT.getVectorElementType(); + SDLoc DL(N); + // Turn it into a scalar SETCC. + SDValue Res = DAG.getNode(ISD::SETCC, DL, MVT::i1, LHS, RHS, + N->getOperand(2)); + + // Vectors may have a different boolean contents to scalars. Promote the + // value appropriately. + ISD::NodeType ExtendCode = + TargetLowering::getExtendForContent(TLI.getBooleanContents(OpVT)); + + Res = DAG.getNode(ExtendCode, DL, NVT, Res); + + return DAG.getNode(ISD::SCALAR_TO_VECTOR, DL, VT, Res); } /// If the value to store is a vector that needs to be scalarized, it must be Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Aug 24 20:19:27 2017 (r322855) @@ -116,7 +116,8 @@ bool ConstantFPSDNode::isValueValidForType(EVT VT, // ISD Namespace //===----------------------------------------------------------------------===// -bool ISD::isConstantSplatVector(const SDNode *N, APInt &SplatVal) { +bool ISD::isConstantSplatVector(const SDNode *N, APInt &SplatVal, + bool AllowShrink) { auto *BV = dyn_cast(N); if (!BV) return false; @@ -124,9 +125,11 @@ bool ISD::isConstantSplatVector(const SDNode *N, APInt APInt SplatUndef; unsigned SplatBitSize; bool HasUndefs; - EVT EltVT = N->getValueType(0).getVectorElementType(); - return BV->isConstantSplat(SplatVal, SplatUndef, SplatBitSize, HasUndefs) && - EltVT.getSizeInBits() >= SplatBitSize; + unsigned EltSize = N->getValueType(0).getVectorElementType().getSizeInBits(); + unsigned MinSplatBits = AllowShrink ? 0 : EltSize; + return BV->isConstantSplat(SplatVal, SplatUndef, SplatBitSize, HasUndefs, + MinSplatBits) && + EltSize >= SplatBitSize; } // FIXME: AllOnes and AllZeros duplicate a lot of code. Could these be Modified: head/contrib/llvm/lib/IR/AutoUpgrade.cpp ============================================================================== --- head/contrib/llvm/lib/IR/AutoUpgrade.cpp Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/llvm/lib/IR/AutoUpgrade.cpp Thu Aug 24 20:19:27 2017 (r322855) @@ -2239,14 +2239,14 @@ bool llvm::UpgradeDebugInfo(Module &M) { } bool llvm::UpgradeModuleFlags(Module &M) { - const NamedMDNode *ModFlags = M.getModuleFlagsMetadata(); + NamedMDNode *ModFlags = M.getModuleFlagsMetadata(); if (!ModFlags) return false; - bool HasObjCFlag = false, HasClassProperties = false; + bool HasObjCFlag = false, HasClassProperties = false, Changed = false; for (unsigned I = 0, E = ModFlags->getNumOperands(); I != E; ++I) { MDNode *Op = ModFlags->getOperand(I); - if (Op->getNumOperands() < 2) + if (Op->getNumOperands() != 3) continue; MDString *ID = dyn_cast_or_null(Op->getOperand(1)); if (!ID) @@ -2255,7 +2255,24 @@ bool llvm::UpgradeModuleFlags(Module &M) { HasObjCFlag = true; if (ID->getString() == "Objective-C Class Properties") HasClassProperties = true; + // Upgrade PIC/PIE Module Flags. The module flag behavior for these two + // field was Error and now they are Max. + if (ID->getString() == "PIC Level" || ID->getString() == "PIE Level") { + if (auto *Behavior = + mdconst::dyn_extract_or_null(Op->getOperand(0))) { + if (Behavior->getLimitedValue() == Module::Error) { + Type *Int32Ty = Type::getInt32Ty(M.getContext()); + Metadata *Ops[3] = { + ConstantAsMetadata::get(ConstantInt::get(Int32Ty, Module::Max)), + MDString::get(M.getContext(), ID->getString()), + Op->getOperand(2)}; + ModFlags->setOperand(I, MDNode::get(M.getContext(), Ops)); + Changed = true; + } + } + } } + // "Objective-C Class Properties" is recently added for Objective-C. We // upgrade ObjC bitcodes to contain a "Objective-C Class Properties" module // flag of value 0, so we can correclty downgrade this flag when trying to @@ -2264,9 +2281,10 @@ bool llvm::UpgradeModuleFlags(Module &M) { if (HasObjCFlag && !HasClassProperties) { M.addModuleFlag(llvm::Module::Override, "Objective-C Class Properties", (uint32_t)0); - return true; + Changed = true; } - return false; + + return Changed; } static bool isOldLoopArgument(Metadata *MD) { Modified: head/contrib/llvm/lib/Object/COFFModuleDefinition.cpp ============================================================================== --- head/contrib/llvm/lib/Object/COFFModuleDefinition.cpp Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/llvm/lib/Object/COFFModuleDefinition.cpp Thu Aug 24 20:19:27 2017 (r322855) @@ -232,7 +232,13 @@ class Parser { (private) for (;;) { read(); if (Tok.K == Identifier && Tok.Value[0] == '@') { - Tok.Value.drop_front().getAsInteger(10, E.Ordinal); + if (Tok.Value.drop_front().getAsInteger(10, E.Ordinal)) { + // Not an ordinal modifier at all, but the next export (fastcall + // decorated) - complete the current one. + unget(); + Info.Exports.push_back(E); + return Error::success(); + } read(); if (Tok.K == KwNoname) { E.Noname = true; Modified: head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Thu Aug 24 20:19:27 2017 (r322855) @@ -5901,7 +5901,10 @@ static bool isVUZPMask(ArrayRef M, EVT VT, unsign return false; for (unsigned i = 0; i < M.size(); i += NumElts) { - WhichResult = M[i] == 0 ? 0 : 1; + if (M.size() == NumElts * 2) + WhichResult = i / NumElts; + else + WhichResult = M[i] == 0 ? 0 : 1; for (unsigned j = 0; j < NumElts; ++j) { if (M[i+j] >= 0 && (unsigned) M[i+j] != 2 * j + WhichResult) return false; @@ -5932,7 +5935,10 @@ static bool isVUZP_v_undef_Mask(ArrayRef M, EVT V unsigned Half = NumElts / 2; for (unsigned i = 0; i < M.size(); i += NumElts) { - WhichResult = M[i] == 0 ? 0 : 1; + if (M.size() == NumElts * 2) + WhichResult = i / NumElts; + else + WhichResult = M[i] == 0 ? 0 : 1; for (unsigned j = 0; j < NumElts; j += Half) { unsigned Idx = WhichResult; for (unsigned k = 0; k < Half; ++k) { @@ -5972,7 +5978,10 @@ static bool isVZIPMask(ArrayRef M, EVT VT, unsign return false; for (unsigned i = 0; i < M.size(); i += NumElts) { - WhichResult = M[i] == 0 ? 0 : 1; + if (M.size() == NumElts * 2) + WhichResult = i / NumElts; + else + WhichResult = M[i] == 0 ? 0 : 1; unsigned Idx = WhichResult * NumElts / 2; for (unsigned j = 0; j < NumElts; j += 2) { if ((M[i+j] >= 0 && (unsigned) M[i+j] != Idx) || @@ -6005,7 +6014,10 @@ static bool isVZIP_v_undef_Mask(ArrayRef M, EVT V return false; for (unsigned i = 0; i < M.size(); i += NumElts) { - WhichResult = M[i] == 0 ? 0 : 1; + if (M.size() == NumElts * 2) + WhichResult = i / NumElts; + else + WhichResult = M[i] == 0 ? 0 : 1; unsigned Idx = WhichResult * NumElts / 2; for (unsigned j = 0; j < NumElts; j += 2) { if ((M[i+j] >= 0 && (unsigned) M[i+j] != Idx) || @@ -8793,6 +8805,8 @@ ARMTargetLowering::EmitLowered__chkstk(MachineInstr &M .addReg(ARM::R4, RegState::Implicit | RegState::Kill) .addReg(ARM::R4, RegState::Implicit | RegState::Define) .addReg(ARM::R12, + RegState::Implicit | RegState::Define | RegState::Dead) + .addReg(ARM::CPSR, RegState::Implicit | RegState::Define | RegState::Dead); break; case CodeModel::Large: @@ -8808,6 +8822,8 @@ ARMTargetLowering::EmitLowered__chkstk(MachineInstr &M .addReg(ARM::R4, RegState::Implicit | RegState::Kill) .addReg(ARM::R4, RegState::Implicit | RegState::Define) .addReg(ARM::R12, + RegState::Implicit | RegState::Define | RegState::Dead) + .addReg(ARM::CPSR, RegState::Implicit | RegState::Define | RegState::Dead); break; } Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Thu Aug 24 20:19:27 2017 (r322855) @@ -29540,8 +29540,9 @@ static bool detectZextAbsDiff(const SDValue &Select, S // In SetLT case, The second operand of the comparison can be either 1 or 0. APInt SplatVal; if ((CC == ISD::SETLT) && - !((ISD::isConstantSplatVector(SetCC.getOperand(1).getNode(), SplatVal) && - SplatVal == 1) || + !((ISD::isConstantSplatVector(SetCC.getOperand(1).getNode(), SplatVal, + /*AllowShrink*/false) && + SplatVal.isOneValue()) || (ISD::isBuildVectorAllZeros(SetCC.getOperand(1).getNode())))) return false; @@ -30628,6 +30629,9 @@ static SDValue combineSelect(SDNode *N, SelectionDAG & // Byte blends are only available in AVX2 if (VT == MVT::v32i8 && !Subtarget.hasAVX2()) return SDValue(); + // There are no 512-bit blend instructions that use sign bits. + if (VT.is512BitVector()) + return SDValue(); assert(BitWidth >= 8 && BitWidth <= 64 && "Invalid mask size"); APInt DemandedMask(APInt::getSignMask(BitWidth)); @@ -32058,7 +32062,8 @@ static SDValue combineAndMaskToShift(SDNode *N, Select return SDValue(); APInt SplatVal; - if (!ISD::isConstantSplatVector(Op1.getNode(), SplatVal) || + if (!ISD::isConstantSplatVector(Op1.getNode(), SplatVal, + /*AllowShrink*/false) || !SplatVal.isMask()) return SDValue(); @@ -32642,7 +32647,8 @@ static SDValue detectUSatPattern(SDValue In, EVT VT) { "Unexpected types for truncate operation"); APInt C; - if (ISD::isConstantSplatVector(In.getOperand(1).getNode(), C)) { + if (ISD::isConstantSplatVector(In.getOperand(1).getNode(), C, + /*AllowShrink*/false)) { // C should be equal to UINT32_MAX / UINT16_MAX / UINT8_MAX according // the element size of the destination type. return C.isMask(VT.getScalarSizeInBits()) ? In.getOperand(0) : @@ -35346,7 +35352,8 @@ static SDValue combineIncDecVector(SDNode *N, Selectio SDNode *N1 = N->getOperand(1).getNode(); APInt SplatVal; - if (!ISD::isConstantSplatVector(N1, SplatVal) || !SplatVal.isOneValue()) + if (!ISD::isConstantSplatVector(N1, SplatVal, /*AllowShrink*/false) || + !SplatVal.isOneValue()) return SDValue(); SDValue AllOnesVec = getOnesVector(VT, DAG, SDLoc(N)); Modified: head/contrib/llvm/lib/Target/X86/X86InstrAVX512.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrAVX512.td Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/llvm/lib/Target/X86/X86InstrAVX512.td Thu Aug 24 20:19:27 2017 (r322855) @@ -3619,8 +3619,8 @@ let Predicates = [HasVLX] in { def : Pat<(alignedstore256 (v4f64 (extract_subvector (v8f64 VR512:$src), (iPTR 0))), addr:$dst), (VMOVAPDZ256mr addr:$dst, (v4f64 (EXTRACT_SUBREG VR512:$src,sub_ymm)))>; - def : Pat<(alignedstore (v8f32 (extract_subvector - (v16f32 VR512:$src), (iPTR 0))), addr:$dst), + def : Pat<(alignedstore256 (v8f32 (extract_subvector + (v16f32 VR512:$src), (iPTR 0))), addr:$dst), (VMOVAPSZ256mr addr:$dst, (v8f32 (EXTRACT_SUBREG VR512:$src,sub_ymm)))>; def : Pat<(alignedstore256 (v4i64 (extract_subvector (v8i64 VR512:$src), (iPTR 0))), addr:$dst), Modified: head/contrib/llvm/lib/Target/X86/X86SchedSandyBridge.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86SchedSandyBridge.td Thu Aug 24 19:48:41 2017 (r322854) +++ head/contrib/llvm/lib/Target/X86/X86SchedSandyBridge.td Thu Aug 24 20:19:27 2017 (r322855) @@ -24,8 +24,8 @@ def SandyBridgeModel : SchedMachineModel { // Based on the LSD (loop-stream detector) queue size. let LoopMicroOpBufferSize = 28; - // This flag is set to allow the scheduler to assign - // a default model to unrecognized opcodes. + // FIXME: SSE4 and AVX are unimplemented. This flag is set to allow + // the scheduler to assign a default model to unrecognized opcodes. let CompleteModel = 0; } @@ -48,7 +48,6 @@ def SBPort23 : ProcResource<2>; def SBPort4 : ProcResource<1>; // Many micro-ops are capable of issuing on multiple ports. -def SBPort01 : ProcResGroup<[SBPort0, SBPort1]>; def SBPort05 : ProcResGroup<[SBPort0, SBPort5]>; def SBPort15 : ProcResGroup<[SBPort1, SBPort5]>; def SBPort015 : ProcResGroup<[SBPort0, SBPort1, SBPort5]>; @@ -116,10 +115,10 @@ def : WriteRes; defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; // 10-14 cycles. defm : SBWriteResPair; defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; defm : SBWriteResPair; defm : SBWriteResPair; defm : SBWriteResPair; @@ -135,11 +134,11 @@ def : WriteRes; -defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; +defm : SBWriteResPair; +defm : SBWriteResPair; defm : SBWriteResPair; -defm : SBWriteResPair; +defm : SBWriteResPair; defm : SBWriteResPair; def : WriteRes { let Latency = 2; @@ -149,15 +148,13 @@ def : WriteRes { - let Latency = 5; - let NumMicroOps = 3; - let ResourceCycles = [1,2]; +def : WriteRes { + let Latency = 6; + let ResourceCycles = [1, 1, 1]; } -def : WriteRes { - let Latency = 11; - let NumMicroOps = 4; - let ResourceCycles = [1,1,2]; +def : WriteRes { + let Latency = 6; + let ResourceCycles = [1, 1, 1, 1]; } //////////////////////////////////////////////////////////////////////////////// @@ -207,15 +204,13 @@ def : WriteRes { - let Latency = 11; - let NumMicroOps = 3; +def : WriteRes { + let Latency = 3; let ResourceCycles = [3]; } -def : WriteRes { - let Latency = 17; - let NumMicroOps = 4; - let ResourceCycles = [3,1]; +def : WriteRes { + let Latency = 3; + let ResourceCycles = [3, 1]; } // Packed Compare Explicit Length Strings, Return Index @@ -229,26 +224,22 @@ def : WriteRes { - let Latency = 7; - let NumMicroOps = 2; - let ResourceCycles = [1,1]; +def : WriteRes { + let Latency = 8; + let ResourceCycles = [2]; } -def : WriteRes { - let Latency = 13; - let NumMicroOps = 3; - let ResourceCycles = [1,1,1]; +def : WriteRes { + let Latency = 8; + let ResourceCycles = [2, 1]; } -def : WriteRes { - let Latency = 12; - let NumMicroOps = 2; +def : WriteRes { + let Latency = 8; let ResourceCycles = [2]; } -def : WriteRes { - let Latency = 18; - let NumMicroOps = 3; - let ResourceCycles = [2,1]; +def : WriteRes { + let Latency = 8; + let ResourceCycles = [2, 1]; } def : WriteRes { @@ -281,2407 +272,4 @@ def : WriteRes; defm : SBWriteResPair; defm : SBWriteResPair; defm : SBWriteResPair; - -// Remaining SNB instrs. - -def SBWriteResGroup0 : SchedWriteRes<[SBPort0]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup0], (instregex "CVTSS2SDrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSLLDri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSLLQri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSLLWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSRADri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSRAWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSRLDri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSRLQri")>; -def: InstRW<[SBWriteResGroup0], (instregex "PSRLWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VCVTSS2SDrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPMOVMSKBrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSLLDri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSLLQri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSLLWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSRADri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSRAWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSRLDri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSRLQri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VPSRLWri")>; -def: InstRW<[SBWriteResGroup0], (instregex "VTESTPDYrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "VTESTPDrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "VTESTPSYrr")>; -def: InstRW<[SBWriteResGroup0], (instregex "VTESTPSrr")>; - -def SBWriteResGroup1 : SchedWriteRes<[SBPort1]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup1], (instregex "COMP_FST0r")>; -def: InstRW<[SBWriteResGroup1], (instregex "COM_FST0r")>; -def: InstRW<[SBWriteResGroup1], (instregex "UCOM_FPr")>; -def: InstRW<[SBWriteResGroup1], (instregex "UCOM_Fr")>; - -def SBWriteResGroup2 : SchedWriteRes<[SBPort5]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup2], (instregex "ANDNPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ANDNPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ANDPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ANDPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "FDECSTP")>; -def: InstRW<[SBWriteResGroup2], (instregex "FFREE")>; -def: InstRW<[SBWriteResGroup2], (instregex "FINCSTP")>; -def: InstRW<[SBWriteResGroup2], (instregex "FNOP")>; -def: InstRW<[SBWriteResGroup2], (instregex "INSERTPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "JMP64r")>; -def: InstRW<[SBWriteResGroup2], (instregex "LD_Frr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOV64toPQIrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVAPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVAPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVDDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVDI2PDIrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVHLPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVLHPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVSDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVSHDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVSLDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVSSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVUPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "MOVUPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ORPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ORPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "RETQ")>; -def: InstRW<[SBWriteResGroup2], (instregex "SHUFPDrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "SHUFPSrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "ST_FPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "ST_Frr")>; -def: InstRW<[SBWriteResGroup2], (instregex "UNPCKHPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "UNPCKHPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "UNPCKLPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "UNPCKLPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDNPDYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDNPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDNPSYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDNPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VANDPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VEXTRACTF128rr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VINSERTF128rr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VINSERTPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOV64toPQIrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOV64toPQIrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVAPDYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVAPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVAPSYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVAPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVDDUPYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVDDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVHLPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVHLPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSHDUPYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSHDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSLDUPYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSLDUPrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVSSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVUPDYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVUPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVUPSYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VMOVUPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VORPDYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VORPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VORPSYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VORPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPDri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPDrm")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPSri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPSrm")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VPERMILPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VSHUFPDYrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VSHUFPDrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VSHUFPSYrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VSHUFPSrri")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKHPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKHPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKLPDYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKLPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKLPSYrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VUNPCKLPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VXORPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "VXORPSrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "XORPDrr")>; -def: InstRW<[SBWriteResGroup2], (instregex "XORPSrr")>; - -def SBWriteResGroup3 : SchedWriteRes<[SBPort01]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup3], (instregex "LEA64_32r")>; - -def SBWriteResGroup4 : SchedWriteRes<[SBPort0]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup4], (instregex "BLENDPDrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "BLENDPSrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "BT32ri8")>; -def: InstRW<[SBWriteResGroup4], (instregex "BT32rr")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTC32ri8")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTC32rr")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTR32ri8")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTR32rr")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTS32ri8")>; -def: InstRW<[SBWriteResGroup4], (instregex "BTS32rr")>; -def: InstRW<[SBWriteResGroup4], (instregex "CDQ")>; -def: InstRW<[SBWriteResGroup4], (instregex "CQO")>; -def: InstRW<[SBWriteResGroup4], (instregex "LAHF")>; -def: InstRW<[SBWriteResGroup4], (instregex "SAHF")>; -def: InstRW<[SBWriteResGroup4], (instregex "SAR32ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "SAR8ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETAEr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETBr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETEr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETGEr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETGr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETLEr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETLr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETNEr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETNOr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETNPr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETNSr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETOr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETPr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SETSr")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHL32ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHL64r1")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHL8r1")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHL8ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHR32ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "SHR8ri")>; -def: InstRW<[SBWriteResGroup4], (instregex "VBLENDPDYrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "VBLENDPDrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "VBLENDPSYrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "VBLENDPSrri")>; -def: InstRW<[SBWriteResGroup4], (instregex "VMOVDQAYrr")>; -def: InstRW<[SBWriteResGroup4], (instregex "VMOVDQArr")>; -def: InstRW<[SBWriteResGroup4], (instregex "VMOVDQUYrr")>; -def: InstRW<[SBWriteResGroup4], (instregex "VMOVDQUrr")>; - -def SBWriteResGroup5 : SchedWriteRes<[SBPort15]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup5], (instregex "KORTESTBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PABSBrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PABSDrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PABSWrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PADDQirr")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PALIGNR64irr")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PSHUFBrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PSIGNBrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PSIGNDrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "MMX_PSIGNWrr64")>; -def: InstRW<[SBWriteResGroup5], (instregex "PABSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PABSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PABSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PACKSSDWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PACKSSWBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PACKUSDWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PACKUSWBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDUSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDUSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PADDWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PALIGNRrri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PAVGBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PAVGWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PBLENDWrri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPEQBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPEQDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPEQQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPEQWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPGTBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPGTDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PCMPGTWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXUBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXUDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMAXUWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINUBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINUDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMINUWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVSXWQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PMOVZXWQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSHUFBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSHUFDri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSHUFHWri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSHUFLWri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSIGNBrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSIGNDrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSIGNWrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSLLDQri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSRLDQri")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBUSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBUSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PSUBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKHBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKHDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKHQDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKHWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKLBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKLDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKLQDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "PUNPCKLWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VMASKMOVPSYrm")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPABSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPABSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPABSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPACKSSDWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPACKSSWBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPACKUSDWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPACKUSWBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPADDBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPADDDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPADDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPADDUSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPADDUSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPALIGNRrri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPAVGBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPAVGWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPBLENDWrri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPEQBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPEQDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPEQWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPGTBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPGTDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPCMPGTWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXUBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXUDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMAXUWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINSDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINUBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINUDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMINUWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVSXWQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPMOVZXWQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSHUFBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSHUFDri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSHUFLWri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSIGNBrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSIGNDrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSIGNWrr128")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSLLDQri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSRLDQri")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBUSBrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBUSWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPSUBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKHBWrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKHDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKHWDrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKLDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKLQDQrr")>; -def: InstRW<[SBWriteResGroup5], (instregex "VPUNPCKLWDrr")>; - -def SBWriteResGroup6 : SchedWriteRes<[SBPort015]> { - let Latency = 1; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup6], (instregex "ADD32ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "ADD32rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "ADD8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "ADD8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "AND32ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "AND64ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "AND64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "AND8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "AND8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "CBW")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMC")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMP16ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMP32i32")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMP64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMP8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "CMP8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "CWDE")>; -def: InstRW<[SBWriteResGroup6], (instregex "DEC64r")>; -def: InstRW<[SBWriteResGroup6], (instregex "DEC8r")>; -def: InstRW<[SBWriteResGroup6], (instregex "INC64r")>; -def: InstRW<[SBWriteResGroup6], (instregex "INC8r")>; -def: InstRW<[SBWriteResGroup6], (instregex "MMX_MOVD64from64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MMX_MOVQ2DQrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOV32rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOV8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOV8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVDQArr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVDQUrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVPQI2QIrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVSX32rr16")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVSX32rr8")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVZX32rr16")>; -def: InstRW<[SBWriteResGroup6], (instregex "MOVZX32rr8")>; -def: InstRW<[SBWriteResGroup6], (instregex "NEG64r")>; -def: InstRW<[SBWriteResGroup6], (instregex "NEG8r")>; -def: InstRW<[SBWriteResGroup6], (instregex "NOT64r")>; -def: InstRW<[SBWriteResGroup6], (instregex "NOT8r")>; -def: InstRW<[SBWriteResGroup6], (instregex "OR64ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "OR64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "OR8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "OR8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "PANDNrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "PANDrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "PORrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "PXORrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "STC")>; -def: InstRW<[SBWriteResGroup6], (instregex "SUB64ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "SUB64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "SUB8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "SUB8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "TEST64rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "TEST8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "TEST8rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VMOVPQI2QIrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VMOVZPQILo2PQIrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VPANDNrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VPANDrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VPORrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "VPXORrr")>; -def: InstRW<[SBWriteResGroup6], (instregex "XOR32rr")>; -def: InstRW<[SBWriteResGroup6], (instregex "XOR64ri8")>; -def: InstRW<[SBWriteResGroup6], (instregex "XOR8ri")>; -def: InstRW<[SBWriteResGroup6], (instregex "XOR8rr")>; - -def SBWriteResGroup7 : SchedWriteRes<[SBPort0]> { - let Latency = 2; - let NumMicroOps = 1; - let ResourceCycles = [1]; -} -def: InstRW<[SBWriteResGroup7], (instregex "MOVMSKPDrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "MOVMSKPSrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "MOVPDI2DIrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "MOVPQIto64rr")>; -def: InstRW<[SBWriteResGroup7], (instregex "PMOVMSKBrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "VMOVMSKPDYrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "VMOVMSKPDrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "VMOVMSKPSrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "VMOVPDI2DIrr")>; -def: InstRW<[SBWriteResGroup7], (instregex "VMOVPQIto64rr")>; - -def SBWriteResGroup9 : SchedWriteRes<[SBPort0]> { - let Latency = 2; - let NumMicroOps = 2; - let ResourceCycles = [2]; -} -def: InstRW<[SBWriteResGroup9], (instregex "BLENDVPDrr0")>; -def: InstRW<[SBWriteResGroup9], (instregex "BLENDVPSrr0")>; -def: InstRW<[SBWriteResGroup9], (instregex "ROL32ri")>; -def: InstRW<[SBWriteResGroup9], (instregex "ROL8ri")>; -def: InstRW<[SBWriteResGroup9], (instregex "ROR32ri")>; -def: InstRW<[SBWriteResGroup9], (instregex "ROR8ri")>; -def: InstRW<[SBWriteResGroup9], (instregex "SETAr")>; -def: InstRW<[SBWriteResGroup9], (instregex "SETBEr")>; -def: InstRW<[SBWriteResGroup9], (instregex "VBLENDVPDYrr")>; -def: InstRW<[SBWriteResGroup9], (instregex "VBLENDVPDrr")>; -def: InstRW<[SBWriteResGroup9], (instregex "VBLENDVPSYrr")>; -def: InstRW<[SBWriteResGroup9], (instregex "VBLENDVPSrr")>; - -def SBWriteResGroup10 : SchedWriteRes<[SBPort15]> { - let Latency = 2; - let NumMicroOps = 2; - let ResourceCycles = [2]; -} -def: InstRW<[SBWriteResGroup10], (instregex "VPBLENDVBrr")>; - -def SBWriteResGroup11 : SchedWriteRes<[SBPort015]> { - let Latency = 2; - let NumMicroOps = 2; - let ResourceCycles = [2]; -} -def: InstRW<[SBWriteResGroup11], (instregex "SCASB")>; -def: InstRW<[SBWriteResGroup11], (instregex "SCASL")>; -def: InstRW<[SBWriteResGroup11], (instregex "SCASQ")>; -def: InstRW<[SBWriteResGroup11], (instregex "SCASW")>; - -def SBWriteResGroup12 : SchedWriteRes<[SBPort0,SBPort1]> { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Aug 24 20:49:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2ADBDE7D81; Thu, 24 Aug 2017 20:49:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67C7D6581E; Thu, 24 Aug 2017 20:49:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OKnJwp077695; Thu, 24 Aug 2017 20:49:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OKnJF4077693; Thu, 24 Aug 2017 20:49:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201708242049.v7OKnJF4077693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 24 Aug 2017 20:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322856 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 20:49:20 -0000 Author: glebius Date: Thu Aug 24 20:49:19 2017 New Revision: 322856 URL: https://svnweb.freebsd.org/changeset/base/322856 Log: Third take on the r319685 and r320480. Actually allow for call soisconnected() via soisdisconnected(), and in the earlier unlock earlier to avoid lock recursion. This fixes a situation when a socket on accept queue is reset before being accepted. Reported by: Jason Eggleston Modified: head/sys/kern/uipc_sockbuf.c head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_sockbuf.c ============================================================================== --- head/sys/kern/uipc_sockbuf.c Thu Aug 24 20:19:27 2017 (r322855) +++ head/sys/kern/uipc_sockbuf.c Thu Aug 24 20:49:19 2017 (r322856) @@ -334,7 +334,7 @@ sowakeup(struct socket *so, struct sockbuf *sb) if (sb->sb_flags & SB_AIO) sowakeup_aio(so, sb); SOCKBUF_UNLOCK(sb); - if (ret == SU_ISCONNECTED && !(so->so_state & SS_ISDISCONNECTED)) + if (ret == SU_ISCONNECTED) soisconnected(so); if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL) pgsigio(&so->so_sigio, SIGIO, 0); Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Thu Aug 24 20:19:27 2017 (r322855) +++ head/sys/kern/uipc_socket.c Thu Aug 24 20:49:19 2017 (r322856) @@ -3769,13 +3769,14 @@ soisdisconnected(struct socket *so) so->so_state |= SS_ISDISCONNECTED; if (!SOLISTENING(so)) { + SOCK_UNLOCK(so); SOCKBUF_LOCK(&so->so_rcv); socantrcvmore_locked(so); SOCKBUF_LOCK(&so->so_snd); sbdrop_locked(&so->so_snd, sbused(&so->so_snd)); socantsendmore_locked(so); - } - SOCK_UNLOCK(so); + } else + SOCK_UNLOCK(so); wakeup(&so->so_timeo); } From owner-svn-src-all@freebsd.org Thu Aug 24 20:51:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3E93DE7E0F; Thu, 24 Aug 2017 20:51:17 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFEDD65AE3; Thu, 24 Aug 2017 20:51:17 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OKpG6g080869; Thu, 24 Aug 2017 20:51:16 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OKpGQS080868; Thu, 24 Aug 2017 20:51:16 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708242051.v7OKpGQS080868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 24 Aug 2017 20:51:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322857 - stable/11/etc/periodic/daily X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/11/etc/periodic/daily X-SVN-Commit-Revision: 322857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 20:51:18 -0000 Author: marius Date: Thu Aug 24 20:51:16 2017 New Revision: 322857 URL: https://svnweb.freebsd.org/changeset/base/322857 Log: MFC: r322726 Bring back the much more readable unified format for differences in /etc/{group,master.passwd}. This was originally turned on for all of /etc/{aliases,group,master.passwd} in r55196, but then backed out only for the latter two in r56697, as the adaption of the sed(1)ing done in r56308 was incorrect. This left us with inconsistent diff(1) formats in the daily output of periodic(8) ever since, despite in r56697 having been promised to be revisited. So properly adapt the password hash filtering to the unified format and turn the later on again for /etc/{group,master.passwd}, too. Modified: stable/11/etc/periodic/daily/200.backup-passwd Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/periodic/daily/200.backup-passwd ============================================================================== --- stable/11/etc/periodic/daily/200.backup-passwd Thu Aug 24 20:49:19 2017 (r322856) +++ stable/11/etc/periodic/daily/200.backup-passwd Thu Aug 24 20:51:16 2017 (r322857) @@ -41,8 +41,8 @@ case "$daily_backup_passwd_enable" in then [ $rc -lt 1 ] && rc=1 echo "$host passwd diffs:" - diff -I '^#' $bak/master.passwd.bak /etc/master.passwd |\ - sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/' + diff -uI '^#' $bak/master.passwd.bak /etc/master.passwd |\ + sed 's/^\([-+][^-+:]*\):[^:]*:/\1:(password):/' mv $bak/master.passwd.bak $bak/master.passwd.bak2 cp -p /etc/master.passwd $bak/master.passwd.bak || rc=3 fi @@ -58,7 +58,7 @@ case "$daily_backup_passwd_enable" in then [ $rc -lt 1 ] && rc=1 echo "$host group diffs:" - diff $bak/group.bak /etc/group + diff -u $bak/group.bak /etc/group mv $bak/group.bak $bak/group.bak2 cp -p /etc/group $bak/group.bak || rc=3 fi From owner-svn-src-all@freebsd.org Thu Aug 24 20:52:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01E15DE7F89; Thu, 24 Aug 2017 20:52:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF93D65C91; Thu, 24 Aug 2017 20:52:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OKq3Kl080944; Thu, 24 Aug 2017 20:52:03 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OKq3kk080943; Thu, 24 Aug 2017 20:52:03 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201708242052.v7OKq3kk080943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 24 Aug 2017 20:52:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322858 - head/tools/regression/sockets/accf_data_attach X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/tools/regression/sockets/accf_data_attach X-SVN-Commit-Revision: 322858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 20:52:04 -0000 Author: glebius Date: Thu Aug 24 20:52:02 2017 New Revision: 322858 URL: https://svnweb.freebsd.org/changeset/base/322858 Log: Add a test case for a connection on accept queue that is reset before it is accepted. In that case accept(2) shall return ECONNABORTED. Accept filters provide help with easily replicating that case. Modified: head/tools/regression/sockets/accf_data_attach/accf_data_attach.c Modified: head/tools/regression/sockets/accf_data_attach/accf_data_attach.c ============================================================================== --- head/tools/regression/sockets/accf_data_attach/accf_data_attach.c Thu Aug 24 20:51:16 2017 (r322857) +++ head/tools/regression/sockets/accf_data_attach/accf_data_attach.c Thu Aug 24 20:52:02 2017 (r322858) @@ -64,6 +64,7 @@ main(void) { struct accept_filter_arg afa; struct sockaddr_in sin; + struct linger linger; socklen_t len; int lso, so, i, ret; @@ -231,8 +232,32 @@ main(void) usleep(10000); if (accept(lso, NULL, 0) < 1) errx(-1, "not ok 11 - accept #2 %s", strerror(errno)); + if (close(so) != 0) + errx(-1, "not ok 11 - close(): %s", strerror(errno)); printf("ok 11 - accept\n"); + /* + * Step 12: reset connection before accept filter allows it. + * In this case the connection must make it to the listen + * queue, but with ECONNABORTED code. + */ + so = socket(PF_INET, SOCK_STREAM, 0); + if (so == -1) + errx(-1, "not ok 12 - socket: %s", strerror(errno)); + if (connect(so, (struct sockaddr *)&sin, sizeof(sin)) < 0) + errx(-1, "not ok 12 - connect %s", strerror(errno)); + linger.l_onoff = 1; + linger.l_linger = 0; + ret = setsockopt(so, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger)); + if (ret != 0) + errx(-1, "not ok 12 - setsockopt(SO_LINGER) failed with %d " + "(%s)", errno, strerror(errno)); + if (close(so) != 0) + errx(-1, "not ok 12 - close(): %s", strerror(errno)); + if (accept(lso, NULL, 0) != -1 && errno != ECONNABORTED) + errx(-1, "not ok 12 - accept #3 %s", strerror(errno)); + printf("ok 12 - accept\n"); + #if 1 /* * XXXGL: this doesn't belong to the test itself, but is known @@ -242,31 +267,33 @@ main(void) */ so = socket(PF_INET, SOCK_STREAM, 0); if (so == -1) - errx(-1, "not ok 12 - socket: %s", strerror(errno)); + errx(-1, "not ok 13 - socket: %s", strerror(errno)); if (connect(so, (struct sockaddr *)&sin, sizeof(sin)) < 0) - errx(-1, "not ok 12 - connect %s", strerror(errno)); + errx(-1, "not ok 13 - connect %s", strerror(errno)); #endif /* - * Step 11: Remove accept filter. After removing the accept filter + * Step 12: Remove accept filter. After removing the accept filter * getsockopt() should fail with EINVAL. */ ret = setsockopt(lso, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0); if (ret != 0) - errx(-1, "not ok 12 - setsockopt() after listen() " + errx(-1, "not ok 13 - setsockopt() after listen() " "failed with %d (%s)", errno, strerror(errno)); bzero(&afa, sizeof(afa)); len = sizeof(afa); ret = getsockopt(lso, SOL_SOCKET, SO_ACCEPTFILTER, &afa, &len); if (ret == 0) - errx(-1, "not ok 12 - getsockopt() after removing " + errx(-1, "not ok 13 - getsockopt() after removing " "the accept filter returns valid accept filter %s", afa.af_name); if (errno != EINVAL) - errx(-1, "not ok 12 - getsockopt() after removing the accept" + errx(-1, "not ok 13 - getsockopt() after removing the accept" "filter failed with %d (%s)", errno, strerror(errno)); - printf("ok 12 - setsockopt\n"); + if (close(lso) != 0) + errx(-1, "not ok 13 - close() of listening socket: %s", + strerror(errno)); + printf("ok 13 - setsockopt\n"); - close(lso); return (0); } From owner-svn-src-all@freebsd.org Thu Aug 24 20:52:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B9D8DE7FD4; Thu, 24 Aug 2017 20:52:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33BF565E11; Thu, 24 Aug 2017 20:52:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OKqS0w081682; Thu, 24 Aug 2017 20:52:28 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OKqSt9081681; Thu, 24 Aug 2017 20:52:28 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708242052.v7OKqSt9081681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 24 Aug 2017 20:52:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322859 - stable/10/etc/periodic/daily X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/etc/periodic/daily X-SVN-Commit-Revision: 322859 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 20:52:29 -0000 Author: marius Date: Thu Aug 24 20:52:28 2017 New Revision: 322859 URL: https://svnweb.freebsd.org/changeset/base/322859 Log: MFC: r322726 Bring back the much more readable unified format for differences in /etc/{group,master.passwd}. This was originally turned on for all of /etc/{aliases,group,master.passwd} in r55196, but then backed out only for the latter two in r56697, as the adaption of the sed(1)ing done in r56308 was incorrect. This left us with inconsistent diff(1) formats in the daily output of periodic(8) ever since, despite in r56697 having been promised to be revisited. So properly adapt the password hash filtering to the unified format and turn the later on again for /etc/{group,master.passwd}, too. Approved by: re (kib) Modified: stable/10/etc/periodic/daily/200.backup-passwd Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/periodic/daily/200.backup-passwd ============================================================================== --- stable/10/etc/periodic/daily/200.backup-passwd Thu Aug 24 20:52:02 2017 (r322858) +++ stable/10/etc/periodic/daily/200.backup-passwd Thu Aug 24 20:52:28 2017 (r322859) @@ -41,8 +41,8 @@ case "$daily_backup_passwd_enable" in then [ $rc -lt 1 ] && rc=1 echo "$host passwd diffs:" - diff -I '^#' $bak/master.passwd.bak /etc/master.passwd |\ - sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/' + diff -uI '^#' $bak/master.passwd.bak /etc/master.passwd |\ + sed 's/^\([-+][^-+:]*\):[^:]*:/\1:(password):/' mv $bak/master.passwd.bak $bak/master.passwd.bak2 cp -p /etc/master.passwd $bak/master.passwd.bak || rc=3 fi @@ -58,7 +58,7 @@ case "$daily_backup_passwd_enable" in then [ $rc -lt 1 ] && rc=1 echo "$host group diffs:" - diff $bak/group.bak /etc/group + diff -u $bak/group.bak /etc/group mv $bak/group.bak $bak/group.bak2 cp -p /etc/group $bak/group.bak || rc=3 fi From owner-svn-src-all@freebsd.org Thu Aug 24 21:44:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 768E9DE8B02; Thu, 24 Aug 2017 21:44:25 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 405DC6719B; Thu, 24 Aug 2017 21:44:25 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OLiOvU002186; Thu, 24 Aug 2017 21:44:24 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OLiNSI002175; Thu, 24 Aug 2017 21:44:23 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708242144.v7OLiNSI002175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 24 Aug 2017 21:44:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322860 - in stable/10: sbin/fsck_ffs sbin/fsirand sbin/newfs sbin/newfs_msdos share/man/man4 sys/geom sys/sys sys/ufs/ffs X-SVN-Group: stable-10 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in stable/10: sbin/fsck_ffs sbin/fsirand sbin/newfs sbin/newfs_msdos share/man/man4 sys/geom sys/sys sys/ufs/ffs X-SVN-Commit-Revision: 322860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 21:44:25 -0000 Author: mckusick Date: Thu Aug 24 21:44:23 2017 New Revision: 322860 URL: https://svnweb.freebsd.org/changeset/base/322860 Log: MFC of 276737, 322200, 322201, 322271, and 322297 276737: Remove old ioctl use and support 322200: Remove (broken) search for alternate superblocks 322201: Show differences when alternate superblock fails to match 322271: Cleanup for 322200. 322297: Restore fsck_ffs ability to find alternate superblocks Discussed with: kib, imp Differential Revision: https://reviews.freebsd.org/D11589 Approved by: re (kib) Modified: stable/10/sbin/fsck_ffs/setup.c stable/10/sbin/fsirand/fsirand.c stable/10/sbin/newfs/mkfs.c stable/10/sbin/newfs/newfs.c stable/10/sbin/newfs_msdos/newfs_msdos.c stable/10/share/man/man4/cd.4 stable/10/share/man/man4/mcd.4 stable/10/sys/geom/geom_bsd.c stable/10/sys/sys/disklabel.h stable/10/sys/ufs/ffs/fs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fsck_ffs/setup.c ============================================================================== --- stable/10/sbin/fsck_ffs/setup.c Thu Aug 24 20:52:28 2017 (r322859) +++ stable/10/sbin/fsck_ffs/setup.c Thu Aug 24 21:44:23 2017 (r322860) @@ -58,9 +58,9 @@ struct bufarea asblk; #define altsblock (*asblk.b_un.b_fs) #define POWEROF2(num) (((num) & ((num) - 1)) == 0) -static void badsb(int listerr, const char *s); static int calcsb(char *dev, int devfd, struct fs *fs); -static struct disklabel *getdisklabel(char *s, int fd); +static void saverecovery(int readfd, int writefd); +static int chkrecovery(int devfd); /* * Read in a superblock finding an alternate if necessary. @@ -236,6 +236,10 @@ setup(char *dev) memmove(&altsblock, &sblock, (size_t)sblock.fs_sbsize); flush(fswritefd, &asblk); } + if (preen == 0 && yflag == 0 && sblock.fs_magic == FS_UFS2_MAGIC && + fswritefd != -1 && chkrecovery(fsreadfd) == 0 && + reply("SAVE DATA TO FIND ALTERNATE SUPERBLOCKS") != 0) + saverecovery(fsreadfd, fswritefd); /* * read in the summary info. */ @@ -319,7 +323,7 @@ int readsb(int listerr) { ufs2_daddr_t super; - int i; + int i, bad; if (bflag) { super = bflag; @@ -369,40 +373,57 @@ readsb(int listerr) dev_bsize = sblock.fs_fsize / fsbtodb(&sblock, 1); sblk.b_bno = super / dev_bsize; sblk.b_size = SBLOCKSIZE; - if (bflag) - goto out; /* * Compare all fields that should not differ in alternate super block. * When an alternate super-block is specified this check is skipped. */ + if (bflag) + goto out; getblk(&asblk, cgsblock(&sblock, sblock.fs_ncg - 1), sblock.fs_sbsize); if (asblk.b_errs) return (0); - if (altsblock.fs_sblkno != sblock.fs_sblkno || - altsblock.fs_cblkno != sblock.fs_cblkno || - altsblock.fs_iblkno != sblock.fs_iblkno || - altsblock.fs_dblkno != sblock.fs_dblkno || - altsblock.fs_ncg != sblock.fs_ncg || - altsblock.fs_bsize != sblock.fs_bsize || - altsblock.fs_fsize != sblock.fs_fsize || - altsblock.fs_frag != sblock.fs_frag || - altsblock.fs_bmask != sblock.fs_bmask || - altsblock.fs_fmask != sblock.fs_fmask || - altsblock.fs_bshift != sblock.fs_bshift || - altsblock.fs_fshift != sblock.fs_fshift || - altsblock.fs_fragshift != sblock.fs_fragshift || - altsblock.fs_fsbtodb != sblock.fs_fsbtodb || - altsblock.fs_sbsize != sblock.fs_sbsize || - altsblock.fs_nindir != sblock.fs_nindir || - altsblock.fs_inopb != sblock.fs_inopb || - altsblock.fs_cssize != sblock.fs_cssize || - altsblock.fs_ipg != sblock.fs_ipg || - altsblock.fs_fpg != sblock.fs_fpg || - altsblock.fs_magic != sblock.fs_magic) { - badsb(listerr, - "VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE"); - return (0); + bad = 0; +#define CHK(x, y) \ + if (altsblock.x != sblock.x) { \ + bad++; \ + if (listerr && debug) \ + printf("SUPER BLOCK VS ALTERNATE MISMATCH %s: " y " vs " y "\n", \ + #x, (intmax_t)sblock.x, (intmax_t)altsblock.x); \ } + CHK(fs_sblkno, "%jd"); + CHK(fs_cblkno, "%jd"); + CHK(fs_iblkno, "%jd"); + CHK(fs_dblkno, "%jd"); + CHK(fs_ncg, "%jd"); + CHK(fs_bsize, "%jd"); + CHK(fs_fsize, "%jd"); + CHK(fs_frag, "%jd"); + CHK(fs_bmask, "%#jx"); + CHK(fs_fmask, "%#jx"); + CHK(fs_bshift, "%jd"); + CHK(fs_fshift, "%jd"); + CHK(fs_fragshift, "%jd"); + CHK(fs_fsbtodb, "%jd"); + CHK(fs_sbsize, "%jd"); + CHK(fs_nindir, "%jd"); + CHK(fs_inopb, "%jd"); + CHK(fs_cssize, "%jd"); + CHK(fs_ipg, "%jd"); + CHK(fs_fpg, "%jd"); + CHK(fs_magic, "%#jx"); +#undef CHK + if (bad) { + if (listerr == 0) + return (0); + if (preen) + printf("%s: ", cdevname); + printf( + "VALUES IN SUPER BLOCK LSB=%jd DISAGREE WITH THOSE IN\n" + "LAST ALTERNATE LSB=%jd\n", + sblk.b_bno, asblk.b_bno); + if (reply("IGNORE ALTERNATE SUPER BLOCK") == 0) + return (0); + } out: /* * If not yet done, update UFS1 superblock with new wider fields. @@ -423,21 +444,9 @@ out: return (1); } -static void -badsb(int listerr, const char *s) -{ - - if (!listerr) - return; - if (preen) - printf("%s: ", cdevname); - pfatal("BAD SUPER BLOCK: %s\n", s); -} - void sblock_init(void) { - struct disklabel *lp; fswritefd = -1; fsmodified = 0; @@ -448,14 +457,11 @@ sblock_init(void) asblk.b_un.b_buf = Malloc(SBLOCKSIZE); if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL) errx(EEXIT, "cannot allocate space for superblock"); - if ((lp = getdisklabel(NULL, fsreadfd))) - real_dev_bsize = dev_bsize = secsize = lp->d_secsize; - else - dev_bsize = secsize = DEV_BSIZE; + dev_bsize = secsize = DEV_BSIZE; } /* - * Calculate a prototype superblock based on information in the disk label. + * Calculate a prototype superblock based on information in the boot area. * When done the cgsblock macro can be calculated and the fs_ncg field * can be used. Do NOT attempt to use other macros without verifying that * their needed information is available! @@ -463,74 +469,63 @@ sblock_init(void) static int calcsb(char *dev, int devfd, struct fs *fs) { - struct disklabel *lp; - struct partition *pp; - char *cp; - int i, nspf; + struct fsrecovery fsr; - cp = strchr(dev, '\0') - 1; - if (cp == (char *)-1 || ((*cp < 'a' || *cp > 'h') && !isdigit(*cp))) { - pfatal("%s: CANNOT FIGURE OUT FILE SYSTEM PARTITION\n", dev); + /* + * We need fragments-per-group and the partition-size. + * + * Newfs stores these details at the end of the boot block area + * at the start of the filesystem partition. If they have been + * overwritten by a boot block, we fail. But usually they are + * there and we can use them. + */ + if (blread(devfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)) || + fsr.fsr_magic != FS_UFS2_MAGIC) return (0); - } - lp = getdisklabel(dev, devfd); - if (isdigit(*cp)) - pp = &lp->d_partitions[0]; - else - pp = &lp->d_partitions[*cp - 'a']; - if (pp->p_fstype != FS_BSDFFS) { - pfatal("%s: NOT LABELED AS A BSD FILE SYSTEM (%s)\n", - dev, pp->p_fstype < FSMAXTYPES ? - fstypenames[pp->p_fstype] : "unknown"); - return (0); - } - if (pp->p_fsize == 0 || pp->p_frag == 0 || - pp->p_cpg == 0 || pp->p_size == 0) { - pfatal("%s: %s: type %s fsize %d, frag %d, cpg %d, size %d\n", - dev, "INCOMPLETE LABEL", fstypenames[pp->p_fstype], - pp->p_fsize, pp->p_frag, pp->p_cpg, pp->p_size); - return (0); - } memset(fs, 0, sizeof(struct fs)); - fs->fs_fsize = pp->p_fsize; - fs->fs_frag = pp->p_frag; - fs->fs_size = pp->p_size; - fs->fs_sblkno = roundup( - howmany(lp->d_bbsize + lp->d_sbsize, fs->fs_fsize), - fs->fs_frag); - nspf = fs->fs_fsize / lp->d_secsize; - for (fs->fs_fsbtodb = 0, i = nspf; i > 1; i >>= 1) - fs->fs_fsbtodb++; - dev_bsize = lp->d_secsize; - if (fs->fs_magic == FS_UFS2_MAGIC) { - fs->fs_fpg = pp->p_cpg; - fs->fs_ncg = howmany(fs->fs_size, fs->fs_fpg); - } else /* if (fs->fs_magic == FS_UFS1_MAGIC) */ { - fs->fs_old_cpg = pp->p_cpg; - fs->fs_old_cgmask = 0xffffffff; - for (i = lp->d_ntracks; i > 1; i >>= 1) - fs->fs_old_cgmask <<= 1; - if (!POWEROF2(lp->d_ntracks)) - fs->fs_old_cgmask <<= 1; - fs->fs_old_cgoffset = roundup(howmany(lp->d_nsectors, nspf), - fs->fs_frag); - fs->fs_fpg = (fs->fs_old_cpg * lp->d_secpercyl) / nspf; - fs->fs_ncg = howmany(fs->fs_size / lp->d_secpercyl, - fs->fs_old_cpg); - } + fs->fs_fpg = fsr.fsr_fpg; + fs->fs_fsbtodb = fsr.fsr_fsbtodb; + fs->fs_sblkno = fsr.fsr_sblkno; + fs->fs_magic = fsr.fsr_magic; + fs->fs_ncg = fsr.fsr_ncg; return (1); } -static struct disklabel * -getdisklabel(char *s, int fd) +/* + * Check to see if recovery information exists. + */ +static int +chkrecovery(int devfd) { - static struct disklabel lab; + struct fsrecovery fsr; - if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) { - if (s == NULL) - return ((struct disklabel *)NULL); - pwarn("ioctl (GCINFO): %s\n", strerror(errno)); - errx(EEXIT, "%s: can't read disk label", s); - } - return (&lab); + if (blread(devfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)) || + fsr.fsr_magic != FS_UFS2_MAGIC) + return (0); + return (1); +} + +/* + * Read the last sector of the boot block, replace the last + * 20 bytes with the recovery information, then write it back. + * The recovery information only works for UFS2 filesystems. + */ +static void +saverecovery(int readfd, int writefd) +{ + struct fsrecovery fsr; + + if (sblock.fs_magic != FS_UFS2_MAGIC || + blread(readfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr))) + return; + fsr.fsr_magic = sblock.fs_magic; + fsr.fsr_fpg = sblock.fs_fpg; + fsr.fsr_fsbtodb = sblock.fs_fsbtodb; + fsr.fsr_sblkno = sblock.fs_sblkno; + fsr.fsr_ncg = sblock.fs_ncg; + blwrite(writefd, (char *)&fsr, (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, + sizeof(fsr)); } Modified: stable/10/sbin/fsirand/fsirand.c ============================================================================== --- stable/10/sbin/fsirand/fsirand.c Thu Aug 24 20:52:28 2017 (r322859) +++ stable/10/sbin/fsirand/fsirand.c Thu Aug 24 21:44:23 2017 (r322860) @@ -36,7 +36,6 @@ static const char rcsid[] = #endif /* not lint */ #include -#include #include #include @@ -120,20 +119,10 @@ fsirand(char *device) char sbuf[SBLOCKSIZE], sbuftmp[SBLOCKSIZE]; int i, devfd, n, cg; u_int32_t bsize = DEV_BSIZE; - struct disklabel label; if ((devfd = open(device, printonly ? O_RDONLY : O_RDWR)) < 0) { warn("can't open %s", device); return (1); - } - - /* Get block size (usually 512) from disklabel if possible */ - if (!ignorelabel) { - if (ioctl(devfd, DIOCGDINFO, &label) < 0) - warn("can't read disklabel, using sector size of %d", - bsize); - else - bsize = label.d_secsize; } dp1 = NULL; Modified: stable/10/sbin/newfs/mkfs.c ============================================================================== --- stable/10/sbin/newfs/mkfs.c Thu Aug 24 20:52:28 2017 (r322859) +++ stable/10/sbin/newfs/mkfs.c Thu Aug 24 21:44:23 2017 (r322860) @@ -121,6 +121,7 @@ mkfs(struct partition *pp, char *fsys) ino_t maxinum; int minfragsperinode; /* minimum ratio of frags to inodes */ char tmpbuf[100]; /* XXX this will break in about 2,500 years */ + struct fsrecovery fsr; union { struct fs fdummy; char cdummy[SBLOCKSIZE]; @@ -618,6 +619,25 @@ restart: sblock.fs_cssize - i < sblock.fs_bsize ? sblock.fs_cssize - i : sblock.fs_bsize, ((char *)fscs) + i); + /* + * Read the last sector of the boot block, replace the last + * 20 bytes with the recovery information, then write it back. + * The recovery information only works for UFS2 filesystems. + */ + if (sblock.fs_magic == FS_UFS2_MAGIC) { + i = bread(&disk, + part_ofs + (SBLOCK_UFS2 - sizeof(fsr)) / disk.d_bsize, + (char *)&fsr, sizeof(fsr)); + if (i == -1) + err(1, "can't read recovery area: %s", disk.d_error); + fsr.fsr_magic = sblock.fs_magic; + fsr.fsr_fpg = sblock.fs_fpg; + fsr.fsr_fsbtodb = sblock.fs_fsbtodb; + fsr.fsr_sblkno = sblock.fs_sblkno; + fsr.fsr_ncg = sblock.fs_ncg; + wtfs((SBLOCK_UFS2 - sizeof(fsr)) / disk.d_bsize, sizeof(fsr), + (char *)&fsr); + } /* * Update information about this partition in pack * label, to that it may be updated on disk. Modified: stable/10/sbin/newfs/newfs.c ============================================================================== --- stable/10/sbin/newfs/newfs.c Thu Aug 24 20:52:28 2017 (r322859) +++ stable/10/sbin/newfs/newfs.c Thu Aug 24 21:44:23 2017 (r322860) @@ -117,11 +117,9 @@ static u_char bootarea[BBSIZE]; static int is_file; /* work on a file, not a device */ static char *dkname; static char *disktype; -static int unlabeled; static void getfssize(intmax_t *, const char *p, intmax_t, intmax_t); static struct disklabel *getdisklabel(char *s); -static void rewritelabel(char *s, struct disklabel *lp); static void usage(void); static int expand_number_int(const char *buf, int *num); @@ -403,12 +401,6 @@ main(int argc, char *argv[]) pp->p_size *= secperblk; } mkfs(pp, special); - if (!unlabeled) { - if (realsectorsize != DEV_BSIZE) - pp->p_size /= realsectorsize / DEV_BSIZE; - if (!Nflag && bcmp(pp, &oldpartition, sizeof(oldpartition))) - rewritelabel(special, lp); - } ufs_disk_close(&disk); if (!jflag) exit(0); @@ -452,34 +444,12 @@ getdisklabel(char *s) return &lab; } - if (ioctl(disk.d_fd, DIOCGDINFO, (char *)&lab) != -1) - return (&lab); - unlabeled++; if (disktype) { lp = getdiskbyname(disktype); if (lp != NULL) return (lp); } return (NULL); -} - -void -rewritelabel(char *s, struct disklabel *lp) -{ - if (unlabeled) - return; - lp->d_checksum = 0; - lp->d_checksum = dkcksum(lp); - if (is_file) { - bsd_disklabel_le_enc(bootarea + 0 /* labeloffset */ + - 1 /* labelsoffset */ * sectorsize, lp); - lseek(disk.d_fd, 0, SEEK_SET); - if (write(disk.d_fd, bootarea, BBSIZE) != BBSIZE) - errx(1, "cannot write label"); - return; - } - if (ioctl(disk.d_fd, DIOCWDINFO, (char *)lp) == -1) - warn("ioctl (WDINFO): %s: can't rewrite disk label", s); } static void Modified: stable/10/sbin/newfs_msdos/newfs_msdos.c ============================================================================== --- stable/10/sbin/newfs_msdos/newfs_msdos.c Thu Aug 24 20:52:28 2017 (r322859) +++ stable/10/sbin/newfs_msdos/newfs_msdos.c Thu Aug 24 21:44:23 2017 (r322860) @@ -829,28 +829,26 @@ getdiskinfo(int fd, const char *fname, const char *dty if (lp == NULL) { if (bpb->bpbBytesPerSec) dlp.d_secsize = bpb->bpbBytesPerSec; - if (ioctl(fd, DIOCGDINFO, &dlp) == -1) { - if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE, - &dlp.d_secsize) == -1) - err(1, "cannot get sector size"); + if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE, + &dlp.d_secsize) == -1) + err(1, "cannot get sector size"); - dlp.d_secperunit = ms / dlp.d_secsize; + dlp.d_secperunit = ms / dlp.d_secsize; - if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS, - &dlp.d_nsectors) == -1) { - warn("cannot get number of sectors per track"); - dlp.d_nsectors = 63; - } - if (bpb->bpbHeads == 0 && - ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) { - warn("cannot get number of heads"); - if (dlp.d_secperunit <= 63*1*1024) - dlp.d_ntracks = 1; - else if (dlp.d_secperunit <= 63*16*1024) - dlp.d_ntracks = 16; - else - dlp.d_ntracks = 255; - } + if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS, + &dlp.d_nsectors) == -1) { + warn("cannot get number of sectors per track"); + dlp.d_nsectors = 63; + } + if (bpb->bpbHeads == 0 && + ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) { + warn("cannot get number of heads"); + if (dlp.d_secperunit <= 63*1*1024) + dlp.d_ntracks = 1; + else if (dlp.d_secperunit <= 63*16*1024) + dlp.d_ntracks = 16; + else + dlp.d_ntracks = 255; } hs = (ms / dlp.d_secsize) - dlp.d_secperunit; Modified: stable/10/share/man/man4/cd.4 ============================================================================== --- stable/10/share/man/man4/cd.4 Thu Aug 24 20:52:28 2017 (r322859) +++ stable/10/share/man/man4/cd.4 Thu Aug 24 21:44:23 2017 (r322860) @@ -101,16 +101,6 @@ in the header files and .In sys/disklabel.h . .Bl -tag -width CDIOCREADSUBCHANNEL -.It Dv DIOCGDINFO -.It Dv DIOCSDINFO -.Pq Li "struct disklabel" -Read or write the in-core copy of the disklabel for the -drive. -The disklabel is initialized with information -read from the scsi inquiry commands, and should be the same as -the information printed at boot. -This structure is defined in the header file -.In sys/disklabel.h . .It Dv CDIOCPLAYTRACKS .Pq Li "struct ioc_play_track" Start audio playback given a track address and length. Modified: stable/10/share/man/man4/mcd.4 ============================================================================== --- stable/10/share/man/man4/mcd.4 Thu Aug 24 20:52:28 2017 (r322859) +++ stable/10/share/man/man4/mcd.4 Thu Aug 24 21:44:23 2017 (r322860) @@ -61,12 +61,8 @@ The driver responds to disk-specific .Fn ioctl commands, namely the -.Dv DIOCGDINFO , -.Dv DIOCGPART , -.Dv DIOCWDINFO , -and -.Dv DIOCSDINFO , -commands. +.Dv DIOCGPART +command. Other disk-specific .Fn ioctl commands will return an error. Modified: stable/10/sys/geom/geom_bsd.c ============================================================================== --- stable/10/sys/geom/geom_bsd.c Thu Aug 24 20:52:28 2017 (r322859) +++ stable/10/sys/geom/geom_bsd.c Thu Aug 24 21:44:23 2017 (r322860) @@ -305,8 +305,8 @@ g_bsd_hotwrite(void *arg, int flag) gsp = gp->softc; ms = gsp->softc; gsl = &gsp->slices[bp->bio_to->index]; - p = (u_char*)bp->bio_data + ms->labeloffset - - (bp->bio_offset + gsl->offset); + p = (u_char*)bp->bio_data + ms->labeloffset - + (bp->bio_offset + gsl->offset); error = g_bsd_modify(gp, p); if (error) { g_io_deliver(bp, EPERM); @@ -315,94 +315,7 @@ g_bsd_hotwrite(void *arg, int flag) g_slice_finish_hot(bp); } -/*- - * This start routine is only called for non-trivial requests, all the - * trivial ones are handled autonomously by the slice code. - * For requests we handle here, we must call the g_io_deliver() on the - * bio, and return non-zero to indicate to the slice code that we did so. - * This code executes in the "DOWN" I/O path, this means: - * * No sleeping. - * * Don't grab the topology lock. - * * Don't call biowait, g_getattr(), g_setattr() or g_read_data() - */ static int -g_bsd_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td) -{ - struct g_geom *gp; - struct g_bsd_softc *ms; - struct g_slicer *gsp; - u_char *label; - int error; - - gp = pp->geom; - gsp = gp->softc; - ms = gsp->softc; - - switch(cmd) { - case DIOCGDINFO: - /* Return a copy of the disklabel to userland. */ - bsd_disklabel_le_dec(ms->label, data, MAXPARTITIONS); - return(0); - case DIOCBSDBB: { - struct g_consumer *cp; - u_char *buf; - void *p; - int error, i; - uint64_t sum; - - if (!(fflag & FWRITE)) - return (EPERM); - /* The disklabel to set is the ioctl argument. */ - buf = g_malloc(BBSIZE, M_WAITOK); - p = *(void **)data; - error = copyin(p, buf, BBSIZE); - if (!error) { - /* XXX: Rude, but supposedly safe */ - DROP_GIANT(); - g_topology_lock(); - /* Validate and modify our slice instance to match. */ - error = g_bsd_modify(gp, buf + ms->labeloffset); - if (!error) { - cp = LIST_FIRST(&gp->consumer); - if (ms->labeloffset == ALPHA_LABEL_OFFSET) { - sum = 0; - for (i = 0; i < 63; i++) - sum += le64dec(buf + i * 8); - le64enc(buf + 504, sum); - } - error = g_write_data(cp, 0, buf, BBSIZE); - } - g_topology_unlock(); - PICKUP_GIANT(); - } - g_free(buf); - return (error); - } - case DIOCSDINFO: - case DIOCWDINFO: { - if (!(fflag & FWRITE)) - return (EPERM); - label = g_malloc(LABELSIZE, M_WAITOK); - /* The disklabel to set is the ioctl argument. */ - bsd_disklabel_le_enc(label, data); - - DROP_GIANT(); - g_topology_lock(); - /* Validate and modify our slice instance to match. */ - error = g_bsd_modify(gp, label); - if (error == 0 && cmd == DIOCWDINFO) - error = g_bsd_writelabel(gp, NULL); - g_topology_unlock(); - PICKUP_GIANT(); - g_free(label); - return(error); - } - default: - return (ENOIOCTL); - } -} - -static int g_bsd_start(struct bio *bp) { struct g_geom *gp; @@ -698,7 +611,6 @@ static struct g_class g_bsd_class = { .taste = g_bsd_taste, .ctlreq = g_bsd_config, .dumpconf = g_bsd_dumpconf, - .ioctl = g_bsd_ioctl, }; DECLARE_GEOM_CLASS(g_bsd_class, g_bsd); Modified: stable/10/sys/sys/disklabel.h ============================================================================== --- stable/10/sys/sys/disklabel.h Thu Aug 24 20:52:28 2017 (r322859) +++ stable/10/sys/sys/disklabel.h Thu Aug 24 21:44:23 2017 (r322860) @@ -284,15 +284,8 @@ static const char *fstypenames[] = { #define D_CHAIN 0x10 /* can do back-back transfers */ /* - * Disklabel-specific ioctls. - * * NB: defines ioctls from 'd'/128 and up. */ - /* get and set disklabel */ -#define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */ -#define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */ -#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */ -#define DIOCBSDBB _IOW('d', 110, void *) /* write bootblocks */ /* * Functions for proper encoding/decoding of struct disklabel into/from Modified: stable/10/sys/ufs/ffs/fs.h ============================================================================== --- stable/10/sys/ufs/ffs/fs.h Thu Aug 24 20:52:28 2017 (r322859) +++ stable/10/sys/ufs/ffs/fs.h Thu Aug 24 21:44:23 2017 (r322860) @@ -234,6 +234,20 @@ struct fsck_cmd { }; /* + * A recovery structure placed at the end of the boot block area by newfs + * that can be used by fsck to search for alternate superblocks. + */ +#define RESID (4096 - 20) /* disk sector size minus recovery area size */ +struct fsrecovery { + char block[RESID]; /* unused part of sector */ + int32_t fsr_magic; /* magic number */ + int32_t fsr_fsbtodb; /* fsbtodb and dbtofsb shift constant */ + int32_t fsr_sblkno; /* offset of super-block in filesys */ + int32_t fsr_fpg; /* blocks per group * fs_frag */ + u_int32_t fsr_ncg; /* number of cylinder groups */ +}; + +/* * Per cylinder group information; summarized in blocks allocated * from first cylinder group data blocks. These blocks have to be * read in from fs_csaddr (size fs_cssize) in addition to the From owner-svn-src-all@freebsd.org Thu Aug 24 21:49:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF457DE8B8B; Thu, 24 Aug 2017 21:49:45 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F9386730A; Thu, 24 Aug 2017 21:49:45 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OLnitZ002390; Thu, 24 Aug 2017 21:49:44 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OLniu1002389; Thu, 24 Aug 2017 21:49:44 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708242149.v7OLniu1002389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 24 Aug 2017 21:49:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322861 - stable/10 X-SVN-Group: stable-10 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/10 X-SVN-Commit-Revision: 322861 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 21:49:45 -0000 Author: mckusick Date: Thu Aug 24 21:49:44 2017 New Revision: 322861 URL: https://svnweb.freebsd.org/changeset/base/322861 Log: Note change brought on by 322860 MFC. Discussed with: kib, imp Differential Revision: https://reviews.freebsd.org/D11589 Approved by: re (kib) Modified: stable/10/UPDATING Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Thu Aug 24 21:44:23 2017 (r322860) +++ stable/10/UPDATING Thu Aug 24 21:49:44 2017 (r322861) @@ -16,6 +16,19 @@ from older versions of FreeBSD, try WITHOUT_CLANG to b stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20170824: + Since the switch to GPT disk labels, fsck for UFS/FFS has been + unable to automatically find alternate superblocks. As of r322860, + the information needed to find alternate superblocks has been + moved to the end of the area reserved for the boot block. + Filesystems created with a newfs of this vintage or later + will create the recovery information. If you have a filesystem + created prior to this change and wish to have a recovery block + created for your filesystem, you can do so by running fsck in + forground mode (i.e., do not use the -p or -y options). As it + starts, fsck will ask ``SAVE DATA TO FIND ALTERNATE SUPERBLOCKS'' + to which you should answer yes. + 20170511: The mmcsd.ko module now additionally depends on geom_flashmap.ko. Also, mmc.ko and mmcsd.ko need to be a matching pair built from the From owner-svn-src-all@freebsd.org Thu Aug 24 22:11:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54F11DE8FDF; Thu, 24 Aug 2017 22:11:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 222F867CA4; Thu, 24 Aug 2017 22:11:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OMAxlL012500; Thu, 24 Aug 2017 22:10:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OMAxZ3012497; Thu, 24 Aug 2017 22:10:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708242210.v7OMAxZ3012497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 24 Aug 2017 22:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322862 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 322862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 22:11:00 -0000 Author: imp Date: Thu Aug 24 22:10:58 2017 New Revision: 322862 URL: https://svnweb.freebsd.org/changeset/base/322862 Log: Fix 32-bit overflow on latency measurements o Allow I/O scheduler to gather times on 32-bit systems. We do this by shifting the sbintime_t over by 8 bits and truncating to 32-bits. This gives us 8.24 time. This is sufficient both in range (256 seconds is about 128x what current users need) and precision (60ns easily meets the 1ms smallest bucket size measurements). 64-bit systems are unchanged. Centralize all the time math so it's easy to tweak tha range / precision tradeoffs in the future. o While I'm here, the I/O scheduler should be using periph_data rather than sim_data since it is operating on behalf of the periph. Differential Review: https://reviews.freebsd.org/D12119 Modified: head/sys/cam/cam_iosched.c head/sys/cam/cam_iosched.h head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Thu Aug 24 21:49:44 2017 (r322861) +++ head/sys/cam/cam_iosched.c Thu Aug 24 22:10:58 2017 (r322862) @@ -1428,7 +1428,8 @@ cam_iosched_bio_complete(struct cam_iosched_softc *isc } if (!(bp->bio_flags & BIO_ERROR)) - cam_iosched_io_metric_update(isc, done_ccb->ccb_h.qos.sim_data, + cam_iosched_io_metric_update(isc, + cam_iosched_sbintime_t(done_ccb->ccb_h.qos.periph_data), bp->bio_cmd, bp->bio_bcount); #endif return retval; Modified: head/sys/cam/cam_iosched.h ============================================================================== --- head/sys/cam/cam_iosched.h Thu Aug 24 21:49:44 2017 (r322861) +++ head/sys/cam/cam_iosched.h Thu Aug 24 22:10:58 2017 (r322862) @@ -41,6 +41,44 @@ struct sysctl_oid; union ccb; struct bio; +/* + * For 64-bit platforms, we know that uintptr_t is the same size as sbintime_t + * so we can store values in it. For 32-bit systems, however, uintptr_t is only + * 32-bits, so it won't fit. For those systems, store 24 bits of fraction and 8 + * bits of seconds. This allows us to measure an interval of up to ~256s, which + * is ~200x what our current uses require. Provide some convenience functions to + * get the time, subtract two times and convert back to sbintime_t in a safe way + * that can be centralized. + */ +#ifdef __LP64__ +#define CAM_IOSCHED_TIME_SHIFT 0 +#else +#define CAM_IOSCHED_TIME_SHIFT 8 +#endif +static inline uintptr_t +cam_iosched_now(void) +{ + + /* Cast here is to avoid right shifting a signed value */ + return (uintptr_t)((uint64_t)sbinuptime() >> CAM_IOSCHED_TIME_SHIFT); +} + +static inline uintptr_t +cam_iosched_delta_t(uintptr_t then) +{ + + /* Since the types are identical, wrapping works correctly */ + return (cam_iosched_now() - then); +} + +static inline sbintime_t +cam_iosched_sbintime_t(uintptr_t delta) +{ + + /* Cast here is to widen the type so the left shift doesn't lose precision */ + return (sbintime_t)((uint64_t)delta << CAM_IOSCHED_TIME_SHIFT); +} + int cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph); void cam_iosched_fini(struct cam_iosched_softc *); void cam_iosched_sysctl_init(struct cam_iosched_softc *, struct sysctl_ctx_list *, struct sysctl_oid *); Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Thu Aug 24 21:49:44 2017 (r322861) +++ head/sys/cam/cam_xpt.c Thu Aug 24 22:10:58 2017 (r322862) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -3494,7 +3495,7 @@ xpt_run_devq(struct cam_devq *devq) mtx_lock(mtx); else mtx = NULL; - work_ccb->ccb_h.qos.sim_data = sbinuptime(); // xxx uintprt_t too small 32bit platforms + work_ccb->ccb_h.qos.periph_data = cam_iosched_now(); (*(sim->sim_action))(sim, work_ccb); if (mtx) mtx_unlock(mtx); @@ -4641,7 +4642,7 @@ xpt_done(union ccb *done_ccb) return; /* Store the time the ccb was in the sim */ - done_ccb->ccb_h.qos.sim_data = sbinuptime() - done_ccb->ccb_h.qos.sim_data; + done_ccb->ccb_h.qos.periph_data = cam_iosched_delta_t(done_ccb->ccb_h.qos.periph_data); hash = (done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id + done_ccb->ccb_h.target_lun) % cam_num_doneqs; queue = &cam_doneqs[hash]; @@ -4664,7 +4665,7 @@ xpt_done_direct(union ccb *done_ccb) return; /* Store the time the ccb was in the sim */ - done_ccb->ccb_h.qos.sim_data = sbinuptime() - done_ccb->ccb_h.qos.sim_data; + done_ccb->ccb_h.qos.periph_data = cam_iosched_delta_t(done_ccb->ccb_h.qos.periph_data); xpt_done_process(&done_ccb->ccb_h); } From owner-svn-src-all@freebsd.org Thu Aug 24 22:11:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4B62DE9009; Thu, 24 Aug 2017 22:11:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B15C867D57; Thu, 24 Aug 2017 22:11:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OMBA7f012583; Thu, 24 Aug 2017 22:11:10 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OMBAlc012582; Thu, 24 Aug 2017 22:11:10 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708242211.v7OMBAlc012582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 24 Aug 2017 22:11:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322863 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 322863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 22:11:12 -0000 Author: imp Date: Thu Aug 24 22:11:10 2017 New Revision: 322863 URL: https://svnweb.freebsd.org/changeset/base/322863 Log: Expand the latency tracking array from 1.024s to 8.192s to help track extreme outliers from dodgy drives. Adjust comments to reflect this, and make sure that the number of latency buckets match in the two places where it matters. Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Thu Aug 24 22:10:58 2017 (r322862) +++ head/sys/cam/cam_iosched.c Thu Aug 24 22:11:10 2017 (r322863) @@ -233,7 +233,7 @@ struct iop_stats { uint32_t state_flags; #define IOP_RATE_LIMITED 1u -#define LAT_BUCKETS 12 /* < 1ms < 2ms ... 512ms < 1024ms > 1024ms */ +#define LAT_BUCKETS 15 /* < 1ms < 2ms ... < 2^(n-1)ms >= 2^(n-1)ms*/ uint64_t latencies[LAT_BUCKETS]; struct cam_iosched_softc *softc; @@ -1520,7 +1520,7 @@ isqrt64(uint64_t val) return res; } -static sbintime_t latencies[] = { +static sbintime_t latencies[LAT_BUCKETS - 1] = { SBT_1MS << 0, SBT_1MS << 1, SBT_1MS << 2, @@ -1531,7 +1531,10 @@ static sbintime_t latencies[] = { SBT_1MS << 7, SBT_1MS << 8, SBT_1MS << 9, - SBT_1MS << 10 + SBT_1MS << 10, + SBT_1MS << 11, + SBT_1MS << 12, + SBT_1MS << 13 /* 8.192s */ }; static void From owner-svn-src-all@freebsd.org Thu Aug 24 22:33:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88C54DE9689; Thu, 24 Aug 2017 22:33:44 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D3CA688D9; Thu, 24 Aug 2017 22:33:44 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OMXhrw022513; Thu, 24 Aug 2017 22:33:43 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OMXhOL022509; Thu, 24 Aug 2017 22:33:43 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201708242233.v7OMXhOL022509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Thu, 24 Aug 2017 22:33:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322864 - in stable/10/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Group: stable-10 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: in stable/10/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Commit-Revision: 322864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 22:33:44 -0000 Author: davidcs Date: Thu Aug 24 22:33:42 2017 New Revision: 322864 URL: https://svnweb.freebsd.org/changeset/base/322864 Log: MFC r322408 Performance enhancements to reduce CPU utililization for large number of TCP connections (order of tens of thousands), with predominantly Transmits. Submitted by: Vaishali.Kulkarni@cavium.com Approved by: re(marius) Modified: stable/10/sys/dev/qlnx/qlnxe/qlnx_def.h stable/10/sys/dev/qlnx/qlnxe/qlnx_os.c stable/10/sys/dev/qlnx/qlnxe/qlnx_ver.h stable/10/sys/modules/qlnx/qlnxe/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/qlnx/qlnxe/qlnx_def.h ============================================================================== --- stable/10/sys/dev/qlnx/qlnxe/qlnx_def.h Thu Aug 24 22:11:10 2017 (r322863) +++ stable/10/sys/dev/qlnx/qlnxe/qlnx_def.h Thu Aug 24 22:33:42 2017 (r322864) @@ -50,9 +50,10 @@ struct qlnx_ivec { typedef struct qlnx_ivec qlnx_ivec_t; -//#define QLNX_MAX_RSS 30 -#define QLNX_MAX_RSS 16 -#define QLNX_MAX_TC 1 +//#define QLNX_MAX_RSS 30 +#define QLNX_MAX_RSS 36 +#define QLNX_DEFAULT_RSS 16 +#define QLNX_MAX_TC 1 enum QLNX_STATE { QLNX_STATE_CLOSED, @@ -201,6 +202,17 @@ struct qlnx_fastpath { uint64_t tx_pkts_freed; uint64_t tx_pkts_transmitted; uint64_t tx_pkts_completed; + uint64_t tx_tso_pkts; + uint64_t tx_non_tso_pkts; + +#ifdef QLNX_TRACE_PERF_DATA + uint64_t tx_pkts_trans_ctx; + uint64_t tx_pkts_compl_ctx; + uint64_t tx_pkts_trans_fp; + uint64_t tx_pkts_compl_fp; + uint64_t tx_pkts_compl_intr; +#endif + uint64_t tx_lso_wnd_min_len; uint64_t tx_defrag; uint64_t tx_nsegs_gt_elem_left; @@ -209,6 +221,13 @@ struct qlnx_fastpath { uint32_t tx_tso_max_pkt_len; uint32_t tx_tso_min_pkt_len; uint64_t tx_pkts[QLNX_FP_MAX_SEGS]; + +#ifdef QLNX_TRACE_PERF_DATA + uint64_t tx_pkts_hist[QLNX_FP_MAX_SEGS]; + uint64_t tx_comInt[QLNX_FP_MAX_SEGS]; + uint64_t tx_pkts_q[QLNX_FP_MAX_SEGS]; +#endif + uint64_t err_tx_nsegs_gt_elem_left; uint64_t err_tx_dmamap_create; uint64_t err_tx_defrag_dmamap_load; @@ -301,8 +320,13 @@ typedef struct qlnx_link_output qlnx_link_output_t; #define QLNX_MFW_VERSION_LENGTH 32 #define QLNX_STORMFW_VERSION_LENGTH 32 -#define QLNX_TX_ELEM_RESERVE 2 +#define QLNX_TX_ELEM_RESERVE 2 +#define QLNX_TX_ELEM_THRESH 128 +#define QLNX_TX_ELEM_MAX_THRESH 512 +#define QLNX_TX_ELEM_MIN_THRESH 32 +#define QLNX_TX_COMPL_THRESH 32 + #define QLNX_TPA_MAX_AGG_BUFFERS (20) #define QLNX_MAX_NUM_MULTICAST_ADDRS ECORE_MAX_MC_ADDRS @@ -454,6 +478,7 @@ struct qlnx_host { qlnx_storm_stats_t storm_stats[QLNX_STORM_STATS_TOTAL]; uint32_t storm_stats_index; uint32_t storm_stats_enable; + uint32_t storm_stats_gather; uint32_t personality; }; @@ -470,8 +495,11 @@ typedef struct qlnx_host qlnx_host_t; #define QLNX_MAX_MTU 9000 #define QLNX_MAX_SEGMENTS_NON_TSO (ETH_TX_MAX_BDS_PER_NON_LSO_PACKET - 1) -#define QLNX_MAX_TSO_FRAME_SIZE ((64 * 1024 - 1) + 22) +//#define QLNX_MAX_TSO_FRAME_SIZE ((64 * 1024 - 1) + 22) +#define QLNX_MAX_TSO_FRAME_SIZE 65536 +#define QLNX_MAX_TX_MBUF_SIZE 65536 /* bytes - bd_len = 16bits */ + #define QL_MAC_CMP(mac1, mac2) \ ((((*(uint32_t *) mac1) == (*(uint32_t *) mac2) && \ (*(uint16_t *)(mac1 + 4)) == (*(uint16_t *)(mac2 + 4)))) ? 0 : 1) @@ -702,6 +730,18 @@ extern void qlnx_fill_link(struct ecore_hwfn *hwfn, #define CQE_HAS_VLAN(flags) \ ((flags) & (PARSING_AND_ERR_FLAGS_TAG8021QEXIST_MASK \ << PARSING_AND_ERR_FLAGS_TAG8021QEXIST_SHIFT)) + +#if defined(__i386__) || defined(__amd64__) + +static __inline +void prefetch(void *x) +{ + __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); +} + +#else +#define prefetch(x) +#endif #endif /* #ifndef _QLNX_DEF_H_ */ Modified: stable/10/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- stable/10/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 22:11:10 2017 (r322863) +++ stable/10/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 22:33:42 2017 (r322864) @@ -94,6 +94,8 @@ static int qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha); static uint32_t qlnx_get_optics(qlnx_host_t *ha, struct qlnx_link_output *if_link); static int qlnx_transmit(struct ifnet *ifp, struct mbuf *mp); +static int qlnx_transmit_locked(struct ifnet *ifp, struct qlnx_fastpath *fp, + struct mbuf *mp); static void qlnx_qflush(struct ifnet *ifp); static int qlnx_alloc_parent_dma_tag(qlnx_host_t *ha); @@ -133,6 +135,8 @@ static void qlnx_timer(void *arg); static int qlnx_alloc_tx_br(qlnx_host_t *ha, struct qlnx_fastpath *fp); static void qlnx_free_tx_br(qlnx_host_t *ha, struct qlnx_fastpath *fp); static void qlnx_trigger_dump(qlnx_host_t *ha); +static uint16_t qlnx_num_tx_compl(qlnx_host_t *ha, struct qlnx_fastpath *fp, + struct qlnx_tx_queue *txq); static void qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, struct qlnx_tx_queue *txq); static int qlnx_rx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, int budget, @@ -215,6 +219,12 @@ char qlnx_name_str[NAME_SIZE]; #define QLOGIC_PCI_DEVICE_ID_8070 0x8070 #endif +SYSCTL_NODE(_hw, OID_AUTO, qlnxe, CTLFLAG_RD, 0, "qlnxe driver parameters"); +/* Number of Queues: 0 (Auto) or 1 to 32 (fixed queue number) */ +static int qlnxe_queue_count = QLNX_DEFAULT_RSS; +SYSCTL_INT(_hw_qlnxe, OID_AUTO, queue_count, CTLFLAG_RDTUN, + &qlnxe_queue_count, 0, "Multi-Queue queue count"); + static int qlnx_valid_device(device_t dev) { @@ -302,7 +312,26 @@ qlnx_pci_probe(device_t dev) return (BUS_PROBE_DEFAULT); } +static uint16_t +qlnx_num_tx_compl(qlnx_host_t *ha, struct qlnx_fastpath *fp, + struct qlnx_tx_queue *txq) +{ + u16 hw_bd_cons; + u16 ecore_cons_idx; + uint16_t diff; + hw_bd_cons = le16toh(*txq->hw_cons_ptr); + + ecore_cons_idx = ecore_chain_get_cons_idx(&txq->tx_pbl); + if (hw_bd_cons < ecore_cons_idx) { + diff = (1 << 16) - (ecore_cons_idx - hw_bd_cons); + } else { + diff = hw_bd_cons - ecore_cons_idx; + } + return diff; +} + + static void qlnx_sp_intr(void *arg) { @@ -395,14 +424,11 @@ qlnx_fp_taskqueue(void *context, int pending) struct qlnx_fastpath *fp; qlnx_host_t *ha; struct ifnet *ifp; - struct mbuf *mp; - int ret; - struct thread *cthread; #ifdef QLNX_RCV_IN_TASKQ int lro_enable; int rx_int = 0, total_rx_count = 0; - + struct thread *cthread; #endif /* #ifdef QLNX_RCV_IN_TASKQ */ fp = context; @@ -410,6 +436,12 @@ qlnx_fp_taskqueue(void *context, int pending) if (fp == NULL) return; + ha = (qlnx_host_t *)fp->edev; + + ifp = ha->ifp; + +#ifdef QLNX_RCV_IN_TASKQ + cthread = curthread; thread_lock(cthread); @@ -419,112 +451,81 @@ qlnx_fp_taskqueue(void *context, int pending) thread_unlock(cthread); - ha = (qlnx_host_t *)fp->edev; + lro_enable = ifp->if_capenable & IFCAP_LRO; - ifp = ha->ifp; + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); -#ifdef QLNX_RCV_IN_TASKQ - { - lro_enable = ifp->if_capenable & IFCAP_LRO; + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } - rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); - - if (rx_int) { - fp->rx_pkts += rx_int; - total_rx_count += rx_int; - } - #ifdef QLNX_SOFT_LRO - { - struct lro_ctrl *lro; - - lro = &fp->rxq->lro; + { + struct lro_ctrl *lro; - if (lro_enable && total_rx_count) { + lro = &fp->rxq->lro; + if (lro_enable && total_rx_count) { + #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) - if (ha->dbg_trace_lro_cnt) { - if (lro->lro_mbuf_count & ~1023) - fp->lro_cnt_1024++; - else if (lro->lro_mbuf_count & ~511) - fp->lro_cnt_512++; - else if (lro->lro_mbuf_count & ~255) - fp->lro_cnt_256++; - else if (lro->lro_mbuf_count & ~127) - fp->lro_cnt_128++; - else if (lro->lro_mbuf_count & ~63) - fp->lro_cnt_64++; - } - tcp_lro_flush_all(lro); + if (ha->dbg_trace_lro_cnt) { + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; + } + tcp_lro_flush_all(lro); #else - struct lro_entry *queued; + struct lro_entry *queued; - while ((!SLIST_EMPTY(&lro->lro_active))) { - queued = SLIST_FIRST(&lro->lro_active); - SLIST_REMOVE_HEAD(&lro->lro_active, next); - tcp_lro_flush(lro, queued); - } -#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, next); + tcp_lro_flush(lro, queued); } +#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ } + } #endif /* #ifdef QLNX_SOFT_LRO */ - ecore_sb_update_sb_idx(fp->sb_info); - rmb(); - } + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); #endif /* #ifdef QLNX_RCV_IN_TASKQ */ - mtx_lock(&fp->tx_mtx); + if(ifp->if_drv_flags & IFF_DRV_RUNNING) { - if (((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) || (!ha->link_up)) { + if (!drbr_empty(ifp, fp->tx_br)) { - mtx_unlock(&fp->tx_mtx); - goto qlnx_fp_taskqueue_exit; - } + if(mtx_trylock(&fp->tx_mtx)) { - mp = drbr_peek(ifp, fp->tx_br); +#ifdef QLNX_TRACE_PERF_DATA + tx_pkts = fp->tx_pkts_transmitted; + tx_compl = fp->tx_pkts_completed; +#endif - while (mp != NULL) { + qlnx_transmit_locked(ifp, fp, NULL); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - ret = qlnx_send(ha, fp, &mp); - } else { - ret = -1; - } - - if (ret) { - - if (mp != NULL) { - drbr_putback(ifp, fp->tx_br, mp); - } else { - fp->tx_pkts_processed++; - drbr_advance(ifp, fp->tx_br); +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_trans_fp += + (fp->tx_pkts_transmitted - tx_pkts); + fp->tx_pkts_compl_fp += + (fp->tx_pkts_completed - tx_compl); +#endif + mtx_unlock(&fp->tx_mtx); } - - mtx_unlock(&fp->tx_mtx); - - goto qlnx_fp_taskqueue_exit; - - } else { - drbr_advance(ifp, fp->tx_br); - fp->tx_pkts_transmitted++; - fp->tx_pkts_processed++; } - - if (fp->tx_ring_full) - break; - - mp = drbr_peek(ifp, fp->tx_br); } - mtx_unlock(&fp->tx_mtx); - -qlnx_fp_taskqueue_exit: - #ifdef QLNX_RCV_IN_TASKQ if (rx_int) { if (fp->fp_taskqueue != NULL) @@ -537,7 +538,7 @@ qlnx_fp_taskqueue_exit: } #endif /* #ifdef QLNX_RCV_IN_TASKQ */ - QL_DPRINT2(ha, "exit ret = %d\n", ret); + QL_DPRINT2(ha, "exit \n"); return; } @@ -611,6 +612,17 @@ qlnx_drain_fp_taskqueues(qlnx_host_t *ha) return; } +static void +qlnx_get_params(qlnx_host_t *ha) +{ + if ((qlnxe_queue_count < 0) || (qlnxe_queue_count > QLNX_MAX_RSS)) { + device_printf(ha->pci_dev, "invalid queue_count value (%d)\n", + qlnxe_queue_count); + qlnxe_queue_count = 0; + } + return; +} + /* * Name: qlnx_pci_attach * Function: attaches the device to the operating system @@ -706,10 +718,21 @@ qlnx_pci_attach(device_t dev) if (qlnx_init_hw(ha) != 0) goto qlnx_pci_attach_err; + qlnx_get_params(ha); + + if((pci_get_device(dev) == QLOGIC_PCI_DEVICE_ID_1644) && + (qlnxe_queue_count == QLNX_DEFAULT_RSS)) { + qlnxe_queue_count = QLNX_MAX_RSS; + } + /* * Allocate MSI-x vectors */ - ha->num_rss = QLNX_MAX_RSS; + if(qlnxe_queue_count == 0) + ha->num_rss = QLNX_DEFAULT_RSS; + else + ha->num_rss = qlnxe_queue_count; + ha->num_tc = QLNX_MAX_TC; ha->msix_count = pci_msix_count(dev); @@ -1236,6 +1259,44 @@ qlnx_add_fp_stats_sysctls(qlnx_host_t *ha) CTLFLAG_RD, &ha->fp_array[i].tx_pkts_completed, "No. of transmit completions"); + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_non_tso_pkts", + CTLFLAG_RD, &ha->fp_array[i].tx_non_tso_pkts, + "No. of non LSO transmited packets"); + +#ifdef QLNX_TRACE_PERF_DATA + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_trans_ctx", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_trans_ctx, + "No. of transmitted packets in transmit context"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_ctx", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_ctx, + "No. of transmit completions in transmit context"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_trans_fp", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_trans_fp, + "No. of transmitted packets in taskqueue"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_fp", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_fp, + "No. of transmit completions in taskqueue"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_intr", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_intr, + "No. of transmit completions in interrupt ctx"); +#endif + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_tso_pkts", + CTLFLAG_RD, &ha->fp_array[i].tx_tso_pkts, + "No. of LSO transmited packets"); + SYSCTL_ADD_QUAD(ctx, node_children, OID_AUTO, "tx_lso_wnd_min_len", CTLFLAG_RD, &ha->fp_array[i].tx_lso_wnd_min_len, @@ -1284,6 +1345,39 @@ qlnx_add_fp_stats_sysctls(qlnx_host_t *ha) &ha->fp_array[i].tx_pkts[j], name_str); } +#ifdef QLNX_TRACE_PERF_DATA + for (j = 0; j < 18; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_pkts_hist_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_pkts_hist[j], name_str); + } + for (j = 0; j < 5; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_comInt_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_comInt[j], name_str); + } + for (j = 0; j < 18; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_pkts_q_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_pkts_q[j], name_str); + } +#endif + SYSCTL_ADD_QUAD(ctx, node_children, OID_AUTO, "err_tx_nsegs_gt_elem_left", CTLFLAG_RD, &ha->fp_array[i].err_tx_nsegs_gt_elem_left, @@ -1979,6 +2073,12 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) ifp->if_capabilities |= IFCAP_TSO6; ifp->if_capabilities |= IFCAP_LRO; + ifp->if_hw_tsomax = QLNX_MAX_TSO_FRAME_SIZE - + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + ifp->if_hw_tsomaxsegcount = QLNX_MAX_SEGMENTS - 1 /* hdr */; + ifp->if_hw_tsomaxsegsize = QLNX_MAX_TX_MBUF_SIZE; + + ifp->if_capenable = ifp->if_capabilities; ifp->if_hwassist = CSUM_IP; @@ -2543,6 +2643,7 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, u16 hw_bd_cons; u16 ecore_cons_idx; uint16_t diff; + uint16_t idx, idx2; hw_bd_cons = le16toh(*txq->hw_cons_ptr); @@ -2580,6 +2681,11 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, qlnx_trigger_dump(ha); } + idx = (txq->sw_tx_cons + 1) & (TX_RING_SIZE - 1); + idx2 = (txq->sw_tx_cons + 2) & (TX_RING_SIZE - 1); + prefetch(txq->sw_tx_ring[idx].mp); + prefetch(txq->sw_tx_ring[idx2].mp); + qlnx_free_tx_pkt(ha, fp, txq); txq->sw_tx_cons = (txq->sw_tx_cons + 1) & (TX_RING_SIZE - 1); @@ -2588,12 +2694,71 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, } static int +qlnx_transmit_locked(struct ifnet *ifp,struct qlnx_fastpath *fp, struct mbuf *mp) +{ + int ret = 0; + struct qlnx_tx_queue *txq; + qlnx_host_t * ha; + uint16_t elem_left; + + txq = fp->txq[0]; + ha = (qlnx_host_t *)fp->edev; + + + if ((!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || (!ha->link_up)) { + if(mp != NULL) + ret = drbr_enqueue(ifp, fp->tx_br, mp); + return (ret); + } + + if(mp != NULL) + ret = drbr_enqueue(ifp, fp->tx_br, mp); + + mp = drbr_peek(ifp, fp->tx_br); + + while (mp != NULL) { + + if (qlnx_send(ha, fp, &mp)) { + + if (mp != NULL) { + drbr_putback(ifp, fp->tx_br, mp); + } else { + fp->tx_pkts_processed++; + drbr_advance(ifp, fp->tx_br); + } + goto qlnx_transmit_locked_exit; + + } else { + drbr_advance(ifp, fp->tx_br); + fp->tx_pkts_transmitted++; + fp->tx_pkts_processed++; + } + + mp = drbr_peek(ifp, fp->tx_br); + } + +qlnx_transmit_locked_exit: + if((qlnx_num_tx_compl(ha,fp, fp->txq[0]) > QLNX_TX_COMPL_THRESH) || + ((int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl)) + < QLNX_TX_ELEM_MAX_THRESH)) + (void)qlnx_tx_int(ha, fp, fp->txq[0]); + + QL_DPRINT2(ha, "%s: exit ret = %d\n", __func__, ret); + return ret; +} + + +static int qlnx_transmit(struct ifnet *ifp, struct mbuf *mp) { qlnx_host_t *ha = (qlnx_host_t *)ifp->if_softc; struct qlnx_fastpath *fp; int rss_id = 0, ret = 0; +#ifdef QLNX_TRACEPERF_DATA + uint64_t tx_pkts = 0, tx_compl = 0; +#endif + QL_DPRINT2(ha, "enter\n"); #if __FreeBSD_version >= 1100000 @@ -2611,15 +2776,27 @@ qlnx_transmit(struct ifnet *ifp, struct mbuf *mp) goto qlnx_transmit_exit; } - if (mp != NULL) { - ret = drbr_enqueue(ifp, fp->tx_br, mp); - } + if (mtx_trylock(&fp->tx_mtx)) { - if (fp->fp_taskqueue != NULL) - taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); +#ifdef QLNX_TRACEPERF_DATA + tx_pkts = fp->tx_pkts_transmitted; + tx_compl = fp->tx_pkts_completed; +#endif - ret = 0; + ret = qlnx_transmit_locked(ifp, fp, mp); +#ifdef QLNX_TRACEPERF_DATA + fp->tx_pkts_trans_ctx += (fp->tx_pkts_transmitted - tx_pkts); + fp->tx_pkts_compl_ctx += (fp->tx_pkts_completed - tx_compl); +#endif + mtx_unlock(&fp->tx_mtx); + } else { + if (mp != NULL && (fp->fp_taskqueue != NULL)) { + ret = drbr_enqueue(ifp, fp->tx_br, mp); + taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); + } + } + qlnx_transmit_exit: QL_DPRINT2(ha, "exit ret = %d\n", ret); @@ -2799,6 +2976,10 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s uint32_t nbds_in_hdr = 0; uint32_t offset = 0; +#ifdef QLNX_TRACE_PERF_DATA + uint16_t bd_used; +#endif + QL_DPRINT8(ha, "enter\n"); if (!ha->link_up) @@ -2811,15 +2992,15 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s txq = fp->txq[0]; - if (fp->tx_ring_full) { - elem_left = ecore_chain_get_elem_left(&txq->tx_pbl); + if ((int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl)) < + QLNX_TX_ELEM_MIN_THRESH) { - if (elem_left < (TX_RING_SIZE >> 4)) - return (-1); - else - fp->tx_ring_full = 0; - } + fp->tx_nsegs_gt_elem_left++; + fp->err_tx_nsegs_gt_elem_left++; + return (ENOBUFS); + } + idx = txq->sw_tx_prod; map = txq->sw_tx_ring[idx].map; @@ -2829,14 +3010,18 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s BUS_DMA_NOWAIT); if (ha->dbg_trace_tso_pkt_len) { - if (!fp->tx_tso_min_pkt_len) { - fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - } else { - if (fp->tx_tso_min_pkt_len > m_head->m_pkthdr.len) + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + if (!fp->tx_tso_min_pkt_len) { fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - if (fp->tx_tso_max_pkt_len < m_head->m_pkthdr.len) - fp->tx_tso_max_pkt_len = m_head->m_pkthdr.len; + fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; + } else { + if (fp->tx_tso_min_pkt_len > m_head->m_pkthdr.len) + fp->tx_tso_min_pkt_len = + m_head->m_pkthdr.len; + if (fp->tx_tso_max_pkt_len < m_head->m_pkthdr.len) + fp->tx_tso_max_pkt_len = + m_head->m_pkthdr.len; + } } } @@ -2923,6 +3108,105 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s fp->tx_pkts[(QLNX_FP_MAX_SEGS - 1)]++; } +#ifdef QLNX_TRACE_PERF_DATA + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + if(m_head->m_pkthdr.len <= 2048) + fp->tx_pkts_hist[0]++; + else if((m_head->m_pkthdr.len > 2048) && + (m_head->m_pkthdr.len <= 4096)) + fp->tx_pkts_hist[1]++; + else if((m_head->m_pkthdr.len > 4096) && + (m_head->m_pkthdr.len <= 8192)) + fp->tx_pkts_hist[2]++; + else if((m_head->m_pkthdr.len > 8192) && + (m_head->m_pkthdr.len <= 12288 )) + fp->tx_pkts_hist[3]++; + else if((m_head->m_pkthdr.len > 11288) && + (m_head->m_pkthdr.len <= 16394)) + fp->tx_pkts_hist[4]++; + else if((m_head->m_pkthdr.len > 16384) && + (m_head->m_pkthdr.len <= 20480)) + fp->tx_pkts_hist[5]++; + else if((m_head->m_pkthdr.len > 20480) && + (m_head->m_pkthdr.len <= 24576)) + fp->tx_pkts_hist[6]++; + else if((m_head->m_pkthdr.len > 24576) && + (m_head->m_pkthdr.len <= 28672)) + fp->tx_pkts_hist[7]++; + else if((m_head->m_pkthdr.len > 28762) && + (m_head->m_pkthdr.len <= 32768)) + fp->tx_pkts_hist[8]++; + else if((m_head->m_pkthdr.len > 32768) && + (m_head->m_pkthdr.len <= 36864)) + fp->tx_pkts_hist[9]++; + else if((m_head->m_pkthdr.len > 36864) && + (m_head->m_pkthdr.len <= 40960)) + fp->tx_pkts_hist[10]++; + else if((m_head->m_pkthdr.len > 40960) && + (m_head->m_pkthdr.len <= 45056)) + fp->tx_pkts_hist[11]++; + else if((m_head->m_pkthdr.len > 45056) && + (m_head->m_pkthdr.len <= 49152)) + fp->tx_pkts_hist[12]++; + else if((m_head->m_pkthdr.len > 49512) && + m_head->m_pkthdr.len <= 53248)) + fp->tx_pkts_hist[13]++; + else if((m_head->m_pkthdr.len > 53248) && + (m_head->m_pkthdr.len <= 57344)) + fp->tx_pkts_hist[14]++; + else if((m_head->m_pkthdr.len > 53248) && + (m_head->m_pkthdr.len <= 57344)) + fp->tx_pkts_hist[15]++; + else if((m_head->m_pkthdr.len > 57344) && + (m_head->m_pkthdr.len <= 61440)) + fp->tx_pkts_hist[16]++; + else + fp->tx_pkts_hist[17]++; + } + + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + + elem_left = ecore_chain_get_elem_left(&txq->tx_pbl); + bd_used = TX_RING_SIZE - elem_left; + + if(bd_used <= 100) + fp->tx_pkts_q[0]++; + else if((bd_used > 100) && (bd_used <= 500)) + fp->tx_pkts_q[1]++; + else if((bd_used > 500) && (bd_used <= 1000)) + fp->tx_pkts_q[2]++; + else if((bd_used > 1000) && (bd_used <= 2000)) + fp->tx_pkts_q[3]++; + else if((bd_used > 3000) && (bd_used <= 4000)) + fp->tx_pkts_q[4]++; + else if((bd_used > 4000) && (bd_used <= 5000)) + fp->tx_pkts_q[5]++; + else if((bd_used > 6000) && (bd_used <= 7000)) + fp->tx_pkts_q[6]++; + else if((bd_used > 7000) && (bd_used <= 8000)) + fp->tx_pkts_q[7]++; + else if((bd_used > 8000) && (bd_used <= 9000)) + fp->tx_pkts_q[8]++; + else if((bd_used > 9000) && (bd_used <= 10000)) + fp->tx_pkts_q[9]++; + else if((bd_used > 10000) && (bd_used <= 11000)) + fp->tx_pkts_q[10]++; + else if((bd_used > 11000) && (bd_used <= 12000)) + fp->tx_pkts_q[11]++; + else if((bd_used > 12000) && (bd_used <= 13000)) + fp->tx_pkts_q[12]++; + else if((bd_used > 13000) && (bd_used <= 14000)) + fp->tx_pkts_q[13]++; + else if((bd_used > 14000) && (bd_used <= 15000)) + fp->tx_pkts_q[14]++; + else if((bd_used > 15000) && (bd_used <= 16000)) + fp->tx_pkts_q[15]++; + else + fp->tx_pkts_q[16]++; + } + +#endif /* end of QLNX_TRACE_PERF_DATA */ + if ((nsegs + QLNX_TX_ELEM_RESERVE) > (int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl))) { @@ -2943,7 +3227,8 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s fp->err_tx_nsegs_gt_elem_left++; fp->tx_ring_full = 1; - ha->storm_stats_enable = 1; + if (ha->storm_stats_enable) + ha->storm_stats_gather = 1; return (ENOBUFS); } } @@ -3131,6 +3416,7 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s third_bd->data.bitfields |= (nbds_in_hdr<tx_tso_pkts++; } else { segs++; for (seg_idx = 1; seg_idx < nsegs; seg_idx++) { @@ -3147,6 +3433,7 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s << ETH_TX_DATA_1ST_BD_PKT_LEN_SHIFT; first_bd->data.bitfields = htole16(first_bd->data.bitfields); + fp->tx_non_tso_pkts++; } @@ -4303,8 +4590,10 @@ qlnx_fp_isr(void *arg) if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); #else - int rx_int = 0, total_rx_count = 0; - int lro_enable, tc; + int rx_int = 0, total_rx_count = 0; + int lro_enable, tc; + struct qlnx_tx_queue *txq; + uint16_t elem_left; lro_enable = ha->ifp->if_capenable & IFCAP_LRO; @@ -4312,10 +4601,36 @@ qlnx_fp_isr(void *arg) do { for (tc = 0; tc < ha->num_tc; tc++) { - if (mtx_trylock(&fp->tx_mtx)) { - qlnx_tx_int(ha, fp, fp->txq[tc]); - mtx_unlock(&fp->tx_mtx); - } + + txq = fp->txq[tc]; + + if((int)(elem_left = + ecore_chain_get_elem_left(&txq->tx_pbl)) < + QLNX_TX_ELEM_THRESH) { + + if (mtx_trylock(&fp->tx_mtx)) { +#ifdef QLNX_TRACE_PERF_DATA + tx_compl = fp->tx_pkts_completed; +#endif + + qlnx_tx_int(ha, fp, fp->txq[tc]); +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_compl_intr += + (fp->tx_pkts_completed - tx_compl); + if ((fp->tx_pkts_completed - tx_compl) <= 32) + fp->tx_comInt[0]++; + else if (((fp->tx_pkts_completed - tx_compl) > 32) && + ((fp->tx_pkts_completed - tx_compl) <= 64)) + fp->tx_comInt[1]++; + else if(((fp->tx_pkts_completed - tx_compl) > 64) && + ((fp->tx_pkts_completed - tx_compl) <= 128)) + fp->tx_comInt[2]++; + else if(((fp->tx_pkts_completed - tx_compl) > 128)) + fp->tx_comInt[3]++; +#endif + mtx_unlock(&fp->tx_mtx); + } + } } rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, @@ -4328,7 +4643,6 @@ qlnx_fp_isr(void *arg) } while (rx_int); - #ifdef QLNX_SOFT_LRO { struct lro_ctrl *lro; @@ -4608,8 +4922,8 @@ qlnx_alloc_tx_dma_tag(qlnx_host_t *ha) NULL, NULL, /* filter, filterarg */ QLNX_MAX_TSO_FRAME_SIZE, /* maxsize */ QLNX_MAX_SEGMENTS, /* nsegments */ - (PAGE_SIZE * 4), /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + QLNX_MAX_TX_MBUF_SIZE, /* maxsegsize */ + 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ &ha->tx_tag)) { @@ -4642,7 +4956,7 @@ qlnx_alloc_rx_dma_tag(qlnx_host_t *ha) MJUM9BYTES, /* maxsize */ 1, /* nsegments */ MJUM9BYTES, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ &ha->rx_tag)) { @@ -5255,6 +5569,14 @@ qlnx_init_fp(qlnx_host_t *ha) fp->tx_pkts_freed = 0; fp->tx_pkts_transmitted = 0; fp->tx_pkts_completed = 0; + +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_trans_ctx = 0; + fp->tx_pkts_compl_ctx = 0; + fp->tx_pkts_trans_fp = 0; + fp->tx_pkts_compl_fp = 0; + fp->tx_pkts_compl_intr = 0; +#endif fp->tx_lso_wnd_min_len = 0; fp->tx_defrag = 0; fp->tx_nsegs_gt_elem_left = 0; @@ -6606,7 +6928,7 @@ qlnx_timer(void *arg) ecore_get_vport_stats(&ha->cdev, &ha->hw_stats); - if (ha->storm_stats_enable) + if (ha->storm_stats_gather) qlnx_sample_storm_stats(ha); callout_reset(&ha->qlnx_callout, hz, qlnx_timer, ha); @@ -6855,7 +7177,7 @@ qlnx_sample_storm_stats(qlnx_host_t *ha) struct ecore_hwfn *hwfn; if (ha->storm_stats_index >= QLNX_STORM_STATS_SAMPLES_PER_HWFN) { - ha->storm_stats_enable = 0; + ha->storm_stats_gather = 0; return; } Modified: stable/10/sys/dev/qlnx/qlnxe/qlnx_ver.h ============================================================================== --- stable/10/sys/dev/qlnx/qlnxe/qlnx_ver.h Thu Aug 24 22:11:10 2017 (r322863) +++ stable/10/sys/dev/qlnx/qlnxe/qlnx_ver.h Thu Aug 24 22:33:42 2017 (r322864) @@ -39,5 +39,5 @@ #define QLNX_VERSION_MAJOR 1 #define QLNX_VERSION_MINOR 4 -#define QLNX_VERSION_BUILD 6 +#define QLNX_VERSION_BUILD 7 Modified: stable/10/sys/modules/qlnx/qlnxe/Makefile ============================================================================== --- stable/10/sys/modules/qlnx/qlnxe/Makefile Thu Aug 24 22:11:10 2017 (r322863) +++ stable/10/sys/modules/qlnx/qlnxe/Makefile Thu Aug 24 22:33:42 2017 (r322864) @@ -52,7 +52,7 @@ SRCS+= pci_if.h CWARNEXTRA += -Wno-cast-qual -CFLAGS += -DQLNX_DEBUG +#CFLAGS += -DQLNX_DEBUG CFLAGS += -DECORE_PACKAGE CFLAGS += -DCONFIG_ECORE_L2 CFLAGS += -DECORE_CONFIG_DIRECT_HWFN From owner-svn-src-all@freebsd.org Thu Aug 24 22:56:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 693B0DE9BB6; Thu, 24 Aug 2017 22:56:23 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D4D26966A; Thu, 24 Aug 2017 22:56:23 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OMuMBM030693; Thu, 24 Aug 2017 22:56:22 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OMuMGX030692; Thu, 24 Aug 2017 22:56:22 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201708242256.v7OMuMGX030692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 24 Aug 2017 22:56:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322865 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 322865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 22:56:23 -0000 Author: erj Date: Thu Aug 24 22:56:22 2017 New Revision: 322865 URL: https://svnweb.freebsd.org/changeset/base/322865 Log: ixv(4): Add more robust mailbox API negotiation The previous update to the driver to 3.2.12-k changed the VF's API version to 1.2, but did not let the VF fall back to 1.1 or 1.0 versions. So, this patch tries 1.2 first, then the older versions in succession if that fails. This should allow the VF driver to negotiate 1.1 and work with older PF drivers, such as the one used in Amazon's EC2 service. PR: 220872 Submitted by: Jeb Cramer MFC after: 1 week Sponsored by: Intel Corporation Modified: head/sys/dev/ixgbe/if_ixv.c Modified: head/sys/dev/ixgbe/if_ixv.c ============================================================================== --- head/sys/dev/ixgbe/if_ixv.c Thu Aug 24 22:33:42 2017 (r322864) +++ head/sys/dev/ixgbe/if_ixv.c Thu Aug 24 22:56:22 2017 (r322865) @@ -93,6 +93,7 @@ static int ixv_configure_interrupts(struct adapte static void ixv_free_pci_resources(struct adapter *); static void ixv_local_timer(void *); static void ixv_setup_interface(device_t, struct adapter *); +static int ixv_negotiate_api(struct adapter *); static void ixv_initialize_transmit_units(struct adapter *); static void ixv_initialize_receive_units(struct adapter *); @@ -384,11 +385,10 @@ ixv_attach(device_t dev) } /* Negotiate mailbox API version */ - error = ixgbevf_negotiate_api_version(hw, ixgbe_mbox_api_12); + error = ixv_negotiate_api(adapter); if (error) { - device_printf(dev, "MBX API 1.2 negotiation failed! Error %d\n", - error); - error = EIO; + device_printf(dev, + "Mailbox API negotiation failed during attach!\n"); goto err_out; } @@ -584,10 +584,12 @@ ixv_init_locked(struct adapter *adapter) /* Reset VF and renegotiate mailbox API version */ hw->mac.ops.reset_hw(hw); - error = ixgbevf_negotiate_api_version(hw, ixgbe_mbox_api_12); - if (error) - device_printf(dev, "MBX API 1.2 negotiation failed! Error %d\n", - error); + error = ixv_negotiate_api(adapter); + if (error) { + device_printf(dev, + "Mailbox API negotiation failed in init_locked!\n"); + return; + } ixv_initialize_transmit_units(adapter); @@ -873,6 +875,31 @@ ixv_media_change(struct ifnet *ifp) return (0); } /* ixv_media_change */ + + +/************************************************************************ + * ixv_negotiate_api + * + * Negotiate the Mailbox API with the PF; + * start with the most featured API first. + ************************************************************************/ +static int +ixv_negotiate_api(struct adapter *adapter) +{ + struct ixgbe_hw *hw = &adapter->hw; + int mbx_api[] = { ixgbe_mbox_api_11, + ixgbe_mbox_api_10, + ixgbe_mbox_api_unknown }; + int i = 0; + + while (mbx_api[i] != ixgbe_mbox_api_unknown) { + if (ixgbevf_negotiate_api_version(hw, mbx_api[i]) == 0) + return (0); + i++; + } + + return (EINVAL); +} /* ixv_negotiate_api */ /************************************************************************ From owner-svn-src-all@freebsd.org Thu Aug 24 23:08:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DCDCDE9F0F; Thu, 24 Aug 2017 23:08:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44A0169C39; Thu, 24 Aug 2017 23:08:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ON8CkR034654; Thu, 24 Aug 2017 23:08:12 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ON8CBq034653; Thu, 24 Aug 2017 23:08:12 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201708242308.v7ON8CBq034653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 24 Aug 2017 23:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322866 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 322866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 23:08:13 -0000 Author: glebius Date: Thu Aug 24 23:08:12 2017 New Revision: 322866 URL: https://svnweb.freebsd.org/changeset/base/322866 Log: Garbage collect RT_NORTREF, which is no longer in use after FLOWTABLE removal. Modified: head/sys/net/route.h Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Thu Aug 24 22:56:22 2017 (r322865) +++ head/sys/net/route.h Thu Aug 24 23:08:12 2017 (r322866) @@ -67,8 +67,6 @@ struct route { #define RT_MAY_LOOP_BIT 3 /* dst may require loop copy */ #define RT_HAS_HEADER_BIT 4 /* mbuf already have its header prepended */ -#define RT_CACHING_CONTEXT 0x1 /* XXX: not used anywhere */ -#define RT_NORTREF 0x2 /* doesn't hold reference on ro_rt */ #define RT_L2_ME (1 << RT_L2_ME_BIT) /* 0x0004 */ #define RT_MAY_LOOP (1 << RT_MAY_LOOP_BIT) /* 0x0008 */ #define RT_HAS_HEADER (1 << RT_HAS_HEADER_BIT) /* 0x0010 */ @@ -411,14 +409,8 @@ struct rt_addrinfo { #define RO_RTFREE(_ro) do { \ if ((_ro)->ro_rt) { \ - if ((_ro)->ro_flags & RT_NORTREF) { \ - (_ro)->ro_flags &= ~RT_NORTREF; \ - (_ro)->ro_rt = NULL; \ - (_ro)->ro_lle = NULL; \ - } else { \ - RT_LOCK((_ro)->ro_rt); \ - RTFREE_LOCKED((_ro)->ro_rt); \ - } \ + RT_LOCK((_ro)->ro_rt); \ + RTFREE_LOCKED((_ro)->ro_rt); \ } \ } while (0) From owner-svn-src-all@freebsd.org Thu Aug 24 23:09:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48C42DE9FA8; Thu, 24 Aug 2017 23:09:40 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 31D2069DA6; Thu, 24 Aug 2017 23:09:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v7ON9cx3017856 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 24 Aug 2017 16:09:38 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v7ON9bJ4017855; Thu, 24 Aug 2017 16:09:38 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 24 Aug 2017 16:09:37 -0700 From: Gleb Smirnoff To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322866 - head/sys/net Message-ID: <20170824230937.GI1071@FreeBSD.org> References: <201708242308.v7ON8CBq034653@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201708242308.v7ON8CBq034653@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 23:09:40 -0000 Hi, On Thu, Aug 24, 2017 at 11:08:12PM +0000, Gleb Smirnoff wrote: T> Log: T> Garbage collect RT_NORTREF, which is no longer in use after FLOWTABLE removal. T> T> Modified: T> head/sys/net/route.h T> T> Modified: head/sys/net/route.h T> ============================================================================== T> --- head/sys/net/route.h Thu Aug 24 22:56:22 2017 (r322865) T> +++ head/sys/net/route.h Thu Aug 24 23:08:12 2017 (r322866) T> @@ -67,8 +67,6 @@ struct route { T> #define RT_MAY_LOOP_BIT 3 /* dst may require loop copy */ T> #define RT_HAS_HEADER_BIT 4 /* mbuf already have its header prepended */ T> T> -#define RT_CACHING_CONTEXT 0x1 /* XXX: not used anywhere */ T> -#define RT_NORTREF 0x2 /* doesn't hold reference on ro_rt */ T> #define RT_L2_ME (1 << RT_L2_ME_BIT) /* 0x0004 */ T> #define RT_MAY_LOOP (1 << RT_MAY_LOOP_BIT) /* 0x0008 */ T> #define RT_HAS_HEADER (1 << RT_HAS_HEADER_BIT) /* 0x0010 */ T> @@ -411,14 +409,8 @@ struct rt_addrinfo { T> T> #define RO_RTFREE(_ro) do { \ T> if ((_ro)->ro_rt) { \ T> - if ((_ro)->ro_flags & RT_NORTREF) { \ T> - (_ro)->ro_flags &= ~RT_NORTREF; \ T> - (_ro)->ro_rt = NULL; \ T> - (_ro)->ro_lle = NULL; \ T> - } else { \ T> - RT_LOCK((_ro)->ro_rt); \ T> - RTFREE_LOCKED((_ro)->ro_rt); \ T> - } \ T> + RT_LOCK((_ro)->ro_rt); \ T> + RTFREE_LOCKED((_ro)->ro_rt); \ T> } \ T> } while (0) It may also make sense to unroll all instances of RO_RTFREE into two lines of code and remove RO_RTFREE() as well. But I don't have solid opinion on that. Anyone to support me on this as well? -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Fri Aug 25 00:11:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F455DEB349; Fri, 25 Aug 2017 00:11:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BC136B7B1; Fri, 25 Aug 2017 00:11:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P0BTMo061948; Fri, 25 Aug 2017 00:11:29 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P0BTHr061947; Fri, 25 Aug 2017 00:11:29 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708250011.v7P0BTHr061947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Fri, 25 Aug 2017 00:11:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322867 - stable/10/sys/conf X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/sys/conf X-SVN-Commit-Revision: 322867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 00:11:30 -0000 Author: marius Date: Fri Aug 25 00:11:29 2017 New Revision: 322867 URL: https://svnweb.freebsd.org/changeset/base/322867 Log: Update stable/10 to BETA2 in preparation for 10.4-BETA2 builds. Approved by: re (implicit) Modified: stable/10/sys/conf/newvers.sh Modified: stable/10/sys/conf/newvers.sh ============================================================================== --- stable/10/sys/conf/newvers.sh Thu Aug 24 23:08:12 2017 (r322866) +++ stable/10/sys/conf/newvers.sh Fri Aug 25 00:11:29 2017 (r322867) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.4" -BRANCH="BETA1" +BRANCH="BETA2" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Fri Aug 25 00:28:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0910DEB9E9; Fri, 25 Aug 2017 00:28:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B32326C0DA; Fri, 25 Aug 2017 00:28:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P0SugI067109; Fri, 25 Aug 2017 00:28:56 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P0SuB7067106; Fri, 25 Aug 2017 00:28:56 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708250028.v7P0SuB7067106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 25 Aug 2017 00:28:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322868 - head/etc/periodic/security X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/etc/periodic/security X-SVN-Commit-Revision: 322868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 00:28:58 -0000 Author: asomers Date: Fri Aug 25 00:28:56 2017 New Revision: 322868 URL: https://svnweb.freebsd.org/changeset/base/322868 Log: Fix 100.chksetuid and 110.neggrpperm for mountpoints with spaces Also, fix them for mountpoints with tabs. PR: 48325 Reported by: pguyot@kallisys.net, aaron@baugher.biz MFC after: 3 weeks Modified: head/etc/periodic/security/100.chksetuid head/etc/periodic/security/110.neggrpperm head/etc/periodic/security/security.functions Modified: head/etc/periodic/security/100.chksetuid ============================================================================== --- head/etc/periodic/security/100.chksetuid Fri Aug 25 00:11:29 2017 (r322867) +++ head/etc/periodic/security/100.chksetuid Fri Aug 25 00:28:56 2017 (r322868) @@ -45,7 +45,13 @@ if check_yesno_period security_status_chksetuid_enable then echo "" echo 'Checking setuid files and devices:' - MP=`mount -t ufs,zfs | awk '$0 !~ /no(suid|exec)/ { print $3 }'` + IFS=$'\n' # Don't split mount points with spaces or tabs + MP=`mount -t ufs,zfs | awk ' + $0 !~ /no(suid|exec)/ { + sub(/^.* on \//, "/"); + sub(/ \(.*\)/, ""); + print $0 + }'` find -sx $MP /dev/null \( ! -fstype local \) -prune -o -type f \ \( -perm -u+x -or -perm -g+x -or -perm -o+x \) \ \( -perm -u+s -or -perm -g+s \) -exec ls -liTd \{\} \+ | Modified: head/etc/periodic/security/110.neggrpperm ============================================================================== --- head/etc/periodic/security/110.neggrpperm Fri Aug 25 00:11:29 2017 (r322867) +++ head/etc/periodic/security/110.neggrpperm Fri Aug 25 00:28:56 2017 (r322868) @@ -43,7 +43,13 @@ if check_yesno_period security_status_neggrpperm_enabl then echo "" echo 'Checking negative group permissions:' - MP=`mount -t ufs,zfs | awk '$0 !~ /no(suid|exec)/ { print $3 }'` + IFS=$'\n' # Don't split mount points with spaces or tabs + MP=`mount -t ufs,zfs | awk ' + $0 !~ /no(suid|exec)/ { + sub(/^.* on \//, "/"); + sub(/ \(.*\)/, ""); + print $0 + }'` n=$(find -sx $MP /dev/null \( ! -fstype local \) -prune -o -type f \ \( \( ! -perm +010 -and -perm +001 \) -or \ \( ! -perm +020 -and -perm +002 \) -or \ Modified: head/etc/periodic/security/security.functions ============================================================================== --- head/etc/periodic/security/security.functions Fri Aug 25 00:11:29 2017 (r322867) +++ head/etc/periodic/security/security.functions Fri Aug 25 00:28:56 2017 (r322868) @@ -48,6 +48,7 @@ rc=0 # LABEL is the base name of the ${LOG}/${label}.{today,yesterday} files. check_diff() { + unset IFS rc=0 if [ "$1" = "new_only" ]; then shift From owner-svn-src-all@freebsd.org Fri Aug 25 02:37:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 832B3DED6B2; Fri, 25 Aug 2017 02:37:33 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 547936F3AB; Fri, 25 Aug 2017 02:37:33 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P2bWNq019310; Fri, 25 Aug 2017 02:37:32 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P2bWHs019309; Fri, 25 Aug 2017 02:37:32 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708250237.v7P2bWHs019309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 25 Aug 2017 02:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322869 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 322869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 02:37:33 -0000 Author: bde Date: Fri Aug 25 02:37:32 2017 New Revision: 322869 URL: https://svnweb.freebsd.org/changeset/base/322869 Log: Fix missing switching of the terminal emulator when switching the terminal state for kernel console output. r56043 in 2000 added many complications to support dynamic selection of the terminal emulator using modules and the ioctl CONS_SETTERM. This was never completed. There are still no modules, but it is easy to restore the scterm and dumb emulators at compile time. Then boot-time configuration for the preferred one doesn't work right, but CONS_SETTERM almost works after fixing this bug. CONS_SETTERM only switches the emulator for the user state, leaving the kernel state(s) still using the boot-time emulator. The fix is especially important when switching from sc to scteken, since the scteken state has pointers in it. Rename kernel_console_ts to sc_kts. Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Fri Aug 25 00:28:56 2017 (r322868) +++ head/sys/dev/syscons/syscons.c Fri Aug 25 02:37:32 2017 (r322869) @@ -98,7 +98,8 @@ static int sc_console_unit = -1; static int sc_saver_keyb_only = 1; static scr_stat *sc_console; static struct consdev *sc_consptr; -static void *kernel_console_ts[MAXCPU]; +static void *sc_kts[MAXCPU]; +static struct sc_term_sw *sc_ktsw; static scr_stat main_console; static struct tty *main_devs[MAXCONS]; @@ -564,6 +565,7 @@ sc_attach_unit(int unit, int flags) scinit(unit, flags); if (sc_console->tsw->te_size > 0) { + sc_ktsw = sc_console->tsw; /* assert(sc_console->ts != NULL); */ oldts = sc_console->ts; for (i = 0; i <= mp_maxid; i++) { @@ -573,7 +575,7 @@ sc_attach_unit(int unit, int flags) sc_console->ts = ts; (*sc_console->tsw->te_default_attr)(sc_console, sc_kattrtab[i], SC_KERNEL_CONS_REV_ATTR); - kernel_console_ts[i] = ts; + sc_kts[i] = ts; } sc_console->ts = oldts; (*sc_console->tsw->te_default_attr)(sc_console, SC_NORM_ATTR, @@ -1728,11 +1730,14 @@ sc_cnterm(struct consdev *cp) sccnupdate(sc_console); #endif - for (i = 0; i <= mp_maxid; i++) { - ts = kernel_console_ts[i]; - kernel_console_ts[i] = NULL; - (*sc_console->tsw->te_term)(sc_console, &ts); - free(ts, M_DEVBUF); + if (sc_ktsw != NULL) { + for (i = 0; i <= mp_maxid; i++) { + ts = sc_kts[i]; + sc_kts[i] = NULL; + (*sc_ktsw->te_term)(sc_console, &ts); + free(ts, M_DEVBUF); + } + sc_ktsw = NULL; } scterm(sc_console_unit, SC_KERNEL_CONSOLE); sc_console_unit = -1; @@ -1992,13 +1997,16 @@ sc_cnputc(struct consdev *cd, int c) sizeof(sc_cnputc_log)) continue; /* Console output has a per-CPU "input" state. Switch for it. */ + oldtsw = scp->tsw; oldts = scp->ts; - ts = kernel_console_ts[PCPU_GET(cpuid)]; + ts = sc_kts[PCPU_GET(cpuid)]; if (ts != NULL) { + scp->tsw = sc_ktsw; scp->ts = ts; (*scp->tsw->te_sync)(scp); } sc_puts(scp, buf, 1); + scp->tsw = oldtsw; scp->ts = oldts; (*scp->tsw->te_sync)(scp); } From owner-svn-src-all@freebsd.org Fri Aug 25 02:41:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55C9FDED763; Fri, 25 Aug 2017 02:41:02 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 206216F552; Fri, 25 Aug 2017 02:41:02 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P2f1bD020212; Fri, 25 Aug 2017 02:41:01 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P2f1La020211; Fri, 25 Aug 2017 02:41:01 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708250241.v7P2f1La020211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 25 Aug 2017 02:41:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322870 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 322870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 02:41:02 -0000 Author: bde Date: Fri Aug 25 02:41:01 2017 New Revision: 322870 URL: https://svnweb.freebsd.org/changeset/base/322870 Log: Oops, the previous commit was missing 1 line. Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Fri Aug 25 02:37:32 2017 (r322869) +++ head/sys/dev/syscons/syscons.c Fri Aug 25 02:41:01 2017 (r322870) @@ -1933,6 +1933,7 @@ sc_cnputc(struct consdev *cd, int c) u_char buf[1]; scr_stat *scp = sc_console; void *oldts, *ts; + struct sc_term_sw *oldtsw; #ifndef SC_NO_HISTORY #if 0 struct tty *tp; From owner-svn-src-all@freebsd.org Fri Aug 25 03:15:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3AE5DEDFA3; Fri, 25 Aug 2017 03:15:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9000707A2; Fri, 25 Aug 2017 03:15:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P3FITI036184; Fri, 25 Aug 2017 03:15:18 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P3FID8036183; Fri, 25 Aug 2017 03:15:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708250315.v7P3FID8036183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 25 Aug 2017 03:15:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322872 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 322872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 03:15:20 -0000 Author: imp Date: Fri Aug 25 03:15:18 2017 New Revision: 322872 URL: https://svnweb.freebsd.org/changeset/base/322872 Log: Enable bus mastering on the device before resetting the device. The card has to do PCIe transactions to complete the reset process, but can't do them, per the PCIe spec, unless bus mastering is enabled. Submitted by: Kinjal Patel PR: 22166 Modified: head/sys/dev/nvme/nvme.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Fri Aug 25 02:48:31 2017 (r322871) +++ head/sys/dev/nvme/nvme.c Fri Aug 25 03:15:18 2017 (r322872) @@ -246,6 +246,12 @@ nvme_attach(device_t dev) } /* + * Enable busmastering so the completion status messages can + * be busmastered back to the host. + */ + pci_enable_busmaster(dev); + + /* * Reset controller twice to ensure we do a transition from cc.en==1 * to cc.en==0. This is because we don't really know what status * the controller was left in when boot handed off to OS. @@ -261,8 +267,6 @@ nvme_attach(device_t dev) nvme_ctrlr_destruct(ctrlr, dev); return (status); } - - pci_enable_busmaster(dev); ctrlr->config_hook.ich_func = nvme_ctrlr_start_config_hook; ctrlr->config_hook.ich_arg = ctrlr; From owner-svn-src-all@freebsd.org Fri Aug 25 03:18:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAF8FDEE0FE; Fri, 25 Aug 2017 03:18:30 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C35270A0C; Fri, 25 Aug 2017 03:18:30 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id C0C8E9D84; Fri, 25 Aug 2017 03:18:29 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 93906728B; Fri, 25 Aug 2017 03:18:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id 1ldS6IP9FPuL; Fri, 25 Aug 2017 03:18:25 +0000 (UTC) Subject: Re: svn commit: r306512 - in head/sys: kern sys DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 4E0367286 To: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Konstantin Belousov References: <201609301727.u8UHRIgD051373@repo.freebsd.org> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <6ea06065-ea5c-b83b-3854-224626be0d77@FreeBSD.org> Date: Thu, 24 Aug 2017 20:18:03 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <201609301727.u8UHRIgD051373@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gf0jINtmXxvW3VvgtjP6UiJJWd4L63TTo" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 03:18:30 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --gf0jINtmXxvW3VvgtjP6UiJJWd4L63TTo Content-Type: multipart/mixed; boundary="W4A4iApjpvSIriNGx07PeIPoIwROtm800"; protected-headers="v1" From: Bryan Drewery To: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Konstantin Belousov Message-ID: <6ea06065-ea5c-b83b-3854-224626be0d77@FreeBSD.org> Subject: Re: svn commit: r306512 - in head/sys: kern sys References: <201609301727.u8UHRIgD051373@repo.freebsd.org> In-Reply-To: <201609301727.u8UHRIgD051373@repo.freebsd.org> --W4A4iApjpvSIriNGx07PeIPoIwROtm800 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 9/30/2016 10:27 AM, Mateusz Guzik wrote: > Author: mjg > Date: Fri Sep 30 17:27:17 2016 > New Revision: 306512 > URL: https://svnweb.freebsd.org/changeset/base/306512 >=20 > Log: > vfs: batch free vnodes in per-mnt lists > =20 > Previously free vnodes would always by directly returned to the globa= l > LRU list. With this change up to mnt_free_list_batch vnodes are colle= cted > first. > =20 > syncer runs always return the batch regardless of its size. > =20 > While vnodes on per-mnt lists are not counted as free, they can be > returned in case of vnode shortage. > =20 > Reviewed by: kib > Tested by: pho >=20 > Modified: > head/sys/kern/vfs_mount.c > head/sys/kern/vfs_subr.c > head/sys/sys/mount.h > head/sys/sys/vnode.h >=20 =2E.. > @@ -2753,17 +2824,25 @@ _vhold(struct vnode *vp, bool locked) > * Remove a vnode from the free list, mark it as in use, > * and put it on the active list. > */ > - mtx_lock(&vnode_free_list_mtx); > - TAILQ_REMOVE(&vnode_free_list, vp, v_actfreelist); > - freevnodes--; > - vp->v_iflag &=3D ~VI_FREE; > + mp =3D vp->v_mount; > + mtx_lock(&mp->mnt_listmtx); ^^ > + if ((vp->v_mflag & VMP_TMPMNTFREELIST) !=3D 0) { > + TAILQ_REMOVE(&mp->mnt_tmpfreevnodelist, vp, v_actfreelist); > + mp->mnt_tmpfreevnodelistsize--; > + vp->v_mflag &=3D ~VMP_TMPMNTFREELIST; > + } else { > + mtx_lock(&vnode_free_list_mtx); > + TAILQ_REMOVE(&vnode_free_list, vp, v_actfreelist); > + freevnodes--; > + mtx_unlock(&vnode_free_list_mtx); > + } > KASSERT((vp->v_iflag & VI_ACTIVE) =3D=3D 0, > ("Activating already active vnode")); > + vp->v_iflag &=3D ~VI_FREE; > vp->v_iflag |=3D VI_ACTIVE; > - mp =3D vp->v_mount; > TAILQ_INSERT_HEAD(&mp->mnt_activevnodelist, vp, v_actfreelist); > mp->mnt_activevnodelistsize++; > - mtx_unlock(&vnode_free_list_mtx); > + mtx_unlock(&mp->mnt_listmtx); > refcount_acquire(&vp->v_holdcnt); > if (!locked) > VI_UNLOCK(vp); > @@ -2819,21 +2898,25 @@ _vdrop(struct vnode *vp, bool locked) > if ((vp->v_iflag & VI_OWEINACT) =3D=3D 0) { > vp->v_iflag &=3D ~VI_ACTIVE; > mp =3D vp->v_mount; > - mtx_lock(&vnode_free_list_mtx); > + mtx_lock(&mp->mnt_listmtx); ^^ If code runs getnewvnode() and then immediately runs vhold() or vrele(), without first running insmntque(vp, mp), then vp->v_mount is NULL here and the lock/freelist dereferencing just panic. Locking the vnode and then using vgone() and vput() on it avoids the issue since it marks the vnode VI_DOOMED and instead frees it in _vdrop() rather than try to re-add it to its NULL per-mount free list. I'm not sure what the right thing here is. Is it a requirement to insmntque() a new vnode immediately, or to vgone() it before releasing it if was just returned from getnewvnode()? Perhaps these cases should assert that v_mount is not NULL or handle the odd case and just free the vnode instead, or can it still just add to the global vnode_free_list if mp is NULL? The old code handled the case fine since the freelist was global and not per-mount. 'mp' was only dereferenced below if the vnode had been active, which was not the case for my example. > if (active) { > TAILQ_REMOVE(&mp->mnt_activevnodelist, vp, > v_actfreelist); > mp->mnt_activevnodelistsize--; > } > - TAILQ_INSERT_TAIL(&vnode_free_list, vp, > + TAILQ_INSERT_TAIL(&mp->mnt_tmpfreevnodelist, vp, > v_actfreelist); > - freevnodes++; > + mp->mnt_tmpfreevnodelistsize++; > vp->v_iflag |=3D VI_FREE; > - mtx_unlock(&vnode_free_list_mtx); > + vp->v_mflag |=3D VMP_TMPMNTFREELIST; > + VI_UNLOCK(vp); > + if (mp->mnt_tmpfreevnodelistsize >=3D mnt_free_list_batch) > + vnlru_return_batch_locked(mp); > + mtx_unlock(&mp->mnt_listmtx); > } else { > + VI_UNLOCK(vp); > atomic_add_long(&free_owe_inact, 1); > } > - VI_UNLOCK(vp); > return; > } > /* --=20 Regards, Bryan Drewery --W4A4iApjpvSIriNGx07PeIPoIwROtm800-- --gf0jINtmXxvW3VvgtjP6UiJJWd4L63TTo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJZn5bxAAoJEDXXcbtuRpfPKMYIAKtRFjDNaq8J+4uSaeptaHBz DK71HOEk+C7vmFm5wWb+Mvhg+bBqlqwO7/ohQT4rYQ3TnxZHEnknR4Gbk0ClzHJa fajS9AdzfdL1qN8mDhfIErNf9UDfcgu4Nc2G8mmaorXvylb29vgv91hf924s1RhX 9CFTqe5tI+v3mbfOO6jj5qvptuIV5MgnaTyb/9M7v81fm1jYo5mUWUx+EXTFBnDL f16f6k3KzdHH2+MjGqstOOokui79WQL5f/URo8NS4qcTDIlqTdNU9IhOEslP65El f1neC87RdTX9WiRfWavAc6TeZzvSI6j95d0y3SYVjvLqpj5oTzjVgqJNWnkLadE= =AwAI -----END PGP SIGNATURE----- --gf0jINtmXxvW3VvgtjP6UiJJWd4L63TTo-- From owner-svn-src-all@freebsd.org Fri Aug 25 04:00:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8552ADEEB20; Fri, 25 Aug 2017 04:00:14 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 519DF71A02; Fri, 25 Aug 2017 04:00:14 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P40DFn052371; Fri, 25 Aug 2017 04:00:13 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P40DnW052370; Fri, 25 Aug 2017 04:00:13 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708250400.v7P40DnW052370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 25 Aug 2017 04:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322873 - stable/11/bin/echo/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/bin/echo/tests X-SVN-Commit-Revision: 322873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 04:00:14 -0000 Author: asomers Date: Fri Aug 25 04:00:13 2017 New Revision: 322873 URL: https://svnweb.freebsd.org/changeset/base/322873 Log: MFC r320269: style fixes in bin/echo/tests Submitted by: shivansh Reviewed by: asomers X-MFC-With: 319626 Sponsored by: Google, Inc (GSoC 2017) Differential Revision: https://reviews.freebsd.org/D11318 Modified: stable/11/bin/echo/tests/echo_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/echo/tests/echo_test.sh ============================================================================== --- stable/11/bin/echo/tests/echo_test.sh Fri Aug 25 03:15:18 2017 (r322872) +++ stable/11/bin/echo/tests/echo_test.sh Fri Aug 25 04:00:13 2017 (r322873) @@ -27,29 +27,33 @@ # atf_test_case n_output -n_output_head() { - atf_set "descr" "Verify that echo(1) does not print the trailing " \ - "newline character with option '-n'" +n_output_head() +{ + atf_set "descr" "Verify that echo(1) does not print the trailing " \ + "newline character with option '-n'" } -n_output_body() { - atf_check -s ignore -o inline:"Hello world" \ - /bin/echo -n "Hello world" +n_output_body() +{ + atf_check -s ignore -o inline:"Hello world" \ + /bin/echo -n "Hello world" } atf_test_case append_c_output -append_c_output_head() { - atf_set "descr" "Verify that echo(1) does not print the trailing newline " \ - "character when '\c' is appended to the end of the string" +append_c_output_head() +{ + atf_set "descr" "Verify that echo(1) does not print the trailing newline " \ + "character when '\c' is appended to the end of the string" } -append_c_output_body() { - atf_check -s ignore -o inline:"Hello world" \ - /bin/echo "Hello world\c" +append_c_output_body() +{ + atf_check -s ignore -o inline:"Hello world" \ + /bin/echo "Hello world\c" } atf_init_test_cases() { - atf_add_test_case n_output - atf_add_test_case append_c_output + atf_add_test_case n_output + atf_add_test_case append_c_output } From owner-svn-src-all@freebsd.org Fri Aug 25 04:05:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 368B3DEEE85; Fri, 25 Aug 2017 04:05:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E08E71DBB; Fri, 25 Aug 2017 04:05:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P45smP056427; Fri, 25 Aug 2017 04:05:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P45rBf056425; Fri, 25 Aug 2017 04:05:53 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708250405.v7P45rBf056425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 25 Aug 2017 04:05:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322874 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 322874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 04:05:55 -0000 Author: imp Date: Fri Aug 25 04:05:53 2017 New Revision: 322874 URL: https://svnweb.freebsd.org/changeset/base/322874 Log: Sanity check sizes Add compile time sanity checks to make sure that packed structures are the proper size, typically as defined in the NVMe standard. Modified: head/sys/dev/nvme/nvme.h head/sys/dev/nvme/nvme_util.c Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Fri Aug 25 04:00:13 2017 (r322873) +++ head/sys/dev/nvme/nvme.h Fri Aug 25 04:05:53 2017 (r322874) @@ -69,6 +69,8 @@ union cap_lo_register { } bits __packed; } __packed; +CTASSERT(sizeof(union cap_lo_register) == 4); + union cap_hi_register { uint32_t raw; struct { @@ -93,6 +95,8 @@ union cap_hi_register { } bits __packed; } __packed; +CTASSERT(sizeof(union cap_hi_register) == 4); + union cc_register { uint32_t raw; struct { @@ -123,6 +127,8 @@ union cc_register { } bits __packed; } __packed; +CTASSERT(sizeof(union cc_register) == 4); + enum shn_value { NVME_SHN_NORMAL = 0x1, NVME_SHN_ABRUPT = 0x2, @@ -144,6 +150,8 @@ union csts_register { } bits __packed; } __packed; +CTASSERT(sizeof(union csts_register) == 4); + enum shst_value { NVME_SHST_NORMAL = 0x0, NVME_SHST_OCCURRING = 0x1, @@ -165,6 +173,8 @@ union aqa_register { } bits __packed; } __packed; +CTASSERT(sizeof(union aqa_register) == 4); + struct nvme_registers { /** controller capabilities */ @@ -198,6 +208,8 @@ struct nvme_registers } doorbell[1] __packed; } __packed; +CTASSERT(sizeof(struct nvme_registers) == 0x1008); + struct nvme_command { /* dword 0 */ @@ -231,6 +243,8 @@ struct nvme_command uint32_t cdw15; /* command-specific */ } __packed; +CTASSERT(sizeof(struct nvme_command) == 16 * 4); + struct nvme_status { uint16_t p : 1; /* phase tag */ @@ -241,6 +255,8 @@ struct nvme_status { uint16_t dnr : 1; /* do not retry */ } __packed; +CTASSERT(sizeof(struct nvme_status) == 2); + struct nvme_completion { /* dword 0 */ @@ -258,6 +274,8 @@ struct nvme_completion { struct nvme_status status; } __packed; +CTASSERT(sizeof(struct nvme_completion) == 4 * 4); + struct nvme_dsm_range { uint32_t attributes; @@ -265,6 +283,8 @@ struct nvme_dsm_range { uint64_t starting_lba; } __packed; +CTASSERT(sizeof(struct nvme_dsm_range) == 16); + /* status code types */ enum nvme_status_code_type { NVME_SCT_GENERIC = 0x0, @@ -423,6 +443,8 @@ struct nvme_power_state { uint8_t ps_rsvd10[9]; } __packed; +CTASSERT(sizeof(struct nvme_power_state) == 32); + #define NVME_SERIAL_NUMBER_LENGTH 20 #define NVME_MODEL_NUMBER_LENGTH 40 #define NVME_FIRMWARE_REVISION_LENGTH 8 @@ -583,6 +605,8 @@ struct nvme_controller_data { uint8_t vs[1024]; } __packed __aligned(4); +CTASSERT(sizeof(struct nvme_controller_data) == 4096); + struct nvme_namespace_data { /** namespace size */ @@ -673,6 +697,8 @@ struct nvme_namespace_data { uint8_t vendor_specific[3712]; } __packed __aligned(4); +CTASSERT(sizeof(struct nvme_namespace_data) == 4096); + enum nvme_log_page { /* 0x00 - reserved */ @@ -715,6 +741,8 @@ struct nvme_error_information_entry { uint8_t reserved[35]; } __packed __aligned(4); +CTASSERT(sizeof(struct nvme_error_information_entry) == 64); + union nvme_critical_warning_state { uint8_t raw; @@ -729,6 +757,8 @@ union nvme_critical_warning_state { } __packed bits; } __packed; +CTASSERT(sizeof(union nvme_critical_warning_state) == 1); + struct nvme_health_information_page { union nvme_critical_warning_state critical_warning; @@ -765,6 +795,8 @@ struct nvme_health_information_page { uint8_t reserved2[296]; } __packed __aligned(4); +CTASSERT(sizeof(struct nvme_health_information_page) == 512); + struct nvme_firmware_page { struct { @@ -777,6 +809,8 @@ struct nvme_firmware_page { uint8_t reserved2[448]; } __packed __aligned(4); +CTASSERT(sizeof(struct nvme_firmware_page) == 512); + struct intel_log_temp_stats { uint64_t current; @@ -789,6 +823,8 @@ struct intel_log_temp_stats uint64_t min_oper_temp; uint64_t est_offset; } __packed __aligned(4); + +CTASSERT(sizeof(struct intel_log_temp_stats) == 13 * 8); #define NVME_TEST_MAX_THREADS 128 Modified: head/sys/dev/nvme/nvme_util.c ============================================================================== --- head/sys/dev/nvme/nvme_util.c Fri Aug 25 04:00:13 2017 (r322873) +++ head/sys/dev/nvme/nvme_util.c Fri Aug 25 04:05:53 2017 (r322874) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include void From owner-svn-src-all@freebsd.org Fri Aug 25 04:33:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F4C8DEF5C1; Fri, 25 Aug 2017 04:33:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F048E72936; Fri, 25 Aug 2017 04:33:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P4X74x068461; Fri, 25 Aug 2017 04:33:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P4X7h6068459; Fri, 25 Aug 2017 04:33:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708250433.v7P4X7h6068459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 25 Aug 2017 04:33:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322875 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 322875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 04:33:08 -0000 Author: imp Date: Fri Aug 25 04:33:06 2017 New Revision: 322875 URL: https://svnweb.freebsd.org/changeset/base/322875 Log: Use _Static_assert These files are compiled in userland too, so we can't use sys/systm.h and rely on CTASSERT. Switch to using _Static_assert instead. MFC After: 3 days Sponsored by: Netflix Modified: head/sys/dev/nvme/nvme.h head/sys/dev/nvme/nvme_util.c Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Fri Aug 25 04:05:53 2017 (r322874) +++ head/sys/dev/nvme/nvme.h Fri Aug 25 04:33:06 2017 (r322875) @@ -69,7 +69,7 @@ union cap_lo_register { } bits __packed; } __packed; -CTASSERT(sizeof(union cap_lo_register) == 4); +_Static_assert(sizeof(union cap_lo_register) == 4, "bad size for cap_lo_register"); union cap_hi_register { uint32_t raw; @@ -95,7 +95,7 @@ union cap_hi_register { } bits __packed; } __packed; -CTASSERT(sizeof(union cap_hi_register) == 4); +_Static_assert(sizeof(union cap_hi_register) == 4, "bad size of cap_hi_register"); union cc_register { uint32_t raw; @@ -127,7 +127,7 @@ union cc_register { } bits __packed; } __packed; -CTASSERT(sizeof(union cc_register) == 4); +_Static_assert(sizeof(union cc_register) == 4, "bad size for cc_register"); enum shn_value { NVME_SHN_NORMAL = 0x1, @@ -150,7 +150,7 @@ union csts_register { } bits __packed; } __packed; -CTASSERT(sizeof(union csts_register) == 4); +_Static_assert(sizeof(union csts_register) == 4, "bad size for csts_register"); enum shst_value { NVME_SHST_NORMAL = 0x0, @@ -173,7 +173,7 @@ union aqa_register { } bits __packed; } __packed; -CTASSERT(sizeof(union aqa_register) == 4); +_Static_assert(sizeof(union aqa_register) == 4, "bad size for aqa_resgister"); struct nvme_registers { @@ -208,7 +208,7 @@ struct nvme_registers } doorbell[1] __packed; } __packed; -CTASSERT(sizeof(struct nvme_registers) == 0x1008); +_Static_assert(sizeof(struct nvme_registers) == 0x1008, "bad size for nvme_registers"); struct nvme_command { @@ -243,7 +243,7 @@ struct nvme_command uint32_t cdw15; /* command-specific */ } __packed; -CTASSERT(sizeof(struct nvme_command) == 16 * 4); +_Static_assert(sizeof(struct nvme_command) == 16 * 4, "bad size for nvme_command"); struct nvme_status { @@ -255,7 +255,7 @@ struct nvme_status { uint16_t dnr : 1; /* do not retry */ } __packed; -CTASSERT(sizeof(struct nvme_status) == 2); +_Static_assert(sizeof(struct nvme_status) == 2, "bad size for nvme_status"); struct nvme_completion { @@ -274,7 +274,7 @@ struct nvme_completion { struct nvme_status status; } __packed; -CTASSERT(sizeof(struct nvme_completion) == 4 * 4); +_Static_assert(sizeof(struct nvme_completion) == 4 * 4, "bad size for nvme_completion"); struct nvme_dsm_range { @@ -283,7 +283,7 @@ struct nvme_dsm_range { uint64_t starting_lba; } __packed; -CTASSERT(sizeof(struct nvme_dsm_range) == 16); +_Static_assert(sizeof(struct nvme_dsm_range) == 16, "bad size for nvme_dsm_ranage"); /* status code types */ enum nvme_status_code_type { @@ -443,7 +443,7 @@ struct nvme_power_state { uint8_t ps_rsvd10[9]; } __packed; -CTASSERT(sizeof(struct nvme_power_state) == 32); +_Static_assert(sizeof(struct nvme_power_state) == 32, "bad size for nvme_power_state"); #define NVME_SERIAL_NUMBER_LENGTH 20 #define NVME_MODEL_NUMBER_LENGTH 40 @@ -605,7 +605,7 @@ struct nvme_controller_data { uint8_t vs[1024]; } __packed __aligned(4); -CTASSERT(sizeof(struct nvme_controller_data) == 4096); +_Static_assert(sizeof(struct nvme_controller_data) == 4096, "bad size for nvme_controller_data"); struct nvme_namespace_data { @@ -697,7 +697,7 @@ struct nvme_namespace_data { uint8_t vendor_specific[3712]; } __packed __aligned(4); -CTASSERT(sizeof(struct nvme_namespace_data) == 4096); +_Static_assert(sizeof(struct nvme_namespace_data) == 4096, "bad size for nvme_namepsace_data"); enum nvme_log_page { @@ -741,7 +741,7 @@ struct nvme_error_information_entry { uint8_t reserved[35]; } __packed __aligned(4); -CTASSERT(sizeof(struct nvme_error_information_entry) == 64); +_Static_assert(sizeof(struct nvme_error_information_entry) == 64, "bad size for nvme_error_information_entry"); union nvme_critical_warning_state { @@ -757,7 +757,7 @@ union nvme_critical_warning_state { } __packed bits; } __packed; -CTASSERT(sizeof(union nvme_critical_warning_state) == 1); +_Static_assert(sizeof(union nvme_critical_warning_state) == 1, "bad size for nvme_critical_warning_state"); struct nvme_health_information_page { @@ -795,7 +795,7 @@ struct nvme_health_information_page { uint8_t reserved2[296]; } __packed __aligned(4); -CTASSERT(sizeof(struct nvme_health_information_page) == 512); +_Static_assert(sizeof(struct nvme_health_information_page) == 512, "bad size for nvme_health_information_page"); struct nvme_firmware_page { @@ -809,7 +809,7 @@ struct nvme_firmware_page { uint8_t reserved2[448]; } __packed __aligned(4); -CTASSERT(sizeof(struct nvme_firmware_page) == 512); +_Static_assert(sizeof(struct nvme_firmware_page) == 512, "bad size for nvme_firmware_page"); struct intel_log_temp_stats { @@ -824,7 +824,7 @@ struct intel_log_temp_stats uint64_t est_offset; } __packed __aligned(4); -CTASSERT(sizeof(struct intel_log_temp_stats) == 13 * 8); +_Static_assert(sizeof(struct intel_log_temp_stats) == 13 * 8, "bad size for intel_log_temp_stats"); #define NVME_TEST_MAX_THREADS 128 Modified: head/sys/dev/nvme/nvme_util.c ============================================================================== --- head/sys/dev/nvme/nvme_util.c Fri Aug 25 04:05:53 2017 (r322874) +++ head/sys/dev/nvme/nvme_util.c Fri Aug 25 04:33:06 2017 (r322875) @@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include void From owner-svn-src-all@freebsd.org Fri Aug 25 05:41:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4DD1DF02E0; Fri, 25 Aug 2017 05:41:29 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E8A673E07; Fri, 25 Aug 2017 05:41:29 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P5fSx6094236; Fri, 25 Aug 2017 05:41:28 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P5fSCV094235; Fri, 25 Aug 2017 05:41:28 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201708250541.v7P5fSCV094235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 25 Aug 2017 05:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322876 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 322876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 05:41:29 -0000 Author: jkim Date: Fri Aug 25 05:41:28 2017 New Revision: 322876 URL: https://svnweb.freebsd.org/changeset/base/322876 Log: MFC: r322803 Fix size to copyout(9) for cpuset_getid(2). Modified: stable/11/sys/kern/kern_cpuset.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_cpuset.c ============================================================================== --- stable/11/sys/kern/kern_cpuset.c Fri Aug 25 04:33:06 2017 (r322875) +++ stable/11/sys/kern/kern_cpuset.c Fri Aug 25 05:41:28 2017 (r322876) @@ -1063,7 +1063,7 @@ kern_cpuset_getid(struct thread *td, cpulevel_t level, tmpid = set->cs_id; cpuset_rel(set); if (error == 0) - error = copyout(&tmpid, setid, sizeof(id)); + error = copyout(&tmpid, setid, sizeof(tmpid)); return (error); } From owner-svn-src-all@freebsd.org Fri Aug 25 05:49:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAF2ADF0394; Fri, 25 Aug 2017 05:49:39 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93368740EE; Fri, 25 Aug 2017 05:49:39 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P5ncDX096892; Fri, 25 Aug 2017 05:49:38 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P5nb2P096879; Fri, 25 Aug 2017 05:49:37 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201708250549.v7P5nb2P096879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 25 Aug 2017 05:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322877 - in stable/11: sys/conf sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/c... X-SVN-Group: stable-11 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in stable/11: sys/conf sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/disassembler sy... X-SVN-Commit-Revision: 322877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 05:49:40 -0000 Author: jkim Date: Fri Aug 25 05:49:37 2017 New Revision: 322877 URL: https://svnweb.freebsd.org/changeset/base/322877 Log: MFC: r319365, r321670 Merge ACPICA 20170728. Added: stable/11/sys/contrib/dev/acpica/common/dmswitch.c - copied unchanged from r319365, head/sys/contrib/dev/acpica/common/dmswitch.c stable/11/sys/contrib/dev/acpica/compiler/aslparseop.c - copied unchanged from r321670, head/sys/contrib/dev/acpica/compiler/aslparseop.c stable/11/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c - copied unchanged from r321670, head/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c stable/11/sys/contrib/dev/acpica/components/utilities/utresdecode.c - copied unchanged from r319365, head/sys/contrib/dev/acpica/components/utilities/utresdecode.c Modified: stable/11/sys/conf/files stable/11/sys/contrib/dev/acpica/changes.txt stable/11/sys/contrib/dev/acpica/common/acfileio.c stable/11/sys/contrib/dev/acpica/common/adfile.c stable/11/sys/contrib/dev/acpica/common/adisasm.c stable/11/sys/contrib/dev/acpica/common/adwalk.c stable/11/sys/contrib/dev/acpica/common/ahids.c stable/11/sys/contrib/dev/acpica/common/ahpredef.c stable/11/sys/contrib/dev/acpica/common/ahtable.c stable/11/sys/contrib/dev/acpica/common/ahuuids.c stable/11/sys/contrib/dev/acpica/common/dmextern.c stable/11/sys/contrib/dev/acpica/common/dmrestag.c stable/11/sys/contrib/dev/acpica/common/dmtable.c stable/11/sys/contrib/dev/acpica/common/dmtbdump.c stable/11/sys/contrib/dev/acpica/common/dmtbinfo.c stable/11/sys/contrib/dev/acpica/compiler/aslanalyze.c stable/11/sys/contrib/dev/acpica/compiler/aslascii.c stable/11/sys/contrib/dev/acpica/compiler/aslbtypes.c stable/11/sys/contrib/dev/acpica/compiler/aslcodegen.c stable/11/sys/contrib/dev/acpica/compiler/aslcompile.c stable/11/sys/contrib/dev/acpica/compiler/aslcompiler.h stable/11/sys/contrib/dev/acpica/compiler/aslcompiler.l stable/11/sys/contrib/dev/acpica/compiler/aslcstyle.y stable/11/sys/contrib/dev/acpica/compiler/asldefine.h stable/11/sys/contrib/dev/acpica/compiler/aslerror.c stable/11/sys/contrib/dev/acpica/compiler/aslexternal.c stable/11/sys/contrib/dev/acpica/compiler/aslfold.c stable/11/sys/contrib/dev/acpica/compiler/aslglobal.h stable/11/sys/contrib/dev/acpica/compiler/aslhelp.c stable/11/sys/contrib/dev/acpica/compiler/aslhelpers.y stable/11/sys/contrib/dev/acpica/compiler/aslkeywords.y stable/11/sys/contrib/dev/acpica/compiler/asllength.c stable/11/sys/contrib/dev/acpica/compiler/asllisting.c stable/11/sys/contrib/dev/acpica/compiler/aslload.c stable/11/sys/contrib/dev/acpica/compiler/asllookup.c stable/11/sys/contrib/dev/acpica/compiler/aslmain.c stable/11/sys/contrib/dev/acpica/compiler/aslmap.c stable/11/sys/contrib/dev/acpica/compiler/aslmapoutput.c stable/11/sys/contrib/dev/acpica/compiler/aslmessages.c stable/11/sys/contrib/dev/acpica/compiler/aslmessages.h stable/11/sys/contrib/dev/acpica/compiler/aslmethod.c stable/11/sys/contrib/dev/acpica/compiler/asloffset.c stable/11/sys/contrib/dev/acpica/compiler/aslopcodes.c stable/11/sys/contrib/dev/acpica/compiler/aslopt.c stable/11/sys/contrib/dev/acpica/compiler/asloptions.c stable/11/sys/contrib/dev/acpica/compiler/aslparser.y stable/11/sys/contrib/dev/acpica/compiler/aslpld.c stable/11/sys/contrib/dev/acpica/compiler/aslpredef.c stable/11/sys/contrib/dev/acpica/compiler/aslprimaries.y stable/11/sys/contrib/dev/acpica/compiler/aslprintf.c stable/11/sys/contrib/dev/acpica/compiler/aslresource.c stable/11/sys/contrib/dev/acpica/compiler/aslresources.y stable/11/sys/contrib/dev/acpica/compiler/aslrestype2s.c stable/11/sys/contrib/dev/acpica/compiler/aslrules.y stable/11/sys/contrib/dev/acpica/compiler/aslstartup.c stable/11/sys/contrib/dev/acpica/compiler/aslsupport.l stable/11/sys/contrib/dev/acpica/compiler/aslsupport.y stable/11/sys/contrib/dev/acpica/compiler/asltokens.y stable/11/sys/contrib/dev/acpica/compiler/asltransform.c stable/11/sys/contrib/dev/acpica/compiler/asltree.c stable/11/sys/contrib/dev/acpica/compiler/asltypes.h stable/11/sys/contrib/dev/acpica/compiler/asltypes.y stable/11/sys/contrib/dev/acpica/compiler/aslutils.c stable/11/sys/contrib/dev/acpica/compiler/aslwalks.c stable/11/sys/contrib/dev/acpica/compiler/aslxref.c stable/11/sys/contrib/dev/acpica/compiler/cvcompiler.c stable/11/sys/contrib/dev/acpica/compiler/cvdisasm.c stable/11/sys/contrib/dev/acpica/compiler/cvparser.c stable/11/sys/contrib/dev/acpica/compiler/dtcompile.c stable/11/sys/contrib/dev/acpica/compiler/dtcompiler.h stable/11/sys/contrib/dev/acpica/compiler/dtfield.c stable/11/sys/contrib/dev/acpica/compiler/dttable1.c stable/11/sys/contrib/dev/acpica/compiler/dttable2.c stable/11/sys/contrib/dev/acpica/compiler/dttemplate.h stable/11/sys/contrib/dev/acpica/compiler/dtutils.c stable/11/sys/contrib/dev/acpica/compiler/prmacros.c stable/11/sys/contrib/dev/acpica/components/debugger/dbdisply.c stable/11/sys/contrib/dev/acpica/components/debugger/dbexec.c stable/11/sys/contrib/dev/acpica/components/debugger/dbobject.c stable/11/sys/contrib/dev/acpica/components/debugger/dbxface.c stable/11/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c stable/11/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c stable/11/sys/contrib/dev/acpica/components/disassembler/dmopcode.c stable/11/sys/contrib/dev/acpica/components/disassembler/dmresrc.c stable/11/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c stable/11/sys/contrib/dev/acpica/components/disassembler/dmwalk.c stable/11/sys/contrib/dev/acpica/components/dispatcher/dsargs.c stable/11/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c stable/11/sys/contrib/dev/acpica/components/dispatcher/dsfield.c stable/11/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c stable/11/sys/contrib/dev/acpica/components/dispatcher/dsobject.c stable/11/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c stable/11/sys/contrib/dev/acpica/components/dispatcher/dsutils.c stable/11/sys/contrib/dev/acpica/components/dispatcher/dswexec.c stable/11/sys/contrib/dev/acpica/components/dispatcher/dswload.c stable/11/sys/contrib/dev/acpica/components/dispatcher/dswload2.c stable/11/sys/contrib/dev/acpica/components/events/evxfevnt.c stable/11/sys/contrib/dev/acpica/components/executer/excreate.c stable/11/sys/contrib/dev/acpica/components/executer/exdebug.c stable/11/sys/contrib/dev/acpica/components/executer/exdump.c stable/11/sys/contrib/dev/acpica/components/executer/exmisc.c stable/11/sys/contrib/dev/acpica/components/executer/exoparg1.c stable/11/sys/contrib/dev/acpica/components/executer/exoparg2.c stable/11/sys/contrib/dev/acpica/components/executer/exresolv.c stable/11/sys/contrib/dev/acpica/components/hardware/hwregs.c stable/11/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c stable/11/sys/contrib/dev/acpica/components/namespace/nsaccess.c stable/11/sys/contrib/dev/acpica/components/namespace/nsarguments.c stable/11/sys/contrib/dev/acpica/components/namespace/nsinit.c stable/11/sys/contrib/dev/acpica/components/namespace/nsnames.c stable/11/sys/contrib/dev/acpica/components/namespace/nsprepkg.c stable/11/sys/contrib/dev/acpica/components/namespace/nsutils.c stable/11/sys/contrib/dev/acpica/components/namespace/nsxfeval.c stable/11/sys/contrib/dev/acpica/components/parser/psloop.c stable/11/sys/contrib/dev/acpica/components/parser/psobject.c stable/11/sys/contrib/dev/acpica/components/parser/psopcode.c stable/11/sys/contrib/dev/acpica/components/parser/psparse.c stable/11/sys/contrib/dev/acpica/components/resources/rscalc.c stable/11/sys/contrib/dev/acpica/components/resources/rsdump.c stable/11/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c stable/11/sys/contrib/dev/acpica/components/resources/rsinfo.c stable/11/sys/contrib/dev/acpica/components/resources/rsmisc.c stable/11/sys/contrib/dev/acpica/components/resources/rsserial.c stable/11/sys/contrib/dev/acpica/components/resources/rsxface.c stable/11/sys/contrib/dev/acpica/components/tables/tbdata.c stable/11/sys/contrib/dev/acpica/components/tables/tbfadt.c stable/11/sys/contrib/dev/acpica/components/tables/tbinstal.c stable/11/sys/contrib/dev/acpica/components/tables/tbutils.c stable/11/sys/contrib/dev/acpica/components/tables/tbxface.c stable/11/sys/contrib/dev/acpica/components/tables/tbxfload.c stable/11/sys/contrib/dev/acpica/components/utilities/utdecode.c stable/11/sys/contrib/dev/acpica/components/utilities/uthex.c stable/11/sys/contrib/dev/acpica/components/utilities/utmath.c stable/11/sys/contrib/dev/acpica/components/utilities/utmisc.c stable/11/sys/contrib/dev/acpica/components/utilities/utobject.c stable/11/sys/contrib/dev/acpica/components/utilities/utownerid.c stable/11/sys/contrib/dev/acpica/components/utilities/utresrc.c stable/11/sys/contrib/dev/acpica/components/utilities/utstate.c stable/11/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c stable/11/sys/contrib/dev/acpica/components/utilities/uttrack.c stable/11/sys/contrib/dev/acpica/components/utilities/utxfmutex.c stable/11/sys/contrib/dev/acpica/include/acapps.h stable/11/sys/contrib/dev/acpica/include/acdisasm.h stable/11/sys/contrib/dev/acpica/include/acdispat.h stable/11/sys/contrib/dev/acpica/include/acglobal.h stable/11/sys/contrib/dev/acpica/include/aclocal.h stable/11/sys/contrib/dev/acpica/include/acnames.h stable/11/sys/contrib/dev/acpica/include/acobject.h stable/11/sys/contrib/dev/acpica/include/acopcode.h stable/11/sys/contrib/dev/acpica/include/acpi.h stable/11/sys/contrib/dev/acpica/include/acpixf.h stable/11/sys/contrib/dev/acpica/include/acpredef.h stable/11/sys/contrib/dev/acpica/include/acresrc.h stable/11/sys/contrib/dev/acpica/include/acrestyp.h stable/11/sys/contrib/dev/acpica/include/actables.h stable/11/sys/contrib/dev/acpica/include/actbl.h stable/11/sys/contrib/dev/acpica/include/actbl1.h stable/11/sys/contrib/dev/acpica/include/actbl2.h stable/11/sys/contrib/dev/acpica/include/actbl3.h stable/11/sys/contrib/dev/acpica/include/actypes.h stable/11/sys/contrib/dev/acpica/include/acutils.h stable/11/sys/contrib/dev/acpica/include/acuuid.h stable/11/sys/contrib/dev/acpica/include/amlcode.h stable/11/sys/contrib/dev/acpica/include/amlresrc.h stable/11/sys/contrib/dev/acpica/include/platform/acenv.h stable/11/sys/contrib/dev/acpica/include/platform/acfreebsd.h stable/11/sys/contrib/dev/acpica/include/platform/acgcc.h stable/11/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c stable/11/sys/dev/acpica/acpi.c stable/11/usr.sbin/acpi/acpidb/Makefile stable/11/usr.sbin/acpi/iasl/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Fri Aug 25 05:41:28 2017 (r322876) +++ stable/11/sys/conf/files Fri Aug 25 05:49:37 2017 (r322877) @@ -340,6 +340,7 @@ contrib/dev/acpica/components/dispatcher/dsmethod.c op contrib/dev/acpica/components/dispatcher/dsmthdat.c optional acpi contrib/dev/acpica/components/dispatcher/dsobject.c optional acpi contrib/dev/acpica/components/dispatcher/dsopcode.c optional acpi +contrib/dev/acpica/components/dispatcher/dspkginit.c optional acpi contrib/dev/acpica/components/dispatcher/dsutils.c optional acpi contrib/dev/acpica/components/dispatcher/dswexec.c optional acpi contrib/dev/acpica/components/dispatcher/dswload.c optional acpi @@ -477,6 +478,7 @@ contrib/dev/acpica/components/utilities/utobject.c opt contrib/dev/acpica/components/utilities/utosi.c optional acpi contrib/dev/acpica/components/utilities/utownerid.c optional acpi contrib/dev/acpica/components/utilities/utpredef.c optional acpi +contrib/dev/acpica/components/utilities/utresdecode.c optional acpi acpi_debug contrib/dev/acpica/components/utilities/utresrc.c optional acpi contrib/dev/acpica/components/utilities/utstate.c optional acpi contrib/dev/acpica/components/utilities/utstring.c optional acpi Modified: stable/11/sys/contrib/dev/acpica/changes.txt ============================================================================== --- stable/11/sys/contrib/dev/acpica/changes.txt Fri Aug 25 05:41:28 2017 (r322876) +++ stable/11/sys/contrib/dev/acpica/changes.txt Fri Aug 25 05:49:37 2017 (r322877) @@ -1,4 +1,286 @@ ---------------------------------------- +28 July 2017. Summary of changes for version 20170728: + + +1) ACPICA kernel-resident subsystem: + +Fixed a regression seen with small resource descriptors that could cause +an inadvertent AE_AML_NO_RESOURCE_END_TAG exception. + +AML interpreter: Implemented a new feature that allows forward references +from individual named references within package objects that are +contained within blocks of "module-level code". This provides +compatibility with other ACPI implementations and supports existing +firmware that depends on this feature. Example: + + Name (ABCD, 1) + If (ABCD) /* An If() at module-level */ + { + Name (PKG1, Package() + { + INT1 /* Forward reference to object INT1 +*/ + }) + Name (INT1, 0x1234) + } + +AML Interpreter: Fixed a problem with the Alias() operator where aliases +to some ASL objects were not handled properly. Objects affected are: +Mutex, Event, and OperationRegion. + +AML Debugger: Enhanced to properly handle AML Alias objects. These +objects have one level of indirection which was not fully supported by +the debugger. + +Table Manager: Added support to detect and ignore duplicate SSDTs within +the XSDT/RSDT. This error in the XSDT has been seen in the field. + +EFI and EDK2 support: + Enabled /WX flag for MSVC builds + Added support for AcpiOsStall, AcpiOsSleep, and AcpiOsGetTimer + Added local support for 64-bit multiply and shift operations + Added support to compile acpidump.efi on Windows + Added OSL function stubs for interfaces not used under EFI + +Added additional support for the _DMA predefined name. _DMA returns a +buffer containing a resource template. This change add support within the +resource manager (AcpiWalkResourceBuffer) to walk and parse this list of +resource descriptors. Lorenzo Pieralisi + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a problem where the internal input line buffer(s) could +overflow if there are very long lines in the input ASL source code file. +Implemented buffer management that automatically increases the size of +the buffers as necessary. + +iASL: Added an option (-vx) to "expect" particular remarks, warnings and +errors. If the specified exception is not raised during compilation, the +compiler emits an error. This is intended to support the ASL test suite, +but may be useful in other contexts. + +iASL: Implemented a new predefined macro, __METHOD__, which returns a +string containing the name of the current control method that is being +compiled. + +iASL: Implemented debugger and table compiler support for the SDEI ACPI +table (Software Delegated Exception Interface). James Morse + + +Unix/Linux makefiles: Added an option to disable compile optimizations. +The disable occurs when the NOOPT flag is set to TRUE. +theracermaster@gmail.com + +Acpidump: Added support for multiple DSDT and FACS tables. This can occur +when there are different tables for 32-bit versus 64-bit. + +Enhanced error reporting for the ASL test suite (ASLTS) by removing +unnecessary/verbose text, and emit the actual line number where an error +has occurred. These changes are intended to improve the usefulness of the +test suite. + +---------------------------------------- +29 June 2017. Summary of changes for version 20170629: + + +1) ACPICA kernel-resident subsystem: + +Tables: Implemented a deferred ACPI table verification. This is useful +for operating systems where the tables cannot be verified in the early +initialization stage due to early memory mapping limitations on some +architectures. Lv Zheng. + +Tables: Removed the signature validation for dynamically loaded tables. +Provides compatibility with other ACPI implementations. Previously, only +SSDT tables were allowed, as per the ACPI specification. Now, any table +signature can be used via the Load() operator. Lv Zheng. + +Tables: Fixed several mutex issues that could cause errors during table +acquisition. Lv Zheng. + +Tables: Fixed a problem where an ACPI warning could be generated if a +null pointer was passed to the AcpiPutTable interface. Lv Zheng. + +Tables: Added a mechanism to handle imbalances for the AcpiGetTable and +AcpiPutTable interfaces. This applies to the "late stage" table loading +when the use of AcpiPutTable is no longer required (since the system +memory manager is fully running and available). Lv Zheng. + +Fixed/Reverted a regression during processing of resource descriptors +that contain only a single EndTag. Fixes an AE_AML_NO_RESOURCE_END_TAG +exception in this case. + +Headers: IORT/SMMU support: Updated the SMMU models for Revision C of the +I/O Remapping specification. Robin Murphy + +Interpreter: Fixed a possible fault if an Alias operator with an invalid +or duplicate target is encountered during Alias creation in +AcpiExCreateAlias. Alex James + +Added an option to use designated initializers for function pointers. +Kees Cook + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Allow compilation of External declarations with target pathnames +that refer to existing named objects within the table. Erik Schmauss. + +iASL: Fixed a regression when compiling FieldUnits. Fixes an error if a +FieldUnit name also is declared via External in the same table. Erik +Schmauss. + +iASL: Allow existing scope names within pathnames used in External +statements. For example: + External (ABCD.EFGH) // ABCD exists, but EFGH is truly external + Device (ABCD) + +iASL: IORT ACPI table: Implemented changes required to decode the new +Proximity Domain for the SMMUv3 IORT. Disassembler and Data Table +compiler. Ganapatrao Kulkarni + +Disassembler: Don't abort disassembly on errors from External() +statements. Erik Schmauss. + +Disassembler: fixed a possible fault when one of the Create*Field +operators references a Resource Template. ACPICA Bugzilla 1396. + +iASL: In the source code, resolved some naming inconsistences across the +parsing support. Fixes confusion between "Parse Op" and "Parse Node". +Adds a new file, aslparseop.c + +---------------------------------------- +31 May 2017. Summary of changes for version 20170531: + + +0) ACPI 6.2 support: + +The ACPI specification version 6.2 has been released and is available at +http://uefi.org/specifications + +This version of ACPICA fully supports the ACPI 6.2 specification. Changes +are summarized below. + +New ACPI tables (Table Compiler/Disassembler/Templates): + HMAT (Heterogeneous Memory Attributes Table) + WSMT (Windows SMM Security Mitigation Table) + PPTT (Processor Properties Topology Table) + +New subtables for existing ACPI tables: + HEST (New subtable, Arch-deferred machine check) + SRAT (New subtable, Arch-specific affinity structure) + PCCT (New subtables, Extended PCC subspaces (types 3 and 4)) + +Simple updates for existing ACPI tables: + BGRT (two new flag bits) + HEST (New bit defined for several subtables, GHES_ASSIST) + +New Resource Descriptors and Resource macros (Compiler/Disassembler): + PinConfig() + PinFunction() + PinGroup() + PinGroupConfig() + PinGroupFunction() + New type for hardware error notification (section 18.3.2.9) + +New predefined names/methods (Compiler/Interpreter): + _HMA (Heterogeneous Memory Attributes) + _LSI (Label Storage Information) + _LSR (Label Storage Read) + _LSW (Label Storage Write) + +ASL grammar/macro changes (Compiler): + For() ASL macro, implemented with the AML while operator + Extensions to Concatenate operator + Support for multiple definition blocks in same ASL file + Clarification for Buffer operator + Allow executable AML code underneath all scopes (Devices, etc.) + Clarification/change for the _OSI return value + ASL grammar update for reference operators + Allow a zero-length string for AML filename in DefinitionBlock + +Miscellaneous: + New device object notification value + Remove a notify value (0x0C) for graceful shutdown + New UUIDs for processor/cache properties and + physical package property + New _HID, ACPI0014 (Wireless Power Calibration Device) + + +1) ACPICA kernel-resident subsystem: + +Added support to disable ACPI events on hardware-reduced platforms. +Eliminates error messages of the form "Could not enable fixed event". Lv +Zheng + +Fixed a problem using Device/Thermal objects with the ObjectType and +DerefOf ASL operators. This support had not been fully/properly +implemented. + +Fixed a problem where if a Buffer object containing a resource template +was longer than the actual resource template, an error was generated -- +even though the AML is legal. This case has been seen in the field. + +Fixed a problem with the header definition of the MADT PCAT_COMPAT flag. +The values for DUAL_PIC and MULTIPLE_APIC were reversed. + +Added header file changes for the TPM2 ACPI table. Update to new version +of the TCG specification. Adds a new TPM2 subtable for ARM SMC. + +Exported the external interfaces AcpiAcquireMutex and AcpiReleaseMutex. +These interfaces are intended to be used only in conjunction with the +predefined _DLM method (Device Lock Method). "This object appears in a +device scope when AML access to the device must be synchronized with the +OS environment". + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 143.1K Code, 60.0K Data, 203.1K Total + Debug Version: 204.0K Code, 84.3K Data, 288.3K Total + Previous Release: + Non-Debug Version: 141.7K Code, 58.5K Data, 200.2K Total + Debug Version: 207.5K Code, 82.7K Data, 290.2K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a problem where an External() declaration could not refer to +a Field Unit. Erik Schmauss. + +Disassembler: Improved support for the Switch/Case operators. This +feature will disassemble AML code back to the original Switch operators +when possible, instead of an If..Else sequence. David Box + +iASL and disassembler: Improved the handling of multiple extraneous +parentheses for both ASL input and disassembled ASL output. + +Improved the behavior of the iASL compiler and disassembler to detect +improper use of external declarations + +Disassembler: Now aborts immediately upon detection of an unknown AML +opcode. The AML parser has no real way to recover from this, and can +result in the creation of an ill-formed parse tree that causes errors +later during the disassembly. + +All tools: Fixed a problem where the Unix application OSL did not handle +control-c correctly. For example, a control-c could incorrectly wake the +debugger. + +AcpiExec: Improved the Control-C handling and added a handler for +segmentation faults (SIGSEGV). Supports both Windows and Unix-like +environments. + +Reduced the verbosity of the generic unix makefiles. Previously, each +compilation displayed the full set of compiler options. This has been +eliminated as the options are easily inspected within the makefiles. Each +compilation now results in a single line of output. + +---------------------------------------- 03 March 2017. Summary of changes for version 20170303: Modified: stable/11/sys/contrib/dev/acpica/common/acfileio.c ============================================================================== --- stable/11/sys/contrib/dev/acpica/common/acfileio.c Fri Aug 25 05:41:28 2017 (r322876) +++ stable/11/sys/contrib/dev/acpica/common/acfileio.c Fri Aug 25 05:49:37 2017 (r322877) @@ -175,6 +175,36 @@ AcCheckTextModeCorruption ( /******************************************************************************* * + * FUNCTION: AcDeleteTableList + * + * PARAMETERS: ListHead - List to delete + * + * RETURN: Status + * + * DESCRIPTION: Delete a list of tables. This is useful for removing memory + * allocated by AcGetAllTablesFromFile + * + ******************************************************************************/ + +void +AcDeleteTableList ( + ACPI_NEW_TABLE_DESC *ListHead) +{ + ACPI_NEW_TABLE_DESC *Current = ListHead; + ACPI_NEW_TABLE_DESC *Previous = Current; + + + while (Current) + { + Current = Current->Next; + AcpiOsFree (Previous); + Previous = Current; + } +} + + +/******************************************************************************* + * * FUNCTION: AcGetAllTablesFromFile * * PARAMETERS: Filename - Table filename @@ -531,8 +561,6 @@ AcValidateTableHeader ( if (!AcpiUtValidNameseg (TableHeader.Signature)) { - fprintf (stderr, "Invalid table signature: 0x%8.8X\n", - *ACPI_CAST_PTR (UINT32, TableHeader.Signature)); return (AE_BAD_SIGNATURE); } Modified: stable/11/sys/contrib/dev/acpica/common/adfile.c ============================================================================== --- stable/11/sys/contrib/dev/acpica/common/adfile.c Fri Aug 25 05:41:28 2017 (r322876) +++ stable/11/sys/contrib/dev/acpica/common/adfile.c Fri Aug 25 05:49:37 2017 (r322877) @@ -316,11 +316,6 @@ FlGenerateFilename ( */ NewFilename = UtStringCacheCalloc ((ACPI_SIZE) strlen (InputFilename) + strlen (Suffix) + 2); - if (!NewFilename) - { - return (NULL); - } - strcpy (NewFilename, InputFilename); /* Try to find the last dot in the filename */ @@ -364,11 +359,6 @@ FlStrdup ( NewString = UtStringCacheCalloc ((ACPI_SIZE) strlen (String) + 1); - if (!NewString) - { - return (NULL); - } - strcpy (NewString, String); return (NewString); } Modified: stable/11/sys/contrib/dev/acpica/common/adisasm.c ============================================================================== --- stable/11/sys/contrib/dev/acpica/common/adisasm.c Fri Aug 25 05:41:28 2017 (r322876) +++ stable/11/sys/contrib/dev/acpica/common/adisasm.c Fri Aug 25 05:49:37 2017 (r322877) @@ -408,6 +408,8 @@ Cleanup: ACPI_FREE (Table); } + AcDeleteTableList (ListHead); + if (File) { fclose (File); @@ -537,7 +539,7 @@ AdDisassembleOneTable ( * the entire tree with the new information (namely, the * number of arguments per method) */ - if (AcpiDmGetExternalMethodCount ()) + if (AcpiDmGetUnresolvedExternalMethodCount ()) { Status = AdReparseOneTable (Table, File, OwnerId); if (ACPI_FAILURE (Status)) @@ -553,7 +555,7 @@ AdDisassembleOneTable ( * 1) Convert fixed-offset references to resource descriptors * to symbolic references (Note: modifies namespace) */ - AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); + AcpiDmConvertParseObjects (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); /* Optional displays */ @@ -616,7 +618,7 @@ AdReparseOneTable ( fprintf (stderr, "\nFound %u external control methods, " "reparsing with new information\n", - AcpiDmGetExternalMethodCount ()); + AcpiDmGetUnresolvedExternalMethodCount ()); /* Reparse, rebuild namespace */ @@ -642,7 +644,7 @@ AdReparseOneTable ( /* New namespace, add the external definitions first */ - AcpiDmAddExternalsToNamespace (); + AcpiDmAddExternalListToNamespace (); /* For -ca option: clear the list of comment addresses. */ @@ -748,6 +750,7 @@ AdDoExternalFileList ( continue; } + AcDeleteTableList (ExternalListHead); return (Status); } @@ -761,6 +764,7 @@ AdDoExternalFileList ( { AcpiOsPrintf ("Could not parse external ACPI tables, %s\n", AcpiFormatException (Status)); + AcDeleteTableList (ExternalListHead); return (Status); } @@ -779,6 +783,8 @@ AdDoExternalFileList ( ExternalFileList = ExternalFileList->Next; } + + AcDeleteTableList (ExternalListHead); if (ACPI_FAILURE (GlobalStatus)) { Modified: stable/11/sys/contrib/dev/acpica/common/adwalk.c ============================================================================== --- stable/11/sys/contrib/dev/acpica/common/adwalk.c Fri Aug 25 05:41:28 2017 (r322876) +++ stable/11/sys/contrib/dev/acpica/common/adwalk.c Fri Aug 25 05:49:37 2017 (r322877) @@ -208,11 +208,16 @@ AcpiDmInspectPossibleArgs ( ACPI_PARSE_OBJECT *Op); static ACPI_STATUS -AcpiDmResourceDescendingOp ( +AcpiDmCommonDescendingOp ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context); +static ACPI_STATUS +AcpiDmProcessResourceDescriptors ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); /******************************************************************************* * @@ -395,21 +400,21 @@ AcpiDmCrossReferenceNamespace ( /******************************************************************************* * - * FUNCTION: AcpiDmConvertResourceIndexes + * FUNCTION: AcpiDmConvertParseObjects * * PARAMETERS: ParseTreeRoot - Root of the parse tree * NamespaceRoot - Root of the internal namespace * * RETURN: None * - * DESCRIPTION: Convert fixed-offset references to resource descriptors to - * symbolic references. Should only be called after namespace has - * been cross referenced. + * DESCRIPTION: Begin parse tree walk to perform conversions needed for + * disassembly. These include resource descriptors and switch/case + * operations. * ******************************************************************************/ void -AcpiDmConvertResourceIndexes ( +AcpiDmConvertParseObjects ( ACPI_PARSE_OBJECT *ParseTreeRoot, ACPI_NAMESPACE_NODE *NamespaceRoot) { @@ -443,9 +448,14 @@ AcpiDmConvertResourceIndexes ( Info.Level = 0; Info.WalkState = WalkState; - AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp, + AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmCommonDescendingOp, AcpiDmCommonAscendingOp, &Info); ACPI_FREE (WalkState); + + if (AcpiGbl_TempListHead) { + AcpiDmClearTempList(); + } + return; } @@ -526,11 +536,20 @@ AcpiDmDumpDescending ( case AML_NAME_OP: case AML_METHOD_OP: case AML_DEVICE_OP: + + AcpiOsPrintf ("%4.4s", + ACPI_CAST_PTR (char, &Op->Named.Name)); + break; + case AML_INT_NAMEDFIELD_OP: - AcpiOsPrintf ("%4.4s", ACPI_CAST_PTR (char, &Op->Named.Name)); + AcpiOsPrintf ("%4.4s Length: (bits) %8.8X%8.8X (bytes) %8.8X%8.8X", + ACPI_CAST_PTR (char, &Op->Named.Name), + ACPI_FORMAT_UINT64 (Op->Common.Value.Integer), + ACPI_FORMAT_UINT64 (Op->Common.Value.Integer / 8)); break; + default: break; @@ -737,7 +756,6 @@ AcpiDmLoadDescendingOp ( WalkState = Info->WalkState; OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - ObjectType = OpInfo->ObjectType; ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); /* Only interested in operators that create new names */ @@ -754,7 +772,7 @@ AcpiDmLoadDescendingOp ( { /* For all named operators, get the new name */ - Path = (char *) Op->Named.Path; + Path = Op->Named.Path; if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) { @@ -875,7 +893,6 @@ AcpiDmXrefDescendingOp ( WalkState = Info->WalkState; OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - ObjectType = OpInfo->ObjectType; ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); if ((!(OpInfo->Flags & AML_NAMED)) && @@ -885,26 +902,7 @@ AcpiDmXrefDescendingOp ( { goto Exit; } - else if (Op->Common.Parent && - Op->Common.Parent->Common.AmlOpcode == AML_EXTERNAL_OP) - { - /* External() NamePath */ - Path = Op->Common.Value.String; - ObjectType = (ACPI_OBJECT_TYPE) Op->Common.Next->Common.Value.Integer; - if (ObjectType == ACPI_TYPE_METHOD) - { - ParamCount = (UINT32) - Op->Common.Next->Common.Next->Common.Value.Integer; - } - - Flags |= ACPI_EXT_RESOLVED_REFERENCE | ACPI_EXT_ORIGIN_FROM_OPCODE; - AcpiDmAddOpToExternalList (Op, Path, - (UINT8) ObjectType, ParamCount, Flags); - - goto Exit; - } - /* Get the NamePath from the appropriate place */ if (OpInfo->Flags & AML_NAMED) @@ -924,9 +922,10 @@ AcpiDmXrefDescendingOp ( Path = NextOp->Common.Value.String; } } - else if (Op->Common.AmlOpcode == AML_SCOPE_OP) + else if (Op->Common.AmlOpcode == AML_SCOPE_OP || + Op->Common.AmlOpcode == AML_EXTERNAL_OP) { - Path = (char *) Op->Named.Path; + Path = Op->Named.Path; } } else if (OpInfo->Flags & AML_CREATE) @@ -1060,21 +1059,58 @@ Exit: return (AE_OK); } +/******************************************************************************* + * + * FUNCTION: AcpiDmCommonDescendingOp + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: ACPI_STATUS + * + * DESCRIPTION: Perform parse tree preprocessing before main disassembly walk. + * + ******************************************************************************/ +static ACPI_STATUS +AcpiDmCommonDescendingOp ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ACPI_STATUS Status; + + + /* Resource descriptor conversion */ + + Status = AcpiDmProcessResourceDescriptors (Op, Level, Context); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Switch/Case conversion */ + + Status = AcpiDmProcessSwitch (Op); + return (AE_OK); +} + + /******************************************************************************* * - * FUNCTION: AcpiDmResourceDescendingOp + * FUNCTION: AcpiDmProcessResourceDescriptors * * PARAMETERS: ASL_WALK_CALLBACK * - * RETURN: None + * RETURN: ACPI_STATUS * - * DESCRIPTION: Process one parse op during symbolic resource index conversion. + * DESCRIPTION: Convert fixed-offset references to resource descriptors to + * symbolic references. Should only be called after namespace has + * been cross referenced. * ******************************************************************************/ static ACPI_STATUS -AcpiDmResourceDescendingOp ( +AcpiDmProcessResourceDescriptors ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) @@ -1114,7 +1150,6 @@ AcpiDmResourceDescendingOp ( return (AE_OK); } - /******************************************************************************* * * FUNCTION: AcpiDmCommonAscendingOp @@ -1135,14 +1170,11 @@ AcpiDmCommonAscendingOp ( void *Context) { ACPI_OP_WALK_INFO *Info = Context; - const ACPI_OPCODE_INFO *OpInfo; ACPI_OBJECT_TYPE ObjectType; /* Close scope if necessary */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - ObjectType = OpInfo->ObjectType; ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); if (AcpiNsOpensScope (ObjectType)) @@ -1152,7 +1184,6 @@ AcpiDmCommonAscendingOp ( return (AE_OK); } - /******************************************************************************* * Modified: stable/11/sys/contrib/dev/acpica/common/ahids.c ============================================================================== --- stable/11/sys/contrib/dev/acpica/common/ahids.c Fri Aug 25 05:41:28 2017 (r322876) +++ stable/11/sys/contrib/dev/acpica/common/ahids.c Fri Aug 25 05:49:37 2017 (r322877) @@ -187,6 +187,7 @@ const AH_DEVICE_ID AslDeviceIds[] = {"ACPI0011", "Generic Buttons Device"}, {"ACPI0012", "NVDIMM Root Device"}, {"ACPI0013", "Generic Event Device"}, + {"ACPI0014", "Wireless Power Calibration Device"}, {"ADMA0F28", "Intel Audio DMA"}, {"AMCR0F28", "Intel Audio Machine Driver"}, {"ATK4001", "Asus Radio Control Button"}, Modified: stable/11/sys/contrib/dev/acpica/common/ahpredef.c ============================================================================== --- stable/11/sys/contrib/dev/acpica/common/ahpredef.c Fri Aug 25 05:41:28 2017 (r322876) +++ stable/11/sys/contrib/dev/acpica/common/ahpredef.c Fri Aug 25 05:49:37 2017 (r322877) @@ -254,6 +254,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_FPS", "Fan Performance States", "Returns a list of supported fan performance states"), AH_PREDEF ("_FSL", "Fan Set Level", "Control method that sets the fan device's speed level (performance state)"), AH_PREDEF ("_FST", "Fan Status", "Returns current status information for a fan device"), + AH_PREDEF ("_FUN", "Function Number", "Resource descriptor field"), AH_PREDEF ("_GAI", "Get Averaging Interval", "Returns the power meter averaging interval"), AH_PREDEF ("_GCP", "Get Capabilities", "Get device time capabilities"), AH_PREDEF ("_GHL", "Get Hardware Limit", "Returns the hardware limit enforced by the power meter"), @@ -270,6 +271,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_GWS", "Get Wake Status", "Return status of wake alarms"), AH_PREDEF ("_HE_", "High-Edge", "Interrupt triggering, Resource Descriptor field"), AH_PREDEF ("_HID", "Hardware ID", "Returns a device's Plug and Play Hardware ID"), + AH_PREDEF ("_HMA", "Heterogeneous Memory Attributes", "Returns a list of HMAT structures."), AH_PREDEF ("_HOT", "Hot Temperature", "Returns the critical temperature for sleep (entry to S4)"), AH_PREDEF ("_HPP", "Hot Plug Parameters", "Returns a list of hot-plug information for a PCI device"), AH_PREDEF ("_HPX", "Hot Plug Parameter Extensions", "Returns a list of hot-plug information for a PCI device. Supersedes _HPP"), @@ -287,6 +289,9 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_LL_", "Low Level", "Interrupt polarity, Resource Descriptor field"), AH_PREDEF ("_LPD", "Low Power Dependencies", "Returns a list of dependencies for low power idle entry"), AH_PREDEF ("_LPI", "Low Power Idle States", "Returns a list of supported low power idle states"), + AH_PREDEF ("_LSI", "Label Storage Information", "Returns information about the Label Storage Area associated with the NVDIMM object."), + AH_PREDEF ("_LSR", "Label Storage Read", "Returns label data from the Label Storage Area of the NVDIMM object."), + AH_PREDEF ("_LSW", "Label Storage Write", "Writes label data in to the Label Storage Area of the NVDIMM object."), AH_PREDEF ("_MAF", "Maximum Address Fixed", "Resource Descriptor field"), AH_PREDEF ("_MAT", "Multiple APIC Table Entry", "Returns a list of MADT APIC structure entries"), AH_PREDEF ("_MAX", "Maximum Base Address", "Resource Descriptor field"), @@ -439,6 +444,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_UPC", "USB Port Capabilities", "Returns a list of USB port capabilities"), AH_PREDEF ("_UPD", "User Presence Detect", "Returns user detection information"), AH_PREDEF ("_UPP", "User Presence Polling", "Returns the recommended user presence polling interval"), + AH_PREDEF ("_VAL", "Pin Configuration Value", "Resource Descriptor field"), AH_PREDEF ("_VEN", "Vendor Data", "Resource Descriptor field"), AH_PREDEF ("_VPO", "Video Post Options", "Returns the implemented video post options"), AH_PREDEF ("_Wxx", "Wake Event", "Method executed as a result of a wake event"), @@ -467,6 +473,15 @@ AcpiAhMatchPredefinedName ( { const AH_PREDEFINED_NAME *Info; + + /* Nameseg must start with an underscore */ + + if (*Nameseg != '_') + { + return (NULL); + } + + /* Search for a match in the predefined name table */ for (Info = AslPredefinedInfo; Info->Name; Info++) { Modified: stable/11/sys/contrib/dev/acpica/common/ahtable.c ============================================================================== --- stable/11/sys/contrib/dev/acpica/common/ahtable.c Fri Aug 25 05:41:28 2017 (r322876) +++ stable/11/sys/contrib/dev/acpica/common/ahtable.c Fri Aug 25 05:49:37 2017 (r322877) @@ -218,6 +218,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_FPDT, "Firmware Performance Data Table"}, {ACPI_SIG_GTDT, "Generic Timer Description Table"}, {ACPI_SIG_HEST, "Hardware Error Source Table"}, + {ACPI_SIG_HMAT, "Heterogeneous Memory Attributes Table"}, {ACPI_SIG_HPET, "High Precision Event Timer table"}, {ACPI_SIG_IORT, "IO Remapping Table"}, {ACPI_SIG_IVRS, "I/O Virtualization Reporting Structure"}, @@ -232,11 +233,13 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, + {ACPI_SIG_PPTT, "Processor Properties Topology Table"}, {ACPI_SIG_RASF, "RAS Features Table"}, {ACPI_RSDP_NAME,"Root System Description Pointer"}, {ACPI_SIG_RSDT, "Root System Description Table"}, {ACPI_SIG_S3PT, "S3 Performance Table"}, {ACPI_SIG_SBST, "Smart Battery Specification Table"}, + {ACPI_SIG_SDEI, "Software Delegated Exception Interface Table"}, {ACPI_SIG_SLIC, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, "System Locality Information Table"}, {ACPI_SIG_SPCR, "Serial Port Console Redirection table"}, @@ -253,6 +256,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_WDDT, "Watchdog Description Table"}, {ACPI_SIG_WDRT, "Watchdog Resource Table"}, {ACPI_SIG_WPBT, "Windows Platform Binary Table"}, + {ACPI_SIG_WSMT, "Windows SMM Security Migrations Table"}, {ACPI_SIG_XENV, "Xen Environment table"}, {ACPI_SIG_XSDT, "Extended System Description Table"}, {NULL, NULL} Modified: stable/11/sys/contrib/dev/acpica/common/ahuuids.c ============================================================================== --- stable/11/sys/contrib/dev/acpica/common/ahuuids.c Fri Aug 25 05:41:28 2017 (r322876) +++ stable/11/sys/contrib/dev/acpica/common/ahuuids.c Fri Aug 25 05:49:37 2017 (r322877) @@ -186,6 +186,10 @@ const AH_UUID Gbl_AcpiUuids[] = {"Persistent Virtual Disk", UUID_PERSISTENT_VIRTUAL_DISK}, {"Persistent Virtual CD", UUID_PERSISTENT_VIRTUAL_CD}, + {"[Processor Properties]", NULL}, + {"Cache Properties", UUID_CACHE_PROPERTIES}, + {"Physical Package Property", UUID_PHYSICAL_PROPERTY}, + {"[Miscellaneous]", NULL}, {"Platform-wide Capabilities", UUID_PLATFORM_CAPABILITIES}, {"Dynamic Enumeration", UUID_DYNAMIC_ENUMERATION}, Modified: stable/11/sys/contrib/dev/acpica/common/dmextern.c ============================================================================== --- stable/11/sys/contrib/dev/acpica/common/dmextern.c Fri Aug 25 05:41:28 2017 (r322876) +++ stable/11/sys/contrib/dev/acpica/common/dmextern.c Fri Aug 25 05:49:37 2017 (r322877) @@ -199,7 +199,10 @@ static const char *AcpiGbl_DmTypeNames[] = #define METHOD_SEPARATORS " \t,()\n" +static const char *ExternalConflictMessage = + " // Conflicts with a later declaration"; + /* Local prototypes */ static const char * @@ -211,6 +214,16 @@ AcpiDmNormalizeParentPrefix ( ACPI_PARSE_OBJECT *Op, char *Path); +static ACPI_STATUS +AcpiDmGetExternalAndInternalPath ( + ACPI_NAMESPACE_NODE *Node, + char **ExternalPath, + char **InternalPath); + +static ACPI_STATUS +AcpiDmRemoveRootPrefix ( + char **Path); + static void AcpiDmAddPathToExternalList ( char *Path, @@ -226,7 +239,22 @@ AcpiDmCreateNewExternal ( UINT32 Value, UINT16 Flags); +static void +AcpiDmCheckForExternalConflict ( + char *Path); +static ACPI_STATUS +AcpiDmResolveExternal ( + char *Path, + UINT8 Type, + ACPI_NAMESPACE_NODE **Node); + + +static void +AcpiDmConflictingDeclaration ( + char *Path); + + /******************************************************************************* * * FUNCTION: AcpiDmGetObjectTypeName @@ -582,7 +610,7 @@ AcpiDmGetExternalsFromFile ( { /* Add the external(s) to the namespace */ - AcpiDmAddExternalsToNamespace (); + AcpiDmAddExternalListToNamespace (); AcpiOsPrintf ("%s: Imported %u external method definitions\n", Gbl_ExternalRefFilename, ImportCount); @@ -698,6 +726,86 @@ AcpiDmAddOpToExternalList ( /******************************************************************************* * + * FUNCTION: AcpiDmGetExternalAndInternalPath + * + * PARAMETERS: Node - Namespace node for object to be added + * ExternalPath - Will contain the external path of the node + * InternalPath - Will contain the internal path of the node + * + * RETURN: None + * + * DESCRIPTION: Get the External and Internal path from the given node. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDmGetExternalAndInternalPath ( + ACPI_NAMESPACE_NODE *Node, + char **ExternalPath, + char **InternalPath) +{ + ACPI_STATUS Status; + + + if (!Node) + { + return (AE_BAD_PARAMETER); + } + + /* Get the full external and internal pathnames to the node */ + + *ExternalPath = AcpiNsGetExternalPathname (Node); + if (!*ExternalPath) + { + return (AE_BAD_PATHNAME); + } + + Status = AcpiNsInternalizeName (*ExternalPath, InternalPath); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (*ExternalPath); + return (Status); + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmRemoveRootPrefix + * + * PARAMETERS: Path - Remove Root prefix from this Path + * + * RETURN: None + * + * DESCRIPTION: Remove the root prefix character '\' from Path. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDmRemoveRootPrefix ( + char **Path) +{ + char *InputPath = *Path; + + + if ((*InputPath == AML_ROOT_PREFIX) && (InputPath[1])) + { + if (!memmove(InputPath, InputPath+1, strlen(InputPath))) + { + return (AE_ERROR); + } + + *Path = InputPath; + } + + return (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmAddNodeToExternalList * * PARAMETERS: Node - Namespace node for object to be added @@ -727,46 +835,27 @@ AcpiDmAddNodeToExternalList ( { char *ExternalPath; char *InternalPath; - char *Temp; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (DmAddNodeToExternalList); - - if (!Node) - { - return_VOID; - } - /* Get the full external and internal pathnames to the node */ - ExternalPath = AcpiNsGetExternalPathname (Node); - if (!ExternalPath) - { - return_VOID; - } - - Status = AcpiNsInternalizeName (ExternalPath, &InternalPath); + Status = AcpiDmGetExternalAndInternalPath (Node, &ExternalPath, &InternalPath); if (ACPI_FAILURE (Status)) { - ACPI_FREE (ExternalPath); return_VOID; } /* Remove the root backslash */ - if ((*ExternalPath == AML_ROOT_PREFIX) && (ExternalPath[1])) + Status = AcpiDmRemoveRootPrefix (&ExternalPath); + if (ACPI_FAILURE (Status)) { - Temp = ACPI_ALLOCATE_ZEROED (strlen (ExternalPath) + 1); - if (!Temp) - { - return_VOID; - } - - strcpy (Temp, &ExternalPath[1]); ACPI_FREE (ExternalPath); - ExternalPath = Temp; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Aug 25 06:39:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F8BEDF0EFD; Fri, 25 Aug 2017 06:39:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id D631C754F0; Fri, 25 Aug 2017 06:39:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA22328; Fri, 25 Aug 2017 09:39:35 +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 1dl8HH-0001kK-PY; Fri, 25 Aug 2017 09:39:35 +0300 Subject: Re: svn commit: r322872 - head/sys/dev/nvme To: Warner Losh , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201708250315.v7P3FID8036183@repo.freebsd.org> From: Andriy Gapon Message-ID: <6a5f32b3-a90e-21ef-dfdb-593573bc38e7@FreeBSD.org> Date: Fri, 25 Aug 2017 09:38:42 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <201708250315.v7P3FID8036183@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 06:39:45 -0000 On 25/08/2017 06:15, Warner Losh wrote: > Author: imp > Date: Fri Aug 25 03:15:18 2017 > New Revision: 322872 > URL: https://svnweb.freebsd.org/changeset/base/322872 > > Log: > Enable bus mastering on the device before resetting the device. The > card has to do PCIe transactions to complete the reset process, but > can't do them, per the PCIe spec, unless bus mastering is enabled. > > Submitted by: Kinjal Patel > PR: 22166 The bug number seems to be incorrect. > Modified: > head/sys/dev/nvme/nvme.c -- Andriy Gapon From owner-svn-src-all@freebsd.org Fri Aug 25 07:04:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D838DF1457; Fri, 25 Aug 2017 07:04:43 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B50AA75E88; Fri, 25 Aug 2017 07:04:42 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P74fPh028901; Fri, 25 Aug 2017 07:04:41 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P74fE9028895; Fri, 25 Aug 2017 07:04:41 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708250704.v7P74fE9028895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 25 Aug 2017 07:04:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322878 - in head: sys/dev/syscons sys/sys usr.sbin/vidcontrol X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head: sys/dev/syscons sys/sys usr.sbin/vidcontrol X-SVN-Commit-Revision: 322878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 07:04:43 -0000 Author: bde Date: Fri Aug 25 07:04:41 2017 New Revision: 322878 URL: https://svnweb.freebsd.org/changeset/base/322878 Log: Support setting the colors of cursors for the VGA renderer. Advertise this by changing the defaults to mostly red. If you don't like this, change them (almost) back using: vidcontrol -c charcolors,base=7,height=0 vidcontrol -c mousecolors,base=0[,height=15] The (graphics mode only) mouse cursor colors were hard-coded to a black border and lightwhite interior. Black for the border is the worst possible default, since it is the same as the default black background and not good for any dark background. Reversing this gives the better default of X Windows. Coloring everything works better still. Now the coloring defaults to a lightwhite border and red interior. Coloring for the character cursor is more complicated and mode dependent. The new coloring doesn't apply for hardware cursors. For non-block cursors, it only applies in graphics mode. In text mode, the cursor color was usually a hard-coded (dull)white for the background only, unless the foreground was white when it was a hard-coded black for the background only, unless the foreground was white and the background was black it was reverse video. In graphics mode, it was always reverse video for the block cursor. Reverse video is worse, especially over cutmarking regions, since cutmarking still uses simple reverse video (nothing better is possible in text mode) and double reverse video for the cursor gives normal video. Now, graphics mode uses the same algorithm as the best case for text mode in all cases for graphics mode. The hard-coded sequence { white, black, } for the background is now { red, white, blue, } where the first 2 colors can be configured. The blue color at the end is a sentinel which prevents reverse video being used in most cases but breaks the compatibility setting for white on black and black on white characters. This will be fixed later. The compatibility setting is most needed for mono modes. The previous commit to syscons.c changed sc_cnterm() to be more careful. It followed null pointers in some cases. But sc_cnterm() has been unreachable for 15+ years since changes for multiple consoles turned off calls to the the cnterm destructor for all console drivers. Before them, it was only called at boot time. So no driver with an attached console has ever been unloadable and not even the non-console destructors have been tested much. Modified: head/sys/dev/syscons/scvgarndr.c head/sys/dev/syscons/syscons.c head/sys/dev/syscons/syscons.h head/sys/sys/consio.h head/usr.sbin/vidcontrol/vidcontrol.1 head/usr.sbin/vidcontrol/vidcontrol.c Modified: head/sys/dev/syscons/scvgarndr.c ============================================================================== --- head/sys/dev/syscons/scvgarndr.c Fri Aug 25 05:49:37 2017 (r322877) +++ head/sys/dev/syscons/scvgarndr.c Fri Aug 25 07:04:41 2017 (r322878) @@ -356,32 +356,28 @@ vga_flipattr(u_short a, int blink) } static u_short -vga_cursorattr_adj(u_short a, int blink) +vga_cursorattr_adj(scr_stat *scp, u_short a, int blink) { - /* - * !blink means pixel mode, and the cursor attribute in that case - * is simplistic reverse video. - */ - if (!blink) - return (vga_flipattr(a, blink)); + int i; + u_short bg, bgmask, fg, newbg; /* * The cursor attribute is usually that of the underlying char - * with the bg changed to white. If the bg is already white, - * then the bg is changed to black. The fg is usually not - * changed, but if it is the same as the new bg then it is - * changed to the inverse of the new bg. + * with only the bg changed, to the first preferred color that + * differs from both the fg and bg. If there is no such color, + * use reverse video. */ - if ((a & 0x7000) == 0x7000) { - a &= 0x8f00; - if ((a & 0x0700) == 0) - a |= 0x0700; - } else { - a |= 0x7000; - if ((a & 0x0700) == 0x0700) - a &= 0xf000; + bgmask = blink ? 0x7000 : 0xf000; + bg = a & bgmask; + fg = a & 0x0f00; + for (i = 0; i < nitems(scp->curs_attr.bg); i++) { + newbg = (scp->curs_attr.bg[i] << 12) & bgmask; + if (newbg != bg && newbg != (fg << 4)) + break; } - return (a); + if (i == nitems(scp->curs_attr.bg)) + return (vga_flipattr(a, blink)); + return (fg | newbg | (blink ? a & 0x8000 : 0)); } static void @@ -522,6 +518,12 @@ draw_txtcharcursor(scr_stat *scp, int at, u_short c, u return; if (flip) a = vga_flipattr(a, TRUE); + /* + * This clause handles partial-block cursors in text mode. + * We want to change the attribute only under the partial + * block, but in text mode we can only change full blocks. + * Use reverse video instead. + */ bcopy(font + c*h, font + sc->cursor_char*h, h); font = font + sc->cursor_char*h; for (i = imax(h - scp->curs_attr.base - scp->curs_attr.height, 0); @@ -536,7 +538,7 @@ draw_txtcharcursor(scr_stat *scp, int at, u_short c, u { if (flip) a = vga_flipattr(a, TRUE); - a = vga_cursorattr_adj(a, TRUE); + a = vga_cursorattr_adj(scp, a, TRUE); sc_vtb_putc(&scp->scr, at, c, a); } } @@ -1026,7 +1028,7 @@ draw_pxlcursor_direct(scr_stat *scp, int at, int on, i if (flip) a = vga_flipattr(a, FALSE); if (on) - a = vga_cursorattr_adj(a, FALSE); + a = vga_cursorattr_adj(scp, a, FALSE); col1 = (a & 0x0f00) >> 8; col2 = a >> 12; @@ -1070,7 +1072,7 @@ draw_pxlcursor_planar(scr_stat *scp, int at, int on, i if (flip) a = vga_flipattr(a, FALSE); if (on) - a = vga_cursorattr_adj(a, FALSE); + a = vga_cursorattr_adj(scp, a, FALSE); col = (a & 0xf000) >> 4; outw(GDCIDX, col | 0x00); /* set/reset */ outw(GDCIDX, 0xff08); /* bit mask */ @@ -1202,7 +1204,7 @@ draw_pxlmouse_planar(scr_stat *scp, int x, int y) outw(GDCIDX, 0x0003); /* data rotate/function select */ outw(GDCIDX, 0x0f01); /* set/reset enable */ - outw(GDCIDX, (0 << 8) | 0x00); /* set/reset */ + outw(GDCIDX, (scp->curs_attr.mouse_ba << 8) | 0x00); /* set/reset */ p = scp->sc->adp->va_window + line_width*y + x/8; for (i = y, j = 0; i < ymax; ++i, ++j) { m = mdp->md_border[j] << 8 >> xoff; @@ -1221,7 +1223,7 @@ draw_pxlmouse_planar(scr_stat *scp, int x, int y) } p += line_width; } - outw(GDCIDX, (15 << 8) | 0x00); /* set/reset */ + outw(GDCIDX, (scp->curs_attr.mouse_ia << 8) | 0x00); /* set/reset */ p = scp->sc->adp->va_window + line_width*y + x/8; for (i = y, j = 0; i < ymax; ++i, ++j) { m = mdp->md_interior[j] << 8 >> xoff; @@ -1325,9 +1327,11 @@ do_on: for (i = 0; i < yend - y; i++, p += line_width) for (j = xend - x - 1; j >= 0; j--) if (mdp->md_interior[i] & (1 << (15 - j))) - DRAW_PIXEL(scp, p + j * pixel_size, 15); + DRAW_PIXEL(scp, p + j * pixel_size, + scp->curs_attr.mouse_ia); else if (mdp->md_border[i] & (1 << (15 - j))) - DRAW_PIXEL(scp, p + j * pixel_size, 0); + DRAW_PIXEL(scp, p + j * pixel_size, + scp->curs_attr.mouse_ba); } static void Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Fri Aug 25 05:49:37 2017 (r322877) +++ head/sys/dev/syscons/syscons.c Fri Aug 25 07:04:41 2017 (r322878) @@ -959,8 +959,16 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, cap = &scp->dflt_curs_attr; break; } - ((int *)data)[1] = cap->base; - ((int *)data)[2] = cap->height; + if (((int *)data)[0] & CONS_CHARCURSOR_COLORS) { + ((int *)data)[1] = cap->bg[0]; + ((int *)data)[2] = cap->bg[1]; + } else if (((int *)data)[0] & CONS_MOUSECURSOR_COLORS) { + ((int *)data)[1] = cap->mouse_ba; + ((int *)data)[2] = cap->mouse_ia; + } else { + ((int *)data)[1] = cap->base; + ((int *)data)[2] = cap->height; + } ((int *)data)[0] = cap->flags; return 0; @@ -3025,8 +3033,12 @@ sc_set_cursor_image(scr_stat *scp) static void sc_adjust_ca(struct cursor_attr *cap, int flags, int base, int height) { - if (0) { - /* Dummy clause to avoid changing indentation later. */ + if (flags & CONS_CHARCURSOR_COLORS) { + cap->bg[0] = base & 0xff; + cap->bg[1] = height & 0xff; + } else if (flags & CONS_MOUSECURSOR_COLORS) { + cap->mouse_ba = base & 0xff; + cap->mouse_ia = height & 0xff; } else { if (base >= 0) cap->base = base; @@ -3243,8 +3255,14 @@ scinit(int unit, int flags) sc->dflt_curs_attr.base = 0; sc->dflt_curs_attr.height = howmany(scp->font_size, 8); sc->dflt_curs_attr.flags = 0; + sc->dflt_curs_attr.bg[0] = FG_RED; + sc->dflt_curs_attr.bg[1] = FG_LIGHTGREY; + sc->dflt_curs_attr.bg[2] = FG_BLUE; + sc->dflt_curs_attr.mouse_ba = FG_WHITE; + sc->dflt_curs_attr.mouse_ia = FG_RED; sc->curs_attr = sc->dflt_curs_attr; scp->base_curs_attr = scp->dflt_curs_attr = sc->curs_attr; + scp->curs_attr = scp->base_curs_attr; #ifndef SC_NO_SYSMOUSE sc_mouse_move(scp, scp->xpixel/2, scp->ypixel/2); Modified: head/sys/dev/syscons/syscons.h ============================================================================== --- head/sys/dev/syscons/syscons.h Fri Aug 25 05:49:37 2017 (r322877) +++ head/sys/dev/syscons/syscons.h Fri Aug 25 07:04:41 2017 (r322878) @@ -167,11 +167,14 @@ typedef struct sc_vtb { int vtb_tail; /* valid for VTB_RINGBUFFER only */ } sc_vtb_t; -/* text cursor attributes */ +/* text and some mouse cursor attributes */ struct cursor_attr { - int flags; - int base; - int height; + u_char flags; + u_char base; + u_char height; + u_char bg[3]; + u_char mouse_ba; + u_char mouse_ia; }; /* softc */ Modified: head/sys/sys/consio.h ============================================================================== --- head/sys/sys/consio.h Fri Aug 25 05:49:37 2017 (r322877) +++ head/sys/sys/consio.h Fri Aug 25 07:04:41 2017 (r322878) @@ -187,6 +187,8 @@ typedef struct mouse_info mouse_info_t; #define CONS_HIDDEN_CURSOR (1 << 2) #define CONS_CURSOR_ATTRS (CONS_BLINK_CURSOR | CONS_CHAR_CURSOR | \ CONS_HIDDEN_CURSOR) +#define CONS_CHARCURSOR_COLORS (1 << 26) +#define CONS_MOUSECURSOR_COLORS (1 << 27) #define CONS_DEFAULT_CURSOR (1 << 28) #define CONS_SHAPEONLY_CURSOR (1 << 29) #define CONS_RESET_CURSOR (1 << 30) Modified: head/usr.sbin/vidcontrol/vidcontrol.1 ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.1 Fri Aug 25 05:49:37 2017 (r322877) +++ head/usr.sbin/vidcontrol/vidcontrol.1 Fri Aug 25 07:04:41 2017 (r322878) @@ -219,6 +219,50 @@ Set or clear the hidden attribute. The following (non-sticky) flags control application of the .Cm setting Ns s : .Bl -tag -width indent +.It Cm charcolors +Apply +.Cm base +and +.Cm height +to the (character) cursor's list of preferred colors instead of its shape. +Beware that the color numbers are raw VGA palette indexes, +not ANSI color numbers. +The indexes are reduced mod 8, 16 or 256, +or ignored, +depending on the video mode and renderer. +.It Cm mousecolors +Colors for the mouse cursor in graphics mode. +Like +.Cm charcolors , +except there is no preference or sequence; +.Cm base +gives the mouse border color and +.Cm height +gives the mouse interior color. +Together with +.Cm charcolors , +this gives 2 selection bits which select between +only 3 of 4 sub-destinations of the 4 destinations selected by +.Cm default +and +.Cm local +(by ignoring +.Cm mousecolors +if +.Cm charcolors +is also set). +.It Cm default +Apply the changes to the default settings and then to the active settings, +instead of only to the active settings. +Together with +.Cm local , +this gives 2 selection bits which select between 4 destinations. +.It Cm shapeonly +Ignore any changes to the +.Cm block +and +.Cm hidden +attributes. .It Cm local Apply the changes to the current vty. The default is to apply them to a global place @@ -233,10 +277,8 @@ to default local settings. Otherwise, the current global settings are reset to default global settings and then copied to the current and default settings for all vtys. -The global defaults are decided (not quite right) at boot time -and cannot be fixed up. -The local defaults are obtained as above and cannot be fixed up -locally. +.It Cm show +Show the current changes. .El .It Fl d Print out current output screen map. Modified: head/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.c Fri Aug 25 05:49:37 2017 (r322877) +++ head/usr.sbin/vidcontrol/vidcontrol.c Fri Aug 25 07:04:41 2017 (r322878) @@ -650,10 +650,21 @@ parse_cursor_params(char *param, struct cshape *shape) shape->shape[1] = strtol(word + 5, NULL, 0); else if (strncmp(word, "height=", 7) == 0) shape->shape[2] = strtol(word + 7, NULL, 0); + else if (strcmp(word, "charcolors") == 0) + type |= CONS_CHARCURSOR_COLORS; + else if (strcmp(word, "mousecolors") == 0) + type |= CONS_MOUSECURSOR_COLORS; + else if (strcmp(word, "default") == 0) + type |= CONS_DEFAULT_CURSOR; + else if (strcmp(word, "shapeonly") == 0) + type |= CONS_SHAPEONLY_CURSOR; else if (strcmp(word, "local") == 0) type |= CONS_LOCAL_CURSOR; else if (strcmp(word, "reset") == 0) type |= CONS_RESET_CURSOR; + else if (strcmp(word, "show") == 0) + printf("flags %#x, base %d, height %d\n", + type, shape->shape[1], shape->shape[2]); else { revert(); errx(1, @@ -676,11 +687,13 @@ set_cursor_type(char *param) { struct cshape shape; - /* Determine if the new setting is local (default to non-local). */ + /* Dry run to determine color, default and local flags. */ shape.shape[0] = 0; + shape.shape[1] = -1; + shape.shape[2] = -1; parse_cursor_params(param, &shape); - /* Get the relevant shape (the local flag is the only input arg). */ + /* Get the relevant old setting. */ if (ioctl(0, CONS_GETCURSORSHAPE, &shape) != 0) { revert(); err(1, "ioctl(CONS_GETCURSORSHAPE)"); From owner-svn-src-all@freebsd.org Fri Aug 25 07:42:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 282CBDF2267; Fri, 25 Aug 2017 07:42:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDF2277423; Fri, 25 Aug 2017 07:42:49 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P7gm1V044850; Fri, 25 Aug 2017 07:42:48 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P7gmsT044849; Fri, 25 Aug 2017 07:42:48 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201708250742.v7P7gmsT044849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 25 Aug 2017 07:42:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322879 - stable/11/usr.sbin/acpi/acpidump X-SVN-Group: stable-11 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: stable/11/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 322879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 07:42:50 -0000 Author: jkim Date: Fri Aug 25 07:42:48 2017 New Revision: 322879 URL: https://svnweb.freebsd.org/changeset/base/322879 Log: MFC: r321601 (emaste) acpidump: add GIC ITS srat type Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpi.c Fri Aug 25 07:04:41 2017 (r322878) +++ stable/11/usr.sbin/acpi/acpidump/acpi.c Fri Aug 25 07:42:48 2017 (r322879) @@ -1115,7 +1115,8 @@ static const char *srat_types[] = { [ACPI_SRAT_TYPE_CPU_AFFINITY] = "CPU", [ACPI_SRAT_TYPE_MEMORY_AFFINITY] = "Memory", [ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY] = "X2APIC", - [ACPI_SRAT_TYPE_GICC_AFFINITY] = "GICC" + [ACPI_SRAT_TYPE_GICC_AFFINITY] = "GICC", + [ACPI_SRAT_TYPE_GIC_ITS_AFFINITY] = "GIC ITS", }; static void From owner-svn-src-all@freebsd.org Fri Aug 25 07:49:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17F2BDF25CE; Fri, 25 Aug 2017 07:49:53 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8FDE77956; Fri, 25 Aug 2017 07:49:52 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P7nqDS045189; Fri, 25 Aug 2017 07:49:52 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P7nqpj045188; Fri, 25 Aug 2017 07:49:52 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201708250749.v7P7nqpj045188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 25 Aug 2017 07:49:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322880 - stable/11/usr.sbin/acpi/acpiconf X-SVN-Group: stable-11 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: stable/11/usr.sbin/acpi/acpiconf X-SVN-Commit-Revision: 322880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 07:49:53 -0000 Author: jkim Date: Fri Aug 25 07:49:51 2017 New Revision: 322880 URL: https://svnweb.freebsd.org/changeset/base/322880 Log: MFC: r316627 (kan) Use int to receive the return value of getopt function. Modified: stable/11/usr.sbin/acpi/acpiconf/acpiconf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/acpi/acpiconf/acpiconf.c ============================================================================== --- stable/11/usr.sbin/acpi/acpiconf/acpiconf.c Fri Aug 25 07:42:48 2017 (r322879) +++ stable/11/usr.sbin/acpi/acpiconf/acpiconf.c Fri Aug 25 07:49:51 2017 (r322880) @@ -203,8 +203,8 @@ usage(const char* prog) int main(int argc, char *argv[]) { - char c, *prog; - int sleep_type; + char *prog; + int c, sleep_type; prog = argv[0]; if (argc < 2) From owner-svn-src-all@freebsd.org Fri Aug 25 08:20:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47C1EDF2E50 for ; Fri, 25 Aug 2017 08:20:42 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.31.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DD3A7C675; Fri, 25 Aug 2017 08:20:41 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from [78.35.148.132] (helo=fabiankeil.de) by smtprelay05.ispgateway.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1dl9ol-0003JY-To; Fri, 25 Aug 2017 10:18:15 +0200 Date: Fri, 25 Aug 2017 10:16:47 +0200 From: Fabian Keil To: Warner Losh Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r322863 - head/sys/cam Message-ID: <20170825101647.5a385e1c@fabiankeil.de> In-Reply-To: <201708242211.v7OMBAlc012582@repo.freebsd.org> References: <201708242211.v7OMBAlc012582@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/LWaf+IfUL2+zVwlmID+qDJV"; protocol="application/pgp-signature" X-Df-Sender: Nzc1MDY3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 08:20:42 -0000 --Sig_/LWaf+IfUL2+zVwlmID+qDJV Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Warner Losh wrote: > Author: imp > Date: Thu Aug 24 22:11:10 2017 > New Revision: 322863 > URL: https://svnweb.freebsd.org/changeset/base/322863 >=20 > Log: > Expand the latency tracking array from 1.024s to 8.192s to help track > extreme outliers from dodgy drives. Adjust comments to reflect this, > and make sure that the number of latency buckets match in the two > places where it matters. It also matters for the sysctl description in cam_iosched_iop_stats_sysctl_= init(). Would you mind increasing LAT_BUCKETS a bit more? I've recently set it to 17 in ElectroBSD as writes to my laptop's disk occasionally take a while under load: fk@t520 ~ $sudo /usr/src/share/dtrace/bio-request-latency [...] ada0 BIO_WRITE value ------------- Distribution ------------- count 16 | 0 32 | 1 64 | 34 128 |@ 582 256 |@@@@@@@@@@ 10608 512 |@@@@@ 5574 1024 |@@ 2454 2048 |@@@@ 3872 4096 |@@@@ 4043 8192 |@@@@ 4115 16384 |@@@@@ 4953 32768 |@@@ 3656 65536 |@@ 2252 131072 |@ 764 262144 | 331 524288 | 291 1048576 | 53 2097152 | 9 4194304 | 4 8388608 | 6 16777216 | 2 33554432 | 0 ada0 BIO_READ value ------------- Distribution ------------- count 16 | 0 32 | 1 64 | 126 128 |@ 1205 256 |@@@@@ 6359 512 |@@@ 3987 1024 |@@ 2044 2048 |@ 1384 4096 |@@ 2853 8192 |@@@@@ 6012 16384 |@@@@@@ 7254 32768 |@@@@@ 6524 65536 |@@@@ 4945 131072 |@@@ 3006 262144 |@ 1194 524288 |@ 620 1048576 | 162 2097152 | 0 Disk Bio Type Requests | Latency in us = | iops Throughput | avg stddev max min | ada0 BIO_FLUSH 253 | 145927 162796 1253731 10293 = | 0 0 k/s ada0 BIO_WRITE 43604 | 30345 261090 30069820 61 = | 43 1994 k/s ada0 BIO_READ 47676 | 56039 128083 1691813 63 = | 47 1260 k/s While proper tuning helps, the latency stats are also useful on systems where the iosched limiters haven't been enabled (yet). Fabian --Sig_/LWaf+IfUL2+zVwlmID+qDJV Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQTKUNd6H/m3+ByGULIFiohV/3dUnQUCWZ/c7wAKCRAFiohV/3dU nfxrAKCfoLPKVLoyATS9U5izZE90l/nPEACgvaCQaQqjVi0JDYeb/ULD7gwcEQ0= =ZKXA -----END PGP SIGNATURE----- --Sig_/LWaf+IfUL2+zVwlmID+qDJV-- From owner-svn-src-all@freebsd.org Fri Aug 25 08:21:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DE63DF2F7B; Fri, 25 Aug 2017 08:21:04 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D7257C6FB; Fri, 25 Aug 2017 08:21:04 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P8L3g2060379; Fri, 25 Aug 2017 08:21:03 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P8L3Ji060378; Fri, 25 Aug 2017 08:21:03 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201708250821.v7P8L3Ji060378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 25 Aug 2017 08:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322881 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: smh X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 08:21:04 -0000 Author: smh Date: Fri Aug 25 08:21:02 2017 New Revision: 322881 URL: https://svnweb.freebsd.org/changeset/base/322881 Log: Add myself (smh) to calendar.freebsd Sponsored by: Multiplay Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 25 07:49:51 2017 (r322880) +++ head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 25 08:21:02 2017 (r322881) @@ -333,6 +333,7 @@ 09/07 Chris Rees born in Kettering, United Kingdom, 1987 09/08 Boris Samorodov born in Krasnodar, Russian Federation, 1963 09/09 Yoshio Mita born in Hiroshima, Japan, 1972 +09/09 Steven Hartland born in Wordsley, United Kingdom, 1973 09/10 Wesley R. Peters born in Hartford, Alabama, United States, 1961 09/12 Weongyo Jeong born in Haman, Korea, 1980 09/12 Benedict Christopher Reuschling born in Darmstadt, Germany, 1981 From owner-svn-src-all@freebsd.org Fri Aug 25 08:24:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AD72DCD10E; Fri, 25 Aug 2017 08:24:30 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 280597CB16; Fri, 25 Aug 2017 08:24:30 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P8OTXY061409; Fri, 25 Aug 2017 08:24:29 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P8OT7j061408; Fri, 25 Aug 2017 08:24:29 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201708250824.v7P8OT7j061408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Fri, 25 Aug 2017 08:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322882 - stable/11/usr.sbin/ypldap X-SVN-Group: stable-11 X-SVN-Commit-Author: araujo X-SVN-Commit-Paths: stable/11/usr.sbin/ypldap X-SVN-Commit-Revision: 322882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 08:24:30 -0000 Author: araujo Date: Fri Aug 25 08:24:29 2017 New Revision: 322882 URL: https://svnweb.freebsd.org/changeset/base/322882 Log: MFC r321846: Log when we have finished pushing users and groups. Obtained from: OpenBSD (rev 1.4) Modified: stable/11/usr.sbin/ypldap/entries.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/ypldap/entries.c ============================================================================== --- stable/11/usr.sbin/ypldap/entries.c Fri Aug 25 08:21:02 2017 (r322881) +++ stable/11/usr.sbin/ypldap/entries.c Fri Aug 25 08:24:29 2017 (r322882) @@ -92,6 +92,7 @@ flatten_entries(struct env *env) free(tmp); } env->sc_user_lines = linep; + log_debug("done pushing users"); wrlen = env->sc_group_line_len; if ((linep = calloc(1, env->sc_group_line_len + 1)) == NULL) { @@ -117,6 +118,7 @@ flatten_entries(struct env *env) wrlen -= len; } env->sc_group_lines = linep; + log_debug("done pushing groups"); } int From owner-svn-src-all@freebsd.org Fri Aug 25 09:51:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55354DD3C73; Fri, 25 Aug 2017 09:51:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 213137EFA7; Fri, 25 Aug 2017 09:51:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7P9pM7h095002; Fri, 25 Aug 2017 09:51:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P9pMjm095001; Fri, 25 Aug 2017 09:51:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708250951.v7P9pMjm095001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 25 Aug 2017 09:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322883 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 322883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 09:51:23 -0000 Author: kib Date: Fri Aug 25 09:51:22 2017 New Revision: 322883 URL: https://svnweb.freebsd.org/changeset/base/322883 Log: Protect v_rdev dereference with the vnode interlock instead of the vnode lock. Caller of softdep_count_dependencies() may own a buffer lock, which might conflict with the lock order. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 10 days Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri Aug 25 08:24:29 2017 (r322882) +++ head/sys/ufs/ffs/ffs_softdep.c Fri Aug 25 09:51:22 2017 (r322883) @@ -13937,9 +13937,9 @@ softdep_count_dependencies(bp, wantcount) */ retry: if (vp->v_type == VCHR) { - VOP_LOCK(vp, LK_RETRY | LK_EXCLUSIVE); + VI_LOCK(vp); mp = vp->v_type == VCHR ? vp->v_rdev->si_mountpt : NULL; - VOP_UNLOCK(vp, 0); + VI_UNLOCK(vp); if (mp == NULL) goto retry; } else if (vp->v_type == VREG) { From owner-svn-src-all@freebsd.org Fri Aug 25 10:35:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2504DD47F7; Fri, 25 Aug 2017 10:35:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 389AF806E3; Fri, 25 Aug 2017 10:35:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v7PAZYUZ046534 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 25 Aug 2017 13:35:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v7PAZYUZ046534 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v7PAZYhx046533; Fri, 25 Aug 2017 13:35:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 25 Aug 2017 13:35:34 +0300 From: Konstantin Belousov To: Bryan Drewery Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r306512 - in head/sys: kern sys Message-ID: <20170825103534.GK1700@kib.kiev.ua> References: <201609301727.u8UHRIgD051373@repo.freebsd.org> <6ea06065-ea5c-b83b-3854-224626be0d77@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6ea06065-ea5c-b83b-3854-224626be0d77@FreeBSD.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 10:35:41 -0000 On Thu, Aug 24, 2017 at 08:18:03PM -0700, Bryan Drewery wrote: > On 9/30/2016 10:27 AM, Mateusz Guzik wrote: > > Author: mjg > > Date: Fri Sep 30 17:27:17 2016 > > New Revision: 306512 > > URL: https://svnweb.freebsd.org/changeset/base/306512 > > > > Log: > > vfs: batch free vnodes in per-mnt lists > > > > Previously free vnodes would always by directly returned to the global > > LRU list. With this change up to mnt_free_list_batch vnodes are collected > > first. > > > > syncer runs always return the batch regardless of its size. > > > > While vnodes on per-mnt lists are not counted as free, they can be > > returned in case of vnode shortage. > > > > Reviewed by: kib > > Tested by: pho > > > > Modified: > > head/sys/kern/vfs_mount.c > > head/sys/kern/vfs_subr.c > > head/sys/sys/mount.h > > head/sys/sys/vnode.h > > > ... > > @@ -2753,17 +2824,25 @@ _vhold(struct vnode *vp, bool locked) > > * Remove a vnode from the free list, mark it as in use, > > * and put it on the active list. > > */ > > - mtx_lock(&vnode_free_list_mtx); > > - TAILQ_REMOVE(&vnode_free_list, vp, v_actfreelist); > > - freevnodes--; > > - vp->v_iflag &= ~VI_FREE; > > + mp = vp->v_mount; > > + mtx_lock(&mp->mnt_listmtx); > ^^ > > > + if ((vp->v_mflag & VMP_TMPMNTFREELIST) != 0) { > > + TAILQ_REMOVE(&mp->mnt_tmpfreevnodelist, vp, v_actfreelist); > > + mp->mnt_tmpfreevnodelistsize--; > > + vp->v_mflag &= ~VMP_TMPMNTFREELIST; > > + } else { > > + mtx_lock(&vnode_free_list_mtx); > > + TAILQ_REMOVE(&vnode_free_list, vp, v_actfreelist); > > + freevnodes--; > > + mtx_unlock(&vnode_free_list_mtx); > > + } > > KASSERT((vp->v_iflag & VI_ACTIVE) == 0, > > ("Activating already active vnode")); > > + vp->v_iflag &= ~VI_FREE; > > vp->v_iflag |= VI_ACTIVE; > > - mp = vp->v_mount; > > TAILQ_INSERT_HEAD(&mp->mnt_activevnodelist, vp, v_actfreelist); > > mp->mnt_activevnodelistsize++; > > - mtx_unlock(&vnode_free_list_mtx); > > + mtx_unlock(&mp->mnt_listmtx); > > refcount_acquire(&vp->v_holdcnt); > > if (!locked) > > VI_UNLOCK(vp); > > @@ -2819,21 +2898,25 @@ _vdrop(struct vnode *vp, bool locked) > > if ((vp->v_iflag & VI_OWEINACT) == 0) { > > vp->v_iflag &= ~VI_ACTIVE; > > mp = vp->v_mount; > > - mtx_lock(&vnode_free_list_mtx); > > + mtx_lock(&mp->mnt_listmtx); > ^^ > > If code runs getnewvnode() and then immediately runs vhold() or vrele(), > without first running insmntque(vp, mp), then vp->v_mount is NULL here > and the lock/freelist dereferencing just panic. getnewvnode() returns vref-ed vnode, i.e. both hold and use counts are set to 1. What is the use case there which requires vhold-ing vnode without finishing its construction ? > Locking the vnode and then using vgone() and vput() on it avoids the > issue since it marks the vnode VI_DOOMED and instead frees it in > _vdrop() rather than try to re-add it to its NULL per-mount free list. This is the common pattern where insmntque() fails. > > I'm not sure what the right thing here is. Is it a requirement to > insmntque() a new vnode immediately, or to vgone() it before releasing > it if was just returned from getnewvnode()? These are the only uses of a newly allocated vnode which make sense. Do you need this for something that does not happen in the svn tree ? > > Perhaps these cases should assert that v_mount is not NULL or handle the > odd case and just free the vnode instead, or can it still just add to > the global vnode_free_list if mp is NULL? > > The old code handled the case fine since the freelist was global and not > per-mount. 'mp' was only dereferenced below if the vnode had been > active, which was not the case for my example. From owner-svn-src-all@freebsd.org Fri Aug 25 10:57:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F577DD4FD1; Fri, 25 Aug 2017 10:57:19 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B18E81011; Fri, 25 Aug 2017 10:57:18 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PAvHPl024427; Fri, 25 Aug 2017 10:57:17 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PAvHFf024426; Fri, 25 Aug 2017 10:57:17 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708251057.v7PAvHFf024426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 25 Aug 2017 10:57:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322884 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 322884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 10:57:19 -0000 Author: bde Date: Fri Aug 25 10:57:17 2017 New Revision: 322884 URL: https://svnweb.freebsd.org/changeset/base/322884 Log: Fix bugs in (mostly) not-yet-activated parts of early/emergency output: - map the hard-coded frame buffer address above KERNBASE. Using the physical address only worked because of larger mapping bugs. The hard-coded frame buffer address only works on x86. Use messy ifdefs to try to avoid warnings about unused code for other arches. - remove the sysctl for reading and writing the table kernel console attributes. Writing only worked for emergency output since normal output uses unalterd copies. - fix the test for the emergency console being usable - explain why a hard-coded attribute is used very early. Emergency output works on x86 even before the pcpu pointer is initialized. Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Fri Aug 25 09:51:22 2017 (r322883) +++ head/sys/dev/syscons/syscons.c Fri Aug 25 10:57:17 2017 (r322884) @@ -76,6 +76,13 @@ __FBSDID("$FreeBSD$"); #endif #include +#if defined(__amd64__) || defined(__i386__) +#include + +#include +#include +#endif + #include #include #include @@ -137,8 +144,6 @@ static int sc_no_suspend_vtswitch = 0; static int sc_susp_scr; static SYSCTL_NODE(_hw, OID_AUTO, syscons, CTLFLAG_RD, 0, "syscons"); -SYSCTL_OPAQUE(_hw_syscons, OID_AUTO, kattr, CTLFLAG_RW, - &sc_kattrtab, sizeof(sc_kattrtab), "CU", "kernel console attributes"); static SYSCTL_NODE(_hw_syscons, OID_AUTO, saver, CTLFLAG_RD, 0, "saver"); SYSCTL_INT(_hw_syscons_saver, OID_AUTO, keybonly, CTLFLAG_RW, &sc_saver_keyb_only, 0, "screen saver interrupted by input only"); @@ -277,16 +282,17 @@ ec_putc(int c) if (sc_console == NULL) { #if !defined(__amd64__) && !defined(__i386__) return; -#endif +#else /* * This is enough for ec_putc() to work very early on x86 * if the kernel starts in normal color text mode. */ - fb = 0xb8000; + fb = KERNBASE + 0xb8000; xsize = 80; ysize = 25; +#endif } else { - if (main_console.status & GRAPHICS_MODE) + if (!ISTEXTSC(&main_console)) return; fb = main_console.sc->adp->va_window; xsize = main_console.xsize; @@ -4159,7 +4165,7 @@ static int sc_kattr(void) { if (sc_console == NULL) - return (SC_KERNEL_CONS_ATTR); + return (SC_KERNEL_CONS_ATTR); /* for very early, before pcpu */ return (sc_kattrtab[PCPU_GET(cpuid) % nitems(sc_kattrtab)]); } From owner-svn-src-all@freebsd.org Fri Aug 25 11:01:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB47FDD51F4; Fri, 25 Aug 2017 11:01:41 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E1DB813A6; Fri, 25 Aug 2017 11:01:41 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PB1e7C027713; Fri, 25 Aug 2017 11:01:40 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PB1doR027697; Fri, 25 Aug 2017 11:01:39 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201708251101.v7PB1doR027697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 25 Aug 2017 11:01:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322885 - in head: sys/compat/cloudabi sys/compat/cloudabi32 sys/compat/cloudabi64 sys/contrib/cloudabi usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: ed X-SVN-Commit-Paths: in head: sys/compat/cloudabi sys/compat/cloudabi32 sys/compat/cloudabi64 sys/contrib/cloudabi usr.bin/truss X-SVN-Commit-Revision: 322885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 11:01:41 -0000 Author: ed Date: Fri Aug 25 11:01:39 2017 New Revision: 322885 URL: https://svnweb.freebsd.org/changeset/base/322885 Log: Sync CloudABI compatibility against the latest upstream version (v0.13). With Flower (CloudABI's network connection daemon) becoming more complete, there is no longer any need for creating any unconnected sockets. Socket pairs in combination with file descriptor passing is all that is necessary, as that is what is used by Flower to pass network connections from the public internet to listening processes. Remove all of the kernel bits that were used to implement socket(), listen(), bindat() and connectat(). In principle, accept() and SO_ACCEPTCONN may also be removed, but there are still some consumers left. Obtained from: https://github.com/NuxiNL/cloudabi MFC after: 1 month Modified: head/sys/compat/cloudabi/cloudabi_fd.c head/sys/compat/cloudabi/cloudabi_sock.c head/sys/compat/cloudabi32/cloudabi32_proto.h head/sys/compat/cloudabi32/cloudabi32_syscall.h head/sys/compat/cloudabi32/cloudabi32_syscalls.c head/sys/compat/cloudabi32/cloudabi32_sysent.c head/sys/compat/cloudabi32/cloudabi32_systrace_args.c head/sys/compat/cloudabi64/cloudabi64_proto.h head/sys/compat/cloudabi64/cloudabi64_syscall.h head/sys/compat/cloudabi64/cloudabi64_syscalls.c head/sys/compat/cloudabi64/cloudabi64_sysent.c head/sys/compat/cloudabi64/cloudabi64_systrace_args.c head/sys/contrib/cloudabi/cloudabi_types_common.h head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.S head/sys/contrib/cloudabi/cloudabi_vdso_armv6.S head/sys/contrib/cloudabi/cloudabi_vdso_i686.S head/sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S head/sys/contrib/cloudabi/cloudabi_vdso_x86_64.S head/sys/contrib/cloudabi/syscalls32.master head/sys/contrib/cloudabi/syscalls64.master head/usr.bin/truss/syscalls.c Modified: head/sys/compat/cloudabi/cloudabi_fd.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_fd.c Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi/cloudabi_fd.c Fri Aug 25 11:01:39 2017 (r322885) @@ -79,11 +79,6 @@ __FBSDID("$FreeBSD$"); MAPPING(CLOUDABI_RIGHT_POLL_WAIT, CAP_KQUEUE_EVENT) \ MAPPING(CLOUDABI_RIGHT_PROC_EXEC, CAP_FEXECVE) \ MAPPING(CLOUDABI_RIGHT_SOCK_ACCEPT, CAP_ACCEPT) \ - MAPPING(CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY, CAP_BINDAT) \ - MAPPING(CLOUDABI_RIGHT_SOCK_BIND_SOCKET, CAP_BIND) \ - MAPPING(CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY, CAP_CONNECTAT) \ - MAPPING(CLOUDABI_RIGHT_SOCK_CONNECT_SOCKET, CAP_CONNECT) \ - MAPPING(CLOUDABI_RIGHT_SOCK_LISTEN, CAP_LISTEN) \ MAPPING(CLOUDABI_RIGHT_SOCK_SHUTDOWN, CAP_SHUTDOWN) \ MAPPING(CLOUDABI_RIGHT_SOCK_STAT_GET, CAP_GETPEERNAME, \ CAP_GETSOCKNAME, CAP_GETSOCKOPT) @@ -109,10 +104,6 @@ cloudabi_sys_fd_create1(struct thread *td, cap_rights_init(&fcaps.fc_rights, CAP_FSTAT, CAP_FTRUNCATE, CAP_MMAP_RWX); return (kern_shm_open(td, SHM_ANON, O_RDWR, 0, &fcaps)); - case CLOUDABI_FILETYPE_SOCKET_DGRAM: - return (kern_socket(td, AF_UNIX, SOCK_DGRAM, 0)); - case CLOUDABI_FILETYPE_SOCKET_STREAM: - return (kern_socket(td, AF_UNIX, SOCK_STREAM, 0)); default: return (EINVAL); } @@ -312,9 +303,7 @@ cloudabi_remove_conflicting_rights(cloudabi_filetype_t CLOUDABI_RIGHT_FILE_STAT_PUT_TIMES | CLOUDABI_RIGHT_FILE_SYMLINK | CLOUDABI_RIGHT_FILE_UNLINK | - CLOUDABI_RIGHT_POLL_FD_READWRITE | - CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY | - CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY; + CLOUDABI_RIGHT_POLL_FD_READWRITE; *inheriting &= CLOUDABI_RIGHT_FD_DATASYNC | CLOUDABI_RIGHT_FD_READ | CLOUDABI_RIGHT_FD_SEEK | @@ -344,9 +333,7 @@ cloudabi_remove_conflicting_rights(cloudabi_filetype_t CLOUDABI_RIGHT_MEM_MAP | CLOUDABI_RIGHT_MEM_MAP_EXEC | CLOUDABI_RIGHT_POLL_FD_READWRITE | - CLOUDABI_RIGHT_PROC_EXEC | - CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY | - CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY; + CLOUDABI_RIGHT_PROC_EXEC; break; case CLOUDABI_FILETYPE_FIFO: *base &= CLOUDABI_RIGHT_FD_READ | @@ -400,9 +387,6 @@ cloudabi_remove_conflicting_rights(cloudabi_filetype_t CLOUDABI_RIGHT_FILE_STAT_FGET | CLOUDABI_RIGHT_POLL_FD_READWRITE | CLOUDABI_RIGHT_SOCK_ACCEPT | - CLOUDABI_RIGHT_SOCK_BIND_SOCKET | - CLOUDABI_RIGHT_SOCK_CONNECT_SOCKET | - CLOUDABI_RIGHT_SOCK_LISTEN | CLOUDABI_RIGHT_SOCK_SHUTDOWN | CLOUDABI_RIGHT_SOCK_STAT_GET; break; Modified: head/sys/compat/cloudabi/cloudabi_sock.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_sock.c Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi/cloudabi_sock.c Fri Aug 25 11:01:39 2017 (r322885) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -49,28 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -/* Copies a pathname into a UNIX socket address structure. */ -static int -copyin_sockaddr_un(const char *path, size_t pathlen, struct sockaddr_un *sun) -{ - int error; - - /* Copy in pathname string if there's enough space. */ - if (pathlen >= sizeof(sun->sun_path)) - return (ENAMETOOLONG); - error = copyin(path, &sun->sun_path, pathlen); - if (error != 0) - return (error); - if (memchr(sun->sun_path, '\0', pathlen) != NULL) - return (EINVAL); - - /* Initialize the rest of the socket address. */ - sun->sun_path[pathlen] = '\0'; - sun->sun_family = AF_UNIX; - sun->sun_len = sizeof(*sun); - return (0); -} - int cloudabi_sys_sock_accept(struct thread *td, struct cloudabi_sys_sock_accept_args *uap) @@ -80,41 +57,6 @@ cloudabi_sys_sock_accept(struct thread *td, } int -cloudabi_sys_sock_bind(struct thread *td, - struct cloudabi_sys_sock_bind_args *uap) -{ - struct sockaddr_un sun; - int error; - - error = copyin_sockaddr_un(uap->path, uap->path_len, &sun); - if (error != 0) - return (error); - return (kern_bindat(td, uap->fd, uap->sock, (struct sockaddr *)&sun)); -} - -int -cloudabi_sys_sock_connect(struct thread *td, - struct cloudabi_sys_sock_connect_args *uap) -{ - struct sockaddr_un sun; - int error; - - error = copyin_sockaddr_un(uap->path, uap->path_len, &sun); - if (error != 0) - return (error); - return (kern_connectat(td, uap->fd, uap->sock, - (struct sockaddr *)&sun)); -} - -int -cloudabi_sys_sock_listen(struct thread *td, - struct cloudabi_sys_sock_listen_args *uap) -{ - - return (kern_listen(td, uap->sock, uap->backlog)); -} - -int cloudabi_sys_sock_shutdown(struct thread *td, struct cloudabi_sys_sock_shutdown_args *uap) { @@ -174,10 +116,7 @@ cloudabi_sock_recv(struct thread *td, cloudabi_fd_t fd cloudabi_riflags_t flags, size_t *rdatalen, size_t *rfdslen, cloudabi_roflags_t *rflags) { - struct sockaddr_storage ss; struct msghdr hdr = { - .msg_name = &ss, - .msg_namelen = sizeof(ss), .msg_iov = data, .msg_iovlen = datalen, }; Modified: head/sys/compat/cloudabi32/cloudabi32_proto.h ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_proto.h Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi32/cloudabi32_proto.h Fri Aug 25 11:01:39 2017 (r322885) @@ -259,22 +259,6 @@ struct cloudabi_sys_sock_accept_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char unused_l_[PADL_(void *)]; void * unused; char unused_r_[PADR_(void *)]; }; -struct cloudabi_sys_sock_bind_args { - char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; - char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; - char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; - char path_len_l_[PADL_(size_t)]; size_t path_len; char path_len_r_[PADR_(size_t)]; -}; -struct cloudabi_sys_sock_connect_args { - char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; - char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; - char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; - char path_len_l_[PADL_(size_t)]; size_t path_len; char path_len_r_[PADR_(size_t)]; -}; -struct cloudabi_sys_sock_listen_args { - char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; - char backlog_l_[PADL_(cloudabi_backlog_t)]; cloudabi_backlog_t backlog; char backlog_r_[PADR_(cloudabi_backlog_t)]; -}; struct cloudabi32_sys_sock_recv_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char in_l_[PADL_(const cloudabi32_recv_in_t *)]; const cloudabi32_recv_in_t * in; char in_r_[PADR_(const cloudabi32_recv_in_t *)]; @@ -349,9 +333,6 @@ int cloudabi_sys_proc_fork(struct thread *, struct clo int cloudabi_sys_proc_raise(struct thread *, struct cloudabi_sys_proc_raise_args *); int cloudabi_sys_random_get(struct thread *, struct cloudabi_sys_random_get_args *); int cloudabi_sys_sock_accept(struct thread *, struct cloudabi_sys_sock_accept_args *); -int cloudabi_sys_sock_bind(struct thread *, struct cloudabi_sys_sock_bind_args *); -int cloudabi_sys_sock_connect(struct thread *, struct cloudabi_sys_sock_connect_args *); -int cloudabi_sys_sock_listen(struct thread *, struct cloudabi_sys_sock_listen_args *); int cloudabi32_sys_sock_recv(struct thread *, struct cloudabi32_sys_sock_recv_args *); int cloudabi32_sys_sock_send(struct thread *, struct cloudabi32_sys_sock_send_args *); int cloudabi_sys_sock_shutdown(struct thread *, struct cloudabi_sys_sock_shutdown_args *); @@ -440,9 +421,6 @@ int cloudabi_sys_thread_yield(struct thread *, struct #define CLOUDABI32_SYS_AUE_cloudabi_sys_proc_raise AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_random_get AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_sock_accept AUE_NULL -#define CLOUDABI32_SYS_AUE_cloudabi_sys_sock_bind AUE_NULL -#define CLOUDABI32_SYS_AUE_cloudabi_sys_sock_connect AUE_NULL -#define CLOUDABI32_SYS_AUE_cloudabi_sys_sock_listen AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi32_sys_sock_recv AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi32_sys_sock_send AUE_NULL #define CLOUDABI32_SYS_AUE_cloudabi_sys_sock_shutdown AUE_NULL Modified: head/sys/compat/cloudabi32/cloudabi32_syscall.h ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_syscall.h Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi32/cloudabi32_syscall.h Fri Aug 25 11:01:39 2017 (r322885) @@ -50,14 +50,11 @@ #define CLOUDABI32_SYS_cloudabi_sys_proc_raise 42 #define CLOUDABI32_SYS_cloudabi_sys_random_get 43 #define CLOUDABI32_SYS_cloudabi_sys_sock_accept 44 -#define CLOUDABI32_SYS_cloudabi_sys_sock_bind 45 -#define CLOUDABI32_SYS_cloudabi_sys_sock_connect 46 -#define CLOUDABI32_SYS_cloudabi_sys_sock_listen 47 -#define CLOUDABI32_SYS_cloudabi32_sys_sock_recv 48 -#define CLOUDABI32_SYS_cloudabi32_sys_sock_send 49 -#define CLOUDABI32_SYS_cloudabi_sys_sock_shutdown 50 -#define CLOUDABI32_SYS_cloudabi_sys_sock_stat_get 51 -#define CLOUDABI32_SYS_cloudabi32_sys_thread_create 52 -#define CLOUDABI32_SYS_cloudabi_sys_thread_exit 53 -#define CLOUDABI32_SYS_cloudabi_sys_thread_yield 54 -#define CLOUDABI32_SYS_MAXSYSCALL 55 +#define CLOUDABI32_SYS_cloudabi32_sys_sock_recv 45 +#define CLOUDABI32_SYS_cloudabi32_sys_sock_send 46 +#define CLOUDABI32_SYS_cloudabi_sys_sock_shutdown 47 +#define CLOUDABI32_SYS_cloudabi_sys_sock_stat_get 48 +#define CLOUDABI32_SYS_cloudabi32_sys_thread_create 49 +#define CLOUDABI32_SYS_cloudabi_sys_thread_exit 50 +#define CLOUDABI32_SYS_cloudabi_sys_thread_yield 51 +#define CLOUDABI32_SYS_MAXSYSCALL 52 Modified: head/sys/compat/cloudabi32/cloudabi32_syscalls.c ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_syscalls.c Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi32/cloudabi32_syscalls.c Fri Aug 25 11:01:39 2017 (r322885) @@ -51,14 +51,11 @@ const char *cloudabi32_syscallnames[] = { "cloudabi_sys_proc_raise", /* 42 = cloudabi_sys_proc_raise */ "cloudabi_sys_random_get", /* 43 = cloudabi_sys_random_get */ "cloudabi_sys_sock_accept", /* 44 = cloudabi_sys_sock_accept */ - "cloudabi_sys_sock_bind", /* 45 = cloudabi_sys_sock_bind */ - "cloudabi_sys_sock_connect", /* 46 = cloudabi_sys_sock_connect */ - "cloudabi_sys_sock_listen", /* 47 = cloudabi_sys_sock_listen */ - "cloudabi32_sys_sock_recv", /* 48 = cloudabi32_sys_sock_recv */ - "cloudabi32_sys_sock_send", /* 49 = cloudabi32_sys_sock_send */ - "cloudabi_sys_sock_shutdown", /* 50 = cloudabi_sys_sock_shutdown */ - "cloudabi_sys_sock_stat_get", /* 51 = cloudabi_sys_sock_stat_get */ - "cloudabi32_sys_thread_create", /* 52 = cloudabi32_sys_thread_create */ - "cloudabi_sys_thread_exit", /* 53 = cloudabi_sys_thread_exit */ - "cloudabi_sys_thread_yield", /* 54 = cloudabi_sys_thread_yield */ + "cloudabi32_sys_sock_recv", /* 45 = cloudabi32_sys_sock_recv */ + "cloudabi32_sys_sock_send", /* 46 = cloudabi32_sys_sock_send */ + "cloudabi_sys_sock_shutdown", /* 47 = cloudabi_sys_sock_shutdown */ + "cloudabi_sys_sock_stat_get", /* 48 = cloudabi_sys_sock_stat_get */ + "cloudabi32_sys_thread_create", /* 49 = cloudabi32_sys_thread_create */ + "cloudabi_sys_thread_exit", /* 50 = cloudabi_sys_thread_exit */ + "cloudabi_sys_thread_yield", /* 51 = cloudabi_sys_thread_yield */ }; Modified: head/sys/compat/cloudabi32/cloudabi32_sysent.c ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_sysent.c Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi32/cloudabi32_sysent.c Fri Aug 25 11:01:39 2017 (r322885) @@ -59,14 +59,11 @@ struct sysent cloudabi32_sysent[] = { { AS(cloudabi_sys_proc_raise_args), (sy_call_t *)cloudabi_sys_proc_raise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = cloudabi_sys_proc_raise */ { AS(cloudabi_sys_random_get_args), (sy_call_t *)cloudabi_sys_random_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = cloudabi_sys_random_get */ { AS(cloudabi_sys_sock_accept_args), (sy_call_t *)cloudabi_sys_sock_accept, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = cloudabi_sys_sock_accept */ - { AS(cloudabi_sys_sock_bind_args), (sy_call_t *)cloudabi_sys_sock_bind, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi_sys_sock_bind */ - { AS(cloudabi_sys_sock_connect_args), (sy_call_t *)cloudabi_sys_sock_connect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi_sys_sock_connect */ - { AS(cloudabi_sys_sock_listen_args), (sy_call_t *)cloudabi_sys_sock_listen, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_listen */ - { AS(cloudabi32_sys_sock_recv_args), (sy_call_t *)cloudabi32_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi32_sys_sock_recv */ - { AS(cloudabi32_sys_sock_send_args), (sy_call_t *)cloudabi32_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi32_sys_sock_send */ - { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi_sys_sock_shutdown */ - { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi_sys_sock_stat_get */ - { AS(cloudabi32_sys_thread_create_args), (sy_call_t *)cloudabi32_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 52 = cloudabi32_sys_thread_create */ - { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 53 = cloudabi_sys_thread_exit */ - { 0, (sy_call_t *)cloudabi_sys_thread_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 54 = cloudabi_sys_thread_yield */ + { AS(cloudabi32_sys_sock_recv_args), (sy_call_t *)cloudabi32_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi32_sys_sock_recv */ + { AS(cloudabi32_sys_sock_send_args), (sy_call_t *)cloudabi32_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi32_sys_sock_send */ + { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_shutdown */ + { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi_sys_sock_stat_get */ + { AS(cloudabi32_sys_thread_create_args), (sy_call_t *)cloudabi32_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi32_sys_thread_create */ + { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi_sys_thread_exit */ + { 0, (sy_call_t *)cloudabi_sys_thread_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi_sys_thread_yield */ }; Modified: head/sys/compat/cloudabi32/cloudabi32_systrace_args.c ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_systrace_args.c Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi32/cloudabi32_systrace_args.c Fri Aug 25 11:01:39 2017 (r322885) @@ -415,36 +415,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 2; break; } - /* cloudabi_sys_sock_bind */ - case 45: { - struct cloudabi_sys_sock_bind_args *p = params; - iarg[0] = p->sock; /* cloudabi_fd_t */ - iarg[1] = p->fd; /* cloudabi_fd_t */ - uarg[2] = (intptr_t) p->path; /* const char * */ - uarg[3] = p->path_len; /* size_t */ - *n_args = 4; - break; - } - /* cloudabi_sys_sock_connect */ - case 46: { - struct cloudabi_sys_sock_connect_args *p = params; - iarg[0] = p->sock; /* cloudabi_fd_t */ - iarg[1] = p->fd; /* cloudabi_fd_t */ - uarg[2] = (intptr_t) p->path; /* const char * */ - uarg[3] = p->path_len; /* size_t */ - *n_args = 4; - break; - } - /* cloudabi_sys_sock_listen */ - case 47: { - struct cloudabi_sys_sock_listen_args *p = params; - iarg[0] = p->sock; /* cloudabi_fd_t */ - iarg[1] = p->backlog; /* cloudabi_backlog_t */ - *n_args = 2; - break; - } /* cloudabi32_sys_sock_recv */ - case 48: { + case 45: { struct cloudabi32_sys_sock_recv_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi32_recv_in_t * */ @@ -453,7 +425,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi32_sys_sock_send */ - case 49: { + case 46: { struct cloudabi32_sys_sock_send_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi32_send_in_t * */ @@ -462,7 +434,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_sock_shutdown */ - case 50: { + case 47: { struct cloudabi_sys_sock_shutdown_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->how; /* cloudabi_sdflags_t */ @@ -470,7 +442,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_sock_stat_get */ - case 51: { + case 48: { struct cloudabi_sys_sock_stat_get_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */ @@ -479,14 +451,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi32_sys_thread_create */ - case 52: { + case 49: { struct cloudabi32_sys_thread_create_args *p = params; uarg[0] = (intptr_t) p->attr; /* cloudabi32_threadattr_t * */ *n_args = 1; break; } /* cloudabi_sys_thread_exit */ - case 53: { + case 50: { struct cloudabi_sys_thread_exit_args *p = params; uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */ iarg[1] = p->scope; /* cloudabi_scope_t */ @@ -494,7 +466,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_thread_yield */ - case 54: { + case 51: { *n_args = 0; break; } @@ -1224,64 +1196,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* cloudabi_sys_sock_bind */ + /* cloudabi32_sys_sock_recv */ case 45: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: - p = "cloudabi_fd_t"; - break; - case 2: - p = "userland const char *"; - break; - case 3: - p = "size_t"; - break; - default: - break; - }; - break; - /* cloudabi_sys_sock_connect */ - case 46: - switch(ndx) { - case 0: - p = "cloudabi_fd_t"; - break; - case 1: - p = "cloudabi_fd_t"; - break; - case 2: - p = "userland const char *"; - break; - case 3: - p = "size_t"; - break; - default: - break; - }; - break; - /* cloudabi_sys_sock_listen */ - case 47: - switch(ndx) { - case 0: - p = "cloudabi_fd_t"; - break; - case 1: - p = "cloudabi_backlog_t"; - break; - default: - break; - }; - break; - /* cloudabi32_sys_sock_recv */ - case 48: - switch(ndx) { - case 0: - p = "cloudabi_fd_t"; - break; - case 1: p = "userland const cloudabi32_recv_in_t *"; break; case 2: @@ -1292,7 +1213,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi32_sys_sock_send */ - case 49: + case 46: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1308,7 +1229,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_sock_shutdown */ - case 50: + case 47: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1321,7 +1242,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_sock_stat_get */ - case 51: + case 48: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1337,7 +1258,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi32_sys_thread_create */ - case 52: + case 49: switch(ndx) { case 0: p = "userland cloudabi32_threadattr_t *"; @@ -1347,7 +1268,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_thread_exit */ - case 53: + case 50: switch(ndx) { case 0: p = "userland cloudabi_lock_t *"; @@ -1360,7 +1281,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_thread_yield */ - case 54: + case 51: break; default: break; @@ -1595,53 +1516,38 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "cloudabi_fd_t"; break; - /* cloudabi_sys_sock_bind */ + /* cloudabi32_sys_sock_recv */ case 45: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_sock_connect */ + /* cloudabi32_sys_sock_send */ case 46: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_sock_listen */ + /* cloudabi_sys_sock_shutdown */ case 47: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi32_sys_sock_recv */ + /* cloudabi_sys_sock_stat_get */ case 48: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi32_sys_sock_send */ + /* cloudabi32_sys_thread_create */ case 49: if (ndx == 0 || ndx == 1) - p = "void"; - break; - /* cloudabi_sys_sock_shutdown */ - case 50: - if (ndx == 0 || ndx == 1) - p = "void"; - break; - /* cloudabi_sys_sock_stat_get */ - case 51: - if (ndx == 0 || ndx == 1) - p = "void"; - break; - /* cloudabi32_sys_thread_create */ - case 52: - if (ndx == 0 || ndx == 1) p = "cloudabi_tid_t"; break; /* cloudabi_sys_thread_exit */ - case 53: + case 50: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_thread_yield */ - case 54: + case 51: default: break; }; Modified: head/sys/compat/cloudabi64/cloudabi64_proto.h ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_proto.h Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi64/cloudabi64_proto.h Fri Aug 25 11:01:39 2017 (r322885) @@ -259,22 +259,6 @@ struct cloudabi_sys_sock_accept_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char unused_l_[PADL_(void *)]; void * unused; char unused_r_[PADR_(void *)]; }; -struct cloudabi_sys_sock_bind_args { - char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; - char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; - char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; - char path_len_l_[PADL_(size_t)]; size_t path_len; char path_len_r_[PADR_(size_t)]; -}; -struct cloudabi_sys_sock_connect_args { - char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; - char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; - char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; - char path_len_l_[PADL_(size_t)]; size_t path_len; char path_len_r_[PADR_(size_t)]; -}; -struct cloudabi_sys_sock_listen_args { - char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; - char backlog_l_[PADL_(cloudabi_backlog_t)]; cloudabi_backlog_t backlog; char backlog_r_[PADR_(cloudabi_backlog_t)]; -}; struct cloudabi64_sys_sock_recv_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char in_l_[PADL_(const cloudabi64_recv_in_t *)]; const cloudabi64_recv_in_t * in; char in_r_[PADR_(const cloudabi64_recv_in_t *)]; @@ -349,9 +333,6 @@ int cloudabi_sys_proc_fork(struct thread *, struct clo int cloudabi_sys_proc_raise(struct thread *, struct cloudabi_sys_proc_raise_args *); int cloudabi_sys_random_get(struct thread *, struct cloudabi_sys_random_get_args *); int cloudabi_sys_sock_accept(struct thread *, struct cloudabi_sys_sock_accept_args *); -int cloudabi_sys_sock_bind(struct thread *, struct cloudabi_sys_sock_bind_args *); -int cloudabi_sys_sock_connect(struct thread *, struct cloudabi_sys_sock_connect_args *); -int cloudabi_sys_sock_listen(struct thread *, struct cloudabi_sys_sock_listen_args *); int cloudabi64_sys_sock_recv(struct thread *, struct cloudabi64_sys_sock_recv_args *); int cloudabi64_sys_sock_send(struct thread *, struct cloudabi64_sys_sock_send_args *); int cloudabi_sys_sock_shutdown(struct thread *, struct cloudabi_sys_sock_shutdown_args *); @@ -440,9 +421,6 @@ int cloudabi_sys_thread_yield(struct thread *, struct #define CLOUDABI64_SYS_AUE_cloudabi_sys_proc_raise AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_random_get AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_sock_accept AUE_NULL -#define CLOUDABI64_SYS_AUE_cloudabi_sys_sock_bind AUE_NULL -#define CLOUDABI64_SYS_AUE_cloudabi_sys_sock_connect AUE_NULL -#define CLOUDABI64_SYS_AUE_cloudabi_sys_sock_listen AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_sock_recv AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_sock_send AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_sock_shutdown AUE_NULL Modified: head/sys/compat/cloudabi64/cloudabi64_syscall.h ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_syscall.h Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi64/cloudabi64_syscall.h Fri Aug 25 11:01:39 2017 (r322885) @@ -50,14 +50,11 @@ #define CLOUDABI64_SYS_cloudabi_sys_proc_raise 42 #define CLOUDABI64_SYS_cloudabi_sys_random_get 43 #define CLOUDABI64_SYS_cloudabi_sys_sock_accept 44 -#define CLOUDABI64_SYS_cloudabi_sys_sock_bind 45 -#define CLOUDABI64_SYS_cloudabi_sys_sock_connect 46 -#define CLOUDABI64_SYS_cloudabi_sys_sock_listen 47 -#define CLOUDABI64_SYS_cloudabi64_sys_sock_recv 48 -#define CLOUDABI64_SYS_cloudabi64_sys_sock_send 49 -#define CLOUDABI64_SYS_cloudabi_sys_sock_shutdown 50 -#define CLOUDABI64_SYS_cloudabi_sys_sock_stat_get 51 -#define CLOUDABI64_SYS_cloudabi64_sys_thread_create 52 -#define CLOUDABI64_SYS_cloudabi_sys_thread_exit 53 -#define CLOUDABI64_SYS_cloudabi_sys_thread_yield 54 -#define CLOUDABI64_SYS_MAXSYSCALL 55 +#define CLOUDABI64_SYS_cloudabi64_sys_sock_recv 45 +#define CLOUDABI64_SYS_cloudabi64_sys_sock_send 46 +#define CLOUDABI64_SYS_cloudabi_sys_sock_shutdown 47 +#define CLOUDABI64_SYS_cloudabi_sys_sock_stat_get 48 +#define CLOUDABI64_SYS_cloudabi64_sys_thread_create 49 +#define CLOUDABI64_SYS_cloudabi_sys_thread_exit 50 +#define CLOUDABI64_SYS_cloudabi_sys_thread_yield 51 +#define CLOUDABI64_SYS_MAXSYSCALL 52 Modified: head/sys/compat/cloudabi64/cloudabi64_syscalls.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_syscalls.c Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi64/cloudabi64_syscalls.c Fri Aug 25 11:01:39 2017 (r322885) @@ -51,14 +51,11 @@ const char *cloudabi64_syscallnames[] = { "cloudabi_sys_proc_raise", /* 42 = cloudabi_sys_proc_raise */ "cloudabi_sys_random_get", /* 43 = cloudabi_sys_random_get */ "cloudabi_sys_sock_accept", /* 44 = cloudabi_sys_sock_accept */ - "cloudabi_sys_sock_bind", /* 45 = cloudabi_sys_sock_bind */ - "cloudabi_sys_sock_connect", /* 46 = cloudabi_sys_sock_connect */ - "cloudabi_sys_sock_listen", /* 47 = cloudabi_sys_sock_listen */ - "cloudabi64_sys_sock_recv", /* 48 = cloudabi64_sys_sock_recv */ - "cloudabi64_sys_sock_send", /* 49 = cloudabi64_sys_sock_send */ - "cloudabi_sys_sock_shutdown", /* 50 = cloudabi_sys_sock_shutdown */ - "cloudabi_sys_sock_stat_get", /* 51 = cloudabi_sys_sock_stat_get */ - "cloudabi64_sys_thread_create", /* 52 = cloudabi64_sys_thread_create */ - "cloudabi_sys_thread_exit", /* 53 = cloudabi_sys_thread_exit */ - "cloudabi_sys_thread_yield", /* 54 = cloudabi_sys_thread_yield */ + "cloudabi64_sys_sock_recv", /* 45 = cloudabi64_sys_sock_recv */ + "cloudabi64_sys_sock_send", /* 46 = cloudabi64_sys_sock_send */ + "cloudabi_sys_sock_shutdown", /* 47 = cloudabi_sys_sock_shutdown */ + "cloudabi_sys_sock_stat_get", /* 48 = cloudabi_sys_sock_stat_get */ + "cloudabi64_sys_thread_create", /* 49 = cloudabi64_sys_thread_create */ + "cloudabi_sys_thread_exit", /* 50 = cloudabi_sys_thread_exit */ + "cloudabi_sys_thread_yield", /* 51 = cloudabi_sys_thread_yield */ }; Modified: head/sys/compat/cloudabi64/cloudabi64_sysent.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_sysent.c Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi64/cloudabi64_sysent.c Fri Aug 25 11:01:39 2017 (r322885) @@ -59,14 +59,11 @@ struct sysent cloudabi64_sysent[] = { { AS(cloudabi_sys_proc_raise_args), (sy_call_t *)cloudabi_sys_proc_raise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = cloudabi_sys_proc_raise */ { AS(cloudabi_sys_random_get_args), (sy_call_t *)cloudabi_sys_random_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = cloudabi_sys_random_get */ { AS(cloudabi_sys_sock_accept_args), (sy_call_t *)cloudabi_sys_sock_accept, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = cloudabi_sys_sock_accept */ - { AS(cloudabi_sys_sock_bind_args), (sy_call_t *)cloudabi_sys_sock_bind, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi_sys_sock_bind */ - { AS(cloudabi_sys_sock_connect_args), (sy_call_t *)cloudabi_sys_sock_connect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi_sys_sock_connect */ - { AS(cloudabi_sys_sock_listen_args), (sy_call_t *)cloudabi_sys_sock_listen, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_listen */ - { AS(cloudabi64_sys_sock_recv_args), (sy_call_t *)cloudabi64_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi64_sys_sock_recv */ - { AS(cloudabi64_sys_sock_send_args), (sy_call_t *)cloudabi64_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi64_sys_sock_send */ - { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi_sys_sock_shutdown */ - { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi_sys_sock_stat_get */ - { AS(cloudabi64_sys_thread_create_args), (sy_call_t *)cloudabi64_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 52 = cloudabi64_sys_thread_create */ - { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 53 = cloudabi_sys_thread_exit */ - { 0, (sy_call_t *)cloudabi_sys_thread_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 54 = cloudabi_sys_thread_yield */ + { AS(cloudabi64_sys_sock_recv_args), (sy_call_t *)cloudabi64_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi64_sys_sock_recv */ + { AS(cloudabi64_sys_sock_send_args), (sy_call_t *)cloudabi64_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi64_sys_sock_send */ + { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_shutdown */ + { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi_sys_sock_stat_get */ + { AS(cloudabi64_sys_thread_create_args), (sy_call_t *)cloudabi64_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi64_sys_thread_create */ + { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi_sys_thread_exit */ + { 0, (sy_call_t *)cloudabi_sys_thread_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi_sys_thread_yield */ }; Modified: head/sys/compat/cloudabi64/cloudabi64_systrace_args.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_systrace_args.c Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/compat/cloudabi64/cloudabi64_systrace_args.c Fri Aug 25 11:01:39 2017 (r322885) @@ -415,36 +415,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 2; break; } - /* cloudabi_sys_sock_bind */ - case 45: { - struct cloudabi_sys_sock_bind_args *p = params; - iarg[0] = p->sock; /* cloudabi_fd_t */ - iarg[1] = p->fd; /* cloudabi_fd_t */ - uarg[2] = (intptr_t) p->path; /* const char * */ - uarg[3] = p->path_len; /* size_t */ - *n_args = 4; - break; - } - /* cloudabi_sys_sock_connect */ - case 46: { - struct cloudabi_sys_sock_connect_args *p = params; - iarg[0] = p->sock; /* cloudabi_fd_t */ - iarg[1] = p->fd; /* cloudabi_fd_t */ - uarg[2] = (intptr_t) p->path; /* const char * */ - uarg[3] = p->path_len; /* size_t */ - *n_args = 4; - break; - } - /* cloudabi_sys_sock_listen */ - case 47: { - struct cloudabi_sys_sock_listen_args *p = params; - iarg[0] = p->sock; /* cloudabi_fd_t */ - iarg[1] = p->backlog; /* cloudabi_backlog_t */ - *n_args = 2; - break; - } /* cloudabi64_sys_sock_recv */ - case 48: { + case 45: { struct cloudabi64_sys_sock_recv_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi64_recv_in_t * */ @@ -453,7 +425,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi64_sys_sock_send */ - case 49: { + case 46: { struct cloudabi64_sys_sock_send_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->in; /* const cloudabi64_send_in_t * */ @@ -462,7 +434,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_sock_shutdown */ - case 50: { + case 47: { struct cloudabi_sys_sock_shutdown_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->how; /* cloudabi_sdflags_t */ @@ -470,7 +442,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_sock_stat_get */ - case 51: { + case 48: { struct cloudabi_sys_sock_stat_get_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */ @@ -479,14 +451,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi64_sys_thread_create */ - case 52: { + case 49: { struct cloudabi64_sys_thread_create_args *p = params; uarg[0] = (intptr_t) p->attr; /* cloudabi64_threadattr_t * */ *n_args = 1; break; } /* cloudabi_sys_thread_exit */ - case 53: { + case 50: { struct cloudabi_sys_thread_exit_args *p = params; uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */ iarg[1] = p->scope; /* cloudabi_scope_t */ @@ -494,7 +466,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg break; } /* cloudabi_sys_thread_yield */ - case 54: { + case 51: { *n_args = 0; break; } @@ -1224,64 +1196,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* cloudabi_sys_sock_bind */ + /* cloudabi64_sys_sock_recv */ case 45: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: - p = "cloudabi_fd_t"; - break; - case 2: - p = "userland const char *"; - break; - case 3: - p = "size_t"; - break; - default: - break; - }; - break; - /* cloudabi_sys_sock_connect */ - case 46: - switch(ndx) { - case 0: - p = "cloudabi_fd_t"; - break; - case 1: - p = "cloudabi_fd_t"; - break; - case 2: - p = "userland const char *"; - break; - case 3: - p = "size_t"; - break; - default: - break; - }; - break; - /* cloudabi_sys_sock_listen */ - case 47: - switch(ndx) { - case 0: - p = "cloudabi_fd_t"; - break; - case 1: - p = "cloudabi_backlog_t"; - break; - default: - break; - }; - break; - /* cloudabi64_sys_sock_recv */ - case 48: - switch(ndx) { - case 0: - p = "cloudabi_fd_t"; - break; - case 1: p = "userland const cloudabi64_recv_in_t *"; break; case 2: @@ -1292,7 +1213,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi64_sys_sock_send */ - case 49: + case 46: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1308,7 +1229,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_sock_shutdown */ - case 50: + case 47: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1321,7 +1242,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_sock_stat_get */ - case 51: + case 48: switch(ndx) { case 0: p = "cloudabi_fd_t"; @@ -1337,7 +1258,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi64_sys_thread_create */ - case 52: + case 49: switch(ndx) { case 0: p = "userland cloudabi64_threadattr_t *"; @@ -1347,7 +1268,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_thread_exit */ - case 53: + case 50: switch(ndx) { case 0: p = "userland cloudabi_lock_t *"; @@ -1360,7 +1281,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d }; break; /* cloudabi_sys_thread_yield */ - case 54: + case 51: break; default: break; @@ -1595,53 +1516,38 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "cloudabi_fd_t"; break; - /* cloudabi_sys_sock_bind */ + /* cloudabi64_sys_sock_recv */ case 45: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_sock_connect */ + /* cloudabi64_sys_sock_send */ case 46: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi_sys_sock_listen */ + /* cloudabi_sys_sock_shutdown */ case 47: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi64_sys_sock_recv */ + /* cloudabi_sys_sock_stat_get */ case 48: if (ndx == 0 || ndx == 1) p = "void"; break; - /* cloudabi64_sys_sock_send */ + /* cloudabi64_sys_thread_create */ case 49: if (ndx == 0 || ndx == 1) - p = "void"; - break; - /* cloudabi_sys_sock_shutdown */ - case 50: - if (ndx == 0 || ndx == 1) - p = "void"; - break; - /* cloudabi_sys_sock_stat_get */ - case 51: - if (ndx == 0 || ndx == 1) - p = "void"; - break; - /* cloudabi64_sys_thread_create */ - case 52: - if (ndx == 0 || ndx == 1) p = "cloudabi_tid_t"; break; /* cloudabi_sys_thread_exit */ - case 53: + case 50: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_thread_yield */ - case 54: + case 51: default: break; }; Modified: head/sys/contrib/cloudabi/cloudabi_types_common.h ============================================================================== --- head/sys/contrib/cloudabi/cloudabi_types_common.h Fri Aug 25 10:57:17 2017 (r322884) +++ head/sys/contrib/cloudabi/cloudabi_types_common.h Fri Aug 25 11:01:39 2017 (r322885) @@ -249,47 +249,42 @@ typedef uint16_t cloudabi_riflags_t; #define CLOUDABI_SOCK_RECV_WAITALL 0x0010 typedef uint64_t cloudabi_rights_t; -#define CLOUDABI_RIGHT_FD_DATASYNC 0x0000000000000001 -#define CLOUDABI_RIGHT_FD_READ 0x0000000000000002 -#define CLOUDABI_RIGHT_FD_SEEK 0x0000000000000004 -#define CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS 0x0000000000000008 -#define CLOUDABI_RIGHT_FD_SYNC 0x0000000000000010 -#define CLOUDABI_RIGHT_FD_TELL 0x0000000000000020 -#define CLOUDABI_RIGHT_FD_WRITE 0x0000000000000040 -#define CLOUDABI_RIGHT_FILE_ADVISE 0x0000000000000080 -#define CLOUDABI_RIGHT_FILE_ALLOCATE 0x0000000000000100 -#define CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY 0x0000000000000200 -#define CLOUDABI_RIGHT_FILE_CREATE_FILE 0x0000000000000400 -#define CLOUDABI_RIGHT_FILE_CREATE_FIFO 0x0000000000000800 -#define CLOUDABI_RIGHT_FILE_LINK_SOURCE 0x0000000000001000 -#define CLOUDABI_RIGHT_FILE_LINK_TARGET 0x0000000000002000 -#define CLOUDABI_RIGHT_FILE_OPEN 0x0000000000004000 -#define CLOUDABI_RIGHT_FILE_READDIR 0x0000000000008000 -#define CLOUDABI_RIGHT_FILE_READLINK 0x0000000000010000 -#define CLOUDABI_RIGHT_FILE_RENAME_SOURCE 0x0000000000020000 -#define CLOUDABI_RIGHT_FILE_RENAME_TARGET 0x0000000000040000 -#define CLOUDABI_RIGHT_FILE_STAT_FGET 0x0000000000080000 -#define CLOUDABI_RIGHT_FILE_STAT_FPUT_SIZE 0x0000000000100000 -#define CLOUDABI_RIGHT_FILE_STAT_FPUT_TIMES 0x0000000000200000 -#define CLOUDABI_RIGHT_FILE_STAT_GET 0x0000000000400000 -#define CLOUDABI_RIGHT_FILE_STAT_PUT_TIMES 0x0000000000800000 -#define CLOUDABI_RIGHT_FILE_SYMLINK 0x0000000001000000 -#define CLOUDABI_RIGHT_FILE_UNLINK 0x0000000002000000 -#define CLOUDABI_RIGHT_MEM_MAP 0x0000000004000000 -#define CLOUDABI_RIGHT_MEM_MAP_EXEC 0x0000000008000000 -#define CLOUDABI_RIGHT_POLL_FD_READWRITE 0x0000000010000000 -#define CLOUDABI_RIGHT_POLL_MODIFY 0x0000000020000000 -#define CLOUDABI_RIGHT_POLL_PROC_TERMINATE 0x0000000040000000 -#define CLOUDABI_RIGHT_POLL_WAIT 0x0000000080000000 -#define CLOUDABI_RIGHT_PROC_EXEC 0x0000000100000000 -#define CLOUDABI_RIGHT_SOCK_ACCEPT 0x0000000200000000 -#define CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY 0x0000000400000000 -#define CLOUDABI_RIGHT_SOCK_BIND_SOCKET 0x0000000800000000 -#define CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY 0x0000001000000000 -#define CLOUDABI_RIGHT_SOCK_CONNECT_SOCKET 0x0000002000000000 -#define CLOUDABI_RIGHT_SOCK_LISTEN 0x0000004000000000 -#define CLOUDABI_RIGHT_SOCK_SHUTDOWN 0x0000008000000000 -#define CLOUDABI_RIGHT_SOCK_STAT_GET 0x0000010000000000 +#define CLOUDABI_RIGHT_FD_DATASYNC 0x0000000000000001 +#define CLOUDABI_RIGHT_FD_READ 0x0000000000000002 +#define CLOUDABI_RIGHT_FD_SEEK 0x0000000000000004 +#define CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS 0x0000000000000008 +#define CLOUDABI_RIGHT_FD_SYNC 0x0000000000000010 +#define CLOUDABI_RIGHT_FD_TELL 0x0000000000000020 +#define CLOUDABI_RIGHT_FD_WRITE 0x0000000000000040 +#define CLOUDABI_RIGHT_FILE_ADVISE 0x0000000000000080 +#define CLOUDABI_RIGHT_FILE_ALLOCATE 0x0000000000000100 +#define CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY 0x0000000000000200 +#define CLOUDABI_RIGHT_FILE_CREATE_FILE 0x0000000000000400 +#define CLOUDABI_RIGHT_FILE_CREATE_FIFO 0x0000000000000800 +#define CLOUDABI_RIGHT_FILE_LINK_SOURCE 0x0000000000001000 +#define CLOUDABI_RIGHT_FILE_LINK_TARGET 0x0000000000002000 +#define CLOUDABI_RIGHT_FILE_OPEN 0x0000000000004000 +#define CLOUDABI_RIGHT_FILE_READDIR 0x0000000000008000 +#define CLOUDABI_RIGHT_FILE_READLINK 0x0000000000010000 +#define CLOUDABI_RIGHT_FILE_RENAME_SOURCE 0x0000000000020000 +#define CLOUDABI_RIGHT_FILE_RENAME_TARGET 0x0000000000040000 +#define CLOUDABI_RIGHT_FILE_STAT_FGET 0x0000000000080000 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Aug 25 11:24:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35FF7DD5AD7; Fri, 25 Aug 2017 11:24:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02C0D81DCB; Fri, 25 Aug 2017 11:24:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PBOkuw036487; Fri, 25 Aug 2017 11:24:46 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PBOksv036486; Fri, 25 Aug 2017 11:24:46 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708251124.v7PBOksv036486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 25 Aug 2017 11:24:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322886 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 11:24:47 -0000 Author: ae Date: Fri Aug 25 11:24:45 2017 New Revision: 322886 URL: https://svnweb.freebsd.org/changeset/base/322886 Log: Add melifaro@ to the calendar.freebsd Submitted by: melifaro Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 25 11:01:39 2017 (r322885) +++ head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 25 11:24:45 2017 (r322886) @@ -131,6 +131,7 @@ 03/30 Po-Chuan Hsieh born in Taipei, Taiwan, Republic of China, 1978 03/31 First quarter status reports are due on 04/15 04/01 Matthew Jacob born in San Francisco, California, United States, 1958 +04/01 Alexander V. Chernikov born in Moscow, Russian Federation, 1984 04/01 Bill Fenner born in Bellefonte, Pennsylvania, United States, 1971 04/01 Peter Edwards born in Dublin, Ireland, 1973 04/03 Hellmuth Michaelis born in Kiel, Schleswig-Holstein, Germany, 1958 From owner-svn-src-all@freebsd.org Fri Aug 25 12:16:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5ED3CDD7284; Fri, 25 Aug 2017 12:16:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AF988326F; Fri, 25 Aug 2017 12:16:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PCG4ES056782; Fri, 25 Aug 2017 12:16:04 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PCG4lC056780; Fri, 25 Aug 2017 12:16:04 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708251216.v7PCG4lC056780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 25 Aug 2017 12:16:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322887 - in stable/11: contrib/netbsd-tests/lib/libc/gen lib/libc/tests/gen X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11: contrib/netbsd-tests/lib/libc/gen lib/libc/tests/gen X-SVN-Commit-Revision: 322887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 12:16:05 -0000 Author: asomers Date: Fri Aug 25 12:16:03 2017 New Revision: 322887 URL: https://svnweb.freebsd.org/changeset/base/322887 Log: MFC r320737, r320914 r320737: Fix cleanup in lib/libc/gen/setdomainname_test ATF cleanup routines run in separate processes from the tests themselves, so they can't share global variables. Also, setdomainname_test needs to be is_exclusive because the test cases access a global resource. PR: 219967 Reviewed by: ngie Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11188 r320914: Remove an extraneous strlen from t_setdomainname.c Reported by: Coverity CID: 1377568 X-MFC-With: 320737 Sponsored by: Spectra Logic Corp Modified: stable/11/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c stable/11/lib/libc/tests/gen/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c ============================================================================== --- stable/11/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c Fri Aug 25 11:24:45 2017 (r322886) +++ stable/11/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c Fri Aug 25 12:16:03 2017 (r322887) @@ -34,11 +34,13 @@ __RCSID("$NetBSD: t_setdomainname.c,v 1.2 2012/03/25 0 #include #include +#include #include +#include #include #include -static char domain[MAXHOSTNAMELEN]; +#define DOMAIN_BACKUP_FILE "domain.bak" static const char domains[][MAXHOSTNAMELEN] = { "1234567890", @@ -47,6 +49,45 @@ static const char domains[][MAXHOSTNAMELEN] = { "--------------------------------------------------------------------" }; +static void +backup_domain(void) +{ + char domain[MAXHOSTNAMELEN]; + int fd; + size_t l; + ssize_t r,n = 0; + + memset(domain, 0, sizeof(domain)); + + ATF_REQUIRE_EQ(0, getdomainname(domain, sizeof(domain))); + l = strnlen(domain, MAXHOSTNAMELEN); + fd = open(DOMAIN_BACKUP_FILE, O_WRONLY | O_CREAT | O_EXCL, 0644); + ATF_REQUIRE(fd >= 0); + while ((r = write(fd, domain + n, l - n)) > 0) + n += r; + ATF_REQUIRE_EQ(0, r); + close(fd); +} + +static void +restore_domain(void) +{ + char domain[MAXHOSTNAMELEN]; + int fd; + ssize_t r, n = 0; + + memset(domain, 0, sizeof(domain)); + if ((fd = open(DOMAIN_BACKUP_FILE, O_RDONLY)) < 0) + err(1, "open"); + while ((r = read(fd, domain + n, sizeof(domain) - n)) > 0) + n += r; + if (r < 0) + err(1, "read"); + if (setdomainname(domain, n) != 0) + err(1, "setdomainname"); + close(fd); +} + ATF_TC_WITH_CLEANUP(setdomainname_basic); ATF_TC_HEAD(setdomainname_basic, tc) { @@ -59,6 +100,7 @@ ATF_TC_BODY(setdomainname_basic, tc) char name[MAXHOSTNAMELEN]; size_t i; + backup_domain(); for (i = 0; i < __arraycount(domains); i++) { (void)memset(name, 0, sizeof(name)); @@ -80,12 +122,11 @@ ATF_TC_BODY(setdomainname_basic, tc) ATF_REQUIRE(strcmp(domains[i], name) == 0); } - (void)setdomainname(domain, sizeof(domain)); } ATF_TC_CLEANUP(setdomainname_basic, tc) { - (void)setdomainname(domain, sizeof(domain)); + restore_domain(); } ATF_TC_WITH_CLEANUP(setdomainname_limit); @@ -100,6 +141,7 @@ ATF_TC_BODY(setdomainname_limit, tc) char name[MAXHOSTNAMELEN + 1]; (void)memset(name, 0, sizeof(name)); + backup_domain(); #ifdef __FreeBSD__ ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN - 1 ) == 0); @@ -110,10 +152,10 @@ ATF_TC_BODY(setdomainname_limit, tc) ATF_TC_CLEANUP(setdomainname_limit, tc) { - (void)setdomainname(domain, sizeof(domain)); + restore_domain(); } -ATF_TC_WITH_CLEANUP(setdomainname_perm); +ATF_TC(setdomainname_perm); ATF_TC_HEAD(setdomainname_perm, tc) { atf_tc_set_md_var(tc, "descr", "Can normal user set the domain name?"); @@ -122,24 +164,16 @@ ATF_TC_HEAD(setdomainname_perm, tc) ATF_TC_BODY(setdomainname_perm, tc) { + char domain[MAXHOSTNAMELEN]; - errno = 0; + memset(domain, 0, sizeof(domain)); + errno = 0; ATF_REQUIRE_ERRNO(EPERM, setdomainname(domain, sizeof(domain)) == -1); } -ATF_TC_CLEANUP(setdomainname_perm, tc) -{ - (void)setdomainname(domain, sizeof(domain)); -} - ATF_TP_ADD_TCS(tp) { - - (void)memset(domain, 0, sizeof(domain)); - - ATF_REQUIRE(getdomainname(domain, sizeof(domain)) == 0); - ATF_TP_ADD_TC(tp, setdomainname_basic); ATF_TP_ADD_TC(tp, setdomainname_limit); ATF_TP_ADD_TC(tp, setdomainname_perm); Modified: stable/11/lib/libc/tests/gen/Makefile ============================================================================== --- stable/11/lib/libc/tests/gen/Makefile Fri Aug 25 11:24:45 2017 (r322886) +++ stable/11/lib/libc/tests/gen/Makefile Fri Aug 25 12:16:03 2017 (r322887) @@ -71,6 +71,7 @@ CFLAGS+= -I${.CURDIR} SRCS.fmtcheck2_test= fmtcheck_test.c SRCS.fnmatch2_test= fnmatch_test.c +TEST_METADATA.setdomainname_test+= is_exclusive=true TESTS_SUBDIRS= execve TESTS_SUBDIRS+= posix_spawn From owner-svn-src-all@freebsd.org Fri Aug 25 12:28:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3668DD779E; Fri, 25 Aug 2017 12:28:35 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7369B8378D; Fri, 25 Aug 2017 12:28:35 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PCSYvV061203; Fri, 25 Aug 2017 12:28:34 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PCSYIN061202; Fri, 25 Aug 2017 12:28:34 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201708251228.v7PCSYIN061202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 25 Aug 2017 12:28:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322888 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: ed X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 12:28:35 -0000 Author: ed Date: Fri Aug 25 12:28:34 2017 New Revision: 322888 URL: https://svnweb.freebsd.org/changeset/base/322888 Log: Make entries for the United States more consistent. MFC after: 1 week Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 25 12:16:03 2017 (r322887) +++ head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 25 12:28:34 2017 (r322888) @@ -224,7 +224,7 @@ 06/04 Johannes Jost Meixner born in Wiesbaden, Germany, 1987 06/06 Sergei Kolobov born in Karpinsk, Russian Federation, 1972 06/06 Ryan Libby born in Kirkland, Washington, United States, 1985 -06/06 Alan Eldridge died in Denver, Colorado, 2003 +06/06 Alan Eldridge died in Denver, Colorado, United States, 2003 06/07 Jimmy Olgeni born in Milano, Italy, 1976 06/07 Benjamin Close born in Adelaide, Australia, 1978 06/07 Roger Pau Monne born in Reus, Catalunya, Spain, 1986 @@ -436,7 +436,7 @@ 12/18 Semen Ustimenko born in Novosibirsk, Russian Federation, 1979 12/19 Stephen Hurd born in Estevan, Saskatchewan, Canada, 1975 12/19 Emmanuel Vadot born in Decines-Charpieu, France, 1983 -12/20 Sean Bruno born in Monterey, California, USA, 1974 +12/20 Sean Bruno born in Monterey, California, United States, 1974 12/21 Rong-En Fan born in Taipei, Taiwan, Republic of China, 1982 12/22 Alan L. Cox born in Warren, Ohio, United States, 1964 12/22 Maxim Sobolev born in Dnepropetrovsk, Ukraine, 1976 From owner-svn-src-all@freebsd.org Fri Aug 25 14:18:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90401DD964D; Fri, 25 Aug 2017 14:18:59 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FDED2C0C; Fri, 25 Aug 2017 14:18:59 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1dlElW-0007Rj-Km; Fri, 25 Aug 2017 16:35:14 +0300 Date: Fri, 25 Aug 2017 16:35:14 +0300 From: Slawa Olhovchenkov To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322863 - head/sys/cam Message-ID: <20170825133514.GA9110@zxy.spb.ru> References: <201708242211.v7OMBAlc012582@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201708242211.v7OMBAlc012582@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 14:18:59 -0000 On Thu, Aug 24, 2017 at 10:11:10PM +0000, Warner Losh wrote: > Author: imp > Date: Thu Aug 24 22:11:10 2017 > New Revision: 322863 > URL: https://svnweb.freebsd.org/changeset/base/322863 > > Log: > Expand the latency tracking array from 1.024s to 8.192s to help track > extreme outliers from dodgy drives. Adjust comments to reflect this, > and make sure that the number of latency buckets match in the two > places where it matters. May be up to 1min? From owner-svn-src-all@freebsd.org Fri Aug 25 14:28:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72C92DD99D1; Fri, 25 Aug 2017 14:28:37 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E0BC31F1; Fri, 25 Aug 2017 14:28:37 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PESaXD010921; Fri, 25 Aug 2017 14:28:36 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PESao7010919; Fri, 25 Aug 2017 14:28:36 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708251428.v7PESao7010919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 25 Aug 2017 14:28:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322889 - in stable/11: share/man/man4 usr.bin/stdbuf X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11: share/man/man4 usr.bin/stdbuf X-SVN-Commit-Revision: 322889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 14:28:37 -0000 Author: asomers Date: Fri Aug 25 14:28:36 2017 New Revision: 322889 URL: https://svnweb.freebsd.org/changeset/base/322889 Log: MFC r320807: stdbuf(1): Add buffer definition "B" to the usage message This option has been missing from the usage message ever since the program was first imported. Submitted by: shivansh Reviewed by: asomers Sponsored by: Google, Inc (GSoC 2017) Differential Revision: https://reviews.freebsd.org/D11529 Modified: stable/11/share/man/man4/aio.4 stable/11/usr.bin/stdbuf/stdbuf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/aio.4 ============================================================================== --- stable/11/share/man/man4/aio.4 Fri Aug 25 12:28:34 2017 (r322888) +++ stable/11/share/man/man4/aio.4 Fri Aug 25 14:28:36 2017 (r322889) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 21, 2016 +.Dd June 22, 2017 .Dt AIO 4 .Os .Sh NAME @@ -161,11 +161,27 @@ field which can be used to request notification when a For .Dv SIGEV_KEVENT notifications, -the posted kevent will contain: +the +.Va sigevent +.Ap +s +.Va sigev_notify_kqueue +field should contain the descriptor of the kqueue that the event should be attached +to, its +.Va sigev_notify_kevent_flags +field may contain +.Dv EV_ONESHOT , +.Dv EV_CLEAR , and/or +.Dv EV_DISPATCH , and its +.Va sigev_notify +field should be set to +.Dv SIGEV_KEVENT . +The posted kevent will contain: .Bl -column ".Va filter" .It Sy Member Ta Sy Value .It Va ident Ta asynchronous I/O control buffer pointer .It Va filter Ta Dv EVFILT_AIO +.It Va flags Ta Dv EV_EOF .It Va udata Ta value stored in .Va aio_sigevent.sigev_value Modified: stable/11/usr.bin/stdbuf/stdbuf.c ============================================================================== --- stable/11/usr.bin/stdbuf/stdbuf.c Fri Aug 25 12:28:34 2017 (r322888) +++ stable/11/usr.bin/stdbuf/stdbuf.c Fri Aug 25 14:28:36 2017 (r322889) @@ -40,7 +40,7 @@ static void usage(int s) { - fprintf(stderr, "Usage: %s [-e 0|L|] [-i 0|L|] [-o 0|L|] " + fprintf(stderr, "Usage: %s [-e 0|L|B|] [-i 0|L|B|] [-o 0|L|B|] " " [args ...]\n", __progname); exit(s); } From owner-svn-src-all@freebsd.org Fri Aug 25 14:32:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 985CFDD9BC5; Fri, 25 Aug 2017 14:32:04 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31405342F; Fri, 25 Aug 2017 14:32:04 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PEW3OC014730; Fri, 25 Aug 2017 14:32:03 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PEW3ca014728; Fri, 25 Aug 2017 14:32:03 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708251432.v7PEW3ca014728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 25 Aug 2017 14:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322890 - stable/11/tests/sys/aio X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/tests/sys/aio X-SVN-Commit-Revision: 322890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 14:32:04 -0000 Author: asomers Date: Fri Aug 25 14:32:03 2017 New Revision: 322890 URL: https://svnweb.freebsd.org/changeset/base/322890 Log: MFC r320974-r320975, r321001, r321206 r320974: Use ATF cleanup routines in aio_test.c Remove aio_test's legacy timeout handling and cleanup routines. Instead, use ATF's builtin capabilities. ATF automatically cleans up newly created files, too, so we don't have to explicitly unlink them. The only tests than need a cleanup routine are the md(4) tests, which must destroy their md device. Reviewed by: jhb Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11468 r320975: Add tests for aio(4) completion notification via signals and threads Reviewed by: jhb Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11468 r321001: Fix the build with GCC after r320975 Reported by: pfg X-MFC-With: 320975 Sponsored by: Spectra Logic Corp r321206: Remove dead code that was killed by r320975 Reported by: Coverity CID: 1377977 X-MFC-With: 320975 Sponsored by: Spectra Logic Corp Modified: stable/11/tests/sys/aio/Makefile stable/11/tests/sys/aio/aio_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/aio/Makefile ============================================================================== --- stable/11/tests/sys/aio/Makefile Fri Aug 25 14:28:36 2017 (r322889) +++ stable/11/tests/sys/aio/Makefile Fri Aug 25 14:32:03 2017 (r322890) @@ -3,11 +3,12 @@ TESTSDIR= ${TESTSBASE}/sys/aio ATF_TESTS_C+= aio_test +TEST_METADATA.aio_test+= timeout="30" PLAIN_TESTS_C+= aio_kqueue_test PLAIN_TESTS_C+= lio_kqueue_test -LIBADD.aio_test+= util +LIBADD.aio_test+= util rt CFLAGS+= -I${.CURDIR:H:H} Modified: stable/11/tests/sys/aio/aio_test.c ============================================================================== --- stable/11/tests/sys/aio/aio_test.c Fri Aug 25 14:28:36 2017 (r322889) +++ stable/11/tests/sys/aio/aio_test.c Fri Aug 25 14:32:03 2017 (r322890) @@ -32,10 +32,11 @@ * size buffer with pseudo-random data, writing it to one fd using AIO, then * reading it from a second descriptor using AIO. For some targets, the same * fd is used for write and read (i.e., file, md device), but for others the - * operation is performed on a peer (pty, socket, fifo, etc). A timeout is - * initiated to detect undue blocking. This test does not attempt to exercise - * error cases or more subtle asynchronous behavior, just make sure that the - * basic operations work on some basic object types. + * operation is performed on a peer (pty, socket, fifo, etc). For each file + * descriptor type, several completion methods are tested. This test program + * does not attempt to exercise error cases or more subtle asynchronous + * behavior, just make sure that the basic operations work on some basic object + * types. */ #include @@ -51,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -85,42 +87,11 @@ struct aio_context { char ac_buffer[GLOBAL_MAX]; int ac_buflen; int ac_seconds; - void (*ac_cleanup)(void *arg); - void *ac_cleanup_arg; }; -static int aio_timedout; +static sem_t completions; -/* - * Each test run specifies a timeout in seconds. Use the somewhat obsoleted - * signal(3) and alarm(3) APIs to set this up. - */ -static void -aio_timeout_signal(int sig __unused) -{ - aio_timedout = 1; -} - -static void -aio_timeout_start(int seconds) -{ - - aio_timedout = 0; - ATF_REQUIRE_MSG(signal(SIGALRM, aio_timeout_signal) != SIG_ERR, - "failed to set SIGALRM handler: %s", strerror(errno)); - alarm(seconds); -} - -static void -aio_timeout_stop(void) -{ - - ATF_REQUIRE_MSG(signal(SIGALRM, NULL) != SIG_ERR, - "failed to reset SIGALRM handler to default: %s", strerror(errno)); - alarm(0); -} - /* * Fill a buffer given a seed that can be fed into srandom() to initialize * the PRNG in a repeatable manner. @@ -163,8 +134,7 @@ aio_test_buffer(char *buffer, int len, long seed) */ static void aio_context_init(struct aio_context *ac, int read_fd, - int write_fd, int buflen, int seconds, void (*cleanup)(void *), - void *cleanup_arg) + int write_fd, int buflen) { ATF_REQUIRE_MSG(buflen <= BUFFER_MAX, @@ -179,9 +149,6 @@ aio_context_init(struct aio_context *ac, int read_fd, aio_fill_buffer(ac->ac_buffer, buflen, ac->ac_seed); ATF_REQUIRE_MSG(aio_test_buffer(ac->ac_buffer, buflen, ac->ac_seed) != 0, "aio_test_buffer: internal error"); - ac->ac_seconds = seconds; - ac->ac_cleanup = cleanup; - ac->ac_cleanup_arg = cleanup_arg; } static ssize_t @@ -189,8 +156,33 @@ poll(struct aiocb *aio) { int error; - while ((error = aio_error(aio)) == EINPROGRESS && !aio_timedout) + while ((error = aio_error(aio)) == EINPROGRESS) usleep(25000); + if (error) + return (error); + else + return (aio_return(aio)); +} + +static void +sigusr1_handler(int sig __unused) +{ + ATF_REQUIRE_EQ(0, sem_post(&completions)); +} + +static void +thr_handler(union sigval sv __unused) +{ + ATF_REQUIRE_EQ(0, sem_post(&completions)); +} + +static ssize_t +poll_signaled(struct aiocb *aio) +{ + int error; + + ATF_REQUIRE_EQ(0, sem_wait(&completions)); + error = aio_error(aio); switch (error) { case EINPROGRESS: errno = EINTR; @@ -202,6 +194,40 @@ poll(struct aiocb *aio) } } +/* + * Setup a signal handler for signal delivery tests + * This isn't thread safe, but it's ok since ATF runs each testcase in a + * separate process + */ +static struct sigevent* +setup_signal(void) +{ + static struct sigevent sev; + + ATF_REQUIRE_EQ(0, sem_init(&completions, false, 0)); + sev.sigev_notify = SIGEV_SIGNAL; + sev.sigev_signo = SIGUSR1; + ATF_REQUIRE(SIG_ERR != signal(SIGUSR1, sigusr1_handler)); + return (&sev); +} + +/* + * Setup a thread for thread delivery tests + * This isn't thread safe, but it's ok since ATF runs each testcase in a + * separate process + */ +static struct sigevent* +setup_thread(void) +{ + static struct sigevent sev; + + ATF_REQUIRE_EQ(0, sem_init(&completions, false, 0)); + sev.sigev_notify = SIGEV_THREAD; + sev.sigev_notify_function = thr_handler; + sev.sigev_notify_attributes = NULL; + return (&sev); +} + static ssize_t suspend(struct aiocb *aio) { @@ -227,28 +253,11 @@ waitcomplete(struct aiocb *aio) } /* - * Each tester can register a callback to clean up in the event the test - * fails. Preserve the value of errno so that subsequent calls to errx() - * work properly. - */ -static void -aio_cleanup(struct aio_context *ac) -{ - int error; - - if (ac->ac_cleanup == NULL) - return; - error = errno; - (ac->ac_cleanup)(ac->ac_cleanup_arg); - errno = error; -} - -/* * Perform a simple write test of our initialized data buffer to the provided * file descriptor. */ static void -aio_write_test(struct aio_context *ac, completion comp) +aio_write_test(struct aio_context *ac, completion comp, struct sigevent *sev) { struct aiocb aio; ssize_t len; @@ -258,38 +267,18 @@ aio_write_test(struct aio_context *ac, completion comp aio.aio_nbytes = ac->ac_buflen; aio.aio_fildes = ac->ac_write_fd; aio.aio_offset = 0; + if (sev) + aio.aio_sigevent = *sev; - aio_timeout_start(ac->ac_seconds); - - if (aio_write(&aio) < 0) { - if (errno == EINTR) { - if (aio_timedout) { - aio_cleanup(ac); - atf_tc_fail("aio_write timed out"); - } - } - aio_cleanup(ac); + if (aio_write(&aio) < 0) atf_tc_fail("aio_write failed: %s", strerror(errno)); - } len = comp(&aio); - if (len < 0) { - if (errno == EINTR) { - if (aio_timedout) { - aio_cleanup(ac); - atf_tc_fail("aio timed out"); - } - } - aio_cleanup(ac); + if (len < 0) atf_tc_fail("aio failed: %s", strerror(errno)); - } - aio_timeout_stop(); - - if (len != ac->ac_buflen) { - aio_cleanup(ac); + if (len != ac->ac_buflen) atf_tc_fail("aio short write (%jd)", (intmax_t)len); - } } /* @@ -297,7 +286,7 @@ aio_write_test(struct aio_context *ac, completion comp * provided file descriptor. */ static void -aio_read_test(struct aio_context *ac, completion comp) +aio_read_test(struct aio_context *ac, completion comp, struct sigevent *sev) { struct aiocb aio; ssize_t len; @@ -308,44 +297,21 @@ aio_read_test(struct aio_context *ac, completion comp) aio.aio_nbytes = ac->ac_buflen; aio.aio_fildes = ac->ac_read_fd; aio.aio_offset = 0; + if (sev) + aio.aio_sigevent = *sev; - aio_timeout_start(ac->ac_seconds); - - if (aio_read(&aio) < 0) { - if (errno == EINTR) { - if (aio_timedout) { - aio_cleanup(ac); - atf_tc_fail("aio_read timed out"); - } - } - aio_cleanup(ac); + if (aio_read(&aio) < 0) atf_tc_fail("aio_read failed: %s", strerror(errno)); - } len = comp(&aio); - if (len < 0) { - if (errno == EINTR) { - if (aio_timedout) { - aio_cleanup(ac); - atf_tc_fail("aio timed out"); - } - } - aio_cleanup(ac); + if (len < 0) atf_tc_fail("aio failed: %s", strerror(errno)); - } - aio_timeout_stop(); + ATF_REQUIRE_EQ_MSG(len, ac->ac_buflen, + "aio short read (%jd)", (intmax_t)len); - if (len != ac->ac_buflen) { - aio_cleanup(ac); - atf_tc_fail("aio short read (%jd)", - (intmax_t)len); - } - - if (aio_test_buffer(ac->ac_buffer, ac->ac_buflen, ac->ac_seed) == 0) { - aio_cleanup(ac); + if (aio_test_buffer(ac->ac_buffer, ac->ac_buflen, ac->ac_seed) == 0) atf_tc_fail("buffer mismatched"); - } } /* @@ -360,25 +326,10 @@ aio_read_test(struct aio_context *ac, completion comp) */ #define FILE_LEN GLOBAL_MAX #define FILE_PATHNAME "testfile" -#define FILE_TIMEOUT 30 -struct aio_file_arg { - int afa_fd; -}; static void -aio_file_cleanup(void *arg) +aio_file_test(completion comp, struct sigevent *sev) { - struct aio_file_arg *afa; - - afa = arg; - close(afa->afa_fd); - unlink(FILE_PATHNAME); -} - -static void -aio_file_test(completion comp) -{ - struct aio_file_arg arg; struct aio_context ac; int fd; @@ -388,60 +339,49 @@ aio_file_test(completion comp) fd = open(FILE_PATHNAME, O_RDWR | O_CREAT); ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); - arg.afa_fd = fd; - - aio_context_init(&ac, fd, fd, FILE_LEN, - FILE_TIMEOUT, aio_file_cleanup, &arg); - aio_write_test(&ac, comp); - aio_read_test(&ac, comp); - - aio_file_cleanup(&arg); + aio_context_init(&ac, fd, fd, FILE_LEN); + aio_write_test(&ac, comp, sev); + aio_read_test(&ac, comp, sev); + close(fd); } ATF_TC_WITHOUT_HEAD(file_poll); ATF_TC_BODY(file_poll, tc) { - aio_file_test(poll); + aio_file_test(poll, NULL); } +ATF_TC_WITHOUT_HEAD(file_signal); +ATF_TC_BODY(file_signal, tc) +{ + aio_file_test(poll_signaled, setup_signal()); +} + ATF_TC_WITHOUT_HEAD(file_suspend); ATF_TC_BODY(file_suspend, tc) { - aio_file_test(suspend); + aio_file_test(suspend, NULL); } +ATF_TC_WITHOUT_HEAD(file_thread); +ATF_TC_BODY(file_thread, tc) +{ + aio_file_test(poll_signaled, setup_thread()); +} + ATF_TC_WITHOUT_HEAD(file_waitcomplete); ATF_TC_BODY(file_waitcomplete, tc) { - aio_file_test(waitcomplete); + aio_file_test(waitcomplete, NULL); } #define FIFO_LEN 256 #define FIFO_PATHNAME "testfifo" -#define FIFO_TIMEOUT 30 -struct aio_fifo_arg { - int afa_read_fd; - int afa_write_fd; -}; static void -aio_fifo_cleanup(void *arg) +aio_fifo_test(completion comp, struct sigevent *sev) { - struct aio_fifo_arg *afa; - - afa = arg; - if (afa->afa_read_fd != -1) - close(afa->afa_read_fd); - if (afa->afa_write_fd != -1) - close(afa->afa_write_fd); - unlink(FIFO_PATHNAME); -} - -static void -aio_fifo_test(completion comp) -{ int error, read_fd = -1, write_fd = -1; - struct aio_fifo_arg arg; struct aio_context ac; ATF_REQUIRE_KERNEL_MODULE("aio"); @@ -449,75 +389,65 @@ aio_fifo_test(completion comp) ATF_REQUIRE_MSG(mkfifo(FIFO_PATHNAME, 0600) != -1, "mkfifo failed: %s", strerror(errno)); - arg.afa_read_fd = -1; - arg.afa_write_fd = -1; read_fd = open(FIFO_PATHNAME, O_RDONLY | O_NONBLOCK); if (read_fd == -1) { error = errno; - aio_fifo_cleanup(&arg); errno = error; atf_tc_fail("read_fd open failed: %s", strerror(errno)); } - arg.afa_read_fd = read_fd; write_fd = open(FIFO_PATHNAME, O_WRONLY); if (write_fd == -1) { error = errno; - aio_fifo_cleanup(&arg); errno = error; atf_tc_fail("write_fd open failed: %s", strerror(errno)); } - arg.afa_write_fd = write_fd; - aio_context_init(&ac, read_fd, write_fd, FIFO_LEN, - FIFO_TIMEOUT, aio_fifo_cleanup, &arg); - aio_write_test(&ac, comp); - aio_read_test(&ac, comp); + aio_context_init(&ac, read_fd, write_fd, FIFO_LEN); + aio_write_test(&ac, comp, sev); + aio_read_test(&ac, comp, sev); - aio_fifo_cleanup(&arg); + close(read_fd); + close(write_fd); } ATF_TC_WITHOUT_HEAD(fifo_poll); ATF_TC_BODY(fifo_poll, tc) { - aio_fifo_test(poll); + aio_fifo_test(poll, NULL); } +ATF_TC_WITHOUT_HEAD(fifo_signal); +ATF_TC_BODY(fifo_signal, tc) +{ + aio_fifo_test(poll_signaled, setup_signal()); +} + ATF_TC_WITHOUT_HEAD(fifo_suspend); ATF_TC_BODY(fifo_suspend, tc) { - aio_fifo_test(waitcomplete); + aio_fifo_test(suspend, NULL); } -ATF_TC_WITHOUT_HEAD(fifo_waitcomplete); -ATF_TC_BODY(fifo_waitcomplete, tc) +ATF_TC_WITHOUT_HEAD(fifo_thread); +ATF_TC_BODY(fifo_thread, tc) { - aio_fifo_test(waitcomplete); + aio_fifo_test(poll_signaled, setup_thread()); } -struct aio_unix_socketpair_arg { - int asa_sockets[2]; -}; - -static void -aio_unix_socketpair_cleanup(void *arg) +ATF_TC_WITHOUT_HEAD(fifo_waitcomplete); +ATF_TC_BODY(fifo_waitcomplete, tc) { - struct aio_unix_socketpair_arg *asa; - - asa = arg; - close(asa->asa_sockets[0]); - close(asa->asa_sockets[1]); + aio_fifo_test(waitcomplete, NULL); } #define UNIX_SOCKETPAIR_LEN 256 -#define UNIX_SOCKETPAIR_TIMEOUT 30 static void -aio_unix_socketpair_test(completion comp) +aio_unix_socketpair_test(completion comp, struct sigevent *sev) { - struct aio_unix_socketpair_arg arg; struct aio_context ac; struct rusage ru_before, ru_after; int sockets[2]; @@ -527,42 +457,51 @@ aio_unix_socketpair_test(completion comp) ATF_REQUIRE_MSG(socketpair(PF_UNIX, SOCK_STREAM, 0, sockets) != -1, "socketpair failed: %s", strerror(errno)); - arg.asa_sockets[0] = sockets[0]; - arg.asa_sockets[1] = sockets[1]; - aio_context_init(&ac, sockets[0], - sockets[1], UNIX_SOCKETPAIR_LEN, UNIX_SOCKETPAIR_TIMEOUT, - aio_unix_socketpair_cleanup, &arg); + aio_context_init(&ac, sockets[0], sockets[1], UNIX_SOCKETPAIR_LEN); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_before) != -1, "getrusage failed: %s", strerror(errno)); - aio_write_test(&ac, comp); + aio_write_test(&ac, comp, sev); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, "getrusage failed: %s", strerror(errno)); ATF_REQUIRE(ru_after.ru_msgsnd == ru_before.ru_msgsnd + 1); ru_before = ru_after; - aio_read_test(&ac, comp); + aio_read_test(&ac, comp, sev); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, "getrusage failed: %s", strerror(errno)); ATF_REQUIRE(ru_after.ru_msgrcv == ru_before.ru_msgrcv + 1); - aio_unix_socketpair_cleanup(&arg); + close(sockets[0]); + close(sockets[1]); } ATF_TC_WITHOUT_HEAD(socket_poll); ATF_TC_BODY(socket_poll, tc) { - aio_unix_socketpair_test(poll); + aio_unix_socketpair_test(poll, NULL); } +ATF_TC_WITHOUT_HEAD(socket_signal); +ATF_TC_BODY(socket_signal, tc) +{ + aio_unix_socketpair_test(poll_signaled, setup_signal()); +} + ATF_TC_WITHOUT_HEAD(socket_suspend); ATF_TC_BODY(socket_suspend, tc) { - aio_unix_socketpair_test(suspend); + aio_unix_socketpair_test(suspend, NULL); } +ATF_TC_WITHOUT_HEAD(socket_thread); +ATF_TC_BODY(socket_thread, tc) +{ + aio_unix_socketpair_test(poll_signaled, setup_thread()); +} + ATF_TC_WITHOUT_HEAD(socket_waitcomplete); ATF_TC_BODY(socket_waitcomplete, tc) { - aio_unix_socketpair_test(waitcomplete); + aio_unix_socketpair_test(waitcomplete, NULL); } struct aio_pty_arg { @@ -570,22 +509,10 @@ struct aio_pty_arg { int apa_write_fd; }; -static void -aio_pty_cleanup(void *arg) -{ - struct aio_pty_arg *apa; - - apa = arg; - close(apa->apa_read_fd); - close(apa->apa_write_fd); -}; - #define PTY_LEN 256 -#define PTY_TIMEOUT 30 static void -aio_pty_test(completion comp) +aio_pty_test(completion comp, struct sigevent *sev) { - struct aio_pty_arg arg; struct aio_context ac; int read_fd, write_fd; struct termios ts; @@ -597,62 +524,60 @@ aio_pty_test(completion comp) ATF_REQUIRE_MSG(openpty(&read_fd, &write_fd, NULL, NULL, NULL) == 0, "openpty failed: %s", strerror(errno)); - arg.apa_read_fd = read_fd; - arg.apa_write_fd = write_fd; if (tcgetattr(write_fd, &ts) < 0) { error = errno; - aio_pty_cleanup(&arg); errno = error; atf_tc_fail("tcgetattr failed: %s", strerror(errno)); } cfmakeraw(&ts); if (tcsetattr(write_fd, TCSANOW, &ts) < 0) { error = errno; - aio_pty_cleanup(&arg); errno = error; atf_tc_fail("tcsetattr failed: %s", strerror(errno)); } - aio_context_init(&ac, read_fd, write_fd, PTY_LEN, - PTY_TIMEOUT, aio_pty_cleanup, &arg); + aio_context_init(&ac, read_fd, write_fd, PTY_LEN); - aio_write_test(&ac, comp); - aio_read_test(&ac, comp); + aio_write_test(&ac, comp, sev); + aio_read_test(&ac, comp, sev); - aio_pty_cleanup(&arg); + close(read_fd); + close(write_fd); } ATF_TC_WITHOUT_HEAD(pty_poll); ATF_TC_BODY(pty_poll, tc) { - aio_pty_test(poll); + aio_pty_test(poll, NULL); } +ATF_TC_WITHOUT_HEAD(pty_signal); +ATF_TC_BODY(pty_signal, tc) +{ + aio_pty_test(poll_signaled, setup_signal()); +} + ATF_TC_WITHOUT_HEAD(pty_suspend); ATF_TC_BODY(pty_suspend, tc) { - aio_pty_test(suspend); + aio_pty_test(suspend, NULL); } -ATF_TC_WITHOUT_HEAD(pty_waitcomplete); -ATF_TC_BODY(pty_waitcomplete, tc) +ATF_TC_WITHOUT_HEAD(pty_thread); +ATF_TC_BODY(pty_thread, tc) { - aio_pty_test(waitcomplete); + aio_pty_test(poll_signaled, setup_thread()); } -static void -aio_pipe_cleanup(void *arg) +ATF_TC_WITHOUT_HEAD(pty_waitcomplete); +ATF_TC_BODY(pty_waitcomplete, tc) { - int *pipes = arg; - - close(pipes[0]); - close(pipes[1]); + aio_pty_test(waitcomplete, NULL); } #define PIPE_LEN 256 -#define PIPE_TIMEOUT 30 static void -aio_pipe_test(completion comp) +aio_pipe_test(completion comp, struct sigevent *sev) { struct aio_context ac; int pipes[2]; @@ -663,76 +588,83 @@ aio_pipe_test(completion comp) ATF_REQUIRE_MSG(pipe(pipes) != -1, "pipe failed: %s", strerror(errno)); - aio_context_init(&ac, pipes[0], pipes[1], PIPE_LEN, - PIPE_TIMEOUT, aio_pipe_cleanup, pipes); - aio_write_test(&ac, comp); - aio_read_test(&ac, comp); + aio_context_init(&ac, pipes[0], pipes[1], PIPE_LEN); + aio_write_test(&ac, comp, sev); + aio_read_test(&ac, comp, sev); - aio_pipe_cleanup(pipes); + close(pipes[0]); + close(pipes[1]); } ATF_TC_WITHOUT_HEAD(pipe_poll); ATF_TC_BODY(pipe_poll, tc) { - aio_pipe_test(poll); + aio_pipe_test(poll, NULL); } +ATF_TC_WITHOUT_HEAD(pipe_signal); +ATF_TC_BODY(pipe_signal, tc) +{ + aio_pipe_test(poll_signaled, setup_signal()); +} + ATF_TC_WITHOUT_HEAD(pipe_suspend); ATF_TC_BODY(pipe_suspend, tc) { - aio_pipe_test(suspend); + aio_pipe_test(suspend, NULL); } +ATF_TC_WITHOUT_HEAD(pipe_thread); +ATF_TC_BODY(pipe_thread, tc) +{ + aio_pipe_test(poll_signaled, setup_thread()); +} + ATF_TC_WITHOUT_HEAD(pipe_waitcomplete); ATF_TC_BODY(pipe_waitcomplete, tc) { - aio_pipe_test(waitcomplete); + aio_pipe_test(waitcomplete, NULL); } -struct aio_md_arg { - int ama_mdctl_fd; - int ama_unit; - int ama_fd; -}; +#define MD_LEN GLOBAL_MAX +#define MDUNIT_LINK "mdunit_link" static void -aio_md_cleanup(void *arg) +aio_md_cleanup(void) { - struct aio_md_arg *ama; struct md_ioctl mdio; - int error; + int mdctl_fd, error, n, unit; + char buf[80]; - ama = arg; - - if (ama->ama_fd != -1) - close(ama->ama_fd); - - if (ama->ama_unit != -1) { - bzero(&mdio, sizeof(mdio)); - mdio.md_version = MDIOVERSION; - mdio.md_unit = ama->ama_unit; - if (ioctl(ama->ama_mdctl_fd, MDIOCDETACH, &mdio) == -1) { - error = errno; - close(ama->ama_mdctl_fd); - errno = error; - atf_tc_fail("ioctl MDIOCDETACH failed: %s", - strerror(errno)); + mdctl_fd = open("/dev/" MDCTL_NAME, O_RDWR, 0); + ATF_REQUIRE(mdctl_fd >= 0); + n = readlink(MDUNIT_LINK, buf, sizeof(buf)); + if (n > 0) { + if (sscanf(buf, "%d", &unit) == 1 && unit >= 0) { + bzero(&mdio, sizeof(mdio)); + mdio.md_version = MDIOVERSION; + mdio.md_unit = unit; + if (ioctl(mdctl_fd, MDIOCDETACH, &mdio) == -1) { + error = errno; + close(mdctl_fd); + errno = error; + atf_tc_fail("ioctl MDIOCDETACH failed: %s", + strerror(errno)); + } } } - - close(ama->ama_mdctl_fd); + + close(mdctl_fd); } -#define MD_LEN GLOBAL_MAX -#define MD_TIMEOUT 30 static void -aio_md_test(completion comp) +aio_md_test(completion comp, struct sigevent *sev) { int error, fd, mdctl_fd, unit; char pathname[PATH_MAX]; - struct aio_md_arg arg; struct aio_context ac; struct md_ioctl mdio; + char buf[80]; ATF_REQUIRE_KERNEL_MODULE("aio"); ATF_REQUIRE_UNSAFE_AIO(); @@ -748,32 +680,30 @@ aio_md_test(completion comp) mdio.md_mediasize = GLOBAL_MAX; mdio.md_sectorsize = 512; - arg.ama_mdctl_fd = mdctl_fd; - arg.ama_unit = -1; - arg.ama_fd = -1; if (ioctl(mdctl_fd, MDIOCATTACH, &mdio) < 0) { error = errno; - aio_md_cleanup(&arg); errno = error; atf_tc_fail("ioctl MDIOCATTACH failed: %s", strerror(errno)); } + close(mdctl_fd); - arg.ama_unit = unit = mdio.md_unit; + /* Store the md unit number in a symlink for future cleanup */ + unit = mdio.md_unit; + snprintf(buf, sizeof(buf), "%d", unit); + ATF_REQUIRE_EQ(0, symlink(buf, MDUNIT_LINK)); snprintf(pathname, PATH_MAX, "/dev/md%d", unit); fd = open(pathname, O_RDWR); ATF_REQUIRE_MSG(fd != -1, "opening %s failed: %s", pathname, strerror(errno)); - arg.ama_fd = fd; - aio_context_init(&ac, fd, fd, MD_LEN, MD_TIMEOUT, - aio_md_cleanup, &arg); - aio_write_test(&ac, comp); - aio_read_test(&ac, comp); - - aio_md_cleanup(&arg); + aio_context_init(&ac, fd, fd, MD_LEN); + aio_write_test(&ac, comp, sev); + aio_read_test(&ac, comp, sev); + + close(fd); } -ATF_TC(md_poll); +ATF_TC_WITH_CLEANUP(md_poll); ATF_TC_HEAD(md_poll, tc) { @@ -781,10 +711,29 @@ ATF_TC_HEAD(md_poll, tc) } ATF_TC_BODY(md_poll, tc) { - aio_md_test(poll); + aio_md_test(poll, NULL); } +ATF_TC_CLEANUP(md_poll, tc) +{ + aio_md_cleanup(); +} -ATF_TC(md_suspend); +ATF_TC_WITH_CLEANUP(md_signal); +ATF_TC_HEAD(md_signal, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(md_signal, tc) +{ + aio_md_test(poll_signaled, setup_signal()); +} +ATF_TC_CLEANUP(md_signal, tc) +{ + aio_md_cleanup(); +} + +ATF_TC_WITH_CLEANUP(md_suspend); ATF_TC_HEAD(md_suspend, tc) { @@ -792,10 +741,29 @@ ATF_TC_HEAD(md_suspend, tc) } ATF_TC_BODY(md_suspend, tc) { - aio_md_test(suspend); + aio_md_test(suspend, NULL); } +ATF_TC_CLEANUP(md_suspend, tc) +{ + aio_md_cleanup(); +} -ATF_TC(md_waitcomplete); +ATF_TC_WITH_CLEANUP(md_thread); +ATF_TC_HEAD(md_thread, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(md_thread, tc) +{ + aio_md_test(poll_signaled, setup_thread()); +} +ATF_TC_CLEANUP(md_thread, tc) +{ + aio_md_cleanup(); +} + +ATF_TC_WITH_CLEANUP(md_waitcomplete); ATF_TC_HEAD(md_waitcomplete, tc) { @@ -803,8 +771,12 @@ ATF_TC_HEAD(md_waitcomplete, tc) } ATF_TC_BODY(md_waitcomplete, tc) { - aio_md_test(waitcomplete); + aio_md_test(waitcomplete, NULL); } +ATF_TC_CLEANUP(md_waitcomplete, tc) +{ + aio_md_cleanup(); +} ATF_TC_WITHOUT_HEAD(aio_large_read_test); ATF_TC_BODY(aio_large_read_test, tc) @@ -1152,28 +1124,40 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, file_poll); + ATF_TP_ADD_TC(tp, file_signal); ATF_TP_ADD_TC(tp, file_suspend); + ATF_TP_ADD_TC(tp, file_thread); ATF_TP_ADD_TC(tp, file_waitcomplete); ATF_TP_ADD_TC(tp, fifo_poll); + ATF_TP_ADD_TC(tp, fifo_signal); ATF_TP_ADD_TC(tp, fifo_suspend); + ATF_TP_ADD_TC(tp, fifo_thread); ATF_TP_ADD_TC(tp, fifo_waitcomplete); ATF_TP_ADD_TC(tp, socket_poll); + ATF_TP_ADD_TC(tp, socket_signal); ATF_TP_ADD_TC(tp, socket_suspend); + ATF_TP_ADD_TC(tp, socket_thread); ATF_TP_ADD_TC(tp, socket_waitcomplete); ATF_TP_ADD_TC(tp, pty_poll); + ATF_TP_ADD_TC(tp, pty_signal); ATF_TP_ADD_TC(tp, pty_suspend); + ATF_TP_ADD_TC(tp, pty_thread); ATF_TP_ADD_TC(tp, pty_waitcomplete); ATF_TP_ADD_TC(tp, pipe_poll); + ATF_TP_ADD_TC(tp, pipe_signal); ATF_TP_ADD_TC(tp, pipe_suspend); + ATF_TP_ADD_TC(tp, pipe_thread); ATF_TP_ADD_TC(tp, pipe_waitcomplete); ATF_TP_ADD_TC(tp, md_poll); + ATF_TP_ADD_TC(tp, md_signal); ATF_TP_ADD_TC(tp, md_suspend); + ATF_TP_ADD_TC(tp, md_thread); ATF_TP_ADD_TC(tp, md_waitcomplete); + ATF_TP_ADD_TC(tp, aio_fsync_test); ATF_TP_ADD_TC(tp, aio_large_read_test); ATF_TP_ADD_TC(tp, aio_socket_two_reads); ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write); ATF_TP_ADD_TC(tp, aio_socket_short_write_cancel); - ATF_TP_ADD_TC(tp, aio_fsync_test); return (atf_no_error()); } From owner-svn-src-all@freebsd.org Fri Aug 25 14:32:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 507ADDD9C0A; Fri, 25 Aug 2017 14:32:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2DBE035C1; Fri, 25 Aug 2017 14:32:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 58C4E10AF07; Fri, 25 Aug 2017 10:32:08 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322824 - in head: lib/clang share/mk usr.bin/clang Date: Thu, 24 Aug 2017 13:32:37 -0700 Message-ID: <55772661.irLqry82cl@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201708232330.v7NNUPpV052276@repo.freebsd.org> References: <201708232330.v7NNUPpV052276@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 25 Aug 2017 10:32:08 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 14:32:16 -0000 On Wednesday, August 23, 2017 11:30:25 PM John Baldwin wrote: > Author: jhb > Date: Wed Aug 23 23:30:25 2017 > New Revision: 322824 > URL: https://svnweb.freebsd.org/changeset/base/322824 > > Log: > Improve the coverage of debug symbols for MK_DEBUG_FILES. > > - Include debug symbols in static libraries. This permits binaries > to include debug symbols for functions obtained from static libraries. > - Permit the C/C++ compiler flags added for MK_DEBUG_FILES to be > overridden by setting DEBUG_FILES_CFLAGS. Use this to limit the debug > information for llvm libraries and binaries. > > Reviewed by: emaste > Sponsored by: DARPA / AFRL > Differential Revision: https://reviews.freebsd.org/D12025 This does increase the size of installed worlds when MK_DEBUG_FILES=yes is enabled (which is the default). On amd64 and mips64 the libraries in /usr/lib and /usr/lib32 each increased by about 150MB to 300MB. The debug info for binaries in /usr/bin (which is stored in /usr/lib/debug/usr/bin) increased another 300MB or so for a total increase of ~900MB. Most of the increase was in llvm binaries (clang, lld, lldb), but the svnlite binaries also have more debug info since previously we were not geneating debug info for private libraries. Without the changes to use -gline-tables-only/-g1 for llvm libraries and binaries the amd64 world increased by almost 4GB with most of that increase in the debug info for clang, lldb, lld, and llvm-tablegen. One thing that might make this less painful in the future is being able to use compressed debug symbols. -- John Baldwin From owner-svn-src-all@freebsd.org Fri Aug 25 14:37:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 954F5DD9CC2; Fri, 25 Aug 2017 14:37:24 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71B9A3869; Fri, 25 Aug 2017 14:37:24 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PEbNQH014980; Fri, 25 Aug 2017 14:37:23 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PEbNQ3014978; Fri, 25 Aug 2017 14:37:23 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708251437.v7PEbNQ3014978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 25 Aug 2017 14:37:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322891 - stable/11/tests/sys/aio X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/tests/sys/aio X-SVN-Commit-Revision: 322891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 14:37:24 -0000 Author: asomers Date: Fri Aug 25 14:37:23 2017 New Revision: 322891 URL: https://svnweb.freebsd.org/changeset/base/322891 Log: MFC r321082: Add regression tests for bugs 220459 and 220398 Bug 220398 - lio_listio(2) never sends asynchronous notification if nent==0 Bug 220459 - lio_listio(2) doesn't support SIGEV_THREAD PR: 220459 PR: 220398 Reviewed by: cem, jhb Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11470 Added: stable/11/tests/sys/aio/lio_test.c - copied unchanged from r321082, head/tests/sys/aio/lio_test.c Modified: stable/11/tests/sys/aio/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/aio/Makefile ============================================================================== --- stable/11/tests/sys/aio/Makefile Fri Aug 25 14:32:03 2017 (r322890) +++ stable/11/tests/sys/aio/Makefile Fri Aug 25 14:37:23 2017 (r322891) @@ -3,12 +3,15 @@ TESTSDIR= ${TESTSBASE}/sys/aio ATF_TESTS_C+= aio_test +ATF_TESTS_C+= lio_test TEST_METADATA.aio_test+= timeout="30" +TEST_METADATA.lio_test+= timeout="10" PLAIN_TESTS_C+= aio_kqueue_test PLAIN_TESTS_C+= lio_kqueue_test LIBADD.aio_test+= util rt +LIBADD.lio_test+= rt CFLAGS+= -I${.CURDIR:H:H} Copied: stable/11/tests/sys/aio/lio_test.c (from r321082, head/tests/sys/aio/lio_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/aio/lio_test.c Fri Aug 25 14:37:23 2017 (r322891, copy of r321082, head/tests/sys/aio/lio_test.c) @@ -0,0 +1,145 @@ +/*- + * Copyright (c) 2017 Spectra Logic Corp + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include +#include + +#include + +#include "freebsd_test_suite/macros.h" + +static sem_t completions; + + +static void +handler(int sig __unused) +{ + ATF_REQUIRE_EQ(0, sem_post(&completions)); +} + +static void +thr_handler(union sigval sv __unused) +{ + ATF_REQUIRE_EQ(0, sem_post(&completions)); +} + +/* With LIO_WAIT, an empty lio_listio should return immediately */ +ATF_TC_WITHOUT_HEAD(lio_listio_empty_wait); +ATF_TC_BODY(lio_listio_empty_wait, tc) +{ + struct aiocb *list = NULL; + + ATF_REQUIRE_EQ(0, lio_listio(LIO_WAIT, &list, 0, NULL)); +} + +/* + * With LIO_NOWAIT, an empty lio_listio should send completion notification + * immediately + */ +ATF_TC_WITHOUT_HEAD(lio_listio_empty_nowait_kevent); +ATF_TC_BODY(lio_listio_empty_nowait_kevent, tc) +{ + struct aiocb *list = NULL; + struct sigevent sev; + struct kevent kq_returned; + int kq, result; + void *udata = (void*)0xdeadbeefdeadbeef; + + atf_tc_expect_timeout("Bug 220398 - lio_listio(2) never sends" + " asynchronous notification if nent==0"); + kq = kqueue(); + ATF_REQUIRE(kq > 0); + sev.sigev_notify = SIGEV_KEVENT; + sev.sigev_notify_kqueue = kq; + sev.sigev_value.sival_ptr = udata; + ATF_REQUIRE_EQ(0, lio_listio(LIO_NOWAIT, &list, 0, &sev)); + result = kevent(kq, NULL, 0, &kq_returned, 1, NULL); + ATF_REQUIRE_MSG(result == 1, "Never got completion notification"); + ATF_REQUIRE_EQ((uintptr_t)list, kq_returned.ident); + ATF_REQUIRE_EQ(EVFILT_LIO, kq_returned.filter); + ATF_REQUIRE_EQ(udata, kq_returned.udata); +} + +/* + * With LIO_NOWAIT, an empty lio_listio should send completion notification + * immediately + */ +ATF_TC_WITHOUT_HEAD(lio_listio_empty_nowait_signal); +ATF_TC_BODY(lio_listio_empty_nowait_signal, tc) +{ + struct aiocb *list = NULL; + struct sigevent sev; + + atf_tc_expect_timeout("Bug 220398 - lio_listio(2) never sends" + "asynchronous notification if nent==0"); + ATF_REQUIRE_EQ(0, sem_init(&completions, false, 0)); + sev.sigev_notify = SIGEV_SIGNAL; + sev.sigev_signo = SIGUSR1; + ATF_REQUIRE(SIG_ERR != signal(SIGUSR1, handler)); + ATF_REQUIRE_EQ(0, lio_listio(LIO_NOWAIT, &list, 0, &sev)); + ATF_REQUIRE_EQ(0, sem_wait(&completions)); + ATF_REQUIRE_EQ(0, sem_destroy(&completions)); +} + +/* + * With LIO_NOWAIT, an empty lio_listio should send completion notification + * immediately + */ +ATF_TC_WITHOUT_HEAD(lio_listio_empty_nowait_thread); +ATF_TC_BODY(lio_listio_empty_nowait_thread, tc) +{ + struct aiocb *list = NULL; + struct sigevent sev; + + atf_tc_expect_fail("Bug 220459 - lio_listio(2) doesn't support" + " SIGEV_THREAD"); + ATF_REQUIRE_EQ(0, sem_init(&completions, false, 0)); + bzero(&sev, sizeof(sev)); + sev.sigev_notify = SIGEV_THREAD; + sev.sigev_notify_function = thr_handler; + sev.sigev_notify_attributes = NULL; + ATF_REQUIRE_MSG(0 == lio_listio(LIO_NOWAIT, &list, 0, &sev), + "lio_listio: %s", strerror(errno)); + ATF_REQUIRE_EQ(0, sem_wait(&completions)); + ATF_REQUIRE_EQ(0, sem_destroy(&completions)); +} + + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_kevent); + ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_signal); + ATF_TP_ADD_TC(tp, lio_listio_empty_nowait_thread); + ATF_TP_ADD_TC(tp, lio_listio_empty_wait); + + return (atf_no_error()); +} From owner-svn-src-all@freebsd.org Fri Aug 25 14:37:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF776DD9CBD; Fri, 25 Aug 2017 14:37:23 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi0-f41.google.com (mail-oi0-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4A9B3868; Fri, 25 Aug 2017 14:37:23 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi0-f41.google.com with SMTP id r9so21939332oie.3; Fri, 25 Aug 2017 07:37:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=pS5TUcgcYhDUB31VwE94MgECbZYUnsi488v+FTt0DyE=; b=C1pzKebWAX4dMNGHymPtxNjGd63tP9jS9ErqcTgQncMpVZZttBp7BTVIU+KqrjaIjm ZnCrmr9gbuTWg5z2M9Twoyv10aibyg8hIDcT5pIX87/z4uNEv3YgMK83ImokgVQlJ23R 8Y5ET1rtyNgCuC29C2NQinEF3LDQTr35WjBjKG7UqgEhdu823MUBKJEVIujpobeefPfk KDVKr8TgMKr3dQ7OOFOfCjYKt7CCu7n/TMifza43xdYOH1wdEryZV1rjORxpT6xJhE6m Wi/fgkKSLpBQLFbENcIyVRTHsW65iaLAqZwqphTUN0eWUAWuivDZZ3+XtPGEDeAt5/jw h+vg== X-Gm-Message-State: AHYfb5jmf67C7glhhVOU2ig/cdRdzrgobYg3QuZrR0F0jMGHFDD9heYA 2Gb3ClLcDxWsz4iyUF0= X-Received: by 10.202.215.66 with SMTP id o63mr14240361oig.176.1503671841121; Fri, 25 Aug 2017 07:37:21 -0700 (PDT) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com. [209.85.214.41]) by smtp.gmail.com with ESMTPSA id z69sm9403940oig.32.2017.08.25.07.37.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Aug 2017 07:37:20 -0700 (PDT) Received: by mail-it0-f41.google.com with SMTP id f1so61352ith.0; Fri, 25 Aug 2017 07:37:20 -0700 (PDT) X-Received: by 10.36.14.216 with SMTP id 207mr2241290ite.151.1503671840683; Fri, 25 Aug 2017 07:37:20 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.81.131 with HTTP; Fri, 25 Aug 2017 07:37:20 -0700 (PDT) In-Reply-To: <6a5f32b3-a90e-21ef-dfdb-593573bc38e7@FreeBSD.org> References: <201708250315.v7P3FID8036183@repo.freebsd.org> <6a5f32b3-a90e-21ef-dfdb-593573bc38e7@FreeBSD.org> From: Conrad Meyer Date: Fri, 25 Aug 2017 07:37:20 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322872 - head/sys/dev/nvme To: Andriy Gapon Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 14:37:24 -0000 Yes, it should be 221616 ( https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221616 ). Best, Conrad On Thu, Aug 24, 2017 at 11:38 PM, Andriy Gapon wrote: > On 25/08/2017 06:15, Warner Losh wrote: >> Author: imp >> Date: Fri Aug 25 03:15:18 2017 >> New Revision: 322872 >> URL: https://svnweb.freebsd.org/changeset/base/322872 >> >> Log: >> Enable bus mastering on the device before resetting the device. The >> card has to do PCIe transactions to complete the reset process, but >> can't do them, per the PCIe spec, unless bus mastering is enabled. >> >> Submitted by: Kinjal Patel >> PR: 22166 > > The bug number seems to be incorrect. > >> Modified: >> head/sys/dev/nvme/nvme.c > > > > -- > Andriy Gapon > From owner-svn-src-all@freebsd.org Fri Aug 25 14:42:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0760DD9FB2; Fri, 25 Aug 2017 14:42:12 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9CF9C3E63; Fri, 25 Aug 2017 14:42:12 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PEgBNG017739; Fri, 25 Aug 2017 14:42:11 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PEgBvj017364; Fri, 25 Aug 2017 14:42:11 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708251442.v7PEgBvj017364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 25 Aug 2017 14:42:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322892 - in stable/11: lib/librt tests/sys/aio X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11: lib/librt tests/sys/aio X-SVN-Commit-Revision: 322892 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 14:42:12 -0000 Author: asomers Date: Fri Aug 25 14:42:11 2017 New Revision: 322892 URL: https://svnweb.freebsd.org/changeset/base/322892 Log: MFC r321332: Implement SIGEV_THREAD notifications for lio_listio(2) Our man pages have always indicated that this was supported, but in fact the feature was never implemented for lio_listio(2). Reviewed by: jhb, kib (earlier version) Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11680 Modified: stable/11/lib/librt/Symbol.map stable/11/lib/librt/aio.c stable/11/tests/sys/aio/lio_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/librt/Symbol.map ============================================================================== --- stable/11/lib/librt/Symbol.map Fri Aug 25 14:37:23 2017 (r322891) +++ stable/11/lib/librt/Symbol.map Fri Aug 25 14:42:11 2017 (r322892) @@ -26,6 +26,7 @@ FBSD_1.0 { }; FBSD_1.5 { + lio_listio; mq_getfd_np; timer_oshandle_np; }; Modified: stable/11/lib/librt/aio.c ============================================================================== --- stable/11/lib/librt/aio.c Fri Aug 25 14:37:23 2017 (r322891) +++ stable/11/lib/librt/aio.c Fri Aug 25 14:42:11 2017 (r322892) @@ -49,6 +49,7 @@ __weak_reference(__aio_waitcomplete, _aio_waitcomplete __weak_reference(__aio_waitcomplete, aio_waitcomplete); __weak_reference(__aio_fsync, _aio_fsync); __weak_reference(__aio_fsync, aio_fsync); +__weak_reference(__lio_listio, lio_listio); typedef void (*aio_func)(union sigval val, struct aiocb *iocb); @@ -58,6 +59,8 @@ extern ssize_t __sys_aio_waitcomplete(struct aiocb **i extern ssize_t __sys_aio_return(struct aiocb *iocb); extern int __sys_aio_error(struct aiocb *iocb); extern int __sys_aio_fsync(int op, struct aiocb *iocb); +extern int __sys_lio_listio(int mode, struct aiocb * const list[], int nent, + struct sigevent *sig); static void aio_dispatch(struct sigev_node *sn) @@ -68,8 +71,8 @@ aio_dispatch(struct sigev_node *sn) } static int -aio_sigev_alloc(struct aiocb *iocb, struct sigev_node **sn, - struct sigevent *saved_ev) +aio_sigev_alloc(sigev_id_t id, struct sigevent *sigevent, + struct sigev_node **sn, struct sigevent *saved_ev) { if (__sigev_check_init()) { /* This might be that thread library is not enabled. */ @@ -77,15 +80,15 @@ aio_sigev_alloc(struct aiocb *iocb, struct sigev_node return (-1); } - *sn = __sigev_alloc(SI_ASYNCIO, &iocb->aio_sigevent, NULL, 1); + *sn = __sigev_alloc(SI_ASYNCIO, sigevent, NULL, 1); if (*sn == NULL) { errno = EAGAIN; return (-1); } - *saved_ev = iocb->aio_sigevent; - (*sn)->sn_id = (sigev_id_t)iocb; - __sigev_get_sigevent(*sn, &iocb->aio_sigevent, (*sn)->sn_id); + *saved_ev = *sigevent; + (*sn)->sn_id = id; + __sigev_get_sigevent(*sn, sigevent, (*sn)->sn_id); (*sn)->sn_dispatch = aio_dispatch; __sigev_list_lock(); @@ -107,7 +110,8 @@ aio_io(struct aiocb *iocb, int (*sysfunc)(struct aiocb return (ret); } - ret = aio_sigev_alloc(iocb, &sn, &saved_ev); + ret = aio_sigev_alloc((sigev_id_t)iocb, &iocb->aio_sigevent, &sn, + &saved_ev); if (ret) return (ret); ret = sysfunc(iocb); @@ -188,11 +192,38 @@ __aio_fsync(int op, struct aiocb *iocb) if (iocb->aio_sigevent.sigev_notify != SIGEV_THREAD) return __sys_aio_fsync(op, iocb); - ret = aio_sigev_alloc(iocb, &sn, &saved_ev); + ret = aio_sigev_alloc((sigev_id_t)iocb, &iocb->aio_sigevent, &sn, + &saved_ev); if (ret) return (ret); ret = __sys_aio_fsync(op, iocb); iocb->aio_sigevent = saved_ev; + if (ret != 0) { + err = errno; + __sigev_list_lock(); + __sigev_delete_node(sn); + __sigev_list_unlock(); + errno = err; + } + return (ret); +} + +int +__lio_listio(int mode, struct aiocb * const list[], int nent, + struct sigevent *sig) +{ + struct sigev_node *sn; + struct sigevent saved_ev; + int ret, err; + + if (sig == NULL || sig->sigev_notify != SIGEV_THREAD) + return (__sys_lio_listio(mode, list, nent, sig)); + + ret = aio_sigev_alloc((sigev_id_t)list, sig, &sn, &saved_ev); + if (ret) + return (ret); + ret = __sys_lio_listio(mode, list, nent, sig); + *sig = saved_ev; if (ret != 0) { err = errno; __sigev_list_lock(); Modified: stable/11/tests/sys/aio/lio_test.c ============================================================================== --- stable/11/tests/sys/aio/lio_test.c Fri Aug 25 14:37:23 2017 (r322891) +++ stable/11/tests/sys/aio/lio_test.c Fri Aug 25 14:42:11 2017 (r322892) @@ -119,8 +119,8 @@ ATF_TC_BODY(lio_listio_empty_nowait_thread, tc) struct aiocb *list = NULL; struct sigevent sev; - atf_tc_expect_fail("Bug 220459 - lio_listio(2) doesn't support" - " SIGEV_THREAD"); + atf_tc_expect_timeout("Bug 220398 - lio_listio(2) never sends" + "asynchronous notification if nent==0"); ATF_REQUIRE_EQ(0, sem_init(&completions, false, 0)); bzero(&sev, sizeof(sev)); sev.sigev_notify = SIGEV_THREAD; From owner-svn-src-all@freebsd.org Fri Aug 25 15:31:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61A6BDDB005; Fri, 25 Aug 2017 15:31:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D6DE648F7; Fri, 25 Aug 2017 15:31:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PFVuNO038247; Fri, 25 Aug 2017 15:31:56 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PFVtoZ038242; Fri, 25 Aug 2017 15:31:55 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708251531.v7PFVtoZ038242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 25 Aug 2017 15:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322893 - head/bin/dd X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/bin/dd X-SVN-Commit-Revision: 322893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 15:31:57 -0000 Author: asomers Date: Fri Aug 25 15:31:55 2017 New Revision: 322893 URL: https://svnweb.freebsd.org/changeset/base/322893 Log: dd(1): Incorrect casting of arguments dd(1) casts many of its numeric arguments from uintmax_t to intmax_t and back again to detect whether or not the original arguments were negative. This is not correct, and causes problems with boundary cases, for example when count is SSIZE_MAX-1. PR: 191263 Submitted by: will@worrbase.com Reviewed by: pi, asomers MFC after: 3 weeks Modified: head/bin/dd/args.c head/bin/dd/conv.c head/bin/dd/dd.c head/bin/dd/dd.h head/bin/dd/position.c Modified: head/bin/dd/args.c ============================================================================== --- head/bin/dd/args.c Fri Aug 25 14:42:11 2017 (r322892) +++ head/bin/dd/args.c Fri Aug 25 15:31:55 2017 (r322893) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -184,7 +185,7 @@ f_bs(char *arg) res = get_num(arg); if (res < 1 || res > SSIZE_MAX) - errx(1, "bs must be between 1 and %jd", (intmax_t)SSIZE_MAX); + errx(1, "bs must be between 1 and %zd", SSIZE_MAX); in.dbsz = out.dbsz = (size_t)res; } @@ -195,22 +196,22 @@ f_cbs(char *arg) res = get_num(arg); if (res < 1 || res > SSIZE_MAX) - errx(1, "cbs must be between 1 and %jd", (intmax_t)SSIZE_MAX); + errx(1, "cbs must be between 1 and %zd", SSIZE_MAX); cbsz = (size_t)res; } static void f_count(char *arg) { - intmax_t res; + uintmax_t res; - res = (intmax_t)get_num(arg); - if (res < 0) - errx(1, "count cannot be negative"); + res = get_num(arg); + if (res == UINTMAX_MAX) + errc(1, ERANGE, "%s", oper); if (res == 0) - cpy_cnt = (uintmax_t)-1; + cpy_cnt = UINTMAX_MAX; else - cpy_cnt = (uintmax_t)res; + cpy_cnt = res; } static void @@ -219,7 +220,7 @@ f_files(char *arg) files_cnt = get_num(arg); if (files_cnt < 1) - errx(1, "files must be between 1 and %jd", (uintmax_t)-1); + errx(1, "files must be between 1 and %zu", SIZE_MAX); } static void @@ -240,8 +241,8 @@ f_ibs(char *arg) if (!(ddflags & C_BS)) { res = get_num(arg); if (res < 1 || res > SSIZE_MAX) - errx(1, "ibs must be between 1 and %jd", - (intmax_t)SSIZE_MAX); + errx(1, "ibs must be between 1 and %zd", + SSIZE_MAX); in.dbsz = (size_t)res; } } @@ -261,8 +262,8 @@ f_obs(char *arg) if (!(ddflags & C_BS)) { res = get_num(arg); if (res < 1 || res > SSIZE_MAX) - errx(1, "obs must be between 1 and %jd", - (intmax_t)SSIZE_MAX); + errx(1, "obs must be between 1 and %zd", + SSIZE_MAX); out.dbsz = (size_t)res; } } Modified: head/bin/dd/conv.c ============================================================================== --- head/bin/dd/conv.c Fri Aug 25 14:42:11 2017 (r322892) +++ head/bin/dd/conv.c Fri Aug 25 15:31:55 2017 (r322893) @@ -133,7 +133,7 @@ block(void) */ ch = 0; for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) { - maxlen = MIN(cbsz, in.dbcnt); + maxlen = MIN(cbsz, (size_t)in.dbcnt); if ((t = ctab) != NULL) for (cnt = 0; cnt < maxlen && (ch = *inp++) != '\n'; ++cnt) @@ -146,7 +146,7 @@ block(void) * Check for short record without a newline. Reassemble the * input block. */ - if (ch != '\n' && in.dbcnt < cbsz) { + if (ch != '\n' && (size_t)in.dbcnt < cbsz) { (void)memmove(in.db, in.dbp - in.dbcnt, in.dbcnt); break; } @@ -228,7 +228,7 @@ unblock(void) * translation has to already be done or we might not recognize the * spaces. */ - for (inp = in.db; in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { + for (inp = in.db; (size_t)in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { for (t = inp + cbsz - 1; t >= inp && *t == ' '; --t) ; if (t >= inp) { Modified: head/bin/dd/dd.c ============================================================================== --- head/bin/dd/dd.c Fri Aug 25 14:42:11 2017 (r322892) +++ head/bin/dd/dd.c Fri Aug 25 15:31:55 2017 (r322893) @@ -204,10 +204,10 @@ setup(void) * record oriented I/O, only need a single buffer. */ if (!(ddflags & (C_BLOCK | C_UNBLOCK))) { - if ((in.db = malloc(out.dbsz + in.dbsz - 1)) == NULL) + if ((in.db = malloc((size_t)out.dbsz + in.dbsz - 1)) == NULL) err(1, "input buffer"); out.db = in.db; - } else if ((in.db = malloc(MAX(in.dbsz, cbsz) + cbsz)) == NULL || + } else if ((in.db = malloc(MAX((size_t)in.dbsz, cbsz) + cbsz)) == NULL || (out.db = malloc(out.dbsz + cbsz)) == NULL) err(1, "output buffer"); @@ -405,7 +405,7 @@ dd_in(void) ++st.in_full; /* Handle full input blocks. */ - } else if ((size_t)n == in.dbsz) { + } else if ((size_t)n == (size_t)in.dbsz) { in.dbcnt += in.dbrcnt = n; ++st.in_full; @@ -562,7 +562,7 @@ dd_out(int force) outp += nw; st.bytes += nw; - if ((size_t)nw == n && n == out.dbsz) + if ((size_t)nw == n && n == (size_t)out.dbsz) ++st.out_full; else ++st.out_part; Modified: head/bin/dd/dd.h ============================================================================== --- head/bin/dd/dd.h Fri Aug 25 14:42:11 2017 (r322892) +++ head/bin/dd/dd.h Fri Aug 25 15:31:55 2017 (r322893) @@ -38,10 +38,9 @@ typedef struct { u_char *db; /* buffer address */ u_char *dbp; /* current buffer I/O address */ - /* XXX ssize_t? */ - size_t dbcnt; /* current buffer byte count */ - size_t dbrcnt; /* last read byte count */ - size_t dbsz; /* block size */ + ssize_t dbcnt; /* current buffer byte count */ + ssize_t dbrcnt; /* last read byte count */ + ssize_t dbsz; /* block size */ #define ISCHR 0x01 /* character device (warn on short) */ #define ISPIPE 0x02 /* pipe-like (see position.c) */ Modified: head/bin/dd/position.c ============================================================================== --- head/bin/dd/position.c Fri Aug 25 14:42:11 2017 (r322892) +++ head/bin/dd/position.c Fri Aug 25 15:31:55 2017 (r322893) @@ -207,7 +207,7 @@ pos_out(void) n = write(out.fd, out.db, out.dbsz); if (n == -1) err(1, "%s", out.name); - if ((size_t)n != out.dbsz) + if (n != out.dbsz) errx(1, "%s: write failure", out.name); } break; From owner-svn-src-all@freebsd.org Fri Aug 25 15:33:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2BD9DDB0B5 for ; Fri, 25 Aug 2017 15:33:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A758F64BD5 for ; Fri, 25 Aug 2017 15:33:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22c.google.com with SMTP id d81so424515ioj.4 for ; Fri, 25 Aug 2017 08:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=OpLCwuun7XhTtykrkMUD7+TySvKiVlZfX3w9lVxWqYM=; b=gyAM04ViWzXsYZgle6/zxElUb18AqtGbrsskm0g6PSJ4lyUkloXoZq1QGgZpshbBhw Ru+ucmShrBqLR7Ja17rzXVTrGSFavwAzptF5neaWeHuDzuKcRh1nkzIIjg7ku9t/sRGB 9dbLLhh2hp+cHPJjgvH+heRMe2zQXxxqLHstiwbjJ70jacQHQQWUcOJACgDERAqlZ7dW 6BWZjdY7JXxeGwPqg+VRmYTWq/9BE8E+jGt/fi+Hcs8HlWajZtBV6Ui0aYw74UqCGWnP XNfmCR8ODpFiHzpDLTNxR9tB0MEYmqYHPb59ihWivJtGQAR72uuc4EVeULr6nTH8aVE6 ej9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=OpLCwuun7XhTtykrkMUD7+TySvKiVlZfX3w9lVxWqYM=; b=YsXwlAmjQMaFOv4mXUqkSZ49T+x/jQjdzStw1yeeaD3T20ibEaj+IqrOHis6xsHnMU 9QxhIjQuYWjJDyyKMXjpTgUkWXkAgfpPELCEr450YRexhjDbmvQYNWaNYxJsd5CeJgoA DKiHhjg15DuevVHhsED75T9DpZXmKADcIgxJxiFTUVo0vsttKD5h8uUU9AA0zC3wFMBB 2nn3SNE0GGrFHdz7JV2dCjlFPMWSN0PDUYlsLnQ88ElrooJKY9bltUZ6FQjZrdI96WXB g41+XJ7iekw4/ofrWNM7O4J2531AnKJPaUpKXvKhiaSTaQGqOAeOr/U+dIUeIHL1brvX 2e0w== X-Gm-Message-State: AHYfb5japj05FN5+vbA79C95Ul1d0LwgjnhZjJQHQLh98Er1uNWkQQ75 yV5+manwXjaFCh5hLpQbDGOXOY24hIOQ X-Received: by 10.107.131.219 with SMTP id n88mr8422310ioi.277.1503675216055; Fri, 25 Aug 2017 08:33:36 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Fri, 25 Aug 2017 08:33:35 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:c525:dd46:ae7:666a] In-Reply-To: <20170825133514.GA9110@zxy.spb.ru> References: <201708242211.v7OMBAlc012582@repo.freebsd.org> <20170825133514.GA9110@zxy.spb.ru> From: Warner Losh Date: Fri, 25 Aug 2017 09:33:35 -0600 X-Google-Sender-Auth: WEKr287hH-ZVi84qbMSZvcplTSA Message-ID: Subject: Re: svn commit: r322863 - head/sys/cam To: Slawa Olhovchenkov Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 15:33:37 -0000 On Fri, Aug 25, 2017 at 7:35 AM, Slawa Olhovchenkov wrote: > On Thu, Aug 24, 2017 at 10:11:10PM +0000, Warner Losh wrote: > > > Author: imp > > Date: Thu Aug 24 22:11:10 2017 > > New Revision: 322863 > > URL: https://svnweb.freebsd.org/changeset/base/322863 > > > > Log: > > Expand the latency tracking array from 1.024s to 8.192s to help track > > extreme outliers from dodgy drives. Adjust comments to reflect this, > > and make sure that the number of latency buckets match in the two > > places where it matters. > > May be up to 1min? > I'm not sure what additional data you'll get between "totally sucks, at least 8s latency" and "totally sucks, at least 32s." or "totally sucks, at least 64s" though the latter isn't possible with the default timeouts... I'm planning on adding a 'max' latency that's self-resetting instead of expanding the bucket upwards. I'm also contemplating expanding it down to 100us or even 10us since nda serves nvme drives which easily can be sub 100us. Warner From owner-svn-src-all@freebsd.org Fri Aug 25 15:38:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1830DDB2C9 for ; Fri, 25 Aug 2017 15:38:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x231.google.com (mail-io0-x231.google.com [IPv6:2607:f8b0:4001:c06::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8572964EF1 for ; Fri, 25 Aug 2017 15:38:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x231.google.com with SMTP id s101so622667ioe.0 for ; Fri, 25 Aug 2017 08:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=QhitrVPRxNWwtnqgmU2UhIgNQ+GMlTvPPZzoE2FqFu0=; b=DvYRXKF1CDWhZs7TNl4pQF368N4DL4Gbp3LFflA8dslXdYxf98TjOPDTOmpiTQ4jes TUdRZOjBxfOUlm9uvdOB6MBVx8+Vaykvm8A82csn/tzZwW1ktaxDdcYFLVPWV7eEbeK1 hoclBOyQsEwmyP65y0iuqDcxOu6GHwuZ4HQ4fdylp30o4Przz1FIMCUQ6FmtwtvGRdF5 FZqX8CxiOs5puJRGa4AKdg0q6IRJKMuZ91X7IzAtI99VpXDO21njuLNODN06Q0H7cya5 rngl0Jyj03gJDR28fPbzODxeAUujpNMb+0MtcaFszEuqBSPNHFMorvSEaWDHeZLf0Z5r ugXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=QhitrVPRxNWwtnqgmU2UhIgNQ+GMlTvPPZzoE2FqFu0=; b=CMZJf41AXcS/PTLErowt47+ZhSm/XP2JVOXpsxWm6MRWgjknCBOg70M2+ubvdieuob 3X1ipqBYAtgvLFWqZ1Z1Htf/70DSPw6vOiTx0xyZpw10BFrowMj58cKunskmTrTMDhsb ZjNd+mznTwch4Ozher8WlpjY7X999zlIvq0Bdf6NMonJgG2ASWd5+yCIAmbc56rG60im EN0MA0O+Rf2A6zViokDxy5bExmWiDwRF9RvRihUkIeOsI9nXDeN4NuBzLey+8dAYgBNr Io1DjTDBShhoNGzPBekP6cPEmoash50q1XUdPYNcKpFw2OLuXi3fpUWYoQNL3MmH8PK9 Zy8g== X-Gm-Message-State: AHYfb5hQ/ZCrhuWvMb2IRVg1S4e4T0akYpWCC7bu3rWnDbiSLIKCMhMw K+pPqTAG91EGORyTxn+eEWD3u3+UIhdl X-Received: by 10.107.161.7 with SMTP id k7mr5469483ioe.189.1503675527837; Fri, 25 Aug 2017 08:38:47 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Fri, 25 Aug 2017 08:38:47 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:c525:dd46:ae7:666a] In-Reply-To: References: <201708250315.v7P3FID8036183@repo.freebsd.org> <6a5f32b3-a90e-21ef-dfdb-593573bc38e7@FreeBSD.org> From: Warner Losh Date: Fri, 25 Aug 2017 09:38:47 -0600 X-Google-Sender-Auth: 1FLgn7jwfGY55gLHCfBjjVs5JbA Message-ID: Subject: Re: svn commit: r322872 - head/sys/dev/nvme To: "Conrad E. Meyer" Cc: Andriy Gapon , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 15:38:48 -0000 On Fri, Aug 25, 2017 at 8:37 AM, Conrad Meyer wrote: > Yes, it should be 221616 ( > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221616 ). > It was a transcription error. I'd already added the commit message to 221616. I'll close it when I MFC it. Warner > Best, > Conrad > > On Thu, Aug 24, 2017 at 11:38 PM, Andriy Gapon wrote: > > On 25/08/2017 06:15, Warner Losh wrote: > >> Author: imp > >> Date: Fri Aug 25 03:15:18 2017 > >> New Revision: 322872 > >> URL: https://svnweb.freebsd.org/changeset/base/322872 > >> > >> Log: > >> Enable bus mastering on the device before resetting the device. The > >> card has to do PCIe transactions to complete the reset process, but > >> can't do them, per the PCIe spec, unless bus mastering is enabled. > >> > >> Submitted by: Kinjal Patel > >> PR: 22166 > > > > The bug number seems to be incorrect. > > > >> Modified: > >> head/sys/dev/nvme/nvme.c > > > > > > > > -- > > Andriy Gapon > > > > From owner-svn-src-all@freebsd.org Fri Aug 25 15:46:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94976DDB5AA; Fri, 25 Aug 2017 15:46:30 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 494ED6542F; Fri, 25 Aug 2017 15:46:30 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1dlGoV-0008Cf-0Y; Fri, 25 Aug 2017 18:46:27 +0300 Date: Fri, 25 Aug 2017 18:46:26 +0300 From: Slawa Olhovchenkov To: Warner Losh Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322863 - head/sys/cam Message-ID: <20170825154626.GK9097@zxy.spb.ru> References: <201708242211.v7OMBAlc012582@repo.freebsd.org> <20170825133514.GA9110@zxy.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 15:46:30 -0000 On Fri, Aug 25, 2017 at 09:33:35AM -0600, Warner Losh wrote: > On Fri, Aug 25, 2017 at 7:35 AM, Slawa Olhovchenkov wrote: > > > On Thu, Aug 24, 2017 at 10:11:10PM +0000, Warner Losh wrote: > > > > > Author: imp > > > Date: Thu Aug 24 22:11:10 2017 > > > New Revision: 322863 > > > URL: https://svnweb.freebsd.org/changeset/base/322863 > > > > > > Log: > > > Expand the latency tracking array from 1.024s to 8.192s to help track > > > extreme outliers from dodgy drives. Adjust comments to reflect this, > > > and make sure that the number of latency buckets match in the two > > > places where it matters. > > > > May be up to 1min? > > > > I'm not sure what additional data you'll get between "totally sucks, at > least 8s latency" and "totally sucks, at least 32s." or "totally sucks, at > least 64s" though the latter isn't possible with the default timeouts... > > I'm planning on adding a 'max' latency that's self-resetting instead of > expanding the bucket upwards. I'm also contemplating expanding it down to > 100us or even 10us since nda serves nvme drives which easily can be sub > 100us. This is just stat data? Don't produce error messages about timeout commands and etc? From owner-svn-src-all@freebsd.org Fri Aug 25 15:47:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96C84DDB620 for ; Fri, 25 Aug 2017 15:47:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5AE636559D for ; Fri, 25 Aug 2017 15:47:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x234.google.com with SMTP id n5so1010878itb.1 for ; Fri, 25 Aug 2017 08:47:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=9sEQRn4N+eOQd3gz3T21FtdfVQriECvlprpkX+P8Sno=; b=Zh9I2tpTLeDed4UU6aPy8lE36DanywADnEwwD19g7cp0Bx6uuQhExrBf1qlqZdNvF5 8nxac469LNg0qyvhy45eUpfdgAFxINui3NWkbWFpLNVM1S5y3rVGSUj5POdoplFPJdfV uTDEyhTWcMSgQ/VOlQsWIANn1N81EMoP6yOGS1C3e2/vBl7L1k997rhnw6gFivIM4SUK FeHAXXErpa174AbPpt2c55pU5o8epwQc1pVJezR3Ngl2Wf/n0Q8aeA+3gCqOq7rm0Opb f8HmzwN5UNqggw4hfRUmWwaz+/JiTkkZdhuvSX8U8sxog+DDNneTNBD7zK+8mauR98Z0 shKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=9sEQRn4N+eOQd3gz3T21FtdfVQriECvlprpkX+P8Sno=; b=ETwrqBv5FF01CKL1NlNzHJtRShUAh84PiYNcnHEdnclPti+tUyTq5YhI9p/wP/YQEh hZBUALD8aFkzNbT+NIWT2MeOPBPqEH16PyGu5qaFVyh2F5DIwvixaTCNYdvsDwyVcvIi pqyi2Pz3btJaN52Z1L6lGYQQquTO6pzswY+iyo/GCFmUQRye4/4fOf+j8oI/pxkTapSe MwUxt8aYUeFUhChYDKJpJRirQD2gACEN7t330sM9YuGMTlxfOfWEh9nkqkoMtAB0yoHC 9oK3OMQNbs7dbYILbk6xlTpt9QPLu7xvSp5HtO60j+6MyGyBB1GqZWl5KHsnpFmobX29 tGmw== X-Gm-Message-State: AHYfb5iZ21A3Ijcpe6lJYyfQlYlJPC+w1DUK/CpWsBYZEYQ5LDz7fHva RwnlI7X+LKo4gwezd04lCFbgsvDdscAr X-Received: by 10.36.159.194 with SMTP id c185mr2254656ite.31.1503676052791; Fri, 25 Aug 2017 08:47:32 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Fri, 25 Aug 2017 08:47:32 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:c525:dd46:ae7:666a] In-Reply-To: <20170825154626.GK9097@zxy.spb.ru> References: <201708242211.v7OMBAlc012582@repo.freebsd.org> <20170825133514.GA9110@zxy.spb.ru> <20170825154626.GK9097@zxy.spb.ru> From: Warner Losh Date: Fri, 25 Aug 2017 09:47:32 -0600 X-Google-Sender-Auth: 4W4H6abTuAG0NMtFhlTydC54P9o Message-ID: Subject: Re: svn commit: r322863 - head/sys/cam To: Slawa Olhovchenkov Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 15:47:33 -0000 On Fri, Aug 25, 2017 at 9:46 AM, Slawa Olhovchenkov wrote: > On Fri, Aug 25, 2017 at 09:33:35AM -0600, Warner Losh wrote: > > > On Fri, Aug 25, 2017 at 7:35 AM, Slawa Olhovchenkov > wrote: > > > > > On Thu, Aug 24, 2017 at 10:11:10PM +0000, Warner Losh wrote: > > > > > > > Author: imp > > > > Date: Thu Aug 24 22:11:10 2017 > > > > New Revision: 322863 > > > > URL: https://svnweb.freebsd.org/changeset/base/322863 > > > > > > > > Log: > > > > Expand the latency tracking array from 1.024s to 8.192s to help > track > > > > extreme outliers from dodgy drives. Adjust comments to reflect > this, > > > > and make sure that the number of latency buckets match in the two > > > > places where it matters. > > > > > > May be up to 1min? > > > > > > > I'm not sure what additional data you'll get between "totally sucks, at > > least 8s latency" and "totally sucks, at least 32s." or "totally sucks, > at > > least 64s" though the latter isn't possible with the default timeouts... > > > > I'm planning on adding a 'max' latency that's self-resetting instead of > > expanding the bucket upwards. I'm also contemplating expanding it down to > > 100us or even 10us since nda serves nvme drives which easily can be sub > > 100us. > > This is just stat data? > Don't produce error messages about timeout commands and etc? > This is 100% stats. There's no error messages produced. Warner From owner-svn-src-all@freebsd.org Fri Aug 25 16:10:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCDBEDDBE57; Fri, 25 Aug 2017 16:10:17 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9770F66015; Fri, 25 Aug 2017 16:10:17 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PGAGMn051555; Fri, 25 Aug 2017 16:10:16 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PGAGJ9051554; Fri, 25 Aug 2017 16:10:16 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201708251610.v7PGAGJ9051554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Fri, 25 Aug 2017 16:10:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322894 - head/usr.sbin/makefs X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/usr.sbin/makefs X-SVN-Commit-Revision: 322894 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 16:10:17 -0000 Author: benno Date: Fri Aug 25 16:10:16 2017 New Revision: 322894 URL: https://svnweb.freebsd.org/changeset/base/322894 Log: Replace makefs' hand-rolled unescaping with strunvis mtree path names and link attributes are encoded, generally using strvis. Newer versions of mtree will use C-style escapes but previously the accepted form was octal escapes. makefs' mtree code spots the C-style escapes but fails to deal with octal escapes correctly. Remove mtree's escape-decoding code (except for a few instances where it's needed) and instead pass pathnames and link targets through strunvis prior to use. Reviewed by: marcel MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12104 Modified: head/usr.sbin/makefs/mtree.c Modified: head/usr.sbin/makefs/mtree.c ============================================================================== --- head/usr.sbin/makefs/mtree.c Fri Aug 25 15:31:55 2017 (r322893) +++ head/usr.sbin/makefs/mtree.c Fri Aug 25 16:10:16 2017 (r322894) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "makefs.h" @@ -355,8 +356,6 @@ read_word(FILE *fp, char *buf, size_t bufsz) break; case '\\': esc++; - if (esc == 1) - continue; break; case '`': case '\'': @@ -401,34 +400,10 @@ read_word(FILE *fp, char *buf, size_t bufsz) fi->line++; } break; - case 'a': + default: if (esc) - c = '\a'; + buf[idx++] = '\\'; break; - case 'b': - if (esc) - c = '\b'; - break; - case 'f': - if (esc) - c = '\f'; - break; - case 'n': - if (esc) - c = '\n'; - break; - case 'r': - if (esc) - c = '\r'; - break; - case 't': - if (esc) - c = '\t'; - break; - case 'v': - if (esc) - c = '\v'; - break; } buf[idx++] = c; esc = 0; @@ -591,7 +566,15 @@ read_mtree_keywords(FILE *fp, fsnode *node) error = ENOATTR; break; } - node->symlink = estrdup(value); + node->symlink = emalloc(strlen(value) + 1); + if (node->symlink == NULL) { + error = errno; + break; + } + if (strunvis(node->symlink, value) < 0) { + error = errno; + break; + } } else error = ENOSYS; break; @@ -971,13 +954,18 @@ read_mtree_spec1(FILE *fp, bool def, const char *name) static int read_mtree_spec(FILE *fp) { - char pathspec[PATH_MAX]; + char pathspec[PATH_MAX], pathtmp[4*PATH_MAX + 1]; char *cp; int error; - error = read_word(fp, pathspec, sizeof(pathspec)); + error = read_word(fp, pathtmp, sizeof(pathtmp)); if (error) goto out; + if (strnunvis(pathspec, PATH_MAX, pathtmp) == -1) { + error = errno; + goto out; + } + error = 0; cp = strchr(pathspec, '/'); if (cp != NULL) { From owner-svn-src-all@freebsd.org Fri Aug 25 16:38:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C9D8DDC395; Fri, 25 Aug 2017 16:38:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DBA7066BA1; Fri, 25 Aug 2017 16:38:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PGcLsk063463; Fri, 25 Aug 2017 16:38:21 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PGcLR0063459; Fri, 25 Aug 2017 16:38:21 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708251638.v7PGcLR0063459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 25 Aug 2017 16:38:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322895 - in head/lib/libc: gen tests/gen X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/lib/libc: gen tests/gen X-SVN-Commit-Revision: 322895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 16:38:23 -0000 Author: cem Date: Fri Aug 25 16:38:21 2017 New Revision: 322895 URL: https://svnweb.freebsd.org/changeset/base/322895 Log: getmntinfo(3): Scale faster, and return sooner getmntinfo(3) is designed around a relatively static or slow growing set of current mounts. It tried to detect a race with somewhat concurrent mount and re-call getfsstat(2) in that case, looping indefinitely. It also allocated space for a single extra mount as slop. In the case where the user has a large number of mounts and is adding them at a rapid pace, it fell over. This patch makes two functional changes: 1. Allocate even more slop. Double whatever the last getfsstat(2) returned. 2. Abort and return some known results after looping a few times (arbitrarily, 3). If the list is constantly changing, we can't guarantee we return a full result to the user at any point anyways. While here, add very basic functional tests for getmntinfo(3) to the libc suite. PR: 221743 Submitted by: Peter Eriksson (earlier version) Sponsored by: Dell EMC Isilon Added: head/lib/libc/tests/gen/getmntinfo_test.c (contents, props changed) Modified: head/lib/libc/gen/getmntinfo.c head/lib/libc/tests/gen/Makefile Modified: head/lib/libc/gen/getmntinfo.c ============================================================================== --- head/lib/libc/gen/getmntinfo.c Fri Aug 25 16:10:16 2017 (r322894) +++ head/lib/libc/gen/getmntinfo.c Fri Aug 25 16:38:21 2017 (r322895) @@ -38,6 +38,9 @@ __FBSDID("$FreeBSD$"); #include #include +#define MAX_TRIES 3 +#define SCALING_FACTOR 2 + /* * Return information about mounted filesystems. */ @@ -47,20 +50,21 @@ getmntinfo(struct statfs **mntbufp, int mode) static struct statfs *mntbuf; static int mntsize; static long bufsize; + unsigned tries = 0; if (mntsize <= 0 && (mntsize = getfsstat(0, 0, MNT_NOWAIT)) < 0) return (0); if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, mode)) < 0) return (0); - while (bufsize <= mntsize * sizeof(struct statfs)) { - if (mntbuf) - free(mntbuf); - bufsize = (mntsize + 1) * sizeof(struct statfs); - if ((mntbuf = malloc(bufsize)) == NULL) + while (tries++ < MAX_TRIES && bufsize <= mntsize * sizeof(*mntbuf)) { + bufsize = (mntsize * SCALING_FACTOR) * sizeof(*mntbuf); + if ((mntbuf = reallocf(mntbuf, bufsize)) == NULL) return (0); if ((mntsize = getfsstat(mntbuf, bufsize, mode)) < 0) return (0); } *mntbufp = mntbuf; + if (mntsize > (bufsize / sizeof(*mntbuf))) + return (bufsize / sizeof(*mntbuf)); return (mntsize); } Modified: head/lib/libc/tests/gen/Makefile ============================================================================== --- head/lib/libc/tests/gen/Makefile Fri Aug 25 16:10:16 2017 (r322894) +++ head/lib/libc/tests/gen/Makefile Fri Aug 25 16:38:21 2017 (r322895) @@ -8,6 +8,7 @@ ATF_TESTS_C+= fmtmsg_test ATF_TESTS_C+= fnmatch2_test ATF_TESTS_C+= fpclassify2_test ATF_TESTS_C+= ftw_test +ATF_TESTS_C+= getmntinfo_test ATF_TESTS_C+= glob2_test ATF_TESTS_C+= popen_test ATF_TESTS_C+= posix_spawn_test Added: head/lib/libc/tests/gen/getmntinfo_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/tests/gen/getmntinfo_test.c Fri Aug 25 16:38:21 2017 (r322895) @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 2017 Conrad Meyer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Limited test program for getmntinfo(3), a non-standard BSDism. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +#include + +static void +check_mntinfo(struct statfs *mntinfo, int n) +{ + int i; + + for (i = 0; i < n; i++) { + ATF_REQUIRE_MSG(mntinfo[i].f_version == STATFS_VERSION, "%ju", + (uintmax_t)mntinfo[i].f_version); + ATF_REQUIRE(mntinfo[i].f_namemax <= sizeof(mntinfo[0].f_mntonname)); + } +} + +ATF_TC_WITHOUT_HEAD(getmntinfo_test); +ATF_TC_BODY(getmntinfo_test, tc) +{ + int nmnts; + struct statfs *mntinfo; + + /* Test bogus mode */ + nmnts = getmntinfo(&mntinfo, 199); + ATF_REQUIRE_MSG(nmnts == 0 && errno == EINVAL, + "getmntinfo() succeeded; errno=%d", errno); + + /* Valid modes */ + nmnts = getmntinfo(&mntinfo, MNT_NOWAIT); + ATF_REQUIRE_MSG(nmnts != 0, "getmntinfo(MNT_NOWAIT) failed; errno=%d", + errno); + + check_mntinfo(mntinfo, nmnts); + memset(mntinfo, 0xdf, sizeof(*mntinfo) * nmnts); + + nmnts = getmntinfo(&mntinfo, MNT_WAIT); + ATF_REQUIRE_MSG(nmnts != 0, "getmntinfo(MNT_WAIT) failed; errno=%d", + errno); + + check_mntinfo(mntinfo, nmnts); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, getmntinfo_test); + + return (atf_no_error()); +} From owner-svn-src-all@freebsd.org Fri Aug 25 16:59:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58195DDC944; Fri, 25 Aug 2017 16:59:47 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi0-f46.google.com (mail-oi0-f46.google.com [209.85.218.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 25F6E6746A; Fri, 25 Aug 2017 16:59:46 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi0-f46.google.com with SMTP id t88so3587713oij.0; Fri, 25 Aug 2017 09:59:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=JYFhYqx7M+lzb87tucfkmAzJ096mIIgo3MQDZuIQSAs=; b=Og4lgCSLDtHmsxu+Dfj6cK1dYekheADkm+p91/noSHkBPN+GmTznGpmeO2jG+uHsf0 OV8hc8WsS7XqJfsVoXVgOPXhMKTxD76UABOHA4NnX5JRbD2lE2eJjspCzNyGntcCpkEO oCg89+XVc6drBO6jxq1ojN/nd1GDUIbtXZ+42NYMpIPo3C766IhGk9B8D8ISkhoL+xUA 1BSgw9c5DXuiDJcaBjahafY2OI7EtDoIgdl2ZPmMEEc/xoIXKqF4Wea7cj4G/JNE8eur NlAgw6ivNb4pXrVOhwDbO34n/Rf9gjl8pltoDCDT6Fy4YvQz+hiaEoetjQQUO5yQkNa4 gItQ== X-Gm-Message-State: AHYfb5g9y2dnm05tdvGsbqSQv8DXyKQas07aX1F+RNge5f3aIZNWgzZK tiq+2q+AurdvHUN9hww= X-Received: by 10.202.212.210 with SMTP id l201mr15831348oig.180.1503680380076; Fri, 25 Aug 2017 09:59:40 -0700 (PDT) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com. [209.85.223.172]) by smtp.gmail.com with ESMTPSA id n203sm6766191oia.15.2017.08.25.09.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Aug 2017 09:59:39 -0700 (PDT) Received: by mail-io0-f172.google.com with SMTP id 81so1177168ioj.5; Fri, 25 Aug 2017 09:59:39 -0700 (PDT) X-Received: by 10.107.38.206 with SMTP id m197mr10094937iom.157.1503680378902; Fri, 25 Aug 2017 09:59:38 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.81.131 with HTTP; Fri, 25 Aug 2017 09:59:38 -0700 (PDT) In-Reply-To: <201708251531.v7PFVtoZ038242@repo.freebsd.org> References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> From: Conrad Meyer Date: Fri, 25 Aug 2017 09:59:38 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322893 - head/bin/dd To: Alan Somers Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 16:59:47 -0000 Hi Alan, By any chance did you test this change with /dev/kmem and kernel addresses ("negative" off_t values)? Thanks, Conrad On Fri, Aug 25, 2017 at 8:31 AM, Alan Somers wrote: > Author: asomers > Date: Fri Aug 25 15:31:55 2017 > New Revision: 322893 > URL: https://svnweb.freebsd.org/changeset/base/322893 > > Log: > dd(1): Incorrect casting of arguments > > dd(1) casts many of its numeric arguments from uintmax_t to intmax_t and > back again to detect whether or not the original arguments were negative. > This is not correct, and causes problems with boundary cases, for example > when count is SSIZE_MAX-1. > > PR: 191263 > Submitted by: will@worrbase.com > Reviewed by: pi, asomers > MFC after: 3 weeks From owner-svn-src-all@freebsd.org Fri Aug 25 17:08:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA37BDDCDC9; Fri, 25 Aug 2017 17:08:12 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7EF80679AA; Fri, 25 Aug 2017 17:08:12 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-wm0-x235.google.com with SMTP id b79so2676809wmb.1; Fri, 25 Aug 2017 10:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=g5c9jkD+5HY9UrIvhuT6iCSs/AKFc+He2zzlreCKDyg=; b=aqOeCEXq/MHhSv4LMeNCnx1Gs0jCzAUI+cuk7WBvj0PBCiasTN/NtKwwYNbJnh9kSK 4LJcZ+++JDr+Ox9vcjzHs8YtY5gIzlBb/isHRGlnd8YpaXOVEMbBiFFl9x5DLdh+9tj2 rA+yfTMsg03qQe2xnXuuyeVo97PpE5Ywv5IHVOjVTcG/GW+cmzAhA7M3OaY9j2fvwBdn /wmK5cnyIEx8cf46jp1KZ5lwA7O1pmjn1v8KRfAob5CR0bye1zcHE+mkwwiASODNqYQk Bt/LhYscUGdsI7m73VMg7ZuO9a1/zO2D8vMTRarWjkj4Zkj/zzbfWg3wg/81tCMG2TH6 pZ6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=g5c9jkD+5HY9UrIvhuT6iCSs/AKFc+He2zzlreCKDyg=; b=VSkjy4idFkM4oc58Uiu/dEv3GtKfEvVoFpfftwVkDzL/Rp/RjNDt7E9YEPy/ucQL8m TsVgUCz8TQTTP0xcNvB5XtCW7XwGpQK6l4+RcRvPKXZk+usLEuTgy7NiUGRsyY6pIWYE OdDN2xpVWMai3Dn3D5urFqkEXJOFZYmGOoHNoV3hv/SY1flLd8LDO+M1uQne3wkUTQXB RyH3ZUv6YYl4+EdLHKjYT91TSzezs9fshQWC636BDTp8djDk8jKjcHuBVzAOJ1gGbrVo VJ5RISTXd92Vkq7O6Xd7PKR2Iuw6w+hWpFSKx+zW6EcHGukwOOrLhIfwHOvsb4C9D3S9 /fYQ== X-Gm-Message-State: AHYfb5gGBgmVjkXITer22XlYfmI7pQXCrz9vKqYZB+qZ+b1Ikat8xRCZ DayCeIoy5ceILYUtEvRQ4AMy/KNlyQ== X-Received: by 10.28.5.136 with SMTP id 130mr76294wmf.4.1503680890633; Fri, 25 Aug 2017 10:08:10 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.28.56.194 with HTTP; Fri, 25 Aug 2017 10:08:09 -0700 (PDT) In-Reply-To: References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> From: Alan Somers Date: Fri, 25 Aug 2017 11:08:09 -0600 X-Google-Sender-Auth: _v9iRRzwXzMPNb7t-_-8x4TWcqc Message-ID: Subject: Re: svn commit: r322893 - head/bin/dd To: "Conrad E. Meyer" Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 17:08:13 -0000 Nope. Do you mean negative offsets for the iseek argument? I didn't know you could do that. On Fri, Aug 25, 2017 at 10:59 AM, Conrad Meyer wrote: > Hi Alan, > > By any chance did you test this change with /dev/kmem and kernel > addresses ("negative" off_t values)? > > Thanks, > Conrad > > On Fri, Aug 25, 2017 at 8:31 AM, Alan Somers wrote: >> Author: asomers >> Date: Fri Aug 25 15:31:55 2017 >> New Revision: 322893 >> URL: https://svnweb.freebsd.org/changeset/base/322893 >> >> Log: >> dd(1): Incorrect casting of arguments >> >> dd(1) casts many of its numeric arguments from uintmax_t to intmax_t and >> back again to detect whether or not the original arguments were negative. >> This is not correct, and causes problems with boundary cases, for example >> when count is SSIZE_MAX-1. >> >> PR: 191263 >> Submitted by: will@worrbase.com >> Reviewed by: pi, asomers >> MFC after: 3 weeks From owner-svn-src-all@freebsd.org Fri Aug 25 17:18:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 353B1DDD048; Fri, 25 Aug 2017 17:18:07 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi0-f44.google.com (mail-oi0-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0265C67E4F; Fri, 25 Aug 2017 17:18:06 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi0-f44.google.com with SMTP id j144so3917646oib.1; Fri, 25 Aug 2017 10:18:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=L93maoUCuCS8ZcVHvQ32sc3RpCX2tYz4obaitLTRO0Q=; b=fKDrp1+1VBiHFLHSlHDwbnrLa+2V15JehdAXMKfUrkKWZqP/9F7nGVmlNHXJGWHwpT 2Bv+J1aYfqhzQJ5QwKS1ClpE75+kgW18BDLQVoq0u9n8+JumklPOqvQ5T5p5dH6wxSwV eUVTPm3G552eKDv/f7NaDhN/L8+cpTEb1DStoY56pp5n+gBtDGyRxiOEEKOXU7Pr5oKy HTgbZGNxtZrmWJ6DymlD8T2CvpoRFC5+yhPDHi1auBKRczFhB44XcivPmh1cOVsMagv8 re8S7OdD0breevIsbiXobakvp/mSfosMyWEOe1YaBjQaFMV9GB6KLdJJsoa9hsFXkSCU SAVQ== X-Gm-Message-State: AHYfb5iBkUGIvK8VE+xvnnvOlCHNEYntqhBRcZNflwnbB0xQiuhDDnyv qabIiX0ONtCqAmJKDHA= X-Received: by 10.202.252.199 with SMTP id a190mr14663900oii.268.1503681479301; Fri, 25 Aug 2017 10:17:59 -0700 (PDT) Received: from mail-it0-f47.google.com (mail-it0-f47.google.com. [209.85.214.47]) by smtp.gmail.com with ESMTPSA id e206sm6292062oig.50.2017.08.25.10.17.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Aug 2017 10:17:59 -0700 (PDT) Received: by mail-it0-f47.google.com with SMTP id 77so2194119itj.0; Fri, 25 Aug 2017 10:17:59 -0700 (PDT) X-Received: by 10.36.14.216 with SMTP id 207mr127403ite.151.1503681478707; Fri, 25 Aug 2017 10:17:58 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.81.131 with HTTP; Fri, 25 Aug 2017 10:17:58 -0700 (PDT) In-Reply-To: <201708251531.v7PFVtoZ038242@repo.freebsd.org> References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> From: Conrad Meyer Date: Fri, 25 Aug 2017 10:17:58 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322893 - head/bin/dd To: Alan Somers Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 17:18:07 -0000 This change seems to break buildworld on MIPS: /home/cem/head.svn/bin/dd/args.c: In function 'f_bs': /home/cem/head.svn/bin/dd/args.c:188: warning: format '%zd' expects type 'signed size_t', but argument 3 has type 'long int' /home/cem/head.svn/bin/dd/args.c: In function 'f_cbs': /home/cem/head.svn/bin/dd/args.c:199: warning: format '%zd' expects type 'signed size_t', but argument 3 has type 'long int' /home/cem/head.svn/bin/dd/args.c: In function 'f_ibs': /home/cem/head.svn/bin/dd/args.c:245: warning: format '%zd' expects type 'signed size_t', but argument 3 has type 'long int' /home/cem/head.svn/bin/dd/args.c: In function 'f_obs': /home/cem/head.svn/bin/dd/args.c:266: warning: format '%zd' expects type 'signed size_t', but argument 3 has type 'long int' (Yes, it's odd that the SSIZE_MAX constant has 'long' type.) Best, Conrad On Fri, Aug 25, 2017 at 8:31 AM, Alan Somers wrote: > Author: asomers > Date: Fri Aug 25 15:31:55 2017 > New Revision: 322893 > URL: https://svnweb.freebsd.org/changeset/base/322893 > > Log: > dd(1): Incorrect casting of arguments > > dd(1) casts many of its numeric arguments from uintmax_t to intmax_t and > back again to detect whether or not the original arguments were negative. > This is not correct, and causes problems with boundary cases, for example > when count is SSIZE_MAX-1. > > PR: 191263 > Submitted by: will@worrbase.com > Reviewed by: pi, asomers > MFC after: 3 weeks > > Modified: > head/bin/dd/args.c > head/bin/dd/conv.c > head/bin/dd/dd.c > head/bin/dd/dd.h > head/bin/dd/position.c > > Modified: head/bin/dd/args.c > ============================================================================== > --- head/bin/dd/args.c Fri Aug 25 14:42:11 2017 (r322892) > +++ head/bin/dd/args.c Fri Aug 25 15:31:55 2017 (r322893) > @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); > > #include > > +#include > #include > #include > #include > @@ -184,7 +185,7 @@ f_bs(char *arg) > > res = get_num(arg); > if (res < 1 || res > SSIZE_MAX) > - errx(1, "bs must be between 1 and %jd", (intmax_t)SSIZE_MAX); > + errx(1, "bs must be between 1 and %zd", SSIZE_MAX); > in.dbsz = out.dbsz = (size_t)res; > } > > @@ -195,22 +196,22 @@ f_cbs(char *arg) > > res = get_num(arg); > if (res < 1 || res > SSIZE_MAX) > - errx(1, "cbs must be between 1 and %jd", (intmax_t)SSIZE_MAX); > + errx(1, "cbs must be between 1 and %zd", SSIZE_MAX); > cbsz = (size_t)res; > } > > static void > f_count(char *arg) > { > - intmax_t res; > + uintmax_t res; > > - res = (intmax_t)get_num(arg); > - if (res < 0) > - errx(1, "count cannot be negative"); > + res = get_num(arg); > + if (res == UINTMAX_MAX) > + errc(1, ERANGE, "%s", oper); > if (res == 0) > - cpy_cnt = (uintmax_t)-1; > + cpy_cnt = UINTMAX_MAX; > else > - cpy_cnt = (uintmax_t)res; > + cpy_cnt = res; > } > > static void > @@ -219,7 +220,7 @@ f_files(char *arg) > > files_cnt = get_num(arg); > if (files_cnt < 1) > - errx(1, "files must be between 1 and %jd", (uintmax_t)-1); > + errx(1, "files must be between 1 and %zu", SIZE_MAX); > } > > static void > @@ -240,8 +241,8 @@ f_ibs(char *arg) > if (!(ddflags & C_BS)) { > res = get_num(arg); > if (res < 1 || res > SSIZE_MAX) > - errx(1, "ibs must be between 1 and %jd", > - (intmax_t)SSIZE_MAX); > + errx(1, "ibs must be between 1 and %zd", > + SSIZE_MAX); > in.dbsz = (size_t)res; > } > } > @@ -261,8 +262,8 @@ f_obs(char *arg) > if (!(ddflags & C_BS)) { > res = get_num(arg); > if (res < 1 || res > SSIZE_MAX) > - errx(1, "obs must be between 1 and %jd", > - (intmax_t)SSIZE_MAX); > + errx(1, "obs must be between 1 and %zd", > + SSIZE_MAX); > out.dbsz = (size_t)res; > } > } > > Modified: head/bin/dd/conv.c > ============================================================================== > --- head/bin/dd/conv.c Fri Aug 25 14:42:11 2017 (r322892) > +++ head/bin/dd/conv.c Fri Aug 25 15:31:55 2017 (r322893) > @@ -133,7 +133,7 @@ block(void) > */ > ch = 0; > for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) { > - maxlen = MIN(cbsz, in.dbcnt); > + maxlen = MIN(cbsz, (size_t)in.dbcnt); > if ((t = ctab) != NULL) > for (cnt = 0; cnt < maxlen && (ch = *inp++) != '\n'; > ++cnt) > @@ -146,7 +146,7 @@ block(void) > * Check for short record without a newline. Reassemble the > * input block. > */ > - if (ch != '\n' && in.dbcnt < cbsz) { > + if (ch != '\n' && (size_t)in.dbcnt < cbsz) { > (void)memmove(in.db, in.dbp - in.dbcnt, in.dbcnt); > break; > } > @@ -228,7 +228,7 @@ unblock(void) > * translation has to already be done or we might not recognize the > * spaces. > */ > - for (inp = in.db; in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { > + for (inp = in.db; (size_t)in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { > for (t = inp + cbsz - 1; t >= inp && *t == ' '; --t) > ; > if (t >= inp) { > > Modified: head/bin/dd/dd.c > ============================================================================== > --- head/bin/dd/dd.c Fri Aug 25 14:42:11 2017 (r322892) > +++ head/bin/dd/dd.c Fri Aug 25 15:31:55 2017 (r322893) > @@ -204,10 +204,10 @@ setup(void) > * record oriented I/O, only need a single buffer. > */ > if (!(ddflags & (C_BLOCK | C_UNBLOCK))) { > - if ((in.db = malloc(out.dbsz + in.dbsz - 1)) == NULL) > + if ((in.db = malloc((size_t)out.dbsz + in.dbsz - 1)) == NULL) > err(1, "input buffer"); > out.db = in.db; > - } else if ((in.db = malloc(MAX(in.dbsz, cbsz) + cbsz)) == NULL || > + } else if ((in.db = malloc(MAX((size_t)in.dbsz, cbsz) + cbsz)) == NULL || > (out.db = malloc(out.dbsz + cbsz)) == NULL) > err(1, "output buffer"); > > @@ -405,7 +405,7 @@ dd_in(void) > ++st.in_full; > > /* Handle full input blocks. */ > - } else if ((size_t)n == in.dbsz) { > + } else if ((size_t)n == (size_t)in.dbsz) { > in.dbcnt += in.dbrcnt = n; > ++st.in_full; > > @@ -562,7 +562,7 @@ dd_out(int force) > outp += nw; > st.bytes += nw; > > - if ((size_t)nw == n && n == out.dbsz) > + if ((size_t)nw == n && n == (size_t)out.dbsz) > ++st.out_full; > else > ++st.out_part; > > Modified: head/bin/dd/dd.h > ============================================================================== > --- head/bin/dd/dd.h Fri Aug 25 14:42:11 2017 (r322892) > +++ head/bin/dd/dd.h Fri Aug 25 15:31:55 2017 (r322893) > @@ -38,10 +38,9 @@ > typedef struct { > u_char *db; /* buffer address */ > u_char *dbp; /* current buffer I/O address */ > - /* XXX ssize_t? */ > - size_t dbcnt; /* current buffer byte count */ > - size_t dbrcnt; /* last read byte count */ > - size_t dbsz; /* block size */ > + ssize_t dbcnt; /* current buffer byte count */ > + ssize_t dbrcnt; /* last read byte count */ > + ssize_t dbsz; /* block size */ > > #define ISCHR 0x01 /* character device (warn on short) */ > #define ISPIPE 0x02 /* pipe-like (see position.c) */ > > Modified: head/bin/dd/position.c > ============================================================================== > --- head/bin/dd/position.c Fri Aug 25 14:42:11 2017 (r322892) > +++ head/bin/dd/position.c Fri Aug 25 15:31:55 2017 (r322893) > @@ -207,7 +207,7 @@ pos_out(void) > n = write(out.fd, out.db, out.dbsz); > if (n == -1) > err(1, "%s", out.name); > - if ((size_t)n != out.dbsz) > + if (n != out.dbsz) > errx(1, "%s: write failure", out.name); > } > break; > From owner-svn-src-all@freebsd.org Fri Aug 25 17:20:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 686BDDDD163; Fri, 25 Aug 2017 17:20:17 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi0-f42.google.com (mail-oi0-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3439C681C1; Fri, 25 Aug 2017 17:20:16 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi0-f42.google.com with SMTP id j144so3964871oib.1; Fri, 25 Aug 2017 10:20:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=yr9LzJ1mUJ5mg6XqkB6hi6thCu5QNUcv23HTBi+axqg=; b=RSQuUE6/t80JGpkqt7hYcCA4qX5Udcrlbg/N0x0Ta1oBRU7IVWOH3v3En5tVroLWlP /C79zx5gxOGG5gpf/6kXSIOmkDcwryHHD8+R2Ys+OhMhba7tJbgcHaGoexj9JHmpFqW7 TaO4g+Kt0IDrU1LUevYSjWl0+gXeS7A7YijBkheFJOPAFf0h6w9Gf6BPcEDDS3qdx4/n Ymbe4+79Ja2UOHKBoiOrS12PmQPIOCo7QSWLK+oS+MIXV4lVT0vDf0AXGgS0OKgQDe0f bXEgB2j8VMnUdVWizyf/1JxdvOJqCgLAHqKKludUXIdXTxMaP6oleZ4Y4QkZ0kNNHeOi rv5A== X-Gm-Message-State: AHYfb5jszLLV/eQCCw/eMbR/KaNBX4rcIh+Kxxd/iSZysnpn8OGzjxcS MQHcEdYWMQW8e/eSJm8= X-Received: by 10.202.95.139 with SMTP id t133mr14562796oib.207.1503681610011; Fri, 25 Aug 2017 10:20:10 -0700 (PDT) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com. [209.85.214.45]) by smtp.gmail.com with ESMTPSA id e206sm6296027oig.50.2017.08.25.10.20.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Aug 2017 10:20:09 -0700 (PDT) Received: by mail-it0-f45.google.com with SMTP id 77so2221417itj.0; Fri, 25 Aug 2017 10:20:09 -0700 (PDT) X-Received: by 10.36.129.138 with SMTP id q132mr155784itd.174.1503681609622; Fri, 25 Aug 2017 10:20:09 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.81.131 with HTTP; Fri, 25 Aug 2017 10:20:09 -0700 (PDT) In-Reply-To: References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> From: Conrad Meyer Date: Fri, 25 Aug 2017 10:20:09 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322893 - head/bin/dd To: Alan Somers Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 17:20:17 -0000 Well, not negative, just large uint64_t numbers that would be negative as off_t (int64_t). E.g., dd if=/dev/kmem bs=1 iseek=0xfffff...foo count=8. I think we would like that to work. I don't recall whether it does or not before this change. Best, Conrad On Fri, Aug 25, 2017 at 10:08 AM, Alan Somers wrote: > Nope. Do you mean negative offsets for the iseek argument? I didn't > know you could do that. > > On Fri, Aug 25, 2017 at 10:59 AM, Conrad Meyer wrote: >> Hi Alan, >> >> By any chance did you test this change with /dev/kmem and kernel >> addresses ("negative" off_t values)? >> >> Thanks, >> Conrad From owner-svn-src-all@freebsd.org Fri Aug 25 17:29:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3619DDD34F; Fri, 25 Aug 2017 17:29:49 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C038E686D6; Fri, 25 Aug 2017 17:29:49 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PHTmJd083823; Fri, 25 Aug 2017 17:29:48 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PHTmwd083819; Fri, 25 Aug 2017 17:29:48 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201708251729.v7PHTmwd083819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Fri, 25 Aug 2017 17:29:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322896 - in head/sys/boot: efi/loader efi/loader/arch/amd64 efi/loader/arch/i386 i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: sobomax X-SVN-Commit-Paths: in head/sys/boot: efi/loader efi/loader/arch/amd64 efi/loader/arch/i386 i386/libi386 X-SVN-Commit-Revision: 322896 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 17:29:50 -0000 Author: sobomax Date: Fri Aug 25 17:29:48 2017 New Revision: 322896 URL: https://svnweb.freebsd.org/changeset/base/322896 Log: Make spinconsole platform independent and hook it up into EFI loader on i386 and amd64. Not enabled on ARMs, those are lacking timer routines. MFC after: 2 moths Sponsored by: Sippy Software, Inc. Modified: head/sys/boot/efi/loader/arch/amd64/Makefile.inc head/sys/boot/efi/loader/arch/i386/Makefile.inc head/sys/boot/efi/loader/conf.c head/sys/boot/i386/libi386/spinconsole.c Modified: head/sys/boot/efi/loader/arch/amd64/Makefile.inc ============================================================================== --- head/sys/boot/efi/loader/arch/amd64/Makefile.inc Fri Aug 25 16:38:21 2017 (r322895) +++ head/sys/boot/efi/loader/arch/amd64/Makefile.inc Fri Aug 25 17:29:48 2017 (r322896) @@ -9,7 +9,8 @@ SRCS+= amd64_tramp.S \ .PATH: ${.CURDIR}/../../i386/libi386 SRCS+= nullconsole.c \ - comconsole.c + comconsole.c \ + spinconsole.c -CFLAGS+= -fPIC +CFLAGS+= -fPIC -DTERM_EMU LDFLAGS+= -Wl,-znocombreloc Modified: head/sys/boot/efi/loader/arch/i386/Makefile.inc ============================================================================== --- head/sys/boot/efi/loader/arch/i386/Makefile.inc Fri Aug 25 16:38:21 2017 (r322895) +++ head/sys/boot/efi/loader/arch/i386/Makefile.inc Fri Aug 25 17:29:48 2017 (r322896) @@ -7,7 +7,8 @@ SRCS+= start.S \ .PATH: ${.CURDIR}/../../i386/libi386 SRCS+= nullconsole.c \ - comconsole.c + comconsole.c \ + spinconsole.c -CFLAGS+= -fPIC +CFLAGS+= -fPIC -DTERM_EMU LDFLAGS+= -Wl,-znocombreloc Modified: head/sys/boot/efi/loader/conf.c ============================================================================== --- head/sys/boot/efi/loader/conf.c Fri Aug 25 16:38:21 2017 (r322895) +++ head/sys/boot/efi/loader/conf.c Fri Aug 25 17:29:48 2017 (r322896) @@ -69,6 +69,7 @@ extern struct console efi_console; #if defined(__amd64__) || defined(__i386__) extern struct console comconsole; extern struct console nullconsole; +extern struct console spinconsole; #endif struct console *consoles[] = { @@ -76,6 +77,7 @@ struct console *consoles[] = { #if defined(__amd64__) || defined(__i386__) &comconsole, &nullconsole, + &spinconsole, #endif NULL }; Modified: head/sys/boot/i386/libi386/spinconsole.c ============================================================================== --- head/sys/boot/i386/libi386/spinconsole.c Fri Aug 25 16:38:21 2017 (r322895) +++ head/sys/boot/i386/libi386/spinconsole.c Fri Aug 25 17:29:48 2017 (r322896) @@ -41,16 +41,14 @@ __FBSDID("$FreeBSD$"); #include #include -extern void get_pos(int *x, int *y); -extern void curs_move(int *_x, int *_y, int x, int y); -extern void vidc_biosputchar(int c); - static void spinc_probe(struct console *cp); static int spinc_init(int arg); static void spinc_putchar(int c); static int spinc_getchar(void); static int spinc_ischar(void); +extern struct console *consoles[]; + struct console spinconsole = { "spinconsole", "spin port", @@ -62,47 +60,53 @@ struct console spinconsole = { spinc_ischar }; +static struct console *parent = NULL; + static void spinc_probe(struct console *cp) { - cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT); + + if (parent == NULL) + parent = consoles[0]; + parent->c_probe(cp); } static int spinc_init(int arg) { - return(0); + + return(parent->c_init(arg)); } static void spinc_putchar(int c) { - static int curx, cury; static unsigned tw_chars = 0x5C2D2F7C; /* "\-/|" */ - static time_t lasttime; + static time_t lasttime = 0; time_t now; - now = time(NULL); + now = time(0); if (now < (lasttime + 1)) return; - lasttime = now; #ifdef TERM_EMU - get_pos(&curx, &cury); - if (curx > 0) - curs_move(&curx, &cury, curx - 1, cury); + if (lasttime > 0) + parent->c_out('\b'); #endif - vidc_biosputchar((char)tw_chars); + lasttime = now; + parent->c_out((char)tw_chars); tw_chars = (tw_chars >> 8) | ((tw_chars & (unsigned long)0xFF) << 24); } static int spinc_getchar(void) { + return(-1); } static int spinc_ischar(void) { + return(0); } From owner-svn-src-all@freebsd.org Fri Aug 25 17:59:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A39EDDD990; Fri, 25 Aug 2017 17:59:32 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78AC8698CD; Fri, 25 Aug 2017 17:59:31 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v7PHxLSe070179; Fri, 25 Aug 2017 10:59:21 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v7PHxKPD070178; Fri, 25 Aug 2017 10:59:20 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201708251759.v7PHxKPD070178@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r322863 - head/sys/cam In-Reply-To: To: Warner Losh Date: Fri, 25 Aug 2017 10:59:20 -0700 (PDT) CC: Slawa Olhovchenkov , Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 17:59:32 -0000 [ Charset UTF-8 unsupported, converting... ] > On Fri, Aug 25, 2017 at 7:35 AM, Slawa Olhovchenkov wrote: > > > On Thu, Aug 24, 2017 at 10:11:10PM +0000, Warner Losh wrote: > > > > > Author: imp > > > Date: Thu Aug 24 22:11:10 2017 > > > New Revision: 322863 > > > URL: https://svnweb.freebsd.org/changeset/base/322863 > > > > > > Log: > > > Expand the latency tracking array from 1.024s to 8.192s to help track > > > extreme outliers from dodgy drives. Adjust comments to reflect this, > > > and make sure that the number of latency buckets match in the two > > > places where it matters. > > > > May be up to 1min? > > > > I'm not sure what additional data you'll get between "totally sucks, at > least 8s latency" and "totally sucks, at least 32s." or "totally sucks, at > least 64s" though the latter isn't possible with the default timeouts... > > I'm planning on adding a 'max' latency that's self-resetting instead of > expanding the bucket upwards. I'm also contemplating expanding it down to > 100us or even 10us since nda serves nvme drives which easily can be sub > 100us. > > Warner What about using a log2/log10 engineering style binning of 1, 2, 4, 8 us 10, 20, 40, 80 us 100, 200, 400, 800 us ... 10000000, 20000000, 40000000, 80000000 us This would give you a fairly fine grain in the high speed area and cource grain in the not very likely areas, and it all fits in a nice 32 ints. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Fri Aug 25 18:02:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52E7BDDDC90; Fri, 25 Aug 2017 18:02:45 +0000 (UTC) (envelope-from matt.joras@gmail.com) Received: from mail-qt0-x22d.google.com (mail-qt0-x22d.google.com [IPv6:2607:f8b0:400d:c0d::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 09D3569E32; Fri, 25 Aug 2017 18:02:45 +0000 (UTC) (envelope-from matt.joras@gmail.com) Received: by mail-qt0-x22d.google.com with SMTP id q53so2604228qtq.5; Fri, 25 Aug 2017 11:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=CVfiyVOv6LAMqc7XQWSS06hm5VkS8zG5pttzQsI5xJQ=; b=EwzNzBtuhIvY0WO2kEOn3YREUNT2BSUbVAY91VtmkiDyRAR0h0GsteYyAqfkn8BQe6 w/yQi6IRAQ9bqbloY6km4wagtzF5t3FmYycT8suHNM+92gDmyNIEh2JGkhANTyiTBTEf 9Re03aGMS1xKbDKq1Our5UqIywsiuc8jYU+MMlynNZYbCceGuIYEDcnWKm5BWlIqcLif PBOxcJJ8FqF0IyN0VDq8aHxY93l6VcWMjVJkXHDDPy+PNTQZVU32SNooc/3QfI0/XEnJ +6pT0MLYc/9w/wRWy3c35UMWuwhWWBCn4E/15LLEe+oTJOdnW3hqDgncsOCtYfSZfo1i BDlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=CVfiyVOv6LAMqc7XQWSS06hm5VkS8zG5pttzQsI5xJQ=; b=uiAu97Lx7TwiEFafRDAk5iTgm4iIVcQELB4Y3eUdQYF4wsQX3KUQ2Qz25JD0/vdosv UE41Qpda+WAJYoQSdtpl7h21Gje/1kPj23hchibPabRWkQd9N59nY/8rGcLg5HiVWT6Z cuJjyjpPhJLhMPRtAFM+qeBK6Nm/pjxnLW+N6sw3NRmy1EmOeCl+dpswunWh1ojyYwxE 6GEbncvScf3i4Dv9uOsT+oiSTmXMxhCbD8FKK+q8wTCFE7dswAEvRifBR5vfT+64hg6q J1m4FapU2BONEfhFDsT/hYXwbkF+i5kLqyPMtAS9m04H2QbBHcUnGXpWb3OQyURf7M6W rkBQ== X-Gm-Message-State: AHYfb5h2nafaze8IVZYn6VuFSAT8jSyif/qxVIp7q0yrZ/CpNtbZBhYv SSA+7727YQbARLaoelo= X-Received: by 10.200.22.57 with SMTP id p54mr16012390qtj.317.1503684163763; Fri, 25 Aug 2017 11:02:43 -0700 (PDT) Received: from [192.168.2.122] (71-212-20-168.tukw.qwest.net. [71.212.20.168]) by smtp.gmail.com with ESMTPSA id 22sm4488107qto.36.2017.08.25.11.02.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Aug 2017 11:02:41 -0700 (PDT) Subject: Re: svn commit: r322893 - head/bin/dd To: cem@freebsd.org, Alan Somers Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> From: Matt Joras Message-ID: <4b016f89-61c5-fc8a-a36a-aca8166c369e@gmail.com> Date: Fri, 25 Aug 2017 11:02:40 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 18:02:45 -0000 On 08/25/2017 10:17, Conrad Meyer wrote: > This change seems to break buildworld on MIPS: > > /home/cem/head.svn/bin/dd/args.c: In function 'f_bs': > /home/cem/head.svn/bin/dd/args.c:188: warning: format '%zd' expects > type 'signed size_t', but argument 3 has type 'long int' > /home/cem/head.svn/bin/dd/args.c: In function 'f_cbs': > /home/cem/head.svn/bin/dd/args.c:199: warning: format '%zd' expects > type 'signed size_t', but argument 3 has type 'long int' > /home/cem/head.svn/bin/dd/args.c: In function 'f_ibs': > /home/cem/head.svn/bin/dd/args.c:245: warning: format '%zd' expects > type 'signed size_t', but argument 3 has type 'long int' > /home/cem/head.svn/bin/dd/args.c: In function 'f_obs': > /home/cem/head.svn/bin/dd/args.c:266: warning: format '%zd' expects > type 'signed size_t', but argument 3 has type 'long int' > > (Yes, it's odd that the SSIZE_MAX constant has 'long' type.) > SSIZE_MAX should have type long, since ssize_t is a long on mips (and other arches besides i386 and arm). Re: the build failure, that's in the GCC C format string checking, so perhaps it's more accurate to say this breaks the (in-tree) GCC build. %zd is the right format specifier for ssize_t. I guess GCC's format string checking is getting confused because SSIZE_MAX is a constant that expands to type long. Perhaps casting to ssize_t would GCC happier, but that looks rather wrong. Matt From owner-svn-src-all@freebsd.org Fri Aug 25 18:07:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 923EFDDDE3F; Fri, 25 Aug 2017 18:07:58 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-pg0-x22e.google.com (mail-pg0-x22e.google.com [IPv6:2607:f8b0:400e:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 64F346A133; Fri, 25 Aug 2017 18:07:58 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-pg0-x22e.google.com with SMTP id b8so2766602pgn.5; Fri, 25 Aug 2017 11:07:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Wak70XuFlEEKHU/YFE7Pn3VuSdk6Fb7HviKY3XoyxD4=; b=uJfdKJWNzapNdZOUZJz4Wccm6R2ZgmGdxQW49hkNNspVQhAiFfI/aD1cI8AIWHZj8X daW4dhGdOIOX3lyasUYHunc4gKmcJZGaDvJNqYrzdk/+3KZM2oN9o5ZEwP9sFZ79iLsX xzn0/GfDLqcXCR1cTATGDTMZZVo5ru+/u0vAzp5IxFxqA+O4x4RLQJ3Puu7sgOJkwmsL dw9bj4istcFtsTtP/PvG0HiN20yWgd2Tx8h8YryGckwSgr4cUGRpHawSwVRS2uYQT3Dz i6TxpqBLvsVrmbgEt5SGPnm/fbKpm7rBF55scJsmrWx939ZuN5Z/t8GLL/IPGNG+0hRJ ulfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Wak70XuFlEEKHU/YFE7Pn3VuSdk6Fb7HviKY3XoyxD4=; b=VE1WfyY4yy3FC1c5ToI1LxRMuHZT1uX03AoqueRz8xJWfVPu/HiT5FrnKXh6Cfedcx mgrElSMKN8bnyQ7i3Q12PUvjb+YQRYPo+5ansfkAT5Mp4GZSEPJbSL2Cw2zIIQxQobk0 svK5jM0KbXOhNhjMawKRthMdBCze9TqUZJK1/jJGGQgAP84wrPPn2VpSfqzq+BYva7wd a3cQHfACIOEuJNzuVRC2dbr93DddhwQkgY9eozumWtGjkz2qLJQgIfN512Z+HSt5jbWb z/ZDePv5c9Ix5R1MfNP9eJufjL1EcEG+TEJNt6LVUnNbwZ+k0DN+aDlC7P1PoZr18r61 giIA== X-Gm-Message-State: AHYfb5g94bhmyqvDLYfh4B1+VZyvX4lMtZobc7fG+rVAQlY2TjE9BHXH Gv2sZXVmx2sGNzhF4o5ZYjjd4OttPlwuyRM= X-Received: by 10.98.217.210 with SMTP id b79mr10237223pfl.110.1503684477387; Fri, 25 Aug 2017 11:07:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.207.193 with HTTP; Fri, 25 Aug 2017 11:07:56 -0700 (PDT) In-Reply-To: <201708232330.v7NNUPpV052276@repo.freebsd.org> References: <201708232330.v7NNUPpV052276@repo.freebsd.org> From: Ryan Libby Date: Fri, 25 Aug 2017 11:07:56 -0700 Message-ID: Subject: Re: svn commit: r322824 - in head: lib/clang share/mk usr.bin/clang To: John Baldwin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 18:07:58 -0000 On Wed, Aug 23, 2017 at 4:30 PM, John Baldwin wrote: > Author: jhb > Date: Wed Aug 23 23:30:25 2017 > New Revision: 322824 > URL: https://svnweb.freebsd.org/changeset/base/322824 > > Log: > Improve the coverage of debug symbols for MK_DEBUG_FILES. > > - Include debug symbols in static libraries. This permits binaries > to include debug symbols for functions obtained from static libraries. > - Permit the C/C++ compiler flags added for MK_DEBUG_FILES to be > overridden by setting DEBUG_FILES_CFLAGS. Use this to limit the debug > information for llvm libraries and binaries. > > Reviewed by: emaste > Sponsored by: DARPA / AFRL > Differential Revision: https://reviews.freebsd.org/D12025 > > Added: > head/lib/clang/Makefile.inc (contents, props changed) > Modified: > head/share/mk/bsd.lib.mk > head/share/mk/bsd.prog.mk > head/share/mk/bsd.sys.mk > head/usr.bin/clang/Makefile.inc This causes llvm to emit hundreds of new warnings [1] for "DWARF2 only supports one section per compilation unit" Are these expected? Are they a concern? Should we silence them? Is this an upstream llvm bug [2]? [1] https://ci.freebsd.org/job/FreeBSD-head-amd64-build/4719/warnings9Result/new/ $ grep -A 1 "warning: DWARF2 only supports one section" consoleText.txt | grep -o "\.section.*" | sort | uniq -c 3 .section .fini,"ax",@progbits 6 .section .init 4 .section .init,"ax",@progbits 17 .section .note.GNU-stack,"",@progbits 2785 .section .note.GNU-stack,"",%progbits 2 .section .reloc, "a" 21 .section .rodata 1 .section __xen_guest [2] https://lists.freebsd.org/pipermail/freebsd-toolchain/2016-March/002122.html From owner-svn-src-all@freebsd.org Fri Aug 25 18:09:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74F00DDDECE for ; Fri, 25 Aug 2017 18:09:40 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3812F6A295 for ; Fri, 25 Aug 2017 18:09:40 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x236.google.com with SMTP id 81so1755838ioj.5 for ; Fri, 25 Aug 2017 11:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=IlMKhgy+ah0s3L0qC+4VwIMgXbK+j8E0xRJ/T92kG+Y=; b=bWasdCrCmsam3OfMlqh7MtYVAoMjl/D0CKWQvbD/o+xm+S8oIcsyYMzEG+xLZ6Fc0G OleVP9OX3GkcJX9Dj12P/kzhqmqfEM34Yb1PrMn4oYSpWT8567jY9asjGhDx9V7VyhFP ewh8XRvLNUsBKaCl75e8/uqlTA5He6bs8CjtL1wVpgZsWfu1jVJBJnwT1GkbQAfwJsFR fg6d25T12RQoXQGu/E2H4/N/7IkAuZ8LNAZ0DnNrBzaqvpbZAr7EgCOoq/sie1ZOK2CG rGyTPVif4U/Oq4LhvVRiYtVfnIC7F30O++zLTlMRBZ1Df1d1j9r6VzvoeWLjyh/ubioL +FfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=IlMKhgy+ah0s3L0qC+4VwIMgXbK+j8E0xRJ/T92kG+Y=; b=f8NtKoUQmF9/VH6YtcTPVUbcrG5wb7SIF2p1AfXh4cfGZhOg5Vp8x/oMB2Mpn8gLC9 vo9NZXwYDaso1dYnCwEDSnqU+yohbMFGluih/5iNBdLkaeMo0LNvgryStZ+y6HgaKO2y PjjDlwx3cPPV8R1sdZw16mMYuJ5FRlmbz40SY4e/XGK6LVDRS0Oi7bhAYYWlxbWuwEu+ NAN4YcnNuT6nocdCktkalP1DJ569Ar6t3qXGAWggRRO1mk4M7UVfB+Zq6rR+fWE1xw2q bAKsVUz43aDfHJKOj/9xnCUJtHjU8SD3M1mV3d2vrbVxZoHtvjQa+0rGyLu08kNmZl6U bK7A== X-Gm-Message-State: AHYfb5h5JrjchW2ZIG4kXbjAG4BIsSl/U+Bf/y7K8IAsfeaiXmxJ+HgF JYzTBjha/g4RKrjbxYA4PQSLrDxrH2LI X-Received: by 10.107.131.219 with SMTP id n88mr8847612ioi.277.1503684579474; Fri, 25 Aug 2017 11:09:39 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Fri, 25 Aug 2017 11:09:38 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <4b016f89-61c5-fc8a-a36a-aca8166c369e@gmail.com> References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> <4b016f89-61c5-fc8a-a36a-aca8166c369e@gmail.com> From: Warner Losh Date: Fri, 25 Aug 2017 12:09:38 -0600 X-Google-Sender-Auth: 4SFIqmYFJ93SZ4IenIDEILimWWw Message-ID: Subject: Re: svn commit: r322893 - head/bin/dd To: Matt Joras Cc: "Conrad E. Meyer" , Alan Somers , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 18:09:40 -0000 On Fri, Aug 25, 2017 at 12:02 PM, Matt Joras wrote: > On 08/25/2017 10:17, Conrad Meyer wrote: > > This change seems to break buildworld on MIPS: > > > > /home/cem/head.svn/bin/dd/args.c: In function 'f_bs': > > /home/cem/head.svn/bin/dd/args.c:188: warning: format '%zd' expects > > type 'signed size_t', but argument 3 has type 'long int' > > /home/cem/head.svn/bin/dd/args.c: In function 'f_cbs': > > /home/cem/head.svn/bin/dd/args.c:199: warning: format '%zd' expects > > type 'signed size_t', but argument 3 has type 'long int' > > /home/cem/head.svn/bin/dd/args.c: In function 'f_ibs': > > /home/cem/head.svn/bin/dd/args.c:245: warning: format '%zd' expects > > type 'signed size_t', but argument 3 has type 'long int' > > /home/cem/head.svn/bin/dd/args.c: In function 'f_obs': > > /home/cem/head.svn/bin/dd/args.c:266: warning: format '%zd' expects > > type 'signed size_t', but argument 3 has type 'long int' > > > > (Yes, it's odd that the SSIZE_MAX constant has 'long' type.) > > > SSIZE_MAX should have type long, since ssize_t is a long on mips (and > other arches besides i386 and arm). > > Re: the build failure, that's in the GCC C format string checking, so > perhaps it's more accurate to say this breaks the (in-tree) GCC build. > %zd is the right format specifier for ssize_t. I guess GCC's format > string checking is getting confused because SSIZE_MAX is a constant that > expands to type long. Perhaps casting to ssize_t would GCC happier, but > that looks rather wrong. > This is why it was cast in the first place due to issues with exact type. Maybe we should put the casts back for the printfs. Warner From owner-svn-src-all@freebsd.org Fri Aug 25 18:18:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16490DDE398 for ; Fri, 25 Aug 2017 18:18:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE9A36A9C6 for ; Fri, 25 Aug 2017 18:18:35 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x236.google.com with SMTP id f1so2285372ith.0 for ; Fri, 25 Aug 2017 11:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=8jl1rNuaRq9ley1VKQr4UgsPu9IBV13XJG/BNyOeoBQ=; b=PJTKc8pDt/N7z7MPQ6IW3MYldjqXVeEiezmP6M8SpTIYMfroJtoq0ynU7Q0frC3j28 JW+cvgvxz7W9SoFrv1Hgk6OCNMA1Nq/fJwYn/CKzVKnQQKtTJAx2+jvdrvSnZ7ErnEz6 JUoovP8c2/a1YEYQIGGDrITC8iP+OldLWACFI67T3PlCOinac1Qftc2YWbPJXlwYPhFR jAM3Jvp6nNsFkHbz41KLblu3qnJFSVcsSTQfltCToTCByp6B5JLxxQ7JHwd5Tv6RqDJt gnqzuhRj4ybG8eXOVya/awKu7/aCpmYYKsjp/DYWmJW9p7fdP8CfGkwA8O2rypF+aKma Mq7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=8jl1rNuaRq9ley1VKQr4UgsPu9IBV13XJG/BNyOeoBQ=; b=MLLIYz4A4/b8AVj4HBrpIClewQHXeNXk6OrL9C1UdX3LZHQLuRS/j6pI9vW4Go3sJJ ise7F8nqk7dAdVTXKEHKhQb99DjR/IbarkLOQj4DoWMXtwl7PBEQYJwSmjOcdBXr6UN9 bjCs0kGqhOe/WJCE1R8cKE+gdCSgjwrBPN7ulHl3WkArCm8r3OtHRrOiL1TDQFXtK4o8 qaxSC9d7BsiTZhwsBEPugV7AGQrN0UaVfqPDGOV0BRkkTPqHnHJNch8q9Z3VtibF7CDJ UFVdhMMdIsr9V5m8PKcOkaqobCapkFVoYVSRz1xtAius0xphlXnPfmuQAYBJBOe4kxfS 5S4w== X-Gm-Message-State: AHYfb5jATG6JcesT9bPlhgccw5kf35KFBKgWRRmse3xRS96bdupWC0VN Fdj0ci9gXYjkGwCDiXxnGrn8x+BCd1yL X-Received: by 10.36.159.194 with SMTP id c185mr283271ite.31.1503685115228; Fri, 25 Aug 2017 11:18:35 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Fri, 25 Aug 2017 11:18:34 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <201708251759.v7PHxKPD070178@pdx.rh.CN85.dnsmgr.net> References: <201708251759.v7PHxKPD070178@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Fri, 25 Aug 2017 12:18:34 -0600 X-Google-Sender-Auth: XwYtFIJgetQN2osBrZcJ8DpLBE4 Message-ID: Subject: Re: svn commit: r322863 - head/sys/cam To: "Rodney W. Grimes" Cc: Slawa Olhovchenkov , Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 18:18:36 -0000 On Fri, Aug 25, 2017 at 11:59 AM, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > [ Charset UTF-8 unsupported, converting... ] > > On Fri, Aug 25, 2017 at 7:35 AM, Slawa Olhovchenkov > wrote: > > > > > On Thu, Aug 24, 2017 at 10:11:10PM +0000, Warner Losh wrote: > > > > > > > Author: imp > > > > Date: Thu Aug 24 22:11:10 2017 > > > > New Revision: 322863 > > > > URL: https://svnweb.freebsd.org/changeset/base/322863 > > > > > > > > Log: > > > > Expand the latency tracking array from 1.024s to 8.192s to help > track > > > > extreme outliers from dodgy drives. Adjust comments to reflect > this, > > > > and make sure that the number of latency buckets match in the two > > > > places where it matters. > > > > > > May be up to 1min? > > > > > > > I'm not sure what additional data you'll get between "totally sucks, at > > least 8s latency" and "totally sucks, at least 32s." or "totally sucks, > at > > least 64s" though the latter isn't possible with the default timeouts... > > > > I'm planning on adding a 'max' latency that's self-resetting instead of > > expanding the bucket upwards. I'm also contemplating expanding it down to > > 100us or even 10us since nda serves nvme drives which easily can be sub > > 100us. > > > > Warner > > What about using a log2/log10 engineering style binning of > 1, 2, 4, 8 us > 10, 20, 40, 80 us > 100, 200, 400, 800 us > ... > 10000000, 20000000, 40000000, 80000000 us > > This would give you a fairly fine grain in the high speed > area and cource grain in the not very likely areas, and > it all fits in a nice 32 ints. > I don't like that at all. it's the worst of both worlds. 1/2/5 makes more sense because the difference between 8 and 10 is tiny, and there's an extra bin per 1000 with your proposal. However, powers of two is completely sufficient to get the data out of the system and is optimal for fitting the fewest bins. Doing either your suggestion or 1/2/5 makes the bins non-uniform, which makes the P99 estimates I'm making from these numbers less accurate mathematically. More bins makes this more expensive since this is a linear search which we do on each I/O. Power of two matches dtrace (though ms instead of us, which I may change). So I'm not inclined to make arbitrary changes here based on aesthetics. I don't see a good reason to do so, and I see only extra costs (including retooling code that I've written to consume this) for changing. Warner From owner-svn-src-all@freebsd.org Fri Aug 25 18:27:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A920EDDE8BF; Fri, 25 Aug 2017 18:27:24 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x233.google.com (mail-io0-x233.google.com [IPv6:2607:f8b0:4001:c06::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 701456B838; Fri, 25 Aug 2017 18:27:24 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x233.google.com with SMTP id g33so1970766ioj.3; Fri, 25 Aug 2017 11:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=rMaMp9k+nKsLsbsFxMr5jivkmA7qNkxhQ18MSYXWVQM=; b=gliRbJUbsdBzBh+eRzWsBjQ7tpp5IBnDqahjVexVV+8krxPZ4QXQ8uIMiKPb0gGu72 HsqIlHOHJEKQ3c0IjJRPA8LBsoGZ+oMtvd3YNpYyPo+igwAsKk00BJXCl+JZ42nqJGD9 m87RCGAZPFImgDawORuDjflvWoGqMM2KYGvti5FQgJIM99LTLhLyckJkO/E6SvhBjt1R P3NU3pTplUrKdR6ceVPCYZJuKdT/27v/+qiGOVNJpxpzmdFpbm9jm4AXUC8f25QJ9wTM OgM+XnCXBWnRWPJ+dZa/opYDIYX2XuVDdF0ztLuLFEXls1pej6ekZe34ubhXw3r2NoUU anMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=rMaMp9k+nKsLsbsFxMr5jivkmA7qNkxhQ18MSYXWVQM=; b=UHDUfIGYbOQwQeREVLT538cX2E+nbe1WT+JBGB2biRPxn9ilTyvoUVv0xicY0d3q9V a3D530nTG2U3HSa6fPnsywFT3uPFI//qO6N3H2DQbf1gB7ndmHEYkO0Qp1WT5UUbPNri ETdLnrWdPp+pOx92wB50ZO6xQwsIjmZFibuFDr7yTmtiECA08iOuJtT+oSFVVJW5GOPL 7eXfQUFCM+4VpNTeq+KHvrKufJMZGg8z487VPxo4qr9EL5mHeOJ+zzNcw9RHnDaQy2lR Nb/yWlm8NIT4lqSGUs75F19snZbp3ueHlngHNpmQiRjBgiMco+CZoRFDfeHtbfyYN09N uBXg== X-Gm-Message-State: AHYfb5itkhFHd8bVcrO5GbmmNmWU4I0Nvx1uhrp4uHIXq0Fhr+p3lzeG LGp0Usb9X1jEfc99QvMo7ncgXylElZKW X-Received: by 10.107.190.195 with SMTP id o186mr8617166iof.330.1503685643782; Fri, 25 Aug 2017 11:27:23 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.24.66 with HTTP; Fri, 25 Aug 2017 11:27:03 -0700 (PDT) In-Reply-To: References: <201708232330.v7NNUPpV052276@repo.freebsd.org> From: Ed Maste Date: Fri, 25 Aug 2017 14:27:03 -0400 X-Google-Sender-Auth: yMnblHXhGQuN7_vO9RSc9JIhGgA Message-ID: Subject: Re: svn commit: r322824 - in head: lib/clang share/mk usr.bin/clang To: Ryan Libby Cc: John Baldwin , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , "freebsd-toolchain@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 18:27:24 -0000 On 25 August 2017 at 14:07, Ryan Libby wrote: > On Wed, Aug 23, 2017 at 4:30 PM, John Baldwin wrote: >> Author: jhb >> Date: Wed Aug 23 23:30:25 2017 >> New Revision: 322824 >> URL: https://svnweb.freebsd.org/changeset/base/322824 >> >> Log: >> Improve the coverage of debug symbols for MK_DEBUG_FILES. >> ... > This causes llvm to emit hundreds of new warnings [1] for > "DWARF2 only supports one section per compilation unit" > > Are these expected? Are they a concern? Should we silence them? > Is this an upstream llvm bug [2]? I'm not sure they were "expected" but I guess are an unsurprising consequence of building more things with debug. In any case they're not a concern. It is an llvm bug (the warning really ought not be emitted for empty sections), but upstream is probably not too concerned as (most? all) other platforms are not using dwarf2. The right answer for us is likely to just stop defaulting to dwarf2 (and specifying it via CFLAGS for kernel if necessary). From owner-svn-src-all@freebsd.org Fri Aug 25 18:30:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F629DDE973 for ; Fri, 25 Aug 2017 18:30:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A2B66B9E5 for ; Fri, 25 Aug 2017 18:30:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x232.google.com with SMTP id k22so2028212iod.2 for ; Fri, 25 Aug 2017 11:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=AlFcnb+2+qxCj6q2XpwRWtNEQqKP5/gDkzQqvA4MBeY=; b=qeA3s+egf0RBj1U4qqocdoHH+YSgZRdaBrtiswPLJhu/OVKVRcc4ioQ99oLBKIlAji QsETTs5Sdx6FGyEKZw1L+ehxxK1c46AqST78lp5ZNdmM0uN7hBmzHCZEO1myNriDkTim ARn4H7Gmnkn1xbbZEnGh+K+AS/G4OwlUyNOAbKbvl0snMSRzy4xVdxt1bwyCnOy3e+fF R24rkZwGLV2F0KXuTVA/gpH8JwGY5oLKhAeMnJHchoIeuyHVGI2XQvn7TNtv2X9V1afJ YGjGCKPOyV7XlIETkMCrrhkhj8yG7AKk2ksp5CvYga94o9xt84PYMFjFS5WJEPVXgaNH so+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=AlFcnb+2+qxCj6q2XpwRWtNEQqKP5/gDkzQqvA4MBeY=; b=sTWL7ICsk7F85rG3vQPjWeCditPibcIyz7K1y8q9sUiGDvAsKLPz05mkrBd8j8YSND eNNuUu8pjRr+zsnOYph7kSdFk2l3lnuusWae8bXHjGCyZIBZK5MbtToF82tQTr2VpwD3 DHgd+2cWM8edo56fYpO1XR/pB29s8uE6IRJlrbvHGnFh1era8XKb9YOg7+giQH9THlPS IvIXzpBYM1Teb0IAxfjPdIES0keL/F/MsdCnq/wC2kF5wQfIQfzd1LVHTsjGJ83oeEUg hpL+o+9gJrnafOI8dXzpj6qPfrbyvwfNrrjJHPiihWYmA4SVUyvRMqllk6cSnvKQ2uMR NqOg== X-Gm-Message-State: AHYfb5g2ZmOvL0O2y40WQcHG2baRgqNCOW9HACMhXQgy7V61q3jMeyL7 AYs9k+s9t1Ynq2Edwxj5sXX+AEa51DmU X-Received: by 10.107.17.19 with SMTP id z19mr9989886ioi.182.1503685811756; Fri, 25 Aug 2017 11:30:11 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.10.71 with HTTP; Fri, 25 Aug 2017 11:30:11 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201708232330.v7NNUPpV052276@repo.freebsd.org> From: Warner Losh Date: Fri, 25 Aug 2017 12:30:11 -0600 X-Google-Sender-Auth: o-iwCwuRe80unh0TWMMrZZDAXZo Message-ID: Subject: Re: svn commit: r322824 - in head: lib/clang share/mk usr.bin/clang To: Ed Maste Cc: Ryan Libby , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , John Baldwin , "freebsd-toolchain@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 18:30:12 -0000 On Fri, Aug 25, 2017 at 12:27 PM, Ed Maste wrote: > On 25 August 2017 at 14:07, Ryan Libby wrote: > > On Wed, Aug 23, 2017 at 4:30 PM, John Baldwin wrote: > >> Author: jhb > >> Date: Wed Aug 23 23:30:25 2017 > >> New Revision: 322824 > >> URL: https://svnweb.freebsd.org/changeset/base/322824 > >> > >> Log: > >> Improve the coverage of debug symbols for MK_DEBUG_FILES. > >> > ... > > This causes llvm to emit hundreds of new warnings [1] for > > "DWARF2 only supports one section per compilation unit" > > > > Are these expected? Are they a concern? Should we silence them? > > Is this an upstream llvm bug [2]? > > I'm not sure they were "expected" but I guess are an unsurprising > consequence of building more things with debug. In any case they're > not a concern. > > It is an llvm bug (the warning really ought not be emitted for empty > sections), but upstream is probably not too concerned as (most? all) > other platforms are not using dwarf2. > > The right answer for us is likely to just stop defaulting to dwarf2 > (and specifying it via CFLAGS for kernel if necessary). > What's the status of kicking gdb out of the tree? If we kick it out, we can stop doing dwarf2 and move to something more modern. Last time this issue came up, that was the decision, pending a few issues with the gdb port which I think John Baldwin is getting close to reaching closure on. Warner From owner-svn-src-all@freebsd.org Fri Aug 25 18:47:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46212DDEDF6; Fri, 25 Aug 2017 18:47:25 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10B296C1A6; Fri, 25 Aug 2017 18:47:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PIlOvl018387; Fri, 25 Aug 2017 18:47:24 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PIlOxV018386; Fri, 25 Aug 2017 18:47:24 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201708251847.v7PIlOxV018386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Fri, 25 Aug 2017 18:47:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322897 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 18:47:25 -0000 Author: alc Date: Fri Aug 25 18:47:23 2017 New Revision: 322897 URL: https://svnweb.freebsd.org/changeset/base/322897 Log: Correct a regression in the previous change, r322459. Specifically, the removal of the "blk" parameter from blst_meta_alloc() had the unintended effect of generating an out-of-range allocation when the cursor reaches the end of the tree if the number of managed blocks in the tree equals the so-called "radix" (which in the blist code is not the standard notion of what a radix is but rather the maximum number of leaves in a tree of the current height.) In other words, only certain swap configurations were affected, which is why earlier testing did not reveal the problem. Submitted by: Doug Moore Reported by: pho, kib Tested by: pho X-MFC with: r322459 Differential Revision: https://reviews.freebsd.org/D12106 Modified: head/sys/kern/subr_blist.c Modified: head/sys/kern/subr_blist.c ============================================================================== --- head/sys/kern/subr_blist.c Fri Aug 25 17:29:48 2017 (r322896) +++ head/sys/kern/subr_blist.c Fri Aug 25 18:47:23 2017 (r322897) @@ -251,6 +251,8 @@ blist_alloc(blist_t bl, daddr_t count) bl->bl_radix); if (blk != SWAPBLK_NONE) { bl->bl_cursor = blk + count; + if (bl->bl_cursor == bl->bl_blocks) + bl->bl_cursor = 0; return (blk); } else if (bl->bl_cursor != 0) bl->bl_cursor = 0; From owner-svn-src-all@freebsd.org Fri Aug 25 18:51:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CCDDDDEF5D; Fri, 25 Aug 2017 18:51:11 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BCA26C4B1; Fri, 25 Aug 2017 18:51:11 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PIpA2J020557; Fri, 25 Aug 2017 18:51:10 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PIpAKx020542; Fri, 25 Aug 2017 18:51:10 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708251851.v7PIpAKx020542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 25 Aug 2017 18:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322898 - head/bin/dd X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/bin/dd X-SVN-Commit-Revision: 322898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 18:51:11 -0000 Author: asomers Date: Fri Aug 25 18:51:10 2017 New Revision: 322898 URL: https://svnweb.freebsd.org/changeset/base/322898 Log: Pacify GCC on mips32 after r322893 Though technically correct, GCC complains about usingi a "%zd" format specifier for a long. Reported by: cem MFC after: 3 weeks X-MFC-With: 322893 Sponsored by: Spectra Logic Modified: head/bin/dd/args.c Modified: head/bin/dd/args.c ============================================================================== --- head/bin/dd/args.c Fri Aug 25 18:47:23 2017 (r322897) +++ head/bin/dd/args.c Fri Aug 25 18:51:10 2017 (r322898) @@ -185,7 +185,7 @@ f_bs(char *arg) res = get_num(arg); if (res < 1 || res > SSIZE_MAX) - errx(1, "bs must be between 1 and %zd", SSIZE_MAX); + errx(1, "bs must be between 1 and %zd", (ssize_t)SSIZE_MAX); in.dbsz = out.dbsz = (size_t)res; } @@ -196,7 +196,7 @@ f_cbs(char *arg) res = get_num(arg); if (res < 1 || res > SSIZE_MAX) - errx(1, "cbs must be between 1 and %zd", SSIZE_MAX); + errx(1, "cbs must be between 1 and %zd", (ssize_t)SSIZE_MAX); cbsz = (size_t)res; } @@ -242,7 +242,7 @@ f_ibs(char *arg) res = get_num(arg); if (res < 1 || res > SSIZE_MAX) errx(1, "ibs must be between 1 and %zd", - SSIZE_MAX); + (ssize_t)SSIZE_MAX); in.dbsz = (size_t)res; } } @@ -263,7 +263,7 @@ f_obs(char *arg) res = get_num(arg); if (res < 1 || res > SSIZE_MAX) errx(1, "obs must be between 1 and %zd", - SSIZE_MAX); + (ssize_t)SSIZE_MAX); out.dbsz = (size_t)res; } } From owner-svn-src-all@freebsd.org Fri Aug 25 18:57:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEEF7DDF189; Fri, 25 Aug 2017 18:57:39 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-wr0-x232.google.com (mail-wr0-x232.google.com [IPv6:2a00:1450:400c:c0c::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5CE676C82E; Fri, 25 Aug 2017 18:57:39 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-wr0-x232.google.com with SMTP id o76so1830984wrb.5; Fri, 25 Aug 2017 11:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=wdccCK024D+x2D8N6bED+Y/haj22zJqbxi6/1GQouBs=; b=iGnDHGMsoZ+JESl7DP/47Ehn9I5wJPfaDiZJDMxSUYal67noYcnD51+P0PO4/VTjPS kyQISkVezDSrEegCQ0Bgnuk24KJUYpYu1852FxoLJYkxGqI5MI15lpuAwSEpdNMtNV2F rkYs6YaF21hzRkwupvcbqfIP8M7E4bikgc120mPPyKYJyMXdzMUdS8vFi9IPIFbUSms5 BHtN+XdUlaxD711GXslWCjdIrk3vjE2ivZZnSvC0X5h0P5LAfJ6QLOgps0YhsuCNIhaR Mc3eDHzVOLXlERYlrsG4LJyP4UhS3QqHkpQvm6nZAHPfCMy/6kJvpuqlhC3THTTUoGIk vW4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=wdccCK024D+x2D8N6bED+Y/haj22zJqbxi6/1GQouBs=; b=ewKAL++7Z1J1pt+dRXUe7Ek5//J2lPRRPr7soOSFftYq4xS3uD/eUb6zSuj9gHr68w TInKpMie3tJegw4KYb7abo2eHpUg+l/ipRy0dhieCW4zGkEy+GA8p6+bhULotG69xsjk 6ixgHu3Be9SM/VRlwkbMPhSterOQ7ug9E2XHbjjMsHSwS9vmm79he3QjpkjyxhoGyETU eW+WT5TQRVKtXeJGWgcmK8tP3KlfuKKvlsVXzjNrpfkHjUkEFK6BV+qEo8EXukA/JP7U JilTvNtvpeoaS/McZrc/VN8lukZmLiwB1383PKE0atPfQMml0ITy6s/cKTOuFHu/LSE0 qUQw== X-Gm-Message-State: AHYfb5jZgegupzXkpwI4XBRlK/P6hnM66guJ5OUDWLuGrRi0C6jBSvG9 NLoH+jVQAH/WgyBw+xJgftPw99ZAww== X-Received: by 10.223.174.225 with SMTP id y88mr7134509wrc.264.1503687457524; Fri, 25 Aug 2017 11:57:37 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.28.56.194 with HTTP; Fri, 25 Aug 2017 11:57:37 -0700 (PDT) In-Reply-To: References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> From: Alan Somers Date: Fri, 25 Aug 2017 12:57:37 -0600 X-Google-Sender-Auth: PXJUpPML6fmbkOf5fNz4DvzEko0 Message-ID: Subject: Re: svn commit: r322893 - head/bin/dd To: "Conrad E. Meyer" Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 18:57:39 -0000 That doesn't work either before or after this change. -Alan On Fri, Aug 25, 2017 at 11:20 AM, Conrad Meyer wrote: > Well, not negative, just large uint64_t numbers that would be negative > as off_t (int64_t). > > E.g., dd if=/dev/kmem bs=1 iseek=0xfffff...foo count=8. I think we > would like that to work. I don't recall whether it does or not before > this change. > > Best, > Conrad > > On Fri, Aug 25, 2017 at 10:08 AM, Alan Somers wrote: >> Nope. Do you mean negative offsets for the iseek argument? I didn't >> know you could do that. >> >> On Fri, Aug 25, 2017 at 10:59 AM, Conrad Meyer wrote: >>> Hi Alan, >>> >>> By any chance did you test this change with /dev/kmem and kernel >>> addresses ("negative" off_t values)? >>> >>> Thanks, >>> Conrad From owner-svn-src-all@freebsd.org Fri Aug 25 18:58:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6914DDF1FD; Fri, 25 Aug 2017 18:58:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7990F6C976; Fri, 25 Aug 2017 18:58:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::d91a:7f20:7200:12cd] (unknown [IPv6:2001:470:7a58:0:d91a:7f20:7200:12cd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 6D21630D4F; Fri, 25 Aug 2017 20:58:31 +0200 (CEST) From: Dimitry Andric Message-Id: <00CB256A-DC74-4D65-B21E-16524A21AFF3@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_D5074571-40BC-44C3-9F2A-EE3ECC517CAE"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r322824 - in head: lib/clang share/mk usr.bin/clang Date: Fri, 25 Aug 2017 20:58:30 +0200 In-Reply-To: Cc: John Baldwin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Ryan Libby References: <201708232330.v7NNUPpV052276@repo.freebsd.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 18:58:33 -0000 --Apple-Mail=_D5074571-40BC-44C3-9F2A-EE3ECC517CAE Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 25 Aug 2017, at 20:07, Ryan Libby wrote: > > On Wed, Aug 23, 2017 at 4:30 PM, John Baldwin wrote: >> Author: jhb >> Date: Wed Aug 23 23:30:25 2017 >> New Revision: 322824 >> URL: https://svnweb.freebsd.org/changeset/base/322824 >> >> Log: >> Improve the coverage of debug symbols for MK_DEBUG_FILES. >> >> - Include debug symbols in static libraries. This permits binaries >> to include debug symbols for functions obtained from static libraries. >> - Permit the C/C++ compiler flags added for MK_DEBUG_FILES to be >> overridden by setting DEBUG_FILES_CFLAGS. Use this to limit the debug >> information for llvm libraries and binaries. >> >> Reviewed by: emaste >> Sponsored by: DARPA / AFRL >> Differential Revision: https://reviews.freebsd.org/D12025 >> >> Added: >> head/lib/clang/Makefile.inc (contents, props changed) >> Modified: >> head/share/mk/bsd.lib.mk >> head/share/mk/bsd.prog.mk >> head/share/mk/bsd.sys.mk >> head/usr.bin/clang/Makefile.inc > > This causes llvm to emit hundreds of new warnings [1] for > "DWARF2 only supports one section per compilation unit" > > Are these expected? Are they a concern? Should we silence them? > Is this an upstream llvm bug [2]? Last time this came up, I put up an upstream review to fix the warning, since it is nonsensical to warn about a non-code section. I've pinged the review again, but now I'm inclined to just commit it. :) -Dimitry --Apple-Mail=_D5074571-40BC-44C3-9F2A-EE3ECC517CAE Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.1 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWaBzVgAKCRCwXqMKLiCW o5XIAJwNbU4Q8dtOpUErFUlLpdnIjAtfyACgzdsrifvRBcymncSXM+se+rDvwc8= =8ugc -----END PGP SIGNATURE----- --Apple-Mail=_D5074571-40BC-44C3-9F2A-EE3ECC517CAE-- From owner-svn-src-all@freebsd.org Fri Aug 25 18:59:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F902DDF26E for ; Fri, 25 Aug 2017 18:59:06 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BB5B6CAB5 for ; Fri, 25 Aug 2017 18:59:05 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 525eebba-89c7-11e7-950d-03a3531dacf2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 525eebba-89c7-11e7-950d-03a3531dacf2; Fri, 25 Aug 2017 18:58:03 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v7PIvtqV004074; Fri, 25 Aug 2017 12:57:55 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1503687475.56799.16.camel@freebsd.org> Subject: Re: svn commit: r322893 - head/bin/dd From: Ian Lepore To: Warner Losh , Matt Joras Cc: "Conrad E. Meyer" , Alan Somers , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Fri, 25 Aug 2017 12:57:55 -0600 In-Reply-To: References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> <4b016f89-61c5-fc8a-a36a-aca8166c369e@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 18:59:06 -0000 On Fri, 2017-08-25 at 12:09 -0600, Warner Losh wrote: > On Fri, Aug 25, 2017 at 12:02 PM, Matt Joras > wrote: > > > > > On 08/25/2017 10:17, Conrad Meyer wrote: > > > > > > This change seems to break buildworld on MIPS: > > > > > > /home/cem/head.svn/bin/dd/args.c: In function 'f_bs': > > > /home/cem/head.svn/bin/dd/args.c:188: warning: format '%zd' > > > expects > > > type 'signed size_t', but argument 3 has type 'long int' > > > /home/cem/head.svn/bin/dd/args.c: In function 'f_cbs': > > > /home/cem/head.svn/bin/dd/args.c:199: warning: format '%zd' > > > expects > > > type 'signed size_t', but argument 3 has type 'long int' > > > /home/cem/head.svn/bin/dd/args.c: In function 'f_ibs': > > > /home/cem/head.svn/bin/dd/args.c:245: warning: format '%zd' > > > expects > > > type 'signed size_t', but argument 3 has type 'long int' > > > /home/cem/head.svn/bin/dd/args.c: In function 'f_obs': > > > /home/cem/head.svn/bin/dd/args.c:266: warning: format '%zd' > > > expects > > > type 'signed size_t', but argument 3 has type 'long int' > > > > > > (Yes, it's odd that the SSIZE_MAX constant has 'long' type.) > > > > > SSIZE_MAX should have type long, since ssize_t is a long on mips > > (and > > other arches besides i386 and arm). > > > > Re: the build failure, that's in the GCC C format string checking, > > so > > perhaps it's more accurate to say this breaks the (in-tree) GCC > > build. > > %zd is the right format specifier for ssize_t. I guess GCC's format > > string checking is getting confused because SSIZE_MAX is a constant > > that > > expands to type long. Perhaps casting to ssize_t would GCC happier, > > but > > that looks rather wrong. > > > This is why it was cast in the first place due to issues with exact > type. > Maybe we should put the casts back for the printfs. > > Warner I think the right fix is to define SSIZE_MAX correctly based on the type of ssize_t.  The x86 and powerpc _limits.h files get this right, it looks like mips is the only one with both 32 and 64-bit support that doesn't define SSIZE_MAX based on ssize_t type. -- Ian From owner-svn-src-all@freebsd.org Fri Aug 25 19:06:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A87FDDF548; Fri, 25 Aug 2017 19:06:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E198E6D1EA; Fri, 25 Aug 2017 19:06:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PJ6aAl026633; Fri, 25 Aug 2017 19:06:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PJ6a4C026632; Fri, 25 Aug 2017 19:06:36 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708251906.v7PJ6a4C026632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Aug 2017 19:06:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322899 - head/usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/usr.bin/truss X-SVN-Commit-Revision: 322899 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 19:06:38 -0000 Author: jhb Date: Fri Aug 25 19:06:36 2017 New Revision: 322899 URL: https://svnweb.freebsd.org/changeset/base/322899 Log: Decode arguments passed to thr_set_name(). MFC after: 1 month Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Fri Aug 25 18:51:10 2017 (r322898) +++ head/usr.bin/truss/syscalls.c Fri Aug 25 19:06:36 2017 (r322899) @@ -483,6 +483,8 @@ static struct syscall decoded_syscalls[] = { .args = { { Long, 0 }, { Signal, 1 } } }, { .name = "thr_self", .ret_type = 1, .nargs = 1, .args = { { Ptr, 0 } } }, + { .name = "thr_set_name", .ret_type = 1, .nargs = 2, + .args = { { Long, 0 }, { Name, 1 } } }, { .name = "truncate", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { QuadHex | IN, 1 } } }, #if 0 From owner-svn-src-all@freebsd.org Fri Aug 25 19:27:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C08E0DDFCF7; Fri, 25 Aug 2017 19:27:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 961906DCA1; Fri, 25 Aug 2017 19:27:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 0457410AB01; Fri, 25 Aug 2017 15:27:05 -0400 (EDT) From: John Baldwin To: Warner Losh Cc: Ed Maste , Ryan Libby , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , "freebsd-toolchain@freebsd.org" Subject: Re: svn commit: r322824 - in head: lib/clang share/mk usr.bin/clang Date: Fri, 25 Aug 2017 11:53:59 -0700 Message-ID: <4019876.lu34otUPCV@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201708232330.v7NNUPpV052276@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 25 Aug 2017 15:27:05 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 19:27:06 -0000 On Friday, August 25, 2017 12:30:11 PM Warner Losh wrote: > On Fri, Aug 25, 2017 at 12:27 PM, Ed Maste wrote: > > > On 25 August 2017 at 14:07, Ryan Libby wrote: > > > On Wed, Aug 23, 2017 at 4:30 PM, John Baldwin wrote: > > >> Author: jhb > > >> Date: Wed Aug 23 23:30:25 2017 > > >> New Revision: 322824 > > >> URL: https://svnweb.freebsd.org/changeset/base/322824 > > >> > > >> Log: > > >> Improve the coverage of debug symbols for MK_DEBUG_FILES. > > >> > > ... > > > This causes llvm to emit hundreds of new warnings [1] for > > > "DWARF2 only supports one section per compilation unit" > > > > > > Are these expected? Are they a concern? Should we silence them? > > > Is this an upstream llvm bug [2]? > > > > I'm not sure they were "expected" but I guess are an unsurprising > > consequence of building more things with debug. In any case they're > > not a concern. > > > > It is an llvm bug (the warning really ought not be emitted for empty > > sections), but upstream is probably not too concerned as (most? all) > > other platforms are not using dwarf2. > > > > The right answer for us is likely to just stop defaulting to dwarf2 > > (and specifying it via CFLAGS for kernel if necessary). > > > > What's the status of kicking gdb out of the tree? If we kick it out, we can > stop doing dwarf2 and move to something more modern. Last time this issue > came up, that was the decision, pending a few issues with the gdb port > which I think John Baldwin is getting close to reaching closure on. gdb is mostly disabled in-tree, but there is no in-tree replacement for the kgdb stack trace from /usr/sbin/crashinfo if the gdb port is not installed, and there won't be until lldb grows some kernel support. OTOH, for most platforms /usr/bin/gdb is now disabled (hidden in /usr/libexec) so isn't relevant for userland binaries certainly. The kernel probably doesn't benefit much from DWARF > 2 (except perhaps for .dwo files if we decide to use those at some point) as the other things added since DWARF2 are largely about handling C++ features like r-value references, etc. -- John Baldwin From owner-svn-src-all@freebsd.org Fri Aug 25 19:41:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C043EDE0103; Fri, 25 Aug 2017 19:41:39 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B4CB6E473; Fri, 25 Aug 2017 19:41:39 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PJfcXh040920; Fri, 25 Aug 2017 19:41:38 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PJfcI5040915; Fri, 25 Aug 2017 19:41:38 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201708251941.v7PJfcI5040915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 25 Aug 2017 19:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322900 - in head: . sys/netinet sys/sys usr.bin/netstat X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head: . sys/netinet sys/sys usr.bin/netstat X-SVN-Commit-Revision: 322900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 19:41:39 -0000 Author: sbruno Date: Fri Aug 25 19:41:38 2017 New Revision: 322900 URL: https://svnweb.freebsd.org/changeset/base/322900 Log: Use counter(9) for PLPMTUD counters. Remove unused PLPMTUD sysctl counters. Bump UPDATING and FreeBSD Version to indicate a rebuild is required. Submitted by: kevin.bowling@kev009.com Reviewed by: jtl Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D12003 Modified: head/UPDATING head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_var.h head/sys/sys/param.h head/usr.bin/netstat/inet.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Aug 25 19:06:36 2017 (r322899) +++ head/UPDATING Fri Aug 25 19:41:38 2017 (r322900) @@ -51,6 +51,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20170825: + Move PMTUD blackhole counters to TCPSTATS and remove them from bare + sysctl values. Minor nit, but requires a rebuild of both world/kernel + to complete. + 20170814: "make check" behavior (made in ^/head@r295380) has been changed to execute from a limited sandbox, as opposed to executing from Modified: head/sys/netinet/tcp_timer.c ============================================================================== --- head/sys/netinet/tcp_timer.c Fri Aug 25 19:06:36 2017 (r322899) +++ head/sys/netinet/tcp_timer.c Fri Aug 25 19:41:38 2017 (r322900) @@ -148,29 +148,6 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_de &VNET_NAME(tcp_pmtud_blackhole_detect), 0, "Path MTU Discovery Black Hole Detection Enabled"); -static VNET_DEFINE(int, tcp_pmtud_blackhole_activated); -#define V_tcp_pmtud_blackhole_activated \ - VNET(tcp_pmtud_blackhole_activated) -SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_activated, - CTLFLAG_RD|CTLFLAG_VNET, - &VNET_NAME(tcp_pmtud_blackhole_activated), 0, - "Path MTU Discovery Black Hole Detection, Activation Count"); - -static VNET_DEFINE(int, tcp_pmtud_blackhole_activated_min_mss); -#define V_tcp_pmtud_blackhole_activated_min_mss \ - VNET(tcp_pmtud_blackhole_activated_min_mss) -SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_activated_min_mss, - CTLFLAG_RD|CTLFLAG_VNET, - &VNET_NAME(tcp_pmtud_blackhole_activated_min_mss), 0, - "Path MTU Discovery Black Hole Detection, Activation Count at min MSS"); - -static VNET_DEFINE(int, tcp_pmtud_blackhole_failed); -#define V_tcp_pmtud_blackhole_failed VNET(tcp_pmtud_blackhole_failed) -SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_failed, - CTLFLAG_RD|CTLFLAG_VNET, - &VNET_NAME(tcp_pmtud_blackhole_failed), 0, - "Path MTU Discovery Black Hole Detection, Failure Count"); - #ifdef INET static VNET_DEFINE(int, tcp_pmtud_blackhole_mss) = 1200; #define V_tcp_pmtud_blackhole_mss VNET(tcp_pmtud_blackhole_mss) @@ -772,7 +749,7 @@ tcp_timer_rexmt(void * xtp) tp->t_maxseg > V_tcp_v6pmtud_blackhole_mss) { /* Use the sysctl tuneable blackhole MSS. */ tp->t_maxseg = V_tcp_v6pmtud_blackhole_mss; - V_tcp_pmtud_blackhole_activated++; + TCPSTAT_INC(tcps_pmtud_blackhole_activated); } else if (isipv6) { /* Use the default MSS. */ tp->t_maxseg = V_tcp_v6mssdflt; @@ -781,7 +758,7 @@ tcp_timer_rexmt(void * xtp) * minmss. */ tp->t_flags2 &= ~TF2_PLPMTU_PMTUD; - V_tcp_pmtud_blackhole_activated_min_mss++; + TCPSTAT_INC(tcps_pmtud_blackhole_activated_min_mss); } #endif #if defined(INET6) && defined(INET) @@ -791,7 +768,7 @@ tcp_timer_rexmt(void * xtp) if (tp->t_maxseg > V_tcp_pmtud_blackhole_mss) { /* Use the sysctl tuneable blackhole MSS. */ tp->t_maxseg = V_tcp_pmtud_blackhole_mss; - V_tcp_pmtud_blackhole_activated++; + TCPSTAT_INC(tcps_pmtud_blackhole_activated); } else { /* Use the default MSS. */ tp->t_maxseg = V_tcp_mssdflt; @@ -800,7 +777,7 @@ tcp_timer_rexmt(void * xtp) * minmss. */ tp->t_flags2 &= ~TF2_PLPMTU_PMTUD; - V_tcp_pmtud_blackhole_activated_min_mss++; + TCPSTAT_INC(tcps_pmtud_blackhole_activated_min_mss); } #endif /* @@ -823,7 +800,7 @@ tcp_timer_rexmt(void * xtp) tp->t_flags2 |= TF2_PLPMTU_PMTUD; tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE; tp->t_maxseg = tp->t_pmtud_saved_maxseg; - V_tcp_pmtud_blackhole_failed++; + TCPSTAT_INC(tcps_pmtud_blackhole_failed); /* * Reset the slow-start flight size as it * may depend on the new MSS. Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Fri Aug 25 19:06:36 2017 (r322899) +++ head/sys/netinet/tcp_var.h Fri Aug 25 19:41:38 2017 (r322900) @@ -580,6 +580,11 @@ struct tcpstat { uint64_t tcps_sig_err_sigopt; /* No signature expected by socket */ uint64_t tcps_sig_err_nosigopt; /* No signature provided by segment */ + /* Path MTU Discovery Black Hole Detection related stats */ + uint64_t tcps_pmtud_blackhole_activated; /* Black Hole Count */ + uint64_t tcps_pmtud_blackhole_activated_min_mss; /* BH at min MSS Count */ + uint64_t tcps_pmtud_blackhole_failed; /* Black Hole Failure Count */ + uint64_t _pad[12]; /* 6 UTO, 6 TBD */ }; Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Fri Aug 25 19:06:36 2017 (r322899) +++ head/sys/sys/param.h Fri Aug 25 19:41:38 2017 (r322900) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200041 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200042 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Fri Aug 25 19:06:36 2017 (r322899) +++ head/usr.bin/netstat/inet.c Fri Aug 25 19:41:38 2017 (r322900) @@ -752,12 +752,24 @@ tcp_stats(u_long off, const char *name, int af1 __unus "{N:/time%s unexpected signature received}\n"); p(tcps_sig_err_nosigopt, "\t{:no-signature-provided/%ju} " "{N:/time%s no signature provided by segment}\n"); + + xo_close_container("tcp-signature"); + xo_open_container("pmtud"); + + p(tcps_pmtud_blackhole_activated, "\t{:pmtud-activated/%ju} " + "{N:/Path MTU discovery black hole detection activation%s}\n"); + p(tcps_pmtud_blackhole_activated_min_mss, + "\t{:pmtud-activated-min-mss/%ju} " + "{N:/Path MTU discovery black hole detection min MSS activation%s}\n"); + p(tcps_pmtud_blackhole_failed, "\t{:pmtud-failed/%ju} " + "{N:/Path MTU discovery black hole detection failure%s}\n"); #undef p #undef p1a #undef p2 #undef p2a #undef p3 - xo_close_container("tcp-signature"); + xo_close_container("pmtud"); + xo_open_container("TCP connection count by state"); xo_emit("{T:/TCP connection count by state}:\n"); From owner-svn-src-all@freebsd.org Fri Aug 25 21:13:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7109CDE1ABC; Fri, 25 Aug 2017 21:13:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 57A2070F1D; Fri, 25 Aug 2017 21:13:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v7PLDlem025824 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 25 Aug 2017 14:13:47 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v7PLDlo3025823; Fri, 25 Aug 2017 14:13:47 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 25 Aug 2017 14:13:47 -0700 From: Gleb Smirnoff To: Sean Bruno Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322900 - in head: . sys/netinet sys/sys usr.bin/netstat Message-ID: <20170825211347.GO1071@FreeBSD.org> References: <201708251941.v7PJfcI5040915@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201708251941.v7PJfcI5040915@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 21:13:54 -0000 Sean, On Fri, Aug 25, 2017 at 07:41:38PM +0000, Sean Bruno wrote: S> Modified: head/sys/netinet/tcp_var.h S> ============================================================================== S> --- head/sys/netinet/tcp_var.h Fri Aug 25 19:06:36 2017 (r322899) S> +++ head/sys/netinet/tcp_var.h Fri Aug 25 19:41:38 2017 (r322900) S> @@ -580,6 +580,11 @@ struct tcpstat { S> uint64_t tcps_sig_err_sigopt; /* No signature expected by socket */ S> uint64_t tcps_sig_err_nosigopt; /* No signature provided by segment */ S> S> + /* Path MTU Discovery Black Hole Detection related stats */ S> + uint64_t tcps_pmtud_blackhole_activated; /* Black Hole Count */ S> + uint64_t tcps_pmtud_blackhole_activated_min_mss; /* BH at min MSS Count */ S> + uint64_t tcps_pmtud_blackhole_failed; /* Black Hole Failure Count */ S> + S> uint64_t _pad[12]; /* 6 UTO, 6 TBD */ S> }; You may have used space in the _pad, and won't need to bump __FreeBSD_version or update UPDATING. This is what for these spares were made for :) -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Fri Aug 25 21:29:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80A1ADE1CFB; Fri, 25 Aug 2017 21:29:50 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D673713C7; Fri, 25 Aug 2017 21:29:50 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 59CC91700B; Fri, 25 Aug 2017 21:29:49 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 41F738769; Fri, 25 Aug 2017 21:29:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id 2kf16NeG8ST4; Fri, 25 Aug 2017 21:29:44 +0000 (UTC) Subject: Re: svn commit: r306512 - in head/sys: kern sys DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 3F2B48763 To: Konstantin Belousov Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201609301727.u8UHRIgD051373@repo.freebsd.org> <6ea06065-ea5c-b83b-3854-224626be0d77@FreeBSD.org> <20170825103534.GK1700@kib.kiev.ua> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: Date: Fri, 25 Aug 2017 14:29:28 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170825103534.GK1700@kib.kiev.ua> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SMKtgHVDJUU7B7Ljl2KSn0sxmOTpFiBl3" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 21:29:50 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --SMKtgHVDJUU7B7Ljl2KSn0sxmOTpFiBl3 Content-Type: multipart/mixed; boundary="E5JqXpauGdNtMJa8VsIOOAsUlndGXmoRe"; protected-headers="v1" From: Bryan Drewery To: Konstantin Belousov Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r306512 - in head/sys: kern sys References: <201609301727.u8UHRIgD051373@repo.freebsd.org> <6ea06065-ea5c-b83b-3854-224626be0d77@FreeBSD.org> <20170825103534.GK1700@kib.kiev.ua> In-Reply-To: <20170825103534.GK1700@kib.kiev.ua> --E5JqXpauGdNtMJa8VsIOOAsUlndGXmoRe Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 8/25/2017 3:35 AM, Konstantin Belousov wrote: > On Thu, Aug 24, 2017 at 08:18:03PM -0700, Bryan Drewery wrote: >> On 9/30/2016 10:27 AM, Mateusz Guzik wrote: >>> Author: mjg >>> Date: Fri Sep 30 17:27:17 2016 >>> New Revision: 306512 >>> URL: https://svnweb.freebsd.org/changeset/base/306512 >>> >>> Log: >>> vfs: batch free vnodes in per-mnt lists >>> =20 >>> Previously free vnodes would always by directly returned to the glo= bal >>> LRU list. With this change up to mnt_free_list_batch vnodes are col= lected >>> first. >>> =20 >>> syncer runs always return the batch regardless of its size. >>> =20 >>> While vnodes on per-mnt lists are not counted as free, they can be >>> returned in case of vnode shortage. >>> =20 >>> Reviewed by: kib >>> Tested by: pho >>> >>> Modified: >>> head/sys/kern/vfs_mount.c >>> head/sys/kern/vfs_subr.c >>> head/sys/sys/mount.h >>> head/sys/sys/vnode.h >>> >> ... >>> @@ -2753,17 +2824,25 @@ _vhold(struct vnode *vp, bool locked) >>> * Remove a vnode from the free list, mark it as in use, >>> * and put it on the active list. >>> */ >>> - mtx_lock(&vnode_free_list_mtx); >>> - TAILQ_REMOVE(&vnode_free_list, vp, v_actfreelist); >>> - freevnodes--; >>> - vp->v_iflag &=3D ~VI_FREE; >>> + mp =3D vp->v_mount; >>> + mtx_lock(&mp->mnt_listmtx); >> ^^ >> >>> + if ((vp->v_mflag & VMP_TMPMNTFREELIST) !=3D 0) { >>> + TAILQ_REMOVE(&mp->mnt_tmpfreevnodelist, vp, v_actfreelist); >>> + mp->mnt_tmpfreevnodelistsize--; >>> + vp->v_mflag &=3D ~VMP_TMPMNTFREELIST; >>> + } else { >>> + mtx_lock(&vnode_free_list_mtx); >>> + TAILQ_REMOVE(&vnode_free_list, vp, v_actfreelist); >>> + freevnodes--; >>> + mtx_unlock(&vnode_free_list_mtx); >>> + } >>> KASSERT((vp->v_iflag & VI_ACTIVE) =3D=3D 0, >>> ("Activating already active vnode")); >>> + vp->v_iflag &=3D ~VI_FREE; >>> vp->v_iflag |=3D VI_ACTIVE; >>> - mp =3D vp->v_mount; >>> TAILQ_INSERT_HEAD(&mp->mnt_activevnodelist, vp, v_actfreelist); >>> mp->mnt_activevnodelistsize++; >>> - mtx_unlock(&vnode_free_list_mtx); >>> + mtx_unlock(&mp->mnt_listmtx); >>> refcount_acquire(&vp->v_holdcnt); >>> if (!locked) >>> VI_UNLOCK(vp); >>> @@ -2819,21 +2898,25 @@ _vdrop(struct vnode *vp, bool locked) >>> if ((vp->v_iflag & VI_OWEINACT) =3D=3D 0) { >>> vp->v_iflag &=3D ~VI_ACTIVE; >>> mp =3D vp->v_mount; >>> - mtx_lock(&vnode_free_list_mtx); >>> + mtx_lock(&mp->mnt_listmtx); >> ^^ >> >> If code runs getnewvnode() and then immediately runs vhold() or vrele(= ), >> without first running insmntque(vp, mp), then vp->v_mount is NULL here= >> and the lock/freelist dereferencing just panic. > getnewvnode() returns vref-ed vnode, i.e. both hold and use counts are > set to 1. What is the use case there which requires vhold-ing vnode > without finishing its construction ? None that I can think of. For vhold I was just observing that a NULL dereference is possible. >=20 >> Locking the vnode and then using vgone() and vput() on it avoids the >> issue since it marks the vnode VI_DOOMED and instead frees it in >> _vdrop() rather than try to re-add it to its NULL per-mount free list.= > This is the common pattern where insmntque() fails. >=20 >> >> I'm not sure what the right thing here is. Is it a requirement to >> insmntque() a new vnode immediately, or to vgone() it before releasing= >> it if was just returned from getnewvnode()? > These are the only uses of a newly allocated vnode which make sense. > Do you need this for something that does not happen in the svn tree ? Outside of the tree in OneFS, we have some code that does getnewvnode(), then adds the unlocked vnode to a kqueue event list (it's actually very complicated compared to the basic description), and then does insmntque. The event list registration is failing in a stress run and it only does a vrele in this case. I need to change it to lock/vgone/vrele (or swap the event registration and insmntque calls of which I'm unsure on the impact). Previously the vrele was enough, and not vgone too, since the vnode was just added back to the global free list. But now the v_mount is required since the free list is per-mount. It is trivial for me to fix the panic I am running into, but it feels like there's a bug in _vdrop now due to this commit and I want to be sure I follow through with it being fixed properly. My confusion/question is probably about what the real distinction here is between using vgone before vrele to cause the vnode to be free'd and not using vgone and causing it to go back into the free list instead - which I cannot do now without swapping the calls. It seems to me that an assert would now make sense in the _vdrop !VI_DOOMED case since a v_mount is required to add back into the free list, and probably _vhold, such as: VNASSERT(mp !=3D NULL, vn, ("%s: not on a mount vnode list")); Or we just add it back to the global mount list in _vdrop as it was supported before with something like: https://people.freebsd.org/~bdrewery/patches/vdrop-global-list.diff >=20 >> >> Perhaps these cases should assert that v_mount is not NULL or handle t= he >> odd case and just free the vnode instead, or can it still just add to >> the global vnode_free_list if mp is NULL? >> >> The old code handled the case fine since the freelist was global and n= ot >> per-mount. 'mp' was only dereferenced below if the vnode had been >> active, which was not the case for my example. >=20 --=20 Regards, Bryan Drewery --E5JqXpauGdNtMJa8VsIOOAsUlndGXmoRe-- --SMKtgHVDJUU7B7Ljl2KSn0sxmOTpFiBl3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJZoJa5AAoJEDXXcbtuRpfPXXgIANkXmvByc7MGNIdvJFyLRxzT ZSiPuhoshBmaE5lk2ydctVikPPqp7ntFF3k7+8hwEGHw1+AySLIq+/aQSSeb3nbL zNO+QyNTlDeUeyFY4Ij08hwmEbSF+ltwihivoiNbeMDA5t3a8QaTlW8Rsl2J1tqf TGjEpiyuukLK6JZY/z2MVfui4viQtM5hfXYDGe6g54jgDSjCkZbI/96wp2AKvIxs Bi15Iyjqddmhze5mVbfmzLNBjwUaL6/PMntGNpwQ1J9OeillUPYzTb82QuJ43FjP g0ix4wY+1HzctlnUarTqnlU84cPrMKoi0doghrZwa8iutEsvxxmet/CYLeTIZXQ= =gpwn -----END PGP SIGNATURE----- --SMKtgHVDJUU7B7Ljl2KSn0sxmOTpFiBl3-- From owner-svn-src-all@freebsd.org Fri Aug 25 21:38:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04E47DE1ED0; Fri, 25 Aug 2017 21:38:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B40D8717D5; Fri, 25 Aug 2017 21:38:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PLcT8W088391; Fri, 25 Aug 2017 21:38:29 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PLcTs1088390; Fri, 25 Aug 2017 21:38:29 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708252138.v7PLcTs1088390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 25 Aug 2017 21:38:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322901 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 322901 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 21:38:31 -0000 Author: imp Date: Fri Aug 25 21:38:29 2017 New Revision: 322901 URL: https://svnweb.freebsd.org/changeset/base/322901 Log: Add feature codes from NVMe 1.3 specification: o Automomous Power State Transition o Host Memory Buffer o Timestamp o Keep Alive Timer o Host Controlled Thermal Management o Non-Operational Power State Config Also note that feature codes 0x78-0x7f are reserved for the NVMe Management Interface. Sponsored by: Netflix Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Fri Aug 25 19:41:38 2017 (r322900) +++ head/sys/dev/nvme/nvme.h Fri Aug 25 21:38:29 2017 (r322901) @@ -397,7 +397,14 @@ enum nvme_feature { NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION = 0x09, NVME_FEAT_WRITE_ATOMICITY = 0x0A, NVME_FEAT_ASYNC_EVENT_CONFIGURATION = 0x0B, - /* 0x0C-0x7F - reserved */ + NVME_FEAT_AUTONOMOUS_POWER_STATE_TRANSITION = 0x0C, + NVME_FEAT_HOST_MEMORY_BUFFER = 0x0D, + NVME_FEAT_TIMESTAMP = 0x0E, + NVME_FEAT_KEEP_ALIVE_TIMER = 0x0F, + NVME_FEAT_HOST_CONTROLLED_THERMAL_MGMT = 0x10, + NVME_FEAT_NON_OP_POWER_STATE_CONFIG = 0x11, + /* 0x12-0x77 - reserved */ + /* 0x78-0x7f - NVMe Management Interface */ NVME_FEAT_SOFTWARE_PROGRESS_MARKER = 0x80, /* 0x81-0xBF - command set specific (reserved) */ /* 0xC0-0xFF - vendor specific */ From owner-svn-src-all@freebsd.org Fri Aug 25 21:38:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78652DE1F0B; Fri, 25 Aug 2017 21:38:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A2607185A; Fri, 25 Aug 2017 21:38:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PLcddi088450; Fri, 25 Aug 2017 21:38:39 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PLcd3q088446; Fri, 25 Aug 2017 21:38:39 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708252138.v7PLcd3q088446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 25 Aug 2017 21:38:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322902 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 322902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 21:38:40 -0000 Author: imp Date: Fri Aug 25 21:38:38 2017 New Revision: 322902 URL: https://svnweb.freebsd.org/changeset/base/322902 Log: NVME Namespace ID is 32-bits, so widen interface to reflect that. Sponsored by: Netflix Modified: head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_ctrlr_cmd.c head/sys/dev/nvme/nvme_ns.c head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Fri Aug 25 21:38:29 2017 (r322901) +++ head/sys/dev/nvme/nvme_ctrlr.c Fri Aug 25 21:38:38 2017 (r322902) @@ -460,7 +460,7 @@ static int nvme_ctrlr_construct_namespaces(struct nvme_controller *ctrlr) { struct nvme_namespace *ns; - int i; + uint32_t i; for (i = 0; i < min(ctrlr->cdata.nn, NVME_MAX_NAMESPACES); i++) { ns = &ctrlr->ns[i]; Modified: head/sys/dev/nvme/nvme_ctrlr_cmd.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr_cmd.c Fri Aug 25 21:38:29 2017 (r322901) +++ head/sys/dev/nvme/nvme_ctrlr_cmd.c Fri Aug 25 21:38:38 2017 (r322902) @@ -52,7 +52,7 @@ nvme_ctrlr_cmd_identify_controller(struct nvme_control } void -nvme_ctrlr_cmd_identify_namespace(struct nvme_controller *ctrlr, uint16_t nsid, +nvme_ctrlr_cmd_identify_namespace(struct nvme_controller *ctrlr, uint32_t nsid, void *payload, nvme_cb_fn_t cb_fn, void *cb_arg) { struct nvme_request *req; Modified: head/sys/dev/nvme/nvme_ns.c ============================================================================== --- head/sys/dev/nvme/nvme_ns.c Fri Aug 25 21:38:29 2017 (r322901) +++ head/sys/dev/nvme/nvme_ns.c Fri Aug 25 21:38:38 2017 (r322902) @@ -476,7 +476,7 @@ nvme_ns_bio_process(struct nvme_namespace *ns, struct } int -nvme_ns_construct(struct nvme_namespace *ns, uint16_t id, +nvme_ns_construct(struct nvme_namespace *ns, uint32_t id, struct nvme_controller *ctrlr) { struct nvme_completion_poll_status status; Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Fri Aug 25 21:38:29 2017 (r322901) +++ head/sys/dev/nvme/nvme_private.h Fri Aug 25 21:38:38 2017 (r322902) @@ -225,8 +225,8 @@ struct nvme_namespace { struct nvme_controller *ctrlr; struct nvme_namespace_data data; - uint16_t id; - uint16_t flags; + uint32_t id; + uint32_t flags; struct cdev *cdev; void *cons_cookie[NVME_MAX_CONSUMERS]; uint32_t stripesize; @@ -356,7 +356,7 @@ void nvme_ctrlr_cmd_identify_controller(struct nvme_co void *payload, nvme_cb_fn_t cb_fn, void *cb_arg); void nvme_ctrlr_cmd_identify_namespace(struct nvme_controller *ctrlr, - uint16_t nsid, void *payload, + uint32_t nsid, void *payload, nvme_cb_fn_t cb_fn, void *cb_arg); void nvme_ctrlr_cmd_set_interrupt_coalescing(struct nvme_controller *ctrlr, uint32_t microseconds, @@ -438,7 +438,7 @@ void nvme_io_qpair_enable(struct nvme_qpair *qpair); void nvme_io_qpair_disable(struct nvme_qpair *qpair); void nvme_io_qpair_destroy(struct nvme_qpair *qpair); -int nvme_ns_construct(struct nvme_namespace *ns, uint16_t id, +int nvme_ns_construct(struct nvme_namespace *ns, uint32_t id, struct nvme_controller *ctrlr); void nvme_ns_destruct(struct nvme_namespace *ns); From owner-svn-src-all@freebsd.org Fri Aug 25 21:38:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19ADBDE1F4F; Fri, 25 Aug 2017 21:38:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0FA5718C6; Fri, 25 Aug 2017 21:38:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PLch6B088503; Fri, 25 Aug 2017 21:38:43 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PLchjB088502; Fri, 25 Aug 2017 21:38:43 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708252138.v7PLchjB088502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 25 Aug 2017 21:38:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322903 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 322903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 21:38:45 -0000 Author: imp Date: Fri Aug 25 21:38:43 2017 New Revision: 322903 URL: https://svnweb.freebsd.org/changeset/base/322903 Log: Fill in reserved areas from NVMe spec in the IDENTIFY structure (struct nvme_controller_data) as defined in the NVM Express specification, revsion 1.3. Sponsored by: Netflix Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Fri Aug 25 21:38:38 2017 (r322902) +++ head/sys/dev/nvme/nvme.h Fri Aug 25 21:38:43 2017 (r322903) @@ -490,8 +490,28 @@ struct nvme_controller_data { /** Controller ID */ uint16_t ctrlr_id; - uint8_t reserved1[176]; + /** Version */ + uint32_t ver; + /** RTD3 Resume Latency */ + uint32_t rtd3r; + + /** RTD3 Enter Latency */ + uint32_t rtd3e; + + /** Optional Asynchronous Events Supported */ + uint32_t oaes; /* bitfield really */ + + /** Controller Attributes */ + uint32_t ctratt; /* bitfield really */ + + uint8_t reserved1[12]; + + /** FRU Globally Unique Identifier */ + uint8_t fguid[16]; + + uint8_t reserved2[128]; + /* bytes 256-511: admin command set attributes */ /** optional admin command support */ @@ -550,8 +570,29 @@ struct nvme_controller_data { uint8_t avscc_rsvd : 7; } __packed avscc; - uint8_t reserved2[15]; + /** Autonomous Power State Transition Attributes */ + struct { + /* Autonmous Power State Transitions supported */ + uint8_t apst_supp : 1; + uint8_t apsta_rsvd : 7; + } __packed apsta; + + /** Warning Composite Temperature Threshold */ + uint16_t wctemp; + + /** Critical Composite Temperature Threshold */ + uint16_t cctemp; + + /** Maximum Time for Firmware Activation */ + uint16_t mtfa; + + /** Host Memory Buffer Preferred Size */ + uint32_t hmpre; + + /** Host Memory Buffer Minimum Size */ + uint32_t hmmin; + /** Name space capabilities */ struct { /* if nsmgmt, report tnvmcap and unvmcap */ @@ -559,7 +600,34 @@ struct nvme_controller_data { uint8_t unvmcap[16]; } __packed untncap; - uint8_t reserved3[200]; + /** Replay Protected Memory Block Support */ + uint32_t rpmbs; /* Really a bitfield */ + + /** Extended Device Self-test Time */ + uint16_t edstt; + + /** Device Self-test Options */ + uint8_t dsto; /* Really a bitfield */ + + /** Firmware Update Granularity */ + uint8_t fwug; + + /** Keep Alive Support */ + uint16_t kas; + + /** Host Controlled Thermal Management Attributes */ + uint16_t hctma; /* Really a bitfield */ + + /** Minimum Thermal Management Temperature */ + uint16_t mntmt; + + /** Maximum Thermal Management Temperature */ + uint16_t mxtmt; + + /** Sanitize Capabilities */ + uint32_t sanicap; /* Really a bitfield */ + + uint8_t reserved3[180]; /* bytes 512-703: nvm command set attributes */ /** submission queue entry size */ @@ -574,7 +642,8 @@ struct nvme_controller_data { uint8_t max : 4; } __packed cqes; - uint8_t reserved4[2]; + /** Maximum Outstanding Commands */ + uint16_t maxcmd; /** number of namespaces */ uint32_t nn; From owner-svn-src-all@freebsd.org Fri Aug 25 22:14:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F018DE29B7; Fri, 25 Aug 2017 22:14:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id D7C6F72AB5; Fri, 25 Aug 2017 22:14:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 605A71A5DC7; Sat, 26 Aug 2017 07:54:09 +1000 (AEST) Date: Sat, 26 Aug 2017 07:54:08 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alan Somers cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322893 - head/bin/dd In-Reply-To: <201708251531.v7PFVtoZ038242@repo.freebsd.org> Message-ID: <20170826061551.A976@besplex.bde.org> References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=bc8baKHB c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=hvvzoT6mHlCTYeWrSbEA:9 a=xkd4CAELegw4TTWS:21 a=nCJHprI3UMGEy-aH:21 a=gEigG_IEjzaiSYIh:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 22:14:13 -0000 On Fri, 25 Aug 2017, Alan Somers wrote: > Log: > dd(1): Incorrect casting of arguments It is indeed now incorrect. > dd(1) casts many of its numeric arguments from uintmax_t to intmax_t and > back again to detect whether or not the original arguments were negative. > This is not correct, and causes problems with boundary cases, for example > when count is SSIZE_MAX-1. The casts were correct. Did someone break the range checks? I wrote most of the cast, but would rarely write range checks using unportable casts. SSIZE_MAX-1 isn't a boundary case. The boundary is at SSIZE_MAX. %zd might work for it not. But %zd is wrong for SSIZE_MAX-1, since the expression might expand the type. > Modified: head/bin/dd/args.c > ============================================================================== > --- head/bin/dd/args.c Fri Aug 25 14:42:11 2017 (r322892) > +++ head/bin/dd/args.c Fri Aug 25 15:31:55 2017 (r322893) > @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); > > #include > > +#include Unrelated change. > #include > #include > #include > @@ -184,7 +185,7 @@ f_bs(char *arg) > > res = get_num(arg); > if (res < 1 || res > SSIZE_MAX) > - errx(1, "bs must be between 1 and %jd", (intmax_t)SSIZE_MAX); > + errx(1, "bs must be between 1 and %zd", SSIZE_MAX); > in.dbsz = out.dbsz = (size_t)res; > } > This is incorrect. The old version used the portable method of casting a signed value of unknown type to intmax_t before %zd existed. %zd still isn't useable in either theory or practice for printing ssize_t's. Theory: C99 defines %zd as being for the signed type "corresponding" to size_t. Who knows what "corresponding" is except for pure 2's complement with no padding bits? POSIX only defines ssize_t circularly as being "any signed integer type capable of representing the range -1 through SSIZE_MAX" where SSIZE_MAX is the maximum of ssize_t". It has a few restrictions that make this not completely circular, but I couldn't find anywhere where it states the usual restriction on limits -- that they have the type of the default promotion of the type that they limit. Practice: As reported in other replies, some arches define SSIZE_MAX in a way that makes its type not the default promotion of ssize_t. Most likely SSIZE_MAX is bogusly long and ssize_t is int, or vice versa, on an arch where int and long have the same representation. Printf format checking reports this type mismatch because it would be fatal on other arches. > @@ -195,22 +196,22 @@ f_cbs(char *arg) > > res = get_num(arg); > if (res < 1 || res > SSIZE_MAX) > - errx(1, "cbs must be between 1 and %jd", (intmax_t)SSIZE_MAX); > + errx(1, "cbs must be between 1 and %zd", SSIZE_MAX); > cbsz = (size_t)res; > } Similarly. > > static void > f_count(char *arg) > { > - intmax_t res; > + uintmax_t res; This breaks the not so careful checking for negative args. dd wants to allow negative args for seek offsets and not much else. It has a badly written get_off_t() to handle the offsets, but old code like this still used the old function get_num() that returns an unsigned type. This is a feature since get_off_t() is so badly written that it is better to convert get_num() almost as done here. My version does this internally: X /* X * Convert an expression of the above forms to an off_t. This version does X * not handle negative numbers perfectly. It assumes 2's complement and X * maybe nonnegative multipliers. I hope perfect handling is not necessary X * for dd. X */ X static off_t X get_off_t(const char *val) X { X u_quad_t num; X X num = get_num(val); X if (num != (u_quad_t)(off_t)num) X errx(1, "%s: offset too large", oper); X return ((off_t)num); X } This still uses the bogus type u_quad_t since that is what get_num() returns in the old version of dd that this patch is for. There should be no restriction except UINTMAX_MAX on counts. This is fixed in my version: X static void X f_count(char *arg) X { X X cpy_cnt = get_num(arg); X #if 0 X if (cpy_cnt == 0) X terminate(0); X #endif X } get_num() already did correct range checking. A count of 0 should mean infinity. Code elsewhere needs be careful to go to infinity for count 0 and to not multiply a large count by a block size. In practice, counts of nearly UINTMAX_MAX are unreachable. > > - res = (intmax_t)get_num(arg); > - if (res < 0) > - errx(1, "count cannot be negative"); > + res = get_num(arg); > + if (res == UINTMAX_MAX) > + errc(1, ERANGE, "%s", oper); This is nonsense error checking. get_num() already did correct checking and exited on range errors. A value of UINTMAX_MAX is not necessarily an error. After calling strtoumax(), it might be either a range error or at the end of the range (including the negative end). Since get_num() returned, it was not a range error. The check here does extra work to break the case where it is in-range. > if (res == 0) > - cpy_cnt = (uintmax_t)-1; > + cpy_cnt = UINTMAX_MAX; > else > - cpy_cnt = (uintmax_t)res; > + cpy_cnt = res; > } I count of 0 always meant infinity. It was converted to the huge value (uintmax_t)-1 which is an alternative spelling of UINTMAX_MAX. My version makes changes elswhere so that 0 works as itself and the user-specified UINTMAX_MAX is not corrupted. > > static void > @@ -219,7 +220,7 @@ f_files(char *arg) > > files_cnt = get_num(arg); > if (files_cnt < 1) > - errx(1, "files must be between 1 and %jd", (uintmax_t)-1); > + errx(1, "files must be between 1 and %zu", SIZE_MAX); > } %jd here was wrong. The value has type uintmax_t. It was printed as -1. Now a different wrong value is printed. The maximum returned by get_num() is still UINTMAX_MAX. This differs from SIZE_MAX on 64-bit arches. My version removes the range check and allows a count of 0. > > static void > @@ -240,8 +241,8 @@ f_ibs(char *arg) > if (!(ddflags & C_BS)) { > res = get_num(arg); > if (res < 1 || res > SSIZE_MAX) Range checks like this are of course correct. Some of the ones with bogus casts might be for portability to systems without OFF_MAX and/or UOFF_MAX. > - errx(1, "ibs must be between 1 and %jd", > - (intmax_t)SSIZE_MAX); > + errx(1, "ibs must be between 1 and %zd", > + SSIZE_MAX); > in.dbsz = (size_t)res; > } > } The change is unportable, as above > @@ -261,8 +262,8 @@ f_obs(char *arg) > if (!(ddflags & C_BS)) { > res = get_num(arg); > if (res < 1 || res > SSIZE_MAX) > - errx(1, "obs must be between 1 and %jd", > - (intmax_t)SSIZE_MAX); > + errx(1, "obs must be between 1 and %zd", > + SSIZE_MAX); > out.dbsz = (size_t)res; > } > } Unportable. > > Modified: head/bin/dd/conv.c > ============================================================================== > --- head/bin/dd/conv.c Fri Aug 25 14:42:11 2017 (r322892) > +++ head/bin/dd/conv.c Fri Aug 25 15:31:55 2017 (r322893) > @@ -133,7 +133,7 @@ block(void) > */ > ch = 0; > for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) { > - maxlen = MIN(cbsz, in.dbcnt); > + maxlen = MIN(cbsz, (size_t)in.dbcnt); > if ((t = ctab) != NULL) > for (cnt = 0; cnt < maxlen && (ch = *inp++) != '\n'; > ++cnt) Bogus cast to compensate for dbcnt being changed to ssize_t. ssize_t is a necessary evil holding the return value of read() and write() (except the return type should be plain int as in V7 and ssize_t shouldn't exist) (but the main design error was changing the arg type of read() and write() from int to unsigned and then to size_t. The different types give a type morass and args larger than than the signed max are unportable at best). Buffer sizes should have size <= SSIZE_MAX because the behaviour of read() and write() is implementation-defined and hard to use betteen SSIZE_MAX+(size_t)1 and SIZE_MAX. But don't use ssize_t for anything else. Not even for buffer sizes that it can hold. You also changed dbsz to ssize_t. That is the wrong type to pass to read() and write(). It gets converted implicitly by the prototype. The above cast does the same conversion to hide the bug that the types don't match. Both of the implicit conversions might be errors, but compilers don't warn enough for ones in prototypes because they are too common. > @@ -146,7 +146,7 @@ block(void) > * Check for short record without a newline. Reassemble the > * input block. > */ > - if (ch != '\n' && in.dbcnt < cbsz) { > + if (ch != '\n' && (size_t)in.dbcnt < cbsz) { > (void)memmove(in.db, in.dbp - in.dbcnt, in.dbcnt); > break; > } Lots more type poisoning. You didn't spread it to the memmove() call. The second and third args now have type ssize_t instead of size_t. This is hidden by thr prototype. Signed poisoning of cbsz would break the warning about the type mismatch in the comparison. I actually don't like unsigned types, but dd has always used them a lot and needs them to reach 4G on 32-bit systems. All unsigned works almost as well as all signed. > @@ -228,7 +228,7 @@ unblock(void) > * translation has to already be done or we might not recognize the > * spaces. > */ > - for (inp = in.db; in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { > + for (inp = in.db; (size_t)in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { > for (t = inp + cbsz - 1; t >= inp && *t == ' '; --t) > ; > if (t >= inp) { This cast also breaks the formatting. > > Modified: head/bin/dd/dd.c > ============================================================================== > --- head/bin/dd/dd.c Fri Aug 25 14:42:11 2017 (r322892) > +++ head/bin/dd/dd.c Fri Aug 25 15:31:55 2017 (r322893) > @@ -204,10 +204,10 @@ setup(void) > * record oriented I/O, only need a single buffer. > */ > if (!(ddflags & (C_BLOCK | C_UNBLOCK))) { > - if ((in.db = malloc(out.dbsz + in.dbsz - 1)) == NULL) > + if ((in.db = malloc((size_t)out.dbsz + in.dbsz - 1)) == NULL) > err(1, "input buffer"); > out.db = in.db; > - } else if ((in.db = malloc(MAX(in.dbsz, cbsz) + cbsz)) == NULL || > + } else if ((in.db = malloc(MAX((size_t)in.dbsz, cbsz) + cbsz)) == NULL || > (out.db = malloc(out.dbsz + cbsz)) == NULL) > err(1, "output buffer"); > Signed poisoning. > @@ -405,7 +405,7 @@ dd_in(void) > ++st.in_full; > > /* Handle full input blocks. */ > - } else if ((size_t)n == in.dbsz) { > + } else if ((size_t)n == (size_t)in.dbsz) { > in.dbcnt += in.dbrcnt = n; > ++st.in_full; > Old bogus cast. n already has type size_t. New signed poisoning. > @@ -562,7 +562,7 @@ dd_out(int force) > outp += nw; > st.bytes += nw; > > - if ((size_t)nw == n && n == out.dbsz) > + if ((size_t)nw == n && n == (size_t)out.dbsz) > ++st.out_full; > else > ++st.out_part; > Lots more signed poisoning. nw holds the value returned by write(), so it needs to be signed (ssize_t). This already poisoned most uses of it. > Modified: head/bin/dd/dd.h > ============================================================================== > --- head/bin/dd/dd.h Fri Aug 25 14:42:11 2017 (r322892) > +++ head/bin/dd/dd.h Fri Aug 25 15:31:55 2017 (r322893) > @@ -38,10 +38,9 @@ > typedef struct { > u_char *db; /* buffer address */ > u_char *dbp; /* current buffer I/O address */ > - /* XXX ssize_t? */ Comment written before someone understood the full brokenness of ssize_t. > - size_t dbcnt; /* current buffer byte count */ Counts should be signed (buffer counts for passing to read()/write() or just adding up). > - size_t dbrcnt; /* last read byte count */ The return value might need to be signed, but it should be converted to unsigned as soon as possible (after checking for errors) to minimise signed poisoning. > - size_t dbsz; /* block size */ Block sizes should be signed. > + ssize_t dbcnt; /* current buffer byte count */ > + ssize_t dbrcnt; /* last read byte count */ > + ssize_t dbsz; /* block size */ > > #define ISCHR 0x01 /* character device (warn on short) */ > #define ISPIPE 0x02 /* pipe-like (see position.c) */ > > Modified: head/bin/dd/position.c > ============================================================================== > --- head/bin/dd/position.c Fri Aug 25 14:42:11 2017 (r322892) > +++ head/bin/dd/position.c Fri Aug 25 15:31:55 2017 (r322893) > @@ -207,7 +207,7 @@ pos_out(void) > n = write(out.fd, out.db, out.dbsz); > if (n == -1) > err(1, "%s", out.name); > - if ((size_t)n != out.dbsz) > + if (n != out.dbsz) > errx(1, "%s: write failure", out.name); > } > break; This moves the ugly ugly conversions to an implicit one in the function call. The error handling is still broken. The non-error of a short write is not handled and this is misreported as a write failure (though correctly using errx()). The signed poisoning makes the critical old and new bugs hard to see. Bruce From owner-svn-src-all@freebsd.org Fri Aug 25 22:37:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DE93DE2D4E; Fri, 25 Aug 2017 22:37:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31E90731C5; Fri, 25 Aug 2017 22:37:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v7PMbqiL006177 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 26 Aug 2017 01:37:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v7PMbqiL006177 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v7PMbqcA006176; Sat, 26 Aug 2017 01:37:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 26 Aug 2017 01:37:52 +0300 From: Konstantin Belousov To: Bryan Drewery Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r306512 - in head/sys: kern sys Message-ID: <20170825223752.GN1700@kib.kiev.ua> References: <201609301727.u8UHRIgD051373@repo.freebsd.org> <6ea06065-ea5c-b83b-3854-224626be0d77@FreeBSD.org> <20170825103534.GK1700@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 22:37:58 -0000 On Fri, Aug 25, 2017 at 02:29:28PM -0700, Bryan Drewery wrote: > https://people.freebsd.org/~bdrewery/patches/vdrop-global-list.diff I do not object against his handling. There is really very small amount of code shared between mp != NULL and mp == NULL cases, you may consider making them use separate paths instead of adding more than one check for mp != NULL. VNASSERT() statement has wrong indent on the continuation line. From owner-svn-src-all@freebsd.org Fri Aug 25 22:38:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41212DE2DD8; Fri, 25 Aug 2017 22:38:57 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E7F273314; Fri, 25 Aug 2017 22:38:56 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PMcue1012684; Fri, 25 Aug 2017 22:38:56 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PMcujp012682; Fri, 25 Aug 2017 22:38:56 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201708252238.v7PMcujp012682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 25 Aug 2017 22:38:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322906 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 322906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 22:38:57 -0000 Author: sbruno Date: Fri Aug 25 22:38:55 2017 New Revision: 322906 URL: https://svnweb.freebsd.org/changeset/base/322906 Log: Add a different #define for the maximum number of transmit and recieve descriptors for the igb(4) class of devices. This will allow a better definition for maximum going forward. Some igb(4) devices support more than the default 4K. Reported by: Jason (j@nitrology.com) Sponsored by: Limelight Networks Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Fri Aug 25 21:53:51 2017 (r322905) +++ head/sys/dev/e1000/if_em.c Fri Aug 25 22:38:55 2017 (r322906) @@ -515,8 +515,8 @@ static struct if_shared_ctx igb_sctx_init = { .isc_nrxd_min = {EM_MIN_RXD}, .isc_ntxd_min = {EM_MIN_TXD}, - .isc_nrxd_max = {EM_MAX_RXD}, - .isc_ntxd_max = {EM_MAX_TXD}, + .isc_nrxd_max = {IGB_MAX_RXD}, + .isc_ntxd_max = {IGB_MAX_TXD}, .isc_nrxd_default = {EM_DEFAULT_RXD}, .isc_ntxd_default = {EM_DEFAULT_TXD}, }; Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Fri Aug 25 21:53:51 2017 (r322905) +++ head/sys/dev/e1000/if_em.h Fri Aug 25 22:38:55 2017 (r322906) @@ -96,10 +96,10 @@ /* Tunables */ /* - * EM_TXD: Maximum number of Transmit Descriptors + * EM_MAX_TXD: Maximum number of Transmit Descriptors * Valid Range: 80-256 for 82542 and 82543-based adapters * 80-4096 for others - * Default Value: 256 + * Default Value: 1024 * This value is the number of transmit descriptors allocated by the driver. * Increasing this value allows the driver to queue more transmits. Each * descriptor is 16 bytes. @@ -111,12 +111,13 @@ #define EM_MAX_TXD 4096 #define EM_DEFAULT_TXD 1024 #define EM_DEFAULT_MULTI_TXD 4096 +#define IGB_MAX_TXD 4096 /* - * EM_RXD - Maximum number of receive Descriptors + * EM_MAX_RXD - Maximum number of receive Descriptors * Valid Range: 80-256 for 82542 and 82543-based adapters * 80-4096 for others - * Default Value: 256 + * Default Value: 1024 * This value is the number of receive descriptors allocated by the driver. * Increasing this value allows the driver to buffer more incoming packets. * Each descriptor is 16 bytes. A receive buffer is also allocated for each @@ -129,6 +130,7 @@ #define EM_MAX_RXD 4096 #define EM_DEFAULT_RXD 1024 #define EM_DEFAULT_MULTI_RXD 4096 +#define IGB_MAX_RXD 4096 /* * EM_TIDV - Transmit Interrupt Delay Value From owner-svn-src-all@freebsd.org Fri Aug 25 22:39:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D75FBDE2E57; Fri, 25 Aug 2017 22:39:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2F7273459; Fri, 25 Aug 2017 22:39:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PMdnuo012763; Fri, 25 Aug 2017 22:39:49 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PMdnbS012755; Fri, 25 Aug 2017 22:39:49 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201708252239.v7PMdnbS012755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 25 Aug 2017 22:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322907 - in stable/11/sys/fs: nfs nfsclient X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in stable/11/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 322907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 22:39:51 -0000 Author: rmacklem Date: Fri Aug 25 22:39:49 2017 New Revision: 322907 URL: https://svnweb.freebsd.org/changeset/base/322907 Log: MFC: r321628 Replace the checks for MNTK_UNMOUNTF with a macro that does the same thing. This patch defines a macro that checks for MNTK_UNMOUNTF and replaces explicit checks with this macro. It has no effect on semantics, but prepares the code for a future patch where there will also be a NFS specific flag for "forced dismount about to occur". Modified: stable/11/sys/fs/nfs/nfs_commonkrpc.c stable/11/sys/fs/nfs/nfs_commonsubs.c stable/11/sys/fs/nfs/nfscl.h stable/11/sys/fs/nfsclient/nfs_clbio.c stable/11/sys/fs/nfsclient/nfs_clport.c stable/11/sys/fs/nfsclient/nfs_clstate.c stable/11/sys/fs/nfsclient/nfs_clvfsops.c stable/11/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonkrpc.c Fri Aug 25 22:38:55 2017 (r322906) +++ stable/11/sys/fs/nfs/nfs_commonkrpc.c Fri Aug 25 22:39:49 2017 (r322907) @@ -509,7 +509,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmo if (xidp != NULL) *xidp = 0; /* Reject requests while attempting a forced unmount. */ - if (nmp != NULL && (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF)) { + if (nmp != NULL && NFSCL_FORCEDISM(nmp->nm_mountp)) { m_freem(nd->nd_mreq); return (ESTALE); } @@ -1229,7 +1229,7 @@ newnfs_sigintr(struct nfsmount *nmp, struct thread *td sigset_t tmpset; /* Terminate all requests while attempting a forced unmount. */ - if (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) + if (NFSCL_FORCEDISM(nmp->nm_mountp)) return (EIO); if (!(nmp->nm_flag & NFSMNT_INT)) return (0); Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonsubs.c Fri Aug 25 22:38:55 2017 (r322906) +++ stable/11/sys/fs/nfs/nfs_commonsubs.c Fri Aug 25 22:39:49 2017 (r322907) @@ -1866,7 +1866,7 @@ nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *i lp->nfslock_lock |= NFSV4LOCK_LOCKWANTED; } while (lp->nfslock_lock & (NFSV4LOCK_LOCK | NFSV4LOCK_LOCKWANTED)) { - if (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (mp != NULL && NFSCL_FORCEDISM(mp)) { lp->nfslock_lock &= ~NFSV4LOCK_LOCKWANTED; return (0); } @@ -1920,7 +1920,7 @@ nfsv4_relref(struct nfsv4lock *lp) * not wait for threads that want the exclusive lock. If priority needs * to be given to threads that need the exclusive lock, a call to nfsv4_lock() * with the 2nd argument == 0 should be done before calling nfsv4_getref(). - * If the mp argument is not NULL, check for MNTK_UNMOUNTF being set and + * If the mp argument is not NULL, check for NFSCL_FORCEDISM() being set and * return without getting a refcnt for that case. */ APPLESTATIC void @@ -1935,7 +1935,7 @@ nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void * Wait for a lock held. */ while (lp->nfslock_lock & NFSV4LOCK_LOCK) { - if (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) + if (mp != NULL && NFSCL_FORCEDISM(mp)) return; lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) @@ -1943,7 +1943,7 @@ nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void (void) nfsmsleep(&lp->nfslock_lock, mutex, PZERO - 1, "nfsv4gr", NULL); } - if (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) + if (mp != NULL && NFSCL_FORCEDISM(mp)) return; lp->nfslock_usecnt++; @@ -4215,9 +4215,7 @@ nfsv4_sequencelookup(struct nfsmount *nmp, struct nfsc * This RPC attempt will fail when it calls * newnfs_request(). */ - if (nmp != NULL && - (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) - != 0) { + if (nmp != NULL && NFSCL_FORCEDISM(nmp->nm_mountp)) { mtx_unlock(&sep->nfsess_mtx); return (ESTALE); } Modified: stable/11/sys/fs/nfs/nfscl.h ============================================================================== --- stable/11/sys/fs/nfs/nfscl.h Fri Aug 25 22:38:55 2017 (r322906) +++ stable/11/sys/fs/nfs/nfscl.h Fri Aug 25 22:39:49 2017 (r322907) @@ -59,6 +59,9 @@ struct nfsv4node { #define NFSCL_RENEW(l) (((l) < 2) ? 1 : ((l) / 2)) #define NFSCL_LEASE(r) ((r) * 2) +/* This macro checks to see if a forced dismount is about to occur. */ +#define NFSCL_FORCEDISM(m) (((m)->mnt_kern_flag & MNTK_UNMOUNTF) != 0) + /* * These flag bits are used for the argument to nfscl_fillsattr() to * indicate special handling of the attributes. Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clbio.c Fri Aug 25 22:38:55 2017 (r322906) +++ stable/11/sys/fs/nfsclient/nfs_clbio.c Fri Aug 25 22:39:49 2017 (r322907) @@ -1342,7 +1342,7 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thre if ((nmp->nm_flag & NFSMNT_INT) == 0) intrflg = 0; - if ((nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF)) + if (NFSCL_FORCEDISM(nmp->nm_mountp)) intrflg = 1; if (intrflg) { slpflag = PCATCH; Modified: stable/11/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clport.c Fri Aug 25 22:38:55 2017 (r322906) +++ stable/11/sys/fs/nfsclient/nfs_clport.c Fri Aug 25 22:39:49 2017 (r322907) @@ -313,7 +313,7 @@ nfscl_ngetreopen(struct mount *mntp, u_int8_t *fhp, in *npp = NULL; /* For forced dismounts, just return error. */ - if ((mntp->mnt_kern_flag & MNTK_UNMOUNTF)) + if (NFSCL_FORCEDISM(mntp)) return (EINTR); MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize, M_NFSFH, M_WAITOK); @@ -336,7 +336,7 @@ nfscl_ngetreopen(struct mount *mntp, u_int8_t *fhp, in * stopped and the MNTK_UNMOUNTF flag is set before doing * a vflush() with FORCECLOSE, we should be ok here. */ - if ((mntp->mnt_kern_flag & MNTK_UNMOUNTF)) + if (NFSCL_FORCEDISM(mntp)) error = EINTR; else { vfs_hash_ref(mntp, hash, td, &nvp, newnfs_vncmpf, nfhp); Modified: stable/11/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clstate.c Fri Aug 25 22:38:55 2017 (r322906) +++ stable/11/sys/fs/nfsclient/nfs_clstate.c Fri Aug 25 22:39:49 2017 (r322907) @@ -803,7 +803,7 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSP * allocate a new clientid and get out now. For the case where * clp != NULL, this is a harmless optimization. */ - if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (NFSCL_FORCEDISM(mp)) { NFSUNLOCKCLSTATE(); if (newclp != NULL) free(newclp, M_NFSCLCLIENT); @@ -843,7 +843,7 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSP } NFSLOCKCLSTATE(); while ((clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID) == 0 && !igotlock && - (mp->mnt_kern_flag & MNTK_UNMOUNTF) == 0) + !NFSCL_FORCEDISM(mp)) igotlock = nfsv4_lock(&clp->nfsc_lock, 1, NULL, NFSCLSTATEMUTEXPTR, mp); if (igotlock == 0) { @@ -858,10 +858,10 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSP nfsv4_lock(&clp->nfsc_lock, 0, NULL, NFSCLSTATEMUTEXPTR, mp); nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, mp); } - if (igotlock == 0 && (mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (igotlock == 0 && NFSCL_FORCEDISM(mp)) { /* * Both nfsv4_lock() and nfsv4_getref() know to check - * for MNTK_UNMOUNTF and return without sleeping to + * for NFSCL_FORCEDISM() and return without sleeping to * wait for the exclusive lock to be released, since it * might be held by nfscl_umount() and we need to get out * now for that case and not wait until nfscl_umount() @@ -4844,7 +4844,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_ lyp->nfsly_timestamp = NFSD_MONOSEC + 120; } nfsv4_getref(&lyp->nfsly_lock, NULL, NFSCLSTATEMUTEXPTR, mp); - if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (NFSCL_FORCEDISM(mp)) { NFSUNLOCKCLSTATE(); if (tlyp != NULL) free(tlyp, M_NFSLAYOUT); @@ -4903,11 +4903,10 @@ nfscl_getlayout(struct nfsclclient *clp, uint8_t *fhp, do { igotlock = nfsv4_lock(&lyp->nfsly_lock, 1, NULL, NFSCLSTATEMUTEXPTR, mp); - } while (igotlock == 0 && - (mp->mnt_kern_flag & MNTK_UNMOUNTF) == 0); + } while (igotlock == 0 && !NFSCL_FORCEDISM(mp)); *retflpp = NULL; } - if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (NFSCL_FORCEDISM(mp)) { lyp = NULL; *recalledp = 1; } @@ -5298,7 +5297,7 @@ nfscl_layoutcommit(vnode_t vp, NFSPROC_T *p) return (EPERM); } nfsv4_getref(&lyp->nfsly_lock, NULL, NFSCLSTATEMUTEXPTR, mp); - if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (NFSCL_FORCEDISM(mp)) { NFSUNLOCKCLSTATE(); return (EPERM); } Modified: stable/11/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvfsops.c Fri Aug 25 22:38:55 2017 (r322906) +++ stable/11/sys/fs/nfsclient/nfs_clvfsops.c Fri Aug 25 22:39:49 2017 (r322907) @@ -1775,7 +1775,7 @@ nfs_sync(struct mount *mp, int waitfor) * the umount(2) syscall doesn't get stuck in VFS_SYNC() before * calling VFS_UNMOUNT(). */ - if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + if (NFSCL_FORCEDISM(mp)) { MNT_IUNLOCK(mp); return (EBADF); } Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvnops.c Fri Aug 25 22:38:55 2017 (r322906) +++ stable/11/sys/fs/nfsclient/nfs_clvnops.c Fri Aug 25 22:39:49 2017 (r322907) @@ -665,7 +665,7 @@ nfs_close(struct vop_close_args *ap) int error = 0, ret, localcred = 0; int fmode = ap->a_fflag; - if ((vp->v_mount->mnt_kern_flag & MNTK_UNMOUNTF)) + if (NFSCL_FORCEDISM(vp->v_mount)) return (0); /* * During shutdown, a_cred isn't valid, so just use root. From owner-svn-src-all@freebsd.org Fri Aug 25 22:44:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68BE9DE3078; Fri, 25 Aug 2017 22:44:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34F8C73813; Fri, 25 Aug 2017 22:44:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PMit71016638; Fri, 25 Aug 2017 22:44:55 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PMitD7016636; Fri, 25 Aug 2017 22:44:55 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201708252244.v7PMitD7016636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 25 Aug 2017 22:44:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322908 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/11/sys/fs/nfsclient X-SVN-Commit-Revision: 322908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 22:44:56 -0000 Author: rmacklem Date: Fri Aug 25 22:44:55 2017 New Revision: 322908 URL: https://svnweb.freebsd.org/changeset/base/322908 Log: MFC: r321675 Fix possible crash for the NFSv4.1 pNFS client. If the nfsrpc_createlayoutrpc() call in nfsrpc_getcreatelayout() fails, the code used nfhpp when it might be set NULL. This patch checks for the error cases (laystat != 0) and avoids using nfhpp for the failure case. This would only affect NFSv4.1 mounts with the "pnfs" option. Found while testing the "umount -N" patch not yet in head. Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clrpcops.c Fri Aug 25 22:39:49 2017 (r322907) +++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c Fri Aug 25 22:44:55 2017 (r322908) @@ -6633,9 +6633,14 @@ nfsrpc_getcreatelayout(vnode_t dvp, char *name, int na NFSCL_DEBUG(4, "aft nfsrpc_createlayoutrpc laystat=%d err=%d\n", laystat, error); lyp = NULL; - nfhp = *nfhpp; - laystat = nfsrpc_layoutgetres(nmp, dvp, nfhp->nfh_fh, nfhp->nfh_len, - &stateid, retonclose, NULL, &lyp, &flh, laystat, NULL, cred, p); + if (laystat == 0) { + nfhp = *nfhpp; + laystat = nfsrpc_layoutgetres(nmp, dvp, nfhp->nfh_fh, + nfhp->nfh_len, &stateid, retonclose, NULL, &lyp, &flh, + laystat, NULL, cred, p); + } else + laystat = nfsrpc_layoutgetres(nmp, dvp, NULL, 0, &stateid, + retonclose, NULL, &lyp, &flh, laystat, NULL, cred, p); if (laystat == 0) nfscl_rellayout(lyp, 0); return (error); From owner-svn-src-all@freebsd.org Fri Aug 25 22:52:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8124CDE32E0; Fri, 25 Aug 2017 22:52:42 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B99E73CA1; Fri, 25 Aug 2017 22:52:42 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PMqfre020869; Fri, 25 Aug 2017 22:52:41 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PMqerH020862; Fri, 25 Aug 2017 22:52:40 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201708252252.v7PMqerH020862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 25 Aug 2017 22:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322909 - in stable/11/sys: fs/nfs fs/nfsclient nfs sys X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in stable/11/sys: fs/nfs fs/nfsclient nfs sys X-SVN-Commit-Revision: 322909 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 22:52:42 -0000 Author: rmacklem Date: Fri Aug 25 22:52:40 2017 New Revision: 322909 URL: https://svnweb.freebsd.org/changeset/base/322909 Log: MFC: r321688 Add kernel support for the NFS client forced dismount "umount -N" option. When an NFS mount is hung against an unresponsive NFS server, the "umount -f" option can be used to dismount the mount. Unfortunately, "umount -f" gets hung as well if a "umount" without "-f" has already been done. Usually, this is because of a vnode lock being held by the "umount" for the mounted-on vnode. This patch adds kernel code so that a new "-N" option can be added to "umount", allowing it to avoid getting hung for this case. It adds two flags. One indicates that a forced dismount is about to happen and the other is used, along with setting mnt_data == NULL, to handshake with the nfs_unmount() VFS call. It includes a slight change to the interface used between the client and common NFS modules, so I bumped __FreeBSD_version to ensure both modules are rebuilt. Modified: stable/11/sys/fs/nfs/nfscl.h stable/11/sys/fs/nfsclient/nfs_clport.c stable/11/sys/fs/nfsclient/nfs_clvfsops.c stable/11/sys/fs/nfsclient/nfsmount.h stable/11/sys/nfs/nfs_nfssvc.c stable/11/sys/nfs/nfssvc.h stable/11/sys/sys/param.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfscl.h ============================================================================== --- stable/11/sys/fs/nfs/nfscl.h Fri Aug 25 22:44:55 2017 (r322908) +++ stable/11/sys/fs/nfs/nfscl.h Fri Aug 25 22:52:40 2017 (r322909) @@ -60,7 +60,8 @@ struct nfsv4node { #define NFSCL_LEASE(r) ((r) * 2) /* This macro checks to see if a forced dismount is about to occur. */ -#define NFSCL_FORCEDISM(m) (((m)->mnt_kern_flag & MNTK_UNMOUNTF) != 0) +#define NFSCL_FORCEDISM(m) (((m)->mnt_kern_flag & MNTK_UNMOUNTF) != 0 || \ + (VFSTONFS(m)->nm_privflag & NFSMNTP_FORCEDISM) != 0) /* * These flag bits are used for the argument to nfscl_fillsattr() to Modified: stable/11/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clport.c Fri Aug 25 22:44:55 2017 (r322908) +++ stable/11/sys/fs/nfsclient/nfs_clport.c Fri Aug 25 22:52:40 2017 (r322909) @@ -1313,6 +1313,8 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *ua cap_rights_t rights; char *buf; int error; + struct mount *mp; + struct nfsmount *nmp; if (uap->flag & NFSSVC_CBADDSOCK) { error = copyin(uap->argp, (caddr_t)&nfscbdarg, sizeof(nfscbdarg)); @@ -1367,6 +1369,56 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *ua dumpmntopts.ndmnt_blen); free(buf, M_TEMP); } + } else if (uap->flag & NFSSVC_FORCEDISM) { + buf = malloc(MNAMELEN + 1, M_TEMP, M_WAITOK); + error = copyinstr(uap->argp, buf, MNAMELEN + 1, NULL); + if (error == 0) { + nmp = NULL; + mtx_lock(&mountlist_mtx); + TAILQ_FOREACH(mp, &mountlist, mnt_list) { + if (strcmp(mp->mnt_stat.f_mntonname, buf) == + 0 && strcmp(mp->mnt_stat.f_fstypename, + "nfs") == 0 && mp->mnt_data != NULL) { + nmp = VFSTONFS(mp); + mtx_lock(&nmp->nm_mtx); + if ((nmp->nm_privflag & + NFSMNTP_FORCEDISM) == 0) { + nmp->nm_privflag |= + (NFSMNTP_FORCEDISM | + NFSMNTP_CANCELRPCS); + mtx_unlock(&nmp->nm_mtx); + } else { + nmp = NULL; + mtx_unlock(&nmp->nm_mtx); + } + break; + } + } + mtx_unlock(&mountlist_mtx); + + if (nmp != NULL) { + /* + * Call newnfs_nmcancelreqs() to cause + * any RPCs in progress on the mount point to + * fail. + * This will cause any process waiting for an + * RPC to complete while holding a vnode lock + * on the mounted-on vnode (such as "df" or + * a non-forced "umount") to fail. + * This will unlock the mounted-on vnode so + * a forced dismount can succeed. + * Then clear NFSMNTP_CANCELRPCS and wakeup(), + * so that nfs_unmount() can complete. + */ + newnfs_nmcancelreqs(nmp); + mtx_lock(&nmp->nm_mtx); + nmp->nm_privflag &= ~NFSMNTP_CANCELRPCS; + wakeup(nmp); + mtx_unlock(&nmp->nm_mtx); + } else + error = EINVAL; + } + free(buf, M_TEMP); } else { error = EINVAL; } Modified: stable/11/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvfsops.c Fri Aug 25 22:44:55 2017 (r322908) +++ stable/11/sys/fs/nfsclient/nfs_clvfsops.c Fri Aug 25 22:52:40 2017 (r322909) @@ -1698,6 +1698,11 @@ nfs_unmount(struct mount *mp, int mntflags) */ if ((mntflags & MNT_FORCE) == 0) nfscl_umount(nmp, td); + else { + mtx_lock(&nmp->nm_mtx); + nmp->nm_privflag |= NFSMNTP_FORCEDISM; + mtx_unlock(&nmp->nm_mtx); + } /* Make sure no nfsiods are assigned to this mount. */ mtx_lock(&ncl_iod_mutex); for (i = 0; i < NFS_MAXASYNCDAEMON; i++) @@ -1706,6 +1711,19 @@ nfs_unmount(struct mount *mp, int mntflags) ncl_iodmount[i] = NULL; } mtx_unlock(&ncl_iod_mutex); + + /* + * We can now set mnt_data to NULL and wait for + * nfssvc(NFSSVC_FORCEDISM) to complete. + */ + mtx_lock(&mountlist_mtx); + mtx_lock(&nmp->nm_mtx); + mp->mnt_data = NULL; + mtx_unlock(&mountlist_mtx); + while ((nmp->nm_privflag & NFSMNTP_CANCELRPCS) != 0) + msleep(nmp, &nmp->nm_mtx, PVFS, "nfsfdism", 0); + mtx_unlock(&nmp->nm_mtx); + newnfs_disconnect(&nmp->nm_sockreq); crfree(nmp->nm_sockreq.nr_cred); FREE(nmp->nm_nam, M_SONAME); Modified: stable/11/sys/fs/nfsclient/nfsmount.h ============================================================================== --- stable/11/sys/fs/nfsclient/nfsmount.h Fri Aug 25 22:44:55 2017 (r322908) +++ stable/11/sys/fs/nfsclient/nfsmount.h Fri Aug 25 22:52:40 2017 (r322909) @@ -44,6 +44,7 @@ */ struct nfsmount { struct nfsmount_common nm_com; /* Common fields for nlm */ + uint32_t nm_privflag; /* Private flags */ int nm_numgrps; /* Max. size of groupslist */ u_char nm_fh[NFSX_FHMAX]; /* File handle of root dir */ int nm_fhsize; /* Size of root file handle */ @@ -98,6 +99,10 @@ struct nfsmount { #define nm_hostname nm_com.nmcom_hostname #define nm_getinfo nm_com.nmcom_getinfo #define nm_vinvalbuf nm_com.nmcom_vinvalbuf + +/* Private flags. */ +#define NFSMNTP_FORCEDISM 0x00000001 +#define NFSMNTP_CANCELRPCS 0x00000002 #define NFSMNT_DIRPATH(m) (&((m)->nm_name[(m)->nm_krbnamelen + 1])) #define NFSMNT_SRVKRBNAME(m) \ Modified: stable/11/sys/nfs/nfs_nfssvc.c ============================================================================== --- stable/11/sys/nfs/nfs_nfssvc.c Fri Aug 25 22:44:55 2017 (r322908) +++ stable/11/sys/nfs/nfs_nfssvc.c Fri Aug 25 22:52:40 2017 (r322909) @@ -92,7 +92,7 @@ sys_nfssvc(struct thread *td, struct nfssvc_args *uap) nfsd_call_nfsserver != NULL) error = (*nfsd_call_nfsserver)(td, uap); else if ((uap->flag & (NFSSVC_CBADDSOCK | NFSSVC_NFSCBD | - NFSSVC_DUMPMNTOPTS)) && nfsd_call_nfscl != NULL) + NFSSVC_DUMPMNTOPTS | NFSSVC_FORCEDISM)) && nfsd_call_nfscl != NULL) error = (*nfsd_call_nfscl)(td, uap); else if ((uap->flag & (NFSSVC_IDNAME | NFSSVC_GETSTATS | NFSSVC_GSSDADDPORT | NFSSVC_GSSDADDFIRST | NFSSVC_GSSDDELETEALL | Modified: stable/11/sys/nfs/nfssvc.h ============================================================================== --- stable/11/sys/nfs/nfssvc.h Fri Aug 25 22:44:55 2017 (r322908) +++ stable/11/sys/nfs/nfssvc.h Fri Aug 25 22:52:40 2017 (r322909) @@ -70,6 +70,7 @@ #define NFSSVC_RESUMENFSD 0x08000000 #define NFSSVC_DUMPMNTOPTS 0x10000000 #define NFSSVC_NEWSTRUCT 0x20000000 +#define NFSSVC_FORCEDISM 0x40000000 /* Argument structure for NFSSVC_DUMPMNTOPTS. */ struct nfscl_dumpmntopts { Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Fri Aug 25 22:44:55 2017 (r322908) +++ stable/11/sys/sys/param.h Fri Aug 25 22:52:40 2017 (r322909) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1101501 /* Master, propagated to newvers */ +#define __FreeBSD_version 1101502 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Fri Aug 25 22:58:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45D45DE33D8; Fri, 25 Aug 2017 22:58:55 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FF4F73F3E; Fri, 25 Aug 2017 22:58:55 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PMwsIc021292; Fri, 25 Aug 2017 22:58:54 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PMwsRb021290; Fri, 25 Aug 2017 22:58:54 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201708252258.v7PMwsRb021290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 25 Aug 2017 22:58:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322910 - stable/11/sbin/umount X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/11/sbin/umount X-SVN-Commit-Revision: 322910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 22:58:55 -0000 Author: rmacklem Date: Fri Aug 25 22:58:54 2017 New Revision: 322910 URL: https://svnweb.freebsd.org/changeset/base/322910 Log: MFC: r321689 Add a new "-N" option to umount(8), that does a forced dismount of an NFS mount point. The new "-N" option does a forced dismount of an NFS mount point, but avoids doing any checking of the mounted-on path, so that it will not get hung when a vnode lock is held by another hung process on the mounted-on vnode. The most common case of this is a "umount" with the "-f" option. Other than avoiding checking the mounted-on path, it performs the same forced dismount as a successful "umount -f" would do. This commit includes a content change to the man page. Modified: stable/11/sbin/umount/umount.8 stable/11/sbin/umount/umount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/umount/umount.8 ============================================================================== --- stable/11/sbin/umount/umount.8 Fri Aug 25 22:52:40 2017 (r322909) +++ stable/11/sbin/umount/umount.8 Fri Aug 25 22:58:54 2017 (r322910) @@ -28,7 +28,7 @@ .\" @(#)umount.8 8.2 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd July 7, 2016 +.Dd July 25, 2017 .Dt UMOUNT 8 .Os .Sh NAME @@ -36,7 +36,7 @@ .Nd unmount file systems .Sh SYNOPSIS .Nm -.Op Fl fnv +.Op Fl fNnv .Ar special ... | node ... | fsid ... .Nm .Fl a | A @@ -81,6 +81,15 @@ The root file system cannot be forcibly unmounted. For NFS, a forced dismount can take up to 1 minute or more to complete against an unresponsive server and may throw away data not yet written to the server for this case. +If a process, such as +.Nm +without the +.Fl f +flag is hung on an +.Tn NFS +mount point, use the +.Fl N +flag instead. Also, doing a forced dismount of an NFSv3 mount when .Xr rpc.lockd 8 is running is unsafe and can result in a crash. @@ -94,6 +103,24 @@ option and, unless otherwise specified with the option, will only unmount .Tn NFS file systems. +.It Fl N +Do a forced dismount of an +.Tn NFS +mount point without checking the mount path. +This option can only be used with the path to the mount point +.Ar node +and the path must be specified exactly as it was at mount time. +This option is useful when a process is hung waiting for an unresponsive +.Tn NFS +server while holding a vnode lock on the mounted-on vnode, such that +.Nm +with the +.Fl f +flag can't complete. +Using this option can result in a loss of file updates that have not been +flushed to the +.Tn NFS +server. .It Fl n Unless the .Fl f Modified: stable/11/sbin/umount/umount.c ============================================================================== --- stable/11/sbin/umount/umount.c Fri Aug 25 22:52:40 2017 (r322909) +++ stable/11/sbin/umount/umount.c Fri Aug 25 22:58:54 2017 (r322910) @@ -86,13 +86,13 @@ int xdr_dir (XDR *, char *); int main(int argc, char *argv[]) { - int all, errs, ch, mntsize, error; + int all, errs, ch, mntsize, error, nfsforce, ret; char **typelist = NULL; struct statfs *mntbuf, *sfs; struct addrinfo hints; - all = errs = 0; - while ((ch = getopt(argc, argv, "AaF:fh:nt:v")) != -1) + nfsforce = all = errs = 0; + while ((ch = getopt(argc, argv, "AaF:fh:Nnt:v")) != -1) switch (ch) { case 'A': all = 2; @@ -110,6 +110,9 @@ main(int argc, char *argv[]) all = 2; nfshost = optarg; break; + case 'N': + nfsforce = 1; + break; case 'n': fflag |= MNT_NONBUSY; break; @@ -132,12 +135,15 @@ main(int argc, char *argv[]) err(1, "-f and -n are mutually exclusive"); /* Start disks transferring immediately. */ - if ((fflag & (MNT_FORCE | MNT_NONBUSY)) == 0) + if ((fflag & (MNT_FORCE | MNT_NONBUSY)) == 0 && nfsforce == 0) sync(); if ((argc == 0 && !all) || (argc != 0 && all)) usage(); + if (nfsforce != 0 && (argc == 0 || nfshost != NULL || typelist != NULL)) + usage(); + /* -h implies "-t nfs" if no -t flag. */ if ((nfshost != NULL) && (typelist == NULL)) typelist = makevfslist("nfs"); @@ -175,7 +181,20 @@ main(int argc, char *argv[]) break; case 0: for (errs = 0; *argv != NULL; ++argv) - if (checkname(*argv, typelist) != 0) + if (nfsforce != 0) { + /* + * First do the nfssvc() syscall to shut down + * the mount point and then do the forced + * dismount. + */ + ret = nfssvc(NFSSVC_FORCEDISM, *argv); + if (ret >= 0) + ret = unmount(*argv, MNT_FORCE); + if (ret < 0) { + warn("%s", *argv); + errs = 1; + } + } else if (checkname(*argv, typelist) != 0) errs = 1; break; } @@ -635,7 +654,7 @@ usage(void) { (void)fprintf(stderr, "%s\n%s\n", - "usage: umount [-fnv] special ... | node ... | fsid ...", + "usage: umount [-fNnv] special ... | node ... | fsid ...", " umount -a | -A [-F fstab] [-fnv] [-h host] [-t type]"); exit(1); } From owner-svn-src-all@freebsd.org Fri Aug 25 23:10:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80A32DE3758; Fri, 25 Aug 2017 23:10:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D87A74599; Fri, 25 Aug 2017 23:10:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PNARnZ025379; Fri, 25 Aug 2017 23:10:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PNARk5025378; Fri, 25 Aug 2017 23:10:27 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708252310.v7PNARk5025378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Aug 2017 23:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322912 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322912 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 23:10:28 -0000 Author: jhb Date: Fri Aug 25 23:10:27 2017 New Revision: 322912 URL: https://svnweb.freebsd.org/changeset/base/322912 Log: Don't grab SOCK_LOCK for soref() when queuing an AIO request. The AIO job holds a reference on the associated file descriptor, so the socket's count should already be > 0. This fixes a LOR with the socket buffer lock after recent socket locking changes in HEAD. Sponsored by: Chelsio Communications Modified: head/sys/kern/sys_socket.c Modified: head/sys/kern/sys_socket.c ============================================================================== --- head/sys/kern/sys_socket.c Fri Aug 25 23:09:11 2017 (r322911) +++ head/sys/kern/sys_socket.c Fri Aug 25 23:10:27 2017 (r322912) @@ -746,11 +746,7 @@ sowakeup_aio(struct socket *so, struct sockbuf *sb) if (sb->sb_flags & SB_AIO_RUNNING) return; sb->sb_flags |= SB_AIO_RUNNING; - if (sb == &so->so_snd) - SOCK_LOCK(so); soref(so); - if (sb == &so->so_snd) - SOCK_UNLOCK(so); soaio_enqueue(&sb->sb_aiotask); } From owner-svn-src-all@freebsd.org Fri Aug 25 23:13:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA00ADE3948; Fri, 25 Aug 2017 23:13:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 729C274968; Fri, 25 Aug 2017 23:13:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PNDLu1029152; Fri, 25 Aug 2017 23:13:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PNDLk4029149; Fri, 25 Aug 2017 23:13:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708252313.v7PNDLk4029149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 25 Aug 2017 23:13:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322913 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 322913 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 23:13:22 -0000 Author: kib Date: Fri Aug 25 23:13:21 2017 New Revision: 322913 URL: https://svnweb.freebsd.org/changeset/base/322913 Log: Replace global swhash in swap pager with per-object trie to track swap blocks assigned to the object pages. - The global swhash_mtx is removed, trie is synchronized by the corresponding object lock. - The swp_pager_meta_free_all() function used during object termination is optimized by only looking at the trie instead of having to search whole hash for the swap blocks owned by the object. - On swap_pager_swapoff(), instead of iterating over the swhash, global object list have to be inspected. There, we have to ensure that we do see valid trie content if we see that the object type is swap. Sizing of the swblk zone is same as for swblock zone, each swblk maps SWAP_META_PAGES pages. Proposed by: alc Reviewed by: alc, markj (previous version) Tested by: alc, pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 month Differential revision: https://reviews.freebsd.org/D11435 Modified: head/sys/vm/swap_pager.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Fri Aug 25 23:10:27 2017 (r322912) +++ head/sys/vm/swap_pager.c Fri Aug 25 23:13:21 2017 (r322913) @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -127,22 +128,17 @@ __FBSDID("$FreeBSD$"); #define SWB_NPAGES MAX_PAGEOUT_CLUSTER #endif +#define SWAP_META_PAGES PCTRIE_COUNT + /* - * The swblock structure maps an object and a small, fixed-size range - * of page indices to disk addresses within a swap area. - * The collection of these mappings is implemented as a hash table. - * Unused disk addresses within a swap area are allocated and managed - * using a blist. + * A swblk structure maps each page index within a + * SWAP_META_PAGES-aligned and sized range to the address of an + * on-disk swap block (or SWAPBLK_NONE). The collection of these + * mappings for an entire vm object is implemented as a pc-trie. */ -#define SWAP_META_PAGES 32 -#define SWAP_META_MASK (SWAP_META_PAGES - 1) - -struct swblock { - struct swblock *swb_hnext; - vm_object_t swb_object; - vm_pindex_t swb_index; - int swb_count; - daddr_t swb_pages[SWAP_META_PAGES]; +struct swblk { + vm_pindex_t p; + daddr_t d[SWAP_META_PAGES]; }; static MALLOC_DEFINE(M_VMPGDATA, "vm_pgdata", "swap pager private data"); @@ -328,10 +324,6 @@ SYSCTL_PROC(_vm, OID_AUTO, swap_async_max, CTLTYPE_INT CTLFLAG_MPSAFE, NULL, 0, sysctl_swap_async_max, "I", "Maximum running async swap ops"); -static struct swblock **swhash; -static int swhash_mask; -static struct mtx swhash_mtx; - static struct sx sw_alloc_sx; /* @@ -345,7 +337,8 @@ static struct sx sw_alloc_sx; (&swap_pager_object_list[((int)(intptr_t)handle >> 4) & (NOBJLISTS-1)]) static struct pagerlst swap_pager_object_list[NOBJLISTS]; -static uma_zone_t swap_zone; +static uma_zone_t swblk_zone; +static uma_zone_t swpctrie_zone; /* * pagerops for OBJT_SWAP - "swap pager". Some ops are also global procedure @@ -403,12 +396,28 @@ static daddr_t swp_pager_getswapspace(int npages); /* * Metadata functions */ -static struct swblock **swp_pager_hash(vm_object_t object, vm_pindex_t index); static void swp_pager_meta_build(vm_object_t, vm_pindex_t, daddr_t); static void swp_pager_meta_free(vm_object_t, vm_pindex_t, vm_pindex_t); static void swp_pager_meta_free_all(vm_object_t); static daddr_t swp_pager_meta_ctl(vm_object_t, vm_pindex_t, int); +static void * +swblk_trie_alloc(struct pctrie *ptree) +{ + + return (uma_zalloc(swpctrie_zone, M_NOWAIT | (curproc == pageproc ? + M_USE_RESERVE : 0))); +} + +static void +swblk_trie_free(struct pctrie *ptree, void *node) +{ + + uma_zfree(swpctrie_zone, node); +} + +PCTRIE_DEFINE(SWAP, swblk, p, swblk_trie_alloc, swblk_trie_free); + /* * SWP_SIZECHECK() - update swap_pager_full indication * @@ -437,33 +446,6 @@ swp_sizecheck(void) } /* - * SWP_PAGER_HASH() - hash swap meta data - * - * This is an helper function which hashes the swapblk given - * the object and page index. It returns a pointer to a pointer - * to the object, or a pointer to a NULL pointer if it could not - * find a swapblk. - */ -static struct swblock ** -swp_pager_hash(vm_object_t object, vm_pindex_t index) -{ - struct swblock **pswap; - struct swblock *swap; - - index &= ~(vm_pindex_t)SWAP_META_MASK; - pswap = &swhash[(index ^ (int)(intptr_t)object) & swhash_mask]; - while ((swap = *pswap) != NULL) { - if (swap->swb_object == object && - swap->swb_index == index - ) { - break; - } - pswap = &swap->swb_hnext; - } - return (pswap); -} - -/* * SWAP_PAGER_INIT() - initialize the swap pager! * * Expected to be started from system init. NOTE: This code is run @@ -528,21 +510,25 @@ swap_pager_swap_init(void) mtx_unlock(&pbuf_mtx); /* - * Initialize our zone. Right now I'm just guessing on the number - * we need based on the number of pages in the system. Each swblock - * can hold 32 pages, so this is probably overkill. This reservation - * is typically limited to around 32MB by default. + * Initialize our zone, guessing on the number we need based + * on the number of pages in the system. */ n = vm_cnt.v_page_count / 2; - if (maxswzone && n > maxswzone / sizeof(struct swblock)) - n = maxswzone / sizeof(struct swblock); + if (maxswzone && n > maxswzone / sizeof(struct swblk)) + n = maxswzone / sizeof(struct swblk); + swpctrie_zone = uma_zcreate("swpctrie", pctrie_node_size(), NULL, NULL, + pctrie_zone_init, NULL, UMA_ALIGN_PTR, + UMA_ZONE_NOFREE | UMA_ZONE_VM); + if (swpctrie_zone == NULL) + panic("failed to create swap pctrie zone."); + swblk_zone = uma_zcreate("swblk", sizeof(struct swblk), NULL, NULL, + NULL, NULL, _Alignof(struct swblk) - 1, + UMA_ZONE_NOFREE | UMA_ZONE_VM); + if (swblk_zone == NULL) + panic("failed to create swap blk zone."); n2 = n; - swap_zone = uma_zcreate("SWAPMETA", sizeof(struct swblock), NULL, NULL, - NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE | UMA_ZONE_VM); - if (swap_zone == NULL) - panic("failed to create swap_zone."); do { - if (uma_zone_reserve_kva(swap_zone, n)) + if (uma_zone_reserve_kva(swblk_zone, n)) break; /* * if the allocation failed, try a zone two thirds the @@ -551,24 +537,13 @@ swap_pager_swap_init(void) n -= ((n + 2) / 3); } while (n > 0); if (n2 != n) - printf("Swap zone entries reduced from %lu to %lu.\n", n2, n); + printf("Swap blk zone entries reduced from %lu to %lu.\n", + n2, n); swap_maxpages = n * SWAP_META_PAGES; - swzone = n * sizeof(struct swblock); - n2 = n; - - /* - * Initialize our meta-data hash table. The swapper does not need to - * be quite as efficient as the VM system, so we do not use an - * oversized hash table. - * - * n: size of hash table, must be power of 2 - * swhash_mask: hash table index mask - */ - for (n = 1; n < n2 / 8; n *= 2) - ; - swhash = malloc(sizeof(struct swblock *) * n, M_VMPGDATA, M_WAITOK | M_ZERO); - swhash_mask = n - 1; - mtx_init(&swhash_mtx, "swap_pager swhash", NULL, MTX_DEF); + swzone = n * sizeof(struct swblk); + if (!uma_zone_reserve_kva(swpctrie_zone, n)) + printf("Cannot reserve swap pctrie zone, " + "reduce kern.maxswzone.\n"); } static vm_object_t @@ -582,14 +557,20 @@ swap_pager_alloc_init(void *handle, struct ucred *cred return (NULL); crhold(cred); } + + /* + * The un_pager.swp.swp_blks trie is initialized by + * vm_object_allocate() to ensure the correct order of + * visibility to other threads. + */ object = vm_object_allocate(OBJT_SWAP, OFF_TO_IDX(offset + PAGE_MASK + size)); + object->handle = handle; if (cred != NULL) { object->cred = cred; object->charge = size; } - object->un_pager.swp.swp_bcount = 0; return (object); } @@ -1651,50 +1632,56 @@ swp_pager_force_pagein(vm_object_t object, vm_pindex_t static void swap_pager_swapoff(struct swdevt *sp) { - struct swblock *swap; - vm_object_t locked_obj, object; - vm_pindex_t pindex; - int i, j, retries; + struct swblk *sb; + vm_object_t object; + vm_pindex_t pi; + int i, retries; sx_assert(&swdev_syscall_lock, SA_XLOCKED); retries = 0; - locked_obj = NULL; full_rescan: - mtx_lock(&swhash_mtx); - for (i = 0; i <= swhash_mask; i++) { /* '<=' is correct here */ -restart: - for (swap = swhash[i]; swap != NULL; swap = swap->swb_hnext) { - object = swap->swb_object; - pindex = swap->swb_index; - for (j = 0; j < SWAP_META_PAGES; ++j) { - if (!swp_pager_isondev(swap->swb_pages[j], sp)) + mtx_lock(&vm_object_list_mtx); + TAILQ_FOREACH(object, &vm_object_list, object_list) { + if (object->type != OBJT_SWAP) + continue; + mtx_unlock(&vm_object_list_mtx); + /* Depends on type-stability. */ + VM_OBJECT_WLOCK(object); + + /* + * Dead objects are eventually terminated on their own. + */ + if ((object->flags & OBJ_DEAD) != 0) + goto next_obj; + + /* + * Sync with fences placed after pctrie + * initialization. We must not access pctrie below + * unless we checked that our object is swap and not + * dead. + */ + atomic_thread_fence_acq(); + if (object->type != OBJT_SWAP) + goto next_obj; + + for (pi = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( + &object->un_pager.swp.swp_blks, pi)) != NULL; ) { + pi = sb->p + SWAP_META_PAGES; + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] == SWAPBLK_NONE) continue; - if (locked_obj != object) { - if (locked_obj != NULL) - VM_OBJECT_WUNLOCK(locked_obj); - locked_obj = object; - if (!VM_OBJECT_TRYWLOCK(object)) { - mtx_unlock(&swhash_mtx); - /* Depends on type-stability. */ - VM_OBJECT_WLOCK(object); - mtx_lock(&swhash_mtx); - goto restart; - } - } - MPASS(locked_obj == object); - mtx_unlock(&swhash_mtx); - swp_pager_force_pagein(object, pindex + j); - mtx_lock(&swhash_mtx); - goto restart; + if (swp_pager_isondev(sb->d[i], sp)) + swp_pager_force_pagein(object, + sb->p + i); } } +next_obj: + VM_OBJECT_WUNLOCK(object); + mtx_lock(&vm_object_list_mtx); } - mtx_unlock(&swhash_mtx); - if (locked_obj != NULL) { - VM_OBJECT_WUNLOCK(locked_obj); - locked_obj = NULL; - } + mtx_unlock(&vm_object_list_mtx); + if (sp->sw_used) { /* * Objects may be locked or paging to the device being @@ -1738,85 +1725,88 @@ restart: static void swp_pager_meta_build(vm_object_t object, vm_pindex_t pindex, daddr_t swapblk) { - static volatile int exhausted; - struct swblock *swap; - struct swblock **pswap; - int idx; + static volatile int swblk_zone_exhausted, swpctrie_zone_exhausted; + struct swblk *sb; + vm_pindex_t modpi, rdpi; + int error, i; VM_OBJECT_ASSERT_WLOCKED(object); + /* * Convert default object to swap object if necessary */ if (object->type != OBJT_SWAP) { + pctrie_init(&object->un_pager.swp.swp_blks); + + /* + * Ensure that swap_pager_swapoff()'s iteration over + * object_list does not see a garbage pctrie. + */ + atomic_thread_fence_rel(); + object->type = OBJT_SWAP; - object->un_pager.swp.swp_bcount = 0; KASSERT(object->handle == NULL, ("default pager with handle")); } - /* - * Locate hash entry. If not found create, but if we aren't adding - * anything just return. If we run out of space in the map we wait - * and, since the hash table may have changed, retry. - */ -retry: - mtx_lock(&swhash_mtx); - pswap = swp_pager_hash(object, pindex); - - if ((swap = *pswap) == NULL) { - int i; - + rdpi = rounddown(pindex, SWAP_META_PAGES); + sb = SWAP_PCTRIE_LOOKUP(&object->un_pager.swp.swp_blks, rdpi); + if (sb == NULL) { if (swapblk == SWAPBLK_NONE) - goto done; - - swap = *pswap = uma_zalloc(swap_zone, M_NOWAIT | - (curproc == pageproc ? M_USE_RESERVE : 0)); - if (swap == NULL) { - mtx_unlock(&swhash_mtx); + return; + for (;;) { + sb = uma_zalloc(swblk_zone, M_NOWAIT | (curproc == + pageproc ? M_USE_RESERVE : 0)); + if (sb != NULL) { + sb->p = rdpi; + for (i = 0; i < SWAP_META_PAGES; i++) + sb->d[i] = SWAPBLK_NONE; + if (atomic_cmpset_int(&swblk_zone_exhausted, + 1, 0)) + printf("swblk zone ok\n"); + break; + } VM_OBJECT_WUNLOCK(object); - if (uma_zone_exhausted(swap_zone)) { - if (atomic_cmpset_int(&exhausted, 0, 1)) - printf("swap zone exhausted, " + if (uma_zone_exhausted(swblk_zone)) { + if (atomic_cmpset_int(&swblk_zone_exhausted, + 0, 1)) + printf("swap blk zone exhausted, " "increase kern.maxswzone\n"); vm_pageout_oom(VM_OOM_SWAPZ); - pause("swzonex", 10); + pause("swzonxb", 10); } else VM_WAIT; VM_OBJECT_WLOCK(object); - goto retry; } - - if (atomic_cmpset_int(&exhausted, 1, 0)) - printf("swap zone ok\n"); - - swap->swb_hnext = NULL; - swap->swb_object = object; - swap->swb_index = pindex & ~(vm_pindex_t)SWAP_META_MASK; - swap->swb_count = 0; - - ++object->un_pager.swp.swp_bcount; - - for (i = 0; i < SWAP_META_PAGES; ++i) - swap->swb_pages[i] = SWAPBLK_NONE; + for (;;) { + error = SWAP_PCTRIE_INSERT( + &object->un_pager.swp.swp_blks, sb); + if (error == 0) { + if (atomic_cmpset_int(&swpctrie_zone_exhausted, + 1, 0)) + printf("swpctrie zone ok\n"); + break; + } + VM_OBJECT_WUNLOCK(object); + if (uma_zone_exhausted(swpctrie_zone)) { + if (atomic_cmpset_int(&swpctrie_zone_exhausted, + 0, 1)) + printf("swap pctrie zone exhausted, " + "increase kern.maxswzone\n"); + vm_pageout_oom(VM_OOM_SWAPZ); + pause("swzonxp", 10); + } else + VM_WAIT; + VM_OBJECT_WLOCK(object); + } } + MPASS(sb->p == rdpi); - /* - * Delete prior contents of metadata - */ - idx = pindex & SWAP_META_MASK; - - if (swap->swb_pages[idx] != SWAPBLK_NONE) { - swp_pager_freeswapspace(swap->swb_pages[idx], 1); - --swap->swb_count; - } - - /* - * Enter block into metadata - */ - swap->swb_pages[idx] = swapblk; - if (swapblk != SWAPBLK_NONE) - ++swap->swb_count; -done: - mtx_unlock(&swhash_mtx); + modpi = pindex % SWAP_META_PAGES; + /* Delete prior contents of metadata. */ + if (sb->d[modpi] != SWAPBLK_NONE) + swp_pager_freeswapspace(sb->d[modpi], 1); + /* Enter block into metadata. */ + sb->d[modpi] = swapblk; } /* @@ -1830,42 +1820,40 @@ done: * with resident pages. */ static void -swp_pager_meta_free(vm_object_t object, vm_pindex_t index, vm_pindex_t count) +swp_pager_meta_free(vm_object_t object, vm_pindex_t pindex, vm_pindex_t count) { - struct swblock **pswap, *swap; - vm_pindex_t c; - daddr_t v; - int n, sidx; + struct swblk *sb; + vm_pindex_t last; + int i; + bool empty; VM_OBJECT_ASSERT_LOCKED(object); if (object->type != OBJT_SWAP || count == 0) return; - mtx_lock(&swhash_mtx); - for (c = 0; c < count;) { - pswap = swp_pager_hash(object, index); - sidx = index & SWAP_META_MASK; - n = SWAP_META_PAGES - sidx; - index += n; - if ((swap = *pswap) == NULL) { - c += n; - continue; - } - for (; c < count && sidx < SWAP_META_PAGES; ++c, ++sidx) { - if ((v = swap->swb_pages[sidx]) == SWAPBLK_NONE) + last = pindex + count - 1; + for (;;) { + sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, + rounddown(pindex, SWAP_META_PAGES)); + if (sb == NULL || sb->p > last) + break; + empty = true; + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] == SWAPBLK_NONE) continue; - swp_pager_freeswapspace(v, 1); - swap->swb_pages[sidx] = SWAPBLK_NONE; - if (--swap->swb_count == 0) { - *pswap = swap->swb_hnext; - uma_zfree(swap_zone, swap); - --object->un_pager.swp.swp_bcount; - c += SWAP_META_PAGES - sidx; - break; - } + if (pindex <= sb->p + i && sb->p + i <= last) { + swp_pager_freeswapspace(sb->d[i], 1); + sb->d[i] = SWAPBLK_NONE; + } else + empty = false; } + pindex = sb->p + SWAP_META_PAGES; + if (empty) { + SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, + sb->p); + uma_zfree(swblk_zone, sb); + } } - mtx_unlock(&swhash_mtx); } /* @@ -1877,36 +1865,23 @@ swp_pager_meta_free(vm_object_t object, vm_pindex_t in static void swp_pager_meta_free_all(vm_object_t object) { - struct swblock **pswap, *swap; - vm_pindex_t index; - daddr_t v; + struct swblk *sb; + vm_pindex_t pindex; int i; VM_OBJECT_ASSERT_WLOCKED(object); if (object->type != OBJT_SWAP) return; - index = 0; - while (object->un_pager.swp.swp_bcount != 0) { - mtx_lock(&swhash_mtx); - pswap = swp_pager_hash(object, index); - if ((swap = *pswap) != NULL) { - for (i = 0; i < SWAP_META_PAGES; ++i) { - v = swap->swb_pages[i]; - if (v != SWAPBLK_NONE) { - --swap->swb_count; - swp_pager_freeswapspace(v, 1); - } - } - if (swap->swb_count != 0) - panic( - "swap_pager_meta_free_all: swb_count != 0"); - *pswap = swap->swb_hnext; - uma_zfree(swap_zone, swap); - --object->un_pager.swp.swp_bcount; + for (pindex = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( + &object->un_pager.swp.swp_blks, pindex)) != NULL;) { + pindex = sb->p + SWAP_META_PAGES; + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] != SWAPBLK_NONE) + swp_pager_freeswapspace(sb->d[i], 1); } - mtx_unlock(&swhash_mtx); - index += SWAP_META_PAGES; + SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, sb->p); + uma_zfree(swblk_zone, sb); } } @@ -1920,9 +1895,6 @@ swp_pager_meta_free_all(vm_object_t object) * was invalid. This routine will automatically free any invalid * meta-data swapblks. * - * It is not possible to store invalid swapblks in the swap meta data - * (other then a literal 'SWAPBLK_NONE'), so we don't bother checking. - * * When acting on a busy resident page and paging is in progress, we * have to wait until paging is complete but otherwise can act on the * busy page. @@ -1933,10 +1905,9 @@ swp_pager_meta_free_all(vm_object_t object) static daddr_t swp_pager_meta_ctl(vm_object_t object, vm_pindex_t pindex, int flags) { - struct swblock **pswap; - struct swblock *swap; + struct swblk *sb; daddr_t r1; - int idx; + int i; VM_OBJECT_ASSERT_LOCKED(object); /* @@ -1946,30 +1917,29 @@ swp_pager_meta_ctl(vm_object_t object, vm_pindex_t pin if (object->type != OBJT_SWAP) return (SWAPBLK_NONE); - r1 = SWAPBLK_NONE; - mtx_lock(&swhash_mtx); - pswap = swp_pager_hash(object, pindex); - - if ((swap = *pswap) != NULL) { - idx = pindex & SWAP_META_MASK; - r1 = swap->swb_pages[idx]; - - if (r1 != SWAPBLK_NONE) { - if (flags & SWM_FREE) { - swp_pager_freeswapspace(r1, 1); - r1 = SWAPBLK_NONE; - } - if (flags & (SWM_FREE|SWM_POP)) { - swap->swb_pages[idx] = SWAPBLK_NONE; - if (--swap->swb_count == 0) { - *pswap = swap->swb_hnext; - uma_zfree(swap_zone, swap); - --object->un_pager.swp.swp_bcount; - } - } + sb = SWAP_PCTRIE_LOOKUP(&object->un_pager.swp.swp_blks, + rounddown(pindex, SWAP_META_PAGES)); + if (sb == NULL) + return (SWAPBLK_NONE); + r1 = sb->d[pindex % SWAP_META_PAGES]; + if (r1 == SWAPBLK_NONE) + return (SWAPBLK_NONE); + if ((flags & (SWM_FREE | SWM_POP)) != 0) { + sb->d[pindex % SWAP_META_PAGES] = SWAPBLK_NONE; + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] != SWAPBLK_NONE) + break; } + if (i == SWAP_META_PAGES) { + SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, + rounddown(pindex, SWAP_META_PAGES)); + uma_zfree(swblk_zone, sb); + } } - mtx_unlock(&swhash_mtx); + if ((flags & SWM_FREE) != 0) { + swp_pager_freeswapspace(r1, 1); + r1 = SWAPBLK_NONE; + } return (r1); } @@ -1983,32 +1953,38 @@ swp_pager_meta_ctl(vm_object_t object, vm_pindex_t pin vm_pindex_t swap_pager_find_least(vm_object_t object, vm_pindex_t pindex) { - struct swblock **pswap, *swap; - vm_pindex_t i, j, lim; - int idx; + struct swblk *sb; + int i; VM_OBJECT_ASSERT_LOCKED(object); - if (object->type != OBJT_SWAP || object->un_pager.swp.swp_bcount == 0) + if (object->type != OBJT_SWAP) return (object->size); - mtx_lock(&swhash_mtx); - for (j = pindex; j < object->size; j = lim) { - pswap = swp_pager_hash(object, j); - lim = rounddown2(j + SWAP_META_PAGES, SWAP_META_PAGES); - if (lim > object->size) - lim = object->size; - if ((swap = *pswap) != NULL) { - for (idx = j & SWAP_META_MASK, i = j; i < lim; - i++, idx++) { - if (swap->swb_pages[idx] != SWAPBLK_NONE) - goto found; - } + sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, + rounddown(pindex, SWAP_META_PAGES)); + if (sb == NULL) + return (object->size); + if (sb->p < pindex) { + for (i = pindex % SWAP_META_PAGES; i < SWAP_META_PAGES; i++) { + if (sb->d[i] != SWAPBLK_NONE) + return (sb->p + i); } + sb = SWAP_PCTRIE_LOOKUP_GE(&object->un_pager.swp.swp_blks, + roundup(pindex, SWAP_META_PAGES)); + if (sb == NULL) + return (object->size); } - i = object->size; -found: - mtx_unlock(&swhash_mtx); - return (i); + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->d[i] != SWAPBLK_NONE) + return (sb->p + i); + } + + /* + * We get here if a swblk is present in the trie but it + * doesn't map any blocks. + */ + MPASS(0); + return (object->size); } /* @@ -2044,7 +2020,7 @@ sys_swapon(struct thread *td, struct swapon_args *uap) * Swap metadata may not fit in the KVM if we have physical * memory of >1GB. */ - if (swap_zone == NULL) { + if (swblk_zone == NULL) { error = ENOMEM; goto done; } @@ -2088,7 +2064,7 @@ swapon_check_swzone(unsigned long npages) unsigned long maxpages; /* absolute maximum we can handle assuming 100% efficiency */ - maxpages = uma_zone_get_max(swap_zone) * SWAP_META_PAGES; + maxpages = uma_zone_get_max(swblk_zone) * SWAP_META_PAGES; /* recommend using no more than half that amount */ if (npages > maxpages / 2) { @@ -2413,15 +2389,9 @@ SYSCTL_NODE(_vm, OID_AUTO, swap_info, CTLFLAG_RD | CTL "Swap statistics by device"); /* - * vmspace_swap_count() - count the approximate swap usage in pages for a - * vmspace. - * - * The map must be locked. - * - * Swap usage is determined by taking the proportional swap used by - * VM objects backing the VM map. To make up for fractional losses, - * if the VM object has any swap use at all the associated map entries - * count for at least 1 swap page. + * Count the approximate swap usage in pages for a vmspace. The + * shadowed or not yet copied on write swap blocks are not accounted. + * The map must be locked. */ long vmspace_swap_count(struct vmspace *vmspace) @@ -2429,23 +2399,38 @@ vmspace_swap_count(struct vmspace *vmspace) vm_map_t map; vm_map_entry_t cur; vm_object_t object; - long count, n; + struct swblk *sb; + vm_pindex_t e, pi; + long count; + int i; map = &vmspace->vm_map; count = 0; for (cur = map->header.next; cur != &map->header; cur = cur->next) { - if ((cur->eflags & MAP_ENTRY_IS_SUB_MAP) == 0 && - (object = cur->object.vm_object) != NULL) { - VM_OBJECT_WLOCK(object); - if (object->type == OBJT_SWAP && - object->un_pager.swp.swp_bcount != 0) { - n = (cur->end - cur->start) / PAGE_SIZE; - count += object->un_pager.swp.swp_bcount * - SWAP_META_PAGES * n / object->size + 1; + if ((cur->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) + continue; + object = cur->object.vm_object; + if (object == NULL || object->type != OBJT_SWAP) + continue; + VM_OBJECT_RLOCK(object); + if (object->type != OBJT_SWAP) + goto unlock; + pi = OFF_TO_IDX(cur->offset); + e = pi + OFF_TO_IDX(cur->end - cur->start); + for (;; pi = sb->p + SWAP_META_PAGES) { + sb = SWAP_PCTRIE_LOOKUP_GE( + &object->un_pager.swp.swp_blks, pi); + if (sb == NULL || sb->p >= e) + break; + for (i = 0; i < SWAP_META_PAGES; i++) { + if (sb->p + i < e && + sb->d[i] != SWAPBLK_NONE) + count++; } - VM_OBJECT_WUNLOCK(object); } +unlock: + VM_OBJECT_RUNLOCK(object); } return (count); } Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Fri Aug 25 23:10:27 2017 (r322912) +++ head/sys/vm/vm_object.c Fri Aug 25 23:13:21 2017 (r322913) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include /* for curproc, pageproc */ @@ -208,6 +209,7 @@ vm_object_zinit(void *mem, int size, int flags) object->paging_in_progress = 0; object->resident_page_count = 0; object->shadow_count = 0; + object->flags = OBJ_DEAD; mtx_lock(&vm_object_list_mtx); TAILQ_INSERT_TAIL(&vm_object_list, object, object_list); @@ -223,6 +225,16 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, LIST_INIT(&object->shadow_head); object->type = type; + if (type == OBJT_SWAP) + pctrie_init(&object->un_pager.swp.swp_blks); + + /* + * Ensure that swap_pager_swapoff() iteration over object_list + * sees up to date type and pctrie head if it observed + * non-dead object. + */ + atomic_thread_fence_rel(); + switch (type) { case OBJT_DEAD: panic("_vm_object_allocate: can't create OBJT_DEAD"); Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Fri Aug 25 23:10:27 2017 (r322912) +++ head/sys/vm/vm_object.h Fri Aug 25 23:13:21 2017 (r322913) @@ -70,6 +70,7 @@ #include #include #include +#include #include #include @@ -151,13 +152,12 @@ struct vm_object { * the handle changed and hash-chain * invalid. * - * swp_bcount - number of swap 'swblock' metablocks, each - * contains up to 16 swapblk assignments. - * see vm/swap_pager.h + * swp_blks - pc-trie of the allocated swap blocks. + * */ struct { void *swp_tmpfs; - int swp_bcount; + struct pctrie swp_blks; } swp; } un_pager; struct ucred *cred; From owner-svn-src-all@freebsd.org Fri Aug 25 23:18:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C111BDE3A07; Fri, 25 Aug 2017 23:18:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8391374AE6; Fri, 25 Aug 2017 23:18:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id B8E0E1899F; Fri, 25 Aug 2017 23:18:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id A7D918A4C; Fri, 25 Aug 2017 23:18:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id CPjV7Wi9Z9lW; Fri, 25 Aug 2017 23:18:15 +0000 (UTC) Subject: Re: svn commit: r306512 - in head/sys: kern sys DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 80B4D8A46 To: Konstantin Belousov Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201609301727.u8UHRIgD051373@repo.freebsd.org> <6ea06065-ea5c-b83b-3854-224626be0d77@FreeBSD.org> <20170825103534.GK1700@kib.kiev.ua> <20170825223752.GN1700@kib.kiev.ua> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <25ad986d-7a39-7854-5680-390c20a16743@FreeBSD.org> Date: Fri, 25 Aug 2017 16:17:59 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170825223752.GN1700@kib.kiev.ua> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ckNkO69sC6vSopMtmTNabeTjjuTFbw2Ln" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 23:18:24 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ckNkO69sC6vSopMtmTNabeTjjuTFbw2Ln Content-Type: multipart/mixed; boundary="XcVkcx4Ax0N4CvI0m0sJTwwIAQNHHrAqp"; protected-headers="v1" From: Bryan Drewery To: Konstantin Belousov Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <25ad986d-7a39-7854-5680-390c20a16743@FreeBSD.org> Subject: Re: svn commit: r306512 - in head/sys: kern sys References: <201609301727.u8UHRIgD051373@repo.freebsd.org> <6ea06065-ea5c-b83b-3854-224626be0d77@FreeBSD.org> <20170825103534.GK1700@kib.kiev.ua> <20170825223752.GN1700@kib.kiev.ua> In-Reply-To: <20170825223752.GN1700@kib.kiev.ua> --XcVkcx4Ax0N4CvI0m0sJTwwIAQNHHrAqp Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 8/25/2017 3:37 PM, Konstantin Belousov wrote: > On Fri, Aug 25, 2017 at 02:29:28PM -0700, Bryan Drewery wrote: >> https://people.freebsd.org/~bdrewery/patches/vdrop-global-list.diff > I do not object against his handling. >=20 > There is really very small amount of code shared between mp !=3D NULL > and mp =3D=3D NULL cases, you may consider making them use separate pat= hs > instead of adding more than one check for mp !=3D NULL. >=20 Sure, and I incorrectly was adding VMP_TMPMNTFREELIST flag for mp=3D=3DNU= LL case. I'll open a review. > VNASSERT() statement has wrong indent on the continuation line. >=20 --=20 Regards, Bryan Drewery --XcVkcx4Ax0N4CvI0m0sJTwwIAQNHHrAqp-- --ckNkO69sC6vSopMtmTNabeTjjuTFbw2Ln Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJZoLAnAAoJEDXXcbtuRpfPRJ0IANds7jjlR2FGihpYQv0WqPvE 5ZGVBB8raABuIacEkeZUjnHP2eAcbNvAdg0LUvelIRRyTLKJI8pc/LR1tT45qZfU 36Zhher7I+75ymxYbnzhi/sQJ2CUiyzHORaByCJXHhVvUyysgEDNqyuZXCfF8fMB 3Kj+Ztlt8e5da4f6GPnzJSxG0qzzuU+JqMALWWu5rfNToUH0HyYOphMu+rqcgPki TvZ6z5rVgwMf6SfWpOvTf6qZh0p7Lt3wkKGdvpA96arkiGFCyBfUl3COkcr+5OU1 UTaOU5iQE2hD2RXneiIYi0vYnIkaKSBCMn0Y58EchGA6q4UBUFXGaai6wjSpi0c= =84mS -----END PGP SIGNATURE----- --ckNkO69sC6vSopMtmTNabeTjjuTFbw2Ln-- From owner-svn-src-all@freebsd.org Fri Aug 25 23:22:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BB45DE3BDC; Fri, 25 Aug 2017 23:22:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5CF4E74D31; Fri, 25 Aug 2017 23:22:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id F1A293C9552; Sat, 26 Aug 2017 08:49:12 +1000 (AEST) Date: Sat, 26 Aug 2017 08:49:12 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Conrad Meyer cc: Alan Somers , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322893 - head/bin/dd In-Reply-To: Message-ID: <20170826075540.X976@besplex.bde.org> References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=bc8baKHB c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=XdQGbixj9DvC8Hh_ePsA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 23:22:05 -0000 On Fri, 25 Aug 2017, Conrad Meyer wrote: > Well, not negative, just large uint64_t numbers that would be negative > as off_t (int64_t). > > E.g., dd if=/dev/kmem bs=1 iseek=0xfffff...foo count=8. I think we > would like that to work. I don't recall whether it does or not before > this change. This is broken on 64-bit systems, first by the horrible get_off_t(), then by broken range checking in at least old versions of dd. The first bug in get_off_t() is that it uses strtoimax(). This fails for offsets >= INTMAX_MAX. This breaks the natural use of dd to seek to the kernel part of kmem using dd. E.g.: dd if=/dev/kmem bs=1 count=1 iseek=0xffffffff802d2100 This should give a negative offset than then works. (lseek() to negative offsets is implementation-defined for special files, and FreeBSD defines it so that it works for seeking in kmem. This depends on some 2's complement magic to represent large unsigned offsets as negative signed.) However, it doesn't work to double bs and halve iseek. The multiplication is then done by a higher level. It exceeds OFF_MAX, so the lseek() isn't tried. get_off_t() but not the higher level is fixed in my version. It does work to calculate the negative offset in another way inside get_off_t(). E.g., bs=1 iseek=-1 gives -1 which is passed to lseek(). bs=2 iseek=-1 also works to give the correct offset of -2 for lseek(). The arithmetic for converting large number like 0xffffffff802d2100 to a negative value is painful, especially since shells have similar bugs near INTMAX_MAX and UINTMAX_MAX and with signed and/or unsigned types even if they support 64-bit integers. The buggy range checking for bs=2 iseek=0x7fffffff802d2100 seems to be only in old versions of dd. It was in jcl(), and was just for the initial args (multiplying them would exceed OFF_MAX). Now there seems to be no check for overflow. The multiplication in pos_in() just overflows even if the check in jcl() passed, later when the seek point advances past INTMAX_MAX (if this exceeds OFF_MAX, then passing the result of the multiplicating to lseek() starts overflowing before the multiplication does). [Context lost to top posting]. Bruce From owner-svn-src-all@freebsd.org Fri Aug 25 23:23:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 329A1DE3C59; Fri, 25 Aug 2017 23:23:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id ED6EE74FBC; Fri, 25 Aug 2017 23:23:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 12CA5102F24; Sat, 26 Aug 2017 09:23:07 +1000 (AEST) Date: Sat, 26 Aug 2017 09:23:06 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Matt Joras cc: cem@freebsd.org, Alan Somers , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322893 - head/bin/dd In-Reply-To: <4b016f89-61c5-fc8a-a36a-aca8166c369e@gmail.com> Message-ID: <20170826085102.S976@besplex.bde.org> References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> <4b016f89-61c5-fc8a-a36a-aca8166c369e@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=LI0WeNe9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=FwyhkCkCfzX_Wn5THrUA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 23:23:14 -0000 On Fri, 25 Aug 2017, Matt Joras wrote: > On 08/25/2017 10:17, Conrad Meyer wrote: >> This change seems to break buildworld on MIPS: >> >> /home/cem/head.svn/bin/dd/args.c: In function 'f_bs': >> /home/cem/head.svn/bin/dd/args.c:188: warning: format '%zd' expects >> type 'signed size_t', but argument 3 has type 'long int' >> /home/cem/head.svn/bin/dd/args.c: In function 'f_cbs': >> /home/cem/head.svn/bin/dd/args.c:199: warning: format '%zd' expects >> type 'signed size_t', but argument 3 has type 'long int' >> /home/cem/head.svn/bin/dd/args.c: In function 'f_ibs': >> /home/cem/head.svn/bin/dd/args.c:245: warning: format '%zd' expects >> type 'signed size_t', but argument 3 has type 'long int' >> /home/cem/head.svn/bin/dd/args.c: In function 'f_obs': >> /home/cem/head.svn/bin/dd/args.c:266: warning: format '%zd' expects >> type 'signed size_t', but argument 3 has type 'long int' >> >> (Yes, it's odd that the SSIZE_MAX constant has 'long' type.) >> > SSIZE_MAX should have type long, since ssize_t is a long on mips (and > other arches besides i386 and arm). Actually the reverse. ssize_t has the correct type int32_t (which happens to be int) on all 32-bit arches. SSIZE_MAX shouldn't have type long on 32-bit arches, but is broken by having that type on arm > Re: the build failure, that's in the GCC C format string checking, so > perhaps it's more accurate to say this breaks the (in-tree) GCC build. > %zd is the right format specifier for ssize_t. I guess GCC's format > string checking is getting confused because SSIZE_MAX is a constant that > expands to type long. Perhaps casting to ssize_t would GCC happier, but > that looks rather wrong. This is because gcc's format checking actually works. It detects that SSIZE_MAX has the incorrect type long on mips because it is defined as LONG_MAX there. arm/arm64, powerpc and x86 have ifdefs to define it correctly as INT_MAX in the 32-bit case. I finally found where POSIX requires SSIZE_MAX to have the "correct" type (POSIX doesn't define what that is. but C99 does). SSIZE_MAX is just in convered by the same rule as most C99 limits for integer types. So SSIZE_MAX is not permitted to be what it is on mips. Bruce From owner-svn-src-all@freebsd.org Fri Aug 25 23:31:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19C38DE3DB1; Fri, 25 Aug 2017 23:31:17 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCDE5753D9; Fri, 25 Aug 2017 23:31:16 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7PNVF76033830; Fri, 25 Aug 2017 23:31:15 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PNVFFI033829; Fri, 25 Aug 2017 23:31:15 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708252331.v7PNVFFI033829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 25 Aug 2017 23:31:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322914 - head/sys/dev/cxgbe/common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/common X-SVN-Commit-Revision: 322914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 23:31:17 -0000 Author: np Date: Fri Aug 25 23:31:15 2017 New Revision: 322914 URL: https://svnweb.freebsd.org/changeset/base/322914 Log: cxgbe(4): Dump the mailbox contents in the same format as CH_DUMP_MBOX. MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Fri Aug 25 23:13:21 2017 (r322913) +++ head/sys/dev/cxgbe/common/t4_hw.c Fri Aug 25 23:31:15 2017 (r322914) @@ -333,9 +333,9 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int * presaged the firmware crashing ... */ if (ctl & F_MBMSGVALID) { - CH_ERR(adap, "found VALID command in mbox %u: " - "%llx %llx %llx %llx %llx %llx %llx %llx\n", mbox, - (unsigned long long)t4_read_reg64(adap, data_reg), + CH_ERR(adap, "found VALID command in mbox %u: %016llx %016llx " + "%016llx %016llx %016llx %016llx %016llx %016llx\n", + mbox, (unsigned long long)t4_read_reg64(adap, data_reg), (unsigned long long)t4_read_reg64(adap, data_reg + 8), (unsigned long long)t4_read_reg64(adap, data_reg + 16), (unsigned long long)t4_read_reg64(adap, data_reg + 24), From owner-svn-src-all@freebsd.org Sat Aug 26 00:02:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93179DE47D2; Sat, 26 Aug 2017 00:02:20 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C1C376043; Sat, 26 Aug 2017 00:02:19 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi0-f52.google.com with SMTP id j144so10909600oib.1; Fri, 25 Aug 2017 17:02:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=mMTMisdGIqLkSzb6my5ijBV6p915NTUHIdXbZtCoUTE=; b=To4xyNRGiR4x4W1vs2H5AmQmceLVKnnLCFHf5CTixUO9lB6Ei5ZP/EdPlE49hqr0Ac 2OIKe8v4S1pax1cBJMXHrvAD0KQ6oL05GHSRjF+WfRpQuiDVeQ+wxmsoUcwBAwowsA2+ pUSK2eJuJEBw9ChdqccYq6opIN75urNsZdvAIGYjFEnhTSGtzmSNMF6EQYBQ98Vyk+/f jC0M5Jjxb4t6h4xigHCv/Wo9JUfBZAeLNsR4VTVLSDRRe1Erax6ITLEHJMwZK72zqrfq Ac0hLBBIzD3byk55kczIE5mmXZuNnJk8gfc9uVO4bO4VL+qI3p3S3ce4edqWJeORvrM5 MVbQ== X-Gm-Message-State: AHYfb5inM/dRZZySJDpl0CkTM+64+fLYSqf5DqO8IzemyPWYfuheHX/A Ssh6fmjaH2kjyL/RoOY= X-Received: by 10.202.52.69 with SMTP id b66mr258268oia.121.1503705732572; Fri, 25 Aug 2017 17:02:12 -0700 (PDT) Received: from mail-io0-f182.google.com (mail-io0-f182.google.com. [209.85.223.182]) by smtp.gmail.com with ESMTPSA id u77sm9219223oiu.25.2017.08.25.17.02.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Aug 2017 17:02:12 -0700 (PDT) Received: by mail-io0-f182.google.com with SMTP id c18so4161393ioj.1; Fri, 25 Aug 2017 17:02:12 -0700 (PDT) X-Received: by 10.107.140.88 with SMTP id o85mr139177iod.248.1503705731975; Fri, 25 Aug 2017 17:02:11 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.81.131 with HTTP; Fri, 25 Aug 2017 17:02:11 -0700 (PDT) In-Reply-To: <20170826075540.X976@besplex.bde.org> References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> <20170826075540.X976@besplex.bde.org> From: Conrad Meyer Date: Fri, 25 Aug 2017 17:02:11 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322893 - head/bin/dd To: Bruce Evans Cc: Alan Somers , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 00:02:20 -0000 On Fri, Aug 25, 2017 at 3:49 PM, Bruce Evans wrote: > get_off_t() but not the higher level is fixed in my version. Would you mind incorporating your version of dd into FreeBSD, or publishing it so someone else can? Thanks, Conrad From owner-svn-src-all@freebsd.org Sat Aug 26 00:17:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B6F2DE4B4C; Sat, 26 Aug 2017 00:17:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF64B765E4; Sat, 26 Aug 2017 00:17:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7Q0HvFE054008; Sat, 26 Aug 2017 00:17:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7Q0Hv9f054007; Sat, 26 Aug 2017 00:17:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708260017.v7Q0Hv9f054007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 26 Aug 2017 00:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322915 - head/contrib/compiler-rt/lib/builtins X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/contrib/compiler-rt/lib/builtins X-SVN-Commit-Revision: 322915 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 00:17:59 -0000 Author: jhb Date: Sat Aug 26 00:17:57 2017 New Revision: 322915 URL: https://svnweb.freebsd.org/changeset/base/322915 Log: Extend the workaround for LLVM bug 11663 to MIPS N32. This fixes infinite recursion in /sbin/init for MIPS N32. Submitted by: Robert M. Kovacsics MFC after: 1 week Sponsored by: DARPA / AFRL Modified: head/contrib/compiler-rt/lib/builtins/int_lib.h Modified: head/contrib/compiler-rt/lib/builtins/int_lib.h ============================================================================== --- head/contrib/compiler-rt/lib/builtins/int_lib.h Fri Aug 25 23:31:15 2017 (r322914) +++ head/contrib/compiler-rt/lib/builtins/int_lib.h Sat Aug 26 00:17:57 2017 (r322915) @@ -92,12 +92,13 @@ * does not have dedicated bit counting instructions. */ #if defined(__FreeBSD__) && (defined(__sparc64__) || \ - defined(__mips_n64) || defined(__mips_o64) || defined(__riscv)) + defined(__mips_n32) || defined(__mips_n64) || defined(__mips_o64) || \ + defined(__riscv)) si_int __clzsi2(si_int); si_int __ctzsi2(si_int); #define __builtin_clz __clzsi2 #define __builtin_ctz __ctzsi2 -#endif /* FreeBSD && (sparc64 || mips_n64 || mips_o64) */ +#endif /* FreeBSD && (sparc64 || mips_n32 || mips_n64 || mips_o64 || riscv) */ COMPILER_RT_ABI si_int __paritysi2(si_int a); COMPILER_RT_ABI si_int __paritydi2(di_int a); From owner-svn-src-all@freebsd.org Sat Aug 26 00:29:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3D38DE4E67; Sat, 26 Aug 2017 00:29:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8120B76ADC; Sat, 26 Aug 2017 00:29:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7Q0T7dW058081; Sat, 26 Aug 2017 00:29:07 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7Q0T7RI058080; Sat, 26 Aug 2017 00:29:07 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708260029.v7Q0T7RI058080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 26 Aug 2017 00:29:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322916 - stable/11/sys/modules X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/modules X-SVN-Commit-Revision: 322916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 00:29:08 -0000 Author: emaste Date: Sat Aug 26 00:29:07 2017 New Revision: 322916 URL: https://svnweb.freebsd.org/changeset/base/322916 Log: sys/modules: don't build bxe,qlxgbe if the user objects to sourceless ucode MFC of r322682 and r322684 Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/modules/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Sat Aug 26 00:17:57 2017 (r322915) +++ stable/11/sys/modules/Makefile Sat Aug 26 00:29:07 2017 (r322916) @@ -565,7 +565,9 @@ _an= an _aout= aout _bios= bios _bktr= bktr +.if ${MK_SOURCELESS_UCODE} != "no" _bxe= bxe +.endif _cardbus= cardbus _cbb= cbb _cpuctl= cpuctl @@ -708,7 +710,9 @@ _ntb= ntb _pms= pms _qlxge= qlxge _qlxgb= qlxgb +.if ${MK_SOURCELESS_UCODE} != "no" _qlxgbe= qlxgbe +.endif _qlnx= qlnx _sfxge= sfxge From owner-svn-src-all@freebsd.org Sat Aug 26 00:30:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 252C6DE5016; Sat, 26 Aug 2017 00:30:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E235D76C57; Sat, 26 Aug 2017 00:30:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7Q0UDMY058191; Sat, 26 Aug 2017 00:30:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7Q0UD1k058190; Sat, 26 Aug 2017 00:30:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708260030.v7Q0UD1k058190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 26 Aug 2017 00:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322917 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 322917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 00:30:15 -0000 Author: emaste Date: Sat Aug 26 00:30:13 2017 New Revision: 322917 URL: https://svnweb.freebsd.org/changeset/base/322917 Log: MFC r322680: sa.4: fix spelling of 'suppresses' PR: 221302 Modified: stable/11/share/man/man4/sa.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/sa.4 ============================================================================== --- stable/11/share/man/man4/sa.4 Sat Aug 26 00:29:07 2017 (r322916) +++ stable/11/share/man/man4/sa.4 Sat Aug 26 00:30:13 2017 (r322917) @@ -270,7 +270,7 @@ on tape reads. Tape drives normally return sense data (which contains the residual) when the application reads a block that is not the same length as the amount of data requested. -The SILI bit supresses that notification in most cases. +The SILI bit suppresses that notification in most cases. See the SSC-5 spec (available at t10.org), specifically the section on the READ(6) command, for more information. .It eot_warn From owner-svn-src-all@freebsd.org Sat Aug 26 00:31:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CFE5DE50A1; Sat, 26 Aug 2017 00:31:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5777576EBC; Sat, 26 Aug 2017 00:31:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7Q0Ux5G060399; Sat, 26 Aug 2017 00:30:59 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7Q0Uxq7060398; Sat, 26 Aug 2017 00:30:59 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708260030.v7Q0Uxq7060398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 26 Aug 2017 00:30:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322918 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 322918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 00:31:00 -0000 Author: emaste Date: Sat Aug 26 00:30:59 2017 New Revision: 322918 URL: https://svnweb.freebsd.org/changeset/base/322918 Log: MFC r322683: ena.4: fix spelling of 'occurred' PR: 331298 Modified: stable/11/share/man/man4/ena.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/ena.4 ============================================================================== --- stable/11/share/man/man4/ena.4 Sat Aug 26 00:30:13 2017 (r322917) +++ stable/11/share/man/man4/ena.4 Sat Aug 26 00:30:59 2017 (r322918) @@ -102,7 +102,7 @@ Supported PCI vendor ID/device IDs: .Bl -diag .It ena%d: failed to init mmio read less .Pp -Error occured during initialization of the mmio register read request. +Error occurred during initialization of the mmio register read request. .It ena%d: Can not reset device .Pp Device could not be reset; device may not be responding or is already @@ -123,7 +123,7 @@ was a problem with initialization of the resources. Failed to get attributes of the device from the controller. .It ena%d: Cannot configure aenq groups rc: %d .Pp -Errors occured when trying to configure AENQ groups. +Errors occurred when trying to configure AENQ groups. .El .Ss Driver initialisation/shutdown phase: .Bl -diag @@ -148,13 +148,13 @@ be attached. Device initialization failed; driver will not be attached. .It ena%d: could not activate irq vector: %d .Pp -Error occured when trying to activate interrupt vectors for Admin Queue. +Error occurred when trying to activate interrupt vectors for Admin Queue. .It ena%d: failed to register interrupt handler for irq %ju: %d .Pp -Error occured when trying to register Admin Queue interrupt handler. +Error occurred when trying to register Admin Queue interrupt handler. .It ena%d: Cannot setup mgmnt queue intr .Pp -Error occured during configuration of the Admin Queue interrupts. +Error occurred during configuration of the Admin Queue interrupts. .It ena%d: Enable MSI-X failed .Pp Configuration of the MSI-X for Admin Queue failed; there could be lack @@ -167,7 +167,7 @@ first and then detach routine should be called again. .It ena%d: Unmapped RX DMA tag associations .It ena%d: Unmapped TX DMA tag associations .Pp -Error occured when trying to destroy RX/TX DMA tag. +Error occurred when trying to destroy RX/TX DMA tag. .It ena%d: Cannot init RSS .It ena%d: Cannot fill indirect table .It ena%d: Cannot fill indirect table @@ -175,7 +175,7 @@ Error occured when trying to destroy RX/TX DMA tag. .It ena%d: Cannot fill hash control .It ena%d: WARNING: RSS was not properly initialized, it will affect bandwidth .Pp -Error occured during initialization of one of RSS resources; device is still +Error occurred during initialization of one of RSS resources; device is still going to work but it will affect performance because all RX packets will be passed to queue 0 and there will be no hash information. .It ena%d: failed to tear down irq: %d From owner-svn-src-all@freebsd.org Sat Aug 26 00:35:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45BACDE52B4; Sat, 26 Aug 2017 00:35:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F55877125; Sat, 26 Aug 2017 00:35:50 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7Q0ZowI062264; Sat, 26 Aug 2017 00:35:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7Q0ZnST062262; Sat, 26 Aug 2017 00:35:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708260035.v7Q0ZnST062262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 26 Aug 2017 00:35:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322919 - in stable/11/usr.sbin/pw: . tests X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/11/usr.sbin/pw: . tests X-SVN-Commit-Revision: 322919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 00:35:51 -0000 Author: emaste Date: Sat Aug 26 00:35:49 2017 New Revision: 322919 URL: https://svnweb.freebsd.org/changeset/base/322919 Log: MFC r322677: pw usermod: Properly deal with empty secondary group lists (-G '') PR: 221417 Relnotes: Yes Modified: stable/11/usr.sbin/pw/pw_user.c stable/11/usr.sbin/pw/tests/pw_usermod_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/pw/pw_user.c ============================================================================== --- stable/11/usr.sbin/pw/pw_user.c Sat Aug 26 00:30:59 2017 (r322918) +++ stable/11/usr.sbin/pw/pw_user.c Sat Aug 26 00:35:49 2017 (r322919) @@ -1087,10 +1087,10 @@ split_groups(StringList **groups, char *groupsstr) char *p; char tok[] = ", \t"; + if (*groups == NULL) + *groups = sl_init(); for (p = strtok(groupsstr, tok); p != NULL; p = strtok(NULL, tok)) { grp = group_from_name_or_id(p); - if (*groups == NULL) - *groups = sl_init(); sl_add(*groups, newstr(grp->gr_name)); } } Modified: stable/11/usr.sbin/pw/tests/pw_usermod_test.sh ============================================================================== --- stable/11/usr.sbin/pw/tests/pw_usermod_test.sh Sat Aug 26 00:30:59 2017 (r322918) +++ stable/11/usr.sbin/pw/tests/pw_usermod_test.sh Sat Aug 26 00:35:49 2017 (r322919) @@ -128,6 +128,9 @@ user_mod_nogroups_body() { atf_check -s exit:0 ${PW} usermod foo -G test3,test4 atf_check -s exit:0 -o inline:"test3\ntest4\n" \ awk -F\: '$4 == "foo" { print $1 }' ${HOME}/group + atf_check -s exit:0 ${PW} usermod foo -G "" + atf_check -s exit:0 -o empty \ + awk -F\: '$4 == "foo" { print $1 }' ${HOME}/group } atf_test_case user_mod_rename From owner-svn-src-all@freebsd.org Sat Aug 26 01:14:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 014D6DE5DB9; Sat, 26 Aug 2017 01:14:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id AA4517C261; Sat, 26 Aug 2017 01:14:09 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id A71081067BA; Sat, 26 Aug 2017 11:14:08 +1000 (AEST) Date: Sat, 26 Aug 2017 11:14:07 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Conrad Meyer cc: Bruce Evans , Alan Somers , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322893 - head/bin/dd In-Reply-To: Message-ID: <20170826110740.P1968@besplex.bde.org> References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> <20170826075540.X976@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=bc8baKHB c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=i4k9MQ4OOmfZME-L6QgA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 01:14:11 -0000 On Fri, 25 Aug 2017, Conrad Meyer wrote: > On Fri, Aug 25, 2017 at 3:49 PM, Bruce Evans wrote: >> get_off_t() but not the higher level is fixed in my version. > > Would you mind incorporating your version of dd into FreeBSD, or > publishing it so someone else can? I guess it is in my queue, but unfortunately near the end. My patches for dd are about 8K (mostly style fixes). Bruce From owner-svn-src-all@freebsd.org Sat Aug 26 03:21:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65743DEB6BB; Sat, 26 Aug 2017 03:21:13 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3320380722; Sat, 26 Aug 2017 03:21:13 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7Q3LCBK027951; Sat, 26 Aug 2017 03:21:12 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7Q3LCq2027950; Sat, 26 Aug 2017 03:21:12 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708260321.v7Q3LCq2027950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 26 Aug 2017 03:21:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322920 - head/sys/mips/include X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/mips/include X-SVN-Commit-Revision: 322920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 03:21:13 -0000 Author: cem Date: Sat Aug 26 03:21:12 2017 New Revision: 322920 URL: https://svnweb.freebsd.org/changeset/base/322920 Log: Fix limits.h constants to have correct type on MIPS Use correctly typed constants to avoid bogus errors like https://lists.freebsd.org/pipermail/svn-src-all/2017-August/150400.html (like x86 _limits.h). Reported by: bde, asomers Reviewed by: mjoras, tinderbox Sponsored by: Dell EMC Isilon Modified: head/sys/mips/include/_limits.h Modified: head/sys/mips/include/_limits.h ============================================================================== --- head/sys/mips/include/_limits.h Sat Aug 26 00:35:49 2017 (r322919) +++ head/sys/mips/include/_limits.h Sat Aug 26 03:21:12 2017 (r322920) @@ -75,17 +75,23 @@ #define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ #define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ +#ifdef __mips_n64 #define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ - #define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ - -#define __OFF_MAX __LLONG_MAX /* max value for an off_t */ -#define __OFF_MIN __LLONG_MIN /* min value for an off_t */ - -/* Quads and long longs are the same size. Ensure they stay in sync. */ -#define __UQUAD_MAX __ULLONG_MAX /* max value for a uquad_t */ -#define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */ -#define __QUAD_MIN __LLONG_MIN /* min value for a quad_t */ +#define __OFF_MAX __LONG_MAX /* max value for an off_t */ +#define __OFF_MIN __LONG_MIN /* min value for an off_t */ +#define __UQUAD_MAX __ULONG_MAX /* max value for a uquad_t */ +#define __QUAD_MAX __LONG_MAX /* max value for a quad_t */ +#define __QUAD_MIN __LONG_MIN /* min value for a quad_t */ +#else +#define __SSIZE_MAX __INT_MAX +#define __SIZE_T_MAX __UINT_MAX +#define __OFF_MAX __LLONG_MAX +#define __OFF_MIN __LLONG_MIN +#define __UQUAD_MAX __ULLONG_MAX +#define __QUAD_MAX __LLONG_MAX +#define __QUAD_MIN __LLONG_MIN +#endif #define __WORD_BIT 32 From owner-svn-src-all@freebsd.org Sat Aug 26 03:27:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 743DADEBA4B; Sat, 26 Aug 2017 03:27:38 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 04A9380C77; Sat, 26 Aug 2017 03:27:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 1B7AA429018; Sat, 26 Aug 2017 13:00:42 +1000 (AEST) Date: Sat, 26 Aug 2017 13:00:41 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alan Somers cc: Bruce Evans , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322258 - head/sys/kern In-Reply-To: Message-ID: <20170826121557.K2180@besplex.bde.org> References: <201708081614.v78GEVGY066448@repo.freebsd.org> <20170809141608.I1096@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=6I5d2MoRAAAA:8 a=5bFV5GeewFy05cFWIRsA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 03:27:38 -0000 On Thu, 24 Aug 2017, Alan Somers wrote: > On Wed, Aug 9, 2017 at 1:05 AM, Bruce Evans wrote: >> On Tue, 8 Aug 2017, Alan Somers wrote: >> ... >> The compile-time definition of AIO_LISTIO_MAX seems to be broken. I think >> POSIX species that AIO_LISTIO_MAX shall not be defined if the value of >> {AIO_LISTIO_MAX} varies at runtime, but it is still defined. FreeBSD >> has this bug for many other sysconf() variables, e.g., {OPEN_MAX}. >> Perhaps AIO_LISTIO_MAX is easier to fix since it is not hard-coded as >> often as OPEN_MAX. > > What you describe is Linux's behavior, but the POSIX requirement is a > bit more general. All POSIX says is that "The value returned [by > sysconf(3)] shall not be more restrictive than the corresponding value > described to the application when it was compiled with the > implementation's or ". No, I described the POSIX requirement. See the section on limits.h. It says that - {AIO_LISTIO_MAX} is a runtime invariant (so sysctls that change it are not POSIX conformant) - for all runtime invariant limits, the definition shall be omitted from if it is unspecified (sic). This indetermination (sic) might depend on the memory size. [That was not a direct quote except for the sic words. POSIX says "indeterminate" in both places in the 1990 and 1996 versions, but this is broken in the 2001 and 2006 versions.] So defining AIO_LISTIO_MAX in is not conformant if you change it before runtime using something like a tunable. You quoted the section for sysconf(3). The wording there is too generic. It covers both runtime increasable and runtime invariant limits. It only really applies to the runtime increasable limits. For the runtime invariant, limits it only applies vacuously. The section on disallows defining runtime invariant limits unless they are known at compile time. If they would be different at runtime, then they were not known at comple time, so must not be defined then, and the requirement that the runtime limits are larger is vacuously satisfied. There aren't many runtime increasable limits, and at least in the 2006 version, only {OPEN_MAX} is allowed to vary within a process's lifetime. {OPEN_MAX} can be decreased in practice and the 2006 version doesn't disallow this provided OPEN_MAX is not defined in (then {OPEN_MAX} must be a compile-time invariant). When it is not defined, the requirement to only increase it is vacuously satisfied, so only the special requirement for {OPEN_MAX} applies. This allows changing it using setrlimit(). The direction of the change is not limited to an increase, but many more paragraphs are needed to speciy what happens when it does decrease (open files above the limit stay open, but obviously you can't use the current limit to limit the search for these files...). > ... > I dug deeper and found that there wasn't any good reason for the > aio_listio_max limit to exist in the first place. This DR eliminates > it, which I think will satisfy most of your concerns. > https://reviews.freebsd.org/D12120 This is inconvenient for me to review. Anything that removes the compile time limit is good. Except actually removing it from would break any applications that use it. Applications should use the minimum for the limit if they don't care, else sysconf(). The 2006 version of POSIX says in its section about profiles that most if its limits are inadequate (so profiles should change them). I don't know the mechanism for this. Just omitting most compile-time limits and increasing the sysconf() limits won't help for sloppy applications. Bruce From owner-svn-src-all@freebsd.org Sat Aug 26 06:44:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2A9ADEFB68; Sat, 26 Aug 2017 06:44:51 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8409F1B76; Sat, 26 Aug 2017 06:44:51 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7Q6ioTo013143; Sat, 26 Aug 2017 06:44:50 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7Q6iocZ013142; Sat, 26 Aug 2017 06:44:50 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708260644.v7Q6iocZ013142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 26 Aug 2017 06:44:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322921 - head/lib/msun/tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/msun/tests X-SVN-Commit-Revision: 322921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 06:44:51 -0000 Author: ngie Date: Sat Aug 26 06:44:50 2017 New Revision: 322921 URL: https://svnweb.freebsd.org/changeset/base/322921 Log: Revert r321457 It doesn't fail after ^/head@r322855 (the releng_50 clang merge). PR: 220989 MFC after: 2 months MFC with: r321369, r322855 Modified: head/lib/msun/tests/trig_test.c Modified: head/lib/msun/tests/trig_test.c ============================================================================== --- head/lib/msun/tests/trig_test.c Sat Aug 26 03:21:12 2017 (r322920) +++ head/lib/msun/tests/trig_test.c Sat Aug 26 06:44:50 2017 (r322921) @@ -158,11 +158,6 @@ ATF_TC_BODY(reduction, tc) }; #endif -#if defined(__clang__) && \ - ((__clang_major__ >= 5)) - atf_tc_expect_fail("test fails with clang 5.0+ - bug 220989"); -#endif - unsigned i; for (i = 0; i < nitems(f_pi_odd); i++) { From owner-svn-src-all@freebsd.org Sat Aug 26 14:07:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65FEDDF7068; Sat, 26 Aug 2017 14:07:26 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 333B66CE0F; Sat, 26 Aug 2017 14:07:26 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QE7PkC093435; Sat, 26 Aug 2017 14:07:25 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QE7OtM093426; Sat, 26 Aug 2017 14:07:24 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201708261407.v7QE7OtM093426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 26 Aug 2017 14:07:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322923 - in head: . sbin/geom/class/eli sys/boot/geli sys/geom/eli X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head: . sbin/geom/class/eli sys/boot/geli sys/geom/eli X-SVN-Commit-Revision: 322923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 14:07:26 -0000 Author: oshogbo Date: Sat Aug 26 14:07:24 2017 New Revision: 322923 URL: https://svnweb.freebsd.org/changeset/base/322923 Log: Hide length of geli passphrase during boot. Introduce additional flag to the geli which allows to restore previous behavior. Reviewed by: AllanJude@, cem@ (previous version) MFC: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11751 Modified: head/UPDATING head/sbin/geom/class/eli/geli.8 head/sbin/geom/class/eli/geom_eli.c head/sys/boot/geli/geliboot.c head/sys/boot/geli/geliboot.h head/sys/boot/geli/pwgets.c head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h head/sys/geom/eli/g_eli_ctl.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Aug 26 07:05:29 2017 (r322922) +++ head/UPDATING Sat Aug 26 14:07:24 2017 (r322923) @@ -51,6 +51,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20170826: + During boot the geli passphrase will be hidden. To restore previous + behavior see geli(8) configuration options. + 20170825: Move PMTUD blackhole counters to TCPSTATS and remove them from bare sysctl values. Minor nit, but requires a rebuild of both world/kernel Modified: head/sbin/geom/class/eli/geli.8 ============================================================================== --- head/sbin/geom/class/eli/geli.8 Sat Aug 26 07:05:29 2017 (r322922) +++ head/sbin/geom/class/eli/geli.8 Sat Aug 26 14:07:24 2017 (r322923) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 3, 2016 +.Dd August 26, 2017 .Dt GELI 8 .Os .Sh NAME @@ -51,7 +51,7 @@ utility: .Pp .Nm .Cm init -.Op Fl bgPTv +.Op Fl bdgPTv .Op Fl a Ar aalgo .Op Fl B Ar backupfile .Op Fl e Ar ealgo @@ -88,7 +88,7 @@ utility: .Ar prov .Nm .Cm configure -.Op Fl bBgGtT +.Op Fl bBdDgGtT .Ar prov ... .Nm .Cm setkey @@ -279,6 +279,9 @@ To inhibit backups, you can use .Pa none as the .Ar backupfile . +.It Fl d +While booting from this encrypted root filesystem enable visibility of +passphrase length. .It Fl e Ar ealgo Encryption algorithm to use. Currently supported algorithms are: @@ -490,6 +493,12 @@ For more information, see the description of the subcommand. .It Fl B Remove the BOOT flag from the given providers. +.It Fl d +While booting from this encrypted root filesystem enable visibility of +passphrase length. +.It Fl D +While booting from this encrypted root filesystem disable visibility of +passphrase length. .It Fl g Enable booting from this encrypted root filesystem. The boot loader prompts for the passphrase and loads Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Sat Aug 26 07:05:29 2017 (r322922) +++ head/sbin/geom/class/eli/geom_eli.c Sat Aug 26 14:07:24 2017 (r322923) @@ -82,7 +82,7 @@ static int eli_backup_create(struct gctl_req *req, con /* * Available commands: * - * init [-bgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov + * init [-bdgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov * label - alias for 'init' * attach [-dprv] [-j passfile] [-k keyfile] prov * detach [-fl] prov ... @@ -107,6 +107,7 @@ struct g_command class_commands[] = { { 'a', "aalgo", "", G_TYPE_STRING }, { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, + { 'd', "displaypass", NULL, G_TYPE_BOOL }, { 'e', "ealgo", "", G_TYPE_STRING }, { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, @@ -119,13 +120,14 @@ struct g_command class_commands[] = { { 'V', "mdversion", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - "[-bgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" + "[-bdgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" }, { "label", G_FLAG_VERBOSE, eli_main, { { 'a', "aalgo", "", G_TYPE_STRING }, { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, + { 'd', "displaypass", NULL, G_TYPE_BOOL }, { 'e', "ealgo", "", G_TYPE_STRING }, { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, @@ -182,13 +184,15 @@ struct g_command class_commands[] = { { { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "noboot", NULL, G_TYPE_BOOL }, + { 'd', "displaypass", NULL, G_TYPE_BOOL }, + { 'D', "nodisplaypass", NULL, G_TYPE_BOOL }, { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'G', "nogeliboot", NULL, G_TYPE_BOOL }, { 't', "trim", NULL, G_TYPE_BOOL }, { 'T', "notrim", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - "[-bBgGtT] prov ..." + "[-bBdDgGtT] prov ..." }, { "setkey", G_FLAG_VERBOSE, eli_main, { @@ -708,6 +712,8 @@ eli_init(struct gctl_req *req) md.md_flags |= G_ELI_FLAG_BOOT; if (gctl_get_int(req, "geliboot")) md.md_flags |= G_ELI_FLAG_GELIBOOT; + if (gctl_get_int(req, "displaypass")) + md.md_flags |= G_ELI_FLAG_GELIDISPLAYPASS; if (gctl_get_int(req, "notrim")) md.md_flags |= G_ELI_FLAG_NODELETE; md.md_ealgo = CRYPTO_ALGORITHM_MIN - 1; @@ -912,7 +918,7 @@ eli_attach(struct gctl_req *req) static void eli_configure_detached(struct gctl_req *req, const char *prov, int boot, - int geliboot, int trim) + int geliboot, int displaypass, int trim) { struct g_eli_metadata md; bool changed = 0; @@ -948,6 +954,21 @@ eli_configure_detached(struct gctl_req *req, const cha changed = 1; } + if (displaypass == 1 && (md.md_flags & G_ELI_FLAG_GELIDISPLAYPASS)) { + if (verbose) + printf("GELIDISPLAYPASS flag already configured for %s.\n", prov); + } else if (displaypass == 0 && + !(md.md_flags & G_ELI_FLAG_GELIDISPLAYPASS)) { + if (verbose) + printf("GELIDISPLAYPASS flag not configured for %s.\n", prov); + } else if (displaypass >= 0) { + if (displaypass) + md.md_flags |= G_ELI_FLAG_GELIDISPLAYPASS; + else + md.md_flags &= ~G_ELI_FLAG_GELIDISPLAYPASS; + changed = 1; + } + if (trim == 0 && (md.md_flags & G_ELI_FLAG_NODELETE)) { if (verbose) printf("TRIM disable flag already configured for %s.\n", prov); @@ -971,8 +992,9 @@ static void eli_configure(struct gctl_req *req) { const char *prov; - bool boot, noboot, geliboot, nogeliboot, trim, notrim; - int doboot, dogeliboot, dotrim; + bool boot, noboot, geliboot, nogeliboot, displaypass, nodisplaypass; + bool trim, notrim; + int doboot, dogeliboot, dodisplaypass, dotrim; int i, nargs; nargs = gctl_get_int(req, "nargs"); @@ -985,6 +1007,8 @@ eli_configure(struct gctl_req *req) noboot = gctl_get_int(req, "noboot"); geliboot = gctl_get_int(req, "geliboot"); nogeliboot = gctl_get_int(req, "nogeliboot"); + displaypass = gctl_get_int(req, "displaypass"); + nodisplaypass = gctl_get_int(req, "nodisplaypass"); trim = gctl_get_int(req, "trim"); notrim = gctl_get_int(req, "notrim"); @@ -1008,6 +1032,16 @@ eli_configure(struct gctl_req *req) else if (nogeliboot) dogeliboot = 0; + dodisplaypass = -1; + if (displaypass && nodisplaypass) { + gctl_error(req, "Options -d and -D are mutually exclusive."); + return; + } + if (displaypass) + dodisplaypass = 1; + else if (nodisplaypass) + dodisplaypass = 0; + dotrim = -1; if (trim && notrim) { gctl_error(req, "Options -t and -T are mutually exclusive."); @@ -1018,7 +1052,8 @@ eli_configure(struct gctl_req *req) else if (notrim) dotrim = 0; - if (doboot == -1 && dogeliboot == -1 && dotrim == -1) { + if (doboot == -1 && dogeliboot == -1 && dodisplaypass == -1 && + dotrim == -1) { gctl_error(req, "No option given."); return; } @@ -1028,8 +1063,10 @@ eli_configure(struct gctl_req *req) /* Now the rest. */ for (i = 0; i < nargs; i++) { prov = gctl_get_ascii(req, "arg%d", i); - if (!eli_is_attached(prov)) - eli_configure_detached(req, prov, doboot, dogeliboot, dotrim); + if (!eli_is_attached(prov)) { + eli_configure_detached(req, prov, doboot, dogeliboot, + dodisplaypass, dotrim); + } } } Modified: head/sys/boot/geli/geliboot.c ============================================================================== --- head/sys/boot/geli/geliboot.c Sat Aug 26 07:05:29 2017 (r322922) +++ head/sys/boot/geli/geliboot.c Sat Aug 26 14:07:24 2017 (r322923) @@ -220,8 +220,9 @@ geli_taste(int read_func(void *vdev, void *priv, off_t /* * Attempt to decrypt the device */ -int -geli_attach(struct dsk *dskp, const char *passphrase, const u_char *mkeyp) +static int +geli_attach(struct geli_entry *ge, struct dsk *dskp, const char *passphrase, + const u_char *mkeyp) { u_char key[G_ELI_USERKEYLEN], mkey[G_ELI_DATAIVKEYLEN], *mkp; u_int keynum; @@ -233,92 +234,83 @@ geli_attach(struct dsk *dskp, const char *passphrase, explicit_bzero(mkeyp, G_ELI_DATAIVKEYLEN); } - SLIST_FOREACH_SAFE(geli_e, &geli_head, entries, geli_e_tmp) { - if (geli_same_device(geli_e, dskp) != 0) { - continue; - } + if (mkeyp != NULL || geli_findkey(ge, dskp, mkey) == 0) { + goto found_key; + } - if (mkeyp != NULL || geli_findkey(geli_e, dskp, mkey) == 0) { - goto found_key; - } + g_eli_crypto_hmac_init(&ctx, NULL, 0); + /* + * Prepare Derived-Key from the user passphrase. + */ + if (geli_e->md.md_iterations < 0) { + /* XXX TODO: Support loading key files. */ + return (1); + } else if (geli_e->md.md_iterations == 0) { + g_eli_crypto_hmac_update(&ctx, geli_e->md.md_salt, + sizeof(geli_e->md.md_salt)); + g_eli_crypto_hmac_update(&ctx, passphrase, + strlen(passphrase)); + } else if (geli_e->md.md_iterations > 0) { + printf("Calculating GELI Decryption Key disk%dp%d @ %d" + " iterations...\n", dskp->unit, + (dskp->slice > 0 ? dskp->slice : dskp->part), + geli_e->md.md_iterations); + u_char dkey[G_ELI_USERKEYLEN]; - g_eli_crypto_hmac_init(&ctx, NULL, 0); - /* - * Prepare Derived-Key from the user passphrase. - */ - if (geli_e->md.md_iterations < 0) { - /* XXX TODO: Support loading key files. */ - return (1); - } else if (geli_e->md.md_iterations == 0) { - g_eli_crypto_hmac_update(&ctx, geli_e->md.md_salt, - sizeof(geli_e->md.md_salt)); - g_eli_crypto_hmac_update(&ctx, passphrase, - strlen(passphrase)); - } else if (geli_e->md.md_iterations > 0) { - printf("Calculating GELI Decryption Key disk%dp%d @ %d" - " iterations...\n", dskp->unit, - (dskp->slice > 0 ? dskp->slice : dskp->part), - geli_e->md.md_iterations); - u_char dkey[G_ELI_USERKEYLEN]; + pkcs5v2_genkey(dkey, sizeof(dkey), geli_e->md.md_salt, + sizeof(geli_e->md.md_salt), passphrase, + geli_e->md.md_iterations); + g_eli_crypto_hmac_update(&ctx, dkey, sizeof(dkey)); + explicit_bzero(dkey, sizeof(dkey)); + } - pkcs5v2_genkey(dkey, sizeof(dkey), geli_e->md.md_salt, - sizeof(geli_e->md.md_salt), passphrase, - geli_e->md.md_iterations); - g_eli_crypto_hmac_update(&ctx, dkey, sizeof(dkey)); - explicit_bzero(dkey, sizeof(dkey)); - } + g_eli_crypto_hmac_final(&ctx, key, 0); - g_eli_crypto_hmac_final(&ctx, key, 0); + error = g_eli_mkey_decrypt(&geli_e->md, key, mkey, &keynum); + if (error == -1) { + explicit_bzero(mkey, sizeof(mkey)); + explicit_bzero(key, sizeof(key)); + printf("Bad GELI key: bad password?\n"); + return (error); + } else if (error != 0) { + explicit_bzero(mkey, sizeof(mkey)); + explicit_bzero(key, sizeof(key)); + printf("Failed to decrypt GELI master key: %d\n", error); + return (error); + } else { + /* Add key to keychain */ + save_key(key); + explicit_bzero(&key, sizeof(key)); + } - error = g_eli_mkey_decrypt(&geli_e->md, key, mkey, &keynum); - if (error == -1) { - explicit_bzero(mkey, sizeof(mkey)); - explicit_bzero(key, sizeof(key)); - printf("Bad GELI key: bad password?\n"); - return (error); - } else if (error != 0) { - explicit_bzero(mkey, sizeof(mkey)); - explicit_bzero(key, sizeof(key)); - printf("Failed to decrypt GELI master key: %d\n", error); - return (error); - } else { - /* Add key to keychain */ - save_key(key); - explicit_bzero(&key, sizeof(key)); - } - found_key: - /* Store the keys */ - bcopy(mkey, geli_e->sc.sc_mkey, sizeof(geli_e->sc.sc_mkey)); - bcopy(mkey, geli_e->sc.sc_ivkey, sizeof(geli_e->sc.sc_ivkey)); - mkp = mkey + sizeof(geli_e->sc.sc_ivkey); - if ((geli_e->sc.sc_flags & G_ELI_FLAG_AUTH) == 0) { - bcopy(mkp, geli_e->sc.sc_ekey, G_ELI_DATAKEYLEN); - } else { - /* - * The encryption key is: ekey = HMAC_SHA512(Data-Key, 0x10) - */ - g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, "\x10", 1, - geli_e->sc.sc_ekey, 0); - } - explicit_bzero(mkey, sizeof(mkey)); + /* Store the keys */ + bcopy(mkey, geli_e->sc.sc_mkey, sizeof(geli_e->sc.sc_mkey)); + bcopy(mkey, geli_e->sc.sc_ivkey, sizeof(geli_e->sc.sc_ivkey)); + mkp = mkey + sizeof(geli_e->sc.sc_ivkey); + if ((geli_e->sc.sc_flags & G_ELI_FLAG_AUTH) == 0) { + bcopy(mkp, geli_e->sc.sc_ekey, G_ELI_DATAKEYLEN); + } else { + /* + * The encryption key is: ekey = HMAC_SHA512(Data-Key, 0x10) + */ + g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, "\x10", 1, + geli_e->sc.sc_ekey, 0); + } + explicit_bzero(mkey, sizeof(mkey)); - /* Initialize the per-sector IV. */ - switch (geli_e->sc.sc_ealgo) { - case CRYPTO_AES_XTS: - break; - default: - SHA256_Init(&geli_e->sc.sc_ivctx); - SHA256_Update(&geli_e->sc.sc_ivctx, geli_e->sc.sc_ivkey, - sizeof(geli_e->sc.sc_ivkey)); - break; - } - - return (0); + /* Initialize the per-sector IV. */ + switch (geli_e->sc.sc_ealgo) { + case CRYPTO_AES_XTS: + break; + default: + SHA256_Init(&geli_e->sc.sc_ivctx); + SHA256_Update(&geli_e->sc.sc_ivctx, geli_e->sc.sc_ivkey, + sizeof(geli_e->sc.sc_ivkey)); + break; } - /* Disk not found. */ - return (2); + return (0); } int @@ -402,7 +394,7 @@ geli_havekey(struct dsk *dskp) } if (geli_findkey(geli_e, dskp, mkey) == 0) { - if (geli_attach(dskp, NULL, mkey) == 0) { + if (geli_attach(geli_e, dskp, NULL, mkey) == 0) { return (0); } } @@ -417,19 +409,27 @@ geli_passphrase(char *pw, int disk, int parttype, int { int i; - /* TODO: Implement GELI keyfile(s) support */ - for (i = 0; i < 3; i++) { - /* Try cached passphrase */ - if (i == 0 && pw[0] != '\0') { - if (geli_attach(dskp, pw, NULL) == 0) { + SLIST_FOREACH_SAFE(geli_e, &geli_head, entries, geli_e_tmp) { + if (geli_same_device(geli_e, dskp) != 0) { + continue; + } + + /* TODO: Implement GELI keyfile(s) support */ + for (i = 0; i < 3; i++) { + /* Try cached passphrase */ + if (i == 0 && pw[0] != '\0') { + if (geli_attach(geli_e, dskp, pw, NULL) == 0) { + return (0); + } + } + printf("GELI Passphrase for disk%d%c%d: ", disk, + parttype, part); + pwgets(pw, GELI_PW_MAXLEN, + (geli_e->md.md_flags & G_ELI_FLAG_GELIDISPLAYPASS) == 0); + printf("\n"); + if (geli_attach(geli_e, dskp, pw, NULL) == 0) { return (0); } - } - printf("GELI Passphrase for disk%d%c%d: ", disk, parttype, part); - pwgets(pw, GELI_PW_MAXLEN); - printf("\n"); - if (geli_attach(dskp, pw, NULL) == 0) { - return (0); } } Modified: head/sys/boot/geli/geliboot.h ============================================================================== --- head/sys/boot/geli/geliboot.h Sat Aug 26 07:05:29 2017 (r322922) +++ head/sys/boot/geli/geliboot.h Sat Aug 26 14:07:24 2017 (r322923) @@ -46,12 +46,11 @@ #define GELI_MAX_KEYS 64 #define GELI_PW_MAXLEN 256 -extern void pwgets(char *buf, int n); +extern void pwgets(char *buf, int n, int hide); void geli_init(void); int geli_taste(int read_func(void *vdev, void *priv, off_t off, void *buf, size_t bytes), struct dsk *dsk, daddr_t lastsector); -int geli_attach(struct dsk *dskp, const char *passphrase, const u_char *mkeyp); int is_geli(struct dsk *dsk); int geli_read(struct dsk *dsk, off_t offset, u_char *buf, size_t bytes); int geli_decrypt(u_int algo, u_char *data, size_t datasize, Modified: head/sys/boot/geli/pwgets.c ============================================================================== --- head/sys/boot/geli/pwgets.c Sat Aug 26 07:05:29 2017 (r322922) +++ head/sys/boot/geli/pwgets.c Sat Aug 26 14:07:24 2017 (r322923) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); /* gets() with constrained input length, for passwords */ void -pwgets(char *buf, int n) +pwgets(char *buf, int n, int hide) { int c; char *lp; @@ -55,9 +55,11 @@ pwgets(char *buf, int n) case '\177': if (lp > buf) { lp--; - putchar('\b'); - putchar(' '); - putchar('\b'); + if (hide == 0) { + putchar('\b'); + putchar(' '); + putchar('\b'); + } } break; case 'u'&037: @@ -68,7 +70,9 @@ pwgets(char *buf, int n) default: if ((n < 1) || ((lp - buf) < n - 1)) { *lp++ = c; - putchar('*'); + if (hide == 0) { + putchar('*'); + } } } /*NOTREACHED*/ Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Sat Aug 26 07:05:29 2017 (r322922) +++ head/sys/geom/eli/g_eli.c Sat Aug 26 14:07:24 2017 (r322923) @@ -1023,7 +1023,7 @@ g_eli_taste(struct g_class *mp, struct g_provider *pp, struct hmac_ctx ctx; char passphrase[256]; u_char key[G_ELI_USERKEYLEN], mkey[G_ELI_DATAIVKEYLEN]; - u_int i, nkey, nkeyfiles, tries; + u_int i, nkey, nkeyfiles, tries, showpass; int error; struct keybuf *keybuf; @@ -1112,8 +1112,11 @@ g_eli_taste(struct g_class *mp, struct g_provider *pp, sizeof(passphrase)); } else { printf("Enter passphrase for %s: ", pp->name); + showpass = g_eli_visible_passphrase; + if ((md.md_flags & G_ELI_FLAG_GELIDISPLAYPASS) != 0) + showpass = GETS_ECHOPASS; cngets(passphrase, sizeof(passphrase), - g_eli_visible_passphrase); + showpass); memcpy(cached_passphrase, passphrase, sizeof(passphrase)); } @@ -1232,6 +1235,7 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, st ADD_FLAG(G_ELI_FLAG_RO, "READ-ONLY"); ADD_FLAG(G_ELI_FLAG_NODELETE, "NODELETE"); ADD_FLAG(G_ELI_FLAG_GELIBOOT, "GELIBOOT"); + ADD_FLAG(G_ELI_FLAG_GELIDISPLAYPASS, "GELIDISPLAYPASS"); #undef ADD_FLAG } sbuf_printf(sb, "\n"); Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Sat Aug 26 07:05:29 2017 (r322922) +++ head/sys/geom/eli/g_eli.h Sat Aug 26 14:07:24 2017 (r322923) @@ -100,6 +100,8 @@ #define G_ELI_FLAG_NODELETE 0x00000040 /* This GELI supports GELIBoot */ #define G_ELI_FLAG_GELIBOOT 0x00000080 +/* Hide passphrase length in GELIboot. */ +#define G_ELI_FLAG_GELIDISPLAYPASS 0x00000100 /* RUNTIME FLAGS. */ /* Provider was open for writing. */ #define G_ELI_FLAG_WOPEN 0x00010000 Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Sat Aug 26 07:05:29 2017 (r322922) +++ head/sys/geom/eli/g_eli_ctl.c Sat Aug 26 14:07:24 2017 (r322923) @@ -377,6 +377,7 @@ g_eli_ctl_configure(struct gctl_req *req, struct g_cla const char *prov; u_char *sector; int *nargs, *boot, *noboot, *trim, *notrim, *geliboot, *nogeliboot; + int *displaypass, *nodisplaypass; int zero, error, changed; u_int i; @@ -434,6 +435,19 @@ g_eli_ctl_configure(struct gctl_req *req, struct g_cla if (*geliboot || *nogeliboot) changed = 1; + displaypass = gctl_get_paraml(req, "displaypass", sizeof(*displaypass)); + if (displaypass == NULL) + displaypass = &zero; + nodisplaypass = gctl_get_paraml(req, "nodisplaypass", sizeof(*nodisplaypass)); + if (nodisplaypass == NULL) + nodisplaypass = &zero; + if (*displaypass && *nodisplaypass) { + gctl_error(req, "Options -d and -D are mutually exclusive."); + return; + } + if (*displaypass || *nodisplaypass) + changed = 1; + if (!changed) { gctl_error(req, "No option given."); return; @@ -492,6 +506,17 @@ g_eli_ctl_configure(struct gctl_req *req, struct g_cla continue; } + if (*displaypass && (sc->sc_flags & G_ELI_FLAG_GELIDISPLAYPASS)) { + G_ELI_DEBUG(1, "GELIDISPLAYPASS flag already configured for %s.", + prov); + continue; + } else if (*nodisplaypass && + !(sc->sc_flags & G_ELI_FLAG_GELIDISPLAYPASS)) { + G_ELI_DEBUG(1, "GELIDISPLAYPASS flag not configured for %s.", + prov); + continue; + } + if (!(sc->sc_flags & G_ELI_FLAG_ONETIME)) { /* * ONETIME providers don't write metadata to @@ -533,6 +558,14 @@ g_eli_ctl_configure(struct gctl_req *req, struct g_cla } else if (*nogeliboot) { md.md_flags &= ~G_ELI_FLAG_GELIBOOT; sc->sc_flags &= ~G_ELI_FLAG_GELIBOOT; + } + + if (*displaypass) { + md.md_flags |= G_ELI_FLAG_GELIDISPLAYPASS; + sc->sc_flags |= G_ELI_FLAG_GELIDISPLAYPASS; + } else if (*nodisplaypass) { + md.md_flags &= ~G_ELI_FLAG_GELIDISPLAYPASS; + sc->sc_flags &= ~G_ELI_FLAG_GELIDISPLAYPASS; } if (sc->sc_flags & G_ELI_FLAG_ONETIME) { From owner-svn-src-all@freebsd.org Sat Aug 26 15:08:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5B75DD41B9; Sat, 26 Aug 2017 15:08:28 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 952CA6E6E4; Sat, 26 Aug 2017 15:08:28 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QF8R4w017661; Sat, 26 Aug 2017 15:08:27 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QF8RaQ017660; Sat, 26 Aug 2017 15:08:27 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708261508.v7QF8RaQ017660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sat, 26 Aug 2017 15:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322924 - head/contrib/cortex-strings/src/aarch64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/contrib/cortex-strings/src/aarch64 X-SVN-Commit-Revision: 322924 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 15:08:29 -0000 Author: andrew Date: Sat Aug 26 15:08:27 2017 New Revision: 322924 URL: https://svnweb.freebsd.org/changeset/base/322924 Log: Work around a bug in QEMU when loading data with a load pair instruction where the source register is also the first destination register. If this is the case, and we raise an exception in the middle of the instruction, for example the load is across two pages and the second page isn't mapped, QEMU will have overwritten the address with invalid data. This is a valid behaviour in most cases, with the exception of when a destination register is also use in address generation. As such switch the order of the registers to ensure the address register is second so it will be written to second, after any exceptions have happened. This has been acknowledged in upstream QEMU, however as the workaround is simple also handle it here. Sponsored by: DARPA, AFRL Modified: head/contrib/cortex-strings/src/aarch64/memcpy.S Modified: head/contrib/cortex-strings/src/aarch64/memcpy.S ============================================================================== --- head/contrib/cortex-strings/src/aarch64/memcpy.S Sat Aug 26 14:07:24 2017 (r322923) +++ head/contrib/cortex-strings/src/aarch64/memcpy.S Sat Aug 26 15:08:27 2017 (r322924) @@ -77,8 +77,8 @@ #define D_h x13 #define E_l src #define E_h count -#define F_l srcend -#define F_h dst +#define F_l dst +#define F_h srcend #define tmp1 x9 #define L(l) .L ## l From owner-svn-src-all@freebsd.org Sat Aug 26 16:11:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9426FDD514E; Sat, 26 Aug 2017 16:11:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65C8C7005B; Sat, 26 Aug 2017 16:11:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QGBLM9044030; Sat, 26 Aug 2017 16:11:21 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QGBLDx044026; Sat, 26 Aug 2017 16:11:21 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708261611.v7QGBLDx044026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 26 Aug 2017 16:11:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322925 - in head/lib/libc: gen locale X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/lib/libc: gen locale X-SVN-Commit-Revision: 322925 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 16:11:22 -0000 Author: pfg Date: Sat Aug 26 16:11:21 2017 New Revision: 322925 URL: https://svnweb.freebsd.org/changeset/base/322925 Log: libc: minor indent(1) cleanups. Illumos and Schillix is adopting some of the locale code and our style(9) sometimes matches the Solaris cstyle, so the changes are also useful as a way to reduce diffs. No functional change. Discussed with: Joerg Schilling MFC after: 1 week Modified: head/lib/libc/gen/fnmatch.c head/lib/libc/locale/setlocale.c head/lib/libc/locale/setrunelocale.c Modified: head/lib/libc/gen/fnmatch.c ============================================================================== --- head/lib/libc/gen/fnmatch.c Sat Aug 26 15:08:27 2017 (r322924) +++ head/lib/libc/gen/fnmatch.c Sat Aug 26 16:11:21 2017 (r322925) @@ -249,7 +249,7 @@ rangematch(const char *pattern, wchar_t test, int flag * consistency with the regular expression syntax. * J.T. Conklin (conklin@ngai.kaleida.com) */ - if ( (negate = (*pattern == '!' || *pattern == '^')) ) + if ((negate = (*pattern == '!' || *pattern == '^'))) ++pattern; if (flags & FNM_CASEFOLD) Modified: head/lib/libc/locale/setlocale.c ============================================================================== --- head/lib/libc/locale/setlocale.c Sat Aug 26 15:08:27 2017 (r322924) +++ head/lib/libc/locale/setlocale.c Sat Aug 26 16:11:21 2017 (r322925) @@ -42,48 +42,48 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include /* for _PATH_LOCALE */ +#include /* for _PATH_LOCALE */ #include #include #include #include "collate.h" -#include "lmonetary.h" /* for __monetary_load_locale() */ -#include "lnumeric.h" /* for __numeric_load_locale() */ -#include "lmessages.h" /* for __messages_load_locale() */ +#include "lmonetary.h" /* for __monetary_load_locale() */ +#include "lnumeric.h" /* for __numeric_load_locale() */ +#include "lmessages.h" /* for __messages_load_locale() */ #include "setlocale.h" #include "ldpart.h" -#include "../stdtime/timelocal.h" /* for __time_load_locale() */ +#include "../stdtime/timelocal.h" /* for __time_load_locale() */ /* * Category names for getenv() */ static const char categories[_LC_LAST][12] = { - "LC_ALL", - "LC_COLLATE", - "LC_CTYPE", - "LC_MONETARY", - "LC_NUMERIC", - "LC_TIME", - "LC_MESSAGES", + "LC_ALL", + "LC_COLLATE", + "LC_CTYPE", + "LC_MONETARY", + "LC_NUMERIC", + "LC_TIME", + "LC_MESSAGES", }; /* * Current locales for each category */ static char current_categories[_LC_LAST][ENCODING_LEN + 1] = { - "C", - "C", - "C", - "C", - "C", - "C", - "C", + "C", + "C", + "C", + "C", + "C", + "C", + "C", }; /* * Path to locale storage directory */ -char *_PathLocale; +char *_PathLocale; /* * The locales we are going to try and load @@ -93,21 +93,20 @@ static char saved_categories[_LC_LAST][ENCODING_LEN + static char current_locale_string[_LC_LAST * (ENCODING_LEN + 1/*"/"*/ + 1)]; -static char *currentlocale(void); -static char *loadlocale(int); +static char *currentlocale(void); +static char *loadlocale(int); const char *__get_locale_env(int); char * setlocale(int category, const char *locale) { int i, j, len, saverr; - const char *env, *r; + const char *env, *r; if (category < LC_ALL || category >= _LC_LAST) { errno = EINVAL; return (NULL); } - if (locale == NULL) return (category != LC_ALL ? current_categories[category] : currentlocale()); @@ -162,13 +161,13 @@ setlocale(int category, const char *locale) } do { if (i == _LC_LAST) - break; /* Too many slashes... */ + break; /* Too many slashes... */ if ((len = r - locale) > ENCODING_LEN) { errno = EINVAL; return (NULL); } (void)strlcpy(new_categories[i], locale, - len + 1); + len + 1); i++; while (*r == '/') r++; @@ -178,7 +177,7 @@ setlocale(int category, const char *locale) } while (*locale); while (i < _LC_LAST) { (void)strcpy(new_categories[i], - new_categories[i-1]); + new_categories[i - 1]); i++; } } @@ -193,7 +192,7 @@ setlocale(int category, const char *locale) saverr = errno; for (j = 1; j < i; j++) { (void)strcpy(new_categories[j], - saved_categories[j]); + saved_categories[j]); if (loadlocale(j) == NULL) { (void)strcpy(new_categories[j], "C"); (void)loadlocale(j); @@ -218,7 +217,7 @@ currentlocale(void) for (i = 2; i < _LC_LAST; ++i) { (void)strcat(current_locale_string, "/"); (void)strcat(current_locale_string, - current_categories[i]); + current_categories[i]); } break; } @@ -230,16 +229,15 @@ loadlocale(int category) { char *new = new_categories[category]; char *old = current_categories[category]; - int (*func)(const char *); + int (*func) (const char *); int saved_errno; if ((new[0] == '.' && - (new[1] == '\0' || (new[1] == '.' && new[2] == '\0'))) || + (new[1] == '\0' || (new[1] == '.' && new[2] == '\0'))) || strchr(new, '/') != NULL) { errno = EINVAL; return (NULL); } - saved_errno = errno; errno = __detect_path_locale(); if (errno != 0) @@ -285,22 +283,22 @@ loadlocale(int category) const char * __get_locale_env(int category) { - const char *env; + const char *env; - /* 1. check LC_ALL. */ - env = getenv(categories[0]); + /* 1. check LC_ALL. */ + env = getenv(categories[0]); - /* 2. check LC_* */ + /* 2. check LC_* */ if (env == NULL || !*env) - env = getenv(categories[category]); + env = getenv(categories[category]); - /* 3. check LANG */ + /* 3. check LANG */ if (env == NULL || !*env) - env = getenv("LANG"); + env = getenv("LANG"); - /* 4. if none is set, fall to "C" */ + /* 4. if none is set, fall to "C" */ if (env == NULL || !*env) - env = "C"; + env = "C"; return (env); } @@ -326,4 +324,3 @@ __detect_path_locale(void) } return (0); } - Modified: head/lib/libc/locale/setrunelocale.c ============================================================================== --- head/lib/libc/locale/setrunelocale.c Sat Aug 26 15:08:27 2017 (r322924) +++ head/lib/libc/locale/setrunelocale.c Sat Aug 26 16:11:21 2017 (r322925) @@ -38,7 +38,7 @@ #include __FBSDID("$FreeBSD$"); -#define __RUNETYPE_INTERNAL 1 +#define __RUNETYPE_INTERNAL 1 #include #include @@ -72,7 +72,7 @@ destruct_ctype(void *v) { struct xlocale_ctype *l = v; - if (&_DefaultRuneLocale != l->runes) + if (&_DefaultRuneLocale != l->runes) free(l->runes); free(l); } @@ -81,7 +81,7 @@ const _RuneLocale * __getCurrentRuneLocale(void) { - return XLOCALE_CTYPE(__get_locale())->runes; + return (XLOCALE_CTYPE(__get_locale())->runes); } static void @@ -144,7 +144,7 @@ __setrunelocale(struct xlocale_ctype *l, const char *e else if (strcmp(rl->__encoding, "EUC-TW") == 0) ret = _EUC_TW_init(l, rl); else if (strcmp(rl->__encoding, "GB18030") == 0) - ret = _GB18030_init(l, rl); + ret = _GB18030_init(l, rl); else if (strcmp(rl->__encoding, "GB2312") == 0) ret = _GB2312_init(l, rl); else if (strcmp(rl->__encoding, "GBK") == 0) @@ -204,10 +204,9 @@ __ctype_load(const char *locale, locale_t unused __unu struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1); l->header.header.destructor = destruct_ctype; - if (__setrunelocale(l, locale)) - { + if (__setrunelocale(l, locale)) { free(l); - return NULL; + return (NULL); } - return l; + return (l); } From owner-svn-src-all@freebsd.org Sat Aug 26 18:04:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6309EDD712C; Sat, 26 Aug 2017 18:04:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27E8473289; Sat, 26 Aug 2017 18:04:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QI4UGE090783; Sat, 26 Aug 2017 18:04:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QI4UQn090782; Sat, 26 Aug 2017 18:04:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708261804.v7QI4UQn090782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 26 Aug 2017 18:04:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322926 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 322926 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:04:31 -0000 Author: kib Date: Sat Aug 26 18:04:29 2017 New Revision: 322926 URL: https://svnweb.freebsd.org/changeset/base/322926 Log: MFamd64 r322719: Trim excessive 'extern'. Reviewed by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/trap.c Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Sat Aug 26 16:11:21 2017 (r322925) +++ head/sys/i386/i386/trap.c Sat Aug 26 18:04:29 2017 (r322926) @@ -107,8 +107,8 @@ PMC_SOFT_DEFINE( , , page_fault, write); #include #endif -extern void trap(struct trapframe *frame); -extern void syscall(struct trapframe *frame); +void trap(struct trapframe *frame); +void syscall(struct trapframe *frame); static int trap_pfault(struct trapframe *, int, vm_offset_t); static void trap_fatal(struct trapframe *, vm_offset_t); From owner-svn-src-all@freebsd.org Sat Aug 26 18:06:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6718BDD71B7; Sat, 26 Aug 2017 18:06:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 369A2733D8; Sat, 26 Aug 2017 18:06:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QI6Thf090898; Sat, 26 Aug 2017 18:06:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QI6TgQ090897; Sat, 26 Aug 2017 18:06:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708261806.v7QI6TgQ090897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 26 Aug 2017 18:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322927 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 322927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:06:30 -0000 Author: kib Date: Sat Aug 26 18:06:29 2017 New Revision: 322927 URL: https://svnweb.freebsd.org/changeset/base/322927 Log: MFamd64 r322718: Use ANSI C declaration for trap_pfault(). Style. Reviewed by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/trap.c Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Sat Aug 26 18:04:29 2017 (r322926) +++ head/sys/i386/i386/trap.c Sat Aug 26 18:06:29 2017 (r322927) @@ -751,17 +751,18 @@ out: } static int -trap_pfault(frame, usermode, eva) - struct trapframe *frame; - int usermode; - vm_offset_t eva; +trap_pfault(struct trapframe *frame, int usermode, vm_offset_t eva) { + struct thread *td; + struct proc *p; vm_offset_t va; vm_map_t map; - int rv = 0; + int rv; vm_prot_t ftype; - struct thread *td = curthread; - struct proc *p = td->td_proc; + + td = curthread; + p = td->td_proc; + rv = 0; if (__predict_false((td->td_pflags & TDP_NOFAULTING) != 0)) { /* From owner-svn-src-all@freebsd.org Sat Aug 26 18:09:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69A1BDD723F; Sat, 26 Aug 2017 18:09:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 376AB7352F; Sat, 26 Aug 2017 18:09:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QI9Rpp091039; Sat, 26 Aug 2017 18:09:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QI9RDm091038; Sat, 26 Aug 2017 18:09:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708261809.v7QI9RDm091038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 26 Aug 2017 18:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322928 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 322928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:09:28 -0000 Author: kib Date: Sat Aug 26 18:09:27 2017 New Revision: 322928 URL: https://svnweb.freebsd.org/changeset/base/322928 Log: Remove unused code. The machdep.uprintf_signal sysctl replaced it in more convenient way, not requiring recompilation to use and providing more information on fault. Reviewed by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/trap.c Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Sat Aug 26 18:06:29 2017 (r322927) +++ head/sys/i386/i386/trap.c Sat Aug 26 18:09:27 2017 (r322928) @@ -731,16 +731,6 @@ kernel_trctrap: KASSERT((read_eflags() & PSL_I) != 0, ("interrupts disabled")); trapsignal(td, &ksi); -#ifdef DEBUG - if (type <= MAX_TRAP_MSG) { - uprintf("fatal process exception: %s", - trap_msg[type]); - if ((type == T_PAGEFLT) || (type == T_PROTFLT)) - uprintf(", fault VA = 0x%lx", (u_long)eva); - uprintf("\n"); - } -#endif - user: userret(td, frame); KASSERT(PCB_USER_FPU(td->td_pcb), From owner-svn-src-all@freebsd.org Sat Aug 26 18:12:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E429EDD7646; Sat, 26 Aug 2017 18:12:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C147A73A77; Sat, 26 Aug 2017 18:12:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QICPS6092723; Sat, 26 Aug 2017 18:12:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QICPkt092722; Sat, 26 Aug 2017 18:12:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708261812.v7QICPkt092722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 26 Aug 2017 18:12:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322929 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 322929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:12:27 -0000 Author: kib Date: Sat Aug 26 18:12:25 2017 New Revision: 322929 URL: https://svnweb.freebsd.org/changeset/base/322929 Log: MFamd64 r322720, r322723: Simplify i386 trap(). - Use more relevant name 'signo' instead of 'i' for the local variable which contains a signal number to send for the current exception. - Eliminate two labels 'userout' and 'out' which point to the very end of the trap() function. Instead use return directly. - Re-indent the prot_fault_translation block by reducing if() nesting. - Some more monor style changes. Reviewed by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/trap.c Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Sat Aug 26 18:09:27 2017 (r322928) +++ head/sys/i386/i386/trap.c Sat Aug 26 18:12:25 2017 (r322929) @@ -178,41 +178,45 @@ trap(struct trapframe *frame) #ifdef KDTRACE_HOOKS struct reg regs; #endif - struct thread *td = curthread; - struct proc *p = td->td_proc; + ksiginfo_t ksi; + struct thread *td; + struct proc *p; #ifdef KDB register_t dr6; #endif - int i = 0, ucode = 0; + int signo, ucode; u_int type; - register_t addr = 0; + register_t addr; vm_offset_t eva; - ksiginfo_t ksi; #ifdef POWERFAIL_NMI static int lastalert = 0; #endif + td = curthread; + p = td->td_proc; + signo = 0; + ucode = 0; + addr = 0; + VM_CNT_INC(v_trap); type = frame->tf_trapno; #ifdef SMP /* Handler for NMI IPIs used for stopping CPUs. */ - if (type == T_NMI) { - if (ipi_nmi_handler() == 0) - goto out; - } + if (type == T_NMI && ipi_nmi_handler() == 0) + return; #endif /* SMP */ #ifdef KDB if (kdb_active) { kdb_reenter(); - goto out; + return; } #endif if (type == T_RESERVED) { trap_fatal(frame, 0); - goto out; + return; } if (type == T_NMI) { @@ -226,18 +230,18 @@ trap(struct trapframe *frame) */ if (pmc_intr != NULL && (*pmc_intr)(PCPU_GET(cpuid), frame) != 0) - goto out; + return; #endif #ifdef STACK if (stack_nmi_handler(frame) != 0) - goto out; + return; #endif } if (type == T_MCHK) { mca_intr(); - goto out; + return; } #ifdef KDTRACE_HOOKS @@ -250,7 +254,7 @@ trap(struct trapframe *frame) */ if ((type == T_PROTFLT || type == T_PAGEFLT) && dtrace_trap_func != NULL && (*dtrace_trap_func)(frame, type)) - goto out; + return; #endif if ((frame->tf_eflags & PSL_I) == 0) { @@ -312,7 +316,7 @@ trap(struct trapframe *frame) switch (type) { case T_PRIVINFLT: /* privileged instruction fault */ - i = SIGILL; + signo = SIGILL; ucode = ILL_PRVOPC; break; @@ -324,66 +328,64 @@ trap(struct trapframe *frame) fill_frame_regs(frame, ®s); if (dtrace_pid_probe_ptr != NULL && dtrace_pid_probe_ptr(®s) == 0) - goto out; + return; } #endif user_trctrap_out: frame->tf_eflags &= ~PSL_T; - i = SIGTRAP; + signo = SIGTRAP; ucode = (type == T_TRCTRAP ? TRAP_TRACE : TRAP_BRKPT); break; case T_ARITHTRAP: /* arithmetic trap */ ucode = npxtrap_x87(); if (ucode == -1) - goto userout; - i = SIGFPE; + return; + signo = SIGFPE; break; - /* - * The following two traps can happen in - * vm86 mode, and, if so, we want to handle - * them specially. - */ + /* + * The following two traps can happen in vm86 mode, + * and, if so, we want to handle them specially. + */ case T_PROTFLT: /* general protection fault */ case T_STKFLT: /* stack fault */ if (frame->tf_eflags & PSL_VM) { - i = vm86_emulate((struct vm86frame *)frame); - if (i == SIGTRAP) { + signo = vm86_emulate((struct vm86frame *)frame); + if (signo == SIGTRAP) { type = T_TRCTRAP; load_dr6(rdr6() | 0x4000); goto user_trctrap_out; } - if (i == 0) + if (signo == 0) goto user; break; } - i = SIGBUS; + signo = SIGBUS; ucode = (type == T_PROTFLT) ? BUS_OBJERR : BUS_ADRERR; break; case T_SEGNPFLT: /* segment not present fault */ - i = SIGBUS; + signo = SIGBUS; ucode = BUS_ADRERR; break; case T_TSSFLT: /* invalid TSS fault */ - i = SIGBUS; + signo = SIGBUS; ucode = BUS_OBJERR; break; case T_ALIGNFLT: - i = SIGBUS; + signo = SIGBUS; ucode = BUS_ADRALN; break; case T_DOUBLEFLT: /* double fault */ default: - i = SIGBUS; + signo = SIGBUS; ucode = BUS_OBJERR; break; case T_PAGEFLT: /* page fault */ - - i = trap_pfault(frame, TRUE, eva); + signo = trap_pfault(frame, TRUE, eva); #if defined(I586_CPU) && !defined(NO_F00F_HACK) - if (i == -2) { + if (signo == -2) { /* * The f00f hack workaround has triggered, so * treat the fault as an illegal instruction @@ -393,52 +395,50 @@ user_trctrap_out: /* Proceed as in that case. */ ucode = ILL_PRVOPC; - i = SIGILL; + signo = SIGILL; break; } #endif - if (i == -1) - goto userout; - if (i == 0) + if (signo == -1) + return; + if (signo == 0) goto user; - if (i == SIGSEGV) + if (signo == SIGSEGV) ucode = SEGV_MAPERR; - else { - if (prot_fault_translation == 0) { - /* - * Autodetect. - * This check also covers the images - * without the ABI-tag ELF note. - */ - if (SV_CURPROC_ABI() == SV_ABI_FREEBSD - && p->p_osrel >= P_OSREL_SIGSEGV) { - i = SIGSEGV; - ucode = SEGV_ACCERR; - } else { - i = SIGBUS; - ucode = BUS_PAGE_FAULT; - } - } else if (prot_fault_translation == 1) { - /* - * Always compat mode. - */ - i = SIGBUS; - ucode = BUS_PAGE_FAULT; - } else { - /* - * Always SIGSEGV mode. - */ - i = SIGSEGV; + else if (prot_fault_translation == 0) { + /* + * Autodetect. This check also covers + * the images without the ABI-tag ELF + * note. + */ + if (SV_CURPROC_ABI() == SV_ABI_FREEBSD && + p->p_osrel >= P_OSREL_SIGSEGV) { + signo = SIGSEGV; ucode = SEGV_ACCERR; + } else { + signo = SIGBUS; + ucode = BUS_PAGE_FAULT; } + } else if (prot_fault_translation == 1) { + /* + * Always compat mode. + */ + signo = SIGBUS; + ucode = BUS_PAGE_FAULT; + } else { + /* + * Always SIGSEGV mode. + */ + signo = SIGSEGV; + ucode = SEGV_ACCERR; } addr = eva; break; case T_DIVIDE: /* integer divide fault */ ucode = FPE_INTDIV; - i = SIGFPE; + signo = SIGFPE; break; #ifdef DEV_ISA @@ -452,21 +452,21 @@ user_trctrap_out: sysbeep(880, hz); lastalert = time_second; } - goto userout; + return; #else /* !POWERFAIL_NMI */ nmi_handle_intr(type, frame); - goto out; + return; #endif /* POWERFAIL_NMI */ #endif /* DEV_ISA */ case T_OFLOW: /* integer overflow fault */ ucode = FPE_INTOVF; - i = SIGFPE; + signo = SIGFPE; break; case T_BOUND: /* bounds check fault */ ucode = FPE_FLTSUB; - i = SIGFPE; + signo = SIGFPE; break; case T_DNA: @@ -474,32 +474,31 @@ user_trctrap_out: ("kernel FPU ctx has leaked")); /* transparent fault (due to context switch "late") */ if (npxdna()) - goto userout; + return; uprintf("pid %d killed due to lack of floating point\n", p->p_pid); - i = SIGKILL; + signo = SIGKILL; ucode = 0; break; case T_FPOPFLT: /* FPU operand fetch fault */ ucode = ILL_COPROC; - i = SIGILL; + signo = SIGILL; break; case T_XMMFLT: /* SIMD floating-point exception */ ucode = npxtrap_sse(); if (ucode == -1) - goto userout; - i = SIGFPE; + return; + signo = SIGFPE; break; #ifdef KDTRACE_HOOKS case T_DTRACE_RET: enable_intr(); fill_frame_regs(frame, ®s); - if (dtrace_return_probe_ptr != NULL && - dtrace_return_probe_ptr(®s) == 0) - goto out; - goto userout; + if (dtrace_return_probe_ptr != NULL) + dtrace_return_probe_ptr(®s); + return; #endif } } else { @@ -510,13 +509,13 @@ user_trctrap_out: switch (type) { case T_PAGEFLT: /* page fault */ (void) trap_pfault(frame, FALSE, eva); - goto out; + return; case T_DNA: if (PCB_USER_FPU(td->td_pcb)) panic("Unregistered use of FPU in kernel"); if (npxdna()) - goto out; + return; break; case T_ARITHTRAP: /* arithmetic trap */ @@ -527,7 +526,7 @@ user_trctrap_out: * handler registration seems to be overkill */ trap_fatal(frame, 0); - goto out; + return; /* * The following two traps can happen in @@ -537,18 +536,18 @@ user_trctrap_out: case T_PROTFLT: /* general protection fault */ case T_STKFLT: /* stack fault */ if (frame->tf_eflags & PSL_VM) { - i = vm86_emulate((struct vm86frame *)frame); - if (i == SIGTRAP) { + signo = vm86_emulate((struct vm86frame *)frame); + if (signo == SIGTRAP) { type = T_TRCTRAP; load_dr6(rdr6() | 0x4000); goto kernel_trctrap; } - if (i != 0) + if (signo != 0) /* * returns to original process */ vm86_trap((struct vm86frame *)frame); - goto out; + return; } /* FALL THROUGH */ case T_SEGNPFLT: /* segment not present fault */ @@ -571,7 +570,7 @@ user_trctrap_out: kern_psignal(p, SIGBUS); PROC_UNLOCK(p); #endif - goto out; + return; } if (td->td_intr_nesting_level != 0) @@ -589,27 +588,26 @@ user_trctrap_out: */ if (frame->tf_eip == (int)doreti_iret) { frame->tf_eip = (int)doreti_iret_fault; - goto out; + return; } if (type == T_STKFLT) break; if (frame->tf_eip == (int)doreti_popl_ds) { frame->tf_eip = (int)doreti_popl_ds_fault; - goto out; + return; } if (frame->tf_eip == (int)doreti_popl_es) { frame->tf_eip = (int)doreti_popl_es_fault; - goto out; + return; } if (frame->tf_eip == (int)doreti_popl_fs) { frame->tf_eip = (int)doreti_popl_fs_fault; - goto out; + return; } if (curpcb->pcb_onfault != NULL) { - frame->tf_eip = - (int)curpcb->pcb_onfault; - goto out; + frame->tf_eip = (int)curpcb->pcb_onfault; + return; } break; @@ -625,7 +623,7 @@ user_trctrap_out: */ if (frame->tf_eflags & PSL_NT) { frame->tf_eflags &= ~PSL_NT; - goto out; + return; } break; @@ -638,7 +636,7 @@ kernel_trctrap: * silently until the syscall handler has * saved the flags. */ - goto out; + return; } if (frame->tf_eip == (int)IDTVEC(lcall_syscall) + 1) { /* @@ -646,7 +644,7 @@ kernel_trctrap: * flags. Stop single stepping it. */ frame->tf_eflags &= ~PSL_T; - goto out; + return; } /* * Ignore debug register trace traps due to @@ -665,7 +663,7 @@ kernel_trctrap: * processor doesn't */ load_dr6(rdr6() & ~0xf); - goto out; + return; } /* * FALLTHROUGH (TRCTRAP kernel mode, kernel address) @@ -680,7 +678,7 @@ kernel_trctrap: dr6 = rdr6(); load_dr6(dr6 & ~0x4000); if (kdb_trap(type, dr6, frame)) - goto out; + return; #endif break; @@ -692,24 +690,24 @@ kernel_trctrap: sysbeep(880, hz); lastalert = time_second; } - goto out; + return; #else /* !POWERFAIL_NMI */ nmi_handle_intr(type, frame); - goto out; + return; #endif /* POWERFAIL_NMI */ #endif /* DEV_ISA */ } trap_fatal(frame, eva); - goto out; + return; } /* Translate fault for emulators (e.g. Linux) */ - if (*p->p_sysent->sv_transtrap) - i = (*p->p_sysent->sv_transtrap)(i, type); + if (*p->p_sysent->sv_transtrap != NULL) + signo = (*p->p_sysent->sv_transtrap)(signo, type); ksiginfo_init_trap(&ksi); - ksi.ksi_signo = i; + ksi.ksi_signo = signo; ksi.ksi_code = ucode; ksi.ksi_addr = (void *)addr; ksi.ksi_trapno = type; @@ -717,8 +715,8 @@ kernel_trctrap: uprintf("pid %d comm %s: signal %d err %x code %d type %d " "addr 0x%x esp 0x%08x eip 0x%08x " "<%02x %02x %02x %02x %02x %02x %02x %02x>\n", - p->p_pid, p->p_comm, i, frame->tf_err, ucode, type, addr, - frame->tf_esp, frame->tf_eip, + p->p_pid, p->p_comm, signo, frame->tf_err, ucode, type, + addr, frame->tf_esp, frame->tf_eip, fubyte((void *)(frame->tf_eip + 0)), fubyte((void *)(frame->tf_eip + 1)), fubyte((void *)(frame->tf_eip + 2)), @@ -735,9 +733,6 @@ user: userret(td, frame); KASSERT(PCB_USER_FPU(td->td_pcb), ("Return from trap with kernel FPU ctx leaked")); -userout: -out: - return; } static int From owner-svn-src-all@freebsd.org Sat Aug 26 18:29:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0D0FDD7D2B; Sat, 26 Aug 2017 18:29:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C9D074549; Sat, 26 Aug 2017 18:29:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QITOj6099386; Sat, 26 Aug 2017 18:29:24 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QITONI099380; Sat, 26 Aug 2017 18:29:24 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708261829.v7QITONI099380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 26 Aug 2017 18:29:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322930 - in head/sys/boot/efi: boot1 include libefi loader X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot/efi: boot1 include libefi loader X-SVN-Commit-Revision: 322930 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:29:25 -0000 Author: imp Date: Sat Aug 26 18:29:24 2017 New Revision: 322930 URL: https://svnweb.freebsd.org/changeset/base/322930 Log: Move efi_main into efi/loader Move the efi_main routine out of libefi into sys/boot/efi/loader. Since boot1 has its own efi_main routine, this effectively prevents boot1 from linking with libefi. By moving it out, we can share code better (though though some refactoring with boot1's efi_main and loader.efi's efi_main is definitely in order). Sponsored by: Netflix Added: head/sys/boot/efi/loader/efi_main.c - copied, changed from r322924, head/sys/boot/efi/libefi/libefi.c Modified: head/sys/boot/efi/boot1/boot1.c head/sys/boot/efi/include/efidevp.h head/sys/boot/efi/libefi/libefi.c head/sys/boot/efi/loader/Makefile Modified: head/sys/boot/efi/boot1/boot1.c ============================================================================== --- head/sys/boot/efi/boot1/boot1.c Sat Aug 26 18:12:25 2017 (r322929) +++ head/sys/boot/efi/boot1/boot1.c Sat Aug 26 18:29:24 2017 (r322930) @@ -88,7 +88,7 @@ Free(void *buf, const char *file __unused, int line __ static BOOLEAN nodes_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) { - int len; + size_t len; if (imgpath == NULL || imgpath->Type != devpath->Type || imgpath->SubType != devpath->SubType) Modified: head/sys/boot/efi/include/efidevp.h ============================================================================== --- head/sys/boot/efi/include/efidevp.h Sat Aug 26 18:12:25 2017 (r322929) +++ head/sys/boot/efi/include/efidevp.h Sat Aug 26 18:29:24 2017 (r322930) @@ -52,7 +52,7 @@ typedef struct _EFI_DEVICE_PATH { #define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK ) #define DevicePathSubType(a) ( (a)->SubType ) -#define DevicePathNodeLength(a) ( ((a)->Length[0]) | ((a)->Length[1] << 8) ) +#define DevicePathNodeLength(a) ((size_t)(((a)->Length[0]) | ((a)->Length[1] << 8))) #define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a))) #define IsDevicePathType(a, t) ( DevicePathType(a) == t ) #define IsDevicePathEndType(a) IsDevicePathType(a, END_DEVICE_PATH_TYPE) Modified: head/sys/boot/efi/libefi/libefi.c ============================================================================== --- head/sys/boot/efi/libefi/libefi.c Sat Aug 26 18:12:25 2017 (r322929) +++ head/sys/boot/efi/libefi/libefi.c Sat Aug 26 18:29:24 2017 (r322930) @@ -32,32 +32,8 @@ __FBSDID("$FreeBSD$"); #include #include -EFI_HANDLE IH; -EFI_SYSTEM_TABLE *ST; -EFI_BOOT_SERVICES *BS; -EFI_RUNTIME_SERVICES *RS; +extern EFI_SYSTEM_TABLE *ST; -static EFI_PHYSICAL_ADDRESS heap; -static UINTN heapsize; - -static CHAR16 * -arg_skipsep(CHAR16 *argp) -{ - - while (*argp == ' ' || *argp == '\t' || *argp == '\n') - argp++; - return (argp); -} - -static CHAR16 * -arg_skipword(CHAR16 *argp) -{ - - while (*argp && *argp != ' ' && *argp != '\t' && *argp != '\n') - argp++; - return (argp); -} - void * efi_get_table(EFI_GUID *tbl) { @@ -70,129 +46,4 @@ efi_get_table(EFI_GUID *tbl) return (ST->ConfigurationTable[i].VendorTable); } return (NULL); -} - -void exit(EFI_STATUS exit_code) -{ - - BS->FreePages(heap, EFI_SIZE_TO_PAGES(heapsize)); - BS->Exit(IH, exit_code, 0, NULL); -} - -void -efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) -{ - static EFI_GUID image_protocol = LOADED_IMAGE_PROTOCOL; - static EFI_GUID console_control_protocol = - EFI_CONSOLE_CONTROL_PROTOCOL_GUID; - EFI_CONSOLE_CONTROL_PROTOCOL *console_control = NULL; - EFI_LOADED_IMAGE *img; - CHAR16 *argp, *args, **argv; - EFI_STATUS status; - int argc, addprog; - - IH = image_handle; - ST = system_table; - BS = ST->BootServices; - RS = ST->RuntimeServices; - - status = BS->LocateProtocol(&console_control_protocol, NULL, - (VOID **)&console_control); - if (status == EFI_SUCCESS) - (void)console_control->SetMode(console_control, - EfiConsoleControlScreenText); - - heapsize = 64 * 1024 * 1024; - status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, - EFI_SIZE_TO_PAGES(heapsize), &heap); - if (status != EFI_SUCCESS) - BS->Exit(IH, status, 0, NULL); - - setheap((void *)(uintptr_t)heap, (void *)(uintptr_t)(heap + heapsize)); - - /* Use exit() from here on... */ - - status = BS->HandleProtocol(IH, &image_protocol, (VOID**)&img); - if (status != EFI_SUCCESS) - exit(status); - - /* - * Pre-process the (optional) load options. If the option string - * is given as an ASCII string, we use a poor man's ASCII to - * Unicode-16 translation. The size of the option string as given - * to us includes the terminating null character. We assume the - * string is an ASCII string if strlen() plus the terminating - * '\0' is less than LoadOptionsSize. Even if all Unicode-16 - * characters have the upper 8 bits non-zero, the terminating - * null character will cause a one-off. - * If the string is already in Unicode-16, we make a copy so that - * we know we can always modify the string. - */ - if (img->LoadOptionsSize > 0 && img->LoadOptions != NULL) { - if (img->LoadOptionsSize == strlen(img->LoadOptions) + 1) { - args = malloc(img->LoadOptionsSize << 1); - for (argc = 0; argc < img->LoadOptionsSize; argc++) - args[argc] = ((char*)img->LoadOptions)[argc]; - } else { - args = malloc(img->LoadOptionsSize); - memcpy(args, img->LoadOptions, img->LoadOptionsSize); - } - } else - args = NULL; - - /* - * Use a quick and dirty algorithm to build the argv vector. We - * first count the number of words. Then, after allocating the - * vector, we split the string up. We don't deal with quotes or - * other more advanced shell features. - * The EFI shell will pass the name of the image as the first - * word in the argument list. This does not happen if we're - * loaded by the boot manager. This is not so easy to figure - * out though. The ParentHandle is not always NULL, because - * there can be a function (=image) that will perform the task - * for the boot manager. - */ - /* Part 1: Figure out if we need to add our program name. */ - addprog = (args == NULL || img->ParentHandle == NULL || - img->FilePath == NULL) ? 1 : 0; - if (!addprog) { - addprog = - (DevicePathType(img->FilePath) != MEDIA_DEVICE_PATH || - DevicePathSubType(img->FilePath) != MEDIA_FILEPATH_DP || - DevicePathNodeLength(img->FilePath) <= - sizeof(FILEPATH_DEVICE_PATH)) ? 1 : 0; - if (!addprog) { - /* XXX todo. */ - } - } - /* Part 2: count words. */ - argc = (addprog) ? 1 : 0; - argp = args; - while (argp != NULL && *argp != 0) { - argp = arg_skipsep(argp); - if (*argp == 0) - break; - argc++; - argp = arg_skipword(argp); - } - /* Part 3: build vector. */ - argv = malloc((argc + 1) * sizeof(CHAR16*)); - argc = 0; - if (addprog) - argv[argc++] = (CHAR16 *)L"loader.efi"; - argp = args; - while (argp != NULL && *argp != 0) { - argp = arg_skipsep(argp); - if (*argp == 0) - break; - argv[argc++] = argp; - argp = arg_skipword(argp); - /* Terminate the words. */ - if (*argp != 0) - *argp++ = 0; - } - argv[argc] = NULL; - - status = main(argc, argv); - exit(status); } Modified: head/sys/boot/efi/loader/Makefile ============================================================================== --- head/sys/boot/efi/loader/Makefile Sat Aug 26 18:12:25 2017 (r322929) +++ head/sys/boot/efi/loader/Makefile Sat Aug 26 18:29:24 2017 (r322930) @@ -16,6 +16,7 @@ SRCS= autoload.c \ bootinfo.c \ conf.c \ copy.c \ + efi_main.c \ main.c \ self_reloc.c \ smbios.c \ Copied and modified: head/sys/boot/efi/loader/efi_main.c (from r322924, head/sys/boot/efi/libefi/libefi.c) ============================================================================== --- head/sys/boot/efi/libefi/libefi.c Sat Aug 26 15:08:27 2017 (r322924, copy source) +++ head/sys/boot/efi/loader/efi_main.c Sat Aug 26 18:29:24 2017 (r322930) @@ -40,6 +40,14 @@ EFI_RUNTIME_SERVICES *RS; static EFI_PHYSICAL_ADDRESS heap; static UINTN heapsize; +void +exit(EFI_STATUS exit_code) +{ + + BS->FreePages(heap, EFI_SIZE_TO_PAGES(heapsize)); + BS->Exit(IH, exit_code, 0, NULL); +} + static CHAR16 * arg_skipsep(CHAR16 *argp) { @@ -58,27 +66,8 @@ arg_skipword(CHAR16 *argp) return (argp); } -void * -efi_get_table(EFI_GUID *tbl) -{ - EFI_GUID *id; - int i; +void efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table); - for (i = 0; i < ST->NumberOfTableEntries; i++) { - id = &ST->ConfigurationTable[i].VendorGuid; - if (!memcmp(id, tbl, sizeof(EFI_GUID))) - return (ST->ConfigurationTable[i].VendorTable); - } - return (NULL); -} - -void exit(EFI_STATUS exit_code) -{ - - BS->FreePages(heap, EFI_SIZE_TO_PAGES(heapsize)); - BS->Exit(IH, exit_code, 0, NULL); -} - void efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) { @@ -131,7 +120,7 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *sy if (img->LoadOptionsSize > 0 && img->LoadOptions != NULL) { if (img->LoadOptionsSize == strlen(img->LoadOptions) + 1) { args = malloc(img->LoadOptionsSize << 1); - for (argc = 0; argc < img->LoadOptionsSize; argc++) + for (argc = 0; argc < (int)img->LoadOptionsSize; argc++) args[argc] = ((char*)img->LoadOptions)[argc]; } else { args = malloc(img->LoadOptionsSize); From owner-svn-src-all@freebsd.org Sat Aug 26 18:29:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81AE0DD7D7F; Sat, 26 Aug 2017 18:29:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45F2974637; Sat, 26 Aug 2017 18:29:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QITct8099443; Sat, 26 Aug 2017 18:29:38 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QITcjP099439; Sat, 26 Aug 2017 18:29:38 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708261829.v7QITcjP099439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 26 Aug 2017 18:29:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322931 - in head/sys/boot/efi: boot1 include loader X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot/efi: boot1 include loader X-SVN-Commit-Revision: 322931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:29:39 -0000 Author: imp Date: Sat Aug 26 18:29:37 2017 New Revision: 322931 URL: https://svnweb.freebsd.org/changeset/base/322931 Log: Cleanup efi_main return type Make the return type of efi_main uniform. Declare the Exit() function as not returning. Move efi_main's declaration to the proper header. Sponsored by: Netflix Modified: head/sys/boot/efi/boot1/boot1.c head/sys/boot/efi/include/efiapi.h head/sys/boot/efi/include/efilib.h head/sys/boot/efi/loader/efi_main.c Modified: head/sys/boot/efi/boot1/boot1.c ============================================================================== --- head/sys/boot/efi/boot1/boot1.c Sat Aug 26 18:29:24 2017 (r322930) +++ head/sys/boot/efi/boot1/boot1.c Sat Aug 26 18:29:37 2017 (r322931) @@ -47,8 +47,6 @@ static const boot_module_t *boot_modules[] = /* The initial number of handles used to query EFI for partitions. */ #define NUM_HANDLES_INIT 24 -EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab); - EFI_SYSTEM_TABLE *systab; EFI_BOOT_SERVICES *bs; static EFI_HANDLE *image; Modified: head/sys/boot/efi/include/efiapi.h ============================================================================== --- head/sys/boot/efi/include/efiapi.h Sat Aug 26 18:29:24 2017 (r322930) +++ head/sys/boot/efi/include/efiapi.h Sat Aug 26 18:29:37 2017 (r322931) @@ -353,7 +353,7 @@ EFI_STATUS IN EFI_STATUS ExitStatus, IN UINTN ExitDataSize, IN CHAR16 *ExitData OPTIONAL - ); + ) __dead2; typedef EFI_STATUS Modified: head/sys/boot/efi/include/efilib.h ============================================================================== --- head/sys/boot/efi/include/efilib.h Sat Aug 26 18:29:24 2017 (r322930) +++ head/sys/boot/efi/include/efilib.h Sat Aug 26 18:29:37 2017 (r322931) @@ -89,8 +89,10 @@ EFI_STATUS errno_to_efi_status(int errno); void efi_time_init(void); void efi_time_fini(void); +EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab); + EFI_STATUS main(int argc, CHAR16 *argv[]); -void exit(EFI_STATUS status); +void exit(EFI_STATUS status) __dead2; void delay(int usecs); /* EFI environment initialization. */ Modified: head/sys/boot/efi/loader/efi_main.c ============================================================================== --- head/sys/boot/efi/loader/efi_main.c Sat Aug 26 18:29:24 2017 (r322930) +++ head/sys/boot/efi/loader/efi_main.c Sat Aug 26 18:29:37 2017 (r322931) @@ -66,9 +66,7 @@ arg_skipword(CHAR16 *argp) return (argp); } -void efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table); - -void +EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) { static EFI_GUID image_protocol = LOADED_IMAGE_PROTOCOL; @@ -184,4 +182,5 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *sy status = main(argc, argv); exit(status); + return (status); } From owner-svn-src-all@freebsd.org Sat Aug 26 18:29:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5D9EDD7DCB; Sat, 26 Aug 2017 18:29:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFB8B746CB; Sat, 26 Aug 2017 18:29:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QIThm7099500; Sat, 26 Aug 2017 18:29:43 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QIThDc099496; Sat, 26 Aug 2017 18:29:43 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708261829.v7QIThDc099496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 26 Aug 2017 18:29:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322932 - head/sys/boot/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/efi/boot1 X-SVN-Commit-Revision: 322932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:29:45 -0000 Author: imp Date: Sat Aug 26 18:29:43 2017 New Revision: 322932 URL: https://svnweb.freebsd.org/changeset/base/322932 Log: Use the loader.efi conventions for the various EFI tables. Sponsored by: Netflix Modified: head/sys/boot/efi/boot1/boot1.c head/sys/boot/efi/boot1/boot_module.h head/sys/boot/efi/boot1/ufs_module.c head/sys/boot/efi/boot1/zfs_module.c Modified: head/sys/boot/efi/boot1/boot1.c ============================================================================== --- head/sys/boot/efi/boot1/boot1.c Sat Aug 26 18:29:37 2017 (r322931) +++ head/sys/boot/efi/boot1/boot1.c Sat Aug 26 18:29:43 2017 (r322932) @@ -47,9 +47,10 @@ static const boot_module_t *boot_modules[] = /* The initial number of handles used to query EFI for partitions. */ #define NUM_HANDLES_INIT 24 -EFI_SYSTEM_TABLE *systab; -EFI_BOOT_SERVICES *bs; -static EFI_HANDLE *image; +EFI_HANDLE IH; +EFI_SYSTEM_TABLE *ST; +EFI_BOOT_SERVICES *BS; +EFI_RUNTIME_SERVICES *RS; static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL; static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; @@ -66,7 +67,7 @@ Malloc(size_t len, const char *file __unused, int line { void *out; - if (bs->AllocatePool(EfiLoaderData, len, &out) == EFI_SUCCESS) + if (BS->AllocatePool(EfiLoaderData, len, &out) == EFI_SUCCESS) return (out); return (NULL); @@ -76,7 +77,7 @@ void Free(void *buf, const char *file __unused, int line __unused) { if (buf != NULL) - (void)bs->FreePool(buf); + (void)BS->FreePool(buf); } /* @@ -398,14 +399,14 @@ try_boot(void) buf = NULL; } - if ((status = bs->LoadImage(TRUE, image, devpath_last(dev->devpath), + if ((status = BS->LoadImage(TRUE, IH, devpath_last(dev->devpath), loaderbuf, loadersize, &loaderhandle)) != EFI_SUCCESS) { printf("Failed to load image provided by %s, size: %zu, (%lu)\n", mod->name, loadersize, EFI_ERROR_CODE(status)); goto errout; } - if ((status = bs->HandleProtocol(loaderhandle, &LoadedImageGUID, + if ((status = BS->HandleProtocol(loaderhandle, &LoadedImageGUID, (VOID**)&loaded_image)) != EFI_SUCCESS) { printf("Failed to query LoadedImage provided by %s (%lu)\n", mod->name, EFI_ERROR_CODE(status)); @@ -431,7 +432,7 @@ try_boot(void) DSTALL(1000000); DPRINTF(".\n"); - if ((status = bs->StartImage(loaderhandle, NULL, NULL)) != + if ((status = BS->StartImage(loaderhandle, NULL, NULL)) != EFI_SUCCESS) { printf("Failed to start image provided by %s (%lu)\n", mod->name, EFI_ERROR_CODE(status)); @@ -465,7 +466,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B UINTN i; /* Figure out if we're dealing with an actual partition. */ - status = bs->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); if (status == EFI_UNSUPPORTED) return (status); @@ -477,7 +478,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B DPRINTF("probing: %s\n", devpath_str(devpath)); - status = bs->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); if (status == EFI_UNSUPPORTED) return (status); @@ -494,7 +495,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B /* Run through each module, see if it can load this partition */ for (i = 0; i < NUM_BOOT_MODULES; i++) { - if ((status = bs->AllocatePool(EfiLoaderData, + if ((status = BS->AllocatePool(EfiLoaderData, sizeof(*devinfo), (void **)&devinfo)) != EFI_SUCCESS) { DPRINTF("\nFailed to allocate devinfo (%lu)\n", @@ -511,7 +512,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B status = boot_modules[i]->probe(devinfo); if (status == EFI_SUCCESS) return (EFI_SUCCESS); - (void)bs->FreePool(devinfo); + (void)BS->FreePool(devinfo); } return (EFI_UNSUPPORTED); @@ -565,12 +566,13 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) UINTN i, max_dim, best_mode, cols, rows, hsize, nhandles; /* Basic initialization*/ - systab = Xsystab; - image = Ximage; - bs = Xsystab->BootServices; + ST = Xsystab; + IH = Ximage; + BS = ST->BootServices; + RS = ST->RuntimeServices; /* Set up the console, so printf works. */ - status = bs->LocateProtocol(&ConsoleControlGUID, NULL, + status = BS->LocateProtocol(&ConsoleControlGUID, NULL, (VOID **)&ConsoleControl); if (status == EFI_SUCCESS) (void)ConsoleControl->SetMode(ConsoleControl, @@ -578,7 +580,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) /* * Reset the console and find the best text mode. */ - conout = systab->ConOut; + conout = ST->ConOut; conout->Reset(conout, TRUE); max_dim = best_mode = 0; for (i = 0; ; i++) { @@ -607,24 +609,24 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) /* Get all the device handles */ hsize = (UINTN)NUM_HANDLES_INIT * sizeof(EFI_HANDLE); - if ((status = bs->AllocatePool(EfiLoaderData, hsize, (void **)&handles)) + if ((status = BS->AllocatePool(EfiLoaderData, hsize, (void **)&handles)) != EFI_SUCCESS) panic("Failed to allocate %d handles (%lu)", NUM_HANDLES_INIT, EFI_ERROR_CODE(status)); - status = bs->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, + status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, &hsize, handles); switch (status) { case EFI_SUCCESS: break; case EFI_BUFFER_TOO_SMALL: - (void)bs->FreePool(handles); - if ((status = bs->AllocatePool(EfiLoaderData, hsize, + (void)BS->FreePool(handles); + if ((status = BS->AllocatePool(EfiLoaderData, hsize, (void **)&handles)) != EFI_SUCCESS) { panic("Failed to allocate %zu handles (%lu)", hsize / sizeof(*handles), EFI_ERROR_CODE(status)); } - status = bs->LocateHandle(ByProtocol, &BlockIoProtocolGUID, + status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, &hsize, handles); if (status != EFI_SUCCESS) panic("Failed to get device handles (%lu)\n", @@ -641,10 +643,10 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) DPRINTF("\n"); /* Determine the devpath of our image so we can prefer it. */ - status = bs->HandleProtocol(image, &LoadedImageGUID, (VOID**)&img); + status = BS->HandleProtocol(IH, &LoadedImageGUID, (VOID**)&img); imgpath = NULL; if (status == EFI_SUCCESS) { - status = bs->HandleProtocol(img->DeviceHandle, &DevicePathGUID, + status = BS->HandleProtocol(img->DeviceHandle, &DevicePathGUID, (void **)&imgpath); if (status != EFI_SUCCESS) DPRINTF("Failed to get image DevicePath (%lu)\n", @@ -709,9 +711,9 @@ putchar(int c) if (c == '\n') { buf[0] = '\r'; buf[1] = 0; - systab->ConOut->OutputString(systab->ConOut, buf); + ST->ConOut->OutputString(ST->ConOut, buf); } buf[0] = c; buf[1] = 0; - systab->ConOut->OutputString(systab->ConOut, buf); + ST->ConOut->OutputString(ST->ConOut, buf); } Modified: head/sys/boot/efi/boot1/boot_module.h ============================================================================== --- head/sys/boot/efi/boot1/boot_module.h Sat Aug 26 18:29:37 2017 (r322931) +++ head/sys/boot/efi/boot1/boot_module.h Sat Aug 26 18:29:43 2017 (r322932) @@ -37,7 +37,7 @@ #ifdef EFI_DEBUG #define DPRINTF(fmt, args...) printf(fmt, ##args) -#define DSTALL(d) bs->Stall(d) +#define DSTALL(d) BS->Stall(d) #else #define DPRINTF(fmt, ...) {} #define DSTALL(d) {} @@ -106,9 +106,6 @@ extern const boot_module_t zfs_module; /* Functions available to modules. */ extern void add_device(dev_info_t **devinfop, dev_info_t *devinfo); extern int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap); - -extern EFI_SYSTEM_TABLE *systab; -extern EFI_BOOT_SERVICES *bs; extern int devpath_strlcat(char *buf, size_t size, EFI_DEVICE_PATH *devpath); extern char *devpath_str(EFI_DEVICE_PATH *devpath); Modified: head/sys/boot/efi/boot1/ufs_module.c ============================================================================== --- head/sys/boot/efi/boot1/ufs_module.c Sat Aug 26 18:29:37 2017 (r322931) +++ head/sys/boot/efi/boot1/ufs_module.c Sat Aug 26 18:29:43 2017 (r322932) @@ -118,7 +118,7 @@ load(const char *filepath, dev_info_t *dev, void **buf return (EFI_INVALID_PARAMETER); } - if ((status = bs->AllocatePool(EfiLoaderData, size, &buf)) != + if ((status = BS->AllocatePool(EfiLoaderData, size, &buf)) != EFI_SUCCESS) { printf("Failed to allocate read buffer %zu for '%s' (%lu)\n", size, filepath, EFI_ERROR_CODE(status)); @@ -129,7 +129,7 @@ load(const char *filepath, dev_info_t *dev, void **buf if ((size_t)read != size) { printf("Failed to read '%s' (%zd != %zu)\n", filepath, read, size); - (void)bs->FreePool(buf); + (void)BS->FreePool(buf); return (EFI_INVALID_PARAMETER); } Modified: head/sys/boot/efi/boot1/zfs_module.c ============================================================================== --- head/sys/boot/efi/boot1/zfs_module.c Sat Aug 26 18:29:37 2017 (r322931) +++ head/sys/boot/efi/boot1/zfs_module.c Sat Aug 26 18:29:43 2017 (r322932) @@ -118,7 +118,7 @@ probe(dev_info_t *dev) EFI_STATUS status; /* ZFS consumes the dev on success so we need a copy. */ - if ((status = bs->AllocatePool(EfiLoaderData, sizeof(*dev), + if ((status = BS->AllocatePool(EfiLoaderData, sizeof(*dev), (void**)&tdev)) != EFI_SUCCESS) { DPRINTF("Failed to allocate tdev (%lu)\n", EFI_ERROR_CODE(status)); @@ -127,7 +127,7 @@ probe(dev_info_t *dev) memcpy(tdev, dev, sizeof(*dev)); if (vdev_probe(vdev_read, tdev, &spa) != 0) { - (void)bs->FreePool(tdev); + (void)BS->FreePool(tdev); return (EFI_UNSUPPORTED); } @@ -180,7 +180,7 @@ load(const char *filepath, dev_info_t *devinfo, void * return (EFI_INVALID_PARAMETER); } - if ((status = bs->AllocatePool(EfiLoaderData, (UINTN)st.st_size, &buf)) + if ((status = BS->AllocatePool(EfiLoaderData, (UINTN)st.st_size, &buf)) != EFI_SUCCESS) { printf("Failed to allocate load buffer %jd for pool '%s' for '%s' " "(%lu)\n", (intmax_t)st.st_size, spa->spa_name, filepath, EFI_ERROR_CODE(status)); @@ -190,7 +190,7 @@ load(const char *filepath, dev_info_t *devinfo, void * if ((err = dnode_read(spa, &dn, 0, buf, st.st_size)) != 0) { printf("Failed to read node from %s (%d)\n", spa->spa_name, err); - (void)bs->FreePool(buf); + (void)BS->FreePool(buf); return (EFI_INVALID_PARAMETER); } From owner-svn-src-all@freebsd.org Sat Aug 26 18:29:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6A41DD7E86; Sat, 26 Aug 2017 18:29:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8973E747F9; Sat, 26 Aug 2017 18:29:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QITrQf099605; Sat, 26 Aug 2017 18:29:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QITrBo099604; Sat, 26 Aug 2017 18:29:53 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708261829.v7QITrBo099604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 26 Aug 2017 18:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322934 - head/sys/boot/geli X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/geli X-SVN-Commit-Revision: 322934 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:29:55 -0000 Author: imp Date: Sat Aug 26 18:29:53 2017 New Revision: 322934 URL: https://svnweb.freebsd.org/changeset/base/322934 Log: _STAND is sometimes defined on the command line. Make the define here match. Sponsored by: Netflix Modified: head/sys/boot/geli/geliboot_internal.h Modified: head/sys/boot/geli/geliboot_internal.h ============================================================================== --- head/sys/boot/geli/geliboot_internal.h Sat Aug 26 18:29:48 2017 (r322933) +++ head/sys/boot/geli/geliboot_internal.h Sat Aug 26 18:29:53 2017 (r322934) @@ -51,7 +51,7 @@ #include /* AES-XTS implementation */ -#define _STAND +#define _STAND 1 #define STAND_H /* We don't want stand.h in {gpt,zfs,gptzfs}boot */ #include From owner-svn-src-all@freebsd.org Sat Aug 26 18:29:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E635ADD7E0D; Sat, 26 Aug 2017 18:29:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A63897475E; Sat, 26 Aug 2017 18:29:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QITmON099553; Sat, 26 Aug 2017 18:29:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QITmBf099552; Sat, 26 Aug 2017 18:29:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708261829.v7QITmBf099552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 26 Aug 2017 18:29:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322933 - head/sys/boot/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/efi/boot1 X-SVN-Commit-Revision: 322933 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:29:50 -0000 Author: imp Date: Sat Aug 26 18:29:48 2017 New Revision: 322933 URL: https://svnweb.freebsd.org/changeset/base/322933 Log: No need for MK_ZFS around these: they are by their nature only active when MK_ZFS is true. Sponsored by: Netflix Modified: head/sys/boot/efi/boot1/Makefile Modified: head/sys/boot/efi/boot1/Makefile ============================================================================== --- head/sys/boot/efi/boot1/Makefile Sat Aug 26 18:29:43 2017 (r322932) +++ head/sys/boot/efi/boot1/Makefile Sat Aug 26 18:29:48 2017 (r322933) @@ -10,7 +10,6 @@ PROG= boot1.sym INTERNALPROG= WARNS?= 6 -.if ${MK_ZFS} != "no" # Disable warnings that are currently incompatible with the zfs boot code CWARNFLAGS.zfs_module.c += -Wno-array-bounds CWARNFLAGS.zfs_module.c += -Wno-cast-align @@ -24,7 +23,6 @@ CWARNFLAGS.skein.c += -Wno-cast-align CWARNFLAGS.skein.c += -Wno-missing-variable-declarations .else if ${COMPILER_TYPE} == "gcc" CWARNFLAGS.skein.c += -Wno-missing-declarations -.endif .endif # architecture-specific loader code From owner-svn-src-all@freebsd.org Sat Aug 26 18:30:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F191DD7F70; Sat, 26 Aug 2017 18:30:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61CC374949; Sat, 26 Aug 2017 18:30:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QIU3WO099735; Sat, 26 Aug 2017 18:30:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QIU3G7099734; Sat, 26 Aug 2017 18:30:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708261830.v7QIU3G7099734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 26 Aug 2017 18:30:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322936 - head/sys/boot/i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/i386/libi386 X-SVN-Commit-Revision: 322936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:30:04 -0000 Author: imp Date: Sat Aug 26 18:30:03 2017 New Revision: 322936 URL: https://svnweb.freebsd.org/changeset/base/322936 Log: Remove useless 'static' for an enum definition. Sponsored by: Netflix Modified: head/sys/boot/i386/libi386/biosdisk.c Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Sat Aug 26 18:29:58 2017 (r322935) +++ head/sys/boot/i386/libi386/biosdisk.c Sat Aug 26 18:30:03 2017 (r322936) @@ -139,7 +139,7 @@ static int bd_ioctl(struct open_file *f, u_long cmd, v static int bd_print(int verbose); #ifdef LOADER_GELI_SUPPORT -static enum isgeli { +enum isgeli { ISGELI_UNKNOWN, ISGELI_NO, ISGELI_YES From owner-svn-src-all@freebsd.org Sat Aug 26 18:29:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A97A1DD7EDA; Sat, 26 Aug 2017 18:29:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E36D748A6; Sat, 26 Aug 2017 18:29:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QITwk7099659; Sat, 26 Aug 2017 18:29:58 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QITwJF099658; Sat, 26 Aug 2017 18:29:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708261829.v7QITwJF099658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 26 Aug 2017 18:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322935 - head/sys/boot/geli X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/geli X-SVN-Commit-Revision: 322935 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:29:59 -0000 Author: imp Date: Sat Aug 26 18:29:58 2017 New Revision: 322935 URL: https://svnweb.freebsd.org/changeset/base/322935 Log: Fix warnings due to type mismatch. Cast ctxp to caddr_t to pass data as expected. While void * is a universal type, char * isn't (and that's what caddr_t is defined as). One could argue these prototypes should take void * rather than caddr_t, but changing that is much more invasive. Sponsored by: Netflix Modified: head/sys/boot/geli/geliboot_crypto.c Modified: head/sys/boot/geli/geliboot_crypto.c ============================================================================== --- head/sys/boot/geli/geliboot_crypto.c Sat Aug 26 18:29:53 2017 (r322934) +++ head/sys/boot/geli/geliboot_crypto.c Sat Aug 26 18:29:58 2017 (r322935) @@ -82,17 +82,17 @@ geliboot_crypt(u_int algo, int enc, u_char *data, size rijndael_set_key(&ctxp->key1, key, xts_len / 2); rijndael_set_key(&ctxp->key2, key + (xts_len / 16), xts_len / 2); - enc_xform_aes_xts.reinit(ctxp, iv); + enc_xform_aes_xts.reinit((caddr_t)ctxp, iv); switch (enc) { case 0: /* decrypt */ for (i = 0; i < datasize; i += AES_XTS_BLOCKSIZE) { - enc_xform_aes_xts.decrypt(ctxp, data + i); + enc_xform_aes_xts.decrypt((caddr_t)ctxp, data + i); } break; case 1: /* encrypt */ for (i = 0; i < datasize; i += AES_XTS_BLOCKSIZE) { - enc_xform_aes_xts.encrypt(ctxp, data + i); + enc_xform_aes_xts.encrypt((caddr_t)ctxp, data + i); } break; } From owner-svn-src-all@freebsd.org Sat Aug 26 18:30:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D319DD7FFC; Sat, 26 Aug 2017 18:30:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A04374A04; Sat, 26 Aug 2017 18:30:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QIU9Uv099789; Sat, 26 Aug 2017 18:30:09 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QIU9Fj099788; Sat, 26 Aug 2017 18:30:09 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708261830.v7QIU9Fj099788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 26 Aug 2017 18:30:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322937 - head/sys/boot/geli X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/geli X-SVN-Commit-Revision: 322937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:30:10 -0000 Author: imp Date: Sat Aug 26 18:30:08 2017 New Revision: 322937 URL: https://svnweb.freebsd.org/changeset/base/322937 Log: Forward declare struct dsk to avoid warnings when building libi386. Sponsored by: Netflix Modified: head/sys/boot/geli/geliboot.h Modified: head/sys/boot/geli/geliboot.h ============================================================================== --- head/sys/boot/geli/geliboot.h Sat Aug 26 18:30:03 2017 (r322936) +++ head/sys/boot/geli/geliboot.h Sat Aug 26 18:30:08 2017 (r322937) @@ -48,6 +48,8 @@ extern void pwgets(char *buf, int n, int hide); +struct dsk; + void geli_init(void); int geli_taste(int read_func(void *vdev, void *priv, off_t off, void *buf, size_t bytes), struct dsk *dsk, daddr_t lastsector); From owner-svn-src-all@freebsd.org Sat Aug 26 18:30:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F042ADD80A1; Sat, 26 Aug 2017 18:30:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD88F74AC5; Sat, 26 Aug 2017 18:30:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QIUEt3099846; Sat, 26 Aug 2017 18:30:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QIUEVX099842; Sat, 26 Aug 2017 18:30:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708261830.v7QIUEVX099842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 26 Aug 2017 18:30:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322938 - in head/sys/boot/efi: boot1 libefi loader X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot/efi: boot1 libefi loader X-SVN-Commit-Revision: 322938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 18:30:16 -0000 Author: imp Date: Sat Aug 26 18:30:14 2017 New Revision: 322938 URL: https://svnweb.freebsd.org/changeset/base/322938 Log: Link in libefi for boot1 Add libefi to the list of libraries we'll link in. Move EFI table definitions back to libefi so we don't have drift between the two efi_main routines. Sponsored by: Netflix Modified: head/sys/boot/efi/boot1/Makefile head/sys/boot/efi/boot1/boot1.c head/sys/boot/efi/libefi/libefi.c head/sys/boot/efi/loader/efi_main.c Modified: head/sys/boot/efi/boot1/Makefile ============================================================================== --- head/sys/boot/efi/boot1/Makefile Sat Aug 26 18:30:08 2017 (r322937) +++ head/sys/boot/efi/boot1/Makefile Sat Aug 26 18:30:14 2017 (r322938) @@ -76,13 +76,15 @@ CFLAGS+= -fPIC LDFLAGS+= -Wl,-znocombreloc .endif +LIBEFI= ${.OBJDIR}/../libefi/libefi.a + # # Add libstand for the runtime functions used by the compiler - for example # __aeabi_* (arm) or __divdi3 (i386). # as well as required string and memory functions for all platforms. # -DPADD+= ${LIBSTAND} -LDADD+= -lstand +DPADD+= ${LIBEFI} ${LIBSTAND} +LDADD+= ${LIBEFI} -lstand DPADD+= ${LDSCRIPT} Modified: head/sys/boot/efi/boot1/boot1.c ============================================================================== --- head/sys/boot/efi/boot1/boot1.c Sat Aug 26 18:30:08 2017 (r322937) +++ head/sys/boot/efi/boot1/boot1.c Sat Aug 26 18:30:14 2017 (r322938) @@ -47,11 +47,6 @@ static const boot_module_t *boot_modules[] = /* The initial number of handles used to query EFI for partitions. */ #define NUM_HANDLES_INIT 24 -EFI_HANDLE IH; -EFI_SYSTEM_TABLE *ST; -EFI_BOOT_SERVICES *BS; -EFI_RUNTIME_SERVICES *RS; - static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL; static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL; Modified: head/sys/boot/efi/libefi/libefi.c ============================================================================== --- head/sys/boot/efi/libefi/libefi.c Sat Aug 26 18:30:08 2017 (r322937) +++ head/sys/boot/efi/libefi/libefi.c Sat Aug 26 18:30:14 2017 (r322938) @@ -32,7 +32,10 @@ __FBSDID("$FreeBSD$"); #include #include -extern EFI_SYSTEM_TABLE *ST; +EFI_HANDLE IH; +EFI_SYSTEM_TABLE *ST; +EFI_BOOT_SERVICES *BS; +EFI_RUNTIME_SERVICES *RS; void * efi_get_table(EFI_GUID *tbl) Modified: head/sys/boot/efi/loader/efi_main.c ============================================================================== --- head/sys/boot/efi/loader/efi_main.c Sat Aug 26 18:30:08 2017 (r322937) +++ head/sys/boot/efi/loader/efi_main.c Sat Aug 26 18:30:14 2017 (r322938) @@ -32,11 +32,6 @@ __FBSDID("$FreeBSD$"); #include #include -EFI_HANDLE IH; -EFI_SYSTEM_TABLE *ST; -EFI_BOOT_SERVICES *BS; -EFI_RUNTIME_SERVICES *RS; - static EFI_PHYSICAL_ADDRESS heap; static UINTN heapsize; From owner-svn-src-all@freebsd.org Sat Aug 26 23:04:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C80ABDDCECA; Sat, 26 Aug 2017 23:04:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9773B7FEE4; Sat, 26 Aug 2017 23:04:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QN4J7o013281; Sat, 26 Aug 2017 23:04:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QN4JPM013277; Sat, 26 Aug 2017 23:04:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708262304.v7QN4JPM013277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 26 Aug 2017 23:04:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322939 - head/sys/boot/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/efi/boot1 X-SVN-Commit-Revision: 322939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 23:04:20 -0000 Author: imp Date: Sat Aug 26 23:04:19 2017 New Revision: 322939 URL: https://svnweb.freebsd.org/changeset/base/322939 Log: Use efi_devpath_str for debug path info. Kill our own hand-rolled (and somewhat flawed) devpath_str in favor of the recently added efi_devpath_str in libefi. This gives us much better names at the expense of not being able to debug on EFI 1.2 machines (since the UEFI protocol efi_devpath_str depends on was added in UEFI 2.0). However, this isn't the first thing that requires newer than EFI 1.2, so it's quite possible that this doesn't change the universe of machines we can EFI boot from. This will now give us the full UEFI path, even for devices we don't yet know about. More importantly, it gives us the full HD(...) part of the path, which is sufficient by itself to locate disks that follow the rules (dd one disk (but not partition) to another still needs the rest of the path to disambiguate, but that isn't following the rules that require every GPT table to have globally unique GUIDs for every partion). This also has the side effect of shrinking boot1.efi by ~3k. Sponsored by: Netflix Modified: head/sys/boot/efi/boot1/boot1.c head/sys/boot/efi/boot1/boot_module.h head/sys/boot/efi/boot1/ufs_module.c head/sys/boot/efi/boot1/zfs_module.c Modified: head/sys/boot/efi/boot1/boot1.c ============================================================================== --- head/sys/boot/efi/boot1/boot1.c Sat Aug 26 18:30:14 2017 (r322938) +++ head/sys/boot/efi/boot1/boot1.c Sat Aug 26 23:04:19 2017 (r322939) @@ -136,178 +136,6 @@ devpath_last(EFI_DEVICE_PATH *devpath) } /* - * devpath_node_str is a basic output method for a devpath node which - * only understands a subset of the available sub types. - * - * If we switch to UEFI 2.x then we should update it to use: - * EFI_DEVICE_PATH_TO_TEXT_PROTOCOL. - */ -static int -devpath_node_str(char *buf, size_t size, EFI_DEVICE_PATH *devpath) -{ - - switch (devpath->Type) { - case MESSAGING_DEVICE_PATH: - switch (devpath->SubType) { - case MSG_ATAPI_DP: { - ATAPI_DEVICE_PATH *atapi; - - atapi = (ATAPI_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "ata(%s,%s,0x%x)", - (atapi->PrimarySecondary == 1) ? "Sec" : "Pri", - (atapi->SlaveMaster == 1) ? "Slave" : "Master", - atapi->Lun); - } - case MSG_USB_DP: { - USB_DEVICE_PATH *usb; - - usb = (USB_DEVICE_PATH *)devpath; - return snprintf(buf, size, "usb(0x%02x,0x%02x)", - usb->ParentPortNumber, usb->InterfaceNumber); - } - case MSG_SCSI_DP: { - SCSI_DEVICE_PATH *scsi; - - scsi = (SCSI_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "scsi(0x%02x,0x%02x)", - scsi->Pun, scsi->Lun); - } - case MSG_SATA_DP: { - SATA_DEVICE_PATH *sata; - - sata = (SATA_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "sata(0x%x,0x%x,0x%x)", - sata->HBAPortNumber, sata->PortMultiplierPortNumber, - sata->Lun); - } - default: - return snprintf(buf, size, "msg(0x%02x)", - devpath->SubType); - } - break; - case HARDWARE_DEVICE_PATH: - switch (devpath->SubType) { - case HW_PCI_DP: { - PCI_DEVICE_PATH *pci; - - pci = (PCI_DEVICE_PATH *)devpath; - return snprintf(buf, size, "pci(0x%02x,0x%02x)", - pci->Device, pci->Function); - } - default: - return snprintf(buf, size, "hw(0x%02x)", - devpath->SubType); - } - break; - case ACPI_DEVICE_PATH: { - ACPI_HID_DEVICE_PATH *acpi; - - acpi = (ACPI_HID_DEVICE_PATH *)(void *)devpath; - if ((acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { - switch (EISA_ID_TO_NUM(acpi->HID)) { - case 0x0a03: - return snprintf(buf, size, "pciroot(0x%x)", - acpi->UID); - case 0x0a08: - return snprintf(buf, size, "pcieroot(0x%x)", - acpi->UID); - case 0x0604: - return snprintf(buf, size, "floppy(0x%x)", - acpi->UID); - case 0x0301: - return snprintf(buf, size, "keyboard(0x%x)", - acpi->UID); - case 0x0501: - return snprintf(buf, size, "serial(0x%x)", - acpi->UID); - case 0x0401: - return snprintf(buf, size, "parallelport(0x%x)", - acpi->UID); - default: - return snprintf(buf, size, "acpi(pnp%04x,0x%x)", - EISA_ID_TO_NUM(acpi->HID), acpi->UID); - } - } - - return snprintf(buf, size, "acpi(0x%08x,0x%x)", acpi->HID, - acpi->UID); - } - case MEDIA_DEVICE_PATH: - switch (devpath->SubType) { - case MEDIA_CDROM_DP: { - CDROM_DEVICE_PATH *cdrom; - - cdrom = (CDROM_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "cdrom(%x)", - cdrom->BootEntry); - } - case MEDIA_HARDDRIVE_DP: { - HARDDRIVE_DEVICE_PATH *hd; - - hd = (HARDDRIVE_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "hd(%x)", - hd->PartitionNumber); - } - default: - return snprintf(buf, size, "media(0x%02x)", - devpath->SubType); - } - case BBS_DEVICE_PATH: - return snprintf(buf, size, "bbs(0x%02x)", devpath->SubType); - case END_DEVICE_PATH_TYPE: - return (0); - } - - return snprintf(buf, size, "type(0x%02x, 0x%02x)", devpath->Type, - devpath->SubType); -} - -/* - * devpath_strlcat appends a text description of devpath to buf but not more - * than size - 1 characters followed by NUL-terminator. - */ -int -devpath_strlcat(char *buf, size_t size, EFI_DEVICE_PATH *devpath) -{ - size_t len, used; - const char *sep; - - sep = ""; - used = 0; - while (!IsDevicePathEnd(devpath)) { - len = snprintf(buf, size - used, "%s", sep); - used += len; - if (used > size) - return (used); - buf += len; - - len = devpath_node_str(buf, size - used, devpath); - used += len; - if (used > size) - return (used); - buf += len; - devpath = NextDevicePathNode(devpath); - sep = ":"; - } - - return (used); -} - -/* - * devpath_str is convenience method which returns the text description of - * devpath using a static buffer, so it isn't thread safe! - */ -char * -devpath_str(EFI_DEVICE_PATH *devpath) -{ - static char buf[256]; - - devpath_strlcat(buf, sizeof(buf), devpath); - - return buf; -} - -/* * load_loader attempts to load the loader image data. * * It tries each module and its respective devices, identified by mod->probe, @@ -470,9 +298,13 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B EFI_ERROR_CODE(status)); return (status); } - - DPRINTF("probing: %s\n", devpath_str(devpath)); - +#ifdef EFI_DEBUG + { + CHAR16 *text = efi_devpath_name(devpath); + DPRINTF("probing: %S\n", text); + efi_free_devpath_name(text); + } +#endif status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); if (status == EFI_UNSUPPORTED) return (status); @@ -646,7 +478,13 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) if (status != EFI_SUCCESS) DPRINTF("Failed to get image DevicePath (%lu)\n", EFI_ERROR_CODE(status)); - DPRINTF("boot1 imagepath: %s\n", devpath_str(imgpath)); +#ifdef EFI_DEBUG + { + CHAR16 *text = efi_devpath_name(imgpath); + DPRINTF("boot1 imagepath: %S\n", text); + efi_free_devpath_name(text); + } +#endif } for (i = 0; i < nhandles; i++) Modified: head/sys/boot/efi/boot1/boot_module.h ============================================================================== --- head/sys/boot/efi/boot1/boot_module.h Sat Aug 26 18:30:14 2017 (r322938) +++ head/sys/boot/efi/boot1/boot_module.h Sat Aug 26 23:04:19 2017 (r322939) @@ -106,7 +106,4 @@ extern const boot_module_t zfs_module; /* Functions available to modules. */ extern void add_device(dev_info_t **devinfop, dev_info_t *devinfo); extern int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap); - -extern int devpath_strlcat(char *buf, size_t size, EFI_DEVICE_PATH *devpath); -extern char *devpath_str(EFI_DEVICE_PATH *devpath); #endif Modified: head/sys/boot/efi/boot1/ufs_module.c ============================================================================== --- head/sys/boot/efi/boot1/ufs_module.c Sat Aug 26 18:30:14 2017 (r322938) +++ head/sys/boot/efi/boot1/ufs_module.c Sat Aug 26 23:04:19 2017 (r322939) @@ -101,8 +101,13 @@ load(const char *filepath, dev_info_t *dev, void **buf ssize_t read; void *buf; - DPRINTF("Loading '%s' from %s\n", filepath, devpath_str(dev->devpath)); - +#ifdef EFI_DEBUG + { + CHAR16 *text = efi_devpath_name(dev->devpath); + DPRINTF("Loading '%s' from %S\n", filepath, text); + efi_free_devpath_name(text); + } +#endif if (init_dev(dev) < 0) { DPRINTF("Failed to init device\n"); return (EFI_UNSUPPORTED); Modified: head/sys/boot/efi/boot1/zfs_module.c ============================================================================== --- head/sys/boot/efi/boot1/zfs_module.c Sat Aug 26 18:30:14 2017 (r322938) +++ head/sys/boot/efi/boot1/zfs_module.c Sat Aug 26 23:04:19 2017 (r322939) @@ -150,9 +150,14 @@ load(const char *filepath, dev_info_t *devinfo, void * spa = devinfo->devdata; - DPRINTF("load: '%s' spa: '%s', devpath: %s\n", filepath, spa->spa_name, - devpath_str(devinfo->devpath)); - +#ifdef EFI_DEBUG + { + CHAR16 *text = efi_devpath_name(devinfo->devpath); + DPRINTF("load: '%s' spa: '%s', devpath: %S\n", filepath, + spa->spa_name, text); + efi_free_devpath_name(text); + } +#endif if ((err = zfs_spa_init(spa)) != 0) { DPRINTF("Failed to load pool '%s' (%d)\n", spa->spa_name, err); return (EFI_NOT_FOUND); From owner-svn-src-all@freebsd.org Sat Aug 26 23:13:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA4BCDDD2E7; Sat, 26 Aug 2017 23:13:19 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B93AB8058E; Sat, 26 Aug 2017 23:13:19 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7QNDIue017288; Sat, 26 Aug 2017 23:13:18 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7QNDIKO017286; Sat, 26 Aug 2017 23:13:18 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708262313.v7QNDIKO017286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Sat, 26 Aug 2017 23:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322940 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 322940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 23:13:20 -0000 Author: rlibby Date: Sat Aug 26 23:13:18 2017 New Revision: 322940 URL: https://svnweb.freebsd.org/changeset/base/322940 Log: amd64: drop q suffix from rd[fg]sbase for gas compatibility Reviewed by: kib Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12133 Modified: head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/exception.S Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Sat Aug 26 23:04:19 2017 (r322939) +++ head/sys/amd64/amd64/cpu_switch.S Sat Aug 26 23:13:18 2017 (r322940) @@ -108,7 +108,7 @@ ENTRY(cpu_switch) movl %fs,%eax cmpl $KUF32SEL,%eax jne 1f - rdfsbaseq %rax + rdfsbase %rax movq %rax,PCB_FSBASE(%r8) 1: movl %gs,%eax cmpl $KUG32SEL,%eax Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Sat Aug 26 23:04:19 2017 (r322939) +++ head/sys/amd64/amd64/exception.S Sat Aug 26 23:13:18 2017 (r322940) @@ -340,10 +340,10 @@ prot_addrf: jz 2f cmpw $KUF32SEL,TF_FS(%rsp) jne 1f - rdfsbaseq %rax + rdfsbase %rax 1: cmpw $KUG32SEL,TF_GS(%rsp) jne 2f - rdgsbaseq %rdx + rdgsbase %rdx 2: swapgs movq PCPU(CURPCB),%rdi testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) @@ -533,7 +533,7 @@ nmi_fromuserspace: jz 2f cmpw $KUF32SEL,TF_FS(%rsp) jne 1f - rdfsbaseq %rax + rdfsbase %rax movq %rax,PCB_FSBASE(%rdi) 1: cmpw $KUG32SEL,TF_GS(%rsp) jne 2f