From owner-svn-src-user@FreeBSD.ORG Sun Sep 25 02:41:51 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58D67106564A; Sun, 25 Sep 2011 02:41:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 484618FC08; Sun, 25 Sep 2011 02:41: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 p8P2fpan005695; Sun, 25 Sep 2011 02:41:51 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8P2fpkg005694; Sun, 25 Sep 2011 02:41:51 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109250241.p8P2fpkg005694@svn.freebsd.org> From: Adrian Chadd Date: Sun, 25 Sep 2011 02:41:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225747 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 02:41:51 -0000 Author: adrian Date: Sun Sep 25 02:41:50 2011 New Revision: 225747 URL: http://svn.freebsd.org/changeset/base/225747 Log: Begin to flesh out the random crypto related issues I've seen crop up here. Added: user/adrian/if_ath_tx/sys/dev/ath/README-crypto Added: user/adrian/if_ath_tx/sys/dev/ath/README-crypto ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/if_ath_tx/sys/dev/ath/README-crypto Sun Sep 25 02:41:50 2011 (r225747) @@ -0,0 +1,56 @@ +Crypto related issues +: + +eg, on the hostap (ar9160) from an AR5416 STA. +iperf tcp - client on STA, server on box behind hostap. + +ccmp_decap: whoa there, talk about whacked. +ccmp_decap: ic_flags=0x000c2408 +ccmp_decap: tid=16, keyix=5, wk_rxkeyix=5 +TODS 00:23:6c:bf:38:3e->00:1b:b1:58:f6:f0(00:1b:b1:58:f6:f0) data WEP [IV a6 3e 00 e4 17 00 KID 0] + 0841 3c00 001b b158 f6f0 0023 6cbf 383e 001b b158 f6f0 2015 a63e 0020 e417 0000 aaaa 0300 0000 888e 0103 005f 0203 0200 0000 0000 0000 0000 cb00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0 +000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0069 4b5f 5689 d8de 3fda d3e2 7be3 ceaa 8b00 0079 ced4 2296 60bc ac + +.. then later: + +ccmp_decap: whoa there, talk about whacked. +ccmp_decap: ic_flags=0x000c2408 +ccmp_decap: tid=0, keyix=5, wk_rxkeyix=5 +TODS 00:23:6c:bf:38:3e->00:1c:c0:43:87:2b(00:1b:b1:58:f6:f0) data QoS [TID 0] WEP [IV 88 09 00 11 19 00 KID 0] + 8849 2c00 001b b158 f6f0 0023 6cbf 383e 001c c043 872b 308b 0000 3000 8809 0020 1119 0066 d9a3 41da 6979 a898 3a05 495f 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3 +637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 383 +9 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 +3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 34 +35 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 + 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3 +031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 323 +3 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 +3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 38 +39 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 + 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 6a98 32d1 0a13 ee7b +wlan0: [00:23:6c:bf:38:3e] discard MPDU frame, BA win <2228:2291> (4 frames) rxseq 2227 tid 0 (retransmit) +wlan0: [00:23:6c:bf:38:3e] discard MPDU frame, BA win <2236:2299> (3 frames) rxseq 2235 tid 0 (retransmit) + +.. then later: + +ccmp_decap: whoa there, talk about whacked. +ccmp_decap: ic_flags=0x000c2408 +ccmp_decap: tid=16, keyix=5, wk_rxkeyix=5 +TODS 00:23:6c:bf:38:3e->00:1b:b1:58:f6:f0(00:1b:b1:58:f6:f0) data WEP [IV 2a 0a 00 11 19 00 KID 0] + 0841 3c00 001b b158 f6f0 0023 6cbf 383e 001b b158 f6f0 601b 2a0a 0020 1119 0000 aaaa 0300 0000 888e 0103 005f 0203 0200 0000 0000 0000 0000 d700 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0 +000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 00af 015a 18af 9806 7015 56e0 a174 c423 d000 0098 73cc c4a6 13d9 99 + +.. at which point the traffic had stopped hard; the RX side was discarding +frames due to failing CCMP replay. + +wlan0: [00:23:6c:bf:38:3e] AES-CCM replay detected +wlan0: [00:23:6c:bf:38:3e] AES-CCM replay detected +wlan0: [00:23:6c:bf:38:3e] AES-CCM replay detected +wlan0: [00:23:6c:bf:38:3e] AES-CCM replay detected +wlan0: [00:23:6c:bf:38:3e] AES-CCM replay detected + + +(after crypto debugging had been enabled on the RX side, to see what was going on.) + +So the question here - why is it that the crypto IV suddenly was invalid +for one frame? Is it an RX or TX problem? From owner-svn-src-user@FreeBSD.ORG Sun Sep 25 07:38:34 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 241411065672; Sun, 25 Sep 2011 07:38:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09DCE8FC19; Sun, 25 Sep 2011 07:38:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8P7cX1b014869; Sun, 25 Sep 2011 07:38:33 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8P7cXv4014867; Sun, 25 Sep 2011 07:38:33 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109250738.p8P7cXv4014867@svn.freebsd.org> From: Adrian Chadd Date: Sun, 25 Sep 2011 07:38:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225748 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 07:38:34 -0000 Author: adrian Date: Sun Sep 25 07:38:33 2011 New Revision: 225748 URL: http://svn.freebsd.org/changeset/base/225748 Log: Update things Modified: user/adrian/if_ath_tx/sys/dev/ath/README-crypto Modified: user/adrian/if_ath_tx/sys/dev/ath/README-crypto ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/README-crypto Sun Sep 25 02:41:50 2011 (r225747) +++ user/adrian/if_ath_tx/sys/dev/ath/README-crypto Sun Sep 25 07:38:33 2011 (r225748) @@ -6,15 +6,6 @@ iperf tcp - client on STA, server on box ccmp_decap: whoa there, talk about whacked. ccmp_decap: ic_flags=0x000c2408 -ccmp_decap: tid=16, keyix=5, wk_rxkeyix=5 -TODS 00:23:6c:bf:38:3e->00:1b:b1:58:f6:f0(00:1b:b1:58:f6:f0) data WEP [IV a6 3e 00 e4 17 00 KID 0] - 0841 3c00 001b b158 f6f0 0023 6cbf 383e 001b b158 f6f0 2015 a63e 0020 e417 0000 aaaa 0300 0000 888e 0103 005f 0203 0200 0000 0000 0000 0000 cb00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0 -000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0069 4b5f 5689 d8de 3fda d3e2 7be3 ceaa 8b00 0079 ced4 2296 60bc ac - -.. then later: - -ccmp_decap: whoa there, talk about whacked. -ccmp_decap: ic_flags=0x000c2408 ccmp_decap: tid=0, keyix=5, wk_rxkeyix=5 TODS 00:23:6c:bf:38:3e->00:1c:c0:43:87:2b(00:1b:b1:58:f6:f0) data QoS [TID 0] WEP [IV 88 09 00 11 19 00 KID 0] 8849 2c00 001b b158 f6f0 0023 6cbf 383e 001c c043 872b 308b 0000 3000 8809 0020 1119 0066 d9a3 41da 6979 a898 3a05 495f 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3637 3839 3031 3233 3435 3 @@ -31,15 +22,6 @@ TODS 00:23:6c:bf:38:3e->00:1c:c0:43:87:2 wlan0: [00:23:6c:bf:38:3e] discard MPDU frame, BA win <2228:2291> (4 frames) rxseq 2227 tid 0 (retransmit) wlan0: [00:23:6c:bf:38:3e] discard MPDU frame, BA win <2236:2299> (3 frames) rxseq 2235 tid 0 (retransmit) -.. then later: - -ccmp_decap: whoa there, talk about whacked. -ccmp_decap: ic_flags=0x000c2408 -ccmp_decap: tid=16, keyix=5, wk_rxkeyix=5 -TODS 00:23:6c:bf:38:3e->00:1b:b1:58:f6:f0(00:1b:b1:58:f6:f0) data WEP [IV 2a 0a 00 11 19 00 KID 0] - 0841 3c00 001b b158 f6f0 0023 6cbf 383e 001b b158 f6f0 601b 2a0a 0020 1119 0000 aaaa 0300 0000 888e 0103 005f 0203 0200 0000 0000 0000 0000 d700 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0 -000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 00af 015a 18af 9806 7015 56e0 a174 c423 d000 0098 73cc c4a6 13d9 99 - .. at which point the traffic had stopped hard; the RX side was discarding frames due to failing CCMP replay. @@ -54,3 +36,23 @@ wlan0: [00:23:6c:bf:38:3e] AES-CCM repla So the question here - why is it that the crypto IV suddenly was invalid for one frame? Is it an RX or TX problem? + +Ie, the IV in the header: + +8809 0020 1119 0066 + +.. and then what looks like some TCP payload from iperf ('0' -> '9' repeated?) +with an 8 byte trailer. + +The IV sequence values: + +cynthia:crypto adrian$ ./de-iv.pl 112150606580104 +88 09 00 11 19 00 66 +cynthia:crypto adrian$ ./de-iv.pl 420547143 +47 0a 00 11 19 00 00 + +There aren't enough bytes between the 802.11 header / IV and the beginning +of the payload sequence for it to be an TCP header and if it were an +IP frame, it'd have a valid looking IP frame version /header length. + + From owner-svn-src-user@FreeBSD.ORG Sun Sep 25 07:38:59 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8F7F106564A; Sun, 25 Sep 2011 07:38:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C98568FC16; Sun, 25 Sep 2011 07:38: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 p8P7cx7O014916; Sun, 25 Sep 2011 07:38:59 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8P7cxbV014914; Sun, 25 Sep 2011 07:38:59 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109250738.p8P7cxbV014914@svn.freebsd.org> From: Adrian Chadd Date: Sun, 25 Sep 2011 07:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225749 - user/adrian/if_ath_tx/sys/net80211 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 07:38:59 -0000 Author: adrian Date: Sun Sep 25 07:38:59 2011 New Revision: 225749 URL: http://svn.freebsd.org/changeset/base/225749 Log: Add the TID to the replay debug message Modified: user/adrian/if_ath_tx/sys/net80211/ieee80211_freebsd.c Modified: user/adrian/if_ath_tx/sys/net80211/ieee80211_freebsd.c ============================================================================== --- user/adrian/if_ath_tx/sys/net80211/ieee80211_freebsd.c Sun Sep 25 07:38:33 2011 (r225748) +++ user/adrian/if_ath_tx/sys/net80211/ieee80211_freebsd.c Sun Sep 25 07:38:59 2011 (r225749) @@ -571,8 +571,8 @@ ieee80211_notify_replay_failure(struct i struct ifnet *ifp = vap->iv_ifp; IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_CRYPTO, wh->i_addr2, - "%s replay detected ", - k->wk_cipher->ic_name, (intmax_t) rsc, + "%s replay detected tid %d ", + tid, k->wk_cipher->ic_name, (intmax_t) rsc, (intmax_t) k->wk_keyrsc[tid], k->wk_keyix, k->wk_rxkeyix); From owner-svn-src-user@FreeBSD.ORG Sun Sep 25 07:39:20 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15C9F1065670; Sun, 25 Sep 2011 07:39:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 067E78FC0A; Sun, 25 Sep 2011 07:39: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 p8P7dJxn014973; Sun, 25 Sep 2011 07:39:19 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8P7dJEQ014971; Sun, 25 Sep 2011 07:39:19 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109250739.p8P7dJEQ014971@svn.freebsd.org> From: Adrian Chadd Date: Sun, 25 Sep 2011 07:39:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225750 - user/adrian/if_ath_tx/sys/net80211 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 07:39:20 -0000 Author: adrian Date: Sun Sep 25 07:39:19 2011 New Revision: 225750 URL: http://svn.freebsd.org/changeset/base/225750 Log: Add a reminder to check whether this should be also done for HT nodes. Modified: user/adrian/if_ath_tx/sys/net80211/ieee80211_output.c Modified: user/adrian/if_ath_tx/sys/net80211/ieee80211_output.c ============================================================================== --- user/adrian/if_ath_tx/sys/net80211/ieee80211_output.c Sun Sep 25 07:38:59 2011 (r225749) +++ user/adrian/if_ath_tx/sys/net80211/ieee80211_output.c Sun Sep 25 07:39:19 2011 (r225750) @@ -723,6 +723,7 @@ ieee80211_send_nulldata(struct ieee80211 } wh = mtod(m, struct ieee80211_frame *); /* NB: a little lie */ + /* XXX shouldn't this also check for NODE_HT? */ if (ni->ni_flags & IEEE80211_NODE_QOS) { const int tid = WME_AC_TO_TID(WME_AC_BE); uint8_t *qos; From owner-svn-src-user@FreeBSD.ORG Sun Sep 25 07:43:07 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1CCB106564A; Sun, 25 Sep 2011 07:43:07 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C272C8FC13; Sun, 25 Sep 2011 07:43:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8P7h77c015125; Sun, 25 Sep 2011 07:43:07 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8P7h7w5015123; Sun, 25 Sep 2011 07:43:07 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109250743.p8P7h7w5015123@svn.freebsd.org> From: Adrian Chadd Date: Sun, 25 Sep 2011 07:43:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225751 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 07:43:07 -0000 Author: adrian Date: Sun Sep 25 07:43:07 2011 New Revision: 225751 URL: http://svn.freebsd.org/changeset/base/225751 Log: First cut at the AR5416 blockack/aggregation bug. It doesn't do the reset; it just prints out a debug message. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 25 07:39:19 2011 (r225750) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 25 07:43:07 2011 (r225751) @@ -3035,7 +3035,12 @@ ath_tx_aggr_comp_aggr(struct ath_softc * } /* AR5416 BA bug; this requires an interface reset */ - /* XXX TODO */ + if (isaggr && tx_ok && (! hasba)) { + device_printf(sc->sc_dev, + "%s: AR5416 bug: hasba=%d; txok=%d, isaggr=%d, seq_st=%d\n", + __func__, hasba, tx_ok, isaggr, seq_st); + /* XXX TODO: schedule an interface reset */ + } /* * Walk the list of frames, figure out which ones were correctly From owner-svn-src-user@FreeBSD.ORG Sun Sep 25 07:49:03 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 647BA1065670; Sun, 25 Sep 2011 07:49:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54EE78FC13; Sun, 25 Sep 2011 07:49: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 p8P7n3xu015356; Sun, 25 Sep 2011 07:49:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8P7n3BN015354; Sun, 25 Sep 2011 07:49:03 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109250749.p8P7n3BN015354@svn.freebsd.org> From: Adrian Chadd Date: Sun, 25 Sep 2011 07:49:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225752 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 07:49:03 -0000 Author: adrian Date: Sun Sep 25 07:49:03 2011 New Revision: 225752 URL: http://svn.freebsd.org/changeset/base/225752 Log: Add some further debugging to get a handle on when this BAW tracking error occurs. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 25 07:43:07 2011 (r225751) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 25 07:49:03 2011 (r225752) @@ -1897,11 +1897,22 @@ ath_tx_update_baw(struct ath_softc *sc, DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, "%s: tid=%d, baw=%d:%d, seqno=%d, index=%d, cindex=%d, baw head=%d, tail=%d\n", - __func__, tid->tid, tap->txa_start, tap->txa_wnd, seqno, index, cindex, tid->baw_head, tid->baw_tail); + __func__, tid->tid, tap->txa_start, tap->txa_wnd, seqno, index, + cindex, tid->baw_head, tid->baw_tail); + /* + * If this occurs then we have a big problem - something else + * has slid tap->txa_start along without updating the BAW + * tracking start/end pointers. Thus the TX BAW state is now + * completely busted. + */ if (tid->tx_buf[cindex] != bf) { - device_printf(sc->sc_dev, "%s: seqno %d: tx_buf bf=%p; comp bf=%p!\n", - __func__, seqno, tid->tx_buf[cindex], bf); + device_printf(sc->sc_dev, + "%s: comp bf=%p, seq=%d; slot bf=%p, seqno=%d\n", + __func__, + bf, SEQNO(bf->bf_state.bfs_seqno), + tid->tx_buf[cindex], + SEQNO(tid->tx_buf[cindex]->bf_state.bfs_seqno)); } tid->tx_buf[cindex] = NULL; From owner-svn-src-user@FreeBSD.ORG Sun Sep 25 15:07:16 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA8301065674; Sun, 25 Sep 2011 15:07:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB6308FC08; Sun, 25 Sep 2011 15:07: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 p8PF7GTq030816; Sun, 25 Sep 2011 15:07:16 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8PF7GMk030814; Sun, 25 Sep 2011 15:07:16 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109251507.p8PF7GMk030814@svn.freebsd.org> From: Adrian Chadd Date: Sun, 25 Sep 2011 15:07:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225754 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 15:07:16 -0000 Author: adrian Date: Sun Sep 25 15:07:16 2011 New Revision: 225754 URL: http://svn.freebsd.org/changeset/base/225754 Log: Update with comment Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 25 11:17:34 2011 (r225753) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 25 15:07:16 2011 (r225754) @@ -1905,6 +1905,10 @@ ath_tx_update_baw(struct ath_softc *sc, * has slid tap->txa_start along without updating the BAW * tracking start/end pointers. Thus the TX BAW state is now * completely busted. + * + * But for now, since I haven't yet fixed TDMA and buffer cloning, + * it's quite possible that a cloned buffer is making its way + * here and causing it to fire off. Disable TDMA for now. */ if (tid->tx_buf[cindex] != bf) { device_printf(sc->sc_dev, From owner-svn-src-user@FreeBSD.ORG Sun Sep 25 15:07:51 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47EA4106566B; Sun, 25 Sep 2011 15:07:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38C348FC08; Sun, 25 Sep 2011 15:07: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 p8PF7pZx030865; Sun, 25 Sep 2011 15:07:51 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8PF7p1c030863; Sun, 25 Sep 2011 15:07:51 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109251507.p8PF7p1c030863@svn.freebsd.org> From: Adrian Chadd Date: Sun, 25 Sep 2011 15:07:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225755 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 15:07:51 -0000 Author: adrian Date: Sun Sep 25 15:07:50 2011 New Revision: 225755 URL: http://svn.freebsd.org/changeset/base/225755 Log: Add code to blank the tx aggregation statistics as well. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_sysctl.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_sysctl.c Sun Sep 25 15:07:16 2011 (r225754) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_sysctl.c Sun Sep 25 15:07:50 2011 (r225755) @@ -588,6 +588,8 @@ ath_sysctl_clearstats(SYSCTL_HANDLER_ARG if (val == 0) return 0; /* Not clearing the stats is still valid */ memset(&sc->sc_stats, 0, sizeof(sc->sc_stats)); + memset(&sc->sc_aggr_stats, 0, sizeof(sc->sc_aggr_stats)); + val = 0; return 0; } From owner-svn-src-user@FreeBSD.ORG Sun Sep 25 15:28:09 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACF46106564A; Sun, 25 Sep 2011 15:28:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D7BB8FC14; Sun, 25 Sep 2011 15:28:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8PFS9W7031552; Sun, 25 Sep 2011 15:28:09 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8PFS9mD031549; Sun, 25 Sep 2011 15:28:09 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109251528.p8PFS9mD031549@svn.freebsd.org> From: Adrian Chadd Date: Sun, 25 Sep 2011 15:28:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225756 - user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Sep 2011 15:28:09 -0000 Author: adrian Date: Sun Sep 25 15:28:09 2011 New Revision: 225756 URL: http://svn.freebsd.org/changeset/base/225756 Log: Disable TX interrupt mitigation for now. Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Sun Sep 25 15:07:50 2011 (r225755) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Sun Sep 25 15:28:09 2011 (r225756) @@ -144,14 +144,13 @@ ar5416GetPendingInterrupts(struct ath_ha */ *masked = isr & HAL_INT_COMMON; -#ifdef AH_AR5416_INTERRUPT_MITIGATION + if (isr & (AR_ISR_RXMINTR | AR_ISR_RXINTM)) { *masked |= HAL_INT_RX; } if (isr & (AR_ISR_TXMINTR | AR_ISR_TXINTM)) { *masked |= HAL_INT_TX; } -#endif /* * Don't signal this when doing interrupt mitigation @@ -162,10 +161,7 @@ ar5416GetPendingInterrupts(struct ath_ha #endif if (isr & (AR_ISR_TXOK | AR_ISR_TXDESC | AR_ISR_TXERR | AR_ISR_TXEOL)) { - -#ifndef AH_AR5416_INTERRUPT_MITIGATION *masked |= HAL_INT_TX; -#endif if (pCap->halUseIsrRac) { isr0 = OS_REG_READ(ah, AR_ISR_S0_S); @@ -288,18 +284,12 @@ ar5416SetInterrupts(struct ath_hal *ah, * Overwrite default mask if Interrupt mitigation * is specified for AR5416 */ - mask = ints & HAL_INT_COMMON; - if (ints & HAL_INT_TX) - mask |= AR_IMR_TXMINTR | AR_IMR_TXINTM; if (ints & HAL_INT_RX) mask |= AR_IMR_RXERR | AR_IMR_RXMINTR | AR_IMR_RXINTM; - if (ints & HAL_INT_TX) { - if (ahp->ah_txErrInterruptMask) - mask |= AR_IMR_TXERR; - if (ahp->ah_txEolInterruptMask) - mask |= AR_IMR_TXEOL; - } #else + if (ints & HAL_INT_RX) + mask |= AR_IMR_RXOK | AR_IMR_RXERR | AR_IMR_RXDESC; +#endif if (ints & HAL_INT_TX) { if (ahp->ah_txOkInterruptMask) mask |= AR_IMR_TXOK; @@ -310,9 +300,6 @@ ar5416SetInterrupts(struct ath_hal *ah, if (ahp->ah_txEolInterruptMask) mask |= AR_IMR_TXEOL; } - if (ints & HAL_INT_RX) - mask |= AR_IMR_RXOK | AR_IMR_RXERR | AR_IMR_RXDESC; -#endif if (ints & (HAL_INT_BMISC)) { mask |= AR_IMR_BCNMISC; if (ints & HAL_INT_TIM) Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun Sep 25 15:07:50 2011 (r225755) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun Sep 25 15:28:09 2011 (r225756) @@ -363,8 +363,6 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO #ifdef AH_AR5416_INTERRUPT_MITIGATION OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 500); OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 2000); - OS_REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_LAST, 300); - OS_REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_FIRST, 750); #endif ar5416InitBB(ah, chan); @@ -611,11 +609,11 @@ ar5416InitIMR(struct ath_hal *ah, HAL_OP | AR_IMR_BCNMISC; #ifdef AH_AR5416_INTERRUPT_MITIGATION - ahp->ah_maskReg |= AR_IMR_TXINTM | AR_IMR_RXINTM - | AR_IMR_TXMINTR | AR_IMR_RXMINTR; + ahp->ah_maskReg |= AR_IMR_RXINTM | AR_IMR_RXMINTR; #else - ahp->ah_maskReg |= AR_IMR_TXOK | AR_IMR_RXOK; -#endif + ahp->ah_maskReg |= AR_IMR_RXOK; +#endif + ahp->ah_maskReg |= AR_IMR_TXOK; if (opmode == HAL_M_HOSTAP) ahp->ah_maskReg |= AR_IMR_MIB; From owner-svn-src-user@FreeBSD.ORG Mon Sep 26 11:35:35 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D1D2106564A; Mon, 26 Sep 2011 11:35:35 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D89D88FC14; Mon, 26 Sep 2011 11:35:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8QBZYN2072474; Mon, 26 Sep 2011 11:35:34 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8QBZYdw072472; Mon, 26 Sep 2011 11:35:34 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201109261135.p8QBZYdw072472@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 26 Sep 2011 11:35:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225761 - user/des X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 11:35:35 -0000 Author: des Date: Mon Sep 26 11:35:34 2011 New Revision: 225761 URL: http://svn.freebsd.org/changeset/base/225761 Log: Fix MANDIR. Modified: user/des/Makefile.inc Modified: user/des/Makefile.inc ============================================================================== --- user/des/Makefile.inc Mon Sep 26 10:12:16 2011 (r225760) +++ user/des/Makefile.inc Mon Sep 26 11:35:34 2011 (r225761) @@ -6,7 +6,7 @@ ETCDIR=${HOME}/etc ETCOWN=${USER} LIBDIR=${HOME}/lib LIBOWN=${USER} -MANDIR=${HOME}/man +MANDIR=${HOME}/man/man MANOWN=${USER} SHAREDIR=${HOME}/share SHAREOWN=${USER} From owner-svn-src-user@FreeBSD.ORG Mon Sep 26 11:39:13 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 272DE106566B; Mon, 26 Sep 2011 11:39:13 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2D398FC0A; Mon, 26 Sep 2011 11:39: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 p8QBdCRn072615; Mon, 26 Sep 2011 11:39:12 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8QBdCEg072613; Mon, 26 Sep 2011 11:39:12 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201109261139.p8QBdCEg072613@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 26 Sep 2011 11:39:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225762 - user/des/phybs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 11:39:13 -0000 Author: des Date: Mon Sep 26 11:39:12 2011 New Revision: 225762 URL: http://svn.freebsd.org/changeset/base/225762 Log: Fix usage string and use sysexits. Modified: user/des/phybs/phybs.c Modified: user/des/phybs/phybs.c ============================================================================== --- user/des/phybs/phybs.c Mon Sep 26 11:35:34 2011 (r225761) +++ user/des/phybs/phybs.c Mon Sep 26 11:39:12 2011 (r225762) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010 Dag-Erling Coïdan Smørgrav + * Copyright (c) 2010-2011 Dag-Erling Coïdan Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #include #include #include +#include #include static const char *device; @@ -68,27 +70,27 @@ scan(int fd, size_t size, off_t offset, (unsigned long)offset, (unsigned long)step); fflush(stdout); if ((buf = malloc(size)) == NULL) - err(1, "malloc()"); + err(EX_OSERR, "malloc()"); memset(buf, 0, size); if (gettimeofday(&t0, NULL) == -1) - err(1, "gettimeofday()"); + err(EX_OSERR, "gettimeofday()"); for (unsigned int i = 0; i < count; ++i, offset += step) { if (opt_r) { if (lseek(fd, offset, SEEK_SET) != offset) - err(1, "lseek(%lu)", (unsigned long)offset); + err(EX_IOERR, "lseek(%lu)", (unsigned long)offset); if ((rlen = read(fd, buf, size)) == -1) - err(1, "read(%lu)", (unsigned long)size); + err(EX_IOERR, "read(%lu)", (unsigned long)size); if (rlen < (ssize_t)size) - errx(1, "short read: %ld < %lu", + errx(EX_IOERR, "short read: %ld < %lu", (long)rlen, (unsigned long)size); } if (opt_w) { if (lseek(fd, offset, SEEK_SET) != offset) - err(1, "lseek(%lu)", (unsigned long)offset); + err(EX_IOERR, "lseek(%lu)", (unsigned long)offset); if ((wlen = write(fd, buf, size)) == -1) - err(1, "write(%lu)", (unsigned long)size); + err(EX_IOERR, "write(%lu)", (unsigned long)size); if (wlen < (ssize_t)size) - errx(1, "short write: %ld < %lu", + errx(EX_IOERR, "short write: %ld < %lu", (long)wlen, (unsigned long)size); } if (tty && i % 256 == 0) { @@ -99,7 +101,7 @@ scan(int fd, size_t size, off_t offset, } } if (gettimeofday(&t1, NULL) == -1) - err(1, "gettimeofday()"); + err(EX_OSERR, "gettimeofday()"); usec = t1.tv_sec * 1000000 + t1.tv_usec; usec -= t0.tv_sec * 1000000 + t0.tv_usec; printf("%10lu%8ju%8ju\n", usec / 1000, @@ -112,7 +114,8 @@ static void usage(void) { - fprintf(stderr, "usage: phybs [-rw] [-l min] [-h max] device\n"); + fprintf(stderr, "usage: phybs %s\n", + "[-rw] [-l minsize] [-h maxsize] [-t total] device"); exit(1); } @@ -176,30 +179,30 @@ main(int argc, char *argv[]) errx(1, "must specify -r and / or -w"); if ((fd = open(device, opt_w ? O_RDWR : O_RDONLY)) == -1) - err(1, "open(%s)", device); + err(errno == EPERM ? EX_NOPERM : EX_OSERR, "open(%s)", device); if (fstat(fd, &st) != 0) - err(1, "stat(%s)", device); + err(EX_OSERR, "stat(%s)", device); bsize = 512; if (S_ISCHR(st.st_mode) && ioctl(fd, DIOCGSECTORSIZE, &bsize) == -1) - err(1, "ioctl(%s, DIOCGSECTORSIZE)", device); + err(EX_OSERR, "ioctl(%s, DIOCGSECTORSIZE)", device); if (minsize == 0) minsize = bsize * 2; if (minsize % bsize != 0) - errx(1, "minsize (%u) is not a multiple of block size (%u)", + errx(EX_USAGE, "minsize (%u) is not a multiple of block size (%u)", minsize, bsize); if (maxsize == 0) maxsize = minsize * 8; if (maxsize % minsize != 0) - errx(1, "maxsize (%u) is not a multiple of minsize (%u)", + errx(EX_USAGE, "maxsize (%u) is not a multiple of minsize (%u)", maxsize, minsize); if (total == 0) total = 128 * 1024 * 1024; if (total % maxsize != 0) - errx(1, "total (%u) is not a multiple of maxsize (%u)", + errx(EX_USAGE, "total (%u) is not a multiple of maxsize (%u)", total, maxsize); printf("%8s%8s%8s%8s%12s%8s%8s\n", @@ -214,5 +217,5 @@ main(int argc, char *argv[]) } close(fd); - exit(0); + exit(EX_OK); } From owner-svn-src-user@FreeBSD.ORG Mon Sep 26 11:40:28 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EE8A106566C; Mon, 26 Sep 2011 11:40:28 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F8248FC14; Mon, 26 Sep 2011 11:40:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8QBeSUe072691; Mon, 26 Sep 2011 11:40:28 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8QBeS4U072689; Mon, 26 Sep 2011 11:40:28 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201109261140.p8QBeS4U072689@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 26 Sep 2011 11:40:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225763 - user/des/phybs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 11:40:28 -0000 Author: des Date: Mon Sep 26 11:40:28 2011 New Revision: 225763 URL: http://svn.freebsd.org/changeset/base/225763 Log: Make -r the default. Change the default minsize to bsize so we can tell if the logical and physical block sizes are the same. Modified: user/des/phybs/phybs.c Modified: user/des/phybs/phybs.c ============================================================================== --- user/des/phybs/phybs.c Mon Sep 26 11:39:12 2011 (r225762) +++ user/des/phybs/phybs.c Mon Sep 26 11:40:28 2011 (r225763) @@ -176,7 +176,7 @@ main(int argc, char *argv[]) device = argv[0]; if (!opt_r && !opt_w) - errx(1, "must specify -r and / or -w"); + opt_r = 1; if ((fd = open(device, opt_w ? O_RDWR : O_RDONLY)) == -1) err(errno == EPERM ? EX_NOPERM : EX_OSERR, "open(%s)", device); @@ -188,7 +188,7 @@ main(int argc, char *argv[]) err(EX_OSERR, "ioctl(%s, DIOCGSECTORSIZE)", device); if (minsize == 0) - minsize = bsize * 2; + minsize = bsize; if (minsize % bsize != 0) errx(EX_USAGE, "minsize (%u) is not a multiple of block size (%u)", minsize, bsize); From owner-svn-src-user@FreeBSD.ORG Mon Sep 26 12:08:15 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A18F1106564A; Mon, 26 Sep 2011 12:08:15 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 911338FC14; Mon, 26 Sep 2011 12:08:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8QC8Fse073605; Mon, 26 Sep 2011 12:08:15 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8QC8Fc3073602; Mon, 26 Sep 2011 12:08:15 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201109261208.p8QC8Fc3073602@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 26 Sep 2011 12:08:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225765 - user/des/phybs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 12:08:15 -0000 Author: des Date: Mon Sep 26 12:08:15 2011 New Revision: 225765 URL: http://svn.freebsd.org/changeset/base/225765 Log: Add a man page. Added: user/des/phybs/phybs.1 (contents, props changed) Modified: user/des/phybs/Makefile Modified: user/des/phybs/Makefile ============================================================================== --- user/des/phybs/Makefile Mon Sep 26 11:57:48 2011 (r225764) +++ user/des/phybs/Makefile Mon Sep 26 12:08:15 2011 (r225765) @@ -3,7 +3,6 @@ PROG = phybs CSTD ?= c99 WARNS ?= 6 -MAN = # none LDADD = -lutil DPADD = ${LIBUTIL} Added: user/des/phybs/phybs.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/phybs/phybs.1 Mon Sep 26 12:08:15 2011 (r225765) @@ -0,0 +1,130 @@ +.\"- +.\" Copyright (c) 2010 Dag-Erling Coïdan Smørgrav +.\" 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 +.\" in this position and unchanged. +.\" 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 September 26, 2011 +.Dt PHYBS 1 +.Os +.Sh NAME +.Nm phybs +.Nd reveal a storage device's physical block size +.Sh SYNOPSIS +.Nm +.Op Fl rtw +.Op Fl l Ar minsize +.Op Fl h Ar maxsize +.Op Fl t Ar total +.Ar device +.Sh DESCRIPTION +The +.Nm +utility runs a series of I/O benchmarks designed to reveal a storage +device's physical block size by comparing the performance of small and +large I/O operations at various (mis-)alignments. +.Pp +The +.Nm +utility makes a series of passes with increasing block sizes. In each +pass, it either reads or writes (or both) a number of blocks at +increasing offsets relative to the ideal alignment, which is assumed +to be multiples of the block size. +The results are presented in terms of time elapsed, transactions per +second and kB per second. +.Pp +If the device's physical block size is larger than its logical block +size, peak performance will be obtained when reading or writing +multiples of the physical block size at offsets which are also +multiples of the physical block size, while I/O operations which do +not meet these criteria will be significantly slower. +.Pp +The following options are available: +.Bl -tag -width Fl +.It Fl h Ar maxsize +Specify the maximum block size to test. +This must be a power of two and a multiple of the minimum block size +.Po +see +.Fl l +.Pc . +The default is eight times the minimum block size. +.It Fl l Ar minsize +Specify the minimum block size to test. +This must be a power of two and a multiple of the device's logical +block size. +The default is the device's logical block size. +.It Fl r +Perform read operations. +This is the default. +.It Fl t Ar total +Specify the total amount of data to read or write in each pass. +This must be a power of two and a multiple of the maximum block size +.Po +see +.Fl h +.Pc . +For best results, it should also be significantly larger than the +device's on-board cache. +The default is 128 MB. +.It Fl w +Perform write operations. +.El +.Sh IMPLEMENTATION NOTES +The +.Nm +utility can be used on files as well as raw devices, but the +characteristics of the underlying file system will greatly influence +the results, possibly to the point where they can not reveal anything +of interest about the actual device. +.Pp +The +.Nm +utility reports the benchmark results, but makes no attempt at +interpreting them. +.Sh EXIT STATUS +The +.Nm +utility returns +.Va EX_OK +if the benchmark completed successfully, +.Va EX_USAGE +if the parameters specified on the command line were invalid, +.Va EX_PERM +if the user does not have permission to open the specified device, +.Va EX_IOERR +if it was interrupted by an I/O error, and +.Va EX_OSERR +if it was interrupted for any other reason. +.Sh SEE ALSO +.Xr recoverdisk 1 +.Xr sysexits 3 +.Xr diskinfo 8 +.Sh AUTHORS +.An -nosplit +The +.Nm +utility and this manual page were written by +.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . From owner-svn-src-user@FreeBSD.ORG Mon Sep 26 12:20:33 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE4BE106564A; Mon, 26 Sep 2011 12:20:33 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93C2B8FC0C; Mon, 26 Sep 2011 12:20:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8QCKXnS074010; Mon, 26 Sep 2011 12:20:33 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8QCKXWQ074007; Mon, 26 Sep 2011 12:20:33 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201109261220.p8QCKXWQ074007@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 26 Sep 2011 12:20:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225766 - user/des/phybs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 12:20:33 -0000 Author: des Date: Mon Sep 26 12:20:33 2011 New Revision: 225766 URL: http://svn.freebsd.org/changeset/base/225766 Log: Add an option to open the device O_SYNC. Modified: user/des/phybs/phybs.1 user/des/phybs/phybs.c Modified: user/des/phybs/phybs.1 ============================================================================== --- user/des/phybs/phybs.1 Mon Sep 26 12:08:15 2011 (r225765) +++ user/des/phybs/phybs.1 Mon Sep 26 12:20:33 2011 (r225766) @@ -34,7 +34,7 @@ .Nd reveal a storage device's physical block size .Sh SYNOPSIS .Nm -.Op Fl rtw +.Op Fl rsw .Op Fl l Ar minsize .Op Fl h Ar maxsize .Op Fl t Ar total @@ -48,10 +48,10 @@ large I/O operations at various (mis-)al .Pp The .Nm -utility makes a series of passes with increasing block sizes. In each -pass, it either reads or writes (or both) a number of blocks at -increasing offsets relative to the ideal alignment, which is assumed -to be multiples of the block size. +utility makes a series of passes with increasing block sizes. +In each pass, it either reads or writes (or both) a number of +non-consecutive blocks at increasing offsets relative to the ideal +alignment, which is assumed to be multiples of the block size. The results are presented in terms of time elapsed, transactions per second and kB per second. .Pp @@ -79,6 +79,8 @@ The default is the device's logical bloc .It Fl r Perform read operations. This is the default. +.It Fl s +Open the device in synchronous mode. .It Fl t Ar total Specify the total amount of data to read or write in each pass. This must be a power of two and a multiple of the maximum block size Modified: user/des/phybs/phybs.c ============================================================================== --- user/des/phybs/phybs.c Mon Sep 26 12:08:15 2011 (r225765) +++ user/des/phybs/phybs.c Mon Sep 26 12:20:33 2011 (r225766) @@ -52,6 +52,7 @@ static unsigned int maxsize; static unsigned int total; static int opt_r; +static int opt_s; static int opt_w; static int tty = 0; @@ -115,7 +116,7 @@ usage(void) { fprintf(stderr, "usage: phybs %s\n", - "[-rw] [-l minsize] [-h maxsize] [-t total] device"); + "[-rsw] [-l minsize] [-h maxsize] [-t total] device"); exit(1); } @@ -143,11 +144,11 @@ int main(int argc, char *argv[]) { struct stat st; - int fd, opt; + int fd, mode, opt; tty = isatty(STDOUT_FILENO); - while ((opt = getopt(argc, argv, "h:l:rt:w")) != -1) + while ((opt = getopt(argc, argv, "h:l:rst:w")) != -1) switch (opt) { case 'h': maxsize = poweroftwo(opt, optarg); @@ -158,6 +159,9 @@ main(int argc, char *argv[]) case 'r': opt_r = 1; break; + case 's': + opt_s = 1; + break; case 't': total = poweroftwo(opt, optarg); break; @@ -178,7 +182,10 @@ main(int argc, char *argv[]) if (!opt_r && !opt_w) opt_r = 1; - if ((fd = open(device, opt_w ? O_RDWR : O_RDONLY)) == -1) + mode = opt_w ? O_RDWR : O_RDONLY; + if (opt_s) + mode |= O_SYNC; + if ((fd = open(device, mode)) == -1) err(errno == EPERM ? EX_NOPERM : EX_OSERR, "open(%s)", device); if (fstat(fd, &st) != 0) From owner-svn-src-user@FreeBSD.ORG Tue Sep 27 03:27:55 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C48A106564A; Tue, 27 Sep 2011 03:27:55 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D74AC8FC14; Tue, 27 Sep 2011 03:27: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 p8R3RsnF002810; Tue, 27 Sep 2011 03:27:54 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8R3Rslw002808; Tue, 27 Sep 2011 03:27:54 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109270327.p8R3Rslw002808@svn.freebsd.org> From: Adrian Chadd Date: Tue, 27 Sep 2011 03:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225771 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2011 03:27:55 -0000 Author: adrian Date: Tue Sep 27 03:27:54 2011 New Revision: 225771 URL: http://svn.freebsd.org/changeset/base/225771 Log: Add some KTR probes to help me figure out interrupt and RXEOL related issues are hiding. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Tue Sep 27 03:20:52 2011 (r225770) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Tue Sep 27 03:27:54 2011 (r225771) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -101,6 +102,9 @@ __FBSDID("$FreeBSD$"); #include #endif +#define ATH_KTR_INTR KTR_SPARE4 +#define ATH_KTR_ERR KTR_SPARE3 + /* * ATH_BCBUF determines the number of vap's that can transmit @@ -1367,6 +1371,7 @@ ath_intr(void *arg) */ ath_hal_getisr(ah, &status); /* NB: clears ISR too */ DPRINTF(sc, ATH_DEBUG_INTR, "%s: status 0x%x\n", __func__, status); + CTR1(ATH_KTR_INTR, "ath_intr: mask=0x%.8x", status); status &= sc->sc_imask; /* discard unasked for bits */ /* Short-circuit un-handled interrupts */ @@ -1412,6 +1417,7 @@ ath_intr(void *arg) } if (status & HAL_INT_RXEOL) { int imask = sc->sc_imask; + CTR0(ATH_KTR_ERR, "ath_intr: RXEOL"); /* * NB: the hardware should re-read the link when * RXE bit is written, but it doesn't work at @@ -1475,6 +1481,7 @@ ath_intr(void *arg) } if (status & HAL_INT_RXORN) { /* NB: hal marks HAL_INT_FATAL when RXORN is fatal */ + CTR0(ATH_KTR_ERR, "ath_intr: RXORN"); sc->sc_stats.ast_rxorn++; } } @@ -3658,6 +3665,7 @@ ath_rx_proc(void *arg, int npending) u_int64_t tsf; int npkts = 0; + CTR1(ATH_KTR_INTR, "ath_rx_proc: pending=%d", npending); DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s: pending %u\n", __func__, npending); ngood = 0; nf = ath_hal_getchannoise(ah, sc->sc_curchan); @@ -4031,6 +4039,8 @@ rx_next: if (ngood) sc->sc_lastrx = tsf; + CTR2(ATH_KTR_INTR, "ath_rx_proc: npkts=%d, ngood=%d", npkts, ngood); + /* Queue DFS tasklet if needed */ if (ath_dfs_tasklet_needed(sc, sc->sc_curchan)) taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_dfstask); @@ -4042,6 +4052,7 @@ rx_next: */ if (sc->sc_kickpcu) { sc->sc_kickpcu = 0; + CTR0(ATH_KTR_ERR, "ath_rx_proc: kickpcu"); /* * XXX this causes a 3ms delay; and shuts down a lof * XXX is it really needed? Or is it just enough to From owner-svn-src-user@FreeBSD.ORG Tue Sep 27 16:57:14 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 886DC1065670; Tue, 27 Sep 2011 16:57:14 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78E958FC13; Tue, 27 Sep 2011 16:57: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 p8RGvEpF032407; Tue, 27 Sep 2011 16:57:14 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8RGvEUl032405; Tue, 27 Sep 2011 16:57:14 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201109271657.p8RGvEUl032405@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 27 Sep 2011 16:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225802 - user/des/phybs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2011 16:57:14 -0000 Author: des Date: Tue Sep 27 16:57:14 2011 New Revision: 225802 URL: http://svn.freebsd.org/changeset/base/225802 Log: Lengthen the progress bar to cover the entire width of the numbers which will replace it, change the indicator character from '|' to 'O', and increase the update frequency. Modified: user/des/phybs/phybs.c Modified: user/des/phybs/phybs.c ============================================================================== --- user/des/phybs/phybs.c Tue Sep 27 16:33:17 2011 (r225801) +++ user/des/phybs/phybs.c Tue Sep 27 16:57:14 2011 (r225802) @@ -56,8 +56,8 @@ static int opt_s; static int opt_w; static int tty = 0; -static char progress[] = " [----------------]" - "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"; +static char progress[] = " [-----------------------]" + "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"; static void scan(int fd, size_t size, off_t offset, off_t step, unsigned int count) @@ -94,10 +94,10 @@ scan(int fd, size_t size, off_t offset, errx(EX_IOERR, "short write: %ld < %lu", (long)wlen, (unsigned long)size); } - if (tty && i % 256 == 0) { - progress[2 + (i * 16) / count] = '|'; + if (tty && i % 16 == 0) { + progress[2 + (i * 23) / count] = 'O'; fputs(progress, stdout); - progress[2 + (i * 16) / count] = '-'; + progress[2 + (i * 23) / count] = '-'; fflush(stdout); } } From owner-svn-src-user@FreeBSD.ORG Wed Sep 28 12:13:16 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2D11106566C; Wed, 28 Sep 2011 12:13:16 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFCF08FC1E; Wed, 28 Sep 2011 12:13: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 p8SCDGvl072543; Wed, 28 Sep 2011 12:13:16 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8SCDGxS072509; Wed, 28 Sep 2011 12:13:16 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109281213.p8SCDGxS072509@svn.freebsd.org> From: Attilio Rao Date: Wed, 28 Sep 2011 12:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225829 - in user/attilio/vmcontention: . contrib/top etc/mtree gnu/usr.bin/groff/tmac include kerberos5/lib/libasn1 kerberos5/lib/libgssapi_krb5 kerberos5/lib/libgssapi_ntlm kerberos5/... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2011 12:13:16 -0000 Author: attilio Date: Wed Sep 28 12:13:15 2011 New Revision: 225829 URL: http://svn.freebsd.org/changeset/base/225829 Log: MFC Modified: user/attilio/vmcontention/Makefile.inc1 user/attilio/vmcontention/UPDATING user/attilio/vmcontention/etc/mtree/BSD.include.dist user/attilio/vmcontention/gnu/usr.bin/groff/tmac/mdoc.local user/attilio/vmcontention/include/Makefile user/attilio/vmcontention/include/iso646.h user/attilio/vmcontention/kerberos5/lib/libasn1/Makefile user/attilio/vmcontention/kerberos5/lib/libgssapi_krb5/Makefile user/attilio/vmcontention/kerberos5/lib/libgssapi_ntlm/Makefile user/attilio/vmcontention/kerberos5/lib/libgssapi_spnego/Makefile user/attilio/vmcontention/kerberos5/lib/libhdb/Makefile user/attilio/vmcontention/kerberos5/lib/libheimntlm/Makefile user/attilio/vmcontention/kerberos5/lib/libhx509/Makefile user/attilio/vmcontention/kerberos5/lib/libkadm5clnt/Makefile user/attilio/vmcontention/kerberos5/lib/libkadm5srv/Makefile user/attilio/vmcontention/kerberos5/lib/libkafs5/Makefile user/attilio/vmcontention/kerberos5/lib/libkrb5/Makefile user/attilio/vmcontention/kerberos5/lib/libroken/Makefile user/attilio/vmcontention/lib/libc/locale/isspace.3 user/attilio/vmcontention/lib/libfetch/common.c user/attilio/vmcontention/lib/libfetch/common.h user/attilio/vmcontention/lib/libfetch/fetch.3 user/attilio/vmcontention/lib/libfetch/fetch.c user/attilio/vmcontention/lib/libfetch/fetch.h user/attilio/vmcontention/lib/libfetch/file.c user/attilio/vmcontention/lib/libfetch/ftp.c user/attilio/vmcontention/lib/libfetch/http.c user/attilio/vmcontention/release/Makefile.sysinstall user/attilio/vmcontention/sbin/hastctl/hastctl.c user/attilio/vmcontention/sbin/hastd/activemap.c user/attilio/vmcontention/sbin/hastd/control.c user/attilio/vmcontention/sbin/hastd/ebuf.c user/attilio/vmcontention/sbin/hastd/event.c user/attilio/vmcontention/sbin/hastd/hast_proto.c user/attilio/vmcontention/sbin/hastd/hooks.c user/attilio/vmcontention/sbin/hastd/metadata.c user/attilio/vmcontention/sbin/hastd/nv.c user/attilio/vmcontention/sbin/hastd/parse.y user/attilio/vmcontention/sbin/hastd/pjdlog.c user/attilio/vmcontention/sbin/hastd/primary.c user/attilio/vmcontention/sbin/hastd/proto_tcp.c user/attilio/vmcontention/sbin/hastd/rangelock.c user/attilio/vmcontention/sbin/hastd/secondary.c user/attilio/vmcontention/sbin/hastd/subr.c user/attilio/vmcontention/sbin/hastd/synch.h user/attilio/vmcontention/share/examples/cvsup/stable-supfile user/attilio/vmcontention/share/man/man4/smp.4 user/attilio/vmcontention/share/man/man9/ifnet.9 user/attilio/vmcontention/share/misc/committers-src.dot user/attilio/vmcontention/sys/conf/newvers.sh user/attilio/vmcontention/sys/dev/ahci/ahci.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c user/attilio/vmcontention/sys/dev/ath/if_ath.c user/attilio/vmcontention/sys/dev/ath/if_athvar.h user/attilio/vmcontention/sys/dev/usb/quirk/usb_quirk.c user/attilio/vmcontention/sys/dev/usb/usbdevs user/attilio/vmcontention/sys/kern/kern_clock.c user/attilio/vmcontention/sys/kern/kern_exec.c user/attilio/vmcontention/sys/kern/subr_kdb.c user/attilio/vmcontention/sys/kern/subr_syscall.c user/attilio/vmcontention/sys/kern/uipc_usrreq.c user/attilio/vmcontention/sys/modules/ipfw/Makefile user/attilio/vmcontention/sys/netinet/ipfw/ip_fw_pfil.c user/attilio/vmcontention/sys/sys/param.h user/attilio/vmcontention/sys/ufs/ffs/ffs_snapshot.c user/attilio/vmcontention/tools/make_libdeps.sh user/attilio/vmcontention/usr.bin/compress/zopen.c user/attilio/vmcontention/usr.bin/fetch/fetch.1 user/attilio/vmcontention/usr.bin/fetch/fetch.c user/attilio/vmcontention/usr.bin/gzip/zuncompress.c user/attilio/vmcontention/usr.bin/script/script.1 user/attilio/vmcontention/usr.bin/script/script.c user/attilio/vmcontention/usr.sbin/mfiutil/mfi_show.c user/attilio/vmcontention/usr.sbin/pkg_install/add/main.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/contrib/bind9/ (props changed) user/attilio/vmcontention/contrib/binutils/ (props changed) user/attilio/vmcontention/contrib/bzip2/ (props changed) user/attilio/vmcontention/contrib/compiler-rt/ (props changed) user/attilio/vmcontention/contrib/dialog/ (props changed) user/attilio/vmcontention/contrib/ee/ (props changed) user/attilio/vmcontention/contrib/expat/ (props changed) user/attilio/vmcontention/contrib/file/ (props changed) user/attilio/vmcontention/contrib/gcc/ (props changed) user/attilio/vmcontention/contrib/gdb/ (props changed) user/attilio/vmcontention/contrib/gdtoa/ (props changed) user/attilio/vmcontention/contrib/gnu-sort/ (props changed) user/attilio/vmcontention/contrib/groff/ (props changed) user/attilio/vmcontention/contrib/less/ (props changed) user/attilio/vmcontention/contrib/libpcap/ (props changed) user/attilio/vmcontention/contrib/libstdc++/ (props changed) user/attilio/vmcontention/contrib/llvm/ (props changed) user/attilio/vmcontention/contrib/llvm/tools/clang/ (props changed) user/attilio/vmcontention/contrib/ncurses/ (props changed) user/attilio/vmcontention/contrib/netcat/ (props changed) user/attilio/vmcontention/contrib/ntp/ (props changed) user/attilio/vmcontention/contrib/one-true-awk/ (props changed) user/attilio/vmcontention/contrib/openbsm/ (props changed) user/attilio/vmcontention/contrib/openpam/ (props changed) user/attilio/vmcontention/contrib/openresolv/ (props changed) user/attilio/vmcontention/contrib/pf/ (props changed) user/attilio/vmcontention/contrib/sendmail/ (props changed) user/attilio/vmcontention/contrib/tcpdump/ (props changed) user/attilio/vmcontention/contrib/tcsh/ (props changed) user/attilio/vmcontention/contrib/tnftp/ (props changed) user/attilio/vmcontention/contrib/top/ (props changed) user/attilio/vmcontention/contrib/top/install-sh (props changed) user/attilio/vmcontention/contrib/tzcode/stdtime/ (props changed) user/attilio/vmcontention/contrib/tzcode/zic/ (props changed) user/attilio/vmcontention/contrib/tzdata/ (props changed) user/attilio/vmcontention/contrib/wpa/ (props changed) user/attilio/vmcontention/contrib/xz/ (props changed) user/attilio/vmcontention/crypto/openssh/ (props changed) user/attilio/vmcontention/crypto/openssl/ (props changed) user/attilio/vmcontention/gnu/lib/ (props changed) user/attilio/vmcontention/gnu/usr.bin/binutils/ (props changed) user/attilio/vmcontention/gnu/usr.bin/cc/cc_tools/ (props changed) user/attilio/vmcontention/gnu/usr.bin/gdb/ (props changed) user/attilio/vmcontention/lib/libc/ (props changed) user/attilio/vmcontention/lib/libc/stdtime/ (props changed) user/attilio/vmcontention/lib/libutil/ (props changed) user/attilio/vmcontention/lib/libz/ (props changed) user/attilio/vmcontention/sbin/ (props changed) user/attilio/vmcontention/sbin/ipfw/ (props changed) user/attilio/vmcontention/share/mk/bsd.arch.inc.mk (props changed) user/attilio/vmcontention/share/zoneinfo/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/amd64/include/xen/ (props changed) user/attilio/vmcontention/sys/boot/ (props changed) user/attilio/vmcontention/sys/boot/i386/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/ski/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/boot1.chrp/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/ofw/ (props changed) user/attilio/vmcontention/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/ (props changed) user/attilio/vmcontention/sys/contrib/octeon-sdk/ (props changed) user/attilio/vmcontention/sys/contrib/pf/ (props changed) user/attilio/vmcontention/sys/contrib/x86emu/ (props changed) user/attilio/vmcontention/usr.bin/calendar/ (props changed) user/attilio/vmcontention/usr.bin/csup/ (props changed) user/attilio/vmcontention/usr.bin/procstat/ (props changed) user/attilio/vmcontention/usr.sbin/ndiscvt/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvctl/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvd/ (props changed) user/attilio/vmcontention/usr.sbin/rtsold/ (props changed) user/attilio/vmcontention/usr.sbin/zic/ (props changed) Modified: user/attilio/vmcontention/Makefile.inc1 ============================================================================== --- user/attilio/vmcontention/Makefile.inc1 Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/Makefile.inc1 Wed Sep 28 12:13:15 2011 (r225829) @@ -1218,7 +1218,8 @@ _startup_libs+= lib/libc gnu/lib/libgcc__L: lib/libc__L -_prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \ +_prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libhdb} \ + ${_kerberos5_lib_libheimntlm} \ ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ ${_kerberos5_lib_libroken} \ lib/libbz2 lib/libcom_err lib/libcrypt \ @@ -1268,6 +1269,19 @@ secure/lib/libssh__L: lib/libgssapi__L k _secure_lib= secure/lib .endif +.if ${MK_KERBEROS} != "no" +kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L +kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ + kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L +kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L +kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ + secure/lib/libcrypto__L kerberos5/lib/libroken__L +kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ + lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ + kerberos5/lib/libroken__L +kerberos5/lib/libroken__L: lib/libcrypt__L +.endif + .if ${MK_GSSAPI} != "no" _lib_libgssapi= lib/libgssapi .endif @@ -1279,6 +1293,7 @@ _lib_libipx= lib/libipx .if ${MK_KERBEROS} != "no" _kerberos5_lib= kerberos5/lib _kerberos5_lib_libasn1= kerberos5/lib/libasn1 +_kerberos5_lib_libhdb= kerberos5/lib/libhdb _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 _kerberos5_lib_libhx509= kerberos5/lib/libhx509 _kerberos5_lib_libroken= kerberos5/lib/libroken Modified: user/attilio/vmcontention/UPDATING ============================================================================== --- user/attilio/vmcontention/UPDATING Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/UPDATING Wed Sep 28 12:13:15 2011 (r225829) @@ -9,8 +9,8 @@ handbook. Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. -NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW: - FreeBSD 9.x has many debugging features turned on, in both the kernel +NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW: + FreeBSD 10.x has many debugging features turned on, in both the kernel and userland. These features attempt to detect incorrect use of system primitives, and encourage loud failure through extra sanity checking and fail stop semantics. They also substantially impact @@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20110923: + The stable/9 branch created in subversion. This corresponds to the + RELENG_9 branch in CVS. + 20110913: This commit modifies vfs_register() so that it uses a hash calculation to set vfc_typenum, which is enabled by default. Modified: user/attilio/vmcontention/etc/mtree/BSD.include.dist ============================================================================== --- user/attilio/vmcontention/etc/mtree/BSD.include.dist Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/etc/mtree/BSD.include.dist Wed Sep 28 12:13:15 2011 (r225829) @@ -96,6 +96,8 @@ .. bktr .. + ciss + .. firewire .. hwpmc Modified: user/attilio/vmcontention/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- user/attilio/vmcontention/gnu/usr.bin/groff/tmac/mdoc.local Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/gnu/usr.bin/groff/tmac/mdoc.local Wed Sep 28 12:13:15 2011 (r225829) @@ -71,12 +71,13 @@ .ds doc-volume-as-arm arm . .\" Default .Os value -.ds doc-default-operating-system FreeBSD\~9.0 +.ds doc-default-operating-system FreeBSD\~10.0 . .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-7.4 7.4 .ds doc-operating-system-FreeBSD-8.3 8.3 .ds doc-operating-system-FreeBSD-9.0 9.0 +.ds doc-operating-system-FreeBSD-10.0 10.0 . .\" Definitions not (yet) in doc-syms . Modified: user/attilio/vmcontention/include/Makefile ============================================================================== --- user/attilio/vmcontention/include/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/include/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -39,7 +39,7 @@ LDIRS= bsm cam geom net net80211 netatal sys vm LSUBDIRS= cam/ata cam/scsi \ - dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \ + dev/acpica dev/an dev/bktr dev/ciss dev/firewire dev/hwpmc \ dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \ dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ Modified: user/attilio/vmcontention/include/iso646.h ============================================================================== --- user/attilio/vmcontention/include/iso646.h Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/include/iso646.h Wed Sep 28 12:13:15 2011 (r225829) @@ -29,6 +29,8 @@ #ifndef _ISO646_H_ #define _ISO646_H_ +#ifndef __cplusplus + #define and && #define and_eq &= #define bitand & @@ -41,4 +43,6 @@ #define xor ^ #define xor_eq ^= +#endif /* !__cplusplus */ + #endif /* !_ISO646_H_ */ Modified: user/attilio/vmcontention/kerberos5/lib/libasn1/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libasn1/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libasn1/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,7 +1,10 @@ # $FreeBSD$ LIB= asn1 +LDFLAGS= -Wl,--no-undefined INCS= asn1_err.h heim_asn1.h +LDADD= -lcom_err -lroken +DPADD= ${LIBCOM_ERR} ${LIBROKEN} SRCS= asn1_err.c \ asn1_err.h \ Modified: user/attilio/vmcontention/kerberos5/lib/libgssapi_krb5/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libgssapi_krb5/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libgssapi_krb5/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,7 +1,7 @@ # $FreeBSD$ LIB= gssapi_krb5 -LDFLAGS= -Wl,-Bsymbolic +LDFLAGS= -Wl,-Bsymbolic -Wl,--no-undefined LDADD= -lgssapi -lkrb5 -lhx509 -lcrypto -lroken -lasn1 -lcom_err -lcrypt DPADD= ${LIBGSSAPI} ${LIBKRB5} ${LIBHX509} ${LIBCRYPTO} ${LIBROKEN} ${LIBASN1} \ ${LIBCOM_ERR} ${LIBCRYPT} Modified: user/attilio/vmcontention/kerberos5/lib/libgssapi_ntlm/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libgssapi_ntlm/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libgssapi_ntlm/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,9 +1,9 @@ # $FreeBSD$ LIB= gssapi_ntlm -LDFLAGS= -Wl,-Bsymbolic -LDADD= -lkrb5 -lhx509 -lheimntlm -lroken -DPADD= ${LIBKRB5} ${LIBHX509} ${LIBHEIMNTLM} ${LIBROKEN} +LDFLAGS= -Wl,-Bsymbolic -Wl,--no-undefined +LDADD= -lcrypto -lgssapi -lkrb5 -lhx509 -lheimntlm -lroken +DPADD= ${LIBCRYPTO} ${LIBGSSAPI} ${LIBKRB5} ${LIBHX509} ${LIBHEIMNTLM} ${LIBROKEN} SRCS= accept_sec_context.c \ acquire_cred.c \ Modified: user/attilio/vmcontention/kerberos5/lib/libgssapi_spnego/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libgssapi_spnego/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libgssapi_spnego/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,9 +1,9 @@ # $FreeBSD$ LIB= gssapi_spnego -LDFLAGS= -Wl,-Bsymbolic -LDADD= -lgssapi -lasn1 -DPADD= ${LIBGSSAPI} ${LIBASN1} +LDFLAGS= -Wl,-Bsymbolic -Wl,--no-undefined +LDADD= -lgssapi -lasn1 -lroken +DPADD= ${LIBGSSAPI} ${LIBASN1} ${LIBROKEN} SRCS= accept_sec_context.c \ compat.c \ Modified: user/attilio/vmcontention/kerberos5/lib/libhdb/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libhdb/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libhdb/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,6 +1,9 @@ # $FreeBSD$ LIB= hdb +LDFLAGS= -Wl,--no-undefined +LDADD= -lasn1 -lcom_err -lkrb5 -lroken +DPADD= ${LIBASN1} ${LIBCOM_ERR} ${LIBKRB5} ${LIBROKEN} INCS= hdb-private.h \ hdb-protos.h \ Modified: user/attilio/vmcontention/kerberos5/lib/libheimntlm/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libheimntlm/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libheimntlm/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,6 +1,9 @@ # $FreeBSD$ LIB= heimntlm +LDFLAGS= -Wl,--no-undefined +LDADD= -lcrypto -lkrb5 +DPADD= ${LIBCRYPTO} ${LIBKRB5} SRCS= ntlm.c INCS= heimntlm.h heimntlm-protos.h CFLAGS+=-I${KRB5DIR}/lib/ntlm Modified: user/attilio/vmcontention/kerberos5/lib/libhx509/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libhx509/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libhx509/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,7 +1,10 @@ # $FreeBSD$ LIB= hx509 +LDFLAGS= -Wl,--no-undefined VERSION_MAP= ${KRB5DIR}/lib/hx509/version-script.map +LDADD= -lasn1 -lcom_err -lcrypto -lroken +DPADD= ${LIBASN1} ${LIBCOM_ERR} ${LIBCRYPTO} ${LIBROKEN} INCS= hx509-private.h \ hx509-protos.h \ Modified: user/attilio/vmcontention/kerberos5/lib/libkadm5clnt/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libkadm5clnt/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libkadm5clnt/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,6 +1,9 @@ # $FreeBSD$ LIB= kadm5clnt +LDFLAGS= -Wl,--no-undefined +LDADD= -lcom_err -lkrb5 -lroken +DPADD= ${LIBCOM_ERR} ${LIBKRB5} ${LIBROKEN} INCS= admin.h \ kadm5-private.h \ Modified: user/attilio/vmcontention/kerberos5/lib/libkadm5srv/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libkadm5srv/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libkadm5srv/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,6 +1,9 @@ # $FreeBSD$ LIB= kadm5srv +LDFLAGS= -Wl,--no-undefined +LDADD= -lcom_err -lhdb -lkrb5 -lroken +DPADD= ${LIBCOM_ERR} ${LIBHDB} ${LIBKRB5} ${LIBROKEN} VERSION_MAP= ${KRB5DIR}/lib/kadm5/version-script.map SRCS= acl.c \ Modified: user/attilio/vmcontention/kerberos5/lib/libkafs5/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libkafs5/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libkafs5/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,6 +1,9 @@ # $FreeBSD$ LIB= kafs5 +LDFLAGS= -Wl,--no-undefined +LDADD= -lasn1 -lkrb5 -lroken +DPADD= ${LIBASN1} ${LIBKRB5} ${LIBROKEN} INCS= kafs.h MAN= kafs5.3 Modified: user/attilio/vmcontention/kerberos5/lib/libkrb5/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libkrb5/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libkrb5/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,7 +1,10 @@ # $FreeBSD$ LIB= krb5 +LDFLAGS= -Wl,--no-undefined VERSION_MAP= ${KRB5DIR}/lib/krb5/version-script.map +LDADD= -lasn1 -lcom_err -lcrypt -lcrypto -lhx509 -lroken +DPADD= ${LIBASN1} ${LIBCOM_ERR} ${LIBCRYPT} ${LIBCRYPTO} ${LIBHX509} ${LIBROKEN} INCS= heim_err.h \ heim_threads.h \ Modified: user/attilio/vmcontention/kerberos5/lib/libroken/Makefile ============================================================================== --- user/attilio/vmcontention/kerberos5/lib/libroken/Makefile Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/kerberos5/lib/libroken/Makefile Wed Sep 28 12:13:15 2011 (r225829) @@ -1,6 +1,8 @@ # $FreeBSD$ LIB= roken +LDADD= -lcrypt +DPADD= ${LIBCRYPT} INCS= roken.h roken-common.h SRCS= base64.c \ Modified: user/attilio/vmcontention/lib/libc/locale/isspace.3 ============================================================================== --- user/attilio/vmcontention/lib/libc/locale/isspace.3 Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/lib/libc/locale/isspace.3 Wed Sep 28 12:13:15 2011 (r225829) @@ -47,16 +47,16 @@ .Sh DESCRIPTION The .Fn isspace -function tests for the white-space characters. +function tests for white-space characters. For any locale, this includes the following standard characters: .Pp .Bl -column \&`\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___ .It "\&``\et''\t``\en''\t``\ev''\t``\ef''\t``\er''\t`` ''" .El .Pp -In the "C" locale +In the "C" locale, .Fn isspace -successful test is limited to this characters only. +returns non-zero for these characters only. The value of the argument must be representable as an .Vt "unsigned char" or the value of Modified: user/attilio/vmcontention/lib/libfetch/common.c ============================================================================== --- user/attilio/vmcontention/lib/libfetch/common.c Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/lib/libfetch/common.c Wed Sep 28 12:13:15 2011 (r225829) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav + * Copyright (c) 1998-2011 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: user/attilio/vmcontention/lib/libfetch/common.h ============================================================================== --- user/attilio/vmcontention/lib/libfetch/common.h Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/lib/libfetch/common.h Wed Sep 28 12:13:15 2011 (r225829) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav + * Copyright (c) 1998-2011 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: user/attilio/vmcontention/lib/libfetch/fetch.3 ============================================================================== --- user/attilio/vmcontention/lib/libfetch/fetch.3 Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/lib/libfetch/fetch.3 Wed Sep 28 12:13:15 2011 (r225829) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav +.\" Copyright (c) 1998-2011 Dag-Erling Smørgrav .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 26, 2010 +.Dd September 27, 2011 .Dt FETCH 3 .Os .Sh NAME @@ -318,9 +318,19 @@ and implement the FTP protocol as described in RFC959. .Pp If the +.Ql P +(not passive) flag is specified, an active (rather than passive) +connection will be attempted. +.Pp +The .Ql p -(passive) flag is specified, a passive (rather than active) connection -will be attempted. +flag is supported for compatibility with earlier versions where active +connections were the default. +It has precedence over the +.Ql P +flag, so if both are specified, +.Nm +will use a passive connection. .Pp If the .Ql l @@ -475,9 +485,11 @@ connections will be bound. .It Ev FTP_LOGIN Default FTP login if none was provided in the URL. .It Ev FTP_PASSIVE_MODE -If set to anything but +If set to .Ql no , -forces the FTP code to use passive mode. +forces the FTP code to use active mode. +If set to any other value, forces passive mode even if the application +requested active mode. .It Ev FTP_PASSWORD Default FTP password if the remote server requests one and none was provided in the URL. Modified: user/attilio/vmcontention/lib/libfetch/fetch.c ============================================================================== --- user/attilio/vmcontention/lib/libfetch/fetch.c Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/lib/libfetch/fetch.c Wed Sep 28 12:13:15 2011 (r225829) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav + * Copyright (c) 1998-2004 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: user/attilio/vmcontention/lib/libfetch/fetch.h ============================================================================== --- user/attilio/vmcontention/lib/libfetch/fetch.h Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/lib/libfetch/fetch.h Wed Sep 28 12:13:15 2011 (r225829) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav + * Copyright (c) 1998-2004 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: user/attilio/vmcontention/lib/libfetch/file.c ============================================================================== --- user/attilio/vmcontention/lib/libfetch/file.c Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/lib/libfetch/file.c Wed Sep 28 12:13:15 2011 (r225829) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav + * Copyright (c) 1998-2011 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: user/attilio/vmcontention/lib/libfetch/ftp.c ============================================================================== --- user/attilio/vmcontention/lib/libfetch/ftp.c Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/lib/libfetch/ftp.c Wed Sep 28 12:13:15 2011 (r225829) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav + * Copyright (c) 1998-2011 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -633,13 +633,12 @@ ftp_transfer(conn_t *conn, const char *o /* check flags */ low = CHECK_FLAG('l'); - pasv = CHECK_FLAG('p'); + pasv = CHECK_FLAG('p') || !CHECK_FLAG('P'); verbose = CHECK_FLAG('v'); /* passive mode */ - if (!pasv) - pasv = ((s = getenv("FTP_PASSIVE_MODE")) != NULL && - strncasecmp(s, "no", 2) != 0); + if ((s = getenv("FTP_PASSIVE_MODE")) != NULL) + pasv = (strncasecmp(s, "no", 2) != 0); /* isolate filename */ filename = ftp_filename(file, &filenamelen, &type); Modified: user/attilio/vmcontention/lib/libfetch/http.c ============================================================================== --- user/attilio/vmcontention/lib/libfetch/http.c Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/lib/libfetch/http.c Wed Sep 28 12:13:15 2011 (r225829) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav + * Copyright (c) 2000-2011 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: user/attilio/vmcontention/release/Makefile.sysinstall ============================================================================== --- user/attilio/vmcontention/release/Makefile.sysinstall Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/release/Makefile.sysinstall Wed Sep 28 12:13:15 2011 (r225829) @@ -24,16 +24,16 @@ # Set these, release builder! # # Fixed version: -#BUILDNAME=9.0-CURRENT +#BUILDNAME=10.0-CURRENT # # Automatic SNAP versioning: DATE != date +%Y%m%d -BASE = 9.0 +BASE = 10.0 BUILDNAME?=${BASE}-${DATE}-SNAP # #CHROOTDIR=/junk/release # If this is a -stable snapshot, then set -#RELEASETAG=RELENG_8 +#RELEASETAG=RELENG_9 # # To test a release with a source tree containing patches and # other work. This tree will get copied instead of getting the @@ -72,7 +72,7 @@ BUILDNAME?=${BASE}-${DATE}-SNAP # # Subversion branch to build for src. If this is not set then it is # automatically computed from RELEASETAG. -#SVNBRANCH=stable/8 +#SVNBRANCH=stable/9 # # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we # are building an official release. Otherwise, we are building for @@ -588,7 +588,7 @@ release rerelease: echo " for i in ${MAKEINDEXPORTS}" >> ${_MK} echo " do" >> ${_MK} echo " cd /usr/ports/\$${i}" >> ${_MK} - echo " env -i HTTP_PROXY=$${HTTP_PROXY} FTP_PROXY=$${FTP_PROXY} FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \\" >> ${_MK} + echo " env -i HTTP_PROXY=$${HTTP_PROXY} FTP_PROXY=$${FTP_PROXY} FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-yes} PATH=$${PATH} \\" >> ${_MK} echo " make all install clean BATCH=yes FORCE_PKG_REGISTER=yes" >> ${_MK} echo " done" >> ${_MK} echo " cd /usr/ports" >> ${_MK} Modified: user/attilio/vmcontention/sbin/hastctl/hastctl.c ============================================================================== --- user/attilio/vmcontention/sbin/hastctl/hastctl.c Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/sbin/hastctl/hastctl.c Wed Sep 28 12:13:15 2011 (r225829) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -433,19 +432,19 @@ main(int argc, char *argv[]) pjdlog_debug_set(debug); cfg = yy_config_parse(cfgpath, true); - assert(cfg != NULL); + PJDLOG_ASSERT(cfg != NULL); switch (cmd) { case CMD_CREATE: control_create(argc, argv, mediasize, extentsize, keepdirty); /* NOTREACHED */ - assert(!"What are we doing here?!"); + PJDLOG_ABORT("What are we doing here?!"); break; case CMD_DUMP: /* Dump metadata from local component of the given resource. */ control_dump(argc, argv); /* NOTREACHED */ - assert(!"What are we doing here?!"); + PJDLOG_ABORT("What are we doing here?!"); break; case CMD_ROLE: /* Change role for the given resources. */ @@ -476,7 +475,7 @@ main(int argc, char *argv[]) } break; default: - assert(!"Impossible command!"); + PJDLOG_ABORT("Impossible command!"); } /* Setup control connection... */ @@ -523,7 +522,7 @@ main(int argc, char *argv[]) error = control_status(nv); break; default: - assert(!"Impossible command!"); + PJDLOG_ABORT("Impossible command!"); } exit(error); Modified: user/attilio/vmcontention/sbin/hastd/activemap.c ============================================================================== --- user/attilio/vmcontention/sbin/hastd/activemap.c Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/sbin/hastd/activemap.c Wed Sep 28 12:13:15 2011 (r225829) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include /* powerof2() */ #include -#include #include #include #include @@ -41,7 +40,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include + +#include "activemap.h" + +#ifndef PJDLOG_ASSERT +#include +#define PJDLOG_ASSERT(...) assert(__VA_ARGS__) +#endif #define ACTIVEMAP_MAGIC 0xac71e4 struct activemap { @@ -93,9 +99,9 @@ off2ext(const struct activemap *amp, off { int extent; - assert(offset >= 0 && offset < amp->am_mediasize); + PJDLOG_ASSERT(offset >= 0 && offset < amp->am_mediasize); extent = (offset >> amp->am_extentshift); - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); return (extent); } @@ -104,9 +110,9 @@ ext2off(const struct activemap *amp, int { off_t offset; - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); offset = ((off_t)extent << amp->am_extentshift); - assert(offset >= 0 && offset < amp->am_mediasize); + PJDLOG_ASSERT(offset >= 0 && offset < amp->am_mediasize); return (offset); } @@ -122,7 +128,7 @@ ext2reqs(const struct activemap *amp, in if (ext < amp->am_nextents - 1) return (((amp->am_extentsize - 1) / MAXPHYS) + 1); - assert(ext == amp->am_nextents - 1); + PJDLOG_ASSERT(ext == amp->am_nextents - 1); left = amp->am_mediasize % amp->am_extentsize; if (left == 0) left = amp->am_extentsize; @@ -139,13 +145,13 @@ activemap_init(struct activemap **ampp, { struct activemap *amp; - assert(ampp != NULL); - assert(mediasize > 0); - assert(extentsize > 0); - assert(powerof2(extentsize)); - assert(sectorsize > 0); - assert(powerof2(sectorsize)); - assert(keepdirty > 0); + PJDLOG_ASSERT(ampp != NULL); + PJDLOG_ASSERT(mediasize > 0); + PJDLOG_ASSERT(extentsize > 0); + PJDLOG_ASSERT(powerof2(extentsize)); + PJDLOG_ASSERT(sectorsize > 0); + PJDLOG_ASSERT(powerof2(sectorsize)); + PJDLOG_ASSERT(keepdirty > 0); amp = malloc(sizeof(*amp)); if (amp == NULL) @@ -225,10 +231,10 @@ keepdirty_add(struct activemap *amp, int */ if (amp->am_nkeepdirty >= amp->am_nkeepdirty_limit) { kd = TAILQ_LAST(&->am_keepdirty, skeepdirty); - assert(kd != NULL); + PJDLOG_ASSERT(kd != NULL); TAILQ_REMOVE(&->am_keepdirty, kd, kd_next); amp->am_nkeepdirty--; - assert(amp->am_nkeepdirty > 0); + PJDLOG_ASSERT(amp->am_nkeepdirty > 0); } if (kd == NULL) kd = malloc(sizeof(*kd)); @@ -261,7 +267,7 @@ keepdirty_free(struct activemap *amp) amp->am_nkeepdirty--; free(kd); } - assert(amp->am_nkeepdirty == 0); + PJDLOG_ASSERT(amp->am_nkeepdirty == 0); } /* @@ -271,7 +277,7 @@ void activemap_free(struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); amp->am_magic = 0; @@ -293,8 +299,8 @@ activemap_write_start(struct activemap * off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(length > 0); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(length > 0); modified = false; end = offset + length - 1; @@ -307,7 +313,7 @@ activemap_write_start(struct activemap * * was modified and has to be flushed to disk. */ if (amp->am_memtab[ext]++ == 0) { - assert(!bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(!bit_test(amp->am_memmap, ext)); bit_set(amp->am_memmap, ext); amp->am_ndirty++; } @@ -329,8 +335,8 @@ activemap_write_complete(struct activema off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(length > 0); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(length > 0); modified = false; end = offset + length - 1; @@ -342,8 +348,8 @@ activemap_write_complete(struct activema * By returning true we inform the caller that on-disk bitmap * was modified and has to be flushed to disk. */ - assert(amp->am_memtab[ext] > 0); - assert(bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(amp->am_memtab[ext] > 0); + PJDLOG_ASSERT(bit_test(amp->am_memmap, ext)); if (--amp->am_memtab[ext] == 0) { bit_clear(amp->am_memmap, ext); amp->am_ndirty--; @@ -365,15 +371,15 @@ activemap_extent_complete(struct activem bool modified; int reqs; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); modified = false; reqs = ext2reqs(amp, extent); - assert(amp->am_memtab[extent] >= reqs); + PJDLOG_ASSERT(amp->am_memtab[extent] >= reqs); amp->am_memtab[extent] -= reqs; - assert(bit_test(amp->am_memmap, extent)); + PJDLOG_ASSERT(bit_test(amp->am_memmap, extent)); if (amp->am_memtab[extent] == 0) { bit_clear(amp->am_memmap, extent); amp->am_ndirty--; @@ -390,7 +396,7 @@ uint64_t activemap_ndirty(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_ndirty); } @@ -403,7 +409,7 @@ bool activemap_differ(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (memcmp(amp->am_diskmap, amp->am_memmap, amp->am_mapsize) != 0); @@ -416,7 +422,7 @@ size_t activemap_size(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_mapsize); } @@ -429,7 +435,7 @@ size_t activemap_ondisk_size(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_diskmapsize); } @@ -442,8 +448,8 @@ activemap_copyin(struct activemap *amp, { int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(size >= amp->am_mapsize); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(size >= amp->am_mapsize); memcpy(amp->am_diskmap, buf, amp->am_mapsize); memcpy(amp->am_memmap, buf, amp->am_mapsize); @@ -481,8 +487,8 @@ activemap_merge(struct activemap *amp, c bitstr_t *remmap = __DECONST(bitstr_t *, buf); int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(size >= amp->am_mapsize); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(size >= amp->am_mapsize); bit_ffs(remmap, amp->am_nextents, &ext); if (ext == -1) { @@ -521,7 +527,7 @@ const unsigned char * activemap_bitmap(struct activemap *amp, size_t *sizep) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); if (sizep != NULL) *sizep = amp->am_diskmapsize; @@ -539,11 +545,11 @@ activemap_calc_ondisk_size(uint64_t medi { uint64_t nextents, mapsize; - assert(mediasize > 0); - assert(extentsize > 0); - assert(powerof2(extentsize)); - assert(sectorsize > 0); - assert(powerof2(sectorsize)); + PJDLOG_ASSERT(mediasize > 0); + PJDLOG_ASSERT(extentsize > 0); + PJDLOG_ASSERT(powerof2(extentsize)); + PJDLOG_ASSERT(sectorsize > 0); + PJDLOG_ASSERT(powerof2(sectorsize)); nextents = ((mediasize - 1) / extentsize) + 1; mapsize = sizeof(bitstr_t) * bitstr_size(nextents); @@ -558,7 +564,7 @@ activemap_sync_rewind(struct activemap * { int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); bit_ffs(amp->am_syncmap, amp->am_nextents, &ext); if (ext == -1) { @@ -581,9 +587,9 @@ activemap_sync_offset(struct activemap * off_t syncoff, left; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(lengthp != NULL); - assert(syncextp != NULL); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(lengthp != NULL); + PJDLOG_ASSERT(syncextp != NULL); *syncextp = -1; @@ -632,9 +638,10 @@ activemap_sync_offset(struct activemap * if (left > MAXPHYS) left = MAXPHYS; - assert(left >= 0 && left <= MAXPHYS); - assert(syncoff >= 0 && syncoff < amp->am_mediasize); - assert(syncoff + left >= 0 && syncoff + left <= amp->am_mediasize); + PJDLOG_ASSERT(left >= 0 && left <= MAXPHYS); + PJDLOG_ASSERT(syncoff >= 0 && syncoff < amp->am_mediasize); + PJDLOG_ASSERT(syncoff + left >= 0 && + syncoff + left <= amp->am_mediasize); *lengthp = left; return (syncoff); @@ -651,7 +658,7 @@ activemap_need_sync(struct activemap *am off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); modified = false; end = offset + length - 1; @@ -659,7 +666,7 @@ activemap_need_sync(struct activemap *am for (ext = off2ext(amp, offset); ext <= off2ext(amp, end); ext++) { if (bit_test(amp->am_syncmap, ext)) { /* Already marked for synchronization. */ - assert(bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(bit_test(amp->am_memmap, ext)); continue; } bit_set(amp->am_syncmap, ext); Modified: user/attilio/vmcontention/sbin/hastd/control.c ============================================================================== --- user/attilio/vmcontention/sbin/hastd/control.c Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/sbin/hastd/control.c Wed Sep 28 12:13:15 2011 (r225829) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -82,8 +81,8 @@ control_set_role_common(struct hastd_con nv_add_string(nvout, name, "resource%u", no); if (res == NULL) { - assert(cfg != NULL); - assert(name != NULL); + PJDLOG_ASSERT(cfg != NULL); + PJDLOG_ASSERT(name != NULL); TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { if (strcmp(res->hr_name, name) == 0) @@ -94,7 +93,7 @@ control_set_role_common(struct hastd_con return; } } - assert(res != NULL); + PJDLOG_ASSERT(res != NULL); /* Send previous role back. */ nv_add_string(nvout, role2str(res->hr_role), "role%u", no); @@ -222,9 +221,9 @@ control_status(struct hastd_config *cfg, struct hast_resource *res, const char *name, unsigned int no) { - assert(cfg != NULL); - assert(nvout != NULL); - assert(name != NULL); + PJDLOG_ASSERT(cfg != NULL); + PJDLOG_ASSERT(nvout != NULL); + PJDLOG_ASSERT(name != NULL); /* Name is always needed. */ nv_add_string(nvout, name, "resource%u", no); @@ -239,7 +238,7 @@ control_status(struct hastd_config *cfg, return; } } - assert(res != NULL); + PJDLOG_ASSERT(res != NULL); nv_add_string(nvout, res->hr_provname, "provname%u", no); nv_add_string(nvout, res->hr_localpath, "localpath%u", no); nv_add_string(nvout, res->hr_remoteaddr, "remoteaddr%u", no); @@ -267,7 +266,7 @@ control_status(struct hastd_config *cfg, switch (res->hr_role) { case HAST_ROLE_PRIMARY: - assert(res->hr_workerpid != 0); + PJDLOG_ASSERT(res->hr_workerpid != 0); /* FALLTHROUGH */ case HAST_ROLE_SECONDARY: if (res->hr_workerpid != 0) @@ -470,7 +469,7 @@ ctrl_thread(void *arg) * something related to us has changes, it sends reload * message to us. */ - assert(res->hr_role == HAST_ROLE_PRIMARY); + PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY); primary_config_reload(res, nvin); nv_add_int16(nvout, 0, "error"); break; Modified: user/attilio/vmcontention/sbin/hastd/ebuf.c ============================================================================== --- user/attilio/vmcontention/sbin/hastd/ebuf.c Wed Sep 28 11:57:10 2011 (r225828) +++ user/attilio/vmcontention/sbin/hastd/ebuf.c Wed Sep 28 12:13:15 2011 (r225829) @@ -32,15 +32,21 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include #include #include +#include + #include "ebuf.h" +#ifndef PJDLOG_ASSERT +#include +#define PJDLOG_ASSERT(...) assert(__VA_ARGS__) +#endif + #define EBUF_MAGIC 0xeb0f41c struct ebuf { /* Magic to assert the caller uses valid structure. */ @@ -91,7 +97,7 @@ void ebuf_free(struct ebuf *eb) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); eb->eb_magic = 0; @@ -103,7 +109,7 @@ int ebuf_add_head(struct ebuf *eb, const void *data, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); if (size > (size_t)(eb->eb_used - eb->eb_start)) { /* @@ -113,7 +119,7 @@ ebuf_add_head(struct ebuf *eb, const voi if (ebuf_head_extend(eb, size) < 0) return (-1); } - assert(size <= (size_t)(eb->eb_used - eb->eb_start)); + PJDLOG_ASSERT(size <= (size_t)(eb->eb_used - eb->eb_start)); eb->eb_size += size; eb->eb_used -= size; @@ -130,7 +136,7 @@ int ebuf_add_tail(struct ebuf *eb, const void *data, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); if (size > (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))) { /* @@ -140,7 +146,8 @@ ebuf_add_tail(struct ebuf *eb, const voi if (ebuf_tail_extend(eb, size) < 0) return (-1); } - assert(size <= (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))); + PJDLOG_ASSERT(size <= + (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))); /* * If data is NULL the caller just wants to reserve space. @@ -156,8 +163,8 @@ void ebuf_del_head(struct ebuf *eb, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); - assert(size <= eb->eb_size); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(size <= eb->eb_size); eb->eb_used += size; eb->eb_size -= size; @@ -167,8 +174,8 @@ void ebuf_del_tail(struct ebuf *eb, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); - assert(size <= eb->eb_size); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(size <= eb->eb_size); eb->eb_size -= size; } @@ -180,7 +187,7 @@ void * ebuf_data(struct ebuf *eb, size_t *sizep) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Sep 28 15:36:09 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28DBC106564A; Wed, 28 Sep 2011 15:36:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17D1F8FC08; Wed, 28 Sep 2011 15:36:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8SFa845079431; Wed, 28 Sep 2011 15:36:08 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8SFa8Ig079429; Wed, 28 Sep 2011 15:36:08 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109281536.p8SFa8Ig079429@svn.freebsd.org> From: Adrian Chadd Date: Wed, 28 Sep 2011 15:36:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225842 - user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2011 15:36:09 -0000 Author: adrian Date: Wed Sep 28 15:36:08 2011 New Revision: 225842 URL: http://svn.freebsd.org/changeset/base/225842 Log: Flip back to the atheros defaults for now. Now that I've figured out why I'm getting performance issues on these mips boards (interrupts occuring in a race window between critical_enter and "wait", and thus being delayed until the next interrupt), this provides better RX performance under heavy UDP load. This doesn't fix the issue - it just means that under heavy UDP load, I'm not getting 1 RX interrupt every 2ms. This turns out not to be often enough in some occasional situations. Some more research is needed though.. Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Wed Sep 28 15:01:20 2011 (r225841) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Wed Sep 28 15:36:08 2011 (r225842) @@ -361,8 +361,8 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO OS_REG_WRITE(ah, AR_MIRT, 0); #ifdef AH_AR5416_INTERRUPT_MITIGATION - OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 500); - OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 2000); + OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 250); + OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 700); #endif ar5416InitBB(ah, chan); From owner-svn-src-user@FreeBSD.ORG Thu Sep 29 03:10:42 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 937C7106564A; Thu, 29 Sep 2011 03:10:42 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69C1A8FC08; Thu, 29 Sep 2011 03:10: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 p8T3AgqK001903; Thu, 29 Sep 2011 03:10:42 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8T3AgZO001901; Thu, 29 Sep 2011 03:10:42 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109290310.p8T3AgZO001901@svn.freebsd.org> From: Adrian Chadd Date: Thu, 29 Sep 2011 03:10:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225860 - user/adrian/if_ath_tx/sys/mips/mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 03:10:42 -0000 Author: adrian Date: Thu Sep 29 03:10:42 2011 New Revision: 225860 URL: http://svn.freebsd.org/changeset/base/225860 Log: The MIPS cpu_idle() routine is unfortunately buggy now that mav's eventtimer code has gone into the tree. If an interrupt comes in after critical_enter() is called but before "wait" occurs, the interrupt will be handled but it won't: * preempt the current idle thread, if PREEMPTION is enabled and you're using the 4BSD scheduler; * won't interrupt "wait", because it occured before it; * won't be handled until the next interrupt that occurs after the "wait" instruction is entered. So the issues with if_arge and if_ath can be traced down to a race with this particular behaviour in MIPS cpu_idle(). The interrupt would be posted but not handled until another interrupt triggers things. I've tried doing what is done in i386 - * interrupts are disabled * sched_runnable() is checked - if it's runnable, skip calling wait and instead reenable interrupts * otherwise atomically enable interrupts and call hlt. If an interrupt has come in and scheduled a netisr or taskqueue call, it'll (hopefully!) trip sched_runnable() and thus skip the wait. The atomic nature of "sti; hlt" is apparently documented for the i386. This way there's no race where an interrupt comes in before the hlt and doesn't wake it up. Now, I've tried the same for MIPS but it doesn't seem to fix things. The behaviour of wait is unfortunately implementation dependent and someone who is much more well versed in the art of MIPS hackery will have to fix it. So for now, I've #if 0'ed the whole thing and left cpu_idle to just do nothing. This fixes all the issues I've been seeing and allows me to acheive 230mbit UDP RX/TX and 150mbit TCP TX/RX without TX/RX queue servicing issues. Whatever is left is due to ath interrupt handling and packet scheduling. Modified: user/adrian/if_ath_tx/sys/mips/mips/machdep.c Modified: user/adrian/if_ath_tx/sys/mips/mips/machdep.c ============================================================================== --- user/adrian/if_ath_tx/sys/mips/mips/machdep.c Thu Sep 29 02:57:08 2011 (r225859) +++ user/adrian/if_ath_tx/sys/mips/mips/machdep.c Thu Sep 29 03:10:42 2011 (r225860) @@ -488,20 +488,33 @@ spinlock_exit(void) void cpu_idle(int busy) { +#if 0 + register_t m; + KASSERT((mips_rd_status() & MIPS_SR_INT_IE) != 0, ("interrupts disabled in idle process.")); KASSERT((mips_rd_status() & MIPS_INT_MASK) != 0, ("all interrupts masked in idle process.")); + m = intr_disable(); if (!busy) { critical_enter(); cpu_idleclock(); } - __asm __volatile ("wait"); + + if (sched_runnable()) + intr_restore(m); + else { + /* XXX not atomic! */ + intr_restore(m); + __asm __volatile ("wait\n"); + } + if (!busy) { cpu_activeclock(); critical_exit(); } +#endif } int From owner-svn-src-user@FreeBSD.ORG Thu Sep 29 05:16:53 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBADD106564A; Thu, 29 Sep 2011 05:16:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C245C8FC08; Thu, 29 Sep 2011 05:16: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 p8T5GrKV005779; Thu, 29 Sep 2011 05:16:53 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8T5Gra1005777; Thu, 29 Sep 2011 05:16:53 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109290516.p8T5Gra1005777@svn.freebsd.org> From: Adrian Chadd Date: Thu, 29 Sep 2011 05:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225862 - user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 05:16:54 -0000 Author: adrian Date: Thu Sep 29 05:16:53 2011 New Revision: 225862 URL: http://svn.freebsd.org/changeset/base/225862 Log: General RX interrupt mitigation fixes. * From what I can tell, interrupt mitigation doesn't mitigate RXERR events, only RXOK events. I'm waiting for confirmation from Atheros, but this is what their driver does. * Yes, RXOK is set in AR_ISR even if it is clear in AR_IMR. So make sure HAL_INT_RX isn't set if interrupt mitigation is enabled. * Add/remove comments in order to better document what is going on. Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Thu Sep 29 03:37:42 2011 (r225861) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Thu Sep 29 05:16:53 2011 (r225862) @@ -132,17 +132,6 @@ ar5416GetPendingInterrupts(struct ath_ha return AH_FALSE; } - /* - * XXX TODO: see whether the hardware signals AR_ISR_RXOK - * even if RX interrupt mitigation is enabled (but then - * doesn't trigger an interrupt per RX packet) - which means - * we'll be setting HAL_INT_RX even before the RX mitigation - * timers have expired. - * - * XXX TODO: do the same for the TX interrupts and TX interrupt - * mitigation. - */ - *masked = isr & HAL_INT_COMMON; if (isr & (AR_ISR_RXMINTR | AR_ISR_RXINTM)) { @@ -153,9 +142,21 @@ ar5416GetPendingInterrupts(struct ath_ha } /* - * Don't signal this when doing interrupt mitigation + * When doing RX interrupt mitigation, the RXOK bit is set + * in AR_ISR even if the relevant bit in AR_IMR is clear. + * Since this interrupt may be due to another source, don't + * just automatically set HAL_INT_RX if it's set, otherwise + * we could prematurely service the RX queue. + * + * In some cases, the driver can even handle all the RX + * frames just before the mitigation interrupt fires. + * The subsequent RX processing trip will then end up + * processing 0 frames. */ -#ifndef AH_AR5416_INTERRUPT_MITIGATION +#ifdef AH_AR5416_INTERRUPT_MITIGATION + if (isr & AR_ISR_RXERR) + *masked |= HAL_INT_RX; +#else if (isr & (AR_ISR_RXOK | AR_ISR_RXERR)) *masked |= HAL_INT_RX; #endif From owner-svn-src-user@FreeBSD.ORG Thu Sep 29 05:20:43 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6927D106566B; Thu, 29 Sep 2011 05:20:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EEFA8FC12; Thu, 29 Sep 2011 05:20: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 p8T5KhXT005971; Thu, 29 Sep 2011 05:20:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8T5Khpt005967; Thu, 29 Sep 2011 05:20:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109290520.p8T5Khpt005967@svn.freebsd.org> From: Adrian Chadd Date: Thu, 29 Sep 2011 05:20:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225863 - in user/adrian/if_ath_tx/sys/dev/ath: . ath_hal ath_hal/ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 05:20:43 -0000 Author: adrian Date: Thu Sep 29 05:20:42 2011 New Revision: 225863 URL: http://svn.freebsd.org/changeset/base/225863 Log: Add in a local patch (not likely a merge candidate to -HEAD in this state) which enables KTR logging for the interrupt status registers. * Add a new field to the public HAL * add in code to ar5416GetPendingInterrupts() which populates it based on the contents of the AR_ISR{_S[0..5]} registers * log it via KTR in ath_intr() Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah.h user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah.h Thu Sep 29 05:16:53 2011 (r225862) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah.h Thu Sep 29 05:20:42 2011 (r225863) @@ -809,6 +809,8 @@ struct ath_hal { uint16_t *ah_eepromdata; /* eeprom buffer, if needed */ + uint32_t ah_intrstate[8]; /* last int state */ + HAL_OPS_CONFIG ah_config; const HAL_RATE_TABLE *__ahdecl(*ah_getRateTable)(struct ath_hal *, u_int mode); Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Thu Sep 29 05:16:53 2011 (r225862) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Thu Sep 29 05:20:42 2011 (r225863) @@ -70,6 +70,8 @@ ar5416GetPendingInterrupts(struct ath_ha uint32_t isr, isr0, isr1, sync_cause = 0; HAL_CAPABILITIES *pCap = &AH_PRIVATE(ah)->ah_caps; + bzero(&ah->ah_intrstate, sizeof(ah->ah_intrstate)); + /* * Verify there's a mac interrupt and the RTC is on. */ @@ -90,6 +92,14 @@ ar5416GetPendingInterrupts(struct ath_ha return AH_FALSE; } + ah->ah_intrstate[0] = isr; + ah->ah_intrstate[1] = OS_REG_READ(ah, AR_ISR_S0); + ah->ah_intrstate[2] = OS_REG_READ(ah, AR_ISR_S1); + ah->ah_intrstate[3] = OS_REG_READ(ah, AR_ISR_S2); + ah->ah_intrstate[4] = OS_REG_READ(ah, AR_ISR_S3); + ah->ah_intrstate[5] = OS_REG_READ(ah, AR_ISR_S4); + ah->ah_intrstate[6] = OS_REG_READ(ah, AR_ISR_S5); + if (isr != 0) { struct ath_hal_5212 *ahp = AH5212(ah); uint32_t mask2; Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Thu Sep 29 05:16:53 2011 (r225862) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Thu Sep 29 05:20:42 2011 (r225863) @@ -1372,6 +1372,13 @@ ath_intr(void *arg) ath_hal_getisr(ah, &status); /* NB: clears ISR too */ DPRINTF(sc, ATH_DEBUG_INTR, "%s: status 0x%x\n", __func__, status); CTR1(ATH_KTR_INTR, "ath_intr: mask=0x%.8x", status); + CTR5(ATH_KTR_INTR, + "ath_intr: ISR=0x%.8x, ISR_S0=0x%.8x, ISR_S1=0x%.8x, ISR_S2=0x%.8x, ISR_S5=0x%.8x", + ah->ah_intrstate[0], + ah->ah_intrstate[1], + ah->ah_intrstate[2], + ah->ah_intrstate[3], + ah->ah_intrstate[6]); status &= sc->sc_imask; /* discard unasked for bits */ /* Short-circuit un-handled interrupts */ From owner-svn-src-user@FreeBSD.ORG Thu Sep 29 08:15:25 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D58351065673; Thu, 29 Sep 2011 08:15:25 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 424978FC13; Thu, 29 Sep 2011 08:15:24 +0000 (UTC) Received: by fxg9 with SMTP id 9so2044168fxg.13 for ; Thu, 29 Sep 2011 01:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=dnEn1LCeuQ4uKvFizt59vsTa6zfLZJqE0utFByjpQLo=; b=fVQ54CYbxTyvgUlvw0gD0YeFS6PJybQdxcyabdDT+Ue5cRxNatOazqquIgmzXgW6K+ YgKdp/kMPOUq3ZREOUR/PRI9qej5Zmxu45YwuYAQI/ssDiqNbWjJuBexnNSEhbTqiLtw lCfeEzUT9E84YEQuwq9F4NCfiYa/hRmGEETHA= Received: by 10.223.50.21 with SMTP id x21mr5254312faf.24.1317282360867; Thu, 29 Sep 2011 00:46:00 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id u6sm1105464fan.17.2011.09.29.00.45.59 (version=SSLv3 cipher=OTHER); Thu, 29 Sep 2011 00:46:00 -0700 (PDT) Sender: Alexander Motin Message-ID: <4E84222F.7050101@FreeBSD.org> Date: Thu, 29 Sep 2011 10:45:51 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Adrian Chadd References: <201109290310.p8T3AgZO001901@svn.freebsd.org> In-Reply-To: <201109290310.p8T3AgZO001901@svn.freebsd.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r225860 - user/adrian/if_ath_tx/sys/mips/mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 08:15:25 -0000 Adrian Chadd wrote: > Author: adrian > Date: Thu Sep 29 03:10:42 2011 > New Revision: 225860 > URL: http://svn.freebsd.org/changeset/base/225860 > + m = intr_disable(); > if (!busy) { > critical_enter(); > cpu_idleclock(); > } > - __asm __volatile ("wait"); > + > + if (sched_runnable()) > + intr_restore(m); > + else { > + /* XXX not atomic! */ > + intr_restore(m); > + __asm __volatile ("wait\n"); > + } > + I think that's not good to call intr_disable() before cpu_idleclock(). cpu_idleclock() uses spin mutex to serialize timer hardware accesses, which disables interrupts. When it enable them back, it will revert effect of your intr_disable() also. -- Alexander Motin From owner-svn-src-user@FreeBSD.ORG Thu Sep 29 08:48:36 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2CEB106564A; Thu, 29 Sep 2011 08:48:36 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2662E8FC0A; Thu, 29 Sep 2011 08:48:35 +0000 (UTC) Received: by fxg9 with SMTP id 9so2073287fxg.13 for ; Thu, 29 Sep 2011 01:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=n5a2iXcRw55H4XXrZlo/5iu/54SOr7iarrTLkcjC2fM=; b=mvryP/sG10aMq9MSo0PZyfllIyzK14CCWh9UtEM64Zarjq6xt0PpX7s3adljJCSe/Y B8E3PQ4eyKhJA8YysbUd+qCsXLxlArG/ZDmmACx39I+Qea9g6xlo/aEWqBZJYSH1wGj3 hmzYVrNeUeTL4WQOZQlhaKEGHmRL6O/FdjKys= Received: by 10.223.37.91 with SMTP id w27mr2946650fad.111.1317286115077; Thu, 29 Sep 2011 01:48:35 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id x22sm1310723faa.5.2011.09.29.01.48.33 (version=SSLv3 cipher=OTHER); Thu, 29 Sep 2011 01:48:34 -0700 (PDT) Sender: Alexander Motin Message-ID: <4E8430D9.3060602@FreeBSD.org> Date: Thu, 29 Sep 2011 11:48:25 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Adrian Chadd References: <201109290310.p8T3AgZO001901@svn.freebsd.org> <4E84222F.7050101@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r225860 - user/adrian/if_ath_tx/sys/mips/mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 08:48:37 -0000 Adrian Chadd wrote: > .. yes, spinlock_enter() / spinlock_exit() in mips does save/restore > the interrupt context. > So if they were disabled, they should continue being disabled. Ah, sorry, probably I've mixed it with something else. But still I see no reason to cover all the critical section with the disabled interrupts. It will just increase race window before the wait instruction and increase problem hit probability. -- Alexander Motin From owner-svn-src-user@FreeBSD.ORG Thu Sep 29 09:01:24 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0D7B106564A for ; Thu, 29 Sep 2011 09:01:24 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id B35DC8FC0A for ; Thu, 29 Sep 2011 09:01:24 +0000 (UTC) Received: by yxk36 with SMTP id 36so513952yxk.13 for ; Thu, 29 Sep 2011 02:01:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=t66DdbOkwlahvQ/dA6mHl5bCTtP0XKE+r2/UQaobcds=; b=s0LeR42ug1JsEo7D6n/NydK7zPzg9QERIAiRwTm0ocbCAkah0ucWJyQgqxnb5lj1hJ Hn5C1xnM+GESUJR8zD/0pRBmdC9poyzPg7vby4tRZrEn5AFmw425MYIIgu0f6k2K5BY1 MWDr7zaFBV+n7xP/BN0wgghTXPyHd/okahxmE= MIME-Version: 1.0 Received: by 10.236.124.97 with SMTP id w61mr61621255yhh.106.1317285396785; Thu, 29 Sep 2011 01:36:36 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.236.111.42 with HTTP; Thu, 29 Sep 2011 01:36:36 -0700 (PDT) In-Reply-To: References: <201109290310.p8T3AgZO001901@svn.freebsd.org> <4E84222F.7050101@FreeBSD.org> Date: Thu, 29 Sep 2011 16:36:36 +0800 X-Google-Sender-Auth: 2AashjGt2vxTk8eH1S9CqpIj-fQ Message-ID: From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r225860 - user/adrian/if_ath_tx/sys/mips/mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 09:01:25 -0000 .. yes, spinlock_enter() / spinlock_exit() in mips does save/restore the interrupt context. So if they were disabled, they should continue being disabled. Adrian From owner-svn-src-user@FreeBSD.ORG Thu Sep 29 09:01:52 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F271106566C for ; Thu, 29 Sep 2011 09:01:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 12C978FC12 for ; Thu, 29 Sep 2011 09:01:51 +0000 (UTC) Received: by ywp17 with SMTP id 17so416942ywp.13 for ; Thu, 29 Sep 2011 02:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=Sg1HhYqr/Vfte3aZkHx4XwJjHdoDwKTexJTL5G/E9nk=; b=hJMtPHPJVC6aY/ju2yi0l3vf/jjOYyRZggzIpQox42WM3A8sbGknzpcngyoO3zCP0J hu9PeZODkY+1bc/OU4BW0/53iMxRPJRg3JpzeN4Ew+nJqCmzR8wxITFJ9m5GIimRqz36 eeB0mDmcbGwp9GS9TXmaNn761OroYijM5g0d0= MIME-Version: 1.0 Received: by 10.236.201.165 with SMTP id b25mr12029355yho.72.1317285307792; Thu, 29 Sep 2011 01:35:07 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.236.111.42 with HTTP; Thu, 29 Sep 2011 01:35:07 -0700 (PDT) In-Reply-To: References: <201109290310.p8T3AgZO001901@svn.freebsd.org> <4E84222F.7050101@FreeBSD.org> Date: Thu, 29 Sep 2011 16:35:07 +0800 X-Google-Sender-Auth: tqLOeSJ4uu_b3CaXWbnjV4TJgj4 Message-ID: From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r225860 - user/adrian/if_ath_tx/sys/mips/mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 09:01:52 -0000 .. and please note that the whole thing is in an #if 0, since it isn't working anyway.. Adrian From owner-svn-src-user@FreeBSD.ORG Thu Sep 29 09:05:48 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36CA1106566B for ; Thu, 29 Sep 2011 09:05:48 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id EE77E8FC14 for ; Thu, 29 Sep 2011 09:05:47 +0000 (UTC) Received: by ggeq3 with SMTP id q3so36465gge.13 for ; Thu, 29 Sep 2011 02:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=ojJHfsX7peZo193gnhYMsxemXV65tkIbopf0kPJQuVU=; b=Yu3VHJlbBgZXZpg7d6h3VOTqhI4tOF91Sm6W+D4EANs6Znxj/1Qp8gKAfJtp09WUQV KFd5V3gQD3b5299079Y7OigXKfLr1p+49cZosVI8eOTYFvd0wtVGrcWR2a1I9swFrun8 6mEYaYMkvuDChWQpm9ved0Ae5v3y7Z/LL7WDY= MIME-Version: 1.0 Received: by 10.236.124.97 with SMTP id w61mr61611833yhh.106.1317285292637; Thu, 29 Sep 2011 01:34:52 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.236.111.42 with HTTP; Thu, 29 Sep 2011 01:34:52 -0700 (PDT) In-Reply-To: <4E84222F.7050101@FreeBSD.org> References: <201109290310.p8T3AgZO001901@svn.freebsd.org> <4E84222F.7050101@FreeBSD.org> Date: Thu, 29 Sep 2011 16:34:52 +0800 X-Google-Sender-Auth: LCmOslX2KZhXFdSdSotU7YVx9xE Message-ID: From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r225860 - user/adrian/if_ath_tx/sys/mips/mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 09:05:48 -0000 On 29 September 2011 15:45, Alexander Motin wrote: > I think that's not good to call intr_disable() before cpu_idleclock(). > cpu_idleclock() uses spin mutex to serialize timer hardware accesses, > which disables interrupts. When it enable them back, it will revert > effect of your intr_disable() also. .. wait. So spinlocks don't save/restore the interrupt state? They just enable/disable it? Adrian From owner-svn-src-user@FreeBSD.ORG Thu Sep 29 09:22:55 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F5FA106566C; Thu, 29 Sep 2011 09:22:55 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F4F58FC08; Thu, 29 Sep 2011 09:22: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 p8T9MtbV013731; Thu, 29 Sep 2011 09:22:55 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8T9MtjO013722; Thu, 29 Sep 2011 09:22:55 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109290922.p8T9MtjO013722@svn.freebsd.org> From: Attilio Rao Date: Thu, 29 Sep 2011 09:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225870 - in user/attilio/vmcontention: bin/ls bin/ps cddl/contrib/opensolaris/lib/libzfs/common contrib/top crypto/openssh etc lib/libc/gen lib/libusbhid sbin/fsdb sbin/hastd share/man... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 09:22:55 -0000 Author: attilio Date: Thu Sep 29 09:22:54 2011 New Revision: 225870 URL: http://svn.freebsd.org/changeset/base/225870 Log: MFC Modified: user/attilio/vmcontention/bin/ls/ls.1 user/attilio/vmcontention/bin/ls/ls.c user/attilio/vmcontention/bin/ls/ls.h user/attilio/vmcontention/bin/ls/print.c user/attilio/vmcontention/bin/ps/extern.h user/attilio/vmcontention/bin/ps/keyword.c user/attilio/vmcontention/bin/ps/print.c user/attilio/vmcontention/bin/ps/ps.c user/attilio/vmcontention/bin/ps/ps.h user/attilio/vmcontention/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c user/attilio/vmcontention/crypto/openssh/ssh_namespace.h user/attilio/vmcontention/etc/devd.conf user/attilio/vmcontention/etc/network.subr user/attilio/vmcontention/lib/libc/gen/devname.c user/attilio/vmcontention/lib/libusbhid/data.c user/attilio/vmcontention/lib/libusbhid/parse.c user/attilio/vmcontention/lib/libusbhid/usbhid.3 user/attilio/vmcontention/lib/libusbhid/usbhid.h user/attilio/vmcontention/sbin/fsdb/fsdbutil.c user/attilio/vmcontention/sbin/hastd/hast.conf.5 user/attilio/vmcontention/sbin/hastd/hast.h user/attilio/vmcontention/sbin/hastd/hastd.c user/attilio/vmcontention/sbin/hastd/parse.y user/attilio/vmcontention/sbin/hastd/primary.c user/attilio/vmcontention/sbin/hastd/secondary.c user/attilio/vmcontention/sbin/hastd/token.l user/attilio/vmcontention/share/man/man7/build.7 user/attilio/vmcontention/share/misc/committers-ports.dot user/attilio/vmcontention/sys/dev/mfi/mfi.c user/attilio/vmcontention/sys/dev/mfi/mfivar.h user/attilio/vmcontention/sys/dev/usb/input/uhid.c user/attilio/vmcontention/sys/net/raw_cb.h user/attilio/vmcontention/sys/net/raw_usrreq.c user/attilio/vmcontention/sys/net/route.c user/attilio/vmcontention/sys/net/route.h user/attilio/vmcontention/sys/net/rtsock.c user/attilio/vmcontention/sys/vm/vm_page.c user/attilio/vmcontention/sys/vm/vm_page.h user/attilio/vmcontention/usr.bin/calendar/calendars/calendar.freebsd user/attilio/vmcontention/usr.bin/csup/diff.c user/attilio/vmcontention/usr.bin/find/find.1 user/attilio/vmcontention/usr.bin/find/ls.c user/attilio/vmcontention/usr.bin/fstat/fstat.1 user/attilio/vmcontention/usr.bin/fstat/fstat.c user/attilio/vmcontention/usr.bin/gzip/zuncompress.c user/attilio/vmcontention/usr.bin/script/script.1 user/attilio/vmcontention/usr.bin/usbhidaction/usbhidaction.1 user/attilio/vmcontention/usr.bin/usbhidaction/usbhidaction.c user/attilio/vmcontention/usr.bin/usbhidctl/usbhid.c user/attilio/vmcontention/usr.bin/usbhidctl/usbhidctl.1 user/attilio/vmcontention/usr.sbin/pstat/pstat.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/contrib/bind9/ (props changed) user/attilio/vmcontention/contrib/binutils/ (props changed) user/attilio/vmcontention/contrib/bzip2/ (props changed) user/attilio/vmcontention/contrib/compiler-rt/ (props changed) user/attilio/vmcontention/contrib/dialog/ (props changed) user/attilio/vmcontention/contrib/ee/ (props changed) user/attilio/vmcontention/contrib/expat/ (props changed) user/attilio/vmcontention/contrib/file/ (props changed) user/attilio/vmcontention/contrib/gcc/ (props changed) user/attilio/vmcontention/contrib/gdb/ (props changed) user/attilio/vmcontention/contrib/gdtoa/ (props changed) user/attilio/vmcontention/contrib/gnu-sort/ (props changed) user/attilio/vmcontention/contrib/groff/ (props changed) user/attilio/vmcontention/contrib/less/ (props changed) user/attilio/vmcontention/contrib/libpcap/ (props changed) user/attilio/vmcontention/contrib/libstdc++/ (props changed) user/attilio/vmcontention/contrib/llvm/ (props changed) user/attilio/vmcontention/contrib/llvm/tools/clang/ (props changed) user/attilio/vmcontention/contrib/ncurses/ (props changed) user/attilio/vmcontention/contrib/netcat/ (props changed) user/attilio/vmcontention/contrib/ntp/ (props changed) user/attilio/vmcontention/contrib/one-true-awk/ (props changed) user/attilio/vmcontention/contrib/openbsm/ (props changed) user/attilio/vmcontention/contrib/openpam/ (props changed) user/attilio/vmcontention/contrib/openresolv/ (props changed) user/attilio/vmcontention/contrib/pf/ (props changed) user/attilio/vmcontention/contrib/sendmail/ (props changed) user/attilio/vmcontention/contrib/tcpdump/ (props changed) user/attilio/vmcontention/contrib/tcsh/ (props changed) user/attilio/vmcontention/contrib/tnftp/ (props changed) user/attilio/vmcontention/contrib/top/ (props changed) user/attilio/vmcontention/contrib/top/install-sh (props changed) user/attilio/vmcontention/contrib/tzcode/stdtime/ (props changed) user/attilio/vmcontention/contrib/tzcode/zic/ (props changed) user/attilio/vmcontention/contrib/tzdata/ (props changed) user/attilio/vmcontention/contrib/wpa/ (props changed) user/attilio/vmcontention/contrib/xz/ (props changed) user/attilio/vmcontention/crypto/heimdal/ (props changed) user/attilio/vmcontention/crypto/openssh/ (props changed) user/attilio/vmcontention/crypto/openssl/ (props changed) user/attilio/vmcontention/gnu/lib/ (props changed) user/attilio/vmcontention/gnu/usr.bin/binutils/ (props changed) user/attilio/vmcontention/gnu/usr.bin/cc/cc_tools/ (props changed) user/attilio/vmcontention/gnu/usr.bin/gdb/ (props changed) user/attilio/vmcontention/lib/libc/ (props changed) user/attilio/vmcontention/lib/libc/stdtime/ (props changed) user/attilio/vmcontention/lib/libutil/ (props changed) user/attilio/vmcontention/lib/libz/ (props changed) user/attilio/vmcontention/sbin/ (props changed) user/attilio/vmcontention/sbin/ipfw/ (props changed) user/attilio/vmcontention/share/mk/bsd.arch.inc.mk (props changed) user/attilio/vmcontention/share/zoneinfo/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/amd64/include/xen/ (props changed) user/attilio/vmcontention/sys/boot/ (props changed) user/attilio/vmcontention/sys/boot/i386/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/ski/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/boot1.chrp/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/ofw/ (props changed) user/attilio/vmcontention/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/ (props changed) user/attilio/vmcontention/sys/contrib/octeon-sdk/ (props changed) user/attilio/vmcontention/sys/contrib/pf/ (props changed) user/attilio/vmcontention/sys/contrib/x86emu/ (props changed) user/attilio/vmcontention/usr.bin/calendar/ (props changed) user/attilio/vmcontention/usr.bin/csup/ (props changed) user/attilio/vmcontention/usr.bin/procstat/ (props changed) user/attilio/vmcontention/usr.sbin/ndiscvt/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvctl/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvd/ (props changed) user/attilio/vmcontention/usr.sbin/rtsold/ (props changed) user/attilio/vmcontention/usr.sbin/zic/ (props changed) Modified: user/attilio/vmcontention/bin/ls/ls.1 ============================================================================== --- user/attilio/vmcontention/bin/ls/ls.1 Thu Sep 29 08:37:53 2011 (r225869) +++ user/attilio/vmcontention/bin/ls/ls.1 Thu Sep 29 09:22:54 2011 (r225870) @@ -32,7 +32,7 @@ .\" @(#)ls.1 8.7 (Berkeley) 7/29/94 .\" $FreeBSD$ .\" -.Dd April 4, 2008 +.Dd September 28, 2011 .Dt LS 1 .Os .Sh NAME @@ -357,8 +357,7 @@ option is given, the numeric ID's are displayed. .Pp If the file is a character special or block special file, -the major and minor device numbers for the file are displayed -in the size field. +the device number for the file is displayed in the size field. If the file is a symbolic link the pathname of the linked-to file is preceded by .Dq Li -> . Modified: user/attilio/vmcontention/bin/ls/ls.c ============================================================================== --- user/attilio/vmcontention/bin/ls/ls.c Thu Sep 29 08:37:53 2011 (r225869) +++ user/attilio/vmcontention/bin/ls/ls.c Thu Sep 29 09:22:54 2011 (r225870) @@ -563,7 +563,7 @@ display(const FTSENT *p, FTSENT *list, i long maxblock; u_long btotal, labelstrlen, maxinode, maxlen, maxnlink; u_long maxlabelstr; - u_int devstrlen; + u_int sizelen; int maxflags; gid_t maxgroup; uid_t maxuser; @@ -572,7 +572,6 @@ display(const FTSENT *p, FTSENT *list, i int entries, needstats; const char *user, *group; char *flags, *labelstr = NULL; - char buf[STRBUF_SIZEOF(u_quad_t) + 1]; char ngroup[STRBUF_SIZEOF(uid_t) + 1]; char nuser[STRBUF_SIZEOF(gid_t) + 1]; @@ -656,7 +655,8 @@ display(const FTSENT *p, FTSENT *list, i MAKENINES(maxsize); free(jinitmax); } - devstrlen = 0; + d.s_size = 0; + sizelen = 0; flags = NULL; for (cur = list, entries = 0; cur; cur = cur->fts_link) { if (cur->fts_info == FTS_ERR || cur->fts_info == FTS_NS) { @@ -796,14 +796,12 @@ label_out: np->group = &np->data[ulen + 1]; (void)strcpy(np->group, group); - if ((S_ISCHR(sp->st_mode) || - S_ISBLK(sp->st_mode)) && - devstrlen < DEVSTR_HEX_LEN) { - if (minor(sp->st_rdev) > 255 || - minor(sp->st_rdev) < 0) - devstrlen = DEVSTR_HEX_LEN; - else - devstrlen = DEVSTR_LEN; + if (S_ISCHR(sp->st_mode) || + S_ISBLK(sp->st_mode)) { + sizelen = snprintf(NULL, 0, + "%#jx", (uintmax_t)sp->st_rdev); + if (d.s_size < sizelen) + d.s_size = sizelen; } if (f_flags) { @@ -837,23 +835,16 @@ label_out: d.maxlen = maxlen; if (needstats) { d.btotal = btotal; - (void)snprintf(buf, sizeof(buf), "%lu", maxblock); - d.s_block = strlen(buf); + d.s_block = snprintf(NULL, 0, "%lu", maxblock); d.s_flags = maxflags; d.s_label = maxlabelstr; d.s_group = maxgroup; - (void)snprintf(buf, sizeof(buf), "%lu", maxinode); - d.s_inode = strlen(buf); - (void)snprintf(buf, sizeof(buf), "%lu", maxnlink); - d.s_nlink = strlen(buf); - if (f_humanval) - d.s_size = HUMANVALSTR_LEN; - else { - (void)snprintf(buf, sizeof(buf), "%ju", maxsize); - d.s_size = strlen(buf); - } - if (d.s_size < devstrlen) - d.s_size = devstrlen; + d.s_inode = snprintf(NULL, 0, "%lu", maxinode); + d.s_nlink = snprintf(NULL, 0, "%lu", maxnlink); + sizelen = f_humanval ? HUMANVALSTR_LEN : + snprintf(NULL, 0, "%ju", maxsize); + if (d.s_size < sizelen) + d.s_size = sizelen; d.s_user = maxuser; } printfcn(&d); Modified: user/attilio/vmcontention/bin/ls/ls.h ============================================================================== --- user/attilio/vmcontention/bin/ls/ls.h Thu Sep 29 08:37:53 2011 (r225869) +++ user/attilio/vmcontention/bin/ls/ls.h Thu Sep 29 09:22:54 2011 (r225870) @@ -36,8 +36,6 @@ #define NO_PRINT 1 #define HUMANVALSTR_LEN 5 -#define DEVSTR_LEN 8 -#define DEVSTR_HEX_LEN 15 extern long blocksize; /* block size units */ Modified: user/attilio/vmcontention/bin/ls/print.c ============================================================================== --- user/attilio/vmcontention/bin/ls/print.c Thu Sep 29 08:37:53 2011 (r225869) +++ user/attilio/vmcontention/bin/ls/print.c Thu Sep 29 09:22:54 2011 (r225870) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -351,16 +352,8 @@ printaname(const FTSENT *p, u_long inode static void printdev(size_t width, dev_t dev) { - char buf[DEVSTR_HEX_LEN + 1]; - if (minor(dev) > 255 || minor(dev) < 0) - (void)snprintf(buf, sizeof(buf), "%3d, 0x%08x", - major(dev), (u_int)minor(dev)); - else - (void)snprintf(buf, sizeof(buf), "%3d, %3d", - major(dev), minor(dev)); - - (void)printf("%*s ", (u_int)width, buf); + (void)printf("%#*jx ", (u_int)width, (uintmax_t)dev); } static void Modified: user/attilio/vmcontention/bin/ps/extern.h ============================================================================== --- user/attilio/vmcontention/bin/ps/extern.h Thu Sep 29 08:37:53 2011 (r225869) +++ user/attilio/vmcontention/bin/ps/extern.h Thu Sep 29 09:22:54 2011 (r225870) @@ -39,63 +39,52 @@ extern fixpt_t ccpu; extern int cflag, eval, fscale, nlistread, rawcpu; extern unsigned long mempages; extern time_t now; -extern int showthreads, sumrusage, termwidth, totwidth; +extern int showthreads, sumrusage, termwidth; extern STAILQ_HEAD(velisthead, varent) varlist; __BEGIN_DECLS -void arguments(KINFO *, VARENT *); -void command(KINFO *, VARENT *); -void cputime(KINFO *, VARENT *); +char *arguments(KINFO *, VARENT *); +char *command(KINFO *, VARENT *); +char *cputime(KINFO *, VARENT *); int donlist(void); -void elapsed(KINFO *, VARENT *); -void elapseds(KINFO *, VARENT *); -void emulname(KINFO *, VARENT *); +char *elapsed(KINFO *, VARENT *); +char *elapseds(KINFO *, VARENT *); +char *emulname(KINFO *, VARENT *); VARENT *find_varentry(VAR *); const char *fmt_argv(char **, char *, size_t); double getpcpu(const KINFO *); -void kvar(KINFO *, VARENT *); -void label(KINFO *, VARENT *); -void loginclass(KINFO *, VARENT *); -void logname(KINFO *, VARENT *); -void longtname(KINFO *, VARENT *); -void lstarted(KINFO *, VARENT *); -void maxrss(KINFO *, VARENT *); -void lockname(KINFO *, VARENT *); -void mwchan(KINFO *, VARENT *); -void nwchan(KINFO *, VARENT *); -void pagein(KINFO *, VARENT *); +char *kvar(KINFO *, VARENT *); +char *label(KINFO *, VARENT *); +char *loginclass(KINFO *, VARENT *); +char *logname(KINFO *, VARENT *); +char *longtname(KINFO *, VARENT *); +char *lstarted(KINFO *, VARENT *); +char *maxrss(KINFO *, VARENT *); +char *lockname(KINFO *, VARENT *); +char *mwchan(KINFO *, VARENT *); +char *nwchan(KINFO *, VARENT *); +char *pagein(KINFO *, VARENT *); void parsefmt(const char *, int); -void pcpu(KINFO *, VARENT *); -void pmem(KINFO *, VARENT *); -void pri(KINFO *, VARENT *); +char *pcpu(KINFO *, VARENT *); +char *pmem(KINFO *, VARENT *); +char *pri(KINFO *, VARENT *); void printheader(void); -void priorityr(KINFO *, VARENT *); -void egroupname(KINFO *, VARENT *); -void rgroupname(KINFO *, VARENT *); -void runame(KINFO *, VARENT *); -void rvar(KINFO *, VARENT *); -int s_comm(KINFO *); -int s_cputime(KINFO *); -int s_label(KINFO *); -int s_loginclass(KINFO *); -int s_logname(KINFO *); -int s_egroupname(KINFO *); -int s_rgroupname(KINFO *); -int s_runame(KINFO *); -int s_systime(KINFO *); -int s_uname(KINFO *); -int s_usertime(KINFO *); +char *priorityr(KINFO *, VARENT *); +char *egroupname(KINFO *, VARENT *); +char *rgroupname(KINFO *, VARENT *); +char *runame(KINFO *, VARENT *); +char *rvar(KINFO *, VARENT *); void showkey(void); -void started(KINFO *, VARENT *); -void state(KINFO *, VARENT *); -void systime(KINFO *, VARENT *); -void tdev(KINFO *, VARENT *); -void tdnam(KINFO *, VARENT *); -void tname(KINFO *, VARENT *); -void ucomm(KINFO *, VARENT *); -void uname(KINFO *, VARENT *); -void upr(KINFO *, VARENT *); -void usertime(KINFO *, VARENT *); -void vsize(KINFO *, VARENT *); -void wchan(KINFO *, VARENT *); +char *started(KINFO *, VARENT *); +char *state(KINFO *, VARENT *); +char *systime(KINFO *, VARENT *); +char *tdev(KINFO *, VARENT *); +char *tdnam(KINFO *, VARENT *); +char *tname(KINFO *, VARENT *); +char *ucomm(KINFO *, VARENT *); +char *uname(KINFO *, VARENT *); +char *upr(KINFO *, VARENT *); +char *usertime(KINFO *, VARENT *); +char *vsize(KINFO *, VARENT *); +char *wchan(KINFO *, VARENT *); __END_DECLS Modified: user/attilio/vmcontention/bin/ps/keyword.c ============================================================================== --- user/attilio/vmcontention/bin/ps/keyword.c Thu Sep 29 08:37:53 2011 (r225869) +++ user/attilio/vmcontention/bin/ps/keyword.c Thu Sep 29 09:22:54 2011 (r225870) @@ -57,178 +57,116 @@ static int vcmp(const void *, const voi #define KOFF(x) offsetof(struct kinfo_proc, x) #define ROFF(x) offsetof(struct rusage, x) -#define EMULLEN 13 /* enough for "FreeBSD ELF32" */ #define LWPFMT "d" -#define LWPLEN 6 #define NLWPFMT "d" -#define NLWPLEN 4 #define UIDFMT "u" -#define UIDLEN 5 #define PIDFMT "d" -#define PIDLEN 5 -#define USERLEN (MAXLOGNAME - 1) /* PLEASE KEEP THE TABLE BELOW SORTED ALPHABETICALLY!!! */ static VAR var[] = { - {"%cpu", "%CPU", NULL, 0, pcpu, NULL, 5, 0, CHAR, NULL, 0}, - {"%mem", "%MEM", NULL, 0, pmem, NULL, 4, 0, CHAR, NULL, 0}, - {"acflag", "ACFLG", NULL, 0, kvar, NULL, 3, KOFF(ki_acflag), USHORT, - "x", 0}, - {"acflg", "", "acflag", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"args", "COMMAND", NULL, COMM|LJUST|USER, arguments, NULL, 16, 0, + {"%cpu", "%CPU", NULL, 0, pcpu, 0, CHAR, NULL, 0}, + {"%mem", "%MEM", NULL, 0, pmem, 0, CHAR, NULL, 0}, + {"acflag", "ACFLG", NULL, 0, kvar, KOFF(ki_acflag), USHORT, "x", 0}, + {"acflg", "", "acflag", 0, NULL, 0, CHAR, NULL, 0}, + {"args", "COMMAND", NULL, COMM|LJUST|USER, arguments, 0, CHAR, NULL, 0}, - {"blocked", "", "sigmask", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"caught", "", "sigcatch", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"class", "CLASS", NULL, LJUST, loginclass, s_loginclass, - MAXLOGNAME-1, 0, CHAR, NULL, 0}, - {"comm", "COMMAND", NULL, LJUST, ucomm, s_comm, - COMMLEN + TDNAMLEN + 1, 0, CHAR, NULL, 0}, - {"command", "COMMAND", NULL, COMM|LJUST|USER, command, NULL, 16, 0, + {"blocked", "", "sigmask", 0, NULL, 0, CHAR, NULL, 0}, + {"caught", "", "sigcatch", 0, NULL, 0, CHAR, NULL, 0}, + {"class", "CLASS", NULL, LJUST, loginclass, 0, CHAR, NULL, 0}, + {"comm", "COMMAND", NULL, LJUST, ucomm, 0, CHAR, NULL, 0}, + {"command", "COMMAND", NULL, COMM|LJUST|USER, command, 0, CHAR, NULL, 0}, - {"cpu", "CPU", NULL, 0, kvar, NULL, 3, KOFF(ki_estcpu), UINT, "d", - 0}, - {"cputime", "", "time", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"egid", "", "gid", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"egroup", "", "group", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"emul", "EMUL", NULL, LJUST, emulname, NULL, EMULLEN, 0, CHAR, - NULL, 0}, - {"etime", "ELAPSED", NULL, USER, elapsed, NULL, 12, 0, CHAR, NULL, 0}, - {"etimes", "ELAPSED", NULL, USER, elapseds, NULL, 12, 0, CHAR, NULL, 0}, - {"euid", "", "uid", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"f", "F", NULL, 0, kvar, NULL, 8, KOFF(ki_flag), INT, "x", 0}, - {"flags", "", "f", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"gid", "GID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_groups), - UINT, UIDFMT, 0}, - {"group", "GROUP", NULL, LJUST, egroupname, s_egroupname, - USERLEN, 0, CHAR, NULL, 0}, - {"ignored", "", "sigignore", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"inblk", "INBLK", NULL, USER, rvar, NULL, 4, ROFF(ru_inblock), LONG, - "ld", 0}, - {"inblock", "", "inblk", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"jid", "JID", NULL, 0, kvar, NULL, 6, KOFF(ki_jid), INT, "d", 0}, - {"jobc", "JOBC", NULL, 0, kvar, NULL, 4, KOFF(ki_jobc), SHORT, "d", - 0}, - {"ktrace", "KTRACE", NULL, 0, kvar, NULL, 8, KOFF(ki_traceflag), INT, - "x", 0}, - {"label", "LABEL", NULL, LJUST, label, s_label, SHRT_MAX, 0, CHAR, - NULL, 0}, - {"lim", "LIM", NULL, 0, maxrss, NULL, 5, 0, CHAR, NULL, 0}, - {"lockname", "LOCK", NULL, LJUST, lockname, NULL, 6, 0, CHAR, NULL, - 0}, - {"login", "LOGIN", NULL, LJUST, logname, s_logname, MAXLOGNAME-1, - 0, CHAR, NULL, 0}, - {"logname", "", "login", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"lstart", "STARTED", NULL, LJUST|USER, lstarted, NULL, 28, 0, CHAR, - NULL, 0}, - {"lwp", "LWP", NULL, 0, kvar, NULL, LWPLEN, KOFF(ki_tid), UINT, - LWPFMT, 0}, - {"majflt", "MAJFLT", NULL, USER, rvar, NULL, 4, ROFF(ru_majflt), - LONG, "ld", 0}, - {"minflt", "MINFLT", NULL, USER, rvar, NULL, 4, ROFF(ru_minflt), - LONG, "ld", 0}, - {"msgrcv", "MSGRCV", NULL, USER, rvar, NULL, 4, ROFF(ru_msgrcv), - LONG, "ld", 0}, - {"msgsnd", "MSGSND", NULL, USER, rvar, NULL, 4, ROFF(ru_msgsnd), - LONG, "ld", 0}, - {"mwchan", "MWCHAN", NULL, LJUST, mwchan, NULL, 6, 0, CHAR, NULL, 0}, - {"ni", "", "nice", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"nice", "NI", NULL, 0, kvar, NULL, 2, KOFF(ki_nice), CHAR, "d", - 0}, - {"nivcsw", "NIVCSW", NULL, USER, rvar, NULL, 5, ROFF(ru_nivcsw), - LONG, "ld", 0}, - {"nlwp", "NLWP", NULL, 0, kvar, NULL, NLWPLEN, KOFF(ki_numthreads), - UINT, NLWPFMT, 0}, - {"nsignals", "", "nsigs", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"nsigs", "NSIGS", NULL, USER, rvar, NULL, 4, ROFF(ru_nsignals), - LONG, "ld", 0}, - {"nswap", "NSWAP", NULL, USER, rvar, NULL, 4, ROFF(ru_nswap), - LONG, "ld", 0}, - {"nvcsw", "NVCSW", NULL, USER, rvar, NULL, 5, ROFF(ru_nvcsw), - LONG, "ld", 0}, - {"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, sizeof(void *) * 2, 0, - CHAR, NULL, 0}, - {"oublk", "OUBLK", NULL, USER, rvar, NULL, 4, ROFF(ru_oublock), - LONG, "ld", 0}, - {"oublock", "", "oublk", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"paddr", "PADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2, - KOFF(ki_paddr), KPTR, "lx", 0}, - {"pagein", "PAGEIN", NULL, USER, pagein, NULL, 6, 0, CHAR, NULL, 0}, - {"pcpu", "", "%cpu", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"pending", "", "sig", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"pgid", "PGID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_pgid), UINT, - PIDFMT, 0}, - {"pid", "PID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_pid), UINT, - PIDFMT, 0}, - {"pmem", "", "%mem", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"ppid", "PPID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_ppid), UINT, - PIDFMT, 0}, - {"pri", "PRI", NULL, 0, pri, NULL, 3, 0, CHAR, NULL, 0}, - {"re", "RE", NULL, INF127, kvar, NULL, 3, KOFF(ki_swtime), UINT, "d", - 0}, - {"rgid", "RGID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_rgid), - UINT, UIDFMT, 0}, - {"rgroup", "RGROUP", NULL, LJUST, rgroupname, s_rgroupname, - USERLEN, 0, CHAR, NULL, 0}, - {"rss", "RSS", NULL, 0, kvar, NULL, 6, KOFF(ki_rssize), PGTOK, "ld", 0}, - {"rtprio", "RTPRIO", NULL, 0, priorityr, NULL, 7, KOFF(ki_pri), CHAR, - NULL, 0}, - {"ruid", "RUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_ruid), - UINT, UIDFMT, 0}, - {"ruser", "RUSER", NULL, LJUST, runame, s_runame, USERLEN, - 0, CHAR, NULL, 0}, - {"sid", "SID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_sid), UINT, - PIDFMT, 0}, - {"sig", "PENDING", NULL, 0, kvar, NULL, 8, KOFF(ki_siglist), INT, - "x", 0}, - {"sigcatch", "CAUGHT", NULL, 0, kvar, NULL, 8, KOFF(ki_sigcatch), - UINT, "x", 0}, - {"sigignore", "IGNORED", NULL, 0, kvar, NULL, 8, KOFF(ki_sigignore), + {"cpu", "CPU", NULL, 0, kvar, KOFF(ki_estcpu), UINT, "d", 0}, + {"cputime", "", "time", 0, NULL, 0, CHAR, NULL, 0}, + {"egid", "", "gid", 0, NULL, 0, CHAR, NULL, 0}, + {"egroup", "", "group", 0, NULL, 0, CHAR, NULL, 0}, + {"emul", "EMUL", NULL, LJUST, emulname, 0, CHAR, NULL, 0}, + {"etime", "ELAPSED", NULL, USER, elapsed, 0, CHAR, NULL, 0}, + {"etimes", "ELAPSED", NULL, USER, elapseds, 0, CHAR, NULL, 0}, + {"euid", "", "uid", 0, NULL, 0, CHAR, NULL, 0}, + {"f", "F", NULL, 0, kvar, KOFF(ki_flag), INT, "x", 0}, + {"flags", "", "f", 0, NULL, 0, CHAR, NULL, 0}, + {"gid", "GID", NULL, 0, kvar, KOFF(ki_groups), UINT, UIDFMT, 0}, + {"group", "GROUP", NULL, LJUST, egroupname, 0, CHAR, NULL, 0}, + {"ignored", "", "sigignore", 0, NULL, 0, CHAR, NULL, 0}, + {"inblk", "INBLK", NULL, USER, rvar, ROFF(ru_inblock), LONG, "ld", 0}, + {"inblock", "", "inblk", 0, NULL, 0, CHAR, NULL, 0}, + {"jid", "JID", NULL, 0, kvar, KOFF(ki_jid), INT, "d", 0}, + {"jobc", "JOBC", NULL, 0, kvar, KOFF(ki_jobc), SHORT, "d", 0}, + {"ktrace", "KTRACE", NULL, 0, kvar, KOFF(ki_traceflag), INT, "x", 0}, + {"label", "LABEL", NULL, LJUST, label, 0, CHAR, NULL, 0}, + {"lim", "LIM", NULL, 0, maxrss, 0, CHAR, NULL, 0}, + {"lockname", "LOCK", NULL, LJUST, lockname, 0, CHAR, NULL, 0}, + {"login", "LOGIN", NULL, LJUST, logname, 0, CHAR, NULL, 0}, + {"logname", "", "login", 0, NULL, 0, CHAR, NULL, 0}, + {"lstart", "STARTED", NULL, LJUST|USER, lstarted, 0, CHAR, NULL, 0}, + {"lwp", "LWP", NULL, 0, kvar, KOFF(ki_tid), UINT, LWPFMT, 0}, + {"majflt", "MAJFLT", NULL, USER, rvar, ROFF(ru_majflt), LONG, "ld", 0}, + {"minflt", "MINFLT", NULL, USER, rvar, ROFF(ru_minflt), LONG, "ld", 0}, + {"msgrcv", "MSGRCV", NULL, USER, rvar, ROFF(ru_msgrcv), LONG, "ld", 0}, + {"msgsnd", "MSGSND", NULL, USER, rvar, ROFF(ru_msgsnd), LONG, "ld", 0}, + {"mwchan", "MWCHAN", NULL, LJUST, mwchan, 0, CHAR, NULL, 0}, + {"ni", "", "nice", 0, NULL, 0, CHAR, NULL, 0}, + {"nice", "NI", NULL, 0, kvar, KOFF(ki_nice), CHAR, "d", 0}, + {"nivcsw", "NIVCSW", NULL, USER, rvar, ROFF(ru_nivcsw), LONG, "ld", 0}, + {"nlwp", "NLWP", NULL, 0, kvar, KOFF(ki_numthreads), UINT, NLWPFMT, 0}, + {"nsignals", "", "nsigs", 0, NULL, 0, CHAR, NULL, 0}, + {"nsigs", "NSIGS", NULL, USER, rvar, ROFF(ru_nsignals), LONG, "ld", 0}, + {"nswap", "NSWAP", NULL, USER, rvar, ROFF(ru_nswap), LONG, "ld", 0}, + {"nvcsw", "NVCSW", NULL, USER, rvar, ROFF(ru_nvcsw), LONG, "ld", 0}, + {"nwchan", "NWCHAN", NULL, LJUST, nwchan, 0, CHAR, NULL, 0}, + {"oublk", "OUBLK", NULL, USER, rvar, ROFF(ru_oublock), LONG, "ld", 0}, + {"oublock", "", "oublk", 0, NULL, 0, CHAR, NULL, 0}, + {"paddr", "PADDR", NULL, 0, kvar, KOFF(ki_paddr), KPTR, "lx", 0}, + {"pagein", "PAGEIN", NULL, USER, pagein, 0, CHAR, NULL, 0}, + {"pcpu", "", "%cpu", 0, NULL, 0, CHAR, NULL, 0}, + {"pending", "", "sig", 0, NULL, 0, CHAR, NULL, 0}, + {"pgid", "PGID", NULL, 0, kvar, KOFF(ki_pgid), UINT, PIDFMT, 0}, + {"pid", "PID", NULL, 0, kvar, KOFF(ki_pid), UINT, PIDFMT, 0}, + {"pmem", "", "%mem", 0, NULL, 0, CHAR, NULL, 0}, + {"ppid", "PPID", NULL, 0, kvar, KOFF(ki_ppid), UINT, PIDFMT, 0}, + {"pri", "PRI", NULL, 0, pri, 0, CHAR, NULL, 0}, + {"re", "RE", NULL, INF127, kvar, KOFF(ki_swtime), UINT, "d", 0}, + {"rgid", "RGID", NULL, 0, kvar, KOFF(ki_rgid), UINT, UIDFMT, 0}, + {"rgroup", "RGROUP", NULL, LJUST, rgroupname, 0, CHAR, NULL, 0}, + {"rss", "RSS", NULL, 0, kvar, KOFF(ki_rssize), PGTOK, "ld", 0}, + {"rtprio", "RTPRIO", NULL, 0, priorityr, KOFF(ki_pri), CHAR, NULL, 0}, + {"ruid", "RUID", NULL, 0, kvar, KOFF(ki_ruid), UINT, UIDFMT, 0}, + {"ruser", "RUSER", NULL, LJUST, runame, 0, CHAR, NULL, 0}, + {"sid", "SID", NULL, 0, kvar, KOFF(ki_sid), UINT, PIDFMT, 0}, + {"sig", "PENDING", NULL, 0, kvar, KOFF(ki_siglist), INT, "x", 0}, + {"sigcatch", "CAUGHT", NULL, 0, kvar, KOFF(ki_sigcatch), UINT, "x", 0}, + {"sigignore", "IGNORED", NULL, 0, kvar, KOFF(ki_sigignore), UINT, "x", 0}, - {"sigmask", "BLOCKED", NULL, 0, kvar, NULL, 8, KOFF(ki_sigmask), - UINT, "x", 0}, - {"sl", "SL", NULL, INF127, kvar, NULL, 3, KOFF(ki_slptime), UINT, "d", - 0}, - {"start", "STARTED", NULL, LJUST|USER, started, NULL, 7, 0, CHAR, NULL, - 0}, - {"stat", "", "state", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"state", "STAT", NULL, 0, state, NULL, 4, 0, CHAR, NULL, 0}, - {"svgid", "SVGID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_svgid), - UINT, UIDFMT, 0}, - {"svuid", "SVUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_svuid), - UINT, UIDFMT, 0}, - {"systime", "SYSTIME", NULL, USER, systime, s_systime, 15, 0, CHAR, - NULL, 0}, - {"tdaddr", "TDADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2, - KOFF(ki_tdaddr), KPTR, "lx", 0}, - {"tdev", "TDEV", NULL, 0, tdev, NULL, 5, 0, CHAR, NULL, 0}, - {"tdnam", "TDNAM", NULL, LJUST, tdnam, NULL, COMMLEN, 0, CHAR, NULL, 0}, - {"time", "TIME", NULL, USER, cputime, s_cputime, 15, 0, CHAR, - NULL, 0}, - {"tpgid", "TPGID", NULL, 0, kvar, NULL, 4, KOFF(ki_tpgid), UINT, - PIDFMT, 0}, - {"tsid", "TSID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_tsid), UINT, - PIDFMT, 0}, - {"tsiz", "TSIZ", NULL, 0, kvar, NULL, 4, KOFF(ki_tsize), PGTOK, "ld", 0}, - {"tt", "TT ", NULL, 0, tname, NULL, 4, 0, CHAR, NULL, 0}, - {"tty", "TTY", NULL, LJUST, longtname, NULL, 8, 0, CHAR, NULL, 0}, - {"ucomm", "UCOMM", NULL, LJUST, ucomm, s_comm, - COMMLEN + TDNAMLEN + 1, 0, CHAR, NULL, 0}, - {"uid", "UID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_uid), UINT, - UIDFMT, 0}, - {"upr", "UPR", NULL, 0, upr, NULL, 3, 0, CHAR, NULL, 0}, - {"uprocp", "UPROCP", NULL, 0, kvar, NULL, sizeof(void *) * 2, - KOFF(ki_paddr), KPTR, "lx", 0}, - {"user", "USER", NULL, LJUST, uname, s_uname, USERLEN, 0, CHAR, - NULL, 0}, - {"usertime", "USERTIME", NULL, USER, usertime, s_usertime, 15, 0, - CHAR, NULL, 0}, - {"usrpri", "", "upr", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"vsize", "", "vsz", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"vsz", "VSZ", NULL, 0, vsize, NULL, 6, 0, CHAR, NULL, 0}, - {"wchan", "WCHAN", NULL, LJUST, wchan, NULL, 6, 0, CHAR, NULL, 0}, - {"xstat", "XSTAT", NULL, 0, kvar, NULL, 4, KOFF(ki_xstat), USHORT, - "x", 0}, - {"", NULL, NULL, 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, + {"sigmask", "BLOCKED", NULL, 0, kvar, KOFF(ki_sigmask), UINT, "x", 0}, + {"sl", "SL", NULL, INF127, kvar, KOFF(ki_slptime), UINT, "d", 0}, + {"start", "STARTED", NULL, LJUST|USER, started, 0, CHAR, NULL, 0}, + {"stat", "", "state", 0, NULL, 0, CHAR, NULL, 0}, + {"state", "STAT", NULL, LJUST, state, 0, CHAR, NULL, 0}, + {"svgid", "SVGID", NULL, 0, kvar, KOFF(ki_svgid), UINT, UIDFMT, 0}, + {"svuid", "SVUID", NULL, 0, kvar, KOFF(ki_svuid), UINT, UIDFMT, 0}, + {"systime", "SYSTIME", NULL, USER, systime, 0, CHAR, NULL, 0}, + {"tdaddr", "TDADDR", NULL, 0, kvar, KOFF(ki_tdaddr), KPTR, "lx", 0}, + {"tdev", "TDEV", NULL, 0, tdev, 0, CHAR, NULL, 0}, + {"tdnam", "TDNAM", NULL, LJUST, tdnam, 0, CHAR, NULL, 0}, + {"time", "TIME", NULL, USER, cputime, 0, CHAR, NULL, 0}, + {"tpgid", "TPGID", NULL, 0, kvar, KOFF(ki_tpgid), UINT, PIDFMT, 0}, + {"tsid", "TSID", NULL, 0, kvar, KOFF(ki_tsid), UINT, PIDFMT, 0}, + {"tsiz", "TSIZ", NULL, 0, kvar, KOFF(ki_tsize), PGTOK, "ld", 0}, + {"tt", "TT ", NULL, 0, tname, 0, CHAR, NULL, 0}, + {"tty", "TTY", NULL, LJUST, longtname, 0, CHAR, NULL, 0}, + {"ucomm", "UCOMM", NULL, LJUST, ucomm, 0, CHAR, NULL, 0}, + {"uid", "UID", NULL, 0, kvar, KOFF(ki_uid), UINT, UIDFMT, 0}, + {"upr", "UPR", NULL, 0, upr, 0, CHAR, NULL, 0}, + {"uprocp", "UPROCP", NULL, 0, kvar, KOFF(ki_paddr), KPTR, "lx", 0}, + {"user", "USER", NULL, LJUST, uname, 0, CHAR, NULL, 0}, + {"usertime", "USERTIME", NULL, USER, usertime, 0, CHAR, NULL, 0}, + {"usrpri", "", "upr", 0, NULL, 0, CHAR, NULL, 0}, + {"vsize", "", "vsz", 0, NULL, 0, CHAR, NULL, 0}, + {"vsz", "VSZ", NULL, 0, vsize, 0, CHAR, NULL, 0}, + {"wchan", "WCHAN", NULL, LJUST, wchan, 0, CHAR, NULL, 0}, + {"xstat", "XSTAT", NULL, 0, kvar, KOFF(ki_xstat), USHORT, "x", 0}, + {"", NULL, NULL, 0, NULL, 0, CHAR, NULL, 0}, }; void Modified: user/attilio/vmcontention/bin/ps/print.c ============================================================================== --- user/attilio/vmcontention/bin/ps/print.c Thu Sep 29 08:37:53 2011 (r225869) +++ user/attilio/vmcontention/bin/ps/print.c Thu Sep 29 09:22:54 2011 (r225870) @@ -64,6 +64,9 @@ __FBSDID("$FreeBSD$"); #include "ps.h" +#define COMMAND_WIDTH 16 +#define ARGUMENTS_WIDTH 16 + #define ps_pgtok(a) (((a) * getpagesize()) / 1024) void @@ -93,53 +96,42 @@ printheader(void) (void)putchar('\n'); } -void +char * arguments(KINFO *k, VARENT *ve) { VAR *v; - int left; - char *cp, *vis_args; + char *vis_args; v = ve->var; if ((vis_args = malloc(strlen(k->ki_args) * 4 + 1)) == NULL) errx(1, "malloc failed"); strvis(vis_args, k->ki_args, VIS_TAB | VIS_NL | VIS_NOSLASH); - if (STAILQ_NEXT(ve, next_ve) == NULL) { - /* last field */ - if (termwidth == UNLIMITED) { - (void)printf("%s", vis_args); - } else { - left = termwidth - (totwidth - v->width); - if (left < 1) /* already wrapped, just use std width */ - left = v->width; - for (cp = vis_args; --left >= 0 && *cp != '\0';) - (void)putchar(*cp++); - } - } else { - (void)printf("%-*.*s", v->width, v->width, vis_args); - } - free(vis_args); + + if (STAILQ_NEXT(ve, next_ve) != NULL && strlen(vis_args) > ARGUMENTS_WIDTH) + vis_args[ARGUMENTS_WIDTH] = '\0'; + + return (vis_args); } -void +char * command(KINFO *k, VARENT *ve) { VAR *v; - int left; - char *cp, *vis_env, *vis_args; + char *vis_args, *vis_env, *str; v = ve->var; if (cflag) { /* If it is the last field, then don't pad */ if (STAILQ_NEXT(ve, next_ve) == NULL) { - if (k->ki_d.prefix) - (void)printf("%s", k->ki_d.prefix); - (void)printf("%s", k->ki_p->ki_comm); - if (showthreads && k->ki_p->ki_numthreads > 1) - (void)printf("/%s", k->ki_p->ki_tdname); + asprintf(&str, "%s%s%s%s", + k->ki_d.prefix ? k->ki_d.prefix : "", + k->ki_p->ki_comm, + (showthreads && k->ki_p->ki_numthreads > 1) ? "/" : "", + (showthreads && k->ki_p->ki_numthreads > 1) ? k->ki_p->ki_tdname : ""); } else - (void)printf("%-*s", v->width, k->ki_p->ki_comm); - return; + str = strdup(k->ki_p->ki_comm); + + return (str); } if ((vis_args = malloc(strlen(k->ki_args) * 4 + 1)) == NULL) errx(1, "malloc failed"); @@ -157,89 +149,84 @@ command(KINFO *k, VARENT *ve) } else vis_env = NULL; - if (termwidth == UNLIMITED) { - if (k->ki_d.prefix) - (void)printf("%s", k->ki_d.prefix); - if (vis_env) - (void)printf("%s ", vis_env); - (void)printf("%s", vis_args); - } else { - left = termwidth - (totwidth - v->width); - if (left < 1) /* already wrapped, just use std width */ - left = v->width; - if ((cp = k->ki_d.prefix) != NULL) - while (--left >= 0 && *cp) - (void)putchar(*cp++); - if ((cp = vis_env) != NULL) { - while (--left >= 0 && *cp) - (void)putchar(*cp++); - if (--left >= 0) - putchar(' '); - } - for (cp = vis_args; --left >= 0 && *cp != '\0';) - (void)putchar(*cp++); - } + asprintf(&str, "%s%s%s%s", + k->ki_d.prefix ? k->ki_d.prefix : "", + vis_env ? vis_env : "", + vis_env ? " " : "", + vis_args); + if (vis_env != NULL) free(vis_env); - } else + free(vis_args); + } else { /* ki_d.prefix & ki_env aren't shown for interim fields */ - (void)printf("%-*.*s", v->width, v->width, vis_args); - free(vis_args); + str = vis_args; + + if (strlen(str) > COMMAND_WIDTH) + str[COMMAND_WIDTH] = '\0'; + } + + return (str); } -void +char * ucomm(KINFO *k, VARENT *ve) { - char tmpbuff[COMMLEN + TDNAMLEN + 2]; VAR *v; + char *str; v = ve->var; if (STAILQ_NEXT(ve, next_ve) == NULL) { /* last field, don't pad */ - if (k->ki_d.prefix) - (void)printf("%s", k->ki_d.prefix); - (void)printf("%s", k->ki_p->ki_comm); - if (showthreads && k->ki_p->ki_numthreads > 1) - printf("/%s", k->ki_p->ki_tdname); + asprintf(&str, "%s%s%s%s", + k->ki_d.prefix ? k->ki_d.prefix : "", + k->ki_p->ki_comm, + (showthreads && k->ki_p->ki_numthreads > 1) ? "/" : "", + (showthreads && k->ki_p->ki_numthreads > 1) ? k->ki_p->ki_tdname : ""); } else { - bzero(tmpbuff, sizeof(tmpbuff)); if (showthreads && k->ki_p->ki_numthreads > 1) - sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm, - k->ki_p->ki_tdname); + asprintf(&str, "%s/%s", k->ki_p->ki_comm, k->ki_p->ki_tdname); else - sprintf(tmpbuff, "%s", k->ki_p->ki_comm); - (void)printf("%-*s", v->width, tmpbuff); + str = strdup(k->ki_p->ki_comm); } + return (str); } -void +char * tdnam(KINFO *k, VARENT *ve) { VAR *v; + char *str; v = ve->var; if (showthreads && k->ki_p->ki_numthreads > 1) - (void)printf("%-*s", v->width, k->ki_p->ki_tdname); + str = strdup(k->ki_p->ki_tdname); else - (void)printf("%-*s", v->width, " "); + str = strdup(" "); + + return (str); } -void +char * logname(KINFO *k, VARENT *ve) { VAR *v; - char *s; v = ve->var; - (void)printf("%-*s", v->width, (s = k->ki_p->ki_login, *s) ? s : "-"); + if (*k->ki_p->ki_login == '\0') + return (NULL); + return (strdup(k->ki_p->ki_login)); } -void +char * state(KINFO *k, VARENT *ve) { int flag, tdflags; - char *cp; + char *cp, *buf; VAR *v; - char buf[16]; + + buf = malloc(16); + if (buf == NULL) + errx(1, "malloc failed"); v = ve->var; flag = k->ki_p->ki_flag; @@ -301,278 +288,270 @@ state(KINFO *k, VARENT *ve) if (flag & P_JAILED) *cp++ = 'J'; *cp = '\0'; - (void)printf("%-*s", v->width, buf); + return (buf); } #define scalepri(x) ((x) - PZERO) -void +char * pri(KINFO *k, VARENT *ve) { VAR *v; + char *str; v = ve->var; - (void)printf("%*d", v->width, scalepri(k->ki_p->ki_pri.pri_level)); + asprintf(&str, "%d", scalepri(k->ki_p->ki_pri.pri_level)); + return (str); } -void +char * upr(KINFO *k, VARENT *ve) { VAR *v; + char *str; v = ve->var; - (void)printf("%*d", v->width, scalepri(k->ki_p->ki_pri.pri_user)); + asprintf(&str, "%d", scalepri(k->ki_p->ki_pri.pri_user)); + return (str); } #undef scalepri -void +char * uname(KINFO *k, VARENT *ve) { VAR *v; v = ve->var; - (void)printf("%-*s", v->width, user_from_uid(k->ki_p->ki_uid, 0)); -} - -int -s_uname(KINFO *k) -{ - return (strlen(user_from_uid(k->ki_p->ki_uid, 0))); + return (strdup(user_from_uid(k->ki_p->ki_uid, 0))); } -void +char * egroupname(KINFO *k, VARENT *ve) { VAR *v; v = ve->var; - (void)printf("%-*s", v->width, - group_from_gid(k->ki_p->ki_groups[0], 0)); -} - -int -s_egroupname(KINFO *k) -{ - return (strlen(group_from_gid(k->ki_p->ki_groups[0], 0))); + return (strdup(group_from_gid(k->ki_p->ki_groups[0], 0))); } -void +char * rgroupname(KINFO *k, VARENT *ve) { VAR *v; v = ve->var; - (void)printf("%-*s", v->width, group_from_gid(k->ki_p->ki_rgid, 0)); -} - -int -s_rgroupname(KINFO *k) -{ - return (strlen(group_from_gid(k->ki_p->ki_rgid, 0))); + return (strdup(group_from_gid(k->ki_p->ki_rgid, 0))); } -void +char * runame(KINFO *k, VARENT *ve) { VAR *v; v = ve->var; - (void)printf("%-*s", v->width, user_from_uid(k->ki_p->ki_ruid, 0)); + return (strdup(user_from_uid(k->ki_p->ki_ruid, 0))); } -int -s_runame(KINFO *k) -{ - return (strlen(user_from_uid(k->ki_p->ki_ruid, 0))); -} - - -void +char * tdev(KINFO *k, VARENT *ve) { VAR *v; dev_t dev; - char buff[16]; + char *str; v = ve->var; dev = k->ki_p->ki_tdev; if (dev == NODEV) - (void)printf("%*s", v->width, "??"); - else { - (void)snprintf(buff, sizeof(buff), - "%d/%d", major(dev), minor(dev)); - (void)printf("%*s", v->width, buff); - } + str = strdup("??"); + else + asprintf(&str, "%#jx", (uintmax_t)dev); + + return (str); } -void +char * tname(KINFO *k, VARENT *ve) { VAR *v; dev_t dev; - char *ttname; + char *ttname, *str; v = ve->var; dev = k->ki_p->ki_tdev; if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL) - (void)printf("%*s ", v->width - 1, "??"); + str = strdup("?? "); else { if (strncmp(ttname, "tty", 3) == 0 || strncmp(ttname, "cua", 3) == 0) ttname += 3; if (strncmp(ttname, "pts/", 4) == 0) ttname += 4; - (void)printf("%*.*s%c", v->width - 1, v->width - 1, ttname, + asprintf(&str, "%s%c", ttname, k->ki_p->ki_kiflag & KI_CTTY ? ' ' : '-'); } + + return (str); } -void +char * longtname(KINFO *k, VARENT *ve) { VAR *v; dev_t dev; - char *ttname; + const char *ttname; v = ve->var; dev = k->ki_p->ki_tdev; if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL) - (void)printf("%-*s", v->width, "??"); - else - (void)printf("%-*s", v->width, ttname); + ttname = "??"; + + return (strdup(ttname)); } -void +char * started(KINFO *k, VARENT *ve) { VAR *v; time_t then; struct tm *tp; static int use_ampm = -1; - char buf[100]; + size_t buflen = 100; + char *buf; + + buf = malloc(buflen); + if (buf == NULL) + errx(1, "malloc failed"); v = ve->var; - if (!k->ki_valid) { - (void)printf("%-*s", v->width, "-"); - return; - } + if (!k->ki_valid) + return (NULL); if (use_ampm < 0) use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0'); then = k->ki_p->ki_start.tv_sec; tp = localtime(&then); if (now - k->ki_p->ki_start.tv_sec < 24 * 3600) { - (void)strftime(buf, sizeof(buf), + (void)strftime(buf, buflen, use_ampm ? "%l:%M%p" : "%k:%M ", tp); } else if (now - k->ki_p->ki_start.tv_sec < 7 * 86400) { - (void)strftime(buf, sizeof(buf), + (void)strftime(buf, buflen, use_ampm ? "%a%I%p" : "%a%H ", tp); } else - (void)strftime(buf, sizeof(buf), "%e%b%y", tp); - (void)printf("%-*s", v->width, buf); + (void)strftime(buf, buflen, "%e%b%y", tp); + return (buf); } -void +char * lstarted(KINFO *k, VARENT *ve) { VAR *v; time_t then; - char buf[100]; + char *buf; + size_t buflen = 100; + + buf = malloc(buflen); + if (buf == NULL) + errx(1, "malloc failed"); v = ve->var; - if (!k->ki_valid) { - (void)printf("%-*s", v->width, "-"); - return; - } + if (!k->ki_valid) + return (NULL); then = k->ki_p->ki_start.tv_sec; - (void)strftime(buf, sizeof(buf), "%c", localtime(&then)); - (void)printf("%-*s", v->width, buf); + (void)strftime(buf, buflen, "%c", localtime(&then)); + return (buf); } -void +char * lockname(KINFO *k, VARENT *ve) { VAR *v; + char *str; v = ve->var; if (k->ki_p->ki_kiflag & KI_LOCKBLOCK) { if (k->ki_p->ki_lockname[0] != 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Sep 29 17:13:23 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3C8B106566B; Thu, 29 Sep 2011 17:13:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 940868FC08; Thu, 29 Sep 2011 17:13:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8THDN61032057; Thu, 29 Sep 2011 17:13:23 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8THDN09032055; Thu, 29 Sep 2011 17:13:23 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109291713.p8THDN09032055@svn.freebsd.org> From: Adrian Chadd Date: Thu, 29 Sep 2011 17:13:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225879 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 17:13:23 -0000 Author: adrian Date: Thu Sep 29 17:13:23 2011 New Revision: 225879 URL: http://svn.freebsd.org/changeset/base/225879 Log: Put in a temporary workaround for the strange rx behaviour I was seeing when RXEOL occured. Normally, I'd expect RXEOL to be followed by a dequeue of ATH_RXBUF number of packets (here 512 for 11n.) But I'd occasionally see this only service a handful at a time (and sometimes it'd service 0 frames!) Since the RX descriptor list should be consistent and correctly linked together after being processed, I gathered that something was interfering with this process (eg rxlink was being set to NULL.) I gathered that kickpcu and the interrupt mask update was racing. So to work around it (and it's stopped the issue appearing so far) : * clear kickpcu after the queue reset has been re-established and the RX has recommenced. This likely won't be very good for SMP machines as the taskqueue and ath_intr() calls can occur simultaneously on different CPUs. This means I'll have to eventually correctly lock this (or use atomics here.) * If a MIB interrupt also pops in at the same time and kickpcu is currently 1, don't reset the interrupt mask. This stops the RXEOL/RXORN interrupt from being triggered until we've handled and cleared the original case. As mentioned, this is only somewhat correct (read: not correct) for the single CPU case, and definitely still very racy for the SMP case. I'll need to come up with a better solution for this kickpcu stuff. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Thu Sep 29 15:43:02 2011 (r225878) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Thu Sep 29 17:13:23 2011 (r225879) @@ -1447,9 +1447,9 @@ ath_intr(void *arg) * is in the RX queue. * This will then kick the PCU. */ - taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_rxtask); sc->sc_rxlink = NULL; sc->sc_kickpcu = 1; + taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_rxtask); } if (status & HAL_INT_TXURN) { sc->sc_stats.ast_txurn++; @@ -1484,7 +1484,14 @@ ath_intr(void *arg) * clear whatever condition caused the interrupt. */ ath_hal_mibevent(ah, &sc->sc_halstats); - ath_hal_intrset(ah, sc->sc_imask); + /* + * Don't reset the interrupt if we've just + * kicked the PCU, or we may get a nested + * RXEOL before the rxproc has had a chance + * to run. + */ + if (sc->sc_kickpcu == 0) + ath_hal_intrset(ah, sc->sc_imask); } if (status & HAL_INT_RXORN) { /* NB: hal marks HAL_INT_FATAL when RXORN is fatal */ @@ -4057,24 +4064,34 @@ rx_next: * need to be handled, kick the PCU if there's * been an RXEOL condition. */ + /* + * XXX TODO! + * It is very likely that we're unfortunately + * racing with other places where ath_hal_intrset() + * may be called. It may be that we do need to + * add some more locking (eg the pcu lock from ath9k/ + * reference), or introduce some other way to cope + * with this. + */ if (sc->sc_kickpcu) { - sc->sc_kickpcu = 0; CTR0(ATH_KTR_ERR, "ath_rx_proc: kickpcu"); - /* - * XXX this causes a 3ms delay; and shuts down a lof - * XXX is it really needed? Or is it just enough to - * XXX kick the PCU again to continue RXing? - */ device_printf(sc->sc_dev, "%s: kickpcu; handled %d packets\n", __func__, npkts); + #if 0 - ath_stoprecv(sc); - sc->sc_imask |= (HAL_INT_RXEOL | HAL_INT_RXORN); + /* + * This re-links all of the descriptors together. + * (Is it possible that somehow, some state/issue + * is leaving us with badly linked descriptors?) + * Is it possible that we're receiving another RXEOL + * _during_ this function? + */ if (ath_startrecv(sc) != 0) { if_printf(ifp, "%s: couldn't restart RX after RXEOL; resetting\n", __func__); ath_reset(ifp); + sc->sc_kickpcu = 0; return; } #endif @@ -4087,6 +4104,7 @@ rx_next: ath_hal_startpcurecv(ah); /* re-enable PCU/DMA engine */ ath_hal_intrset(ah, sc->sc_imask); + sc->sc_kickpcu = 0; } if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0) { From owner-svn-src-user@FreeBSD.ORG Sat Oct 1 22:16:17 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14196106566B; Sat, 1 Oct 2011 22:16:17 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEAC88FC16; Sat, 1 Oct 2011 22:16: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 p91MGGUc035894; Sat, 1 Oct 2011 22:16:16 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p91MGGAo035892; Sat, 1 Oct 2011 22:16:16 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201110012216.p91MGGAo035892@svn.freebsd.org> From: Gabor Kovesdan Date: Sat, 1 Oct 2011 22:16:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225909 - user/gabor/grep/trunk/regex X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Oct 2011 22:16:17 -0000 Author: gabor Date: Sat Oct 1 22:16:16 2011 New Revision: 225909 URL: http://svn.freebsd.org/changeset/base/225909 Log: - Add char format string Modified: user/gabor/grep/trunk/regex/glue.h Modified: user/gabor/grep/trunk/regex/glue.h ============================================================================== --- user/gabor/grep/trunk/regex/glue.h Sat Oct 1 20:56:58 2011 (r225908) +++ user/gabor/grep/trunk/regex/glue.h Sat Oct 1 22:16:16 2011 (r225909) @@ -14,6 +14,7 @@ #define HAVE_MBSTATE_T 1 #define TRE_CHAR(n) L##n +#define CHF "%lc" #define tre_char_t wchar_t #define tre_mbrtowc(pwc, s, n, ps) (mbrtowc((pwc), (s), (n), (ps))) From owner-svn-src-user@FreeBSD.ORG Sat Oct 1 22:17:26 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36E2E106566B; Sat, 1 Oct 2011 22:17:26 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26AD68FC0A; Sat, 1 Oct 2011 22:17: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 p91MHQ3m035964; Sat, 1 Oct 2011 22:17:26 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p91MHQtQ035962; Sat, 1 Oct 2011 22:17:26 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201110012217.p91MHQtQ035962@svn.freebsd.org> From: Gabor Kovesdan Date: Sat, 1 Oct 2011 22:17:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225910 - user/gabor/grep/trunk/regex X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Oct 2011 22:17:26 -0000 Author: gabor Date: Sat Oct 1 22:17:25 2011 New Revision: 225910 URL: http://svn.freebsd.org/changeset/base/225910 Log: - Fix regression in pattern handling Reported by: aakuusta@gmail.com Modified: user/gabor/grep/trunk/regex/tre-compile.c Modified: user/gabor/grep/trunk/regex/tre-compile.c ============================================================================== --- user/gabor/grep/trunk/regex/tre-compile.c Sat Oct 1 22:16:16 2011 (r225909) +++ user/gabor/grep/trunk/regex/tre-compile.c Sat Oct 1 22:17:25 2011 (r225910) @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -80,7 +81,7 @@ tre_convert_pattern(const char *regex, s #endif /* TRE_MULTIBYTE */ wregex[wlen] = L'\0'; *w = wregex; - *wn = n; + *wn = wlen; return REG_OK; #else /* !TRE_WCHAR */ { From owner-svn-src-user@FreeBSD.ORG Sat Oct 1 22:19:22 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B86E2106566C; Sat, 1 Oct 2011 22:19:22 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7E8F8FC14; Sat, 1 Oct 2011 22:19:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p91MJMNi036064; Sat, 1 Oct 2011 22:19:22 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p91MJMVm036062; Sat, 1 Oct 2011 22:19:22 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201110012219.p91MJMVm036062@svn.freebsd.org> From: Gabor Kovesdan Date: Sat, 1 Oct 2011 22:19:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225911 - user/gabor/tre-integration/contrib/tre/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Oct 2011 22:19:22 -0000 Author: gabor Date: Sat Oct 1 22:19:22 2011 New Revision: 225911 URL: http://svn.freebsd.org/changeset/base/225911 Log: - Fix pattern handling - Add a missing include Modified: user/gabor/tre-integration/contrib/tre/lib/tre-compile.c Modified: user/gabor/tre-integration/contrib/tre/lib/tre-compile.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-compile.c Sat Oct 1 22:17:25 2011 (r225910) +++ user/gabor/tre-integration/contrib/tre/lib/tre-compile.c Sat Oct 1 22:19:22 2011 (r225911) @@ -18,6 +18,7 @@ #endif /* HAVE_CONFIG_H */ #include #include +#include #include #include @@ -1914,7 +1915,7 @@ tre_convert_pattern(const char *regex, s #endif /* TRE_MULTIBYTE */ wregex[wlen] = L'\0'; *w = wregex; - *wn = n; + *wn = wlen; return REG_OK; #else /* !TRE_WCHAR */ {