From owner-svn-src-stable-9@FreeBSD.ORG Sun Jun 3 09:37:27 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8007106564A; Sun, 3 Jun 2012 09:37:27 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A14F98FC0A; Sun, 3 Jun 2012 09:37:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q539bRGq048239; Sun, 3 Jun 2012 09:37:27 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q539bR1J048236; Sun, 3 Jun 2012 09:37:27 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206030937.q539bR1J048236@svn.freebsd.org> From: Martin Matuska Date: Sun, 3 Jun 2012 09:37:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236505 - in stable/9: cddl/contrib/opensolaris/cmd/zpool sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 09:37:27 -0000 Author: mm Date: Sun Jun 3 09:37:27 2012 New Revision: 236505 URL: http://svn.freebsd.org/changeset/base/236505 Log: MFC r236145, r236146: MFC r236145 [1]: Import illumos changeset 13564:cf89c0c60496 1946 incorrect formatting when listing output of multiple pools with zpool iostat -v MFC r236146 [2]: Import illumos changeset 13605:b5c2b5db80d6 (partial) 763 FMD msg URLs should refer to something visible Replace sun.com URL's with illumos.org References: https://www.illumos.org/issues/1946 [1] https://www.illumos.org/issues/763 [2] Obtained from: illumos (issue #1946 [1], #763 [2]) Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 3 08:30:00 2012 (r236504) +++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 3 09:37:27 2012 (r236505) @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Frederik Wessels. All rights reserved. * Copyright (c) 2011 Martin Matuska . All rights reserved. */ @@ -1616,7 +1617,7 @@ show_import(nvlist_t *config) } if (msgid != NULL) - (void) printf(gettext(" see: http://www.sun.com/msg/%s\n"), + (void) printf(gettext(" see: http://illumos.org/msg/%s\n"), msgid); (void) printf(gettext(" config:\n\n")); @@ -2351,7 +2352,8 @@ get_namewidth(zpool_handle_t *zhp, void if (!cb->cb_verbose) cb->cb_namewidth = strlen(zpool_get_name(zhp)); else - cb->cb_namewidth = max_width(zhp, nvroot, 0, 0); + cb->cb_namewidth = max_width(zhp, nvroot, 0, + cb->cb_namewidth); } /* @@ -3683,7 +3685,7 @@ print_dedup_stats(nvlist_t *config) * pool: tank * status: DEGRADED * reason: One or more devices ... - * see: http://www.sun.com/msg/ZFS-xxxx-01 + * see: http://illumos.org/msg/ZFS-xxxx-01 * config: * mirror DEGRADED * c1t0d0 OK @@ -3891,7 +3893,7 @@ status_callback(zpool_handle_t *zhp, voi } if (msgid != NULL) - (void) printf(gettext(" see: http://www.sun.com/msg/%s\n"), + (void) printf(gettext(" see: http://illumos.org/msg/%s\n"), msgid); if (config != NULL) { Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Jun 3 08:30:00 2012 (r236504) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Jun 3 09:37:27 2012 (r236505) @@ -2050,7 +2050,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_ cmn_err(CE_WARN, "pool '%s' could not be " "loaded as it was last accessed by " "another system (host: %s hostid: 0x%lx). " - "See: http://www.sun.com/msg/ZFS-8000-EY", + "See: http://illumos.org/msg/ZFS-8000-EY", spa_name(spa), hostname, (unsigned long)hostid); return (EBADF); From owner-svn-src-stable-9@FreeBSD.ORG Sun Jun 3 11:54:26 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B8307106566B; Sun, 3 Jun 2012 11:54:26 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88B278FC15; Sun, 3 Jun 2012 11:54:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53BsQUL059477; Sun, 3 Jun 2012 11:54:26 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53BsQCR059473; Sun, 3 Jun 2012 11:54:26 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206031154.q53BsQCR059473@svn.freebsd.org> From: Marius Strobl Date: Sun, 3 Jun 2012 11:54:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236511 - stable/9/sys/powerpc/include X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 11:54:26 -0000 Author: marius Date: Sun Jun 3 11:54:26 2012 New Revision: 236511 URL: http://svn.freebsd.org/changeset/base/236511 Log: MFC: r233635 Allow multiple inclusion of trap.h. This has always been broken, but until recently never caused problems. Modified: stable/9/sys/powerpc/include/trap.h stable/9/sys/powerpc/include/trap_aim.h stable/9/sys/powerpc/include/trap_booke.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/powerpc/include/trap.h ============================================================================== --- stable/9/sys/powerpc/include/trap.h Sun Jun 3 11:31:45 2012 (r236510) +++ stable/9/sys/powerpc/include/trap.h Sun Jun 3 11:54:26 2012 (r236511) @@ -6,7 +6,3 @@ #include #endif -#ifndef LOCORE -struct trapframe; -void trap(struct trapframe *); -#endif Modified: stable/9/sys/powerpc/include/trap_aim.h ============================================================================== --- stable/9/sys/powerpc/include/trap_aim.h Sun Jun 3 11:31:45 2012 (r236510) +++ stable/9/sys/powerpc/include/trap_aim.h Sun Jun 3 11:54:26 2012 (r236511) @@ -119,4 +119,9 @@ #define EXC_PGM_PRIV (1UL << 18) #define EXC_PGM_TRAP (1UL << 17) +#ifndef LOCORE +struct trapframe; +void trap(struct trapframe *); +#endif + #endif /* _POWERPC_TRAP_H_ */ Modified: stable/9/sys/powerpc/include/trap_booke.h ============================================================================== --- stable/9/sys/powerpc/include/trap_booke.h Sun Jun 3 11:31:45 2012 (r236510) +++ stable/9/sys/powerpc/include/trap_booke.h Sun Jun 3 11:54:26 2012 (r236511) @@ -52,4 +52,9 @@ #define EXC_LAST 255 +#ifndef LOCORE +struct trapframe; +void trap(struct trapframe *); +#endif + #endif /* _POWERPC_TRAP_H_ */ From owner-svn-src-stable-9@FreeBSD.ORG Sun Jun 3 17:48:05 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C360106566B; Sun, 3 Jun 2012 17:48:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 677408FC08; Sun, 3 Jun 2012 17:48:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53Hm5qu075326; Sun, 3 Jun 2012 17:48:05 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53Hm5X4075324; Sun, 3 Jun 2012 17:48:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206031748.q53Hm5X4075324@svn.freebsd.org> From: Marius Strobl Date: Sun, 3 Jun 2012 17:48:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236518 - stable/9/sys/boot/powerpc/ps3 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 17:48:05 -0000 Author: marius Date: Sun Jun 3 17:48:04 2012 New Revision: 236518 URL: http://svn.freebsd.org/changeset/base/236518 Log: MFC: r233666 Fix build after changes to trap headers. Modified: stable/9/sys/boot/powerpc/ps3/start.S Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/boot/powerpc/ps3/start.S ============================================================================== --- stable/9/sys/boot/powerpc/ps3/start.S Sun Jun 3 16:19:37 2012 (r236517) +++ stable/9/sys/boot/powerpc/ps3/start.S Sun Jun 3 17:48:04 2012 (r236518) @@ -25,6 +25,8 @@ * $FreeBSD$ */ +#define LOCORE + #include /* From owner-svn-src-stable-9@FreeBSD.ORG Sun Jun 3 17:51:54 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 096B21065672; Sun, 3 Jun 2012 17:51:54 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8FA58FC15; Sun, 3 Jun 2012 17:51:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53HprFb075521; Sun, 3 Jun 2012 17:51:53 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53HprHg075520; Sun, 3 Jun 2012 17:51:53 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201206031751.q53HprHg075520@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 3 Jun 2012 17:51:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236519 - stable/9/sys/modules/netmap X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 17:51:54 -0000 Author: luigi Date: Sun Jun 3 17:51:53 2012 New Revision: 236519 URL: http://svn.freebsd.org/changeset/base/236519 Log: MFC: let netmap build as a module (but do not connect to the main build yet) Added: stable/9/sys/modules/netmap/ stable/9/sys/modules/netmap/Makefile (contents, props changed) Added: stable/9/sys/modules/netmap/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/modules/netmap/Makefile Sun Jun 3 17:51:53 2012 (r236519) @@ -0,0 +1,14 @@ +# $FreeBSD$ +# +# Compile netmap as a module, useful if you want a netmap bridge +# or loadable drivers. + +.PATH: ${.CURDIR}/../../dev/netmap +.PATH.h: ${.CURDIR}/../../net +KMOD = netmap +SRCS = device_if.h bus_if.h opt_netmap.h +SRCS += netmap.c netmap.h netmap_kern.h + +netmap.o: netmap_mem2.c + +.include From owner-svn-src-stable-9@FreeBSD.ORG Sun Jun 3 18:00:39 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A1805106564A; Sun, 3 Jun 2012 18:00:39 +0000 (UTC) (envelope-from rea@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BA0E8FC0C; Sun, 3 Jun 2012 18:00:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53I0dsm075988; Sun, 3 Jun 2012 18:00:39 GMT (envelope-from rea@svn.freebsd.org) Received: (from rea@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53I0dUD075982; Sun, 3 Jun 2012 18:00:39 GMT (envelope-from rea@svn.freebsd.org) Message-Id: <201206031800.q53I0dUD075982@svn.freebsd.org> From: Eygene Ryabinkin Date: Sun, 3 Jun 2012 18:00:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236520 - stable/9/crypto/openssh X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 18:00:39 -0000 Author: rea (ports committer) Date: Sun Jun 3 18:00:38 2012 New Revision: 236520 URL: http://svn.freebsd.org/changeset/base/236520 Log: OpenSSH: allow VersionAddendum to be used again Prior to this, setting VersionAddendum will be a no-op: one will always have BASE_VERSION + " " + VERSION_HPN for VersionAddendum set in the config and a bare BASE_VERSION + VERSION_HPN when there is no VersionAddendum is set. HPN patch requires both parties to have the "hpn" inside their advertized versions, so we add VERSION_HPN to the VERSION_BASE if HPN is enabled and omitting it if HPN is disabled. VersionAddendum now uses the following logics: * unset (default value): append " " and VERSION_ADDENDUM; * VersionAddendum is set and isn't empty: append " " and VersionAddendum; * VersionAddendum is set and empty: don't append anything. Approved by: des Reviewed by: bz Modified: stable/9/crypto/openssh/ssh.c stable/9/crypto/openssh/sshconnect.c stable/9/crypto/openssh/sshd.c stable/9/crypto/openssh/version.c stable/9/crypto/openssh/version.h Directory Properties: stable/9/crypto/openssh/ (props changed) Modified: stable/9/crypto/openssh/ssh.c ============================================================================== --- stable/9/crypto/openssh/ssh.c Sun Jun 3 17:51:53 2012 (r236519) +++ stable/9/crypto/openssh/ssh.c Sun Jun 3 18:00:38 2012 (r236520) @@ -405,7 +405,8 @@ main(int ac, char **av) /* FALLTHROUGH */ case 'V': fprintf(stderr, "%s, %s\n", - SSH_RELEASE, SSLeay_version(SSLEAY_VERSION)); + ssh_version_get(options.hpn_disabled), + SSLeay_version(SSLEAY_VERSION)); if (opt == 'V') exit(0); break; Modified: stable/9/crypto/openssh/sshconnect.c ============================================================================== --- stable/9/crypto/openssh/sshconnect.c Sun Jun 3 17:51:53 2012 (r236519) +++ stable/9/crypto/openssh/sshconnect.c Sun Jun 3 18:00:38 2012 (r236520) @@ -585,7 +585,7 @@ ssh_exchange_identification(int timeout_ snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s", compat20 ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1, compat20 ? PROTOCOL_MINOR_2 : minor1, - SSH_RELEASE, compat20 ? "\r\n" : "\n"); + ssh_version_get(options.hpn_disabled), compat20 ? "\r\n" : "\n"); if (roaming_atomicio(vwrite, connection_out, buf, strlen(buf)) != strlen(buf)) fatal("write: %.100s", strerror(errno)); Modified: stable/9/crypto/openssh/sshd.c ============================================================================== --- stable/9/crypto/openssh/sshd.c Sun Jun 3 17:51:53 2012 (r236519) +++ stable/9/crypto/openssh/sshd.c Sun Jun 3 18:00:38 2012 (r236520) @@ -430,7 +430,7 @@ sshd_exchange_identification(int sock_in minor = PROTOCOL_MINOR_1; } snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s", major, minor, - SSH_RELEASE, newline); + ssh_version_get(options.hpn_disabled), newline); server_version_string = xstrdup(buf); /* Send our protocol version identification. */ @@ -871,7 +871,7 @@ static void usage(void) { fprintf(stderr, "%s, %s\n", - SSH_RELEASE, SSLeay_version(SSLEAY_VERSION)); + ssh_version_get(0), SSLeay_version(SSLEAY_VERSION)); fprintf(stderr, "usage: sshd [-46DdeiqTt] [-b bits] [-C connection_spec] [-c host_cert_file]\n" " [-f config_file] [-g login_grace_time] [-h host_key_file]\n" @@ -1561,7 +1561,7 @@ main(int ac, char **av) exit(1); } - debug("sshd version %.100s", SSH_RELEASE); + debug("sshd version %.100s", ssh_version_get(options.hpn_disabled)); /* Store privilege separation user for later use if required. */ if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) { Modified: stable/9/crypto/openssh/version.c ============================================================================== --- stable/9/crypto/openssh/version.c Sun Jun 3 17:51:53 2012 (r236519) +++ stable/9/crypto/openssh/version.c Sun Jun 3 18:00:38 2012 (r236520) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2001 Brian Fundakowski Feldman + * Copyright (c) 2012 Eygene Ryabinkin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,30 +36,60 @@ __RCSID("$FreeBSD$"); static char *version = NULL; +/* NULL means "use default value", empty string means "unset" */ +static const char *addendum = NULL; +static unsigned char update_version = 1; +/* + * Constructs the version string if it is empty or needs updating. + * + * HPN patch we're running requires both parties + * to have the "hpn" string inside the advertized version + * (see compat.c::compat_datafellows), so we should + * include it to the generated string if HPN is enabled. + */ const char * -ssh_version_get(void) { +ssh_version_get(int hpn_disabled) +{ + const char *hpn = NULL, *add = NULL; + char *newvers = NULL; + size_t size = 0; + + if (version != NULL && !update_version) + return (version); + + hpn = (hpn_disabled ? NULL : SSH_VERSION_HPN); + add = (addendum == NULL ? SSH_VERSION_ADDENDUM : + (addendum[0] == '\0' ? NULL : addendum)); + + size = strlen(SSH_VERSION_BASE) + (hpn ? strlen(hpn) : 0) + + (add ? strlen(add) + 1 : 0) + 1; + newvers = xmalloc(size); + strcpy(newvers, SSH_VERSION_BASE); + if (hpn) + strcat(newvers, hpn); + if (add) { + strcat(newvers, " "); + strcat(newvers, add); + } + + if (version) + xfree(version); + version = newvers; + update_version = 0; - if (version == NULL) - version = xstrdup(SSH_VERSION); return (version); } void -ssh_version_set_addendum(const char *add) { - char *newvers; - size_t size; - - if (add != NULL) { - size = strlen(SSH_VERSION_BASE) + strlen(SSH_VERSION_HPN) + 1 + - strlen(add) + 1; - newvers = xmalloc(size); - snprintf(newvers, size, "%s %s", SSH_VERSION_BASE, - SSH_VERSION_HPN, add); - } else { - newvers = xstrdup(SSH_VERSION_BASE SSH_VERSION_HPN); - } - if (version != NULL) - xfree(version); - version = newvers; +ssh_version_set_addendum(const char *add) +{ + if (add && addendum && !strcmp(add, addendum)) + return; + + if (addendum) + xfree((void *)addendum); + addendum = (add ? xstrdup(add) : xstrdup("")); + + update_version = 1; } Modified: stable/9/crypto/openssh/version.h ============================================================================== --- stable/9/crypto/openssh/version.h Sun Jun 3 17:51:53 2012 (r236519) +++ stable/9/crypto/openssh/version.h Sun Jun 3 18:00:38 2012 (r236520) @@ -1,14 +1,14 @@ /* $OpenBSD: version.h,v 1.61 2011/02/04 00:44:43 djm Exp $ */ /* $FreeBSD$ */ -#ifndef SSH_VERSION +#ifndef _VERSION_H_ +#define _VERSION_H_ + #define SSH_VERSION_BASE "OpenSSH_5.8p2" #define SSH_VERSION_ADDENDUM "FreeBSD-20110503" #define SSH_VERSION_HPN "_hpn13v11" -#define SSH_VERSION SSH_VERSION_BASE SSH_VERSION_HPN " " SSH_VERSION_ADDENDUM -#define SSH_RELEASE (ssh_version_get()) -const char *ssh_version_get(void); +const char *ssh_version_get(int hpn_disabled); void ssh_version_set_addendum(const char *); -#endif /* SSH_VERSION */ +#endif /* _VERSION_H_ */ From owner-svn-src-stable-9@FreeBSD.ORG Sun Jun 3 18:16:17 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DF896106566B; Sun, 3 Jun 2012 18:16:17 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C81F88FC1B; Sun, 3 Jun 2012 18:16:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53IGHWB076808; Sun, 3 Jun 2012 18:16:17 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53IGH7O076805; Sun, 3 Jun 2012 18:16:17 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201206031816.q53IGH7O076805@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 3 Jun 2012 18:16:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236523 - in stable/9: libexec/rtld-elf share/man/man5 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 18:16:18 -0000 Author: bapt Date: Sun Jun 3 18:16:17 2012 New Revision: 236523 URL: http://svn.freebsd.org/changeset/base/236523 Log: MFC: 234851, 235059 Add two special directives to libmap.conf: include : Parse the contents of file before continuing with the current file. includedir : Parse the contents of every file in dir that ends in .conf before continuing with the current file. Any file or directory encountered while processing include or includedir directives will be parsed exactly once, even if it is encountered multiple times. Approved by: des (mentor) Modified: stable/9/libexec/rtld-elf/libmap.c stable/9/share/man/man5/libmap.conf.5 Directory Properties: stable/9/libexec/rtld-elf/ (props changed) stable/9/share/man/ (props changed) stable/9/share/man/man5/ (props changed) Modified: stable/9/libexec/rtld-elf/libmap.c ============================================================================== --- stable/9/libexec/rtld-elf/libmap.c Sun Jun 3 18:14:57 2012 (r236522) +++ stable/9/libexec/rtld-elf/libmap.c Sun Jun 3 18:16:17 2012 (r236523) @@ -2,11 +2,13 @@ * $FreeBSD$ */ +#include #include #include #include #include #include +#include #include #include #include @@ -39,9 +41,17 @@ struct lmp { TAILQ_ENTRY(lmp) lmp_link; }; +static TAILQ_HEAD(lmc_list, lmc) lmc_head = TAILQ_HEAD_INITIALIZER(lmc_head); +struct lmc { + char *path; + TAILQ_ENTRY(lmc) next; +}; + static int lm_count; static void lmc_parse(char *, size_t); +static void lmc_parse_file(char *); +static void lmc_parse_dir(char *); static void lm_add(const char *, const char *, const char *); static void lm_free(struct lm_list *); static char *lml_find(struct lm_list *, const char *); @@ -61,37 +71,13 @@ static const char *quickbasename(const c int lm_init(char *libmap_override) { - struct stat st; - char *lm_map, *p; - int fd; + char *p; dbg("lm_init(\"%s\")", libmap_override); TAILQ_INIT(&lmp_head); - fd = open(_PATH_LIBMAP_CONF, O_RDONLY); - if (fd == -1) { - dbg("lm_init: open(\"%s\") failed, %s", _PATH_LIBMAP_CONF, - rtld_strerror(errno)); - goto override; - } - if (fstat(fd, &st) == -1) { - close(fd); - dbg("lm_init: fstat(\"%s\") failed, %s", _PATH_LIBMAP_CONF, - rtld_strerror(errno)); - goto override; - } - lm_map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); - if (lm_map == (const char *)MAP_FAILED) { - close(fd); - dbg("lm_init: mmap(\"%s\") failed, %s", _PATH_LIBMAP_CONF, - rtld_strerror(errno)); - goto override; - } - close(fd); - lmc_parse(lm_map, st.st_size); - munmap(lm_map, st.st_size); + lmc_parse_file(_PATH_LIBMAP_CONF); -override: if (libmap_override) { /* * Do some character replacement to make $LIBMAP look @@ -116,14 +102,116 @@ override: } static void +lmc_parse_file(char *path) +{ + struct lmc *p; + struct stat st; + int fd; + char *rpath; + char *lm_map; + + rpath = realpath(path, NULL); + if (rpath == NULL) + return; + + TAILQ_FOREACH(p, &lmc_head, next) { + if (strcmp(p->path, rpath) == 0) { + free(rpath); + return; + } + } + + fd = open(rpath, O_RDONLY); + if (fd == -1) { + dbg("lm_parse_file: open(\"%s\") failed, %s", rpath, + rtld_strerror(errno)); + free(rpath); + return; + } + if (fstat(fd, &st) == -1) { + close(fd); + dbg("lm_parse_file: fstat(\"%s\") failed, %s", rpath, + rtld_strerror(errno)); + free(rpath); + return; + } + lm_map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); + if (lm_map == (const char *)MAP_FAILED) { + close(fd); + dbg("lm_parse_file: mmap(\"%s\") failed, %s", rpath, + rtld_strerror(errno)); + free(rpath); + return; + } + close(fd); + p = xmalloc(sizeof(struct lmc)); + p->path = rpath; + TAILQ_INSERT_HEAD(&lmc_head, p, next); + lmc_parse(lm_map, st.st_size); + munmap(lm_map, st.st_size); +} + +static void +lmc_parse_dir(char *idir) +{ + DIR *d; + struct dirent *dp; + struct lmc *p; + char conffile[MAXPATHLEN]; + char *ext; + char *rpath; + + rpath = realpath(idir, NULL); + if (rpath == NULL) + return; + + TAILQ_FOREACH(p, &lmc_head, next) { + if (strcmp(p->path, rpath) == 0) { + free(rpath); + return; + } + } + d = opendir(idir); + if (d == NULL) { + free(rpath); + return; + } + + p = xmalloc(sizeof(struct lmc)); + p->path = rpath; + TAILQ_INSERT_HEAD(&lmc_head, p, next); + + while ((dp = readdir(d)) != NULL) { + if (dp->d_ino == 0) + continue; + if (dp->d_type != DT_REG) + continue; + ext = strrchr(dp->d_name, '.'); + if (ext == NULL) + continue; + if (strcmp(ext, ".conf") != 0) + continue; + if (strlcpy(conffile, idir, MAXPATHLEN) >= MAXPATHLEN) + continue; /* too long */ + if (strlcat(conffile, "/", MAXPATHLEN) >= MAXPATHLEN) + continue; /* too long */ + if (strlcat(conffile, dp->d_name, MAXPATHLEN) >= MAXPATHLEN) + continue; /* too long */ + lmc_parse_file(conffile); + } + closedir(d); +} + +static void lmc_parse(char *lm_p, size_t lm_len) { char *cp, *f, *t, *c, *p; char prog[MAXPATHLEN]; - char line[MAXPATHLEN + 2]; + /* allow includedir + full length path */ + char line[MAXPATHLEN + 13]; size_t cnt; int i; - + cnt = 0; p = NULL; while (cnt < lm_len) { @@ -181,7 +269,8 @@ lmc_parse(char *lm_p, size_t lm_len) while(rtld_isspace(*cp)) cp++; if (!iseol(*cp)) continue; - strcpy(prog, c); + if (strlcpy(prog, c, sizeof prog) >= sizeof prog) + continue; p = prog; continue; } @@ -207,7 +296,12 @@ lmc_parse(char *lm_p, size_t lm_len) if (!iseol(*cp)) continue; *cp = '\0'; - lm_add(p, f, t); + if (strcmp(f, "includedir") == 0) + lmc_parse_dir(t); + else if (strcmp(f, "include") == 0) + lmc_parse_file(t); + else + lm_add(p, f, t); } } @@ -232,9 +326,17 @@ void lm_fini (void) { struct lmp *lmp; + struct lmc *p; dbg("%s()", __func__); + while (!TAILQ_EMPTY(&lmc_head)) { + p = TAILQ_FIRST(&lmc_head); + TAILQ_REMOVE(&lmc_head, p, next); + free(p->path); + free(p); + } + while (!TAILQ_EMPTY(&lmp_head)) { lmp = TAILQ_FIRST(&lmp_head); TAILQ_REMOVE(&lmp_head, lmp, lmp_link); Modified: stable/9/share/man/man5/libmap.conf.5 ============================================================================== --- stable/9/share/man/man5/libmap.conf.5 Sun Jun 3 18:14:57 2012 (r236522) +++ stable/9/share/man/man5/libmap.conf.5 Sun Jun 3 18:16:17 2012 (r236523) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 31, 2004 +.Dd April 28, 2012 .Dt LIBMAP.CONF 5 .Os .Sh NAME @@ -43,6 +43,27 @@ left hand side containing the mapping ca side containing the mapping. Dependencies are matched against candidates and replaced with the mappings. .Pp +Two special directives are available: +.Bl -tag -width indent +.It Cm include Ar file +Parse the contents of +.Ar file +before continuing with the current file. +.It Cm includedir Ar dir +Parse the contents of every file in +.Ar dir +that ends in +.Pa .conf +before continuing with the current file. +.El +.Pp +Any file or directory encountered while processing +.Cm include +or +.Cm includedir +directives will be parsed exactly once, even if it is encountered +multiple times. +.Pp Constrained mappings may be specified by enclosing the name of the executable or library in brackets. All mappings following a constraint will only be evaluated for that constraint. From owner-svn-src-stable-9@FreeBSD.ORG Mon Jun 4 06:39:11 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3165D1065673; Mon, 4 Jun 2012 06:39:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B43D8FC14; Mon, 4 Jun 2012 06:39:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q546dA0a009835; Mon, 4 Jun 2012 06:39:10 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q546dA0Y009833; Mon, 4 Jun 2012 06:39:10 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206040639.q546dA0Y009833@svn.freebsd.org> From: Dimitry Andric Date: Mon, 4 Jun 2012 06:39:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236538 - stable/9/contrib/llvm/tools/bugpoint X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 06:39:11 -0000 Author: dim Date: Mon Jun 4 06:39:10 2012 New Revision: 236538 URL: http://svn.freebsd.org/changeset/base/236538 Log: MFC r236386: Pull in r155978 from upstream llvm trunk: Fix unintentional use of operator bool. This enables llvm's bugpoint tool to build with libc++. Modified: stable/9/contrib/llvm/tools/bugpoint/ToolRunner.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/tools/bugpoint/ToolRunner.cpp ============================================================================== --- stable/9/contrib/llvm/tools/bugpoint/ToolRunner.cpp Mon Jun 4 06:06:10 2012 (r236537) +++ stable/9/contrib/llvm/tools/bugpoint/ToolRunner.cpp Mon Jun 4 06:39:10 2012 (r236538) @@ -128,7 +128,7 @@ static int RunProgramRemotelyWithTimeout ErrorFile.close(); } - errs() << OS; + errs() << OS.str(); } return ReturnCode; From owner-svn-src-stable-9@FreeBSD.ORG Mon Jun 4 06:43:01 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B491D10656D1; Mon, 4 Jun 2012 06:43:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F35B8FC16; Mon, 4 Jun 2012 06:43:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q546h1B1010031; Mon, 4 Jun 2012 06:43:01 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q546h1H4010029; Mon, 4 Jun 2012 06:43:01 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206040643.q546h1H4010029@svn.freebsd.org> From: Dimitry Andric Date: Mon, 4 Jun 2012 06:43:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236539 - stable/9/contrib/libc++/include X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 06:43:01 -0000 Author: dim Date: Mon Jun 4 06:43:01 2012 New Revision: 236539 URL: http://svn.freebsd.org/changeset/base/236539 Log: MFC r236387: Fix dangling else in libc++'s __bit_reference header. This has also been sent upstream. Modified: stable/9/contrib/libc++/include/__bit_reference Directory Properties: stable/9/contrib/libc++/ (props changed) Modified: stable/9/contrib/libc++/include/__bit_reference ============================================================================== --- stable/9/contrib/libc++/include/__bit_reference Mon Jun 4 06:39:10 2012 (r236538) +++ stable/9/contrib/libc++/include/__bit_reference Mon Jun 4 06:43:01 2012 (r236539) @@ -950,11 +950,15 @@ __equal_unaligned(__bit_iterator<_Cp, tr __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r); __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); if (__first2.__ctz_ > __first1.__ctz_) + { if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_))) return false; + } else + { if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_))) return false; + } __first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word; __first2.__ctz_ = static_cast((__ddn + __first2.__ctz_) % __bits_per_word); __dn -= __ddn; From owner-svn-src-stable-9@FreeBSD.ORG Mon Jun 4 06:45:49 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B429A1065672; Mon, 4 Jun 2012 06:45:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F9828FC12; Mon, 4 Jun 2012 06:45:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q546jnBX010210; Mon, 4 Jun 2012 06:45:49 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q546jnix010208; Mon, 4 Jun 2012 06:45:49 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206040645.q546jnix010208@svn.freebsd.org> From: Dimitry Andric Date: Mon, 4 Jun 2012 06:45:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236540 - stable/9/sbin/devd X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 06:45:49 -0000 Author: dim Date: Mon Jun 4 06:45:49 2012 New Revision: 236540 URL: http://svn.freebsd.org/changeset/base/236540 Log: MFC r236388: Make devd build with libc++. Modified: stable/9/sbin/devd/devd.cc Directory Properties: stable/9/sbin/devd/ (props changed) Modified: stable/9/sbin/devd/devd.cc ============================================================================== --- stable/9/sbin/devd/devd.cc Mon Jun 4 06:43:01 2012 (r236539) +++ stable/9/sbin/devd/devd.cc Mon Jun 4 06:45:49 2012 (r236540) @@ -798,7 +798,7 @@ create_socket(const char *name) unlink(name); if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) err(1, "fcntl"); - if (bind(fd, (struct sockaddr *) & sun, slen) < 0) + if (::bind(fd, (struct sockaddr *) & sun, slen) < 0) err(1, "bind"); listen(fd, 4); chown(name, 0, 0); /* XXX - root.wheel */ From owner-svn-src-stable-9@FreeBSD.ORG Mon Jun 4 07:03:57 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 02587106564A; Mon, 4 Jun 2012 07:03:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E05348FC0A; Mon, 4 Jun 2012 07:03:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5473u5Y011152; Mon, 4 Jun 2012 07:03:56 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5473usD011144; Mon, 4 Jun 2012 07:03:56 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206040703.q5473usD011144@svn.freebsd.org> From: Alexander Motin Date: Mon, 4 Jun 2012 07:03:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236541 - in stable/9/sys: cam dev/ahci dev/ata dev/mvs dev/siis X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 07:03:57 -0000 Author: mav Date: Mon Jun 4 07:03:56 2012 New Revision: 236541 URL: http://svn.freebsd.org/changeset/base/236541 Log: MFC r235333: Add two functions xpt_batch_start() and xpt_batch_done() to the CAM SIM KPI to allow drivers to handle request completion directly without passing them to the CAM SWI thread removing extra context switch. Modify all ATA/SATA drivers to use them. Modified: stable/9/sys/cam/cam_sim.h stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/cam_xpt_sim.h stable/9/sys/dev/ahci/ahci.c stable/9/sys/dev/ata/ata-all.c stable/9/sys/dev/mvs/mvs.c stable/9/sys/dev/siis/siis.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/cam/cam_sim.h ============================================================================== --- stable/9/sys/cam/cam_sim.h Mon Jun 4 06:45:49 2012 (r236540) +++ stable/9/sys/cam/cam_sim.h Mon Jun 4 07:03:56 2012 (r236541) @@ -106,6 +106,7 @@ struct cam_sim { #define CAM_SIM_MPSAFE 0x02 #define CAM_SIM_ON_DONEQ 0x04 #define CAM_SIM_POLLED 0x08 +#define CAM_SIM_BATCH 0x10 struct callout callout; struct cam_devq *devq; /* Device Queue to use for this SIM */ int refcount; /* References to the SIM. */ Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Mon Jun 4 06:45:49 2012 (r236540) +++ stable/9/sys/cam/cam_xpt.c Mon Jun 4 07:03:56 2012 (r236541) @@ -4332,7 +4332,8 @@ xpt_done(union ccb *done_ccb) TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h, sim_links.tqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; - if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED)) == 0) { + if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED | + CAM_SIM_BATCH)) == 0) { mtx_lock(&cam_simq_lock); first = TAILQ_EMPTY(&cam_simq); TAILQ_INSERT_TAIL(&cam_simq, sim, links); @@ -4344,6 +4345,25 @@ xpt_done(union ccb *done_ccb) } } +void +xpt_batch_start(struct cam_sim *sim) +{ + + KASSERT((sim->flags & CAM_SIM_BATCH) == 0, ("Batch flag already set")); + sim->flags |= CAM_SIM_BATCH; +} + +void +xpt_batch_done(struct cam_sim *sim) +{ + + KASSERT((sim->flags & CAM_SIM_BATCH) != 0, ("Batch flag was not set")); + sim->flags &= ~CAM_SIM_BATCH; + if (!TAILQ_EMPTY(&sim->sim_doneq) && + (sim->flags & CAM_SIM_ON_DONEQ) == 0) + camisr_runqueue(&sim->sim_doneq); +} + union ccb * xpt_alloc_ccb() { Modified: stable/9/sys/cam/cam_xpt_sim.h ============================================================================== --- stable/9/sys/cam/cam_xpt_sim.h Mon Jun 4 06:45:49 2012 (r236540) +++ stable/9/sys/cam/cam_xpt_sim.h Mon Jun 4 07:03:56 2012 (r236541) @@ -51,6 +51,8 @@ void xpt_release_devq_rl(struct cam_pat u_int count, int run_queue); int xpt_sim_opened(struct cam_sim *sim); void xpt_done(union ccb *done_ccb); +void xpt_batch_start(struct cam_sim *sim); +void xpt_batch_done(struct cam_sim *sim); #endif #endif /* _CAM_CAM_XPT_SIM_H */ Modified: stable/9/sys/dev/ahci/ahci.c ============================================================================== --- stable/9/sys/dev/ahci/ahci.c Mon Jun 4 06:45:49 2012 (r236540) +++ stable/9/sys/dev/ahci/ahci.c Mon Jun 4 07:03:56 2012 (r236541) @@ -1458,7 +1458,9 @@ ahci_ch_intr_locked(void *data) struct ahci_channel *ch = device_get_softc(dev); mtx_lock(&ch->mtx); + xpt_batch_start(ch->sim); ahci_ch_intr(data); + xpt_batch_done(ch->sim); mtx_unlock(&ch->mtx); } Modified: stable/9/sys/dev/ata/ata-all.c ============================================================================== --- stable/9/sys/dev/ata/ata-all.c Mon Jun 4 06:45:49 2012 (r236540) +++ stable/9/sys/dev/ata/ata-all.c Mon Jun 4 07:03:56 2012 (r236541) @@ -544,9 +544,11 @@ ata_interrupt(void *data) struct ata_channel *ch = (struct ata_channel *)data; mtx_lock(&ch->state_mtx); + xpt_batch_start(ch->sim); #endif ata_interrupt_locked(data); #ifdef ATA_CAM + xpt_batch_done(ch->sim); mtx_unlock(&ch->state_mtx); #endif } Modified: stable/9/sys/dev/mvs/mvs.c ============================================================================== --- stable/9/sys/dev/mvs/mvs.c Mon Jun 4 06:45:49 2012 (r236540) +++ stable/9/sys/dev/mvs/mvs.c Mon Jun 4 07:03:56 2012 (r236541) @@ -654,7 +654,9 @@ mvs_ch_intr_locked(void *data) struct mvs_channel *ch = device_get_softc(dev); mtx_lock(&ch->mtx); + xpt_batch_start(ch->sim); mvs_ch_intr(data); + xpt_batch_done(ch->sim); mtx_unlock(&ch->mtx); } Modified: stable/9/sys/dev/siis/siis.c ============================================================================== --- stable/9/sys/dev/siis/siis.c Mon Jun 4 06:45:49 2012 (r236540) +++ stable/9/sys/dev/siis/siis.c Mon Jun 4 07:03:56 2012 (r236541) @@ -830,7 +830,9 @@ siis_ch_intr_locked(void *data) struct siis_channel *ch = device_get_softc(dev); mtx_lock(&ch->mtx); + xpt_batch_start(ch->sim); siis_ch_intr(data); + xpt_batch_done(ch->sim); mtx_unlock(&ch->mtx); } From owner-svn-src-stable-9@FreeBSD.ORG Mon Jun 4 07:07:47 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 38251106566B; Mon, 4 Jun 2012 07:07:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 235618FC12; Mon, 4 Jun 2012 07:07:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5477k4T011422; Mon, 4 Jun 2012 07:07:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5477k5P011420; Mon, 4 Jun 2012 07:07:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206040707.q5477k5P011420@svn.freebsd.org> From: Alexander Motin Date: Mon, 4 Jun 2012 07:07:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236543 - stable/9/sys/dev/ata X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 07:07:47 -0000 Author: mav Date: Mon Jun 4 07:07:46 2012 New Revision: 236543 URL: http://svn.freebsd.org/changeset/base/236543 Log: MFC r236184: Make legacy ATA to not call device_add_child() with unit number but without driver name. Modified: stable/9/sys/dev/ata/ata-all.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ata/ata-all.c ============================================================================== --- stable/9/sys/dev/ata/ata-all.c Mon Jun 4 07:05:13 2012 (r236542) +++ stable/9/sys/dev/ata/ata-all.c Mon Jun 4 07:07:46 2012 (r236543) @@ -887,7 +887,7 @@ ata_add_child(device_t parent, struct at { device_t child; - if ((child = device_add_child(parent, NULL, unit))) { + if ((child = device_add_child(parent, (unit < 0) ? NULL : "ad", unit))) { device_set_softc(child, atadev); device_quiet(child); atadev->dev = child; From owner-svn-src-stable-9@FreeBSD.ORG Mon Jun 4 07:12:37 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 017B41065674; Mon, 4 Jun 2012 07:12:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E0BE68FC1C; Mon, 4 Jun 2012 07:12:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q547CaAd011830; Mon, 4 Jun 2012 07:12:36 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q547CaOt011828; Mon, 4 Jun 2012 07:12:36 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206040712.q547CaOt011828@svn.freebsd.org> From: Alexander Motin Date: Mon, 4 Jun 2012 07:12:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236546 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 07:12:37 -0000 Author: mav Date: Mon Jun 4 07:12:36 2012 New Revision: 236546 URL: http://svn.freebsd.org/changeset/base/236546 Log: MFC r232740: Make kern.sched.idlespinthresh default value adaptive depending of HZ. Otherwise with HZ above 8000 CPU may never skip timer ticks on idle. Modified: stable/9/sys/kern/sched_ule.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/sched_ule.c ============================================================================== --- stable/9/sys/kern/sched_ule.c Mon Jun 4 07:12:11 2012 (r236545) +++ stable/9/sys/kern/sched_ule.c Mon Jun 4 07:12:36 2012 (r236546) @@ -212,7 +212,7 @@ static int preempt_thresh = 0; #endif static int static_boost = PRI_MIN_BATCH; static int sched_idlespins = 10000; -static int sched_idlespinthresh = 16; +static int sched_idlespinthresh = -1; /* * tdq - per processor runqs and statistics. All fields are protected by the @@ -1410,6 +1410,8 @@ sched_initticks(void *dummy) steal_thresh = min(fls(mp_ncpus) - 1, 3); affinity = SCHED_AFFINITY_DEFAULT; #endif + if (sched_idlespinthresh < 0) + sched_idlespinthresh = max(16, 2 * hz / realstathz); } From owner-svn-src-stable-9@FreeBSD.ORG Mon Jun 4 07:16:13 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D02F106566B; Mon, 4 Jun 2012 07:16:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 671DB8FC08; Mon, 4 Jun 2012 07:16:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q547GDcY012057; Mon, 4 Jun 2012 07:16:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q547GDLq012055; Mon, 4 Jun 2012 07:16:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206040716.q547GDLq012055@svn.freebsd.org> From: Alexander Motin Date: Mon, 4 Jun 2012 07:16:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236547 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 07:16:13 -0000 Author: mav Date: Mon Jun 4 07:16:12 2012 New Revision: 236547 URL: http://svn.freebsd.org/changeset/base/236547 Log: MFC r234066: Microoptimize cpu_search(). According to profiling, it makes one take 6% of CPU time on hackbench with its million of context switches per second, instead of 8% before. Modified: stable/9/sys/kern/sched_ule.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/sched_ule.c ============================================================================== --- stable/9/sys/kern/sched_ule.c Mon Jun 4 07:12:36 2012 (r236546) +++ stable/9/sys/kern/sched_ule.c Mon Jun 4 07:16:12 2012 (r236547) @@ -615,32 +615,34 @@ cpu_search(const struct cpu_group *cg, s cpuset_t cpumask; struct cpu_group *child; struct tdq *tdq; - int cpu, i, hload, lload, load, total, rnd; + int cpu, i, hload, lload, load, total, rnd, *rndptr; total = 0; cpumask = cg->cg_mask; if (match & CPU_SEARCH_LOWEST) { lload = INT_MAX; - low->cs_load = INT_MAX; lgroup = *low; } if (match & CPU_SEARCH_HIGHEST) { - hload = -1; - high->cs_load = -1; + hload = INT_MIN; hgroup = *high; } /* Iterate through the child CPU groups and then remaining CPUs. */ - for (i = 0, cpu = 0; i <= cg->cg_children; ) { - if (i >= cg->cg_children) { - while (cpu <= mp_maxid && !CPU_ISSET(cpu, &cpumask)) - cpu++; - if (cpu > mp_maxid) + for (i = cg->cg_children, cpu = mp_maxid; i >= 0; ) { + if (i == 0) { + while (cpu >= 0 && !CPU_ISSET(cpu, &cpumask)) + cpu--; + if (cpu < 0) break; child = NULL; } else - child = &cg->cg_child[i]; + child = &cg->cg_child[i - 1]; + if (match & CPU_SEARCH_LOWEST) + lgroup.cs_cpu = -1; + if (match & CPU_SEARCH_HIGHEST) + hgroup.cs_cpu = -1; if (child) { /* Handle child CPU group. */ CPU_NAND(&cpumask, &child->cg_mask); switch (match) { @@ -657,23 +659,23 @@ cpu_search(const struct cpu_group *cg, s } else { /* Handle child CPU. */ tdq = TDQ_CPU(cpu); load = tdq->tdq_load * 256; - rnd = DPCPU_SET(randomval, - DPCPU_GET(randomval) * 69069 + 5) >> 26; + rndptr = DPCPU_PTR(randomval); + rnd = (*rndptr = *rndptr * 69069 + 5) >> 26; if (match & CPU_SEARCH_LOWEST) { if (cpu == low->cs_prefer) load -= 64; /* If that CPU is allowed and get data. */ - if (CPU_ISSET(cpu, &lgroup.cs_mask) && - tdq->tdq_lowpri > lgroup.cs_pri && - tdq->tdq_load <= lgroup.cs_limit) { + if (tdq->tdq_lowpri > lgroup.cs_pri && + tdq->tdq_load <= lgroup.cs_limit && + CPU_ISSET(cpu, &lgroup.cs_mask)) { lgroup.cs_cpu = cpu; lgroup.cs_load = load - rnd; } } if (match & CPU_SEARCH_HIGHEST) - if (CPU_ISSET(cpu, &hgroup.cs_mask) && - tdq->tdq_load >= hgroup.cs_limit && - tdq->tdq_transferable) { + if (tdq->tdq_load >= hgroup.cs_limit && + tdq->tdq_transferable && + CPU_ISSET(cpu, &hgroup.cs_mask)) { hgroup.cs_cpu = cpu; hgroup.cs_load = load - rnd; } @@ -682,7 +684,7 @@ cpu_search(const struct cpu_group *cg, s /* We have info about child item. Compare it. */ if (match & CPU_SEARCH_LOWEST) { - if (lgroup.cs_load != INT_MAX && + if (lgroup.cs_cpu >= 0 && (load < lload || (load == lload && lgroup.cs_load < low->cs_load))) { lload = load; @@ -691,17 +693,19 @@ cpu_search(const struct cpu_group *cg, s } } if (match & CPU_SEARCH_HIGHEST) - if (hgroup.cs_load >= 0 && + if (hgroup.cs_cpu >= 0 && (load > hload || (load == hload && hgroup.cs_load > high->cs_load))) { hload = load; high->cs_cpu = hgroup.cs_cpu; high->cs_load = hgroup.cs_load; } - if (child) - i++; - else - cpu++; + if (child) { + i--; + if (i == 0 && CPU_EMPTY(&cpumask)) + break; + } else + cpu--; } return (total); } From owner-svn-src-stable-9@FreeBSD.ORG Mon Jun 4 14:11:50 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A9C5106566C; Mon, 4 Jun 2012 14:11:50 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 634DF8FC1A; Mon, 4 Jun 2012 14:11:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54EBouW045733; Mon, 4 Jun 2012 14:11:50 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54EBo4p045729; Mon, 4 Jun 2012 14:11:50 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201206041411.q54EBo4p045729@svn.freebsd.org> From: Isabell Long Date: Mon, 4 Jun 2012 14:11:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236562 - stable/9/lib/libc/stdio X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 14:11:50 -0000 Author: issyl0 (doc committer) Date: Mon Jun 4 14:11:49 2012 New Revision: 236562 URL: http://svn.freebsd.org/changeset/base/236562 Log: Merge r235848 from head to stable/9: Add two new locale-specific man pages: - libc/stdio/scanf_l.3 - libc/stdio/printf_l.3 Approved by: gabor (mentor) Added: stable/9/lib/libc/stdio/printf_l.3 - copied unchanged from r235848, head/lib/libc/stdio/printf_l.3 stable/9/lib/libc/stdio/scanf_l.3 - copied unchanged from r235848, head/lib/libc/stdio/scanf_l.3 Modified: stable/9/lib/libc/stdio/Makefile.inc Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdio/Makefile.inc ============================================================================== --- stable/9/lib/libc/stdio/Makefile.inc Mon Jun 4 13:41:22 2012 (r236561) +++ stable/9/lib/libc/stdio/Makefile.inc Mon Jun 4 14:11:49 2012 (r236562) @@ -36,7 +36,8 @@ MAN+= fclose.3 ferror.3 fflush.3 fgetln. fopen.3 fputs.3 \ fputws.3 fread.3 fseek.3 funopen.3 fwide.3 getc.3 \ getline.3 getwc.3 mktemp.3 \ - printf.3 putc.3 putwc.3 remove.3 scanf.3 setbuf.3 stdio.3 tmpnam.3 \ + printf.3 printf_l.3 putc.3 putwc.3 remove.3 scanf.3 scanf_l.3 setbuf.3 \ + stdio.3 tmpnam.3 \ ungetc.3 ungetwc.3 wprintf.3 wscanf.3 MLINKS+=fclose.3 fcloseall.3 @@ -63,11 +64,16 @@ MLINKS+=printf.3 asprintf.3 printf.3 dpr printf.3 vasprintf.3 printf.3 vdprintf.3 \ printf.3 vfprintf.3 printf.3 vprintf.3 printf.3 vsnprintf.3 \ printf.3 vsprintf.3 +MLINKS+=printf_l.3 asprintf_l.3 printf_l.3 fprintf_l.3 printf_l.3 snprintf_l.3 \ + printf_l.3 sprintf_l.3 printf_l.3 vasprintf_l.3 printf_l.3 vfprintf_l.3 \ + printf_l.3 vprintf_l.3 printf_l.3 vsnprintf_l.3 printf_l.3 vsprintf_l.3 MLINKS+=putc.3 fputc.3 putc.3 putc_unlocked.3 putc.3 putchar.3 \ putc.3 putchar_unlocked.3 putc.3 putw.3 MLINKS+=putwc.3 fputwc.3 putwc.3 putwchar.3 MLINKS+=scanf.3 fscanf.3 scanf.3 sscanf.3 scanf.3 vfscanf.3 scanf.3 vscanf.3 \ scanf.3 vsscanf.3 +MLINKS+=scanf_l.3 fscanf_l.3 scanf_l.3 sscanf_l.3 scanf_l.3 vfscanf_l.3 \ + scanf_l.3 vscanf_l.3 scanf_l.3 vsscanf_l.3 MLINKS+=setbuf.3 setbuffer.3 setbuf.3 setlinebuf.3 setbuf.3 setvbuf.3 MLINKS+=tmpnam.3 tempnam.3 tmpnam.3 tmpfile.3 MLINKS+=wprintf.3 fwprintf.3 wprintf.3 swprintf.3 \ Copied: stable/9/lib/libc/stdio/printf_l.3 (from r235848, head/lib/libc/stdio/printf_l.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/lib/libc/stdio/printf_l.3 Mon Jun 4 14:11:49 2012 (r236562, copy of r235848, head/lib/libc/stdio/printf_l.3) @@ -0,0 +1,80 @@ +.\" Copyright (c) 2012 Isabell Long +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 7, 2012 +.Dt PRINTF_L 3 +.Os +.Sh NAME +.Nm printf_l , +.Nm asprintf_l , +.Nm fprintf_l , +.Nm snprintf_l , +.Nm sprintf_l , +.Nm vasprintf_l , +.Nm vfprintf_l , +.Nm vprintf_l , +.Nm vsnprintf_l , +.Nm vsprintf_l +.Nd formatted output conversion +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In stdio.h +.Ft int +.Fn printf_l "locale_t loc" "const char * restrict format" "..." +.Ft int +.Fn asprintf_l "char **ret" "locale_t loc" "const char * format" "..." +.Ft int +.Fn fprintf_l "FILE * restrict stream" "locale_t loc" "const char * restrict format" "..." +.Ft int +.Fn snprintf_l "char * restrict str" "size_t size" "locale_t loc" "const char * restrict format" "..." +.Ft int +.Fn sprintf_l "char * restrict str" "locale_t loc" "const char * restrict format" "..." +.Ft int +.Fn vasprintf_l "char **ret" "locale_t loc" "const char *format" "va_list ap" +.Ft int +.Fn vfprintf_l "FILE * restrict stream" "locale_t loc" "const char * restrict format" "va_list ap" +.Ft int +.Fn vprintf_l "locale_t loc" "const char * restrict format" "va_list ap" +.Ft int +.Fn vsnprintf_l "char * restrict str" "size_t size" "locale_t loc" "const char * restrict format" "va_list ap" +.Ft int +.Fn vsprintf_l "char * restrict str" "locale_t loc" "const char * restrict format" "va_list ap" +.Sh DESCRIPTION +The above functions are used to convert formatted output in the locale +.Fa loc . +They behave in the same way as the versions without the _l suffix, but use +the specified locale rather than the global or per-thread locale. +See the specific manual pages for more information. +.Sh SEE ALSO +.Xr printf 3 , +.Xr xlocale 3 +.Sh STANDARDS +These functions do not conform to any specific standard so they should be +considered as non-portable local extensions. +.Sh HISTORY +These functions first appeared in Darwin and were first implemented in +.Fx 9.1 . Copied: stable/9/lib/libc/stdio/scanf_l.3 (from r235848, head/lib/libc/stdio/scanf_l.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/lib/libc/stdio/scanf_l.3 Mon Jun 4 14:11:49 2012 (r236562, copy of r235848, head/lib/libc/stdio/scanf_l.3) @@ -0,0 +1,70 @@ +.\" Copyright (c) 2012 Isabell Long +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 8, 2012 +.Dt SCANF_L 3 +.Os +.Sh NAME +.Nm scanf_l , +.Nm fscanf_l , +.Nm sscanf_l , +.Nm vfscanf_l , +.Nm vscanf_l , +.Nm vsscanf_l +.Nd input format conversion +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In stdio.h +.Ft int +.Fn scanf_l "locale_t loc" "const char * restrict format" "..." +.Ft int +.Fn fscanf_l "FILE * restrict stream" "locale_t loc" "const char * restrict format" "..." +.Ft int +.Fn sscanf_l "const char * restrict str" "locale_t loc" "const char * restrict format" "..." +.Ft int +.Fn vfscanf_l "FILE * restrict stream" "locale_t loc" "const char * restrict format" "va_list ap" +.Ft int +.Fn vscanf_l "locale_t loc" "const char * restrict format" "va_list ap" +.Ft int +.Fn vsscanf_l "const char * restrict str" "locale_t loc" "const char * restrict format" "va_list ap" +.Sh DESCRIPTION +The above functions scan input according to a specified +.Fa format +in the locale +.Fa loc . +They behave in the same way as the versions without the _l suffix, but use +the specific locale rather than the the global or per-thread locale. +See the specific manual pages for more information. +.Sh SEE ALSO +.Xr scanf 3 , +.Xr xlocale 3 +.Sh STANDARDS +These functions do not conform to any specific standard so they should be +considered as non-portable local extensions. +.Sh HISTORY +These functions first appeared in Darwin and were first implemented in +.Fx 9.1 . From owner-svn-src-stable-9@FreeBSD.ORG Mon Jun 4 22:14:34 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10EA0106564A; Mon, 4 Jun 2012 22:14:34 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFB138FC12; Mon, 4 Jun 2012 22:14:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54MEXmx070239; Mon, 4 Jun 2012 22:14:33 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54MEXHe070234; Mon, 4 Jun 2012 22:14:33 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201206042214.q54MEXHe070234@svn.freebsd.org> From: Doug Barton Date: Mon, 4 Jun 2012 22:14:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236587 - in stable/9/contrib/bind9: . lib/dns X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 22:14:34 -0000 Author: dougb Date: Mon Jun 4 22:14:33 2012 New Revision: 236587 URL: http://svn.freebsd.org/changeset/base/236587 Log: Upgrade to 9.8.3-P1, the latest from ISC. This version contains a critical bugfix: Processing of DNS resource records where the rdata field is zero length may cause various issues for the servers handling them. Processing of these records may lead to unexpected outcomes. Recursive servers may crash or disclose some portion of memory to the client. Secondary servers may crash on restart after transferring a zone containing these records. Master servers may corrupt zone data if the zone option "auto-dnssec" is set to "maintain". Other unexpected problems that are not listed here may also be encountered. All BIND users are strongly encouraged to upgrade. Modified: stable/9/contrib/bind9/CHANGES stable/9/contrib/bind9/lib/dns/rdata.c stable/9/contrib/bind9/lib/dns/rdataslab.c stable/9/contrib/bind9/version Directory Properties: stable/9/contrib/bind9/ (props changed) Modified: stable/9/contrib/bind9/CHANGES ============================================================================== --- stable/9/contrib/bind9/CHANGES Mon Jun 4 22:11:20 2012 (r236586) +++ stable/9/contrib/bind9/CHANGES Mon Jun 4 22:14:33 2012 (r236587) @@ -1,3 +1,8 @@ + --- 9.8.3-P1 released --- + +3331. [security] dns_rdataslab_fromrdataset could produce bad + rdataslabs. [RT #29644] + --- 9.8.3 released --- 3318. [tuning] Reduce the amount of work performed while holding a Modified: stable/9/contrib/bind9/lib/dns/rdata.c ============================================================================== --- stable/9/contrib/bind9/lib/dns/rdata.c Mon Jun 4 22:11:20 2012 (r236586) +++ stable/9/contrib/bind9/lib/dns/rdata.c Mon Jun 4 22:14:33 2012 (r236587) @@ -329,8 +329,8 @@ dns_rdata_compare(const dns_rdata_t *rda REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); @@ -360,8 +360,8 @@ dns_rdata_casecompare(const dns_rdata_t REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); Modified: stable/9/contrib/bind9/lib/dns/rdataslab.c ============================================================================== --- stable/9/contrib/bind9/lib/dns/rdataslab.c Mon Jun 4 22:11:20 2012 (r236586) +++ stable/9/contrib/bind9/lib/dns/rdataslab.c Mon Jun 4 22:14:33 2012 (r236587) @@ -126,6 +126,11 @@ isc_result_t dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region, unsigned int reservelen) { + /* + * Use &removed as a sentinal pointer for duplicate + * rdata as rdata.data == NULL is valid. + */ + static unsigned char removed; struct xrdata *x; unsigned char *rawbuf; #if DNS_RDATASET_FIXED @@ -169,6 +174,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ INSIST(result == ISC_R_SUCCESS); dns_rdata_init(&x[i].rdata); dns_rdataset_current(rdataset, &x[i].rdata); + INSIST(x[i].rdata.data != &removed); #if DNS_RDATASET_FIXED x[i].order = i; #endif @@ -201,8 +207,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ */ for (i = 1; i < nalloc; i++) { if (compare_rdata(&x[i-1].rdata, &x[i].rdata) == 0) { - x[i-1].rdata.data = NULL; - x[i-1].rdata.length = 0; + x[i-1].rdata.data = &removed; #if DNS_RDATASET_FIXED /* * Preserve the least order so A, B, A -> A, B @@ -292,7 +297,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ #endif for (i = 0; i < nalloc; i++) { - if (x[i].rdata.data == NULL) + if (x[i].rdata.data == &removed) continue; #if DNS_RDATASET_FIXED offsettable[x[i].order] = rawbuf - offsetbase; Modified: stable/9/contrib/bind9/version ============================================================================== --- stable/9/contrib/bind9/version Mon Jun 4 22:11:20 2012 (r236586) +++ stable/9/contrib/bind9/version Mon Jun 4 22:14:33 2012 (r236587) @@ -6,5 +6,5 @@ MAJORVER=9 MINORVER=8 PATCHVER=3 -RELEASETYPE= -RELEASEVER= +RELEASETYPE=-P +RELEASEVER=1 From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 5 06:41:48 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 61E63106566B; Tue, 5 Jun 2012 06:41:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B3A68FC08; Tue, 5 Jun 2012 06:41:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q556fmqn094001; Tue, 5 Jun 2012 06:41:48 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q556fmW9093998; Tue, 5 Jun 2012 06:41:48 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206050641.q556fmW9093998@svn.freebsd.org> From: Dimitry Andric Date: Tue, 5 Jun 2012 06:41:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236600 - in stable/9/lib: libc++ libcxxrt X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 06:41:48 -0000 Author: dim Date: Tue Jun 5 06:41:47 2012 New Revision: 236600 URL: http://svn.freebsd.org/changeset/base/236600 Log: MFC r236442: Tabify libcxxrt and libc++'s Makefiles. Modified: stable/9/lib/libc++/Makefile stable/9/lib/libcxxrt/Makefile Directory Properties: stable/9/lib/libc++/ (props changed) stable/9/lib/libcxxrt/ (props changed) Modified: stable/9/lib/libc++/Makefile ============================================================================== --- stable/9/lib/libc++/Makefile Tue Jun 5 06:03:55 2012 (r236599) +++ stable/9/lib/libc++/Makefile Tue Jun 5 06:41:47 2012 (r236600) @@ -1,156 +1,156 @@ # $FreeBSD$ -LIBCXXRTDIR= ${.CURDIR}/../../contrib/libcxxrt -HDRDIR= ${.CURDIR}/../../contrib/libc++/include -SRCDIR= ${.CURDIR}/../../contrib/libc++/src -CXXINCLUDEDIR= ${INCLUDEDIR}/c++/v${SHLIB_MAJOR} +LIBCXXRTDIR= ${.CURDIR}/../../contrib/libcxxrt +HDRDIR= ${.CURDIR}/../../contrib/libc++/include +SRCDIR= ${.CURDIR}/../../contrib/libc++/src +CXXINCLUDEDIR= ${INCLUDEDIR}/c++/v${SHLIB_MAJOR} .PATH: ${SRCDIR} -LIB= c++ -SHLIB_MAJOR= 1 +LIB= c++ +SHLIB_MAJOR= 1 -SRCS+= algorithm.cpp\ - bind.cpp\ - chrono.cpp\ - condition_variable.cpp\ - debug.cpp\ - exception.cpp\ - future.cpp\ - hash.cpp\ - ios.cpp\ - iostream.cpp\ - locale.cpp\ - memory.cpp\ - mutex.cpp\ - new.cpp\ - random.cpp\ - regex.cpp\ - stdexcept.cpp\ - string.cpp\ - strstream.cpp\ - system_error.cpp\ - thread.cpp\ - typeinfo.cpp\ - utility.cpp\ - valarray.cpp - -WARNS= 0 -CXXFLAGS+= -I${HDRDIR} -I${LIBCXXRTDIR} -std=c++0x -nostdlib -DLIBCXXRT - -DPADD= ${LIBCXXRT} -LDADD= -lcxxrt -LDFLAGS+= --verbose -INCSGROUPS= STD EXT - -STD_HEADERS= __bit_reference\ - __config\ - __debug\ - __functional_03\ - __functional_base\ - __functional_base_03\ - __hash_table\ - __locale\ - __mutex_base\ - __split_buffer\ - __sso_allocator\ - __std_stream\ - __tree\ - __tuple\ - __tuple_03\ - __undef_min_max\ - algorithm\ - array\ - atomic\ - bitset\ - cassert\ - ccomplex\ - cctype\ - cerrno\ - cfenv\ - cfloat\ - chrono\ - cinttypes\ - ciso646\ - climits\ - clocale\ - cmath\ - codecvt\ - complex\ - complex.h\ - condition_variable\ - csetjmp\ - csignal\ - cstdarg\ - cstdbool\ - cstddef\ - cstdint\ - cstdio\ - cstdlib\ - cstring\ - ctgmath\ - ctime\ - cwchar\ - cwctype\ - deque\ - exception\ - forward_list\ - fstream\ - functional\ - future\ - initializer_list\ - iomanip\ - ios\ - iosfwd\ - iostream\ - istream\ - iterator\ - limits\ - list\ - locale\ - map\ - memory\ - mutex\ - new\ - numeric\ - ostream\ - queue\ - random\ - ratio\ - regex\ - scoped_allocator\ - set\ - sstream\ - stack\ - stdexcept\ - streambuf\ - string\ - strstream\ - system_error\ - tgmath.h\ - thread\ - tuple\ - type_traits\ - typeindex\ - typeinfo\ - unordered_map\ - unordered_set\ - utility\ - valarray\ - vector +SRCS+= algorithm.cpp\ + bind.cpp\ + chrono.cpp\ + condition_variable.cpp\ + debug.cpp\ + exception.cpp\ + future.cpp\ + hash.cpp\ + ios.cpp\ + iostream.cpp\ + locale.cpp\ + memory.cpp\ + mutex.cpp\ + new.cpp\ + random.cpp\ + regex.cpp\ + stdexcept.cpp\ + string.cpp\ + strstream.cpp\ + system_error.cpp\ + thread.cpp\ + typeinfo.cpp\ + utility.cpp\ + valarray.cpp + +WARNS= 0 +CXXFLAGS+= -I${HDRDIR} -I${LIBCXXRTDIR} -std=c++0x -nostdlib -DLIBCXXRT + +DPADD= ${LIBCXXRT} +LDADD= -lcxxrt +LDFLAGS+= --verbose +INCSGROUPS= STD EXT + +STD_HEADERS= __bit_reference\ + __config\ + __debug\ + __functional_03\ + __functional_base\ + __functional_base_03\ + __hash_table\ + __locale\ + __mutex_base\ + __split_buffer\ + __sso_allocator\ + __std_stream\ + __tree\ + __tuple\ + __tuple_03\ + __undef_min_max\ + algorithm\ + array\ + atomic\ + bitset\ + cassert\ + ccomplex\ + cctype\ + cerrno\ + cfenv\ + cfloat\ + chrono\ + cinttypes\ + ciso646\ + climits\ + clocale\ + cmath\ + codecvt\ + complex\ + complex.h\ + condition_variable\ + csetjmp\ + csignal\ + cstdarg\ + cstdbool\ + cstddef\ + cstdint\ + cstdio\ + cstdlib\ + cstring\ + ctgmath\ + ctime\ + cwchar\ + cwctype\ + deque\ + exception\ + forward_list\ + fstream\ + functional\ + future\ + initializer_list\ + iomanip\ + ios\ + iosfwd\ + iostream\ + istream\ + iterator\ + limits\ + list\ + locale\ + map\ + memory\ + mutex\ + new\ + numeric\ + ostream\ + queue\ + random\ + ratio\ + regex\ + scoped_allocator\ + set\ + sstream\ + stack\ + stdexcept\ + streambuf\ + string\ + strstream\ + system_error\ + tgmath.h\ + thread\ + tuple\ + type_traits\ + typeindex\ + typeinfo\ + unordered_map\ + unordered_set\ + utility\ + valarray\ + vector .for hdr in ${STD_HEADERS} -STD+= ${HDRDIR}/${hdr} +STD+= ${HDRDIR}/${hdr} .endfor -STDDIR= ${CXXINCLUDEDIR} +STDDIR= ${CXXINCLUDEDIR} -EXT_HEADERS= __hash\ - hash_map\ - hash_set +EXT_HEADERS= __hash\ + hash_map\ + hash_set .for hdr in ${EXT_HEADERS} -EXT+= ${HDRDIR}/ext/${hdr} +EXT+= ${HDRDIR}/ext/${hdr} .endfor -EXTDIR= ${CXXINCLUDEDIR}/ext +EXTDIR= ${CXXINCLUDEDIR}/ext .include Modified: stable/9/lib/libcxxrt/Makefile ============================================================================== --- stable/9/lib/libcxxrt/Makefile Tue Jun 5 06:03:55 2012 (r236599) +++ stable/9/lib/libcxxrt/Makefile Tue Jun 5 06:41:47 2012 (r236600) @@ -1,26 +1,26 @@ # $FreeBSD$ -SRCDIR= ${.CURDIR}/../../contrib/libcxxrt +SRCDIR= ${.CURDIR}/../../contrib/libcxxrt -SHLIB_MAJOR= 1 -SHLIBDIR?= /lib +SHLIB_MAJOR= 1 +SHLIBDIR?= /lib .PATH: ${SRCDIR} -LIB= cxxrt +LIB= cxxrt -SRCS+= libelftc_dem_gnu3.c\ - terminate.cc\ - dynamic_cast.cc\ - memory.cc\ - auxhelper.cc\ - exception.cc\ - stdexcept.cc\ - typeinfo.cc\ - guard.cc - -WARNS= 0 -CFLAGS+= -I${SRCDIR} -VERSION_MAP= ${.CURDIR}/Version.map +SRCS+= libelftc_dem_gnu3.c\ + terminate.cc\ + dynamic_cast.cc\ + memory.cc\ + auxhelper.cc\ + exception.cc\ + stdexcept.cc\ + typeinfo.cc\ + guard.cc + +WARNS= 0 +CFLAGS+= -I${SRCDIR} +VERSION_MAP= ${.CURDIR}/Version.map .include From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 5 06:43:45 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B2FCC106566C; Tue, 5 Jun 2012 06:43:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9CF2C8FC15; Tue, 5 Jun 2012 06:43:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q556hjGc094146; Tue, 5 Jun 2012 06:43:45 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q556hj2l094144; Tue, 5 Jun 2012 06:43:45 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206050643.q556hj2l094144@svn.freebsd.org> From: Dimitry Andric Date: Tue, 5 Jun 2012 06:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236601 - stable/9/lib/libc++ X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 06:43:45 -0000 Author: dim Date: Tue Jun 5 06:43:45 2012 New Revision: 236601 URL: http://svn.freebsd.org/changeset/base/236601 Log: MFC r236444: Install libcxxrt's C++ ABI and unwind headers. This is done in libc++'s Makefile, so these headers go into the same destination directory as libc++'s own headers, currently /usr/include/c++/v1. Modified: stable/9/lib/libc++/Makefile Directory Properties: stable/9/lib/libc++/ (props changed) Modified: stable/9/lib/libc++/Makefile ============================================================================== --- stable/9/lib/libc++/Makefile Tue Jun 5 06:41:47 2012 (r236600) +++ stable/9/lib/libc++/Makefile Tue Jun 5 06:43:45 2012 (r236601) @@ -138,10 +138,17 @@ STD_HEADERS= __bit_reference\ utility\ valarray\ vector +RT_HEADERS= cxxabi.h\ + unwind.h\ + unwind-arm.h\ + unwind-itanium.h .for hdr in ${STD_HEADERS} STD+= ${HDRDIR}/${hdr} .endfor +.for hdr in ${RT_HEADERS} +STD+= ${LIBCXXRTDIR}/${hdr} +.endfor STDDIR= ${CXXINCLUDEDIR} EXT_HEADERS= __hash\ From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 5 11:23:57 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07A11106564A; Tue, 5 Jun 2012 11:23:57 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5E208FC08; Tue, 5 Jun 2012 11:23:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q55BNu55016263; Tue, 5 Jun 2012 11:23:56 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55BNuac016261; Tue, 5 Jun 2012 11:23:56 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206051123.q55BNuac016261@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 5 Jun 2012 11:23:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236606 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 11:23:57 -0000 Author: bz Date: Tue Jun 5 11:23:56 2012 New Revision: 236606 URL: http://svn.freebsd.org/changeset/base/236606 Log: MFC r236327 (by emax): When we return deprecated addresses, we need to reference them. Modified: stable/9/sys/netinet6/in6.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/in6.c ============================================================================== --- stable/9/sys/netinet6/in6.c Tue Jun 5 10:23:41 2012 (r236605) +++ stable/9/sys/netinet6/in6.c Tue Jun 5 11:23:56 2012 (r236606) @@ -2236,14 +2236,20 @@ in6_ifawithifp(struct ifnet *ifp, struct IF_ADDR_RUNLOCK(ifp); return (struct in6_ifaddr *)ifa; } - IF_ADDR_RUNLOCK(ifp); /* use the last-resort values, that are, deprecated addresses */ - if (dep[0]) + if (dep[0]) { + ifa_ref((struct ifaddr *)dep[0]); + IF_ADDR_RUNLOCK(ifp); return dep[0]; - if (dep[1]) + } + if (dep[1]) { + ifa_ref((struct ifaddr *)dep[1]); + IF_ADDR_RUNLOCK(ifp); return dep[1]; + } + IF_ADDR_RUNLOCK(ifp); return NULL; } From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 5 11:26:44 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA616106566C; Tue, 5 Jun 2012 11:26:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 946178FC14; Tue, 5 Jun 2012 11:26:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q55BQiER016498; Tue, 5 Jun 2012 11:26:44 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55BQiqk016496; Tue, 5 Jun 2012 11:26:44 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206051126.q55BQiqk016496@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 5 Jun 2012 11:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236608 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 11:26:44 -0000 Author: bz Date: Tue Jun 5 11:26:43 2012 New Revision: 236608 URL: http://svn.freebsd.org/changeset/base/236608 Log: MFC r236501 (by emax): Plug reference leak. Interface addresses are refcounted as packets move through the stack, and there's garbage collection tied to it so that address changes can safely propagate while traffic is flowing. In our setup, we weren't changing or deleting any addresses, but the refcounting logic in ip6_input() was wrong and caused a reference leak on every inbound V6 packet. This eventually caused a 32bit overflow, and the resulting 0 value caused the garbage collection to run on the active address. That then snowballed into the panic. Modified: stable/9/sys/netinet6/ip6_input.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/ip6_input.c ============================================================================== --- stable/9/sys/netinet6/ip6_input.c Tue Jun 5 11:24:05 2012 (r236607) +++ stable/9/sys/netinet6/ip6_input.c Tue Jun 5 11:26:43 2012 (r236608) @@ -797,19 +797,23 @@ passin: * as our interface address (e.g. multicast addresses, addresses * within FAITH prefixes and such). */ - if (deliverifp && !ip6_getdstifaddr(m)) { + if (deliverifp) { struct in6_ifaddr *ia6; - ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); - if (ia6) { - if (!ip6_setdstifaddr(m, ia6)) { - /* - * XXX maybe we should drop the packet here, - * as we could not provide enough information - * to the upper layers. - */ - } + if ((ia6 = ip6_getdstifaddr(m)) != NULL) { ifa_free(&ia6->ia_ifa); + } else { + ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); + if (ia6) { + if (!ip6_setdstifaddr(m, ia6)) { + /* + * XXX maybe we should drop the packet here, + * as we could not provide enough information + * to the upper layers. + */ + } + ifa_free(&ia6->ia_ifa); + } } } From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 5 11:28:57 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3EFE1065672; Tue, 5 Jun 2012 11:28:57 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CDDAE8FC15; Tue, 5 Jun 2012 11:28:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q55BSv9K016698; Tue, 5 Jun 2012 11:28:57 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55BSvld016696; Tue, 5 Jun 2012 11:28:57 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206051128.q55BSvld016696@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 5 Jun 2012 11:28:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236610 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 11:28:58 -0000 Author: bz Date: Tue Jun 5 11:28:57 2012 New Revision: 236610 URL: http://svn.freebsd.org/changeset/base/236610 Log: MFC r236575 (by emax): Plug more refcount leaks and possible NULL deref for interface address list. Modified: stable/9/sys/netinet/tcp_input.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/tcp_input.c ============================================================================== --- stable/9/sys/netinet/tcp_input.c Tue Jun 5 11:27:11 2012 (r236609) +++ stable/9/sys/netinet/tcp_input.c Tue Jun 5 11:28:57 2012 (r236610) @@ -543,6 +543,8 @@ tcp6_input(struct mbuf **mp, int *offp, (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); return IPPROTO_DONE; } + if (ia6) + ifa_free(&ia6->ia_ifa); tcp_input(m, *offp); return IPPROTO_DONE; @@ -1253,7 +1255,8 @@ relocked: rstreason = BANDLIM_RST_OPENPORT; goto dropwithreset; } - ifa_free(&ia6->ia_ifa); + if (ia6) + ifa_free(&ia6->ia_ifa); } #endif /* INET6 */ /* From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 5 11:42:35 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7B1621065672; Tue, 5 Jun 2012 11:42:35 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 652088FC12; Tue, 5 Jun 2012 11:42:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q55BgZEm017409; Tue, 5 Jun 2012 11:42:35 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55BgZWo017407; Tue, 5 Jun 2012 11:42:35 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201206051142.q55BgZWo017407@svn.freebsd.org> From: David Chisnall Date: Tue, 5 Jun 2012 11:42:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236612 - stable/9/lib/msun/src X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 11:42:35 -0000 Author: theraven Date: Tue Jun 5 11:42:34 2012 New Revision: 236612 URL: http://svn.freebsd.org/changeset/base/236612 Log: Merge r236148. This allows C++ code to include after explicitly including math.h. Modified: stable/9/lib/msun/src/math.h Directory Properties: stable/9/lib/msun/ (props changed) Modified: stable/9/lib/msun/src/math.h ============================================================================== --- stable/9/lib/msun/src/math.h Tue Jun 5 11:29:00 2012 (r236611) +++ stable/9/lib/msun/src/math.h Tue Jun 5 11:42:34 2012 (r236612) @@ -398,35 +398,15 @@ float significandf(float); * long double versions of ISO/POSIX math functions */ #if __ISO_C_VISIBLE >= 1999 -#if _DECLARE_C99_LDBL_MATH -long double acoshl(long double); -#endif long double acosl(long double); -#if _DECLARE_C99_LDBL_MATH -long double asinhl(long double); -#endif long double asinl(long double); long double atan2l(long double, long double); -#if _DECLARE_C99_LDBL_MATH -long double atanhl(long double); -#endif long double atanl(long double); long double cbrtl(long double); long double ceill(long double); long double copysignl(long double, long double) __pure2; -#if _DECLARE_C99_LDBL_MATH -long double coshl(long double); -#endif long double cosl(long double); -#if _DECLARE_C99_LDBL_MATH -long double erfcl(long double); -long double erfl(long double); -#endif long double exp2l(long double); -#if _DECLARE_C99_LDBL_MATH -long double expl(long double); -long double expm1l(long double); -#endif long double fabsl(long double) __pure2; long double fdiml(long double, long double); long double floorl(long double); @@ -438,20 +418,9 @@ long double frexpl(long double value, in long double hypotl(long double, long double); int ilogbl(long double) __pure2; long double ldexpl(long double, int); -#if _DECLARE_C99_LDBL_MATH -long double lgammal(long double); -#endif long long llrintl(long double); long long llroundl(long double); -#if _DECLARE_C99_LDBL_MATH -long double log10l(long double); -long double log1pl(long double); -long double log2l(long double); -#endif long double logbl(long double); -#if _DECLARE_C99_LDBL_MATH -long double logl(long double); -#endif long lrintl(long double); long lroundl(long double); long double modfl(long double, long double *); /* fundamentally !__pure2 */ @@ -461,30 +430,54 @@ long double nextafterl(long double, long double nexttoward(double, long double); float nexttowardf(float, long double); long double nexttowardl(long double, long double); -#if _DECLARE_C99_LDBL_MATH -long double powl(long double, long double); -#endif long double remainderl(long double, long double); long double remquol(long double, long double, int *); long double rintl(long double); long double roundl(long double); long double scalblnl(long double, long); long double scalbnl(long double, int); -#if _DECLARE_C99_LDBL_MATH -long double sinhl(long double); -#endif long double sinl(long double); long double sqrtl(long double); -#if _DECLARE_C99_LDBL_MATH -long double tanhl(long double); -#endif long double tanl(long double); -#if _DECLARE_C99_LDBL_MATH -long double tgammal(long double); -#endif long double truncl(long double); #endif /* __ISO_C_VISIBLE >= 1999 */ __END_DECLS #endif /* !_MATH_H_ */ + +/* separate header for cmath */ +#ifndef _MATH_EXTRA_H_ +#if __ISO_C_VISIBLE >= 1999 +#if _DECLARE_C99_LDBL_MATH + +#define _MATH_EXTRA_H_ + +/* + * extra long double versions of math functions for C99 and cmath + */ +__BEGIN_DECLS + +long double acoshl(long double); +long double asinhl(long double); +long double atanhl(long double); +long double coshl(long double); +long double erfcl(long double); +long double erfl(long double); +long double expl(long double); +long double expm1l(long double); +long double lgammal(long double); +long double log10l(long double); +long double log1pl(long double); +long double log2l(long double); +long double logl(long double); +long double powl(long double, long double); +long double sinhl(long double); +long double tanhl(long double); +long double tgammal(long double); + +__END_DECLS + +#endif /* !_DECLARE_C99_LDBL_MATH */ +#endif /* __ISO_C_VISIBLE >= 1999 */ +#endif /* !_MATH_EXTRA_H_ */ From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 5 13:57:03 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62C851065673; Tue, 5 Jun 2012 13:57:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4CA3D8FC18; Tue, 5 Jun 2012 13:57:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q55Dv3M8023525; Tue, 5 Jun 2012 13:57:03 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55Dv35r023523; Tue, 5 Jun 2012 13:57:03 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206051357.q55Dv35r023523@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 5 Jun 2012 13:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236616 - stable/9/share/man/man9 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 13:57:03 -0000 Author: trasz Date: Tue Jun 5 13:57:02 2012 New Revision: 236616 URL: http://svn.freebsd.org/changeset/base/236616 Log: MFC r236237: Fix lock interaction table for rmlocks - by default they cannot sleep, just like rwlocks. Modified: stable/9/share/man/man9/locking.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/locking.9 ============================================================================== --- stable/9/share/man/man9/locking.9 Tue Jun 5 13:27:37 2012 (r236615) +++ stable/9/share/man/man9/locking.9 Tue Jun 5 13:57:02 2012 (r236616) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 3, 2010 +.Dd May 25, 2012 .Dt LOCKING 9 .Os .Sh NAME @@ -301,7 +301,7 @@ one of the synchronization primitives di .It mutex Ta \&ok Ta \&ok-1 Ta \&no Ta \&ok Ta \&ok Ta \&no-3 .It sx Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok Ta \&ok Ta \&ok-4 .It rwlock Ta \&ok Ta \&ok Ta \&no Ta \&ok-2 Ta \&ok Ta \&no-3 -.It rmlock Ta \&ok Ta \&ok Ta \&ok-5 Ta \&ok Ta \&ok-2 Ta \&ok-5 +.It rmlock Ta \&ok Ta \&ok Ta \&no-5 Ta \&ok Ta \&ok-2 Ta \&no-5 .El .Pp .Em *1 From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 5 19:58:59 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E76EB1065672; Tue, 5 Jun 2012 19:58:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D97C8FC08; Tue, 5 Jun 2012 19:58:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q55JwxTO040698; Tue, 5 Jun 2012 19:58:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55JwxTN040695; Tue, 5 Jun 2012 19:58:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206051958.q55JwxTN040695@svn.freebsd.org> From: Marius Strobl Date: Tue, 5 Jun 2012 19:58:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236631 - in stable/9/sys: dev/iwn sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 19:59:00 -0000 Author: marius Date: Tue Jun 5 19:58:58 2012 New Revision: 236631 URL: http://svn.freebsd.org/changeset/base/236631 Log: MFC: r236486 Add nitems(), a macro for determining the number of elements in a statically-allocated array. Obtained from: OpenBSD (in principle) MFC: r236489 Modified: stable/9/sys/dev/iwn/if_iwn.c stable/9/sys/sys/param.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/iwn/if_iwn.c ============================================================================== --- stable/9/sys/dev/iwn/if_iwn.c Tue Jun 5 19:51:37 2012 (r236630) +++ stable/9/sys/dev/iwn/if_iwn.c Tue Jun 5 19:58:58 2012 (r236631) @@ -2005,8 +2005,6 @@ iwn_setregdomain(struct ieee80211com *ic return 0; } -#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) - static void iwn_read_eeprom_enhinfo(struct iwn_softc *sc) { Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Tue Jun 5 19:51:37 2012 (r236630) +++ stable/9/sys/sys/param.h Tue Jun 5 19:58:58 2012 (r236631) @@ -273,6 +273,7 @@ #ifndef howmany #define howmany(x, y) (((x)+((y)-1))/(y)) #endif +#define nitems(x) (sizeof((x)) / sizeof((x)[0])) #define rounddown(x, y) (((x)/(y))*(y)) #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 5 20:27:41 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B27EB10656B6; Tue, 5 Jun 2012 20:27:41 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9CD5B8FC14; Tue, 5 Jun 2012 20:27:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q55KRf3x042197; Tue, 5 Jun 2012 20:27:41 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55KRfJa042195; Tue, 5 Jun 2012 20:27:41 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206052027.q55KRfJa042195@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 5 Jun 2012 20:27:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236636 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 20:27:41 -0000 Author: trasz Date: Tue Jun 5 20:27:41 2012 New Revision: 236636 URL: http://svn.freebsd.org/changeset/base/236636 Log: MFC r235781: Fix enforcement of file size limit with O_APPEND on ZFS. vn_rlimit_fsize takes uio->uio_offset and uio->uio_resid into account when determining whether given write would exceed RLIMIT_FSIZE. When APPEND flag is specified, ZFS updates uio->uio_offset to point to the end of file. But this happens after a call to vn_rlimit_fsize, so vn_rlimit_fsize check can be rendered ineffective by thread that opens some file with O_APPEND and lseeks below RLIMIT_FSIZE before calling write. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jun 5 20:22:37 2012 (r236635) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jun 5 20:27:41 2012 (r236636) @@ -839,6 +839,12 @@ zfs_write(vnode_t *vp, uio_t *uio, int i rl = zfs_range_lock(zp, woff, n, RL_WRITER); } + if (vn_rlimit_fsize(vp, uio, uio->uio_td)) { + zfs_range_unlock(rl); + ZFS_EXIT(zfsvfs); + return (EFBIG); + } + if (woff >= limit) { zfs_range_unlock(rl); ZFS_EXIT(zfsvfs); @@ -5697,9 +5703,6 @@ zfs_freebsd_write(ap) } */ *ap; { - if (vn_rlimit_fsize(ap->a_vp, ap->a_uio, ap->a_uio->uio_td)) - return (EFBIG); - return (zfs_write(ap->a_vp, ap->a_uio, ioflags(ap->a_ioflag), ap->a_cred, NULL)); } From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 5 20:49:19 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1C6D106566C; Tue, 5 Jun 2012 20:49:19 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 828EE8FC0A; Tue, 5 Jun 2012 20:49:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q55KnJrQ043418; Tue, 5 Jun 2012 20:49:19 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55KnJnO043415; Tue, 5 Jun 2012 20:49:19 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206052049.q55KnJnO043415@svn.freebsd.org> From: Marius Strobl Date: Tue, 5 Jun 2012 20:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236641 - in stable/9/sys/dev: bge sym X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 20:49:19 -0000 Author: marius Date: Tue Jun 5 20:49:18 2012 New Revision: 236641 URL: http://svn.freebsd.org/changeset/base/236641 Log: MFC: r236488 Take advantage of nitems(). Modified: stable/9/sys/dev/bge/if_bge.c stable/9/sys/dev/sym/sym_hipd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/bge/if_bge.c ============================================================================== --- stable/9/sys/dev/bge/if_bge.c Tue Jun 5 20:48:13 2012 (r236640) +++ stable/9/sys/dev/bge/if_bge.c Tue Jun 5 20:49:18 2012 (r236641) @@ -2791,9 +2791,8 @@ bge_mbox_reorder(struct bge_softc *sc) }; devclass_t pci, pcib; device_t bus, dev; - int count, i; + int i; - count = sizeof(mbox_reorder_lists) / sizeof(mbox_reorder_lists[0]); pci = devclass_find("pci"); pcib = devclass_find("pcib"); dev = sc->bge_dev; @@ -2806,7 +2805,7 @@ bge_mbox_reorder(struct bge_softc *sc) device_get_name(bus), device_get_unit(bus)); if (device_get_devclass(dev) != pcib) break; - for (i = 0; i < count; i++) { + for (i = 0; i < nitems(mbox_reorder_lists); i++) { device_printf(sc->bge_dev, "probing dev : %s%d, vendor : 0x%04x " "device : 0x%04x\n", Modified: stable/9/sys/dev/sym/sym_hipd.c ============================================================================== --- stable/9/sys/dev/sym/sym_hipd.c Tue Jun 5 20:48:13 2012 (r236640) +++ stable/9/sys/dev/sym/sym_hipd.c Tue Jun 5 20:49:18 2012 (r236641) @@ -8411,9 +8411,6 @@ static const struct sym_pci_chip sym_pci FE_RAM|FE_IO256|FE_LEDC} }; -#define sym_pci_num_devs \ - (sizeof(sym_pci_dev_table) / sizeof(sym_pci_dev_table[0])) - /* * Look up the chip table. * @@ -8434,7 +8431,7 @@ sym_find_pci_chip(device_t dev) device_id = pci_get_device(dev); revision = pci_get_revid(dev); - for (i = 0; i < sym_pci_num_devs; i++) { + for (i = 0; i < nitems(sym_pci_dev_table); i++) { chip = &sym_pci_dev_table[i]; if (device_id != chip->device_id) continue; From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 5 20:53:47 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 007CA106566B; Tue, 5 Jun 2012 20:53:47 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF5FD8FC1E; Tue, 5 Jun 2012 20:53:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q55KrkS4043664; Tue, 5 Jun 2012 20:53:46 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55KrkYS043661; Tue, 5 Jun 2012 20:53:46 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206052053.q55KrkYS043661@svn.freebsd.org> From: Marius Strobl Date: Tue, 5 Jun 2012 20:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236642 - stable/9/sys/dev/mmc X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 20:53:47 -0000 Author: marius Date: Tue Jun 5 20:53:46 2012 New Revision: 236642 URL: http://svn.freebsd.org/changeset/base/236642 Log: MFC: r236491 Add missing prototypes. While at it, sort them alphabetically. Modified: stable/9/sys/dev/mmc/mmc.c stable/9/sys/dev/mmc/mmcsd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/mmc/mmc.c ============================================================================== --- stable/9/sys/dev/mmc/mmc.c Tue Jun 5 20:49:18 2012 (r236641) +++ stable/9/sys/dev/mmc/mmc.c Tue Jun 5 20:53:46 2012 (r236642) @@ -112,11 +112,21 @@ static int mmc_debug; SYSCTL_INT(_hw_mmc, OID_AUTO, debug, CTLFLAG_RW, &mmc_debug, 0, "Debug level"); /* bus entry points */ -static int mmc_probe(device_t dev); +static int mmc_acquire_bus(device_t busdev, device_t dev); static int mmc_attach(device_t dev); +static int mmc_child_location_str(device_t dev, device_t child, char *buf, + size_t buflen); static int mmc_detach(device_t dev); -static int mmc_suspend(device_t dev); +static int mmc_probe(device_t dev); +static int mmc_read_ivar(device_t bus, device_t child, int which, + uintptr_t *result); +static int mmc_release_bus(device_t busdev, device_t dev); static int mmc_resume(device_t dev); +static int mmc_suspend(device_t dev); +static int mmc_wait_for_request(device_t brdev, device_t reqdev, + struct mmc_request *req); +static int mmc_write_ivar(device_t bus, device_t child, int which, + uintptr_t value); #define MMC_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define MMC_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) @@ -127,25 +137,69 @@ static int mmc_resume(device_t dev); #define MMC_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); #define MMC_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); +static int mmc_all_send_cid(struct mmc_softc *sc, uint32_t *rawcid); +static void mmc_app_decode_scr(uint32_t *raw_scr, struct mmc_scr *scr); +static void mmc_app_decode_sd_status(uint32_t *raw_sd_status, + struct mmc_sd_status *sd_status); +static int mmc_app_sd_status(struct mmc_softc *sc, uint16_t rca, + uint32_t *rawsdstatus); +static int mmc_app_send_scr(struct mmc_softc *sc, uint16_t rca, + uint32_t *rawscr); static int mmc_calculate_clock(struct mmc_softc *sc); -static void mmc_delayed_attach(void *); +static void mmc_decode_cid_mmc(uint32_t *raw_cid, struct mmc_cid *cid); +static void mmc_decode_cid_sd(uint32_t *raw_cid, struct mmc_cid *cid); +static void mmc_decode_csd_mmc(uint32_t *raw_csd, struct mmc_csd *csd); +static void mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd); +static void mmc_delayed_attach(void *xsc); +static int mmc_delete_cards(struct mmc_softc *sc); +static void mmc_discover_cards(struct mmc_softc *sc); +static void mmc_format_card_id_string(struct mmc_ivars *ivar); +static void mmc_go_discovery(struct mmc_softc *sc); +static uint32_t mmc_get_bits(uint32_t *bits, int bit_len, int start, + int size); +static int mmc_highest_voltage(uint32_t ocr); +static void mmc_idle_cards(struct mmc_softc *sc); +static void mmc_ms_delay(int ms); +static void mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard); static void mmc_power_down(struct mmc_softc *sc); +static void mmc_power_up(struct mmc_softc *sc); +static void mmc_rescan_cards(struct mmc_softc *sc); +static void mmc_scan(struct mmc_softc *sc); +static int mmc_sd_switch(struct mmc_softc *sc, uint8_t mode, uint8_t grp, + uint8_t value, uint8_t *res); +static int mmc_select_card(struct mmc_softc *sc, uint16_t rca); +static uint32_t mmc_select_vdd(struct mmc_softc *sc, uint32_t ocr); +static int mmc_send_app_op_cond(struct mmc_softc *sc, uint32_t ocr, + uint32_t *rocr); +static int mmc_send_csd(struct mmc_softc *sc, uint16_t rca, uint32_t *rawcsd); +static int mmc_send_ext_csd(struct mmc_softc *sc, uint8_t *rawextcsd); +static int mmc_send_if_cond(struct mmc_softc *sc, uint8_t vhs); +static int mmc_send_op_cond(struct mmc_softc *sc, uint32_t ocr, + uint32_t *rocr); +static int mmc_send_relative_addr(struct mmc_softc *sc, uint32_t *resp); +static int mmc_send_status(struct mmc_softc *sc, uint16_t rca, + uint32_t *status); +static int mmc_set_blocklen(struct mmc_softc *sc, uint32_t len); +static int mmc_set_card_bus_width(struct mmc_softc *sc, uint16_t rca, + int width); +static int mmc_set_relative_addr(struct mmc_softc *sc, uint16_t resp); +static int mmc_set_timing(struct mmc_softc *sc, int timing); +static int mmc_switch(struct mmc_softc *sc, uint8_t set, uint8_t index, + uint8_t value); +static int mmc_test_bus_width(struct mmc_softc *sc); +static int mmc_wait_for_app_cmd(struct mmc_softc *sc, uint32_t rca, + struct mmc_command *cmd, int retries); static int mmc_wait_for_cmd(struct mmc_softc *sc, struct mmc_command *cmd, int retries); static int mmc_wait_for_command(struct mmc_softc *sc, uint32_t opcode, uint32_t arg, uint32_t flags, uint32_t *resp, int retries); -static int mmc_select_card(struct mmc_softc *sc, uint16_t rca); -static int mmc_set_card_bus_width(struct mmc_softc *sc, uint16_t rca, int width); -static int mmc_app_send_scr(struct mmc_softc *sc, uint16_t rca, uint32_t *rawscr); -static void mmc_app_decode_scr(uint32_t *raw_scr, struct mmc_scr *scr); -static int mmc_send_ext_csd(struct mmc_softc *sc, uint8_t *rawextcsd); -static void mmc_scan(struct mmc_softc *sc); -static int mmc_delete_cards(struct mmc_softc *sc); -static void mmc_format_card_id_string(struct mmc_ivars *ivar); +static int mmc_wait_for_req(struct mmc_softc *sc, struct mmc_request *req); +static void mmc_wakeup(struct mmc_request *req); static void mmc_ms_delay(int ms) { + DELAY(1000 * ms); /* XXX BAD */ } Modified: stable/9/sys/dev/mmc/mmcsd.c ============================================================================== --- stable/9/sys/dev/mmc/mmcsd.c Tue Jun 5 20:49:18 2012 (r236641) +++ stable/9/sys/dev/mmc/mmcsd.c Tue Jun 5 20:53:46 2012 (r236642) @@ -89,19 +89,21 @@ struct mmcsd_softc { }; /* bus entry points */ -static int mmcsd_probe(device_t dev); static int mmcsd_attach(device_t dev); static int mmcsd_detach(device_t dev); +static int mmcsd_probe(device_t dev); /* disk routines */ -static int mmcsd_open(struct disk *dp); static int mmcsd_close(struct disk *dp); -static void mmcsd_strategy(struct bio *bp); static int mmcsd_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length); +static int mmcsd_open(struct disk *dp); +static void mmcsd_strategy(struct bio *bp); static void mmcsd_task(void *arg); static int mmcsd_bus_bit_width(device_t dev); +static daddr_t mmcsd_delete(struct mmcsd_softc *sc, struct bio *bp); +static daddr_t mmcsd_rw(struct mmcsd_softc *sc, struct bio *bp); #define MMCSD_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define MMCSD_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) @@ -256,12 +258,14 @@ mmcsd_resume(device_t dev) static int mmcsd_open(struct disk *dp) { + return (0); } static int mmcsd_close(struct disk *dp) { + return (0); } @@ -521,6 +525,7 @@ out: static int mmcsd_bus_bit_width(device_t dev) { + if (mmc_get_bus_width(dev) == bus_width_1) return (1); if (mmc_get_bus_width(dev) == bus_width_4) From owner-svn-src-stable-9@FreeBSD.ORG Wed Jun 6 01:01:13 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 03CEC1065670; Wed, 6 Jun 2012 01:01:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2E3A8FC12; Wed, 6 Jun 2012 01:01:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5611CNF058820; Wed, 6 Jun 2012 01:01:12 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5611Ceb058818; Wed, 6 Jun 2012 01:01:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206060101.q5611Ceb058818@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 6 Jun 2012 01:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236648 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 01:01:13 -0000 Author: kib Date: Wed Jun 6 01:01:12 2012 New Revision: 236648 URL: http://svn.freebsd.org/changeset/base/236648 Log: MFC r236309: Assert that TDP_NOFAULTING and TDP_NOSPEEPING thread flags do not leak when thread returns from a syscall to usermode. Modified: stable/9/sys/kern/subr_syscall.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_syscall.c ============================================================================== --- stable/9/sys/kern/subr_syscall.c Wed Jun 6 00:20:13 2012 (r236647) +++ stable/9/sys/kern/subr_syscall.c Wed Jun 6 01:01:12 2012 (r236648) @@ -182,6 +182,12 @@ syscallret(struct thread *td, int error, KASSERT(td->td_locks == 0, ("System call %s returning with %d locks held", syscallname(p, sa->code), td->td_locks)); + KASSERT((td->td_pflags & TDP_NOFAULTING) == 0, + ("System call %s returning with pagefaults disabled", + syscallname(p, sa->code))); + KASSERT((td->td_pflags & TDP_NOSLEEPING) == 0, + ("System call %s returning with sleep disabled", + syscallname(p, sa->code))); /* * Handle reschedule and other end-of-syscall issues From owner-svn-src-stable-9@FreeBSD.ORG Wed Jun 6 04:17:40 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BD3E1106566B; Wed, 6 Jun 2012 04:17:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A82F58FC12; Wed, 6 Jun 2012 04:17:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q564HeoF067906; Wed, 6 Jun 2012 04:17:40 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q564HeUi067904; Wed, 6 Jun 2012 04:17:40 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206060417.q564HeUi067904@svn.freebsd.org> From: Eitan Adler Date: Wed, 6 Jun 2012 04:17:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236650 - stable/9/sys/dev/puc X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 04:17:40 -0000 Author: eadler Date: Wed Jun 6 04:17:40 2012 New Revision: 236650 URL: http://svn.freebsd.org/changeset/base/236650 Log: MFC r236282: Add support for Sun 1040 PCI Quad Serial PR: kern/163450 Approved by: cperciva (implicit) Modified: stable/9/sys/dev/puc/pucdata.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/puc/pucdata.c ============================================================================== --- stable/9/sys/dev/puc/pucdata.c Wed Jun 6 02:42:30 2012 (r236649) +++ stable/9/sys/dev/puc/pucdata.c Wed Jun 6 04:17:40 2012 (r236650) @@ -901,6 +901,12 @@ const struct puc_cfg puc_pci_devices[] = .config_function = puc_config_syba }, + { 0x5372, 0x6873, 0xffff, 0, + "Sun 1040 PCI Quad Serial", + DEFAULT_RCLK, + PUC_PORT_4S, 0x10, 4, 0, + }, + { 0x6666, 0x0001, 0xffff, 0, "Decision Computer Inc, PCCOM 4-port serial", DEFAULT_RCLK, From owner-svn-src-stable-9@FreeBSD.ORG Wed Jun 6 04:26:04 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 55B56106566C; Wed, 6 Jun 2012 04:26:04 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40F2E8FC12; Wed, 6 Jun 2012 04:26:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q564Q44w068429; Wed, 6 Jun 2012 04:26:04 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q564Q4NU068427; Wed, 6 Jun 2012 04:26:04 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206060426.q564Q4NU068427@svn.freebsd.org> From: Eitan Adler Date: Wed, 6 Jun 2012 04:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236653 - stable/9/sys/cam/scsi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 04:26:04 -0000 Author: eadler Date: Wed Jun 6 04:26:03 2012 New Revision: 236653 URL: http://svn.freebsd.org/changeset/base/236653 Log: MFC r236283: Add support for newer garmin devices PR: kern/163932 Approved by: cperciva (implicit) Modified: stable/9/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_xpt.c Wed Jun 6 04:18:22 2012 (r236652) +++ stable/9/sys/cam/scsi/scsi_xpt.c Wed Jun 6 04:26:03 2012 (r236653) @@ -535,6 +535,10 @@ static struct scsi_quirk_entry scsi_quir CAM_QUIRK_NOLUNS, /*mintags*/0, /*maxtags*/0 }, { + { T_DIRECT, SIP_MEDIA_REMOVABLE, "Garmin", "*", "*" }, + CAM_QUIRK_NORPTLUNS, /*mintags*/2, /*maxtags*/255 + }, + { /* Default tagged queuing parameters for all devices */ { T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED, From owner-svn-src-stable-9@FreeBSD.ORG Wed Jun 6 04:38:26 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CB1A8106564A; Wed, 6 Jun 2012 04:38:26 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BC748FC0A; Wed, 6 Jun 2012 04:38:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q564cQvb069205; Wed, 6 Jun 2012 04:38:26 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q564cQBF069200; Wed, 6 Jun 2012 04:38:26 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206060438.q564cQBF069200@svn.freebsd.org> From: Eitan Adler Date: Wed, 6 Jun 2012 04:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236655 - in stable/9/sys/dev: hptiop hptmv isp X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 04:38:26 -0000 Author: eadler Date: Wed Jun 6 04:38:25 2012 New Revision: 236655 URL: http://svn.freebsd.org/changeset/base/236655 Log: MFC r236379: Adding missing dependancies for loading hptiop(4), hptmv(4) and isp(4) as modules. PR: kern/166239 Approved by: cperciva (implicit) Modified: stable/9/sys/dev/hptiop/hptiop.c stable/9/sys/dev/hptmv/entry.c stable/9/sys/dev/isp/isp_pci.c stable/9/sys/dev/isp/isp_sbus.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/hptiop/hptiop.c ============================================================================== --- stable/9/sys/dev/hptiop/hptiop.c Wed Jun 6 04:26:27 2012 (r236654) +++ stable/9/sys/dev/hptiop/hptiop.c Wed Jun 6 04:38:25 2012 (r236655) @@ -1268,6 +1268,7 @@ static driver_t hptiop_pci_driver = { }; DRIVER_MODULE(hptiop, pci, hptiop_pci_driver, hptiop_devclass, 0, 0); +MODULE_DEPEND(hptiop, cam, 1, 1, 1); static int hptiop_probe(device_t dev) { Modified: stable/9/sys/dev/hptmv/entry.c ============================================================================== --- stable/9/sys/dev/hptmv/entry.c Wed Jun 6 04:26:27 2012 (r236654) +++ stable/9/sys/dev/hptmv/entry.c Wed Jun 6 04:38:25 2012 (r236655) @@ -108,6 +108,7 @@ static devclass_t hpt_devclass; #define __DRIVER_MODULE(p1, p2, p3, p4, p5, p6) DRIVER_MODULE(p1, p2, p3, p4, p5, p6) __DRIVER_MODULE(PROC_DIR_NAME, pci, hpt_pci_driver, hpt_devclass, 0, 0); +MODULE_DEPEND(PROC_DIR_NAME, cam, 1, 1, 1); #define ccb_ccb_ptr spriv_ptr0 #define ccb_adapter ccb_h.spriv_ptr1 Modified: stable/9/sys/dev/isp/isp_pci.c ============================================================================== --- stable/9/sys/dev/isp/isp_pci.c Wed Jun 6 04:26:27 2012 (r236654) +++ stable/9/sys/dev/isp/isp_pci.c Wed Jun 6 04:38:25 2012 (r236655) @@ -372,6 +372,8 @@ static driver_t isp_pci_driver = { }; static devclass_t isp_devclass; DRIVER_MODULE(isp, pci, isp_pci_driver, isp_devclass, 0, 0); +MODULE_DEPEND(isp, cam, 1, 1, 1); +MODULE_DEPEND(isp, firmware, 1, 1, 1); static int isp_pci_probe(device_t dev) Modified: stable/9/sys/dev/isp/isp_sbus.c ============================================================================== --- stable/9/sys/dev/isp/isp_sbus.c Wed Jun 6 04:26:27 2012 (r236654) +++ stable/9/sys/dev/isp/isp_sbus.c Wed Jun 6 04:38:25 2012 (r236655) @@ -106,6 +106,8 @@ static driver_t isp_sbus_driver = { }; static devclass_t isp_devclass; DRIVER_MODULE(isp, sbus, isp_sbus_driver, isp_devclass, 0, 0); +MODULE_DEPEND(isp, cam, 1, 1, 1); +MODULE_DEPEND(isp, firmware, 1, 1, 1); static int isp_sbus_probe(device_t dev) From owner-svn-src-stable-9@FreeBSD.ORG Wed Jun 6 06:32:51 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18DF81065676; Wed, 6 Jun 2012 06:32:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04ADE8FC19; Wed, 6 Jun 2012 06:32:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q566Wo0e074435; Wed, 6 Jun 2012 06:32:50 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q566WoDl074433; Wed, 6 Jun 2012 06:32:50 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206060632.q566WoDl074433@svn.freebsd.org> From: Eitan Adler Date: Wed, 6 Jun 2012 06:32:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236659 - stable/9/sys/dev/vxge/vxgehal X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 06:32:51 -0000 Author: eadler Date: Wed Jun 6 06:32:50 2012 New Revision: 236659 URL: http://svn.freebsd.org/changeset/base/236659 Log: MFC r236377: Fix bug revealed by warning generated by clang: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] Approved by: cperciva (implicit) Modified: stable/9/sys/dev/vxge/vxgehal/vxgehal-channel.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/vxge/vxgehal/vxgehal-channel.h ============================================================================== --- stable/9/sys/dev/vxge/vxgehal/vxgehal-channel.h Wed Jun 6 06:19:52 2012 (r236658) +++ stable/9/sys/dev/vxge/vxgehal/vxgehal-channel.h Wed Jun 6 06:32:50 2012 (r236659) @@ -291,7 +291,7 @@ __hal_channel_dtr_restore(__hal_channel_ else dtr_index = channel->reserve_index - 1; - if ((channel->dtr_arr[dtr_index].dtr == dtrh)) { + if ((channel->dtr_arr[dtr_index].dtr = dtrh) != NULL) { channel->reserve_index = dtr_index; channel->dtr_arr[dtr_index].state = VXGE_HAL_CHANNEL_DTR_FREE; From owner-svn-src-stable-9@FreeBSD.ORG Wed Jun 6 06:35:10 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9396C1065674; Wed, 6 Jun 2012 06:35:10 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7ECEE8FC1A; Wed, 6 Jun 2012 06:35:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q566ZAY6074618; Wed, 6 Jun 2012 06:35:10 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q566ZAge074616; Wed, 6 Jun 2012 06:35:10 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206060635.q566ZAge074616@svn.freebsd.org> From: Eitan Adler Date: Wed, 6 Jun 2012 06:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236660 - stable/9/sbin/camcontrol X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 06:35:10 -0000 Author: eadler Date: Wed Jun 6 06:35:09 2012 New Revision: 236660 URL: http://svn.freebsd.org/changeset/base/236660 Log: MFC r236285: Add missing flag enable when certain arguments are parsed PR: bin/163053 Approved by: cperciva (implicit) Modified: stable/9/sbin/camcontrol/camcontrol.c Directory Properties: stable/9/sbin/camcontrol/ (props changed) Modified: stable/9/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.c Wed Jun 6 06:32:50 2012 (r236659) +++ stable/9/sbin/camcontrol/camcontrol.c Wed Jun 6 06:35:09 2012 (r236660) @@ -3385,6 +3385,7 @@ ratecontrol(struct cam_device *device, i spi->flags &= ~CTS_SPI_FLAGS_DISC_ENB; else spi->flags |= CTS_SPI_FLAGS_DISC_ENB; + didsettings++; } if (scsi && tag_enable != -1) { if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0) { From owner-svn-src-stable-9@FreeBSD.ORG Wed Jun 6 06:38:56 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C40AD1065675; Wed, 6 Jun 2012 06:38:56 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AEF428FC16; Wed, 6 Jun 2012 06:38:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q566cud1074933; Wed, 6 Jun 2012 06:38:56 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q566cuY0074931; Wed, 6 Jun 2012 06:38:56 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206060638.q566cuY0074931@svn.freebsd.org> From: Eitan Adler Date: Wed, 6 Jun 2012 06:38:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236663 - stable/9/usr.sbin/lpr/lpr X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 06:38:56 -0000 Author: eadler Date: Wed Jun 6 06:38:56 2012 New Revision: 236663 URL: http://svn.freebsd.org/changeset/base/236663 Log: MFC r236289: Relax security permissions on '.seq' file creation - the strict, but odd permissions resulted in a security alert from 110.neggrpperm PR: bin/165533 Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/lpr/lpr/lpr.c Directory Properties: stable/9/usr.sbin/lpr/ (props changed) Modified: stable/9/usr.sbin/lpr/lpr/lpr.c ============================================================================== --- stable/9/usr.sbin/lpr/lpr/lpr.c Wed Jun 6 06:35:47 2012 (r236662) +++ stable/9/usr.sbin/lpr/lpr/lpr.c Wed Jun 6 06:38:56 2012 (r236663) @@ -846,7 +846,7 @@ mktemps(const struct printer *pp) (void) snprintf(buf, sizeof(buf), "%s/.seq", pp->spool_dir); seteuid(euid); - if ((fd = open(buf, O_RDWR|O_CREAT, 0661)) < 0) { + if ((fd = open(buf, O_RDWR|O_CREAT, 0664)) < 0) { printf("%s: cannot create %s\n", progname, buf); exit(1); } From owner-svn-src-stable-9@FreeBSD.ORG Wed Jun 6 12:16:54 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A33A31065677; Wed, 6 Jun 2012 12:16:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C1068FC0C; Wed, 6 Jun 2012 12:16:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q56CGs3w013385; Wed, 6 Jun 2012 12:16:54 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56CGsZ5013381; Wed, 6 Jun 2012 12:16:54 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206061216.q56CGsZ5013381@svn.freebsd.org> From: Alexander Motin Date: Wed, 6 Jun 2012 12:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236677 - stable/9/sys/cam/scsi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 12:16:54 -0000 Author: mav Date: Wed Jun 6 12:16:54 2012 New Revision: 236677 URL: http://svn.freebsd.org/changeset/base/236677 Log: MFC r230053: Add BIO_DELETE support for SCSI Direct Access devices (da). Depending on device capabilities use different methods to implement it. Currently used method can be read/set via kern.cam.da.X.delete_method sysctls. Possible values are: NONE - no provisioning support reported by the device; DISABLE - provisioning support was disabled because of errors; ZERO - use WRITE SAME (10) command to write zeroes; WS10 - use WRITE SAME (10) command with UNMAP bit set; WS16 - use WRITE SAME (16) command with UNMAP bit set; UNMAP - use UNMAP command (equivalent of the ATA DSM TRIM command). The last two methods (UNMAP and WS16) are defined by SBC specification and the UNMAP method is the most advanced one. The rest of methods I've found supported in Linux, and as soon as they were trivial to implement, then why not? Hope they will be useful in some cases. Unluckily I have no devices properly reporting parameters of the logical block provisioning support via respective VPD pages (0xB0 and 0xB2). So all info I have/use now is the flag telling whether logical block provisioning is supported or not. As result, specific methods chosen now by trying different ones in order (UNMAP, WS16, DISABLE) and checking completion status to fallback if needed. I don't expect problems from this, as if something go wrong, it should just disable itself. It may disable even too aggressively if only some command parameter misfit. Unlike Linux, which executes each delete with separate request, I've implemented here the same request aggregation as implemented in ada driver. Tests on SSDs I have show much better results doing it this way: above 8GB/s of the linear delete on Intel SATA SSD on LSI SAS HBA (mps). Sponsored by: iXsystems, Inc. Modified: stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Wed Jun 6 12:13:20 2012 (r236676) +++ stable/9/sys/cam/scsi/scsi_all.c Wed Jun 6 12:16:54 2012 (r236677) @@ -364,6 +364,8 @@ static struct op_table_entry scsi_op_cod { 0x40, D | T | L | P | W | R | O | M | S | C, "CHANGE DEFINITION" }, /* 41 O WRITE SAME(10) */ { 0x41, D, "WRITE SAME(10)" }, + /* 42 O UNMAP */ + { 0x42, D, "UNMAP" }, /* 42 O READ SUB-CHANNEL */ { 0x42, R, "READ SUB-CHANNEL" }, /* 43 O READ TOC/PMA/ATIP */ @@ -5570,6 +5572,104 @@ scsi_read_write(struct ccb_scsiio *csio, } void +scsi_write_same(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + int minimum_cmd_size, u_int64_t lba, u_int32_t block_count, + u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout) +{ + u_int8_t cdb_len; + if ((minimum_cmd_size < 16) && + ((block_count & 0xffff) == block_count) && + ((lba & 0xffffffff) == lba)) { + /* + * Need a 10 byte cdb. + */ + struct scsi_write_same_10 *scsi_cmd; + + scsi_cmd = (struct scsi_write_same_10 *)&csio->cdb_io.cdb_bytes; + scsi_cmd->opcode = WRITE_SAME_10; + scsi_cmd->byte2 = byte2; + scsi_ulto4b(lba, scsi_cmd->addr); + scsi_cmd->group = 0; + scsi_ulto2b(block_count, scsi_cmd->length); + scsi_cmd->control = 0; + cdb_len = sizeof(*scsi_cmd); + + CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, + ("10byte: %x%x%x%x:%x%x: %d\n", scsi_cmd->addr[0], + scsi_cmd->addr[1], scsi_cmd->addr[2], + scsi_cmd->addr[3], scsi_cmd->length[0], + scsi_cmd->length[1], dxfer_len)); + } else { + /* + * 16 byte CDB. We'll only get here if the LBA is larger + * than 2^32, or if the user asks for a 16 byte command. + */ + struct scsi_write_same_16 *scsi_cmd; + + scsi_cmd = (struct scsi_write_same_16 *)&csio->cdb_io.cdb_bytes; + scsi_cmd->opcode = WRITE_SAME_16; + scsi_cmd->byte2 = byte2; + scsi_u64to8b(lba, scsi_cmd->addr); + scsi_ulto4b(block_count, scsi_cmd->length); + scsi_cmd->group = 0; + scsi_cmd->control = 0; + cdb_len = sizeof(*scsi_cmd); + + CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, + ("16byte: %x%x%x%x%x%x%x%x:%x%x%x%x: %d\n", + scsi_cmd->addr[0], scsi_cmd->addr[1], + scsi_cmd->addr[2], scsi_cmd->addr[3], + scsi_cmd->addr[4], scsi_cmd->addr[5], + scsi_cmd->addr[6], scsi_cmd->addr[7], + scsi_cmd->length[0], scsi_cmd->length[1], + scsi_cmd->length[2], scsi_cmd->length[3], + dxfer_len)); + } + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_OUT, + tag_action, + data_ptr, + dxfer_len, + sense_len, + cdb_len, + timeout); +} + +void +scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + u_int8_t *data_ptr, u_int16_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout) +{ + struct scsi_unmap *scsi_cmd; + + scsi_cmd = (struct scsi_unmap *)&csio->cdb_io.cdb_bytes; + scsi_cmd->opcode = UNMAP; + scsi_cmd->byte2 = byte2; + scsi_ulto4b(0, scsi_cmd->reserved); + scsi_cmd->group = 0; + scsi_ulto2b(dxfer_len, scsi_cmd->length); + scsi_cmd->control = 0; + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_OUT, + tag_action, + data_ptr, + dxfer_len, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + +void scsi_receive_diagnostic_results(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), uint8_t tag_action, int pcv, uint8_t page_code, Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Wed Jun 6 12:13:20 2012 (r236676) +++ stable/9/sys/cam/scsi/scsi_all.h Wed Jun 6 12:16:54 2012 (r236677) @@ -819,6 +819,41 @@ struct scsi_rw_16 u_int8_t control; }; +struct scsi_write_same_10 +{ + uint8_t opcode; + uint8_t byte2; +#define SWS_LBDATA 0x02 +#define SWS_PBDATA 0x04 +#define SWS_UNMAP 0x08 +#define SWS_ANCHOR 0x10 + uint8_t addr[4]; + uint8_t group; + uint8_t length[2]; + uint8_t control; +}; + +struct scsi_write_same_16 +{ + uint8_t opcode; + uint8_t byte2; + uint8_t addr[8]; + uint8_t length[4]; + uint8_t group; + uint8_t control; +}; + +struct scsi_unmap +{ + uint8_t opcode; + uint8_t byte2; +#define SU_ANCHOR 0x01 + uint8_t reserved[4]; + uint8_t group; + uint8_t length[2]; + uint8_t control; +}; + struct scsi_write_verify_10 { uint8_t opcode; @@ -957,6 +992,8 @@ struct ata_pass_16 { #define WRITE_BUFFER 0x3B #define READ_BUFFER 0x3C #define CHANGE_DEFINITION 0x40 +#define WRITE_SAME_10 0x41 +#define UNMAP 0x42 #define LOG_SELECT 0x4C #define LOG_SENSE 0x4D #define MODE_SELECT_10 0x55 @@ -970,6 +1007,7 @@ struct ata_pass_16 { #define WRITE_16 0x8A #define WRITE_VERIFY_16 0x8E #define SYNCHRONIZE_CACHE_16 0x91 +#define WRITE_SAME_16 0x93 #define SERVICE_ACTION_IN 0x9E #define REPORT_LUNS 0xA0 #define ATA_PASS_12 0xA1 @@ -2312,6 +2350,20 @@ void scsi_read_write(struct ccb_scsiio * u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); +void scsi_write_same(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + int minimum_cmd_size, u_int64_t lba, + u_int32_t block_count, u_int8_t *data_ptr, + u_int32_t dxfer_len, u_int8_t sense_len, + u_int32_t timeout); + +void scsi_unmap(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + u_int8_t tag_action, u_int8_t byte2, + u_int8_t *data_ptr, u_int16_t dxfer_len, + u_int8_t sense_len, u_int32_t timeout); + void scsi_start_stop(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int start, int load_eject, Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Wed Jun 6 12:13:20 2012 (r236676) +++ stable/9/sys/cam/scsi/scsi_da.c Wed Jun 6 12:16:54 2012 (r236677) @@ -83,8 +83,7 @@ typedef enum { DA_FLAG_RETRY_UA = 0x080, DA_FLAG_OPEN = 0x100, DA_FLAG_SCTX_INIT = 0x200, - DA_FLAG_CAN_RC16 = 0x400, - DA_FLAG_CAN_LBPME = 0x800 + DA_FLAG_CAN_RC16 = 0x400 } da_flags; typedef enum { @@ -101,10 +100,24 @@ typedef enum { DA_CCB_BUFFER_IO = 0x03, DA_CCB_WAITING = 0x04, DA_CCB_DUMP = 0x05, + DA_CCB_DELETE = 0x06, DA_CCB_TYPE_MASK = 0x0F, DA_CCB_RETRY_UA = 0x10 } da_ccb_state; +typedef enum { + DA_DELETE_NONE, + DA_DELETE_DISABLE, + DA_DELETE_ZERO, + DA_DELETE_WS10, + DA_DELETE_WS16, + DA_DELETE_UNMAP, + DA_DELETE_MAX = DA_DELETE_UNMAP +} da_delete_methods; + +static const char *da_delete_method_names[] = + { "NONE", "DISABLE", "ZERO", "WS10", "WS16", "UNMAP" }; + /* Offsets into our private area for storing information */ #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 @@ -119,8 +132,12 @@ struct disk_params { u_int stripeoffset; }; +#define UNMAP_MAX_RANGES 512 + struct da_softc { struct bio_queue_head bio_queue; + struct bio_queue_head delete_queue; + struct bio_queue_head delete_run_queue; SLIST_ENTRY(da_softc) links; LIST_HEAD(, ccb_hdr) pending_ccbs; da_state state; @@ -130,6 +147,10 @@ struct da_softc { int error_inject; int ordered_tag_count; int outstanding_cmds; + int unmap_max_ranges; + int unmap_max_lba; + int delete_running; + da_delete_methods delete_method; struct disk_params params; struct disk *disk; union ccb saved_ccb; @@ -138,6 +159,7 @@ struct da_softc { struct sysctl_oid *sysctl_tree; struct callout sendordered_c; uint64_t wwpn; + uint8_t unmap_buf[UNMAP_MAX_RANGES * 16 + 8]; }; struct da_quirk_entry { @@ -817,6 +839,7 @@ static void daasync(void *callback_arg, struct cam_path *path, void *arg); static void dasysctlinit(void *context, int pending); static int dacmdsizesysctl(SYSCTL_HANDLER_ARGS); +static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS); static periph_ctor_t daregister; static periph_dtor_t dacleanup; static periph_start_t dastart; @@ -937,6 +960,10 @@ daopen(struct disk *dp) softc->disk->d_fwheads = softc->params.heads; softc->disk->d_devstat->block_size = softc->params.secsize; softc->disk->d_devstat->flags &= ~DEVSTAT_BS_UNAVAILABLE; + if (softc->delete_method > DA_DELETE_DISABLE) + softc->disk->d_flags |= DISKFLAG_CANDELETE; + else + softc->disk->d_flags &= ~DISKFLAG_CANDELETE; if ((softc->flags & DA_FLAG_PACK_REMOVABLE) != 0 && (softc->quirks & DA_Q_NO_PREVENT) == 0) @@ -1034,6 +1061,26 @@ daclose(struct disk *dp) return (0); } +static void +daschedule(struct cam_periph *periph) +{ + struct da_softc *softc = (struct da_softc *)periph->softc; + uint32_t prio; + + /* Check if cam_periph_getccb() was called. */ + prio = periph->immediate_priority; + + /* Check if we have more work to do. */ + if (bioq_first(&softc->bio_queue) || + (!softc->delete_running && bioq_first(&softc->delete_queue))) { + prio = CAM_PRIORITY_NORMAL; + } + + /* Schedule CCB if any of above is true. */ + if (prio != CAM_PRIORITY_NONE) + xpt_schedule(periph, prio); +} + /* * Actually translate the requested transfer into one the physical driver * can understand. The transfer is described by a buf and will include @@ -1066,12 +1113,18 @@ dastrategy(struct bio *bp) /* * Place it in the queue of disk activities for this disk */ - bioq_disksort(&softc->bio_queue, bp); + if (bp->bio_cmd == BIO_DELETE) { + if (bp->bio_bcount == 0) + biodone(bp); + else + bioq_disksort(&softc->delete_queue, bp); + } else + bioq_disksort(&softc->bio_queue, bp); /* * Schedule ourselves for performing the work. */ - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + daschedule(periph); cam_periph_unlock(periph); return; @@ -1234,6 +1287,7 @@ daoninvalidate(struct cam_periph *periph * with XPT_ABORT_CCB. */ bioq_flush(&softc->bio_queue, NULL, ENXIO); + bioq_flush(&softc->delete_queue, NULL, ENXIO); disk_gone(softc->disk); xpt_print(periph->path, "lost device - %d outstanding, %d refs\n", @@ -1379,6 +1433,10 @@ dasysctlinit(void *context, int pending) * the fly. */ SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "delete_method", CTLTYPE_STRING | CTLFLAG_RW, + &softc->delete_method, 0, dadeletemethodsysctl, "A", + "BIO_DELETE execution method"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "minimum_cmd_size", CTLTYPE_INT | CTLFLAG_RW, &softc->minimum_cmd_size, 0, dacmdsizesysctl, "I", "Minimum CDB size"); @@ -1452,6 +1510,32 @@ dacmdsizesysctl(SYSCTL_HANDLER_ARGS) return (0); } +static int +dadeletemethodsysctl(SYSCTL_HANDLER_ARGS) +{ + char buf[16]; + int error; + const char *p; + int i, value; + + value = *(int *)arg1; + if (value < 0 || value > DA_DELETE_MAX) + p = "UNKNOWN"; + else + p = da_delete_method_names[value]; + strncpy(buf, p, sizeof(buf)); + error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + if (error != 0 || req->newptr == NULL) + return (error); + for (i = 0; i <= DA_DELETE_MAX; i++) { + if (strcmp(buf, da_delete_method_names[i]) != 0) + continue; + *(int *)arg1 = i; + return (0); + } + return (EINVAL); +} + static cam_status daregister(struct cam_periph *periph, void *arg) { @@ -1484,10 +1568,14 @@ daregister(struct cam_periph *periph, vo LIST_INIT(&softc->pending_ccbs); softc->state = DA_STATE_PROBE; bioq_init(&softc->bio_queue); + bioq_init(&softc->delete_queue); + bioq_init(&softc->delete_run_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= DA_FLAG_PACK_REMOVABLE; if ((cgd->inq_data.flags & SID_CmdQue) != 0) softc->flags |= DA_FLAG_TAGGED_QUEUING; + softc->unmap_max_ranges = UNMAP_MAX_RANGES; + softc->unmap_max_lba = 1024*1024*2; periph->softc = softc; @@ -1640,13 +1728,10 @@ dastart(struct cam_periph *periph, union switch (softc->state) { case DA_STATE_NORMAL: { - /* Pull a buffer from the queue and get going on it */ - struct bio *bp; + struct bio *bp, *bp1; + uint8_t tag_code; - /* - * See if there is a buf with work for us to do.. - */ - bp = bioq_first(&softc->bio_queue); + /* Execute immediate CCB if waiting. */ if (periph->immediate_priority <= periph->pinfo.priority) { CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); @@ -1655,84 +1740,186 @@ dastart(struct cam_periph *periph, union periph_links.sle); periph->immediate_priority = CAM_PRIORITY_NONE; wakeup(&periph->ccb_list); - } else if (bp == NULL) { - xpt_release_ccb(start_ccb); - } else { - u_int8_t tag_code; + /* May have more work to do, so ensure we stay scheduled */ + daschedule(periph); + break; + } - bioq_remove(&softc->bio_queue, bp); + /* Run BIO_DELETE if not running yet. */ + if (!softc->delete_running && + (bp = bioq_first(&softc->delete_queue)) != NULL) { + uint64_t lba; + u_int count; + + if (softc->delete_method == DA_DELETE_UNMAP) { + uint8_t *buf = softc->unmap_buf; + uint64_t lastlba = (uint64_t)-1; + uint32_t lastcount = 0; + int blocks = 0, off, ranges = 0; + + softc->delete_running = 1; + bzero(softc->unmap_buf, sizeof(softc->unmap_buf)); + bp1 = bp; + do { + bioq_remove(&softc->delete_queue, bp1); + if (bp1 != bp) + bioq_insert_tail(&softc->delete_run_queue, bp1); + lba = bp1->bio_pblkno; + count = bp1->bio_bcount / softc->params.secsize; + + /* Try to extend the previous range. */ + if (lba == lastlba) { + lastcount += count; + off = (ranges - 1) * 16 + 8; + scsi_ulto4b(lastcount, &buf[off + 8]); + } else if (count > 0) { + off = ranges * 16 + 8; + scsi_u64to8b(lba, &buf[off + 0]); + scsi_ulto4b(count, &buf[off + 8]); + lastcount = count; + ranges++; + } + blocks += count; + lastlba = lba + count; + bp1 = bioq_first(&softc->delete_queue); + if (bp1 == NULL || + ranges >= softc->unmap_max_ranges || + blocks + bp1->bio_bcount / + softc->params.secsize > softc->unmap_max_lba) + break; + } while (1); + scsi_ulto2b(count * 16 + 6, &buf[0]); + scsi_ulto2b(count * 16, &buf[2]); + + scsi_unmap(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*byte2*/0, + /*data_ptr*/ buf, + /*dxfer_len*/ count * 16 + 8, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; + goto out; + } else if (softc->delete_method == DA_DELETE_ZERO || + softc->delete_method == DA_DELETE_WS10 || + softc->delete_method == DA_DELETE_WS16) { + softc->delete_running = 1; + lba = bp->bio_pblkno; + count = 0; + bp1 = bp; + do { + bioq_remove(&softc->delete_queue, bp1); + if (bp1 != bp) + bioq_insert_tail(&softc->delete_run_queue, bp1); + count += bp1->bio_bcount / softc->params.secsize; + bp1 = bioq_first(&softc->delete_queue); + if (bp1 == NULL || + lba + count != bp1->bio_pblkno || + count + bp1->bio_bcount / + softc->params.secsize > 0xffff) + break; + } while (1); + + scsi_write_same(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*byte2*/softc->delete_method == + DA_DELETE_ZERO ? 0 : SWS_UNMAP, + softc->delete_method == + DA_DELETE_WS16 ? 16 : 10, + /*lba*/lba, + /*block_count*/count, + /*data_ptr*/ __DECONST(void *, + zero_region), + /*dxfer_len*/ softc->params.secsize, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; + goto out; + } else { + bioq_flush(&softc->delete_queue, NULL, 0); + /* FALLTHROUGH */ + } + } - if ((bp->bio_flags & BIO_ORDERED) != 0 - || (softc->flags & DA_FLAG_NEED_OTAG) != 0) { - softc->flags &= ~DA_FLAG_NEED_OTAG; - softc->ordered_tag_count++; - tag_code = MSG_ORDERED_Q_TAG; - } else { - tag_code = MSG_SIMPLE_Q_TAG; - } - switch (bp->bio_cmd) { - case BIO_READ: - case BIO_WRITE: - scsi_read_write(&start_ccb->csio, - /*retries*/da_retry_count, - /*cbfcnp*/dadone, - /*tag_action*/tag_code, - /*read_op*/bp->bio_cmd - == BIO_READ, - /*byte2*/0, - softc->minimum_cmd_size, - /*lba*/bp->bio_pblkno, - /*block_count*/bp->bio_bcount / - softc->params.secsize, - /*data_ptr*/ bp->bio_data, - /*dxfer_len*/ bp->bio_bcount, - /*sense_len*/SSD_FULL_SIZE, - da_default_timeout * 1000); - break; - case BIO_FLUSH: - /* - * BIO_FLUSH doesn't currently communicate - * range data, so we synchronize the cache - * over the whole disk. We also force - * ordered tag semantics the flush applies - * to all previously queued I/O. - */ - scsi_synchronize_cache(&start_ccb->csio, - /*retries*/1, - /*cbfcnp*/dadone, - MSG_ORDERED_Q_TAG, - /*begin_lba*/0, - /*lb_count*/0, - SSD_FULL_SIZE, - da_default_timeout*1000); - break; - } - start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO; + /* Run regular command. */ + bp = bioq_takefirst(&softc->bio_queue); + if (bp == NULL) { + xpt_release_ccb(start_ccb); + break; + } + + if ((bp->bio_flags & BIO_ORDERED) != 0 || + (softc->flags & DA_FLAG_NEED_OTAG) != 0) { + softc->flags &= ~DA_FLAG_NEED_OTAG; + softc->ordered_tag_count++; + tag_code = MSG_ORDERED_Q_TAG; + } else { + tag_code = MSG_SIMPLE_Q_TAG; + } + switch (bp->bio_cmd) { + case BIO_READ: + case BIO_WRITE: + scsi_read_write(&start_ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/tag_code, + /*read_op*/bp->bio_cmd + == BIO_READ, + /*byte2*/0, + softc->minimum_cmd_size, + /*lba*/bp->bio_pblkno, + /*block_count*/bp->bio_bcount / + softc->params.secsize, + /*data_ptr*/ bp->bio_data, + /*dxfer_len*/ bp->bio_bcount, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + break; + case BIO_FLUSH: /* - * Block out any asyncronous callbacks - * while we touch the pending ccb list. + * BIO_FLUSH doesn't currently communicate + * range data, so we synchronize the cache + * over the whole disk. We also force + * ordered tag semantics the flush applies + * to all previously queued I/O. */ - LIST_INSERT_HEAD(&softc->pending_ccbs, - &start_ccb->ccb_h, periph_links.le); - softc->outstanding_cmds++; - - /* We expect a unit attention from this device */ - if ((softc->flags & DA_FLAG_RETRY_UA) != 0) { - start_ccb->ccb_h.ccb_state |= DA_CCB_RETRY_UA; - softc->flags &= ~DA_FLAG_RETRY_UA; - } - - start_ccb->ccb_h.ccb_bp = bp; - bp = bioq_first(&softc->bio_queue); - - xpt_action(start_ccb); + scsi_synchronize_cache(&start_ccb->csio, + /*retries*/1, + /*cbfcnp*/dadone, + MSG_ORDERED_Q_TAG, + /*begin_lba*/0, + /*lb_count*/0, + SSD_FULL_SIZE, + da_default_timeout*1000); + break; } - - if (bp != NULL) { - /* Have more work to do, so ensure we stay scheduled */ - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO; + +out: + /* + * Block out any asyncronous callbacks + * while we touch the pending ccb list. + */ + LIST_INSERT_HEAD(&softc->pending_ccbs, + &start_ccb->ccb_h, periph_links.le); + softc->outstanding_cmds++; + + /* We expect a unit attention from this device */ + if ((softc->flags & DA_FLAG_RETRY_UA) != 0) { + start_ccb->ccb_h.ccb_state |= DA_CCB_RETRY_UA; + softc->flags &= ~DA_FLAG_RETRY_UA; } + + start_ccb->ccb_h.ccb_bp = bp; + xpt_action(start_ccb); + + /* May have more work to do, so ensure we stay scheduled */ + daschedule(periph); break; } case DA_STATE_PROBE: @@ -1798,9 +1985,42 @@ cmd6workaround(union ccb *ccb) struct scsi_rw_10 *cmd10; struct da_softc *softc; u_int8_t *cdb; + struct bio *bp; int frozen; cdb = ccb->csio.cdb_io.cdb_bytes; + softc = (struct da_softc *)xpt_path_periph(ccb->ccb_h.path)->softc; + + if (ccb->ccb_h.ccb_state == DA_CCB_DELETE) { + if (softc->delete_method == DA_DELETE_UNMAP) { + xpt_print(ccb->ccb_h.path, "UNMAP is not supported, " + "switching to WRITE SAME(16) with UNMAP.\n"); + softc->delete_method = DA_DELETE_WS16; + } else if (softc->delete_method == DA_DELETE_WS16) { + xpt_print(ccb->ccb_h.path, + "WRITE SAME(16) with UNMAP is not supported, " + "disabling BIO_DELETE.\n"); + softc->delete_method = DA_DELETE_DISABLE; + } else if (softc->delete_method == DA_DELETE_WS10) { + xpt_print(ccb->ccb_h.path, + "WRITE SAME(10) with UNMAP is not supported, " + "disabling BIO_DELETE.\n"); + softc->delete_method = DA_DELETE_DISABLE; + } else if (softc->delete_method == DA_DELETE_ZERO) { + xpt_print(ccb->ccb_h.path, + "WRITE SAME(10) is not supported, " + "disabling BIO_DELETE.\n"); + softc->delete_method = DA_DELETE_DISABLE; + } else + softc->delete_method = DA_DELETE_DISABLE; + while ((bp = bioq_takefirst(&softc->delete_run_queue)) + != NULL) + bioq_disksort(&softc->delete_queue, bp); + bioq_insert_tail(&softc->delete_queue, + (struct bio *)ccb->ccb_h.ccb_bp); + ccb->ccb_h.ccb_bp = NULL; + return (0); + } /* Translation only possible if CDB is an array and cmd is R/W6 */ if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0 || @@ -1809,8 +2029,7 @@ cmd6workaround(union ccb *ccb) xpt_print(ccb->ccb_h.path, "READ(6)/WRITE(6) not supported, " "increasing minimum_cmd_size to 10.\n"); - softc = (struct da_softc *)xpt_path_periph(ccb->ccb_h.path)->softc; - softc->minimum_cmd_size = 10; + softc->minimum_cmd_size = 10; bcopy(cdb, &cmd6, sizeof(struct scsi_rw_6)); cmd10 = (struct scsi_rw_10 *)cdb; @@ -1848,8 +2067,9 @@ dadone(struct cam_periph *periph, union csio = &done_ccb->csio; switch (csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) { case DA_CCB_BUFFER_IO: + case DA_CCB_DELETE: { - struct bio *bp; + struct bio *bp, *bp1; bp = (struct bio *)done_ccb->ccb_h.ccb_bp; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { @@ -1869,6 +2089,7 @@ dadone(struct cam_periph *periph, union */ return; } + bp = (struct bio *)done_ccb->ccb_h.ccb_bp; if (error != 0) { int queued_error; @@ -1896,10 +2117,12 @@ dadone(struct cam_periph *periph, union } bioq_flush(&softc->bio_queue, NULL, queued_error); - bp->bio_error = error; - bp->bio_resid = bp->bio_bcount; - bp->bio_flags |= BIO_ERROR; - } else { + if (bp != NULL) { + bp->bio_error = error; + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; + } + } else if (bp != NULL) { bp->bio_resid = csio->resid; bp->bio_error = 0; if (bp->bio_resid != 0) @@ -1911,7 +2134,7 @@ dadone(struct cam_periph *periph, union /*reduction*/0, /*timeout*/0, /*getcount_only*/0); - } else { + } else if (bp != NULL) { if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) panic("REQ_CMP with QFRZN"); bp->bio_resid = csio->resid; @@ -1940,7 +2163,22 @@ dadone(struct cam_periph *periph, union softc->outstanding_cmds); } - biodone(bp); + if ((csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) == + DA_CCB_DELETE) { + while ((bp1 = bioq_takefirst(&softc->delete_run_queue)) + != NULL) { + bp1->bio_resid = bp->bio_resid; + bp1->bio_error = bp->bio_error; + if (bp->bio_flags & BIO_ERROR) + bp1->bio_flags |= BIO_ERROR; + biodone(bp1); + } + softc->delete_running = 0; + if (bp != NULL) + biodone(bp); + daschedule(periph); + } else if (bp != NULL) + biodone(bp); break; } case DA_CCB_PROBE: @@ -2010,10 +2248,9 @@ dadone(struct cam_periph *periph, union } else { dasetgeom(periph, block_size, maxsector, lbppbe, lalba & SRC16_LALBA); - if (lalba & SRC16_LBPME) - softc->flags |= DA_FLAG_CAN_LBPME; - else - softc->flags &= ~DA_FLAG_CAN_LBPME; + if ((lalba & SRC16_LBPME) && + softc->delete_method == DA_DELETE_NONE) + softc->delete_method = DA_DELETE_UNMAP; dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), "%juMB (%ju %u byte sectors: %dH %dS/T " @@ -2400,10 +2637,9 @@ done: } else { dasetgeom(periph, block_len, maxsector, lbppbe, lalba & SRC16_LALBA); - if (lalba & SRC16_LBPME) - softc->flags |= DA_FLAG_CAN_LBPME; - else - softc->flags &= ~DA_FLAG_CAN_LBPME; + if ((lalba & SRC16_LBPME) && + softc->delete_method == DA_DELETE_NONE) + softc->delete_method = DA_DELETE_UNMAP; } } From owner-svn-src-stable-9@FreeBSD.ORG Wed Jun 6 16:00:31 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C57BE1065673; Wed, 6 Jun 2012 16:00:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF3098FC12; Wed, 6 Jun 2012 16:00:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q56G0VbG023864; Wed, 6 Jun 2012 16:00:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56G0Vc0023859; Wed, 6 Jun 2012 16:00:31 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206061600.q56G0Vc0023859@svn.freebsd.org> From: John Baldwin Date: Wed, 6 Jun 2012 16:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236683 - in stable/9: share/man/man9 sys/kern sys/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 16:00:32 -0000 Author: jhb Date: Wed Jun 6 16:00:31 2012 New Revision: 236683 URL: http://svn.freebsd.org/changeset/base/236683 Log: MFC 228509,228620,228533: Add a helper API to allow in-kernel code to map portions of shared memory objects created by shm_open(2) into the kernel's address space. This provides a convenient way for creating shared memory buffers between userland and the kernel without requiring custom character devices. Added: stable/9/share/man/man9/shm_map.9 - copied, changed from r228509, head/share/man/man9/shm_map.9 Modified: stable/9/share/man/man9/Makefile stable/9/sys/kern/uipc_shm.c stable/9/sys/sys/mman.h Directory Properties: stable/9/share/man/man9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/share/man/man9/Makefile ============================================================================== --- stable/9/share/man/man9/Makefile Wed Jun 6 15:29:27 2012 (r236682) +++ stable/9/share/man/man9/Makefile Wed Jun 6 16:00:31 2012 (r236683) @@ -237,6 +237,7 @@ MAN= accept_filter.9 \ sema.9 \ sf_buf.9 \ sglist.9 \ + shm_map.9 \ signal.9 \ sleep.9 \ sleepqueue.9 \ @@ -1156,6 +1157,7 @@ MLINKS+=sglist.9 sglist_alloc.9 \ sglist.9 sglist_reset.9 \ sglist.9 sglist_slice.9 \ sglist.9 sglist_split.9 +MLINKS+=shm_map.9 shm_unmap.9 MLINKS+=signal.9 cursig.9 \ signal.9 execsigs.9 \ signal.9 issignal.9 \ Copied and modified: stable/9/share/man/man9/shm_map.9 (from r228509, head/share/man/man9/shm_map.9) ============================================================================== --- head/share/man/man9/shm_map.9 Wed Dec 14 22:22:19 2011 (r228509, copy source) +++ stable/9/share/man/man9/shm_map.9 Wed Jun 6 16:00:31 2012 (r236683) @@ -30,9 +30,8 @@ .Dt SHM_MAP 9 .Os .Sh NAME -.Nm shm_map , -.Nm shm_unmap -.Nd map shared memory objects into the kernel's address space +.Nm shm_map , shm_unmap +.Nd "map shared memory objects into the kernel's address space" .Sh SYNOPSIS .In sys/types.h .In sys/mman.h @@ -42,9 +41,9 @@ .Fn shm_unmap "struct file *fp" "void *mem" "size_t size" .Sh DESCRIPTION The -.Nm shm_map +.Fn shm_map and -.Nm shm_unmap +.Fn shm_unmap functions provide an API for mapping shared memory objects into the kernel. Shared memory objects are created by .Xr shm_open 2 . @@ -57,13 +56,13 @@ Shared memory objects can still be grown .Pp To simplify the accounting needed to enforce the above requirement, callers of this API are required to unmap the entire region mapped by -.Nm shm_map +.Fn shm_map when calling -.Nm shm_unmap . +.Fn shm_unmap . Unmapping only a portion of the region is not permitted. .Pp The -.Nm shm_map +.Fn shm_map function locates the shared memory object associated with the open file .Fa fp . It maps the region of that object described by @@ -77,9 +76,9 @@ will be set to the start of the mapping. All pages for the range will be wired into memory upon successful return. .Pp The -.Nm shm_unmap +.Fn shm_unmap function unmaps a region previously mapped by -.Nm shm_map . +.Fn shm_map . The .Fa mem argument should match the value previously returned in @@ -87,22 +86,22 @@ argument should match the value previous and the .Fa size argument should match the value passed to -.Nm shm_map . +.Fn shm_map . .Pp Note that -.Nm shm_map +.Fn shm_map will not hold an extra reference on the open file .Fa fp for the lifetime of the mapping. Instead, the calling code is required to do this if it wishes to use -.Nm shm_unmap +.Fn shm_unmap on the region in the future. .Sh RETURN VALUES The -.Nm shm_map +.Fn shm_map and -.Nm shm_unmap +.Fn shm_unmap functions return zero on success or an error on failure. .Sh EXAMPLES The following function accepts a file descriptor for a shared memory @@ -110,7 +109,7 @@ object. It maps the first sixteen kilobytes of the object into the kernel, performs some work on that address, and then unmaps the address before returning. -.Bd -literal +.Bd -literal -offset indent int shm_example(int fd) { @@ -118,7 +117,7 @@ shm_example(int fd) void *mem; int error; - error = fget(curthread, fd, CAP_MMAP, &fp) + error = fget(curthread, fd, CAP_MMAP, &fp); if (error) return (error); error = shm_map(fp, 16384, 0, &mem); @@ -136,7 +135,7 @@ shm_example(int fd) .Ed .Sh ERRORS The -.Nm shm_map +.Fn shm_map function returns the following errors on failure: .Bl -tag -width Er .It Bq Er EINVAL @@ -158,7 +157,7 @@ The shared memory object could not be ma .El .Pp The -.Nm shm_unmap +.Fn shm_unmap function returns the following errors on failure: .Bl -tag -width Er .It Bq Er EINVAL Modified: stable/9/sys/kern/uipc_shm.c ============================================================================== --- stable/9/sys/kern/uipc_shm.c Wed Jun 6 15:29:27 2012 (r236682) +++ stable/9/sys/kern/uipc_shm.c Wed Jun 6 16:00:31 2012 (r236683) @@ -74,7 +74,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -260,6 +262,14 @@ shm_dotruncate(struct shmfd *shmfd, off_ /* Are we shrinking? If so, trim the end. */ if (length < shmfd->shm_size) { + /* + * Disallow any requests to shrink the size if this + * object is mapped into the kernel. + */ + if (shmfd->shm_kmappings > 0) { + VM_OBJECT_UNLOCK(object); + return (EBUSY); + } /* * Zero the truncated part of the last page. @@ -732,3 +742,105 @@ out: mtx_unlock(&shm_timestamp_lock); return (error); } + +/* + * Helper routines to allow the backing object of a shared memory file + * descriptor to be mapped in the kernel. + */ +int +shm_map(struct file *fp, size_t size, off_t offset, void **memp) +{ + struct shmfd *shmfd; + vm_offset_t kva, ofs; + vm_object_t obj; + int rv; + + if (fp->f_type != DTYPE_SHM) + return (EINVAL); + shmfd = fp->f_data; + obj = shmfd->shm_object; + VM_OBJECT_LOCK(obj); + /* + * XXXRW: This validation is probably insufficient, and subject to + * sign errors. It should be fixed. + */ + if (offset >= shmfd->shm_size || + offset + size > round_page(shmfd->shm_size)) { + VM_OBJECT_UNLOCK(obj); + return (EINVAL); + } + + shmfd->shm_kmappings++; + vm_object_reference_locked(obj); + VM_OBJECT_UNLOCK(obj); + + /* Map the object into the kernel_map and wire it. */ + kva = vm_map_min(kernel_map); + ofs = offset & PAGE_MASK; + offset = trunc_page(offset); + size = round_page(size + ofs); + rv = vm_map_find(kernel_map, obj, offset, &kva, size, + VMFS_ALIGNED_SPACE, VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE, 0); + if (rv == KERN_SUCCESS) { + rv = vm_map_wire(kernel_map, kva, kva + size, + VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); + if (rv == KERN_SUCCESS) { + *memp = (void *)(kva + ofs); + return (0); + } + vm_map_remove(kernel_map, kva, kva + size); + } else + vm_object_deallocate(obj); + + /* On failure, drop our mapping reference. */ + VM_OBJECT_LOCK(obj); + shmfd->shm_kmappings--; + VM_OBJECT_UNLOCK(obj); + + return (vm_mmap_to_errno(rv)); +} + +/* + * We require the caller to unmap the entire entry. This allows us to + * safely decrement shm_kmappings when a mapping is removed. + */ +int +shm_unmap(struct file *fp, void *mem, size_t size) +{ + struct shmfd *shmfd; + vm_map_entry_t entry; + vm_offset_t kva, ofs; + vm_object_t obj; + vm_pindex_t pindex; + vm_prot_t prot; + boolean_t wired; + vm_map_t map; + int rv; + + if (fp->f_type != DTYPE_SHM) + return (EINVAL); + shmfd = fp->f_data; + kva = (vm_offset_t)mem; + ofs = kva & PAGE_MASK; + kva = trunc_page(kva); + size = round_page(size + ofs); + map = kernel_map; + rv = vm_map_lookup(&map, kva, VM_PROT_READ | VM_PROT_WRITE, &entry, + &obj, &pindex, &prot, &wired); + if (rv != KERN_SUCCESS) + return (EINVAL); + if (entry->start != kva || entry->end != kva + size) { + vm_map_lookup_done(map, entry); + return (EINVAL); + } + vm_map_lookup_done(map, entry); + if (obj != shmfd->shm_object) + return (EINVAL); + vm_map_remove(map, kva, kva + size); + VM_OBJECT_LOCK(obj); + KASSERT(shmfd->shm_kmappings > 0, ("shm_unmap: object not mapped")); + shmfd->shm_kmappings--; + VM_OBJECT_UNLOCK(obj); + return (0); +} Modified: stable/9/sys/sys/mman.h ============================================================================== --- stable/9/sys/sys/mman.h Wed Jun 6 15:29:27 2012 (r236682) +++ stable/9/sys/sys/mman.h Wed Jun 6 16:00:31 2012 (r236683) @@ -181,6 +181,8 @@ typedef __size_t size_t; #ifdef _KERNEL #include +struct file; + struct shmfd { size_t shm_size; vm_object_t shm_object; @@ -188,6 +190,7 @@ struct shmfd { uid_t shm_uid; gid_t shm_gid; mode_t shm_mode; + int shm_kmappings; /* * Values maintained solely to make this a better-behaved file @@ -203,6 +206,8 @@ struct shmfd { int shm_mmap(struct shmfd *shmfd, vm_size_t objsize, vm_ooffset_t foff, vm_object_t *obj); +int shm_map(struct file *fp, size_t size, off_t offset, void **memp); +int shm_unmap(struct file *fp, void *mem, size_t size); #else /* !_KERNEL */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Jun 6 18:00:25 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ECA951065670; Wed, 6 Jun 2012 18:00:25 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44F678FC19; Wed, 6 Jun 2012 18:00:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q56I0KGI029820; Wed, 6 Jun 2012 18:00:20 GMT (envelope-from oleg@svn.freebsd.org) Received: (from oleg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56I0Kem029818; Wed, 6 Jun 2012 18:00:20 GMT (envelope-from oleg@svn.freebsd.org) Message-Id: <201206061800.q56I0Kem029818@svn.freebsd.org> From: Oleg Bulyzhin Date: Wed, 6 Jun 2012 18:00:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236692 - stable/9/sys/netinet/ipfw X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 18:00:26 -0000 Author: oleg Date: Wed Jun 6 18:00:19 2012 New Revision: 236692 URL: http://svn.freebsd.org/changeset/base/236692 Log: MFC: r232272, r232273 - lookup_dyn_rule_locked(): style(9) cleanup - Refresh dynamic tcp rule only if both sides answered keepalive packets. - Remove some useless assignments. Modified: stable/9/sys/netinet/ipfw/ip_fw_dynamic.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/9/sys/netinet/ipfw/ip_fw_dynamic.c Wed Jun 6 17:28:46 2012 (r236691) +++ stable/9/sys/netinet/ipfw/ip_fw_dynamic.c Wed Jun 6 18:00:19 2012 (r236692) @@ -390,72 +390,68 @@ ipfw_remove_dyn_children(struct ip_fw *r IPFW_DYN_UNLOCK(); } -/** - * lookup a dynamic rule, locked version +/* + * Lookup a dynamic rule, locked version. */ static ipfw_dyn_rule * lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction, struct tcphdr *tcp) { /* - * stateful ipfw extensions. - * Lookup into dynamic session queue + * Stateful ipfw extensions. + * Lookup into dynamic session queue. */ #define MATCH_REVERSE 0 #define MATCH_FORWARD 1 #define MATCH_NONE 2 #define MATCH_UNKNOWN 3 int i, dir = MATCH_NONE; - ipfw_dyn_rule *prev, *q=NULL; + ipfw_dyn_rule *prev, *q = NULL; IPFW_DYN_LOCK_ASSERT(); if (V_ipfw_dyn_v == NULL) - goto done; /* not found */ - i = hash_packet( pkt ); - for (prev=NULL, q = V_ipfw_dyn_v[i] ; q != NULL ; ) { + goto done; /* not found */ + i = hash_packet(pkt); + for (prev = NULL, q = V_ipfw_dyn_v[i]; q != NULL;) { if (q->dyn_type == O_LIMIT_PARENT && q->count) goto next; - if (TIME_LEQ( q->expire, time_uptime)) { /* expire entry */ + if (TIME_LEQ(q->expire, time_uptime)) { /* expire entry */ UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q); continue; } - if (pkt->proto == q->id.proto && - q->dyn_type != O_LIMIT_PARENT) { - if (IS_IP6_FLOW_ID(pkt)) { - if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), - &(q->id.src_ip6)) && - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), - &(q->id.dst_ip6)) && + if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT) + goto next; + + if (IS_IP6_FLOW_ID(pkt)) { + if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.src_ip6) && + IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.dst_ip6) && pkt->src_port == q->id.src_port && - pkt->dst_port == q->id.dst_port ) { + pkt->dst_port == q->id.dst_port) { + dir = MATCH_FORWARD; + break; + } + if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.dst_ip6) && + IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.src_ip6) && + pkt->src_port == q->id.dst_port && + pkt->dst_port == q->id.src_port) { + dir = MATCH_REVERSE; + break; + } + } else { + if (pkt->src_ip == q->id.src_ip && + pkt->dst_ip == q->id.dst_ip && + pkt->src_port == q->id.src_port && + pkt->dst_port == q->id.dst_port) { dir = MATCH_FORWARD; break; - } - if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), - &(q->id.dst_ip6)) && - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), - &(q->id.src_ip6)) && - pkt->src_port == q->id.dst_port && - pkt->dst_port == q->id.src_port ) { - dir = MATCH_REVERSE; - break; - } - } else { - if (pkt->src_ip == q->id.src_ip && - pkt->dst_ip == q->id.dst_ip && - pkt->src_port == q->id.src_port && - pkt->dst_port == q->id.dst_port ) { - dir = MATCH_FORWARD; - break; - } - if (pkt->src_ip == q->id.dst_ip && - pkt->dst_ip == q->id.src_ip && - pkt->src_port == q->id.dst_port && - pkt->dst_port == q->id.src_port ) { - dir = MATCH_REVERSE; - break; - } + } + if (pkt->src_ip == q->id.dst_ip && + pkt->dst_ip == q->id.src_ip && + pkt->src_port == q->id.dst_port && + pkt->dst_port == q->id.src_port) { + dir = MATCH_REVERSE; + break; } } next: @@ -463,45 +459,55 @@ next: q = q->next; } if (q == NULL) - goto done; /* q = NULL, not found */ + goto done; /* q = NULL, not found */ - if ( prev != NULL) { /* found and not in front */ + if (prev != NULL) { /* found and not in front */ prev->next = q->next; q->next = V_ipfw_dyn_v[i]; V_ipfw_dyn_v[i] = q; } if (pkt->proto == IPPROTO_TCP) { /* update state according to flags */ - u_char flags = pkt->_flags & (TH_FIN|TH_SYN|TH_RST); + uint32_t ack; + u_char flags = pkt->_flags & (TH_FIN | TH_SYN | TH_RST); #define BOTH_SYN (TH_SYN | (TH_SYN << 8)) #define BOTH_FIN (TH_FIN | (TH_FIN << 8)) - q->state |= (dir == MATCH_FORWARD ) ? flags : (flags << 8); - switch (q->state) { - case TH_SYN: /* opening */ +#define TCP_FLAGS (TH_FLAGS | (TH_FLAGS << 8)) +#define ACK_FWD 0x10000 /* fwd ack seen */ +#define ACK_REV 0x20000 /* rev ack seen */ + + q->state |= (dir == MATCH_FORWARD) ? flags : (flags << 8); + switch (q->state & TCP_FLAGS) { + case TH_SYN: /* opening */ q->expire = time_uptime + V_dyn_syn_lifetime; break; case BOTH_SYN: /* move to established */ - case BOTH_SYN | TH_FIN : /* one side tries to close */ - case BOTH_SYN | (TH_FIN << 8) : - if (tcp) { + case BOTH_SYN | TH_FIN: /* one side tries to close */ + case BOTH_SYN | (TH_FIN << 8): #define _SEQ_GE(a,b) ((int)(a) - (int)(b) >= 0) - u_int32_t ack = ntohl(tcp->th_ack); - if (dir == MATCH_FORWARD) { - if (q->ack_fwd == 0 || _SEQ_GE(ack, q->ack_fwd)) - q->ack_fwd = ack; - else { /* ignore out-of-sequence */ - break; + if (tcp == NULL) + break; + + ack = ntohl(tcp->th_ack); + if (dir == MATCH_FORWARD) { + if (q->ack_fwd == 0 || + _SEQ_GE(ack, q->ack_fwd)) { + q->ack_fwd = ack; + q->state |= ACK_FWD; } - } else { - if (q->ack_rev == 0 || _SEQ_GE(ack, q->ack_rev)) - q->ack_rev = ack; - else { /* ignore out-of-sequence */ - break; + } else { + if (q->ack_rev == 0 || + _SEQ_GE(ack, q->ack_rev)) { + q->ack_rev = ack; + q->state |= ACK_REV; } - } } - q->expire = time_uptime + V_dyn_ack_lifetime; + if ((q->state & (ACK_FWD | ACK_REV)) == + (ACK_FWD | ACK_REV)) { + q->expire = time_uptime + V_dyn_ack_lifetime; + q->state &= ~(ACK_FWD | ACK_REV); + } break; case BOTH_SYN | BOTH_FIN: /* both sides closed */ @@ -531,9 +537,9 @@ next: q->expire = time_uptime + V_dyn_short_lifetime; } done: - if (match_direction) + if (match_direction != NULL) *match_direction = dir; - return q; + return (q); } ipfw_dyn_rule * @@ -1076,10 +1082,12 @@ ipfw_tick(void * vnetx) if (TIME_LEQ(q->expire, time_uptime)) continue; /* too late, rule expired */ - m = ipfw_send_pkt(NULL, &(q->id), q->ack_rev - 1, - q->ack_fwd, TH_SYN); - mnext = ipfw_send_pkt(NULL, &(q->id), q->ack_fwd - 1, - q->ack_rev, 0); + m = (q->state & ACK_REV) ? NULL : + ipfw_send_pkt(NULL, &(q->id), q->ack_rev - 1, + q->ack_fwd, TH_SYN); + mnext = (q->state & ACK_FWD) ? NULL : + ipfw_send_pkt(NULL, &(q->id), q->ack_fwd - 1, + q->ack_rev, 0); switch (q->id.addr_type) { case 4: @@ -1105,18 +1113,16 @@ ipfw_tick(void * vnetx) break; #endif } - - m = mnext = NULL; } } IPFW_DYN_UNLOCK(); - for (m = mnext = m0; m != NULL; m = mnext) { + for (m = m0; m != NULL; m = mnext) { mnext = m->m_nextpkt; m->m_nextpkt = NULL; ip_output(m, NULL, NULL, 0, NULL, NULL); } #ifdef INET6 - for (m = mnext = m6; m != NULL; m = mnext) { + for (m = m6; m != NULL; m = mnext) { mnext = m->m_nextpkt; m->m_nextpkt = NULL; ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL); From owner-svn-src-stable-9@FreeBSD.ORG Wed Jun 6 21:49:32 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7587E1065677; Wed, 6 Jun 2012 21:49:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D9268FC12; Wed, 6 Jun 2012 21:49:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q56LnWWf040385; Wed, 6 Jun 2012 21:49:32 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56LnWO0040374; Wed, 6 Jun 2012 21:49:32 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206062149.q56LnWO0040374@svn.freebsd.org> From: John Baldwin Date: Wed, 6 Jun 2012 21:49:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236698 - in stable/9: lib/libprocstat sys/kern sys/sys usr.bin/fstat usr.bin/procstat X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 21:49:32 -0000 Author: jhb Date: Wed Jun 6 21:49:31 2012 New Revision: 236698 URL: http://svn.freebsd.org/changeset/base/236698 Log: MFC 233760: Export some more useful info about shared memory objects to userland via procstat(1) and fstat(1): - Change shm file descriptors to track the pathname they are associated with and add a shm_path() method to copy the path out to a caller-supplied buffer. - Use the fo_stat() method of shared memory objects and shm_path() to export the path, mode, and size of a shared memory object via struct kinfo_file. - Add a struct shmstat to the libprocstat(3) interface along with a procstat_get_shm_info() to export the mode and size of a shared memory object. - Change procstat to always print out the path for a given object if it is valid. - Teach fstat about shared memory objects and to display their path, mode, and size. Modified: stable/9/lib/libprocstat/Symbol.map stable/9/lib/libprocstat/Versions.def stable/9/lib/libprocstat/libprocstat.3 stable/9/lib/libprocstat/libprocstat.c stable/9/lib/libprocstat/libprocstat.h stable/9/sys/kern/kern_descrip.c stable/9/sys/kern/uipc_shm.c stable/9/sys/sys/mman.h stable/9/usr.bin/fstat/fstat.c stable/9/usr.bin/procstat/procstat_files.c Directory Properties: stable/9/lib/libprocstat/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) stable/9/usr.bin/fstat/ (props changed) stable/9/usr.bin/procstat/ (props changed) Modified: stable/9/lib/libprocstat/Symbol.map ============================================================================== --- stable/9/lib/libprocstat/Symbol.map Wed Jun 6 21:42:22 2012 (r236697) +++ stable/9/lib/libprocstat/Symbol.map Wed Jun 6 21:49:31 2012 (r236698) @@ -14,3 +14,7 @@ FBSD_1.2 { procstat_open_kvm; procstat_open_sysctl; }; + +FBSD_1.3 { + procstat_get_shm_info; +}; Modified: stable/9/lib/libprocstat/Versions.def ============================================================================== --- stable/9/lib/libprocstat/Versions.def Wed Jun 6 21:42:22 2012 (r236697) +++ stable/9/lib/libprocstat/Versions.def Wed Jun 6 21:49:31 2012 (r236698) @@ -3,3 +3,8 @@ # This version was first added to 9.0-current. FBSD_1.2 { }; + +# This version was first added to 10.0-current. +FBSD_1.3 { +} FBSD_1.2; + Modified: stable/9/lib/libprocstat/libprocstat.3 ============================================================================== --- stable/9/lib/libprocstat/libprocstat.3 Wed Jun 6 21:42:22 2012 (r236697) +++ stable/9/lib/libprocstat/libprocstat.3 Wed Jun 6 21:49:31 2012 (r236698) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 12, 2011 +.Dd April 1, 2012 .Dt LIBPROCSTAT 3 .Os .Sh NAME @@ -37,6 +37,7 @@ .Nm procstat_freeprocs , .Nm procstat_get_pipe_info , .Nm procstat_get_pts_info , +.Nm procstat_get_shm_info , .Nm procstat_get_socket_info , .Nm procstat_get_vnode_info .Nd library interface for file and process information retrieval @@ -70,6 +71,13 @@ .Fa "char *errbuf" .Fc .Ft int +.Fo procstat_get_shm_info +.Fa "struct procstat *procstat" +.Fa "struct filestat *fst" +.Fa "struct shmstat *shm" +.Fa "char *errbuf" +.Fc +.Ft int .Fo procstat_get_socket_info .Fa "struct procstat *procstat" .Fa "struct filestat *fst" @@ -191,10 +199,12 @@ function call. The .Fn procstat_get_pipe_info , .Fn procstat_get_pts_info , +.Fn procstat_get_shm_info , .Fn procstat_get_socket_info and .Fn procstat_get_vnode_info functions are used to retrieve information about pipes, pseudo-terminals, +shared memory objects, sockets, and vnodes, respectively. Each of them have a similar interface API. The @@ -231,11 +241,14 @@ argument indicates an actual error messa .Nm procstat_get_pipe_info .It Li PS_FST_TYPE_PTS .Nm procstat_get_pts_info +.It Li PS_FST_TYPE_SHM +.Nm procstat_get_shm_info .El .Sh SEE ALSO .Xr fstat 1 , .Xr fuser 1 , .Xr pipe 2 , +.Xr shm_open 2 , .Xr socket 2 , .Xr kvm 3 , .Xr queue 3 , Modified: stable/9/lib/libprocstat/libprocstat.c ============================================================================== --- stable/9/lib/libprocstat/libprocstat.c Wed Jun 6 21:42:22 2012 (r236697) +++ stable/9/lib/libprocstat/libprocstat.c Wed Jun 6 21:49:31 2012 (r236698) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #define _WANT_FILE #include #include +#include #define _KERNEL #include #include @@ -114,6 +115,10 @@ static int procstat_get_pts_info_sysctl( struct ptsstat *pts, char *errbuf); static int procstat_get_pts_info_kvm(kvm_t *kd, struct filestat *fst, struct ptsstat *pts, char *errbuf); +static int procstat_get_shm_info_sysctl(struct filestat *fst, + struct shmstat *shm, char *errbuf); +static int procstat_get_shm_info_kvm(kvm_t *kd, struct filestat *fst, + struct shmstat *shm, char *errbuf); static int procstat_get_socket_info_sysctl(struct filestat *fst, struct sockstat *sock, char *errbuf); static int procstat_get_socket_info_kvm(kvm_t *kd, struct filestat *fst, @@ -469,6 +474,10 @@ procstat_getfiles_kvm(struct procstat *p data = file.f_data; break; #endif + case DTYPE_SHM: + type = PS_FST_TYPE_SHM; + data = file.f_data; + break; default: continue; } @@ -849,6 +858,69 @@ procstat_get_pts_info_sysctl(struct file } int +procstat_get_shm_info(struct procstat *procstat, struct filestat *fst, + struct shmstat *shm, char *errbuf) +{ + + assert(shm); + if (procstat->type == PROCSTAT_KVM) { + return (procstat_get_shm_info_kvm(procstat->kd, fst, shm, + errbuf)); + } else if (procstat->type == PROCSTAT_SYSCTL) { + return (procstat_get_shm_info_sysctl(fst, shm, errbuf)); + } else { + warnx("unknown access method: %d", procstat->type); + snprintf(errbuf, _POSIX2_LINE_MAX, "error"); + return (1); + } +} + +static int +procstat_get_shm_info_kvm(kvm_t *kd, struct filestat *fst, + struct shmstat *shm, char *errbuf) +{ + struct shmfd shmfd; + void *shmfdp; + + assert(kd); + assert(shm); + assert(fst); + bzero(shm, sizeof(*shm)); + shmfdp = fst->fs_typedep; + if (shmfdp == NULL) + goto fail; + if (!kvm_read_all(kd, (unsigned long)shmfdp, &shmfd, + sizeof(struct shmfd))) { + warnx("can't read shmfd at %p", (void *)shmfdp); + goto fail; + } + shm->mode = S_IFREG | shmfd.shm_mode; + shm->size = shmfd.shm_size; + return (0); + +fail: + snprintf(errbuf, _POSIX2_LINE_MAX, "error"); + return (1); +} + +static int +procstat_get_shm_info_sysctl(struct filestat *fst, struct shmstat *shm, + char *errbuf __unused) +{ + struct kinfo_file *kif; + + assert(shm); + assert(fst); + bzero(shm, sizeof(*shm)); + kif = fst->fs_typedep; + if (kif == NULL) + return (0); + shm->size = kif->kf_un.kf_file.kf_file_size; + shm->mode = kif->kf_un.kf_file.kf_file_mode; + return (0); +} + +int procstat_get_vnode_info(struct procstat *procstat, struct filestat *fst, struct vnstat *vn, char *errbuf) { Modified: stable/9/lib/libprocstat/libprocstat.h ============================================================================== --- stable/9/lib/libprocstat/libprocstat.h Wed Jun 6 21:42:22 2012 (r236697) +++ stable/9/lib/libprocstat/libprocstat.h Wed Jun 6 21:49:31 2012 (r236698) @@ -123,6 +123,10 @@ struct pipestat { uint64_t addr; uint64_t peer; }; +struct shmstat { + uint64_t size; + uint16_t mode; +}; struct sockstat { uint64_t inp_ppcb; uint64_t so_addr; @@ -152,6 +156,8 @@ int procstat_get_pipe_info(struct procst struct pipestat *pipe, char *errbuf); int procstat_get_pts_info(struct procstat *procstat, struct filestat *fst, struct ptsstat *pts, char *errbuf); +int procstat_get_shm_info(struct procstat *procstat, struct filestat *fst, + struct shmstat *shm, char *errbuf); int procstat_get_socket_info(struct procstat *procstat, struct filestat *fst, struct sockstat *sock, char *errbuf); int procstat_get_vnode_info(struct procstat *procstat, struct filestat *fst, Modified: stable/9/sys/kern/kern_descrip.c ============================================================================== --- stable/9/sys/kern/kern_descrip.c Wed Jun 6 21:42:22 2012 (r236697) +++ stable/9/sys/kern/kern_descrip.c Wed Jun 6 21:49:31 2012 (r236698) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -126,6 +127,7 @@ static int fill_pts_info(struct tty *tp, static int fill_pipe_info(struct pipe *pi, struct kinfo_file *kif); static int fill_procdesc_info(struct procdesc *pdp, struct kinfo_file *kif); +static int fill_shm_info(struct file *fp, struct kinfo_file *kif); /* * A process is initially started out with NDFILE descriptors stored within @@ -2958,6 +2960,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE struct kinfo_ofile *kif; struct filedesc *fdp; int error, i, *name; + struct shmfd *shmfd; struct socket *so; struct vnode *vp; struct file *fp; @@ -2995,6 +2998,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE vp = NULL; so = NULL; tp = NULL; + shmfd = NULL; kif->kf_fd = i; #ifdef CAPABILITIES @@ -3046,6 +3050,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE case DTYPE_SHM: kif->kf_type = KF_TYPE_SHM; + shmfd = fp->f_data; break; case DTYPE_SEM: @@ -3159,6 +3164,8 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE strlcpy(kif->kf_path, tty_devname(tp), sizeof(kif->kf_path)); } + if (shmfd != NULL) + shm_path(shmfd, kif->kf_path, sizeof(kif->kf_path)); error = SYSCTL_OUT(req, kif, sizeof(*kif)); if (error) break; @@ -3229,6 +3236,9 @@ export_fd_for_sysctl(void *data, int typ case KF_TYPE_PROCDESC: error = fill_procdesc_info((struct procdesc *)data, kif); break; + case KF_TYPE_SHM: + error = fill_shm_info((struct file *)data, kif); + break; default: error = 0; } @@ -3398,6 +3408,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER case DTYPE_SHM: type = KF_TYPE_SHM; + data = fp; break; case DTYPE_SEM: @@ -3621,6 +3632,23 @@ fill_procdesc_info(struct procdesc *pdp, return (0); } +static int +fill_shm_info(struct file *fp, struct kinfo_file *kif) +{ + struct thread *td; + struct stat sb; + + td = curthread; + if (fp->f_data == NULL) + return (1); + if (fo_stat(fp, &sb, td->td_ucred, td) != 0) + return (1); + shm_path(fp->f_data, kif->kf_path, sizeof(kif->kf_path)); + kif->kf_un.kf_file.kf_file_mode = sb.st_mode; + kif->kf_un.kf_file.kf_file_size = sb.st_size; + return (0); +} + static SYSCTL_NODE(_kern_proc, KERN_PROC_FILEDESC, filedesc, CTLFLAG_RD, sysctl_kern_proc_filedesc, "Process filedesc entries"); Modified: stable/9/sys/kern/uipc_shm.c ============================================================================== --- stable/9/sys/kern/uipc_shm.c Wed Jun 6 21:42:22 2012 (r236697) +++ stable/9/sys/kern/uipc_shm.c Wed Jun 6 21:49:31 2012 (r236698) @@ -468,6 +468,7 @@ shm_insert(char *path, Fnv32_t fnv, stru map->sm_path = path; map->sm_fnv = fnv; map->sm_shmfd = shm_hold(shmfd); + shmfd->shm_path = path; LIST_INSERT_HEAD(SHM_HASH(fnv), map, sm_link); } @@ -490,6 +491,7 @@ shm_remove(char *path, Fnv32_t fnv, stru FREAD | FWRITE); if (error) return (error); + map->sm_shmfd->shm_path = NULL; LIST_REMOVE(map, sm_link); shm_drop(map->sm_shmfd); free(map->sm_path, M_SHMFD); @@ -844,3 +846,15 @@ shm_unmap(struct file *fp, void *mem, si VM_OBJECT_UNLOCK(obj); return (0); } + +void +shm_path(struct shmfd *shmfd, char *path, size_t size) +{ + + if (shmfd->shm_path == NULL) + return; + sx_slock(&shm_dict_lock); + if (shmfd->shm_path != NULL) + strlcpy(path, shmfd->shm_path, size); + sx_sunlock(&shm_dict_lock); +} Modified: stable/9/sys/sys/mman.h ============================================================================== --- stable/9/sys/sys/mman.h Wed Jun 6 21:42:22 2012 (r236697) +++ stable/9/sys/sys/mman.h Wed Jun 6 21:49:31 2012 (r236698) @@ -178,7 +178,7 @@ typedef __size_t size_t; #define _SIZE_T_DECLARED #endif -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_WANT_FILE) #include struct file; @@ -202,12 +202,16 @@ struct shmfd { struct timespec shm_birthtime; struct label *shm_label; /* MAC label */ + const char *shm_path; }; +#endif +#ifdef _KERNEL int shm_mmap(struct shmfd *shmfd, vm_size_t objsize, vm_ooffset_t foff, vm_object_t *obj); int shm_map(struct file *fp, size_t size, off_t offset, void **memp); int shm_unmap(struct file *fp, void *mem, size_t size); +void shm_path(struct shmfd *shmfd, char *path, size_t size); #else /* !_KERNEL */ Modified: stable/9/usr.bin/fstat/fstat.c ============================================================================== --- stable/9/usr.bin/fstat/fstat.c Wed Jun 6 21:42:22 2012 (r236697) +++ stable/9/usr.bin/fstat/fstat.c Wed Jun 6 21:49:31 2012 (r236698) @@ -84,6 +84,8 @@ static void print_pipe_info(struct procs struct filestat *fst); static void print_pts_info(struct procstat *procstat, struct filestat *fst); +static void print_shm_info(struct procstat *procstat, + struct filestat *fst); static void print_socket_info(struct procstat *procstat, struct filestat *fst); static void print_vnode_info(struct procstat *procstat, @@ -289,6 +291,9 @@ print_file_info(struct procstat *procsta case PS_FST_TYPE_PTS: print_pts_info(procstat, fst); break; + case PS_FST_TYPE_SHM: + print_shm_info(procstat, fst); + break; default: if (vflg) fprintf(stderr, @@ -419,6 +424,30 @@ print_pts_info(struct procstat *procstat } static void +print_shm_info(struct procstat *procstat, struct filestat *fst) +{ + struct shmstat shm; + char errbuf[_POSIX2_LINE_MAX]; + char mode[15]; + int error; + + error = procstat_get_shm_info(procstat, fst, &shm, errbuf); + if (error != 0) { + printf("* error"); + return; + } + if (nflg) { + printf(" "); + (void)snprintf(mode, sizeof(mode), "%o", shm.mode); + } else { + printf(" %-15s", fst->fs_path != NULL ? fst->fs_path : "-"); + strmode(shm.mode, mode); + } + printf(" %10s %6ju", mode, shm.size); + print_access_flags(fst->fs_fflags); +} + +static void print_vnode_info(struct procstat *procstat, struct filestat *fst) { struct vnstat vn; Modified: stable/9/usr.bin/procstat/procstat_files.c ============================================================================== --- stable/9/usr.bin/procstat/procstat_files.c Wed Jun 6 21:42:22 2012 (r236697) +++ stable/9/usr.bin/procstat/procstat_files.c Wed Jun 6 21:49:31 2012 (r236698) @@ -440,13 +440,6 @@ procstat_files(struct procstat *procstat printf(" "); } switch (fst->fs_type) { - case PS_FST_TYPE_VNODE: - case PS_FST_TYPE_FIFO: - case PS_FST_TYPE_PTS: - printf("%-3s ", "-"); - printf("%-18s", fst->fs_path != NULL ? fst->fs_path : "-"); - break; - case PS_FST_TYPE_SOCKET: error = procstat_get_socket_info(procstat, fst, &sock, NULL); if (error != 0) @@ -477,7 +470,8 @@ procstat_files(struct procstat *procstat break; default: - printf("%-18s", "-"); + printf("%-3s ", "-"); + printf("%-18s", fst->fs_path != NULL ? fst->fs_path : "-"); } printf("\n"); From owner-svn-src-stable-9@FreeBSD.ORG Thu Jun 7 05:35:44 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FCB11065781; Thu, 7 Jun 2012 05:35:44 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D59FA8FC0A; Thu, 7 Jun 2012 05:35:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q575ZhK3062679; Thu, 7 Jun 2012 05:35:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q575ZhbP062677; Thu, 7 Jun 2012 05:35:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201206070535.q575ZhbP062677@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 7 Jun 2012 05:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236702 - stable/9/sys/dev/bge X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2012 05:35:44 -0000 Author: yongari Date: Thu Jun 7 05:35:43 2012 New Revision: 236702 URL: http://svn.freebsd.org/changeset/base/236702 Log: MFC r236371: Remove unnecessary device_printfs. Modified: stable/9/sys/dev/bge/if_bge.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/bge/if_bge.c ============================================================================== --- stable/9/sys/dev/bge/if_bge.c Thu Jun 7 03:22:20 2012 (r236701) +++ stable/9/sys/dev/bge/if_bge.c Thu Jun 7 05:35:43 2012 (r236702) @@ -2800,17 +2800,9 @@ bge_mbox_reorder(struct bge_softc *sc) for (;;) { dev = device_get_parent(bus); bus = device_get_parent(dev); - device_printf(sc->bge_dev, "dev : %s%d, bus : %s%d\n", - device_get_name(dev), device_get_unit(dev), - device_get_name(bus), device_get_unit(bus)); if (device_get_devclass(dev) != pcib) break; for (i = 0; i < nitems(mbox_reorder_lists); i++) { - device_printf(sc->bge_dev, - "probing dev : %s%d, vendor : 0x%04x " - "device : 0x%04x\n", - device_get_name(dev), device_get_unit(dev), - pci_get_vendor(dev), pci_get_device(dev)); if (pci_get_vendor(dev) == mbox_reorder_lists[i].vendor && pci_get_device(dev) == From owner-svn-src-stable-9@FreeBSD.ORG Thu Jun 7 06:41:10 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E92A106566B; Thu, 7 Jun 2012 06:41:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 296FF8FC14; Thu, 7 Jun 2012 06:41:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q576fAsX065719; Thu, 7 Jun 2012 06:41:10 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q576f9P4065717; Thu, 7 Jun 2012 06:41:09 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206070641.q576f9P4065717@svn.freebsd.org> From: Dimitry Andric Date: Thu, 7 Jun 2012 06:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236704 - stable/9/sys/dev/aic7xxx/aicasm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2012 06:41:10 -0000 Author: dim Date: Thu Jun 7 06:41:09 2012 New Revision: 236704 URL: http://svn.freebsd.org/changeset/base/236704 Log: MFC r236571: Make aicasm compile without warnings if -Wpointer-sign is enabled. Modified: stable/9/sys/dev/aic7xxx/aicasm/aicasm.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/aic7xxx/aicasm/aicasm.c ============================================================================== --- stable/9/sys/dev/aic7xxx/aicasm/aicasm.c Thu Jun 7 05:37:46 2012 (r236703) +++ stable/9/sys/dev/aic7xxx/aicasm/aicasm.c Thu Jun 7 06:41:09 2012 (r236704) @@ -530,7 +530,7 @@ output_listing(char *ifilename) int instrptr; unsigned int line; int func_count; - int skip_addr; + unsigned int skip_addr; instrcount = 0; instrptr = 0; From owner-svn-src-stable-9@FreeBSD.ORG Thu Jun 7 18:44:07 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 031B7106564A; Thu, 7 Jun 2012 18:44:07 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E18238FC12; Thu, 7 Jun 2012 18:44:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q57Ii6Xw004921; Thu, 7 Jun 2012 18:44:06 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q57Ii6Iq004919; Thu, 7 Jun 2012 18:44:06 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201206071844.q57Ii6Iq004919@svn.freebsd.org> From: Sean Bruno Date: Thu, 7 Jun 2012 18:44:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236719 - stable/9/sys/dev/mfi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2012 18:44:07 -0000 Author: sbruno Date: Thu Jun 7 18:44:06 2012 New Revision: 236719 URL: http://svn.freebsd.org/changeset/base/236719 Log: MFC r236323 Cosmetic nit. If a configured volume has no label, don't emit an empty string for the name during probe. Simply indicate that it has no label. Modified: stable/9/sys/dev/mfi/mfi_disk.c Modified: stable/9/sys/dev/mfi/mfi_disk.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_disk.c Thu Jun 7 15:57:30 2012 (r236718) +++ stable/9/sys/dev/mfi/mfi_disk.c Thu Jun 7 18:44:06 2012 (r236719) @@ -130,10 +130,17 @@ mfi_disk_attach(device_t dev) state = "unknown"; break; } - device_printf(dev, "%juMB (%ju sectors) RAID volume '%s' is %s\n", - sectors / (1024 * 1024 / secsize), sectors, - ld_info->ld_config.properties.name, - state); + + if ( strlen(ld_info->ld_config.properties.name) == 0 ) { + device_printf(dev, + "%juMB (%ju sectors) RAID volume (no label) is %s\n", + sectors / (1024 * 1024 / secsize), sectors, state); + } else { + device_printf(dev, + "%juMB (%ju sectors) RAID volume '%s' is %s\n", + sectors / (1024 * 1024 / secsize), sectors, + ld_info->ld_config.properties.name, state); + } sc->ld_disk = disk_alloc(); sc->ld_disk->d_drv1 = sc; From owner-svn-src-stable-9@FreeBSD.ORG Thu Jun 7 18:58:59 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8F22106566B; Thu, 7 Jun 2012 18:58:59 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9EB08FC18; Thu, 7 Jun 2012 18:58:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q57IwxaG005699; Thu, 7 Jun 2012 18:58:59 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q57Iwxom005698; Thu, 7 Jun 2012 18:58:59 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201206071858.q57Iwxom005698@svn.freebsd.org> From: Sean Bruno Date: Thu, 7 Jun 2012 18:58:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236721 - in stable/9/sys: . dev X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2012 18:59:00 -0000 Author: sbruno Date: Thu Jun 7 18:58:59 2012 New Revision: 236721 URL: http://svn.freebsd.org/changeset/base/236721 Log: Update mergeinfo from r236323 that was missed in the code MFC commit at r236323 doh! Modified: Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) From owner-svn-src-stable-9@FreeBSD.ORG Thu Jun 7 19:12:50 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5E9D7106564A; Thu, 7 Jun 2012 19:12:50 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 476D58FC14; Thu, 7 Jun 2012 19:12:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q57JCou6006378; Thu, 7 Jun 2012 19:12:50 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q57JColM006377; Thu, 7 Jun 2012 19:12:50 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201206071912.q57JColM006377@svn.freebsd.org> From: Sean Bruno Date: Thu, 7 Jun 2012 19:12:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236722 - stable/9/share/man/man4 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2012 19:12:50 -0000 Author: sbruno Date: Thu Jun 7 19:12:49 2012 New Revision: 236722 URL: http://svn.freebsd.org/changeset/base/236722 Log: MFC r236412,236418,236420,236591,236624 Doc updates for bce(4) tuneables Note that for 7/8/9 the strict_rx_mtu variable is named loose_rx_mtu. Modified: stable/9/share/man/man4/bce.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/bce.4 ============================================================================== --- stable/9/share/man/man4/bce.4 Thu Jun 7 18:58:59 2012 (r236721) +++ stable/9/share/man/man4/bce.4 Thu Jun 7 19:12:49 2012 (r236722) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 7, 2009 +.Dd June 4, 2012 .Dt BCE 4 .Os .Sh NAME @@ -200,9 +200,73 @@ variables and .Xr loader 8 tunables: .Bl -tag -width indent +.It Va hw.bce.verbose +Enable/Disable verbose logging and output to the console. +Useful for debugging (default 0). .It Va hw.bce.msi_enable -Whether or not MSI support is enabled in the driver. -The default value is 1. +Enable/Disable MSI support (default 1). +.It Va hw.bce.tso_enable +Enable/Disable TSO support (default 1). +.It Va hw.bce.strict_rx_mtu +Enable/Disable strict RX frame size checking (default 0). +.It Va hw.bce.hdr_split +Enable/Disable frame header/payload splitting (default 1). +.It Va hw.bce.rx_pages +Set the number of memory pages assigned to recieve packets by the driver. +Due to alignment issues, this value can only be of the set +1, 2, 4 or 8 (default 2). +.It Va hw.bce.tx_pages +Set the number of memory pages assigned to transmit packets +by the driver. +Due to alignment issues, this value can only be of the set +1, 2, 4 or 8 (default 2). +.It Va hw.bce.rx_ticks +Time in microsecond ticks to wait before generating a status +block updates due to RX processing activity. +Values from 0-100 are valid. +A value of 0 disables this status block update. +Cannot be set to 0 if hw.bce.rx_quick_cons_trip is also 0 +(default 18). +.It Va hw.bce.rx_ticks_int +Time in microsecond ticks to wait during RX interrupt +processing before generating a status block update. +Values from 0-100 are valid. +Valid values are in the range from 0-100. +A value of 0 disables this status block update (default 18). +.It Va hw.bce.rx_quick_cons_trip +Number of RX Quick BD Chain entries that must be completed +before a status block is generated. +Values from 0-256 are valid. +A value of 0 disables this status block update. +Cannot be set to 0 if hw.bce.rx_ticks is also 0 (default 6). +.It Va hw.bce.rx_quick_cons_trip_int +Number of RX quick BD entries that must be completed before +a status block is generated duing interrupt processing. +Values from 0-256 are valid. +A value of 0 disables this status block update (default 6). +.It Va hw.bce.tx_ticks +Time in microsecond ticks to wait before a status block +update is generated due to TX activitiy. +Values from 0-100 are valid. +A value of 0 disables this status block update. +Cannot be set to 0 if hw.bce.tx_quick_cons_trip is also 0 +(default 80). +.It Va hw.bce.tx_ticks_int +Time in microsecond ticks to wait in interrupt processing +before a status block update is generated due to TX activity +Values from 0-100 are valid. +A value of 0 disables this status block update (default 80). +.It Va hw.bce.tx_cons_trip +How many TX Quick BD Chain entries that must be completed +before a status block is generated. +Values from 0-100 are valid. +A value of 0 disables this status block update. +Cannot be set to 0 if hw.bce.tx_ticks is also 0 (default 20). +.It Va hw.bce.tx_cons_trip_int +How many TX Quick BD Chain entries that must be completed +before a status block is generated during an interrupt. +Values from 0-100 are valid. +A value of 0 disables this status block update (default 20). .El .Sh DIAGNOSTICS .Bl -diag @@ -266,7 +330,7 @@ address space. .It "bce%d: Could not allocate TX descriptor chain DMA tag!" The driver could not allocate a DMA tag for the controller's TX chain. -.It "bce%d: Could not allocate TX descriptor chain DMA memory! +.It "bce%d: Could not allocate TX descriptor chain DMA memory!" The driver could not allocate DMA addressable memory for the controller's TX chain. .It "bce%d: Could not map TX descriptor chain DMA memory!" @@ -346,6 +410,10 @@ with the cable connection, or a driver l A controller hardware failure has occurred. If the problem continues replace the controller. .El +.Sh SUPPORT +For general information and support, +go to the Broadcom NIC Open Source Developer Resource Site: +.Pa http://www.broadcom.com/support/ethernet_nic/open_source.php . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , From owner-svn-src-stable-9@FreeBSD.ORG Fri Jun 8 05:53:25 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D55D31065673; Fri, 8 Jun 2012 05:53:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF9AA8FC19; Fri, 8 Jun 2012 05:53:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q585rPbs035648; Fri, 8 Jun 2012 05:53:25 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q585rPVO035646; Fri, 8 Jun 2012 05:53:25 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206080553.q585rPVO035646@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 05:53:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236734 - stable/9/sys/geom/multipath X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2012 05:53:25 -0000 Author: mav Date: Fri Jun 8 05:53:25 2012 New Revision: 236734 URL: http://svn.freebsd.org/changeset/base/236734 Log: MFC r236619: Add missing newlines into XML output. Modified: stable/9/sys/geom/multipath/g_multipath.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/9/sys/geom/multipath/g_multipath.c Fri Jun 8 01:51:49 2012 (r236733) +++ stable/9/sys/geom/multipath/g_multipath.c Fri Jun 8 05:53:25 2012 (r236734) @@ -1314,7 +1314,7 @@ g_multipath_dumpconf(struct sbuf *sb, co if (sc == NULL) return; if (cp != NULL) { - sbuf_printf(sb, "%s%s", indent, + sbuf_printf(sb, "%s%s\n", indent, (cp->index & MP_NEW) ? "NEW" : (cp->index & MP_LOST) ? "LOST" : (cp->index & MP_FAIL) ? "FAIL" : @@ -1323,17 +1323,17 @@ g_multipath_dumpconf(struct sbuf *sb, co sc->sc_active_active == 2 ? "READ" : "PASSIVE"); } else { good = g_multipath_good(gp); - sbuf_printf(sb, "%s%s", indent, + sbuf_printf(sb, "%s%s\n", indent, good == 0 ? "BROKEN" : (good != sc->sc_ndisks || sc->sc_ndisks == 1) ? "DEGRADED" : "OPTIMAL"); } if (cp == NULL && pp == NULL) { - sbuf_printf(sb, "%s%s", indent, sc->sc_uuid); - sbuf_printf(sb, "%sActive/%s", indent, + sbuf_printf(sb, "%s%s\n", indent, sc->sc_uuid); + sbuf_printf(sb, "%sActive/%s\n", indent, sc->sc_active_active == 2 ? "Read" : sc->sc_active_active == 1 ? "Active" : "Passive"); - sbuf_printf(sb, "%s%s", indent, + sbuf_printf(sb, "%s%s\n", indent, sc->sc_uuid[0] == 0 ? "MANUAL" : "AUTOMATIC"); } } From owner-svn-src-stable-9@FreeBSD.ORG Fri Jun 8 10:03:37 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3FAB1065670; Fri, 8 Jun 2012 10:03:37 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 958958FC17; Fri, 8 Jun 2012 10:03:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q58A3bGC047624; Fri, 8 Jun 2012 10:03:37 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58A3bF2047622; Fri, 8 Jun 2012 10:03:37 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201206081003.q58A3bF2047622@svn.freebsd.org> From: Max Khon Date: Fri, 8 Jun 2012 10:03:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236742 - stable/9/usr.bin/make X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2012 10:03:37 -0000 Author: fjoe Date: Fri Jun 8 10:03:37 2012 New Revision: 236742 URL: http://svn.freebsd.org/changeset/base/236742 Log: MFC: r231544 Include target names in diagnostic output. Submitted by: Garrett Cooper Modified: stable/9/usr.bin/make/job.c Directory Properties: stable/9/ (props changed) stable/9/usr.bin/ (props changed) stable/9/usr.bin/make/ (props changed) Modified: stable/9/usr.bin/make/job.c ============================================================================== --- stable/9/usr.bin/make/job.c Fri Jun 8 09:51:57 2012 (r236741) +++ stable/9/usr.bin/make/job.c Fri Jun 8 10:03:37 2012 (r236742) @@ -954,17 +954,19 @@ JobFinish(Job *job, int *status) lastNode = job->node; } fprintf(out, - "*** Completed successfully\n"); + "*** [%s] Completed successfully\n", + job->node->name); } } else { if (usePipes && job->node != lastNode) { MESSAGE(out, job->node); lastNode = job->node; } - fprintf(out, "*** Error code %d%s\n", + fprintf(out, "*** [%s] Error code %d%s\n", + job->node->name, WEXITSTATUS(*status), (job->flags & JOB_IGNERR) ? - "(ignored)" : ""); + " (ignored)" : ""); if (job->flags & JOB_IGNERR) { *status = 0; @@ -1005,7 +1007,8 @@ JobFinish(Job *job, int *status) MESSAGE(out, job->node); lastNode = job->node; } - fprintf(out, "*** Continued\n"); + fprintf(out, "*** [%s] Continued\n", + job->node->name); } if (!(job->flags & JOB_CONTINUING)) { DEBUGF(JOB, ("Warning: process %jd was not " @@ -1029,7 +1032,8 @@ JobFinish(Job *job, int *status) lastNode = job->node; } fprintf(out, - "*** Signal %d\n", WTERMSIG(*status)); + "*** [%s] Signal %d\n", job->node->name, + WTERMSIG(*status)); fflush(out); } } @@ -1056,7 +1060,8 @@ JobFinish(Job *job, int *status) MESSAGE(out, job->node); lastNode = job->node; } - fprintf(out, "*** Stopped -- signal %d\n", WSTOPSIG(*status)); + fprintf(out, "*** [%s] Stopped -- signal %d\n", + job->node->name, WSTOPSIG(*status)); job->flags |= JOB_RESUME; TAILQ_INSERT_TAIL(&stoppedJobs, job, link); fflush(out); @@ -3042,13 +3047,15 @@ Compat_RunCommand(char *cmd, GNode *gn) if (status == 0) { return (0); } else { - printf("*** Error code %d", status); + printf("*** [%s] Error code %d", + gn->name, status); } } else if (WIFSTOPPED(reason)) { status = WSTOPSIG(reason); } else { status = WTERMSIG(reason); - printf("*** Signal %d", status); + printf("*** [%s] Signal %d", + gn->name, status); } if (ps.errCheck) { From owner-svn-src-stable-9@FreeBSD.ORG Fri Jun 8 20:30:38 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0712B106566C; Fri, 8 Jun 2012 20:30:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E68108FC12; Fri, 8 Jun 2012 20:30:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q58KUbx1082284; Fri, 8 Jun 2012 20:30:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58KUbpM082282; Fri, 8 Jun 2012 20:30:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206082030.q58KUbpM082282@svn.freebsd.org> From: Alexander Motin Date: Fri, 8 Jun 2012 20:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236765 - stable/9/sys/cam/ata X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2012 20:30:38 -0000 Author: mav Date: Fri Jun 8 20:30:37 2012 New Revision: 236765 URL: http://svn.freebsd.org/changeset/base/236765 Log: MFC r235982: Add tunable/sysctl kern.cam.pmp.hide_special, controlling whether special PMP ports such as PMP configuration or SEMB should be exposed or hidden. These ports were always hidden before as useless and sometimes promatic. But with updated ses driver supporting SEMB it is no longer so straight. Keep ports hidden by default to avoid probe request ttimeouts if SEP is not connected to PMP's SEMB via I2C, that is very often situation. Modified: stable/9/sys/cam/ata/ata_pmp.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_pmp.c ============================================================================== --- stable/9/sys/cam/ata/ata_pmp.c Fri Jun 8 19:21:49 2012 (r236764) +++ stable/9/sys/cam/ata/ata_pmp.c Fri Jun 8 20:30:37 2012 (r236765) @@ -126,8 +126,13 @@ static void pmpdone(struct cam_periph * #define PMP_DEFAULT_RETRY 1 #endif +#ifndef PMP_DEFAULT_HIDE_SPECIAL +#define PMP_DEFAULT_HIDE_SPECIAL 1 +#endif + static int pmp_retry_count = PMP_DEFAULT_RETRY; static int pmp_default_timeout = PMP_DEFAULT_TIMEOUT; +static int pmp_hide_special = PMP_DEFAULT_HIDE_SPECIAL; SYSCTL_NODE(_kern_cam, OID_AUTO, pmp, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); @@ -137,6 +142,9 @@ TUNABLE_INT("kern.cam.pmp.retry_count", SYSCTL_INT(_kern_cam_pmp, OID_AUTO, default_timeout, CTLFLAG_RW, &pmp_default_timeout, 0, "Normal I/O timeout (in seconds)"); TUNABLE_INT("kern.cam.pmp.default_timeout", &pmp_default_timeout); +SYSCTL_INT(_kern_cam_pmp, OID_AUTO, hide_special, CTLFLAG_RW, + &pmp_hide_special, 0, "Hide extra ports"); +TUNABLE_INT("kern.cam.pmp.hide_special", &pmp_hide_special); static struct periph_driver pmpdriver = { @@ -583,23 +591,33 @@ pmpdone(struct cam_periph *periph, union (ataio->res.lba_mid << 16) + (ataio->res.lba_low << 8) + ataio->res.sector_count; - /* This PMP declares 6 ports, while only 5 of them are real. - * Port 5 is enclosure management bridge port, which has implementation - * problems, causing probe faults. Hide it for now. */ - if (softc->pm_pid == 0x37261095 && softc->pm_ports == 6) - softc->pm_ports = 5; - /* This PMP declares 7 ports, while only 5 of them are real. - * Port 5 is some fake "Config Disk" with 640 sectors size, - * port 6 is enclosure management bridge port. - * Both fake ports has implementation problems, causing - * probe faults. Hide them for now. */ - if (softc->pm_pid == 0x47261095 && softc->pm_ports == 7) - softc->pm_ports = 5; - /* These PMPs declare one more port then actually have, - * for configuration purposes. Hide it for now. */ - if (softc->pm_pid == 0x57231095 || softc->pm_pid == 0x57331095 || - softc->pm_pid == 0x57341095 || softc->pm_pid == 0x57441095) - softc->pm_ports--; + if (pmp_hide_special) { + /* + * This PMP declares 6 ports, while only 5 of them + * are real. Port 5 is a SEMB port, probing which + * causes timeouts if external SEP is not connected + * to PMP over I2C. + */ + if (softc->pm_pid == 0x37261095 && softc->pm_ports == 6) + softc->pm_ports = 5; + + /* + * This PMP declares 7 ports, while only 5 of them + * are real. Port 5 is a fake "Config Disk" with + * 640 sectors size. Port 6 is a SEMB port. + */ + if (softc->pm_pid == 0x47261095 && softc->pm_ports == 7) + softc->pm_ports = 5; + + /* + * These PMPs have extra configuration port. + */ + if (softc->pm_pid == 0x57231095 || + softc->pm_pid == 0x57331095 || + softc->pm_pid == 0x57341095 || + softc->pm_pid == 0x57441095) + softc->pm_ports--; + } printf("%s%d: %d fan-out ports\n", periph->periph_name, periph->unit_number, softc->pm_ports); From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 01:41:42 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 50B68106566B; Sat, 9 Jun 2012 01:41:42 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3AFE38FC08; Sat, 9 Jun 2012 01:41:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q591fgI1098660; Sat, 9 Jun 2012 01:41:42 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q591fgJf098658; Sat, 9 Jun 2012 01:41:42 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201206090141.q591fgJf098658@svn.freebsd.org> From: Warren Block Date: Sat, 9 Jun 2012 01:41:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236773 - stable/9/share/man/man4 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 01:41:42 -0000 Author: wblock (doc committer) Date: Sat Jun 9 01:41:41 2012 New Revision: 236773 URL: http://svn.freebsd.org/changeset/base/236773 Log: MFC r236122,r236595: Wording corrections and simplifications. Approved by: gjb (mentor) Modified: stable/9/share/man/man4/vlan.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/vlan.4 ============================================================================== --- stable/9/share/man/man4/vlan.4 Sat Jun 9 00:37:26 2012 (r236772) +++ stable/9/share/man/man4/vlan.4 Sat Jun 9 01:41:41 2012 (r236773) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 25, 2011 +.Dd June 4, 2012 .Dt VLAN 4 .Os .Sh NAME @@ -33,7 +33,7 @@ .Nd "IEEE 802.1Q VLAN network interface" .Sh SYNOPSIS To compile this driver into the kernel, -place the following lines in your +place the following line in your kernel configuration file: .Bd -ragged -offset indent .Cd "device vlan" @@ -79,16 +79,16 @@ to a properly configured switch port. The VLAN tag should match one of those set up in the switched network. .Pp -Initially .Nm -assumes the same minimum length for tagged and untagged frames. -This mode is selected by the +initially assumes the same minimum length for tagged and untagged frames. +This mode is selected by setting the .Xr sysctl 8 variable .Va net.link.vlan.soft_pad -set to 0 (default). -However, there are network devices that fail to adjust frame length, -should it fall below the allowed minimum due to untagging. +to 0 +.Pq default . +However, there are network devices that fail to adjust frame length +when it falls below the allowed minimum due to untagging. Such devices should be able to interoperate with .Nm after changing the value of @@ -97,7 +97,7 @@ to 1. In the latter mode, .Nm will pad short frames before tagging them -so that their length stays not less than the minimum value +so that their length is not less than the minimum value after untagging by the non-compliant devices. .Sh HARDWARE The @@ -111,7 +111,7 @@ receive and transmit long frames (up to header and FCS). The capabilities may be user-controlled by the respective parameters to .Xr ifconfig 8 , -.Cm vlanhwtag +.Cm vlanhwtag , and .Cm vlanmtu . However, a physical interface is not obliged to react to them: @@ -119,8 +119,8 @@ It may have either capability enabled pe a way to turn it off. The whole issue is very specific to a particular device and its driver. .Pp -By now, the list of physical interfaces able of full VLAN processing -in the hardware is limited to the following devices: +At present, these devices are capable of full VLAN processing +in hardware: .Xr ae 4 , .Xr age 4 , .Xr alc 4 , @@ -146,11 +146,10 @@ in the hardware is limited to the follow and .Xr vge 4 . .Pp -The rest of the Ethernet interfaces can run -VLANs using software emulation in the +Other Ethernet interfaces can run VLANs using software emulation in the .Nm driver. -However, some of them lack the capability +However, some lack the capability of transmitting and receiving long frames. Assigning such an interface as the parent to .Nm @@ -163,9 +162,8 @@ connectivity problems due to massive, in .Xr icmp 4 filtering that breaks the Path MTU Discovery mechanism. .Pp -The following interfaces support long frames for -.Nm -natively: +These interfaces natively support long frames for +.Nm : .Xr axe 4 , .Xr bfe 4 , .Xr cas 4 , @@ -198,7 +196,7 @@ for use and calculates the appropriate frame MTU based on the capabilities of the parent interface. Some other interfaces not listed above may handle long frames, -but they do not advertise this ability of theirs. +but they do not advertise this ability. The MTU setting on .Nm can be corrected manually if used in conjunction with such a parent interface. From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 06:43:27 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C90FA1065670; Sat, 9 Jun 2012 06:43:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B15018FC20; Sat, 9 Jun 2012 06:43:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q596hRaI011721; Sat, 9 Jun 2012 06:43:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q596hRco011710; Sat, 9 Jun 2012 06:43:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090643.q596hRco011710@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 06:43:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236778 - in stable/9: sbin/camcontrol sys/cam sys/cam/ata sys/cam/scsi sys/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 06:43:27 -0000 Author: mav Date: Sat Jun 9 06:43:26 2012 New Revision: 236778 URL: http://svn.freebsd.org/changeset/base/236778 Log: MFC r235897: - Add low-level support for SATA Enclosure Management Bridge (SEMB) devices -- SATA equivalents of the SCSI SES/SAF-TE devices. - Add some utility functions for SCSI SAF-TE devices access. Sponsored by: iXsystems, Inc. Modified: stable/9/sbin/camcontrol/camcontrol.c stable/9/sys/cam/ata/ata_all.c stable/9/sys/cam/ata/ata_all.h stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/ata/ata_xpt.c stable/9/sys/cam/cam_ccb.h stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h stable/9/sys/sys/ata.h Directory Properties: stable/9/sbin/camcontrol/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.c Sat Jun 9 03:34:34 2012 (r236777) +++ stable/9/sbin/camcontrol/camcontrol.c Sat Jun 9 06:43:26 2012 (r236778) @@ -456,7 +456,7 @@ getdevtree(void) case DEV_MATCH_DEVICE: { struct device_match_result *dev_result; char vendor[16], product[48], revision[16]; - char tmpstr[256]; + char fw[5], tmpstr[256]; dev_result = &ccb.cdm.matches[i].result.device_result; @@ -495,6 +495,25 @@ getdevtree(void) sizeof(revision)); sprintf(tmpstr, "<%s %s>", product, revision); + } else if (dev_result->protocol == PROTO_SEMB) { + struct sep_identify_data *sid; + + sid = (struct sep_identify_data *) + &dev_result->ident_data; + cam_strvis(vendor, sid->vendor_id, + sizeof(sid->vendor_id), + sizeof(vendor)); + cam_strvis(product, sid->product_id, + sizeof(sid->product_id), + sizeof(product)); + cam_strvis(revision, sid->product_rev, + sizeof(sid->product_rev), + sizeof(revision)); + cam_strvis(fw, sid->firmware_rev, + sizeof(sid->firmware_rev), + sizeof(fw)); + sprintf(tmpstr, "<%s %s %s %s>", + vendor, product, revision, fw); } else { sprintf(tmpstr, "<>"); } Modified: stable/9/sys/cam/ata/ata_all.c ============================================================================== --- stable/9/sys/cam/ata/ata_all.c Sat Jun 9 03:34:34 2012 (r236777) +++ stable/9/sys/cam/ata/ata_all.c Sat Jun 9 06:43:26 2012 (r236778) @@ -108,6 +108,16 @@ ata_op_string(struct ata_cmd *cmd) case 0x51: return ("CONFIGURE_STREAM"); case 0x60: return ("READ_FPDMA_QUEUED"); case 0x61: return ("WRITE_FPDMA_QUEUED"); + case 0x67: + if (cmd->features == 0xec) + return ("SEP_ATTN IDENTIFY"); + switch (cmd->lba_low) { + case 0x00: return ("SEP_ATTN READ BUFFER"); + case 0x02: return ("SEP_ATTN RECEIVE DIAGNOSTIC RESULTS"); + case 0x80: return ("SEP_ATTN WRITE BUFFER"); + case 0x82: return ("SEP_ATTN SEND DIAGNOSTIC"); + } + return ("SEP_ATTN"); case 0x70: return ("SEEK"); case 0x87: return ("CFA_TRANSLATE_SECTOR"); case 0x90: return ("EXECUTE_DEVICE_DIAGNOSTIC"); @@ -286,6 +296,21 @@ ata_print_ident(struct ata_params *ident printf(" device\n"); } +void +semb_print_ident(struct sep_identify_data *ident_data) +{ + char vendor[9], product[17], revision[5], fw[5], in[7], ins[5]; + + cam_strvis(vendor, ident_data->vendor_id, 8, sizeof(vendor)); + cam_strvis(product, ident_data->product_id, 16, sizeof(product)); + cam_strvis(revision, ident_data->product_rev, 4, sizeof(revision)); + cam_strvis(fw, ident_data->firmware_rev, 4, sizeof(fw)); + cam_strvis(in, ident_data->interface_id, 6, sizeof(in)); + cam_strvis(ins, ident_data->interface_rev, 4, sizeof(ins)); + printf("<%s %s %s %s> SEMB %s %s device\n", + vendor, product, revision, fw, in, ins); +} + uint32_t ata_logical_sector_size(struct ata_params *ident_data) { @@ -695,3 +720,86 @@ ata_static_identify_match(caddr_t identb } return (-1); } + +void +semb_receive_diagnostic_results(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), + uint8_t tag_action, int pcv, uint8_t page_code, + uint8_t *data_ptr, uint16_t length, uint32_t timeout) +{ + + length = min(length, 1020); + length = (length + 3) & ~3; + cam_fill_ataio(ataio, + retries, + cbfcnp, + /*flags*/CAM_DIR_IN, + tag_action, + data_ptr, + length, + timeout); + ata_28bit_cmd(ataio, ATA_SEP_ATTN, + pcv ? page_code : 0, 0x02, length / 4); +} + +void +semb_send_diagnostic(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t *data_ptr, uint16_t length, uint32_t timeout) +{ + + length = min(length, 1020); + length = (length + 3) & ~3; + cam_fill_ataio(ataio, + retries, + cbfcnp, + /*flags*/length ? CAM_DIR_OUT : CAM_DIR_NONE, + tag_action, + data_ptr, + length, + timeout); + ata_28bit_cmd(ataio, ATA_SEP_ATTN, + length > 0 ? data_ptr[0] : 0, 0x82, length / 4); +} + +void +semb_read_buffer(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), + uint8_t tag_action, uint8_t page_code, + uint8_t *data_ptr, uint16_t length, uint32_t timeout) +{ + + length = min(length, 1020); + length = (length + 3) & ~3; + cam_fill_ataio(ataio, + retries, + cbfcnp, + /*flags*/CAM_DIR_IN, + tag_action, + data_ptr, + length, + timeout); + ata_28bit_cmd(ataio, ATA_SEP_ATTN, + page_code, 0x00, length / 4); +} + +void +semb_write_buffer(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t *data_ptr, uint16_t length, uint32_t timeout) +{ + + length = min(length, 1020); + length = (length + 3) & ~3; + cam_fill_ataio(ataio, + retries, + cbfcnp, + /*flags*/length ? CAM_DIR_OUT : CAM_DIR_NONE, + tag_action, + data_ptr, + length, + timeout); + ata_28bit_cmd(ataio, ATA_SEP_ATTN, + length > 0 ? data_ptr[0] : 0, 0x80, length / 4); +} + Modified: stable/9/sys/cam/ata/ata_all.h ============================================================================== --- stable/9/sys/cam/ata/ata_all.h Sat Jun 9 03:34:34 2012 (r236777) +++ stable/9/sys/cam/ata/ata_all.h Sat Jun 9 06:43:26 2012 (r236778) @@ -83,6 +83,20 @@ struct ata_res { u_int8_t sector_count_exp; }; +struct sep_identify_data { + uint8_t length; /* Enclosure descriptor length */ + uint8_t subenc_id; /* Sub-enclosure identifier */ + uint8_t logical_id[8]; /* Enclosure logical identifier (WWN) */ + uint8_t vendor_id[8]; /* Vendor identification string */ + uint8_t product_id[16]; /* Product identification string */ + uint8_t product_rev[4]; /* Product revision string */ + uint8_t channel_id; /* Channel identifier */ + uint8_t firmware_rev[4];/* Firmware revision */ + uint8_t interface_id[6];/* Interface spec ("S-E-S "/"SAF-TE")*/ + uint8_t interface_rev[4];/* Interface spec revision */ + uint8_t vend_spec[11]; /* Vendor specific information */ +}; + int ata_version(int ver); char * ata_op_string(struct ata_cmd *cmd); @@ -126,4 +140,26 @@ int ata_speed2revision(u_int speed); int ata_identify_match(caddr_t identbuffer, caddr_t table_entry); int ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry); +void semb_print_ident(struct sep_identify_data *ident_data); + +void semb_receive_diagnostic_results(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), + uint8_t tag_action, int pcv, uint8_t page_code, + uint8_t *data_ptr, uint16_t allocation_length, uint32_t timeout); + +void semb_send_diagnostic(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t *data_ptr, uint16_t param_list_length, + uint32_t timeout); + +void semb_read_buffer(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), + uint8_t tag_action, uint8_t page_code, + uint8_t *data_ptr, uint16_t allocation_length, uint32_t timeout); + +void semb_write_buffer(struct ccb_ataio *ataio, + u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t *data_ptr, uint16_t param_list_length, + uint32_t timeout); + #endif Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Sat Jun 9 03:34:34 2012 (r236777) +++ stable/9/sys/cam/ata/ata_da.c Sat Jun 9 06:43:26 2012 (r236778) @@ -776,6 +776,20 @@ adaasync(void *callback_arg, u_int32_t c "due to status 0x%x\n", status); break; } + case AC_ADVINFO_CHANGED: + { + uintptr_t buftype; + + buftype = (uintptr_t)arg; + if (buftype == CDAI_TYPE_PHYS_PATH) { + struct ada_softc *softc; + + softc = periph->softc; + disk_attr_changed(softc->disk, "GEOM::physpath", + M_NOWAIT); + } + break; + } case AC_SENT_BDR: case AC_BUS_RESET: { @@ -1088,8 +1102,8 @@ adaregister(struct cam_periph *periph, v * them and the only alternative would be to * not attach the device on failure. */ - xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE, - adaasync, periph, periph->path); + xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE | + AC_ADVINFO_CHANGED, adaasync, periph, periph->path); /* * Schedule a periodic event to occasionally send an Modified: stable/9/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 03:34:34 2012 (r236777) +++ stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 06:43:26 2012 (r236778) @@ -93,6 +93,8 @@ typedef enum { PROBE_FULL_INQUIRY, PROBE_PM_PID, PROBE_PM_PRV, + PROBE_IDENTIFY_SES, + PROBE_IDENTIFY_SAFTE, PROBE_INVALID } probe_action; @@ -110,6 +112,8 @@ static char *probe_action_text[] = { "PROBE_FULL_INQUIRY", "PROBE_PM_PID", "PROBE_PM_PRV", + "PROBE_IDENTIFY_SES", + "PROBE_IDENTIFY_SAFTE", "PROBE_INVALID" }; @@ -266,7 +270,8 @@ probeschedule(struct cam_periph *periph) ccb = (union ccb *)TAILQ_FIRST(&softc->request_ccbs); if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) || - periph->path->device->protocol == PROTO_SATAPM) + periph->path->device->protocol == PROTO_SATAPM || + periph->path->device->protocol == PROTO_SEMB) PROBE_SET_ACTION(softc, PROBE_RESET); else PROBE_SET_ACTION(softc, PROBE_IDENTIFY); @@ -300,7 +305,8 @@ probestart(struct cam_periph *periph, un if (softc->restart) { softc->restart = 0; if ((path->device->flags & CAM_DEV_UNCONFIGURED) || - path->device->protocol == PROTO_SATAPM) + path->device->protocol == PROTO_SATAPM || + path->device->protocol == PROTO_SEMB) softc->action = PROBE_RESET; else softc->action = PROBE_IDENTIFY; @@ -622,6 +628,30 @@ negotiate: 10 * 1000); ata_pm_read_cmd(ataio, 1, 15); break; + case PROBE_IDENTIFY_SES: + cam_fill_ataio(ataio, + 1, + probedone, + /*flags*/CAM_DIR_IN, + 0, + /*data_ptr*/(u_int8_t *)&softc->ident_data, + /*dxfer_len*/sizeof(softc->ident_data), + 30 * 1000); + ata_28bit_cmd(ataio, ATA_SEP_ATTN, 0xEC, 0x02, + sizeof(softc->ident_data) / 4); + break; + case PROBE_IDENTIFY_SAFTE: + cam_fill_ataio(ataio, + 1, + probedone, + /*flags*/CAM_DIR_IN, + 0, + /*data_ptr*/(u_int8_t *)&softc->ident_data, + /*dxfer_len*/sizeof(softc->ident_data), + 30 * 1000); + ata_28bit_cmd(ataio, ATA_SEP_ATTN, 0xEC, 0x00, + sizeof(softc->ident_data) / 4); + break; case PROBE_INVALID: CAM_DEBUG(path, CAM_DEBUG_INFO, ("probestart: invalid action state\n")); @@ -758,12 +788,16 @@ probedone(struct cam_periph *periph, uni { struct ccb_trans_settings cts; struct ata_params *ident_buf; + struct scsi_inquiry_data *inq_buf; probe_softc *softc; struct cam_path *path; cam_status status; u_int32_t priority; u_int caps; - int found = 1; + int changed = 1, found = 1; + static const uint8_t fake_device_id_hdr[8] = + {0, SVPD_DEVICE_ID, 0, 12, + SVPD_ID_CODESET_BINARY, SVPD_ID_TYPE_NAA, 0, 8}; CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("probedone\n")); @@ -771,6 +805,7 @@ probedone(struct cam_periph *periph, uni path = done_ccb->ccb_h.path; priority = done_ccb->ccb_h.pinfo.priority; ident_buf = &path->device->ident_data; + inq_buf = &path->device->inq_data; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (softc->restart) { @@ -819,6 +854,18 @@ probedone(struct cam_periph *periph, uni } else if (softc->action == PROBE_SETDMAAA && status == CAM_ATA_STATUS_ERROR) { goto noerror; + + /* + * SES and SAF-TE SEPs have different IDENTIFY commands, + * but SATA specification doesn't tell how to identify them. + * Until better way found, just try another if first fail. + */ + } else if (softc->action == PROBE_IDENTIFY_SES && + status == CAM_ATA_STATUS_ERROR) { + PROBE_SET_ACTION(softc, PROBE_IDENTIFY_SAFTE); + xpt_release_ccb(done_ccb); + xpt_schedule(periph, priority); + return; } /* @@ -862,6 +909,10 @@ noerror: xpt_action((union ccb *)&cts); path->device->protocol = PROTO_SATAPM; PROBE_SET_ACTION(softc, PROBE_PM_PID); + } else if (sign == 0xc33c && + done_ccb->ccb_h.target_id != 15) { + path->device->protocol = PROTO_SEMB; + PROBE_SET_ACTION(softc, PROBE_IDENTIFY_SES); } else if (sign == 0xeb14 && done_ccb->ccb_h.target_id != 15) { path->device->protocol = PROTO_SCSI; @@ -881,7 +932,6 @@ noerror: { struct ccb_pathinq cpi; int16_t *ptr; - int changed = 1; ident_buf = &softc->ident_data; for (ptr = (int16_t *)ident_buf; @@ -936,6 +986,11 @@ noerror: path->device->serial_num = NULL; path->device->serial_num_len = 0; } + if (path->device->device_id != NULL) { + free(path->device->device_id, M_CAMXPT); + path->device->device_id = NULL; + path->device->device_id_len = 0; + } path->device->serial_num = (u_int8_t *)malloc((sizeof(ident_buf->serial) + 1), M_CAMXPT, M_NOWAIT); @@ -948,6 +1003,18 @@ noerror: path->device->serial_num_len = strlen(path->device->serial_num); } + if (ident_buf->enabled.extension & + ATA_SUPPORT_64BITWWN) { + path->device->device_id = + malloc(16, M_CAMXPT, M_NOWAIT); + if (path->device->device_id != NULL) { + path->device->device_id_len = 16; + bcopy(&fake_device_id_hdr, + path->device->device_id, 8); + bcopy(ident_buf->wwn, + path->device->device_id + 8, 8); + } + } path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; } @@ -1092,11 +1159,9 @@ notsata: case PROBE_INQUIRY: case PROBE_FULL_INQUIRY: { - struct scsi_inquiry_data *inq_buf; u_int8_t periph_qual, len; path->device->flags |= CAM_DEV_INQUIRY_DATA_VALID; - inq_buf = &path->device->inq_data; periph_qual = SID_QUAL(inq_buf); @@ -1200,6 +1265,48 @@ notsata: xpt_async(AC_SCSI_AEN, done_ccb->ccb_h.path, done_ccb); } break; + case PROBE_IDENTIFY_SES: + case PROBE_IDENTIFY_SAFTE: + if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) { + /* Check that it is the same device. */ + if (bcmp(&softc->ident_data, ident_buf, 53)) { + /* Device changed. */ + xpt_async(AC_LOST_DEVICE, path, NULL); + } else { + bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params)); + changed = 0; + } + } + if (changed) { + bcopy(&softc->ident_data, ident_buf, sizeof(struct ata_params)); + /* Clean up from previous instance of this device */ + if (path->device->device_id != NULL) { + free(path->device->device_id, M_CAMXPT); + path->device->device_id = NULL; + path->device->device_id_len = 0; + } + path->device->device_id = + malloc(16, M_CAMXPT, M_NOWAIT); + if (path->device->device_id != NULL) { + path->device->device_id_len = 16; + bcopy(&fake_device_id_hdr, + path->device->device_id, 8); + bcopy(((uint8_t*)ident_buf) + 2, + path->device->device_id + 8, 8); + } + + path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; + } + + if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { + path->device->flags &= ~CAM_DEV_UNCONFIGURED; + xpt_acquire_device(path->device); + done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action(done_ccb); + xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, + done_ccb); + } + break; case PROBE_INVALID: CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_INFO, ("probedone: invalid action state\n")); @@ -1624,10 +1731,20 @@ ata_dev_advinfo(union ccb *start_ccb) device = start_ccb->ccb_h.path->device; cdai = &start_ccb->cdai; switch(cdai->buftype) { - case CDAI_TYPE_SERIAL_NUM: + case CDAI_TYPE_SCSI_DEVID: if (cdai->flags & CDAI_FLAG_STORE) + return; + cdai->provsiz = device->device_id_len; + if (device->device_id_len == 0) break; - start_ccb->ccb_h.status = CAM_REQ_CMP; + amt = device->device_id_len; + if (cdai->provsiz > cdai->bufsiz) + amt = cdai->bufsiz; + memcpy(cdai->buf, device->device_id, amt); + break; + case CDAI_TYPE_SERIAL_NUM: + if (cdai->flags & CDAI_FLAG_STORE) + return; cdai->provsiz = device->serial_num_len; if (device->serial_num_len == 0) break; @@ -1636,8 +1753,45 @@ ata_dev_advinfo(union ccb *start_ccb) amt = cdai->bufsiz; memcpy(cdai->buf, device->serial_num, amt); break; - default: + case CDAI_TYPE_PHYS_PATH: + if (cdai->flags & CDAI_FLAG_STORE) { + if (device->physpath != NULL) + free(device->physpath, M_CAMXPT); + device->physpath_len = cdai->bufsiz; + /* Clear existing buffer if zero length */ + if (cdai->bufsiz == 0) + break; + device->physpath = malloc(cdai->bufsiz, M_CAMXPT, M_NOWAIT); + if (device->physpath == NULL) { + start_ccb->ccb_h.status = CAM_REQ_ABORTED; + return; + } + memcpy(device->physpath, cdai->buf, cdai->bufsiz); + } else { + cdai->provsiz = device->physpath_len; + if (device->physpath_len == 0) + break; + amt = device->physpath_len; + if (cdai->provsiz > cdai->bufsiz) + amt = cdai->bufsiz; + memcpy(cdai->buf, device->physpath, amt); + } break; + default: + return; + } + start_ccb->ccb_h.status = CAM_REQ_CMP; + + if (cdai->flags & CDAI_FLAG_STORE) { + int owned; + + owned = mtx_owned(start_ccb->ccb_h.path->bus->sim->mtx); + if (owned == 0) + mtx_lock(start_ccb->ccb_h.path->bus->sim->mtx); + xpt_async(AC_ADVINFO_CHANGED, start_ccb->ccb_h.path, + (void *)(uintptr_t)cdai->buftype); + if (owned == 0) + mtx_unlock(start_ccb->ccb_h.path->bus->sim->mtx); } } Modified: stable/9/sys/cam/cam_ccb.h ============================================================================== --- stable/9/sys/cam/cam_ccb.h Sat Jun 9 03:34:34 2012 (r236777) +++ stable/9/sys/cam/cam_ccb.h Sat Jun 9 06:43:26 2012 (r236778) @@ -242,6 +242,7 @@ typedef enum { PROTO_ATA, /* AT Attachment */ PROTO_ATAPI, /* AT Attachment Packetized Interface */ PROTO_SATAPM, /* SATA Port Multiplier */ + PROTO_SEMB, /* SATA Enclosure Management Bridge */ } cam_proto; typedef enum { Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Sat Jun 9 03:34:34 2012 (r236777) +++ stable/9/sys/cam/cam_xpt.c Sat Jun 9 06:43:26 2012 (r236778) @@ -1080,6 +1080,9 @@ xpt_announce_periph(struct cam_periph *p else if (path->device->protocol == PROTO_ATA || path->device->protocol == PROTO_SATAPM) ata_print_ident(&path->device->ident_data); + else if (path->device->protocol == PROTO_SEMB) + semb_print_ident( + (struct sep_identify_data *)&path->device->ident_data); else printf("Unknown protocol device\n"); if (bootverbose && path->device->serial_num_len > 0) { @@ -4848,7 +4851,8 @@ xpt_finishconfig_task(void *context, int * attached. For any devices like that, announce the * passthrough driver so the user will see something. */ - xpt_for_all_devices(xptpassannouncefunc, NULL); + if (!bootverbose) + xpt_for_all_devices(xptpassannouncefunc, NULL); /* Release our hook so that the boot can continue. */ config_intrhook_disestablish(xsoftc.xpt_config_hook); Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Sat Jun 9 03:34:34 2012 (r236777) +++ stable/9/sys/cam/scsi/scsi_all.c Sat Jun 9 06:43:26 2012 (r236778) @@ -5740,6 +5740,66 @@ scsi_send_diagnostic(struct ccb_scsiio * timeout); } +void +scsi_read_buffer(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb*), + uint8_t tag_action, int mode, + uint8_t buffer_id, u_int32_t offset, + uint8_t *data_ptr, uint32_t allocation_length, + uint8_t sense_len, uint32_t timeout) +{ + struct scsi_read_buffer *scsi_cmd; + + scsi_cmd = (struct scsi_read_buffer *)&csio->cdb_io.cdb_bytes; + memset(scsi_cmd, 0, sizeof(*scsi_cmd)); + scsi_cmd->opcode = READ_BUFFER; + scsi_cmd->byte2 = mode; + scsi_cmd->buffer_id = buffer_id; + scsi_ulto3b(offset, scsi_cmd->offset); + scsi_ulto3b(allocation_length, scsi_cmd->length); + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/CAM_DIR_IN, + tag_action, + data_ptr, + allocation_length, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + +void +scsi_write_buffer(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, int mode, + uint8_t buffer_id, u_int32_t offset, + uint8_t *data_ptr, uint32_t param_list_length, + uint8_t sense_len, uint32_t timeout) +{ + struct scsi_write_buffer *scsi_cmd; + + scsi_cmd = (struct scsi_write_buffer *)&csio->cdb_io.cdb_bytes; + memset(scsi_cmd, 0, sizeof(*scsi_cmd)); + scsi_cmd->opcode = WRITE_BUFFER; + scsi_cmd->byte2 = mode; + scsi_cmd->buffer_id = buffer_id; + scsi_ulto3b(offset, scsi_cmd->offset); + scsi_ulto3b(param_list_length, scsi_cmd->length); + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/param_list_length ? CAM_DIR_OUT : CAM_DIR_NONE, + tag_action, + data_ptr, + param_list_length, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + void scsi_start_stop(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Sat Jun 9 03:34:34 2012 (r236777) +++ stable/9/sys/cam/scsi/scsi_all.h Sat Jun 9 06:43:26 2012 (r236778) @@ -1267,6 +1267,8 @@ struct scsi_vpd_id_descriptor #define SCSI_PROTO_RDMA 0x04 #define SCSI_PROTO_iSCSI 0x05 #define SCSI_PROTO_SAS 0x06 +#define SCSI_PROTO_ADT 0x07 +#define SCSI_PROTO_ATA 0x08 #define SVPD_ID_PROTO_SHIFT 4 #define SVPD_ID_CODESET_BINARY 0x01 #define SVPD_ID_CODESET_ASCII 0x02 @@ -1400,6 +1402,13 @@ struct scsi_service_action_in uint8_t control; }; +struct scsi_diag_page { + uint8_t page_code; + uint8_t page_specific_flags; + uint8_t length[2]; + uint8_t params[0]; +}; + struct scsi_read_capacity { u_int8_t opcode; @@ -2342,6 +2351,20 @@ void scsi_send_diagnostic(struct ccb_scs uint16_t param_list_length, uint8_t sense_len, uint32_t timeout); +void scsi_read_buffer(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb*), + uint8_t tag_action, int mode, + uint8_t buffer_id, u_int32_t offset, + uint8_t *data_ptr, uint32_t allocation_length, + uint8_t sense_len, uint32_t timeout); + +void scsi_write_buffer(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, int mode, + uint8_t buffer_id, u_int32_t offset, + uint8_t *data_ptr, uint32_t param_list_length, + uint8_t sense_len, uint32_t timeout); + void scsi_read_write(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int readop, u_int8_t byte2, Modified: stable/9/sys/sys/ata.h ============================================================================== --- stable/9/sys/sys/ata.h Sat Jun 9 03:34:34 2012 (r236777) +++ stable/9/sys/sys/ata.h Sat Jun 9 06:43:26 2012 (r236778) @@ -318,6 +318,7 @@ struct ata_params { #define ATA_READ_VERIFY48 0x42 #define ATA_READ_FPDMA_QUEUED 0x60 /* read DMA NCQ */ #define ATA_WRITE_FPDMA_QUEUED 0x61 /* write DMA NCQ */ +#define ATA_SEP_ATTN 0x67 /* SEP request */ #define ATA_SEEK 0x70 /* seek */ #define ATA_PACKET_CMD 0xa0 /* packet command */ #define ATA_ATAPI_IDENTIFY 0xa1 /* get ATAPI params*/ From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 07:18:14 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9D084106564A; Sat, 9 Jun 2012 07:18:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F17F8FC0C; Sat, 9 Jun 2012 07:18:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q597IEWg013442; Sat, 9 Jun 2012 07:18:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597IDAt013439; Sat, 9 Jun 2012 07:18:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090718.q597IDAt013439@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236779 - in stable/9/sys/cam: ata scsi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 07:18:14 -0000 Author: mav Date: Sat Jun 9 07:18:13 2012 New Revision: 236779 URL: http://svn.freebsd.org/changeset/base/236779 Log: MFC r236228: Plug request and references leak caused by race between invalidated ond probe periph destruction and new incoming probe request. This at least caused problems with SATA Port Multipliers hot-plug. Modified: stable/9/sys/cam/ata/ata_xpt.c stable/9/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 06:43:26 2012 (r236778) +++ stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 07:18:13 2012 (r236779) @@ -1327,9 +1327,9 @@ done: done_ccb->ccb_h.status = found ? CAM_REQ_CMP : CAM_REQ_CMP_ERR; xpt_done(done_ccb); } + cam_periph_invalidate(periph); cam_release_devq(periph->path, RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_XPT + 1, FALSE); - cam_periph_invalidate(periph); cam_periph_release_locked(periph); } @@ -1580,12 +1580,17 @@ ata_scan_lun(struct cam_periph *periph, } if ((old_periph = cam_periph_find(path, "aprobe")) != NULL) { - probe_softc *softc; + if ((old_periph->flags & CAM_PERIPH_INVALID) == 0) { + probe_softc *softc; - softc = (probe_softc *)old_periph->softc; - TAILQ_INSERT_TAIL(&softc->request_ccbs, &request_ccb->ccb_h, - periph_links.tqe); - softc->restart = 1; + softc = (probe_softc *)old_periph->softc; + TAILQ_INSERT_TAIL(&softc->request_ccbs, + &request_ccb->ccb_h, periph_links.tqe); + softc->restart = 1; + } else { + request_ccb->ccb_h.status = CAM_REQ_CMP_ERR; + xpt_done(request_ccb); + } } else { status = cam_periph_alloc(proberegister, NULL, probecleanup, probestart, "aprobe", Modified: stable/9/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_xpt.c Sat Jun 9 06:43:26 2012 (r236778) +++ stable/9/sys/cam/scsi/scsi_xpt.c Sat Jun 9 07:18:13 2012 (r236779) @@ -1710,9 +1710,9 @@ probe_device_check: done_ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(done_ccb); if (TAILQ_FIRST(&softc->request_ccbs) == NULL) { + cam_periph_invalidate(periph); cam_release_devq(periph->path, RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_XPT + 1, FALSE); - cam_periph_invalidate(periph); cam_periph_release_locked(periph); } else { probeschedule(periph); @@ -2278,11 +2278,16 @@ scsi_scan_lun(struct cam_periph *periph, } if ((old_periph = cam_periph_find(path, "probe")) != NULL) { - probe_softc *softc; + if ((old_periph->flags & CAM_PERIPH_INVALID) == 0) { + probe_softc *softc; - softc = (probe_softc *)old_periph->softc; - TAILQ_INSERT_TAIL(&softc->request_ccbs, &request_ccb->ccb_h, - periph_links.tqe); + softc = (probe_softc *)old_periph->softc; + TAILQ_INSERT_TAIL(&softc->request_ccbs, + &request_ccb->ccb_h, periph_links.tqe); + } else { + request_ccb->ccb_h.status = CAM_REQ_CMP_ERR; + xpt_done(request_ccb); + } } else { status = cam_periph_alloc(proberegister, NULL, probecleanup, probestart, "probe", From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 07:28:12 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5794D106567D; Sat, 9 Jun 2012 07:28:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28D698FC20; Sat, 9 Jun 2012 07:28:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q597SC88014031; Sat, 9 Jun 2012 07:28:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597SBx0014027; Sat, 9 Jun 2012 07:28:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090728.q597SBx0014027@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236782 - in stable/9/sys/cam: . ata X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 07:28:12 -0000 Author: mav Date: Sat Jun 9 07:28:11 2012 New Revision: 236782 URL: http://svn.freebsd.org/changeset/base/236782 Log: MFC r236234: Allow to change number of openings (used tags) for ATA/SATA devices via `camcontrol tags ... -N ...`. There is no need to tune it in usual cases, but some users want to have it for debugging purposes. Modified: stable/9/sys/cam/ata/ata_xpt.c stable/9/sys/cam/cam_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 07:22:50 2012 (r236781) +++ stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 07:28:11 2012 (r236782) @@ -65,6 +65,7 @@ struct ata_quirk_entry { struct scsi_inquiry_pattern inq_pat; u_int8_t quirks; #define CAM_QUIRK_MAXTAGS 0x01 + u_int mintags; u_int maxtags; }; @@ -153,7 +154,7 @@ static struct ata_quirk_entry ata_quirk_ T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED, /*vendor*/"*", /*product*/"*", /*revision*/"*" }, - /*quirks*/0, /*maxtags*/0 + /*quirks*/0, /*mintags*/0, /*maxtags*/0 }, }; @@ -1019,7 +1020,8 @@ noerror: path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; } if (ident_buf->satacapabilities & ATA_SUPPORT_NCQ) { - path->device->mintags = path->device->maxtags = + path->device->mintags = 2; + path->device->maxtags = ATA_QUEUE_LEN(ident_buf->queue) + 1; } ata_find_quirk(path->device); @@ -1355,8 +1357,10 @@ ata_find_quirk(struct cam_ed *device) quirk = (struct ata_quirk_entry *)match; device->quirk = quirk; - if (quirk->quirks & CAM_QUIRK_MAXTAGS) - device->mintags = device->maxtags = quirk->maxtags; + if (quirk->quirks & CAM_QUIRK_MAXTAGS) { + device->mintags = quirk->mintags; + device->maxtags = quirk->maxtags; + } } typedef struct { Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Sat Jun 9 07:22:50 2012 (r236781) +++ stable/9/sys/cam/cam_xpt.c Sat Jun 9 07:28:11 2012 (r236782) @@ -2905,17 +2905,13 @@ xpt_action_default(union ccb *start_ccb) if ((crs->release_flags & RELSIM_ADJUST_OPENINGS) != 0) { - if (INQ_DATA_TQ_ENABLED(&dev->inq_data)) { - /* Don't ever go below one opening */ - if (crs->openings > 0) { - xpt_dev_ccbq_resize(path, - crs->openings); - - if (bootverbose) { - xpt_print(path, - "tagged openings now %d\n", - crs->openings); - } + /* Don't ever go below one opening */ + if (crs->openings > 0) { + xpt_dev_ccbq_resize(path, crs->openings); + if (bootverbose) { + xpt_print(path, + "number of openings is now %d\n", + crs->openings); } } } From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 07:31:05 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39A441065670; Sat, 9 Jun 2012 07:31:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A7898FC08; Sat, 9 Jun 2012 07:31:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q597V4uX014302; Sat, 9 Jun 2012 07:31:04 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597V4bG014297; Sat, 9 Jun 2012 07:31:04 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090731.q597V4bG014297@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:31:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236784 - in stable/9/sys/cam: . ata X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 07:31:05 -0000 Author: mav Date: Sat Jun 9 07:31:04 2012 New Revision: 236784 URL: http://svn.freebsd.org/changeset/base/236784 Log: NFC r236393: Use AC_GETDEV_CHANGED async to notify ada driver about DMA and NCQ status change. Now that allows switching between PIO and DMA modes on the fly. Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/ata/ata_xpt.c stable/9/sys/cam/cam_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Sat Jun 9 07:29:07 2012 (r236783) +++ stable/9/sys/cam/ata/ata_da.c Sat Jun 9 07:31:04 2012 (r236784) @@ -742,6 +742,7 @@ static void adaasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) { + struct ccb_getdev cgd; struct cam_periph *periph; struct ada_softc *softc; @@ -776,6 +777,32 @@ adaasync(void *callback_arg, u_int32_t c "due to status 0x%x\n", status); break; } + case AC_GETDEV_CHANGED: + { + softc = (struct ada_softc *)periph->softc; + xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + cgd.ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)&cgd); + + if ((cgd.ident_data.capabilities1 & ATA_SUPPORT_DMA) && + (cgd.inq_flags & SID_DMA)) + softc->flags |= ADA_FLAG_CAN_DMA; + else + softc->flags &= ~ADA_FLAG_CAN_DMA; + if ((cgd.ident_data.satacapabilities & ATA_SUPPORT_NCQ) && + (cgd.inq_flags & SID_DMA) && (cgd.inq_flags & SID_CmdQue)) + softc->flags |= ADA_FLAG_CAN_NCQ; + else + softc->flags &= ~ADA_FLAG_CAN_NCQ; + if ((cgd.ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) && + (cgd.inq_flags & SID_DMA)) + softc->flags |= ADA_FLAG_CAN_TRIM; + else + softc->flags &= ~ADA_FLAG_CAN_TRIM; + + cam_periph_async(periph, code, path, arg); + break; + } case AC_ADVINFO_CHANGED: { uintptr_t buftype; @@ -793,8 +820,6 @@ adaasync(void *callback_arg, u_int32_t c case AC_SENT_BDR: case AC_BUS_RESET: { - struct ccb_getdev cgd; - softc = (struct ada_softc *)periph->softc; cam_periph_async(periph, code, path, arg); if (softc->state != ADA_STATE_NORMAL) @@ -933,7 +958,7 @@ adaregister(struct cam_periph *periph, v bioq_init(&softc->bio_queue); bioq_init(&softc->trim_queue); - if (cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA && + if ((cgd->ident_data.capabilities1 & ATA_SUPPORT_DMA) && (cgd->inq_flags & SID_DMA)) softc->flags |= ADA_FLAG_CAN_DMA; if (cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48) @@ -942,10 +967,11 @@ adaregister(struct cam_periph *periph, v softc->flags |= ADA_FLAG_CAN_FLUSHCACHE; if (cgd->ident_data.support.command1 & ATA_SUPPORT_POWERMGT) softc->flags |= ADA_FLAG_CAN_POWERMGT; - if (cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ && + if ((cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ) && (cgd->inq_flags & SID_DMA) && (cgd->inq_flags & SID_CmdQue)) softc->flags |= ADA_FLAG_CAN_NCQ; - if (cgd->ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) { + if ((cgd->ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) && + (cgd->inq_flags & SID_DMA)) { softc->flags |= ADA_FLAG_CAN_TRIM; softc->trim_max_ranges = TRIM_MAX_RANGES; if (cgd->ident_data.max_dsm_blocks != 0) { @@ -1103,7 +1129,8 @@ adaregister(struct cam_periph *periph, v * not attach the device on failure. */ xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE | - AC_ADVINFO_CHANGED, adaasync, periph, periph->path); + AC_GETDEV_CHANGED | AC_ADVINFO_CHANGED, + adaasync, periph, periph->path); /* * Schedule a periodic event to occasionally send an Modified: stable/9/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 07:29:07 2012 (r236783) +++ stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 07:31:04 2012 (r236784) @@ -413,6 +413,7 @@ negotiate: path->device->inq_flags &= ~SID_DMA; else path->device->inq_flags |= SID_DMA; + xpt_async(AC_GETDEV_CHANGED, path, NULL); cam_fill_ataio(ataio, 1, probedone, @@ -1018,6 +1019,7 @@ noerror: } path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; + xpt_async(AC_GETDEV_CHANGED, path, NULL); } if (ident_buf->satacapabilities & ATA_SUPPORT_NCQ) { path->device->mintags = 2; Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Sat Jun 9 07:29:07 2012 (r236783) +++ stable/9/sys/cam/cam_xpt.c Sat Jun 9 07:31:04 2012 (r236784) @@ -4704,6 +4704,7 @@ xpt_start_tags(struct cam_path *path) newopenings = min(device->maxtags, sim->max_tagged_dev_openings); xpt_dev_ccbq_resize(path, newopenings); + xpt_async(AC_GETDEV_CHANGED, path, NULL); xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY; @@ -4728,6 +4729,7 @@ xpt_stop_tags(struct cam_path *path) xpt_freeze_devq(path, /*count*/1); device->inq_flags &= ~SID_CmdQue; xpt_dev_ccbq_resize(path, sim->max_dev_openings); + xpt_async(AC_GETDEV_CHANGED, path, NULL); xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY; From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 07:43:12 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9B6B31065672; Sat, 9 Jun 2012 07:43:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84C7C8FC18; Sat, 9 Jun 2012 07:43:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q597hC7S014915; Sat, 9 Jun 2012 07:43:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597hCwN014910; Sat, 9 Jun 2012 07:43:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090743.q597hCwN014910@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236786 - in stable/9: sbin/camcontrol sys/cam sys/cam/ata X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 07:43:12 -0000 Author: mav Date: Sat Jun 9 07:43:11 2012 New Revision: 236786 URL: http://svn.freebsd.org/changeset/base/236786 Log: MFC r236437: Rewrite enabling NCQ for SATA devices in a way more alike to SCSI TCQ. This allows to control it with `camcontrol negotiate adaX -T (en|dis)able` on the fly, same as for SCSI devices. Sponsored by: iXsystems, Inc. Modified: stable/9/sbin/camcontrol/camcontrol.c stable/9/sys/cam/ata/ata_xpt.c stable/9/sys/cam/cam_ccb.h stable/9/sys/cam/cam_xpt.c Directory Properties: stable/9/sbin/camcontrol/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.c Sat Jun 9 07:36:18 2012 (r236785) +++ stable/9/sbin/camcontrol/camcontrol.c Sat Jun 9 07:43:11 2012 (r236786) @@ -1025,11 +1025,11 @@ camxferrate(struct cam_device *device) if (sas->valid & CTS_SAS_VALID_SPEED) speed = sas->bitrate; } else if (ccb->cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &ccb->cts.xport_specific.ata; - if (ata->valid & CTS_ATA_VALID_MODE) - speed = ata_mode2speed(ata->mode); + if (pata->valid & CTS_ATA_VALID_MODE) + speed = ata_mode2speed(pata->mode); } else if (ccb->cts.transport == XPORT_SATA) { struct ccb_trans_settings_sata *sata = &ccb->cts.xport_specific.sata; @@ -1072,16 +1072,16 @@ camxferrate(struct cam_device *device) fprintf(stdout, ")"); } } else if (ccb->cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &ccb->cts.xport_specific.ata; printf(" ("); - if (ata->valid & CTS_ATA_VALID_MODE) - printf("%s, ", ata_mode2string(ata->mode)); - if ((ata->valid & CTS_ATA_VALID_ATAPI) && ata->atapi != 0) - printf("ATAPI %dbytes, ", ata->atapi); - if (ata->valid & CTS_ATA_VALID_BYTECOUNT) - printf("PIO %dbytes", ata->bytecount); + if (pata->valid & CTS_ATA_VALID_MODE) + printf("%s, ", ata_mode2string(pata->mode)); + if ((pata->valid & CTS_ATA_VALID_ATAPI) && pata->atapi != 0) + printf("ATAPI %dbytes, ", pata->atapi); + if (pata->valid & CTS_ATA_VALID_BYTECOUNT) + printf("PIO %dbytes", pata->bytecount); printf(")"); } else if (ccb->cts.transport == XPORT_SATA) { struct ccb_trans_settings_sata *sata = @@ -2891,21 +2891,45 @@ cts_print(struct cam_device *device, str "enabled" : "disabled"); } } + if (cts->transport == XPORT_FC) { + struct ccb_trans_settings_fc *fc = + &cts->xport_specific.fc; + + if (fc->valid & CTS_FC_VALID_WWNN) + fprintf(stdout, "%sWWNN: 0x%llx", pathstr, + (long long) fc->wwnn); + if (fc->valid & CTS_FC_VALID_WWPN) + fprintf(stdout, "%sWWPN: 0x%llx", pathstr, + (long long) fc->wwpn); + if (fc->valid & CTS_FC_VALID_PORT) + fprintf(stdout, "%sPortID: 0x%x", pathstr, fc->port); + if (fc->valid & CTS_FC_VALID_SPEED) + fprintf(stdout, "%stransfer speed: %d.%03dMB/s\n", + pathstr, fc->bitrate / 1000, fc->bitrate % 1000); + } + if (cts->transport == XPORT_SAS) { + struct ccb_trans_settings_sas *sas = + &cts->xport_specific.sas; + + if (sas->valid & CTS_SAS_VALID_SPEED) + fprintf(stdout, "%stransfer speed: %d.%03dMB/s\n", + pathstr, sas->bitrate / 1000, sas->bitrate % 1000); + } if (cts->transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &cts->xport_specific.ata; - if ((ata->valid & CTS_ATA_VALID_MODE) != 0) { + if ((pata->valid & CTS_ATA_VALID_MODE) != 0) { fprintf(stdout, "%sATA mode: %s\n", pathstr, - ata_mode2string(ata->mode)); + ata_mode2string(pata->mode)); } - if ((ata->valid & CTS_ATA_VALID_ATAPI) != 0) { + if ((pata->valid & CTS_ATA_VALID_ATAPI) != 0) { fprintf(stdout, "%sATAPI packet length: %d\n", pathstr, - ata->atapi); + pata->atapi); } - if ((ata->valid & CTS_ATA_VALID_BYTECOUNT) != 0) { + if ((pata->valid & CTS_ATA_VALID_BYTECOUNT) != 0) { fprintf(stdout, "%sPIO transaction length: %d\n", - pathstr, ata->bytecount); + pathstr, pata->bytecount); } } if (cts->transport == XPORT_SATA) { @@ -2941,12 +2965,22 @@ cts_print(struct cam_device *device, str sata->caps); } } + if (cts->protocol == PROTO_ATA) { + struct ccb_trans_settings_ata *ata= + &cts->proto_specific.ata; + + if (ata->valid & CTS_ATA_VALID_TQ) { + fprintf(stdout, "%stagged queueing: %s\n", pathstr, + (ata->flags & CTS_ATA_FLAGS_TAG_ENB) ? + "enabled" : "disabled"); + } + } if (cts->protocol == PROTO_SCSI) { struct ccb_trans_settings_scsi *scsi= &cts->proto_specific.scsi; if (scsi->valid & CTS_SCSI_VALID_TQ) { - fprintf(stdout, "%stagged queueing is %s\n", pathstr, + fprintf(stdout, "%stagged queueing: %s\n", pathstr, (scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) ? "enabled" : "disabled"); } @@ -3384,16 +3418,19 @@ ratecontrol(struct cam_device *device, i if (change_settings) { int didsettings = 0; struct ccb_trans_settings_spi *spi = NULL; - struct ccb_trans_settings_ata *ata = NULL; + struct ccb_trans_settings_pata *pata = NULL; struct ccb_trans_settings_sata *sata = NULL; + struct ccb_trans_settings_ata *ata = NULL; struct ccb_trans_settings_scsi *scsi = NULL; if (ccb->cts.transport == XPORT_SPI) spi = &ccb->cts.xport_specific.spi; if (ccb->cts.transport == XPORT_ATA) - ata = &ccb->cts.xport_specific.ata; + pata = &ccb->cts.xport_specific.ata; if (ccb->cts.transport == XPORT_SATA) sata = &ccb->cts.xport_specific.sata; + if (ccb->cts.protocol == PROTO_ATA) + ata = &ccb->cts.proto_specific.ata; if (ccb->cts.protocol == PROTO_SCSI) scsi = &ccb->cts.proto_specific.scsi; ccb->cts.xport_specific.valid = 0; @@ -3406,19 +3443,28 @@ ratecontrol(struct cam_device *device, i spi->flags |= CTS_SPI_FLAGS_DISC_ENB; didsettings++; } - if (scsi && tag_enable != -1) { + if (tag_enable != -1) { if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0) { warnx("HBA does not support tagged queueing, " "so you cannot modify tag settings"); retval = 1; goto ratecontrol_bailout; } - scsi->valid |= CTS_SCSI_VALID_TQ; - if (tag_enable == 0) - scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; - else - scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB; - didsettings++; + if (ata) { + ata->valid |= CTS_SCSI_VALID_TQ; + if (tag_enable == 0) + ata->flags &= ~CTS_ATA_FLAGS_TAG_ENB; + else + ata->flags |= CTS_ATA_FLAGS_TAG_ENB; + didsettings++; + } else if (scsi) { + scsi->valid |= CTS_SCSI_VALID_TQ; + if (tag_enable == 0) + scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; + else + scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB; + didsettings++; + } } if (spi && offset != -1) { if ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0) { @@ -3465,6 +3511,12 @@ ratecontrol(struct cam_device *device, i retval = 1; goto ratecontrol_bailout; } + if (!user_settings) { + warnx("You can modify only user rate " + "settings for SATA"); + retval = 1; + goto ratecontrol_bailout; + } sata->revision = ata_speed2revision(syncrate * 100); if (sata->revision < 0) { warnx("Invalid rate %f", syncrate); @@ -3474,16 +3526,22 @@ ratecontrol(struct cam_device *device, i sata->valid |= CTS_SATA_VALID_REVISION; didsettings++; } - if ((ata || sata) && mode != -1) { + if ((pata || sata) && mode != -1) { if ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0) { warnx("HBA is not capable of changing " "transfer rates"); retval = 1; goto ratecontrol_bailout; } - if (ata) { - ata->mode = mode; - ata->valid |= CTS_ATA_VALID_MODE; + if (!user_settings) { + warnx("You can modify only user mode " + "settings for ATA/SATA"); + retval = 1; + goto ratecontrol_bailout; + } + if (pata) { + pata->mode = mode; + pata->valid |= CTS_ATA_VALID_MODE; } else { sata->mode = mode; sata->valid |= CTS_SATA_VALID_MODE; @@ -3530,11 +3588,6 @@ ratecontrol(struct cam_device *device, i if (didsettings == 0) { goto ratecontrol_bailout; } - if (!user_settings && (ata || sata)) { - warnx("You can modify only user settings for ATA/SATA"); - retval = 1; - goto ratecontrol_bailout; - } ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; if (cam_send_ccb(device, ccb) < 0) { perror("error sending XPT_SET_TRAN_SETTINGS CCB"); @@ -3566,13 +3619,10 @@ ratecontrol(struct cam_device *device, i fprintf(stderr, "Test Unit Ready failed\n"); goto ratecontrol_bailout; } - /* - * If the user wants things quiet, there's no sense in - * getting the transfer settings, if we're not going - * to print them. - */ - if (quiet != 0) - goto ratecontrol_bailout; + } + if ((change_settings || send_tur) && !quiet && + (ccb->cts.transport == XPORT_ATA || + ccb->cts.transport == XPORT_SATA || send_tur)) { fprintf(stdout, "New parameters:\n"); retval = get_print_cts(device, user_settings, 0, NULL); } Modified: stable/9/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 07:36:18 2012 (r236785) +++ stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 07:43:11 2012 (r236786) @@ -165,7 +165,7 @@ static cam_status proberegister(struct c void *arg); static void probeschedule(struct cam_periph *probe_periph); static void probestart(struct cam_periph *periph, union ccb *start_ccb); -//static void proberequestdefaultnegotiation(struct cam_periph *periph); +static void proberequestdefaultnegotiation(struct cam_periph *periph); //static int proberequestbackoff(struct cam_periph *periph, // struct cam_ed *device); static void probedone(struct cam_periph *periph, union ccb *done_ccb); @@ -180,6 +180,7 @@ static struct cam_ed * ata_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id); static void ata_device_transport(struct cam_path *path); +static void ata_get_transfer_settings(struct ccb_trans_settings *cts); static void ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device, int async_update); @@ -662,7 +663,7 @@ negotiate: } xpt_action(start_ccb); } -#if 0 + static void proberequestdefaultnegotiation(struct cam_periph *periph) { @@ -672,14 +673,15 @@ proberequestdefaultnegotiation(struct ca cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; xpt_action((union ccb *)&cts); - if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) return; - } + cts.xport_specific.valid = 0; cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb *)&cts); } +#if 0 /* * Backoff Negotiation Code- only pertinent for SPI devices. */ @@ -1044,10 +1046,10 @@ noerror: cts.xport_specific.sata.tags = path->device->maxtags; cts.xport_specific.sata.valid = CTS_SATA_VALID_TAGS; xpt_action((union ccb *)&cts); - /* Reconfigure queues for tagged queueing. */ - xpt_start_tags(path); } } + if (changed) + proberequestdefaultnegotiation(periph); ata_device_transport(path); PROBE_SET_ACTION(softc, PROBE_SETMODE); xpt_release_ccb(done_ccb); @@ -1829,10 +1831,7 @@ ata_action(union ccb *start_ccb) break; case XPT_GET_TRAN_SETTINGS: { - struct cam_sim *sim; - - sim = start_ccb->ccb_h.path->bus->sim; - (*(sim->sim_action))(sim, start_ccb); + ata_get_transfer_settings(&start_ccb->cts); break; } case XPT_SCSI_IO: @@ -1871,14 +1870,48 @@ ata_action(union ccb *start_ccb) } static void +ata_get_transfer_settings(struct ccb_trans_settings *cts) +{ + struct ccb_trans_settings_ata *ata; + struct ccb_trans_settings_scsi *scsi; + struct cam_ed *device; + struct cam_sim *sim; + + device = cts->ccb_h.path->device; + sim = cts->ccb_h.path->bus->sim; + (*(sim->sim_action))(sim, (union ccb *)cts); + + if (cts->protocol == PROTO_ATA) { + ata = &cts->proto_specific.ata; + if ((ata->valid & CTS_ATA_VALID_TQ) == 0) { + ata->valid |= CTS_ATA_VALID_TQ; + if (cts->type == CTS_TYPE_USER_SETTINGS || + (device->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 || + (device->inq_flags & SID_CmdQue) != 0) + ata->flags |= CTS_ATA_FLAGS_TAG_ENB; + } + } + if (cts->protocol == PROTO_SCSI) { + scsi = &cts->proto_specific.scsi; + if ((scsi->valid & CTS_SCSI_VALID_TQ) == 0) { + scsi->valid |= CTS_SCSI_VALID_TQ; + if (cts->type == CTS_TYPE_USER_SETTINGS || + (device->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 || + (device->inq_flags & SID_CmdQue) != 0) + scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB; + } + } +} + +static void ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device, int async_update) { struct ccb_pathinq cpi; - struct ccb_trans_settings cur_cts; + struct ccb_trans_settings_ata *ata; struct ccb_trans_settings_scsi *scsi; - struct ccb_trans_settings_scsi *cur_scsi; struct cam_sim *sim; + struct ata_params *ident_data; struct scsi_inquiry_data *inq_data; if (device == NULL) { @@ -1938,95 +1971,63 @@ ata_set_transfer_settings(struct ccb_tra } sim = cts->ccb_h.path->bus->sim; - - /* - * Nothing more of interest to do unless - * this is a device connected via the - * SCSI protocol. - */ - if (cts->protocol != PROTO_SCSI) { - if (async_update == FALSE) - (*(sim->sim_action))(sim, (union ccb *)cts); - return; - } - + ident_data = &device->ident_data; inq_data = &device->inq_data; - scsi = &cts->proto_specific.scsi; + if (cts->protocol == PROTO_ATA) + ata = &cts->proto_specific.ata; + else + ata = NULL; + if (cts->protocol == PROTO_SCSI) + scsi = &cts->proto_specific.scsi; + else + scsi = NULL; xpt_setup_ccb(&cpi.ccb_h, cts->ccb_h.path, CAM_PRIORITY_NONE); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); - /* SCSI specific sanity checking */ + /* Sanity checking */ if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0 - || (INQ_DATA_TQ_ENABLED(inq_data)) == 0 + || (ata && (ident_data->satacapabilities & ATA_SUPPORT_NCQ) == 0) + || (scsi && (INQ_DATA_TQ_ENABLED(inq_data)) == 0) || (device->queue_flags & SCP_QUEUE_DQUE) != 0 || (device->mintags == 0)) { /* * Can't tag on hardware that doesn't support tags, * doesn't have it enabled, or has broken tag support. */ - scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; - } - - if (async_update == FALSE) { - /* - * Perform sanity checking against what the - * controller and device can do. - */ - xpt_setup_ccb(&cur_cts.ccb_h, cts->ccb_h.path, CAM_PRIORITY_NONE); - cur_cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; - cur_cts.type = cts->type; - xpt_action((union ccb *)&cur_cts); - if ((cur_cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - return; - } - cur_scsi = &cur_cts.proto_specific.scsi; - if ((scsi->valid & CTS_SCSI_VALID_TQ) == 0) { - scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; - scsi->flags |= cur_scsi->flags & CTS_SCSI_FLAGS_TAG_ENB; - } - if ((cur_scsi->valid & CTS_SCSI_VALID_TQ) == 0) + if (ata) + ata->flags &= ~CTS_ATA_FLAGS_TAG_ENB; + if (scsi) scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; } - if (cts->type == CTS_TYPE_CURRENT_SETTINGS - && (scsi->valid & CTS_SCSI_VALID_TQ) != 0) { - int device_tagenb; - - /* - * If we are transitioning from tags to no-tags or - * vice-versa, we need to carefully freeze and restart - * the queue so that we don't overlap tagged and non-tagged - * commands. We also temporarily stop tags if there is - * a change in transfer negotiation settings to allow - * "tag-less" negotiation. - */ - if ((device->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 - || (device->inq_flags & SID_CmdQue) != 0) - device_tagenb = TRUE; - else - device_tagenb = FALSE; + /* Start/stop tags use. */ + if (cts->type == CTS_TYPE_CURRENT_SETTINGS && + ((ata && (ata->valid & CTS_ATA_VALID_TQ) != 0) || + (scsi && (scsi->valid & CTS_SCSI_VALID_TQ) != 0))) { + int nowt, newt = 0; + + nowt = ((device->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 || + (device->inq_flags & SID_CmdQue) != 0); + if (ata) + newt = (ata->flags & CTS_ATA_FLAGS_TAG_ENB) != 0; + if (scsi) + newt = (scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) != 0; - if (((scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) != 0 - && device_tagenb == FALSE) - || ((scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) == 0 - && device_tagenb == TRUE)) { - - if ((scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) != 0) { - /* - * Delay change to use tags until after a - * few commands have gone to this device so - * the controller has time to perform transfer - * negotiations without tagged messages getting - * in the way. - */ - device->tag_delay_count = CAM_TAG_DELAY_COUNT; - device->flags |= CAM_DEV_TAG_AFTER_COUNT; - } else { - xpt_stop_tags(cts->ccb_h.path); - } - } + if (newt && !nowt) { + /* + * Delay change to use tags until after a + * few commands have gone to this device so + * the controller has time to perform transfer + * negotiations without tagged messages getting + * in the way. + */ + device->tag_delay_count = CAM_TAG_DELAY_COUNT; + device->flags |= CAM_DEV_TAG_AFTER_COUNT; + } else if (nowt && !newt) + xpt_stop_tags(cts->ccb_h.path); } + if (async_update == FALSE) (*(sim->sim_action))(sim, (union ccb *)cts); } @@ -2116,11 +2117,11 @@ ata_announce_periph(struct cam_periph *p /* Report connection speed */ speed = cpi.base_transfer_speed; if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &cts.xport_specific.ata; - if (ata->valid & CTS_ATA_VALID_MODE) - speed = ata_mode2speed(ata->mode); + if (pata->valid & CTS_ATA_VALID_MODE) + speed = ata_mode2speed(pata->mode); } if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SATA) { struct ccb_trans_settings_sata *sata = @@ -2139,16 +2140,16 @@ ata_announce_periph(struct cam_periph *p periph->unit_number, speed); /* Report additional information about connection */ if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_ATA) { - struct ccb_trans_settings_ata *ata = + struct ccb_trans_settings_pata *pata = &cts.xport_specific.ata; printf(" ("); - if (ata->valid & CTS_ATA_VALID_MODE) - printf("%s, ", ata_mode2string(ata->mode)); - if ((ata->valid & CTS_ATA_VALID_ATAPI) && ata->atapi != 0) - printf("ATAPI %dbytes, ", ata->atapi); - if (ata->valid & CTS_ATA_VALID_BYTECOUNT) - printf("PIO %dbytes", ata->bytecount); + if (pata->valid & CTS_ATA_VALID_MODE) + printf("%s, ", ata_mode2string(pata->mode)); + if ((pata->valid & CTS_ATA_VALID_ATAPI) && pata->atapi != 0) + printf("ATAPI %dbytes, ", pata->atapi); + if (pata->valid & CTS_ATA_VALID_BYTECOUNT) + printf("PIO %dbytes", pata->bytecount); printf(")"); } if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SATA) { Modified: stable/9/sys/cam/cam_ccb.h ============================================================================== --- stable/9/sys/cam/cam_ccb.h Sat Jun 9 07:36:18 2012 (r236785) +++ stable/9/sys/cam/cam_ccb.h Sat Jun 9 07:43:11 2012 (r236786) @@ -844,6 +844,14 @@ struct ccb_trans_settings_scsi #define CTS_SCSI_FLAGS_TAG_ENB 0x01 }; +struct ccb_trans_settings_ata +{ + u_int valid; /* Which fields to honor */ +#define CTS_ATA_VALID_TQ 0x01 + u_int flags; +#define CTS_ATA_FLAGS_TAG_ENB 0x01 +}; + struct ccb_trans_settings_spi { u_int valid; /* Which fields to honor */ @@ -878,7 +886,7 @@ struct ccb_trans_settings_sas { u_int32_t bitrate; /* Mbps */ }; -struct ccb_trans_settings_ata { +struct ccb_trans_settings_pata { u_int valid; /* Which fields to honor */ #define CTS_ATA_VALID_MODE 0x01 #define CTS_ATA_VALID_BYTECOUNT 0x02 @@ -924,6 +932,7 @@ struct ccb_trans_settings { u_int transport_version; union { u_int valid; /* Which fields to honor */ + struct ccb_trans_settings_ata ata; struct ccb_trans_settings_scsi scsi; } proto_specific; union { @@ -931,7 +940,7 @@ struct ccb_trans_settings { struct ccb_trans_settings_spi spi; struct ccb_trans_settings_fc fc; struct ccb_trans_settings_sas sas; - struct ccb_trans_settings_ata ata; + struct ccb_trans_settings_pata ata; struct ccb_trans_settings_sata sata; } xport_specific; }; Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Sat Jun 9 07:36:18 2012 (r236785) +++ stable/9/sys/cam/cam_xpt.c Sat Jun 9 07:43:11 2012 (r236786) @@ -5053,10 +5053,16 @@ camisr_runqueue(void *V_queue) ccb_h->path->bus->sim->devq->send_openings++; runq = TRUE; - if (((dev->flags & CAM_DEV_REL_ON_COMPLETE) != 0 - && (ccb_h->status&CAM_STATUS_MASK) != CAM_REQUEUE_REQ) - || ((dev->flags & CAM_DEV_REL_ON_QUEUE_EMPTY) != 0 + if (((dev->flags & CAM_DEV_REL_ON_QUEUE_EMPTY) != 0 && (dev->ccbq.dev_active == 0))) { + dev->flags &= ~CAM_DEV_REL_ON_QUEUE_EMPTY; + xpt_release_devq(ccb_h->path, /*count*/1, + /*run_queue*/FALSE); + } + + if (((dev->flags & CAM_DEV_REL_ON_COMPLETE) != 0 + && (ccb_h->status&CAM_STATUS_MASK) != CAM_REQUEUE_REQ)) { + dev->flags &= ~CAM_DEV_REL_ON_COMPLETE; xpt_release_devq(ccb_h->path, /*count*/1, /*run_queue*/FALSE); } From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 07:48:09 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6FB31065674; Sat, 9 Jun 2012 07:48:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D188C8FC17; Sat, 9 Jun 2012 07:48:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q597m8gK015250; Sat, 9 Jun 2012 07:48:08 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597m8H8015248; Sat, 9 Jun 2012 07:48:08 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090748.q597m8H8015248@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:48:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236788 - stable/9/sys/cam/ata X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 07:48:09 -0000 Author: mav Date: Sat Jun 9 07:48:08 2012 New Revision: 236788 URL: http://svn.freebsd.org/changeset/base/236788 Log: MFC r236552: Remove some dead code that I doubt will ever be implemented. Modified: stable/9/sys/cam/ata/ata_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 07:44:51 2012 (r236787) +++ stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 07:48:08 2012 (r236788) @@ -166,8 +166,6 @@ static cam_status proberegister(struct c static void probeschedule(struct cam_periph *probe_periph); static void probestart(struct cam_periph *periph, union ccb *start_ccb); static void proberequestdefaultnegotiation(struct cam_periph *periph); -//static int proberequestbackoff(struct cam_periph *periph, -// struct cam_ed *device); static void probedone(struct cam_periph *periph, union ccb *done_ccb); static void probecleanup(struct cam_periph *periph); static void ata_find_quirk(struct cam_ed *device); @@ -681,112 +679,6 @@ proberequestdefaultnegotiation(struct ca xpt_action((union ccb *)&cts); } -#if 0 -/* - * Backoff Negotiation Code- only pertinent for SPI devices. - */ -static int -proberequestbackoff(struct cam_periph *periph, struct cam_ed *device) -{ - struct ccb_trans_settings cts; - struct ccb_trans_settings_spi *spi; - - memset(&cts, 0, sizeof (cts)); - xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE); - cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; - cts.type = CTS_TYPE_CURRENT_SETTINGS; - xpt_action((union ccb *)&cts); - if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (bootverbose) { - xpt_print(periph->path, - "failed to get current device settings\n"); - } - return (0); - } - if (cts.transport != XPORT_SPI) { - if (bootverbose) { - xpt_print(periph->path, "not SPI transport\n"); - } - return (0); - } - spi = &cts.xport_specific.spi; - - /* - * We cannot renegotiate sync rate if we don't have one. - */ - if ((spi->valid & CTS_SPI_VALID_SYNC_RATE) == 0) { - if (bootverbose) { - xpt_print(periph->path, "no sync rate known\n"); - } - return (0); - } - - /* - * We'll assert that we don't have to touch PPR options- the - * SIM will see what we do with period and offset and adjust - * the PPR options as appropriate. - */ - - /* - * A sync rate with unknown or zero offset is nonsensical. - * A sync period of zero means Async. - */ - if ((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) == 0 - || spi->sync_offset == 0 || spi->sync_period == 0) { - if (bootverbose) { - xpt_print(periph->path, "no sync rate available\n"); - } - return (0); - } - - if (device->flags & CAM_DEV_DV_HIT_BOTTOM) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, - ("hit async: giving up on DV\n")); - return (0); - } - - - /* - * Jump sync_period up by one, but stop at 5MHz and fall back to Async. - * We don't try to remember 'last' settings to see if the SIM actually - * gets into the speed we want to set. We check on the SIM telling - * us that a requested speed is bad, but otherwise don't try and - * check the speed due to the asynchronous and handshake nature - * of speed setting. - */ - spi->valid = CTS_SPI_VALID_SYNC_RATE | CTS_SPI_VALID_SYNC_OFFSET; - for (;;) { - spi->sync_period++; - if (spi->sync_period >= 0xf) { - spi->sync_period = 0; - spi->sync_offset = 0; - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, - ("setting to async for DV\n")); - /* - * Once we hit async, we don't want to try - * any more settings. - */ - device->flags |= CAM_DEV_DV_HIT_BOTTOM; - } else if (bootverbose) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, - ("DV: period 0x%x\n", spi->sync_period)); - printf("setting period to 0x%x\n", spi->sync_period); - } - cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; - cts.type = CTS_TYPE_CURRENT_SETTINGS; - xpt_action((union ccb *)&cts); - if ((cts.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { - break; - } - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, - ("DV: failed to set period 0x%x\n", spi->sync_period)); - if (spi->sync_period == 0) { - return (0); - } - } - return (1); -} -#endif static void probedone(struct cam_periph *periph, union ccb *done_ccb) { From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 07:53:58 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25EC81065670; Sat, 9 Jun 2012 07:53:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1066B8FC1C; Sat, 9 Jun 2012 07:53:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q597rvGo015599; Sat, 9 Jun 2012 07:53:57 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q597rvXB015593; Sat, 9 Jun 2012 07:53:57 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090753.q597rvXB015593@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 07:53:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236790 - in stable/9/sys: cam/ata dev/ahci dev/ata dev/mvs dev/siis X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 07:53:58 -0000 Author: mav Date: Sat Jun 9 07:53:57 2012 New Revision: 236790 URL: http://svn.freebsd.org/changeset/base/236790 Log: r236666: ATA/SATA controllers have no idea about protocol of the connected device until transport will do some probe actions (at least soft reset). Make ATA/SATA SIMs to not report bogus and confusing PROTO_ATA protocol. Make ATA/SATA transport to fill that gap by reporting protocol to SIM with XPT_SET_TRAN_SETTINGS and patching XPT_GET_TRAN_SETTINGS results if needed. Modified: stable/9/sys/cam/ata/ata_xpt.c stable/9/sys/dev/ahci/ahci.c stable/9/sys/dev/ata/ata-all.c stable/9/sys/dev/mvs/mvs.c stable/9/sys/dev/siis/siis.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 07:49:09 2012 (r236789) +++ stable/9/sys/cam/ata/ata_xpt.c Sat Jun 9 07:53:57 2012 (r236790) @@ -940,9 +940,9 @@ noerror: xpt_action((union ccb *)&cts); } } + ata_device_transport(path); if (changed) proberequestdefaultnegotiation(periph); - ata_device_transport(path); PROBE_SET_ACTION(softc, PROBE_SETMODE); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); @@ -1119,6 +1119,9 @@ notsata: snprintf(ident_buf->revision, sizeof(ident_buf->revision), "%04x", softc->pm_prv); path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; + ata_device_transport(path); + if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) + proberequestdefaultnegotiation(periph); /* Set supported bits. */ bzero(&cts, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); @@ -1195,6 +1198,9 @@ notsata: path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID; } + ata_device_transport(path); + if (changed) + proberequestdefaultnegotiation(periph); if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; @@ -1773,6 +1779,12 @@ ata_get_transfer_settings(struct ccb_tra sim = cts->ccb_h.path->bus->sim; (*(sim->sim_action))(sim, (union ccb *)cts); + if (cts->protocol == PROTO_UNKNOWN || + cts->protocol == PROTO_UNSPECIFIED) { + cts->protocol = device->protocol; + cts->protocol_version = device->protocol_version; + } + if (cts->protocol == PROTO_ATA) { ata = &cts->proto_specific.ata; if ((ata->valid & CTS_ATA_VALID_TQ) == 0) { @@ -1793,6 +1805,12 @@ ata_get_transfer_settings(struct ccb_tra scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB; } } + + if (cts->transport == XPORT_UNKNOWN || + cts->transport == XPORT_UNSPECIFIED) { + cts->transport = device->transport; + cts->transport_version = device->transport_version; + } } static void Modified: stable/9/sys/dev/ahci/ahci.c ============================================================================== --- stable/9/sys/dev/ahci/ahci.c Sat Jun 9 07:49:09 2012 (r236789) +++ stable/9/sys/dev/ahci/ahci.c Sat Jun 9 07:53:57 2012 (r236790) @@ -2881,7 +2881,7 @@ ahciaction(struct cam_sim *sim, union cc d = &ch->curr[ccb->ccb_h.target_id]; else d = &ch->user[ccb->ccb_h.target_id]; - cts->protocol = PROTO_ATA; + cts->protocol = PROTO_UNSPECIFIED; cts->protocol_version = PROTO_VERSION_UNSPECIFIED; cts->transport = XPORT_SATA; cts->transport_version = XPORT_VERSION_UNSPECIFIED; @@ -2967,7 +2967,7 @@ ahciaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_ATA; + cpi->protocol = PROTO_UNSPECIFIED; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ Modified: stable/9/sys/dev/ata/ata-all.c ============================================================================== --- stable/9/sys/dev/ata/ata-all.c Sat Jun 9 07:49:09 2012 (r236789) +++ stable/9/sys/dev/ata/ata-all.c Sat Jun 9 07:53:57 2012 (r236790) @@ -1787,7 +1787,7 @@ ataaction(struct cam_sim *sim, union ccb d = &ch->curr[ccb->ccb_h.target_id]; else d = &ch->user[ccb->ccb_h.target_id]; - cts->protocol = PROTO_ATA; + cts->protocol = PROTO_UNSPECIFIED; cts->protocol_version = PROTO_VERSION_UNSPECIFIED; if (ch->flags & ATA_SATA) { cts->transport = XPORT_SATA; @@ -1875,7 +1875,7 @@ ataaction(struct cam_sim *sim, union ccb else cpi->transport = XPORT_ATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_ATA; + cpi->protocol = PROTO_UNSPECIFIED; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; if (device_get_devclass(device_get_parent(parent)) == Modified: stable/9/sys/dev/mvs/mvs.c ============================================================================== --- stable/9/sys/dev/mvs/mvs.c Sat Jun 9 07:49:09 2012 (r236789) +++ stable/9/sys/dev/mvs/mvs.c Sat Jun 9 07:53:57 2012 (r236790) @@ -2301,7 +2301,7 @@ mvsaction(struct cam_sim *sim, union ccb d = &ch->curr[ccb->ccb_h.target_id]; else d = &ch->user[ccb->ccb_h.target_id]; - cts->protocol = PROTO_ATA; + cts->protocol = PROTO_UNSPECIFIED; cts->protocol_version = PROTO_VERSION_UNSPECIFIED; cts->transport = XPORT_SATA; cts->transport_version = XPORT_VERSION_UNSPECIFIED; @@ -2385,7 +2385,7 @@ mvsaction(struct cam_sim *sim, union ccb cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_ATA; + cpi->protocol = PROTO_UNSPECIFIED; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; if ((ch->quirks & MVS_Q_SOC) == 0) { Modified: stable/9/sys/dev/siis/siis.c ============================================================================== --- stable/9/sys/dev/siis/siis.c Sat Jun 9 07:49:09 2012 (r236789) +++ stable/9/sys/dev/siis/siis.c Sat Jun 9 07:53:57 2012 (r236790) @@ -1884,7 +1884,7 @@ siisaction(struct cam_sim *sim, union cc d = &ch->curr[ccb->ccb_h.target_id]; else d = &ch->user[ccb->ccb_h.target_id]; - cts->protocol = PROTO_ATA; + cts->protocol = PROTO_UNSPECIFIED; cts->protocol_version = PROTO_VERSION_UNSPECIFIED; cts->transport = XPORT_SATA; cts->transport_version = XPORT_VERSION_UNSPECIFIED; @@ -1960,7 +1960,7 @@ siisaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_ATA; + cpi->protocol = PROTO_UNSPECIFIED; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; cpi->hba_vendor = pci_get_vendor(parent); From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 08:04:09 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 04ED6106564A; Sat, 9 Jun 2012 08:04:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA7648FC1D; Sat, 9 Jun 2012 08:04:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q59848Fl016146; Sat, 9 Jun 2012 08:04:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q59848EN016143; Sat, 9 Jun 2012 08:04:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206090804.q59848EN016143@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 9 Jun 2012 08:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236792 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 08:04:09 -0000 Author: kib Date: Sat Jun 9 08:04:08 2012 New Revision: 236792 URL: http://svn.freebsd.org/changeset/base/236792 Log: MFC r236043: Add a vn_bmap_seekhole(9) vnode helper which can be used by any filesystem which supports VOP_BMAP(9) to implement SEEK_HOLE/SEEK_DATA commands for lseek(2). Modified: stable/9/sys/kern/vfs_vnops.c stable/9/sys/sys/vnode.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Sat Jun 9 07:57:52 2012 (r236791) +++ stable/9/sys/kern/vfs_vnops.c Sat Jun 9 08:04:08 2012 (r236792) @@ -1461,3 +1461,56 @@ vn_pages_remove(struct vnode *vp, vm_pin vm_object_page_remove(object, start, end, 0); VM_OBJECT_UNLOCK(object); } + +int +vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred) +{ + struct vattr va; + daddr_t bn, bnp; + uint64_t bsize; + off_t noff; + int error; + + KASSERT(cmd == FIOSEEKHOLE || cmd == FIOSEEKDATA, + ("Wrong command %lu", cmd)); + + if (vn_lock(vp, LK_SHARED) != 0) + return (EBADF); + if (vp->v_type != VREG) { + error = ENOTTY; + goto unlock; + } + error = VOP_GETATTR(vp, &va, cred); + if (error != 0) + goto unlock; + noff = *off; + if (noff >= va.va_size) { + error = ENXIO; + goto unlock; + } + bsize = vp->v_mount->mnt_stat.f_iosize; + for (bn = noff / bsize; noff < va.va_size; bn++, noff += bsize) { + error = VOP_BMAP(vp, bn, NULL, &bnp, NULL, NULL); + if (error == EOPNOTSUPP) { + error = ENOTTY; + goto unlock; + } + if ((bnp == -1 && cmd == FIOSEEKHOLE) || + (bnp != -1 && cmd == FIOSEEKDATA)) { + noff = bn * bsize; + if (noff < *off) + noff = *off; + goto unlock; + } + } + if (noff > va.va_size) + noff = va.va_size; + /* noff == va.va_size. There is an implicit hole at the end of file. */ + if (cmd == FIOSEEKDATA) + error = ENXIO; +unlock: + VOP_UNLOCK(vp, 0); + if (error == 0) + *off = noff; + return (error); +} Modified: stable/9/sys/sys/vnode.h ============================================================================== --- stable/9/sys/sys/vnode.h Sat Jun 9 07:57:52 2012 (r236791) +++ stable/9/sys/sys/vnode.h Sat Jun 9 08:04:08 2012 (r236792) @@ -643,6 +643,8 @@ void vunref(struct vnode *); void vn_printf(struct vnode *vp, const char *fmt, ...) __printflike(2,3); #define vprint(label, vp) vn_printf((vp), "%s\n", (label)) int vrecycle(struct vnode *vp, struct thread *td); +int vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, + struct ucred *cred); int vn_close(struct vnode *vp, int flags, struct ucred *file_cred, struct thread *td); void vn_finished_write(struct mount *mp); From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 08:06:50 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 929491065698; Sat, 9 Jun 2012 08:06:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E2998FC1A; Sat, 9 Jun 2012 08:06:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5986oSM016319; Sat, 9 Jun 2012 08:06:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5986oQ9016317; Sat, 9 Jun 2012 08:06:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206090806.q5986oQ9016317@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Jun 2012 08:06:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236793 - stable/9/sys/cam/scsi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 08:06:50 -0000 Author: mav Date: Sat Jun 9 08:06:49 2012 New Revision: 236793 URL: http://svn.freebsd.org/changeset/base/236793 Log: MFC r236691: Remove declaration of scsi_interpret_sense(), removed 11 years ago. Modified: stable/9/sys/cam/scsi/scsi_all.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Sat Jun 9 08:04:08 2012 (r236792) +++ stable/9/sys/cam/scsi/scsi_all.h Sat Jun 9 08:06:49 2012 (r236793) @@ -2172,12 +2172,6 @@ int scsi_sense_sbuf(struct ccb_scsiio * char * scsi_sense_string(struct ccb_scsiio *csio, char *str, int str_len); void scsi_sense_print(struct ccb_scsiio *csio); -int scsi_interpret_sense(union ccb *ccb, - u_int32_t sense_flags, - u_int32_t *relsim_flags, - u_int32_t *reduction, - u_int32_t *timeout, - scsi_sense_action error_action); #else /* _KERNEL */ int scsi_command_string(struct cam_device *device, struct ccb_scsiio *csio, struct sbuf *sb); @@ -2189,13 +2183,6 @@ char * scsi_sense_string(struct cam_dev char *str, int str_len); void scsi_sense_print(struct cam_device *device, struct ccb_scsiio *csio, FILE *ofile); -int scsi_interpret_sense(struct cam_device *device, - union ccb *ccb, - u_int32_t sense_flags, - u_int32_t *relsim_flags, - u_int32_t *reduction, - u_int32_t *timeout, - scsi_sense_action error_action); #endif /* _KERNEL */ #define SF_RETRY_UA 0x01 From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 08:09:17 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0379A1065670; Sat, 9 Jun 2012 08:09:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8F098FC08; Sat, 9 Jun 2012 08:09:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5989GAD016512; Sat, 9 Jun 2012 08:09:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5989GtA016510; Sat, 9 Jun 2012 08:09:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206090809.q5989GtA016510@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 9 Jun 2012 08:09:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236795 - stable/9/sys/ufs/ufs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 08:09:17 -0000 Author: kib Date: Sat Jun 9 08:09:16 2012 New Revision: 236795 URL: http://svn.freebsd.org/changeset/base/236795 Log: MFC r236044: Implement SEEK_HOLE/SEEK_DATA for UFS. Modified: stable/9/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/9/sys/ufs/ufs/ufs_vnops.c Sat Jun 9 08:07:38 2012 (r236794) +++ stable/9/sys/ufs/ufs/ufs_vnops.c Sat Jun 9 08:09:16 2012 (r236795) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -104,6 +105,7 @@ static int ufs_chown(struct vnode *, uid static vop_close_t ufs_close; static vop_create_t ufs_create; static vop_getattr_t ufs_getattr; +static vop_ioctl_t ufs_ioctl; static vop_link_t ufs_link; static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *); static vop_markatime_t ufs_markatime; @@ -2513,6 +2515,9 @@ ufs_pathconf(ap) *ap->a_retval = 0; #endif break; + case _PC_MIN_HOLE_SIZE: + *ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize; + break; case _PC_ASYNC_IO: /* _PC_ASYNC_IO should have been handled by upper layers. */ KASSERT(0, ("_PC_ASYNC_IO should not get here")); @@ -2746,6 +2751,20 @@ bad: return (error); } +static int +ufs_ioctl(struct vop_ioctl_args *ap) +{ + + switch (ap->a_command) { + case FIOSEEKDATA: + case FIOSEEKHOLE: + return (vn_bmap_seekhole(ap->a_vp, ap->a_command, + (off_t *)ap->a_data, ap->a_cred)); + default: + return (ENOTTY); + } +} + /* Global vfs data structures for ufs. */ struct vop_vector ufs_vnodeops = { .vop_default = &default_vnodeops, @@ -2760,6 +2779,7 @@ struct vop_vector ufs_vnodeops = { .vop_create = ufs_create, .vop_getattr = ufs_getattr, .vop_inactive = ufs_inactive, + .vop_ioctl = ufs_ioctl, .vop_link = ufs_link, .vop_lookup = vfs_cache_lookup, .vop_markatime = ufs_markatime, From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 08:13:58 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1ED49106564A; Sat, 9 Jun 2012 08:13:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4A668FC14; Sat, 9 Jun 2012 08:13:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q598Dvbs016758; Sat, 9 Jun 2012 08:13:57 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q598DvQb016755; Sat, 9 Jun 2012 08:13:57 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206090813.q598DvQb016755@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 9 Jun 2012 08:13:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236796 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 08:13:58 -0000 Author: kib Date: Sat Jun 9 08:13:57 2012 New Revision: 236796 URL: http://svn.freebsd.org/changeset/base/236796 Log: MFC r236465: Update the print mask for decoding b_flags. Add print masks for b_vflags and b_xflags_t and print them as well. MFC r236487: Fix typo. Use commas to separate flag printouts, in style with other parts of function. Modified: stable/9/sys/kern/vfs_bio.c stable/9/sys/sys/buf.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_bio.c ============================================================================== --- stable/9/sys/kern/vfs_bio.c Sat Jun 9 08:09:16 2012 (r236795) +++ stable/9/sys/kern/vfs_bio.c Sat Jun 9 08:13:57 2012 (r236796) @@ -4017,7 +4017,9 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) } db_printf("buf at %p\n", bp); - db_printf("b_flags = 0x%b\n", (u_int)bp->b_flags, PRINT_BUF_FLAGS); + db_printf("b_flags = 0x%b, b_xflags=0x%b, b_vflags=0x%b\n", + (u_int)bp->b_flags, PRINT_BUF_FLAGS, (u_int)bp->b_xflags, + PRINT_BUF_XFLAGS, (u_int)bp->b_vflags, PRINT_BUF_VFLAGS); db_printf( "b_error = %d, b_bufsize = %ld, b_bcount = %ld, b_resid = %ld\n" "b_bufobj = (%p), b_data = %p, b_blkno = %jd, b_lblkno = %jd, " Modified: stable/9/sys/sys/buf.h ============================================================================== --- stable/9/sys/sys/buf.h Sat Jun 9 08:09:16 2012 (r236795) +++ stable/9/sys/sys/buf.h Sat Jun 9 08:13:57 2012 (r236796) @@ -224,8 +224,8 @@ struct buf { #define B_CLUSTER 0x40000000 /* pagein op, so swap() can count it */ #define B_REMFREE 0x80000000 /* Delayed bremfree */ -#define PRINT_BUF_FLAGS "\20\40remfree\37cluster\36vmio\35ram\34b27" \ - "\33paging\32b25\31b24\30b23\27relbuf\26dirty\25b20" \ +#define PRINT_BUF_FLAGS "\20\40remfree\37cluster\36vmio\35ram\34managed" \ + "\33paging\32needsgiant\31nocopy\30b23\27relbuf\26dirty\25b20" \ "\24b19\23b18\22clusterok\21malloc\20nocache\17b14\16inval" \ "\15b12\14b11\13eintr\12done\11persist\10delwri\7validsuspwrt" \ "\6cache\5deferred\4direct\3async\2needcommit\1age" @@ -239,6 +239,8 @@ struct buf { #define BX_BKGRDMARKER 0x00000020 /* Mark buffer for splay tree */ #define BX_ALTDATA 0x00000040 /* Holds extended data */ +#define PRINT_BUF_XFLAGS "\20\7altdata\6bkgrdmarker\5bkgrdwrite\2clean\1dirty" + #define NOOFFSET (-1LL) /* No buffer offset calculated yet */ /* @@ -249,6 +251,8 @@ struct buf { #define BV_BKGRDWAIT 0x00000004 /* Background write waiting */ #define BV_INFREECNT 0x80000000 /* buf is counted in numfreebufs */ +#define PRINT_BUF_VFLAGS "\20\40infreecnt\3bkgrdwait\2bkgrdinprog\1scanned" + #ifdef _KERNEL /* * Buffer locking From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 08:23:55 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CCC8A1065673; Sat, 9 Jun 2012 08:23:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B78788FC0A; Sat, 9 Jun 2012 08:23:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q598NtD6017368; Sat, 9 Jun 2012 08:23:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q598Ntn0017366; Sat, 9 Jun 2012 08:23:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206090823.q598Ntn0017366@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 9 Jun 2012 08:23:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236797 - stable/9/tools/tools/syscall_timing X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 08:23:55 -0000 Author: kib Date: Sat Jun 9 08:23:55 2012 New Revision: 236797 URL: http://svn.freebsd.org/changeset/base/236797 Log: MFC r236686: Add gettimeofday() test. Modified: stable/9/tools/tools/syscall_timing/syscall_timing.c Directory Properties: stable/9/tools/tools/syscall_timing/ (props changed) Modified: stable/9/tools/tools/syscall_timing/syscall_timing.c ============================================================================== --- stable/9/tools/tools/syscall_timing/syscall_timing.c Sat Jun 9 08:13:57 2012 (r236796) +++ stable/9/tools/tools/syscall_timing/syscall_timing.c Sat Jun 9 08:23:55 2012 (r236797) @@ -142,6 +142,22 @@ test_clock_gettime(uintmax_t num, uintma } uintmax_t +test_gettimeofday(uintmax_t num, uintmax_t int_arg, const char *path) +{ + struct timeval tv; + uintmax_t i; + + benchmark_start(); + for (i = 0; i < num; i++) { + if (alarm_fired) + break; + (void)gettimeofday(&tv, NULL); + } + benchmark_stop(); + return (i); +} + +uintmax_t test_pipe(uintmax_t num, uintmax_t int_arg, const char *path) { int fd[2], i; @@ -608,6 +624,7 @@ static const struct test tests[] = { { "getuid", test_getuid }, { "getppid", test_getppid }, { "clock_gettime", test_clock_gettime }, + { "gettimeofday", test_gettimeofday }, { "pipe", test_pipe }, { "socket_local_stream", test_socket_stream, .t_int = PF_LOCAL }, { "socket_local_dgram", test_socket_dgram, .t_int = PF_LOCAL }, From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 08:25:39 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A87BE1065673; Sat, 9 Jun 2012 08:25:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 917DA8FC23; Sat, 9 Jun 2012 08:25:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q598Pd46017493; Sat, 9 Jun 2012 08:25:39 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q598Pdbq017491; Sat, 9 Jun 2012 08:25:39 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206090825.q598Pdbq017491@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 9 Jun 2012 08:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236798 - stable/9/tools/tools/syscall_timing X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 08:25:39 -0000 Author: kib Date: Sat Jun 9 08:25:39 2012 New Revision: 236798 URL: http://svn.freebsd.org/changeset/base/236798 Log: MFC r236690: Do not execute a needed statement with side-effect in assert(). Modified: stable/9/tools/tools/syscall_timing/syscall_timing.c Directory Properties: stable/9/tools/tools/syscall_timing/ (props changed) Modified: stable/9/tools/tools/syscall_timing/syscall_timing.c ============================================================================== --- stable/9/tools/tools/syscall_timing/syscall_timing.c Sat Jun 9 08:23:55 2012 (r236797) +++ stable/9/tools/tools/syscall_timing/syscall_timing.c Sat Jun 9 08:25:39 2012 (r236798) @@ -71,20 +71,24 @@ alarm_handler(int signum) static void benchmark_start(void) { + int error; alarm_fired = 0; if (alarm_timeout) { signal(SIGALRM, alarm_handler); alarm(alarm_timeout); } - assert(clock_gettime(CLOCK_REALTIME, &ts_start) == 0); + error = clock_gettime(CLOCK_REALTIME, &ts_start); + assert(error == 0); } static void benchmark_stop(void) { + int error; - assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); + error = clock_gettime(CLOCK_REALTIME, &ts_end); + assert(error == 0); } uintmax_t @@ -687,7 +691,7 @@ main(int argc, char *argv[]) const char *path; long long ll; char *endp; - int ch, i, j, k; + int ch, error, i, j, k; uintmax_t iterations, loops; alarm_timeout = 1; @@ -756,7 +760,8 @@ main(int argc, char *argv[]) } } - assert(clock_getres(CLOCK_REALTIME, &ts_res) == 0); + error = clock_getres(CLOCK_REALTIME, &ts_res); + assert(error == 0); printf("Clock resolution: %ju.%09ju\n", (uintmax_t)ts_res.tv_sec, (uintmax_t)ts_res.tv_nsec); printf("test\tloop\ttime\titerations\tperiteration\n"); From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 10:06:49 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BA57B1065675; Sat, 9 Jun 2012 10:06:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4FAB8FC1E; Sat, 9 Jun 2012 10:06:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q59A6nMR022320; Sat, 9 Jun 2012 10:06:49 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q59A6nFU022317; Sat, 9 Jun 2012 10:06:49 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206091006.q59A6nFU022317@svn.freebsd.org> From: Dimitry Andric Date: Sat, 9 Jun 2012 10:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236807 - in stable/9/lib/libc: include net X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 10:06:49 -0000 Author: dim Date: Sat Jun 9 10:06:49 2012 New Revision: 236807 URL: http://svn.freebsd.org/changeset/base/236807 Log: MFC r236695: Fix two warnings about self-assignment in libc. These normally only trigger with clang, when you either use -save-temps, or ccache. Reported by: Sevan / Venture37 Modified: stable/9/lib/libc/include/port_before.h stable/9/lib/libc/net/getaddrinfo.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/include/port_before.h ============================================================================== --- stable/9/lib/libc/include/port_before.h Sat Jun 9 10:04:40 2012 (r236806) +++ stable/9/lib/libc/include/port_before.h Sat Jun 9 10:06:49 2012 (r236807) @@ -17,6 +17,6 @@ var = _u.v; \ } while (0) -#define UNUSED(x) (x) = (x) +#define UNUSED(x) (void)(x) #endif /* _PORT_BEFORE_H_ */ Modified: stable/9/lib/libc/net/getaddrinfo.c ============================================================================== --- stable/9/lib/libc/net/getaddrinfo.c Sat Jun 9 10:04:40 2012 (r236806) +++ stable/9/lib/libc/net/getaddrinfo.c Sat Jun 9 10:06:49 2012 (r236807) @@ -464,7 +464,7 @@ getaddrinfo(const char *hostname, const } error = get_portmatch(pai, servname); if (error) - ERR(error); + goto bad; *pai = ai0; } From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 9 22:44:25 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 50C5C1065675; Sat, 9 Jun 2012 22:44:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3BB078FC17; Sat, 9 Jun 2012 22:44:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q59MiPjV058307; Sat, 9 Jun 2012 22:44:25 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q59MiPdp058305; Sat, 9 Jun 2012 22:44:25 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206092244.q59MiPdp058305@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 9 Jun 2012 22:44:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236826 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 22:44:25 -0000 Author: bz Date: Sat Jun 9 22:44:24 2012 New Revision: 236826 URL: http://svn.freebsd.org/changeset/base/236826 Log: MFC r236615: Plug two interface address refcount leaks in early error return cases in the ioctl path. Reported by: rpaulo Reviewed by: emax Modified: stable/9/sys/netinet6/in6.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/in6.c ============================================================================== --- stable/9/sys/netinet6/in6.c Sat Jun 9 22:26:53 2012 (r236825) +++ stable/9/sys/netinet6/in6.c Sat Jun 9 22:44:24 2012 (r236826) @@ -1638,14 +1638,19 @@ in6_lifaddr_ioctl(struct socket *so, u_l hostid = IFA_IN6(ifa); /* prefixlen must be <= 64. */ - if (64 < iflr->prefixlen) + if (64 < iflr->prefixlen) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; + } prefixlen = iflr->prefixlen; /* hostid part must be zero. */ sin6 = (struct sockaddr_in6 *)&iflr->addr; if (sin6->sin6_addr.s6_addr32[2] != 0 || sin6->sin6_addr.s6_addr32[3] != 0) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; } } else