From owner-svn-src-head@FreeBSD.ORG Sun May 29 00:17:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DB441065673; Sun, 29 May 2011 00:17:14 +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 D8E7E8FC23; Sun, 29 May 2011 00:17:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T0HDYL006350; Sun, 29 May 2011 00:17:13 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T0HDke006347; Sun, 29 May 2011 00:17:13 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105290017.p4T0HDke006347@svn.freebsd.org> From: Adrian Chadd Date: Sun, 29 May 2011 00:17:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222432 - in head/sys/dev/ath: . ath_hal/ar9002 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 00:17:14 -0000 Author: adrian Date: Sun May 29 00:17:13 2011 New Revision: 222432 URL: http://svn.freebsd.org/changeset/base/222432 Log: Teach if_ath about devices which have short-GI in 20MHz channel modes. This has been disabled until now because there hasn't been any supported device which has this feature. Since the AR9287 is the first device to support it, and since now the HAL has functional AR9287+11n support, flip this on. Modified: head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c Sat May 28 22:11:22 2011 (r222431) +++ head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c Sun May 29 00:17:13 2011 (r222432) @@ -439,9 +439,14 @@ ar9287FillCapabilityInfo(struct ath_hal /* Disable this so Block-ACK works correctly */ pCap->halHasRxSelfLinkedTail = AH_FALSE; pCap->halPSPollBroken = AH_FALSE; + + /* Hardware supports (at least) single-stream STBC TX/RX */ pCap->halRxStbcSupport = 1; pCap->halTxStbcSupport = 1; + /* Hardware supports short-GI w/ 20MHz */ + pCap->halHTSGI20Support = 1; + return AH_TRUE; } Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat May 28 22:11:22 2011 (r222431) +++ head/sys/dev/ath/if_ath.c Sun May 29 00:17:13 2011 (r222432) @@ -627,13 +627,22 @@ ath_attach(u_int16_t devid, struct ath_s | IEEE80211_HTC_AMPDU /* A-MPDU tx/rx */ | IEEE80211_HTC_AMSDU /* A-MSDU tx/rx */ | IEEE80211_HTCAP_MAXAMSDU_3839 /* max A-MSDU length */ - /* At the present time, the hardware doesn't support short-GI in 20mhz mode */ -#if 0 - | IEEE80211_HTCAP_SHORTGI20 /* short GI in 20MHz */ -#endif | IEEE80211_HTCAP_SMPS_OFF; /* SM power save off */ ; + /* + * Enable short-GI for HT20 only if the hardware + * advertises support. + * Notably, anything earlier than the AR9287 doesn't. + */ + if ((ath_hal_getcapability(ah, + HAL_CAP_HT20_SGI, 0, NULL) == HAL_OK) && + (wmodes & HAL_MODE_HT20)) { + device_printf(sc->sc_dev, + "[HT] enabling short-GI in 20MHz mode\n"); + ic->ic_htcaps |= IEEE80211_HTCAP_SHORTGI20; + } + if (wmodes & HAL_MODE_HT40) ic->ic_htcaps |= IEEE80211_HTCAP_CHWIDTH40 | IEEE80211_HTCAP_SHORTGI40; From owner-svn-src-head@FreeBSD.ORG Sun May 29 00:27:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57CE1106564A; Sun, 29 May 2011 00:27:43 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2EE8A8FC12; Sun, 29 May 2011 00:27: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 p4T0RhYU006689; Sun, 29 May 2011 00:27:43 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T0Rh1Y006686; Sun, 29 May 2011 00:27:43 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201105290027.p4T0Rh1Y006686@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 29 May 2011 00:27:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222433 - in head/sys/powerpc: booke include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 00:27:43 -0000 Author: marcel Date: Sun May 29 00:27:42 2011 New Revision: 222433 URL: http://svn.freebsd.org/changeset/base/222433 Log: o Add system versions for the P4040(E) and P4080(E). o In bare_probe(), change the logic that determines the maximum number of processors/cores into a switch statement and take advantage of the fact that bit 3 of the SVR value indicates whether we're running on a security enabled version. Since we don't care about that here, mask the bit. All -E versions are taken care of automatically. Modified: head/sys/powerpc/booke/platform_bare.c head/sys/powerpc/include/spr.h Modified: head/sys/powerpc/booke/platform_bare.c ============================================================================== --- head/sys/powerpc/booke/platform_bare.c Sun May 29 00:17:13 2011 (r222432) +++ head/sys/powerpc/booke/platform_bare.c Sun May 29 00:27:42 2011 (r222433) @@ -104,13 +104,22 @@ bare_probe(platform_t plat) int i, law_max, tgt; ver = SVR_VER(mfspr(SPR_SVR)); - - if (ver == SVR_MPC8572E || ver == SVR_MPC8572 || - ver == SVR_P1020E || ver == SVR_P1020 || - ver == SVR_P2020E || ver == SVR_P2020) + switch (ver & ~0x0008) { /* Mask Security Enabled bit */ + case SVR_P4080: + maxcpu = 8; + break; + case SVR_P4040: + maxcpu = 4; + break; + case SVR_MPC8572: + case SVR_P1020: + case SVR_P2020: maxcpu = 2; - else + break; + default: maxcpu = 1; + break; + } /* * Clear local access windows. Skip DRAM entries, so we don't shoot Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Sun May 29 00:17:13 2011 (r222432) +++ head/sys/powerpc/include/spr.h Sun May 29 00:27:42 2011 (r222433) @@ -662,6 +662,10 @@ #define SVR_P2010E 0x80eb #define SVR_P2020 0x80e2 #define SVR_P2020E 0x80ea +#define SVR_P4040 0x8200 +#define SVR_P4040E 0x8208 +#define SVR_P4080 0x8201 +#define SVR_P4080E 0x8209 #define SVR_VER(svr) (((svr) >> 16) & 0xffff) #define SPR_PID0 0x030 /* ..8 Process ID Register 0 */ From owner-svn-src-head@FreeBSD.ORG Sun May 29 00:40:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC747106566B; Sun, 29 May 2011 00:40:59 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D7418FC08; Sun, 29 May 2011 00:40: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 p4T0exGT007187; Sun, 29 May 2011 00:40:59 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T0exUt007185; Sun, 29 May 2011 00:40:59 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201105290040.p4T0exUt007185@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 29 May 2011 00:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222434 - head/sys/powerpc/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 00:40:59 -0000 Author: marcel Date: Sun May 29 00:40:59 2011 New Revision: 222434 URL: http://svn.freebsd.org/changeset/base/222434 Log: The P4080 has 8 cores. Bump MAXCPU to 8 to match. Modified: head/sys/powerpc/include/param.h Modified: head/sys/powerpc/include/param.h ============================================================================== --- head/sys/powerpc/include/param.h Sun May 29 00:27:42 2011 (r222433) +++ head/sys/powerpc/include/param.h Sun May 29 00:40:59 2011 (r222434) @@ -68,7 +68,7 @@ #endif #if defined(SMP) || defined(KLD_MODULE) -#define MAXCPU 4 +#define MAXCPU 8 #else #define MAXCPU 1 #endif /* SMP || KLD_MODULE */ From owner-svn-src-head@FreeBSD.ORG Sun May 29 00:42:34 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB8C4106564A; Sun, 29 May 2011 00:42:34 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id 809448FC12; Sun, 29 May 2011 00:42:34 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id CD00A58135; Sat, 28 May 2011 19:42:33 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id enqPxuP4WmmZ; Sat, 28 May 2011 19:42:33 -0500 (CDT) Received: from elpis.tachypleus.net (unknown [76.210.63.135]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 5C37D5811B; Sat, 28 May 2011 19:42:33 -0500 (CDT) Message-ID: <4DE19678.3050701@freebsd.org> Date: Sat, 28 May 2011 19:42:32 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; U; FreeBSD powerpc; en-US; rv:1.9.2.13) Gecko/20110202 Thunderbird/3.1.7 MIME-Version: 1.0 To: Marcel Moolenaar References: <201105290040.p4T0exUt007185@svn.freebsd.org> In-Reply-To: <201105290040.p4T0exUt007185@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222434 - head/sys/powerpc/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 00:42:34 -0000 On 05/28/11 19:40, Marcel Moolenaar wrote: > Author: marcel > Date: Sun May 29 00:40:59 2011 > New Revision: 222434 > URL: http://svn.freebsd.org/changeset/base/222434 > > Log: > The P4080 has 8 cores. Bump MAXCPU to 8 to match. Can we just bump this straight to 32, like on other archs? We're very near to supporting many-way POWER6 and POWER7 systems anyway, and a single-socket POWER7 can already have 32 CPUs. -Nathan From owner-svn-src-head@FreeBSD.ORG Sun May 29 01:04:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBE231065670; Sun, 29 May 2011 01:04:05 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id AB08E8FC08; Sun, 29 May 2011 01:04:05 +0000 (UTC) Received: from sa-nc-common-178.static.jnpr.net (natint3.juniper.net [66.129.224.36]) (authenticated bits=0) by mail.xcllnt.net (8.14.4/8.14.4) with ESMTP id p4T13xWv083491 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 28 May 2011 18:04:04 -0700 (PDT) (envelope-from marcel@xcllnt.net) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Marcel Moolenaar In-Reply-To: <4DE19678.3050701@freebsd.org> Date: Sat, 28 May 2011 18:03:54 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201105290040.p4T0exUt007185@svn.freebsd.org> <4DE19678.3050701@freebsd.org> To: Nathan Whitehorn X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222434 - head/sys/powerpc/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 01:04:06 -0000 On May 28, 2011, at 5:42 PM, Nathan Whitehorn wrote: > On 05/28/11 19:40, Marcel Moolenaar wrote: >> Author: marcel >> Date: Sun May 29 00:40:59 2011 >> New Revision: 222434 >> URL: http://svn.freebsd.org/changeset/base/222434 >>=20 >> Log: >> The P4080 has 8 cores. Bump MAXCPU to 8 to match. >=20 > Can we just bump this straight to 32, like on other archs? We're very = near to supporting many-way POWER6 and POWER7 systems anyway, and a = single-socket POWER7 can already have 32 CPUs. We could, but I'm not sure I should be concerned about the "scaling" of the various arrays in the kernel due to MAXCPU. This with an eye on small embedded devices that do 2-way SMP. I've never liked this constant anyway to be honest. It's either too big or too small. I don't think it'll ever be right :-) --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-head@FreeBSD.ORG Sun May 29 02:21:36 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F8B6106566C; Sun, 29 May 2011 02:21:36 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1702E8FC0A; Sun, 29 May 2011 02:21:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T2LZNI010424; Sun, 29 May 2011 02:21:35 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T2LZtf010422; Sun, 29 May 2011 02:21:35 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <201105290221.p4T2LZtf010422@svn.freebsd.org> From: Qing Li Date: Sun, 29 May 2011 02:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222438 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 02:21:36 -0000 Author: qingli Date: Sun May 29 02:21:35 2011 New Revision: 222438 URL: http://svn.freebsd.org/changeset/base/222438 Log: Supply the LLE_STATIC flag bit to in_ifscurb() when scrubbing interface address so that proper clean up will take place in the routing code. This patch fixes the bootp panic on startup problem. Also, added more error handling and logging code in function in_scrubprefix(). MFC after: 5 days Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sun May 29 02:10:57 2011 (r222437) +++ head/sys/netinet/in.c Sun May 29 02:21:35 2011 (r222438) @@ -548,7 +548,7 @@ in_control(struct socket *so, u_long cmd * is the same as before, then the call is * un-necessarily executed here. */ - in_ifscrub(ifp, ia, 0); + in_ifscrub(ifp, ia, LLE_STATIC); ia->ia_sockmask = ifra->ifra_mask; ia->ia_sockmask.sin_family = AF_INET; ia->ia_subnetmask = @@ -557,7 +557,7 @@ in_control(struct socket *so, u_long cmd } if ((ifp->if_flags & IFF_POINTOPOINT) && (ifra->ifra_dstaddr.sin_family == AF_INET)) { - in_ifscrub(ifp, ia, 0); + in_ifscrub(ifp, ia, LLE_STATIC); ia->ia_dstaddr = ifra->ifra_dstaddr; maskIsNew = 1; /* We lie; but the effect's the same */ } @@ -1179,14 +1179,20 @@ in_scrubprefix(struct in_ifaddr *target, && (ia->ia_ifp->if_type != IFT_CARP)) { ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(); - rtinit(&(target->ia_ifa), (int)RTM_DELETE, + error = rtinit(&(target->ia_ifa), (int)RTM_DELETE, rtinitflags(target)); - target->ia_flags &= ~IFA_ROUTE; - + if (error == 0) + target->ia_flags &= ~IFA_ROUTE; + else + log(LOG_INFO, "in_scrubprefix: err=%d, old prefix delete failed\n", + error); error = rtinit(&ia->ia_ifa, (int)RTM_ADD, rtinitflags(ia) | RTF_UP); if (error == 0) ia->ia_flags |= IFA_ROUTE; + else + log(LOG_INFO, "in_scrubprefix: err=%d, new prefix add failed\n", + error); ifa_free(&ia->ia_ifa); return (error); } @@ -1210,9 +1216,12 @@ in_scrubprefix(struct in_ifaddr *target, /* * As no-one seem to have this prefix, we can remove the route. */ - rtinit(&(target->ia_ifa), (int)RTM_DELETE, rtinitflags(target)); - target->ia_flags &= ~IFA_ROUTE; - return (0); + error = rtinit(&(target->ia_ifa), (int)RTM_DELETE, rtinitflags(target)); + if (error == 0) + target->ia_flags &= ~IFA_ROUTE; + else + log(LOG_INFO, "in_scrubprefix: err=%d, prefix delete failed\n", error); + return (error); } #undef rtinitflags From owner-svn-src-head@FreeBSD.ORG Sun May 29 03:01:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77C621065673; Sun, 29 May 2011 03:01:59 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id A1A648FC0C; Sun, 29 May 2011 03:01:58 +0000 (UTC) Received: by wyf23 with SMTP id 23so2699499wyf.13 for ; Sat, 28 May 2011 20:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=gCYenPiS1o28RGSLqSKIv123C7twMd7xy81Tv6vY1qY=; b=U5m0u5nwq13Saj/d/KYH5mqldsEZ6gQ1kdKEwtKZnZIcUS5LDiBTf1y67Yhc0Sr0aj A18mtK3fOgLApFGoSabmyNAaj0lAXDKcf5S/VpAdA5sZCU1gOGQZbLD09dfj1eixRMRe 6nAPKYhS2VkXXSGCkvVc/d5FhLwwgAA9B/VCg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=sB2w2bH22b6atJuhAsm4wSHnsbn6iYBIXgchmazg42U+bJ8QZ7/RSN7lp3AQV683If 4zX9Zya8O5EioTgDxZkQILYV45rFJWhJ5ZOJ8VoN2dhtx7p6VprJKP5DiYZirUHyWeGF L247BfP97GFfVtCdKboy95uekXegjYUd92WeQ= MIME-Version: 1.0 Received: by 10.216.59.85 with SMTP id r63mr1177724wec.35.1306638117239; Sat, 28 May 2011 20:01:57 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.93.193 with HTTP; Sat, 28 May 2011 20:01:57 -0700 (PDT) In-Reply-To: <201105282103.43370.pieter@degoeje.nl> References: <201105131848.p4DIm1j7079495@svn.freebsd.org> <201105282103.43370.pieter@degoeje.nl> Date: Sat, 28 May 2011 20:01:57 -0700 X-Google-Sender-Auth: 6UeKLgbjHrdgXGGOwyCqPuHAHZA Message-ID: From: mdf@FreeBSD.org To: Pieter de Goeje Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221853 - in head/sys: dev/md dev/null sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 03:01:59 -0000 On Sat, May 28, 2011 at 12:03 PM, Pieter de Goeje wrote= : > On Friday 13 May 2011 20:48:01 Matthew D Fleming wrote: >> Author: mdf >> Date: Fri May 13 18:48:00 2011 >> New Revision: 221853 >> URL: http://svn.freebsd.org/changeset/base/221853 >> >> Log: >> =A0 Usa a globally visible region of zeros for both /dev/zero and the md >> =A0 device. =A0There are likely other kernel uses of "blob of zeros" tha= n can >> =A0 be converted. >> >> =A0 Reviewed by: =A0 =A0 =A0 =A0alc >> =A0 MFC after: =A01 week >> > > This change seems to reduce /dev/zero performance by 68% as measured by t= his > command: dd if=3D/dev/zero of=3D/dev/null bs=3D64k count=3D100000. > > x dd-8-stable > + dd-9-current > +------------------------------------------------------------------------= -+ > |+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= | > |+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= | > |+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= | > |+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0x =A0x| > |+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0x x =A0x| > |A =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 |MA_|| > +------------------------------------------------------------------------= -+ > =A0 =A0N =A0 =A0 =A0 =A0 =A0 Min =A0 =A0 =A0 =A0 =A0 Max =A0 =A0 =A0 =A0M= edian =A0 =A0 =A0 =A0 =A0 Avg =A0 =A0 =A0 =A0Stddev > x =A0 5 1.2573578e+10 1.3156063e+10 1.2827355e+10 =A01.290079e+10 2.49512= 07e+08 > + =A0 5 4.1271391e+09 4.1453925e+09 4.1295157e+09 4.1328097e+09 =A0 =A0 7= 487363.6 > Difference at 95.0% confidence > =A0 =A0 =A0 =A0-8.76798e+09 +/- 2.57431e+08 > =A0 =A0 =A0 =A0-67.9647% +/- 1.99547% > =A0 =A0 =A0 =A0(Student's t, pooled s =3D 1.76511e+08) > > This particular measurement was against 8-stable but the results are the = same > for -current just before this commit. Basically througput drops from > ~13GB/sec to 4GB/sec. > > Hardware is a Phenom II X4 945 with 8GB of 800Mhz DDR2 memory. FreeBSD/am= d64 > is installed. This processor has 6MB of L3 cache. > > To me it looks like it's not able to cache the zeroes anymore. Is this > intentional? I tried to change ZERO_REGION_SIZE back to 64K but that didn= 't > help. Hmm. I don't have access to my FreeBSD box over the weekend, but I'll run this on my box when I get back to work. Meanwhile you could try setting ZERO_REGION_SIZE to PAGE_SIZE and I think that will restore things to the original performance. Cheers, matthew From owner-svn-src-head@FreeBSD.ORG Sun May 29 07:40:49 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E7261065670; Sun, 29 May 2011 07:40:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 351998FC1E; Sun, 29 May 2011 07:40:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4T7enjm020082; Sun, 29 May 2011 07:40:49 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4T7engw020080; Sun, 29 May 2011 07:40:49 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105290740.p4T7engw020080@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 May 2011 07:40:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222444 - head/contrib/ntp/ntpd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 07:40:49 -0000 Author: bz Date: Sun May 29 07:40:48 2011 New Revision: 222444 URL: http://svn.freebsd.org/changeset/base/222444 Log: The argument to setsockopt for IP_MULTICAST_LOOP depends on operating system and is decided upon by configure and could be an u_int or a u_char. For FreeBSD it is a u_char. For IPv6 however RFC 3493, 5.2 defines the argument to IPV6_MULTICAST_LOOP to be an unsigned integer so make sure we always use that using a second variable for the IPV6 case. This is to get rid of these error messages every 5 minutes on some systems: ntpd[1530]: setsockopt IPV6_MULTICAST_LOOP failure: Invalid argument on socket 22, addr fe80::... for multicast address ff02::101 While here also fix the copy&paste error in the log message for IPV6_MULTICAST_LOOP. Reviewed by: roberto Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 10 days Filed as: Bug 1936 on ntp.org Modified: head/contrib/ntp/ntpd/ntp_io.c Modified: head/contrib/ntp/ntpd/ntp_io.c ============================================================================== --- head/contrib/ntp/ntpd/ntp_io.c Sun May 29 05:45:56 2011 (r222443) +++ head/contrib/ntp/ntpd/ntp_io.c Sun May 29 07:40:48 2011 (r222444) @@ -1753,7 +1753,12 @@ void enable_multicast_if(struct interface *iface, struct sockaddr_storage *maddr) { #ifdef MCAST +#ifdef IP_MULTICAST_LOOP /*u_char*/ TYPEOF_IP_MULTICAST_LOOP off = 0; +#endif +#ifdef IPV6_MULTICAST_LOOP + u_int off6 = 0; /* RFC 3493, 5.2. defines type unsigned int */ +#endif switch (maddr->ss_family) { @@ -1797,9 +1802,9 @@ enable_multicast_if(struct interface *if * Don't send back to itself, but allow it to fail to set it */ if (setsockopt(iface->fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, - (char *) &off, sizeof(off)) == -1) { + (char *) &off6, sizeof(off6)) == -1) { netsyslog(LOG_ERR, - "setsockopt IP_MULTICAST_LOOP failure: %m on socket %d, addr %s for multicast address %s", + "setsockopt IPV6_MULTICAST_LOOP failure: %m on socket %d, addr %s for multicast address %s", iface->fd, stoa(&iface->sin), stoa(maddr)); } #endif From owner-svn-src-head@FreeBSD.ORG Sun May 29 11:10:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF6B61065673; Sun, 29 May 2011 11:10:56 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5D048FC0C; Sun, 29 May 2011 11:10:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TBAugk027412; Sun, 29 May 2011 11:10:56 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TBAuqS027410; Sun, 29 May 2011 11:10:56 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105291110.p4TBAuqS027410@svn.freebsd.org> From: Benedict Reuschling Date: Sun, 29 May 2011 11:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222447 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 11:10:56 -0000 Author: bcr (doc committer) Date: Sun May 29 11:10:56 2011 New Revision: 222447 URL: http://svn.freebsd.org/changeset/base/222447 Log: Mention that jumbo frame support is disabled on PCIe VT6130/VT6132 controllers because of TX MAC hangs when trying to send a frame that is larger than 4K (see r200759). PR: docs/156742 Submitted by: Michael Moll (kvedulv at kvedulv dot de) Reviewed by: yongari@ MFC after: 6 days Modified: head/share/man/man4/vge.4 Modified: head/share/man/man4/vge.4 ============================================================================== --- head/share/man/man4/vge.4 Sun May 29 10:49:33 2011 (r222446) +++ head/share/man/man4/vge.4 Sun May 29 11:10:56 2011 (r222447) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 23, 2010 +.Dd May 29, 2011 .Dt VGE 4 .Os .Sh NAME @@ -66,13 +66,14 @@ The MAC supports TCP/IP hardware checksums (IPv4 only), TCP large send, VLAN tag insertion and stripping, as well as VLAN filtering, a 64-entry CAM filter and a 64-entry VLAN filter, 64-bit multicast hash filter, 4 separate transmit DMA queues, flow control -and jumbo frames up to 16K in size. +and jumbo frames (not on VT6130/VT6132) up to 16K in size. The Velocity family controllers have a 16K receive FIFO and 48K transmit FIFO. .Pp The .Nm driver takes advantage of the controller's checksum offload and VLAN -tagging features, as well as the jumbo frame and CAM filter support. +tagging features, as well as the jumbo frame (except VT6130/VT6132) and CAM +filter support. The CAM filter is used for multicast address filtering to provide 64 perfect multicast address filter support. If it is necessary for the interface to join more than 64 multicast @@ -81,6 +82,8 @@ groups, the driver will switch over to u The jumbo frame support can be enabled by setting the interface MTU to any value larger than the default of 1500 bytes, up to a maximum of 9000 bytes. +Jumbo frames are disabled on the VT6130/VT6132 controllers because the TX +MAC will hang when trying to send a frame that is larger than 4K. The receive and transmit checksum offload support can be toggled on and off using the .Xr ifconfig 8 From owner-svn-src-head@FreeBSD.ORG Sun May 29 13:08:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72EF61065673; Sun, 29 May 2011 13:08:06 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id 2A7768FC16; Sun, 29 May 2011 13:08:06 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 9FF2358135; Sun, 29 May 2011 08:08:05 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id oAWiawMHrgjH; Sun, 29 May 2011 08:08:05 -0500 (CDT) Received: from elpis.tachypleus.net (unknown [76.210.63.135]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 2E4975811B; Sun, 29 May 2011 08:08:04 -0500 (CDT) Message-ID: <4DE24534.4080209@freebsd.org> Date: Sun, 29 May 2011 08:08:04 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; U; FreeBSD powerpc; en-US; rv:1.9.2.13) Gecko/20110202 Thunderbird/3.1.7 MIME-Version: 1.0 To: Julian Elischer References: <201105280850.p4S8odjf076440@svn.freebsd.org> In-Reply-To: <201105280850.p4S8odjf076440@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222417 - in head/sys/boot: common forth i386/loader ia64/common pc98/loader powerpc/ofw powerpc/ps3 sparc64/loader X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 13:08:06 -0000 On 05/28/11 03:50, Julian Elischer wrote: > Author: julian > Date: Sat May 28 08:50:38 2011 > New Revision: 222417 > URL: http://svn.freebsd.org/changeset/base/222417 > > Log: > New boot loader menus from Devin Teske. > Discussed on hackers and recommended for inclusion into 9.0 at the devsummit. > All support email to devin dteske at vicor dot ignoreme dot com . > > Submitted by: dteske at vicor dot ignoreme dot com > Reviewed by: me and many others > > Added: > head/sys/boot/forth/beastie.4th.8 (contents, props changed) > head/sys/boot/forth/brand.4th (contents, props changed) > head/sys/boot/forth/brand.4th.8 (contents, props changed) > head/sys/boot/forth/check-password.4th (contents, props changed) > head/sys/boot/forth/check-password.4th.8 (contents, props changed) > head/sys/boot/forth/color.4th (contents, props changed) > head/sys/boot/forth/color.4th.8 (contents, props changed) > head/sys/boot/forth/delay.4th (contents, props changed) > head/sys/boot/forth/delay.4th.8 (contents, props changed) > head/sys/boot/forth/menu-commands.4th (contents, props changed) > head/sys/boot/forth/menu.4th (contents, props changed) > head/sys/boot/forth/menu.4th.8 (contents, props changed) > head/sys/boot/forth/menu.rc (contents, props changed) > head/sys/boot/forth/shortcuts.4th (contents, props changed) > head/sys/boot/forth/version.4th (contents, props changed) > head/sys/boot/forth/version.4th.8 (contents, props changed) > Modified: > head/sys/boot/common/Makefile.inc > head/sys/boot/forth/beastie.4th > head/sys/boot/forth/loader.4th > head/sys/boot/forth/loader.conf.5 > head/sys/boot/forth/loader.rc > head/sys/boot/forth/support.4th > head/sys/boot/i386/loader/Makefile > head/sys/boot/ia64/common/Makefile > head/sys/boot/pc98/loader/Makefile > head/sys/boot/powerpc/ofw/Makefile > head/sys/boot/powerpc/ps3/Makefile > head/sys/boot/sparc64/loader/Makefile > This patch is bogus for non-x86 architectures, which don't use a boot menu, never have, and don't support full-screen mode. Please revert it for everything but i386 (and maybe pc98). -Nathan From owner-svn-src-head@FreeBSD.ORG Sun May 29 14:25:42 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9452106564A; Sun, 29 May 2011 14:25:42 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EE2A8FC12; Sun, 29 May 2011 14:25: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 p4TEPghB033868; Sun, 29 May 2011 14:25:42 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TEPggZ033861; Sun, 29 May 2011 14:25:42 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201105291425.p4TEPggZ033861@svn.freebsd.org> From: Andreas Tobler Date: Sun, 29 May 2011 14:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222449 - in head/sys: conf dev/iicbus powerpc/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 14:25:42 -0000 Author: andreast Date: Sun May 29 14:25:42 2011 New Revision: 222449 URL: http://svn.freebsd.org/changeset/base/222449 Log: Add a new driver, the ad7417, to read temperatures and voltages on some PowerMac's. Approved by: nwhitehorn (mentor) Added: head/sys/dev/iicbus/ad7417.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 head/sys/powerpc/conf/NOTES Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sun May 29 12:15:49 2011 (r222448) +++ head/sys/conf/files.powerpc Sun May 29 14:25:42 2011 (r222449) @@ -27,6 +27,7 @@ dev/cfi/cfi_bus_fdt.c optional cfi fdt dev/fb/fb.c optional sc dev/fdt/fdt_powerpc.c optional fdt dev/hwpmc/hwpmc_powerpc.c optional hwpmc +dev/iicbus/ad7417.c optional ad7417 powermac dev/iicbus/ds1775.c optional ds1775 powermac dev/iicbus/max6690.c optional max6690 powermac dev/kbd/kbd.c optional sc Added: head/sys/dev/iicbus/ad7417.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/ad7417.c Sun May 29 14:25:42 2011 (r222449) @@ -0,0 +1,457 @@ +/*- + * Copyright (c) 2010 Andreas Tobler + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#define FCU_ZERO_C_TO_K 2732 + +/* CPU A/B sensors, temp and adc: AD7417. */ + +#define AD7417_TEMP 0x00 +#define AD7417_CONFIG 0x01 +#define AD7417_ADC 0x04 +#define AD7417_CONFIG2 0x05 +#define AD7417_CONFMASK 0xe0 + +uint8_t adc741x_config; + +struct ad7417_sensor { + int id; + char location[32]; + enum { + ADC7417_TEMP_SENSOR, + ADC7417_ADC_SENSOR + } type; +}; + +/* Regular bus attachment functions */ +static int ad7417_probe(device_t); +static int ad7417_attach(device_t); + +/* Utility functions */ +static int ad7417_sensor_sysctl(SYSCTL_HANDLER_ARGS); +static int ad7417_write(device_t dev, uint32_t addr, uint8_t reg, + uint8_t *buf, int len); +static int ad7417_read_1(device_t dev, uint32_t addr, uint8_t reg, + uint8_t *data); +static int ad7417_read_2(device_t dev, uint32_t addr, uint8_t reg, + uint16_t *data); + +struct ad7417_softc { + device_t sc_dev; + uint32_t sc_addr; + struct ad7417_sensor *sc_sensors; + int sc_nsensors; +}; +static device_method_t ad7417_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ad7417_probe), + DEVMETHOD(device_attach, ad7417_attach), + { 0, 0 }, +}; + +static driver_t ad7417_driver = { + "ad7417", + ad7417_methods, + sizeof(struct ad7417_softc) +}; + +static devclass_t ad7417_devclass; + +DRIVER_MODULE(ad7417, iicbus, ad7417_driver, ad7417_devclass, 0, 0); +MALLOC_DEFINE(M_AD7417, "ad7417", "Supply-Monitor AD7417"); + + +static int +ad7417_write(device_t dev, uint32_t addr, uint8_t reg, uint8_t *buff, int len) +{ + unsigned char buf[4]; + struct iic_msg msg[] = { + { addr, IIC_M_WR, 0, buf } + }; + + msg[0].len = len + 1; + buf[0] = reg; + memcpy(buf + 1, buff, len); + + if (iicbus_transfer(dev, msg, 1) != 0) { + device_printf(dev, "iicbus write failed\n"); + return (EIO); + } + + return (0); + +} + +static int +ad7417_read_1(device_t dev, uint32_t addr, uint8_t reg, uint8_t *data) +{ + uint8_t buf[4]; + + struct iic_msg msg[2] = { + { addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® }, + { addr, IIC_M_RD, 1, buf }, + }; + + if (iicbus_transfer(dev, msg, 2) != 0) { + device_printf(dev, "iicbus read failed\n"); + return (EIO); + } + + *data = *((uint8_t*)buf); + + return (0); +} + +static int +ad7417_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data) +{ + uint8_t buf[4]; + + struct iic_msg msg[2] = { + { addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® }, + { addr, IIC_M_RD, 2, buf }, + }; + + if (iicbus_transfer(dev, msg, 2) != 0) { + device_printf(dev, "iicbus read failed\n"); + return (EIO); + } + + *data = *((uint16_t*)buf); + + return (0); +} + +static int +ad7417_init_adc(device_t dev, uint32_t addr) +{ + uint8_t buf; + + adc741x_config = 0; + /* Clear Config2 */ + buf = 0; + ad7417_write(dev, addr, AD7417_CONFIG2, &buf, 1); + + /* Read & cache Config1 */ + buf = 0; + ad7417_write(dev, addr, AD7417_CONFIG, &buf, 1); + + ad7417_read_1(dev, addr, AD7417_CONFIG, &buf); + adc741x_config = (uint8_t)buf; + + /* Disable shutdown mode */ + adc741x_config &= 0xfe; + buf = adc741x_config; + ad7417_write(dev, addr, AD7417_CONFIG, &buf, 1); + + return (0); + +} +static int +ad7417_probe(device_t dev) +{ + const char *name, *compatible; + struct ad7417_softc *sc; + + name = ofw_bus_get_name(dev); + compatible = ofw_bus_get_compat(dev); + + if (!name) + return (ENXIO); + + if (strcmp(name, "supply-monitor") != 0 || + strcmp(compatible, "ad7417") != 0) + return (ENXIO); + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_addr = iicbus_get_addr(dev); + + device_set_desc(dev, "Supply-Monitor AD7417"); + + return (0); +} + +/* + * This function returns the number of sensors. If we call it the second time + * and we have allocated memory for sc->sc_sensors, we fill in the properties. + */ +static int +ad7417_fill_sensor_prop(device_t dev) +{ + phandle_t child; + struct ad7417_softc *sc; + u_int id[10]; + char location[96]; + char type[32]; + int i = 0, j, len = 0, prop_len, prev_len = 0; + + sc = device_get_softc(dev); + + child = ofw_bus_get_node(dev); + + /* Fill the sensor location property. */ + prop_len = OF_getprop(child, "hwsensor-location", location, + sizeof(location)); + while (len < prop_len) { + if (sc->sc_sensors != NULL) + strcpy(sc->sc_sensors[i].location, location + len); + prev_len = strlen(location + len) + 1; + len += prev_len; + i++; + } + if (sc->sc_sensors == NULL) + return (i); + + /* Fill the fan type property. */ + len = 0; + i = 0; + prev_len = 0; + prop_len = OF_getprop(child, "hwsensor-type", type, sizeof(type)); + while (len < prop_len) { + if (strcmp(type + len, "temperature") == 0) + sc->sc_sensors[i].type = ADC7417_TEMP_SENSOR; + else + sc->sc_sensors[i].type = ADC7417_ADC_SENSOR; + prev_len = strlen(type + len) + 1; + len += prev_len; + i++; + } + + /* Fill the sensor id property. Taken from OF. */ + prop_len = OF_getprop(child, "hwsensor-id", id, sizeof(id)); + for (j = 0; j < i; j++) + sc->sc_sensors[j].id = id[j]; + + return (i); +} + +static int +ad7417_attach(device_t dev) +{ + struct ad7417_softc *sc; + struct sysctl_oid *oid, *sensroot_oid; + struct sysctl_ctx_list *ctx; + char sysctl_name[32]; + int i, j; + const char *unit; + const char *desc; + + sc = device_get_softc(dev); + + sc->sc_nsensors = 0; + + /* Count the actual number of sensors. */ + sc->sc_nsensors = ad7417_fill_sensor_prop(dev); + + device_printf(dev, "%d sensors detected.\n", sc->sc_nsensors); + + if (sc->sc_nsensors == 0) + device_printf(dev, "WARNING: No AD7417 sensors detected!\n"); + + sc->sc_sensors = malloc (sc->sc_nsensors * sizeof(struct ad7417_sensor), + M_AD7417, M_WAITOK | M_ZERO); + + ctx = device_get_sysctl_ctx(dev); + sensroot_oid = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "sensor", + CTLFLAG_RD, 0, "AD7417 Sensor Information"); + + /* Now we can fill the properties into the allocated struct. */ + sc->sc_nsensors = ad7417_fill_sensor_prop(dev); + + /* Add sysctls for the sensors. */ + for (i = 0; i < sc->sc_nsensors; i++) { + for (j = 0; j < strlen(sc->sc_sensors[i].location); j++) { + sysctl_name[j] = tolower(sc->sc_sensors[i].location[j]); + if (isspace(sysctl_name[j])) + sysctl_name[j] = '_'; + } + sysctl_name[j] = 0; + + oid = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(sensroot_oid), + OID_AUTO, + sysctl_name, CTLFLAG_RD, 0, + "Sensor Information"); + + if (sc->sc_sensors[i].type == ADC7417_TEMP_SENSOR) { + unit = "temp"; + desc = "Sensor temp in C"; + } else { + unit = "volt"; + desc = "Sensor Volt in V"; + } + /* I use i to pass the sensor id. */ + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + unit, CTLTYPE_INT | CTLFLAG_RD, dev, + i, ad7417_sensor_sysctl, + sc->sc_sensors[i].type == ADC7417_TEMP_SENSOR ? + "IK" : "I", desc); + } + /* Dump sensor location, ID & type. */ + if (bootverbose) { + device_printf(dev, "Sensors\n"); + for (i = 0; i < sc->sc_nsensors; i++) { + device_printf(dev, "Location: %s ID: %d type: %d\n", + sc->sc_sensors[i].location, + sc->sc_sensors[i].id, + sc->sc_sensors[i].type); + } + } + + return (0); +} + +static int +ad7417_get_temp(device_t dev, uint32_t addr, int *temp) +{ + uint16_t buf[2]; + uint16_t read; + + ad7417_read_2(dev, addr, AD7417_TEMP, buf); + read = *((int16_t*)buf); + + /* The ADC is 10 bit, the resolution is 0.25 C. + The temperature is in tenth kelvin. + */ + *temp = (((int16_t)(read & 0xffc0)) >> 6) * 25 / 10; + return (0); +} + +static int +ad7417_get_adc(device_t dev, uint32_t addr, unsigned int *value, + uint8_t chan) +{ + uint8_t cfg1, tmp; + uint16_t read, buf[2]; + + ad7417_read_1(dev, addr, AD7417_CONFIG, &cfg1); + + tmp = chan << 5; + + cfg1 = (cfg1 & ~AD7417_CONFMASK) | (tmp & AD7417_CONFMASK); + + ad7417_write(dev, addr, AD7417_CONFIG, &cfg1, 1); + + ad7417_read_2(dev, addr, AD7417_ADC, buf); + + read = *((uint16_t*)buf); + + *value = ((uint32_t)read) >> 6; + + return (0); +} + +static int +ad7417_sensor_read(device_t dev, struct ad7417_sensor *sens, int *temp) +{ + struct ad7417_softc *sc; + + sc = device_get_softc(dev); + + /* Init the ADC. */ + ad7417_init_adc(sc->sc_dev, sc->sc_addr); + + if (sens->type == ADC7417_TEMP_SENSOR) { + ad7417_get_temp(sc->sc_dev, sc->sc_addr, temp); + *temp += FCU_ZERO_C_TO_K; + } else { + uint8_t chan; + switch (sens->id) { + case 11: + case 16: + chan = 1; + break; + case 12: + case 17: + chan = 2; + break; + case 13: + case 18: + chan = 3; + break; + case 14: + case 19: + chan = 4; + break; + default: + chan = 1; + } + + ad7417_get_adc(sc->sc_dev, sc->sc_addr, temp, chan); + } + return (0); +} + +static int +ad7417_sensor_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t dev; + struct ad7417_softc *sc; + struct ad7417_sensor *sens; + int value = 0; + int error; + int temp; + + dev = arg1; + sc = device_get_softc(dev); + sens = &sc->sc_sensors[arg2]; + + error = ad7417_sensor_read(dev, sens, &value); + if (error != 0) + return (error); + + temp = value; + + error = sysctl_handle_int(oidp, &temp, 0, req); + + return (error); +} Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Sun May 29 12:15:49 2011 (r222448) +++ head/sys/powerpc/conf/GENERIC Sun May 29 14:25:42 2011 (r222449) @@ -174,6 +174,7 @@ device sbp # SCSI over FireWire (Requi device fwe # Ethernet over FireWire (non-standard!) # Misc +device ad7417 # PowerMac7,2 temperature sensor device ds1775 # PowerMac7,2 temperature sensor device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Sun May 29 12:15:49 2011 (r222448) +++ head/sys/powerpc/conf/GENERIC64 Sun May 29 14:25:42 2011 (r222449) @@ -175,6 +175,7 @@ device sbp # SCSI over FireWire (Requi device fwe # Ethernet over FireWire (non-standard!) # Misc +device ad7417 # PowerMac7,2 temperature sensor device ds1775 # PowerMac7,2 temperature sensor device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor Modified: head/sys/powerpc/conf/NOTES ============================================================================== --- head/sys/powerpc/conf/NOTES Sun May 29 12:15:49 2011 (r222448) +++ head/sys/powerpc/conf/NOTES Sun May 29 14:25:42 2011 (r222449) @@ -39,6 +39,7 @@ device kiic # Apple Keywest I2C Contro device ofwd # Open Firmware disks device adb # Apple Desktop Bus device cuda # VIA-CUDA ADB interface +device ad7417 # PowerMac7,2 temperature sensor device ds1775 # PowerMac7,2 temperature sensor device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor From owner-svn-src-head@FreeBSD.ORG Sun May 29 14:27:11 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7914B106566B; Sun, 29 May 2011 14:27:11 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6976B8FC0A; Sun, 29 May 2011 14:27:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TERBdw033951; Sun, 29 May 2011 14:27:11 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TERBN1033949; Sun, 29 May 2011 14:27:11 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201105291427.p4TERBN1033949@svn.freebsd.org> From: Andreas Tobler Date: Sun, 29 May 2011 14:27:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222450 - head/sys/boot/powerpc/ofw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 14:27:11 -0000 Author: andreast Date: Sun May 29 14:27:11 2011 New Revision: 222450 URL: http://svn.freebsd.org/changeset/base/222450 Log: Add some missing files. Without we hang in the OF prompt asking for screen.4th. Approved by: nwhitehorn (mentor) Modified: head/sys/boot/powerpc/ofw/Makefile Modified: head/sys/boot/powerpc/ofw/Makefile ============================================================================== --- head/sys/boot/powerpc/ofw/Makefile Sun May 29 14:25:42 2011 (r222449) +++ head/sys/boot/powerpc/ofw/Makefile Sun May 29 14:27:11 2011 (r222450) @@ -103,6 +103,7 @@ loader.help: help.common help.ofw .PATH: ${.CURDIR}/../../forth FILES= loader.help loader.4th support.4th loader.conf +FILES+= screen.4th frames.4th FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th FILESDIR_loader.conf= /boot/defaults From owner-svn-src-head@FreeBSD.ORG Sun May 29 15:02:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 992E9106566C; Sun, 29 May 2011 15:02:10 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51C798FC14; Sun, 29 May 2011 15:02:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TF2AKY035050; Sun, 29 May 2011 15:02:10 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TF2AWx035049; Sun, 29 May 2011 15:02:10 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201105291502.p4TF2AWx035049@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 29 May 2011 15:02:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222451 - head/tools/regression/bin/sh/builtins X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 15:02:10 -0000 Author: jilles Date: Sun May 29 15:02:10 2011 New Revision: 222451 URL: http://svn.freebsd.org/changeset/base/222451 Log: sh: Add test for 'set +o'. Added: head/tools/regression/bin/sh/builtins/set1.0 (contents, props changed) Added: head/tools/regression/bin/sh/builtins/set1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/set1.0 Sun May 29 15:02:10 2011 (r222451) @@ -0,0 +1,32 @@ +# $FreeBSD$ + +set +C +set +f +set -e + +settings=$(set +o) +set -C +set -f +set +e +case $- in +*C*) ;; +*) echo missing C ;; +esac +case $- in +*f*) ;; +*) echo missing C ;; +esac +case $- in +*e*) echo bad e ;; +esac +eval "$settings" +case $- in +*C*) echo bad C ;; +esac +case $- in +*f*) echo bad f ;; +esac +case $- in +*e*) ;; +*) echo missing e ;; +esac From owner-svn-src-head@FreeBSD.ORG Sun May 29 15:10:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C942106566C; Sun, 29 May 2011 15:10:52 +0000 (UTC) (envelope-from brix@FreeBSD.org) Received: from solow.pil.dk (relay.pil.dk [195.41.47.164]) by mx1.freebsd.org (Postfix) with ESMTP id 385908FC1F; Sun, 29 May 2011 15:10:51 +0000 (UTC) Received: from druadan.brixandersen.dk (0x55534f5f.adsl.cybercity.dk [85.83.79.95]) by solow.pil.dk (Postfix) with ESMTPA id 3CF081CC00D; Sun, 29 May 2011 17:10:50 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-3--190352940" From: Henrik Brix Andersen In-Reply-To: <201105291425.p4TEPggZ033861@svn.freebsd.org> Date: Sun, 29 May 2011 17:10:45 +0200 Content-Transfer-Encoding: 7bit Message-Id: <9F1CE0EF-CCA6-4A8A-8FE1-2E593626025A@FreeBSD.org> References: <201105291425.p4TEPggZ033861@svn.freebsd.org> To: Andreas Tobler X-Pgp-Agent: GPGMail 1.3.3 X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222449 - in head/sys: conf dev/iicbus powerpc/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 15:10:52 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-3--190352940 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi, On May 29, 2011, at 16:25, Andreas Tobler wrote: > Author: andreast > Date: Sun May 29 14:25:42 2011 > New Revision: 222449 > URL: http://svn.freebsd.org/changeset/base/222449 >=20 > Log: > Add a new driver, the ad7417, to read temperatures and voltages on = some > PowerMac's. >=20 > Approved by: nwhitehorn (mentor) >=20 > Added: > head/sys/dev/iicbus/ad7417.c (contents, props changed) > Modified: > head/sys/conf/files.powerpc > head/sys/powerpc/conf/GENERIC > head/sys/powerpc/conf/GENERIC64 > head/sys/powerpc/conf/NOTES Since this driver is powerpc-only (the chip is not powerpc-specific - = but this driver depends on OFW?) shouldn't it live somewhere under = sys/powerpc/ instead of the generic sys/dev/iicbus/? Or perhaps be rewritten to a more generic form? Brix --=20 Henrik Brix Andersen --Apple-Mail-3--190352940 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iEYEARECAAYFAk3iYfUACgkQv+Q4flTiePj4ogCeNY9Gk5hOaaXSUo40edmHW5x0 bcgAn1CP8/rw/5a1ZlkJpt0+QN6h2Zid =9tLJ -----END PGP SIGNATURE----- --Apple-Mail-3--190352940-- From owner-svn-src-head@FreeBSD.ORG Sun May 29 18:00:50 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC90C106564A; Sun, 29 May 2011 18:00:50 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD3DB8FC14; Sun, 29 May 2011 18:00:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TI0oP1040432; Sun, 29 May 2011 18:00:50 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TI0o01040430; Sun, 29 May 2011 18:00:50 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201105291800.p4TI0o01040430@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 29 May 2011 18:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222454 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 18:00:51 -0000 Author: trociny Date: Sun May 29 18:00:50 2011 New Revision: 222454 URL: http://svn.freebsd.org/changeset/base/222454 Log: In soreceive_generic(), if MSG_WAITALL is set but the request is larger than the receive buffer, we have to receive in sections. When notifying the protocol that some data has been drained the lock is released for a moment. Returning we block waiting for the rest of data. There is a race, when data could arrive while the lock was released and then the connection stalls in sbwait. Fix this by checking for data before blocking and skip blocking if there are some. PR: kern/154504 Reported by: Andrey Simonenko Tested by: Andrey Simonenko Reviewed by: rwatson Approved by: kib (co-mentor) MFC after: 2 weeks Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sun May 29 15:10:12 2011 (r222453) +++ head/sys/kern/uipc_socket.c Sun May 29 18:00:50 2011 (r222454) @@ -1845,10 +1845,16 @@ dontblock: } SBLASTRECORDCHK(&so->so_rcv); SBLASTMBUFCHK(&so->so_rcv); - error = sbwait(&so->so_rcv); - if (error) { - SOCKBUF_UNLOCK(&so->so_rcv); - goto release; + /* + * We could receive some data while was notifying + * the protocol. Skip blocking in this case. + */ + if (so->so_rcv.sb_mb == NULL) { + error = sbwait(&so->so_rcv); + if (error) { + SOCKBUF_UNLOCK(&so->so_rcv); + goto release; + } } m = so->so_rcv.sb_mb; if (m != NULL) From owner-svn-src-head@FreeBSD.ORG Sun May 29 18:35:58 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29B2F106564A; Sun, 29 May 2011 18:35:58 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 187328FC15; Sun, 29 May 2011 18:35:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TIZwmA041678; Sun, 29 May 2011 18:35:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TIZw50041673; Sun, 29 May 2011 18:35:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105291835.p4TIZw50041673@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 18:35:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222458 - in head/sys: dev/iicbus powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 18:35:58 -0000 Author: nwhitehorn Date: Sun May 29 18:35:57 2011 New Revision: 222458 URL: http://svn.freebsd.org/changeset/base/222458 Log: Update the I2C-based temperature/fan drivers to connect to the Powermac thermal control module. This provides automatic fan management on all G5 PowerMacs and Xserves. Modified: head/sys/dev/iicbus/ad7417.c head/sys/dev/iicbus/ds1775.c head/sys/dev/iicbus/max6690.c head/sys/powerpc/powermac/fcu.c Modified: head/sys/dev/iicbus/ad7417.c ============================================================================== --- head/sys/dev/iicbus/ad7417.c Sun May 29 18:33:13 2011 (r222457) +++ head/sys/dev/iicbus/ad7417.c Sun May 29 18:35:57 2011 (r222458) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #define FCU_ZERO_C_TO_K 2732 @@ -63,8 +64,9 @@ __FBSDID("$FreeBSD$"); uint8_t adc741x_config; struct ad7417_sensor { + struct pmac_therm therm; + device_t dev; int id; - char location[32]; enum { ADC7417_TEMP_SENSOR, ADC7417_ADC_SENSOR @@ -83,6 +85,9 @@ static int ad7417_read_1(device_t dev, u uint8_t *data); static int ad7417_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data); +static int ad7417_diode_read(struct ad7417_sensor *sens); +static int ad7417_adc_read(struct ad7417_sensor *sens); +static int ad7417_sensor_read(struct ad7417_sensor *sens); struct ad7417_softc { device_t sc_dev; @@ -243,7 +248,7 @@ ad7417_fill_sensor_prop(device_t dev) sizeof(location)); while (len < prop_len) { if (sc->sc_sensors != NULL) - strcpy(sc->sc_sensors[i].location, location + len); + strcpy(sc->sc_sensors[i].therm.name, location + len); prev_len = strlen(location + len) + 1; len += prev_len; i++; @@ -251,7 +256,7 @@ ad7417_fill_sensor_prop(device_t dev) if (sc->sc_sensors == NULL) return (i); - /* Fill the fan type property. */ + /* Fill the sensor type property. */ len = 0; i = 0; prev_len = 0; @@ -271,6 +276,36 @@ ad7417_fill_sensor_prop(device_t dev) for (j = 0; j < i; j++) sc->sc_sensors[j].id = id[j]; + /* Fill the sensor zone property. Taken from OF. */ + prop_len = OF_getprop(child, "hwsensor-zone", id, sizeof(id)); + for (j = 0; j < i; j++) + sc->sc_sensors[j].therm.zone = id[j]; + + /* Finish setting up sensor properties */ + for (j = 0; j < i; j++) { + sc->sc_sensors[j].dev = dev; + + /* HACK: Apple wired a random diode to the ADC line */ + if (strstr(sc->sc_sensors[j].therm.name, "DIODE TEMP") + != NULL) { + sc->sc_sensors[j].type = ADC7417_TEMP_SENSOR; + sc->sc_sensors[j].therm.read = + (int (*)(struct pmac_therm *))(ad7417_diode_read); + } else { + sc->sc_sensors[j].therm.read = + (int (*)(struct pmac_therm *))(ad7417_sensor_read); + } + + if (sc->sc_sensors[j].type != ADC7417_TEMP_SENSOR) + continue; + + /* Make up some ranges */ + sc->sc_sensors[j].therm.target_temp = 500 + 2732; + sc->sc_sensors[j].therm.max_temp = 900 + 2732; + + pmac_thermal_sensor_register(&sc->sc_sensors[j].therm); + } + return (i); } @@ -310,8 +345,9 @@ ad7417_attach(device_t dev) /* Add sysctls for the sensors. */ for (i = 0; i < sc->sc_nsensors; i++) { - for (j = 0; j < strlen(sc->sc_sensors[i].location); j++) { - sysctl_name[j] = tolower(sc->sc_sensors[i].location[j]); + for (j = 0; j < strlen(sc->sc_sensors[i].therm.name); j++) { + sysctl_name[j] = + tolower(sc->sc_sensors[i].therm.name[j]); if (isspace(sysctl_name[j])) sysctl_name[j] = '_'; } @@ -341,7 +377,7 @@ ad7417_attach(device_t dev) device_printf(dev, "Sensors\n"); for (i = 0; i < sc->sc_nsensors; i++) { device_printf(dev, "Location: %s ID: %d type: %d\n", - sc->sc_sensors[i].location, + sc->sc_sensors[i].therm.name, sc->sc_sensors[i].id, sc->sc_sensors[i].type); } @@ -391,44 +427,91 @@ ad7417_get_adc(device_t dev, uint32_t ad } static int -ad7417_sensor_read(device_t dev, struct ad7417_sensor *sens, int *temp) +ad7417_diode_read(struct ad7417_sensor *sens) +{ + static int eeprom_read = 0; + static cell_t eeprom[2][40]; + phandle_t eeprom_node; + int rawval, diode_slope, diode_offset; + int temp; + + if (!eeprom_read) { + eeprom_node = OF_finddevice("/u3/i2c/cpuid@a0"); + OF_getprop(eeprom_node, "cpuid", eeprom[0], sizeof(eeprom[0])); + eeprom_node = OF_finddevice("/u3/i2c/cpuid@a2"); + OF_getprop(eeprom_node, "cpuid", eeprom[1], sizeof(eeprom[1])); + eeprom_read = 1; + } + + rawval = ad7417_adc_read(sens); + if (strstr(sens->therm.name, "CPU B") != NULL) { + diode_slope = eeprom[1][0x11] >> 16; + diode_offset = (int16_t)(eeprom[1][0x11] & 0xffff) << 12; + } else { + diode_slope = eeprom[0][0x11] >> 16; + diode_offset = (int16_t)(eeprom[0][0x11] & 0xffff) << 12; + } + + temp = (rawval*diode_slope + diode_offset) >> 2; + temp = (10*(temp >> 16)) + ((10*(temp & 0xffff)) >> 16); + + return (temp + FCU_ZERO_C_TO_K); +} + +static int +ad7417_adc_read(struct ad7417_sensor *sens) +{ + struct ad7417_softc *sc; + uint8_t chan; + int temp; + + sc = device_get_softc(sens->dev); + + switch (sens->id) { + case 11: + case 16: + chan = 1; + break; + case 12: + case 17: + chan = 2; + break; + case 13: + case 18: + chan = 3; + break; + case 14: + case 19: + chan = 4; + break; + default: + chan = 1; + } + + ad7417_get_adc(sc->sc_dev, sc->sc_addr, &temp, chan); + + return (temp); +} + + +static int +ad7417_sensor_read(struct ad7417_sensor *sens) { struct ad7417_softc *sc; + int temp; - sc = device_get_softc(dev); + sc = device_get_softc(sens->dev); /* Init the ADC. */ ad7417_init_adc(sc->sc_dev, sc->sc_addr); if (sens->type == ADC7417_TEMP_SENSOR) { - ad7417_get_temp(sc->sc_dev, sc->sc_addr, temp); - *temp += FCU_ZERO_C_TO_K; + ad7417_get_temp(sc->sc_dev, sc->sc_addr, &temp); + temp += FCU_ZERO_C_TO_K; } else { - uint8_t chan; - switch (sens->id) { - case 11: - case 16: - chan = 1; - break; - case 12: - case 17: - chan = 2; - break; - case 13: - case 18: - chan = 3; - break; - case 14: - case 19: - chan = 4; - break; - default: - chan = 1; - } - - ad7417_get_adc(sc->sc_dev, sc->sc_addr, temp, chan); + temp = ad7417_adc_read(sens); } - return (0); + return (temp); } static int @@ -439,19 +522,16 @@ ad7417_sensor_sysctl(SYSCTL_HANDLER_ARGS struct ad7417_sensor *sens; int value = 0; int error; - int temp; dev = arg1; sc = device_get_softc(dev); sens = &sc->sc_sensors[arg2]; - error = ad7417_sensor_read(dev, sens, &value); - if (error != 0) - return (error); - - temp = value; + value = sens->therm.read(&sens->therm); + if (value < 0) + return (ENXIO); - error = sysctl_handle_int(oidp, &temp, 0, req); + error = sysctl_handle_int(oidp, &value, 0, req); return (error); } Modified: head/sys/dev/iicbus/ds1775.c ============================================================================== --- head/sys/dev/iicbus/ds1775.c Sun May 29 18:33:13 2011 (r222457) +++ head/sys/dev/iicbus/ds1775.c Sun May 29 18:35:57 2011 (r222458) @@ -49,33 +49,31 @@ __FBSDID("$FreeBSD$"); #include #include +#include #define FCU_ZERO_C_TO_K 2732 /* Drivebay sensor: LM75/DS1775. */ #define DS1775_TEMP 0x0 -struct ds1775_sensor { - char location[32]; -}; - /* Regular bus attachment functions */ static int ds1775_probe(device_t); static int ds1775_attach(device_t); +struct ds1775_softc { + struct pmac_therm sc_sensor; + device_t sc_dev; + struct intr_config_hook enum_hook; + uint32_t sc_addr; +}; + /* Utility functions */ +static int ds1775_sensor_read(struct ds1775_softc *sc); static int ds1775_sensor_sysctl(SYSCTL_HANDLER_ARGS); static void ds1775_start(void *xdev); static int ds1775_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data); -struct ds1775_softc { - device_t sc_dev; - struct intr_config_hook enum_hook; - uint32_t sc_addr; - struct ds1775_sensor *sc_sensors; - -}; static device_method_t ds1775_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ds1775_probe), @@ -92,7 +90,6 @@ static driver_t ds1775_driver = { static devclass_t ds1775_devclass; DRIVER_MODULE(ds1755, iicbus, ds1775_driver, ds1775_devclass, 0, 0); -MALLOC_DEFINE(M_DS1775, "ds1775", "Temp-Monitor DS1775"); static int ds1775_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data) @@ -169,7 +166,6 @@ ds1775_start(void *xdev) { phandle_t child; struct ds1775_softc *sc; - struct ds1775_sensor *sens; struct sysctl_oid *sensroot_oid; struct sysctl_ctx_list *ctx; ssize_t plen; @@ -183,30 +179,34 @@ ds1775_start(void *xdev) child = ofw_bus_get_node(dev); - sc->sc_sensors = malloc (sizeof(struct ds1775_sensor), - M_DS1775, M_WAITOK | M_ZERO); - - sens = sc->sc_sensors; - ctx = device_get_sysctl_ctx(dev); sensroot_oid = device_get_sysctl_tree(dev); - plen = OF_getprop(child, "hwsensor-location", sens->location, - sizeof(sens->location)); + OF_getprop(child, "hwsensor-zone", &sc->sc_sensor.zone, sizeof(int)); + plen = OF_getprop(child, "hwsensor-location", sc->sc_sensor.name, + sizeof(sc->sc_sensor.name)); units = "C"; if (plen == -1) { strcpy(sysctl_name, "sensor"); } else { - for (i = 0; i < strlen(sens->location); i++) { - sysctl_name[i] = tolower(sens->location[i]); + for (i = 0; i < strlen(sc->sc_sensor.name); i++) { + sysctl_name[i] = tolower(sc->sc_sensor.name[i]); if (isspace(sysctl_name[i])) sysctl_name[i] = '_'; } sysctl_name[i] = 0; } - sprintf(sysctl_desc,"%s (%s)", sens->location, units); + /* Make up target temperatures. These are low, for the drive bay. */ + sc->sc_sensor.target_temp = 300 + FCU_ZERO_C_TO_K; + sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K; + + sc->sc_sensor.read = + (int (*)(struct pmac_therm *sc))(ds1775_sensor_read); + pmac_thermal_sensor_register(&sc->sc_sensor); + + sprintf(sysctl_desc,"%s (%s)", sc->sc_sensor.name, units); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO, sysctl_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, @@ -216,14 +216,11 @@ ds1775_start(void *xdev) } static int -ds1775_sensor_read(device_t dev, struct ds1775_sensor *sens, int *temp) +ds1775_sensor_read(struct ds1775_softc *sc) { - struct ds1775_softc *sc; uint16_t buf[2]; uint16_t read; - sc = device_get_softc(dev); - ds1775_read_2(sc->sc_dev, sc->sc_addr, DS1775_TEMP, buf); read = *((int16_t *)buf); @@ -231,29 +228,21 @@ ds1775_sensor_read(device_t dev, struct /* The default mode of the ADC is 9 bit, the resolution is 0.5 C per bit. The temperature is in tenth kelvin. */ - *temp = ((int16_t)(read) >> 7) * 5; - - return (0); + return (((int16_t)(read) >> 7) * 5 + FCU_ZERO_C_TO_K); } + static int ds1775_sensor_sysctl(SYSCTL_HANDLER_ARGS) { device_t dev; struct ds1775_softc *sc; - struct ds1775_sensor *sens; - int value; int error; unsigned int temp; dev = arg1; sc = device_get_softc(dev); - sens = &sc->sc_sensors[arg2]; - - error = ds1775_sensor_read(dev, sens, &value); - if (error != 0) - return (error); - temp = value + FCU_ZERO_C_TO_K; + temp = ds1775_sensor_read(sc); error = sysctl_handle_int(oidp, &temp, 0, req); Modified: head/sys/dev/iicbus/max6690.c ============================================================================== --- head/sys/dev/iicbus/max6690.c Sun May 29 18:33:13 2011 (r222457) +++ head/sys/dev/iicbus/max6690.c Sun May 29 18:35:57 2011 (r222458) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #define FCU_ZERO_C_TO_K 2732 @@ -61,8 +62,10 @@ __FBSDID("$FreeBSD$"); #define MAX6690_TEMP_MASK 0xe0 struct max6690_sensor { + struct pmac_therm therm; + device_t dev; + int id; - char location[32]; }; /* Regular bus attachment functions */ @@ -70,6 +73,7 @@ static int max6690_probe(device_t); static int max6690_attach(device_t); /* Utility functions */ +static int max6690_sensor_read(struct max6690_sensor *sens); static int max6690_sensor_sysctl(SYSCTL_HANDLER_ARGS); static void max6690_start(void *xdev); static int max6690_read_1(device_t dev, uint32_t addr, uint8_t reg, @@ -167,7 +171,7 @@ max6690_fill_sensor_prop(device_t dev) sizeof(location)); while (len < prop_len) { if (sc->sc_sensors != NULL) - strcpy(sc->sc_sensors[i].location, location + len); + strcpy(sc->sc_sensors[i].therm.name, location + len); prev_len = strlen(location + len) + 1; len += prev_len; i++; @@ -180,6 +184,22 @@ max6690_fill_sensor_prop(device_t dev) for (j = 0; j < i; j++) sc->sc_sensors[j].id = (id[j] & 0xf); + /* Fill the sensor zone property. */ + prop_len = OF_getprop(child, "hwsensor-zone", id, sizeof(id)); + for (j = 0; j < i; j++) + sc->sc_sensors[j].therm.zone = id[j]; + + /* Set up remaining sensor properties */ + for (j = 0; j < i; j++) { + sc->sc_sensors[j].dev = dev; + + sc->sc_sensors[j].therm.target_temp = 400 + 2732; + sc->sc_sensors[j].therm.max_temp = 800 + 2732; + + sc->sc_sensors[j].therm.read = + (int (*)(struct pmac_therm *))(max6690_sensor_read); + } + return (i); } static int @@ -240,10 +260,15 @@ max6690_start(void *xdev) /* Now we can fill the properties into the allocated struct. */ sc->sc_nsensors = max6690_fill_sensor_prop(dev); + /* Register with powermac_thermal */ + for (i = 0; i < sc->sc_nsensors; i++) + pmac_thermal_sensor_register(&sc->sc_sensors[i].therm); + /* Add sysctls for the sensors. */ for (i = 0; i < sc->sc_nsensors; i++) { - for (j = 0; j < strlen(sc->sc_sensors[i].location); j++) { - sysctl_name[j] = tolower(sc->sc_sensors[i].location[j]); + for (j = 0; j < strlen(sc->sc_sensors[i].therm.name); j++) { + sysctl_name[j] = + tolower(sc->sc_sensors[i].therm.name[j]); if (isspace(sysctl_name[j])) sysctl_name[j] = '_'; } @@ -265,7 +290,7 @@ max6690_start(void *xdev) device_printf(dev, "Sensors\n"); for (i = 0; i < sc->sc_nsensors; i++) { device_printf(dev, "Location : %s ID: %d\n", - sc->sc_sensors[i].location, + sc->sc_sensors[i].therm.name, sc->sc_sensors[i].id); } } @@ -274,14 +299,15 @@ max6690_start(void *xdev) } static int -max6690_sensor_read(device_t dev, struct max6690_sensor *sens, int *temp) +max6690_sensor_read(struct max6690_sensor *sens) { uint8_t reg_int = 0, reg_ext = 0; uint8_t integer; uint8_t fraction; + int temp; struct max6690_softc *sc; - sc = device_get_softc(dev); + sc = device_get_softc(sens->dev); /* The internal sensor id's are even, the external ar odd. */ if ((sens->id % 2) == 0) { @@ -301,9 +327,9 @@ max6690_sensor_read(device_t dev, struct /* The temperature is in tenth kelvin, the fractional part resolution is 0.125. */ - *temp = (integer * 10) + (fraction >> 5) * 10 / 8; + temp = (integer * 10) + (fraction >> 5) * 10 / 8; - return (0); + return (temp); } static int @@ -320,9 +346,9 @@ max6690_sensor_sysctl(SYSCTL_HANDLER_ARG sc = device_get_softc(dev); sens = &sc->sc_sensors[arg2]; - error = max6690_sensor_read(dev, sens, &value); - if (error != 0) - return (error); + value = max6690_sensor_read(sens); + if (value < 0) + return (EIO); temp = value + FCU_ZERO_C_TO_K; Modified: head/sys/powerpc/powermac/fcu.c ============================================================================== --- head/sys/powerpc/powermac/fcu.c Sun May 29 18:33:13 2011 (r222457) +++ head/sys/powerpc/powermac/fcu.c Sun May 29 18:35:57 2011 (r222458) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include /* FCU registers * /u3@0,f8000000/i2c@f8001000/fan@15e @@ -66,10 +67,10 @@ __FBSDID("$FreeBSD$"); #define FCU_PWM_SGET(x) 0x30 + (x) * 2 /* Set or get PWM. */ struct fcu_fan { + struct pmac_fan fan; + device_t dev; + int id; - cell_t min; - cell_t max; - char location[32]; enum { FCU_FAN_RPM, FCU_FAN_PWM @@ -103,9 +104,9 @@ static int fcu_attach(device_t); /* Utility functions */ static void fcu_attach_fans(device_t dev); static int fcu_fill_fan_prop(device_t dev); -static int fcu_fan_set_rpm(device_t dev, struct fcu_fan *fan, int rpm); -static int fcu_fan_get_rpm(device_t dev, struct fcu_fan *fan, int *rpm); -static int fcu_fan_set_pwm(device_t dev, struct fcu_fan *fan, int pwm); +static int fcu_fan_set_rpm(struct fcu_fan *fan, int rpm); +static int fcu_fan_get_rpm(struct fcu_fan *fan); +static int fcu_fan_set_pwm(struct fcu_fan *fan, int pwm); static int fcu_fan_get_pwm(device_t dev, struct fcu_fan *fan, int *pwm, int *rpm); static int fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS); @@ -249,23 +250,23 @@ fcu_start(void *xdev) } static int -fcu_fan_set_rpm(device_t dev, struct fcu_fan *fan, int rpm) +fcu_fan_set_rpm(struct fcu_fan *fan, int rpm) { uint8_t reg; struct fcu_softc *sc; unsigned char buf[2]; - sc = device_get_softc(dev); + sc = device_get_softc(fan->dev); /* Clamp to allowed range */ - rpm = max(fan->min, rpm); - rpm = min(fan->max, rpm); + rpm = max(fan->fan.min_rpm, rpm); + rpm = min(fan->fan.max_rpm, rpm); if (fan->type == FCU_FAN_RPM) { reg = FCU_RPM_SET(fan->id); fan->setpoint = rpm; } else { - device_printf(dev, "Unknown fan type: %d\n", fan->type); + device_printf(fan->dev, "Unknown fan type: %d\n", fan->type); return (EIO); } @@ -278,66 +279,68 @@ fcu_fan_set_rpm(device_t dev, struct fcu } static int -fcu_fan_get_rpm(device_t dev, struct fcu_fan *fan, int *rpm) +fcu_fan_get_rpm(struct fcu_fan *fan) { uint8_t reg; struct fcu_softc *sc; uint8_t buff[2] = { 0, 0 }; uint8_t active = 0, avail = 0, fail = 0; + int rpm; - sc = device_get_softc(dev); + sc = device_get_softc(fan->dev); if (fan->type == FCU_FAN_RPM) { /* Check if the fan is available. */ reg = FCU_RPM_AVAILABLE; fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &avail); if ((avail & (1 << fan->id)) == 0) { - device_printf(dev, "RPM Fan not available ID: %d\n", - fan->id); - return (EIO); + device_printf(fan->dev, + "RPM Fan not available ID: %d\n", fan->id); + return (-1); } /* Check if we have a failed fan. */ reg = FCU_RPM_FAIL; fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &fail); if ((fail & (1 << fan->id)) != 0) { - device_printf(dev, "RPM Fan failed ID: %d\n", fan->id); - return (EIO); + device_printf(fan->dev, + "RPM Fan failed ID: %d\n", fan->id); + return (-1); } /* Check if fan is active. */ reg = FCU_RPM_ACTIVE; fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &active); if ((active & (1 << fan->id)) == 0) { - device_printf(dev, "RPM Fan not active ID: %d\n", + device_printf(fan->dev, "RPM Fan not active ID: %d\n", fan->id); - return (ENXIO); + return (-1); } reg = FCU_RPM_READ(fan->id); } else { - device_printf(dev, "Unknown fan type: %d\n", fan->type); - return (EIO); + device_printf(fan->dev, "Unknown fan type: %d\n", fan->type); + return (-1); } /* It seems that we can read the fans rpm. */ fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buff); - *rpm = (buff[0] << (8 - fcu_rpm_shift)) | buff[1] >> fcu_rpm_shift; + rpm = (buff[0] << (8 - fcu_rpm_shift)) | buff[1] >> fcu_rpm_shift; - return (0); + return (rpm); } static int -fcu_fan_set_pwm(device_t dev, struct fcu_fan *fan, int pwm) +fcu_fan_set_pwm(struct fcu_fan *fan, int pwm) { uint8_t reg; struct fcu_softc *sc; uint8_t buf[2]; - sc = device_get_softc(dev); + sc = device_get_softc(fan->dev); /* Clamp to allowed range */ - pwm = max(fan->min, pwm); - pwm = min(fan->max, pwm); + pwm = max(fan->fan.min_rpm, pwm); + pwm = min(fan->fan.max_rpm, pwm); if (fan->type == FCU_FAN_PWM) { reg = FCU_PWM_SGET(fan->id); @@ -347,7 +350,7 @@ fcu_fan_set_pwm(device_t dev, struct fcu pwm = 30; fan->setpoint = pwm; } else { - device_printf(dev, "Unknown fan type: %d\n", fan->type); + device_printf(fan->dev, "Unknown fan type: %d\n", fan->type); return (EIO); } @@ -434,7 +437,7 @@ fcu_fill_fan_prop(device_t dev) sizeof(location)); while (len < prop_len) { if (sc->sc_fans != NULL) { - strcpy(sc->sc_fans[i].location, location + len); + strcpy(sc->sc_fans[i].fan.name, location + len); } prev_len = strlen(location + len) + 1; len += prev_len; @@ -463,6 +466,33 @@ fcu_fill_fan_prop(device_t dev) for (j = 0; j < i; j++) sc->sc_fans[j].id = ((id[j] >> 8) & 0x0f) % 8; + /* Fill the fan zone property. */ + prop_len = OF_getprop(child, "hwctrl-zone", id, sizeof(id)); + for (j = 0; j < i; j++) + sc->sc_fans[j].fan.zone = id[j]; + + /* Finish setting up fan properties */ + for (j = 0; j < i; j++) { + sc->sc_fans[j].dev = sc->sc_dev; + if (sc->sc_fans[j].type == FCU_FAN_RPM) { + sc->sc_fans[j].fan.min_rpm = 4800 >> fcu_rpm_shift; + sc->sc_fans[j].fan.max_rpm = 56000 >> fcu_rpm_shift; + sc->sc_fans[j].setpoint = + fcu_fan_get_rpm(&sc->sc_fans[j]); + sc->sc_fans[j].fan.read = + (int (*)(struct pmac_fan *))(fcu_fan_get_rpm); + sc->sc_fans[j].fan.set = + (int (*)(struct pmac_fan *, int))(fcu_fan_set_rpm); + } else { + sc->sc_fans[j].fan.min_rpm = 40; /* Percent */ + sc->sc_fans[j].fan.max_rpm = 100; + sc->sc_fans[j].fan.read = NULL; + sc->sc_fans[j].fan.set = + (int (*)(struct pmac_fan *, int))(fcu_fan_set_pwm); + } + sc->sc_fans[j].fan.default_rpm = sc->sc_fans[j].fan.max_rpm; + } + return (i); } @@ -478,7 +508,7 @@ fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS) sc = device_get_softc(fcu); fan = &sc->sc_fans[arg2 & 0x00ff]; if (fan->type == FCU_FAN_RPM) { - fcu_fan_get_rpm(fcu, fan, &rpm); + rpm = fcu_fan_get_rpm(fan); error = sysctl_handle_int(oidp, &rpm, 0, req); } else { fcu_fan_get_pwm(fcu, fan, &pwm, &rpm); @@ -504,9 +534,9 @@ fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS) return (error); if (fan->type == FCU_FAN_RPM) - return (fcu_fan_set_rpm(fcu, fan, rpm)); + return (fcu_fan_set_rpm(fan, rpm)); else - return (fcu_fan_set_pwm(fcu, fan, pwm)); + return (fcu_fan_set_pwm(fan, pwm)); } static void @@ -543,39 +573,36 @@ fcu_attach_fans(device_t dev) /* Now we can fill the properties into the allocated struct. */ sc->sc_nfans = fcu_fill_fan_prop(dev); + /* Register fans with pmac_thermal */ + for (i = 0; i < sc->sc_nfans; i++) + pmac_thermal_fan_register(&sc->sc_fans[i].fan); + /* Add sysctls for the fans. */ for (i = 0; i < sc->sc_nfans; i++) { - for (j = 0; j < strlen(sc->sc_fans[i].location); j++) { - sysctl_name[j] = tolower(sc->sc_fans[i].location[j]); + for (j = 0; j < strlen(sc->sc_fans[i].fan.name); j++) { + sysctl_name[j] = tolower(sc->sc_fans[i].fan.name[j]); if (isspace(sysctl_name[j])) sysctl_name[j] = '_'; } sysctl_name[j] = 0; if (sc->sc_fans[i].type == FCU_FAN_RPM) { - sc->sc_fans[i].min = 2400 >> fcu_rpm_shift; - sc->sc_fans[i].max = 56000 >> fcu_rpm_shift; - fcu_fan_get_rpm(dev, &sc->sc_fans[i], - &sc->sc_fans[i].setpoint); - oid = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(fanroot_oid), OID_AUTO, sysctl_name, CTLFLAG_RD, 0, "Fan Information"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "minrpm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].min), sizeof(cell_t), - "Minimum allowed RPM"); + &(sc->sc_fans[i].fan.min_rpm), + sizeof(int), "Minimum allowed RPM"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "maxrpm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].max), sizeof(cell_t), - "Maximum allowed RPM"); + &(sc->sc_fans[i].fan.max_rpm), + sizeof(int), "Maximum allowed RPM"); /* I use i to pass the fan id. */ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "rpm", CTLTYPE_INT | CTLFLAG_RW, dev, i, fcu_fanrpm_sysctl, "I", "Fan RPM"); } else { - sc->sc_fans[i].min = 30; - sc->sc_fans[i].max = 100; fcu_fan_get_pwm(dev, &sc->sc_fans[i], &sc->sc_fans[i].setpoint, &sc->sc_fans[i].rpm); @@ -585,12 +612,12 @@ fcu_attach_fans(device_t dev) CTLFLAG_RD, 0, "Fan Information"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "minpwm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].min), sizeof(cell_t), - "Minimum allowed PWM in %"); + &(sc->sc_fans[i].fan.min_rpm), + sizeof(int), "Minimum allowed PWM in %"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "maxpwm", CTLTYPE_INT | CTLFLAG_RD, - &(sc->sc_fans[i].max), sizeof(cell_t), - "Maximum allowed PWM in %"); + &(sc->sc_fans[i].fan.max_rpm), + sizeof(int), "Maximum allowed PWM in %"); /* I use i to pass the fan id or'ed with the type * of info I want to display/modify. */ @@ -610,7 +637,7 @@ fcu_attach_fans(device_t dev) device_printf(dev, "Fans\n"); for (i = 0; i < sc->sc_nfans; i++) { device_printf(dev, "Location: %s type: %d ID: %d " - "RPM: %d\n", sc->sc_fans[i].location, + "RPM: %d\n", sc->sc_fans[i].fan.name, sc->sc_fans[i].type, sc->sc_fans[i].id, (sc->sc_fans[i].type == FCU_FAN_RPM) ? sc->sc_fans[i].setpoint : From owner-svn-src-head@FreeBSD.ORG Sun May 29 18:41:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AD90106564A; Sun, 29 May 2011 18:41:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B51A8FC18; Sun, 29 May 2011 18:41: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 p4TIf6cu041864; Sun, 29 May 2011 18:41:06 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TIf6uN041859; Sun, 29 May 2011 18:41:06 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201105291841.p4TIf6uN041859@svn.freebsd.org> From: Michael Tuexen Date: Sun, 29 May 2011 18:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222459 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 18:41:07 -0000 Author: tuexen Date: Sun May 29 18:41:06 2011 New Revision: 222459 URL: http://svn.freebsd.org/changeset/base/222459 Log: Get rid of unused functions. MFC after: 1 week. Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sun May 29 18:35:57 2011 (r222458) +++ head/sys/netinet/sctp_indata.c Sun May 29 18:41:06 2011 (r222459) @@ -247,49 +247,6 @@ sctp_build_ctl_nchunk(struct sctp_inpcb } -char * -sctp_build_ctl_cchunk(struct sctp_inpcb *inp, - int *control_len, - struct sctp_sndrcvinfo *sinfo) -{ - struct sctp_sndrcvinfo *outinfo; - struct cmsghdr *cmh; - char *buf; - int len; - int use_extended = 0; - - if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_RECVDATAIOEVNT)) { - /* user does not want the sndrcv ctl */ - return (NULL); - } - if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXT_RCVINFO)) { - use_extended = 1; - len = CMSG_LEN(sizeof(struct sctp_extrcvinfo)); - } else { - len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); - } - SCTP_MALLOC(buf, char *, len, SCTP_M_CMSG); - if (buf == NULL) { - /* No space */ - return (buf); - } - /* We need a CMSG header followed by the struct */ - cmh = (struct cmsghdr *)buf; - outinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmh); - cmh->cmsg_level = IPPROTO_SCTP; - if (use_extended) { - cmh->cmsg_type = SCTP_EXTRCV; - cmh->cmsg_len = len; - memcpy(outinfo, sinfo, len); - } else { - cmh->cmsg_type = SCTP_SNDRCV; - cmh->cmsg_len = len; - *outinfo = *sinfo; - } - *control_len = len; - return (buf); -} - static void sctp_mark_non_revokable(struct sctp_association *asoc, uint32_t tsn) { Modified: head/sys/netinet/sctp_indata.h ============================================================================== --- head/sys/netinet/sctp_indata.h Sun May 29 18:35:57 2011 (r222458) +++ head/sys/netinet/sctp_indata.h Sun May 29 18:41:06 2011 (r222459) @@ -83,11 +83,6 @@ struct mbuf * sctp_build_ctl_nchunk(struct sctp_inpcb *inp, struct sctp_sndrcvinfo *sinfo); -char * -sctp_build_ctl_cchunk(struct sctp_inpcb *inp, - int *control_len, - struct sctp_sndrcvinfo *sinfo); - void sctp_set_rwnd(struct sctp_tcb *, struct sctp_association *); uint32_t Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sun May 29 18:35:57 2011 (r222458) +++ head/sys/netinet/sctputil.c Sun May 29 18:41:06 2011 (r222459) @@ -6184,71 +6184,6 @@ sctp_soreceive(struct socket *so, } -int -sctp_l_soreceive(struct socket *so, - struct sockaddr **name, - struct uio *uio, - char **controlp, - int *controllen, - int *flag) -{ - int error, fromlen; - uint8_t sockbuf[256]; - struct sockaddr *from; - struct sctp_extrcvinfo sinfo; - int filling_sinfo = 1; - struct sctp_inpcb *inp; - - inp = (struct sctp_inpcb *)so->so_pcb; - /* pickup the assoc we are reading from */ - if (inp == NULL) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); - return (EINVAL); - } - if ((sctp_is_feature_off(inp, - SCTP_PCB_FLAGS_RECVDATAIOEVNT)) || - (controlp == NULL)) { - /* user does not want the sndrcv ctl */ - filling_sinfo = 0; - } - if (name) { - from = (struct sockaddr *)sockbuf; - fromlen = sizeof(sockbuf); - from->sa_len = 0; - } else { - from = NULL; - fromlen = 0; - } - - error = sctp_sorecvmsg(so, uio, - (struct mbuf **)NULL, - from, fromlen, flag, - (struct sctp_sndrcvinfo *)&sinfo, - filling_sinfo); - if ((controlp) && (filling_sinfo)) { - /* - * copy back the sinfo in a CMSG format note that the caller - * has reponsibility for freeing the memory. - */ - if (filling_sinfo) - *controlp = sctp_build_ctl_cchunk(inp, - controllen, - (struct sctp_sndrcvinfo *)&sinfo); - } - if (name) { - /* copy back the address info */ - if (from && from->sa_len) { - *name = sodupsockaddr(from, M_WAIT); - } else { - *name = NULL; - } - } - return (error); -} - - - - Modified: head/sys/netinet/sctputil.h ============================================================================== --- head/sys/netinet/sctputil.h Sun May 29 18:35:57 2011 (r222458) +++ head/sys/netinet/sctputil.h Sun May 29 18:41:06 2011 (r222459) @@ -328,20 +328,6 @@ sctp_soreceive(struct socket *so, struct struct mbuf **controlp, int *flagsp); - -/* For those not passing mbufs, this does the - * translations for you. Caller owns memory - * of size controllen returned in controlp. - */ -int -sctp_l_soreceive(struct socket *so, - struct sockaddr **name, - struct uio *uio, - char **controlp, - int *controllen, - int *flag); - - void sctp_misc_ints(uint8_t from, uint32_t a, uint32_t b, uint32_t c, uint32_t d); From owner-svn-src-head@FreeBSD.ORG Sun May 29 19:53:11 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC6DE1065674; Sun, 29 May 2011 19:53:11 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCDA68FC13; Sun, 29 May 2011 19:53:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TJrBQo044073; Sun, 29 May 2011 19:53:11 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TJrBMq044071; Sun, 29 May 2011 19:53:11 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105291953.p4TJrBMq044071@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 19:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222460 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 19:53:11 -0000 Author: nwhitehorn Date: Sun May 29 19:53:11 2011 New Revision: 222460 URL: http://svn.freebsd.org/changeset/base/222460 Log: Don't put negative values into the averages. Modified: head/sys/powerpc/powermac/powermac_thermal.c Modified: head/sys/powerpc/powermac/powermac_thermal.c ============================================================================== --- head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 18:41:06 2011 (r222459) +++ head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 19:53:11 2011 (r222460) @@ -121,6 +121,8 @@ pmac_therm_manage_fans(void) sensor->sensor->target_temp)*100 / (sensor->sensor->max_temp - sensor->sensor->target_temp); + if (frac_excess < 0) + frac_excess = 0; if (sensor->sensor->zone == fan->fan->zone) { max_excess_zone = imax(max_excess_zone, frac_excess); From owner-svn-src-head@FreeBSD.ORG Sun May 29 19:53:46 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 961271065782; Sun, 29 May 2011 19:53:46 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 86C4A8FC1D; Sun, 29 May 2011 19:53:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TJrk8W044122; Sun, 29 May 2011 19:53:46 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TJrkAt044120; Sun, 29 May 2011 19:53:46 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105291953.p4TJrkAt044120@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 19:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222461 - head/sys/dev/iicbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 19:53:46 -0000 Author: nwhitehorn Date: Sun May 29 19:53:46 2011 New Revision: 222461 URL: http://svn.freebsd.org/changeset/base/222461 Log: Move the celsius-to-kelvin conversion to a place that powermac_thermal can see it as well. Modified: head/sys/dev/iicbus/max6690.c Modified: head/sys/dev/iicbus/max6690.c ============================================================================== --- head/sys/dev/iicbus/max6690.c Sun May 29 19:53:11 2011 (r222460) +++ head/sys/dev/iicbus/max6690.c Sun May 29 19:53:46 2011 (r222461) @@ -329,7 +329,7 @@ max6690_sensor_read(struct max6690_senso */ temp = (integer * 10) + (fraction >> 5) * 10 / 8; - return (temp); + return (temp + FCU_ZERO_C_TO_K); } static int @@ -338,7 +338,6 @@ max6690_sensor_sysctl(SYSCTL_HANDLER_ARG device_t dev; struct max6690_softc *sc; struct max6690_sensor *sens; - int value = 0; int error; unsigned int temp; @@ -346,12 +345,10 @@ max6690_sensor_sysctl(SYSCTL_HANDLER_ARG sc = device_get_softc(dev); sens = &sc->sc_sensors[arg2]; - value = max6690_sensor_read(sens); - if (value < 0) + temp = max6690_sensor_read(sens); + if (temp < 0) return (EIO); - temp = value + FCU_ZERO_C_TO_K; - error = sysctl_handle_int(oidp, &temp, 0, req); return (error); From owner-svn-src-head@FreeBSD.ORG Sun May 29 20:04:03 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F98F106566B; Sun, 29 May 2011 20:04:03 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 501B08FC14; Sun, 29 May 2011 20:04: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 p4TK43tQ044512; Sun, 29 May 2011 20:04:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TK43LR044509; Sun, 29 May 2011 20:04:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105292004.p4TK43LR044509@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 20:04:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222462 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 20:04:03 -0000 Author: nwhitehorn Date: Sun May 29 20:04:02 2011 New Revision: 222462 URL: http://svn.freebsd.org/changeset/base/222462 Log: Add the next digit of precision to temperatures, which I missed when converting the reporting format from degrees C to 0.1 degree K. Modified: head/sys/powerpc/powermac/smu.c head/sys/powerpc/powermac/smusat.c Modified: head/sys/powerpc/powermac/smu.c ============================================================================== --- head/sys/powerpc/powermac/smu.c Sun May 29 19:53:46 2011 (r222461) +++ head/sys/powerpc/powermac/smu.c Sun May 29 20:04:02 2011 (r222462) @@ -854,7 +854,7 @@ smu_sensor_read(struct smu_sensor *sens) value <<= 1; /* Convert from 16.16 fixed point degC into integer 0.1 K. */ - value = 10*(value >> 16) + 2732; + value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2732; break; case SMU_VOLTAGE_SENSOR: value *= sc->sc_cpu_volt_scale; Modified: head/sys/powerpc/powermac/smusat.c ============================================================================== --- head/sys/powerpc/powermac/smusat.c Sun May 29 19:53:46 2011 (r222461) +++ head/sys/powerpc/powermac/smusat.c Sun May 29 20:04:02 2011 (r222462) @@ -235,7 +235,7 @@ smusat_sensor_read(struct smu_sensor *se /* 16.16 */ value <<= 10; /* From 16.16 to 0.1 C */ - value = 10*(value >> 16) + 2732; + value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2732; break; case SMU_VOLTAGE_SENSOR: /* 16.16 */ From owner-svn-src-head@FreeBSD.ORG Sun May 29 20:46:54 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32A60106564A; Sun, 29 May 2011 20:46:54 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22FDD8FC0C; Sun, 29 May 2011 20:46: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 p4TKksi6045884; Sun, 29 May 2011 20:46:54 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TKksdv045882; Sun, 29 May 2011 20:46:54 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105292046.p4TKksdv045882@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 20:46:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222463 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 20:46:54 -0000 Author: nwhitehorn Date: Sun May 29 20:46:53 2011 New Revision: 222463 URL: http://svn.freebsd.org/changeset/base/222463 Log: Add some error handling here: if a sensor returns an error code (a negative Kelvin temperature, which is impossible except for some contrived magnetic spin systems), use the previous measurement from that sensor instead of corrupting everything and randomly changing the fans or shutting off the machine. Modified: head/sys/powerpc/powermac/powermac_thermal.c Modified: head/sys/powerpc/powermac/powermac_thermal.c ============================================================================== --- head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 20:04:02 2011 (r222462) +++ head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 20:46:53 2011 (r222463) @@ -94,13 +94,17 @@ pmac_therm_manage_fans(void) struct pmac_fan_le *fan; int average_excess, max_excess_zone, frac_excess; int nsens, nsens_zone; + int temp; if (!enable_pmac_thermal) return; /* Read all the sensors */ SLIST_FOREACH(sensor, &sensors, entries) { - sensor->last_val = sensor->sensor->read(sensor->sensor); + temp = sensor->sensor->read(sensor->sensor); + if (temp > 0) /* Use the previous temp in case of error */ + sensor->last_val = temp; + if (sensor->last_val > sensor->sensor->max_temp) { printf("WARNING: Current temperature (%s: %d.%d C) " "exceeds critical temperature (%d.%d C)! " From owner-svn-src-head@FreeBSD.ORG Sun May 29 20:55:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B2D6106564A; Sun, 29 May 2011 20:55:24 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BC258FC0A; Sun, 29 May 2011 20:55:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TKtNhf046237; Sun, 29 May 2011 20:55:23 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TKtNgD046235; Sun, 29 May 2011 20:55:23 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201105292055.p4TKtNgD046235@svn.freebsd.org> From: Rick Macklem Date: Sun, 29 May 2011 20:55:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222464 - head/sys/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 20:55:24 -0000 Author: rmacklem Date: Sun May 29 20:55:23 2011 New Revision: 222464 URL: http://svn.freebsd.org/changeset/base/222464 Log: Add a check for MNTK_UNMOUNTF at the beginning of nfs_sync() in the old NFS client so that a forced dismount doesn't get stuck in the VFS_SYNC() call that happens before VFS_UNMOUNT() in dounmount(). Analagous to r222329 for the new NFS client. An additional change is needed before forced dismounts will work. PR: kern/157365 MFC after: 2 weeks Modified: head/sys/nfsclient/nfs_vfsops.c Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Sun May 29 20:46:53 2011 (r222463) +++ head/sys/nfsclient/nfs_vfsops.c Sun May 29 20:55:23 2011 (r222464) @@ -1408,10 +1408,20 @@ nfs_sync(struct mount *mp, int waitfor) td = curthread; + MNT_ILOCK(mp); + /* + * If a forced dismount is in progress, return from here so that + * the umount(2) syscall doesn't get stuck in VFS_SYNC() before + * calling VFS_UNMOUNT(). + */ + if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + MNT_IUNLOCK(mp); + return (EBADF); + } + /* * Force stale buffer cache information to be flushed. */ - MNT_ILOCK(mp); loop: MNT_VNODE_FOREACH(vp, mp, mvp) { VI_LOCK(vp); From owner-svn-src-head@FreeBSD.ORG Sun May 29 21:03:40 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A400106566C; Sun, 29 May 2011 21:03:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 794CC8FC13; Sun, 29 May 2011 21:03:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TL3ekG046541; Sun, 29 May 2011 21:03:40 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TL3egv046536; Sun, 29 May 2011 21:03:40 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105292103.p4TL3egv046536@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 May 2011 21:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222465 - in head/usr.sbin: jail jls X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 21:03:40 -0000 Author: bz Date: Sun May 29 21:03:40 2011 New Revision: 222465 URL: http://svn.freebsd.org/changeset/base/222465 Log: Check for IPv4 or IPv6 to be available by the kernel to not provoke errors trying to query options not available. Make it possible to compile out INET or INET6 only parts. Reviewed by: jamie Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 10 days Modified: head/usr.sbin/jail/Makefile head/usr.sbin/jail/jail.c head/usr.sbin/jls/Makefile head/usr.sbin/jls/jls.c Modified: head/usr.sbin/jail/Makefile ============================================================================== --- head/usr.sbin/jail/Makefile Sun May 29 20:55:23 2011 (r222464) +++ head/usr.sbin/jail/Makefile Sun May 29 21:03:40 2011 (r222465) @@ -10,5 +10,8 @@ LDADD= -ljail -lutil .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 .endif +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+= -DINET +.endif .include Modified: head/usr.sbin/jail/jail.c ============================================================================== --- head/usr.sbin/jail/jail.c Sun May 29 20:55:23 2011 (r222464) +++ head/usr.sbin/jail/jail.c Sun May 29 21:03:40 2011 (r222465) @@ -54,12 +54,18 @@ static struct jailparam *params; static char **param_values; static int nparams; -static char *ip4_addr; #ifdef INET6 +static int ip6_ok; static char *ip6_addr; #endif +#ifdef INET +static int ip4_ok; +static char *ip4_addr; +#endif +#if defined(INET6) || defined(INET) static void add_ip_addr(char **addrp, char *newaddr); +#endif #ifdef INET6 static void add_ip_addr46(char *newaddr); #endif @@ -194,6 +200,13 @@ main(int argc, char **argv) if (uflag) GET_USER_INFO; +#ifdef INET6 + ip6_ok = feature_present("inet6"); +#endif +#ifdef INET + ip4_ok = feature_present("inet"); +#endif + if (jailname) set_param("name", jailname); if (securelevel) @@ -207,10 +220,12 @@ main(int argc, char **argv) break; } if (hflag) { +#ifdef INET if (!strncmp(argv[i], "ip4.addr=", 9)) { add_ip_addr(&ip4_addr, argv[i] + 9); break; } +#endif #ifdef INET6 if (!strncmp(argv[i], "ip6.addr=", 9)) { add_ip_addr(&ip6_addr, argv[i] + 9); @@ -231,12 +246,14 @@ main(int argc, char **argv) set_param("host.hostname", argv[1]); if (hflag) add_ip_addrinfo(0, argv[1]); +#if defined(INET6) || defined(INET) if (argv[2][0] != '\0') #ifdef INET6 add_ip_addr46(argv[2]); #else add_ip_addr(&ip4_addr, argv[2]); #endif +#endif cmdarg = 3; /* Emulate the defaults from security.jail.* sysctls */ sysvallen = sizeof(sysval); @@ -259,8 +276,10 @@ main(int argc, char **argv) } } } +#ifdef INET if (ip4_addr != NULL) set_param("ip4.addr", ip4_addr); +#endif #ifdef INET6 if (ip6_addr != NULL) set_param("ip6.addr", ip6_addr); @@ -297,14 +316,19 @@ main(int argc, char **argv) for (i = 0; i < nparams; i++) if (!strcmp(params[i].jp_name, "path")) break; -#ifdef INET6 +#if defined(INET6) && defined(INET) fprintf(fp, "%d\t%s\t%s\t%s%s%s\t%s\n", jid, i < nparams ? (char *)params[i].jp_value : argv[0], argv[1], ip4_addr ? ip4_addr : "", ip4_addr && ip4_addr[0] && ip6_addr && ip6_addr[0] ? "," : "", ip6_addr ? ip6_addr : "", argv[3]); -#else +#elif defined(INET6) + fprintf(fp, "%d\t%s\t%s\t%s\t%s\n", + jid, i < nparams + ? (char *)params[i].jp_value : argv[0], + argv[1], ip6_addr ? ip6_addr : "", argv[3]); +#elif defined(INET) fprintf(fp, "%d\t%s\t%s\t%s\t%s\n", jid, i < nparams ? (char *)params[i].jp_value : argv[0], @@ -348,6 +372,7 @@ main(int argc, char **argv) err(1, "execvp: %s", argv[cmdarg]); } +#if defined(INET6) || defined(INET) static void add_ip_addr(char **addrp, char *value) { @@ -368,6 +393,7 @@ add_ip_addr(char **addrp, char *value) *addrp = addr; } } +#endif #ifdef INET6 static void @@ -391,23 +417,24 @@ static void add_ip_addrinfo(int ai_flags, char *value) { struct addrinfo hints, *ai0, *ai; - struct in_addr addr4; - size_t size; - int error, ip4ok; - int mib[4]; + int error; +#ifdef INET char avalue4[INET_ADDRSTRLEN]; + struct in_addr addr4; +#endif #ifdef INET6 - struct in6_addr addr6; - int ip6ok; char avalue6[INET6_ADDRSTRLEN]; + struct in6_addr addr6; #endif /* Look up the hostname (or get the address) */ memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; -#ifdef INET6 +#if defined(INET6) && defined(INET) hints.ai_family = PF_UNSPEC; -#else +#elif defined(INET6) + hints.ai_family = PF_INET6; +#elif defined(INET) hints.ai_family = PF_INET; #endif hints.ai_flags = ai_flags; @@ -415,32 +442,12 @@ add_ip_addrinfo(int ai_flags, char *valu if (error != 0) errx(1, "hostname %s: %s", value, gai_strerror(error)); - /* - * Silently ignore unsupported address families from DNS lookups. - * But if this is a numeric address, let the kernel give the error. - */ - if (ai_flags & AI_NUMERICHOST) - ip4ok = -#ifdef INET6 - ip6ok = -#endif - 1; - else { - size = 4; - ip4ok = (sysctlnametomib("security.jail.param.ip4", mib, - &size) == 0); -#ifdef INET6 - size = 4; - ip6ok = (sysctlnametomib("security.jail.param.ip6", mib, - &size) == 0); -#endif - } - /* Convert the addresses to ASCII so set_param can convert them back. */ for (ai = ai0; ai; ai = ai->ai_next) switch (ai->ai_family) { +#ifdef INET case AF_INET: - if (!ip4ok) + if (!ip4_ok && (ai_flags & AI_NUMERICHOST) == 0) break; memcpy(&addr4, &((struct sockaddr_in *) (void *)ai->ai_addr)->sin_addr, sizeof(addr4)); @@ -449,9 +456,10 @@ add_ip_addrinfo(int ai_flags, char *valu err(1, "inet_ntop"); add_ip_addr(&ip4_addr, avalue4); break; +#endif #ifdef INET6 case AF_INET6: - if (!ip6ok) + if (!ip6_ok && (ai_flags & AI_NUMERICHOST) == 0) break; memcpy(&addr6, &((struct sockaddr_in6 *) (void *)ai->ai_addr)->sin6_addr, sizeof(addr6)); Modified: head/usr.sbin/jls/Makefile ============================================================================== --- head/usr.sbin/jls/Makefile Sun May 29 20:55:23 2011 (r222464) +++ head/usr.sbin/jls/Makefile Sun May 29 21:03:40 2011 (r222465) @@ -1,8 +1,17 @@ # $FreeBSD$ +.include + PROG= jls MAN= jls.8 DPADD= ${LIBJAIL} LDADD= -ljail +.if ${MK_INET6_SUPPORT} != "no" +CFLAGS+= -DINET6 +.endif +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+= -DINET +.endif + .include Modified: head/usr.sbin/jls/jls.c ============================================================================== --- head/usr.sbin/jls/jls.c Sun May 29 20:55:23 2011 (r222464) +++ head/usr.sbin/jls/jls.c Sun May 29 21:03:40 2011 (r222465) @@ -59,6 +59,12 @@ __FBSDID("$FreeBSD$"); static struct jailparam *params; static int *param_parent; static int nparams; +#ifdef INET6 +static int ip6_ok; +#endif +#ifdef INET +static int ip4_ok; +#endif static int add_param(const char *name, void *value, size_t valuelen, struct jailparam *source, unsigned flags); @@ -112,6 +118,13 @@ main(int argc, char **argv) errx(1, "usage: jls [-dhnqv] [-j jail] [param ...]"); } +#ifdef INET6 + ip6_ok = feature_present("inet6"); +#endif +#ifdef INET + ip4_ok = feature_present("inet"); +#endif + /* Add the parameters to print. */ if (optind == argc) { if (pflags & (PRINT_HEADER | PRINT_NAMEVAL)) @@ -124,13 +137,24 @@ main(int argc, char **argv) add_param("name", NULL, (size_t)0, NULL, JP_USER); add_param("dying", NULL, (size_t)0, NULL, JP_USER); add_param("cpuset.id", NULL, (size_t)0, NULL, JP_USER); - add_param("ip4.addr", NULL, (size_t)0, NULL, JP_USER); - add_param("ip6.addr", NULL, (size_t)0, NULL, - JP_USER | JP_OPT); +#ifdef INET + if (ip4_ok) + add_param("ip4.addr", NULL, (size_t)0, NULL, + JP_USER); +#endif +#ifdef INET6 + if (ip6_ok) + add_param("ip6.addr", NULL, (size_t)0, NULL, + JP_USER | JP_OPT); +#endif } else { pflags |= PRINT_DEFAULT; add_param("jid", NULL, (size_t)0, NULL, JP_USER); - add_param("ip4.addr", NULL, (size_t)0, NULL, JP_USER); +#ifdef INET + if (ip4_ok) + add_param("ip4.addr", NULL, (size_t)0, NULL, + JP_USER); +#endif add_param("host.hostname", NULL, (size_t)0, NULL, JP_USER); add_param("path", NULL, (size_t)0, NULL, JP_USER); @@ -327,7 +351,7 @@ print_jail(int pflags, int jflags) { char *nname; char **param_values; - int i, ai, jid, count, spc; + int i, ai, jid, count, n, spc; char ipbuf[INET6_ADDRSTRLEN]; jid = jailparam_get(params, nparams, jflags); @@ -345,31 +369,45 @@ print_jail(int pflags, int jflags) *(int *)params[4].jp_value ? "DYING" : "ACTIVE", "", *(int *)params[5].jp_value); - count = params[6].jp_valuelen / sizeof(struct in_addr); - for (ai = 0; ai < count; ai++) - if (inet_ntop(AF_INET, - &((struct in_addr *)params[6].jp_value)[ai], - ipbuf, sizeof(ipbuf)) == NULL) - err(1, "inet_ntop"); - else - printf("%6s %-15.15s\n", "", ipbuf); - if (!strcmp(params[7].jp_name, "ip6.addr")) { - count = params[7].jp_valuelen / sizeof(struct in6_addr); + n = 6; +#ifdef INET + if (ip4_ok && !strcmp(params[n].jp_name, "ip.addr")) { + count = params[n].jp_valuelen / sizeof(struct in_addr); + for (ai = 0; ai < count; ai++) + if (inet_ntop(AF_INET, + &((struct in_addr *)params[n].jp_value)[ai], + ipbuf, sizeof(ipbuf)) == NULL) + err(1, "inet_ntop"); + else + printf("%6s %-15.15s\n", "", ipbuf); + n++; + } +#endif +#ifdef INET6 + if (ip6_ok && !strcmp(params[n].jp_name, "ip6.addr")) { + count = params[n].jp_valuelen / sizeof(struct in6_addr); for (ai = 0; ai < count; ai++) if (inet_ntop(AF_INET6, - &((struct in6_addr *)params[7].jp_value)[ai], + &((struct in6_addr *) + params[n].jp_value)[ai], ipbuf, sizeof(ipbuf)) == NULL) err(1, "inet_ntop"); else printf("%6s %s\n", "", ipbuf); + n++; } +#endif } else if (pflags & PRINT_DEFAULT) printf("%6d %-15.15s %-29.29s %.74s\n", *(int *)params[0].jp_value, - params[1].jp_valuelen == 0 ? "-" +#ifdef INET + (!ip4_ok || params[1].jp_valuelen == 0) ? "-" : inet_ntoa(*(struct in_addr *)params[1].jp_value), - (char *)params[2].jp_value, - (char *)params[3].jp_value); +#else + "-" +#endif + (char *)params[2-!ip4_ok].jp_value, + (char *)params[3-!ip4_ok].jp_value); else { param_values = alloca(nparams * sizeof(*param_values)); for (i = 0; i < nparams; i++) { From owner-svn-src-head@FreeBSD.ORG Sun May 29 21:13:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4F86106566B; Sun, 29 May 2011 21:13:53 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B58B78FC16; Sun, 29 May 2011 21:13: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 p4TLDrrH046888; Sun, 29 May 2011 21:13:53 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TLDrA3046886; Sun, 29 May 2011 21:13:53 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201105292113.p4TLDrA3046886@svn.freebsd.org> From: Rick Macklem Date: Sun, 29 May 2011 21:13:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 21:13:53 -0000 Author: rmacklem Date: Sun May 29 21:13:53 2011 New Revision: 222466 URL: http://svn.freebsd.org/changeset/base/222466 Log: Modify the umount(8) command so that it doesn't do a sync(2) syscall before unmount(2) for the "-f" case. This avoids a forced dismount from getting stuck for an NFS mountpoint in sync() when the server is not responsive. With this commit, forced dismounts should normally work for the NFS clients, but can take up to about 1minute to complete. PR: kern/157365 Reviewed by: kib MFC after: 2 weeks Modified: head/sbin/umount/umount.c Modified: head/sbin/umount/umount.c ============================================================================== --- head/sbin/umount/umount.c Sun May 29 21:03:40 2011 (r222465) +++ head/sbin/umount/umount.c Sun May 29 21:13:53 2011 (r222466) @@ -90,9 +90,6 @@ main(int argc, char *argv[]) struct statfs *mntbuf, *sfs; struct addrinfo hints; - /* Start disks transferring immediately. */ - sync(); - all = errs = 0; while ((ch = getopt(argc, argv, "AaF:fh:t:v")) != -1) switch (ch) { @@ -127,6 +124,10 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + /* Start disks transferring immediately. */ + if ((fflag & MNT_FORCE) == 0) + sync(); + if ((argc == 0 && !all) || (argc != 0 && all)) usage(); From owner-svn-src-head@FreeBSD.ORG Sun May 29 21:20:48 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EFA61065675; Sun, 29 May 2011 21:20:48 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FCC08FC14; Sun, 29 May 2011 21:20:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TLKl9W047126; Sun, 29 May 2011 21:20:47 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TLKlTx047124; Sun, 29 May 2011 21:20:47 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201105292120.p4TLKlTx047124@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 29 May 2011 21:20:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222467 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 21:20:48 -0000 Author: trociny Date: Sun May 29 21:20:47 2011 New Revision: 222467 URL: http://svn.freebsd.org/changeset/base/222467 Log: If READ from the local node failed we send the request to the remote node. There is no use in doing this for synchronization requests. Approved by: pjd (mentor) MFC after: 1 week Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Sun May 29 21:13:53 2011 (r222466) +++ head/sbin/hastd/primary.c Sun May 29 21:20:47 2011 (r222467) @@ -1243,7 +1243,7 @@ local_send_thread(void *arg) ggio->gctl_offset + res->hr_localoff); if (ret == ggio->gctl_length) hio->hio_errors[ncomp] = 0; - else { + else if (!ISSYNCREQ(hio)) { /* * If READ failed, try to read from remote node. */ From owner-svn-src-head@FreeBSD.ORG Sun May 29 21:24:20 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC21C106564A; Sun, 29 May 2011 21:24:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBCAF8FC13; Sun, 29 May 2011 21:24: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 p4TLOKR2047296; Sun, 29 May 2011 21:24:20 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TLOKiM047291; Sun, 29 May 2011 21:24:20 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105292124.p4TLOKiM047291@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 May 2011 21:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222468 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 21:24:21 -0000 Author: bz Date: Sun May 29 21:24:20 2011 New Revision: 222468 URL: http://svn.freebsd.org/changeset/base/222468 Log: Split netconfig into three parts: - netconfig - what auto will call which in turn will check for IPv4 and IPv6 to be available and ask the user to configure it by calling - netconfig_ipv4 doing DHCP and static IPv4 addresses, and - netconfig_ipv6 doing rtsol and static IPv6 addresses, and then checking, querying and updating resolv.conf upon return. Both DHCP and rtsol (in the future) might update resolv.conf already so we seed ourselves from that file if available. Reviewed by: nwhitehorn Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems Added: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 (contents, props changed) head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 (contents, props changed) Modified: head/usr.sbin/bsdinstall/scripts/Makefile head/usr.sbin/bsdinstall/scripts/netconfig Modified: head/usr.sbin/bsdinstall/scripts/Makefile ============================================================================== --- head/usr.sbin/bsdinstall/scripts/Makefile Sun May 29 21:20:47 2011 (r222467) +++ head/usr.sbin/bsdinstall/scripts/Makefile Sun May 29 21:24:20 2011 (r222468) @@ -1,7 +1,8 @@ # $FreeBSD$ SCRIPTS= auto adduser checksum config hostname jail keymap mirrorselect \ - mount netconfig rootpass services time umount wlanconfig + mount netconfig netconfig_ipv4 netconfig_ipv6 rootpass services \ + time umount wlanconfig BINDIR= /usr/libexec/bsdinstall NO_MAN= true Modified: head/usr.sbin/bsdinstall/scripts/netconfig ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig Sun May 29 21:20:47 2011 (r222467) +++ head/usr.sbin/bsdinstall/scripts/netconfig Sun May 29 21:24:20 2011 (r222468) @@ -2,6 +2,11 @@ #- # Copyright (c) 2011 Nathan Whitehorn # All rights reserved. +# Copyright (c) 2011 The FreeBSD Foundation +# All rights reserved. +# +# Portions of this software were developed by Bjoern Zeeb +# under sponsorship from the FreeBSD Foundation. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -66,56 +71,124 @@ if ifconfig $INTERFACE | grep -q 'media: INTERFACE="$NEXT_WLAN_IFACE" fi -dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0 -if [ $? -eq $DIALOG_OK ]; then - echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/rc.conf.net - - if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then - dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0 - dhclient $INTERFACE 2>> $BSDINSTALL_LOG - if [ $? -ne 0 ]; then - dialog --backtitle 'FreeBSD Installer' --msgbox "DHCP lease acquisition failed." 0 0 - exec $0 - fi +IPV6_AVAIL=0 +IPV4_AVAIL=0 +sysctl -N kern.features.inet6 > /dev/null 2>&1 +case $? in +0) IPV6_AVAIL=1 ;; +esac +sysctl -N kern.features.inet > /dev/null 2>&1 +case $? in +0) IPV4_AVAIL=1 ;; +esac + +if [ ${IPV4_AVAIL} -eq 1 ]; then + dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \ + --yesno 'Would you like to configure IPv4 for this interface?' 0 0 + if [ $? -eq $DIALOG_OK ]; then + bsdinstall netconfig_ipv4 ${INTERFACE} "${IFCONFIG_PREFIX}" || \ + exec $0 + else + IPV4_AVAIL=0 + fi +fi +# In case wlanconfig left an option and we do not support IPv4 we need to write +# it out on its own. We cannot write it out with IPv6 as that suffix. +if [ ${IPV4_AVAIL} -eq 0 -a -n ${IFCONFIG_PREFIX} ]; then + echo ifconfig_${INTERFACE}=\"${IFCONFIG_PREFIX}\" >> $BSDINSTALL_TMPETC/rc.conf.net +fi +if [ ${IPV6_AVAIL} -eq 1 ]; then + dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \ + --yesno 'Would you like to configure IPv6 for this interface?' 0 0 + if [ $? -eq $DIALOG_OK ]; then + bsdinstall netconfig_ipv6 ${INTERFACE} || exec $0 + else + IPV6_AVAIL=0 fi - exit 0 fi -IP_ADDRESS=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $2); }'` -NETMASK=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $4); }'` -ROUTER=`netstat -rn -f inet | awk '/default/ {printf("%s\n", $2);}'` +SEARCH="" +IP4_1="" +IP4_2="" +IP6_1="" +IP6_2="" +while read key value; do + case "${key}" in + search) SEARCH="${value}" ;; + nameserver) # is more trick as we have to distinguish v4 and v6 + case "${value}" in + [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) + if [ -z "${IP4_1}" ] ; then + IP4_1="${value}" + elif [ -z "${IP4_2}" ]; then + IP4_2="${value}" + fi + ;; + [0-9A-Fa-f:]*:*) + if [ -z "${IP6_1}" ] ; then + IP6_1="${value}" + elif [ -z "${IP6_2}" ]; then + IP6_2="${value}" + fi + ;; + esac + ;; + # ignore others + esac +done < ${BSDINSTALL_TMPETC}/resolv.conf + +RESOLV="" +if [ ${IPV6_AVAIL} -eq 1 -a ${IPV4_AVAIL} -eq 1 ]; then + RESOLV=" + 'Search' 1 0 \"${SEARCH}\" 1 16 50 0 0 + 'Nameserver' 2 0 \"Nameserver\" 2 16 50 0 2 + 'IPv6 DNS #1' 2 0 \"${IP6_1}\" 2 16 50 0 0 + 'IPv6 DNS #2' 3 0 \"${IP6_2}\" 3 16 50 0 0 + 'IPv4 DNS #1' 4 0 \"${IP4_1}\" 4 16 16 0 0 + 'IPv4 DNS #2' 5 0 \"${IP4_2}\" 5 16 16 0 0" +elif [ ${IPV6_AVAIL} -eq 1 ]; then + RESOLV=" + 'Search' 1 0 \"${SEARCH}\" 1 16 50 0 0 + 'Nameserver' 2 0 \"Nameserver\" 2 16 50 0 2 + 'IPv6 DNS #1' 2 0 \"${IP6_1}\" 2 16 50 0 0 + 'IPv6 DNS #2' 3 0 \"${IP6_2}\" 3 16 50 0 0" +elif [ ${IPV4_AVAIL} -eq 1 ]; then + RESOLV=" + 'Search' 1 0 \"${SEARCH}\" 1 16 50 0 0 + 'Nameserver' 2 0 \"Nameserver\" 2 16 50 0 2 + 'IPv4 DNS #1' 2 0 \"${IP4_1}\" 2 16 16 0 0 + 'IPv4 DNS #2' 3 0 \"${IP4_2}\" 3 16 16 0 0" +else + exit 0 +fi exec 3>&1 -IF_CONFIG=$(dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --form 'Static Network Interface Configuration' 0 0 0 \ - 'IP Address' 1 0 "$IP_ADDRESS" 1 20 16 0 \ - 'Subnet Mask' 2 0 "$NETMASK" 2 20 16 0 \ - 'Default Router' 3 0 "$ROUTER" 3 20 16 0 \ - \ - 'Nameserver' 5 0 "" 5 20 16 0 \ - 'Search Domain' 6 0 "" 6 20 20 0 \ +RESOLV=$(echo "${RESOLV}" | xargs dialog --backtitle 'FreeBSD Installer' \ + --title 'Network Configuration' \ + --mixedform 'Resovler Configuration' 0 0 0 \ 2>&1 1>&3) if [ $? -eq $DIALOG_CANCEL ]; then exec $0; fi exec 3>&- -echo $INTERFACE $IF_CONFIG | - awk -v prefix="$IFCONFIG_PREFIX" '{ - printf("ifconfig_%s=\"%s%s netmask %s\"\n", $1, prefix, $2, $3); - printf("defaultrouter=\"%s\"\n", $4); - }' >> $BSDINSTALL_TMPETC/rc.conf.net - -if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then - . $BSDINSTALL_TMPETC/rc.conf.net - ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE` - route delete default - route add default $defaultrouter -fi - - -echo $IF_CONFIG | - awk '{ - if ($4 != "") - printf("nameserver %s\n", $4); - if ($5 != "") - printf("search %s\n", $5); - }' > $BSDINSTALL_TMPETC/resolv.conf +echo ${RESOLV} | tr ' ' '\n' | \ +awk ' +BEGIN { + search=1 + printf "search "; +} +{ + if (/^[[:space:]]+$/) { + next; + } + if (/^Nameserver$/) { + printf "\n"; + search=0; + next; + } + if (search > 0) { + printf "%s%s", (search > 1) ? "," : "", $1; + next; + } + printf "nameserver %s\n", $1; +}' > ${BSDINSTALL_TMPETC}/resolv.conf Added: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Sun May 29 21:24:20 2011 (r222468) @@ -0,0 +1,85 @@ +#!/bin/sh +#- +# Copyright (c) 2011 Nathan Whitehorn +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +: ${DIALOG_OK=0} +: ${DIALOG_CANCEL=1} +: ${DIALOG_HELP=2} +: ${DIALOG_EXTRA=3} +: ${DIALOG_ITEM_HELP=4} +: ${DIALOG_ESC=255} + +INTERFACE=$1 +IFCONFIG_PREFIX="$2" +case "${INTERFACE}" in +"") dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \ + --msgbox 'No interface specified for IPv4 configuration.' 0 0 + exit 1 + ;; +esac + +dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0 +if [ $? -eq $DIALOG_OK ]; then + echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/rc.conf.net + + if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then + dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0 + dhclient $INTERFACE 2>> $BSDINSTALL_LOG + if [ $? -ne 0 ]; then + dialog --backtitle 'FreeBSD Installer' --msgbox "DHCP lease acquisition failed." 0 0 + exec $0 ${INTERFACE} "${IFCONFIG_PREFIX}" + fi + fi + exit 0 +fi + +IP_ADDRESS=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $2); }'` +NETMASK=`ifconfig $INTERFACE inet | awk '/inet/ {printf("%s\n", $4); }'` +ROUTER=`netstat -rn -f inet | awk '/default/ {printf("%s\n", $2);}'` + +exec 3>&1 +IF_CONFIG=$(dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --form 'Static Network Interface Configuration' 0 0 0 \ + 'IP Address' 1 0 "$IP_ADDRESS" 1 20 16 0 \ + 'Subnet Mask' 2 0 "$NETMASK" 2 20 16 0 \ + 'Default Router' 3 0 "$ROUTER" 3 20 16 0 \ +2>&1 1>&3) +if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi +exec 3>&- + +echo $INTERFACE $IF_CONFIG | + awk -v prefix="$IFCONFIG_PREFIX" '{ + printf("ifconfig_%s=\"%s inet %s netmask %s\"\n", $1, prefix, $2, $3); + printf("defaultrouter=\"%s\"\n", $4); + }' >> $BSDINSTALL_TMPETC/rc.conf.net + +if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then + . $BSDINSTALL_TMPETC/rc.conf.net + ifconfig $INTERFACE inet `eval echo \\\$ifconfig_$INTERFACE` + route delete -inet default + route add -inet default $defaultrouter +fi + Added: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Sun May 29 21:24:20 2011 (r222468) @@ -0,0 +1,149 @@ +#!/bin/sh +#- +# Copyright (c) 2011 Nathan Whitehorn +# All rights reserved. +# Copyright (c) 2011 The FreeBSD Foundation +# All rights reserved. +# +# Portions of this software were developed by Bjoern Zeeb +# under sponsorship from the FreeBSD Foundation. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +# +# TODO: +# - Add -R /sbin/resolvconf to rtsol once support is in tree. +# - Add DHCPv6 support once FreeBSD ships with it. +# + +: ${DIALOG_OK=0} +: ${DIALOG_CANCEL=1} +: ${DIALOG_HELP=2} +: ${DIALOG_EXTRA=3} +: ${DIALOG_ITEM_HELP=4} +: ${DIALOG_ESC=255} + +INTERFACE=$1 +case "${INTERFACE}" in +"") dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \ + --msgbox 'No interface specified for IPv6 configuration.' 0 0 + exit 1 + ;; +esac + +AGAIN="" +while : ; do + MSG="Would you like to try stateless address autoconfiguration (SLAAC)${AGAIN}?" + dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \ + --yesno "${MSG}" 0 0 + if [ $? -eq $DIALOG_OK ]; then + if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then + dialog --backtitle 'FreeBSD Installer' \ + --infobox "Sending Router Solicitation ..." 0 0 + ifconfig ${INTERFACE} inet6 accept_rtadv up + rtsol -F $INTERFACE 2>> $BSDINSTALL_LOG + if [ $? -ne 0 ]; then + dialog --backtitle 'FreeBSD Installer' --msgbox "SLAAC failed." 0 0 + AGAIN=" again" + continue + fi + fi + echo ifconfig_${INTERFACE}_ipv6=\"accept_rtadv\" >> $BSDINSTALL_TMPETC/rc.conf.net + exit 0 + else + break + fi +done + +ROUTER6=`netstat -Wrn -f inet6 | awk '/default/ {printf("%s\n", $2);}'` +ADDRS=`ifconfig ${INTERFACE} inet6 | \ +awk -v dfr="${ROUTER6}" ' +BEGIN { + n=0; +} +{ + if (/inet6/) { + if (match($2, "^fe80:")) { next; }; + # For the moment ignore all but the first address; it might confuse the user. + if (n > 0) { next; }; + n++; + printf "\"IPv6 Address\" %d 0 \"%s/%s\" %d 16 50 0 0 ", n, $2, $4, n; + } +} +END { + if (n == 0) { + n++; + printf "\"IPv6 Address\" %d 0 \"\" %d 16 50 0 0 ", n, n; + } + n++; + # Nasty trick adding a (hidden, same y) read-only field as a marker + # to separate interface address(es) from the default router. + printf "\"Default Router\" %d 0 \"%s\" %d 16 50 0 2 ", n, "DefaultRouter", n; + printf "\"Default Router\" %d 0 \"%s\" %d 16 50 0 0 ", n, dfr, n; +}'` + +exec 3>&1 +IF_CONFIG=$(echo ${ADDRS} | xargs dialog --backtitle 'FreeBSD Installer' \ + --title 'Network Configuration' \ + --mixedform 'Static IPv6 Network Interface Configuration' 0 0 0 \ +2>&1 1>&3) +if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi +exec 3>&- + +echo ${IF_CONFIG} | tr ' ' '\n' | \ +awk -v iface="${INTERFACE}" ' +BEGIN { + dfr=0; + count=0; +} +{ + if (/^[[:space:]]+$/) { + next; + } + if (/DefaultRouter/) { + dfr=1; + next; + } + if (dfr == 1) { + printf("ipv6_defaultrouter=\"%s\"\n", $1); + next; + } + if (count > 0) { + # Ignore all but the first IP address for now. + next; + } + count++; + if (!match($1, "/")) { + sub("$", "/64", $1); + } + printf("ifconfig_%s_ipv6=\"inet6 %s\"\n", iface, $1); +}' >> $BSDINSTALL_TMPETC/rc.conf.net + +if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then + . $BSDINSTALL_TMPETC/rc.conf.net + ifconfig ${INTERFACE} `eval echo \\\$ifconfig_${INTERFACE}_ipv6` + route delete default + route add default ${ipv6_defaultrouter} +fi + From owner-svn-src-head@FreeBSD.ORG Sun May 29 22:37:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23749106566C; Sun, 29 May 2011 22:37:24 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13AEF8FC14; Sun, 29 May 2011 22:37:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4TMbNGX049482; Sun, 29 May 2011 22:37:23 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4TMbNRT049480; Sun, 29 May 2011 22:37:23 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105292237.p4TMbNRT049480@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 May 2011 22:37:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222469 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 22:37:24 -0000 Author: nwhitehorn Date: Sun May 29 22:37:23 2011 New Revision: 222469 URL: http://svn.freebsd.org/changeset/base/222469 Log: Use kproc_exit() instead of returning from the management function on systems with no manageable thermal control devices. Modified: head/sys/powerpc/powermac/powermac_thermal.c Modified: head/sys/powerpc/powermac/powermac_thermal.c ============================================================================== --- head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 21:24:20 2011 (r222468) +++ head/sys/powerpc/powermac/powermac_thermal.c Sun May 29 22:37:23 2011 (r222469) @@ -79,7 +79,7 @@ fan_management_proc(void) { /* Nothing to manage? */ if (SLIST_EMPTY(&fans)) - return; + kproc_exit(0); while (1) { pmac_therm_manage_fans(); From owner-svn-src-head@FreeBSD.ORG Sun May 29 23:24:57 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D36AD1065672; Sun, 29 May 2011 23:24:57 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from mail.soaustin.net (pancho.soaustin.net [76.74.250.40]) by mx1.freebsd.org (Postfix) with ESMTP id B4F2D8FC14; Sun, 29 May 2011 23:24:57 +0000 (UTC) Received: by mail.soaustin.net (Postfix, from userid 502) id 071DB56205; Sun, 29 May 2011 18:24:57 -0500 (CDT) Date: Sun, 29 May 2011 18:24:56 -0500 From: Mark Linimon To: Nathan Whitehorn Message-ID: <20110529232456.GA7446@lonesome.com> References: <201105292046.p4TKksdv045882@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201105292046.p4TKksdv045882@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222463 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2011 23:24:57 -0000 On Sun, May 29, 2011 at 08:46:54PM +0000, Nathan Whitehorn wrote: > Add some error handling here: if a sensor returns an error code (a negative > Kelvin temperature, which is impossible except for some contrived magnetic > spin systems), use the previous measurement from that sensor instead of > corrupting everything and randomly changing the fans or shutting off the > machine. I believe this wins "commit message of the month". mcl From owner-svn-src-head@FreeBSD.ORG Mon May 30 04:23:34 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 876F91065670; Mon, 30 May 2011 04:23:34 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DD1D8FC14; Mon, 30 May 2011 04:23: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 p4U4NYM3059892; Mon, 30 May 2011 04:23:34 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U4NYYq059888; Mon, 30 May 2011 04:23:34 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <201105300423.p4U4NYYq059888@svn.freebsd.org> From: Julian Elischer Date: Mon, 30 May 2011 04:23:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222472 - in head/sys/boot: ia64/common powerpc/ps3 sparc64/loader X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 04:23:34 -0000 Author: julian Date: Mon May 30 04:23:33 2011 New Revision: 222472 URL: http://svn.freebsd.org/changeset/base/222472 Log: Include forgotten framework changes to get some of the new menu files installed correctly on non x86/amd systems. pointy-hut to devin Modified: head/sys/boot/ia64/common/Makefile head/sys/boot/powerpc/ps3/Makefile head/sys/boot/sparc64/loader/Makefile Modified: head/sys/boot/ia64/common/Makefile ============================================================================== --- head/sys/boot/ia64/common/Makefile Mon May 30 02:41:04 2011 (r222471) +++ head/sys/boot/ia64/common/Makefile Mon May 30 04:23:33 2011 (r222472) @@ -33,6 +33,7 @@ loader.help: help.common .PATH: ${.CURDIR}/../../forth FILES+= loader.4th support.4th loader.conf +FILES+= screen.4th frames.4th FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th .if !exists(${DESTDIR}/boot/loader.rc) Modified: head/sys/boot/powerpc/ps3/Makefile ============================================================================== --- head/sys/boot/powerpc/ps3/Makefile Mon May 30 02:41:04 2011 (r222471) +++ head/sys/boot/powerpc/ps3/Makefile Mon May 30 04:23:33 2011 (r222472) @@ -113,8 +113,9 @@ loader.help: help.common help.ps3 .PATH: ${.CURDIR}/../../forth FILES= loader.help loader.4th support.4th loader.conf +FILES+= screen.4th frames.4th FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th -FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th +FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th FILESDIR_loader.conf= /boot/defaults .if !exists(${DESTDIR}/boot/loader.rc) Modified: head/sys/boot/sparc64/loader/Makefile ============================================================================== --- head/sys/boot/sparc64/loader/Makefile Mon May 30 02:41:04 2011 (r222471) +++ head/sys/boot/sparc64/loader/Makefile Mon May 30 04:23:33 2011 (r222472) @@ -84,8 +84,9 @@ loader.help: help.common help.sparc64 .PATH: ${.CURDIR}/../../forth FILES= loader.help loader.4th support.4th loader.conf +FILES+= screen.4th frames.4th FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th -FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th +FILES+= menu.4th menu-commands.4th shortcuts.4th version.4th FILESDIR_loader.conf= /boot/defaults .if !exists(${DESTDIR}/boot/loader.rc) From owner-svn-src-head@FreeBSD.ORG Mon May 30 05:37:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C47CB106564A; Mon, 30 May 2011 05:37:26 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAE578FC12; Mon, 30 May 2011 05:37: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 p4U5bQ00062108; Mon, 30 May 2011 05:37:26 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U5bQJA062103; Mon, 30 May 2011 05:37:26 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105300537.p4U5bQJA062103@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 30 May 2011 05:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222473 - in head: sbin/ipfw sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 05:37:27 -0000 Author: ae Date: Mon May 30 05:37:26 2011 New Revision: 222473 URL: http://svn.freebsd.org/changeset/base/222473 Log: Add tablearg support for ipfw setfib. PR: kern/156410 MFC after: 2 weeks Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_sockopt.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Mon May 30 04:23:33 2011 (r222472) +++ head/sbin/ipfw/ipfw.8 Mon May 30 05:37:26 2011 (r222473) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 27, 2010 +.Dd May 30, 2011 .Dt IPFW 8 .Os .Sh NAME @@ -871,13 +871,16 @@ for more information on and .Cm ngtee actions. -.It Cm setfib Ar fibnum +.It Cm setfib Ar fibnum | tablearg The packet is tagged so as to use the FIB (routing table) .Ar fibnum in any subsequent forwarding decisions. Initially this is limited to the values 0 through 15, see .Xr setfib 1 . Processing continues at the next rule. +It is possible to use the +.Cm tablearg +keyword with a setfib. If tablearg value is not within compiled FIB range packet fib is set to 0. .It Cm reass Queue and reassemble ip fragments. If the packet is not fragmented, counters are updated and processing continues with the next rule. @@ -1711,7 +1714,7 @@ is used. The .Cm tablearg argument can be used with the following actions: -.Cm nat, pipe , queue, divert, tee, netgraph, ngtee, fwd, skipto +.Cm nat, pipe , queue, divert, tee, netgraph, ngtee, fwd, skipto, setfib, action parameters: .Cm tag, untag, rule options: Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon May 30 04:23:33 2011 (r222472) +++ head/sbin/ipfw/ipfw2.c Mon May 30 05:37:26 2011 (r222473) @@ -2835,14 +2835,19 @@ chkarg: size_t intsize = sizeof(int); action->opcode = O_SETFIB; - NEED1("missing fib number"); - action->arg1 = strtoul(*av, NULL, 10); - if (sysctlbyname("net.fibs", &numfibs, &intsize, NULL, 0) == -1) - errx(EX_DATAERR, "fibs not suported.\n"); - if (action->arg1 >= numfibs) /* Temporary */ - errx(EX_DATAERR, "fib too large.\n"); - av++; - break; + NEED1("missing fib number"); + if (_substrcmp(*av, "tablearg") == 0) { + action->arg1 = IP_FW_TABLEARG; + } else { + action->arg1 = strtoul(*av, NULL, 10); + if (sysctlbyname("net.fibs", &numfibs, &intsize, + NULL, 0) == -1) + errx(EX_DATAERR, "fibs not suported.\n"); + if (action->arg1 >= numfibs) /* Temporary */ + errx(EX_DATAERR, "fib too large.\n"); + } + av++; + break; } case TOK_REASS: Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Mon May 30 04:23:33 2011 (r222472) +++ head/sys/netinet/ipfw/ip_fw2.c Mon May 30 05:37:26 2011 (r222473) @@ -2137,14 +2137,21 @@ do { \ done = 1; /* exit outer loop */ break; - case O_SETFIB: + case O_SETFIB: { + uint32_t fib; + f->pcnt++; /* update stats */ f->bcnt += pktlen; f->timestamp = time_uptime; - M_SETFIB(m, cmd->arg1); - args->f_id.fib = cmd->arg1; + fib = (cmd->arg1 == IP_FW_TABLEARG) ? tablearg: + cmd->arg1; + if (fib >= rt_numfibs) + fib = 0; + M_SETFIB(m, fib); + args->f_id.fib = fib; l = 0; /* exit inner loop */ break; + } case O_NAT: if (!IPFW_NAT_LOADED) { Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_sockopt.c Mon May 30 04:23:33 2011 (r222472) +++ head/sys/netinet/ipfw/ip_fw_sockopt.c Mon May 30 05:37:26 2011 (r222473) @@ -606,7 +606,7 @@ check_ipfw_struct(struct ip_fw *rule, in case O_SETFIB: if (cmdlen != F_INSN_SIZE(ipfw_insn)) goto bad_size; - if (cmd->arg1 >= rt_numfibs) { + if ((cmd->arg1 != IP_FW_TABLEARG) && (cmd->arg1 >= rt_numfibs)) { printf("ipfw: invalid fib number %d\n", cmd->arg1); return EINVAL; From owner-svn-src-head@FreeBSD.ORG Mon May 30 05:53:01 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C68E1065672; Mon, 30 May 2011 05:53:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D47438FC14; Mon, 30 May 2011 05:53:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U5r0Tj062595; Mon, 30 May 2011 05:53:00 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U5r0SE062593; Mon, 30 May 2011 05:53:00 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105300553.p4U5r0SE062593@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 30 May 2011 05:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222474 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 05:53:01 -0000 Author: ae Date: Mon May 30 05:53:00 2011 New Revision: 222474 URL: http://svn.freebsd.org/changeset/base/222474 Log: Wrap long line. MFC after: 2 weeks Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_sockopt.c Mon May 30 05:37:26 2011 (r222473) +++ head/sys/netinet/ipfw/ip_fw_sockopt.c Mon May 30 05:53:00 2011 (r222474) @@ -606,7 +606,8 @@ check_ipfw_struct(struct ip_fw *rule, in case O_SETFIB: if (cmdlen != F_INSN_SIZE(ipfw_insn)) goto bad_size; - if ((cmd->arg1 != IP_FW_TABLEARG) && (cmd->arg1 >= rt_numfibs)) { + if ((cmd->arg1 != IP_FW_TABLEARG) && + (cmd->arg1 >= rt_numfibs)) { printf("ipfw: invalid fib number %d\n", cmd->arg1); return EINVAL; From owner-svn-src-head@FreeBSD.ORG Mon May 30 06:23:51 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D02E11065672; Mon, 30 May 2011 06:23:51 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B61818FC19; Mon, 30 May 2011 06:23: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 p4U6Npmq063537; Mon, 30 May 2011 06:23:51 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U6NpAp063533; Mon, 30 May 2011 06:23:51 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201105300623.p4U6NpAp063533@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 30 May 2011 06:23:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222475 - in head/sys/dev: mmc sdhci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 06:23:51 -0000 Author: jchandra Date: Mon May 30 06:23:51 2011 New Revision: 222475 URL: http://svn.freebsd.org/changeset/base/222475 Log: Fix read_ivar implementation for MMC and SD. 1. Both mmc_read_ivar() and sdhci_read_ivar() use the expression '*(int *)result = val' to assign to result which is uintptr_t *. This does not work on big-endian 64 bit systems. 2. The media_size ivar is declared as 'off_t' which does not fit into uintptr_t in 32bit systems, change this to long. Submitted by: kanthms at netlogicmicro com (initial version) Modified: head/sys/dev/mmc/mmc.c head/sys/dev/mmc/mmcvar.h head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Mon May 30 05:53:00 2011 (r222474) +++ head/sys/dev/mmc/mmc.c Mon May 30 06:23:51 2011 (r222475) @@ -1445,37 +1445,37 @@ mmc_read_ivar(device_t bus, device_t chi default: return (EINVAL); case MMC_IVAR_DSR_IMP: - *(int *)result = ivar->csd.dsr_imp; + *result = ivar->csd.dsr_imp; break; case MMC_IVAR_MEDIA_SIZE: - *(off_t *)result = ivar->sec_count; + *result = ivar->sec_count; break; case MMC_IVAR_RCA: - *(int *)result = ivar->rca; + *result = ivar->rca; break; case MMC_IVAR_SECTOR_SIZE: - *(int *)result = MMC_SECTOR_SIZE; + *result = MMC_SECTOR_SIZE; break; case MMC_IVAR_TRAN_SPEED: - *(int *)result = mmcbr_get_clock(bus); + *result = mmcbr_get_clock(bus); break; case MMC_IVAR_READ_ONLY: - *(int *)result = ivar->read_only; + *result = ivar->read_only; break; case MMC_IVAR_HIGH_CAP: - *(int *)result = ivar->high_cap; + *result = ivar->high_cap; break; case MMC_IVAR_CARD_TYPE: - *(int *)result = ivar->mode; + *result = ivar->mode; break; case MMC_IVAR_BUS_WIDTH: - *(int *)result = ivar->bus_width; + *result = ivar->bus_width; break; case MMC_IVAR_ERASE_SECTOR: - *(int *)result = ivar->erase_sector; + *result = ivar->erase_sector; break; case MMC_IVAR_MAX_DATA: - *(int *)result = mmcbr_get_max_data(bus); + *result = mmcbr_get_max_data(bus); break; } return (0); Modified: head/sys/dev/mmc/mmcvar.h ============================================================================== --- head/sys/dev/mmc/mmcvar.h Mon May 30 05:53:00 2011 (r222474) +++ head/sys/dev/mmc/mmcvar.h Mon May 30 06:23:51 2011 (r222475) @@ -79,7 +79,7 @@ enum mmc_device_ivars { __BUS_ACCESSOR(mmc, var, MMC, ivar, type) MMC_ACCESSOR(dsr_imp, DSR_IMP, int) -MMC_ACCESSOR(media_size, MEDIA_SIZE, off_t) +MMC_ACCESSOR(media_size, MEDIA_SIZE, long) MMC_ACCESSOR(rca, RCA, int) MMC_ACCESSOR(sector_size, SECTOR_SIZE, int) MMC_ACCESSOR(tran_speed, TRAN_SPEED, int) Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Mon May 30 05:53:00 2011 (r222474) +++ head/sys/dev/sdhci/sdhci.c Mon May 30 06:23:51 2011 (r222475) @@ -1443,46 +1443,46 @@ sdhci_read_ivar(device_t bus, device_t c default: return (EINVAL); case MMCBR_IVAR_BUS_MODE: - *(int *)result = slot->host.ios.bus_mode; + *result = slot->host.ios.bus_mode; break; case MMCBR_IVAR_BUS_WIDTH: - *(int *)result = slot->host.ios.bus_width; + *result = slot->host.ios.bus_width; break; case MMCBR_IVAR_CHIP_SELECT: - *(int *)result = slot->host.ios.chip_select; + *result = slot->host.ios.chip_select; break; case MMCBR_IVAR_CLOCK: - *(int *)result = slot->host.ios.clock; + *result = slot->host.ios.clock; break; case MMCBR_IVAR_F_MIN: - *(int *)result = slot->host.f_min; + *result = slot->host.f_min; break; case MMCBR_IVAR_F_MAX: - *(int *)result = slot->host.f_max; + *result = slot->host.f_max; break; case MMCBR_IVAR_HOST_OCR: - *(int *)result = slot->host.host_ocr; + *result = slot->host.host_ocr; break; case MMCBR_IVAR_MODE: - *(int *)result = slot->host.mode; + *result = slot->host.mode; break; case MMCBR_IVAR_OCR: - *(int *)result = slot->host.ocr; + *result = slot->host.ocr; break; case MMCBR_IVAR_POWER_MODE: - *(int *)result = slot->host.ios.power_mode; + *result = slot->host.ios.power_mode; break; case MMCBR_IVAR_VDD: - *(int *)result = slot->host.ios.vdd; + *result = slot->host.ios.vdd; break; case MMCBR_IVAR_CAPS: - *(int *)result = slot->host.caps; + *result = slot->host.caps; break; case MMCBR_IVAR_TIMING: - *(int *)result = slot->host.ios.timing; + *result = slot->host.ios.timing; break; case MMCBR_IVAR_MAX_DATA: - *(int *)result = 65535; + *result = 65535; break; } return (0); From owner-svn-src-head@FreeBSD.ORG Mon May 30 07:21:35 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86C31106566B; Mon, 30 May 2011 07:21:35 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 30F218FC0A; Mon, 30 May 2011 07:21:34 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 4C02E45EB2; Mon, 30 May 2011 09:21:33 +0200 (CEST) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 9EB7545684; Mon, 30 May 2011 09:21:27 +0200 (CEST) Date: Mon, 30 May 2011 09:20:56 +0200 From: Pawel Jakub Dawidek To: "Bjoern A. Zeeb" Message-ID: <20110530072056.GK2114@garage.freebsd.pl> References: <201105292103.p4TL3egv046536@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2fjX3cMESU3XgGmZ" Content-Disposition: inline In-Reply-To: <201105292103.p4TL3egv046536@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222465 - in head/usr.sbin: jail jls X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 07:21:35 -0000 --2fjX3cMESU3XgGmZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, May 29, 2011 at 09:03:40PM +0000, Bjoern A. Zeeb wrote: > Author: bz > Date: Sun May 29 21:03:40 2011 > New Revision: 222465 > URL: http://svn.freebsd.org/changeset/base/222465 >=20 > Log: > Check for IPv4 or IPv6 to be available by the kernel to not > provoke errors trying to query options not available. > Make it possible to compile out INET or INET6 only parts. That's interesting. When adding IPv6 support to HAST I was thinking about making IPv4/IPv6 support compile options. But after discussing this with various folks I decided to always compile IPv4 and IPv6 support in for userland tools and detect what is supported by the kernel at runtime. This way it is easy to just recompile the kernel to add/remove IPv4/IPv6 support and userland tools may stay unmodified. Do we have some general recommendation within FreeBSD how to handle this in userland? (ie. at compile-time or at run-time) --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --2fjX3cMESU3XgGmZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk3jRVcACgkQForvXbEpPzS4jwCg7gkLPvTXNAyLqk/RtRUIUDyh CkAAn26pAw7SxO3nxPDNFTN4YrjU8kcd =+jfq -----END PGP SIGNATURE----- --2fjX3cMESU3XgGmZ-- From owner-svn-src-head@FreeBSD.ORG Mon May 30 07:52:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 704C6106564A; Mon, 30 May 2011 07:52:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 1F0A58FC0A; Mon, 30 May 2011 07:52:29 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 0A26725D385D; Mon, 30 May 2011 07:52:27 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 3793315A097A; Mon, 30 May 2011 07:52:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id uc4MUdHnCBfR; Mon, 30 May 2011 07:52:26 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id DEC9715A095A; Mon, 30 May 2011 07:52:25 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <20110530072056.GK2114@garage.freebsd.pl> Date: Mon, 30 May 2011 07:52:24 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <1E64D441-B1DD-4535-BA36-BE89DBEF06F2@FreeBSD.org> References: <201105292103.p4TL3egv046536@svn.freebsd.org> <20110530072056.GK2114@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222465 - in head/usr.sbin: jail jls X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 07:52:29 -0000 On May 30, 2011, at 7:20 AM, Pawel Jakub Dawidek wrote: > On Sun, May 29, 2011 at 09:03:40PM +0000, Bjoern A. Zeeb wrote: >> Author: bz >> Date: Sun May 29 21:03:40 2011 >> New Revision: 222465 >> URL: http://svn.freebsd.org/changeset/base/222465 >>=20 >> Log: >> Check for IPv4 or IPv6 to be available by the kernel to not >> provoke errors trying to query options not available. >> Make it possible to compile out INET or INET6 only parts. >=20 > That's interesting. When adding IPv6 support to HAST I was thinking > about making IPv4/IPv6 support compile options. But after discussing > this with various folks I decided to always compile IPv4 and IPv6 > support in for userland tools and detect what is supported by the = kernel > at runtime. This way it is easy to just recompile the kernel to > add/remove IPv4/IPv6 support and userland tools may stay unmodified. >=20 > Do we have some general recommendation within FreeBSD how to handle = this > in userland? (ie. at compile-time or at run-time) The code by default still compiles for dual-stack usage and dynamically detects available address families now avoiding errors. The problem before was that on an IPv6-only kernel you get an error, = which prevents the classic jls command from working: # jls=20 jls: unknown parameter: ip4.addr Now that works, skipping the unavailable option without erroring. The = problem here is historical as jails in the early days had the single one = mandatory IPv4 address, which now no longer is mandatory or might not even be possible = to use.=20 In addition to dynamic detection it allows people to reduce the size of = the binary using src.conf like we have supported for compiling out INET6 for = ages for various user space binaries, just that we can compile out one or the = other now. While possibly less interesting for jail/jls there are still = people building images for very tiny RAM and disk - say very cheap IPv6 only sensor = networks with tens of thousands of nodes and for them every byte might still = matter, Compiling out will also force an address family even on a dual stack = kernel. So having a mix of src.conf options and feature_present(3) gives the = full flexibility for everyone. Bjoern --=20 Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-head@FreeBSD.ORG Mon May 30 08:40:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97C02106566B; Mon, 30 May 2011 08:40:59 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 884E88FC21; Mon, 30 May 2011 08:40: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 p4U8ex3k067952; Mon, 30 May 2011 08:40:59 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U8exFB067950; Mon, 30 May 2011 08:40:59 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105300840.p4U8exFB067950@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 30 May 2011 08:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222482 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:40:59 -0000 Author: bz Date: Mon May 30 08:40:59 2011 New Revision: 222482 URL: http://svn.freebsd.org/changeset/base/222482 Log: While doing it right for current configuration, fix the entry for rc.conf adding the missing mandatory "inet6" keyword. Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Mon May 30 08:05:27 2011 (r222481) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Mon May 30 08:40:59 2011 (r222482) @@ -69,7 +69,7 @@ while : ; do continue fi fi - echo ifconfig_${INTERFACE}_ipv6=\"accept_rtadv\" >> $BSDINSTALL_TMPETC/rc.conf.net + echo ifconfig_${INTERFACE}_ipv6=\"inet6 accept_rtadv\" >> $BSDINSTALL_TMPETC/rc.conf.net exit 0 else break From owner-svn-src-head@FreeBSD.ORG Mon May 30 08:54:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AD30106566B; Mon, 30 May 2011 08:54:33 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AF3F8FC0A; Mon, 30 May 2011 08:54: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 p4U8sW7w068375; Mon, 30 May 2011 08:54:32 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U8sWPW068373; Mon, 30 May 2011 08:54:32 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201105300854.p4U8sWPW068373@svn.freebsd.org> From: Robert Watson Date: Mon, 30 May 2011 08:54:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222483 - head/tools/regression/netinet/tcpconnect X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:54:33 -0000 Author: rwatson Date: Mon May 30 08:54:32 2011 New Revision: 222483 URL: http://svn.freebsd.org/changeset/base/222483 Log: Add missing #include of err.h. MFC after: 3 days Sponsored by: Juniper Networks, Inc. Modified: head/tools/regression/netinet/tcpconnect/tcpconnect.c Modified: head/tools/regression/netinet/tcpconnect/tcpconnect.c ============================================================================== --- head/tools/regression/netinet/tcpconnect/tcpconnect.c Mon May 30 08:40:59 2011 (r222482) +++ head/tools/regression/netinet/tcpconnect/tcpconnect.c Mon May 30 08:54:32 2011 (r222483) @@ -34,6 +34,7 @@ #include +#include #include #include #include From owner-svn-src-head@FreeBSD.ORG Mon May 30 08:54:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 538031065670; Mon, 30 May 2011 08:54:33 +0000 (UTC) Date: Mon, 30 May 2011 08:54:33 +0000 From: Alexey Dokuchaev To: Julian Elischer Message-ID: <20110530085433.GA13988@FreeBSD.org> References: <201105280850.p4S8odjf076440@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201105280850.p4S8odjf076440@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222417 - in head/sys/boot: common forth i386/loader ia64/common pc98/loader powerpc/ofw powerpc/ps3 sparc64/loader X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 08:54:33 -0000 On Sat, May 28, 2011 at 08:50:39AM +0000, Julian Elischer wrote: > Author: julian > Date: Sat May 28 08:50:38 2011 > New Revision: 222417 > URL: http://svn.freebsd.org/changeset/base/222417 > > Log: > New boot loader menus from Devin Teske. > Discussed on hackers and recommended for inclusion into 9.0 at the > devsummit. What about that sexy loader by olli@ [1]? I thought it was also destined for 9.x? Or these two works do not interfere? I've been using it for quite a while, seems pretty stable to me. ./danfe [1] http://wiki.freebsd.org/OliverFromme/BootLoader From owner-svn-src-head@FreeBSD.ORG Mon May 30 09:04:36 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90907106564A; Mon, 30 May 2011 09:04:36 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 482C88FC12; Mon, 30 May 2011 09:04:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U94aV6068732; Mon, 30 May 2011 09:04:36 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U94aOF068730; Mon, 30 May 2011 09:04:36 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201105300904.p4U94aOF068730@svn.freebsd.org> From: Robert Watson Date: Mon, 30 May 2011 09:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222484 - head/tools/regression/netinet/tcpdrop X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 09:04:36 -0000 Author: rwatson Date: Mon May 30 09:04:35 2011 New Revision: 222484 URL: http://svn.freebsd.org/changeset/base/222484 Log: In the tcpdrop regression test, allow the kernel to allocate us a port rather than using a fixed port number. This means that the regression test can be run many times in a row without waiting on TIMEWAIT to release a hard-coded port number. MFC after: 3 days Sponsored by: Juniper Networks, Inc. Modified: head/tools/regression/netinet/tcpdrop/tcpdrop.c Modified: head/tools/regression/netinet/tcpdrop/tcpdrop.c ============================================================================== --- head/tools/regression/netinet/tcpdrop/tcpdrop.c Mon May 30 08:54:32 2011 (r222483) +++ head/tools/regression/netinet/tcpdrop/tcpdrop.c Mon May 30 09:04:35 2011 (r222484) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2006 Robert N. M. Watson + * Copyright (c) 2011 Juniper Networks, Inc. * All rights reserved. * + * Portions of this software were developed by Robert N. M. Watson under + * contract to Juniper Networks, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -46,8 +50,6 @@ #include #include -#define TCP_PORT 9001 - static int tcp_drop(struct sockaddr_in *sin_local, struct sockaddr_in *sin_remote) { @@ -66,41 +68,12 @@ tcp_drop(struct sockaddr_in *sin_local, } static void -tcp_server(pid_t partner) +tcp_server(pid_t partner, int listen_fd) { - int error, listen_fd, accept_fd; - struct sockaddr_in sin; + int error, accept_fd; ssize_t len; char ch; - listen_fd = socket(PF_INET, SOCK_STREAM, 0); - if (listen_fd < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: socket"); - } - - bzero(&sin, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_len = sizeof(sin); - sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - sin.sin_port = htons(TCP_PORT); - - if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: bind"); - } - - if (listen(listen_fd, -1) < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: listen"); - } - accept_fd = accept(listen_fd, NULL, NULL); if (accept_fd < 0) { error = errno; @@ -146,7 +119,7 @@ tcp_server(pid_t partner) } static void -tcp_client(pid_t partner) +tcp_client(pid_t partner, u_short port) { struct sockaddr_in sin, sin_local; int error, sock; @@ -168,7 +141,7 @@ tcp_client(pid_t partner) sin.sin_family = AF_INET; sin.sin_len = sizeof(sin); sin.sin_addr.s_addr = ntohl(INADDR_LOOPBACK); - sin.sin_port = htons(TCP_PORT); + sin.sin_port = port; if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) < 0) { error = errno; @@ -230,6 +203,40 @@ int main(int argc, char *argv[]) { pid_t child_pid, parent_pid; + struct sockaddr_in sin; + int listen_fd; + u_short port; + socklen_t len; + + listen_fd = socket(PF_INET, SOCK_STREAM, 0); + if (listen_fd < 0) + err(-1, "socket"); + + /* + * We use the loopback, but let the kernel select a port for the + * server socket. + */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) + err(-1, "bind"); + + if (listen(listen_fd, -1) < 0) + err(-1, "listen"); + + /* + * Query the port so that the client can use it. + */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + if (getsockname(listen_fd, (struct sockaddr *)&sin, &len) < 0) + err(-1, "getsockname"); + port = sin.sin_port; + printf("Using port %d\n", ntohs(port)); if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) err(-1, "signal"); @@ -240,9 +247,9 @@ main(int argc, char *argv[]) err(-1, "fork"); if (child_pid == 0) { child_pid = getpid(); - tcp_server(parent_pid); + tcp_server(parent_pid, listen_fd); } else - tcp_client(child_pid); + tcp_client(child_pid, port); return (0); } From owner-svn-src-head@FreeBSD.ORG Mon May 30 09:06:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D64FF1065673; Mon, 30 May 2011 09:06:24 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C68098FC19; Mon, 30 May 2011 09:06:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U96ONt068823; Mon, 30 May 2011 09:06:24 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U96OZZ068821; Mon, 30 May 2011 09:06:24 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201105300906.p4U96OZZ068821@svn.freebsd.org> From: Robert Watson Date: Mon, 30 May 2011 09:06:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222485 - head/tools/regression/netinet/tcpfullwindowrst X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 09:06:24 -0000 Author: rwatson Date: Mon May 30 09:06:24 2011 New Revision: 222485 URL: http://svn.freebsd.org/changeset/base/222485 Log: Add missing include of stdio.h. MFC after: 3 days Sponsored by: Juniper Networks, Inc. Modified: head/tools/regression/netinet/tcpfullwindowrst/tcpfullwindowrsttest.c Modified: head/tools/regression/netinet/tcpfullwindowrst/tcpfullwindowrsttest.c ============================================================================== --- head/tools/regression/netinet/tcpfullwindowrst/tcpfullwindowrsttest.c Mon May 30 09:04:35 2011 (r222484) +++ head/tools/regression/netinet/tcpfullwindowrst/tcpfullwindowrsttest.c Mon May 30 09:06:24 2011 (r222485) @@ -35,6 +35,7 @@ $FreeBSD$ #include #include #include +#include #include #include From owner-svn-src-head@FreeBSD.ORG Mon May 30 09:34:15 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A46BB106566C; Mon, 30 May 2011 09:34:15 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93CBA8FC14; Mon, 30 May 2011 09:34: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 p4U9YF0R069735; Mon, 30 May 2011 09:34:15 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U9YFbh069733; Mon, 30 May 2011 09:34:15 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201105300934.p4U9YFbh069733@svn.freebsd.org> From: Robert Watson Date: Mon, 30 May 2011 09:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222486 - head/tools/regression/netinet/tcpsocktimewait X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 09:34:15 -0000 Author: rwatson Date: Mon May 30 09:34:15 2011 New Revision: 222486 URL: http://svn.freebsd.org/changeset/base/222486 Log: Rework TIMEWAIT regression test so that kernel-allocated port numbers are used rather than a fixed userspace one, avoiding conflicts between the two test runs. MFC after: 3 days Sponsored by: Juniper Networks, Inc. Modified: head/tools/regression/netinet/tcpsocktimewait/tcpsocktimewait.c Modified: head/tools/regression/netinet/tcpsocktimewait/tcpsocktimewait.c ============================================================================== --- head/tools/regression/netinet/tcpsocktimewait/tcpsocktimewait.c Mon May 30 09:06:24 2011 (r222485) +++ head/tools/regression/netinet/tcpsocktimewait/tcpsocktimewait.c Mon May 30 09:34:15 2011 (r222486) @@ -1,7 +1,11 @@ /*- * Copyright (c) 2006 Robert N. M. Watson + * Copyright (c) 2011 Juniper Networks, Inc. * All rights reserved. * + * Portions of this software were developed by Robert N. M. Watson under + * contract to Juniper Networks, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -41,45 +45,15 @@ #include #include #include +#include #include #include #include -#define TCP_PORT 9001 - static void -tcp_server(pid_t partner) +tcp_server(pid_t partner, int listen_fd) { - int error, listen_fd, accept_fd; - struct sockaddr_in sin; - - listen_fd = socket(PF_INET, SOCK_STREAM, 0); - if (listen_fd < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: socket"); - } - - bzero(&sin, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_len = sizeof(sin); - sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - sin.sin_port = htons(TCP_PORT); - - if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: bind"); - } - - if (listen(listen_fd, -1) < 0) { - error = errno; - (void)kill(partner, SIGTERM); - errno = error; - err(-1, "tcp_server: listen"); - } + int error, accept_fd; accept_fd = accept(listen_fd, NULL, NULL); if (accept_fd < 0) { @@ -93,7 +67,7 @@ tcp_server(pid_t partner) } static void -tcp_client(pid_t partner, int secs) +tcp_client(pid_t partner, u_short port, int secs) { struct sockaddr_in sin; int error, sock; @@ -112,7 +86,7 @@ tcp_client(pid_t partner, int secs) sin.sin_family = AF_INET; sin.sin_len = sizeof(sin); sin.sin_addr.s_addr = ntohl(INADDR_LOOPBACK); - sin.sin_port = htons(TCP_PORT); + sin.sin_port = port; if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) < 0) { error = errno; @@ -135,7 +109,11 @@ tcp_client(pid_t partner, int secs) int main(int argc, char *argv[]) { + struct sockaddr_in sin; pid_t child_pid, parent_pid; + int listen_fd; + socklen_t len; + u_short port; if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) err(-1, "signal"); @@ -144,29 +122,96 @@ main(int argc, char *argv[]) * Run the whole thing twice: once, with a short sleep in the client, * so that we close before time wait runs out, and once with a long * sleep so that the time wait terminates while the socket is open. + * We don't reuse listen sockets between runs. + */ + listen_fd = socket(PF_INET, SOCK_STREAM, 0); + if (listen_fd < 0) + err(-1, "socket"); + + /* + * We use the loopback, but let the kernel select a port for the + * server socket. + */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) + err(-1, "bind"); + + if (listen(listen_fd, -1) < 0) + err(-1, "listen"); + + /* + * Query the port so that the client can use it. */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + len = sizeof(sin); + if (getsockname(listen_fd, (struct sockaddr *)&sin, &len) < 0) + err(-1, "getsockname"); + port = sin.sin_port; + printf("Using port %d\n", ntohs(port)); + parent_pid = getpid(); child_pid = fork(); if (child_pid < 0) err(-1, "fork"); if (child_pid == 0) { child_pid = getpid(); - tcp_server(child_pid); + tcp_server(child_pid, listen_fd); exit(0); } else - tcp_client(parent_pid, 1); + tcp_client(parent_pid, port, 1); (void)kill(child_pid, SIGTERM); + close(listen_fd); sleep(5); + /* + * Start again, this time long sleep. + */ + listen_fd = socket(PF_INET, SOCK_STREAM, 0); + if (listen_fd < 0) + err(-1, "socket"); + + /* + * We use the loopback, but let the kernel select a port for the + * server socket. + */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) + err(-1, "bind"); + + if (listen(listen_fd, -1) < 0) + err(-1, "listen"); + + /* + * Query the port so that the client can use it. + */ + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + len = sizeof(sin); + if (getsockname(listen_fd, (struct sockaddr *)&sin, &len) < 0) + err(-1, "getsockname"); + port = sin.sin_port; + printf("Using port %d\n", ntohs(port)); + parent_pid = getpid(); child_pid = fork(); if (child_pid < 0) err(-1, "fork"); if (child_pid == 0) { child_pid = getpid(); - tcp_server(parent_pid); + tcp_server(parent_pid, listen_fd); } else - tcp_client(child_pid, 800); + tcp_client(child_pid, port, 800); return (0); } From owner-svn-src-head@FreeBSD.ORG Mon May 30 09:41:39 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F282106566B; Mon, 30 May 2011 09:41:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FADA8FC13; Mon, 30 May 2011 09:41:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U9fd58069988; Mon, 30 May 2011 09:41:39 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U9fdbL069986; Mon, 30 May 2011 09:41:39 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105300941.p4U9fdbL069986@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 30 May 2011 09:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222487 - head/tools/regression/netinet/udpconnectjail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 09:41:39 -0000 Author: bz Date: Mon May 30 09:41:38 2011 New Revision: 222487 URL: http://svn.freebsd.org/changeset/base/222487 Log: Upgrade jail(2) to latest jail(2) API to make the regression test work again. Eventually should switch to jail_set(2). Reported by: rwatson MFC after: 10 days Modified: head/tools/regression/netinet/udpconnectjail/udpconnectjail.c Modified: head/tools/regression/netinet/udpconnectjail/udpconnectjail.c ============================================================================== --- head/tools/regression/netinet/udpconnectjail/udpconnectjail.c Mon May 30 09:34:15 2011 (r222486) +++ head/tools/regression/netinet/udpconnectjail/udpconnectjail.c Mon May 30 09:41:38 2011 (r222487) @@ -77,6 +77,7 @@ main(int argc, __unused char *argv[]) { struct sockaddr_in sin; struct jail thejail; + struct in_addr ia4; if (argc != 1) usage(); @@ -94,12 +95,18 @@ main(int argc, __unused char *argv[]) /* * Now re-run in a jail. + * XXX-BZ should switch to jail_set(2). */ + ia4.s_addr = htonl(INADDR_LOOPBACK); + bzero(&thejail, sizeof(thejail)); - thejail.version = 0; + thejail.version = JAIL_API_VERSION; thejail.path = "/"; thejail.hostname = "jail"; - thejail.ip_number = INADDR_LOOPBACK; + thejail.jailname = "udpconnectjail"; + thejail.ip4s = 1; + thejail.ip4 = &ia4; + if (jail(&thejail) < 0) errx(-1, "jail: %s", strerror(errno)); test("in jail", &sin); From owner-svn-src-head@FreeBSD.ORG Mon May 30 09:43:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CD51106566B; Mon, 30 May 2011 09:43:56 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B2BC8FC08; Mon, 30 May 2011 09:43:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4U9hu2q070106; Mon, 30 May 2011 09:43:56 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4U9htjI070096; Mon, 30 May 2011 09:43:55 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201105300943.p4U9htjI070096@svn.freebsd.org> From: Robert Watson Date: Mon, 30 May 2011 09:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222488 - in head/sys: contrib/pf/net netinet netinet/ipfw netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 09:43:56 -0000 Author: rwatson Date: Mon May 30 09:43:55 2011 New Revision: 222488 URL: http://svn.freebsd.org/changeset/base/222488 Log: Decompose the current single inpcbinfo lock into two locks: - The existing ipi_lock continues to protect the global inpcb list and inpcb counter. This lock is now relegated to a small number of allocation and free operations, and occasional operations that walk all connections (including, awkwardly, certain UDP multicast receive operations -- something to revisit). - A new ipi_hash_lock protects the two inpcbinfo hash tables for looking up connections and bound sockets, manipulated using new INP_HASH_*() macros. This lock, combined with inpcb locks, protects the 4-tuple address space. Unlike the current ipi_lock, ipi_hash_lock follows the individual inpcb connection locks, so may be acquired while manipulating a connection on which a lock is already held, avoiding the need to acquire the inpcbinfo lock preemptively when a binding change might later be required. As a result, however, lookup operations necessarily go through a reference acquire while holding the lookup lock, later acquiring an inpcb lock -- if required. A new function in_pcblookup() looks up connections, and accepts flags indicating how to return the inpcb. Due to lock order changes, callers no longer need acquire locks before performing a lookup: the lookup routine will acquire the ipi_hash_lock as needed. In the future, it will also be able to use alternative lookup and locking strategies transparently to callers, such as pcbgroup lookup. New lookup flags are, supplementing the existing INPLOOKUP_WILDCARD flag: INPLOOKUP_RLOCKPCB - Acquire a read lock on the returned inpcb INPLOOKUP_WLOCKPCB - Acquire a write lock on the returned inpcb Callers must pass exactly one of these flags (for the time being). Some notes: - All protocols are updated to work within the new regime; especially, TCP, UDPv4, and UDPv6. pcbinfo ipi_lock acquisitions are largely eliminated, and global hash lock hold times are dramatically reduced compared to previous locking. - The TCP syncache still relies on the pcbinfo lock, something that we may want to revisit. - Support for reverting to the FreeBSD 7.x locking strategy in TCP input is no longer available -- hash lookup locks are now held only very briefly during inpcb lookup, rather than for potentially extended periods. However, the pcbinfo ipi_lock will still be acquired if a connection state might change such that a connection is added or removed. - Raw IP sockets continue to use the pcbinfo ipi_lock for protection, due to maintaining their own hash tables. - The interface in6_pcblookup_hash_locked() is maintained, which allows callers to acquire hash locks and perform one or more lookups atomically with 4-tuple allocation: this is required only for TCPv6, as there is no in6_pcbconnect_setup(), which there should be. - UDPv6 locking remains significantly more conservative than UDPv4 locking, which relates to source address selection. This needs attention, as it likely significantly reduces parallelism in this code for multithreaded socket use (such as in BIND). - In the UDPv4 and UDPv6 multicast cases, we need to revisit locking somewhat, as they relied on ipi_lock to stablise 4-tuple matches, which is no longer sufficient. A second check once the inpcb lock is held should do the trick, keeping the general case from requiring the inpcb lock for every inpcb visited. - This work reminds us that we need to revisit locking of the v4/v6 flags, which may be accessed lock-free both before and after this change. - Right now, a single lock name is used for the pcbhash lock -- this is undesirable, and probably another argument is required to take care of this (or a char array name field in the pcbinfo?). This is not an MFC candidate for 8.x due to its impact on lookup and locking semantics. It's possible some of these issues could be worked around with compatibility wrappers, if necessary. Reviewed by: bz Sponsored by: Juniper Networks, Inc. Modified: head/sys/contrib/pf/net/pf.c head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h head/sys/netinet/ip_divert.c head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/raw_ip.c head/sys/netinet/siftr.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_pcb.h head/sys/netinet6/in6_src.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/contrib/pf/net/pf.c Mon May 30 09:43:55 2011 (r222488) @@ -3034,16 +3034,14 @@ pf_socket_lookup(int direction, struct p #ifdef INET case AF_INET: #ifdef __FreeBSD__ - INP_INFO_RLOCK(pi); /* XXX LOR */ - inp = in_pcblookup_hash(pi, saddr->v4, sport, daddr->v4, - dport, 0, NULL); + inp = in_pcblookup(pi, saddr->v4, sport, daddr->v4, + dport, INPLOOKUP_RLOCKPCB, NULL); if (inp == NULL) { - inp = in_pcblookup_hash(pi, saddr->v4, sport, - daddr->v4, dport, INPLOOKUP_WILDCARD, NULL); - if(inp == NULL) { - INP_INFO_RUNLOCK(pi); + inp = in_pcblookup(pi, saddr->v4, sport, + daddr->v4, dport, INPLOOKUP_WILDCARD | + INPLOOKUP_RLOCKPCB, NULL); + if (inp == NULL) return (-1); - } } #else inp = in_pcbhashlookup(tb, saddr->v4, sport, daddr->v4, dport); @@ -3058,16 +3056,14 @@ pf_socket_lookup(int direction, struct p #ifdef INET6 case AF_INET6: #ifdef __FreeBSD__ - INP_INFO_RLOCK(pi); - inp = in6_pcblookup_hash(pi, &saddr->v6, sport, - &daddr->v6, dport, 0, NULL); + inp = in6_pcblookup(pi, &saddr->v6, sport, + &daddr->v6, dport, INPLOOKUP_RLOCKPCB, NULL); if (inp == NULL) { - inp = in6_pcblookup_hash(pi, &saddr->v6, sport, - &daddr->v6, dport, INPLOOKUP_WILDCARD, NULL); - if (inp == NULL) { - INP_INFO_RUNLOCK(pi); + inp = in6_pcblookup(pi, &saddr->v6, sport, + &daddr->v6, dport, INPLOOKUP_WILDCARD | + INPLOOKUP_RLOCKPCB, NULL); + if (inp == NULL) return (-1); - } } #else inp = in6_pcbhashlookup(tb, &saddr->v6, sport, &daddr->v6, @@ -3085,9 +3081,10 @@ pf_socket_lookup(int direction, struct p return (-1); } #ifdef __FreeBSD__ + INP_RLOCK_ASSERT(inp); pd->lookup.uid = inp->inp_cred->cr_uid; pd->lookup.gid = inp->inp_cred->cr_groups[0]; - INP_INFO_RUNLOCK(pi); + INP_RUNLOCK(inp); #else pd->lookup.uid = inp->inp_socket->so_euid; pd->lookup.gid = inp->inp_socket->so_egid; Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/in_pcb.c Mon May 30 09:43:55 2011 (r222488) @@ -127,6 +127,10 @@ static VNET_DEFINE(int, ipport_tcplastco #define V_ipport_tcplastcount VNET(ipport_tcplastcount) +static struct inpcb *in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, + struct in_addr faddr, u_int fport_arg, + struct in_addr laddr, u_int lport_arg, + int lookupflags, struct ifnet *ifp); static void in_pcbremlists(struct inpcb *inp); #ifdef INET @@ -212,11 +216,13 @@ in_pcbinfo_init(struct inpcbinfo *pcbinf { INP_INFO_LOCK_INIT(pcbinfo, name); + INP_HASH_LOCK_INIT(pcbinfo, "pcbinfohash"); /* XXXRW: argument? */ #ifdef VIMAGE pcbinfo->ipi_vnet = curvnet; #endif pcbinfo->ipi_listhead = listhead; LIST_INIT(pcbinfo->ipi_listhead); + pcbinfo->ipi_count = 0; pcbinfo->ipi_hashbase = hashinit(hash_nelements, M_PCB, &pcbinfo->ipi_hashmask); pcbinfo->ipi_porthashbase = hashinit(porthash_nelements, M_PCB, @@ -234,10 +240,14 @@ void in_pcbinfo_destroy(struct inpcbinfo *pcbinfo) { + KASSERT(pcbinfo->ipi_count == 0, + ("%s: ipi_count = %u", __func__, pcbinfo->ipi_count)); + hashdestroy(pcbinfo->ipi_hashbase, M_PCB, pcbinfo->ipi_hashmask); hashdestroy(pcbinfo->ipi_porthashbase, M_PCB, pcbinfo->ipi_porthashmask); uma_zdestroy(pcbinfo->ipi_zone); + INP_HASH_LOCK_DESTROY(pcbinfo); INP_INFO_LOCK_DESTROY(pcbinfo); } @@ -309,8 +319,8 @@ in_pcbbind(struct inpcb *inp, struct soc { int anonport, error; - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_WLOCK_ASSERT(inp); + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); if (inp->inp_lport != 0 || inp->inp_laddr.s_addr != INADDR_ANY) return (EINVAL); @@ -351,8 +361,8 @@ in_pcb_lport(struct inpcb *inp, struct i * Because no actual state changes occur here, a global write lock on * the pcbinfo isn't required. */ - INP_INFO_LOCK_ASSERT(pcbinfo); INP_LOCK_ASSERT(inp); + INP_HASH_LOCK_ASSERT(pcbinfo); if (inp->inp_flags & INP_HIGHPORT) { first = V_ipport_hifirstauto; /* sysctl */ @@ -473,11 +483,10 @@ in_pcbbind_setup(struct inpcb *inp, stru int error; /* - * Because no actual state changes occur here, a global write lock on - * the pcbinfo isn't required. + * No state changes, so read locks are sufficient here. */ - INP_INFO_LOCK_ASSERT(pcbinfo); INP_LOCK_ASSERT(inp); + INP_HASH_LOCK_ASSERT(pcbinfo); if (TAILQ_EMPTY(&V_in_ifaddrhead)) /* XXX broken! */ return (EADDRNOTAVAIL); @@ -618,8 +627,8 @@ in_pcbconnect(struct inpcb *inp, struct in_addr_t laddr, faddr; int anonport, error; - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_WLOCK_ASSERT(inp); + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); lport = inp->inp_lport; laddr = inp->inp_laddr.s_addr; @@ -907,8 +916,8 @@ in_pcbconnect_setup(struct inpcb *inp, s * Because a global state change doesn't actually occur here, a read * lock is sufficient. */ - INP_INFO_LOCK_ASSERT(inp->inp_pcbinfo); INP_LOCK_ASSERT(inp); + INP_HASH_LOCK_ASSERT(inp->inp_pcbinfo); if (oinpp != NULL) *oinpp = NULL; @@ -983,8 +992,8 @@ in_pcbconnect_setup(struct inpcb *inp, s if (error) return (error); } - oinp = in_pcblookup_hash(inp->inp_pcbinfo, faddr, fport, laddr, lport, - 0, NULL); + oinp = in_pcblookup_hash_locked(inp->inp_pcbinfo, faddr, fport, + laddr, lport, 0, NULL); if (oinp != NULL) { if (oinpp != NULL) *oinpp = oinp; @@ -1007,8 +1016,8 @@ void in_pcbdisconnect(struct inpcb *inp) { - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_WLOCK_ASSERT(inp); + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); inp->inp_faddr.s_addr = INADDR_ANY; inp->inp_fport = 0; @@ -1187,19 +1196,24 @@ void in_pcbdrop(struct inpcb *inp) { - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_WLOCK_ASSERT(inp); + /* + * XXXRW: Possibly we should protect the setting of INP_DROPPED with + * the hash lock...? + */ inp->inp_flags |= INP_DROPPED; if (inp->inp_flags & INP_INHASHLIST) { struct inpcbport *phd = inp->inp_phd; + INP_HASH_WLOCK(inp->inp_pcbinfo); LIST_REMOVE(inp, inp_hash); LIST_REMOVE(inp, inp_portlist); if (LIST_FIRST(&phd->phd_pcblist) == NULL) { LIST_REMOVE(phd, phd_hash); free(phd, M_PCB); } + INP_HASH_WUNLOCK(inp->inp_pcbinfo); inp->inp_flags &= ~INP_INHASHLIST; } } @@ -1328,7 +1342,8 @@ in_pcbpurgeif0(struct inpcbinfo *pcbinfo } /* - * Lookup a PCB based on the local address and port. + * Lookup a PCB based on the local address and port. Caller must hold the + * hash lock. No inpcb locks or references are acquired. */ #define INP_LOOKUP_MAPPED_PCB_COST 3 struct inpcb * @@ -1346,7 +1361,7 @@ in_pcblookup_local(struct inpcbinfo *pcb KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); - INP_INFO_LOCK_ASSERT(pcbinfo); + INP_HASH_LOCK_ASSERT(pcbinfo); if ((lookupflags & INPLOOKUP_WILDCARD) == 0) { struct inpcbhead *head; @@ -1450,10 +1465,12 @@ in_pcblookup_local(struct inpcbinfo *pcb #undef INP_LOOKUP_MAPPED_PCB_COST /* - * Lookup PCB in hash list. + * Lookup PCB in hash list, using pcbinfo tables. This variation assumes + * that the caller has locked the hash list, and will not perform any further + * locking or reference operations on either the hash list or the connection. */ -struct inpcb * -in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr, +static struct inpcb * +in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport_arg, struct in_addr laddr, u_int lport_arg, int lookupflags, struct ifnet *ifp) { @@ -1464,7 +1481,7 @@ in_pcblookup_hash(struct inpcbinfo *pcbi KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); - INP_INFO_LOCK_ASSERT(pcbinfo); + INP_HASH_LOCK_ASSERT(pcbinfo); /* * First look for an exact match. @@ -1574,6 +1591,56 @@ in_pcblookup_hash(struct inpcbinfo *pcbi return (NULL); } + +/* + * Lookup PCB in hash list, using pcbinfo tables. This variation locks the + * hash list lock, and will return the inpcb locked (i.e., requires + * INPLOOKUP_LOCKPCB). + */ +static struct inpcb * +in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr, + u_int fport, struct in_addr laddr, u_int lport, int lookupflags, + struct ifnet *ifp) +{ + struct inpcb *inp; + + INP_HASH_RLOCK(pcbinfo); + inp = in_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, + (lookupflags & ~(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)), ifp); + if (inp != NULL) { + in_pcbref(inp); + INP_HASH_RUNLOCK(pcbinfo); + if (lookupflags & INPLOOKUP_WLOCKPCB) { + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (NULL); + } else if (lookupflags & INPLOOKUP_RLOCKPCB) { + INP_RLOCK(inp); + if (in_pcbrele_rlocked(inp)) + return (NULL); + } else + panic("%s: locking bug", __func__); + } else + INP_HASH_RUNLOCK(pcbinfo); + return (inp); +} + +/* + * Public inpcb lookup routines, accepting a 4-tuple. + */ +struct inpcb * +in_pcblookup(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport, + struct in_addr laddr, u_int lport, int lookupflags, struct ifnet *ifp) +{ + + KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, + ("%s: invalid lookup flags %d", __func__, lookupflags)); + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, + ("%s: LOCKPCB not set", __func__)); + + return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, + lookupflags, ifp)); +} #endif /* INET */ /* @@ -1588,8 +1655,9 @@ in_pcbinshash(struct inpcb *inp) struct inpcbport *phd; u_int32_t hashkey_faddr; - INP_INFO_WLOCK_ASSERT(pcbinfo); INP_WLOCK_ASSERT(inp); + INP_HASH_WLOCK_ASSERT(pcbinfo); + KASSERT((inp->inp_flags & INP_INHASHLIST) == 0, ("in_pcbinshash: INP_INHASHLIST")); @@ -1645,8 +1713,9 @@ in_pcbrehash(struct inpcb *inp) struct inpcbhead *head; u_int32_t hashkey_faddr; - INP_INFO_WLOCK_ASSERT(pcbinfo); INP_WLOCK_ASSERT(inp); + INP_HASH_WLOCK_ASSERT(pcbinfo); + KASSERT(inp->inp_flags & INP_INHASHLIST, ("in_pcbrehash: !INP_INHASHLIST")); @@ -1679,12 +1748,14 @@ in_pcbremlists(struct inpcb *inp) if (inp->inp_flags & INP_INHASHLIST) { struct inpcbport *phd = inp->inp_phd; + INP_HASH_WLOCK(pcbinfo); LIST_REMOVE(inp, inp_hash); LIST_REMOVE(inp, inp_portlist); if (LIST_FIRST(&phd->phd_pcblist) == NULL) { LIST_REMOVE(phd, phd_hash); free(phd, M_PCB); } + INP_HASH_WUNLOCK(pcbinfo); inp->inp_flags &= ~INP_INHASHLIST; } LIST_REMOVE(inp, inp_list); Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/in_pcb.h Mon May 30 09:43:55 2011 (r222488) @@ -268,22 +268,22 @@ struct inpcbport { * Global data structure for each high-level protocol (UDP, TCP, ...) in both * IPv4 and IPv6. Holds inpcb lists and information for managing them. * - * Each pcbinfo is protected by ipi_lock, covering mutable global fields (such - * as the global pcb list) and hashed lookup tables. The lock order is: + * Each pcbinfo is protected by two locks: ipi_lock and ipi_hash_lock, + * the former covering mutable global fields (such as the global pcb list), + * and the latter covering the hashed lookup tables. The lock order is: * - * ipi_lock (before) inpcb locks + * ipi_lock (before) inpcb locks (before) ipi_hash_lock * * Locking key: * * (c) Constant or nearly constant after initialisation * (g) Locked by ipi_lock - * (h) Read using either ipi_lock or inpcb lock; write requires both. + * (h) Read using either ipi_hash_lock or inpcb lock; write requires both. * (x) Synchronisation properties poorly defined */ struct inpcbinfo { /* - * Global lock protecting global inpcb list, inpcb count, hash tables, - * etc. + * Global lock protecting global inpcb list, inpcb count, etc. */ struct rwlock ipi_lock; @@ -312,17 +312,22 @@ struct inpcbinfo { struct uma_zone *ipi_zone; /* (c) */ /* + * Global lock protecting hash lookup tables. + */ + struct rwlock ipi_hash_lock; + + /* * Global hash of inpcbs, hashed by local and foreign addresses and * port numbers. */ - struct inpcbhead *ipi_hashbase; /* (g) */ - u_long ipi_hashmask; /* (g) */ + struct inpcbhead *ipi_hashbase; /* (h) */ + u_long ipi_hashmask; /* (h) */ /* * Global hash of inpcbs, hashed by only local port number. */ - struct inpcbporthead *ipi_porthashbase; /* (g) */ - u_long ipi_porthashmask; /* (g) */ + struct inpcbporthead *ipi_porthashbase; /* (h) */ + u_long ipi_porthashmask; /* (h) */ /* * Pointer to network stack instance @@ -406,6 +411,18 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_INFO_WLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_lock, RA_WLOCKED) #define INP_INFO_UNLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_lock, RA_UNLOCKED) +#define INP_HASH_LOCK_INIT(ipi, d) \ + rw_init_flags(&(ipi)->ipi_hash_lock, (d), 0) +#define INP_HASH_LOCK_DESTROY(ipi) rw_destroy(&(ipi)->ipi_hash_lock) +#define INP_HASH_RLOCK(ipi) rw_rlock(&(ipi)->ipi_hash_lock) +#define INP_HASH_WLOCK(ipi) rw_wlock(&(ipi)->ipi_hash_lock) +#define INP_HASH_RUNLOCK(ipi) rw_runlock(&(ipi)->ipi_hash_lock) +#define INP_HASH_WUNLOCK(ipi) rw_wunlock(&(ipi)->ipi_hash_lock) +#define INP_HASH_LOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_hash_lock, \ + RA_LOCKED) +#define INP_HASH_WLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_hash_lock, \ + RA_WLOCKED) + #define INP_PCBHASH(faddr, lport, fport, mask) \ (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) #define INP_PCBPORTHASH(lport, mask) \ @@ -466,7 +483,16 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_LLE_VALID 0x00000001 /* cached lle is valid */ #define INP_RT_VALID 0x00000002 /* cached rtentry is valid */ -#define INPLOOKUP_WILDCARD 1 +/* + * Flags passed to in_pcblookup*() functions. + */ +#define INPLOOKUP_WILDCARD 0x00000001 /* Allow wildcard sockets. */ +#define INPLOOKUP_RLOCKPCB 0x00000002 /* Return inpcb read-locked. */ +#define INPLOOKUP_WLOCKPCB 0x00000004 /* Return inpcb write-locked. */ + +#define INPLOOKUP_MASK (INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB | \ + INPLOOKUP_WLOCKPCB) + #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) #define sotoin6pcb(so) sotoinpcb(so) /* for KAME src sync over BSD*'s */ @@ -527,7 +553,7 @@ struct inpcb * in_pcblookup_local(struct inpcbinfo *, struct in_addr, u_short, int, struct ucred *); struct inpcb * - in_pcblookup_hash(struct inpcbinfo *, struct in_addr, u_int, + in_pcblookup(struct inpcbinfo *, struct in_addr, u_int, struct in_addr, u_int, int, struct ifnet *); void in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr, int, struct inpcb *(*)(struct inpcb *, int)); Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/ip_divert.c Mon May 30 09:43:55 2011 (r222488) @@ -659,9 +659,9 @@ div_pcblist(SYSCTL_HANDLER_ARGS) INP_INFO_WLOCK(&V_divcbinfo); for (i = 0; i < n; i++) { inp = inp_list[i]; - INP_WLOCK(inp); - if (!in_pcbrele(inp)) - INP_WUNLOCK(inp); + INP_RLOCK(inp); + if (!in_pcbrele_rlocked(inp)) + INP_RUNLOCK(inp); } INP_INFO_WUNLOCK(&V_divcbinfo); Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/ipfw/ip_fw2.c Mon May 30 09:43:55 2011 (r222488) @@ -657,7 +657,7 @@ check_uidgid(ipfw_insn_u32 *insn, int pr (struct bsd_ucred *)uc, ugid_lookupp, ((struct mbuf *)inp)->m_skb); #else /* FreeBSD */ struct inpcbinfo *pi; - int wildcard; + int lookupflags; struct inpcb *pcb; int match; @@ -682,30 +682,31 @@ check_uidgid(ipfw_insn_u32 *insn, int pr if (*ugid_lookupp == -1) return (0); if (proto == IPPROTO_TCP) { - wildcard = 0; + lookupflags = 0; pi = &V_tcbinfo; } else if (proto == IPPROTO_UDP) { - wildcard = INPLOOKUP_WILDCARD; + lookupflags = INPLOOKUP_WILDCARD; pi = &V_udbinfo; } else return 0; + lookupflags |= INPLOOKUP_RLOCKPCB; match = 0; if (*ugid_lookupp == 0) { - INP_INFO_RLOCK(pi); pcb = (oif) ? - in_pcblookup_hash(pi, + in_pcblookup(pi, dst_ip, htons(dst_port), src_ip, htons(src_port), - wildcard, oif) : - in_pcblookup_hash(pi, + lookupflags, oif) : + in_pcblookup(pi, src_ip, htons(src_port), dst_ip, htons(dst_port), - wildcard, NULL); + lookupflags, NULL); if (pcb != NULL) { + INP_RLOCK_ASSERT(pcb); *uc = crhold(pcb->inp_cred); *ugid_lookupp = 1; + INP_RUNLOCK(pcb); } - INP_INFO_RUNLOCK(pi); if (*ugid_lookupp == 0) { /* * We tried and failed, set the variable to -1 @@ -1827,21 +1828,32 @@ do { \ else break; + /* + * XXXRW: so_user_cookie should almost + * certainly be inp_user_cookie? + */ + /* For incomming packet, lookup up the inpcb using the src/dest ip/port tuple */ if (inp == NULL) { - INP_INFO_RLOCK(pi); - inp = in_pcblookup_hash(pi, + inp = in_pcblookup(pi, src_ip, htons(src_port), dst_ip, htons(dst_port), - 0, NULL); - INP_INFO_RUNLOCK(pi); - } - - if (inp && inp->inp_socket) { - tablearg = inp->inp_socket->so_user_cookie; - if (tablearg) - match = 1; + INPLOOKUP_RLOCKPCB, NULL); + if (inp != NULL) { + tablearg = + inp->inp_socket->so_user_cookie; + if (tablearg) + match = 1; + INP_RUNLOCK(inp); + } + } else { + if (inp->inp_socket) { + tablearg = + inp->inp_socket->so_user_cookie; + if (tablearg) + match = 1; + } } break; } Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/raw_ip.c Mon May 30 09:43:55 2011 (r222488) @@ -226,7 +226,7 @@ rip_append(struct inpcb *last, struct ip { int policyfail = 0; - INP_RLOCK_ASSERT(last); + INP_LOCK_ASSERT(last); #ifdef IPSEC /* check AH/ESP integrity. */ @@ -834,16 +834,19 @@ rip_detach(struct socket *so) static void rip_dodisconnect(struct socket *so, struct inpcb *inp) { + struct inpcbinfo *pcbinfo; - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); - INP_WLOCK_ASSERT(inp); - + pcbinfo = inp->inp_pcbinfo; + INP_INFO_WLOCK(pcbinfo); + INP_WLOCK(inp); rip_delhash(inp); inp->inp_faddr.s_addr = INADDR_ANY; rip_inshash(inp); SOCK_LOCK(so); so->so_state &= ~SS_ISCONNECTED; SOCK_UNLOCK(so); + INP_WUNLOCK(inp); + INP_INFO_WUNLOCK(pcbinfo); } static void @@ -854,11 +857,7 @@ rip_abort(struct socket *so) inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip_abort: inp == NULL")); - INP_INFO_WLOCK(&V_ripcbinfo); - INP_WLOCK(inp); rip_dodisconnect(so, inp); - INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&V_ripcbinfo); } static void @@ -869,11 +868,7 @@ rip_close(struct socket *so) inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip_close: inp == NULL")); - INP_INFO_WLOCK(&V_ripcbinfo); - INP_WLOCK(inp); rip_dodisconnect(so, inp); - INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&V_ripcbinfo); } static int @@ -887,11 +882,7 @@ rip_disconnect(struct socket *so) inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip_disconnect: inp == NULL")); - INP_INFO_WLOCK(&V_ripcbinfo); - INP_WLOCK(inp); rip_dodisconnect(so, inp); - INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&V_ripcbinfo); return (0); } @@ -1077,9 +1068,9 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) INP_INFO_WLOCK(&V_ripcbinfo); for (i = 0; i < n; i++) { inp = inp_list[i]; - INP_WLOCK(inp); - if (!in_pcbrele(inp)) - INP_WUNLOCK(inp); + INP_RLOCK(inp); + if (!in_pcbrele_rlocked(inp)) + INP_RUNLOCK(inp); } INP_INFO_WUNLOCK(&V_ripcbinfo); Modified: head/sys/netinet/siftr.c ============================================================================== --- head/sys/netinet/siftr.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/siftr.c Mon May 30 09:43:55 2011 (r222488) @@ -696,17 +696,16 @@ siftr_findinpcb(int ipver, struct ip *ip /* We need the tcbinfo lock. */ INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); - INP_INFO_RLOCK(&V_tcbinfo); if (dir == PFIL_IN) inp = (ipver == INP_IPV4 ? - in_pcblookup_hash(&V_tcbinfo, ip->ip_src, sport, ip->ip_dst, - dport, 0, m->m_pkthdr.rcvif) + in_pcblookup(&V_tcbinfo, ip->ip_src, sport, ip->ip_dst, + dport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) : #ifdef SIFTR_IPV6 - in6_pcblookup_hash(&V_tcbinfo, + in6_pcblookup(&V_tcbinfo, &((struct ip6_hdr *)ip)->ip6_src, sport, - &((struct ip6_hdr *)ip)->ip6_dst, dport, 0, + &((struct ip6_hdr *)ip)->ip6_dst, dport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) #else NULL @@ -715,13 +714,13 @@ siftr_findinpcb(int ipver, struct ip *ip else inp = (ipver == INP_IPV4 ? - in_pcblookup_hash(&V_tcbinfo, ip->ip_dst, dport, ip->ip_src, - sport, 0, m->m_pkthdr.rcvif) + in_pcblookup(&V_tcbinfo, ip->ip_dst, dport, ip->ip_src, + sport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) : #ifdef SIFTR_IPV6 - in6_pcblookup_hash(&V_tcbinfo, + in6_pcblookup(&V_tcbinfo, &((struct ip6_hdr *)ip)->ip6_dst, dport, - &((struct ip6_hdr *)ip)->ip6_src, sport, 0, + &((struct ip6_hdr *)ip)->ip6_src, sport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) #else NULL @@ -734,12 +733,7 @@ siftr_findinpcb(int ipver, struct ip *ip ss->nskip_in_inpcb++; else ss->nskip_out_inpcb++; - } else { - /* Acquire the inpcb lock. */ - INP_UNLOCK_ASSERT(inp); - INP_RLOCK(inp); } - INP_INFO_RUNLOCK(&V_tcbinfo); return (inp); } Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Mon May 30 09:41:38 2011 (r222487) +++ head/sys/netinet/tcp_input.c Mon May 30 09:43:55 2011 (r222488) @@ -5,6 +5,7 @@ * Swinburne University of Technology, Melbourne, Australia. * Copyright (c) 2009-2010 Lawrence Stewart * Copyright (c) 2010 The FreeBSD Foundation + * Copyright (c) 2010-2011 Juniper Networks, Inc. * All rights reserved. * * Portions of this software were developed at the Centre for Advanced Internet @@ -16,6 +17,9 @@ * Internet Architectures, Swinburne University of Technology, Melbourne, * Australia by David Hayes under sponsorship from the FreeBSD Foundation. * + * Portions of this software were developed by Robert N. M. Watson under + * contract to Juniper Networks, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -197,10 +201,6 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, &VNET_NAME(tcp_autorcvbuf_max), 0, "Max size of automatic receive buffer"); -int tcp_read_locking = 1; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, read_locking, CTLFLAG_RW, - &tcp_read_locking, 0, "Enable read locking strategy"); - VNET_DEFINE(struct inpcbhead, tcb); #define tcb6 tcb /* for KAME src sync over BSD*'s */ VNET_DEFINE(struct inpcbinfo, tcbinfo); @@ -591,8 +591,7 @@ tcp_input(struct mbuf *m, int off0) char *s = NULL; /* address and port logging */ int ti_locked; #define TI_UNLOCKED 1 -#define TI_RLOCKED 2 -#define TI_WLOCKED 3 +#define TI_WLOCKED 2 #ifdef TCPDEBUG /* @@ -756,30 +755,25 @@ tcp_input(struct mbuf *m, int off0) drop_hdrlen = off0 + off; /* - * Locate pcb for segment, which requires a lock on tcbinfo. - * Optimisticaly acquire a global read lock rather than a write lock - * unless header flags necessarily imply a state change. There are - * two cases where we might discover later we need a write lock - * despite the flags: ACKs moving a connection out of the syncache, - * and ACKs for a connection in TIMEWAIT. + * Locate pcb for segment; if we're likely to add or remove a + * connection then first acquire pcbinfo lock. There are two cases + * where we might discover later we need a write lock despite the + * flags: ACKs moving a connection out of the syncache, and ACKs for + * a connection in TIMEWAIT. */ - if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || - tcp_read_locking == 0) { + if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0) { INP_INFO_WLOCK(&V_tcbinfo); ti_locked = TI_WLOCKED; - } else { - INP_INFO_RLOCK(&V_tcbinfo); - ti_locked = TI_RLOCKED; - } + } else + ti_locked = TI_UNLOCKED; findpcb: #ifdef INVARIANTS - if (ti_locked == TI_RLOCKED) - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - else if (ti_locked == TI_WLOCKED) + if (ti_locked == TI_WLOCKED) { INP_INFO_WLOCK_ASSERT(&V_tcbinfo); - else - panic("%s: findpcb ti_locked %d\n", __func__, ti_locked); + } else { + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); + } #endif #ifdef INET @@ -797,20 +791,18 @@ findpcb: * Transparently forwarded. Pretend to be the destination. * already got one like this? */ - inp = in_pcblookup_hash(&V_tcbinfo, - ip->ip_src, th->th_sport, - ip->ip_dst, th->th_dport, - 0, m->m_pkthdr.rcvif); + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, th->th_sport, + ip->ip_dst, th->th_dport, INPLOOKUP_WLOCKPCB, + m->m_pkthdr.rcvif); if (!inp) { - /* It's new. Try to find the ambushing socket. */ - inp = in_pcblookup_hash(&V_tcbinfo, - ip->ip_src, th->th_sport, - next_hop->sin_addr, - next_hop->sin_port ? - ntohs(next_hop->sin_port) : - th->th_dport, - INPLOOKUP_WILDCARD, - m->m_pkthdr.rcvif); + /* + * It's new. Try to find the ambushing socket. + */ + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, + th->th_sport, next_hop->sin_addr, + next_hop->sin_port ? ntohs(next_hop->sin_port) : + th->th_dport, INPLOOKUP_WILDCARD | + INPLOOKUP_WLOCKPCB, m->m_pkthdr.rcvif); } /* Remove the tag from the packet. We don't need it anymore. */ m_tag_delete(m, fwd_tag); @@ -820,21 +812,19 @@ findpcb: { #ifdef INET6 if (isipv6) - inp = in6_pcblookup_hash(&V_tcbinfo, - &ip6->ip6_src, th->th_sport, - &ip6->ip6_dst, th->th_dport, - INPLOOKUP_WILDCARD, - m->m_pkthdr.rcvif); + inp = in6_pcblookup(&V_tcbinfo, &ip6->ip6_src, + th->th_sport, &ip6->ip6_dst, th->th_dport, + INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, + m->m_pkthdr.rcvif); #endif #if defined(INET) && defined(INET6) else #endif #ifdef INET - inp = in_pcblookup_hash(&V_tcbinfo, - ip->ip_src, th->th_sport, - ip->ip_dst, th->th_dport, - INPLOOKUP_WILDCARD, - m->m_pkthdr.rcvif); + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, + th->th_sport, ip->ip_dst, th->th_dport, + INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, + m->m_pkthdr.rcvif); #endif } @@ -865,7 +855,7 @@ findpcb: rstreason = BANDLIM_RST_CLOSEDPORT; goto dropwithreset; } - INP_WLOCK(inp); + INP_WLOCK_ASSERT(inp); if (!(inp->inp_flags & INP_HW_FLOWID) && (m->m_flags & M_FLOWID) && ((inp->inp_socket == NULL) @@ -906,28 +896,26 @@ findpcb: * legitimate new connection attempt the old INPCB gets removed and * we can try again to find a listening socket. * - * At this point, due to earlier optimism, we may hold a read lock on - * the inpcbinfo, rather than a write lock. If so, we need to - * upgrade, or if that fails, acquire a reference on the inpcb, drop - * all locks, acquire a global write lock, and then re-acquire the - * inpcb lock. We may at that point discover that another thread has - * tried to free the inpcb, in which case we need to loop back and - * try to find a new inpcb to deliver to. + * At this point, due to earlier optimism, we may hold only an inpcb + * lock, and not the inpcbinfo write lock. If so, we need to try to + * acquire it, or if that fails, acquire a reference on the inpcb, + * drop all locks, acquire a global write lock, and then re-acquire + * the inpcb lock. We may at that point discover that another thread + * has tried to free the inpcb, in which case we need to loop back + * and try to find a new inpcb to deliver to. + * + * XXXRW: It may be time to rethink timewait locking. */ relocked: if (inp->inp_flags & INP_TIMEWAIT) { - KASSERT(ti_locked == TI_RLOCKED || ti_locked == TI_WLOCKED, - ("%s: INP_TIMEWAIT ti_locked %d", __func__, ti_locked)); - - if (ti_locked == TI_RLOCKED) { - if (INP_INFO_TRY_UPGRADE(&V_tcbinfo) == 0) { + if (ti_locked == TI_UNLOCKED) { + if (INP_INFO_TRY_WLOCK(&V_tcbinfo) == 0) { in_pcbref(inp); INP_WUNLOCK(inp); - INP_INFO_RUNLOCK(&V_tcbinfo); INP_INFO_WLOCK(&V_tcbinfo); ti_locked = TI_WLOCKED; INP_WLOCK(inp); - if (in_pcbrele(inp)) { + if (in_pcbrele_wlocked(inp)) { inp = NULL; goto findpcb; } @@ -975,26 +963,24 @@ relocked: /* * We've identified a valid inpcb, but it could be that we need an - * inpcbinfo write lock and have only a read lock. In this case, - * attempt to upgrade/relock using the same strategy as the TIMEWAIT - * case above. If we relock, we have to jump back to 'relocked' as - * the connection might now be in TIMEWAIT. - */ - if (tp->t_state != TCPS_ESTABLISHED || - (thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || - tcp_read_locking == 0) { - KASSERT(ti_locked == TI_RLOCKED || ti_locked == TI_WLOCKED, - ("%s: upgrade check ti_locked %d", __func__, ti_locked)); - - if (ti_locked == TI_RLOCKED) { - if (INP_INFO_TRY_UPGRADE(&V_tcbinfo) == 0) { + * inpcbinfo write lock but don't hold it. In this case, attempt to + * acquire using the same strategy as the TIMEWAIT case above. If we + * relock, we have to jump back to 'relocked' as the connection might + * now be in TIMEWAIT. + */ +#ifdef INVARIANTS + if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0) + INP_INFO_WLOCK_ASSERT(&V_tcbinfo); +#endif + if (tp->t_state != TCPS_ESTABLISHED) { + if (ti_locked == TI_UNLOCKED) { + if (INP_INFO_TRY_WLOCK(&V_tcbinfo) == 0) { in_pcbref(inp); INP_WUNLOCK(inp); - INP_INFO_RUNLOCK(&V_tcbinfo); INP_INFO_WLOCK(&V_tcbinfo); ti_locked = TI_WLOCKED; INP_WLOCK(inp); - if (in_pcbrele(inp)) { + if (in_pcbrele_wlocked(inp)) { inp = NULL; goto findpcb; } @@ -1027,13 +1013,16 @@ relocked: /* * When the socket is accepting connections (the INPCB is in LISTEN * state) we look into the SYN cache if this is a new connection - * attempt or the completion of a previous one. + * attempt or the completion of a previous one. Because listen + * sockets are never in TCPS_ESTABLISHED, the V_tcbinfo lock will be + * held in this case. */ if (so->so_options & SO_ACCEPTCONN) { struct in_conninfo inc; KASSERT(tp->t_state == TCPS_LISTEN, ("%s: so accepting but " "tp not listening", __func__)); + INP_INFO_WLOCK_ASSERT(&V_tcbinfo); bzero(&inc, sizeof(inc)); #ifdef INET6 @@ -1371,13 +1360,17 @@ relocked: return; dropwithreset: - if (ti_locked == TI_RLOCKED) - INP_INFO_RUNLOCK(&V_tcbinfo); - else if (ti_locked == TI_WLOCKED) + if (ti_locked == TI_WLOCKED) { INP_INFO_WUNLOCK(&V_tcbinfo); - else - panic("%s: dropwithreset ti_locked %d", __func__, ti_locked); - ti_locked = TI_UNLOCKED; + ti_locked = TI_UNLOCKED; + } +#ifdef INVARIANTS + else { + KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropwithreset " + "ti_locked: %d", __func__, ti_locked)); + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); + } +#endif if (inp != NULL) { tcp_dropwithreset(m, th, tp, tlen, rstreason); @@ -1388,13 +1381,17 @@ dropwithreset: goto drop; dropunlock: - if (ti_locked == TI_RLOCKED) - INP_INFO_RUNLOCK(&V_tcbinfo); - else if (ti_locked == TI_WLOCKED) + if (ti_locked == TI_WLOCKED) { INP_INFO_WUNLOCK(&V_tcbinfo); - else - panic("%s: dropunlock ti_locked %d", __func__, ti_locked); - ti_locked = TI_UNLOCKED; + ti_locked = TI_UNLOCKED; + } +#ifdef INVARIANTS + else { + KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropunlock " + "ti_locked: %d", __func__, ti_locked)); + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); + } +#endif if (inp != NULL) INP_WUNLOCK(inp); @@ -1449,13 +1446,13 @@ tcp_do_segment(struct mbuf *m, struct tc INP_INFO_WLOCK_ASSERT(&V_tcbinfo); } else { #ifdef INVARIANTS - if (ti_locked == TI_RLOCKED) - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon May 30 10:02:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 359491065672; Mon, 30 May 2011 10:02:52 +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 261D98FC18; Mon, 30 May 2011 10:02:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UA2qRH070762; Mon, 30 May 2011 10:02:52 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UA2qu7070760; Mon, 30 May 2011 10:02:52 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105301002.p4UA2qu7070760@svn.freebsd.org> From: Adrian Chadd Date: Mon, 30 May 2011 10:02:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222489 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 10:02:52 -0000 Author: adrian Date: Mon May 30 10:02:51 2011 New Revision: 222489 URL: http://svn.freebsd.org/changeset/base/222489 Log: Update chipset support list for ath_hal. Modified: head/share/man/man4/ath_hal.4 Modified: head/share/man/man4/ath_hal.4 ============================================================================== --- head/share/man/man4/ath_hal.4 Mon May 30 09:43:55 2011 (r222488) +++ head/share/man/man4/ath_hal.4 Mon May 30 10:02:51 2011 (r222489) @@ -51,14 +51,17 @@ or .\".Cd "device ath_ar5312" .\".Cd "device ath_rf2136" .\".Cd "device ath_rf2137" +.Cd "device ath_ar9130" .Cd "device ath_ar9160" .Cd "device ath_ar9280" +.Cd "device ath_ar9285" +.Cd "device ath_ar9287" .Cd "options AH_SUPPORT_AR5416" .Sh DESCRIPTION The hal provides hardware support for wireless network adapters based on the Atheros AR5210, AR5211, AR5212, AR5213, AR2413, AR2417, AR2425, -AR5413, AR5416, AR5418, AR5424, AR9160, AR9220, AR9280, and AR9285 chips -(and companion RF/baseband parts). +AR5413, AR5416, AR5418, AR5424, AR9160, AR9220, AR9280, AR9285 and AR9287 +chips (and companion RF/baseband parts). This code is part of the .Xr ath 4 driver but configured separately to allow fine-grained control @@ -66,14 +69,15 @@ over the set of chips supported. Selecting .Nm enables support for all PCI and Cardbus devices. -Note this includes AR5416, AR9160, AR9220, AR9280 and AR9285 devices -and must be accompanied by the +Note this includes AR5416, AR5418, AR9130, AR9160, AR9220, AR9280, AR9285 +and AR9287 devices and must be accompanied by the AH_SUPPORT_AR5416 option to enable the extended hardware descriptor format used by AR5416 and later devices. .Pp Some devices come in Cardbus/MiniPCI/PCI format. -Others (AR9280, AR9285) come in PCIe, Mini-PCIe or ExpressCard format. +Others (for example AR2413, AR2427, AR5418, AR9280, AR9285, AR9287) come in +PCIe, Mini-PCIe or ExpressCard format. .Pp Historically this code has been released in a binary-only form and packaged as a separate module. From owner-svn-src-head@FreeBSD.ORG Mon May 30 10:07:47 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0549C106564A; Mon, 30 May 2011 10:07:47 +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 E92AC8FC08; Mon, 30 May 2011 10:07:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UA7kDe070940; Mon, 30 May 2011 10:07:46 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UA7kJa070936; Mon, 30 May 2011 10:07:46 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105301007.p4UA7kJa070936@svn.freebsd.org> From: Adrian Chadd Date: Mon, 30 May 2011 10:07:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222490 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 10:07:47 -0000 Author: adrian Date: Mon May 30 10:07:46 2011 New Revision: 222490 URL: http://svn.freebsd.org/changeset/base/222490 Log: Add ath_ahb and ath_pci module manpages. Added: head/share/man/man4/ath_ahb.4 (contents, props changed) head/share/man/man4/ath_pci.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon May 30 10:02:51 2011 (r222489) +++ head/share/man/man4/Makefile Mon May 30 10:07:46 2011 (r222490) @@ -46,7 +46,9 @@ MAN= aac.4 \ atapicam.4 \ ataraid.4 \ ath.4 \ + ath_ahb.4 \ ath_hal.4 \ + ath_pci.4 \ atkbd.4 \ atkbdc.4 \ ${_atp.4} \ Added: head/share/man/man4/ath_ahb.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ath_ahb.4 Mon May 30 10:07:46 2011 (r222490) @@ -0,0 +1,60 @@ +.\"- +.\" Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd +.\" All rights reserved. +.\"" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer, +.\" without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any +.\" redistribution must be conditioned upon including a substantially +.\" similar Disclaimer requirement for further binary redistribution. +.\" +.\" NO WARRANTY +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY +.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. +.\" +.\" $FreeBSD$ +.\"/ +.Dd May 30, 2011 +.Dt ATH_AHB 4 +.Os +.Sh NAME +.Nm ath_ahb +.Nd "Atheros AHB device glue" +.Sh SYNOPSIS +.Cd "device ath_ahb" +.Sh DESCRIPTION +This module provides the AHB bus glue needed for the devices supported +by the +.Xr ath 4 +and +.Xr ath_hal 4 +drivers. +.Pp +This is only relevant for embedded System-on-Chip (SoC) devices such as +the Atheros AR913x series, which include an Atheros wireless MAC on-die. +.Sh SEE ALSO +.Xr ath 4 +.Xr ath_hal 4 +.Sh HISTORY +The +.Nm +module first appeared in +.Fx 9.0 . +.Sh BUGS +See +.Xr ath 4 +for known bugs. Added: head/share/man/man4/ath_pci.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ath_pci.4 Mon May 30 10:07:46 2011 (r222490) @@ -0,0 +1,57 @@ +.\"- +.\" Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd +.\" All rights reserved. +.\"" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer, +.\" without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any +.\" redistribution must be conditioned upon including a substantially +.\" similar Disclaimer requirement for further binary redistribution. +.\" +.\" NO WARRANTY +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY +.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. +.\" +.\" $FreeBSD$ +.\"/ +.Dd May 30, 2011 +.Dt ATH_PCI 4 +.Os +.Sh NAME +.Nm ath_pci +.Nd "Atheros PCI device glue" +.Sh SYNOPSIS +.Cd "device ath_pci" +.Sh DESCRIPTION +This module provides the PCI/PCIe bus glue needed for the devices supported +by the +.Xr ath 4 +and +.Xr ath_hal 4 +drivers. +.Sh SEE ALSO +.Xr ath 4 +.Xr ath_hal 4 +.Sh HISTORY +The +.Nm +module first appeared in +.Fx 9.0 . +.Sh BUGS +See +.Xr ath 4 +for known bugs. From owner-svn-src-head@FreeBSD.ORG Mon May 30 10:12:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A031C1065676; Mon, 30 May 2011 10:12:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90F958FC18; Mon, 30 May 2011 10:12:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UACHiA071116; Mon, 30 May 2011 10:12:17 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UACH6S071114; Mon, 30 May 2011 10:12:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105301012.p4UACH6S071114@svn.freebsd.org> From: Adrian Chadd Date: Mon, 30 May 2011 10:12:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222491 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 10:12:17 -0000 Author: adrian Date: Mon May 30 10:12:17 2011 New Revision: 222491 URL: http://svn.freebsd.org/changeset/base/222491 Log: Mention in ath(4) that ath_pci is required now. Modified: head/share/man/man4/ath.4 Modified: head/share/man/man4/ath.4 ============================================================================== --- head/share/man/man4/ath.4 Mon May 30 10:07:46 2011 (r222490) +++ head/share/man/man4/ath.4 Mon May 30 10:12:17 2011 (r222491) @@ -40,6 +40,7 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device ath" +.Cd "device ath_pci" .Cd "device ath_hal" .Cd "options AH_SUPPORT_AR5416" .Cd "device ath_rate_sample" @@ -51,6 +52,7 @@ module at boot time, place the following .Xr loader.conf 5 : .Bd -literal -offset indent if_ath_load="YES" +if_ath_pci_load="YES" .Ed .Sh DESCRIPTION The @@ -64,6 +66,19 @@ Supported features include 802.11 and 80 IBSS, MBSS, TDMA, and host-based access point operation modes. All host/device interaction is via DMA. .Pp +Please note that from FreeBSD-9.0, the +.Nm +driver does not include the PCI/PCIe bus glue. +The same driver supports multiple underlying bus types, including PCI/PCIe, +but also embedded (AHB) and USB in the future. +.Pp +To enable use for PCI/PCIe systems, see the +.Xr ath_pci 4 +driver. +For embedded systems which use the AHB to connect the wireless MAC, see the +.Xr ath_ahb 4 +driver. +.Pp The .Nm driver encapsulates all IP and ARP traffic as 802.11 frames, however From owner-svn-src-head@FreeBSD.ORG Mon May 30 10:23:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFA921065672; Mon, 30 May 2011 10:23:59 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B03958FC13; Mon, 30 May 2011 10:23: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 p4UANxvF071564; Mon, 30 May 2011 10:23:59 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UANx7N071561; Mon, 30 May 2011 10:23:59 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105301023.p4UANx7N071561@svn.freebsd.org> From: Benedict Reuschling Date: Mon, 30 May 2011 10:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222492 - head/share/man/man7 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 10:23:59 -0000 Author: bcr (doc committer) Date: Mon May 30 10:23:59 2011 New Revision: 222492 URL: http://svn.freebsd.org/changeset/base/222492 Log: Add a short description about NO_CHECKSUM. PR: docs/155980 Submitted by KOIE Hidetaka (koie at suri co jp) MFC after: 7 days Modified: head/share/man/man7/c99.7 head/share/man/man7/ports.7 Modified: head/share/man/man7/c99.7 ============================================================================== --- head/share/man/man7/c99.7 Mon May 30 10:12:17 2011 (r222491) +++ head/share/man/man7/c99.7 Mon May 30 10:23:59 2011 (r222492) @@ -122,7 +122,7 @@ Support for variable length arrays New high-precision integer type named long long int, and other integer types defined in stdint.h .It -New boolen data type implemented in stdbool.h +New boolean data type implemented in stdbool.h .It One line comments taken from the C++ language .It Modified: head/share/man/man7/ports.7 ============================================================================== --- head/share/man/man7/ports.7 Mon May 30 10:12:17 2011 (r222491) +++ head/share/man/man7/ports.7 Mon May 30 10:23:59 2011 (r222492) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 25, 2011 +.Dd May 30, 2011 .Dt PORTS 7 .Os .Sh NAME @@ -479,6 +479,8 @@ Of course, these ports may not work as e what you are doing and are sure about installing a forbidden port, then .Va NO_IGNORE lets you do it. +.It Va NO_CHECKSUM +If defined, skip verifying the port's checksum. .It Va TRYBROKEN If defined, attempt to build a port even if it is marked as .Aq Va BROKEN . From owner-svn-src-head@FreeBSD.ORG Mon May 30 10:28:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C4551065672; Mon, 30 May 2011 10:28:56 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D2E28FC1A; Mon, 30 May 2011 10:28:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UASthE071755; Mon, 30 May 2011 10:28:55 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UAStr6071753; Mon, 30 May 2011 10:28:55 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105301028.p4UAStr6071753@svn.freebsd.org> From: Benedict Reuschling Date: Mon, 30 May 2011 10:28:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222493 - head/share/man/man7 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 10:28:56 -0000 Author: bcr (doc committer) Date: Mon May 30 10:28:55 2011 New Revision: 222493 URL: http://svn.freebsd.org/changeset/base/222493 Log: Bump document date. I accidently committed the actual change (typo fix) in r222492, which is a completely unrelated change. Modified: head/share/man/man7/c99.7 Modified: head/share/man/man7/c99.7 ============================================================================== --- head/share/man/man7/c99.7 Mon May 30 10:23:59 2011 (r222492) +++ head/share/man/man7/c99.7 Mon May 30 10:28:55 2011 (r222493) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 17, 2010 +.Dd May 30, 2011 .Dt C 7 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Mon May 30 11:17:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6055B1065674; Mon, 30 May 2011 11:17:43 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 50E488FC21; Mon, 30 May 2011 11:17: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 p4UBHhqk074648; Mon, 30 May 2011 11:17:43 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UBHhYh074646; Mon, 30 May 2011 11:17:43 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105301117.p4UBHhYh074646@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 30 May 2011 11:17:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222495 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 11:17:43 -0000 Author: ae Date: Mon May 30 11:17:42 2011 New Revision: 222495 URL: http://svn.freebsd.org/changeset/base/222495 Log: Document kern.geom.part.check_integrity sysctl variable. Modified: head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Mon May 30 11:09:38 2011 (r222494) +++ head/sbin/geom/class/part/gpart.8 Mon May 30 11:17:42 2011 (r222495) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2011 +.Dd May 30, 2011 .Dt GPART 8 .Os .Sh NAME @@ -802,6 +802,22 @@ providers and some of them will be marke Be careful when choosing a provider for recovering. If you choose incorrectly you can destroy the metadata of another GEOM class, e.g. GEOM MIRROR or GEOM LABEL. +.Sh SYSCTL VARIABLES +The following +.Xr sysctl 8 +variables can be used to control the behavior of the +.Nm PART +GEOM class. +The default value is shown next to each variable. +.Bl -tag -width indent +.It Va kern.geom.part.check_integrity : No 1 +This variable controls the behaviour of metadata integrity checks. +When integrity checks are enabled +.Nm PART +GEOM class verifies all generic partition parameters that it gets from the +disk metadata. If some inconsistency is detected, partition table will be +rejected with a diagnostic message: +.Pa GEOM_PART: Integrity check failed (provider, scheme) . .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES From owner-svn-src-head@FreeBSD.ORG Mon May 30 12:48:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE0A3106566B; Mon, 30 May 2011 12:48:53 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8AE9F8FC13; Mon, 30 May 2011 12:48:53 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 241B146B51; Mon, 30 May 2011 08:48:53 -0400 (EDT) Date: Mon, 30 May 2011 13:48:53 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Rick Macklem In-Reply-To: <201105292113.p4TLDrA3046886@svn.freebsd.org> Message-ID: References: <201105292113.p4TLDrA3046886@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 12:48:53 -0000 On Sun, 29 May 2011, Rick Macklem wrote: > Modify the umount(8) command so that it doesn't do > a sync(2) syscall before unmount(2) for the "-f" case. > This avoids a forced dismount from getting stuck for > an NFS mountpoint in sync() when the server is not > responsive. With this commit, forced dismounts should > normally work for the NFS clients, but can take up to > about 1minute to complete. I'm actually a bit confused about why umount(8) calls sync(2) at all: surely it's the responsibility of the file system, rather than the userland tool, to ensure consistency subject to file system configuration and unmount-time flags? Robert From owner-svn-src-head@FreeBSD.ORG Mon May 30 13:07:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46D15106566C; Mon, 30 May 2011 13:07:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id B41298FC0A; Mon, 30 May 2011 13:07:57 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p4UD7pYP049138 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 30 May 2011 16:07:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p4UD7poe085907; Mon, 30 May 2011 16:07:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p4UD7pHt085906; Mon, 30 May 2011 16:07:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 30 May 2011 16:07:51 +0300 From: Kostik Belousov To: Robert Watson Message-ID: <20110530130751.GV48734@deviant.kiev.zoral.com.ua> References: <201105292113.p4TLDrA3046886@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ESod/vG06iFAbj33" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, Rick Macklem , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 13:07:59 -0000 --ESod/vG06iFAbj33 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 30, 2011 at 01:48:53PM +0100, Robert Watson wrote: > On Sun, 29 May 2011, Rick Macklem wrote: >=20 > > Modify the umount(8) command so that it doesn't do > > a sync(2) syscall before unmount(2) for the "-f" case. > > This avoids a forced dismount from getting stuck for > > an NFS mountpoint in sync() when the server is not > > responsive. With this commit, forced dismounts should > > normally work for the NFS clients, but can take up to > > about 1minute to complete. >=20 > I'm actually a bit confused about why umount(8) calls sync(2) at all:=20 > surely it's the responsibility of the file system, rather than the userla= nd=20 > tool, to ensure consistency subject to file system configuration and=20 > unmount-time flags? This call is from the same department as triple-sync before reboot, IMO. --ESod/vG06iFAbj33 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk3jlqYACgkQC3+MBN1Mb4indgCgiMHk6ZWSIxLfz0jIPmCMLuGp VfcAn3Q+6CJGGt0CQ3CjYpr7KiSWDw8L =83zU -----END PGP SIGNATURE----- --ESod/vG06iFAbj33-- From owner-svn-src-head@FreeBSD.ORG Mon May 30 13:58:51 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EC24106566C; Mon, 30 May 2011 13:58:51 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.mail.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id C502F8FC1F; Mon, 30 May 2011 13:58:50 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap0EAIqh402DaFvO/2dsb2JhbABVhEmiWIhxrDqQEoErg2yBBwSQT482 X-IronPort-AV: E=Sophos;i="4.65,291,1304308800"; d="scan'208";a="122302127" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu-pri.mail.uoguelph.ca with ESMTP; 30 May 2011 09:58:49 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id B5DA8B3F29; Mon, 30 May 2011 09:58:49 -0400 (EDT) Date: Mon, 30 May 2011 09:58:49 -0400 (EDT) From: Rick Macklem To: Kostik Belousov Message-ID: <336367081.983085.1306763929731.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20110530130751.GV48734@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.201] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: svn-src-head@freebsd.org, Rick Macklem , svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson Subject: Re: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 13:58:51 -0000 > On Mon, May 30, 2011 at 01:48:53PM +0100, Robert Watson wrote: > > On Sun, 29 May 2011, Rick Macklem wrote: > > > > > Modify the umount(8) command so that it doesn't do > > > a sync(2) syscall before unmount(2) for the "-f" case. > > > This avoids a forced dismount from getting stuck for > > > an NFS mountpoint in sync() when the server is not > > > responsive. With this commit, forced dismounts should > > > normally work for the NFS clients, but can take up to > > > about 1minute to complete. > > > > I'm actually a bit confused about why umount(8) calls sync(2) at > > all: > > surely it's the responsibility of the file system, rather than the > > userland > > tool, to ensure consistency subject to file system configuration and > > unmount-time flags? > This call is from the same department as triple-sync before reboot, > IMO. Hehe. I'm so old, I do two syncs, as required by 6th Edition.:-) I assumed the sync() was meant to be an optimization (given the comment for it) in the sense that it would get the writes of dirty blocks started "right away". However, given the short period of time from the the sync(2) call to the unmount(2) call, I'm not convinced it makes a significant difference. (I thought of just getting rid of it, but figured it was harmless for the non "-f" case and might matter for a buggy fs that doesn't get the unmount(2) quite right. ie. Same argument as doing the triple-sync, just to be sure.) rick From owner-svn-src-head@FreeBSD.ORG Mon May 30 14:57:01 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A94E106566B; Mon, 30 May 2011 14:57:01 +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 1AD218FC19; Mon, 30 May 2011 14:57:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UEv0co081903; Mon, 30 May 2011 14:57:00 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UEv0Ba081901; Mon, 30 May 2011 14:57:00 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105301457.p4UEv0Ba081901@svn.freebsd.org> From: Adrian Chadd Date: Mon, 30 May 2011 14:57:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222497 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 14:57:01 -0000 Author: adrian Date: Mon May 30 14:57:00 2011 New Revision: 222497 URL: http://svn.freebsd.org/changeset/base/222497 Log: Set default A-MPDU density/size. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon May 30 11:24:03 2011 (r222496) +++ head/sys/dev/ath/if_ath.c Mon May 30 14:57:00 2011 (r222497) @@ -984,6 +984,21 @@ ath_vap_create(struct ieee80211com *ic, avp->av_bmiss = vap->iv_bmiss; vap->iv_bmiss = ath_bmiss_vap; + /* Set default parameters */ + + /* + * Anything earlier than some AR9300 series MACs don't + * support a smaller MPDU density. + */ + vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_8; + /* + * All NICs can handle the maximum size, however + * AR5416 based MACs can only TX aggregates w/ RTS + * protection when the total aggregate size is <= 8k. + * However, for now that's enforced by the TX path. + */ + vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K; + avp->av_bslot = -1; if (needbeacon) { /* From owner-svn-src-head@FreeBSD.ORG Mon May 30 15:06:58 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14FC1106570F; Mon, 30 May 2011 15:06:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFBD18FC0A; Mon, 30 May 2011 15:06:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UF6vHu082250; Mon, 30 May 2011 15:06:57 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UF6vnG082248; Mon, 30 May 2011 15:06:57 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105301506.p4UF6vnG082248@svn.freebsd.org> From: Adrian Chadd Date: Mon, 30 May 2011 15:06:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222498 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 15:06:58 -0000 Author: adrian Date: Mon May 30 15:06:57 2011 New Revision: 222498 URL: http://svn.freebsd.org/changeset/base/222498 Log: Enable setting the short-GI bit when TX'ing HT rates but only if the hardware supports it. Since ni->ni_htcap in hostap mode is what the remote end has advertised, not what has been negotiated/decided, we need to check ourselves what the current channel width is and what the hardware supports before enabling short-GI. It's important that short-GI isn't enabled when it isn't negotiated and when the hardware doesn't support it (ie, short-gi for 20mhz channels on any chip < AR9287.) I've quickly verified this on the AR9285 in 11n mode. Modified: head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Mon May 30 14:57:00 2011 (r222497) +++ head/sys/dev/ath/if_ath_tx_ht.c Mon May 30 15:06:57 2011 (r222498) @@ -136,15 +136,23 @@ ath_rateseries_setup(struct ath_softc *s */ if (ni->ni_chw == 40) series[i].RateFlags |= HAL_RATESERIES_2040; -#if 0 + /* - * The hardware only supports short-gi in 40mhz mode - - * if later hardware supports it in 20mhz mode, be sure - * to add the relevant check here. + * Set short-GI only if the node has advertised it + * the channel width is suitable, and we support it. + * We don't currently have a "negotiated" set of bits - + * ni_htcap is what the remote end sends, not what this + * node is capable of. */ - if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) + if (ni->ni_chw == 40 && + ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40 && + ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) + series[i].RateFlags |= HAL_RATESERIES_HALFGI; + + if (ni->ni_chw == 20 && + ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20 && + ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) series[i].RateFlags |= HAL_RATESERIES_HALFGI; -#endif series[i].Rate = rt->info[rix[i]].rateCode; From owner-svn-src-head@FreeBSD.ORG Mon May 30 15:25:15 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 816771065673; Mon, 30 May 2011 15:25:15 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 1AFEA8FC15; Mon, 30 May 2011 15:25:14 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p4UFP3iJ016780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 May 2011 01:25:05 +1000 Date: Tue, 31 May 2011 01:25:03 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: mdf@FreeBSD.org In-Reply-To: Message-ID: <20110531004247.C4034@besplex.bde.org> References: <201105131848.p4DIm1j7079495@svn.freebsd.org> <201105282103.43370.pieter@degoeje.nl> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-64904466-1306769103=:4034" Cc: svn-src-head@FreeBSD.org, Pieter de Goeje , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r221853 - in head/sys: dev/md dev/null sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 15:25:15 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-64904466-1306769103=:4034 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sat, 28 May 2011 mdf@FreeBSD.org wrote: > On Sat, May 28, 2011 at 12:03 PM, Pieter de Goeje wro= te: >> On Friday 13 May 2011 20:48:01 Matthew D Fleming wrote: >>> Author: mdf >>> Date: Fri May 13 18:48:00 2011 >>> New Revision: 221853 >>> URL: http://svn.freebsd.org/changeset/base/221853 >>> >>> Log: >>> =A0 Usa a globally visible region of zeros for both /dev/zero and the m= d >>> =A0 device. =A0There are likely other kernel uses of "blob of zeros" th= an can >>> =A0 be converted. >>> >>> =A0 Reviewed by: =A0 =A0 =A0 =A0alc >>> =A0 MFC after: =A01 week >> >> This change seems to reduce /dev/zero performance by 68% as measured by = this >> command: dd if=3D/dev/zero of=3D/dev/null bs=3D64k count=3D100000. >> >> x dd-8-stable >> + dd-9-current >> +-----------------------------------------------------------------------= --+ >> |+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= | Argh, hard \xa0. [...binary garbage deleted] >> This particular measurement was against 8-stable but the results are the= same >> for -current just before this commit. Basically througput drops from >> ~13GB/sec to 4GB/sec. >> >> Hardware is a Phenom II X4 945 with 8GB of 800Mhz DDR2 memory. FreeBSD/a= md64 >> is installed. This processor has 6MB of L3 cache. >> >> To me it looks like it's not able to cache the zeroes anymore. Is this >> intentional? I tried to change ZERO_REGION_SIZE back to 64K but that did= n't >> help. > > Hmm. I don't have access to my FreeBSD box over the weekend, but I'll > run this on my box when I get back to work. > > Meanwhile you could try setting ZERO_REGION_SIZE to PAGE_SIZE and I > think that will restore things to the original performance. Using /dev/zero always thrashes caches by the amount + (unless the arch uses nontemporal memory accesses for uiomove, which none do AFAIK). So a large source buffer is always just a pessimization. A large target buffer size is also a pessimization, but for the target buffer a fairly large size is needed to amortize the large syscall costs. In this PR, the target buffer size is 64K. ZERO_REGION_SIZE is 64K on i386 and 2M on amd64. 64K+64K on i386 is good for thrashing the L1 cache. It will only have a noticeable impact on a current L2 cache in competition with other threads. It is hard to fit everything in the L1 cache even with non-bloated buffer sizes and 1 thread (16 for the source (I)cache, 0 for the source (D)cache and 4K for the target cache might work). On amd64, 2M+2M is good for thrashing most L2 caches. In this PR, the thrashing is limited by the target buffer size to about 64K+64K, up from 4K+64K, and it is marginal whether the extra thrashing from the larger source buffer makes much difference. The old zbuf source buffer size of PAGE_SIZE was already too large. The source buffer size only needs to be large enough to amortize loop overhead. 1 cache line is enough in most cases. uiomove() and copyout() unfortunately don't support copying from register space, so there must be a source buffer. This may limit the bandwidth by a factor of 2 in some cases, since most modern CPUs can execute either 2 64-bit stores or 1 64-bit store and 1 64-bit load per cycle if everything is already in the L1 cache. However, target buffers for /dev/zero (or any user i/o) probably need to be larger than the L1 cache to amortize the syscall overhead, so there are usually plenty of cycles to spare for the unnecessary loads while the stores wait for caches. This behaviour is easy to see for regular files too (regular files get copied out from the buffer cache). You have limited control on the amount of thrashing by changing the target buffer size, and can determine cache sizes by looking at throughputs. Bruce --0-64904466-1306769103=:4034-- From owner-svn-src-head@FreeBSD.ORG Mon May 30 15:49:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE740106564A; Mon, 30 May 2011 15:49:17 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2138A8FC1C; Mon, 30 May 2011 15:49:16 +0000 (UTC) Received: by wyf23 with SMTP id 23so3686701wyf.13 for ; Mon, 30 May 2011 08:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=YAqFh3aFa6MNx5jmjC6TLgYxL1IIAIU+Dr+5wnZWCxU=; b=lpy921bG+0UkUxvVi8f/YBDjE9Puq+ZKK/x8F+u3UESLgl+7p/tvirg0A9Ua05SAWB PAqoYgOgvi4Sa9os4yyQS3ceg0NNvS5/EX1Bg40C3f/81nz/RlrLhYiQOVr9fgOfqxOF g46rQSjjUZzR3FTzhyFJgWVYyLTQ3QmaPa3Bs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=mYronCzc3H/gKXJUeunQekyMHunVTtrM2cEBEZXHH2eoZicHPGD8BDCAnV0x07Krim buGhHSQUETncbuAguMAbiFCjPlsN7w9VrtRDOcNf1Er967mchjA1k0Ff4q0GgdxkaBRN VHoeqd0krhvVBK6Kfvoprew51clsCw0dooLG8= MIME-Version: 1.0 Received: by 10.216.141.1 with SMTP id f1mr5020365wej.35.1306770555897; Mon, 30 May 2011 08:49:15 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.93.193 with HTTP; Mon, 30 May 2011 08:49:15 -0700 (PDT) In-Reply-To: <20110531004247.C4034@besplex.bde.org> References: <201105131848.p4DIm1j7079495@svn.freebsd.org> <201105282103.43370.pieter@degoeje.nl> <20110531004247.C4034@besplex.bde.org> Date: Mon, 30 May 2011 08:49:15 -0700 X-Google-Sender-Auth: aQwvUUlVZ5VveKrt-oKfx_ahp4c Message-ID: From: mdf@FreeBSD.org To: Bruce Evans Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Pieter de Goeje , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221853 - in head/sys: dev/md dev/null sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 15:49:18 -0000 On Mon, May 30, 2011 at 8:25 AM, Bruce Evans wrote: > On Sat, 28 May 2011 mdf@FreeBSD.org wrote: > >> On Sat, May 28, 2011 at 12:03 PM, Pieter de Goeje >> wrote: >>> >>> On Friday 13 May 2011 20:48:01 Matthew D Fleming wrote: >>>> >>>> Author: mdf >>>> Date: Fri May 13 18:48:00 2011 >>>> New Revision: 221853 >>>> URL: http://svn.freebsd.org/changeset/base/221853 >>>> >>>> Log: >>>> =A0 Usa a globally visible region of zeros for both /dev/zero and the = md >>>> =A0 device. =A0There are likely other kernel uses of "blob of zeros" t= han >>>> can >>>> =A0 be converted. >>>> >>>> =A0 Reviewed by: =A0 =A0 =A0 =A0alc >>>> =A0 MFC after: =A01 week >>> >>> This change seems to reduce /dev/zero performance by 68% as measured by >>> this >>> command: dd if=3D/dev/zero of=3D/dev/null bs=3D64k count=3D100000. >>> >>> x dd-8-stable >>> + dd-9-current >>> >>> +----------------------------------------------------------------------= ---+ >>> |+ >>> =A0| > > Argh, hard \xa0. > > [...binary garbage deleted] > >>> This particular measurement was against 8-stable but the results are th= e >>> same >>> for -current just before this commit. Basically througput drops from >>> ~13GB/sec to 4GB/sec. >>> >>> Hardware is a Phenom II X4 945 with 8GB of 800Mhz DDR2 memory. >>> FreeBSD/amd64 >>> is installed. This processor has 6MB of L3 cache. >>> >>> To me it looks like it's not able to cache the zeroes anymore. Is this >>> intentional? I tried to change ZERO_REGION_SIZE back to 64K but that >>> didn't >>> help. >> >> Hmm. =A0I don't have access to my FreeBSD box over the weekend, but I'll >> run this on my box when I get back to work. >> >> Meanwhile you could try setting ZERO_REGION_SIZE to PAGE_SIZE and I >> think that will restore things to the original performance. > > Using /dev/zero always thrashes caches by the amount size> + (unless the arch uses nontemporal memory > accesses for uiomove, which none do AFAIK). =A0So a large source buffer > is always just a pessimization. =A0A large target buffer size is also a > pessimization, but for the target buffer a fairly large size is needed > to amortize the large syscall costs. =A0In this PR, the target buffer > size is 64K. =A0ZERO_REGION_SIZE is 64K on i386 and 2M on amd64. =A064K+6= 4K > on i386 is good for thrashing the L1 cache. That depends -- is the cache virtually or physically addressed? The zero_region only has 4k (PAGE_SIZE) of unique physical addresses. So most of the cache thrashing is due to the user-space buffer, if the cache is physically addressed. =A0It will only have a > noticeable impact on a current L2 cache in competition with other > threads. =A0It is hard to fit everything in the L1 cache even with > non-bloated buffer sizes and 1 thread (16 for the source (I)cache, 0 > for the source (D)cache and 4K for the target cache might work). =A0On > amd64, 2M+2M is good for thrashing most L2 caches. =A0In this PR, the > thrashing is limited by the target buffer size to about 64K+64K, up > from 4K+64K, and it is marginal whether the extra thrashing from the > larger source buffer makes much difference. > > The old zbuf source buffer size of PAGE_SIZE was already too large. Wouldn't this depend on how far down from the use of the buffer the actual copy happens? Another advantage to a large virtual buffer is that it reduces the number of times the copy loop in uiomove has to return up to the device layer that initiated the copy. This is all pretty fast, but again assuming a physical cache fewer trips is better. Thanks, matthew > The source buffer size only needs to be large enough to amortize > loop overhead. =A01 cache line is enough in most cases. =A0uiomove() > and copyout() unfortunately don't support copying from register > space, so there must be a source buffer. =A0This may limit the bandwidth > by a factor of 2 in some cases, since most modern CPUs can execute > either 2 64-bit stores or 1 64-bit store and 1 64-bit load per cycle > if everything is already in the L1 cache. =A0However, target buffers > for /dev/zero (or any user i/o) probably need to be larger than the > L1 cache to amortize the syscall overhead, so there are usually plenty > of cycles to spare for the unnecessary loads while the stores wait for > caches. > > This behaviour is easy to see for regular files too (regular files get > copied out from the buffer cache). =A0You have limited control on the > amount of thrashing by changing the target buffer size, and can determine > cache sizes by looking at throughputs. > > Bruce From owner-svn-src-head@FreeBSD.ORG Mon May 30 17:27:48 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69510106564A; Mon, 30 May 2011 17:27:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 592128FC1C; Mon, 30 May 2011 17:27:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UHRmDN086501; Mon, 30 May 2011 17:27:48 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UHRmA9086499; Mon, 30 May 2011 17:27:48 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105301727.p4UHRmA9086499@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 30 May 2011 17:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222502 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 17:27:48 -0000 Author: bz Date: Mon May 30 17:27:48 2011 New Revision: 222502 URL: http://svn.freebsd.org/changeset/base/222502 Log: Contrary to the rc.conf framework, when manualy enabling IPv6 we have to -ifdiabled ourselves. Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Mon May 30 16:10:15 2011 (r222501) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Mon May 30 17:27:48 2011 (r222502) @@ -61,7 +61,7 @@ while : ; do if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then dialog --backtitle 'FreeBSD Installer' \ --infobox "Sending Router Solicitation ..." 0 0 - ifconfig ${INTERFACE} inet6 accept_rtadv up + ifconfig ${INTERFACE} inet6 -ifdisabled accept_rtadv up rtsol -F $INTERFACE 2>> $BSDINSTALL_LOG if [ $? -ne 0 ]; then dialog --backtitle 'FreeBSD Installer' --msgbox "SLAAC failed." 0 0 From owner-svn-src-head@FreeBSD.ORG Mon May 30 17:52:55 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D6A51065670; Mon, 30 May 2011 17:52:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 2421F8FC16; Mon, 30 May 2011 17:52:54 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p4UHqkkY005457 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 May 2011 03:52:47 +1000 Date: Tue, 31 May 2011 03:52:46 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: mdf@FreeBSD.org In-Reply-To: Message-ID: <20110531032658.N5049@besplex.bde.org> References: <201105131848.p4DIm1j7079495@svn.freebsd.org> <201105282103.43370.pieter@degoeje.nl> <20110531004247.C4034@besplex.bde.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-993397294-1306777966=:5049" Cc: svn-src-head@FreeBSD.org, Pieter de Goeje , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans Subject: Re: svn commit: r221853 - in head/sys: dev/md dev/null sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 17:52:55 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-993397294-1306777966=:5049 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 30 May 2011 mdf@FreeBSD.org wrote: > On Mon, May 30, 2011 at 8:25 AM, Bruce Evans wrote= : >> On Sat, 28 May 2011 mdf@FreeBSD.org wrote: >>> ... >>> Meanwhile you could try setting ZERO_REGION_SIZE to PAGE_SIZE and I >>> think that will restore things to the original performance. >> >> Using /dev/zero always thrashes caches by the amount > size> + (unless the arch uses nontemporal memory >> accesses for uiomove, which none do AFAIK). =A0So a large source buffer >> is always just a pessimization. =A0A large target buffer size is also a >> pessimization, but for the target buffer a fairly large size is needed >> to amortize the large syscall costs. =A0In this PR, the target buffer >> size is 64K. =A0ZERO_REGION_SIZE is 64K on i386 and 2M on amd64. =A064K+= 64K >> on i386 is good for thrashing the L1 cache. > > That depends -- is the cache virtually or physically addressed? The > zero_region only has 4k (PAGE_SIZE) of unique physical addresses. So > most of the cache thrashing is due to the user-space buffer, if the > cache is physically addressed. Oops. I now remember thinking that the much larger source buffer would be OK since it only uses 1 physical page. But it is apparently virtually addressed. > =A0It will only have a >> noticeable impact on a current L2 cache in competition with other >> threads. =A0It is hard to fit everything in the L1 cache even with >> non-bloated buffer sizes and 1 thread (16 for the source (I)cache, 0 >> for the source (D)cache and 4K for the target cache might work). =A0On >> amd64, 2M+2M is good for thrashing most L2 caches. =A0In this PR, the >> thrashing is limited by the target buffer size to about 64K+64K, up >> from 4K+64K, and it is marginal whether the extra thrashing from the >> larger source buffer makes much difference. >> >> The old zbuf source buffer size of PAGE_SIZE was already too large. > > Wouldn't this depend on how far down from the use of the buffer the > actual copy happens? Another advantage to a large virtual buffer is > that it reduces the number of times the copy loop in uiomove has to > return up to the device layer that initiated the copy. This is all > pretty fast, but again assuming a physical cache fewer trips is > better. Yes, I had forgotten that I have to keep going back to the uiomove() level for each iteration. That's a lot of overhead although not nearly as much as going back to the user level. If this is actually important to optimize, then I might add a repeat count to uiomove() and copyout() (actually a different function for the latter). linux-2.6.10 uses a mmapped /dev/zero and has had this since Y2K according to its comment. Sigh. You will never beat that by copying, but I think mmapping /dev/zero is only much more optimal for silly benchmarks. linux-2.6.10 also has a seekable /dev/zero. Seeks don't really work, but some of them "succeed" and keep the offset at 0 . ISTR remember a FreeBSD PR about the file offset for /dev/zero not "working" because it is garbage instead of 0. It is clearly a Linuxism to depend on it being nonzero. IIRC, the file offset for device files is at best implementation-defined in POSIX. Bruce --0-993397294-1306777966=:5049-- From owner-svn-src-head@FreeBSD.ORG Mon May 30 18:07:35 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67E96106566C; Mon, 30 May 2011 18:07:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57EE08FC19; Mon, 30 May 2011 18:07:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UI7Zcb087723; Mon, 30 May 2011 18:07:35 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UI7ZBQ087721; Mon, 30 May 2011 18:07:35 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105301807.p4UI7ZBQ087721@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 30 May 2011 18:07:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222503 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 18:07:35 -0000 Author: bz Date: Mon May 30 18:07:35 2011 New Revision: 222503 URL: http://svn.freebsd.org/changeset/base/222503 Log: Unbreak NOINET kernels after r222488. Reviewed by: rwatson Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems! Pointy hat: to myself for missing this during review? Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Mon May 30 17:27:48 2011 (r222502) +++ head/sys/netinet/in_pcb.c Mon May 30 18:07:35 2011 (r222503) @@ -127,13 +127,13 @@ static VNET_DEFINE(int, ipport_tcplastco #define V_ipport_tcplastcount VNET(ipport_tcplastcount) +static void in_pcbremlists(struct inpcb *inp); +#ifdef INET static struct inpcb *in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport_arg, struct in_addr laddr, u_int lport_arg, int lookupflags, struct ifnet *ifp); -static void in_pcbremlists(struct inpcb *inp); -#ifdef INET #define RANGECHK(var, min, max) \ if ((var) < (min)) { (var) = (min); } \ else if ((var) > (max)) { (var) = (max); } From owner-svn-src-head@FreeBSD.ORG Mon May 30 18:22:56 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05896106564A; Mon, 30 May 2011 18:22:56 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D2D4A8FC13; Mon, 30 May 2011 18:22:55 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 7EB4646B06; Mon, 30 May 2011 14:22:55 -0400 (EDT) Date: Mon, 30 May 2011 19:22:55 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Kostik Belousov In-Reply-To: <20110530130751.GV48734@deviant.kiev.zoral.com.ua> Message-ID: References: <201105292113.p4TLDrA3046886@svn.freebsd.org> <20110530130751.GV48734@deviant.kiev.zoral.com.ua> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Rick Macklem , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 18:22:56 -0000 On Mon, 30 May 2011, Kostik Belousov wrote: > On Mon, May 30, 2011 at 01:48:53PM +0100, Robert Watson wrote: >> On Sun, 29 May 2011, Rick Macklem wrote: >> >>> Modify the umount(8) command so that it doesn't do a sync(2) syscall >>> before unmount(2) for the "-f" case. This avoids a forced dismount from >>> getting stuck for an NFS mountpoint in sync() when the server is not >>> responsive. With this commit, forced dismounts should normally work for >>> the NFS clients, but can take up to about 1minute to complete. >> >> I'm actually a bit confused about why umount(8) calls sync(2) at all: >> surely it's the responsibility of the file system, rather than the userland >> tool, to ensure consistency subject to file system configuration and >> unmount-time flags? > This call is from the same department as triple-sync before reboot, IMO. No doubt. :-) If the sync(2) has actual consistency and reliability benefits, it should probably be done by the umount(2) system call, so that other future auto-mounters, etc, also get the same result, rather than having to encode it in every application. If it's done on blind faith, perhaps it shouldn't be done at all. Robert From owner-svn-src-head@FreeBSD.ORG Mon May 30 18:24:16 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67B8C106564A; Mon, 30 May 2011 18:24:16 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 41E288FC15; Mon, 30 May 2011 18:24:16 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id ED4C446B39; Mon, 30 May 2011 14:24:15 -0400 (EDT) Date: Mon, 30 May 2011 19:24:15 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Rick Macklem In-Reply-To: <336367081.983085.1306763929731.JavaMail.root@erie.cs.uoguelph.ca> Message-ID: References: <336367081.983085.1306763929731.JavaMail.root@erie.cs.uoguelph.ca> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Kostik Belousov , Rick Macklem , svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 18:24:16 -0000 On Mon, 30 May 2011, Rick Macklem wrote: > Hehe. I'm so old, I do two syncs, as required by 6th Edition.:-) > > I assumed the sync() was meant to be an optimization (given the comment for > it) in the sense that it would get the writes of dirty blocks started "right > away". However, given the short period of time from the the sync(2) call to > the unmount(2) call, I'm not convinced it makes a significant difference. (I > thought of just getting rid of it, but figured it was harmless for the non > "-f" case and might matter for a buggy fs that doesn't get the unmount(2) > quite right. ie. Same argument as doing the triple-sync, just to be sure.) If it masks, for example, lateny for a synchronous RPC to the remote mountd to deregister the mountpoint, allowing a cache flush and unmount to take place concurrently, that might be a useful benefit. I'm not sure I see any evidence that is the case in the source code, however. Robert From owner-svn-src-head@FreeBSD.ORG Mon May 30 19:26:34 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB70D106566B; Mon, 30 May 2011 19:26:34 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.mail.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id 4A49F8FC08; Mon, 30 May 2011 19:26:33 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap0EAOHu402DaFvO/2dsb2JhbABVhEmiWIhxqwiQNIErg2yBBwSQT482 X-IronPort-AV: E=Sophos;i="4.65,293,1304308800"; d="scan'208";a="122340554" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu-pri.mail.uoguelph.ca with ESMTP; 30 May 2011 15:26:33 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 44878B40DE; Mon, 30 May 2011 15:26:33 -0400 (EDT) Date: Mon, 30 May 2011 15:26:33 -0400 (EDT) From: Rick Macklem To: Robert Watson Message-ID: <813868799.1015531.1306783593226.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.202] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: svn-src-head@freebsd.org, Rick Macklem , svn-src-all@freebsd.org, src-committers@freebsd.org, Kostik Belousov Subject: Re: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 19:26:35 -0000 > > No doubt. :-) > > If the sync(2) has actual consistency and reliability benefits, it > should > probably be done by the umount(2) system call, so that other future > auto-mounters, etc, also get the same result, rather than having to > encode it > in every application. If it's done on blind faith, perhaps it > shouldn't be > done at all. > I wouldn't say it's necessary, but if you look at dounmount() in vfs_mount.c, it does a VFS_SYNC() before VFS_UNMOUNT(). I needed to fix nfs_sync() for forced dismounts to work because of this. rick From owner-svn-src-head@FreeBSD.ORG Mon May 30 19:34:44 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0739B1065676; Mon, 30 May 2011 19:34:44 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id 594D38FC0C; Mon, 30 May 2011 19:34:43 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap0EAAvx402DaFvO/2dsb2JhbABVhEmiWIhxqneQNIErg2yBBwSQT482 X-IronPort-AV: E=Sophos;i="4.65,293,1304308800"; d="scan'208";a="126294906" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 30 May 2011 15:34:37 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id EF0C2B3F2B; Mon, 30 May 2011 15:34:37 -0400 (EDT) Date: Mon, 30 May 2011 15:34:37 -0400 (EDT) From: Rick Macklem To: Robert Watson Message-ID: <1822018328.1016204.1306784077970.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.203] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: Kostik Belousov , Rick Macklem , svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 19:34:44 -0000 > > If it masks, for example, lateny for a synchronous RPC to the remote > mountd to > deregister the mountpoint, allowing a cache flush and unmount to take > place > concurrently, that might be a useful benefit. I'm not sure I see any > evidence > that is the case in the source code, however. > Well, I suppose write latency will often be higher for NFS than other mount points. The case where I think the sync(2) might help from a performance point of view might be (I'm talking through my hat here. Haven't benchmarked or looked at it closely and don't intend to:-): - does a "umount -a" when there are a lot of /etc/fstab entries with a lot of dirty blocks to be written out. --> the writes would be started for all file systems and then they would be unmount(2)'d one at a time. It might be quite a while before the last fs gets an unmount(2), so the blocks "might" have been written out by then. on the other hand, take the above example and replace "umount -a" with "umount /x" where "/x" is a single fs with no dirty blocks and... --> for this one, the sync(2) would just slow it down, by going through all the other fs's... rick From owner-svn-src-head@FreeBSD.ORG Mon May 30 19:41:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 763F5106566B; Mon, 30 May 2011 19:41:29 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BFA28FC13; Mon, 30 May 2011 19:41:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UJfTKA090733; Mon, 30 May 2011 19:41:29 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UJfTm6090727; Mon, 30 May 2011 19:41:29 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201105301941.p4UJfTm6090727@svn.freebsd.org> From: Steve Kargl Date: Mon, 30 May 2011 19:41:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222508 - in head/lib/msun: ld128 ld80 src X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 19:41:29 -0000 Author: kargl Date: Mon May 30 19:41:28 2011 New Revision: 222508 URL: http://svn.freebsd.org/changeset/base/222508 Log: Clean up the unneeded cpp macro INLINE_REM_PIO2L. Reviewed by: das Approved by: das (mentor) Modified: head/lib/msun/ld128/e_rem_pio2l.h head/lib/msun/ld80/e_rem_pio2l.h head/lib/msun/src/s_cosl.c head/lib/msun/src/s_sinl.c head/lib/msun/src/s_tanl.c Modified: head/lib/msun/ld128/e_rem_pio2l.h ============================================================================== --- head/lib/msun/ld128/e_rem_pio2l.h Mon May 30 19:16:58 2011 (r222507) +++ head/lib/msun/ld128/e_rem_pio2l.h Mon May 30 19:41:28 2011 (r222508) @@ -58,10 +58,7 @@ pio2_2t = 2.067032109826398823649690305 pio2_3 = 2.0670321098263988236499468110329591e-43L, /* 0x127044533e63a0105e00000000000.0p-254 */ pio2_3t = -2.5650587247459238361625433492959285e-65L; /* -0x159c4ec64ddaeb5f78671cbfb2210.0p-327 */ -#ifdef INLINE_REM_PIO2L -static inline __always_inline -#endif -int +static inline __always_inline int __ieee754_rem_pio2l(long double x, long double *y) { union IEEEl2bits u,u1; Modified: head/lib/msun/ld80/e_rem_pio2l.h ============================================================================== --- head/lib/msun/ld80/e_rem_pio2l.h Mon May 30 19:16:58 2011 (r222507) +++ head/lib/msun/ld80/e_rem_pio2l.h Mon May 30 19:41:28 2011 (r222508) @@ -70,10 +70,7 @@ pio2_2t = 6.36831716351095013979e-25L, pio2_3t = -2.75299651904407171810e-37L; /* -0xbb5bf6c7ddd660ce.0p-185 */ #endif -#ifdef INLINE_REM_PIO2L -static inline __always_inline -#endif -int +static inline __always_inline int __ieee754_rem_pio2l(long double x, long double *y) { union IEEEl2bits u,u1; Modified: head/lib/msun/src/s_cosl.c ============================================================================== --- head/lib/msun/src/s_cosl.c Mon May 30 19:16:58 2011 (r222507) +++ head/lib/msun/src/s_cosl.c Mon May 30 19:41:28 2011 (r222508) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include "math.h" -#define INLINE_REM_PIO2L #include "math_private.h" #if LDBL_MANT_DIG == 64 #include "../ld80/e_rem_pio2l.h" Modified: head/lib/msun/src/s_sinl.c ============================================================================== --- head/lib/msun/src/s_sinl.c Mon May 30 19:16:58 2011 (r222507) +++ head/lib/msun/src/s_sinl.c Mon May 30 19:41:28 2011 (r222508) @@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$"); #include #include "math.h" -#define INLINE_REM_PIO2L #include "math_private.h" #if LDBL_MANT_DIG == 64 #include "../ld80/e_rem_pio2l.h" Modified: head/lib/msun/src/s_tanl.c ============================================================================== --- head/lib/msun/src/s_tanl.c Mon May 30 19:16:58 2011 (r222507) +++ head/lib/msun/src/s_tanl.c Mon May 30 19:41:28 2011 (r222508) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include "math.h" -#define INLINE_REM_PIO2L #include "math_private.h" #if LDBL_MANT_DIG == 64 #include "../ld80/e_rem_pio2l.h" From owner-svn-src-head@FreeBSD.ORG Mon May 30 21:07:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1FAE1065674; Mon, 30 May 2011 21:07:26 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF64C8FC08; Mon, 30 May 2011 21:07: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 p4UL7QFq093281; Mon, 30 May 2011 21:07:26 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UL7QPB093269; Mon, 30 May 2011 21:07:26 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201105302107.p4UL7QPB093269@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 30 May 2011 21:07:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222509 - in head/sys: conf dev/cxgbe dev/cxgbe/common modules/cxgbe/if_cxgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 21:07:26 -0000 Author: np Date: Mon May 30 21:07:26 2011 New Revision: 222509 URL: http://svn.freebsd.org/changeset/base/222509 Log: L2 table code. This is enough to get the T4's switch + L2 rewrite filters working. (All other filters - switch without L2 info rewrite, steer, and drop - were already fully-functional). Some contrived examples of "switch" filters with L2 rewriting: # cxgbetool t4nex0 iport 0 dport 80 action switch vlan +9 eport 3 Intercept all packets received on physical port 0 with TCP port 80 as destination, insert a vlan tag with VID 9, and send them out of port 3. # cxgbetool t4nex0 sip 192.168.1.1/32 ivlan 5 action switch \ vlan =9 smac aa:bb:cc:dd:ee:ff eport 0 Intercept all packets (received on any port) with source IP address 192.168.1.1 and VLAN id 5, rewrite the VLAN id to 9, rewrite source mac to aa:bb:cc:dd:ee:ff, and send it out of port 0. MFC after: 1 week Added: head/sys/dev/cxgbe/common/jhash.h (contents, props changed) head/sys/dev/cxgbe/t4_l2t.c (contents, props changed) head/sys/dev/cxgbe/t4_l2t.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/osdep.h head/sys/dev/cxgbe/t4_ioctl.h head/sys/dev/cxgbe/t4_main.c head/sys/modules/cxgbe/if_cxgbe/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon May 30 19:41:28 2011 (r222508) +++ head/sys/conf/files Mon May 30 21:07:26 2011 (r222509) @@ -917,6 +917,8 @@ dev/cxgbe/t4_main.c optional cxgbe pci compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_sge.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" +dev/cxgbe/t4_l2t.c optional cxgbe pci \ + compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/common/t4_hw.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cy/cy.c optional cy Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Mon May 30 19:41:28 2011 (r222508) +++ head/sys/dev/cxgbe/adapter.h Mon May 30 21:07:26 2011 (r222509) @@ -445,6 +445,7 @@ struct adapter { struct port_info *port[MAX_NPORTS]; uint8_t chan_map[NCHAN]; + struct l2t_data *l2t; /* L2 table */ struct tid_info tids; int registered_device_map; Added: head/sys/dev/cxgbe/common/jhash.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/common/jhash.h Mon May 30 21:07:26 2011 (r222509) @@ -0,0 +1,140 @@ +#ifndef _JHASH_H +#define _JHASH_H + +/* jhash.h: Jenkins hash support. + * + * Copyright (C) 1996 Bob Jenkins (bob_jenkins@burtleburtle.net) + * + * http://burtleburtle.net/bob/hash/ + * + * These are the credits from Bob's sources: + * + * lookup2.c, by Bob Jenkins, December 1996, Public Domain. + * hash(), hash2(), hash3, and mix() are externally useful functions. + * Routines to test the hash are included if SELF_TEST is defined. + * You can use this free for any purpose. It has no warranty. + * + * $FreeBSD$ + */ + +/* NOTE: Arguments are modified. */ +#define __jhash_mix(a, b, c) \ +{ \ + a -= b; a -= c; a ^= (c>>13); \ + b -= c; b -= a; b ^= (a<<8); \ + c -= a; c -= b; c ^= (b>>13); \ + a -= b; a -= c; a ^= (c>>12); \ + b -= c; b -= a; b ^= (a<<16); \ + c -= a; c -= b; c ^= (b>>5); \ + a -= b; a -= c; a ^= (c>>3); \ + b -= c; b -= a; b ^= (a<<10); \ + c -= a; c -= b; c ^= (b>>15); \ +} + +/* The golden ration: an arbitrary value */ +#define JHASH_GOLDEN_RATIO 0x9e3779b9 + +/* The most generic version, hashes an arbitrary sequence + * of bytes. No alignment or length assumptions are made about + * the input key. + */ +static inline u32 jhash(const void *key, u32 length, u32 initval) +{ + u32 a, b, c, len; + const u8 *k = key; + + len = length; + a = b = JHASH_GOLDEN_RATIO; + c = initval; + + while (len >= 12) { + a += (k[0] +((u32)k[1]<<8) +((u32)k[2]<<16) +((u32)k[3]<<24)); + b += (k[4] +((u32)k[5]<<8) +((u32)k[6]<<16) +((u32)k[7]<<24)); + c += (k[8] +((u32)k[9]<<8) +((u32)k[10]<<16)+((u32)k[11]<<24)); + + __jhash_mix(a,b,c); + + k += 12; + len -= 12; + } + + c += length; + switch (len) { + case 11: c += ((u32)k[10]<<24); + case 10: c += ((u32)k[9]<<16); + case 9 : c += ((u32)k[8]<<8); + case 8 : b += ((u32)k[7]<<24); + case 7 : b += ((u32)k[6]<<16); + case 6 : b += ((u32)k[5]<<8); + case 5 : b += k[4]; + case 4 : a += ((u32)k[3]<<24); + case 3 : a += ((u32)k[2]<<16); + case 2 : a += ((u32)k[1]<<8); + case 1 : a += k[0]; + }; + + __jhash_mix(a,b,c); + + return c; +} + +/* A special optimized version that handles 1 or more of u32s. + * The length parameter here is the number of u32s in the key. + */ +static inline u32 jhash2(u32 *k, u32 length, u32 initval) +{ + u32 a, b, c, len; + + a = b = JHASH_GOLDEN_RATIO; + c = initval; + len = length; + + while (len >= 3) { + a += k[0]; + b += k[1]; + c += k[2]; + __jhash_mix(a, b, c); + k += 3; len -= 3; + } + + c += length * 4; + + switch (len) { + case 2 : b += k[1]; + case 1 : a += k[0]; + }; + + __jhash_mix(a,b,c); + + return c; +} + + +/* A special ultra-optimized versions that knows they are hashing exactly + * 3, 2 or 1 word(s). + * + * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally + * done at the end is not done here. + */ +static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) +{ + a += JHASH_GOLDEN_RATIO; + b += JHASH_GOLDEN_RATIO; + c += initval; + + __jhash_mix(a, b, c); + + return c; +} + +static inline u32 jhash_2words(u32 a, u32 b, u32 initval) +{ + return jhash_3words(a, b, 0, initval); +} + +static inline u32 jhash_1word(u32 a, u32 initval) +{ + return jhash_3words(a, 0, 0, initval); +} + +#endif /* _JHASH_H */ Modified: head/sys/dev/cxgbe/offload.h ============================================================================== --- head/sys/dev/cxgbe/offload.h Mon May 30 19:41:28 2011 (r222508) +++ head/sys/dev/cxgbe/offload.h Mon May 30 21:07:26 2011 (r222509) @@ -31,6 +31,24 @@ #ifndef __T4_OFFLOAD_H__ #define __T4_OFFLOAD_H__ +/* CPL message priority levels */ +enum { + CPL_PRIORITY_DATA = 0, /* data messages */ + CPL_PRIORITY_SETUP = 1, /* connection setup messages */ + CPL_PRIORITY_TEARDOWN = 0, /* connection teardown messages */ + CPL_PRIORITY_LISTEN = 1, /* listen start/stop messages */ + CPL_PRIORITY_ACK = 1, /* RX ACK messages */ + CPL_PRIORITY_CONTROL = 1 /* control messages */ +}; + +#define INIT_TP_WR(w, tid) do { \ + (w)->wr.wr_hi = htonl(V_FW_WR_OP(FW_TP_WR) | \ + V_FW_WR_IMMDLEN(sizeof(*w) - sizeof(w->wr))); \ + (w)->wr.wr_mid = htonl(V_FW_WR_LEN16(DIV_ROUND_UP(sizeof(*w), 16)) | \ + V_FW_WR_FLOWID(tid)); \ + (w)->wr.wr_lo = cpu_to_be64(0); \ +} while (0) + /* * Max # of ATIDs. The absolute HW max is 16K but we keep it lower. */ Modified: head/sys/dev/cxgbe/osdep.h ============================================================================== --- head/sys/dev/cxgbe/osdep.h Mon May 30 19:41:28 2011 (r222508) +++ head/sys/dev/cxgbe/osdep.h Mon May 30 21:07:26 2011 (r222509) @@ -82,6 +82,7 @@ typedef boolean_t bool; #define DIV_ROUND_UP(x, y) howmany(x, y) #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#define container_of(p, s, f) ((s *)(((uint8_t *)(p)) - offsetof(s, f))) #define swab16(x) bswap16(x) #define swab32(x) bswap32(x) Modified: head/sys/dev/cxgbe/t4_ioctl.h ============================================================================== --- head/sys/dev/cxgbe/t4_ioctl.h Mon May 30 19:41:28 2011 (r222508) +++ head/sys/dev/cxgbe/t4_ioctl.h Mon May 30 21:07:26 2011 (r222509) @@ -178,6 +178,8 @@ struct t4_filter_specification { struct t4_filter { uint32_t idx; + uint16_t l2tidx; + uint16_t smtidx; uint64_t hits; struct t4_filter_specification fs; }; Added: head/sys/dev/cxgbe/t4_l2t.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/t4_l2t.c Mon May 30 21:07:26 2011 (r222509) @@ -0,0 +1,361 @@ +/*- + * Copyright (c) 2011 Chelsio Communications, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common/common.h" +#include "common/jhash.h" +#include "common/t4_msg.h" +#include "offload.h" +#include "t4_l2t.h" + +/* identifies sync vs async L2T_WRITE_REQs */ +#define S_SYNC_WR 12 +#define V_SYNC_WR(x) ((x) << S_SYNC_WR) +#define F_SYNC_WR V_SYNC_WR(1) + +enum { + L2T_STATE_VALID, /* entry is up to date */ + L2T_STATE_STALE, /* entry may be used but needs revalidation */ + L2T_STATE_RESOLVING, /* entry needs address resolution */ + L2T_STATE_SYNC_WRITE, /* synchronous write of entry underway */ + + /* when state is one of the below the entry is not hashed */ + L2T_STATE_SWITCHING, /* entry is being used by a switching filter */ + L2T_STATE_UNUSED /* entry not in use */ +}; + +struct l2t_data { + struct rwlock lock; + volatile int nfree; /* number of free entries */ + struct l2t_entry *rover;/* starting point for next allocation */ + struct l2t_entry l2tab[L2T_SIZE]; +}; + +/* + * Module locking notes: There is a RW lock protecting the L2 table as a + * whole plus a spinlock per L2T entry. Entry lookups and allocations happen + * under the protection of the table lock, individual entry changes happen + * while holding that entry's spinlock. The table lock nests outside the + * entry locks. Allocations of new entries take the table lock as writers so + * no other lookups can happen while allocating new entries. Entry updates + * take the table lock as readers so multiple entries can be updated in + * parallel. An L2T entry can be dropped by decrementing its reference count + * and therefore can happen in parallel with entry allocation but no entry + * can change state or increment its ref count during allocation as both of + * these perform lookups. + * + * Note: We do not take refereces to ifnets in this module because both + * the TOE and the sockets already hold references to the interfaces and the + * lifetime of an L2T entry is fully contained in the lifetime of the TOE. + */ +static inline unsigned int +vlan_prio(const struct l2t_entry *e) +{ + return e->vlan >> 13; +} + +static inline void +l2t_hold(struct l2t_data *d, struct l2t_entry *e) +{ + if (atomic_fetchadd_int(&e->refcnt, 1) == 0) /* 0 -> 1 transition */ + atomic_add_int(&d->nfree, -1); +} + +/* + * To avoid having to check address families we do not allow v4 and v6 + * neighbors to be on the same hash chain. We keep v4 entries in the first + * half of available hash buckets and v6 in the second. + */ +enum { + L2T_SZ_HALF = L2T_SIZE / 2, + L2T_HASH_MASK = L2T_SZ_HALF - 1 +}; + +static inline unsigned int +arp_hash(const uint32_t *key, int ifindex) +{ + return jhash_2words(*key, ifindex, 0) & L2T_HASH_MASK; +} + +static inline unsigned int +ipv6_hash(const uint32_t *key, int ifindex) +{ + uint32_t xor = key[0] ^ key[1] ^ key[2] ^ key[3]; + + return L2T_SZ_HALF + (jhash_2words(xor, ifindex, 0) & L2T_HASH_MASK); +} + +static inline unsigned int +addr_hash(const uint32_t *addr, int addr_len, int ifindex) +{ + return addr_len == 4 ? arp_hash(addr, ifindex) : + ipv6_hash(addr, ifindex); +} + +/* + * Checks if an L2T entry is for the given IP/IPv6 address. It does not check + * whether the L2T entry and the address are of the same address family. + * Callers ensure an address is only checked against L2T entries of the same + * family, something made trivial by the separation of IP and IPv6 hash chains + * mentioned above. Returns 0 if there's a match, + */ +static inline int +addreq(const struct l2t_entry *e, const uint32_t *addr) +{ + if (e->v6) + return (e->addr[0] ^ addr[0]) | (e->addr[1] ^ addr[1]) | + (e->addr[2] ^ addr[2]) | (e->addr[3] ^ addr[3]); + return e->addr[0] ^ addr[0]; +} + +/* + * Write an L2T entry. Must be called with the entry locked (XXX: really?). + * The write may be synchronous or asynchronous. + */ +static int +write_l2e(struct adapter *sc, struct l2t_entry *e, int sync) +{ + struct mbuf *m; + struct cpl_l2t_write_req *req; + + if ((m = m_gethdr(M_NOWAIT, MT_DATA)) == NULL) + return (ENOMEM); + + req = mtod(m, struct cpl_l2t_write_req *); + m->m_pkthdr.len = m->m_len = sizeof(*req); + + INIT_TP_WR(req, 0); + OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, e->idx | + V_SYNC_WR(sync) | V_TID_QID(sc->sge.fwq.abs_id))); + req->params = htons(V_L2T_W_PORT(e->lport) | V_L2T_W_NOREPLY(!sync)); + req->l2t_idx = htons(e->idx); + req->vlan = htons(e->vlan); + memcpy(req->dst_mac, e->dmac, sizeof(req->dst_mac)); + + t4_mgmt_tx(sc, m); + + if (sync && e->state != L2T_STATE_SWITCHING) + e->state = L2T_STATE_SYNC_WRITE; + + return (0); +} + +/* + * Add a packet to an L2T entry's queue of packets awaiting resolution. + * Must be called with the entry's lock held. + */ +static inline void +arpq_enqueue(struct l2t_entry *e, struct mbuf *m) +{ + mtx_assert(&e->lock, MA_OWNED); + + m->m_next = NULL; + if (e->arpq_head) + e->arpq_tail->m_next = m; + else + e->arpq_head = m; + e->arpq_tail = m; +} + +/* + * Allocate a free L2T entry. Must be called with l2t_data.lock held. + */ +static struct l2t_entry * +alloc_l2e(struct l2t_data *d) +{ + struct l2t_entry *end, *e, **p; + + rw_assert(&d->lock, RA_WLOCKED); + + if (!atomic_load_acq_int(&d->nfree)) + return (NULL); + + /* there's definitely a free entry */ + for (e = d->rover, end = &d->l2tab[L2T_SIZE]; e != end; ++e) + if (atomic_load_acq_int(&e->refcnt) == 0) + goto found; + + for (e = d->l2tab; atomic_load_acq_int(&e->refcnt); ++e) ; +found: + d->rover = e + 1; + atomic_add_int(&d->nfree, -1); + + /* + * The entry we found may be an inactive entry that is + * presently in the hash table. We need to remove it. + */ + if (e->state < L2T_STATE_SWITCHING) { + for (p = &d->l2tab[e->hash].first; *p; p = &(*p)->next) { + if (*p == e) { + *p = e->next; + e->next = NULL; + break; + } + } + } + + e->state = L2T_STATE_UNUSED; + return e; +} + +/* + * Called when an L2T entry has no more users. The entry is left in the hash + * table since it is likely to be reused but we also bump nfree to indicate + * that the entry can be reallocated for a different neighbor. We also drop + * the existing neighbor reference in case the neighbor is going away and is + * waiting on our reference. + * + * Because entries can be reallocated to other neighbors once their ref count + * drops to 0 we need to take the entry's lock to avoid races with a new + * incarnation. + */ +static void +t4_l2e_free(struct l2t_entry *e) +{ + struct llentry *lle = NULL; + struct l2t_data *d; + + mtx_lock(&e->lock); + if (atomic_load_acq_int(&e->refcnt) == 0) { /* hasn't been recycled */ + lle = e->lle; + e->lle = NULL; + /* + * Don't need to worry about the arpq, an L2T entry can't be + * released if any packets are waiting for resolution as we + * need to be able to communicate with the device to close a + * connection. + */ + } + mtx_unlock(&e->lock); + + d = container_of(e, struct l2t_data, l2tab[e->idx]); + atomic_add_int(&d->nfree, 1); + + if (lle) + LLE_FREE(lle); +} + +void +t4_l2t_release(struct l2t_entry *e) +{ + if (atomic_fetchadd_int(&e->refcnt, -1) == 1) + t4_l2e_free(e); +} + +/* + * Allocate an L2T entry for use by a switching rule. Such need to be + * explicitly freed and while busy they are not on any hash chain, so normal + * address resolution updates do not see them. + */ +struct l2t_entry * +t4_l2t_alloc_switching(struct l2t_data *d) +{ + struct l2t_entry *e; + + rw_rlock(&d->lock); + e = alloc_l2e(d); + if (e) { + mtx_lock(&e->lock); /* avoid race with t4_l2t_free */ + e->state = L2T_STATE_SWITCHING; + atomic_store_rel_int(&e->refcnt, 1); + mtx_unlock(&e->lock); + } + rw_runlock(&d->lock); + return e; +} + +/* + * Sets/updates the contents of a switching L2T entry that has been allocated + * with an earlier call to @t4_l2t_alloc_switching. + */ +int +t4_l2t_set_switching(struct adapter *sc, struct l2t_entry *e, uint16_t vlan, + uint8_t port, uint8_t *eth_addr) +{ + e->vlan = vlan; + e->lport = port; + memcpy(e->dmac, eth_addr, ETHER_ADDR_LEN); + return write_l2e(sc, e, 0); +} + +struct l2t_data * +t4_init_l2t(int flags) +{ + int i; + struct l2t_data *d; + + d = malloc(sizeof(*d), M_CXGBE, M_ZERO | flags); + if (!d) + return (NULL); + + d->rover = d->l2tab; + atomic_store_rel_int(&d->nfree, L2T_SIZE); + rw_init(&d->lock, "L2T"); + + for (i = 0; i < L2T_SIZE; i++) { + d->l2tab[i].idx = i; + d->l2tab[i].state = L2T_STATE_UNUSED; + mtx_init(&d->l2tab[i].lock, "L2T_E", NULL, MTX_DEF); + atomic_store_rel_int(&d->l2tab[i].refcnt, 0); + } + + return (d); +} + +int +t4_free_l2t(struct l2t_data *d) +{ + int i; + + for (i = 0; i < L2T_SIZE; i++) + mtx_destroy(&d->l2tab[i].lock); + rw_destroy(&d->lock); + free(d, M_CXGBE); + + return (0); +} Added: head/sys/dev/cxgbe/t4_l2t.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/t4_l2t.h Mon May 30 21:07:26 2011 (r222509) @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2011 Chelsio Communications, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#ifndef __T4_L2T_H +#define __T4_L2T_H + +enum { L2T_SIZE = 4096 }; /* # of L2T entries */ + +/* + * Each L2T entry plays multiple roles. First of all, it keeps state for the + * corresponding entry of the HW L2 table and maintains a queue of offload + * packets awaiting address resolution. Second, it is a node of a hash table + * chain, where the nodes of the chain are linked together through their next + * pointer. Finally, each node is a bucket of a hash table, pointing to the + * first element in its chain through its first pointer. + */ +struct l2t_entry { + uint16_t state; /* entry state */ + uint16_t idx; /* entry index */ + uint32_t addr[4]; /* next hop IP or IPv6 address */ + struct ifnet *ifp; /* outgoing interface */ + uint16_t smt_idx; /* SMT index */ + uint16_t vlan; /* VLAN TCI (id: 0-11, prio: 13-15) */ + int ifindex; /* interface index */ + struct llentry *lle; /* llentry for next hop */ + struct l2t_entry *first; /* start of hash chain */ + struct l2t_entry *next; /* next l2t_entry on chain */ + struct mbuf *arpq_head; /* list of mbufs awaiting resolution */ + struct mbuf *arpq_tail; + struct mtx lock; + volatile uint32_t refcnt; /* entry reference count */ + uint16_t hash; /* hash bucket the entry is on */ + uint8_t v6; /* whether entry is for IPv6 */ + uint8_t lport; /* associated offload logical port */ + uint8_t dmac[ETHER_ADDR_LEN]; /* next hop's MAC address */ +}; + +struct l2t_data *t4_init_l2t(int); +int t4_free_l2t(struct l2t_data *); +struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *); +int t4_l2t_set_switching(struct adapter *, struct l2t_entry *, uint16_t, + uint8_t, uint8_t *); +void t4_l2t_release(struct l2t_entry *); + +#endif /* __T4_L2T_H */ Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Mon May 30 19:41:28 2011 (r222508) +++ head/sys/dev/cxgbe/t4_main.c Mon May 30 21:07:26 2011 (r222509) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include "common/t4_regs_values.h" #include "common/t4fw_interface.h" #include "t4_ioctl.h" +#include "t4_l2t.h" /* T4 bus driver interface */ static int t4_probe(device_t); @@ -240,6 +241,7 @@ struct filter_entry { uint32_t locked:1; /* filter is administratively locked */ uint32_t pending:1; /* filter action is pending firmware reply */ uint32_t smtidx:8; /* Source MAC Table index for smac */ + struct l2t_entry *l2t; /* Layer Two Table entry for dmac */ struct t4_filter_specification fs; }; @@ -304,7 +306,7 @@ static int set_filter_mode(struct adapte static int get_filter(struct adapter *, struct t4_filter *); static int set_filter(struct adapter *, struct t4_filter *); static int del_filter(struct adapter *, struct t4_filter *); -static void clear_filter(struct adapter *, struct filter_entry *); +static void clear_filter(struct filter_entry *); static int set_filter_wr(struct adapter *, int); static int del_filter_wr(struct adapter *, int); void filter_rpl(struct adapter *, const struct cpl_set_tcb_rpl *); @@ -604,6 +606,8 @@ t4_attach(device_t dev) sc->irq = malloc(sc->intr_count * sizeof(struct irq), M_CXGBE, M_ZERO | M_WAITOK); + sc->l2t = t4_init_l2t(M_WAITOK); + t4_sysctls(sc); /* @@ -691,6 +695,9 @@ t4_detach(device_t dev) bus_release_resource(dev, SYS_RES_MEMORY, sc->msix_rid, sc->msix_res); + if (sc->l2t) + t4_free_l2t(sc->l2t); + free(sc->irq, M_CXGBE); free(sc->sge.rxq, M_CXGBE); free(sc->sge.txq, M_CXGBE); @@ -2913,8 +2920,10 @@ get_filter(struct adapter *sc, struct t4 for (i = t->idx; i < nfilters; i++, f++) { if (f->valid) { t->idx = i; - t->fs = f->fs; + t->l2tidx = f->l2t ? f->l2t->idx : 0; + t->smtidx = f->smtidx; t->hits = 0; /* XXX implement */ + t->fs = f->fs; return (0); } @@ -3034,11 +3043,12 @@ del_filter(struct adapter *sc, struct t4 return (0); } -/* XXX: L2T */ static void -clear_filter(struct adapter *sc, struct filter_entry *f) +clear_filter(struct filter_entry *f) { - (void) sc; + if (f->l2t) + t4_l2t_release(f->l2t); + bzero(f, sizeof (*f)); } @@ -3053,8 +3063,18 @@ set_filter_wr(struct adapter *sc, int fi ADAPTER_LOCK_ASSERT_OWNED(sc); - if (f->fs.newdmac || f->fs.newvlan) - return (ENOTSUP); /* XXX: fix after L2T code */ + if (f->fs.newdmac || f->fs.newvlan) { + /* This filter needs an L2T entry; allocate one. */ + f->l2t = t4_l2t_alloc_switching(sc->l2t); + if (f->l2t == NULL) + return (EAGAIN); + if (t4_l2t_set_switching(sc, f->l2t, f->fs.vlan, f->fs.eport, + f->fs.dmac)) { + t4_l2t_release(f->l2t); + f->l2t = NULL; + return (ENOMEM); + } + } ftid = sc->tids.ftid_base + fidx; @@ -3089,7 +3109,7 @@ set_filter_wr(struct adapter *sc, int fi V_FW_FILTER_WR_HITCNTS(f->fs.hitcnts) | V_FW_FILTER_WR_TXCHAN(f->fs.eport) | V_FW_FILTER_WR_PRIO(f->fs.prio) | - V_FW_FILTER_WR_L2TIX(0)); /* XXX: L2T */ + V_FW_FILTER_WR_L2TIX(f->l2t ? f->l2t->idx : 0)); fwr->ethtype = htobe16(f->fs.val.ethtype); fwr->ethtypem = htobe16(f->fs.mask.ethtype); fwr->frag_to_ovlan_vldm = @@ -3136,7 +3156,7 @@ set_filter_wr(struct adapter *sc, int fi if (rc != 0) { sc->tids.ftids_in_use--; m_freem(m); - clear_filter(sc, f); + clear_filter(f); } return (rc); } @@ -3188,12 +3208,12 @@ filter_rpl(struct adapter *sc, const str * Clear the filter when we get confirmation from the * hardware that the filter has been deleted. */ - clear_filter(sc, f); + clear_filter(f); sc->tids.ftids_in_use--; } else if (rc == FW_FILTER_WR_SMT_TBL_FULL) { device_printf(sc->dev, "filter %u setup failed due to full SMT\n", idx); - clear_filter(sc, f); + clear_filter(f); sc->tids.ftids_in_use--; } else if (rc == FW_FILTER_WR_FLT_ADDED) { f->smtidx = (be64toh(rpl->oldval) >> 24) & 0xff; @@ -3206,7 +3226,7 @@ filter_rpl(struct adapter *sc, const str */ device_printf(sc->dev, "filter %u setup failed with error %u\n", idx, rc); - clear_filter(sc, f); + clear_filter(f); sc->tids.ftids_in_use--; } } Modified: head/sys/modules/cxgbe/if_cxgbe/Makefile ============================================================================== --- head/sys/modules/cxgbe/if_cxgbe/Makefile Mon May 30 19:41:28 2011 (r222508) +++ head/sys/modules/cxgbe/if_cxgbe/Makefile Mon May 30 21:07:26 2011 (r222509) @@ -6,7 +6,7 @@ CXGBE = ${.CURDIR}/../../../dev/cxgbe .PATH: ${CXGBE} ${CXGBE}/common KMOD = if_cxgbe -SRCS = t4_main.c t4_sge.c +SRCS = t4_main.c t4_sge.c t4_l2t.c SRCS+= t4_hw.c SRCS+= device_if.h bus_if.h pci_if.h SRCS+= opt_inet.h From owner-svn-src-head@FreeBSD.ORG Mon May 30 21:34:44 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 842641065673; Mon, 30 May 2011 21:34:44 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 725518FC18; Mon, 30 May 2011 21:34:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ULYiWR094117; Mon, 30 May 2011 21:34:44 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ULYigj094113; Mon, 30 May 2011 21:34:44 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201105302134.p4ULYigj094113@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 30 May 2011 21:34:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222510 - head/sys/dev/cxgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 21:34:44 -0000 Author: np Date: Mon May 30 21:34:44 2011 New Revision: 222510 URL: http://svn.freebsd.org/changeset/base/222510 Log: - Specialized ingress queues that take interrupts for other ingress queues. Try to have a set of these per port when possible, fall back to sharing a common pool between all ports otherwise. - One control queue per port (used to be one per hardware channel). - t4_eth_rx now handles Ethernet rx only. - sysctls to display pidx/cidx for some queues. MFC after: 1 week Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Mon May 30 21:07:26 2011 (r222509) +++ head/sys/dev/cxgbe/adapter.h Mon May 30 21:34:44 2011 (r222510) @@ -110,6 +110,9 @@ enum { FW_IQ_QSIZE = 256, FW_IQ_ESIZE = 64, /* At least 64 mandated by the firmware spec */ + INTR_IQ_QSIZE = 64, + INTR_IQ_ESIZE = 64, /* Handles some CPLs too, do not reduce */ + CTRL_EQ_QSIZE = 128, CTRL_EQ_ESIZE = 64, @@ -141,7 +144,7 @@ enum { /* adapter flags */ FULL_INIT_DONE = (1 << 0), FW_OK = (1 << 1), - INTR_FWD = (1 << 2), + INTR_SHARED = (1 << 2), /* one set of intrq's for all ports */ CXGBE_BUSY = (1 << 9), @@ -384,12 +387,10 @@ struct sge_ctrlq { /* stats for common events first */ - uint64_t total_wrs; /* # of work requests sent down this queue */ /* stats for not-that-common events */ uint32_t no_desc; /* out of hardware descriptors */ - uint32_t too_long; /* WR longer than hardware max */ } __aligned(CACHE_LINE_SIZE); struct sge { @@ -403,7 +404,7 @@ struct sge { struct sge_iq fwq; /* Firmware event queue */ struct sge_ctrlq *ctrlq;/* Control queues */ - struct sge_iq *fiq; /* Forwarded interrupt queues (INTR_FWD) */ + struct sge_iq *intrq; /* Interrupt queues */ struct sge_txq *txq; /* NIC tx queues */ struct sge_rxq *rxq; /* NIC rx queues */ @@ -457,7 +458,9 @@ struct adapter { struct t4_virt_res vres; struct sysctl_ctx_list ctx; /* from first_port_up to last_port_down */ + struct sysctl_oid *oid_fwq; struct sysctl_oid *oid_ctrlq; + struct sysctl_oid *oid_intrq; struct mtx sc_lock; char lockname[16]; @@ -503,7 +506,10 @@ struct adapter { rxq = &pi->adapter->sge.rxq[pi->first_rxq]; \ for (iter = 0; iter < pi->nrxq; ++iter, ++rxq) -#define NFIQ(sc) ((sc)->intr_count > 1 ? (sc)->intr_count - 1 : 1) +/* One for errors, one for firmware events */ +#define T4_EXTRA_INTR 2 +#define NINTRQ(sc) ((sc)->intr_count > T4_EXTRA_INTR ? \ + (sc)->intr_count - T4_EXTRA_INTR : 1) static inline uint32_t t4_read_reg(struct adapter *sc, uint32_t reg) @@ -600,12 +606,9 @@ int t4_teardown_adapter_queues(struct ad int t4_setup_eth_queues(struct port_info *); int t4_teardown_eth_queues(struct port_info *); void t4_intr_all(void *); -void t4_intr_fwd(void *); +void t4_intr(void *); void t4_intr_err(void *); void t4_intr_evt(void *); -void t4_intr_data(void *); -void t4_evt_rx(void *); -void t4_eth_rx(void *); int t4_mgmt_tx(struct adapter *, struct mbuf *); int t4_eth_tx(struct ifnet *, struct sge_txq *, struct mbuf *); void t4_update_fl_bufsize(struct ifnet *); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Mon May 30 21:07:26 2011 (r222509) +++ head/sys/dev/cxgbe/t4_main.c Mon May 30 21:34:44 2011 (r222510) @@ -214,12 +214,12 @@ SYSCTL_UINT(_hw_cxgbe, OID_AUTO, interru "interrupt types allowed (bits 0, 1, 2 = INTx, MSI, MSI-X respectively)"); /* - * Force the driver to use interrupt forwarding. + * Force the driver to use the same set of interrupts for all ports. */ -static int intr_fwd = 0; -TUNABLE_INT("hw.cxgbe.interrupt_forwarding", &intr_fwd); -SYSCTL_UINT(_hw_cxgbe, OID_AUTO, interrupt_forwarding, CTLFLAG_RDTUN, - &intr_fwd, 0, "always use forwarded interrupts"); +static int intr_shared = 0; +TUNABLE_INT("hw.cxgbe.interrupts_shared", &intr_shared); +SYSCTL_UINT(_hw_cxgbe, OID_AUTO, interrupts_shared, CTLFLAG_RDTUN, + &intr_shared, 0, "interrupts shared between all ports"); static unsigned int filter_mode = HW_TPL_FR_MT_PR_IV_P_FC; TUNABLE_INT("hw.cxgbe.filter_mode", &filter_mode); @@ -229,7 +229,7 @@ SYSCTL_UINT(_hw_cxgbe, OID_AUTO, filter_ struct intrs_and_queues { int intr_type; /* INTx, MSI, or MSI-X */ int nirq; /* Number of vectors */ - int intr_fwd; /* Interrupts forwarded */ + int intr_shared; /* Interrupts shared between all ports */ int ntxq10g; /* # of NIC txq's for each 10G port */ int nrxq10g; /* # of NIC rxq's for each 10G port */ int ntxq1g; /* # of NIC txq's for each 1G port */ @@ -516,8 +516,8 @@ t4_attach(device_t dev) device_printf(dev, "unable to initialize port %d: %d\n", i, rc); free(pi, M_CXGBE); - sc->port[i] = NULL; /* indicates init failed */ - continue; + sc->port[i] = NULL; + goto done; } snprintf(pi->lockname, sizeof(pi->lockname), "%sp%d", @@ -584,15 +584,15 @@ t4_attach(device_t dev) s->nrxq = n10g * iaq.nrxq10g + n1g * iaq.nrxq1g; s->ntxq = n10g * iaq.ntxq10g + n1g * iaq.ntxq1g; s->neq = s->ntxq + s->nrxq; /* the free list in an rxq is an eq */ - s->neq += NCHAN; /* control queues, 1 per hw channel */ + s->neq += sc->params.nports; /* control queues, 1 per port */ s->niq = s->nrxq + 1; /* 1 extra for firmware event queue */ - if (iaq.intr_fwd) { - sc->flags |= INTR_FWD; - s->niq += NFIQ(sc); /* forwarded interrupt queues */ - s->fiq = malloc(NFIQ(sc) * sizeof(struct sge_iq), M_CXGBE, - M_ZERO | M_WAITOK); - } - s->ctrlq = malloc(NCHAN * sizeof(struct sge_ctrlq), M_CXGBE, + if (iaq.intr_shared) + sc->flags |= INTR_SHARED; + s->niq += NINTRQ(sc); /* interrupt queues */ + + s->intrq = malloc(NINTRQ(sc) * sizeof(struct sge_iq), M_CXGBE, + M_ZERO | M_WAITOK); + s->ctrlq = malloc(sc->params.nports * sizeof(struct sge_ctrlq), M_CXGBE, M_ZERO | M_WAITOK); s->rxq = malloc(s->nrxq * sizeof(struct sge_rxq), M_CXGBE, M_ZERO | M_WAITOK); @@ -702,7 +702,7 @@ t4_detach(device_t dev) free(sc->sge.rxq, M_CXGBE); free(sc->sge.txq, M_CXGBE); free(sc->sge.ctrlq, M_CXGBE); - free(sc->sge.fiq, M_CXGBE); + free(sc->sge.intrq, M_CXGBE); free(sc->sge.iqmap, M_CXGBE); free(sc->sge.eqmap, M_CXGBE); free(sc->tids.ftid_tab, M_CXGBE); @@ -1238,33 +1238,32 @@ cfg_itype_and_nqueues(struct adapter *sc nrxq10g = min(nc, max_nrxq_10g); nrxq1g = min(nc, max_nrxq_1g); - /* Extra 2 is for a) error interrupt b) firmware event */ - iaq->nirq = n10g * nrxq10g + n1g * nrxq1g + 2; - if (iaq->nirq <= navail && intr_fwd == 0) { + iaq->nirq = n10g * nrxq10g + n1g * nrxq1g + T4_EXTRA_INTR; + if (iaq->nirq <= navail && intr_shared == 0) { if (itype == INTR_MSI && !powerof2(iaq->nirq)) - goto fwd; + goto share; /* One for err, one for fwq, and one for each rxq */ - iaq->intr_fwd = 0; + iaq->intr_shared = 0; iaq->nrxq10g = nrxq10g; iaq->nrxq1g = nrxq1g; } else { -fwd: - iaq->intr_fwd = 1; +share: + iaq->intr_shared = 1; - if (navail > nc) { + if (navail >= nc + T4_EXTRA_INTR) { if (itype == INTR_MSIX) - navail = nc + 1; + navail = nc + T4_EXTRA_INTR; /* navail is and must remain a pow2 for MSI */ if (itype == INTR_MSI) { KASSERT(powerof2(navail), ("%d not power of 2", navail)); - while (navail / 2 > nc) + while (navail / 2 >= nc + T4_EXTRA_INTR) navail /= 2; } } @@ -1297,7 +1296,7 @@ fwd: * the kernel is willing to allocate (it's in navail). */ pci_release_msi(sc->dev); - goto fwd; + goto share; } device_printf(sc->dev, @@ -1930,16 +1929,18 @@ cxgbe_uninit_synchronized(struct port_in return (0); } -#define T4_ALLOC_IRQ(sc, irqid, rid, handler, arg, name) do { \ - rc = t4_alloc_irq(sc, &sc->irq[irqid], rid, handler, arg, name); \ +#define T4_ALLOC_IRQ(sc, irq, rid, handler, arg, name) do { \ + rc = t4_alloc_irq(sc, irq, rid, handler, arg, name); \ if (rc != 0) \ goto done; \ } while (0) static int first_port_up(struct adapter *sc) { - int rc, i; - char name[8]; + int rc, i, rid, p, q; + char s[8]; + struct irq *irq; + struct sge_iq *intrq; ADAPTER_LOCK_ASSERT_NOTOWNED(sc); @@ -1953,39 +1954,52 @@ first_port_up(struct adapter *sc) /* * Setup interrupts. */ + irq = &sc->irq[0]; + rid = sc->intr_type == INTR_INTX ? 0 : 1; if (sc->intr_count == 1) { - KASSERT(sc->flags & INTR_FWD, - ("%s: single interrupt but not forwarded?", __func__)); - T4_ALLOC_IRQ(sc, 0, 0, t4_intr_all, sc, "all"); + KASSERT(sc->flags & INTR_SHARED, + ("%s: single interrupt but not shared?", __func__)); + + T4_ALLOC_IRQ(sc, irq, rid, t4_intr_all, sc, "all"); } else { /* Multiple interrupts. The first one is always error intr */ - T4_ALLOC_IRQ(sc, 0, 1, t4_intr_err, sc, "err"); + T4_ALLOC_IRQ(sc, irq, rid, t4_intr_err, sc, "err"); + irq++; + rid++; + + /* Firmware event queue normally has an interrupt of its own */ + if (sc->intr_count > T4_EXTRA_INTR) { + T4_ALLOC_IRQ(sc, irq, rid, t4_intr_evt, &sc->sge.fwq, + "evt"); + irq++; + rid++; + } + + intrq = &sc->sge.intrq[0]; + if (sc->flags & INTR_SHARED) { - if (sc->flags & INTR_FWD) { - /* The rest are shared by the fwq and all data intr */ - for (i = 1; i < sc->intr_count; i++) { - snprintf(name, sizeof(name), "mux%d", i - 1); - T4_ALLOC_IRQ(sc, i, i + 1, t4_intr_fwd, - &sc->sge.fiq[i - 1], name); + /* All ports share these interrupt queues */ + + for (i = 0; i < NINTRQ(sc); i++) { + snprintf(s, sizeof(s), "*.%d", i); + T4_ALLOC_IRQ(sc, irq, rid, t4_intr, intrq, s); + irq++; + rid++; + intrq++; } } else { - struct port_info *pi; - int p, q; - T4_ALLOC_IRQ(sc, 1, 2, t4_intr_evt, &sc->sge.fwq, - "evt"); + /* Each port has its own set of interrupt queues */ - p = q = 0; - pi = sc->port[p]; - for (i = 2; i < sc->intr_count; i++) { - snprintf(name, sizeof(name), "p%dq%d", p, q); - if (++q >= pi->nrxq) { - p++; - q = 0; - pi = sc->port[p]; + for (p = 0; p < sc->params.nports; p++) { + for (q = 0; q < sc->port[p]->nrxq; q++) { + snprintf(s, sizeof(s), "%d.%d", p, q); + T4_ALLOC_IRQ(sc, irq, rid, t4_intr, + intrq, s); + irq++; + rid++; + intrq++; } - T4_ALLOC_IRQ(sc, i, i + 1, t4_intr_data, - &sc->sge.rxq[i - 2], name); } } } @@ -3121,7 +3135,7 @@ set_filter_wr(struct adapter *sc, int fi V_FW_FILTER_WR_OVLAN_VLDM(f->fs.mask.ovlan_vld)); fwr->smac_sel = 0; fwr->rx_chan_rx_rpl_iq = htobe16(V_FW_FILTER_WR_RX_CHAN(0) | - V_FW_FILTER_WR_RX_RPL_IQ(sc->sge.fwq.abs_id)); + V_FW_FILTER_WR_RX_RPL_IQ(sc->sge.intrq[0].abs_id)); fwr->maci_to_matchtypem = htobe32(V_FW_FILTER_WR_MACI(f->fs.val.macidx) | V_FW_FILTER_WR_MACIM(f->fs.mask.macidx) | @@ -3181,7 +3195,7 @@ del_filter_wr(struct adapter *sc, int fi m->m_len = m->m_pkthdr.len = sizeof(*fwr); bzero(fwr, sizeof (*fwr)); - t4_mk_filtdelwr(ftid, fwr, sc->sge.fwq.abs_id); + t4_mk_filtdelwr(ftid, fwr, sc->sge.intrq[0].abs_id); f->pending = 1; rc = t4_mgmt_tx(sc, m); Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Mon May 30 21:07:26 2011 (r222509) +++ head/sys/dev/cxgbe/t4_sge.c Mon May 30 21:34:44 2011 (r222510) @@ -91,6 +91,8 @@ struct sgl { bus_dma_segment_t seg[TX_SGL_SEGS]; }; +static void t4_evt_rx(void *); +static void t4_eth_rx(void *); static inline void init_iq(struct sge_iq *, struct adapter *, int, int, int, int, iq_intr_handler_t *, char *); static inline void init_fl(struct sge_fl *, int, char *); @@ -102,8 +104,10 @@ static int free_ring(struct adapter *, b static int alloc_iq_fl(struct port_info *, struct sge_iq *, struct sge_fl *, int, int); static int free_iq_fl(struct port_info *, struct sge_iq *, struct sge_fl *); -static int alloc_iq(struct sge_iq *, int); -static int free_iq(struct sge_iq *); +static int alloc_intrq(struct adapter *, int, int, int); +static int free_intrq(struct sge_iq *); +static int alloc_fwq(struct adapter *, int); +static int free_fwq(struct sge_iq *); static int alloc_rxq(struct port_info *, struct sge_rxq *, int, int); static int free_rxq(struct port_info *, struct sge_rxq *); static int alloc_ctrlq(struct adapter *, struct sge_ctrlq *, int); @@ -139,9 +143,10 @@ static void write_eqflush_wr(struct sge_ static __be64 get_flit(bus_dma_segment_t *, int, int); static int handle_sge_egr_update(struct adapter *, const struct cpl_sge_egr_update *); +static void handle_cpl(struct adapter *, struct sge_iq *); static int ctrl_tx(struct adapter *, struct sge_ctrlq *, struct mbuf *); -static int sysctl_abs_id(SYSCTL_HANDLER_ARGS); +static int sysctl_uint16(SYSCTL_HANDLER_ARGS); extern void filter_rpl(struct adapter *, const struct cpl_set_tcb_rpl *); @@ -243,8 +248,7 @@ t4_destroy_dma_tag(struct adapter *sc) /* * Allocate and initialize the firmware event queue, control queues, and the - * forwarded interrupt queues (if any). The adapter owns all these queues as - * they are not associated with any particular port. + * interrupt queues. The adapter owns all of these queues. * * Returns errno on failure. Resources allocated up to that point may still be * allocated. Caller is responsible for cleanup in case this function fails. @@ -252,8 +256,8 @@ t4_destroy_dma_tag(struct adapter *sc) int t4_setup_adapter_queues(struct adapter *sc) { - int i, rc; - struct sge_iq *iq, *fwq; + int i, j, rc, intr_idx, qsize; + struct sge_iq *iq; struct sge_ctrlq *ctrlq; iq_intr_handler_t *handler; char name[16]; @@ -264,47 +268,76 @@ t4_setup_adapter_queues(struct adapter * struct sysctl_oid *oid = device_get_sysctl_tree(sc->dev); struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); + sc->oid_fwq = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO, + "fwq", CTLFLAG_RD, NULL, "firmware event queue"); sc->oid_ctrlq = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO, "ctrlq", CTLFLAG_RD, NULL, "ctrl queues"); + sc->oid_intrq = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO, + "intrq", CTLFLAG_RD, NULL, "interrupt queues"); } - fwq = &sc->sge.fwq; - if (sc->flags & INTR_FWD) { - iq = &sc->sge.fiq[0]; - - /* - * Forwarded interrupt queues - allocate 1 if there's only 1 - * vector available, one less than the number of vectors - * otherwise (the first vector is reserved for the error - * interrupt in that case). - */ - i = sc->intr_count > 1 ? 1 : 0; - for (; i < sc->intr_count; i++, iq++) { - - snprintf(name, sizeof(name), "%s fiq%d", + /* + * Interrupt queues + */ + intr_idx = sc->intr_count - NINTRQ(sc); + if (sc->flags & INTR_SHARED) { + qsize = max((sc->sge.nrxq + 1) * 2, INTR_IQ_QSIZE); + for (i = 0; i < NINTRQ(sc); i++, intr_idx++) { + snprintf(name, sizeof(name), "%s intrq%d", device_get_nameunit(sc->dev), i); - init_iq(iq, sc, 0, 0, (sc->sge.nrxq + 1) * 2, 16, NULL, - name); - rc = alloc_iq(iq, i); + iq = &sc->sge.intrq[i]; + init_iq(iq, sc, 0, 0, qsize, INTR_IQ_ESIZE, NULL, name); + rc = alloc_intrq(sc, i % sc->params.nports, i, + intr_idx); + if (rc != 0) { device_printf(sc->dev, - "failed to create fwd intr queue %d: %d\n", - i, rc); + "failed to create %s: %d\n", name, rc); return (rc); } } - - handler = t4_evt_rx; - i = 0; /* forward fwq's interrupt to the first fiq */ } else { - handler = NULL; - i = 1; /* fwq should use vector 1 (0 is used by error) */ + int qidx = 0; + struct port_info *pi; + + for (i = 0; i < sc->params.nports; i++) { + pi = sc->port[i]; + qsize = max((pi->nrxq + 1) * 2, INTR_IQ_QSIZE); + for (j = 0; j < pi->nrxq; j++, qidx++, intr_idx++) { + snprintf(name, sizeof(name), "%s intrq%d", + device_get_nameunit(pi->dev), j); + + iq = &sc->sge.intrq[qidx]; + init_iq(iq, sc, 0, 0, qsize, INTR_IQ_ESIZE, + NULL, name); + rc = alloc_intrq(sc, i, qidx, intr_idx); + + if (rc != 0) { + device_printf(sc->dev, + "failed to create %s: %d\n", + name, rc); + return (rc); + } + } + } } + /* + * Firmware event queue + */ snprintf(name, sizeof(name), "%s fwq", device_get_nameunit(sc->dev)); - init_iq(fwq, sc, 0, 0, FW_IQ_QSIZE, FW_IQ_ESIZE, handler, name); - rc = alloc_iq(fwq, i); + if (sc->intr_count > T4_EXTRA_INTR) { + handler = NULL; + intr_idx = 1; + } else { + handler = t4_evt_rx; + intr_idx = 0; + } + + iq = &sc->sge.fwq; + init_iq(iq, sc, 0, 0, FW_IQ_QSIZE, FW_IQ_ESIZE, handler, name); + rc = alloc_fwq(sc, intr_idx); if (rc != 0) { device_printf(sc->dev, "failed to create firmware event queue: %d\n", rc); @@ -313,10 +346,10 @@ t4_setup_adapter_queues(struct adapter * } /* - * Control queues - one per hardware channel. + * Control queues - one per port. */ ctrlq = &sc->sge.ctrlq[0]; - for (i = 0; i < NCHAN; i++, ctrlq++) { + for (i = 0; i < sc->params.nports; i++, ctrlq++) { snprintf(name, sizeof(name), "%s ctrlq%d", device_get_nameunit(sc->dev), i); init_eq(&ctrlq->eq, CTRL_EQ_QSIZE, name); @@ -344,21 +377,22 @@ t4_teardown_adapter_queues(struct adapte ADAPTER_LOCK_ASSERT_NOTOWNED(sc); /* Do this before freeing the queues */ - if (sc->oid_ctrlq) { + if (sc->oid_fwq || sc->oid_ctrlq || sc->oid_intrq) { sysctl_ctx_free(&sc->ctx); + sc->oid_fwq = NULL; sc->oid_ctrlq = NULL; + sc->oid_intrq = NULL; } - for (i = 0; i < NCHAN; i++) + for (i = 0; i < sc->params.nports; i++) free_ctrlq(sc, &sc->sge.ctrlq[i]); iq = &sc->sge.fwq; - free_iq(iq); - if (sc->flags & INTR_FWD) { - for (i = 0; i < NFIQ(sc); i++) { - iq = &sc->sge.fiq[i]; - free_iq(iq); - } + free_fwq(iq); + + for (i = 0; i < NINTRQ(sc); i++) { + iq = &sc->sge.intrq[i]; + free_intrq(iq); } return (0); @@ -388,23 +422,19 @@ t4_setup_eth_queues(struct port_info *pi snprintf(name, sizeof(name), "%s rxq%d-iq", device_get_nameunit(pi->dev), i); init_iq(&rxq->iq, sc, pi->tmr_idx, pi->pktc_idx, - pi->qsize_rxq, RX_IQ_ESIZE, - sc->flags & INTR_FWD ? t4_eth_rx : NULL, name); + pi->qsize_rxq, RX_IQ_ESIZE, t4_eth_rx, name); snprintf(name, sizeof(name), "%s rxq%d-fl", device_get_nameunit(pi->dev), i); init_fl(&rxq->fl, pi->qsize_rxq / 8, name); - if (sc->flags & INTR_FWD) - intr_idx = (pi->first_rxq + i) % NFIQ(sc); - else - intr_idx = pi->first_rxq + i + 2; + intr_idx = pi->first_rxq + i; + if (sc->flags & INTR_SHARED) + intr_idx %= NINTRQ(sc); rc = alloc_rxq(pi, rxq, intr_idx, i); if (rc != 0) goto done; - - intr_idx++; } for_each_txq(pi, i, txq) { @@ -452,25 +482,26 @@ t4_teardown_eth_queues(struct port_info return (0); } -/* Deals with errors and forwarded interrupts */ +/* Deals with errors and the first (and only) interrupt queue */ void t4_intr_all(void *arg) { struct adapter *sc = arg; t4_intr_err(arg); - t4_intr_fwd(&sc->sge.fiq[0]); + t4_intr(&sc->sge.intrq[0]); } -/* Deals with forwarded interrupts on the given ingress queue */ +/* Deals with interrupts, and a few CPLs, on the given interrupt queue */ void -t4_intr_fwd(void *arg) +t4_intr(void *arg) { struct sge_iq *iq = arg, *q; struct adapter *sc = iq->adapter; struct rsp_ctrl *ctrl; + const struct rss_header *rss; int ndesc_pending = 0, ndesc_total = 0; - int qid; + int qid, rsp_type; if (!atomic_cmpset_32(&iq->state, IQS_IDLE, IQS_BUSY)) return; @@ -479,17 +510,23 @@ t4_intr_fwd(void *arg) rmb(); - /* Only interrupt muxing expected on this queue */ - KASSERT(G_RSPD_TYPE(ctrl->u.type_gen) == X_RSPD_TYPE_INTR, - ("unexpected event on forwarded interrupt queue: %x", - G_RSPD_TYPE(ctrl->u.type_gen))); + rss = (const void *)iq->cdesc; + rsp_type = G_RSPD_TYPE(ctrl->u.type_gen); + + if (__predict_false(rsp_type == X_RSPD_TYPE_CPL)) { + handle_cpl(sc, iq); + goto nextdesc; + } qid = ntohl(ctrl->pldbuflen_qid) - sc->sge.iq_start; q = sc->sge.iqmap[qid]; - q->handler(q); + if (atomic_cmpset_32(&q->state, IQS_IDLE, IQS_BUSY)) { + q->handler(q); + atomic_cmpset_32(&q->state, IQS_BUSY, IQS_IDLE); + } - ndesc_total++; +nextdesc: ndesc_total++; if (++ndesc_pending >= iq->qsize / 4) { t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), V_CIDXINC(ndesc_pending) | @@ -514,9 +551,7 @@ t4_intr_err(void *arg) { struct adapter *sc = arg; - if (sc->intr_type == INTR_INTX) - t4_write_reg(sc, MYPF_REG(A_PCIE_PF_CLI), 0); - + t4_write_reg(sc, MYPF_REG(A_PCIE_PF_CLI), 0); t4_slow_intr_handler(sc); } @@ -526,70 +561,32 @@ t4_intr_evt(void *arg) { struct sge_iq *iq = arg; - if (!atomic_cmpset_32(&iq->state, IQS_IDLE, IQS_BUSY)) - return; - - t4_evt_rx(arg); - - atomic_cmpset_32(&iq->state, IQS_BUSY, IQS_IDLE); -} - -void -t4_intr_data(void *arg) -{ - struct sge_iq *iq = arg; - - if (!atomic_cmpset_32(&iq->state, IQS_IDLE, IQS_BUSY)) - return; - - t4_eth_rx(arg); - - atomic_cmpset_32(&iq->state, IQS_BUSY, IQS_IDLE); + if (atomic_cmpset_32(&iq->state, IQS_IDLE, IQS_BUSY)) { + t4_evt_rx(arg); + atomic_cmpset_32(&iq->state, IQS_BUSY, IQS_IDLE); + } } -void +static void t4_evt_rx(void *arg) { struct sge_iq *iq = arg; struct adapter *sc = iq->adapter; struct rsp_ctrl *ctrl; - const struct rss_header *rss; int ndesc_pending = 0, ndesc_total = 0; KASSERT(iq == &sc->sge.fwq, ("%s: unexpected ingress queue", __func__)); while (is_new_response(iq, &ctrl)) { + int rsp_type; rmb(); - rss = (const void *)iq->cdesc; + rsp_type = G_RSPD_TYPE(ctrl->u.type_gen); + if (__predict_false(rsp_type != X_RSPD_TYPE_CPL)) + panic("%s: unexpected rsp_type %d", __func__, rsp_type); - /* Should only get CPL on this queue */ - KASSERT(G_RSPD_TYPE(ctrl->u.type_gen) == X_RSPD_TYPE_CPL, - ("%s: unexpected type %d", __func__, - G_RSPD_TYPE(ctrl->u.type_gen))); - - switch (rss->opcode) { - case CPL_FW4_MSG: - case CPL_FW6_MSG: { - const struct cpl_fw6_msg *cpl; - - cpl = (const void *)(rss + 1); - if (cpl->type == FW6_TYPE_CMD_RPL) - t4_handle_fw_rpl(sc, cpl->data); - - break; - } - case CPL_SGE_EGR_UPDATE: - handle_sge_egr_update(sc, (const void *)(rss + 1)); - break; - case CPL_SET_TCB_RPL: - filter_rpl(sc, (const void *) (rss + 1)); - break; - default: - device_printf(sc->dev, - "can't handle CPL opcode %d.", rss->opcode); - } + handle_cpl(sc, iq); ndesc_total++; if (++ndesc_pending >= iq->qsize / 4) { @@ -600,6 +597,7 @@ t4_evt_rx(void *arg) V_QINTR_TIMER_IDX(X_TIMERREG_UPDATE_CIDX))); ndesc_pending = 0; } + iq_next(iq); } @@ -613,7 +611,7 @@ t4_evt_rx(void *arg) #define RX_COPY_THRESHOLD MINCLSIZE #endif -void +static void t4_eth_rx(void *arg) { struct sge_rxq *rxq = arg; @@ -644,17 +642,9 @@ t4_eth_rx(void *arg) rss = (const void *)iq->cdesc; i = G_RSPD_TYPE(ctrl->u.type_gen); - if (__predict_false(i == X_RSPD_TYPE_CPL)) { - - /* Can't be anything except an egress update */ - KASSERT(rss->opcode == CPL_SGE_EGR_UPDATE, - ("%s: unexpected CPL %x", __func__, rss->opcode)); - - handle_sge_egr_update(sc, (const void *)(rss + 1)); - goto nextdesc; - } KASSERT(i == X_RSPD_TYPE_FLBUF && rss->opcode == CPL_RX_PKT, - ("%s: unexpected CPL %x rsp %d", __func__, rss->opcode, i)); + ("%s: unexpected type %d CPL opcode 0x%x", + __func__, i, rss->opcode)); sd_next = sd + 1; if (__predict_false(fl->cidx + 1 == fl->cap)) @@ -786,16 +776,15 @@ t4_eth_rx(void *arg) refill_fl(sc, fl, 64, 32); FL_UNLOCK(fl); -nextdesc: ndescs++; - iq_next(iq); - - if (ndescs > 32) { + if (++ndescs > 32) { t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), V_CIDXINC(ndescs) | V_INGRESSQID((u32)iq->cntxt_id) | V_SEINTARM(V_QINTR_TIMER_IDX(X_TIMERREG_UPDATE_CIDX))); ndescs = 0; } + + iq_next(iq); } #ifdef INET @@ -1008,7 +997,7 @@ t4_update_fl_bufsize(struct ifnet *ifp) /* * A non-NULL handler indicates this iq will not receive direct interrupts, the - * handler will be invoked by a forwarded interrupt queue. + * handler will be invoked by an interrupt queue. */ static inline void init_iq(struct sge_iq *iq, struct adapter *sc, int tmr_idx, int pktc_idx, @@ -1100,7 +1089,7 @@ free_ring(struct adapter *sc, bus_dma_ta * * If the ingress queue will take interrupts directly (iq->handler == NULL) then * the intr_idx specifies the vector, starting from 0. Otherwise it specifies - * the index of the queue to which its interrupts will be forwarded. + * the index of the interrupt queue to which its interrupts will be forwarded. */ static int alloc_iq_fl(struct port_info *pi, struct sge_iq *iq, struct sge_fl *fl, @@ -1112,10 +1101,6 @@ alloc_iq_fl(struct port_info *pi, struct struct adapter *sc = iq->adapter; __be32 v = 0; - /* The adapter queues are nominally allocated in port[0]'s name */ - if (pi == NULL) - pi = sc->port[0]; - len = iq->qsize * iq->esize; rc = alloc_ring(sc, len, &iq->desc_tag, &iq->desc_map, &iq->ba, (void **)&iq->desc); @@ -1135,10 +1120,10 @@ alloc_iq_fl(struct port_info *pi, struct v |= F_FW_IQ_CMD_IQASYNCH; if (iq->handler) { - KASSERT(intr_idx < NFIQ(sc), + KASSERT(intr_idx < NINTRQ(sc), ("%s: invalid indirect intr_idx %d", __func__, intr_idx)); v |= F_FW_IQ_CMD_IQANDST; - v |= V_FW_IQ_CMD_IQANDSTINDEX(sc->sge.fiq[intr_idx].abs_id); + v |= V_FW_IQ_CMD_IQANDSTINDEX(sc->sge.intrq[intr_idx].abs_id); } else { KASSERT(intr_idx < sc->intr_count, ("%s: invalid direct intr_idx %d", __func__, intr_idx)); @@ -1333,13 +1318,61 @@ free_iq_fl(struct port_info *pi, struct } static int -alloc_iq(struct sge_iq *iq, int intr_idx) +alloc_intrq(struct adapter *sc, int port_idx, int intrq_idx, int intr_idx) { - return alloc_iq_fl(NULL, iq, NULL, intr_idx, -1); + int rc; + struct sysctl_oid *oid; + struct sysctl_oid_list *children; + char name[16]; + struct sge_iq *intrq = &sc->sge.intrq[intrq_idx]; + + rc = alloc_iq_fl(sc->port[port_idx], intrq, NULL, intr_idx, -1); + if (rc != 0) + return (rc); + + children = SYSCTL_CHILDREN(sc->oid_intrq); + + snprintf(name, sizeof(name), "%d", intrq_idx); + oid = SYSCTL_ADD_NODE(&sc->ctx, children, OID_AUTO, name, CTLFLAG_RD, + NULL, "interrupt queue"); + children = SYSCTL_CHILDREN(oid); + + SYSCTL_ADD_PROC(&sc->ctx, children, OID_AUTO, "cidx", + CTLTYPE_INT | CTLFLAG_RD, &intrq->cidx, 0, sysctl_uint16, "I", + "consumer index"); + + return (rc); } static int -free_iq(struct sge_iq *iq) +free_intrq(struct sge_iq *iq) +{ + return free_iq_fl(NULL, iq, NULL); + +} + +static int +alloc_fwq(struct adapter *sc, int intr_idx) +{ + int rc; + struct sysctl_oid_list *children; + struct sge_iq *fwq = &sc->sge.fwq; + + rc = alloc_iq_fl(sc->port[0], fwq, NULL, intr_idx, -1); + if (rc != 0) + return (rc); + + children = SYSCTL_CHILDREN(sc->oid_fwq); + + SYSCTL_ADD_PROC(&sc->ctx, children, OID_AUTO, "cidx", + CTLTYPE_INT | CTLFLAG_RD, &fwq->cidx, 0, sysctl_uint16, "I", + "consumer index"); + + return (rc); +} + +static int +free_fwq(struct sge_iq *iq) { return free_iq_fl(NULL, iq, NULL); } @@ -1375,7 +1408,7 @@ alloc_rxq(struct port_info *pi, struct s children = SYSCTL_CHILDREN(oid); SYSCTL_ADD_PROC(&pi->ctx, children, OID_AUTO, "abs_id", - CTLTYPE_INT | CTLFLAG_RD, &rxq->iq.abs_id, 0, sysctl_abs_id, "I", + CTLTYPE_INT | CTLFLAG_RD, &rxq->iq.abs_id, 0, sysctl_uint16, "I", "absolute id of the queue"); #ifdef INET SYSCTL_ADD_INT(&pi->ctx, children, OID_AUTO, "lro_queued", CTLFLAG_RD, @@ -1433,7 +1466,10 @@ alloc_ctrlq(struct adapter *sc, struct s eq->cap = eq->qsize - SPG_LEN / CTRL_EQ_ESIZE; eq->spg = (void *)&eq->desc[eq->cap]; eq->avail = eq->cap - 1; /* one less to avoid cidx = pidx */ - eq->iqid = sc->sge.fwq.cntxt_id; + if (sc->flags & INTR_SHARED) + eq->iqid = sc->sge.intrq[idx % NINTRQ(sc)].cntxt_id; + else + eq->iqid = sc->sge.intrq[sc->port[idx]->first_rxq].cntxt_id; bzero(&c, sizeof(c)); @@ -1446,8 +1482,8 @@ alloc_ctrlq(struct adapter *sc, struct s c.physeqid_pkd = htobe32(0); c.fetchszm_to_iqid = htobe32(V_FW_EQ_CTRL_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) | - V_FW_EQ_CTRL_CMD_PCIECHN(idx) | F_FW_EQ_CTRL_CMD_FETCHRO | - V_FW_EQ_CTRL_CMD_IQID(eq->iqid)); + V_FW_EQ_CTRL_CMD_PCIECHN(sc->port[idx]->tx_chan) | + F_FW_EQ_CTRL_CMD_FETCHRO | V_FW_EQ_CTRL_CMD_IQID(eq->iqid)); c.dcaen_to_eqsize = htobe32(V_FW_EQ_CTRL_CMD_FBMIN(X_FETCHBURSTMIN_64B) | V_FW_EQ_CTRL_CMD_FBMAX(X_FETCHBURSTMAX_512B) | @@ -1479,13 +1515,12 @@ alloc_ctrlq(struct adapter *sc, struct s NULL, "ctrl queue"); children = SYSCTL_CHILDREN(oid); - SYSCTL_ADD_UQUAD(&sc->ctx, children, OID_AUTO, "total_wrs", CTLFLAG_RD, - &ctrlq->total_wrs, "total # of work requests"); + SYSCTL_ADD_PROC(&sc->ctx, children, OID_AUTO, "pidx", + CTLTYPE_INT | CTLFLAG_RD, &ctrlq->eq.pidx, 0, sysctl_uint16, "I", + "producer index"); SYSCTL_ADD_UINT(&sc->ctx, children, OID_AUTO, "no_desc", CTLFLAG_RD, &ctrlq->no_desc, 0, "# of times ctrlq ran out of hardware descriptors"); - SYSCTL_ADD_UINT(&sc->ctx, children, OID_AUTO, "too_long", CTLFLAG_RD, - &ctrlq->too_long, 0, "# of oversized work requests"); return (rc); } @@ -1526,6 +1561,7 @@ alloc_txq(struct port_info *pi, struct s char name[16]; struct sysctl_oid *oid; struct sysctl_oid_list *children; + struct sge_iq *intrq; txq->ifp = pi->ifp; TASK_INIT(&txq->resume_tx, 0, cxgbe_txq_start, txq); @@ -1544,7 +1580,12 @@ alloc_txq(struct port_info *pi, struct s txq->sdesc = malloc(eq->cap * sizeof(struct tx_sdesc), M_CXGBE, M_ZERO | M_WAITOK); txq->br = buf_ring_alloc(eq->qsize, M_CXGBE, M_WAITOK, &eq->eq_lock); - eq->iqid = sc->sge.rxq[pi->first_rxq].iq.cntxt_id; + + intrq = &sc->sge.intrq[0]; + if (sc->flags & INTR_SHARED) + eq->iqid = intrq[(pi->first_txq + idx) % NINTRQ(sc)].cntxt_id; + else + eq->iqid = intrq[pi->first_rxq + (idx % pi->nrxq)].cntxt_id; rc = bus_dma_tag_create(sc->dmat, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, 64 * 1024, TX_SGL_SEGS, @@ -2695,6 +2736,32 @@ handle_sge_egr_update(struct adapter *sc return (0); } +static void +handle_cpl(struct adapter *sc, struct sge_iq *iq) +{ + const struct rss_header *rss = (const void *)iq->cdesc; + const struct cpl_fw6_msg *cpl = (const void *)(rss + 1); + + switch (rss->opcode) { + case CPL_FW4_MSG: + case CPL_FW6_MSG: + if (cpl->type == FW6_TYPE_CMD_RPL) + t4_handle_fw_rpl(sc, cpl->data); + break; + + case CPL_SGE_EGR_UPDATE: + handle_sge_egr_update(sc, (const void *)cpl); + break; + + case CPL_SET_TCB_RPL: + filter_rpl(sc, (const void *)cpl); + break; + + default: + panic("%s: unexpected CPL opcode 0x%x", __func__, rss->opcode); + } +} + /* * m0 is freed on successful transmission. */ @@ -2710,7 +2777,8 @@ ctrl_tx(struct adapter *sc, struct sge_c M_ASSERTPKTHDR(m0); if (m0->m_pkthdr.len > SGE_MAX_WR_LEN) { - ctrlq->too_long++; + log(LOG_ERR, "%s: %s work request too long (%d)", + device_get_nameunit(sc->dev), __func__, m0->m_pkthdr.len); return (EMSGSIZE); } ndesc = howmany(m0->m_pkthdr.len, CTRL_EQ_ESIZE); @@ -2738,7 +2806,6 @@ ctrl_tx(struct adapter *sc, struct sge_c eq->pidx -= eq->cap; eq->pending += ndesc; - ctrlq->total_wrs++; ring_eq_db(sc, eq); failed: EQ_UNLOCK(eq); @@ -2749,7 +2816,7 @@ failed: } static int -sysctl_abs_id(SYSCTL_HANDLER_ARGS) +sysctl_uint16(SYSCTL_HANDLER_ARGS) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon May 30 21:41:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C84C7106568B; Mon, 30 May 2011 21:41:06 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B82CF8FC23; Mon, 30 May 2011 21:41:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ULf6c8094334; Mon, 30 May 2011 21:41:06 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ULf6HB094332; Mon, 30 May 2011 21:41:06 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201105302141.p4ULf6HB094332@svn.freebsd.org> From: Jilles Tjoelker Date: Mon, 30 May 2011 21:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222511 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 21:41:06 -0000 Author: jilles Date: Mon May 30 21:41:06 2011 New Revision: 222511 URL: http://svn.freebsd.org/changeset/base/222511 Log: posix_spawn(): Do not fail when trying to close an fd that is not open. As noted in Austin Group issue #370 (an interpretation has been issued), failing posix_spawn() because an fd specified with posix_spawn_file_actions_addclose() is not open is unnecessarily harsh, and there are existing implementations that do not fail posix_spawn() for this reason. Reviewed by: ed MFC after: 10 days Modified: head/lib/libc/gen/posix_spawn.c Modified: head/lib/libc/gen/posix_spawn.c ============================================================================== --- head/lib/libc/gen/posix_spawn.c Mon May 30 21:34:44 2011 (r222510) +++ head/lib/libc/gen/posix_spawn.c Mon May 30 21:41:06 2011 (r222511) @@ -163,11 +163,8 @@ process_file_actions_entry(posix_spawn_f return (errno); break; case FAE_CLOSE: - /* Perform a close() */ - if (_close(fae->fae_fildes) != 0) { - if (errno == EBADF) - return (EBADF); - } + /* Perform a close(), do not fail if already closed */ + (void)_close(fae->fae_fildes); break; } return (0); From owner-svn-src-head@FreeBSD.ORG Mon May 30 21:49:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BB4F106566B; Mon, 30 May 2011 21:49:59 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B2048FC1D; Mon, 30 May 2011 21:49: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 p4ULnx5U094633; Mon, 30 May 2011 21:49:59 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ULnxKJ094631; Mon, 30 May 2011 21:49:59 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201105302149.p4ULnxKJ094631@svn.freebsd.org> From: Jilles Tjoelker Date: Mon, 30 May 2011 21:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222512 - head/tools/regression/bin/sh/parser X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 21:49:59 -0000 Author: jilles Date: Mon May 30 21:49:59 2011 New Revision: 222512 URL: http://svn.freebsd.org/changeset/base/222512 Log: sh: Add tests for some somewhat obscure aspects of function definitions. Added: head/tools/regression/bin/sh/parser/func2.0 (contents, props changed) head/tools/regression/bin/sh/parser/func3.0 (contents, props changed) Added: head/tools/regression/bin/sh/parser/func2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/parser/func2.0 Mon May 30 21:49:59 2011 (r222512) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +f() { return 42; } +f() { return 3; } & +f +[ $? -eq 42 ] Added: head/tools/regression/bin/sh/parser/func3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/parser/func3.0 Mon May 30 21:49:59 2011 (r222512) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +name=/var/empty/nosuch +f() { true; } <$name +name=/dev/null +f From owner-svn-src-head@FreeBSD.ORG Mon May 30 21:51:57 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEFA8106566B; Mon, 30 May 2011 21:51:57 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3F61B8FC14; Mon, 30 May 2011 21:51:56 +0000 (UTC) Received: by vws18 with SMTP id 18so4007817vws.13 for ; Mon, 30 May 2011 14:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=lp3D+u28BQ31oCSiY+tsaopWai4kB4o8boVZFphhcas=; b=tV7XEOiZ3/Bipzw0YxH9/bdBkvFdUL/tACCpcS1suLaNkWeBlcNqL7GTEr+M9j9JWc hLlXQFnRnXrtkwuVFxQaIWALcQsfbQVjN/QaR2sp2GHXqzYtJOsrGcsah3bGX7+WuDwZ 1DeIe3mQIXA9JgsS/f/IzGmwxAtkkYYIiiM3k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=IE44FVYnGAPjzeGHPApkx0+ucub7WJYCBBw8r0AQUFeVbixjPKHlzl30slkdRT0ZoH 6FtMBgnth+rynPwZYISgijr3Xt4ngADULfaafplvzxZQTFmRmTekkZnvnDKV02l7+EG3 OCK1IH2xQM8gFH8Y92N0GDjGoz98VhFLOndZk= MIME-Version: 1.0 Received: by 10.220.105.75 with SMTP id s11mr1999667vco.73.1306792316205; Mon, 30 May 2011 14:51:56 -0700 (PDT) Received: by 10.220.183.11 with HTTP; Mon, 30 May 2011 14:51:56 -0700 (PDT) In-Reply-To: <201105302141.p4ULf6HB094332@svn.freebsd.org> References: <201105302141.p4ULf6HB094332@svn.freebsd.org> Date: Mon, 30 May 2011 14:51:56 -0700 Message-ID: From: Garrett Cooper To: Jilles Tjoelker Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222511 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 21:51:57 -0000 On Mon, May 30, 2011 at 2:41 PM, Jilles Tjoelker wrote= : > Author: jilles > Date: Mon May 30 21:41:06 2011 > New Revision: 222511 > URL: http://svn.freebsd.org/changeset/base/222511 > > Log: > =A0posix_spawn(): Do not fail when trying to close an fd that is not open= . > > =A0As noted in Austin Group issue #370 (an interpretation has been issued= ), > =A0failing posix_spawn() because an fd specified with > =A0posix_spawn_file_actions_addclose() is not open is unnecessarily harsh= , and > =A0there are existing implementations that do not fail posix_spawn() for = this > =A0reason. ... The manpage should probably be updated: 5. If the file_actions argument is not NULL, and specifies any close= , dup2, or open actions to be performed, and if posix_spawn() or posix_spawnp() fails for any of the reasons that would cause close(), dup2(), or open() to fail, an error value is returned as described by close(), dup2(), and open(), respectively (or, if th= e error occurs after the calling process successfully returns, the child process exits with exit status 127). An open file action ma= y, by itself, result in any of the errors described by close() or dup2(), in addition to those described by open(). From owner-svn-src-head@FreeBSD.ORG Mon May 30 21:56:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 706DA106564A; Mon, 30 May 2011 21:56:37 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FF358FC13; Mon, 30 May 2011 21:56:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ULubeP094872; Mon, 30 May 2011 21:56:37 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ULubBX094868; Mon, 30 May 2011 21:56:37 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201105302156.p4ULubBX094868@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 30 May 2011 21:56:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222513 - in head/sys/dev/cxgbe: . common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 21:56:37 -0000 Author: np Date: Mon May 30 21:56:37 2011 New Revision: 222513 URL: http://svn.freebsd.org/changeset/base/222513 Log: Update to firmware interface 1.3.10 MFC after: 1 week Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4fw_interface.h head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Mon May 30 21:49:59 2011 (r222512) +++ head/sys/dev/cxgbe/common/common.h Mon May 30 21:56:37 2011 (r222513) @@ -54,7 +54,7 @@ enum { #define FW_VERSION_MAJOR 1 #define FW_VERSION_MINOR 3 -#define FW_VERSION_MICRO 8 +#define FW_VERSION_MICRO 10 struct port_stats { u64 tx_octets; /* total # of octets in good frames */ Modified: head/sys/dev/cxgbe/common/t4fw_interface.h ============================================================================== --- head/sys/dev/cxgbe/common/t4fw_interface.h Mon May 30 21:49:59 2011 (r222512) +++ head/sys/dev/cxgbe/common/t4fw_interface.h Mon May 30 21:56:37 2011 (r222513) @@ -43,6 +43,7 @@ enum fw_retval { FW_ENOMEM = 12, /* out of memory */ FW_EFAULT = 14, /* bad address; fw bad */ FW_EBUSY = 16, /* resource busy */ + FW_EEXIST = 17, /* File exists */ FW_EINVAL = 22, /* invalid argument */ FW_ENOSYS = 38, /* functionality not implemented */ FW_EPROTO = 71, /* protocol error */ @@ -59,6 +60,8 @@ enum fw_retval { FW_FCOE_NO_XCHG = 136, /* */ FW_SCSI_RSP_ERR = 137, /* */ FW_ERR_RDEV_IMPL_LOGO = 138, /* */ + FW_SCSI_UNDER_FLOW_ERR = 139, /* */ + FW_SCSI_OVER_FLOW_ERR = 140, /* */ }; /****************************************************************************** @@ -85,7 +88,8 @@ enum fw_wr_opcodes { FW_RI_FR_NSMR_WR = 0x19, FW_RI_INV_LSTAG_WR = 0x1a, FW_RI_WR = 0x0d, - FW_LASTC2E_WR = 0x4a + FW_ISCSI_NODE_WR = 0x4a, + FW_LASTC2E_WR = 0x4b }; /* @@ -514,7 +518,7 @@ struct fw_eth_tx_pkts_wr { __be32 r3; __be16 plen; __u8 npkt; - __u8 r4; + __u8 type; }; struct fw_eq_flush_wr { @@ -1465,6 +1469,65 @@ struct fw_ri_wr { #define G_FW_RI_WR_P2PTYPE(x) \ (((x) >> S_FW_RI_WR_P2PTYPE) & M_FW_RI_WR_P2PTYPE) +#ifdef FOISCSI +struct fw_iscsi_node_wr { + __u8 opcode; + __u8 subop; + __u8 node_attr_to_compl; + __u8 len16; + __u8 status; + __u8 r2; + __be16 immd_len; + __be64 cookie; + __be32 node_id; + __be32 ctrl_handle; + __be32 io_handle; + __be32 r3; +}; + +#define S_FW_ISCSI_NODE_WR_NODE_ATTR 7 +#define M_FW_ISCSI_NODE_WR_NODE_ATTR 0x1 +#define V_FW_ISCSI_NODE_WR_NODE_ATTR(x) ((x) << S_FW_ISCSI_NODE_WR_NODE_ATTR) +#define G_FW_ISCSI_NODE_WR_NODE_ATTR(x) \ + (((x) >> S_FW_ISCSI_NODE_WR_NODE_ATTR) & M_FW_ISCSI_NODE_WR_NODE_ATTR) +#define F_FW_ISCSI_NODE_WR_NODE_ATTR V_FW_ISCSI_NODE_WR_NODE_ATTR(1U) + +#define S_FW_ISCSI_NODE_WR_SESS_ATTR 6 +#define M_FW_ISCSI_NODE_WR_SESS_ATTR 0x1 +#define V_FW_ISCSI_NODE_WR_SESS_ATTR(x) ((x) << S_FW_ISCSI_NODE_WR_SESS_ATTR) +#define G_FW_ISCSI_NODE_WR_SESS_ATTR(x) \ + (((x) >> S_FW_ISCSI_NODE_WR_SESS_ATTR) & M_FW_ISCSI_NODE_WR_SESS_ATTR) +#define F_FW_ISCSI_NODE_WR_SESS_ATTR V_FW_ISCSI_NODE_WR_SESS_ATTR(1U) + +#define S_FW_ISCSI_NODE_WR_CONN_ATTR 5 +#define M_FW_ISCSI_NODE_WR_CONN_ATTR 0x1 +#define V_FW_ISCSI_NODE_WR_CONN_ATTR(x) ((x) << S_FW_ISCSI_NODE_WR_CONN_ATTR) +#define G_FW_ISCSI_NODE_WR_CONN_ATTR(x) \ + (((x) >> S_FW_ISCSI_NODE_WR_CONN_ATTR) & M_FW_ISCSI_NODE_WR_CONN_ATTR) +#define F_FW_ISCSI_NODE_WR_CONN_ATTR V_FW_ISCSI_NODE_WR_CONN_ATTR(1U) + +#define S_FW_ISCSI_NODE_WR_TGT_ATTR 4 +#define M_FW_ISCSI_NODE_WR_TGT_ATTR 0x1 +#define V_FW_ISCSI_NODE_WR_TGT_ATTR(x) ((x) << S_FW_ISCSI_NODE_WR_TGT_ATTR) +#define G_FW_ISCSI_NODE_WR_TGT_ATTR(x) \ + (((x) >> S_FW_ISCSI_NODE_WR_TGT_ATTR) & M_FW_ISCSI_NODE_WR_TGT_ATTR) +#define F_FW_ISCSI_NODE_WR_TGT_ATTR V_FW_ISCSI_NODE_WR_TGT_ATTR(1U) + +#define S_FW_ISCSI_NODE_WR_NODE_TYPE 3 +#define M_FW_ISCSI_NODE_WR_NODE_TYPE 0x1 +#define V_FW_ISCSI_NODE_WR_NODE_TYPE(x) ((x) << S_FW_ISCSI_NODE_WR_NODE_TYPE) +#define G_FW_ISCSI_NODE_WR_NODE_TYPE(x) \ + (((x) >> S_FW_ISCSI_NODE_WR_NODE_TYPE) & M_FW_ISCSI_NODE_WR_NODE_TYPE) +#define F_FW_ISCSI_NODE_WR_NODE_TYPE V_FW_ISCSI_NODE_WR_NODE_TYPE(1U) + +#define S_FW_ISCSI_NODE_WR_COMPL 0 +#define M_FW_ISCSI_NODE_WR_COMPL 0x1 +#define V_FW_ISCSI_NODE_WR_COMPL(x) ((x) << S_FW_ISCSI_NODE_WR_COMPL) +#define G_FW_ISCSI_NODE_WR_COMPL(x) \ + (((x) >> S_FW_ISCSI_NODE_WR_COMPL) & M_FW_ISCSI_NODE_WR_COMPL) +#define F_FW_ISCSI_NODE_WR_COMPL V_FW_ISCSI_NODE_WR_COMPL(1U) + +#endif /****************************************************************************** * C O M M A N D s @@ -1511,6 +1574,7 @@ enum fw_cmd_opcodes { FW_RSS_VI_CONFIG_CMD = 0x23, FW_SCHED_CMD = 0x24, FW_DEVLOG_CMD = 0x25, + FW_NETIF_CMD = 0x26, FW_LASTC2E_CMD = 0x40, FW_ERROR_CMD = 0x80, FW_DEBUG_CMD = 0x81, @@ -1941,6 +2005,8 @@ enum fw_caps_config_iscsi { FW_CAPS_CONFIG_ISCSI_TARGET_PDU = 0x00000002, FW_CAPS_CONFIG_ISCSI_INITIATOR_CNXOFLD = 0x00000004, FW_CAPS_CONFIG_ISCSI_TARGET_CNXOFLD = 0x00000008, + FW_CAPS_CONFIG_ISCSI_INITIATOR_SSNOFLD = 0x00000010, + FW_CAPS_CONFIG_ISCSI_TARGET_SSNOFLD = 0x00000020, }; enum fw_caps_config_fcoe { @@ -3941,6 +4007,39 @@ enum fw_port_cap { FW_PORT_CAP_TECHKX4 = 0x2000, }; +#define S_FW_PORT_AUXLINFO_MDI 3 +#define M_FW_PORT_AUXLINFO_MDI 0x3 +#define V_FW_PORT_AUXLINFO_MDI(x) ((x) << S_FW_PORT_AUXLINFO_MDI) +#define G_FW_PORT_AUXLINFO_MDI(x) \ + (((x) >> S_FW_PORT_AUXLINFO_MDI) & M_FW_PORT_AUXLINFO_MDI) + +#define S_FW_PORT_AUXLINFO_KX4 2 +#define M_FW_PORT_AUXLINFO_KX4 0x1 +#define V_FW_PORT_AUXLINFO_KX4(x) ((x) << S_FW_PORT_AUXLINFO_KX4) +#define G_FW_PORT_AUXLINFO_KX4(x) \ + (((x) >> S_FW_PORT_AUXLINFO_KX4) & M_FW_PORT_AUXLINFO_KX4) +#define F_FW_PORT_AUXLINFO_KX4 V_FW_PORT_AUXLINFO_KX4(1U) + +#define S_FW_PORT_AUXLINFO_KR 1 +#define M_FW_PORT_AUXLINFO_KR 0x1 +#define V_FW_PORT_AUXLINFO_KR(x) ((x) << S_FW_PORT_AUXLINFO_KR) +#define G_FW_PORT_AUXLINFO_KR(x) \ + (((x) >> S_FW_PORT_AUXLINFO_KR) & M_FW_PORT_AUXLINFO_KR) +#define F_FW_PORT_AUXLINFO_KR V_FW_PORT_AUXLINFO_KR(1U) + +#define S_FW_PORT_AUXLINFO_FEC 0 +#define M_FW_PORT_AUXLINFO_FEC 0x1 +#define V_FW_PORT_AUXLINFO_FEC(x) ((x) << S_FW_PORT_AUXLINFO_FEC) +#define G_FW_PORT_AUXLINFO_FEC(x) \ + (((x) >> S_FW_PORT_AUXLINFO_FEC) & M_FW_PORT_AUXLINFO_FEC) +#define F_FW_PORT_AUXLINFO_FEC V_FW_PORT_AUXLINFO_FEC(1U) + +#define S_FW_PORT_RCAP_AUX 11 +#define M_FW_PORT_RCAP_AUX 0x7 +#define V_FW_PORT_RCAP_AUX(x) ((x) << S_FW_PORT_RCAP_AUX) +#define G_FW_PORT_RCAP_AUX(x) \ + (((x) >> S_FW_PORT_RCAP_AUX) & M_FW_PORT_RCAP_AUX) + #define S_FW_PORT_CAP_SPEED 0 #define M_FW_PORT_CAP_SPEED 0x3f #define V_FW_PORT_CAP_SPEED(x) ((x) << S_FW_PORT_CAP_SPEED) @@ -4002,11 +4101,23 @@ enum fw_port_l2cfg_ctlbf { FW_PORT_L2_CTLBF_MTU = 0x40 }; +enum fw_port_dcb_cfg { + FW_PORT_DCB_CFG_PG = 0x01, + FW_PORT_DCB_CFG_PFC = 0x02, + FW_PORT_DCB_CFG_APPL = 0x04 +}; + +enum fw_port_dcb_cfg_rc { + FW_PORT_DCB_CFG_SUCCESS = 0x0, + FW_PORT_DCB_CFG_ERROR = 0x1 +}; + enum fw_port_dcb_type { FW_PORT_DCB_TYPE_PGID = 0x00, FW_PORT_DCB_TYPE_PGRATE = 0x01, FW_PORT_DCB_TYPE_PRIORATE = 0x02, - FW_PORT_DCB_TYPE_PFC = 0x03 + FW_PORT_DCB_TYPE_PFC = 0x03, + FW_PORT_DCB_TYPE_APP_ID = 0x04, }; struct fw_port_cmd { @@ -4038,7 +4149,7 @@ struct fw_port_cmd { __be16 acap; __be16 mtu; __u8 cbllen; - __u8 r7; + __u8 auxlinfo; __be32 r8; __be64 r9; } info; @@ -4068,6 +4179,14 @@ struct fw_port_cmd { __be16 r10[3]; __be64 r11; } pfc; + struct fw_port_app_priority { + __u8 type; + __u8 r10_lo[3]; + __u8 prio; + __u8 sel; + __be16 protocolid; + __u8 r12[8]; + } app_priority; } dcb; } u; }; @@ -5232,6 +5351,116 @@ struct fw_devlog_cmd { (((x) >> S_FW_DEVLOG_CMD_MEMADDR16_DEVLOG) & \ M_FW_DEVLOG_CMD_MEMADDR16_DEVLOG) +struct fw_netif_cmd { + __be32 op_portid; + __be32 retval_to_len16; + __be32 add_to_ipv4gw; + __be32 vlanid_mtuval; + __be32 gwaddr; + __be32 addr; + __be32 nmask; + __be32 bcaddr; +}; + +#define S_FW_NETIF_CMD_PORTID 0 +#define M_FW_NETIF_CMD_PORTID 0xf +#define V_FW_NETIF_CMD_PORTID(x) ((x) << S_FW_NETIF_CMD_PORTID) +#define G_FW_NETIF_CMD_PORTID(x) \ + (((x) >> S_FW_NETIF_CMD_PORTID) & M_FW_NETIF_CMD_PORTID) + +#define S_FW_NETIF_CMD_RETVAL 24 +#define M_FW_NETIF_CMD_RETVAL 0xff +#define V_FW_NETIF_CMD_RETVAL(x) ((x) << S_FW_NETIF_CMD_RETVAL) +#define G_FW_NETIF_CMD_RETVAL(x) \ + (((x) >> S_FW_NETIF_CMD_RETVAL) & M_FW_NETIF_CMD_RETVAL) + +#define S_FW_NETIF_CMD_IFIDX 16 +#define M_FW_NETIF_CMD_IFIDX 0xff +#define V_FW_NETIF_CMD_IFIDX(x) ((x) << S_FW_NETIF_CMD_IFIDX) +#define G_FW_NETIF_CMD_IFIDX(x) \ + (((x) >> S_FW_NETIF_CMD_IFIDX) & M_FW_NETIF_CMD_IFIDX) + +#define S_FW_NETIF_CMD_LEN16 0 +#define M_FW_NETIF_CMD_LEN16 0xff +#define V_FW_NETIF_CMD_LEN16(x) ((x) << S_FW_NETIF_CMD_LEN16) +#define G_FW_NETIF_CMD_LEN16(x) \ + (((x) >> S_FW_NETIF_CMD_LEN16) & M_FW_NETIF_CMD_LEN16) + +#define S_FW_NETIF_CMD_ADD 31 +#define M_FW_NETIF_CMD_ADD 0x1 +#define V_FW_NETIF_CMD_ADD(x) ((x) << S_FW_NETIF_CMD_ADD) +#define G_FW_NETIF_CMD_ADD(x) \ + (((x) >> S_FW_NETIF_CMD_ADD) & M_FW_NETIF_CMD_ADD) +#define F_FW_NETIF_CMD_ADD V_FW_NETIF_CMD_ADD(1U) + +#define S_FW_NETIF_CMD_LINK 30 +#define M_FW_NETIF_CMD_LINK 0x1 +#define V_FW_NETIF_CMD_LINK(x) ((x) << S_FW_NETIF_CMD_LINK) +#define G_FW_NETIF_CMD_LINK(x) \ + (((x) >> S_FW_NETIF_CMD_LINK) & M_FW_NETIF_CMD_LINK) +#define F_FW_NETIF_CMD_LINK V_FW_NETIF_CMD_LINK(1U) + +#define S_FW_NETIF_CMD_VLAN 29 +#define M_FW_NETIF_CMD_VLAN 0x1 +#define V_FW_NETIF_CMD_VLAN(x) ((x) << S_FW_NETIF_CMD_VLAN) +#define G_FW_NETIF_CMD_VLAN(x) \ + (((x) >> S_FW_NETIF_CMD_VLAN) & M_FW_NETIF_CMD_VLAN) +#define F_FW_NETIF_CMD_VLAN V_FW_NETIF_CMD_VLAN(1U) + +#define S_FW_NETIF_CMD_MTU 28 +#define M_FW_NETIF_CMD_MTU 0x1 +#define V_FW_NETIF_CMD_MTU(x) ((x) << S_FW_NETIF_CMD_MTU) +#define G_FW_NETIF_CMD_MTU(x) \ + (((x) >> S_FW_NETIF_CMD_MTU) & M_FW_NETIF_CMD_MTU) +#define F_FW_NETIF_CMD_MTU V_FW_NETIF_CMD_MTU(1U) + +#define S_FW_NETIF_CMD_DHCP 27 +#define M_FW_NETIF_CMD_DHCP 0x1 +#define V_FW_NETIF_CMD_DHCP(x) ((x) << S_FW_NETIF_CMD_DHCP) +#define G_FW_NETIF_CMD_DHCP(x) \ + (((x) >> S_FW_NETIF_CMD_DHCP) & M_FW_NETIF_CMD_DHCP) +#define F_FW_NETIF_CMD_DHCP V_FW_NETIF_CMD_DHCP(1U) + +#define S_FW_NETIF_CMD_IPV4BCADDR 3 +#define M_FW_NETIF_CMD_IPV4BCADDR 0x1 +#define V_FW_NETIF_CMD_IPV4BCADDR(x) ((x) << S_FW_NETIF_CMD_IPV4BCADDR) +#define G_FW_NETIF_CMD_IPV4BCADDR(x) \ + (((x) >> S_FW_NETIF_CMD_IPV4BCADDR) & M_FW_NETIF_CMD_IPV4BCADDR) +#define F_FW_NETIF_CMD_IPV4BCADDR V_FW_NETIF_CMD_IPV4BCADDR(1U) + +#define S_FW_NETIF_CMD_IPV4NMASK 2 +#define M_FW_NETIF_CMD_IPV4NMASK 0x1 +#define V_FW_NETIF_CMD_IPV4NMASK(x) ((x) << S_FW_NETIF_CMD_IPV4NMASK) +#define G_FW_NETIF_CMD_IPV4NMASK(x) \ + (((x) >> S_FW_NETIF_CMD_IPV4NMASK) & M_FW_NETIF_CMD_IPV4NMASK) +#define F_FW_NETIF_CMD_IPV4NMASK V_FW_NETIF_CMD_IPV4NMASK(1U) + +#define S_FW_NETIF_CMD_IPV4ADDR 1 +#define M_FW_NETIF_CMD_IPV4ADDR 0x1 +#define V_FW_NETIF_CMD_IPV4ADDR(x) ((x) << S_FW_NETIF_CMD_IPV4ADDR) +#define G_FW_NETIF_CMD_IPV4ADDR(x) \ + (((x) >> S_FW_NETIF_CMD_IPV4ADDR) & M_FW_NETIF_CMD_IPV4ADDR) +#define F_FW_NETIF_CMD_IPV4ADDR V_FW_NETIF_CMD_IPV4ADDR(1U) + +#define S_FW_NETIF_CMD_IPV4GW 0 +#define M_FW_NETIF_CMD_IPV4GW 0x1 +#define V_FW_NETIF_CMD_IPV4GW(x) ((x) << S_FW_NETIF_CMD_IPV4GW) +#define G_FW_NETIF_CMD_IPV4GW(x) \ + (((x) >> S_FW_NETIF_CMD_IPV4GW) & M_FW_NETIF_CMD_IPV4GW) +#define F_FW_NETIF_CMD_IPV4GW V_FW_NETIF_CMD_IPV4GW(1U) + +#define S_FW_NETIF_CMD_VLANID 16 +#define M_FW_NETIF_CMD_VLANID 0xfff +#define V_FW_NETIF_CMD_VLANID(x) ((x) << S_FW_NETIF_CMD_VLANID) +#define G_FW_NETIF_CMD_VLANID(x) \ + (((x) >> S_FW_NETIF_CMD_VLANID) & M_FW_NETIF_CMD_VLANID) + +#define S_FW_NETIF_CMD_MTUVAL 0 +#define M_FW_NETIF_CMD_MTUVAL 0xffff +#define V_FW_NETIF_CMD_MTUVAL(x) ((x) << S_FW_NETIF_CMD_MTUVAL) +#define G_FW_NETIF_CMD_MTUVAL(x) \ + (((x) >> S_FW_NETIF_CMD_MTUVAL) & M_FW_NETIF_CMD_MTUVAL) + enum fw_error_type { FW_ERROR_TYPE_EXCEPTION = 0x0, FW_ERROR_TYPE_HWMODULE = 0x1, Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Mon May 30 21:49:59 2011 (r222512) +++ head/sys/dev/cxgbe/t4_sge.c Mon May 30 21:56:37 2011 (r222513) @@ -2365,7 +2365,7 @@ write_txpkts_wr(struct sge_txq *txq, str wr->equiq_to_len16 = htobe32(ctrl); wr->plen = htobe16(txpkts->plen); wr->npkt = txpkts->npkt; - wr->r3 = wr->r4 = 0; + wr->r3 = wr->type = 0; /* Everything else already written */ From owner-svn-src-head@FreeBSD.ORG Tue May 31 00:25:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CBCE106566B; Tue, 31 May 2011 00:25:52 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5CB228FC1E; Tue, 31 May 2011 00:25:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4V0PqTQ099417; Tue, 31 May 2011 00:25:52 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4V0PqTB099414; Tue, 31 May 2011 00:25:52 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105310025.p4V0PqTB099414@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 31 May 2011 00:25:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222515 - in head/etc: . defaults X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 00:25:52 -0000 Author: bz Date: Tue May 31 00:25:52 2011 New Revision: 222515 URL: http://svn.freebsd.org/changeset/base/222515 Log: No logner set an IPv4 loopback address by default in defaults/rc.conf. If not specified, network.subr will add it automatically if we have INET support (1). In network.subr only call the address family up/down functions if the respective AF is available. Switch to new kern.features variables for inet and inet6 as the inet sysctl tree is also available for IPv6-only kernels leading to unexpected results. Suggested by: hrs (1) Reviewed by: hrs Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 20 days Modified: head/etc/defaults/rc.conf head/etc/network.subr Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Mon May 30 23:27:42 2011 (r222514) +++ head/etc/defaults/rc.conf Tue May 31 00:25:52 2011 (r222515) @@ -210,7 +210,7 @@ icmp_log_redirect="NO" # Set to YES to network_interfaces="auto" # List of network interfaces (or "auto"). cloned_interfaces="" # List of cloned network interfaces to create. #cloned_interfaces="gif0 gif1 gif2 gif3" # Pre-cloning GENERIC config. -ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration. +#ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration. #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry. #ifconfig_ed0_ipx="ipx 0x00010010" # Sample IPX address family entry. #ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Mon May 30 23:27:42 2011 (r222514) +++ head/etc/network.subr Tue May 31 00:25:52 2011 (r222515) @@ -44,9 +44,9 @@ ifn_start() ifscript_up ${ifn} && cfg=0 ifconfig_up ${ifn} && cfg=0 - ipv4_up ${ifn} && cfg=0 - ipv6_up ${ifn} && cfg=0 - ipx_up ${ifn} && cfg=0 + afexists inet && ipv4_up ${ifn} && cfg=0 + afexists inet6 && ipv6_up ${ifn} && cfg=0 + afexists ipx && ipx_up ${ifn} && cfg=0 childif_create ${ifn} && cfg=0 return $cfg @@ -64,9 +64,9 @@ ifn_stop() [ -z "$ifn" ] && err 1 "ifn_stop called without an interface" - ipx_down ${ifn} && cfg=0 - ipv6_down ${ifn} && cfg=0 - ipv4_down ${ifn} && cfg=0 + afexists ipx && ipx_down ${ifn} && cfg=0 + afexists inet6 && ipv6_down ${ifn} && cfg=0 + afexists inet && ipv4_down ${ifn} && cfg=0 ifconfig_down ${ifn} && cfg=0 ifscript_down ${ifn} && cfg=0 childif_destroy ${ifn} && cfg=0 @@ -86,6 +86,11 @@ ifconfig_up() local _cfg _ipv6_opts ifconfig_args _cfg=1 + # Make sure lo0 always comes up. + if [ "$1" = "lo0" ]; then + _cfg=0 + fi + # ifconfig_IF ifconfig_args=`ifconfig_getargs $1` if [ -n "${ifconfig_args}" ]; then @@ -351,10 +356,10 @@ afexists() case ${_af} in inet) - ${SYSCTL_N} net.inet > /dev/null 2>&1 + ${SYSCTL_N} kern.features.inet > /dev/null 2>&1 ;; inet6) - ${SYSCTL_N} net.inet6 > /dev/null 2>&1 + ${SYSCTL_N} kern.features.inet6 > /dev/null 2>&1 ;; ipx) ${SYSCTL_N} net.ipx > /dev/null 2>&1 @@ -512,6 +517,13 @@ ipv4_up() _if=$1 _ret=1 + # Add 127.0.0.1/8 to lo0 unless otherwise specified. + if [ "${_if}" = "lo0" ]; then + ifconfig_args=`ifconfig_getargs ${_if}` + if [ -z "${ifconfig_args}" ]; then + ifconfig ${_if} inet 127.0.0.1/8 alias + fi + fi ifalias_up ${_if} inet && _ret=0 ipv4_addrs_common ${_if} alias && _ret=0 From owner-svn-src-head@FreeBSD.ORG Tue May 31 01:30:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20D921065670; Tue, 31 May 2011 01:30:59 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10CEF8FC12; Tue, 31 May 2011 01:30: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 p4V1UwQi001822; Tue, 31 May 2011 01:30:58 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4V1Uwib001820; Tue, 31 May 2011 01:30:58 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201105310130.p4V1Uwib001820@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 May 2011 01:30:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222516 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 01:30:59 -0000 Author: yongari Date: Tue May 31 01:30:58 2011 New Revision: 222516 URL: http://svn.freebsd.org/changeset/base/222516 Log: Correctly check MAC running status before disabling TX/RX MACs. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Tue May 31 00:25:52 2011 (r222515) +++ head/sys/dev/msk/if_msk.c Tue May 31 01:30:58 2011 (r222516) @@ -566,7 +566,7 @@ msk_miibus_statchg(device_t dev) msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0); /* Disable Rx/Tx MAC. */ gmac = GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL); - if ((GM_GPCR_RX_ENA | GM_GPCR_TX_ENA) != 0) { + if ((gmac & (GM_GPCR_RX_ENA | GM_GPCR_TX_ENA)) != 0) { gmac &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA); GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac); /* Read again to ensure writing. */ From owner-svn-src-head@FreeBSD.ORG Tue May 31 07:02:50 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 283E01065672; Tue, 31 May 2011 07:02:50 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17E0B8FC08; Tue, 31 May 2011 07:02:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4V72njd011818; Tue, 31 May 2011 07:02:49 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4V72n5H011816; Tue, 31 May 2011 07:02:49 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201105310702.p4V72n5H011816@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 31 May 2011 07:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222518 - head/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 07:02:50 -0000 Author: pjd Date: Tue May 31 07:02:49 2011 New Revision: 222518 URL: http://svn.freebsd.org/changeset/base/222518 Log: Imagine situation where a security problem is found in setuid binary. User upgrades his system to fix the problem, but if he has any ZFS snapshots for the file system which contains problematic binary, any user can mount the snapshot and execute vulnerable binary. Prevent this from happening by always mounting snapshots with setuid turned off. MFC after: 2 weeks Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Tue May 31 05:00:45 2011 (r222517) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Tue May 31 07:02:49 2011 (r222518) @@ -172,6 +172,11 @@ mount_snapshot(kthread_t *td, vnode_t ** */ mp->mnt_flag |= MNT_RDONLY; /* + * We don't want snapshots to allow access to vulnerable setuid + * programs, so we turn off setuid when mounting snapshots. + */ + mp->mnt_flag |= MNT_NOSUID; + /* * We don't want snapshots to be visible in regular * mount(8) and df(1) output. */ From owner-svn-src-head@FreeBSD.ORG Tue May 31 07:13:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CCE11065670; Tue, 31 May 2011 07:13:07 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CCF98FC15; Tue, 31 May 2011 07:13: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 p4V7D7mC012167; Tue, 31 May 2011 07:13:07 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4V7D7mB012165; Tue, 31 May 2011 07:13:07 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201105310713.p4V7D7mB012165@svn.freebsd.org> From: Benedict Reuschling Date: Tue, 31 May 2011 07:13:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222519 - head/usr.sbin/usbdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 07:13:07 -0000 Author: bcr (doc committer) Date: Tue May 31 07:13:07 2011 New Revision: 222519 URL: http://svn.freebsd.org/changeset/base/222519 Log: Minor wording adjustments to usbdump(8). PR: docs/157317 Submitted by: Warren Block (wblock at wonkity dot com) Reviewed by: hps@ MFC after: 5 days Modified: head/usr.sbin/usbdump/usbdump.8 Modified: head/usr.sbin/usbdump/usbdump.8 ============================================================================== --- head/usr.sbin/usbdump/usbdump.8 Tue May 31 07:02:49 2011 (r222518) +++ head/usr.sbin/usbdump/usbdump.8 Tue May 31 07:13:07 2011 (r222519) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 4, 2010 +.Dd May 31, 2011 .Dt USBDUMP 8 .Os .Sh NAME @@ -63,16 +63,16 @@ Write the raw packets to .Ar file . .El .Sh EXAMPLES -Captures USB raw packets on usbus2: +Capture the USB raw packets on usbus2: .Pp .Dl "usbdump -i usbus2 -s 256 -v" .Pp -Dumps the USB raw packets of usbus2 into the file without packet +Dump the USB raw packets of usbus2 into the file without packet size limit: .Pp .Dl "usbdump -i usbus2 -s 0 -w /tmp/dump_pkts" .Pp -Read the USB raw packets from previous file: +Read and display the USB raw packets from previous file: .Pp .Dl "usbdump -r /tmp/dump_pkts -v" .Sh OUTPUT FORMAT From owner-svn-src-head@FreeBSD.ORG Tue May 31 08:21:41 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4935106564A; Tue, 31 May 2011 08:21:41 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 5EFB68FC14; Tue, 31 May 2011 08:21:41 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p4V8Lb2h009696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 May 2011 18:21:38 +1000 Date: Tue, 31 May 2011 18:21:37 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Rick Macklem In-Reply-To: <336367081.983085.1306763929731.JavaMail.root@erie.cs.uoguelph.ca> Message-ID: <20110531170853.Y1153@besplex.bde.org> References: <336367081.983085.1306763929731.JavaMail.root@erie.cs.uoguelph.ca> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, Robert Watson , Kostik Belousov , Rick Macklem Subject: Re: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 08:21:42 -0000 On Mon, 30 May 2011, Rick Macklem wrote: >> On Mon, May 30, 2011 at 01:48:53PM +0100, Robert Watson wrote: >>> On Sun, 29 May 2011, Rick Macklem wrote: >>> >>>> Modify the umount(8) command so that it doesn't do >>>> a sync(2) syscall before unmount(2) for the "-f" case. >>>> This avoids a forced dismount from getting stuck for >>>> an NFS mountpoint in sync() when the server is not >>>> responsive. With this commit, forced dismounts should >>>> normally work for the NFS clients, but can take up to >>>> about 1minute to complete. >>> >>> I'm actually a bit confused about why umount(8) calls sync(2) at >>> all: >>> surely it's the responsibility of the file system, rather than the >>> userland >>> tool, to ensure consistency subject to file system configuration and >>> unmount-time flags? >> This call is from the same department as triple-sync before reboot, >> IMO. > Hehe. I'm so old, I do two syncs, as required by 6th Edition.:-) I am apparently not so old, since my reboot script only has 1 sync :-). > I assumed the sync() was meant to be an optimization (given the comment > for it) in the sense that it would get the writes of dirty blocks started > "right away". However, given the short period of time from the the sync(2) It is only an optimization. Any number of syncs are useless for actually syncing the system, since sync(2) only does an async sync (it returns without waiting for most writes to complete). As you pointed out later in this thread, unmount(2) does a sync that works -- a sync sync -- before doing the unmount proper. It does this irrespective of the force flag: % if (((mp->mnt_flag & MNT_RDONLY) || % (error = VFS_SYNC(mp, MNT_WAIT)) == 0) || (flags & MNT_FORCE) != 0) % error = VFS_UNMOUNT(mp, flags); The force flag doesn't mean that i/o's are forced to complete. It only means that open files are forced to be closed (and a few related things). This can be seen here. We wait (potentially forever) for any existing writes to complete. Only then do we look at the force flag and bale out if the sync failed and the force flag is _not_ set. Most i/o problems will cause hangs in this sync, and the force flag won't help. But if we somehow get past this sync, and have i/o problems, then honoring the force flag and continuing gives even more fragility, since we have almost passed the point of being able to give up after an error (this point is typically very early in VFS_UNMOUNT()). Many file systems have had bugs in this area. Before 1999/01/22 (vfs_bio.c 1.196), b*write() gave up after an i/o error, and pretended to succeed. Both recoverable and unrecoverable errors were mishandled. This avoided many hangs in VFS_SYNC(). When this was partially fixed, many VFS_SYNC()s couldn't handle the errors, and paniced when they should have looped endlessly. Now I think they mostly loop endlessly, even for unrecoverable errors when they shouldn't. My version attempts to fix vfs_bio.c 1.196 by still giving up after an unrecoverable i/o error. This reduced endless loops but gave more panics in other places that can't handle the errors, mainly in the VFS_UMOUNT() call in the above -- many file systems saw the errors after the point where it is posible to either recover from them or loop endlessly on them, and then a panic occurred soon after the VFS_UMOUNT() returned with a half-complete unmount(), since neither a success or a failure return can indicate this state. > call to the unmount(2) call, I'm not convinced it makes a significant > difference. (I thought of just getting rid of it, but figured it was > harmless for the non "-f" case and might matter for a buggy fs that doesn't > get the unmount(2) quite right. ie. Same argument as doing the triple-sync, > just to be sure.) I think you shouldn't have touched umount(8). The sync can still hang or just be in progress when unmount(2) is called, and unmount(2) still does its own sync, so nfs_unmount() must still handle hanging syncs in some way. My reboot script has more details related to this: %%% sh < Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CC28106566B; Tue, 31 May 2011 09:14:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 93C438FC0A; Tue, 31 May 2011 09:14:00 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p4V9DtU3014694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 May 2011 19:13:56 +1000 Date: Tue, 31 May 2011 19:13:55 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: mdf@FreeBSD.org In-Reply-To: Message-ID: <20110531185629.J1721@besplex.bde.org> References: <201105182106.p4IL6KkE008657@svn.freebsd.org> <20110518211651.GE2273@garage.freebsd.pl> <4DD43AB7.7060705@FreeBSD.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1933995627-1306833235=:1721" Cc: src-committers@FreeBSD.org, Pawel Jakub Dawidek , Ben Laurie , svn-src-all@FreeBSD.org, Dimitry Andric , svn-src-head@FreeBSD.org Subject: Re: svn commit: r222084 - head/contrib/gperf/src X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 09:14:01 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1933995627-1306833235=:1721 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Wed, 18 May 2011 mdf@FreeBSD.org wrote: > On Wed, May 18, 2011 at 2:31 PM, Dimitry Andric wrote: >> On 2011-05-18 23:16, Pawel Jakub Dawidek wrote: >>> >>> On Wed, May 18, 2011 at 09:06:20PM +0000, Ben Laurie wrote: >>>> >>>> Author: benl >>>> Date: Wed May 18 21:06:20 2011 >>>> New Revision: 222084 >>>> URL: http://svn.freebsd.org/changeset/base/222084 >>>> >>>> Log: >>>> =A0 Fix clang warnings. >>>> >>>> =A0 Approved by: philip (mentor) >>> >>> [...] >>>> >>>> - =A0 =A0 =A0 =A0 =A0 =A0fprintf (stderr, " by changing asso_value['%c= '] (char #%d) >>>> to %d\n", >>>> + =A0 =A0 =A0 =A0 =A0 =A0fprintf (stderr, " by changing asso_value['%c= '] (char #%zd) >>>> to %d\n", >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *p, p - union_set + 1, ass= o_values[(unsigned >>>> char)(*p)]); >>> >>> Hmm, both 'p' and 'union_set' are 'char *' and %zd is for ssize_t. It i= s >>> a bit strange that it fixes the warning. >> >> If you subtract two pointers, such as in this case, you get a ptrdiff_t. >> >> Strictly, this doesn't have to be exactly the same type as ssize_t, but >> in practice it will almost always be. >> >> You can also cast the result to intmax_t, and use %jd, then it will >> always be correct, but possibly have some small overhead. > > Or you can use %td which is the C99 conversion specifier for ptrdiff_t. Of course this is the only correct fix. All the changes are wrong IMO. Apart from being unmaintainable since they are in dusty contrib code: % Modified: head/contrib/gperf/src/gen-perf.cc % =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D % --- head/contrib/gperf/src/gen-perf.cc=09Wed May 18 21:04:29 2011=09(r222= 083) % +++ head/contrib/gperf/src/gen-perf.cc=09Wed May 18 21:06:20 2011=09(r222= 084) % @@ -246,7 +246,7 @@ Gen_Perf::change (List_Node *prior, List % { % if (option[DEBUG]) % { % - fprintf (stderr, " by changing asso_value['%c'] (char #%d) t= o %d\n", % + fprintf (stderr, " by changing asso_value['%c'] (char #%zd) = to %d\n", % *p, p - union_set + 1, asso_values[(unsigned char)(= *p)]); % fflush (stderr); % } % %td % Modified: head/contrib/gperf/src/key-list.cc % =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D % --- head/contrib/gperf/src/key-list.cc=09Wed May 18 21:04:29 2011=09(r222= 083) % +++ head/contrib/gperf/src/key-list.cc=09Wed May 18 21:06:20 2011=09(r222= 084) % @@ -497,8 +497,8 @@ Key_List::merge (List_Node *list1, List_ % *resultp =3D list1; % break; % } % - if (occurrence_sort && list1->occurrence < list2->occurrence % - || hash_sort && list1->hash_value > list2->hash_value) % + if ((occurrence_sort && list1->occurrence < list2->occurrence) % +=09 || (hash_sort && list1->hash_value > list2->hash_value)) % { % *resultp =3D list2; % resultp =3D &list2->next; list2 =3D list1; list1 =3D *resultp; It is a compiler bug to warn about precedence when there is no problem with precedence, as here for && vs ||. clang recently became even more broken than gcc for this -- it now warns even without -Wparentheses (or -Wall, which implies -Wparentheses) in CFLAGS, so it issues broken warning at very low WARNS levels (for WARNS=3D1, maybe even with no WARNS). % @@ -1035,17 +1035,16 @@ Key_List::output_hash_function (void) % if (option[CPLUSPLUS]) % printf ("%s::", option.get_class_name ()); % printf ("%s ", option.get_hash_name ()); % - printf (option[KRC] ? % - "(str, len)\n" % - " register char *str;\n" % - " register unsigned int len;\n" : % - option[C] ? % - "(str, len)\n" % - " register const char *str;\n" % - " register unsigned int len;\n" : % - option[ANSIC] | option[CPLUSPLUS] ? % - "(register const char *str, register unsigned int len)\= n" : % - ""); % + if (option[KRC] || option[C] || option [ANSIC] || option[CPLUSPLUS]) % + printf (option[KRC] ? % +=09 "(str, len)\n" % + " register char *str;\n" % + " register unsigned int len;\n" : % +=09 option[C] ? % +=09 "(str, len)\n" % + " register const char *str;\n" % + " register unsigned int len;\n" : % +=09 "(register const char *str, register unsigned int len)\n"); %=20 % /* Note that when the hash function is called, it has already been ver= ified % that min_key_len <=3D len <=3D max_key_len. */ Far too invasive, and I can't even see a problem in the original. The original has an empty format for the default case. This is perfectly valid= , an serves as documentation for the default case. The expression is a "computed switch" statement. The change also obfuscates the pseudo-cases option[ANSIC] and option[CPLUSPLUS] as the default pseudo-case (after filtering out the actual default case before the pseudo-switch. % @@ -1442,7 +1441,7 @@ Key_List::output_lookup_array (void) %=20 % if (option[DEBUG]) % fprintf (stderr, % - "dup_ptr[%d]: hash_value =3D %d, index =3D %d, coun= t =3D %d\n", % + "dup_ptr[%zd]: hash_value =3D %d, index =3D %d, cou= nt =3D %d\n", % dup_ptr - duplicates, % dup_ptr->hash_value, dup_ptr->index, dup_ptr->count= ); % Looks like another ptrdiff_t. % @@ -1986,17 +1985,16 @@ Key_List::output_lookup_function (void) % if (option[CPLUSPLUS]) % printf ("%s::", option.get_class_name ()); % printf ("%s ", option.get_function_name ()); % - printf (option[KRC] ? % - "(str, len)\n" % - " register char *str;\n" % - " register unsigned int len;\n" : % - option[C] ? % - "(str, len)\n" % - " register const char *str;\n" % - " register unsigned int len;\n" : % - option[ANSIC] | option[CPLUSPLUS] ? % - "(register const char *str, register unsigned int len)\= n" : % - ""); % + if (option[KRC] || option[C] || option[ANSIC] || option[CPLUSPLUS]) % + printf (option[KRC] ? % +=09 "(str, len)\n" % + " register char *str;\n" % + " register unsigned int len;\n" : % +=09 option[C] ? % +=09 "(str, len)\n" % + " register const char *str;\n" % + " register unsigned int len;\n" : % +=09 "(register const char *str, register unsigned int len)\n"); %=20 % /* Output the function's body. */ % printf ("{\n"); % Another pseudo-switch invaded. % Modified: head/contrib/gperf/src/options.cc % =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D % --- head/contrib/gperf/src/options.cc=09Wed May 18 21:04:29 2011=09(r2220= 83) % +++ head/contrib/gperf/src/options.cc=09Wed May 18 21:06:20 2011=09(r2220= 84) % @@ -237,7 +237,7 @@ Options::print_options (void) % { % putchar (*arg); % arg++; % - if (*arg >=3D 'A' && *arg <=3D 'Z' || *arg >=3D 'a' && *arg <= =3D 'z') % + if ((*arg >=3D 'A' && *arg <=3D 'Z') || (*arg >=3D 'a' && *arg= <=3D 'z')) % { % putchar (*arg); % arg++; % Another precedence non-problem. Bruce --0-1933995627-1306833235=:1721-- From owner-svn-src-head@FreeBSD.ORG Tue May 31 09:22:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29CB61065672; Tue, 31 May 2011 09:22:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FB948FC13; Tue, 31 May 2011 09:22: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 p4V9Mqb9016059; Tue, 31 May 2011 09:22:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4V9MqYY016057; Tue, 31 May 2011 09:22:52 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201105310922.p4V9MqYY016057@svn.freebsd.org> From: Alexander Motin Date: Tue, 31 May 2011 09:22:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222520 - head/sys/cam/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 09:22:53 -0000 Author: mav Date: Tue May 31 09:22:52 2011 New Revision: 222520 URL: http://svn.freebsd.org/changeset/base/222520 Log: Add quirks to hint 4K physical sector (Advanced Format) for ATA disks not reporting it properly (none? of known disks now). Hitachi and WDC AF disks seem could be identified more or less formally. For Seagate and Samsung enumerate some found models/series. For other disks it can be forced with kern.cam.ada.X.quirks=1 tunable. Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Tue May 31 07:13:07 2011 (r222519) +++ head/sys/cam/ata/ata_da.c Tue May 31 09:22:52 2011 (r222520) @@ -89,7 +89,8 @@ typedef enum { } ada_flags; typedef enum { - ADA_Q_NONE = 0x00 + ADA_Q_NONE = 0x00, + ADA_Q_4K = 0x01, } ada_quirks; typedef enum { @@ -154,6 +155,86 @@ struct ada_quirk_entry { static struct ada_quirk_entry ada_quirk_table[] = { { + /* Hitachi Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "Hitachi H??????????E3*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD204UI*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Barracuda Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST????DL*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9500423AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9500424AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750420AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750422AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Momentus Thin Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST???LT*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD????RS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD????RX*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD??????RS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* WDC Caviar Green Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD??????RX*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* WDC Scorpio Black Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD???PKT*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* WDC Scorpio Black Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD?????PKT*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* WDC Scorpio Blue Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD???PVT*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* WDC Scorpio Blue Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD?????PVT*", "*" }, + /*quirks*/ADA_Q_4K + }, + { /* Default */ { T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED, @@ -740,7 +821,7 @@ adaregister(struct cam_periph *periph, v struct disk_params *dp; caddr_t match; u_int maxio; - int legacy_id; + int legacy_id, quirks; cgd = (struct ccb_getdev *)arg; if (periph == NULL) { @@ -815,6 +896,11 @@ adaregister(struct cam_periph *periph, v */ (void)cam_periph_hold(periph, PRIBIO); mtx_unlock(periph->sim->mtx); + snprintf(announce_buf, sizeof(announce_buf), + "kern.cam.ada.%d.quirks", periph->unit_number); + quirks = softc->quirks; + TUNABLE_INT_FETCH(announce_buf, &quirks); + softc->quirks = quirks; softc->write_cache = -1; snprintf(announce_buf, sizeof(announce_buf), "kern.cam.ada.%d.write_cache", periph->unit_number); @@ -870,6 +956,9 @@ adaregister(struct cam_periph *periph, v softc->disk->d_stripeoffset = (softc->disk->d_stripesize - ata_logical_sector_offset(&cgd->ident_data)) % softc->disk->d_stripesize; + } else if (softc->quirks & ADA_Q_4K) { + softc->disk->d_stripesize = 4096; + softc->disk->d_stripeoffset = 0; } softc->disk->d_fwsectors = softc->params.secs_per_track; softc->disk->d_fwheads = softc->params.heads; From owner-svn-src-head@FreeBSD.ORG Tue May 31 12:59:16 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BB791065689; Tue, 31 May 2011 12:59:16 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C2FD8FC17; Tue, 31 May 2011 12:59: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 p4VCxGLe024570; Tue, 31 May 2011 12:59:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VCxGEU024568; Tue, 31 May 2011 12:59:16 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105311259.p4VCxGEU024568@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 31 May 2011 12:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222523 - head/share/man/man7 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 12:59:16 -0000 Author: nwhitehorn Date: Tue May 31 12:59:15 2011 New Revision: 222523 URL: http://svn.freebsd.org/changeset/base/222523 Log: It is generally considered useful for release media to have kernels on them. Submitted by: joel Modified: head/share/man/man7/release.7 Modified: head/share/man/man7/release.7 ============================================================================== --- head/share/man/man7/release.7 Tue May 31 12:54:32 2011 (r222522) +++ head/share/man/man7/release.7 Tue May 31 12:59:15 2011 (r222523) @@ -65,7 +65,9 @@ and should have experience upgrading sys The release build process requires that .Pa /usr/obj be populated with the output of -.Dq Li "make buildworld" . +.Dq Li "make buildworld" +and +.Dq Li "make buildkernel" . This is necessary to provide the object files for the release or, when using .Pa generate-release.sh , @@ -294,7 +296,7 @@ The following sequence of commands can b cd /usr svn co svn://svn.freebsd.org/base/head src cd src -make buildworld +make buildworld buildkernel cd release make release make install DESTDIR=/var/freebsd-snapshot From owner-svn-src-head@FreeBSD.ORG Tue May 31 14:40:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36DAD1065673; Tue, 31 May 2011 14:40:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 271818FC1B; Tue, 31 May 2011 14:40: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 p4VEeMP2027799; Tue, 31 May 2011 14:40:22 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VEeL5u027792; Tue, 31 May 2011 14:40:21 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105311440.p4VEeL5u027792@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 31 May 2011 14:40:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222527 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 14:40:22 -0000 Author: bz Date: Tue May 31 14:40:21 2011 New Revision: 222527 URL: http://svn.freebsd.org/changeset/base/222527 Log: Conditionally compile in the af_inet and af_inet6, af_nd6 modules. If compiled in for dual-stack use, test with feature_present(3) to see if we should register the IPv4/IPv6 address family related options. In case there is no "inet" support we would love to go with the usage() and make the address family mandatory (as it is for anything but inet in theory). Unfortunately people are used to ifconfig IF up/down etc. as well, so use a fallback of "link". Adjust the man page to reflect these minor details. Improve error handling printing a warning in addition to the usage telling that we do not know the given address family in two places. Reviewed by: hrs, rwatson Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 2 weeks Modified: head/sbin/ifconfig/Makefile head/sbin/ifconfig/af_inet.c head/sbin/ifconfig/af_inet6.c head/sbin/ifconfig/af_nd6.c head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifconfig.c Modified: head/sbin/ifconfig/Makefile ============================================================================== --- head/sbin/ifconfig/Makefile Tue May 31 14:18:10 2011 (r222526) +++ head/sbin/ifconfig/Makefile Tue May 31 14:40:21 2011 (r222527) @@ -15,10 +15,16 @@ SRCS= ifconfig.c # base support # of the toolchain. # SRCS+= af_link.c # LLC support +.if ${MK_INET_SUPPORT} != "no" SRCS+= af_inet.c # IPv4 support +.endif +.if ${MK_INET6_SUPPORT} != "no" SRCS+= af_inet6.c # IPv6 support +.endif SRCS+= af_atalk.c # AppleTalk support +.if ${MK_INET6_SUPPORT} != "no" SRCS+= af_nd6.c # ND6 support +.endif SRCS+= ifclone.c # clone device support SRCS+= ifmac.c # MAC support @@ -38,6 +44,12 @@ SRCS+= ifpfsync.c # pfsync(4) support SRCS+= ifbridge.c # bridge support SRCS+= iflagg.c # lagg support +.if ${MK_INET6_SUPPORT} != "no" +CFLAGS+= -DINET6 +.endif +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+= -DINET +.endif .if ${MK_IPX_SUPPORT} != "no" && !defined(RELEASE_CRUNCH) SRCS+= af_ipx.c # IPX support DPADD+= ${LIBIPX} Modified: head/sbin/ifconfig/af_inet.c ============================================================================== --- head/sbin/ifconfig/af_inet.c Tue May 31 14:18:10 2011 (r222526) +++ head/sbin/ifconfig/af_inet.c Tue May 31 14:40:21 2011 (r222527) @@ -200,5 +200,7 @@ static struct afswtch af_inet = { static __constructor void inet_ctor(void) { + if (!feature_present("inet")) + return; af_register(&af_inet); } Modified: head/sbin/ifconfig/af_inet6.c ============================================================================== --- head/sbin/ifconfig/af_inet6.c Tue May 31 14:18:10 2011 (r222526) +++ head/sbin/ifconfig/af_inet6.c Tue May 31 14:40:21 2011 (r222527) @@ -541,6 +541,9 @@ inet6_ctor(void) #define N(a) (sizeof(a) / sizeof(a[0])) size_t i; + if (!feature_present("inet6")) + return; + for (i = 0; i < N(inet6_cmds); i++) cmd_register(&inet6_cmds[i]); af_register(&af_inet6); Modified: head/sbin/ifconfig/af_nd6.c ============================================================================== --- head/sbin/ifconfig/af_nd6.c Tue May 31 14:18:10 2011 (r222526) +++ head/sbin/ifconfig/af_nd6.c Tue May 31 14:40:21 2011 (r222527) @@ -225,5 +225,9 @@ static struct afswtch af_nd6 = { static __constructor void nd6_ctor(void) { + + if (!feature_present("inet6")) + return; + af_register(&af_nd6); } Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Tue May 31 14:18:10 2011 (r222526) +++ head/sbin/ifconfig/ifconfig.8 Tue May 31 14:40:21 2011 (r222527) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd March 20, 2011 +.Dd May 31, 2011 .Dt IFCONFIG 8 .Os .Sh NAME @@ -42,7 +42,7 @@ .Op Fl n .Ar interface .Op Cm create -.Op Ar address_family +.Ar address_family .Oo .Ar address .Op Ar dest_address @@ -165,8 +165,10 @@ and .Dq link . .\" and .\" .Dq ns . -The default is -.Dq inet . +The default if available is +.Dq inet +or otherwise +.Dq link . .Dq ether and .Dq lladdr Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Tue May 31 14:18:10 2011 (r222526) +++ head/sbin/ifconfig/ifconfig.c Tue May 31 14:40:21 2011 (r222527) @@ -220,8 +220,10 @@ main(int argc, char *argv[]) ifindex = 0; if (argc == 1) { afp = af_getbyname(*argv); - if (afp == NULL) + if (afp == NULL) { + warnx("Address family '%s' unknown.", *argv); usage(); + } if (afp->af_name != NULL) argc--, argv++; /* leave with afp non-zero */ @@ -484,7 +486,28 @@ ifconfig(int argc, char *const *argv, in int s; strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name); - afp = uafp != NULL ? uafp : af_getbyname("inet"); + afp = NULL; + if (uafp != NULL) + afp = uafp; + /* + * This is the historical "accident" allowing users to configure IPv4 + * addresses without the "inet" keyword which while a nice feature has + * proven to complicate other things. We cannot remove this but only + * make sure we will never have a similar implicit default for IPv6 or + * any other address familiy. We need a fallback though for + * ifconfig IF up/down etc. to work without INET support as people + * never used ifconfig IF link up/down, etc. either. + */ +#ifdef INET + if (afp == NULL && feature_present("inet")) + afp = af_getbyname("inet"); +#endif + if (afp == NULL) + afp = af_getbyname("link"); + if (afp == NULL) { + warnx("Please specify an address_family."); + usage(); + } top: ifr.ifr_addr.sa_family = afp->af_af == AF_LINK || afp->af_af == AF_UNSPEC ? From owner-svn-src-head@FreeBSD.ORG Tue May 31 14:48:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66441106564A; Tue, 31 May 2011 14:48:05 +0000 (UTC) (envelope-from ben@links.org) Received: from mail.links.org (mail.links.org [217.155.92.109]) by mx1.freebsd.org (Postfix) with ESMTP id 1F1E78FC13; Tue, 31 May 2011 14:48:04 +0000 (UTC) Received: from [193.133.15.218] (localhost [127.0.0.1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.links.org (Postfix) with ESMTPS id F005233C1A; Tue, 31 May 2011 15:28:45 +0100 (BST) Message-ID: <4DE4FB1D.8090407@links.org> Date: Tue, 31 May 2011 15:28:45 +0100 From: Ben Laurie User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201105182106.p4IL6KkE008657@svn.freebsd.org> <20110518211651.GE2273@garage.freebsd.pl> In-Reply-To: <20110518211651.GE2273@garage.freebsd.pl> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222084 - head/contrib/gperf/src X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 14:48:05 -0000 On 18/05/2011 22:16, Pawel Jakub Dawidek wrote: > On Wed, May 18, 2011 at 09:06:20PM +0000, Ben Laurie wrote: >> Author: benl >> Date: Wed May 18 21:06:20 2011 >> New Revision: 222084 >> URL: http://svn.freebsd.org/changeset/base/222084 >> >> Log: >> Fix clang warnings. >> >> Approved by: philip (mentor) > [...] >> - fprintf (stderr, " by changing asso_value['%c'] (char #%d) to %d\n", >> + fprintf (stderr, " by changing asso_value['%c'] (char #%zd) to %d\n", >> *p, p - union_set + 1, asso_values[(unsigned char)(*p)]); > > Hmm, both 'p' and 'union_set' are 'char *' and %zd is for ssize_t. It is > a bit strange that it fixes the warning. Why? The difference between two pointers is ssize_t, surely? -- http://www.apache-ssl.org/ben.html http://www.links.org/ "There is no limit to what a man can do or how far he can go if he doesn't mind who gets the credit." - Robert Woodruff From owner-svn-src-head@FreeBSD.ORG Tue May 31 15:02:30 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4F501065677; Tue, 31 May 2011 15:02:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3F538FC17; Tue, 31 May 2011 15:02:30 +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 p4VF2UGq028486; Tue, 31 May 2011 15:02:30 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VF2Uew028482; Tue, 31 May 2011 15:02:30 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105311502.p4VF2Uew028482@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 31 May 2011 15:02:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222528 - in head/usr.sbin/pc-sysinstall: backend backend-query X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 15:02:30 -0000 Author: bz Date: Tue May 31 15:02:30 2011 New Revision: 222528 URL: http://svn.freebsd.org/changeset/base/222528 Log: Start teaching pc-sysinstall about IPv6. Add some additional empty string checks for IPv4 and try to configure a netmask along with the address rather than doing things twice. Contrary to AUTO-DHCP, IPv6-SLAAC will accept static configuration as well, which we will use at least for resolv.conf currently and if we were given a static address configure that as an alias as well. The pc-sysinstaller changes going along were committed to PC-BSD as r10773. Reviewed by: kmoore Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 20 days Modified: head/usr.sbin/pc-sysinstall/backend-query/enable-net.sh head/usr.sbin/pc-sysinstall/backend-query/test-netup.sh head/usr.sbin/pc-sysinstall/backend/functions-networking.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/enable-net.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/enable-net.sh Tue May 31 14:40:21 2011 (r222527) +++ head/usr.sbin/pc-sysinstall/backend-query/enable-net.sh Tue May 31 15:02:30 2011 (r222528) @@ -1,6 +1,11 @@ #!/bin/sh #- # Copyright (c) 2010 iXsystems, Inc. All rights reserved. +# Copyright (c) 2011 The FreeBSD Foundation +# All rights reserved. +# +# Portions of this software were developed by Bjoern Zeeb +# under sponsorship from the FreeBSD Foundation. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -40,23 +45,67 @@ NETMASK="$3" DNS="$4" GATEWAY="$5" MIRRORFETCH="$6" +IPV6="$7" +IPV6GATE="$8" +IPV6DNS="$9" if [ -z "${NIC}" ] then - echo "ERROR: Usage enable-net " + echo "ERROR: Usage enable-net " \ + " " exit 150 fi if [ "$NIC" = "AUTO-DHCP" ] then enable_auto_dhcp +elif [ "$NIC" = "IPv6-SLAAC" ] +then + enable_auto_slaac + # In addition, if static values were defined, add them as well. + # We might not get DNS information from RAs, for example. + if [ -n "${IPV6}" ]; then + VAL="" + get_first_wired_nic + if [ -n "${VAL}" ]; then + ifconfig ${VAL} inet6 ${IPV6} alias + fi + fi + # Append only here. + if [ -n "${IPV6DNS}" ]; then + echo "nameserver ${IPV6DNS}" >>/etc/resolv.conf + fi + # Do not + if [ -n "${IPV6GATE}" ]; then + # Check if we have a default route already to not overwrite. + if ! route -n get -inet6 default > /dev/null 2>&1 ; then + route add -inet6 default ${IPV6GATE} + fi + fi else echo "Enabling NIC: $NIC" - ifconfig ${NIC} ${IP} ${NETMASK} - - echo "nameserver ${DNS}" >/etc/resolv.conf - - route add default ${GATE} + if [ -n "${IP}" ]; then + ifconfig ${NIC} inet ${IP} ${NETMASK} + fi + if [ -n "${IPV6}" ]; then + ifconfig ${NIC} inet6 ${IPV6} alias + fi + + # Keep default from IPv4-only support times and clear the resolv.conf file. + : > /etc/resolv.conf + if [ -n "${DNS}" ]; then + echo "nameserver ${DNS}" >>/etc/resolv.conf + fi + if [ -n "${IPV6DNS}" ]; then + echo "nameserver ${IPV6DNS}" >>/etc/resolv.conf + fi + + if [ -n "${GATE}" ]; then + route add -inet default ${GATE} + fi + if [ -n "${IPV6GATE}" ]; then + route add -inet6 default ${IPV6GATE} + fi fi case ${MIRRORFETCH} in Modified: head/usr.sbin/pc-sysinstall/backend-query/test-netup.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/test-netup.sh Tue May 31 14:40:21 2011 (r222527) +++ head/usr.sbin/pc-sysinstall/backend-query/test-netup.sh Tue May 31 15:02:30 2011 (r222528) @@ -1,6 +1,11 @@ #!/bin/sh #- # Copyright (c) 2010 iXsystems, Inc. All rights reserved. +# Copyright (c) 2011 The FreeBSD Foundation +# All rights reserved. +# +# Portions of this software were developed by Bjoern Zeeb +# under sponsorship from the FreeBSD Foundation.# # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -26,8 +31,8 @@ # $FreeBSD$ -# Script which tests "fetch" when using a network connection, and saves -# if we are using direct connect, or need FTP passive mode +# Script which tries to ping "home" to see if Internet connectivity is +# available. ############################################################################# rm ${TMPDIR}/.testftp >/dev/null 2>/dev/null @@ -39,12 +44,26 @@ then exit 0 fi +ping6 -c 2 www.pcbsd.org >/dev/null 2>/dev/null +if [ "$?" = "0" ] +then + echo "ftp: Up" + exit 0 +fi + ping -c 2 www.freebsd.org >/dev/null 2>/dev/null if [ "$?" = "0" ] then echo "ftp: Up" exit 0 fi - + +ping6 -c 2 www.freebsd.org >/dev/null 2>/dev/null +if [ "$?" = "0" ] +then + echo "ftp: Up" + exit 0 +fi + echo "ftp: Down" exit 1 Modified: head/usr.sbin/pc-sysinstall/backend/functions-networking.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-networking.sh Tue May 31 14:40:21 2011 (r222527) +++ head/usr.sbin/pc-sysinstall/backend/functions-networking.sh Tue May 31 15:02:30 2011 (r222528) @@ -1,6 +1,11 @@ #!/bin/sh #- # Copyright (c) 2010 iXsystems, Inc. All rights reserved. +# Copyright (c) 2011 The FreeBSD Foundation +# All rights reserved. +# +# Portions of this software were developed by Bjoern Zeeb +# under sponsorship from the FreeBSD Foundation. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -119,6 +124,61 @@ save_auto_dhcp() enable_dhcp_all }; +# Function which simply enables iPv6 SLAAC on all detected nics +enable_slaac_all() +{ + rm ${TMPDIR}/.niclist >/dev/null 2>/dev/null + # start by getting a list of nics on this system + ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist + if [ -e "${TMPDIR}/.niclist" ] + then + echo "# Auto-Enabled NICs from pc-sysinstall" >>${FSMNT}/etc/rc.conf + WLANCOUNT="0" + while read line + do + NIC="`echo $line | cut -d ':' -f 1`" + DESC="`echo $line | cut -d ':' -f 2`" + echo_log "Setting $NIC to acceptign RAs on the system." + check_is_wifi ${NIC} + if [ $? -eq 0 ] + then + # We have a wifi device, setup a wlan* entry for it + # Given we cannot have DHCP and SLAAC the same time currently + # it's save to just duplicate. + WLAN="wlan${WLANCOUNT}" + echo "wlans_${NIC}=\"${WLAN}\"" >>${FSMNT}/etc/rc.conf + #echo "ifconfig_${NIC}=\"up\"" >>${FSMNT}/etc/rc.conf + echo "ifconfig_${WLAN}=\"inet6 accept_rtadv\"" >>${FSMNT}/etc/rc.conf + CNIC="${WLAN}" + WLANCOUNT=$((WLANCOUNT+1)) + else + #echo "ifconfig_${NIC}=\"up\"" >>${FSMNT}/etc/rc.conf + echo "ifconfig_${NIC}_ipv6=\"inet6 accept_rtadv\"" >>${FSMNT}/etc/rc.conf + CNIC="${NIC}" + fi + + done < ${TMPDIR}/.niclist + fi + + # Given we cannot yet rely on RAs to provide DNS information as much + # as we can in the DHCP world, we should append a given nameserver. + : > ${FSMNT}/etc/resolv.conf + get_value_from_cfg netSaveIPv6NameServer + NAMESERVER="${VAL}" + if [ -n "${NAMESERVER}" ] + then + echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf + fi + +}; + + +# Function which detects available nics, and enables IPv6 SLAAC on them +save_auto_slaac() +{ + enable_slaac_all +}; + # Function which saves a manual nic setup to the installed system save_manual_nic() @@ -137,21 +197,41 @@ save_manual_nic() fi # If we get here, we have a manual setup, lets do so now + IFARGS="" + IF6ARGS="" # Set the manual IP - IFARGS="inet ${NETIP}" - - # Check if we have a netmask to set - get_value_from_cfg netSaveMask - NETMASK="${VAL}" - if [ -n "${NETMASK}" ] + if [ -n "${NETIP}" ] then - IFARGS="${IFARGS} netmask ${NETMASK}" + IFARGS="inet ${NETIP}" + + # Check if we have a netmask to set + get_value_from_cfg netSaveMask + NETMASK="${VAL}" + if [ -n "${NETMASK}" ] + then + IFARGS="${IFARGS} netmask ${NETMASK}" + fi fi + get_value_from_cfg netSaveIPv6 + NETIP6="${VAL}" + if [ -n "${NETIP6}" ] + then + # Make sure we have one inet6 prefix. + IF6ARGS=`echo "${NETIP6}" | awk '{ if ("^inet6 ") { print $0; } else + { printf "inet6 %s", $0; } }'` + fi echo "# Auto-Enabled NICs from pc-sysinstall" >>${FSMNT}/etc/rc.conf - echo "ifconfig_${NIC}=\"${IFARGS}\"" >>${FSMNT}/etc/rc.conf + if [ -n "${IFARGS}" ] + then + echo "ifconfig_${NIC}=\"${IFARGS}\"" >>${FSMNT}/etc/rc.conf + fi + if [ -n "${IF6ARGS}" ] + then + echo "ifconfig_${NIC}_ipv6=\"${IF6ARGS}\"" >>${FSMNT}/etc/rc.conf + fi # Check if we have a default router to set get_value_from_cfg netSaveDefaultRouter @@ -160,15 +240,28 @@ save_manual_nic() then echo "defaultrouter=\"${NETROUTE}\"" >>${FSMNT}/etc/rc.conf fi + get_value_from_cfg netSaveIPv6DefaultRouter + NETROUTE="${VAL}" + if [ -n "${NETROUTE}" ] + then + echo "ipv6_defaultrouter=\"${NETROUTE}\"" >>${FSMNT}/etc/rc.conf + fi # Check if we have a nameserver to enable + : > ${FSMNT}/etc/resolv.conf get_value_from_cfg netSaveNameServer NAMESERVER="${VAL}" if [ -n "${NAMESERVER}" ] then - echo "nameserver ${NAMESERVER}" >${FSMNT}/etc/resolv.conf + echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf fi - + get_value_from_cfg netSaveIPv6NameServer + NAMESERVER="${VAL}" + if [ -n "${NAMESERVER}" ] + then + echo "nameserver ${NAMESERVER}" >>${FSMNT}/etc/resolv.conf + fi + }; # Function which determines if a nic is active / up @@ -208,6 +301,31 @@ enable_auto_dhcp() }; +# Function which detects available nics, and runs rtsol on them. +enable_auto_slaac() +{ + + # start by getting a list of nics on this system + ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist + ALLNICS="" + while read line + do + NIC="`echo $line | cut -d ':' -f 1`" + DESC="`echo $line | cut -d ':' -f 2`" + + is_nic_active "${NIC}" + if [ $? -eq 0 ] ; then + echo_log "Will try IPv6 SLAAC on $NIC $DESC" + ifconfig ${NIC} inet6 -ifdisabled accept_rtadv up + ALLNICS="${ALLNICS} ${NIC}" + fi + done < ${TMPDIR}/.niclist + + # XXX once we support it in-tree call /sbin/resovconf here. + echo_log "Running rtsol on ${ALLNICS}" + rtsol -F ${ALLNICS} >/dev/null 2>/dev/null +} + # Get the mac address of a target NIC get_nic_mac() { @@ -236,15 +354,20 @@ enable_manual_nic() # If we get here, we have a manual setup, lets do so now - # Set the manual IP - rc_halt "ifconfig ${NIC} ${NETIP}" + # IPv4: - # Check if we have a netmask to set - get_value_from_cfg netMask - NETMASK="${VAL}" - if [ -n "${NETMASK}" ] + # Set the manual IP + if [ -n "${NETIP}" ] then - rc_halt "ifconfig ${NIC} netmask ${NETMASK}" + # Check if we have a netmask to set + get_value_from_cfg netMask + NETMASK="${VAL}" + if [ -n "${NETMASK}" ] + then + rc_halt "ifconfig inet ${NIC} netmask ${NETMASK}" + else + rc_halt "ifconfig inet ${NIC} ${NETIP}" + fi fi # Check if we have a default router to set @@ -252,18 +375,42 @@ enable_manual_nic() NETROUTE="${VAL}" if [ -n "${NETROUTE}" ] then - rc_halt "route add default ${NETROUTE}" + rc_halt "route add -inet default ${NETROUTE}" + fi + + # IPv6: + + # Set static IPv6 address + get_value_from_cfg netIPv6 + NETIP="${VAL}" + if [ -n ${NETIP} ] + then + rc_halt "ifconfig inet6 ${NIC} ${NETIP} -ifdisabled up" + fi + + # Default router + get_value_from_cfg netIPv6DefaultRouter + NETROUTE="${VAL}" + if [ -n "${NETROUTE}" ] + then + rc_halt "route add -inet6 default ${NETROUTE}" fi # Check if we have a nameserver to enable + : >/etc/resolv.conf get_value_from_cfg netNameServer NAMESERVER="${VAL}" if [ -n "${NAMESERVER}" ] then - echo "nameserver ${NAMESERVER}" >/etc/resolv.conf + echo "nameserver ${NAMESERVER}" >>/etc/resolv.conf fi - - + get_value_from_cfg netIPv6NameServer + NAMESERVER="${VAL}" + if [ -n "${NAMESERVER}" ] + then + echo "nameserver ${NAMESERVER}" >>/etc/resolv.conf + fi + }; @@ -281,6 +428,9 @@ start_networking() if [ "$NETDEV" = "AUTO-DHCP" ] then enable_auto_dhcp + elif [ "$NETDEV" = "IPv6-SLAAC" ] + then + enable_auto_slaac else enable_manual_nic ${NETDEV} fi @@ -304,6 +454,9 @@ save_networking_install() if [ "$NETDEV" = "AUTO-DHCP" ] then save_auto_dhcp + elif [ "$NETDEV" = "IPv6-SLAAC" ] + then + save_auto_slaac else save_manual_nic ${NETDEV} fi From owner-svn-src-head@FreeBSD.ORG Tue May 31 15:05:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 980811065673; Tue, 31 May 2011 15:05:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 886EB8FC0A; Tue, 31 May 2011 15:05:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4VF5TMn028606; Tue, 31 May 2011 15:05:29 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VF5Ta8028602; Tue, 31 May 2011 15:05:29 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201105311505.p4VF5Ta8028602@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 31 May 2011 15:05:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222529 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 15:05:29 -0000 Author: bz Date: Tue May 31 15:05:29 2011 New Revision: 222529 URL: http://svn.freebsd.org/changeset/base/222529 Log: Remove some further INET related symbols from pf to allow the module to not only compile bu load as well for testing with IPv6-only kernels. For the moment we ignore the csum change in pf_ioctl.c given the pending update to pf45. Reported by: dru Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 20 days Modified: head/sys/contrib/pf/net/pf.c head/sys/contrib/pf/net/pf_ioctl.c head/sys/contrib/pf/net/pf_norm.c Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Tue May 31 15:02:30 2011 (r222528) +++ head/sys/contrib/pf/net/pf.c Tue May 31 15:05:29 2011 (r222529) @@ -6132,9 +6132,11 @@ pf_routable(struct pf_addr *addr, sa_fam #ifdef __FreeBSD__ /* XXX MRT not always INET */ /* stick with table 0 though */ +#ifdef INET if (af == AF_INET) in_rtalloc_ign((struct route *)&ro, 0, 0); else +#endif rtalloc_ign((struct route *)&ro, 0); #else /* ! __FreeBSD__ */ rtalloc_noclone((struct route *)&ro, NO_CLONING); @@ -6214,9 +6216,11 @@ pf_rtlabel_match(struct pf_addr *addr, s # ifdef RTF_PRCLONING rtalloc_ign((struct route *)&ro, (RTF_CLONING|RTF_PRCLONING)); # else /* !RTF_PRCLONING */ +#ifdef INET if (af == AF_INET) in_rtalloc_ign((struct route *)&ro, 0, 0); else +#endif rtalloc_ign((struct route *)&ro, 0); # endif #else /* ! __FreeBSD__ */ @@ -6789,11 +6793,13 @@ pf_check_proto_cksum(struct mbuf *m, int KMOD_UDPSTAT_INC(udps_badsum); break; } +#ifdef INET case IPPROTO_ICMP: { KMOD_ICMPSTAT_INC(icps_checksum); break; } +#endif #ifdef INET6 case IPPROTO_ICMPV6: { @@ -6889,9 +6895,11 @@ pf_check_proto_cksum(struct mbuf *m, int case IPPROTO_UDP: KMOD_UDPSTAT_INC(udps_badsum); break; +#ifdef INET case IPPROTO_ICMP: KMOD_ICMPSTAT_INC(icps_checksum); break; +#endif #ifdef INET6 case IPPROTO_ICMPV6: KMOD_ICMP6STAT_INC(icp6s_checksum); Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Tue May 31 15:02:30 2011 (r222528) +++ head/sys/contrib/pf/net/pf_ioctl.c Tue May 31 15:05:29 2011 (r222529) @@ -3735,9 +3735,12 @@ pf_check6_out(void *arg, struct mbuf **m */ int chk; - /* We need a proper CSUM befor we start (s. OpenBSD ip_output) */ + /* We need a proper CSUM before we start (s. OpenBSD ip_output) */ if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { +#ifdef INET + /* XXX-BZ copy&paste error from r126261? */ in_delayed_cksum(*m); +#endif (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } chk = pf_test6(PF_OUT, ifp, m, NULL, inp); Modified: head/sys/contrib/pf/net/pf_norm.c ============================================================================== --- head/sys/contrib/pf/net/pf_norm.c Tue May 31 15:02:30 2011 (r222528) +++ head/sys/contrib/pf/net/pf_norm.c Tue May 31 15:05:29 2011 (r222529) @@ -949,6 +949,7 @@ pf_fragcache(struct mbuf **m0, struct ip return (NULL); } +#ifdef INET int pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short *reason, struct pf_pdesc *pd) @@ -1198,6 +1199,7 @@ pf_normalize_ip(struct mbuf **m0, int di return (PF_DROP); } +#endif #ifdef INET6 int From owner-svn-src-head@FreeBSD.ORG Tue May 31 15:11:23 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D60CA1065674; Tue, 31 May 2011 15:11:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C63678FC17; Tue, 31 May 2011 15:11: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 p4VFBNOI028833; Tue, 31 May 2011 15:11:23 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VFBNnu028827; Tue, 31 May 2011 15:11:23 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201105311511.p4VFBNnu028827@svn.freebsd.org> From: John Baldwin Date: Tue, 31 May 2011 15:11:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222530 - in head: contrib/top usr.bin/top X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 15:11:23 -0000 Author: jhb Date: Tue May 31 15:11:23 2011 New Revision: 222530 URL: http://svn.freebsd.org/changeset/base/222530 Log: Add a new option to toggle the display of the system idle process (per-CPU idle threads). The process is displayed by default (subject to whether or not system processes are displayed) to preserve existing behavior. The system idle process can be hidden via the '-z' command line argument or the 'z' key while top is running. When it is hidden, top more closely matches the behavior of FreeBSD <= 4.x where idle time was not accounted to any process. MFC after: 2 weeks Modified: head/contrib/top/commands.c head/contrib/top/machine.h head/contrib/top/top.X head/contrib/top/top.c head/usr.bin/top/machine.c Modified: head/contrib/top/commands.c ============================================================================== --- head/contrib/top/commands.c Tue May 31 15:05:29 2011 (r222529) +++ head/contrib/top/commands.c Tue May 31 15:11:23 2011 (r222530) @@ -94,6 +94,7 @@ S - toggle the displaying of syste a - toggle the displaying of process titles\n\ t - toggle the display of this process\n\ u - display processes for only one user (+ selects all users)\n\ +z - toggle the displaying of the system idle process\n\ \n\ \n", stdout); } Modified: head/contrib/top/machine.h ============================================================================== --- head/contrib/top/machine.h Tue May 31 15:05:29 2011 (r222529) +++ head/contrib/top/machine.h Tue May 31 15:11:23 2011 (r222530) @@ -65,6 +65,7 @@ struct process_select int uid; /* only this uid (unless uid == -1) */ int wcpu; /* show weighted cpu */ int jail; /* show jail ID */ + int kidle; /* show per-CPU idle threads */ char *command; /* only this command (unless == NULL) */ }; Modified: head/contrib/top/top.X ============================================================================== --- head/contrib/top/top.X Tue May 31 15:05:29 2011 (r222529) +++ head/contrib/top/top.X Tue May 31 15:11:23 2011 (r222530) @@ -10,7 +10,7 @@ top \- display and update information ab .SH SYNOPSIS .B top [ -.B \-abCHIijnPqStuv +.B \-abCHIijnPqStuvz ] [ .BI \-d count ] [ @@ -142,6 +142,9 @@ Write version number information to stde No other processing takes place when this option is used. To see current revision information while top is running, use the help command \*(lq?\*(rq. .TP +.B \-z +Do not display the system idle process. +.TP .BI \-d count Show only .I count @@ -303,6 +306,9 @@ ID. Toggle the display of the .I top process. +.TP +.B z +Toggle the display of the system idle process. .SH "THE DISPLAY" The actual display varies depending on the specific variant of Unix that the machine is running. This description may not exactly match Modified: head/contrib/top/top.c ============================================================================== --- head/contrib/top/top.c Tue May 31 15:05:29 2011 (r222529) +++ head/contrib/top/top.c Tue May 31 15:11:23 2011 (r222530) @@ -196,9 +196,9 @@ char *argv[]; fd_set readfds; #ifdef ORDER - static char command_chars[] = "\f qh?en#sdkriIutHmSCajo"; + static char command_chars[] = "\f qh?en#sdkriIutHmSCajzo"; #else - static char command_chars[] = "\f qh?en#sdkriIutHmSCaj"; + static char command_chars[] = "\f qh?en#sdkriIutHmSCajz"; #endif /* these defines enumerate the "strchr"s of the commands in command_chars */ #define CMD_redraw 0 @@ -224,8 +224,9 @@ char *argv[]; #define CMD_wcputog 19 #define CMD_showargs 20 #define CMD_jidtog 21 +#define CMD_kidletog 22 #ifdef ORDER -#define CMD_order 22 +#define CMD_order 23 #endif /* set the buffer for stdout */ @@ -258,6 +259,7 @@ char *argv[]; ps.thread = No; ps.wcpu = 1; ps.jail = No; + ps.kidle = Yes; ps.command = NULL; /* get preset options from the environment */ @@ -283,7 +285,7 @@ char *argv[]; optind = 1; } - while ((i = getopt(ac, av, "CSIHPabijnquvs:d:U:m:o:t")) != EOF) + while ((i = getopt(ac, av, "CSIHPabijnquvzs:d:U:m:o:t")) != EOF) { switch(i) { @@ -412,10 +414,14 @@ char *argv[]; pcpu_stats = Yes; break; + case 'z': + ps.kidle = !ps.kidle; + break; + default: fprintf(stderr, "Top version %s\n" -"Usage: %s [-abCHIijnPqStuv] [-d count] [-m io | cpu] [-o field] [-s time]\n" +"Usage: %s [-abCHIijnPqStuvz] [-d count] [-m io | cpu] [-o field] [-s time]\n" " [-U username] [number]\n", version_string(), myname); exit(1); @@ -1075,7 +1081,13 @@ restart: reset_display(); putchar('\r'); break; - + case CMD_kidletog: + ps.kidle = !ps.kidle; + new_message(MT_standout | MT_delayed, + " %sisplaying system idle process.", + ps.kidle ? "D" : "Not d"); + putchar('\r'); + break; default: new_message(MT_standout, " BAD CASE IN SWITCH!"); putchar('\r'); Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Tue May 31 15:05:29 2011 (r222529) +++ head/usr.bin/top/machine.c Tue May 31 15:11:23 2011 (r222530) @@ -624,6 +624,7 @@ get_process_info(struct system_info *si, int show_system; int show_uid; int show_command; + int show_kidle; /* * Save the previous process info. @@ -664,6 +665,7 @@ get_process_info(struct system_info *si, show_system = sel->system; show_uid = sel->uid != -1; show_command = sel->command != NULL; + show_kidle = sel->kidle; /* count up process states and get pointers to interesting procs */ total_procs = 0; @@ -705,6 +707,11 @@ get_process_info(struct system_info *si, /* skip idle or non-running processes */ continue; + if (displaymode == DISP_CPU && !show_kidle && + pp->ki_tdflags & TDF_IDLETD) + /* skip kernel idle process */ + continue; + if (displaymode == DISP_IO && !show_idle && p_io == 0) /* skip processes that aren't doing I/O */ continue; From owner-svn-src-head@FreeBSD.ORG Tue May 31 15:11:44 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D59D1065675; Tue, 31 May 2011 15:11:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B3128FC20; Tue, 31 May 2011 15:11:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4VFBhtU028892; Tue, 31 May 2011 15:11:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VFBhXF028875; Tue, 31 May 2011 15:11:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201105311511.p4VFBhXF028875@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 31 May 2011 15:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222531 - in head/sys: i386/pci ia64/ia64 kern mips/mips net powerpc/booke powerpc/powerpc sparc64/sparc64 sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 15:11:44 -0000 Author: nwhitehorn Date: Tue May 31 15:11:43 2011 New Revision: 222531 URL: http://svn.freebsd.org/changeset/base/222531 Log: On multi-core, multi-threaded PPC systems, it is important that the threads be brought up in the order they are enumerated in the device tree (in particular, that thread 0 on each core be brought up first). The SLIST through which we loop to start the CPUs has all of its entries added with SLIST_INSERT_HEAD(), which means it is in reverse order of enumeration and so AP startup would always fail in such situations (causing a machine check or RTAS failure). Fix this by changing the SLIST into an STAILQ, and inserting new CPUs at the end. Reviewed by: jhb Modified: head/sys/i386/pci/pci_cfgreg.c head/sys/ia64/ia64/machdep.c head/sys/ia64/ia64/mp_machdep.c head/sys/ia64/ia64/pmap.c head/sys/kern/kern_idle.c head/sys/kern/sched_4bsd.c head/sys/kern/subr_kdb.c head/sys/kern/subr_pcpu.c head/sys/mips/mips/mp_machdep.c head/sys/net/netisr.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/powerpc/mp_machdep.c head/sys/sparc64/sparc64/mp_machdep.c head/sys/sparc64/sparc64/pmap.c head/sys/sys/pcpu.h Modified: head/sys/i386/pci/pci_cfgreg.c ============================================================================== --- head/sys/i386/pci/pci_cfgreg.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/i386/pci/pci_cfgreg.c Tue May 31 15:11:43 2011 (r222531) @@ -553,7 +553,7 @@ pcie_cfgregopen(uint64_t base, uint8_t m (uintmax_t)base); #ifdef SMP - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) #endif { Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/ia64/ia64/machdep.c Tue May 31 15:11:43 2011 (r222531) @@ -316,7 +316,7 @@ cpu_startup(void *dummy) /* * Create sysctl tree for per-CPU information. */ - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { snprintf(nodename, sizeof(nodename), "%u", pc->pc_cpuid); sysctl_ctx_init(&pc->pc_md.sysctl_ctx); pc->pc_md.sysctl_tree = SYSCTL_ADD_NODE(&pc->pc_md.sysctl_ctx, Modified: head/sys/ia64/ia64/mp_machdep.c ============================================================================== --- head/sys/ia64/ia64/mp_machdep.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/ia64/ia64/mp_machdep.c Tue May 31 15:11:43 2011 (r222531) @@ -357,7 +357,7 @@ cpu_mp_start() /* Keep 'em spinning until we unleash them... */ ia64_ap_state.as_spin = 1; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { pc->pc_md.current_pmap = kernel_pmap; pc->pc_other_cpus = all_cpus & ~pc->pc_cpumask; /* The BSP is obviously running already. */ @@ -424,7 +424,7 @@ cpu_mp_unleash(void *dummy) cpus = 0; smp_cpus = 0; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { cpus++; if (pc->pc_md.awake) { kproc_create(ia64_store_mca_state, pc, NULL, 0, 0, @@ -462,7 +462,7 @@ ipi_selected(cpumask_t cpus, int ipi) { struct pcpu *pc; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if (cpus & pc->pc_cpumask) ipi_send(pc, ipi); } @@ -486,7 +486,7 @@ ipi_all_but_self(int ipi) { struct pcpu *pc; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if (pc != pcpup) ipi_send(pc, ipi); } Modified: head/sys/ia64/ia64/pmap.c ============================================================================== --- head/sys/ia64/ia64/pmap.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/ia64/ia64/pmap.c Tue May 31 15:11:43 2011 (r222531) @@ -535,7 +535,7 @@ pmap_invalidate_page(vm_offset_t va) critical_enter(); vhpt_ofs = ia64_thash(va) - PCPU_GET(md.vhpt); tag = ia64_ttag(va); - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { pte = (struct ia64_lpte *)(pc->pc_md.vhpt + vhpt_ofs); atomic_cmpset_64(&pte->tag, tag, 1UL << 63); } Modified: head/sys/kern/kern_idle.c ============================================================================== --- head/sys/kern/kern_idle.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/kern/kern_idle.c Tue May 31 15:11:43 2011 (r222531) @@ -60,7 +60,7 @@ idle_setup(void *dummy) p = NULL; /* start with no idle process */ #ifdef SMP - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { #endif #ifdef SMP error = kproc_kthread_add(sched_idletd, NULL, &p, &td, Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/kern/sched_4bsd.c Tue May 31 15:11:43 2011 (r222531) @@ -1081,7 +1081,7 @@ forward_wakeup(int cpunum) dontuse = me | stopped_cpus | hlt_cpus_mask; map2 = 0; if (forward_wakeup_use_loop) { - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { id = pc->pc_cpumask; if ((id & dontuse) == 0 && pc->pc_curthread == pc->pc_idlethread) { @@ -1112,7 +1112,7 @@ forward_wakeup(int cpunum) } if (map) { forward_wakeups_delivered++; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { id = pc->pc_cpumask; if ((map & id) == 0) continue; Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/kern/subr_kdb.c Tue May 31 15:11:43 2011 (r222531) @@ -412,7 +412,7 @@ kdb_thr_ctx(struct thread *thr) return (&kdb_pcb); #if defined(SMP) && defined(KDB_STOPPEDPCB) - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if (pc->pc_curthread == thr && (stopped_cpus & pc->pc_cpumask)) return (KDB_STOPPEDPCB(pc)); } Modified: head/sys/kern/subr_pcpu.c ============================================================================== --- head/sys/kern/subr_pcpu.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/kern/subr_pcpu.c Tue May 31 15:11:43 2011 (r222531) @@ -74,7 +74,7 @@ static TAILQ_HEAD(, dpcpu_free) dpcpu_he static struct sx dpcpu_lock; uintptr_t dpcpu_off[MAXCPU]; struct pcpu *cpuid_to_pcpu[MAXCPU]; -struct cpuhead cpuhead = SLIST_HEAD_INITIALIZER(cpuhead); +struct cpuhead cpuhead = STAILQ_HEAD_INITIALIZER(cpuhead); /* * Initialize the MI portions of a struct pcpu. @@ -89,7 +89,7 @@ pcpu_init(struct pcpu *pcpu, int cpuid, pcpu->pc_cpuid = cpuid; pcpu->pc_cpumask = 1 << cpuid; cpuid_to_pcpu[cpuid] = pcpu; - SLIST_INSERT_HEAD(&cpuhead, pcpu, pc_allcpu); + STAILQ_INSERT_TAIL(&cpuhead, pcpu, pc_allcpu); cpu_pcpu_init(pcpu, cpuid, size); pcpu->pc_rm_queue.rmq_next = &pcpu->pc_rm_queue; pcpu->pc_rm_queue.rmq_prev = &pcpu->pc_rm_queue; @@ -245,7 +245,7 @@ void pcpu_destroy(struct pcpu *pcpu) { - SLIST_REMOVE(&cpuhead, pcpu, pcpu, pc_allcpu); + STAILQ_REMOVE(&cpuhead, pcpu, pcpu, pc_allcpu); cpuid_to_pcpu[pcpu->pc_cpuid] = NULL; dpcpu_off[pcpu->pc_cpuid] = 0; } Modified: head/sys/mips/mips/mp_machdep.c ============================================================================== --- head/sys/mips/mips/mp_machdep.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/mips/mips/mp_machdep.c Tue May 31 15:11:43 2011 (r222531) @@ -86,7 +86,7 @@ ipi_selected(cpumask_t cpus, int ipi) CTR3(KTR_SMP, "%s: cpus: %x, ipi: %x\n", __func__, cpus, ipi); - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if ((cpus & pc->pc_cpumask) != 0) ipi_send(pc, ipi); } Modified: head/sys/net/netisr.c ============================================================================== --- head/sys/net/netisr.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/net/netisr.c Tue May 31 15:11:43 2011 (r222531) @@ -1221,7 +1221,7 @@ netisr_start(void *arg) { struct pcpu *pc; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if (nws_count >= netisr_maxthreads) break; /* XXXRW: Is skipping absent CPUs still required here? */ Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/powerpc/booke/pmap.c Tue May 31 15:11:43 2011 (r222531) @@ -390,7 +390,7 @@ tlb_miss_lock(void) if (!smp_started) return; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if (pc != pcpup) { CTR3(KTR_PMAP, "%s: tlb miss LOCK of CPU=%d, " @@ -416,7 +416,7 @@ tlb_miss_unlock(void) if (!smp_started) return; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if (pc != pcpup) { CTR2(KTR_PMAP, "%s: tlb miss UNLOCK of CPU=%d", __func__, pc->pc_cpuid); Modified: head/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/mp_machdep.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/powerpc/powerpc/mp_machdep.c Tue May 31 15:11:43 2011 (r222531) @@ -212,7 +212,7 @@ cpu_mp_unleash(void *dummy) cpus = 0; smp_cpus = 0; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { cpus++; pc->pc_other_cpus = all_cpus & ~pc->pc_cpumask; if (!pc->pc_bsp) { @@ -347,7 +347,7 @@ ipi_selected(cpumask_t cpus, int ipi) { struct pcpu *pc; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if (cpus & pc->pc_cpumask) ipi_send(pc, ipi); } @@ -367,7 +367,7 @@ ipi_all_but_self(int ipi) { struct pcpu *pc; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if (pc != pcpup) ipi_send(pc, ipi); } Modified: head/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/mp_machdep.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/sparc64/sparc64/mp_machdep.c Tue May 31 15:11:43 2011 (r222531) @@ -383,7 +383,7 @@ cpu_mp_unleash(void *v) ctx_inc = (TLB_CTX_USER_MAX - 1) / mp_ncpus; csa = &cpu_start_args; csa->csa_count = mp_ncpus; - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { pc->pc_tlb_ctx = ctx_min; pc->pc_tlb_ctx_min = ctx_min; pc->pc_tlb_ctx_max = ctx_min + ctx_inc; Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Tue May 31 15:11:23 2011 (r222530) +++ head/sys/sparc64/sparc64/pmap.c Tue May 31 15:11:43 2011 (r222531) @@ -1278,7 +1278,7 @@ pmap_release(pmap_t pm) * to a kernel thread, leaving the pmap pointer unchanged. */ mtx_lock_spin(&sched_lock); - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) + STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) if (pc->pc_pmap == pm) pc->pc_pmap = NULL; mtx_unlock_spin(&sched_lock); Modified: head/sys/sys/pcpu.h ============================================================================== --- head/sys/sys/pcpu.h Tue May 31 15:11:23 2011 (r222530) +++ head/sys/sys/pcpu.h Tue May 31 15:11:43 2011 (r222531) @@ -164,7 +164,7 @@ struct pcpu { u_int pc_cpuid; /* This cpu number */ cpumask_t pc_cpumask; /* This cpu mask */ cpumask_t pc_other_cpus; /* Mask of all other cpus */ - SLIST_ENTRY(pcpu) pc_allcpu; + STAILQ_ENTRY(pcpu) pc_allcpu; struct lock_list_entry *pc_spinlocks; #ifdef KTR char pc_name[PCPU_NAME_LEN]; /* String name for KTR */ @@ -201,7 +201,7 @@ struct pcpu { #ifdef _KERNEL -SLIST_HEAD(cpuhead, pcpu); +STAILQ_HEAD(cpuhead, pcpu); extern struct cpuhead cpuhead; extern struct pcpu *cpuid_to_pcpu[MAXCPU]; From owner-svn-src-head@FreeBSD.ORG Tue May 31 15:32:54 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF2E11065672; Tue, 31 May 2011 15:32:54 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id 9FCD78FC1D; Tue, 31 May 2011 15:32:54 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.4/8.14.4) with ESMTP id p4VFWs6i055884; Tue, 31 May 2011 08:32:54 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.4/8.14.4/Submit) id p4VFWsg8055883; Tue, 31 May 2011 08:32:54 -0700 (PDT) (envelope-from sgk) Date: Tue, 31 May 2011 08:32:54 -0700 From: Steve Kargl To: Ben Laurie Message-ID: <20110531153254.GA55855@troutmask.apl.washington.edu> References: <201105182106.p4IL6KkE008657@svn.freebsd.org> <20110518211651.GE2273@garage.freebsd.pl> <4DE4FB1D.8090407@links.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DE4FB1D.8090407@links.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek Subject: Re: svn commit: r222084 - head/contrib/gperf/src X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 15:32:54 -0000 On Tue, May 31, 2011 at 03:28:45PM +0100, Ben Laurie wrote: > On 18/05/2011 22:16, Pawel Jakub Dawidek wrote: > > On Wed, May 18, 2011 at 09:06:20PM +0000, Ben Laurie wrote: > >> Author: benl > >> Date: Wed May 18 21:06:20 2011 > >> New Revision: 222084 > >> URL: http://svn.freebsd.org/changeset/base/222084 > >> > >> Log: > >> Fix clang warnings. > >> > >> Approved by: philip (mentor) > > [...] > >> - fprintf (stderr, " by changing asso_value['%c'] (char #%d) to %d\n", > >> + fprintf (stderr, " by changing asso_value['%c'] (char #%zd) to %d\n", > >> *p, p - union_set + 1, asso_values[(unsigned char)(*p)]); > > > > Hmm, both 'p' and 'union_set' are 'char *' and %zd is for ssize_t. It is > > a bit strange that it fixes the warning. > > Why? The difference between two pointers is ssize_t, surely? > >From n1256.pdf, When two pointers are subtracted, both shall point to elements of the same array object, or one past the last element of the array object; the result is the difference of the subscripts of the two array elements. The size of the result is implementation-defined, and its type (a signed integer type) is ptrdiff_t defined in the header. ptrdiff_t is not necessarily that same as ssize_t. -- Steve From owner-svn-src-head@FreeBSD.ORG Tue May 31 15:41:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 965C11065675; Tue, 31 May 2011 15:41:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D2188FC18; Tue, 31 May 2011 15:41:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4VFfAZl029805; Tue, 31 May 2011 15:41:10 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VFfA9w029802; Tue, 31 May 2011 15:41:10 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201105311541.p4VFfA9w029802@svn.freebsd.org> From: John Baldwin Date: Tue, 31 May 2011 15:41:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222532 - in head: contrib/top usr.bin/top X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 15:41:10 -0000 Author: jhb Date: Tue May 31 15:41:10 2011 New Revision: 222532 URL: http://svn.freebsd.org/changeset/base/222532 Log: - Document the -H option and 'H' key alongside other options and keys rather than at the bottom of the manpage. - Remove an obsolete comment about SWAIT being a stale state. It was resurrected for a different purpose in FreeBSD 5 to mark idle ithreads. - Add a comment documenting that the SLEEP and LOCK states typically display the name of the event being waited on with lock names being prefixed with an asterisk and sleep event names not having a prefix. MFC after: 1 week Modified: head/contrib/top/top.X head/usr.bin/top/top.local.1 Modified: head/contrib/top/top.X ============================================================================== --- head/contrib/top/top.X Tue May 31 15:11:43 2011 (r222531) +++ head/contrib/top/top.X Tue May 31 15:41:10 2011 (r222532) @@ -89,6 +89,10 @@ Use \*(lqbatch\*(rq mode. In this mode, ignored. Interrupt characters (such as ^C and ^\e) still have an effect. This is the default on a dumb terminal, or when the output is not a terminal. .TP +.B \-H +Display each thread for a multithreaded process individually. +By default a single summary line is displayed for each process. +.TP .B \-i Use \*(lqinteractive\*(rq mode. In this mode, any input is immediately read for processing. See the section on \*(lqInteractive Mode\*(rq @@ -292,6 +296,9 @@ or .BR r enice command. .TP +.B H +Toggle the display of threads. +.TP .B i (or .BR I ) @@ -358,8 +365,11 @@ the order of the processes, and COMMAND is the name of the command that the process is currently running (if the process is swapped out, this column is marked \*(lq\*(rq). .SH NOTES -The \*(lqABANDONED\*(rq state (known in the kernel as \*(lqSWAIT\*(rq) was -abandoned, thus the name. A process should never end up in this state. +If a process is in the \*(lqSLEEP\*(rq or \*(lqLOCK\*(rq state, +the state column will report the name of the event or lock on which the +process is waiting. +Lock names are prefixed with an asterisk \*(lq*\*(rq while sleep events +are not. .SH AUTHOR William LeFebvre, EECS Department, Northwestern University .SH ENVIRONMENT Modified: head/usr.bin/top/top.local.1 ============================================================================== --- head/usr.bin/top/top.local.1 Tue May 31 15:11:43 2011 (r222531) +++ head/usr.bin/top/top.local.1 Tue May 31 15:41:10 2011 (r222532) @@ -1,10 +1,6 @@ .\" $FreeBSD$ .SH "FreeBSD NOTES" -.SH DISPLAY OF THREADS -The '-H' option will toggle the display of kernel visible thread contexts. -At runtime the 'H' key will toggle this mode. The default is OFF. - .SH DESCRIPTION OF MEMORY Mem: 9220K Active, 1M Inact, 3284K Wired, 1M Cache, 2M Buf, 1320K Free Swap: 91M Total, 79M Free, 13% Inuse, 80K In, 104K Out From owner-svn-src-head@FreeBSD.ORG Tue May 31 15:52:12 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24B8E106564A; Tue, 31 May 2011 15:52:12 +0000 (UTC) (envelope-from ben@links.org) Received: from mail.links.org (mail.links.org [217.155.92.109]) by mx1.freebsd.org (Postfix) with ESMTP id CBF7E8FC15; Tue, 31 May 2011 15:52:11 +0000 (UTC) Received: from [193.133.15.218] (localhost [127.0.0.1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.links.org (Postfix) with ESMTPS id D800A33C46; Tue, 31 May 2011 16:52:10 +0100 (BST) Message-ID: <4DE50EAA.3030001@links.org> Date: Tue, 31 May 2011 16:52:10 +0100 From: Ben Laurie User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <201105141744.p4EHiCpx010486@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, benl@freebsd.org, svn-src-all@freebsd.org, simon@freebsd.org, Colin Percival , svn-src-head@freebsd.org Subject: Re: svn commit: r221900 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 15:52:12 -0000 On 15/05/2011 05:19, Bjoern A. Zeeb wrote: > On Sat, 14 May 2011, Colin Percival wrote: > >> Author: cperciva >> Date: Sat May 14 17:44:12 2011 >> New Revision: 221900 >> URL: http://svn.freebsd.org/changeset/base/221900 >> >> Log: >> Encourage Ben Laurie to finish getting his commit bit by appointing him >> as the OpenSSL maintainer. > > > I'd like to thanks Simon for doing this all the years! Great job! > > I am also happy Ben volunteered to pick up the task:) Great to have > you doing this for FreeBSD! Now I'm back from my travels someone's going to have to tell me what I need to do! -- http://www.apache-ssl.org/ben.html http://www.links.org/ "There is no limit to what a man can do or how far he can go if he doesn't mind who gets the credit." - Robert Woodruff From owner-svn-src-head@FreeBSD.ORG Tue May 31 16:59:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD79E1065677; Tue, 31 May 2011 16:59:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DEE38FC0A; Tue, 31 May 2011 16:59: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 p4VGxE2k032230; Tue, 31 May 2011 16:59:14 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VGxE50032228; Tue, 31 May 2011 16:59:14 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201105311659.p4VGxE50032228@svn.freebsd.org> From: Warner Losh Date: Tue, 31 May 2011 16:59:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222534 - head/usr.bin/tftp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 16:59:14 -0000 Author: imp Date: Tue May 31 16:59:14 2011 New Revision: 222534 URL: http://svn.freebsd.org/changeset/base/222534 Log: Fix a couple of spelling errors. Submitted by: bcr@ Modified: head/usr.bin/tftp/main.c Modified: head/usr.bin/tftp/main.c ============================================================================== --- head/usr.bin/tftp/main.c Tue May 31 15:49:28 2011 (r222533) +++ head/usr.bin/tftp/main.c Tue May 31 16:59:14 2011 (r222534) @@ -155,7 +155,7 @@ static struct cmd cmdtab[] = { { "options", setoptions, "enable or disable RFC2347 style options" }, { "help", help, "print help information" }, - { "packetdrop", setpacketdrop, "artifical packetloss feature" }, + { "packetdrop", setpacketdrop, "artificial packetloss feature" }, { "?", help, "print help information" }, { NULL, NULL, NULL } }; @@ -955,7 +955,7 @@ setblocksize(int argc, char *argv[]) if (!options_rfc_enabled) printf("RFC2347 style options are not enabled " - "(but proceding anyway)\n"); + "(but proceeding anyway)\n"); if (argc != 1) { int size = atoi(argv[1]); @@ -993,7 +993,7 @@ setblocksize2(int argc, char *argv[]) if (!options_rfc_enabled || !options_extra_enabled) printf( "RFC2347 style or non-RFC defined options are not enabled " - "(but proceding anyway)\n"); + "(but proceeding anyway)\n"); if (argc != 1) { int size = atoi(argv[1]); From owner-svn-src-head@FreeBSD.ORG Tue May 31 17:14:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76E57106564A; Tue, 31 May 2011 17:14:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 677798FC08; Tue, 31 May 2011 17:14:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4VHE6PG032729; Tue, 31 May 2011 17:14:06 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VHE60s032727; Tue, 31 May 2011 17:14:06 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201105311714.p4VHE60s032727@svn.freebsd.org> From: Warner Losh Date: Tue, 31 May 2011 17:14:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222535 - head/tools/tools/nanobsd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 17:14:06 -0000 Author: imp Date: Tue May 31 17:14:06 2011 New Revision: 222535 URL: http://svn.freebsd.org/changeset/base/222535 Log: Don't need (and can't use) -L to copy links here. Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Tue May 31 16:59:14 2011 (r222534) +++ head/tools/tools/nanobsd/nanobsd.sh Tue May 31 17:14:06 2011 (r222535) @@ -418,7 +418,7 @@ populate_slice ( ) ( echo "Creating ${dev} with ${dir} (mounting on ${mnt})" newfs_part $dev $mnt $lbl cd ${dir} - find . -print | grep -Ev '/(CVS|\.svn)' | cpio -Ldumpv ${mnt} + find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt} df -i ${mnt} umount ${mnt} ) From owner-svn-src-head@FreeBSD.ORG Tue May 31 17:29:58 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A049B1065673; Tue, 31 May 2011 17:29:58 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F8458FC12; Tue, 31 May 2011 17:29:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4VHTw4U033300; Tue, 31 May 2011 17:29:58 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VHTwrZ033296; Tue, 31 May 2011 17:29:58 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201105311729.p4VHTwrZ033296@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 31 May 2011 17:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 17:29:58 -0000 Author: ken Date: Tue May 31 17:29:58 2011 New Revision: 222537 URL: http://svn.freebsd.org/changeset/base/222537 Log: Fix apparent garbage in the message buffer. While we have had a fix in place (options PRINTF_BUFR_SIZE=128) to fix scrambled console output, the message buffer and syslog were still getting log messages one character at a time. While all of the characters still made it into the log (courtesy of atomic operations), they were often interleaved when there were multiple threads writing to the buffer at the same time. This fixes message buffer accesses to use buffering logic as well, so that strings that are less than PRINTF_BUFR_SIZE will be put into the message buffer atomically. So now dmesg output should look the same as console output. subr_msgbuf.c: Convert most message buffer calls to use a new spin lock instead of atomic variables in some places. Add a new routine, msgbuf_addstr(), that adds a NUL-terminated string to a message buffer. This takes a priority argument, which allows us to eliminate some races (at least in the the string at a time case) that are present in the implementation of msglogchar(). (dangling and lastpri are static variables, and are subject to races when multiple callers are present.) msgbuf_addstr() also allows the caller to request that carriage returns be stripped out of the string. This matches the behavior of msglogchar(), but in testing so far it doesn't appear that any newlines are being stripped out. So the carriage return removal functionality may be a candidate for removal later on if further analysis shows that it isn't necessary. subr_prf.c: Add a new msglogstr() routine that calls msgbuf_logstr(). Rename putcons() to putbuf(). This now handles buffered output to the message log as well as the console. Also, remove the logic in putcons() (now putbuf()) that added a carriage return before a newline. The console path was the only path that needed it, and cnputc() (called by cnputs()) already adds a carriage return. So this duplication resulted in kernel-generated console output lines ending in '\r''\r''\n'. Refactor putchar() to handle the new buffering scheme. Add buffering to log(). Change log_console() to use msglogstr() instead of msglogchar(). Don't add extra newlines by default in log_console(). Hide that behavior behind a tunable/sysctl (kern.log_console_add_linefeed) for those who would like the old behavior. The old behavior led to the insertion of extra newlines for log output for programs that print out a string, and then a trailing newline on a separate write. (This is visible with dmesg -a.) msgbuf.h: Add a prototype for msgbuf_addstr(). Add three new fields to struct msgbuf, msg_needsnl, msg_lastpri and msg_lock. The first two are needed for log message functionality previously handled by msglogchar(). (Which is still active if buffering isn't enabled.) Include sys/lock.h and sys/mutex.h for the new mutex. Reviewed by: gibbs Modified: head/sys/kern/subr_msgbuf.c head/sys/kern/subr_prf.c head/sys/sys/msgbuf.h Modified: head/sys/kern/subr_msgbuf.c ============================================================================== --- head/sys/kern/subr_msgbuf.c Tue May 31 17:24:18 2011 (r222536) +++ head/sys/kern/subr_msgbuf.c Tue May 31 17:29:58 2011 (r222537) @@ -31,8 +31,16 @@ #include #include +#include +#include #include +/* + * Maximum number conversion buffer length: uintmax_t in base 2, plus <> + * around the priority, and a terminating NUL. + */ +#define MAXPRIBUF (sizeof(intmax_t) * NBBY + 3) + /* Read/write sequence numbers are modulo a multiple of the buffer size. */ #define SEQMOD(size) ((size) * 16) @@ -51,6 +59,9 @@ msgbuf_init(struct msgbuf *mbp, void *pt mbp->msg_seqmod = SEQMOD(size); msgbuf_clear(mbp); mbp->msg_magic = MSG_MAGIC; + mbp->msg_lastpri = -1; + mbp->msg_needsnl = 0; + mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); } /* @@ -80,6 +91,11 @@ msgbuf_reinit(struct msgbuf *mbp, void * } msgbuf_clear(mbp); } + + mbp->msg_lastpri = -1; + /* Assume that the old message buffer didn't end in a newline. */ + mbp->msg_needsnl = 1; + mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); } /* @@ -110,25 +126,140 @@ msgbuf_getcount(struct msgbuf *mbp) } /* - * Append a character to a message buffer. This function can be - * considered fully reentrant so long as the number of concurrent - * callers is less than the number of characters in the buffer. - * However, the message buffer is only guaranteed to be consistent - * for reading when there are no callers in this function. + * Add a character into the message buffer, and update the checksum and + * sequence number. + * + * The caller should hold the message buffer spinlock. + */ +static inline void +msgbuf_do_addchar(struct msgbuf *mbp, u_int *seq, int c) +{ + u_int pos; + + /* Make sure we properly wrap the sequence number. */ + pos = MSGBUF_SEQ_TO_POS(mbp, *seq); + + mbp->msg_cksum += (u_int)c - + (u_int)(u_char)mbp->msg_ptr[pos]; + + mbp->msg_ptr[pos] = c; + + *seq = MSGBUF_SEQNORM(mbp, *seq + 1); +} + +/* + * Append a character to a message buffer. */ void msgbuf_addchar(struct msgbuf *mbp, int c) { - u_int new_seq, pos, seq; + mtx_lock_spin(&mbp->msg_lock); + + msgbuf_do_addchar(mbp, &mbp->msg_wseq, c); + + mtx_unlock_spin(&mbp->msg_lock); +} + +/* + * Append a NUL-terminated string with a priority to a message buffer. + * Filter carriage returns if the caller requests it. + * + * XXX The carriage return filtering behavior is present in the + * msglogchar() API, however testing has shown that we don't seem to send + * carriage returns down this path. So do we still need it? + */ +void +msgbuf_addstr(struct msgbuf *mbp, int pri, char *str, int filter_cr) +{ + u_int seq; + size_t len, prefix_len; + char prefix[MAXPRIBUF]; + int nl, i; + + len = strlen(str); + prefix_len = 0; + nl = 0; + + /* If we have a zero-length string, no need to do anything. */ + if (len == 0) + return; + + mtx_lock_spin(&mbp->msg_lock); + + /* + * If this is true, we may need to insert a new priority sequence, + * so prepare the prefix. + */ + if (pri != -1) + prefix_len = sprintf(prefix, "<%d>", pri); + + /* + * Starting write sequence number. + */ + seq = mbp->msg_wseq; + + /* + * Whenever there is a change in priority, we have to insert a + * newline, and a priority prefix if the priority is not -1. Here + * we detect whether there was a priority change, and whether we + * did not end with a newline. If that is the case, we need to + * insert a newline before this string. + */ + if (mbp->msg_lastpri != pri && mbp->msg_needsnl != 0) { + + msgbuf_do_addchar(mbp, &seq, '\n'); + mbp->msg_needsnl = 0; + } + + for (i = 0; i < len; i++) { + /* + * If we just had a newline, and the priority is not -1 + * (and therefore prefix_len != 0), then we need a priority + * prefix for this line. + */ + if (mbp->msg_needsnl == 0 && prefix_len != 0) { + int j; + + for (j = 0; j < prefix_len; j++) + msgbuf_do_addchar(mbp, &seq, prefix[j]); + } + + /* + * Don't copy carriage returns if the caller requested + * filtering. + * + * XXX This matches the behavior of msglogchar(), but is it + * necessary? Testing has shown that we don't seem to get + * carriage returns here. + */ + if ((filter_cr != 0) && (str[i] == '\r')) + continue; + + /* + * Clear this flag if we see a newline. This affects whether + * we need to insert a new prefix or insert a newline later. + */ + if (str[i] == '\n') + mbp->msg_needsnl = 0; + else + mbp->msg_needsnl = 1; + + msgbuf_do_addchar(mbp, &seq, str[i]); + } + /* + * Update the write sequence number for the actual number of + * characters we put in the message buffer. (Depends on whether + * carriage returns are filtered.) + */ + mbp->msg_wseq = seq; + + /* + * Set the last priority. + */ + mbp->msg_lastpri = pri; + + mtx_unlock_spin(&mbp->msg_lock); - do { - seq = mbp->msg_wseq; - new_seq = MSGBUF_SEQNORM(mbp, seq + 1); - } while (atomic_cmpset_rel_int(&mbp->msg_wseq, seq, new_seq) == 0); - pos = MSGBUF_SEQ_TO_POS(mbp, seq); - atomic_add_int(&mbp->msg_cksum, (u_int)(u_char)c - - (u_int)(u_char)mbp->msg_ptr[pos]); - mbp->msg_ptr[pos] = c; } /* @@ -141,14 +272,21 @@ msgbuf_getchar(struct msgbuf *mbp) u_int len, wseq; int c; + mtx_lock_spin(&mbp->msg_lock); + wseq = mbp->msg_wseq; len = MSGBUF_SEQSUB(mbp, wseq, mbp->msg_rseq); - if (len == 0) + if (len == 0) { + mtx_unlock_spin(&mbp->msg_lock); return (-1); + } if (len > mbp->msg_size) mbp->msg_rseq = MSGBUF_SEQNORM(mbp, wseq - mbp->msg_size); c = (u_char)mbp->msg_ptr[MSGBUF_SEQ_TO_POS(mbp, mbp->msg_rseq)]; mbp->msg_rseq = MSGBUF_SEQNORM(mbp, mbp->msg_rseq + 1); + + mtx_unlock_spin(&mbp->msg_lock); + return (c); } @@ -161,10 +299,14 @@ msgbuf_getbytes(struct msgbuf *mbp, char { u_int len, pos, wseq; + mtx_lock_spin(&mbp->msg_lock); + wseq = mbp->msg_wseq; len = MSGBUF_SEQSUB(mbp, wseq, mbp->msg_rseq); - if (len == 0) + if (len == 0) { + mtx_unlock_spin(&mbp->msg_lock); return (0); + } if (len > mbp->msg_size) { mbp->msg_rseq = MSGBUF_SEQNORM(mbp, wseq - mbp->msg_size); len = mbp->msg_size; @@ -175,6 +317,9 @@ msgbuf_getbytes(struct msgbuf *mbp, char bcopy(&mbp->msg_ptr[pos], buf, len); mbp->msg_rseq = MSGBUF_SEQNORM(mbp, mbp->msg_rseq + len); + + mtx_unlock_spin(&mbp->msg_lock); + return (len); } @@ -193,16 +338,21 @@ msgbuf_peekbytes(struct msgbuf *mbp, cha { u_int len, pos, wseq; + mtx_lock_spin(&mbp->msg_lock); + if (buf == NULL) { /* Just initialise *seqp. */ *seqp = MSGBUF_SEQNORM(mbp, mbp->msg_wseq - mbp->msg_size); + mtx_unlock_spin(&mbp->msg_lock); return (0); } wseq = mbp->msg_wseq; len = MSGBUF_SEQSUB(mbp, wseq, *seqp); - if (len == 0) + if (len == 0) { + mtx_unlock_spin(&mbp->msg_lock); return (0); + } if (len > mbp->msg_size) { *seqp = MSGBUF_SEQNORM(mbp, wseq - mbp->msg_size); len = mbp->msg_size; @@ -212,6 +362,9 @@ msgbuf_peekbytes(struct msgbuf *mbp, cha len = min(len, (u_int)buflen); bcopy(&mbp->msg_ptr[MSGBUF_SEQ_TO_POS(mbp, *seqp)], buf, len); *seqp = MSGBUF_SEQNORM(mbp, *seqp + len); + + mtx_unlock_spin(&mbp->msg_lock); + return (len); } Modified: head/sys/kern/subr_prf.c ============================================================================== --- head/sys/kern/subr_prf.c Tue May 31 17:24:18 2011 (r222536) +++ head/sys/kern/subr_prf.c Tue May 31 17:29:58 2011 (r222537) @@ -94,6 +94,7 @@ struct snprintf_arg { extern int log_open; static void msglogchar(int c, int pri); +static void msglogstr(char *str, int pri, int filter_cr); static void putchar(int ch, void *arg); static char *ksprintn(char *nbuf, uintmax_t num, int base, int *len, int upper); static void snprintf_func(int ch, void *arg); @@ -106,6 +107,14 @@ TUNABLE_INT("kern.log_console_output", & SYSCTL_INT(_kern, OID_AUTO, log_console_output, CTLFLAG_RW, &log_console_output, 0, "Duplicate console output to the syslog."); +/* + * See the comment in log_console() below for more explanation of this. + */ +static int log_console_add_linefeed = 0; +TUNABLE_INT("kern.log_console_add_linefeed", &log_console_add_linefeed); +SYSCTL_INT(_kern, OID_AUTO, log_console_add_linefeed, CTLFLAG_RW, + &log_console_add_linefeed, 0, "log_console() adds extra newlines."); + static int always_console_output = 0; TUNABLE_INT("kern.always_console_output", &always_console_output); SYSCTL_INT(_kern, OID_AUTO, always_console_output, CTLFLAG_RW, @@ -240,16 +249,37 @@ log(int level, const char *fmt, ...) { va_list ap; struct putchar_arg pca; +#ifdef PRINTF_BUFR_SIZE + char bufr[PRINTF_BUFR_SIZE]; +#endif pca.tty = NULL; pca.pri = level; pca.flags = log_open ? TOLOG : TOCONS; +#ifdef PRINTF_BUFR_SIZE + pca.p_bufr = bufr; + pca.p_next = pca.p_bufr; + pca.n_bufr = sizeof(bufr); + pca.remain = sizeof(bufr); + *pca.p_next = '\0'; +#else pca.p_bufr = NULL; +#endif va_start(ap, fmt); kvprintf(fmt, putchar, &pca, 10, ap); va_end(ap); +#ifdef PRINTF_BUFR_SIZE + /* Write any buffered console/log output: */ + if (*pca.p_bufr != '\0') { + if (pca.flags & TOLOG) + msglogstr(pca.p_bufr, level, /*filter_cr*/1); + + if (pca.flags & TOCONS) + cnputs(pca.p_bufr); + } +#endif msgbuftrigger = 1; } @@ -258,7 +288,7 @@ log(int level, const char *fmt, ...) void log_console(struct uio *uio) { - int c, i, error, nl; + int c, error, nl; char *consbuffer; int pri; @@ -271,20 +301,48 @@ log_console(struct uio *uio) nl = 0; while (uio->uio_resid > 0) { - c = imin(uio->uio_resid, CONSCHUNK); + c = imin(uio->uio_resid, CONSCHUNK - 1); error = uiomove(consbuffer, c, uio); if (error != 0) break; - for (i = 0; i < c; i++) { - msglogchar(consbuffer[i], pri); - if (consbuffer[i] == '\n') - nl = 1; - else - nl = 0; - } + /* Make sure we're NUL-terminated */ + consbuffer[c] = '\0'; + if (consbuffer[c - 1] == '\n') + nl = 1; + else + nl = 0; + msglogstr(consbuffer, pri, /*filter_cr*/ 1); + } + /* + * The previous behavior in log_console() is preserved when + * log_console_add_linefeed is non-zero. For that behavior, if an + * individual console write came in that was not terminated with a + * line feed, it would add a line feed. + * + * This results in different data in the message buffer than + * appears on the system console (which doesn't add extra line feed + * characters). + * + * A number of programs and rc scripts write a line feed, or a period + * and a line feed when they have completed their operation. On + * the console, this looks seamless, but when displayed with + * 'dmesg -a', you wind up with output that looks like this: + * + * Updating motd: + * . + * + * On the console, it looks like this: + * Updating motd:. + * + * We could add logic to detect that situation, or just not insert + * the extra newlines. Set the kern.log_console_add_linefeed + * sysctl/tunable variable to get the old behavior. + */ + if (!nl && log_console_add_linefeed) { + consbuffer[0] = '\n'; + consbuffer[1] = '\0'; + msglogstr(consbuffer, pri, /*filter_cr*/ 1); } - if (!nl) - msglogchar('\n', pri); msgbuftrigger = 1; free(uio, M_IOV); free(consbuffer, M_TEMP); @@ -330,9 +388,11 @@ vprintf(const char *fmt, va_list ap) retval = kvprintf(fmt, putchar, &pca, 10, ap); #ifdef PRINTF_BUFR_SIZE - /* Write any buffered console output: */ - if (*pca.p_bufr != '\0') + /* Write any buffered console/log output: */ + if (*pca.p_bufr != '\0') { cnputs(pca.p_bufr); + msglogstr(pca.p_bufr, pca.pri, /*filter_cr*/ 1); + } #endif if (!panicstr) @@ -342,18 +402,18 @@ vprintf(const char *fmt, va_list ap) } static void -putcons(int c, struct putchar_arg *ap) +putbuf(int c, struct putchar_arg *ap) { /* Check if no console output buffer was provided. */ - if (ap->p_bufr == NULL) + if (ap->p_bufr == NULL) { /* Output direct to the console. */ - cnputc(c); - else { + if (ap->flags & TOCONS) + cnputc(c); + + if (ap->flags & TOLOG) + msglogchar(c, ap->pri); + } else { /* Buffer the character: */ - if (c == '\n') { - *ap->p_next++ = '\r'; - ap->remain--; - } *ap->p_next++ = c; ap->remain--; @@ -361,12 +421,35 @@ putcons(int c, struct putchar_arg *ap) *ap->p_next = '\0'; /* Check if the buffer needs to be flushed. */ - if (ap->remain < 3 || c == '\n') { - cnputs(ap->p_bufr); + if (ap->remain == 2 || c == '\n') { + + if (ap->flags & TOLOG) + msglogstr(ap->p_bufr, ap->pri, /*filter_cr*/1); + + if (ap->flags & TOCONS) { + if ((panicstr == NULL) && (constty != NULL)) + msgbuf_addstr(&consmsgbuf, -1, + ap->p_bufr, /*filter_cr*/ 0); + + if ((constty == NULL) ||(always_console_output)) + cnputs(ap->p_bufr); + } + ap->p_next = ap->p_bufr; ap->remain = ap->n_bufr; *ap->p_next = '\0'; } + + /* + * Since we fill the buffer up one character at a time, + * this should not happen. We should always catch it when + * ap->remain == 2 (if not sooner due to a newline), flush + * the buffer and move on. One way this could happen is + * if someone sets PRINTF_BUFR_SIZE to 1 or something + * similarly silly. + */ + KASSERT(ap->remain > 2, ("Bad buffer logic, remain = %zd", + ap->remain)); } } @@ -381,26 +464,25 @@ putchar(int c, void *arg) struct putchar_arg *ap = (struct putchar_arg*) arg; struct tty *tp = ap->tty; int flags = ap->flags; + int putbuf_done = 0; /* Don't use the tty code after a panic or while in ddb. */ if (kdb_active) { if (c != '\0') cnputc(c); - } else if (panicstr || ((flags & TOCONS) && constty == NULL)) { - if (c != '\0') - putcons(c, ap); } else { - if ((flags & TOTTY) && tp != NULL) + if ((panicstr == NULL) && (flags & TOTTY) && (tp != NULL)) tty_putchar(tp, c); + if (flags & TOCONS) { - if (constty != NULL) - msgbuf_addchar(&consmsgbuf, c); - if (always_console_output && c != '\0') - putcons(c, ap); + putbuf(c, ap); + putbuf_done = 1; } } - if ((flags & TOLOG)) - msglogchar(c, ap->pri); + if ((flags & TOLOG) && (putbuf_done == 0)) { + if (c != '\0') + putbuf(c, ap); + } } /* @@ -890,6 +972,15 @@ msglogchar(int c, int pri) } } +static void +msglogstr(char *str, int pri, int filter_cr) +{ + if (!msgbufmapped) + return; + + msgbuf_addstr(msgbufp, pri, str, filter_cr); +} + void msgbufinit(void *ptr, int size) { Modified: head/sys/sys/msgbuf.h ============================================================================== --- head/sys/sys/msgbuf.h Tue May 31 17:24:18 2011 (r222536) +++ head/sys/sys/msgbuf.h Tue May 31 17:29:58 2011 (r222537) @@ -33,15 +33,21 @@ #ifndef _SYS_MSGBUF_H_ #define _SYS_MSGBUF_H_ +#include +#include + struct msgbuf { - char *msg_ptr; /* pointer to buffer */ + char *msg_ptr; /* pointer to buffer */ #define MSG_MAGIC 0x063062 - u_int msg_magic; - u_int msg_size; /* size of buffer area */ - u_int msg_wseq; /* write sequence number */ - u_int msg_rseq; /* read sequence number */ - u_int msg_cksum; /* checksum of contents */ - u_int msg_seqmod; /* range for sequence numbers */ + u_int msg_magic; + u_int msg_size; /* size of buffer area */ + u_int msg_wseq; /* write sequence number */ + u_int msg_rseq; /* read sequence number */ + u_int msg_cksum; /* checksum of contents */ + u_int msg_seqmod; /* range for sequence numbers */ + int msg_lastpri; /* saved priority value */ + int msg_needsnl; /* set when newline needed */ + struct mtx msg_lock; /* mutex to protect the buffer */ }; /* Normalise a sequence number or a difference between sequence numbers. */ @@ -59,6 +65,7 @@ extern struct mtx msgbuf_lock; void msgbufinit(void *ptr, int size); void msgbuf_addchar(struct msgbuf *mbp, int c); +void msgbuf_addstr(struct msgbuf *mbp, int pri, char *str, int filter_cr); void msgbuf_clear(struct msgbuf *mbp); void msgbuf_copy(struct msgbuf *src, struct msgbuf *dst); int msgbuf_getbytes(struct msgbuf *mbp, char *buf, int buflen); From owner-svn-src-head@FreeBSD.ORG Tue May 31 17:43:25 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBFD3106564A; Tue, 31 May 2011 17:43:25 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC5DE8FC12; Tue, 31 May 2011 17:43:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4VHhPA1033837; Tue, 31 May 2011 17:43:25 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VHhPKE033835; Tue, 31 May 2011 17:43:25 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201105311743.p4VHhPKE033835@svn.freebsd.org> From: Rick Macklem Date: Tue, 31 May 2011 17:43:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222540 - head/sys/fs/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 17:43:26 -0000 Author: rmacklem Date: Tue May 31 17:43:25 2011 New Revision: 222540 URL: http://svn.freebsd.org/changeset/base/222540 Log: Fix the new NFS client so that it doesn't do an NFSv3 Pathconf RPC for cases where the reply doesn't include the answer. This fixes a problem reported by avg@ where the NFSv3 Pathconf RPC would fail when "ls -l" did an lpathconf(2) for _PC_ACL_NFS4. Tested by: avg MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Tue May 31 17:34:30 2011 (r222539) +++ head/sys/fs/nfsclient/nfs_clvnops.c Tue May 31 17:43:25 2011 (r222540) @@ -3293,7 +3293,13 @@ nfs_pathconf(struct vop_pathconf_args *a struct thread *td = curthread; int attrflag, error; - if (NFS_ISV34(vp)) { + if (NFS_ISV4(vp) || (NFS_ISV3(vp) && (ap->a_name == _PC_LINK_MAX || + ap->a_name == _PC_NAME_MAX || ap->a_name == _PC_CHOWN_RESTRICTED || + ap->a_name == _PC_NO_TRUNC))) { + /* + * Since only the above 4 a_names are returned by the NFSv3 + * Pathconf RPC, there is no point in doing it for others. + */ error = nfsrpc_pathconf(vp, &pc, td->td_ucred, td, &nfsva, &attrflag, NULL); if (attrflag != 0) @@ -3302,7 +3308,10 @@ nfs_pathconf(struct vop_pathconf_args *a if (error != 0) return (error); } else { - /* For NFSv2, just fake them. */ + /* + * For NFSv2 (or NFSv3 when not one of the above 4 a_names), + * just fake them. + */ pc.pc_linkmax = LINK_MAX; pc.pc_namemax = NFS_MAXNAMLEN; pc.pc_notrunc = 1; From owner-svn-src-head@FreeBSD.ORG Tue May 31 17:45:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBD33106566C; Tue, 31 May 2011 17:45:18 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from mail.soaustin.net (pancho.soaustin.net [76.74.250.40]) by mx1.freebsd.org (Postfix) with ESMTP id A98368FC14; Tue, 31 May 2011 17:45:18 +0000 (UTC) Received: by mail.soaustin.net (Postfix, from userid 502) id D889456203; Tue, 31 May 2011 12:45:17 -0500 (CDT) Date: Tue, 31 May 2011 12:45:17 -0500 From: Mark Linimon To: Ben Laurie Message-ID: <20110531174517.GA19718@lonesome.com> References: <201105141744.p4EHiCpx010486@svn.freebsd.org> <4DE50EAA.3030001@links.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DE50EAA.3030001@links.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: src-committers@freebsd.org, benl@freebsd.org, svn-src-all@freebsd.org, simon@freebsd.org, "Bjoern A. Zeeb" , Colin Percival , svn-src-head@freebsd.org Subject: Re: svn commit: r221900 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 17:45:18 -0000 On Tue, May 31, 2011 at 04:52:10PM +0100, Ben Laurie wrote: > Now I'm back from my travels someone's going to have to tell me what I > need to do! Now you understand the reason not to leave the room: someone just volunteers you to do stuff, when you do. mcl From owner-svn-src-head@FreeBSD.ORG Tue May 31 18:27:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1400106566C; Tue, 31 May 2011 18:27:18 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1A6A8FC16; Tue, 31 May 2011 18:27:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4VIRIO1035208; Tue, 31 May 2011 18:27:18 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VIRIOX035206; Tue, 31 May 2011 18:27:18 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201105311827.p4VIRIOX035206@svn.freebsd.org> From: Rick Macklem Date: Tue, 31 May 2011 18:27:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222541 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 18:27:18 -0000 Author: rmacklem Date: Tue May 31 18:27:18 2011 New Revision: 222541 URL: http://svn.freebsd.org/changeset/base/222541 Log: Add a sentence to the umount.8 man page to clarify the behaviour for forced dismount when used on an NFS mount point. Requested by Jeremy Chadwick. This is a content change. MFC after: 2 weeks Modified: head/sbin/umount/umount.8 Modified: head/sbin/umount/umount.8 ============================================================================== --- head/sbin/umount/umount.8 Tue May 31 17:43:25 2011 (r222540) +++ head/sbin/umount/umount.8 Tue May 31 18:27:18 2011 (r222541) @@ -28,7 +28,7 @@ .\" @(#)umount.8 8.2 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd July 18, 2003 +.Dd May 31, 2011 .Dt UMOUNT 8 .Os .Sh NAME @@ -78,6 +78,9 @@ The file system is forcibly unmounted. Active special devices continue to work, but all other files return errors if further accesses are attempted. The root file system cannot be forcibly unmounted. +For NFS, a forced dismount can take up to 1 minute or more to +complete against an unresponsive server and may throw away +data not yet written to the server for this case. .It Fl h Ar host Only file systems mounted from the specified host will be unmounted. From owner-svn-src-head@FreeBSD.ORG Tue May 31 18:45:16 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51DD5106564A; Tue, 31 May 2011 18:45:16 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 421F48FC16; Tue, 31 May 2011 18:45: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 p4VIjGpg035749; Tue, 31 May 2011 18:45:16 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VIjGbw035747; Tue, 31 May 2011 18:45:16 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201105311845.p4VIjGbw035747@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 May 2011 18:45:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222542 - head/sys/dev/nfe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 18:45:16 -0000 Author: yongari Date: Tue May 31 18:45:15 2011 New Revision: 222542 URL: http://svn.freebsd.org/changeset/base/222542 Log: If driver is not running, disable interrupts and do not try to process received frames. Previously it was possible to handle RX interrupts even if controller is not fully initialized. This resulted in non-working driver after system is up and running. Reported by: hselasky Tested by: hselasky Modified: head/sys/dev/nfe/if_nfe.c Modified: head/sys/dev/nfe/if_nfe.c ============================================================================== --- head/sys/dev/nfe/if_nfe.c Tue May 31 18:27:18 2011 (r222541) +++ head/sys/dev/nfe/if_nfe.c Tue May 31 18:45:15 2011 (r222542) @@ -1889,7 +1889,7 @@ nfe_int_task(void *arg, int pending) if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { NFE_UNLOCK(sc); - nfe_enable_intr(sc); + nfe_disable_intr(sc); return; } From owner-svn-src-head@FreeBSD.ORG Tue May 31 19:08:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60B75106566C; Tue, 31 May 2011 19:08:26 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 36E878FC12; Tue, 31 May 2011 19:08: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 p4VJ8QPJ036441; Tue, 31 May 2011 19:08:26 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VJ8QJ5036436; Tue, 31 May 2011 19:08:26 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201105311908.p4VJ8QJ5036436@svn.freebsd.org> From: Bernhard Schmidt Date: Tue, 31 May 2011 19:08:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222543 - in head/sys/dev: ipw iwi iwn wpi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 19:08:26 -0000 Author: bschmidt Date: Tue May 31 19:08:25 2011 New Revision: 222543 URL: http://svn.freebsd.org/changeset/base/222543 Log: Add module version to iwi/ipw/wpi and iwn. The version is used to check if a module is already preset, not setting it results in: can't re-use a leaf (ipw)! module_register: module pci/ipw already exists! Module pci/ipw failed to register: 17 while trying to load the module due to an entry in loader.conf. With this commit we get the expected: module ipw already present! Reported by: Dru Lavigne, bz Tested by: bz MFC after: 1 week Modified: head/sys/dev/ipw/if_ipw.c head/sys/dev/iwi/if_iwi.c head/sys/dev/iwn/if_iwn.c head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/ipw/if_ipw.c ============================================================================== --- head/sys/dev/ipw/if_ipw.c Tue May 31 18:45:15 2011 (r222542) +++ head/sys/dev/ipw/if_ipw.c Tue May 31 19:08:25 2011 (r222543) @@ -199,6 +199,8 @@ static devclass_t ipw_devclass; DRIVER_MODULE(ipw, pci, ipw_driver, ipw_devclass, 0, 0); +MODULE_VERSION(ipw, 1); + static int ipw_probe(device_t dev) { Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Tue May 31 18:45:15 2011 (r222542) +++ head/sys/dev/iwi/if_iwi.c Tue May 31 19:08:25 2011 (r222543) @@ -232,6 +232,8 @@ static devclass_t iwi_devclass; DRIVER_MODULE(iwi, pci, iwi_driver, iwi_devclass, 0, 0); +MODULE_VERSION(iwi, 1); + static __inline uint8_t MEM_READ_1(struct iwi_softc *sc, uint32_t addr) { Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Tue May 31 18:45:15 2011 (r222542) +++ head/sys/dev/iwn/if_iwn.c Tue May 31 19:08:25 2011 (r222543) @@ -401,6 +401,8 @@ static devclass_t iwn_devclass; DRIVER_MODULE(iwn, pci, iwn_driver, iwn_devclass, 0, 0); +MODULE_VERSION(iwn, 1); + MODULE_DEPEND(iwn, firmware, 1, 1, 1); MODULE_DEPEND(iwn, pci, 1, 1, 1); MODULE_DEPEND(iwn, wlan, 1, 1, 1); Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Tue May 31 18:45:15 2011 (r222542) +++ head/sys/dev/wpi/if_wpi.c Tue May 31 19:08:25 2011 (r222543) @@ -273,6 +273,8 @@ static devclass_t wpi_devclass; DRIVER_MODULE(wpi, pci, wpi_driver, wpi_devclass, 0, 0); +MODULE_VERSION(wpi, 1); + static const uint8_t wpi_ridx_to_plcp[] = { /* OFDM: IEEE Std 802.11a-1999, pp. 14 Table 80 */ /* R1-R4 (ral/ural is R4-R1) */ From owner-svn-src-head@FreeBSD.ORG Tue May 31 19:45:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EADD106564A; Tue, 31 May 2011 19:45:59 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B3A78FC0A; Tue, 31 May 2011 19:45: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 p4VJjxoj037641; Tue, 31 May 2011 19:45:59 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VJjwMk037631; Tue, 31 May 2011 19:45:58 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201105311945.p4VJjwMk037631@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 31 May 2011 19:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222544 - in head/sys: contrib/dev/acpica contrib/dev/acpica/debugger contrib/dev/acpica/include contrib/dev/acpica/tables dev/acpica/Osd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 19:45:59 -0000 Author: jkim Date: Tue May 31 19:45:58 2011 New Revision: 222544 URL: http://svn.freebsd.org/changeset/base/222544 Log: Merge ACPICA 20110527. Modified: head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/debugger/dbexec.c head/sys/contrib/dev/acpica/debugger/dbinput.c head/sys/contrib/dev/acpica/debugger/dbutils.c head/sys/contrib/dev/acpica/debugger/dbxface.c head/sys/contrib/dev/acpica/include/acconfig.h head/sys/contrib/dev/acpica/include/acdebug.h head/sys/contrib/dev/acpica/include/acglobal.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acpiosxf.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/acpredef.h head/sys/contrib/dev/acpica/osunixxf.c head/sys/contrib/dev/acpica/tables/tbinstal.c head/sys/dev/acpica/Osd/OsdDebug.c Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/changes.txt Tue May 31 19:45:58 2011 (r222544) @@ -1,31 +1,99 @@ ---------------------------------------- +27 May 2011. Summary of changes for version 20110527: + +This release is available at www.acpica.org/downloads + +1) ACPI CA Core Subsystem: + +ASL Load() operator: Reinstate most restrictions on the incoming ACPI table +signature. Now, only allow SSDT, OEMx, and a null signature. History: + 1) Originally, we checked the table signature for "SSDT" or "PSDT". + (PSDT is now obsolete.) + 2) We added support for OEMx tables, signature "OEM" plus a fourth + "don't care" character. + 3) Valid tables were encountered with a null signature, so we just + gave up on validating the signature, (05/2008). + 4) We encountered non-AML tables such as the MADT, which caused + interpreter errors and kernel faults. So now, we once again allow + only SSDT, OEMx, and now, also a null signature. (05/2011). + +Added the missing _TDL predefined name to the global name list in order to +enable validation. Affects both the core ACPICA code and the iASL compiler. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug +version of the code includes the debug output trace mechanism and has a much +larger code and data size. + + Previous Release (VC 9.0): + Non-Debug Version: 90.0K Code, 23.8K Data, 113.8K Total + Debug Version: 164.5K Code, 68.0K Data, 232.5K Total + Current Release (VC 9.0): + Non-Debug Version: 90.1K Code, 23.9K Data, 114.0K Total + Debug Version: 165.6K Code, 68.4K Data, 234.0K Total + +2) iASL Compiler/Disassembler and Tools: + +Debugger/AcpiExec: Implemented support for "complex" method arguments on the +debugger command line. This adds support beyond simple integers -- including +Strings, Buffers, and Packages. Includes support for nested packages. +Increased the default command line buffer size to accommodate these arguments. +See the ACPICA reference for details and syntax. ACPICA BZ 917. + +Debugger/AcpiExec: Implemented support for "default" method arguments for the +Execute/Debug command. Now, the debugger will always invoke a control method +with the required number of arguments -- even if the command line specifies +none or insufficient arguments. It uses default integer values for any missing +arguments. Also fixes a bug where only six method arguments maximum were +supported instead of the required seven. + +Debugger/AcpiExec: Add a maximum buffer length parameter to AcpiOsGetLine and +also return status in order to prevent buffer overruns. See the ACPICA +reference for details and syntax. ACPICA BZ 921 + +iASL: Cleaned up support for Berkeley yacc. A general cleanup of code and +makefiles to simplify support for the two different but similar parser +generators, bison and yacc. + +Updated the generic unix makefile for gcc 4. The default gcc version is now +expected to be 4 or greater, since options specific to gcc 4 are used. + +---------------------------------------- 13 April 2011. Summary of changes for version 20110413: 1) ACPI CA Core Subsystem: Implemented support to execute a so-called "orphan" _REG method under the EC -device. This change will force the execution of a _REG method underneath the EC +device. This change will force the execution of a _REG method underneath the +EC device even if there is no corresponding operation region of type EmbeddedControl. Fixes a problem seen on some machines and apparently is compatible with Windows behavior. ACPICA BZ 875. Added more predefined methods that are eligible for automatic NULL package -element removal. This change adds another group of predefined names to the list +element removal. This change adds another group of predefined names to the +list of names that can be repaired by having NULL package elements dynamically removed. This group are those methods that return a single variable-length package containing simple data types such as integers, buffers, strings. This -includes: _ALx, _BCL, _CID,_ DOD, _EDL, _FIX, _PCL, _PLD, _PMD, _PRx, _PSL, _Sx, +includes: _ALx, _BCL, _CID,_ DOD, _EDL, _FIX, _PCL, _PLD, _PMD, _PRx, _PSL, +_Sx, and _TZD. ACPICA BZ 914. -Split and segregated all internal global lock functions to a new file, evglock.c. +Split and segregated all internal global lock functions to a new file, +evglock.c. -Updated internal address SpaceID for DataTable regions. Moved this internal space -id in preparation for ACPI 5.0 changes that will include some new space IDs. This +Updated internal address SpaceID for DataTable regions. Moved this internal +space +id in preparation for ACPI 5.0 changes that will include some new space IDs. +This change should not affect user/host code. -Example Code and Data Size: These are the sizes for the OS-independent acpica.lib +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug version of -the code includes the debug output trace mechanism and has a much larger code and +the code includes the debug output trace mechanism and has a much larger code +and data size. Previous Release (VC 9.0): @@ -40,34 +108,44 @@ data size. iASL/DTC: Major update for new grammar features. Allow generic data types in custom ACPI tables. Field names are now optional. Any line can be split to multiple lines using the continuation char (\). Large buffers now use line- -continuation character(s) and no colon on the continuation lines. See the grammar +continuation character(s) and no colon on the continuation lines. See the +grammar update in the iASL compiler reference. ACPI BZ 910,911. Lin Ming, Bob Moore. iASL: Mark ASL "Return()" and the simple "Return" as "Null" return statements. -Since the parser stuffs a "zero" as the return value for these statements (due to +Since the parser stuffs a "zero" as the return value for these statements (due +to the underlying AML grammar), they were seen as "return with value" by the iASL semantic checking. They are now seen correctly as "null" return statements. iASL: Check if a_REG declaration has a corresponding Operation Region. Adds a check for each _REG to ensure that there is in fact a corresponding operation -region declaration in the same scope. If not, the _REG method is not very useful +region declaration in the same scope. If not, the _REG method is not very +useful since it probably won't be executed. ACPICA BZ 915. -iASL/DTC: Finish support for expression evaluation. Added a new expression parser -that implements c-style operator precedence and parenthesization. ACPICA bugzilla +iASL/DTC: Finish support for expression evaluation. Added a new expression +parser +that implements c-style operator precedence and parenthesization. ACPICA +bugzilla 908. -Disassembler/DTC: Remove support for () and <> style comments in data tables. Now -that DTC has full expression support, we don't want to have comment strings that -start with a parentheses or a less-than symbol. Now, only the standard /* and // +Disassembler/DTC: Remove support for () and <> style comments in data tables. +Now +that DTC has full expression support, we don't want to have comment strings +that +start with a parentheses or a less-than symbol. Now, only the standard /* and +// comments are supported, as well as the bracket [] comments. -AcpiXtract: Fix for RSDP and dynamic SSDT extraction. These tables have "unusual" +AcpiXtract: Fix for RSDP and dynamic SSDT extraction. These tables have +"unusual" headers in the acpidump file. Update the header validation to support these tables. Problem introduced in previous AcpiXtract version in the change to support "wrong checksum" error messages emitted by acpidump utility. -iASL: Add a * option to generate all template files (as a synonym for ALL) as in +iASL: Add a * option to generate all template files (as a synonym for ALL) as +in "iasl -T *" or "iasl -T ALL". iASL/DTC: Do not abort compiler on fatal errors. We do not want to completely @@ -81,7 +159,8 @@ invocation. 1) ACPI CA Core Subsystem: Fixed a problem caused by a _PRW method appearing at the namespace root scope -during the setup of wake GPEs. A fault could occur if a _PRW directly under the +during the setup of wake GPEs. A fault could occur if a _PRW directly under +the root object was passed to the AcpiSetupGpeForWake interface. Lin Ming. Implemented support for "spurious" Global Lock interrupts. On some systems, a @@ -89,9 +168,11 @@ global lock interrupt can occur without interrupt, we now ensure that a thread is actually waiting for the lock before signaling GL availability. Rafael Wysocki, Bob Moore. -Example Code and Data Size: These are the sizes for the OS-independent acpica.lib +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug version of -the code includes the debug output trace mechanism and has a much larger code and +the code includes the debug output trace mechanism and has a much larger code +and data size. Previous Release (VC 9.0): @@ -108,14 +189,16 @@ header files, disassembler, table compil Lin Ming. AcpiXtract: Correctly handle embedded comments and messages from AcpiDump. -Apparently some or all versions of acpidump will occasionally emit a comment like +Apparently some or all versions of acpidump will occasionally emit a comment +like "Wrong checksum", etc., into the dump file. This was causing problems for AcpiXtract. ACPICA BZ 905. iASL: Fix the Linux makefile by removing an inadvertent double file inclusion. ACPICA BZ 913. -AcpiExec: Update installation of operation region handlers. Install one handler +AcpiExec: Update installation of operation region handlers. Install one +handler for a user-defined address space. This is used by the ASL test suite (ASLTS). ---------------------------------------- Modified: head/sys/contrib/dev/acpica/debugger/dbexec.c ============================================================================== --- head/sys/contrib/dev/acpica/debugger/dbexec.c Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/debugger/dbexec.c Tue May 31 19:45:58 2011 (r222544) @@ -53,7 +53,8 @@ ACPI_MODULE_NAME ("dbexec") -static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo; +static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo; +#define DB_DEFAULT_PKG_ELEMENTS 33 /* Local prototypes */ @@ -81,6 +82,348 @@ AcpiDbExecutionWalk ( void *Context, void **ReturnValue); +static ACPI_STATUS +AcpiDbHexCharToValue ( + int HexChar, + UINT8 *ReturnValue); + +static ACPI_STATUS +AcpiDbConvertToPackage ( + char *String, + ACPI_OBJECT *Object); + +static ACPI_STATUS +AcpiDbConvertToObject ( + ACPI_OBJECT_TYPE Type, + char *String, + ACPI_OBJECT *Object); + +static void +AcpiDbDeleteObjects ( + UINT32 Count, + ACPI_OBJECT *Objects); + + +/******************************************************************************* + * + * FUNCTION: AcpiDbHexCharToValue + * + * PARAMETERS: HexChar - Ascii Hex digit, 0-9|a-f|A-F + * ReturnValue - Where the converted value is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a single hex character to a 4-bit number (0-16). + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbHexCharToValue ( + int HexChar, + UINT8 *ReturnValue) +{ + UINT8 Value; + + + /* Digit must be ascii [0-9a-fA-F] */ + + if (!ACPI_IS_XDIGIT (HexChar)) + { + return (AE_BAD_HEX_CONSTANT); + } + + if (HexChar <= 0x39) + { + Value = (UINT8) (HexChar - 0x30); + } + else + { + Value = (UINT8) (ACPI_TOUPPER (HexChar) - 0x37); + } + + *ReturnValue = Value; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbHexByteToBinary + * + * PARAMETERS: HexByte - Double hex digit (0x00 - 0xFF) in format: + * HiByte then LoByte. + * ReturnValue - Where the converted value is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert two hex characters to an 8 bit number (0 - 255). + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbHexByteToBinary ( + char *HexByte, + UINT8 *ReturnValue) +{ + UINT8 Local0; + UINT8 Local1; + ACPI_STATUS Status; + + + /* High byte */ + + Status = AcpiDbHexCharToValue (HexByte[0], &Local0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Low byte */ + + Status = AcpiDbHexCharToValue (HexByte[1], &Local1); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + *ReturnValue = (UINT8) ((Local0 << 4) | Local1); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbConvertToBuffer + * + * PARAMETERS: String - Input string to be converted + * Object - Where the buffer object is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a string to a buffer object. String is treated a list + * of buffer elements, each separated by a space or comma. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbConvertToBuffer ( + char *String, + ACPI_OBJECT *Object) +{ + UINT32 i; + UINT32 j; + UINT32 Length; + UINT8 *Buffer; + ACPI_STATUS Status; + + + /* Generate the final buffer length */ + + for (i = 0, Length = 0; String[i];) + { + i+=2; + Length++; + + while (String[i] && + ((String[i] == ',') || (String[i] == ' '))) + { + i++; + } + } + + Buffer = ACPI_ALLOCATE (Length); + if (!Buffer) + { + return (AE_NO_MEMORY); + } + + /* Convert the command line bytes to the buffer */ + + for (i = 0, j = 0; String[i];) + { + Status = AcpiDbHexByteToBinary (&String[i], &Buffer[j]); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (Buffer); + return (Status); + } + + j++; + i+=2; + while (String[i] && + ((String[i] == ',') || (String[i] == ' '))) + { + i++; + } + } + + Object->Type = ACPI_TYPE_BUFFER; + Object->Buffer.Pointer = Buffer; + Object->Buffer.Length = Length; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbConvertToPackage + * + * PARAMETERS: String - Input string to be converted + * Object - Where the package object is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a string to a package object. Handles nested packages + * via recursion with AcpiDbConvertToObject. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbConvertToPackage ( + char *String, + ACPI_OBJECT *Object) +{ + char *This; + char *Next; + UINT32 i; + ACPI_OBJECT_TYPE Type; + ACPI_OBJECT *Elements; + ACPI_STATUS Status; + + + Elements = ACPI_ALLOCATE_ZEROED ( + DB_DEFAULT_PKG_ELEMENTS * sizeof (ACPI_OBJECT)); + + This = String; + for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++) + { + This = AcpiDbGetNextToken (This, &Next, &Type); + if (!This) + { + break; + } + + /* Recursive call to convert each package element */ + + Status = AcpiDbConvertToObject (Type, This, &Elements[i]); + if (ACPI_FAILURE (Status)) + { + AcpiDbDeleteObjects (i + 1, Elements); + ACPI_FREE (Elements); + return (Status); + } + + This = Next; + } + + Object->Type = ACPI_TYPE_PACKAGE; + Object->Package.Count = i; + Object->Package.Elements = Elements; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbConvertToObject + * + * PARAMETERS: Type - Object type as determined by parser + * String - Input string to be converted + * Object - Where the new object is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a typed and tokenized string to an ACPI_OBJECT. Typing: + * 1) String objects were surrounded by quotes. + * 2) Buffer objects were surrounded by parentheses. + * 3) Package objects were surrounded by brackets "[]". + * 4) All standalone tokens are treated as integers. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbConvertToObject ( + ACPI_OBJECT_TYPE Type, + char *String, + ACPI_OBJECT *Object) +{ + ACPI_STATUS Status = AE_OK; + + + switch (Type) + { + case ACPI_TYPE_STRING: + Object->Type = ACPI_TYPE_STRING; + Object->String.Pointer = String; + Object->String.Length = (UINT32) ACPI_STRLEN (String); + break; + + case ACPI_TYPE_BUFFER: + Status = AcpiDbConvertToBuffer (String, Object); + break; + + case ACPI_TYPE_PACKAGE: + Status = AcpiDbConvertToPackage (String, Object); + break; + + default: + Object->Type = ACPI_TYPE_INTEGER; + Status = AcpiUtStrtoul64 (String, 16, &Object->Integer.Value); + break; + } + + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDeleteObjects + * + * PARAMETERS: Count - Count of objects in the list + * Objects - Array of ACPI_OBJECTs to be deleted + * + * RETURN: None + * + * DESCRIPTION: Delete a list of ACPI_OBJECTS. Handles packages and nested + * packages via recursion. + * + ******************************************************************************/ + +static void +AcpiDbDeleteObjects ( + UINT32 Count, + ACPI_OBJECT *Objects) +{ + UINT32 i; + + + for (i = 0; i < Count; i++) + { + switch (Objects[i].Type) + { + case ACPI_TYPE_BUFFER: + ACPI_FREE (Objects[i].Buffer.Pointer); + break; + + case ACPI_TYPE_PACKAGE: + + /* Recursive call to delete package elements */ + + AcpiDbDeleteObjects (Objects[i].Package.Count, + Objects[i].Package.Elements); + + /* Free the elements array */ + + ACPI_FREE (Objects[i].Package.Elements); + break; + + default: + break; + } + } +} + /******************************************************************************* * @@ -104,8 +447,8 @@ AcpiDbExecuteMethod ( ACPI_OBJECT_LIST ParamObjects; ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; ACPI_HANDLE Handle; - UINT32 i; ACPI_DEVICE_INFO *ObjInfo; + UINT32 i; ACPI_FUNCTION_TRACE (DbExecuteMethod); @@ -139,25 +482,37 @@ AcpiDbExecuteMethod ( { /* Are there arguments to the method? */ + i = 0; if (Info->Args && Info->Args[0]) { - for (i = 0; Info->Args[i] && + /* Get arguments passed on the command line */ + + for (; Info->Args[i] && (i < ACPI_METHOD_NUM_ARGS) && (i < ObjInfo->ParamCount); i++) { - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16); - } + /* Convert input string (token) to an actual ACPI_OBJECT */ - ParamObjects.Pointer = Params; - ParamObjects.Count = i; + Status = AcpiDbConvertToObject (Info->Types[i], + Info->Args[i], &Params[i]); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "While parsing method arguments")); + goto Cleanup; + } + } } - else + + /* Create additional "default" parameters as needed */ + + if (i < ObjInfo->ParamCount) { - /* Setup default parameters */ + AcpiOsPrintf ("Adding %u arguments containing default values\n", + ObjInfo->ParamCount - i); - for (i = 0; i < ObjInfo->ParamCount; i++) + for (; i < ObjInfo->ParamCount; i++) { switch (i) { @@ -181,13 +536,11 @@ AcpiDbExecuteMethod ( break; } } - - ParamObjects.Pointer = Params; - ParamObjects.Count = ObjInfo->ParamCount; } - } - ACPI_FREE (ObjInfo); + ParamObjects.Count = ObjInfo->ParamCount; + ParamObjects.Pointer = Params; + } /* Prepare for a return object of arbitrary size */ @@ -198,7 +551,7 @@ AcpiDbExecuteMethod ( AcpiGbl_MethodExecuting = TRUE; Status = AcpiEvaluateObject (NULL, - Info->Pathname, &ParamObjects, ReturnObj); + Info->Pathname, &ParamObjects, ReturnObj); AcpiGbl_CmSingleStep = FALSE; AcpiGbl_MethodExecuting = FALSE; @@ -206,16 +559,20 @@ AcpiDbExecuteMethod ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "while executing %s from debugger", Info->Pathname)); + "while executing %s from debugger", Info->Pathname)); if (Status == AE_BUFFER_OVERFLOW) { ACPI_ERROR ((AE_INFO, - "Possible overflow of internal debugger buffer (size 0x%X needed 0x%X)", + "Possible overflow of internal debugger buffer (size 0x%X needed 0x%X)", ACPI_DEBUG_BUFFER_SIZE, (UINT32) ReturnObj->Length)); } } +Cleanup: + AcpiDbDeleteObjects (ObjInfo->ParamCount, Params); + ACPI_FREE (ObjInfo); + return_ACPI_STATUS (Status); } @@ -380,6 +737,7 @@ void AcpiDbExecute ( char *Name, char **Args, + ACPI_OBJECT_TYPE *Types, UINT32 Flags) { ACPI_STATUS Status; @@ -417,6 +775,7 @@ AcpiDbExecute ( AcpiUtStrupr (NameString); AcpiGbl_DbMethodInfo.Name = NameString; AcpiGbl_DbMethodInfo.Args = Args; + AcpiGbl_DbMethodInfo.Types = Types; AcpiGbl_DbMethodInfo.Flags = Flags; ReturnObj.Pointer = NULL; @@ -529,6 +888,8 @@ AcpiDbMethodThread ( LocalInfo.Arguments[2] = LocalInfo.IndexOfThreadStr; LocalInfo.Arguments[3] = NULL; + LocalInfo.Types = LocalInfo.ArgTypes; + (void) AcpiOsSignalSemaphore (Info->InfoGate, 1); for (i = 0; i < Info->NumLoops; i++) @@ -696,6 +1057,12 @@ AcpiDbCreateExecutionThreads ( AcpiGbl_DbMethodInfo.Arguments[1] = AcpiGbl_DbMethodInfo.IdOfThreadStr; AcpiGbl_DbMethodInfo.Arguments[2] = AcpiGbl_DbMethodInfo.IndexOfThreadStr; AcpiGbl_DbMethodInfo.Arguments[3] = NULL; + + AcpiGbl_DbMethodInfo.Types = AcpiGbl_DbMethodInfo.ArgTypes; + AcpiGbl_DbMethodInfo.ArgTypes[0] = ACPI_TYPE_INTEGER; + AcpiGbl_DbMethodInfo.ArgTypes[1] = ACPI_TYPE_INTEGER; + AcpiGbl_DbMethodInfo.ArgTypes[2] = ACPI_TYPE_INTEGER; + AcpiDbUInt32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr); AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); Modified: head/sys/contrib/dev/acpica/debugger/dbinput.c ============================================================================== --- head/sys/contrib/dev/acpica/debugger/dbinput.c Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/debugger/dbinput.c Tue May 31 19:45:58 2011 (r222544) @@ -54,11 +54,6 @@ /* Local prototypes */ -static char * -AcpiDbGetNextToken ( - char *String, - char **Next); - static UINT32 AcpiDbGetLine ( char *InputBuffer); @@ -285,6 +280,10 @@ AcpiDbDisplayHelp ( AcpiOsPrintf (" Call Run to next control method invocation\n"); AcpiOsPrintf (" Debug [Arguments] Single Step a control method\n"); AcpiOsPrintf (" Execute [Arguments] Execute control method\n"); + AcpiOsPrintf (" Hex Integer Integer method argument\n"); + AcpiOsPrintf (" \"Ascii String\" String method argument\n"); + AcpiOsPrintf (" (Byte List) Buffer method argument\n"); + AcpiOsPrintf (" [Package Element List] Package method argument\n"); AcpiOsPrintf (" Go Allow method to run to completion\n"); AcpiOsPrintf (" Information Display info about the current method\n"); AcpiOsPrintf (" Into Step into (not over) a method call\n"); @@ -318,12 +317,15 @@ AcpiDbDisplayHelp ( * ******************************************************************************/ -static char * +char * AcpiDbGetNextToken ( char *String, - char **Next) + char **Next, + ACPI_OBJECT_TYPE *ReturnType) { char *Start; + UINT32 Depth; + ACPI_OBJECT_TYPE Type = ACPI_TYPE_INTEGER; /* At end of buffer? */ @@ -333,7 +335,7 @@ AcpiDbGetNextToken ( return (NULL); } - /* Get rid of any spaces at the beginning */ + /* Remove any spaces at the beginning */ if (*String == ' ') { @@ -348,22 +350,88 @@ AcpiDbGetNextToken ( } } - if (*String == '"') + switch (*String) { + case '"': + /* This is a quoted string, scan until closing quote */ String++; Start = String; + Type = ACPI_TYPE_STRING; - /* Find end of token */ + /* Find end of string */ while (*String && (*String != '"')) { String++; } - } - else - { + break; + + case '(': + + /* This is the start of a buffer, scan until closing paren */ + + String++; + Start = String; + Type = ACPI_TYPE_BUFFER; + + /* Find end of buffer */ + + while (*String && (*String != ')')) + { + String++; + } + break; + + case '[': + + /* This is the start of a package, scan until closing bracket */ + + String++; + Depth = 1; + Start = String; + Type = ACPI_TYPE_PACKAGE; + + /* Find end of package (closing bracket) */ + + while (*String) + { + /* Handle String package elements */ + + if (*String == '"') + { + /* Find end of string */ + + String++; + while (*String && (*String != '"')) + { + String++; + } + if (!(*String)) + { + break; + } + } + else if (*String == '[') + { + Depth++; /* A nested package declaration */ + } + else if (*String == ']') + { + Depth--; + if (Depth == 0) /* Found final package closing bracket */ + { + break; + } + } + + String++; + } + break; + + default: + Start = String; /* Find end of token */ @@ -372,6 +440,7 @@ AcpiDbGetNextToken ( { String++; } + break; } if (!(*String)) @@ -384,6 +453,7 @@ AcpiDbGetNextToken ( *Next = String + 1; } + *ReturnType = Type; return (Start); } @@ -416,7 +486,8 @@ AcpiDbGetLine ( This = AcpiGbl_DbParsedBuf; for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++) { - AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next); + AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next, + &AcpiGbl_DbArgTypes[i]); if (!AcpiGbl_DbArgs[i]) { break; @@ -575,7 +646,8 @@ AcpiDbCommandDispatch ( break; case CMD_DEBUG: - AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_SINGLE_STEP); + AcpiDbExecute (AcpiGbl_DbArgs[1], + &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_SINGLE_STEP); break; case CMD_DISASSEMBLE: @@ -601,7 +673,7 @@ AcpiDbCommandDispatch ( case CMD_EXECUTE: AcpiDbExecute (AcpiGbl_DbArgs[1], - &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP); + &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP); break; case CMD_FIND: @@ -961,7 +1033,13 @@ AcpiDbUserCommands ( /* Get the user input line */ - (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); + Status = AcpiOsGetLine (AcpiGbl_DbLineBuf, + ACPI_DB_LINE_BUFFER_SIZE, NULL); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line")); + return (Status); + } /* Check for single or multithreaded debug */ Modified: head/sys/contrib/dev/acpica/debugger/dbutils.c ============================================================================== --- head/sys/contrib/dev/acpica/debugger/dbutils.c Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/debugger/dbutils.c Tue May 31 19:45:58 2011 (r222544) @@ -382,7 +382,7 @@ AcpiDbUInt32ToHexString ( UINT32 Value, char *Buffer) { - UINT8 i; + int i; if (Value == 0) @@ -391,10 +391,9 @@ AcpiDbUInt32ToHexString ( return; } - ACPI_STRCPY (Buffer, "0x"); - Buffer[10] = '\0'; + Buffer[8] = '\0'; - for (i = 9; i > 1; i--) + for (i = 7; i >= 0; i--) { Buffer[i] = Converter [Value & 0x0F]; Value = Value >> 4; Modified: head/sys/contrib/dev/acpica/debugger/dbxface.c ============================================================================== --- head/sys/contrib/dev/acpica/debugger/dbxface.c Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/debugger/dbxface.c Tue May 31 19:45:58 2011 (r222544) @@ -137,7 +137,13 @@ AcpiDbStartCommand ( /* Get the user input line */ - (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); + Status = AcpiOsGetLine (AcpiGbl_DbLineBuf, + ACPI_DB_LINE_BUFFER_SIZE, NULL); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line")); + return (Status); + } } Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op); Modified: head/sys/contrib/dev/acpica/include/acconfig.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acconfig.h Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/include/acconfig.h Tue May 31 19:45:58 2011 (r222544) @@ -200,7 +200,8 @@ * *****************************************************************************/ -#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ +#define ACPI_DEBUGGER_MAX_ARGS ACPI_METHOD_NUM_ARGS + 2 /* Max command line arguments */ +#define ACPI_DB_LINE_BUFFER_SIZE 512 #define ACPI_DEBUGGER_COMMAND_PROMPT '-' #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' Modified: head/sys/contrib/dev/acpica/include/acdebug.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acdebug.h Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/include/acdebug.h Tue May 31 19:45:58 2011 (r222544) @@ -277,6 +277,7 @@ void AcpiDbExecute ( char *Name, char **Args, + ACPI_OBJECT_TYPE *Types, UINT32 Flags); void @@ -357,6 +358,12 @@ AcpiDbUserCommands ( char Prompt, ACPI_PARSE_OBJECT *Op); +char * +AcpiDbGetNextToken ( + char *String, + char **Next, + ACPI_OBJECT_TYPE *ReturnType); + /* * dbstats - Generation and display of ACPI table statistics Modified: head/sys/contrib/dev/acpica/include/acglobal.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acglobal.h Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/include/acglobal.h Tue May 31 19:45:58 2011 (r222544) @@ -425,10 +425,11 @@ ACPI_EXTERN BOOLEAN ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue May 31 20:15:31 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4343E1065670; Tue, 31 May 2011 20:15:31 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.mail.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id 95E058FC0C; Tue, 31 May 2011 20:15:30 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap0EAO1L5U2DaFvO/2dsb2JhbABThEmiT4hxrGuQUoErg2yBBwSQT482 X-IronPort-AV: E=Sophos;i="4.65,299,1304308800"; d="scan'208";a="122477004" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu-pri.mail.uoguelph.ca with ESMTP; 31 May 2011 16:15:29 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 86E30B3F2B; Tue, 31 May 2011 16:15:29 -0400 (EDT) Date: Tue, 31 May 2011 16:15:29 -0400 (EDT) From: Rick Macklem To: Bruce Evans Message-ID: <1326411567.44367.1306872929534.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20110531170853.Y1153@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.203] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, Robert Watson , Kostik Belousov , Rick Macklem Subject: Re: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 20:15:31 -0000 > > It is only an optimization. Any number of syncs are useless for > actually syncing the system, since sync(2) only does an async sync (it > returns without waiting for most writes to complete). As you pointed > out later in this thread, unmount(2) does a sync that works -- a sync > sync -- before doing the unmount proper. It does this irrespective of > the force flag: > > % if (((mp->mnt_flag & MNT_RDONLY) || > % (error = VFS_SYNC(mp, MNT_WAIT)) == 0) || (flags & MNT_FORCE) != 0) > % error = VFS_UNMOUNT(mp, flags); > > The force flag doesn't mean that i/o's are forced to complete. It > only means that open files are forced to be closed (and a few related > things). This can be seen here. We wait (potentially forever) for > any existing writes to complete. Only then do we look at the force > flag and bale out if the sync failed and the force flag is _not_ set. > Most i/o problems will cause hangs in this sync, and the force flag > won't help. But if we somehow get past this sync, and have i/o > problems, then honoring the force flag and continuing gives even more > fragility, since we have almost passed the point of being able to give > up after an error (this point is typically very early in > VFS_UNMOUNT()). > Well, in vgonel(), which is called from vflush() and seems to be what gets rid of the vnode even when open for forced dismounts, there is: /* * Clear out any buffers associated with the vnode. * If the flush fails, just toss the buffers. */ - followed shortly by if (vinvalbuf(vp, V_SAVE, 0, 0) != 0) vinvalbuf(vp, 0, 0, 0); It seems to me that this code is willing to give up when it can't write dirty buffers, but??? To me, a forced dismount of an NFS mount that just wedges on an unresponsive server isn't very useful. The only case I can think of where a forced dismount that isn't willing to throw away dirty buffers might be useful would be when an app. (userland process) is for some reason unkillable and is sitting with an open NFS file. Is this a problem in practice? (I do know that a mount stuck on an unresponsive server is a real problem. There have been several PRs, the most recent being kern/157365.) I brought up the concept of a "hard forced dismount" at the developer summit a year ago, but no one seemed to see a difference between that and what they believed a forced dismount already did. After that, I thought about it a little and couldn't see much use for a "soft forced dismount that fails instead of throwing away dirty buffers, but does close down open files". - For example, suppose a userland process is writing a file through the stdio library: A - fopen()s a file for writing B - does fwrite()s of small amounts of data C - does an fflush() If the open is closed by a forced dismount before C, the written data will be lost, since it isn't even in the kernel yet. If the file is on a responsive NFS server, it will be written to the server shortly after C. So, there seems to be a narrow window around C where the data will be lost for a forced dismount that throws away dirty buffers vs one that doesn't "but only if the server is responsive". In other words, "Is there much difference between ripping the open files out from under a app. before it does a write syscall vs throwing the data away when it's in the kernel buffer but not yet written to an NFS server?" Anyhow, the way I now have the NFS clients, they do a "hard forced dismount" where they can throw away dirty buffers not yet written to the server. Recent patches to nfs_sync() make it return without attempting writes for the forced dismount case and the vgonel() { see above code snippet } throws away the data when the first vinvalbuf(.., V_SAVE,.) fails. > Many file systems have had bugs in this area. Before 1999/01/22 > (vfs_bio.c 1.196), b*write() gave up after an i/o error, and pretended > to succeed. Both recoverable and unrecoverable errors were mishandled. > This avoided many hangs in VFS_SYNC(). When this was partially fixed, > many VFS_SYNC()s couldn't handle the errors, and paniced when they > should have looped endlessly. Now I think they mostly loop endlessly, > even for unrecoverable errors when they shouldn't. My version attempts > to fix vfs_bio.c 1.196 by still giving up after an unrecoverable i/o > error. This reduced endless loops but gave more panics in other places > that can't handle the errors, mainly in the VFS_UMOUNT() call in the > above -- many file systems saw the errors after the point where it is > posible to either recover from them or loop endlessly on them, and > then > a panic occurred soon after the VFS_UMOUNT() returned with a > half-complete > unmount(), since neither a success or a failure return can indicate > this > state. > > > call to the unmount(2) call, I'm not convinced it makes a > > significant > > difference. (I thought of just getting rid of it, but figured it was > > harmless for the non "-f" case and might matter for a buggy fs that > > doesn't > > get the unmount(2) quite right. ie. Same argument as doing the > > triple-sync, > > just to be sure.) > > I think you shouldn't have touched umount(8). The sync can still hang > or > just be in progress when unmount(2) is called, and unmount(2) still > does > its own sync, so nfs_unmount() must still handle hanging syncs in some > way. > > My reboot script has more details related to this: > > %%% > sh < sync > #umount -Af -t nfs > /sbin/reboot > EOF > %%% > > This used to unmount the nfs file systems explicitly because I > _wanted_ > their unmounts to hang if there is a problem (hopefullly while they > could > be aborted by ^C). Otherwise, I wanted the reboot to be fairly > forceful > (no messing around with shutdown or even umount). reboot(8) and > reboot(2) > do a fairly clean shutdown, including unmounting all file systems with > the force flag set (in vfs_unmountall(9)), although their man pages > don't > mention unmounting. reboot(8) doesn't even mention reboot(2)!, > although > it bogusly references sync(8). reboot(8) actually uses sync(2) (unless > nflag), but this is fairly bogus too, since reboot(2) does another > sync > (unless RB_NOSYNC). Perhaps there was a problem with the force flag > being > too forceful especially for nfs. vfs_bio.c 1.196 might have fixed > this. > > Bruce From owner-svn-src-head@FreeBSD.ORG Tue May 31 21:00:21 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 341441065674; Tue, 31 May 2011 21:00:21 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 1C9658FC1D; Tue, 31 May 2011 21:00:19 +0000 (UTC) Received: by wwc33 with SMTP id 33so5112431wwc.31 for ; Tue, 31 May 2011 14:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=wS3mgvTmLxGzeCGhAA4kTMY39CTK5s2bt/CjL24B1Ds=; b=SB7bNeaUy+u/JjEjmnxXroFL1b5iViSNBRLWsj0AwlQD+ecDBRY+mVwynfVj3Z31M8 ju0Mk4vJjD8840AOH3ZRV6gP29T6B7GxpVlpeH2ZTh2dvp9sV5ZnPEnmGpFkssQ4nBLp 9scVvl03JGNjppAuLKZ2keFVW/7n2kCsHgyfY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=nVyS++2rWiwe4TkSJbeu5a5Qn1ftzuoinQj9M8hbbxaFyEBW7Elingb6Ved8s7P9QS o2ykHhgeAykTeZlmwNhzqtCzKG9hVQsQx2FUCiFdm1O96lkMQkzSpTcwxy+Sise+CyCk DvlhDcGXVoYe4bnKWP8rLEC2+pmGAwZYMRnAI= MIME-Version: 1.0 Received: by 10.216.156.70 with SMTP id l48mr4109813wek.5.1306875618782; Tue, 31 May 2011 14:00:18 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.93.193 with HTTP; Tue, 31 May 2011 14:00:18 -0700 (PDT) In-Reply-To: <201105311729.p4VHTwrZ033296@svn.freebsd.org> References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> Date: Tue, 31 May 2011 14:00:18 -0700 X-Google-Sender-Auth: mBaFZucuC4kW6QmF77t6Wslv6kg Message-ID: From: mdf@FreeBSD.org To: "Kenneth D. Merry" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 21:00:21 -0000 On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry wrote: > Author: ken > Date: Tue May 31 17:29:58 2011 > New Revision: 222537 > URL: http://svn.freebsd.org/changeset/base/222537 > > Log: > =A0Fix apparent garbage in the message buffer. > > =A0While we have had a fix in place (options PRINTF_BUFR_SIZE=3D128) to f= ix > =A0scrambled console output, the message buffer and syslog were still get= ting > =A0log messages one character at a time. =A0While all of the characters s= till > =A0made it into the log (courtesy of atomic operations), they were often > =A0interleaved when there were multiple threads writing to the buffer at = the > =A0same time. This seems to panic my box with "lock "msgbuf" 0xfffffe0127ffffe0 already initialized". Unfortunately, though I booted with a fresh CURRENT this morning successfully, both /boot/kernel and /boot/kernel.old give this panic. To add insult to injury, when the kernel drops into the debugger, my keyboard input no longer works so I can't get a stack, etc. So: 1) Is there anything else I can do to help debug this? 2) how can I resurrect this box without a reinstall? I will try to repro on a virtual machine so I have a snapshot to come back = to. Thanks, matthew > =A0This fixes message buffer accesses to use buffering logic as well, so = that > =A0strings that are less than PRINTF_BUFR_SIZE will be put into the messa= ge > =A0buffer atomically. =A0So now dmesg output should look the same as cons= ole > =A0output. > > =A0subr_msgbuf.c: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Convert most message buf= fer calls to use a new spin > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0lock instead of atomic var= iables in some places. > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Add a new routine, msgbuf_= addstr(), that adds a > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0NUL-terminated string to a= message buffer. =A0This > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0takes a priority argument,= which allows us to > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0eliminate some races (at l= east in the the string > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0at a time case) that are p= resent in the > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0implementation of msglogch= ar(). =A0(dangling and > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0lastpri are static variabl= es, and are subject to > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0races when multiple caller= s are present.) > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0msgbuf_addstr() also allow= s the caller to request > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0that carriage returns be s= tripped out of the > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0string. =A0This matches th= e behavior of msglogchar(), > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0but in testing so far it d= oesn't appear that any > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0newlines are being strippe= d out. =A0So the carriage > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return removal functionali= ty may be a candidate > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for removal later on if fu= rther analysis shows > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0that it isn't necessary. > > =A0subr_prf.c: =A0 =A0 =A0 =A0 =A0 Add a new msglogstr() routine that cal= ls > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0msgbuf_logstr(). > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Rename putcons() to putbuf= (). =A0This now handles > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0buffered output to the mes= sage log as well as > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0the console. =A0Also, remo= ve the logic in putcons() > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(now putbuf()) that added = a carriage return before > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0a newline. =A0The console = path was the only path that > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0needed it, and cnputc() (c= alled by cnputs()) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0already adds a carriage re= turn. =A0So this > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0duplication resulted in ke= rnel-generated console > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0output lines ending in '\r= ''\r''\n'. > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Refactor putchar() to hand= le the new buffering > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0scheme. > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Add buffering to log(). > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Change log_console() to us= e msglogstr() instead of > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0msglogchar(). =A0Don't add= extra newlines by default > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0in log_console(). =A0Hide = that behavior behind a > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tunable/sysctl (kern.log_c= onsole_add_linefeed) for > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0those who would like the o= ld behavior. =A0The old > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0behavior led to the insert= ion of extra newlines > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for log output for program= s that print out a > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0string, and then a trailin= g newline on a separate > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0write. =A0(This is visible= with dmesg -a.) > > =A0msgbuf.h: =A0 =A0 =A0 =A0 =A0 =A0 Add a prototype for msgbuf_addstr(). > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Add three new fields to st= ruct msgbuf, msg_needsnl, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0msg_lastpri and msg_lock. = =A0The first two are needed > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for log message functional= ity previously handled > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0by msglogchar(). =A0(Which= is still active if > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0buffering isn't enabled.) > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Include sys/lock.h and sys= /mutex.h for the new > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mutex. > > =A0Reviewed by: =A0gibbs > > Modified: > =A0head/sys/kern/subr_msgbuf.c > =A0head/sys/kern/subr_prf.c > =A0head/sys/sys/msgbuf.h > > Modified: head/sys/kern/subr_msgbuf.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/subr_msgbuf.c Tue May 31 17:24:18 2011 =A0 =A0 =A0 =A0(= r222536) > +++ head/sys/kern/subr_msgbuf.c Tue May 31 17:29:58 2011 =A0 =A0 =A0 =A0(= r222537) > @@ -31,8 +31,16 @@ > > =A0#include > =A0#include > +#include > +#include > =A0#include > > +/* > + * Maximum number conversion buffer length: uintmax_t in base 2, plus <> > + * around the priority, and a terminating NUL. > + */ > +#define =A0 =A0 =A0 =A0MAXPRIBUF =A0 =A0 =A0 (sizeof(intmax_t) * NBBY + = 3) > + > =A0/* Read/write sequence numbers are modulo a multiple of the buffer siz= e. */ > =A0#define SEQMOD(size) ((size) * 16) > > @@ -51,6 +59,9 @@ msgbuf_init(struct msgbuf *mbp, void *pt > =A0 =A0 =A0 =A0mbp->msg_seqmod =3D SEQMOD(size); > =A0 =A0 =A0 =A0msgbuf_clear(mbp); > =A0 =A0 =A0 =A0mbp->msg_magic =3D MSG_MAGIC; > + =A0 =A0 =A0 mbp->msg_lastpri =3D -1; > + =A0 =A0 =A0 mbp->msg_needsnl =3D 0; > + =A0 =A0 =A0 mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); > =A0} > > =A0/* > @@ -80,6 +91,11 @@ msgbuf_reinit(struct msgbuf *mbp, void * > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0msgbuf_clear(mbp); > =A0 =A0 =A0 =A0} > + > + =A0 =A0 =A0 mbp->msg_lastpri =3D -1; > + =A0 =A0 =A0 /* Assume that the old message buffer didn't end in a newli= ne. */ > + =A0 =A0 =A0 mbp->msg_needsnl =3D 1; > + =A0 =A0 =A0 mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); > =A0} > > =A0/* > @@ -110,25 +126,140 @@ msgbuf_getcount(struct msgbuf *mbp) > =A0} > > =A0/* > - * Append a character to a message buffer. =A0This function can be > - * considered fully reentrant so long as the number of concurrent > - * callers is less than the number of characters in the buffer. > - * However, the message buffer is only guaranteed to be consistent > - * for reading when there are no callers in this function. > + * Add a character into the message buffer, and update the checksum and > + * sequence number. > + * > + * The caller should hold the message buffer spinlock. > + */ > +static inline void > +msgbuf_do_addchar(struct msgbuf *mbp, u_int *seq, int c) > +{ > + =A0 =A0 =A0 u_int pos; > + > + =A0 =A0 =A0 /* Make sure we properly wrap the sequence number. */ > + =A0 =A0 =A0 pos =3D MSGBUF_SEQ_TO_POS(mbp, *seq); > + > + =A0 =A0 =A0 mbp->msg_cksum +=3D (u_int)c - > + =A0 =A0 =A0 =A0 =A0 (u_int)(u_char)mbp->msg_ptr[pos]; > + > + =A0 =A0 =A0 mbp->msg_ptr[pos] =3D c; > + > + =A0 =A0 =A0 *seq =3D MSGBUF_SEQNORM(mbp, *seq + 1); > +} > + > +/* > + * Append a character to a message buffer. > =A0*/ > =A0void > =A0msgbuf_addchar(struct msgbuf *mbp, int c) > =A0{ > - =A0 =A0 =A0 u_int new_seq, pos, seq; > + =A0 =A0 =A0 mtx_lock_spin(&mbp->msg_lock); > + > + =A0 =A0 =A0 msgbuf_do_addchar(mbp, &mbp->msg_wseq, c); > + > + =A0 =A0 =A0 mtx_unlock_spin(&mbp->msg_lock); > +} > + > +/* > + * Append a NUL-terminated string with a priority to a message buffer. > + * Filter carriage returns if the caller requests it. > + * > + * XXX The carriage return filtering behavior is present in the > + * msglogchar() API, however testing has shown that we don't seem to sen= d > + * carriage returns down this path. =A0So do we still need it? > + */ > +void > +msgbuf_addstr(struct msgbuf *mbp, int pri, char *str, int filter_cr) > +{ > + =A0 =A0 =A0 u_int seq; > + =A0 =A0 =A0 size_t len, prefix_len; > + =A0 =A0 =A0 char prefix[MAXPRIBUF]; > + =A0 =A0 =A0 int nl, i; > + > + =A0 =A0 =A0 len =3D strlen(str); > + =A0 =A0 =A0 prefix_len =3D 0; > + =A0 =A0 =A0 nl =3D 0; > + > + =A0 =A0 =A0 /* If we have a zero-length string, no need to do anything.= */ > + =A0 =A0 =A0 if (len =3D=3D 0) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return; > + > + =A0 =A0 =A0 mtx_lock_spin(&mbp->msg_lock); > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* If this is true, we may need to insert a new priority = sequence, > + =A0 =A0 =A0 =A0* so prepare the prefix. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 if (pri !=3D -1) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 prefix_len =3D sprintf(prefix, "<%d>", pri)= ; > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* Starting write sequence number. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 seq =3D mbp->msg_wseq; > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* Whenever there is a change in priority, we have to ins= ert a > + =A0 =A0 =A0 =A0* newline, and a priority prefix if the priority is not = -1. =A0Here > + =A0 =A0 =A0 =A0* we detect whether there was a priority change, and whe= ther we > + =A0 =A0 =A0 =A0* did not end with a newline. =A0If that is the case, we= need to > + =A0 =A0 =A0 =A0* insert a newline before this string. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 if (mbp->msg_lastpri !=3D pri && mbp->msg_needsnl !=3D 0) { > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 msgbuf_do_addchar(mbp, &seq, '\n'); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mbp->msg_needsnl =3D 0; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 for (i =3D 0; i < len; i++) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* If we just had a newline, and the prio= rity is not -1 > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* (and therefore prefix_len !=3D 0), the= n we need a priority > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* prefix for this line. > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (mbp->msg_needsnl =3D=3D 0 && prefix_len= !=3D 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int j; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (j =3D 0; j < prefix_le= n; j++) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msgbuf_do_a= ddchar(mbp, &seq, prefix[j]); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Don't copy carriage returns if the cal= ler requested > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* filtering. > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* XXX This matches the behavior of msglo= gchar(), but is it > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* necessary? =A0Testing has shown that w= e don't seem to get > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* carriage returns here. > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((filter_cr !=3D 0) && (str[i] =3D=3D '\= r')) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 continue; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Clear this flag if we see a newline. = =A0This affects whether > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* we need to insert a new prefix or inse= rt a newline later. > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (str[i] =3D=3D '\n') > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mbp->msg_needsnl =3D 0; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mbp->msg_needsnl =3D 1; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 msgbuf_do_addchar(mbp, &seq, str[i]); > + =A0 =A0 =A0 } > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* Update the write sequence number for the actual number= of > + =A0 =A0 =A0 =A0* characters we put in the message buffer. =A0(Depends o= n whether > + =A0 =A0 =A0 =A0* carriage returns are filtered.) > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 mbp->msg_wseq =3D seq; > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* Set the last priority. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 mbp->msg_lastpri =3D pri; > + > + =A0 =A0 =A0 mtx_unlock_spin(&mbp->msg_lock); > > - =A0 =A0 =A0 do { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 seq =3D mbp->msg_wseq; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 new_seq =3D MSGBUF_SEQNORM(mbp, seq + 1); > - =A0 =A0 =A0 } while (atomic_cmpset_rel_int(&mbp->msg_wseq, seq, new_seq= ) =3D=3D 0); > - =A0 =A0 =A0 pos =3D MSGBUF_SEQ_TO_POS(mbp, seq); > - =A0 =A0 =A0 atomic_add_int(&mbp->msg_cksum, (u_int)(u_char)c - > - =A0 =A0 =A0 =A0 =A0 (u_int)(u_char)mbp->msg_ptr[pos]); > - =A0 =A0 =A0 mbp->msg_ptr[pos] =3D c; > =A0} > > =A0/* > @@ -141,14 +272,21 @@ msgbuf_getchar(struct msgbuf *mbp) > =A0 =A0 =A0 =A0u_int len, wseq; > =A0 =A0 =A0 =A0int c; > > + =A0 =A0 =A0 mtx_lock_spin(&mbp->msg_lock); > + > =A0 =A0 =A0 =A0wseq =3D mbp->msg_wseq; > =A0 =A0 =A0 =A0len =3D MSGBUF_SEQSUB(mbp, wseq, mbp->msg_rseq); > - =A0 =A0 =A0 if (len =3D=3D 0) > + =A0 =A0 =A0 if (len =3D=3D 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_unlock_spin(&mbp->msg_lock); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (-1); > + =A0 =A0 =A0 } > =A0 =A0 =A0 =A0if (len > mbp->msg_size) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mbp->msg_rseq =3D MSGBUF_SEQNORM(mbp, wseq= - mbp->msg_size); > =A0 =A0 =A0 =A0c =3D (u_char)mbp->msg_ptr[MSGBUF_SEQ_TO_POS(mbp, mbp->msg= _rseq)]; > =A0 =A0 =A0 =A0mbp->msg_rseq =3D MSGBUF_SEQNORM(mbp, mbp->msg_rseq + 1); > + > + =A0 =A0 =A0 mtx_unlock_spin(&mbp->msg_lock); > + > =A0 =A0 =A0 =A0return (c); > =A0} > > @@ -161,10 +299,14 @@ msgbuf_getbytes(struct msgbuf *mbp, char > =A0{ > =A0 =A0 =A0 =A0u_int len, pos, wseq; > > + =A0 =A0 =A0 mtx_lock_spin(&mbp->msg_lock); > + > =A0 =A0 =A0 =A0wseq =3D mbp->msg_wseq; > =A0 =A0 =A0 =A0len =3D MSGBUF_SEQSUB(mbp, wseq, mbp->msg_rseq); > - =A0 =A0 =A0 if (len =3D=3D 0) > + =A0 =A0 =A0 if (len =3D=3D 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_unlock_spin(&mbp->msg_lock); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (0); > + =A0 =A0 =A0 } > =A0 =A0 =A0 =A0if (len > mbp->msg_size) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mbp->msg_rseq =3D MSGBUF_SEQNORM(mbp, wseq= - mbp->msg_size); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0len =3D mbp->msg_size; > @@ -175,6 +317,9 @@ msgbuf_getbytes(struct msgbuf *mbp, char > > =A0 =A0 =A0 =A0bcopy(&mbp->msg_ptr[pos], buf, len); > =A0 =A0 =A0 =A0mbp->msg_rseq =3D MSGBUF_SEQNORM(mbp, mbp->msg_rseq + len)= ; > + > + =A0 =A0 =A0 mtx_unlock_spin(&mbp->msg_lock); > + > =A0 =A0 =A0 =A0return (len); > =A0} > > @@ -193,16 +338,21 @@ msgbuf_peekbytes(struct msgbuf *mbp, cha > =A0{ > =A0 =A0 =A0 =A0u_int len, pos, wseq; > > + =A0 =A0 =A0 mtx_lock_spin(&mbp->msg_lock); > + > =A0 =A0 =A0 =A0if (buf =3D=3D NULL) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Just initialise *seqp. */ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*seqp =3D MSGBUF_SEQNORM(mbp, mbp->msg_wse= q - mbp->msg_size); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_unlock_spin(&mbp->msg_lock); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (0); > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0wseq =3D mbp->msg_wseq; > =A0 =A0 =A0 =A0len =3D MSGBUF_SEQSUB(mbp, wseq, *seqp); > - =A0 =A0 =A0 if (len =3D=3D 0) > + =A0 =A0 =A0 if (len =3D=3D 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_unlock_spin(&mbp->msg_lock); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (0); > + =A0 =A0 =A0 } > =A0 =A0 =A0 =A0if (len > mbp->msg_size) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*seqp =3D MSGBUF_SEQNORM(mbp, wseq - mbp->= msg_size); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0len =3D mbp->msg_size; > @@ -212,6 +362,9 @@ msgbuf_peekbytes(struct msgbuf *mbp, cha > =A0 =A0 =A0 =A0len =3D min(len, (u_int)buflen); > =A0 =A0 =A0 =A0bcopy(&mbp->msg_ptr[MSGBUF_SEQ_TO_POS(mbp, *seqp)], buf, l= en); > =A0 =A0 =A0 =A0*seqp =3D MSGBUF_SEQNORM(mbp, *seqp + len); > + > + =A0 =A0 =A0 mtx_unlock_spin(&mbp->msg_lock); > + > =A0 =A0 =A0 =A0return (len); > =A0} > > > Modified: head/sys/kern/subr_prf.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/subr_prf.c =A0 =A0Tue May 31 17:24:18 2011 =A0 =A0 =A0 = =A0(r222536) > +++ head/sys/kern/subr_prf.c =A0 =A0Tue May 31 17:29:58 2011 =A0 =A0 =A0 = =A0(r222537) > @@ -94,6 +94,7 @@ struct snprintf_arg { > =A0extern int log_open; > > =A0static void =A0msglogchar(int c, int pri); > +static void =A0msglogstr(char *str, int pri, int filter_cr); > =A0static void =A0putchar(int ch, void *arg); > =A0static char *ksprintn(char *nbuf, uintmax_t num, int base, int *len, i= nt upper); > =A0static void =A0snprintf_func(int ch, void *arg); > @@ -106,6 +107,14 @@ TUNABLE_INT("kern.log_console_output", & > =A0SYSCTL_INT(_kern, OID_AUTO, log_console_output, CTLFLAG_RW, > =A0 =A0 &log_console_output, 0, "Duplicate console output to the syslog."= ); > > +/* > + * See the comment in log_console() below for more explanation of this. > + */ > +static int log_console_add_linefeed =3D 0; > +TUNABLE_INT("kern.log_console_add_linefeed", &log_console_add_linefeed); > +SYSCTL_INT(_kern, OID_AUTO, log_console_add_linefeed, CTLFLAG_RW, > + =A0 =A0&log_console_add_linefeed, 0, "log_console() adds extra newlines= ."); > + > =A0static int =A0 =A0 always_console_output =3D 0; > =A0TUNABLE_INT("kern.always_console_output", &always_console_output); > =A0SYSCTL_INT(_kern, OID_AUTO, always_console_output, CTLFLAG_RW, > @@ -240,16 +249,37 @@ log(int level, const char *fmt, ...) > =A0{ > =A0 =A0 =A0 =A0va_list ap; > =A0 =A0 =A0 =A0struct putchar_arg pca; > +#ifdef PRINTF_BUFR_SIZE > + =A0 =A0 =A0 char bufr[PRINTF_BUFR_SIZE]; > +#endif > > =A0 =A0 =A0 =A0pca.tty =3D NULL; > =A0 =A0 =A0 =A0pca.pri =3D level; > =A0 =A0 =A0 =A0pca.flags =3D log_open ? TOLOG : TOCONS; > +#ifdef PRINTF_BUFR_SIZE > + =A0 =A0 =A0 pca.p_bufr =3D bufr; > + =A0 =A0 =A0 pca.p_next =3D pca.p_bufr; > + =A0 =A0 =A0 pca.n_bufr =3D sizeof(bufr); > + =A0 =A0 =A0 pca.remain =3D sizeof(bufr); > + =A0 =A0 =A0 *pca.p_next =3D '\0'; > +#else > =A0 =A0 =A0 =A0pca.p_bufr =3D NULL; > +#endif > > =A0 =A0 =A0 =A0va_start(ap, fmt); > =A0 =A0 =A0 =A0kvprintf(fmt, putchar, &pca, 10, ap); > =A0 =A0 =A0 =A0va_end(ap); > > +#ifdef PRINTF_BUFR_SIZE > + =A0 =A0 =A0 /* Write any buffered console/log output: */ > + =A0 =A0 =A0 if (*pca.p_bufr !=3D '\0') { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (pca.flags & TOLOG) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msglogstr(pca.p_bufr, level= , /*filter_cr*/1); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (pca.flags & TOCONS) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 cnputs(pca.p_bufr); > + =A0 =A0 =A0 } > +#endif > =A0 =A0 =A0 =A0msgbuftrigger =3D 1; > =A0} > > @@ -258,7 +288,7 @@ log(int level, const char *fmt, ...) > =A0void > =A0log_console(struct uio *uio) > =A0{ > - =A0 =A0 =A0 int c, i, error, nl; > + =A0 =A0 =A0 int c, error, nl; > =A0 =A0 =A0 =A0char *consbuffer; > =A0 =A0 =A0 =A0int pri; > > @@ -271,20 +301,48 @@ log_console(struct uio *uio) > > =A0 =A0 =A0 =A0nl =3D 0; > =A0 =A0 =A0 =A0while (uio->uio_resid > 0) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 c =3D imin(uio->uio_resid, CONSCHUNK); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 c =3D imin(uio->uio_resid, CONSCHUNK - 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0error =3D uiomove(consbuffer, c, uio); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (error !=3D 0) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (i =3D 0; i < c; i++) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msglogchar(consbuffer[i], p= ri); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (consbuffer[i] =3D=3D '\= n') > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 nl =3D 1; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 nl =3D 0; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Make sure we're NUL-terminated */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 consbuffer[c] =3D '\0'; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (consbuffer[c - 1] =3D=3D '\n') > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 nl =3D 1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 nl =3D 0; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 msglogstr(consbuffer, pri, /*filter_cr*/ 1)= ; > + =A0 =A0 =A0 } > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* The previous behavior in log_console() is preserved wh= en > + =A0 =A0 =A0 =A0* log_console_add_linefeed is non-zero. =A0For that beha= vior, if an > + =A0 =A0 =A0 =A0* individual console write came in that was not terminat= ed with a > + =A0 =A0 =A0 =A0* line feed, it would add a line feed. > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* This results in different data in the message buffer t= han > + =A0 =A0 =A0 =A0* appears on the system console (which doesn't add extra= line feed > + =A0 =A0 =A0 =A0* characters). > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* A number of programs and rc scripts write a line feed,= or a period > + =A0 =A0 =A0 =A0* and a line feed when they have completed their operati= on. =A0On > + =A0 =A0 =A0 =A0* the console, this looks seamless, but when displayed w= ith > + =A0 =A0 =A0 =A0* 'dmesg -a', you wind up with output that looks like th= is: > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* Updating motd: > + =A0 =A0 =A0 =A0* . > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* On the console, it looks like this: > + =A0 =A0 =A0 =A0* Updating motd:. > + =A0 =A0 =A0 =A0* > + =A0 =A0 =A0 =A0* We could add logic to detect that situation, or just n= ot insert > + =A0 =A0 =A0 =A0* the extra newlines. =A0Set the kern.log_console_add_li= nefeed > + =A0 =A0 =A0 =A0* sysctl/tunable variable to get the old behavior. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 if (!nl && log_console_add_linefeed) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 consbuffer[0] =3D '\n'; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 consbuffer[1] =3D '\0'; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 msglogstr(consbuffer, pri, /*filter_cr*/ 1)= ; > =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 if (!nl) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 msglogchar('\n', pri); > =A0 =A0 =A0 =A0msgbuftrigger =3D 1; > =A0 =A0 =A0 =A0free(uio, M_IOV); > =A0 =A0 =A0 =A0free(consbuffer, M_TEMP); > @@ -330,9 +388,11 @@ vprintf(const char *fmt, va_list ap) > =A0 =A0 =A0 =A0retval =3D kvprintf(fmt, putchar, &pca, 10, ap); > > =A0#ifdef PRINTF_BUFR_SIZE > - =A0 =A0 =A0 /* Write any buffered console output: */ > - =A0 =A0 =A0 if (*pca.p_bufr !=3D '\0') > + =A0 =A0 =A0 /* Write any buffered console/log output: */ > + =A0 =A0 =A0 if (*pca.p_bufr !=3D '\0') { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cnputs(pca.p_bufr); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 msglogstr(pca.p_bufr, pca.pri, /*filter_cr*= / 1); > + =A0 =A0 =A0 } > =A0#endif > > =A0 =A0 =A0 =A0if (!panicstr) > @@ -342,18 +402,18 @@ vprintf(const char *fmt, va_list ap) > =A0} > > =A0static void > -putcons(int c, struct putchar_arg *ap) > +putbuf(int c, struct putchar_arg *ap) > =A0{ > =A0 =A0 =A0 =A0/* Check if no console output buffer was provided. */ > - =A0 =A0 =A0 if (ap->p_bufr =3D=3D NULL) > + =A0 =A0 =A0 if (ap->p_bufr =3D=3D NULL) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Output direct to the console. */ > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 cnputc(c); > - =A0 =A0 =A0 else { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ap->flags & TOCONS) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 cnputc(c); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ap->flags & TOLOG) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msglogchar(c, ap->pri); > + =A0 =A0 =A0 } else { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Buffer the character: */ > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (c =3D=3D '\n') { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *ap->p_next++ =3D '\r'; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ap->remain--; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*ap->p_next++ =3D c; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ap->remain--; > > @@ -361,12 +421,35 @@ putcons(int c, struct putchar_arg *ap) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*ap->p_next =3D '\0'; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Check if the buffer needs to be flushed= . */ > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ap->remain < 3 || c =3D=3D '\n') { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 cnputs(ap->p_bufr); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ap->remain =3D=3D 2 || c =3D=3D '\n') { > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ap->flags & TOLOG) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msglogstr(a= p->p_bufr, ap->pri, /*filter_cr*/1); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ap->flags & TOCONS) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((panics= tr =3D=3D NULL) && (constty !=3D NULL)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 msgbuf_addstr(&consmsgbuf, -1, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 ap->p_bufr, /*filter_cr*/ 0); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((constt= y =3D=3D NULL) ||(always_console_output)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 cnputs(ap->p_bufr); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ap->p_next =3D ap->p_bufr; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ap->remain =3D ap->n_bufr; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*ap->p_next =3D '\0'; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Since we fill the buffer up one charac= ter at a time, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* this should not happen. =A0We should a= lways catch it when > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* ap->remain =3D=3D 2 (if not sooner due= to a newline), flush > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* the buffer and move on. =A0One way thi= s could happen is > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* if someone sets PRINTF_BUFR_SIZE to 1 = or something > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* similarly silly. > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 KASSERT(ap->remain > 2, ("Bad buffer logic,= remain =3D %zd", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ap->remain)); > =A0 =A0 =A0 =A0} > =A0} > > @@ -381,26 +464,25 @@ putchar(int c, void *arg) > =A0 =A0 =A0 =A0struct putchar_arg *ap =3D (struct putchar_arg*) arg; > =A0 =A0 =A0 =A0struct tty *tp =3D ap->tty; > =A0 =A0 =A0 =A0int flags =3D ap->flags; > + =A0 =A0 =A0 int putbuf_done =3D 0; > > =A0 =A0 =A0 =A0/* Don't use the tty code after a panic or while in ddb. *= / > =A0 =A0 =A0 =A0if (kdb_active) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (c !=3D '\0') > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cnputc(c); > - =A0 =A0 =A0 } else if (panicstr || ((flags & TOCONS) && constty =3D=3D = NULL)) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (c !=3D '\0') > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 putcons(c, ap); > =A0 =A0 =A0 =A0} else { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((flags & TOTTY) && tp !=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((panicstr =3D=3D NULL) && (flags & TOTT= Y) && (tp !=3D NULL)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tty_putchar(tp, c); > + > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (flags & TOCONS) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (constty !=3D NULL) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msgbuf_addc= har(&consmsgbuf, c); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (always_console_output &= & c !=3D '\0') > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 putcons(c, = ap); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 putbuf(c, ap); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 putbuf_done =3D 1; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 if ((flags & TOLOG)) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 msglogchar(c, ap->pri); > + =A0 =A0 =A0 if ((flags & TOLOG) && (putbuf_done =3D=3D 0)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (c !=3D '\0') > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 putbuf(c, ap); > + =A0 =A0 =A0 } > =A0} > > =A0/* > @@ -890,6 +972,15 @@ msglogchar(int c, int pri) > =A0 =A0 =A0 =A0} > =A0} > > +static void > +msglogstr(char *str, int pri, int filter_cr) > +{ > + =A0 =A0 =A0 if (!msgbufmapped) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return; > + > + =A0 =A0 =A0 msgbuf_addstr(msgbufp, pri, str, filter_cr); > +} > + > =A0void > =A0msgbufinit(void *ptr, int size) > =A0{ > > Modified: head/sys/sys/msgbuf.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/msgbuf.h =A0 =A0 =A0 Tue May 31 17:24:18 2011 =A0 =A0 = =A0 =A0(r222536) > +++ head/sys/sys/msgbuf.h =A0 =A0 =A0 Tue May 31 17:29:58 2011 =A0 =A0 = =A0 =A0(r222537) > @@ -33,15 +33,21 @@ > =A0#ifndef _SYS_MSGBUF_H_ > =A0#define =A0 =A0 =A0 =A0_SYS_MSGBUF_H_ > > +#include > +#include > + > =A0struct msgbuf { > - =A0 =A0 =A0 char =A0 =A0*msg_ptr; =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* pointe= r to buffer */ > + =A0 =A0 =A0 char =A0 =A0 =A0 *msg_ptr; =A0 =A0 =A0 =A0 =A0 =A0/* pointe= r to buffer */ > =A0#define =A0 =A0 =A0 =A0MSG_MAGIC =A0 =A0 =A0 0x063062 > - =A0 =A0 =A0 u_int =A0 msg_magic; > - =A0 =A0 =A0 u_int =A0 msg_size; =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* size of = buffer area */ > - =A0 =A0 =A0 u_int =A0 msg_wseq; =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* write se= quence number */ > - =A0 =A0 =A0 u_int =A0 msg_rseq; =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* read seq= uence number */ > - =A0 =A0 =A0 u_int =A0 msg_cksum; =A0 =A0 =A0 =A0 =A0 =A0 =A0/* checksum= of contents */ > - =A0 =A0 =A0 u_int =A0 msg_seqmod; =A0 =A0 =A0 =A0 =A0 =A0 /* range for = sequence numbers */ > + =A0 =A0 =A0 u_int =A0 =A0 =A0msg_magic; > + =A0 =A0 =A0 u_int =A0 =A0 =A0msg_size; =A0 =A0 =A0 =A0 =A0 =A0/* size o= f buffer area */ > + =A0 =A0 =A0 u_int =A0 =A0 =A0msg_wseq; =A0 =A0 =A0 =A0 =A0 =A0/* write = sequence number */ > + =A0 =A0 =A0 u_int =A0 =A0 =A0msg_rseq; =A0 =A0 =A0 =A0 =A0 =A0/* read s= equence number */ > + =A0 =A0 =A0 u_int =A0 =A0 =A0msg_cksum; =A0 =A0 =A0 =A0 =A0 /* checksum= of contents */ > + =A0 =A0 =A0 u_int =A0 =A0 =A0msg_seqmod; =A0 =A0 =A0 =A0 =A0/* range fo= r sequence numbers */ > + =A0 =A0 =A0 int =A0 =A0 =A0 =A0msg_lastpri; =A0 =A0 =A0 =A0 /* saved pr= iority value */ > + =A0 =A0 =A0 int =A0 =A0 =A0 =A0msg_needsnl; =A0 =A0 =A0 =A0 /* set when= newline needed */ > + =A0 =A0 =A0 struct mtx msg_lock; =A0 =A0 =A0 =A0 =A0 =A0/* mutex to pro= tect the buffer */ > =A0}; > > =A0/* Normalise a sequence number or a difference between sequence number= s. */ > @@ -59,6 +65,7 @@ extern struct mtx msgbuf_lock; > > =A0void =A0 msgbufinit(void *ptr, int size); > =A0void =A0 msgbuf_addchar(struct msgbuf *mbp, int c); > +void =A0 msgbuf_addstr(struct msgbuf *mbp, int pri, char *str, int filte= r_cr); > =A0void =A0 msgbuf_clear(struct msgbuf *mbp); > =A0void =A0 msgbuf_copy(struct msgbuf *src, struct msgbuf *dst); > =A0int =A0 =A0msgbuf_getbytes(struct msgbuf *mbp, char *buf, int buflen); > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@FreeBSD.ORG Tue May 31 21:14:55 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC77A106564A; Tue, 31 May 2011 21:14:55 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1CB7F8FC08; Tue, 31 May 2011 21:14:54 +0000 (UTC) Received: by vxc34 with SMTP id 34so5055329vxc.13 for ; Tue, 31 May 2011 14:14:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=aMrjjS1X2rDOerO49Qj8AWvPjAZLTxy3XTRh/cqL/ZU=; b=cpK7RRCk8Yob1LJYYw4wq21jwEBJ7V+u1EjcXeS8NJ73vEY2zVBm6/Skxkj6mKk0TG TUz2//QrUH0fIQkR6DJFvdLL8KRoexZbRJAyQIaIf/LwI8leIWjtdw9YZm5Ztnx7R8XR IC4UeHx4p3Z2DF+WbAYAc5UqMpErnpjce0pbI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=rhidkrZPfMMMXweZRtxQifZCpMRCThYsMHeFy9Yk1eniSRfwsiseA6DS93pwHSbyWP efPi1AX/ouys45Ra4Dj8Wu/kjuhLSHgV00SeLC1dHMfuJobOyzxeTCzzpKKy36a/bJFG nT6fYr4n6Fa8rmX1oUfaPj785EXX5ElG90TVk= MIME-Version: 1.0 Received: by 10.52.67.146 with SMTP id n18mr992090vdt.232.1306876494211; Tue, 31 May 2011 14:14:54 -0700 (PDT) Received: by 10.220.183.11 with HTTP; Tue, 31 May 2011 14:14:54 -0700 (PDT) In-Reply-To: References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> Date: Tue, 31 May 2011 14:14:54 -0700 Message-ID: From: Garrett Cooper To: mdf@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Kenneth D. Merry" Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 21:14:56 -0000 On Tue, May 31, 2011 at 2:00 PM, wrote: > On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry wrot= e: >> Author: ken >> Date: Tue May 31 17:29:58 2011 >> New Revision: 222537 >> URL: http://svn.freebsd.org/changeset/base/222537 >> >> Log: >> =A0Fix apparent garbage in the message buffer. >> >> =A0While we have had a fix in place (options PRINTF_BUFR_SIZE=3D128) to = fix >> =A0scrambled console output, the message buffer and syslog were still ge= tting >> =A0log messages one character at a time. =A0While all of the characters = still >> =A0made it into the log (courtesy of atomic operations), they were often >> =A0interleaved when there were multiple threads writing to the buffer at= the >> =A0same time. > > This seems to panic my box with "lock "msgbuf" 0xfffffe0127ffffe0 > already initialized". > > Unfortunately, though I booted with a fresh CURRENT this morning > successfully, both /boot/kernel and /boot/kernel.old give this panic. > To add insult to injury, when the kernel drops into the debugger, my > keyboard input no longer works so I can't get a stack, etc. > > So: > > 1) Is there anything else I can do to help debug this? 1. sysctl debug.debugger_on_panic=3D1 ? > 2) how can I resurrect this box without a reinstall? 2. Best way is to probably to use the bsdinstall CD, use the LiveCD mode, setup the system as usual (mount /, mount devfs, chroot, mount -a), rewind to an earlier version of svn (shouldn't be too hard if you run /etc/rc.d/network restart from inside the chroot), rebuild the kernel (and potentially world), and install the kernel to the chroot, then exit and reboot (this is a method I picked up from installing Gentoo Linux multiple times, but it should work for FreeBSD as well). This is part of the reason why I'm an avid using of make installkernel INSTKERNNAME=3D$KERNCONF.$SVN_REVISION , symlink /boot/kernel to the latest one I want to boot, and I only go through every once in a blue moon to reap the kernels I don't need anymore -- I don't know until after a few weeks soak on my workstation whether or not a regression is present in the kernel. > I will try to repro on a virtual machine so I have a snapshot to come bac= k to. HTH! -Garrett From owner-svn-src-head@FreeBSD.ORG Tue May 31 21:15:31 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A71021065672; Tue, 31 May 2011 21:15:31 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 054918FC1F; Tue, 31 May 2011 21:15:30 +0000 (UTC) Received: by vxc34 with SMTP id 34so5055905vxc.13 for ; Tue, 31 May 2011 14:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=norq3zd7oRlULio52RpsFziP0Dm+A6M9tDASJLMQyvk=; b=HbLpzu8tvswMW0VMVwqnKJMXlU9e10td4f8b4nSVgfjaMtL/4rMUVSitioqFXbW+H6 eUBZ8J/OZaE+XWc9LPfoBa0t8sM2zzsf4NdzMNe/ub8IOSzEp/zc8HaNS/IXnrocRVD8 dtQStnCPWXITSYuHMzRLD15zO3FQanDrrR2wg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=ULEhFbvtbhfDN6ZQ9FEI68AX7kkj0iw70YeyGsR25Hn45SyoSnuv3/qKN5tyg/DpkN wv7ynPp2KsHFHLTn1j3Lmu7eNjZWMOcB2r424fs78IqQ23PJXLJzio5fwXecw7oeKc47 4jLrbQ/wP+2rqk/i5JJUK+7Aa/MKOPPLEbFqk= MIME-Version: 1.0 Received: by 10.220.124.71 with SMTP id t7mr2469370vcr.38.1306876530252; Tue, 31 May 2011 14:15:30 -0700 (PDT) Received: by 10.220.183.11 with HTTP; Tue, 31 May 2011 14:15:30 -0700 (PDT) In-Reply-To: References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> Date: Tue, 31 May 2011 14:15:30 -0700 Message-ID: From: Garrett Cooper To: mdf@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Kenneth D. Merry" Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 21:15:31 -0000 On Tue, May 31, 2011 at 2:14 PM, Garrett Cooper wrote: > On Tue, May 31, 2011 at 2:00 PM, =A0 wrote: >> On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry wro= te: >>> Author: ken >>> Date: Tue May 31 17:29:58 2011 >>> New Revision: 222537 >>> URL: http://svn.freebsd.org/changeset/base/222537 >>> >>> Log: >>> =A0Fix apparent garbage in the message buffer. >>> >>> =A0While we have had a fix in place (options PRINTF_BUFR_SIZE=3D128) to= fix >>> =A0scrambled console output, the message buffer and syslog were still g= etting >>> =A0log messages one character at a time. =A0While all of the characters= still >>> =A0made it into the log (courtesy of atomic operations), they were ofte= n >>> =A0interleaved when there were multiple threads writing to the buffer a= t the >>> =A0same time. >> >> This seems to panic my box with "lock "msgbuf" 0xfffffe0127ffffe0 >> already initialized". >> >> Unfortunately, though I booted with a fresh CURRENT this morning >> successfully, both /boot/kernel and /boot/kernel.old give this panic. >> To add insult to injury, when the kernel drops into the debugger, my >> keyboard input no longer works so I can't get a stack, etc. >> >> So: >> >> 1) Is there anything else I can do to help debug this? > > 1. sysctl debug.debugger_on_panic=3D1 ? Sorry.. I meant 'debug.debugger_on_panic=3D0'. >> 2) how can I resurrect this box without a reinstall? > > 2. Best way is to probably to use the bsdinstall CD, use the LiveCD > mode, setup the system as usual (mount /, mount devfs, chroot, mount > -a), rewind to an earlier version of svn (shouldn't be too hard if you > run /etc/rc.d/network restart from inside the chroot), rebuild the > kernel (and potentially world), and install the kernel to the chroot, > then exit and reboot (this is a method I picked up from installing > Gentoo Linux multiple times, but it should work for FreeBSD as well). > > This is part of the reason why I'm an avid using of make installkernel > INSTKERNNAME=3D$KERNCONF.$SVN_REVISION , symlink /boot/kernel to the > latest one I want to boot, and I only go through every once in a blue > moon to reap the kernels I don't need anymore -- I don't know until > after a few weeks soak on my workstation whether or not a regression > is present in the kernel. > >> I will try to repro on a virtual machine so I have a snapshot to come ba= ck to. From owner-svn-src-head@FreeBSD.ORG Tue May 31 21:49:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD4561065670; Tue, 31 May 2011 21:49:26 +0000 (UTC) (envelope-from pieter@degoeje.nl) Received: from smtp.utwente.nl (smtp2.utsp.utwente.nl [130.89.2.9]) by mx1.freebsd.org (Postfix) with ESMTP id 3BE8C8FC19; Tue, 31 May 2011 21:49:25 +0000 (UTC) Received: from nox.student.utwente.nl (nox.student.utwente.nl [130.89.165.91]) by smtp.utwente.nl (8.12.10/SuSE Linux 0.7) with ESMTP id p4VLmxZZ004463; Tue, 31 May 2011 23:48:59 +0200 From: Pieter de Goeje To: mdf@freebsd.org Date: Tue, 31 May 2011 23:48:59 +0200 User-Agent: KMail/1.9.10 References: <201105131848.p4DIm1j7079495@svn.freebsd.org> <201105282103.43370.pieter@degoeje.nl> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201105312348.59571.pieter@degoeje.nl> X-UTwente-MailScanner-Information: Scanned by MailScanner. Contact icts.servicedesk@utwente.nl for more information. X-UTwente-MailScanner: Found to be clean X-UTwente-MailScanner-From: pieter@degoeje.nl X-Spam-Status: No Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221853 - in head/sys: dev/md dev/null sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 21:49:26 -0000 On Sunday 29 May 2011 05:01:57 mdf@freebsd.org wrote: > On Sat, May 28, 2011 at 12:03 PM, Pieter de Goeje wrote: > > To me it looks like it's not able to cache the zeroes anymore. Is this > > intentional? I tried to change ZERO_REGION_SIZE back to 64K but that > > didn't help. > > Hmm. I don't have access to my FreeBSD box over the weekend, but I'll > run this on my box when I get back to work. > > Meanwhile you could try setting ZERO_REGION_SIZE to PAGE_SIZE and I > think that will restore things to the original performance. Indeed it does. I couldn't find any authoritative docs stating wether or not the cache on this CPU is virtually indexed, but apparently at least some of it is. Regards, Pieter From owner-svn-src-head@FreeBSD.ORG Tue May 31 21:58:16 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFB59106564A; Tue, 31 May 2011 21:58:16 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id 6D51B8FC0A; Tue, 31 May 2011 21:58:16 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id p4VLkI1U058137; Tue, 31 May 2011 15:46:18 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id p4VLkI2h058136; Tue, 31 May 2011 15:46:18 -0600 (MDT) (envelope-from ken) Date: Tue, 31 May 2011 15:46:18 -0600 From: "Kenneth D. Merry" To: mdf@FreeBSD.org Message-ID: <20110531214618.GA57498@nargothrond.kdm.org> References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 21:58:16 -0000 On Tue, May 31, 2011 at 14:00:18 -0700, mdf@FreeBSD.org wrote: > On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry wrote: > > Author: ken > > Date: Tue May 31 17:29:58 2011 > > New Revision: 222537 > > URL: http://svn.freebsd.org/changeset/base/222537 > > > > Log: > > ?Fix apparent garbage in the message buffer. > > > > ?While we have had a fix in place (options PRINTF_BUFR_SIZE=128) to fix > > ?scrambled console output, the message buffer and syslog were still getting > > ?log messages one character at a time. ?While all of the characters still > > ?made it into the log (courtesy of atomic operations), they were often > > ?interleaved when there were multiple threads writing to the buffer at the > > ?same time. > > This seems to panic my box with "lock "msgbuf" 0xfffffe0127ffffe0 > already initialized". > > Unfortunately, though I booted with a fresh CURRENT this morning > successfully, both /boot/kernel and /boot/kernel.old give this panic. > To add insult to injury, when the kernel drops into the debugger, my > keyboard input no longer works so I can't get a stack, etc. Uh-oh! > So: > > 1) Is there anything else I can do to help debug this? > 2) how can I resurrect this box without a reinstall? > > I will try to repro on a virtual machine so I have a snapshot to come back to. My guess is that this is an issue with the message buffer reinitialization path. lock_init() (called by mtx_init()) has an assert to make sure that the lock is initialized, and that is just a flag check. Since the spin lock is part of the message buffer structure, if it is held over from a previous boot, the LO_INITIALIZED flag may still be set. Try power cycling the machine. If it is an issue with re-initialization, that should clear the memory and allow you to boot. My testing has been with VMs (under Xen), so the reinit path has probably not been tested as fully as it should have been. Sorry about that! As for the debugger, that's another issue altogether. It does work for me, but then again if the spin lock initialization is broken for the message buffer that may affect things. Try a cold boot and see if that helps. If so, I think we can probably just bzero the mutex in msgbuf_reinit() and that will fix things. Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-head@FreeBSD.ORG Tue May 31 22:02:39 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEBEB106566B; Tue, 31 May 2011 22:02:39 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id DEA8C8FC08; Tue, 31 May 2011 22:02:38 +0000 (UTC) Received: by wwc33 with SMTP id 33so5164326wwc.31 for ; Tue, 31 May 2011 15:02:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=JRmpzJz/N3UxFJ6GOtLnRj9dE5KYc7svx9UVo6qLPEg=; b=e0pb7VcWlLlRsHnHyGdIHd6fipHQfcDwQz6yT55+eZdiCdDKNeQUGm1GdgEPcGEnph 3YK0XktXZ9Ne+43reQXXuPHJ1BvCWeSFqrSehq6dBggh+DeoZQXjwD5f/LMatDPoVMpO dJLyxfKluOcyVu+RVj79CDvuwOazI/2EArvjU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=j7osepsUjqlSAcgWfyVJIT+2XOVq6LJjmEV6Kpz3zVfuEpuE12EhlfyBhxjJEz+qw9 9cu88g3E4DNgfjvjhmCdOOtprPvHbDBPR0q2UdL6LeN/WE/i63MGYdEz2NPz/4pW38Ay FeqmuG8PZKO6c7XODrWQSZ03MNThglL4bd+Vg= MIME-Version: 1.0 Received: by 10.216.230.213 with SMTP id j63mr4158975weq.20.1306879357724; Tue, 31 May 2011 15:02:37 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.93.193 with HTTP; Tue, 31 May 2011 15:02:37 -0700 (PDT) In-Reply-To: <20110531214618.GA57498@nargothrond.kdm.org> References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> <20110531214618.GA57498@nargothrond.kdm.org> Date: Tue, 31 May 2011 15:02:37 -0700 X-Google-Sender-Auth: K3aHYfmuaAayhfYe2vfT2N8beko Message-ID: From: mdf@FreeBSD.org To: "Kenneth D. Merry" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 22:02:40 -0000 On Tue, May 31, 2011 at 2:46 PM, Kenneth D. Merry wrote: > On Tue, May 31, 2011 at 14:00:18 -0700, mdf@FreeBSD.org wrote: >> On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry wro= te: >> > Author: ken >> > Date: Tue May 31 17:29:58 2011 >> > New Revision: 222537 >> > URL: http://svn.freebsd.org/changeset/base/222537 >> > >> > Log: >> > ?Fix apparent garbage in the message buffer. >> > >> > ?While we have had a fix in place (options PRINTF_BUFR_SIZE=3D128) to = fix >> > ?scrambled console output, the message buffer and syslog were still ge= tting >> > ?log messages one character at a time. ?While all of the characters st= ill >> > ?made it into the log (courtesy of atomic operations), they were often >> > ?interleaved when there were multiple threads writing to the buffer at= the >> > ?same time. >> >> This seems to panic my box with "lock "msgbuf" 0xfffffe0127ffffe0 >> already initialized". >> >> Unfortunately, though I booted with a fresh CURRENT this morning >> successfully, both /boot/kernel and /boot/kernel.old give this panic. >> To add insult to injury, when the kernel drops into the debugger, my >> keyboard input no longer works so I can't get a stack, etc. > > Uh-oh! > >> So: >> >> 1) Is there anything else I can do to help debug this? >> 2) how can I resurrect this box without a reinstall? >> >> I will try to repro on a virtual machine so I have a snapshot to come ba= ck to. > > My guess is that this is an issue with the message buffer reinitializatio= n > path. =A0lock_init() (called by mtx_init()) has an assert to make sure th= at > the lock is initialized, and that is just a flag check. > > Since the spin lock is part of the message buffer structure, if it is hel= d > over from a previous boot, the LO_INITIALIZED flag may still be set. > > Try power cycling the machine. =A0If it is an issue with re-initializatio= n, > that should clear the memory and allow you to boot. Hmm, apparently my previous presses of the power button weren't long enough. I let it sit off for 20 seconds and it boots okay now. Thanks, matthew > My testing has been with VMs (under Xen), so the reinit path has probably > not been tested as fully as it should have been. =A0Sorry about that! > > As for the debugger, that's another issue altogether. =A0It does work for= me, > but then again if the spin lock initialization is broken for the message > buffer that may affect things. > > Try a cold boot and see if that helps. =A0If so, I think we can probably = just > bzero the mutex in msgbuf_reinit() and that will fix things. > > Ken > -- > Kenneth Merry > ken@FreeBSD.ORG > From owner-svn-src-head@FreeBSD.ORG Tue May 31 22:11:26 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3ECA01065674; Tue, 31 May 2011 22:11:26 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id EEA008FC0A; Tue, 31 May 2011 22:11:22 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id p4VMBMBw059186; Tue, 31 May 2011 16:11:22 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id p4VMBMvQ059185; Tue, 31 May 2011 16:11:22 -0600 (MDT) (envelope-from ken) Date: Tue, 31 May 2011 16:11:22 -0600 From: "Kenneth D. Merry" To: mdf@FreeBSD.org Message-ID: <20110531221122.GA58836@nargothrond.kdm.org> References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> <20110531214618.GA57498@nargothrond.kdm.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="17pEHd4RhPHOinZp" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 22:11:26 -0000 --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, May 31, 2011 at 15:02:37 -0700, mdf@FreeBSD.org wrote: > On Tue, May 31, 2011 at 2:46 PM, Kenneth D. Merry wrote: > > On Tue, May 31, 2011 at 14:00:18 -0700, mdf@FreeBSD.org wrote: > >> On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry wrote: > >> > Author: ken > >> > Date: Tue May 31 17:29:58 2011 > >> > New Revision: 222537 > >> > URL: http://svn.freebsd.org/changeset/base/222537 > >> > > >> > Log: > >> > ?Fix apparent garbage in the message buffer. > >> > > >> > ?While we have had a fix in place (options PRINTF_BUFR_SIZE=128) to fix > >> > ?scrambled console output, the message buffer and syslog were still getting > >> > ?log messages one character at a time. ?While all of the characters still > >> > ?made it into the log (courtesy of atomic operations), they were often > >> > ?interleaved when there were multiple threads writing to the buffer at the > >> > ?same time. > >> > >> This seems to panic my box with "lock "msgbuf" 0xfffffe0127ffffe0 > >> already initialized". > >> > >> Unfortunately, though I booted with a fresh CURRENT this morning > >> successfully, both /boot/kernel and /boot/kernel.old give this panic. > >> To add insult to injury, when the kernel drops into the debugger, my > >> keyboard input no longer works so I can't get a stack, etc. > > > > Uh-oh! > > > >> So: > >> > >> 1) Is there anything else I can do to help debug this? > >> 2) how can I resurrect this box without a reinstall? > >> > >> I will try to repro on a virtual machine so I have a snapshot to come back to. > > > > My guess is that this is an issue with the message buffer reinitialization > > path. ?lock_init() (called by mtx_init()) has an assert to make sure that > > the lock is initialized, and that is just a flag check. > > > > Since the spin lock is part of the message buffer structure, if it is held > > over from a previous boot, the LO_INITIALIZED flag may still be set. > > > > Try power cycling the machine. ?If it is an issue with re-initialization, > > that should clear the memory and allow you to boot. > > Hmm, apparently my previous presses of the power button weren't long > enough. I let it sit off for 20 seconds and it boots okay now. Okay, so it probably is the re-initialization code. Can you try this patch and see if it survives a warm boot? I also changed the initialization path, so we don't get tripped up by garbage left in memory. Also, does the debugger work now that it has booted successfully? Thanks, Ken -- Kenneth Merry ken@FreeBSD.ORG --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="subr_msgbuf.c.20110531.txt" Index: subr_msgbuf.c =================================================================== --- subr_msgbuf.c (revision 222537) +++ subr_msgbuf.c (working copy) @@ -61,6 +61,7 @@ mbp->msg_magic = MSG_MAGIC; mbp->msg_lastpri = -1; mbp->msg_needsnl = 0; + bzero(&mbp->msg_lock, sizeof(mbp->msg_lock)); mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); } @@ -95,6 +96,7 @@ mbp->msg_lastpri = -1; /* Assume that the old message buffer didn't end in a newline. */ mbp->msg_needsnl = 1; + bzero(&mbp->msg_lock, sizeof(mbp->msg_lock)); mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); } --17pEHd4RhPHOinZp-- From owner-svn-src-head@FreeBSD.ORG Tue May 31 22:16:08 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29964106564A; Tue, 31 May 2011 22:16:07 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id F07BB8FC1A; Tue, 31 May 2011 22:16:06 +0000 (UTC) Received: by wwc33 with SMTP id 33so5173973wwc.31 for ; Tue, 31 May 2011 15:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=t8V3nfW2V3v/DKm3Ql7WN5zR7I+6WEhZmvu2grW1IxQ=; b=ikFTCPW4ObnZ7iRDom8DxJDeDE8SOnj8/2L5JcBwgr0xWegFYevgtaukt38kaBmiKI XN6d/cMBr4UHHabklGmlEFkcZqFcGQV3veDwdqpuZUDV+sJkQqYjjWkoX2DKuzdArGl5 k9ZCOcqTTFpHNuwr+0AHwOsC9/p3C/FhcRpEI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=A4J42FrduTf1kM0lYc2peZ0XXDw7jz5Fs+PDMN9LwJ+Drqv3gxcCGqNQNCnTMvpwuG THjoPHveiJlXWRF2pTYuf0z76HIdNYzAMLOi6jXakBCzCL1PDuLfq6U2hjoKcUjBoI6p eDmflV9E3670JwYuGoPIT46eHEJ9qsHlZZY1Q= MIME-Version: 1.0 Received: by 10.216.221.158 with SMTP id r30mr4199047wep.50.1306880165766; Tue, 31 May 2011 15:16:05 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.93.193 with HTTP; Tue, 31 May 2011 15:16:05 -0700 (PDT) In-Reply-To: <20110531221122.GA58836@nargothrond.kdm.org> References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> <20110531214618.GA57498@nargothrond.kdm.org> <20110531221122.GA58836@nargothrond.kdm.org> Date: Tue, 31 May 2011 15:16:05 -0700 X-Google-Sender-Auth: fjohNvmx0_OopfwXg8uRDUEsbI0 Message-ID: From: mdf@FreeBSD.org To: "Kenneth D. Merry" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 22:16:08 -0000 On Tue, May 31, 2011 at 3:11 PM, Kenneth D. Merry wrote: > On Tue, May 31, 2011 at 15:02:37 -0700, mdf@FreeBSD.org wrote: >> On Tue, May 31, 2011 at 2:46 PM, Kenneth D. Merry wrot= e: >> > On Tue, May 31, 2011 at 14:00:18 -0700, mdf@FreeBSD.org wrote: >> >> On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry = wrote: >> >> > Author: ken >> >> > Date: Tue May 31 17:29:58 2011 >> >> > New Revision: 222537 >> >> > URL: http://svn.freebsd.org/changeset/base/222537 >> >> > >> >> > Log: >> >> > ?Fix apparent garbage in the message buffer. >> >> > >> >> > ?While we have had a fix in place (options PRINTF_BUFR_SIZE=3D128) = to fix >> >> > ?scrambled console output, the message buffer and syslog were still= getting >> >> > ?log messages one character at a time. ?While all of the characters= still >> >> > ?made it into the log (courtesy of atomic operations), they were of= ten >> >> > ?interleaved when there were multiple threads writing to the buffer= at the >> >> > ?same time. >> >> >> >> This seems to panic my box with "lock "msgbuf" 0xfffffe0127ffffe0 >> >> already initialized". >> >> >> >> Unfortunately, though I booted with a fresh CURRENT this morning >> >> successfully, both /boot/kernel and /boot/kernel.old give this panic. >> >> To add insult to injury, when the kernel drops into the debugger, my >> >> keyboard input no longer works so I can't get a stack, etc. >> > >> > Uh-oh! >> > >> >> So: >> >> >> >> 1) Is there anything else I can do to help debug this? >> >> 2) how can I resurrect this box without a reinstall? >> >> >> >> I will try to repro on a virtual machine so I have a snapshot to come= back to. >> > >> > My guess is that this is an issue with the message buffer reinitializa= tion >> > path. ?lock_init() (called by mtx_init()) has an assert to make sure t= hat >> > the lock is initialized, and that is just a flag check. >> > >> > Since the spin lock is part of the message buffer structure, if it is = held >> > over from a previous boot, the LO_INITIALIZED flag may still be set. >> > >> > Try power cycling the machine. ?If it is an issue with re-initializati= on, >> > that should clear the memory and allow you to boot. >> >> Hmm, apparently my previous presses of the power button weren't long >> enough. =A0I let it sit off for 20 seconds and it boots okay now. > > Okay, so it probably is the re-initialization code. =A0Can you try this p= atch > and see if it survives a warm boot? =A0I also changed the initialization > path, so we don't get tripped up by garbage left in memory. This patch survived a warm reboot (shutdown -r now). > Also, does the debugger work now that it has booted successfully? The debugger (or rather, my keyboard in the debugger) works on a successful boot. I used sysctl debug.kdb.enter=3D1 to test it. Thanks, matthew From owner-svn-src-head@FreeBSD.ORG Tue May 31 22:39:32 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C7471065673; Tue, 31 May 2011 22:39:32 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C2998FC14; Tue, 31 May 2011 22:39:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4VMdWre043019; Tue, 31 May 2011 22:39:32 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VMdW2A043017; Tue, 31 May 2011 22:39:32 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201105312239.p4VMdW2A043017@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 31 May 2011 22:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222550 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 22:39:32 -0000 Author: ken Date: Tue May 31 22:39:32 2011 New Revision: 222550 URL: http://svn.freebsd.org/changeset/base/222550 Log: Fix a bug introduced in revision 222537. In msgbuf_reinit() and msgbuf_init(), we weren't initializing the mutex. Depending on the contents of memory, the LO_INITIALIZED flag might be set on the mutex (either due to a warm reboot, and the message buffer remaining in place, or due to garbage in memory) and in that case, with INVARIANTS turned on, we would trigger an assertion that the mutex had already been initialized. Fix this by bzeroing the message buffer mutex for the _init() and _reinit() paths. Reported by: mdf Modified: head/sys/kern/subr_msgbuf.c Modified: head/sys/kern/subr_msgbuf.c ============================================================================== --- head/sys/kern/subr_msgbuf.c Tue May 31 21:42:34 2011 (r222549) +++ head/sys/kern/subr_msgbuf.c Tue May 31 22:39:32 2011 (r222550) @@ -61,6 +61,7 @@ msgbuf_init(struct msgbuf *mbp, void *pt mbp->msg_magic = MSG_MAGIC; mbp->msg_lastpri = -1; mbp->msg_needsnl = 0; + bzero(&mbp->msg_lock, sizeof(mbp->msg_lock)); mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); } @@ -95,6 +96,7 @@ msgbuf_reinit(struct msgbuf *mbp, void * mbp->msg_lastpri = -1; /* Assume that the old message buffer didn't end in a newline. */ mbp->msg_needsnl = 1; + bzero(&mbp->msg_lock, sizeof(mbp->msg_lock)); mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); } From owner-svn-src-head@FreeBSD.ORG Tue May 31 22:40:56 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7C191065672; Tue, 31 May 2011 22:40:56 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id 6542D8FC14; Tue, 31 May 2011 22:40:56 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id p4VMeti5060162; Tue, 31 May 2011 16:40:55 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id p4VMetrV060161; Tue, 31 May 2011 16:40:55 -0600 (MDT) (envelope-from ken) Date: Tue, 31 May 2011 16:40:55 -0600 From: "Kenneth D. Merry" To: mdf@FreeBSD.org Message-ID: <20110531224055.GA59252@nargothrond.kdm.org> References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> <20110531214618.GA57498@nargothrond.kdm.org> <20110531221122.GA58836@nargothrond.kdm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 22:40:56 -0000 On Tue, May 31, 2011 at 15:16:05 -0700, mdf@FreeBSD.org wrote: > On Tue, May 31, 2011 at 3:11 PM, Kenneth D. Merry wrote: > > On Tue, May 31, 2011 at 15:02:37 -0700, mdf@FreeBSD.org wrote: > >> On Tue, May 31, 2011 at 2:46 PM, Kenneth D. Merry wrote: > >> > On Tue, May 31, 2011 at 14:00:18 -0700, mdf@FreeBSD.org wrote: > >> >> On Tue, May 31, 2011 at 10:29 AM, Kenneth D. Merry wrote: > >> >> > Author: ken > >> >> > Date: Tue May 31 17:29:58 2011 > >> >> > New Revision: 222537 > >> >> > URL: http://svn.freebsd.org/changeset/base/222537 > >> >> > > >> >> > Log: > >> >> > ?Fix apparent garbage in the message buffer. > >> >> > > >> >> > ?While we have had a fix in place (options PRINTF_BUFR_SIZE=128) to fix > >> >> > ?scrambled console output, the message buffer and syslog were still getting > >> >> > ?log messages one character at a time. ?While all of the characters still > >> >> > ?made it into the log (courtesy of atomic operations), they were often > >> >> > ?interleaved when there were multiple threads writing to the buffer at the > >> >> > ?same time. > >> >> > >> >> This seems to panic my box with "lock "msgbuf" 0xfffffe0127ffffe0 > >> >> already initialized". > >> >> > >> >> Unfortunately, though I booted with a fresh CURRENT this morning > >> >> successfully, both /boot/kernel and /boot/kernel.old give this panic. > >> >> To add insult to injury, when the kernel drops into the debugger, my > >> >> keyboard input no longer works so I can't get a stack, etc. > >> > > >> > Uh-oh! > >> > > >> >> So: > >> >> > >> >> 1) Is there anything else I can do to help debug this? > >> >> 2) how can I resurrect this box without a reinstall? > >> >> > >> >> I will try to repro on a virtual machine so I have a snapshot to come back to. > >> > > >> > My guess is that this is an issue with the message buffer reinitialization > >> > path. ?lock_init() (called by mtx_init()) has an assert to make sure that > >> > the lock is initialized, and that is just a flag check. > >> > > >> > Since the spin lock is part of the message buffer structure, if it is held > >> > over from a previous boot, the LO_INITIALIZED flag may still be set. > >> > > >> > Try power cycling the machine. ?If it is an issue with re-initialization, > >> > that should clear the memory and allow you to boot. > >> > >> Hmm, apparently my previous presses of the power button weren't long > >> enough. ?I let it sit off for 20 seconds and it boots okay now. > > > > Okay, so it probably is the re-initialization code. ?Can you try this patch > > and see if it survives a warm boot? ?I also changed the initialization > > path, so we don't get tripped up by garbage left in memory. > > This patch survived a warm reboot (shutdown -r now). Cool! I just checked in the patch. > > Also, does the debugger work now that it has booted successfully? > > The debugger (or rather, my keyboard in the debugger) works on a > successful boot. I used sysctl debug.kdb.enter=1 to test it. Ahh, glad things are working there too. Let me know if you (or anyone else) run into any more issues. Thanks for testing this! Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-head@FreeBSD.ORG Tue May 31 22:47:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E035106566C; Tue, 31 May 2011 22:47:22 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 9CF5D8FC0A; Tue, 31 May 2011 22:47:21 +0000 (UTC) Received: by wyf23 with SMTP id 23so5001061wyf.13 for ; Tue, 31 May 2011 15:47:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=RD9EfHOR6df8T+x2U5RZPXP4iYNdF4NkdRrIPKH2SUg=; b=b++1/gCcuWYKCrTF/PCO/JP9jHzDqbXaGirYLT9gK/ZoU/+wfDiV3HyzeMV0qLVqyV GUXoKR87W2FxUaVItjsgY6jIoja3GmH1QRWlZvNzsH/HMGVmrx8qTNRbTqWmkVXHH70e kSH1q3mbfPXhYi5TAjahv/344+Rc/2OE0mF1s= DomainKey-Signature: a=rsa-sha1; c=nofws; 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; b=M2+xlBsEwdIRLPgdBHJFE7pC+lOW2f2R8sOuOvnf2ebAy54NacITsXZinawpd/ZQuU rHLdBODNPu5cIOoO8HBwIFY7laVxHgjn5FF38fv4+K/uTQm596vtMWFhf93+QrXruY3m 8BHK+iTM8stEiYei/8E3Ss9IrOJG1Qy6vi6Bg= MIME-Version: 1.0 Received: by 10.216.59.83 with SMTP id r61mr3253105wec.5.1306882040310; Tue, 31 May 2011 15:47:20 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.93.193 with HTTP; Tue, 31 May 2011 15:47:20 -0700 (PDT) In-Reply-To: <201105312348.59571.pieter@degoeje.nl> References: <201105131848.p4DIm1j7079495@svn.freebsd.org> <201105282103.43370.pieter@degoeje.nl> <201105312348.59571.pieter@degoeje.nl> Date: Tue, 31 May 2011 15:47:20 -0700 X-Google-Sender-Auth: qC07pP7coECpub4pZJWqzo3gh78 Message-ID: From: mdf@FreeBSD.org To: Pieter de Goeje , Bruce Evans Content-Type: multipart/mixed; boundary=000e0ce0d960c6ad8b04a49a2ff1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221853 - in head/sys: dev/md dev/null sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 22:47:22 -0000 --000e0ce0d960c6ad8b04a49a2ff1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Tue, May 31, 2011 at 2:48 PM, Pieter de Goeje wrote: > On Sunday 29 May 2011 05:01:57 mdf@freebsd.org wrote: >> On Sat, May 28, 2011 at 12:03 PM, Pieter de Goeje wr= ote: >> > To me it looks like it's not able to cache the zeroes anymore. Is this >> > intentional? I tried to change ZERO_REGION_SIZE back to 64K but that >> > didn't help. >> >> Hmm. =A0I don't have access to my FreeBSD box over the weekend, but I'll >> run this on my box when I get back to work. >> >> Meanwhile you could try setting ZERO_REGION_SIZE to PAGE_SIZE and I >> think that will restore things to the original performance. > > Indeed it does. I couldn't find any authoritative docs stating wether or = not > the cache on this CPU is virtually indexed, but apparently at least some = of > it is. On my physical box (some Dell thing from about 2008), I ran 10 loops of dd if=3D/dev/zero of=3D/dev/null bs=3DXX count=3DXX where bs went by pow= ers of 2 from 512 bytes to 2M, and count was set so that the dd always transferred 8GB. I compared ZERO_REGION_SIZE of 64k and 2M on amd64. The summary of the ministat(1) output is: bs=3D512b - no difference bs=3D1K - no difference bs=3D2k - no difference bs=3D4k - no difference bs=3D8k - no difference bs=3D16k - no difference bs=3D32k - no difference bs=3D64k - no difference bs=3D128k - 2M is 0.69% faster bs=3D256k - 2M is 0.98% faster bs=3D512k - 2M is 0.65% faster bs=3D1M - 2M is 1.02% faster bs=3D2M - 2M is 2.17% slower I'll play again with a 4K buffer. For some applications (/dev/zero) a small size is sufficient. For some (md(4)) a ZERO_REGION_SIZE at least as large as the sectorsize is desired so that a single kernel buffer pointer can be used to set up a uio for VOP_WRITE(9). Attached is the ministat output; I hope it makes it. :-) Thanks, matthew --000e0ce0d960c6ad8b04a49a2ff1 Content-Type: text/plain; charset=US-ASCII; name="zero-ministat.txt" Content-Disposition: attachment; filename="zero-ministat.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_godfv02p0 eCAvZGF0YS96ZXJvLWFtZDY0LXNtYWxsL3plcm8tNTEyLnR4dAorIC9kYXRhL3plcm8tYW1kNjQt bGFyZ2UvemVyby01MTIudHh0CistLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKfCAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgKyAgICAgICAgICAgeCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg fAp8KyAgICAgICAgICAgICAgICAgICAgICArICAgICAreCp4KyAgK3ggeCAqICB4KyAgICB4ICsg ICAgICAgICAgICAgICAgICAgIHh8CnwgICAgICAgICAgICAgICAgICB8X19fX19fX19fX3xfX0FN X19fX19fX01BX19ffF9fX19fX198ICAgICAgICAgICAgICAgICAgIHwKKy0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tKwogICAgTiAgICAgICAgICAgTWluICAgICAgICAgICBNYXggICAgICAgIE1lZGlhbiAgICAg ICAgICAgQXZnICAgICAgICBTdGRkZXYKeCAgMTAgICAgIDEzLjU2NDI3NiAgICAgMTMuNjY2NDk5 ICAgICAxMy41OTAzNzMgICAgIDEzLjU5MTk5MyAgIDAuMDMwMTcyMDgzCisgIDEwICAgICAgMTMu NDkxNzQgICAgIDEzLjYxNjI2MyAgICAgMTMuNTY5OTI1ICAgICAxMy41NjgwMDYgICAwLjAzMzg4 NDI4MQpObyBkaWZmZXJlbmNlIHByb3ZlbiBhdCA5NS4wJSBjb25maWRlbmNlCgoKCnggL2RhdGEv emVyby1hbWQ2NC1zbWFsbC96ZXJvLTEwMjQudHh0CisgL2RhdGEvemVyby1hbWQ2NC1sYXJnZS96 ZXJvLTEwMjQudHh0CistLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKfCsgICAgICAgICAgICArICAgICAgICAg ICArK3h4ICAgICAgeCAgeCArKiArKyAgICAgeHgrICAgICAgICAgICAgICAgICAgICArfAp8ICAg ICAgICAgICAgICAgfF9fX19fX19fX19fX3xfX19fX19fQUFNX19NX19fX3xfX19fX19fX198ICAg ICAgICAgICAgICAgICB8CistLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKICAgIE4gICAgICAgICAgIE1pbiAg ICAgICAgICAgTWF4ICAgICAgICBNZWRpYW4gICAgICAgICAgIEF2ZyAgICAgICAgU3RkZGV2Cngg IDEwICAgICAgNy4xNTUzODQgICAgICA3LjE4Mjg0OSAgICAgIDcuMTY4MDc2ICAgICA3LjE2NjEz ODIgICAgMC4wMTA0MTQ4OQorICAxMCAgICAgIDcuMTI0MjYzICAgICAgNy4yMDczNjMgICAgICA3 LjE3MDQ0OSAgICAgNy4xNjQ3ODk2ICAgMC4wMjM0NTM2NjIKTm8gZGlmZmVyZW5jZSBwcm92ZW4g YXQgOTUuMCUgY29uZmlkZW5jZQoKCgp4IC9kYXRhL3plcm8tYW1kNjQtc21hbGwvemVyby0yMDQ4 LnR4dAorIC9kYXRhL3plcm8tYW1kNjQtbGFyZ2UvemVyby0yMDQ4LnR4dAorLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0rCnwgICAgICAgICAgICAgICAgICArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIHwKfCsgICAgICAgICAgKyAgICAgICsgICAgeHggICAq eCAgICsqIHh4KyAgICsreCAgICAgICAgICAgICAgICB4ICAgICAgICAgICB4fAp8ICAgICAgICAg ICAgfF9fX19fX19fX3xfX19fQV9fX19fTV9fTV9fQV98X19fX19fX19fX19fX3wgICAgICAgICAg ICAgICAgICB8CistLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKICAgIE4gICAgICAgICAgIE1pbiAgICAgICAg ICAgTWF4ICAgICAgICBNZWRpYW4gICAgICAgICAgIEF2ZyAgICAgICAgU3RkZGV2CnggIDEwICAg ICAgMy44MjcyNDIgICAgICAzLjg2NzA5NSAgICAgIDMuODM3OTAxICAgICAgMy44Mzk5ODggICAw LjAxMjk4Mzc1NQorICAxMCAgICAgIDMuODA5MjEzICAgICAgMy44NDM2ODIgICAgICAzLjgzNTc0 OCAgICAgMy44MzAyNzY1ICAgMC4wMTEzNDAzMDcKTm8gZGlmZmVyZW5jZSBwcm92ZW4gYXQgOTUu MCUgY29uZmlkZW5jZQoKCgp4IC9kYXRhL3plcm8tYW1kNjQtc21hbGwvemVyby00MDk2LnR4dAor IC9kYXRhL3plcm8tYW1kNjQtbGFyZ2UvemVyby00MDk2LnR4dAorLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0r CnwrICsgICArK3h4eCAgIHggICArICsgKiB4ICAgICsgICAgICAgICAgICAgICsrICAgICAgIHgg ICAgICAgICAgIHggICAgICAgeHwKfCAgIHxfX19fX19fX19fX19fX19BTV9NX19fX19BX19fX19f X3xfX19fX19fX19fX19fX19fX3wgICAgICAgICAgICAgICAgICAgfAorLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0rCiAgICBOICAgICAgICAgICBNaW4gICAgICAgICAgIE1heCAgICAgICAgTWVkaWFuICAgICAg ICAgICBBdmcgICAgICAgIFN0ZGRldgp4ICAxMCAgICAgIDIuMTY1NTQxICAgICAgMi4yMDEyMjQg ICAgICAyLjE3MzIyNyAgICAgMi4xNzY5MDI5ICAgMC4wMTM4MDMxOTMKKyAgMTAgICAgICAyLjE2 MTM2MiAgICAgIDIuMTg1OTExICAgICAgMi4xNzIzODggICAgIDIuMTcxOTYzNCAgMC4wMDg4MTI5 MzcxCk5vIGRpZmZlcmVuY2UgcHJvdmVuIGF0IDk1LjAlIGNvbmZpZGVuY2UKCgoKeCAvZGF0YS96 ZXJvLWFtZDY0LXNtYWxsL3plcm8tODE5Mi50eHQKKyAvZGF0YS96ZXJvLWFtZDY0LWxhcmdlL3pl cm8tODE5Mi50eHQKKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwp8ICAgICAgICAgICAgICAgICAgICAgICAg ICAgICt4ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8CnwrICAg eCAgICAgICsgICsgICt4ICArICAgIHgrK3ggICAgKyAgeCB4ICAgICAgICAgICAgeCAgKyAgICAg ICAgICAgeCAgICAgeHwKfCAgICAgICAgIHxfX19fX198X19fX19fX0FfX01fX19fX19fX19BX3xf X19fX19fX19fX19fX19fX19ffCAgICAgICAgICAgICAgfAorLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCiAg ICBOICAgICAgICAgICBNaW4gICAgICAgICAgIE1heCAgICAgICAgTWVkaWFuICAgICAgICAgICBB dmcgICAgICAgIFN0ZGRldgp4ICAxMCAgICAgIDEuMzMyMjkxICAgICAgMS4zNjAzNDYgICAgICAx LjM0NTgxOCAgICAgMS4zNDU4MDIyICAwLjAwODcyODQyNTcKKyAgMTAgICAgICAxLjMzMDQ5OSAg ICAgIDEuMzUzMTU4ICAgICAgMS4zNDE0MjUgICAgIDEuMzQwMTQ2NCAgMC4wMDYxMjY5NjM5Ck5v IGRpZmZlcmVuY2UgcHJvdmVuIGF0IDk1LjAlIGNvbmZpZGVuY2UKCgoKeCAvZGF0YS96ZXJvLWFt ZDY0LXNtYWxsL3plcm8tMTYzODQudHh0CisgL2RhdGEvemVyby1hbWQ2NC1sYXJnZS96ZXJvLTE2 Mzg0LnR4dAorLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCnx4ICAgICAgIHggICAgICAgICsrK3grIHggIHgg IHgrKyAgeCAgICAgICAgICArICArIHggICAgICAgICAgICArICAgICAgICsgeHwKfCAgICAgfF9f X19fX19fX19ffF9fX19fX19fTUFfX19NX19fX0FfX19fX19fX19fX198X19fX19ffCAgICAgICAg ICAgICAgICAgfAorLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCiAgICBOICAgICAgICAgICBNaW4gICAgICAg ICAgIE1heCAgICAgICAgTWVkaWFuICAgICAgICAgICBBdmcgICAgICAgIFN0ZGRldgp4ICAxMCAg ICAgIDAuOTUxNDM5ICAgICAgMC45NzE3ODYgICAgICAwLjk1ODczMiAgICAgMC45NTkwMDMzICAw LjAwNjA0MTI4ODEKKyAgMTAgICAgICAwLjk1NjEzNyAgICAgIDAuOTcxMjUyICAgICAgMC45NjAw NTYgICAgIDAuOTYxNTc4OSAgMC4wMDU0NzA0NDk2Ck5vIGRpZmZlcmVuY2UgcHJvdmVuIGF0IDk1 LjAlIGNvbmZpZGVuY2UKCgoKeCAvZGF0YS96ZXJvLWFtZDY0LXNtYWxsL3plcm8tMzI3NjgudHh0 CisgL2RhdGEvemVyby1hbWQ2NC1sYXJnZS96ZXJvLTMyNzY4LnR4dAorLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0rCnwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICAgICAgICAgICB4 ICAgICAgICAgICAgICAgICAgICAgIHwKfHggICAgICB4ICArICAgICAgICAgICAgKyAgICB4KyAq ICAgICB4ICogICAgICAgICAgIHgrICAgIHh4ICAgICArKyAgICAgICArfAp8ICAgICAgICAgICAg ICAgIHxfX19fX3xfX19fX19fX19fX19fQV9fTV9fX0FfX19fX19fX19fX198X19fX19ffCAgICAg ICAgICB8CistLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKICAgIE4gICAgICAgICAgIE1pbiAgICAgICAgICAg TWF4ICAgICAgICBNZWRpYW4gICAgICAgICAgIEF2ZyAgICAgICAgU3RkZGV2CnggIDEwICAgICAg IDAuODc4NzggICAgICAgMC44ODQxNiAgICAgIDAuODgyMzkxICAgICAwLjg4MjA5MTggIDAuMDAx ODYyMjc0MgorICAxMCAgICAgIDAuODc5NzI1ICAgICAgMC44ODU1MTQgICAgICAwLjg4MjM4NCAg ICAgMC44ODI3MDg4ICAwLjAwMTg5MTUyNTQKTm8gZGlmZmVyZW5jZSBwcm92ZW4gYXQgOTUuMCUg Y29uZmlkZW5jZQoKCgp4IC9kYXRhL3plcm8tYW1kNjQtc21hbGwvemVyby02NTUzNi50eHQKKyAv ZGF0YS96ZXJvLWFtZDY0LWxhcmdlL3plcm8tNjU1MzYudHh0CistLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsK fCAgICAgICAgICAgKyAgICAgICAgICAgICAgeCAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgfAp8eCAgICAgICAgICArIHggICB4eCAgK3grICAqeCArIHgrICAg ICAgICAgICAgICAgICAgICsgICAgKyAgICAgIHggICAgICAgICt8CnwgICAgICAgIHxfX19ffF9f X19fX19fX19BX01fX01fX19BX19fX19fX3xfX19fX19fX19fX198ICAgICAgICAgICAgICAgICAg IHwKKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKwogICAgTiAgICAgICAgICAgTWluICAgICAgICAgICBNYXgg ICAgICAgIE1lZGlhbiAgICAgICAgICAgQXZnICAgICAgICBTdGRkZXYKeCAgMTAgICAgICAwLjc3 NzM2NCAgICAgICAwLjc4MjQ1ICAgICAgMC43Nzk0MTMgICAgIDAuNzc5Mjk5NyAgMC4wMDEzMTM0 NTU5CisgIDEwICAgICAgMC43NzgyMDEgICAgICAwLjc4MzE2OCAgICAgIDAuNzc5NjQ4ICAgICAw Ljc4MDAyNTUgIDAuMDAxNjQzODA4MQpObyBkaWZmZXJlbmNlIHByb3ZlbiBhdCA5NS4wJSBjb25m aWRlbmNlCgoKCnggL2RhdGEvemVyby1hbWQ2NC1zbWFsbC96ZXJvLTEzMTA3Mi50eHQKKyAvZGF0 YS96ZXJvLWFtZDY0LWxhcmdlL3plcm8tMTMxMDcyLnR4dAorLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCnwg ICAgICAgICAgICAgICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IHggIHggIHggICAgICAgIHwKfCsgICArICsrICsrICAgKyArICAgKyAgICAgICAgICAgICAgICAg ICAgICAgIHggICAgICAgICAgICB4eCAgeHggeCAgICAgICB4fAp8ICAgIHxfX19fX0FfX19fX3wg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfF9fX19fX0FNX19fX198ICAgICB8 CistLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLSsKICAgIE4gICAgICAgICAgIE1pbiAgICAgICAgICAgTWF4ICAg ICAgICBNZWRpYW4gICAgICAgICAgIEF2ZyAgICAgICAgU3RkZGV2CnggIDEwICAgICAgMC43MzA4 MzUgICAgICAgMC43MzM2NCAgICAgIDAuNzMyNTY0ICAgICAwLjczMjQ1MTkgMC4wMDA3MTUxNDUy OAorICAxMCAgICAgIDAuNzI2Mzg1ICAgICAgMC43MjgzNjYgICAgICAwLjcyNzM0NSAgICAgMC43 MjczNzMxIDAuMDAwNjAwNjQ3MzMKRGlmZmVyZW5jZSBhdCA5NS4wJSBjb25maWRlbmNlCgktMC4w MDUwNzg4ICsvLSAwLjAwMDYyMDQ5MwoJLTAuNjkzMzk3JSArLy0gMC4wODQ3MTQ0JQoJKFN0dWRl bnQncyB0LCBwb29sZWQgcyA9IDAuMDAwNjYwMzgyKQoKCgp4IC9kYXRhL3plcm8tYW1kNjQtc21h bGwvemVyby0yNjIxNDQudHh0CisgL2RhdGEvemVyby1hbWQ2NC1sYXJnZS96ZXJvLTI2MjE0NC50 eHQKKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tKwp8KysrKyArKyAgKysgICAgKyAgKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ICB4IHh4eHggIHh8CnwgfF9fX19NQV9fX19f fCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHxfX0FN X3wgIHwKKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwogICAgTiAgICAgICAgICAgTWluICAgICAgICAgICBN YXggICAgICAgIE1lZGlhbiAgICAgICAgICAgQXZnICAgICAgICBTdGRkZXYKeCAgMTAgICAgICAw LjcwNzQ2MyAgICAgIDAuNzA4NzU5ICAgICAgMC43MDgzMDIgICAgIDAuNzA4MjA1NyAwLjAwMDM1 MjAwMDAyCisgIDEwICAgICAgMC43MDA0MzggICAgICAwLjcwMjUxNSAgICAgICAwLjcwMTEyICAg ICAwLjcwMTIzODMgMC4wMDA2ODU3Mzk4NApEaWZmZXJlbmNlIGF0IDk1LjAlIGNvbmZpZGVuY2UK CS0wLjAwNjk2NzQgKy8tIDAuMDAwNTEyMTIKCS0wLjk4MzgxJSArLy0gMC4wNzIzMTIzJQoJKFN0 dWRlbnQncyB0LCBwb29sZWQgcyA9IDAuMDAwNTQ1MDQzKQoKCgp4IC9kYXRhL3plcm8tYW1kNjQt c21hbGwvemVyby01MjQyODgudHh0CisgL2RhdGEvemVyby1hbWQ2NC1sYXJnZS96ZXJvLTUyNDI4 OC50eHQKKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwp8KyAgICAgKyArKyAgICArKysgKyAgICAgICArICAg ICAgICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeHggeHh4eHh8CnwgICAgIHxfX19f X19fX19BX19fX19fX198ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IHxfQU18IHwKKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKwogICAgTiAgICAgICAgICAgTWluICAgICAgICAg ICBNYXggICAgICAgIE1lZGlhbiAgICAgICAgICAgQXZnICAgICAgICBTdGRkZXYKeCAgMTAgICAg ICAwLjY5NTk0OSAgICAgIDAuNjk2NTA0ICAgICAgMC42OTYzMjkgICAgIDAuNjk2MjY5OCAwLjAw MDE3MjU0MzU5CisgIDEwICAgICAgMC42OTA1NjEgICAgICAwLjY5MzMwOSAgICAgIDAuNjkxNzc1 ICAgICAgMC42OTE3NDUgMC4wMDA3OTkwODExNApEaWZmZXJlbmNlIGF0IDk1LjAlIGNvbmZpZGVu Y2UKCS0wLjAwNDUyNDggKy8tIDAuMDAwNTQzMTQxCgktMC42NDk4NjMlICsvLSAwLjA3ODAwNzIl CgkoU3R1ZGVudCdzIHQsIHBvb2xlZCBzID0gMC4wMDA1NzgwNTgpCgoKCnggL2RhdGEvemVyby1h bWQ2NC1zbWFsbC96ZXJvLTEwNDg1NzYudHh0CisgL2RhdGEvemVyby1hbWQ2NC1sYXJnZS96ZXJv LTEwNDg1NzYudHh0CistLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKfCAgICArICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfAp8ICsg ICsrICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgeCB4eCAgICB8CnwgKyArKysgICArICAgICAgICAgICsgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIHh4eHh4ICB4eHwKfHxfX19NX0FfX19ffCAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHxfQV9ffCAgfAor LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0rCiAgICBOICAgICAgICAgICBNaW4gICAgICAgICAgIE1heCAgICAg ICAgTWVkaWFuICAgICAgICAgICBBdmcgICAgICAgIFN0ZGRldgp4ICAxMCAgICAgIDAuNjg5ODY2 ICAgICAgIDAuNjkwNzIgICAgICAwLjY5MDE5MyAgICAgMC42OTAyMDY4IDAuMDAwMjg3NjE2NTcK KyAgMTAgICAgICAwLjY4MjYxMyAgICAgIDAuNjg0Nzc1ICAgICAgIDAuNjgzMDEgICAgIDAuNjgz MTQ3MyAwLjAwMDYyNTg4NTM0CkRpZmZlcmVuY2UgYXQgOTUuMCUgY29uZmlkZW5jZQoJLTAuMDA3 MDU5NSArLy0gMC4wMDA0NTc2NAoJLTEuMDIyODElICsvLSAwLjA2NjMwNDglCgkoU3R1ZGVudCdz IHQsIHBvb2xlZCBzID0gMC4wMDA0ODcwNikKCgoKeCAvZGF0YS96ZXJvLWFtZDY0LXNtYWxsL3pl cm8tMjA5NzE1Mi50eHQKKyAvZGF0YS96ZXJvLWFtZDY0LWxhcmdlL3plcm8tMjA5NzE1Mi50eHQK Ky0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tKwp8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgKyAgICArICAgICAgICAgICAgICB8Cnx4ICB4eCAgeCAgeHh4IHgg ICAgICAgICAgICAgIHggICAgICAgICB4ICsgICsrICAgICArICArKyAgICsgICAgICAgICAgICAg K3wKfCB8X19fX19fX19fTV9BX19fX19fX19fX198ICAgICAgICAgICAgICAgICAgfF9fX19fX19f X0FfX19fX19fX3wgICAgICAgICAgfAorLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCiAgICBOICAgICAgICAg ICBNaW4gICAgICAgICAgIE1heCAgICAgICAgTWVkaWFuICAgICAgICAgICBBdmcgICAgICAgIFN0 ZGRldgp4ICAxMCAgICAgIDAuNzA3NjU4ICAgICAgMC43MjI0OTkgICAgICAwLjcxMjAxNCAgICAg MC43MTI2MTM4ICAwLjAwNDY1NzAxNjUKKyAgMTAgICAgICAwLjcyMzM5NSAgICAgICAwLjczNTUy ICAgICAgMC43MjgzNjcgICAgIDAuNzI4MTAyMiAgIDAuMDAzNTE3NzkyCkRpZmZlcmVuY2UgYXQg OTUuMCUgY29uZmlkZW5jZQoJMC4wMTU0ODg0ICsvLSAwLjAwMzg3NzYyCgkyLjE3MzQ2JSArLy0g MC41NDQxNDElCgkoU3R1ZGVudCdzIHQsIHBvb2xlZCBzID0gMC4wMDQxMjY5KQo= --000e0ce0d960c6ad8b04a49a2ff1-- From owner-svn-src-head@FreeBSD.ORG Tue May 31 23:19:15 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C918D106564A; Tue, 31 May 2011 23:19:14 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 00BF58FC0C; Tue, 31 May 2011 23:19:13 +0000 (UTC) Received: by wyf23 with SMTP id 23so5018544wyf.13 for ; Tue, 31 May 2011 16:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=mWj+DB+0wxj5iLji7t9a+XU0A1WeaPrNNtXslm1FrU4=; b=K95dnxd3K7PN4EXOeIgUAoUCzzUfWOkc0madHeaA2iF6XEUL1yhq2I38I3D2GH53NW 1XyWpe5zFtO0eQxxDDbqr8T9VYGQu4c5APk2mqsHSqDWb3Luf+4cu9A9frHOk1ZAr+rb z0Gr6peZuuMQ4hPDgTdj8fZff4amoWkWAQj20= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Sq4f0vkR2VCBtuCHNnAoGNLE4qASnjhmmnr660XQg5DvkXatbnJ4d36JhxCQBFn93Z RSqii0XP1jX3D9GNlrNByMEmluHHZvbHj9WpEvbmMW4jtkgSmclpMW3FDzYzPSeWzwvu wbLx8xSW5O7vCp7SNDpBFtj0WiytTWlcmK4Lw= MIME-Version: 1.0 Received: by 10.216.156.70 with SMTP id l48mr4209655wek.5.1306883952742; Tue, 31 May 2011 16:19:12 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.93.193 with HTTP; Tue, 31 May 2011 16:19:12 -0700 (PDT) In-Reply-To: References: <201105131848.p4DIm1j7079495@svn.freebsd.org> <201105282103.43370.pieter@degoeje.nl> <201105312348.59571.pieter@degoeje.nl> Date: Tue, 31 May 2011 16:19:12 -0700 X-Google-Sender-Auth: 2SLuOfVHH6Et4RI3D8_JQMfByAY Message-ID: From: mdf@FreeBSD.org To: Pieter de Goeje , Bruce Evans Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221853 - in head/sys: dev/md dev/null sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 23:19:15 -0000 On Tue, May 31, 2011 at 3:47 PM, wrote: > On Tue, May 31, 2011 at 2:48 PM, Pieter de Goeje wrot= e: >> On Sunday 29 May 2011 05:01:57 mdf@freebsd.org wrote: >>> On Sat, May 28, 2011 at 12:03 PM, Pieter de Goeje w= rote: >>> > To me it looks like it's not able to cache the zeroes anymore. Is thi= s >>> > intentional? I tried to change ZERO_REGION_SIZE back to 64K but that >>> > didn't help. >>> >>> Hmm. =A0I don't have access to my FreeBSD box over the weekend, but I'l= l >>> run this on my box when I get back to work. >>> >>> Meanwhile you could try setting ZERO_REGION_SIZE to PAGE_SIZE and I >>> think that will restore things to the original performance. >> >> Indeed it does. I couldn't find any authoritative docs stating wether or= not >> the cache on this CPU is virtually indexed, but apparently at least some= of >> it is. > > On my physical box (some Dell thing from about 2008), I ran 10 loops > of dd if=3D/dev/zero of=3D/dev/null bs=3DXX count=3DXX where bs went by p= owers > of 2 from 512 bytes to 2M, and count was set so that the dd always > transferred 8GB. =A0I compared ZERO_REGION_SIZE of 64k and 2M on amd64. > > The summary of the ministat(1) output is: > > bs=3D512b - no difference > bs=3D1K - no difference > bs=3D2k - no difference > bs=3D4k - no difference > bs=3D8k - no difference > bs=3D16k - no difference > bs=3D32k - no difference > bs=3D64k - no difference > bs=3D128k - 2M is 0.69% faster > bs=3D256k - 2M is 0.98% faster > bs=3D512k - 2M is 0.65% faster > bs=3D1M - 2M is 1.02% faster > bs=3D2M - 2M is 2.17% slower > > I'll play again with a 4K buffer. The data is harder to parse precisely, but in general it looks like on my box using a 4K buffer results in significantly worse performance when the dd(1) block size is larger than 4K. How much worse depends on the block size, but it goes from 6% at bs=3D8k to 17% at bs>=3D256k. Showing 4k/64k/2M ZERO_REGION_SIZE graphically in the ministat(1) output also makes it clear that the difference between 64k and 2M is nearly insignificant on my box compared to using 4k. http://people.freebsd.org/~mdf/zero-ministat.txt Cheers, matthew From owner-svn-src-head@FreeBSD.ORG Tue May 31 23:49:13 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D2F01065674; Tue, 31 May 2011 23:49:13 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C64B8FC15; Tue, 31 May 2011 23:49:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4VNnDcE045145; Tue, 31 May 2011 23:49:13 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4VNnDkJ045143; Tue, 31 May 2011 23:49:13 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201105312349.p4VNnDkJ045143@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 31 May 2011 23:49:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222551 - head/sys/dev/cxgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 23:49:13 -0000 Author: np Date: Tue May 31 23:49:13 2011 New Revision: 222551 URL: http://svn.freebsd.org/changeset/base/222551 Log: Firmware device log. # sysctl dev.t4nex.0.devlog MFC after: mdf's sysctl+sbuf changes are MFC'd Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue May 31 22:39:32 2011 (r222550) +++ head/sys/dev/cxgbe/t4_main.c Tue May 31 23:49:13 2011 (r222551) @@ -271,6 +271,7 @@ static void setup_memwin(struct adapter static int cfg_itype_and_nqueues(struct adapter *, int, int, struct intrs_and_queues *); static int prep_firmware(struct adapter *); +static int get_devlog_params(struct adapter *, struct devlog_params *); static int get_capabilities(struct adapter *, struct fw_caps_config_cmd *); static int get_params(struct adapter *, struct fw_caps_config_cmd *); static void t4_set_desc(struct adapter *); @@ -297,6 +298,7 @@ static int sysctl_holdoff_pktc_idx(SYSCT static int sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS); static int sysctl_qsize_txq(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); +static int sysctl_devlog(SYSCTL_HANDLER_ARGS); static inline void txq_start(struct ifnet *, struct sge_txq *); static uint32_t fconf_to_mode(uint32_t); static uint32_t mode_to_fconf(uint32_t); @@ -402,6 +404,9 @@ t4_attach(device_t dev) if (rc != 0) goto done; /* error message displayed already */ + /* Read firmware devlog parameters */ + (void) get_devlog_params(sc, &sc->params.devlog); + /* Get device capabilities and select which ones we'll use */ rc = get_capabilities(sc, &caps); if (rc != 0) { @@ -1420,6 +1425,34 @@ prep_firmware(struct adapter *sc) } static int +get_devlog_params(struct adapter *sc, struct devlog_params *dlog) +{ + struct fw_devlog_cmd devlog_cmd; + uint32_t meminfo; + int rc; + + bzero(&devlog_cmd, sizeof(devlog_cmd)); + devlog_cmd.op_to_write = htobe32(V_FW_CMD_OP(FW_DEVLOG_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_READ); + devlog_cmd.retval_len16 = htobe32(FW_LEN16(devlog_cmd)); + rc = -t4_wr_mbox(sc, sc->mbox, &devlog_cmd, sizeof(devlog_cmd), + &devlog_cmd); + if (rc != 0) { + device_printf(sc->dev, + "failed to get devlog parameters: %d.\n", rc); + bzero(dlog, sizeof (*dlog)); + return (rc); + } + + meminfo = be32toh(devlog_cmd.memtype_devlog_memaddr16_devlog); + dlog->memtype = G_FW_DEVLOG_CMD_MEMTYPE_DEVLOG(meminfo); + dlog->start = G_FW_DEVLOG_CMD_MEMADDR16_DEVLOG(meminfo) << 4; + dlog->size = be32toh(devlog_cmd.memsize_devlog); + + return (0); +} + +static int get_capabilities(struct adapter *sc, struct fw_caps_config_cmd *caps) { int rc; @@ -2387,6 +2420,10 @@ t4_sysctls(struct adapter *sc) CTLTYPE_STRING | CTLFLAG_RD, &intr_pktcount, sizeof(intr_pktcount), sysctl_int_array, "A", "interrupt holdoff packet counter values"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "devlog", + CTLTYPE_STRING | CTLFLAG_RD, sc, 0, + sysctl_devlog, "A", "device log"); + return (0); } @@ -2730,6 +2767,120 @@ sysctl_handle_t4_reg64(SYSCTL_HANDLER_AR return (sysctl_handle_64(oidp, &val, 0, req)); } +const char *devlog_level_strings[] = { + [FW_DEVLOG_LEVEL_EMERG] = "EMERG", + [FW_DEVLOG_LEVEL_CRIT] = "CRIT", + [FW_DEVLOG_LEVEL_ERR] = "ERR", + [FW_DEVLOG_LEVEL_NOTICE] = "NOTICE", + [FW_DEVLOG_LEVEL_INFO] = "INFO", + [FW_DEVLOG_LEVEL_DEBUG] = "DEBUG" +}; + +const char *devlog_facility_strings[] = { + [FW_DEVLOG_FACILITY_CORE] = "CORE", + [FW_DEVLOG_FACILITY_SCHED] = "SCHED", + [FW_DEVLOG_FACILITY_TIMER] = "TIMER", + [FW_DEVLOG_FACILITY_RES] = "RES", + [FW_DEVLOG_FACILITY_HW] = "HW", + [FW_DEVLOG_FACILITY_FLR] = "FLR", + [FW_DEVLOG_FACILITY_DMAQ] = "DMAQ", + [FW_DEVLOG_FACILITY_PHY] = "PHY", + [FW_DEVLOG_FACILITY_MAC] = "MAC", + [FW_DEVLOG_FACILITY_PORT] = "PORT", + [FW_DEVLOG_FACILITY_VI] = "VI", + [FW_DEVLOG_FACILITY_FILTER] = "FILTER", + [FW_DEVLOG_FACILITY_ACL] = "ACL", + [FW_DEVLOG_FACILITY_TM] = "TM", + [FW_DEVLOG_FACILITY_QFC] = "QFC", + [FW_DEVLOG_FACILITY_DCB] = "DCB", + [FW_DEVLOG_FACILITY_ETH] = "ETH", + [FW_DEVLOG_FACILITY_OFLD] = "OFLD", + [FW_DEVLOG_FACILITY_RI] = "RI", + [FW_DEVLOG_FACILITY_ISCSI] = "ISCSI", + [FW_DEVLOG_FACILITY_FCOE] = "FCOE", + [FW_DEVLOG_FACILITY_FOISCSI] = "FOISCSI", + [FW_DEVLOG_FACILITY_FOFCOE] = "FOFCOE" +}; + +static int +sysctl_devlog(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + struct devlog_params *dparams = &sc->params.devlog; + struct fw_devlog_e *buf, *e; + int i, j, rc, nentries, first = 0; + struct sbuf *sb; + uint64_t ftstamp = UINT64_MAX; + + if (dparams->start == 0) + return (ENXIO); + + nentries = dparams->size / sizeof(struct fw_devlog_e); + + buf = malloc(dparams->size, M_CXGBE, M_NOWAIT); + if (buf == NULL) + return (ENOMEM); + + rc = -t4_mem_read(sc, dparams->memtype, dparams->start, dparams->size, + (void *)buf); + if (rc != 0) + goto done; + + for (i = 0; i < nentries; i++) { + e = &buf[i]; + + if (e->timestamp == 0) + break; /* end */ + + e->timestamp = be64toh(e->timestamp); + e->seqno = be32toh(e->seqno); + for (j = 0; j < 8; j++) + e->params[j] = be32toh(e->params[j]); + + if (e->timestamp < ftstamp) { + ftstamp = e->timestamp; + first = i; + } + } + + if (buf[first].timestamp == 0) + goto done; /* nothing in the log */ + + rc = sysctl_wire_old_buffer(req, 0); + if (rc != 0) + goto done; + + sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req); + sbuf_printf(sb, "\n%10s %15s %8s %8s %s\n", + "Seq#", "Tstamp", "Level", "Facility", "Message"); + + i = first; + do { + e = &buf[i]; + if (e->timestamp == 0) + break; /* end */ + + sbuf_printf(sb, "%10d %15ju %8s %8s ", + e->seqno, e->timestamp, + (e->level < ARRAY_SIZE(devlog_level_strings) ? + devlog_level_strings[e->level] : "UNKNOWN"), + (e->facility < ARRAY_SIZE(devlog_facility_strings) ? + devlog_facility_strings[e->facility] : "UNKNOWN")); + sbuf_printf(sb, e->fmt, e->params[0], e->params[1], + e->params[2], e->params[3], e->params[4], + e->params[5], e->params[6], e->params[7]); + + if (++i == nentries) + i = 0; + } while (i != first); + + rc = sbuf_finish(sb); + sbuf_delete(sb); +done: + free(buf, M_CXGBE); + return (rc); +} + static inline void txq_start(struct ifnet *ifp, struct sge_txq *txq) { From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 01:32:58 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 663401065673; Wed, 1 Jun 2011 01:32:58 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 564F08FC0C; Wed, 1 Jun 2011 01:32:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p511Ww7t048214; Wed, 1 Jun 2011 01:32:58 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p511WwC5048212; Wed, 1 Jun 2011 01:32:58 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201106010132.p511WwC5048212@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 1 Jun 2011 01:32:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222552 - head/sys/dev/cxgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 01:32:58 -0000 Author: np Date: Wed Jun 1 01:32:58 2011 New Revision: 222552 URL: http://svn.freebsd.org/changeset/base/222552 Log: Provide hit-count with rest of the information about a filter. MFC after: 1 week Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue May 31 23:49:13 2011 (r222551) +++ head/sys/dev/cxgbe/t4_main.c Wed Jun 1 01:32:58 2011 (r222552) @@ -305,6 +305,7 @@ static uint32_t mode_to_fconf(uint32_t); static uint32_t fspec_to_fconf(struct t4_filter_specification *); static int get_filter_mode(struct adapter *, uint32_t *); static int set_filter_mode(struct adapter *, uint32_t); +static inline uint64_t get_filter_hits(struct adapter *, uint32_t); static int get_filter(struct adapter *, struct t4_filter *); static int set_filter(struct adapter *, struct t4_filter *); static int del_filter(struct adapter *, struct t4_filter *); @@ -3064,6 +3065,20 @@ done: return (rc); } +static inline uint64_t +get_filter_hits(struct adapter *sc, uint32_t fid) +{ + uint32_t tcb_base = t4_read_reg(sc, A_TP_CMM_TCB_BASE); + uint64_t hits; + + t4_write_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_OFFSET, 0), + tcb_base + (fid + sc->tids.ftid_base) * TCB_SIZE); + t4_read_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_OFFSET, 0)); + hits = t4_read_reg64(sc, MEMWIN0_BASE + 16); + + return (be64toh(hits)); +} + static int get_filter(struct adapter *sc, struct t4_filter *t) { @@ -3087,7 +3102,10 @@ get_filter(struct adapter *sc, struct t4 t->idx = i; t->l2tidx = f->l2t ? f->l2t->idx : 0; t->smtidx = f->smtidx; - t->hits = 0; /* XXX implement */ + if (f->fs.hitcnts) + t->hits = get_filter_hits(sc, t->idx); + else + t->hits = UINT64_MAX; t->fs = f->fs; return (0); From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 02:07:01 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 47834106566B; Wed, 1 Jun 2011 02:07:01 +0000 (UTC) Date: Wed, 1 Jun 2011 02:07:01 +0000 From: Alexander Best To: Niclas Zeising Message-ID: <20110601020701.GA29512@freebsd.org> References: <201105281514.p4SFEoB2089540@svn.freebsd.org> <4DE11E9F.1020601@daemonic.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DE11E9F.1020601@daemonic.se> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Kirk McKusick Subject: Re: svn commit: r222423 - head/sbin/newfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 02:07:01 -0000 On Sat May 28 11, Niclas Zeising wrote: > On 2011-05-28 17:14, Kirk McKusick wrote: > > Author: mckusick > > Date: Sat May 28 15:14:50 2011 > > New Revision: 222423 > > URL: http://svn.freebsd.org/changeset/base/222423 > > > > Log: > > Update the manual page to reflect the new 32K/4K defaults. > > > > Reminded by: Ivan Voras > > > > Modified: > > head/sbin/newfs/newfs.8 > > > > See docs/157354 as well. > > http://www.freebsd.org/cgi/query-pr.cgi?pr=157354 i believe tuning(7) might also benefit from updating it to reflect the new defaults. cheers. alex > > Regards! > -- > Niclas -- a13x From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 06:07:42 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC8DC106566B; Wed, 1 Jun 2011 06:07:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 7EECE8FC1B; Wed, 1 Jun 2011 06:07:41 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA26970; Wed, 01 Jun 2011 09:07:40 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1QReah-000KC4-Ov; Wed, 01 Jun 2011 09:07:39 +0300 Message-ID: <4DE5D72A.1020405@FreeBSD.org> Date: Wed, 01 Jun 2011 09:07:38 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.17) Gecko/20110503 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: "Kenneth D. Merry" References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> In-Reply-To: <201105311729.p4VHTwrZ033296@svn.freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 06:07:43 -0000 on 31/05/2011 20:29 Kenneth D. Merry said the following: > + mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); Sorry that I didn't gather myself together for a review before this change got actually committed. Do you see any reason not to make this spinlock recursive? I am a little bit worried about "exotic" situations like receiving an NMI in the middle of printing and wanting to print in the NMI context, or similar things that penetrate contexts with disabled interrupts - e.g. Machine Check Exception. Also it's not clear to me if there won't any bigger damage in the situations like those described above. P.S. I have been thinking about fixing the problem in a different fashion, via reserving portions of dmesg buffer for a whole message using CAS: http://lists.freebsd.org/pipermail/freebsd-hackers/2010-April/031535.html -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 09:25:08 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC6461065670; Wed, 1 Jun 2011 09:25:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 650E08FC15; Wed, 1 Jun 2011 09:25:08 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p519P3XS007390 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 1 Jun 2011 19:25:05 +1000 Date: Wed, 1 Jun 2011 19:25:03 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Steve Kargl In-Reply-To: <20110531153254.GA55855@troutmask.apl.washington.edu> Message-ID: <20110601191732.A1211@besplex.bde.org> References: <201105182106.p4IL6KkE008657@svn.freebsd.org> <20110518211651.GE2273@garage.freebsd.pl> <4DE4FB1D.8090407@links.org> <20110531153254.GA55855@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek , Ben Laurie Subject: Re: svn commit: r222084 - head/contrib/gperf/src X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 09:25:08 -0000 On Tue, 31 May 2011, Steve Kargl wrote: > On Tue, May 31, 2011 at 03:28:45PM +0100, Ben Laurie wrote: >> On 18/05/2011 22:16, Pawel Jakub Dawidek wrote: >>> On Wed, May 18, 2011 at 09:06:20PM +0000, Ben Laurie wrote: >>>> Author: benl >>>> Date: Wed May 18 21:06:20 2011 >>>> New Revision: 222084 >>>> URL: http://svn.freebsd.org/changeset/base/222084 >>>> >>>> Log: >>>> Fix clang warnings. >>>> >>>> Approved by: philip (mentor) >>> [...] >>>> - fprintf (stderr, " by changing asso_value['%c'] (char #%d) to %d\n", >>>> + fprintf (stderr, " by changing asso_value['%c'] (char #%zd) to %d\n", >>>> *p, p - union_set + 1, asso_values[(unsigned char)(*p)]); >>> >>> Hmm, both 'p' and 'union_set' are 'char *' and %zd is for ssize_t. It is >>> a bit strange that it fixes the warning. >> >> Why? The difference between two pointers is ssize_t, surely? >> > >> From n1256.pdf, > > When two pointers are subtracted, both shall point to elements of > the same array object, or one past the last element of the array > object; the result is the difference of the subscripts of the two > array elements. The size of the result is implementation-defined, > and its type (a signed integer type) is ptrdiff_t defined in the > header. > > ptrdiff_t is not necessarily that same as ssize_t. ssize_t doesn't even exist in Standard C. It is a POSIX thing, mainly for the (broken for historical reasons) return type of read(2) and similar functions. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 10:07:38 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4867A106566B; Wed, 1 Jun 2011 10:07:38 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 9A8228FC14; Wed, 1 Jun 2011 10:07:37 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p51A7VN3009677 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 1 Jun 2011 20:07:33 +1000 Date: Wed, 1 Jun 2011 20:07:31 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andriy Gapon In-Reply-To: <4DE5D72A.1020405@FreeBSD.org> Message-ID: <20110601193030.A1275@besplex.bde.org> References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> <4DE5D72A.1020405@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "Kenneth D. Merry" Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 10:07:38 -0000 On Wed, 1 Jun 2011, Andriy Gapon wrote: > on 31/05/2011 20:29 Kenneth D. Merry said the following: >> + mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); > > Sorry that I didn't gather myself together for a review before this change got > actually committed. > Do you see any reason not to make this spinlock recursive? I see reasons why it must not exist. The message buffer code cannot use any normal locking, and was carefully written to avoid doing so. > I am a little bit worried about "exotic" situations like receiving an NMI in the > middle of printing and wanting to print in the NMI context, or similar things > that penetrate contexts with disabled interrupts - e.g. Machine Check Exception. > Also it's not clear to me if there won't any bigger damage in the situations > like those described above. > > P.S. I have been thinking about fixing the problem in a different fashion, via > reserving portions of dmesg buffer for a whole message using CAS: > http://lists.freebsd.org/pipermail/freebsd-hackers/2010-April/031535.html Something like this might work. PRINTF_BUFR size should not exist either, especially now that it is much more complicated and broken. Here is some of my old mail about adding (necessarily not normal) locking to to printf. No one replied, so I never finished this :-(. %%% >From bde@optusnet.com.au Mon Jun 15 16:18:03 2009 +1000 Date: Mon, 15 Jun 2009 16:17:59 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Sam Leffler , Ed Schouten , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r194204 - in head/sys: amd64/conf i386/conf In-Reply-To: <20090615114142.B775@besplex.bde.org> Message-ID: <20090615153040.R1080@besplex.bde.org> References: <200906141801.n5EI1Zti056239@svn.freebsd.org> <4A356A0F.3050800@freebsd.org> <20090615075134.K24645@delplex.bde.org> <4A359AA6.7010101@freebsd.org> <20090615114142.B775@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Status: RO X-Status: A X-Keywords: X-UID: 913 On Mon, 15 Jun 2009, Bruce Evans wrote: > On Sun, 14 Jun 2009, Sam Leffler wrote: >> I'd love to see someone properly lock printf/console output instead of >> kludges like PRINTF_BUFR_SIZE. > > Almost done (for FreeBSD-~5.2): non-production version with lots of debugging > cruft: This version for RELENG_7 seems to work as intended. jhb should look at its atomic ops. I only have 1 normal source of interleaved messages -- the messages about waiting for system processes on shutdown on SMP systems -- and this seems to be fixed. The patch applies even without removing PRINTF_BUFR_SIZE or cnputs(), and works, at least if PRINTF_BUFR_SIZE and the per-cpu buffer are not enabled. Note that it serializes accesses to the message buffer too. The locks automatically cover the message buffer if they are applied, and are applied to all cases that set TOLOG, though this might be too dangerous for tprintf() since printing to a user's console shouldn't block other parts of the kernel. printf() to a redirected console is more careful about this -- it extracts messages from the message buffer and can handle long delays provided the message buffer doesn't wrap around. This might be the best method for all cases. Accesses to the message buffer need to be serialized for this to work properly, and serializing ony accesses to the message buffer is easier since there are no hardware delays to worry about -- strict locking with no timeouts will work provided the halting problem is solvable for kvprintf() to the message buffer alone. No attempt is made to buffer messages across printf()s. Neither does PRINTF_BUFR_SIZE. PRINTF_BUFR_SIZE uses an auto buffer so it obviously has to flush at the end of each printf. Always extracting from the message buffer might be the best way to handle this too. Normally you would extract complete lines, but there must be a timeout to handle partial lines. The 1 second timeout here isn't best if the timeout is needed for avoiding deadlock, as may happen when a printf() is interrupted by panic(). panic could reasonably() blow open all locks including printf_lock(), but this is not easy to do without letting other CPUs proceed and/or complicating the usual case. Very slow terminals, say 50 bps, need a timeout of say 16 seconds so that the can print an 80-character line without being interrupted. % Index: subr_prf.c % =================================================================== % RCS file: /home/ncvs/src/sys/kern/subr_prf.c,v % retrieving revision 1.130.2.1 % diff -u -2 -r1.130.2.1 subr_prf.c % --- subr_prf.c 21 Jan 2009 00:26:45 -0000 1.130.2.1 % +++ subr_prf.c 15 Jun 2009 05:32:03 -0000 % @@ -112,4 +112,27 @@ % &always_console_output, 0, "Always output to console despite TIOCCONS."); % % +static int printf_lockcount; % + % +static void % +printf_lock(void) % +{ % + int timeout; % + % + timeout = 1000; % + do { % + if (atomic_cmpset_acq_int(&printf_lockcount, 0, 1)) % + return; % + DELAY(1000); % + } while (--timeout != 0); % + atomic_add_acq_int(&printf_lockcount, 1); % +} % + % +static void % +printf_unlock(void) % +{ % + % + atomic_add_rel_int(&printf_lockcount, -1); % +} % + % /* % * Warn that a system table is full. % @@ -198,5 +221,9 @@ % pca.flags = flags; % va_start(ap, fmt); % + if (pri != -1) % + printf_lock(); /* To serialize msgbuf. XXX: long-held lock? */ % kvprintf(fmt, putchar, &pca, 10, ap); % + if (pri != -1) % + printf_unlock(); % va_end(ap); % if (sess != NULL) % @@ -243,5 +270,7 @@ % % va_start(ap, fmt); % + printf_lock(); /* Even for TOLOG, for serializing msgbuf. */ % kvprintf(fmt, putchar, &pca, 10, ap); % + printf_unlock(); % va_end(ap); % % @@ -312,5 +341,7 @@ % #endif % % + printf_lock(); % retval = kvprintf(fmt, putchar, &pca, 10, ap); % + printf_unlock(); % va_end(ap); % % @@ -350,5 +381,7 @@ % #endif % % + printf_lock(); % retval = kvprintf(fmt, putchar, &pca, 10, ap); % + printf_unlock(); % % #ifdef PRINTF_BUFR_SIZE Bruce >From bde@optusnet.com.au Tue Jun 16 08:16:06 2009 +1000 Date: Tue, 16 Jun 2009 08:16:03 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Bruce Evans cc: Sam Leffler , Ed Schouten , jhb@freebsd.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r194204 - in head/sys: amd64/conf i386/conf In-Reply-To: <20090615153040.R1080@besplex.bde.org> Message-ID: <20090616070732.Q25544@delplex.bde.org> References: <200906141801.n5EI1Zti056239@svn.freebsd.org> <4A356A0F.3050800@freebsd.org> <20090615075134.K24645@delplex.bde.org> <4A359AA6.7010101@freebsd.org> <20090615114142.B775@besplex.bde.org> <20090615153040.R1080@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Status: O X-Status: X-Keywords: X-UID: 914 On Mon, 15 Jun 2009, Bruce Evans wrote: > ... > This version for RELENG_7 seems to work as intended. jhb should look at > its atomic ops. No reply yet. I thought of some problems with this version. Mainly with the delaying code: - Some versions of DELAY() need to lock the hardware, so calling DELAY() can deadlock. E.g., on amd64 before the TSC is initialized, and on i386 with no TSC and/or before the TSC is initialized, and when kdb is not active on both, DELAY() calls getit(), and getit() locks the clock hardware unconditionally using a non-recursive spin mutex. Contrary to what I said in previous mail, detection of erroneous recursion isn't broken in the usual case. The usual case is probably INVARIANTS, and then recursion is detected. The handling of erroneous version then causes endless recursion on printf(): it is a failing KASSERT() which will call panic(), which will call printf(), which will reach the failing KASSERT() again. The non-recursive spinlock in cnputs() has the same bug (deadlock --> recursive deadlock). This problem in DELAY() is well known, so it is worked around when kdb is active by not calling getit() then. Nearby bugs in DELAY(): if DELAY() is first called after the TSC is initialized, then its debugging code is never reached. Its debugging code is a non-NOTEd non-option and could have been removed after the getit() version of DELAY() was verified to give reasonably accurate timing, but it is more useful for the TSC version since the TSC version has not been verified to give reasonably accurate timing. The TSC version must fail any reasonable verifiications except probably for P-state invariant TSCs since the TSC varies and DELAY() makes no attempt to compensate for its variance). If DELAY() is first called before the TSC is initialized, then the debugging code still works for the i8254 but its placement is confusing, and when the counter is changed to the TSC there is no code to debug the change. - timecounters are no better than DELAY() for implementing the delaying, since apart from them possibly not working on cold and/or deadlocked systems, although the upper-level timecounter code is lock-free, the timecounter hardware code might need to use a lock. Again, the i8254 timecounter hardware code uses the clock spinlock. - KTR uses plain printf(), and KTR can produce a lot of output, so the delay should be as short as possible, as for mcount_trylock(), and 1ms is too long. Recursion is a relatively unimportant part of the problem here. Too-long delays are possible in normal operation, when one CPU is in a normal printf() and other CPUs want to do KTR printfs. Serialization of the printf()s is especially important for voluminous concurrent KTR output, but so is printing such output fast. jhb should look at this too. I use KTR less than once a year. > % Index: subr_prf.c > % =================================================================== > % RCS file: /home/ncvs/src/sys/kern/subr_prf.c,v > % retrieving revision 1.130.2.1 > % diff -u -2 -r1.130.2.1 subr_prf.c > % --- subr_prf.c 21 Jan 2009 00:26:45 -0000 1.130.2.1 > % +++ subr_prf.c 15 Jun 2009 05:32:03 -0000 > % @@ -112,4 +112,27 @@ > % &always_console_output, 0, "Always output to console despite > TIOCCONS."); > % % +static int printf_lockcount; > % + > % +static void > % +printf_lock(void) > % +{ > % + int timeout; > % + > % + timeout = 1000; > % + do { > % + if (atomic_cmpset_acq_int(&printf_lockcount, 0, 1)) > % + return; > % + DELAY(1000); > % + } while (--timeout != 0); > % + atomic_add_acq_int(&printf_lockcount, 1); > % +} If the DELAY() is removed, the initial value of `timeout' would need to be (possibly dynamically) calibrated. The timeouts for the panics for spinlocks and threadlocks in kern_mutex.c have similar problems and could benefit from calibration. First they do up to 10 million cpu_spinwait()s. 10 million might be too small or too large. Then they do up to 60 million DELAY(1)s. DELAY() can deadlock as above. 60 million is supposed to give a delay of 60 seconds, but short delays can be very inaccurate (the minimum DELAY() is about 5 us with i8254 hardware on fast CPUs and about 30 us with i8254 hardware on 1990's CPUs), so the timeouts can be more like 5 minutes than 1 minute. A non-dynamically calibrated loop using uncached memory or device accesses has a better chance of working accurately than the non-dynamically calibrated TSC loop in the amd64 and i8254 DELAY()s, since throttling of the TSC is more common than throttling of memory systems. Bruce %%% -current still has the broken cnputs(): % void % cnputs(char *p) This function was only used by PRINTF_BUR_SIZE. I is under the ifdef for one call, but the larger code in putcons() that calls it is not ifdefed although it was only used if ap->p_bufr != NULL and only PRINTF_BUFR_SIZE sets p_bufr. % { % int c; % int unlock_reqd = 0; % % if (use_cnputs_mtx) { % mtx_lock_spin(&cnputs_mtx); Ordinary locking cannot be used here. cnputs_mtx is not even recursive, so any recursive call here gives deadlock. Recursive calls can easily be arranged using ddb, perhaps just by tracing through this code, or possibly by NMIs. A recursive mutex would cause other problems (not so bad) when recursion occurse. The new msg_lock seems to have the same problems and more. It isn't recursive. cnputs_mtx is at least NOWITNESS. If msg_lock were recursive, then problems from this would probably be quite bad, unlike for cnputs_mtx -- with cnputs_mtx, you should just get interleaved output, while with msg_lock you would probably get a corrupt message buffer. % unlock_reqd = 1; % } % % while ((c = *p++) != '\0') % cnputc(c); % % if (unlock_reqd) % mtx_unlock_spin(&cnputs_mtx); % } Bruce From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 10:23:03 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C85D6106564A; Wed, 1 Jun 2011 10:23:03 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B719E8FC0A; Wed, 1 Jun 2011 10:23: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 p51AN32g064491; Wed, 1 Jun 2011 10:23:03 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51AN3M7064489; Wed, 1 Jun 2011 10:23:03 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201106011023.p51AN3M7064489@svn.freebsd.org> From: "Jayachandran C." Date: Wed, 1 Jun 2011 10:23:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222558 - head/contrib/binutils/ld/emulparams X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 10:23:03 -0000 Author: jchandra Date: Wed Jun 1 10:23:03 2011 New Revision: 222558 URL: http://svn.freebsd.org/changeset/base/222558 Log: Add .interp back into INITIAL_READONLY_SECTIONS in MIPS n64 ABI. The binutils update in r218822 caused the MIPS n64 dynamic binaries to fail because the ".interp" section is not in the initial sections. This happens because elf64bmip-defs.sh overrides INITIAL_READONLY_SECTIONS to add ".MIPS.options" sections instead of the ".reginfo" section used by n32. This used to work fine, but after r218822, INITIAL_READONLY_SECTIONS also contains the .interp section, so the override has to be done differently. Reported by : aduane at juniper Obtained from: gonzo (Initial version) Modified: head/contrib/binutils/ld/emulparams/elf64bmip-defs.sh Modified: head/contrib/binutils/ld/emulparams/elf64bmip-defs.sh ============================================================================== --- head/contrib/binutils/ld/emulparams/elf64bmip-defs.sh Wed Jun 1 06:07:57 2011 (r222557) +++ head/contrib/binutils/ld/emulparams/elf64bmip-defs.sh Wed Jun 1 10:23:03 2011 (r222558) @@ -1,3 +1,11 @@ . ${srcdir}/emulparams/elf32bmipn32-defs.sh COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" -INITIAL_READONLY_SECTIONS=".MIPS.options : { *(.MIPS.options) }" + +# elf32bmipn32-defs.sh use .reginfo, n64 ABI should use .MIPS.options, +# override INITIAL_READONLY_SECTIONS to do this. +INITIAL_READONLY_SECTIONS= +if test -z "${CREATE_SHLIB}"; then + INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }" +fi +INITIAL_READONLY_SECTIONS="${INITIAL_READONLY_SECTIONS} + .MIPS.options ${RELOCATING-0} : { *(.MIPS.options) }" From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 12:05:35 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8834A106566C; Wed, 1 Jun 2011 12:05:35 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77EFC8FC13; Wed, 1 Jun 2011 12:05:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51C5ZfZ069336; Wed, 1 Jun 2011 12:05:35 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51C5ZCm069334; Wed, 1 Jun 2011 12:05:35 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106011205.p51C5ZCm069334@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 1 Jun 2011 12:05:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222559 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 12:05:35 -0000 Author: ae Date: Wed Jun 1 12:05:35 2011 New Revision: 222559 URL: http://svn.freebsd.org/changeset/base/222559 Log: Hide useless warning under debug macro. PR: kern/69963 MFC after: 1 week Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_dynamic.c Wed Jun 1 10:23:03 2011 (r222558) +++ head/sys/netinet/ipfw/ip_fw_dynamic.c Wed Jun 1 12:05:35 2011 (r222559) @@ -753,11 +753,12 @@ ipfw_install_state(struct ip_fw *rule, i q = lookup_dyn_rule_locked(&args->f_id, NULL, NULL); if (q != NULL) { /* should never occur */ + DEB( if (last_log != time_uptime) { last_log = time_uptime; printf("ipfw: %s: entry already present, done\n", __func__); - } + }) IPFW_DYN_UNLOCK(); return (0); } From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 12:14:09 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E4881065670; Wed, 1 Jun 2011 12:14:09 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 9E91A8FC21; Wed, 1 Jun 2011 12:14:08 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p51CE4vr031529 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 1 Jun 2011 22:14:05 +1000 Date: Wed, 1 Jun 2011 22:14:04 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Rick Macklem In-Reply-To: <1326411567.44367.1306872929534.JavaMail.root@erie.cs.uoguelph.ca> Message-ID: <20110601210748.R1599@besplex.bde.org> References: <1326411567.44367.1306872929534.JavaMail.root@erie.cs.uoguelph.ca> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, Robert Watson , Bruce Evans , Kostik Belousov , Rick Macklem Subject: Re: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 12:14:09 -0000 On Tue, 31 May 2011, Rick Macklem wrote: >> It is only an optimization. Any number of syncs are useless for >> actually syncing the system, since sync(2) only does an async sync (it >> returns without waiting for most writes to complete). As you pointed >> out later in this thread, unmount(2) does a sync that works -- a sync >> sync -- before doing the unmount proper. It does this irrespective of >> the force flag: >> >> % if (((mp->mnt_flag & MNT_RDONLY) || >> % (error = VFS_SYNC(mp, MNT_WAIT)) == 0) || (flags & MNT_FORCE) != 0) >> % error = VFS_UNMOUNT(mp, flags); >> >> The force flag doesn't mean that i/o's are forced to complete. It >> only means that open files are forced to be closed (and a few related >> things). This can be seen here. We wait (potentially forever) for >> any existing writes to complete. Only then do we look at the force >> flag and bale out if the sync failed and the force flag is _not_ set. >> Most i/o problems will cause hangs in this sync, and the force flag >> won't help. But if we somehow get past this sync, and have i/o The sync should actually return an error (after syncing everything that doesn't hang). Perhaps it actually does. Then we have got past the sync. But for nfs, it will tend to hang just detecting the i/o errors (need large timeouts which are not very different from hangs). >> problems, then honoring the force flag and continuing gives even more >> fragility, since we have almost passed the point of being able to give >> up after an error (this point is typically very early in >> VFS_UNMOUNT()). >> > Well, in vgonel(), which is called from vflush() and seems to be what > gets rid of the vnode even when open for forced dismounts, there is: > > /* > * Clear out any buffers associated with the vnode. > * If the flush fails, just toss the buffers. > */ > - followed shortly by > if (vinvalbuf(vp, V_SAVE, 0, 0) != 0) > vinvalbuf(vp, 0, 0, 0); > > It seems to me that this code is willing to give up when it can't write > dirty buffers, but??? That looks like a hack to me (collateral from vfs_bio.c 1.196). In 4.4BSD-Lite, the corresponding code is in vclean() and it is just: % /* % * Clean out any buffers associated with the vnode. % */ % if (flags & DOCLOSE) % vinvalbuf(vp, V_SAVE, NOCRED, p, 0, 0); In 4.4BSD, the buffers would have been tossed at the bwrite() level before we got here. Now bwrite() is more careful, and we are a bit more careful here -- we actually check if vinvalbuf() succeeded and clean up if it didn't. There must be a place that tosses buffers with unrecoverable write errors, and forced unmounts is a good place. But vgonel() is a bad place, since it has a much wider scope than forced unmounts. I think vgonel() is normally called when a vnode is recycled. So we can have a vnode unhappily holding buffers with unrecoverable write errors for several minutes, with syncs trying to flush them every ~30 seconds, but then when the vnode is recycled for some reason the above forcibly tosses its buffers with no further error messages. Similarly for recoverable write errors (maybe an nfs server that is down for longer than the recycling time). > To me, a forced dismount of an NFS mount that just wedges on an > unresponsive server isn't very useful. The only case I can think I agree. My point is that no one tried hard to make forced unmounts very forceful, so making it work is even harder than might first appear. The problem is related to making removed removable devices work properly. > of where a forced dismount that isn't willing to throw away dirty > buffers might be useful would be when an app. (userland process) > is for some reason unkillable and is sitting with an open NFS file. > Is this a problem in practice? (I do know that a mount stuck on an > unresponsive server is a real problem. There have been several PRs, > the most recent being kern/157365.) The server can easily crash while the client has dirty buffers. > I brought up the concept of a "hard forced dismount" at the developer > summit a year ago, but no one seemed to see a difference between that > and what they believed a forced dismount already did. After that, I > thought about it a little and couldn't see much use for a "soft forced > dismount that fails instead of throwing away dirty buffers, but does > close down open files". It's useful to be able to forcibly close all open files, even ones open for writing or with dirty buffers (there can also be dirty buffers for closed files). I think umount -f flag gives this, and I wouldn't want to to also discard dirty buffers on devices where the buffers are hopefully-transiently unwritable. Discarding of unwritable buffers really has little to do with unmount -- if there is 1 with an i/o error that I know is unrecoverable, then I would like to discard it immediately instead of letting the system sit there and try to flush it quite often. > - For example, suppose a userland process is writing a file through > the stdio library: > A - fopen()s a file for writing > B - does fwrite()s of small amounts of data > C - does an fflush() > > If the open is closed by a forced dismount before C, the written data > will be lost, since it isn't even in the kernel yet. If the file is on > a responsive NFS server, it will be written to the server shortly after C. > So, there seems to be a narrow window around C where the data will be lost > for a forced dismount that throws away dirty buffers vs one that doesn't > "but only if the server is responsive". > > In other words, "Is there much difference between ripping the open files > out from under a app. before it does a write syscall vs throwing the data > away when it's in the kernel buffer but not yet written to an NFS server?" Not much, sinc a careful application should do an fsync() as well as the above and not depend on the data reaching the file system until fsync() returns successfully, which it must not do if the kernel discarded the data. [But the tossing in vgonel() seems to break this: most write()s are async so they can't return an error. Errors live in the buffers. But when buffers are tossed, don't we lose all trace of the errors? Then a subsequent fsync won't see any errors and will return success.] > Anyhow, the way I now have the NFS clients, they do a "hard forced dismount" > where they can throw away dirty buffers not yet written to the server. > Recent patches to nfs_sync() make it return without attempting writes for > the forced dismount case and the vgonel() { see above code snippet } throws > away the data when the first vinvalbuf(.., V_SAVE,.) fails. Did you have to change VFS_SYNC() to pass the forced-dismount flag? I don't like that, but see the problem: VFS_SYNC(XXX_WAIT) should normally just try to sync everything, but return an error if this is impossible, but for an nfs server it would take too long to determine that it is impossible. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 12:33:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EA34106566C; Wed, 1 Jun 2011 12:33:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E94C8FC22; Wed, 1 Jun 2011 12:33:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51CX5TF070213; Wed, 1 Jun 2011 12:33:05 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51CX5Yp070211; Wed, 1 Jun 2011 12:33:05 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106011233.p51CX5Yp070211@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 1 Jun 2011 12:33:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222560 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 12:33:05 -0000 Author: ae Date: Wed Jun 1 12:33:05 2011 New Revision: 222560 URL: http://svn.freebsd.org/changeset/base/222560 Log: Hide some debug messages under debug macro. MFC after: 1 week Modified: head/sys/netinet/ipfw/ip_dummynet.c Modified: head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- head/sys/netinet/ipfw/ip_dummynet.c Wed Jun 1 12:05:35 2011 (r222559) +++ head/sys/netinet/ipfw/ip_dummynet.c Wed Jun 1 12:33:05 2011 (r222560) @@ -1045,7 +1045,7 @@ config_red(struct dn_fsk *fs) fs->w_q = fs->fs.w_q; fs->max_p = fs->fs.max_p; - D("called"); + ND("called"); /* Doing stuff that was in userland */ i = fs->sched->link.bandwidth; s = (i <= 0) ? 0 : @@ -1109,7 +1109,7 @@ config_red(struct dn_fsk *fs) if (dn_cfg.red_max_pkt_size < 1) dn_cfg.red_max_pkt_size = 1500; fs->max_pkt_size = dn_cfg.red_max_pkt_size; - D("exit"); + ND("exit"); return 0; } @@ -2176,7 +2176,7 @@ ip_dn_destroy(int last) DN_BH_WLOCK(); if (last) { - printf("%s removing last instance\n", __FUNCTION__); + ND("removing last instance\n"); ip_dn_ctl_ptr = NULL; ip_dn_io_ptr = NULL; } @@ -2256,13 +2256,13 @@ unload_dn_sched(struct dn_alg *s) struct dn_alg *tmp, *r; int err = EINVAL; - D("called for %s", s->name); + ND("called for %s", s->name); DN_BH_WLOCK(); SLIST_FOREACH_SAFE(r, &dn_cfg.schedlist, next, tmp) { if (strcmp(s->name, r->name) != 0) continue; - D("ref_count = %d", r->ref_count); + ND("ref_count = %d", r->ref_count); err = (r->ref_count != 0) ? EBUSY : 0; if (err == 0) SLIST_REMOVE(&dn_cfg.schedlist, r, dn_alg, next); From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 15:48:44 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 448CB1065673; Wed, 1 Jun 2011 15:48:44 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 35AB18FC17; Wed, 1 Jun 2011 15:48:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51Fmi0K076292; Wed, 1 Jun 2011 15:48:44 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51FmibR076290; Wed, 1 Jun 2011 15:48:44 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201106011548.p51FmibR076290@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 1 Jun 2011 15:48:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222568 - head/usr.sbin/kbdmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 15:48:44 -0000 Author: jh Date: Wed Jun 1 15:48:43 2011 New Revision: 222568 URL: http://svn.freebsd.org/changeset/base/222568 Log: Don't try to close the stream if fopen(3) fails. PR: bin/155349 Submitted by: Urankar Mikael Modified: head/usr.sbin/kbdmap/kbdmap.c Modified: head/usr.sbin/kbdmap/kbdmap.c ============================================================================== --- head/usr.sbin/kbdmap/kbdmap.c Wed Jun 1 15:46:26 2011 (r222567) +++ head/usr.sbin/kbdmap/kbdmap.c Wed Jun 1 15:48:43 2011 (r222568) @@ -226,10 +226,10 @@ get_font(void) } } } + fclose(fp); } else fprintf(stderr, "Could not open %s for reading\n", sysconfig); - fclose(fp); return fnt; } From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 16:12:49 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DF99106566B; Wed, 1 Jun 2011 16:12:49 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from aslan.scsiguy.com (ns1.scsiguy.com [70.89.174.89]) by mx1.freebsd.org (Postfix) with ESMTP id 3E4738FC13; Wed, 1 Jun 2011 16:12:49 +0000 (UTC) Received: from Justins-MacBook-Pro.local (207-225-98-3.dia.static.qwest.net [207.225.98.3]) (authenticated bits=0) by aslan.scsiguy.com (8.14.4/8.14.4) with ESMTP id p51G1IsB097228 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 1 Jun 2011 10:01:18 -0600 (MDT) (envelope-from gibbs@FreeBSD.org) Message-ID: <4DE66249.5070503@FreeBSD.org> Date: Wed, 01 Jun 2011 10:01:13 -0600 From: "Justin T. Gibbs" Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Andriy Gapon References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> <4DE5D72A.1020405@FreeBSD.org> In-Reply-To: <4DE5D72A.1020405@FreeBSD.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (aslan.scsiguy.com [70.89.174.89]); Wed, 01 Jun 2011 10:01:19 -0600 (MDT) Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "Kenneth D. Merry" Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gibbs@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 16:12:49 -0000 On 6/1/11 12:07 AM, Andriy Gapon wrote: > on 31/05/2011 20:29 Kenneth D. Merry said the following: > > + mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); > > > Sorry that I didn't gather myself together for a review before this change got > actually committed. > Do you see any reason not to make this spinlock recursive? > > I am a little bit worried about "exotic" situations like receiving an NMI in the > middle of printing and wanting to print in the NMI context, or similar things > that penetrate contexts with disabled interrupts - e.g. Machine Check Exception. > Also it's not clear to me if there won't any bigger damage in the situations > like those described above. > > P.S. I have been thinking about fixing the problem in a different fashion, via > reserving portions of dmesg buffer for a whole message using CAS: > http://lists.freebsd.org/pipermail/freebsd-hackers/2010-April/031535.html This is actually where we started (although unfortunately independently since neither Ken nor I saw your previous email). As you say in your message form last April, integrating this type of strategy into the message buffer code is problematic. You need to track the in-progress writes (i.e. holes in the message buffer) so that only fully committed data is printed. I'm sure this can be done with per-cpu data structures and a heavy dose of atomic ops, but after an hour of discussion, we wound up with a ton of complexity and little confidence our design was sound. Even using a spinlock is a lot more complex than it would at first appear. Ken spent almost 2 weeks completing the work and ferreting out all of the corner cases. This bug has been in FreeBSD since SMP was added. While our solution may not be ideal, it is better than what was there before. Committing it seems to have also reignited the discussion on how to implement an even better solution. If there are concrete ideas on how to improve this code further, Ken and I will participate in the work to get them into -current. -- Justin From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 17:58:27 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9599D106564A; Wed, 1 Jun 2011 17:58:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 819158FC14; Wed, 1 Jun 2011 17:58:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51HwR1R080855; Wed, 1 Jun 2011 17:58:27 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51HwRI2080848; Wed, 1 Jun 2011 17:58:27 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201106011758.p51HwRI2080848@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 1 Jun 2011 17:58:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222578 - in head: share/man/man4 sys/conf sys/dev/usb sys/dev/usb/serial sys/modules/usb sys/modules/usb/umcs7840 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 17:58:27 -0000 Author: hselasky Date: Wed Jun 1 17:58:27 2011 New Revision: 222578 URL: http://svn.freebsd.org/changeset/base/222578 Log: Add support for new USB serial driver. Submitted by: Lev Serebryakov, lev @ MFC after: 14 days Added: head/share/man/man4/umcs7840.4 (contents, props changed) head/sys/dev/usb/serial/umcs7840.c (contents, props changed) head/sys/dev/usb/serial/umcs7840.h (contents, props changed) head/sys/modules/usb/umcs7840/ head/sys/modules/usb/umcs7840/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/ucom.4 head/sys/conf/files head/sys/dev/usb/usb_process.c head/sys/dev/usb/usbdevs head/sys/modules/usb/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Jun 1 17:51:27 2011 (r222577) +++ head/share/man/man4/Makefile Wed Jun 1 17:58:27 2011 (r222578) @@ -475,6 +475,7 @@ MAN= aac.4 \ ukbd.4 \ ulpt.4 \ umass.4 \ + umcs7840.4 \ umct.4 \ umodem.4 \ ums.4 \ Modified: head/share/man/man4/ucom.4 ============================================================================== --- head/share/man/man4/ucom.4 Wed Jun 1 17:51:27 2011 (r222577) +++ head/share/man/man4/ucom.4 Wed Jun 1 17:58:27 2011 (r222578) @@ -78,6 +78,7 @@ multiple external ports. .Xr uark 4 , .Xr uchcom 4 , .Xr uftdi 4 , +.Xr umcs7840 4 , .Xr umct 4 , .Xr umodem 4 , .Xr uplcom 4 , Added: head/share/man/man4/umcs7840.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/umcs7840.4 Wed Jun 1 17:58:27 2011 (r222578) @@ -0,0 +1,97 @@ +.\" +.\" Copyright (c) 2010 Lev Serebryakov . +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Lennart Augustsson. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 December 10, 2010 +.Dt UMCS7840 4 +.Os +.Sh NAME +.Nm umcs7840 +.Nd USB support for serial adapters based on the MCS7820 and MCS7840 chips +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device umcs7840" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +umcs7840_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for various multiport serial adapters based on the MosCom +MCS7820 and MCS7840 chips. They are 2- or 4-port adapters with full-featured +16550-compatible UARTs and very flexible baud generators. Also, these chips +support RS422/RS485 and IrDA oprations. +.Pp +The device is accessed through the +.Xr ucom 4 +driver which makes it behave like a +.Xr tty 4 . +.Pp +Different ports on device are presented as sub-units, like +.Pa /dev/ttyU0.1 +and +.Pa /dev/ttyU0.2 +.Sh HARDWARE +The +.Nm +driver was tested on the following adapters: +.Pp +.Bl -bullet -compact +.It +ST Lab U-360 two-port serial USB adapter +.It +ST Lab U-400 four-port serial USB adapter +.El +.Sh SEE ALSO +.Xr tty 4 , +.Xr ucom 4 , +.Xr usb 4 +.Sh BUGS +This driver doesn't support access to any fine tunes of +chip, like RS522/RS485 mode, non-standard baudrates, etc. +.Sh HISTORY +The +.Nm +driver +appeared in ports since December of 2010. +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Lev Serebryakov +.Aq lev@FreeBSD.org . Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Jun 1 17:51:27 2011 (r222577) +++ head/sys/conf/files Wed Jun 1 17:58:27 2011 (r222578) @@ -1955,6 +1955,7 @@ dev/usb/serial/uftdi.c optional uftdi dev/usb/serial/ugensa.c optional ugensa dev/usb/serial/uipaq.c optional uipaq dev/usb/serial/ulpt.c optional ulpt +dev/usb/serial/umcs7840.c optional umcs7840 dev/usb/serial/umct.c optional umct dev/usb/serial/umodem.c optional umodem dev/usb/serial/umoscom.c optional umoscom @@ -1964,7 +1965,7 @@ dev/usb/serial/uvisor.c optional uvisor dev/usb/serial/uvscom.c optional uvscom dev/usb/serial/usb_serial.c optional ucom | u3g | uark | ubsa | ubser | \ uchcom | ucycom | ufoma | uftdi | \ - ugensa | uipaq | umct | \ + ugensa | uipaq | umcs7840 | umct | \ umodem | umoscom | uplcom | uslcom | \ uvisor | uvscom # Added: head/sys/dev/usb/serial/umcs7840.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/serial/umcs7840.c Wed Jun 1 17:58:27 2011 (r222578) @@ -0,0 +1,1075 @@ +/*- + * Copyright (c) 2010 Lev Serebryakov . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This driver supports several multiport USB-to-RS232 serial adapters driven + * by MosChip mos7820 and mos7840, bridge chips. + * The adapters are sold under many different brand names. + * + * Datasheets are available at MosChip www site at + * http://www.moschip.com. The datasheets don't contain full + * programming information for the chip. + * + * It is nornal to have only two enabled ports in devices, based on + * quad-port mos7840. + * + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include "usbdevs.h" + +#define USB_DEBUG_VAR umcs7840_debug +#include +#include + +#include + +#include + +#define UMCS7840_MODVER 1 + +#ifdef USB_DEBUG +static int umcs7840_debug = 0; + +SYSCTL_NODE(_hw_usb, OID_AUTO, umcs7840, CTLFLAG_RW, 0, "USB umcs7840 quadport serial adapter"); +SYSCTL_INT(_hw_usb_umcs7840, OID_AUTO, debug, CTLFLAG_RW, &umcs7840_debug, 0, "Debug level"); +#endif /* USB_DEBUG */ + + +/* + * Two-port devices (both with 7820 chip and 7840 chip configured as two-port) + * have ports 0 and 2, with ports 1 and 3 omitted. + * So,PHYSICAL port numbers (indexes) on two-port device will be 0 and 2. + * This driver trys to use physical numbers as much as possible. + */ + +/* + * Indexed by PHYSICAL port number. + * Pack non-regular registers to array to easier if-less access. + */ +struct umcs7840_port_registers { + uint8_t reg_sp; /* SP register. */ + uint8_t reg_control; /* CONTROL register. */ + uint8_t reg_dcr; /* DCR0 register. DCR1 & DCR2 can be + * calculated */ +}; + +static const struct umcs7840_port_registers umcs7840_port_registers[UMCS7840_MAX_PORTS] = { + {.reg_sp = MCS7840_DEV_REG_SP1,.reg_control = MCS7840_DEV_REG_CONTROL1,.reg_dcr = MCS7840_DEV_REG_DCR0_1}, + {.reg_sp = MCS7840_DEV_REG_SP2,.reg_control = MCS7840_DEV_REG_CONTROL2,.reg_dcr = MCS7840_DEV_REG_DCR0_2}, + {.reg_sp = MCS7840_DEV_REG_SP3,.reg_control = MCS7840_DEV_REG_CONTROL3,.reg_dcr = MCS7840_DEV_REG_DCR0_3}, + {.reg_sp = MCS7840_DEV_REG_SP4,.reg_control = MCS7840_DEV_REG_CONTROL4,.reg_dcr = MCS7840_DEV_REG_DCR0_4}, +}; + +enum { + UMCS7840_BULK_RD_EP, + UMCS7840_BULK_WR_EP, + UMCS7840_N_TRANSFERS +}; + +struct umcs7840_softc_oneport { + struct usb_xfer *sc_xfer[UMCS7840_N_TRANSFERS]; /* Control structures + * for two transfers */ + + uint8_t sc_lcr; /* local line control register */ + uint8_t sc_mcr; /* local modem control register */ + uint8_t sc_lsr; /* local line status register */ + uint8_t sc_msr; /* local modem status register */ +}; + +struct umcs7840_softc { + struct ucom_super_softc sc_super_ucom; + struct ucom_softc sc_ucom[UMCS7840_MAX_PORTS]; /* Need to be continuous + * array, so indexed by + * LOGICAL port + * (subunit) number */ + + struct usb_xfer *sc_intr_xfer; /* Interrupt endpoint */ + + device_t sc_dev; /* Device for error prints */ + struct usb_device *sc_udev; /* USB Device for all operations */ + struct mtx sc_mtx; /* ucom requires this */ + + uint8_t sc_driver_done; /* Flag when enumeration is finished */ + + uint8_t sc_numports; /* Number of ports (subunits) */ + struct umcs7840_softc_oneport sc_ports[UMCS7840_MAX_PORTS]; /* Indexed by PHYSICAL + * port number. */ +}; + +/* prototypes */ +static usb_error_t umcs7840_get_reg_sync(struct umcs7840_softc *, uint8_t, uint8_t *); +static usb_error_t umcs7840_set_reg_sync(struct umcs7840_softc *, uint8_t, uint8_t); +static usb_error_t umcs7840_get_UART_reg_sync(struct umcs7840_softc *, uint8_t, uint8_t, uint8_t *); +static usb_error_t umcs7840_set_UART_reg_sync(struct umcs7840_softc *, uint8_t, uint8_t, uint8_t); + +static usb_error_t umcs7840_set_baudrate(struct umcs7840_softc *, uint8_t, uint32_t); +static usb_error_t umcs7840_calc_baudrate(uint32_t rate, uint16_t *, uint8_t *); + +static void umcs7840_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *); +static void umcs7840_cfg_set_dtr(struct ucom_softc *, uint8_t); +static void umcs7840_cfg_set_rts(struct ucom_softc *, uint8_t); +static void umcs7840_cfg_set_break(struct ucom_softc *, uint8_t); +static void umcs7840_cfg_param(struct ucom_softc *, struct termios *); +static void umcs7840_cfg_open(struct ucom_softc *); +static void umcs7840_cfg_close(struct ucom_softc *); + +static int umcs7840_pre_param(struct ucom_softc *, struct termios *); + +static void umcs7840_start_read(struct ucom_softc *); +static void umcs7840_stop_read(struct ucom_softc *); + +static void umcs7840_start_write(struct ucom_softc *); +static void umcs7840_stop_write(struct ucom_softc *); + +static void umcs7840_poll(struct ucom_softc *ucom); + +static device_probe_t umcs7840_probe; +static device_attach_t umcs7840_attach; +static device_detach_t umcs7840_detach; + +static usb_callback_t umcs7840_intr_callback; +static usb_callback_t umcs7840_read_callback1; +static usb_callback_t umcs7840_read_callback2; +static usb_callback_t umcs7840_read_callback3; +static usb_callback_t umcs7840_read_callback4; +static usb_callback_t umcs7840_write_callback1; +static usb_callback_t umcs7840_write_callback2; +static usb_callback_t umcs7840_write_callback3; +static usb_callback_t umcs7840_write_callback4; + +static void umcs7840_read_callbackN(struct usb_xfer *, usb_error_t, uint8_t); +static void umcs7840_write_callbackN(struct usb_xfer *, usb_error_t, uint8_t); + +/* Indexed by LOGICAL port number (subunit), so two-port device uses 0 & 1 */ +static usb_callback_t *umcs7840_rw_callbacks[UMCS7840_MAX_PORTS][UMCS7840_N_TRANSFERS] = { + {&umcs7840_read_callback1, &umcs7840_write_callback1}, + {&umcs7840_read_callback2, &umcs7840_write_callback2}, + {&umcs7840_read_callback3, &umcs7840_write_callback3}, + {&umcs7840_read_callback4, &umcs7840_write_callback4}, +}; + +static const struct usb_config umcs7840_bulk_config_data[UMCS7840_N_TRANSFERS] = { + [UMCS7840_BULK_RD_EP] = { + .type = UE_BULK, + .endpoint = 0x01, + .direction = UE_DIR_IN, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = 0, /* use wMaxPacketSize */ + .callback = &umcs7840_read_callback1, + .if_index = 0, + }, + + [UMCS7840_BULK_WR_EP] = { + .type = UE_BULK, + .endpoint = 0x02, + .direction = UE_DIR_OUT, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = 0, /* use wMaxPacketSize */ + .callback = &umcs7840_write_callback1, + .if_index = 0, + }, +}; + +static const struct usb_config umcs7840_intr_config_data[1] = { + [0] = { + .type = UE_INTERRUPT, + .endpoint = 0x09, + .direction = UE_DIR_IN, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = 0, /* use wMaxPacketSize */ + .callback = &umcs7840_intr_callback, + .if_index = 0, + }, +}; + +static struct ucom_callback umcs7840_callback = { + .ucom_cfg_get_status = &umcs7840_cfg_get_status, + + .ucom_cfg_set_dtr = &umcs7840_cfg_set_dtr, + .ucom_cfg_set_rts = &umcs7840_cfg_set_rts, + .ucom_cfg_set_break = &umcs7840_cfg_set_break, + + .ucom_cfg_param = &umcs7840_cfg_param, + .ucom_cfg_open = &umcs7840_cfg_open, + .ucom_cfg_close = &umcs7840_cfg_close, + + .ucom_pre_param = &umcs7840_pre_param, + + .ucom_start_read = &umcs7840_start_read, + .ucom_stop_read = &umcs7840_stop_read, + + .ucom_start_write = &umcs7840_start_write, + .ucom_stop_write = &umcs7840_stop_write, + + .ucom_poll = &umcs7840_poll, +}; + +static const struct usb_device_id umcs7840_devs[] = { + {USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7820, 0)}, + {USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7840, 0)}, +}; + +static device_method_t umcs7840_methods[] = { + DEVMETHOD(device_probe, umcs7840_probe), + DEVMETHOD(device_attach, umcs7840_attach), + DEVMETHOD(device_detach, umcs7840_detach), + {0, 0} +}; + +static devclass_t umcs7840_devclass; + +static driver_t umcs7840_driver = { + .name = "umcs7840", + .methods = umcs7840_methods, + .size = sizeof(struct umcs7840_softc), +}; + +DRIVER_MODULE(umcs7840, uhub, umcs7840_driver, umcs7840_devclass, 0, 0); +MODULE_DEPEND(umcs7840, ucom, 1, 1, 1); +MODULE_DEPEND(umcs7840, usb, 1, 1, 1); +MODULE_VERSION(umcs7840, UMCS7840_MODVER); + +static int +umcs7840_probe(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + + if (uaa->usb_mode != USB_MODE_HOST) + return (ENXIO); + if (uaa->info.bConfigIndex != MCS7840_CONFIG_INDEX) + return (ENXIO); + if (uaa->info.bIfaceIndex != MCS7840_IFACE_INDEX) + return (ENXIO); + return (usbd_lookup_id_by_uaa(umcs7840_devs, sizeof(umcs7840_devs), uaa)); +} + +static int +umcs7840_attach(device_t dev) +{ + struct usb_config umcs7840_config_tmp[UMCS7840_N_TRANSFERS]; + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct umcs7840_softc *sc = device_get_softc(dev); + + uint8_t iface_index = MCS7840_IFACE_INDEX; + int error; + int subunit; + int n; + uint8_t data; + + for (n = 0; n < UMCS7840_N_TRANSFERS; ++n) + umcs7840_config_tmp[n] = umcs7840_bulk_config_data[n]; + + device_set_usb_desc(dev); + mtx_init(&sc->sc_mtx, "umcs7840", NULL, MTX_DEF); + + sc->sc_dev = dev; + sc->sc_udev = uaa->device; + + /* + * Get number of ports + * Documentation (full datasheet) says, that number of ports is + * set as MCS7840_DEV_MODE_SELECT24S bit in MODE R/Only + * register. But vendor driver uses these undocumented + * register & bit. + * + * Experiments show, that MODE register can have `0' + * (4 ports) bit on 2-port device, so use vendor driver's way. + * + * Also, see notes in header file for these constants. + */ + umcs7840_get_reg_sync(sc, MCS7840_DEV_REG_GPIO, &data); + if (data & MCS7840_DEV_GPIO_4PORTS) { + sc->sc_numports = 4; + /* Store physical port numbers in sc_portno */ + sc->sc_ucom[0].sc_portno = 0; + sc->sc_ucom[1].sc_portno = 1; + sc->sc_ucom[2].sc_portno = 2; + sc->sc_ucom[3].sc_portno = 3; + } else { + sc->sc_numports = 2; + /* Store physical port numbers in sc_portno */ + sc->sc_ucom[0].sc_portno = 0; + sc->sc_ucom[1].sc_portno = 2; /* '1' is skipped */ + } + device_printf(dev, "Chip mcs%04x, found %d active ports\n", uaa->info.idProduct, sc->sc_numports); + if (!umcs7840_get_reg_sync(sc, MCS7840_DEV_REG_MODE, &data)) { + device_printf(dev, "On-die confguration: RST: active %s, HRD: %s, PLL: %s, POR: %s, Ports: %s, EEPROM write %s, IrDA is %savailable\n", + (data & MCS7840_DEV_MODE_RESET) ? "low" : "high", + (data & MCS7840_DEV_MODE_SER_PRSNT) ? "yes" : "no", + (data & MCS7840_DEV_MODE_PLLBYPASS) ? "bypassed" : "avail", + (data & MCS7840_DEV_MODE_PORBYPASS) ? "bypassed" : "avail", + (data & MCS7840_DEV_MODE_SELECT24S) ? "2" : "4", + (data & MCS7840_DEV_MODE_EEPROMWR) ? "enabled" : "disabled", + (data & MCS7840_DEV_MODE_IRDA) ? "" : "not "); + } + /* Setup all transfers */ + for (subunit = 0; subunit < sc->sc_numports; ++subunit) { + for (n = 0; n < UMCS7840_N_TRANSFERS; ++n) { + /* Set endpoint address */ + umcs7840_config_tmp[n].endpoint = umcs7840_bulk_config_data[n].endpoint + 2 * sc->sc_ucom[subunit].sc_portno; + umcs7840_config_tmp[n].callback = umcs7840_rw_callbacks[subunit][n]; + } + error = usbd_transfer_setup(uaa->device, + &iface_index, sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer, umcs7840_config_tmp, + UMCS7840_N_TRANSFERS, sc, &sc->sc_mtx); + if (error) { + device_printf(dev, "allocating USB transfers failed for subunit %d of %d\n", + subunit + 1, sc->sc_numports); + goto detach; + } + } + error = usbd_transfer_setup(uaa->device, + &iface_index, &sc->sc_intr_xfer, umcs7840_intr_config_data, + 1, sc, &sc->sc_mtx); + if (error) { + device_printf(dev, "allocating USB transfers failed for interrupt\n"); + goto detach; + } + /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); + for (subunit = 0; subunit < sc->sc_numports; ++subunit) { + usbd_xfer_set_stall(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer[UMCS7840_BULK_RD_EP]); + usbd_xfer_set_stall(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer[UMCS7840_BULK_WR_EP]); + } + mtx_unlock(&sc->sc_mtx); + + error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_numports, sc, + &umcs7840_callback, &sc->sc_mtx); + if (error) + goto detach; + + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); + + return (0); + +detach: + umcs7840_detach(dev); + return (ENXIO); +} + +static int +umcs7840_detach(device_t dev) +{ + struct umcs7840_softc *sc = device_get_softc(dev); + int subunit; + + ucom_detach(&sc->sc_super_ucom, sc->sc_ucom); + + for (subunit = 0; subunit < sc->sc_numports; ++subunit) + usbd_transfer_unsetup(sc->sc_ports[sc->sc_ucom[subunit].sc_portno].sc_xfer, UMCS7840_N_TRANSFERS); + usbd_transfer_unsetup(&sc->sc_intr_xfer, 1); + + mtx_destroy(&sc->sc_mtx); + return (0); +} + +static void +umcs7840_cfg_open(struct ucom_softc *ucom) +{ + struct umcs7840_softc *sc = ucom->sc_parent; + uint16_t pn = ucom->sc_portno; + uint8_t data; + + /* If it very first open, finish global configuration */ + if (!sc->sc_driver_done) { + /* + * USB enumeration is finished, pass internal memory to FIFOs + * If it is done in the end of "attach", kernel panics. + */ + if (umcs7840_get_reg_sync(sc, MCS7840_DEV_REG_CONTROL1, &data)) + return; + data |= MCS7840_DEV_CONTROL1_DRIVER_DONE; + if (umcs7840_set_reg_sync(sc, MCS7840_DEV_REG_CONTROL1, data)) + return; + sc->sc_driver_done = 1; + } + /* Toggle reset bit on-off */ + if (umcs7840_get_reg_sync(sc, umcs7840_port_registers[pn].reg_sp, &data)) + return; + data |= MCS7840_DEV_SPx_UART_RESET; + if (umcs7840_set_reg_sync(sc, umcs7840_port_registers[pn].reg_sp, data)) + return; + data &= ~MCS7840_DEV_SPx_UART_RESET; + if (umcs7840_set_reg_sync(sc, umcs7840_port_registers[pn].reg_sp, data)) + return; + + /* Set RS-232 mode */ + if (umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_SCRATCHPAD, MCS7840_UART_SCRATCHPAD_RS232)) + return; + + /* Disable RX on time of initialization */ + if (umcs7840_get_reg_sync(sc, umcs7840_port_registers[pn].reg_control, &data)) + return; + data |= MCS7840_DEV_CONTROLx_RX_DISABLE; + if (umcs7840_set_reg_sync(sc, umcs7840_port_registers[pn].reg_control, data)) + return; + + /* Disable all interrupts */ + if (umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_IER, 0)) + return; + + /* Reset FIFO -- documented */ + if (umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_FCR, 0)) + return; + if (umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_FCR, + MCS7840_UART_FCR_ENABLE | MCS7840_UART_FCR_FLUSHRHR | + MCS7840_UART_FCR_FLUSHTHR | MCS7840_UART_FCR_RTL_1_14)) + return; + + /* Set 8 bit, no parity, 1 stop bit -- documented */ + sc->sc_ports[pn].sc_lcr = MCS7840_UART_LCR_DATALEN8 | MCS7840_UART_LCR_STOPB1; + if (umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_LCR, sc->sc_ports[pn].sc_lcr)) + return; + + /* + * Enable DTR/RTS on modem control, enable modem interrupts -- + * documented + */ + sc->sc_ports[pn].sc_mcr = MCS7840_UART_MCR_DTR | MCS7840_UART_MCR_RTS | MCS7840_UART_MCR_IE; + if (umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_MCR, sc->sc_ports[pn].sc_mcr)) + return; + + /* Clearing Bulkin and Bulkout FIFO */ + if (umcs7840_get_reg_sync(sc, umcs7840_port_registers[pn].reg_sp, &data)) + return; + data |= MCS7840_DEV_SPx_RESET_OUT_FIFO | MCS7840_DEV_SPx_RESET_IN_FIFO; + if (umcs7840_set_reg_sync(sc, umcs7840_port_registers[pn].reg_sp, data)) + return; + data &= ~(MCS7840_DEV_SPx_RESET_OUT_FIFO | MCS7840_DEV_SPx_RESET_IN_FIFO); + if (umcs7840_set_reg_sync(sc, umcs7840_port_registers[pn].reg_sp, data)) + return; + + /* Set speed 9600 */ + if (umcs7840_set_baudrate(sc, pn, 9600)) + return; + + + /* Finally enable all interrupts -- documented */ + /* + * Copied from vendor driver, I don't know why we should read LCR + * here + */ + if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LCR, &sc->sc_ports[pn].sc_lcr)) + return; + if (umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_IER, + MCS7840_UART_IER_RXSTAT | MCS7840_UART_IER_MODEM)) + return; + + /* Enable RX */ + if (umcs7840_get_reg_sync(sc, umcs7840_port_registers[pn].reg_control, &data)) + return; + data &= ~MCS7840_DEV_CONTROLx_RX_DISABLE; + if (umcs7840_set_reg_sync(sc, umcs7840_port_registers[pn].reg_control, data)) + return; + + /* Read LSR & MSR */ + if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, &sc->sc_ports[pn].sc_lsr)) + return; + if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &sc->sc_ports[pn].sc_msr)) + return; + DPRINTF("Port %d has been opened, LSR=%02x MSR=%02x\n", pn, sc->sc_ports[pn].sc_lsr, sc->sc_ports[pn].sc_msr); +} + +static void +umcs7840_cfg_close(struct ucom_softc *ucom) +{ + struct umcs7840_softc *sc = ucom->sc_parent; + uint16_t pn = ucom->sc_portno; + uint8_t data; + + umcs7840_stop_read(ucom); + umcs7840_stop_write(ucom); + + umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_MCR, 0); + umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_IER, 0); + + /* Disable RX */ + if (umcs7840_get_reg_sync(sc, umcs7840_port_registers[pn].reg_control, &data)) + return; + data |= MCS7840_DEV_CONTROLx_RX_DISABLE; + if (umcs7840_set_reg_sync(sc, umcs7840_port_registers[pn].reg_control, data)) + return; + DPRINTF("Port %d has been closed\n", pn); +} + +static void +umcs7840_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) +{ + struct umcs7840_softc *sc = ucom->sc_parent; + uint8_t pn = ucom->sc_portno; + + if (onoff) + sc->sc_ports[pn].sc_mcr |= MCS7840_UART_MCR_DTR; + else + sc->sc_ports[pn].sc_mcr &= ~MCS7840_UART_MCR_DTR; + + umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_MCR, sc->sc_ports[pn].sc_mcr); + DPRINTF("Port %d DTR set to: %s\n", pn, onoff ? "on" : "off"); +} + +static void +umcs7840_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff) +{ + struct umcs7840_softc *sc = ucom->sc_parent; + uint8_t pn = ucom->sc_portno; + + if (onoff) + sc->sc_ports[pn].sc_mcr |= MCS7840_UART_MCR_RTS; + else + sc->sc_ports[pn].sc_mcr &= ~MCS7840_UART_MCR_RTS; + + umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_MCR, sc->sc_ports[pn].sc_mcr); + DPRINTF("Port %d RTS set to: %s\n", pn, onoff ? "on" : "off"); +} + +static void +umcs7840_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) +{ + struct umcs7840_softc *sc = ucom->sc_parent; + uint8_t pn = ucom->sc_portno; + + if (onoff) + sc->sc_ports[pn].sc_lcr |= MCS7840_UART_LCR_BREAK; + else + sc->sc_ports[pn].sc_lcr &= ~MCS7840_UART_LCR_BREAK; + + umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_LCR, sc->sc_ports[pn].sc_lcr); + DPRINTF("Port %d BREAK set to: %s\n", pn, onoff ? "on" : "off"); +} + + +static void +umcs7840_cfg_param(struct ucom_softc *ucom, struct termios *t) +{ + struct umcs7840_softc *sc = ucom->sc_parent; + uint8_t pn = ucom->sc_portno; + uint8_t lcr = sc->sc_ports[pn].sc_lcr; + uint8_t mcr = sc->sc_ports[pn].sc_mcr; + + DPRINTF("Port %d config:\n", pn); + if (t->c_cflag & CSTOPB) { + DPRINTF(" 2 stop bits\n"); + lcr |= MCS7840_UART_LCR_STOPB2; + } else { + lcr |= MCS7840_UART_LCR_STOPB1; + DPRINTF(" 1 stop bit\n"); + } + + lcr &= ~MCS7840_UART_LCR_PARITYMASK; + if (t->c_cflag & PARENB) { + lcr |= MCS7840_UART_LCR_PARITYON; + if (t->c_cflag & PARODD) { + lcr = MCS7840_UART_LCR_PARITYODD; + DPRINTF(" parity on - odd\n"); + } else { + lcr = MCS7840_UART_LCR_PARITYEVEN; + DPRINTF(" parity on - even\n"); + } + } else { + lcr &= ~MCS7840_UART_LCR_PARITYON; + DPRINTF(" parity off\n"); + } + + lcr &= ~MCS7840_UART_LCR_DATALENMASK; + switch (t->c_cflag & CSIZE) { + case CS5: + lcr |= MCS7840_UART_LCR_DATALEN5; + DPRINTF(" 5 bit\n"); + break; + case CS6: + lcr |= MCS7840_UART_LCR_DATALEN6; + DPRINTF(" 6 bit\n"); + break; + case CS7: + lcr |= MCS7840_UART_LCR_DATALEN7; + DPRINTF(" 7 bit\n"); + break; + case CS8: + lcr |= MCS7840_UART_LCR_DATALEN8; + DPRINTF(" 8 bit\n"); + break; + } + + if (t->c_cflag & CRTSCTS) { + mcr |= MCS7840_UART_MCR_CTSRTS; + DPRINTF(" CTS/RTS\n"); + } else + mcr &= ~MCS7840_UART_MCR_CTSRTS; + + if (t->c_cflag & (CDTR_IFLOW | CDSR_OFLOW)) { + mcr |= MCS7840_UART_MCR_DTRDSR; + DPRINTF(" DTR/DSR\n"); + } else + mcr &= ~MCS7840_UART_MCR_DTRDSR; + + sc->sc_ports[pn].sc_lcr = lcr; + umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_LCR, sc->sc_ports[pn].sc_lcr); + DPRINTF("Port %d LCR=%02x\n", pn, sc->sc_ports[pn].sc_lcr); + + sc->sc_ports[pn].sc_mcr = mcr; + umcs7840_set_UART_reg_sync(sc, pn, MCS7840_UART_REG_MCR, sc->sc_ports[pn].sc_mcr); + DPRINTF("Port %d MCR=%02x\n", pn, sc->sc_ports[pn].sc_mcr); + + umcs7840_set_baudrate(sc, pn, t->c_ospeed); +} + + +static int +umcs7840_pre_param(struct ucom_softc *ucom, struct termios *t) +{ + uint8_t clk; + uint16_t divisor; + + if (umcs7840_calc_baudrate(t->c_ospeed, &divisor, &clk) || !divisor) + return (EINVAL); + return (0); +} + +static void +umcs7840_start_read(struct ucom_softc *ucom) +{ + struct umcs7840_softc *sc = ucom->sc_parent; + uint8_t pn = ucom->sc_portno; + + /* Start interrupt transfer */ + usbd_transfer_start(sc->sc_intr_xfer); + + /* Start read transfer */ + usbd_transfer_start(sc->sc_ports[pn].sc_xfer[UMCS7840_BULK_RD_EP]); +} + +static void +umcs7840_stop_read(struct ucom_softc *ucom) +{ + struct umcs7840_softc *sc = ucom->sc_parent; + uint8_t pn = ucom->sc_portno; + + /* Stop read transfer */ + usbd_transfer_stop(sc->sc_ports[pn].sc_xfer[UMCS7840_BULK_RD_EP]); +} + +static void +umcs7840_start_write(struct ucom_softc *ucom) +{ + struct umcs7840_softc *sc = ucom->sc_parent; + uint8_t pn = ucom->sc_portno; + + /* Start interrupt transfer */ + usbd_transfer_start(sc->sc_intr_xfer); + + /* Start write transfer */ + usbd_transfer_start(sc->sc_ports[pn].sc_xfer[UMCS7840_BULK_WR_EP]); +} + +static void +umcs7840_stop_write(struct ucom_softc *ucom) +{ + struct umcs7840_softc *sc = ucom->sc_parent; + uint8_t pn = ucom->sc_portno; + + /* Stop write transfer */ + usbd_transfer_stop(sc->sc_ports[pn].sc_xfer[UMCS7840_BULK_WR_EP]); +} + +static void +umcs7840_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr) +{ + struct umcs7840_softc *sc = ucom->sc_parent; + + *lsr = sc->sc_ports[ucom->sc_portno].sc_lsr; + *msr = sc->sc_ports[ucom->sc_portno].sc_msr; + DPRINTF("Port %d status: LSR=%02x MSR=%02x\n", ucom->sc_portno, *lsr, *msr); +} + +static void +umcs7840_intr_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct umcs7840_softc *sc = usbd_xfer_softc(xfer); + struct usb_page_cache *pc; + uint8_t buf[13]; + int actlen; + int subunit; + + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + if (actlen == 5 || actlen == 13) { + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_out(pc, 0, buf, actlen); + /* Check status of all ports */ + for (subunit = 0; subunit < sc->sc_numports; ++subunit) { + uint8_t pn = sc->sc_ucom[subunit].sc_portno; + + if (buf[pn] & MCS7840_UART_ISR_NOPENDING) + continue; + DPRINTF("Port %d has pending interrupt: %02x (FIFO: %02x)\n", pn, buf[pn] & MCS7840_UART_ISR_INTMASK, buf[pn] & (~MCS7840_UART_ISR_INTMASK)); + switch (buf[pn] & MCS7840_UART_ISR_INTMASK) { + case MCS7840_UART_ISR_RXERR: + case MCS7840_UART_ISR_RXHASDATA: + case MCS7840_UART_ISR_RXTIMEOUT: + /* Read new LSR */ + if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, &sc->sc_ports[pn].sc_lsr)) + break; /* Inner switch */ + ucom_status_change(&sc->sc_ucom[subunit]); + /* Inner switch */ + break; + case MCS7840_UART_ISR_TXEMPTY: + /* Do nothing */ + break; /* Inner switch */ + case MCS7840_UART_ISR_MSCHANGE: + /* Read new MSR */ + if (umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &sc->sc_ports[pn].sc_msr)) + break; /* Inner switch */ + DPRINTF("Port %d: new MSR %02x\n", pn, sc->sc_ports[pn].sc_msr); + ucom_status_change(&sc->sc_ucom[subunit]); + break; + } + } + } else + device_printf(sc->sc_dev, "Invalid interrupt data length %d", actlen); + /* FALLTHROUGH */ + case USB_ST_SETUP: +tr_setup: + usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); + usbd_transfer_submit(xfer); + return; + + default: /* Error */ + if (error != USB_ERR_CANCELLED) { + /* try to clear stall first */ + usbd_xfer_set_stall(xfer); + goto tr_setup; + } + return; + } +} + +static void +umcs7840_read_callback1(struct usb_xfer *xfer, usb_error_t error) +{ + umcs7840_read_callbackN(xfer, error, 0); +} + +static void +umcs7840_read_callback2(struct usb_xfer *xfer, usb_error_t error) +{ + umcs7840_read_callbackN(xfer, error, 1); +} +static void +umcs7840_read_callback3(struct usb_xfer *xfer, usb_error_t error) +{ + umcs7840_read_callbackN(xfer, error, 2); +} + +static void +umcs7840_read_callback4(struct usb_xfer *xfer, usb_error_t error) +{ + umcs7840_read_callbackN(xfer, error, 3); +} + +static void +umcs7840_read_callbackN(struct usb_xfer *xfer, usb_error_t error, uint8_t subunit) +{ + struct umcs7840_softc *sc = usbd_xfer_softc(xfer); + struct ucom_softc *ucom = &sc->sc_ucom[subunit]; + struct usb_page_cache *pc; + int actlen; + + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); + + DPRINTF("Port %d read, state = %d, data length = %d\n", ucom->sc_portno, USB_GET_STATE(xfer), actlen); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + pc = usbd_xfer_get_frame(xfer, 0); + ucom_put_data(ucom, pc, 0, actlen); + /* FALLTHROUGH */ + case USB_ST_SETUP: +tr_setup: + usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); + usbd_transfer_submit(xfer); + return; + + default: /* Error */ + if (error != USB_ERR_CANCELLED) { + /* try to clear stall first */ + usbd_xfer_set_stall(xfer); + goto tr_setup; + } + return; + } +} + +static void +umcs7840_write_callback1(struct usb_xfer *xfer, usb_error_t error) +{ + umcs7840_write_callbackN(xfer, error, 0); +} + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 18:42:44 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D39E106566C; Wed, 1 Jun 2011 18:42:44 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5CF7C8FC15; Wed, 1 Jun 2011 18:42:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51IgiX5082385; Wed, 1 Jun 2011 18:42:44 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51Igi4A082383; Wed, 1 Jun 2011 18:42:44 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201106011842.p51Igi4A082383@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 1 Jun 2011 18:42:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222581 - head/sys/dev/usb/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 18:42:44 -0000 Author: yongari Date: Wed Jun 1 18:42:44 2011 New Revision: 222581 URL: http://svn.freebsd.org/changeset/base/222581 Log: Poke correct GPIO pins for newer axe(4) controllers with Marvell PHY. Newer models seem to use different LED mode that requires enabling both GPIO1 and GPIO2. Tested by: marcel Modified: head/sys/dev/usb/net/if_axe.c Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Wed Jun 1 18:27:13 2011 (r222580) +++ head/sys/dev/usb/net/if_axe.c Wed Jun 1 18:42:44 2011 (r222581) @@ -514,7 +514,7 @@ static void axe_ax88178_init(struct axe_softc *sc) { struct usb_ether *ue; - int gpio0, phymode; + int gpio0, ledmode, phymode; uint16_t eeprom, val; ue = &sc->sc_ue; @@ -528,9 +528,11 @@ axe_ax88178_init(struct axe_softc *sc) if (eeprom == 0xffff) { phymode = AXE_PHY_MODE_MARVELL; gpio0 = 1; + ledmode = 0; } else { phymode = eeprom & 0x7f; gpio0 = (eeprom & 0x80) ? 0 : 1; + ledmode = eeprom >> 8; } if (bootverbose) @@ -548,9 +550,22 @@ axe_ax88178_init(struct axe_softc *sc) AXE_GPIO_WRITE(AXE_GPIO0_EN | AXE_GPIO2_EN, hz / 4); AXE_GPIO_WRITE(AXE_GPIO0_EN | AXE_GPIO2 | AXE_GPIO2_EN, hz / 32); - } else + } else { AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM | AXE_GPIO1 | - AXE_GPIO1_EN, hz / 32); + AXE_GPIO1_EN, hz / 3); + if (ledmode == 1) { + AXE_GPIO_WRITE(AXE_GPIO1_EN, hz / 3); + AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN, + hz / 3); + } else { + AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN | + AXE_GPIO2 | AXE_GPIO2_EN, hz / 32); + AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN | + AXE_GPIO2_EN, hz / 4); + AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN | + AXE_GPIO2 | AXE_GPIO2_EN, hz / 32); + } + } break; case AXE_PHY_MODE_CICADA: case AXE_PHY_MODE_CICADA_V2: From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 19:44:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B77A8106564A; Wed, 1 Jun 2011 19:44:52 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6D768FC13; Wed, 1 Jun 2011 19:44:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51Jiqbw084266; Wed, 1 Jun 2011 19:44:52 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51JiqRh084264; Wed, 1 Jun 2011 19:44:52 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106011944.p51JiqRh084264@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 1 Jun 2011 19:44:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222582 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 19:44:52 -0000 Author: ae Date: Wed Jun 1 19:44:52 2011 New Revision: 222582 URL: http://svn.freebsd.org/changeset/base/222582 Log: O_FORWARD_IP is only action which depends from the result of lookup of dynamic rules. We are doing forwarding in the following cases: o For the simple ipfw fwd rule, e.g. fwd 10.0.0.1 ip from any to any out xmit em0 fwd 127.0.0.1,3128 tcp from any to any 80 in recv em1 o For the dynamic fwd rule, e.g. fwd 192.168.0.1 tcp from any to 10.0.0.3 3333 setup keep-state When this rule triggers it creates a dynamic rule, but this dynamic rule should forward packets only in forward direction. o And the last case that does not work before - simple fwd rule which triggers when some dynamic rule is already executed. PR: kern/147720, kern/150798 MFC after: 1 month Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Wed Jun 1 18:42:44 2011 (r222581) +++ head/sys/netinet/ipfw/ip_fw2.c Wed Jun 1 19:44:52 2011 (r222582) @@ -2118,7 +2118,8 @@ do { \ case O_FORWARD_IP: if (args->eh) /* not valid on layer2 pkts */ break; - if (!q || dyn_dir == MATCH_FORWARD) { + if (q == NULL || q->rule != f || + dyn_dir == MATCH_FORWARD) { struct sockaddr_in *sa; sa = &(((ipfw_insn_sa *)cmd)->sa); if (sa->sin_addr.s_addr == INADDR_ANY) { From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 19:53:01 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6C981065676; Wed, 1 Jun 2011 19:53:01 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2185D8FC12; Wed, 1 Jun 2011 19:53:00 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap0EAMGX5k2DaFvO/2dsb2JhbABThEmiW4hxrheQUIErg2yBCQSQVY9H X-IronPort-AV: E=Sophos;i="4.65,305,1304308800"; d="scan'208";a="126560145" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 01 Jun 2011 15:53:00 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 235E5B3F3D; Wed, 1 Jun 2011 15:53:00 -0400 (EDT) Date: Wed, 1 Jun 2011 15:53:00 -0400 (EDT) From: Rick Macklem To: Bruce Evans Message-ID: <964931290.106769.1306957980133.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20110601210748.R1599@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.203] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, Robert Watson , Kostik Belousov , Rick Macklem Subject: Re: svn commit: r222466 - head/sbin/umount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 19:53:01 -0000 > > Did you have to change VFS_SYNC() to pass the forced-dismount flag? I > don't like that, but see the problem: VFS_SYNC(XXX_WAIT) should > normally > just try to sync everything, but return an error if this is > impossible, > but for an nfs server it would take too long to determine that it is > impossible. > It just checks MNTK_UNMOUNTF being set in mnt_kern_flag. From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 20:00:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB610106566C; Wed, 1 Jun 2011 20:00:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C03848FC0C; Wed, 1 Jun 2011 20:00:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51K0PPh084769; Wed, 1 Jun 2011 20:00:25 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51K0PsO084767; Wed, 1 Jun 2011 20:00:25 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201106012000.p51K0PsO084767@svn.freebsd.org> From: Robert Watson Date: Wed, 1 Jun 2011 20:00:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222583 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 20:00:26 -0000 Author: rwatson Date: Wed Jun 1 20:00:25 2011 New Revision: 222583 URL: http://svn.freebsd.org/changeset/base/222583 Log: Add an optional netisr dispatch point at ether_input(), but set the default dispatch method to NETISR_DISPATCH_DIRECT in order to force direct dispatch. This adds a fairly negligble overhead without changing default behavior, but in the future will allow deferred or hybrid dispatch to other worker threads before link layer processing has taken place. For example, this could allow redistribution using RSS hashes without ethernet header cache line hits, if the NIC was unable to adequately implement load balancing to too small a number of input queues -- perhaps due to hard queueset counts of 1, 3, or 8, but in a modern system with 16-128 threads. This can happen on highly threaded systems, where you want want an ithread per core, redistributing work to other queues, but also on virtualised systems where hardware hashing is (or is not) available, but only a single queue has been directed to one VCPU on a VM. Note: this adds a previously non-present assertion about the equivalence of the ifnet from which the packet is received, and the ifnet stamped in the mbuf header. I believe this assertion to generally be true, but we'll find out soon -- if it's not, we might have to add additional overhead in some cases to add an m_tag with the originating ifnet pointer stored in it. Reviewed by: bz MFC after: 3 weeks Sponsored by: Juniper Networks, Inc. Modified: head/sys/net/if_ethersubr.c Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Wed Jun 1 19:44:52 2011 (r222582) +++ head/sys/net/if_ethersubr.c Wed Jun 1 20:00:25 2011 (r222583) @@ -561,7 +561,7 @@ ether_ipfw_chk(struct mbuf **m0, struct * mbuf chain m with the ethernet header at the front. */ static void -ether_input(struct ifnet *ifp, struct mbuf *m) +ether_input_internal(struct ifnet *ifp, struct mbuf *m) { struct ether_header *eh; u_short etype; @@ -755,6 +755,46 @@ ether_input(struct ifnet *ifp, struct mb } /* + * Ethernet input dispatch; by default, direct dispatch here regardless of + * global configuration. + */ +static void +ether_nh_input(struct mbuf *m) +{ + + ether_input_internal(m->m_pkthdr.rcvif, m); +} + +static struct netisr_handler ether_nh = { + .nh_name = "ether", + .nh_handler = ether_nh_input, + .nh_proto = NETISR_ETHER, + .nh_policy = NETISR_POLICY_SOURCE, + .nh_dispatch = NETISR_DISPATCH_DIRECT, +}; + +static void +ether_init(__unused void *arg) +{ + + netisr_register(ðer_nh); +} +SYSINIT(ether, SI_SUB_INIT_IF, SI_ORDER_ANY, ether_init, NULL); + +static void +ether_input(struct ifnet *ifp, struct mbuf *m) +{ + + /* + * We will rely on rcvif being set properly in the deferred context, + * so assert it is correct here. + */ + KASSERT(m->m_pkthdr.rcvif == ifp, ("%s: ifnet mismatch", __func__)); + + netisr_dispatch(NETISR_ETHER, m); +} + +/* * Upper layer processing for a received Ethernet packet. */ void From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 20:01:03 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45DC3106564A; Wed, 1 Jun 2011 20:01: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 33BE28FC08; Wed, 1 Jun 2011 20:01: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 p51K13iK084845; Wed, 1 Jun 2011 20:01:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51K13YD084828; Wed, 1 Jun 2011 20:01:03 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201106012001.p51K13YD084828@svn.freebsd.org> From: Adrian Chadd Date: Wed, 1 Jun 2011 20:01:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222584 - in head/sys/dev/ath/ath_hal: . ar5212 ar5416 ar9001 ar9002 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 20:01:03 -0000 Author: adrian Date: Wed Jun 1 20:01:02 2011 New Revision: 222584 URL: http://svn.freebsd.org/changeset/base/222584 Log: Add some missing DFS chipset functionality to the FreeBSD HAL. Please note - this doesn't in any way constitute a full DFS implementation, it merely adds the relevant capability bits and radar detection threshold register access. The particulars: * Add new capability bits outlining what the DFS capabilities are of the various chipsets. * Add HAL methods to set and get the radar related register values. * Add AR5212 and AR5416+ DFS radar related register value routines. * Add a missing HAL phy error code that's related to radar event processing. * Add HAL_PHYERR_PARAM, a data type that encapsulates the radar register values. The AR5212 routines are just for completeness. The AR5416 routines are a super-set of those; I may later on do a drive-by pass to tidy up duplicate code. Obtained from: Linux, Atheros Modified: head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ah_desc.h head/sys/dev/ath/ath_hal/ah_internal.h head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h head/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ah.c Wed Jun 1 20:01:02 2011 (r222584) @@ -610,6 +610,10 @@ ath_hal_getcapability(struct ath_hal *ah return HAL_OK; case HAL_CAP_4ADDR_AGGR: return pCap->hal4AddrAggrSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_EXT_CHAN_DFS: + return pCap->halExtChanDfsSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_COMBINED_RADAR_RSSI: + return pCap->halUseCombinedRadarRssi ? HAL_OK : HAL_ENOTSUPP; case HAL_CAP_AUTO_SLEEP: return pCap->halAutoSleepSupport ? HAL_OK : HAL_ENOTSUPP; case HAL_CAP_MBSSID_AGGR_SUPPORT: @@ -626,6 +630,8 @@ ath_hal_getcapability(struct ath_hal *ah case HAL_CAP_RXTSTAMP_PREC: /* rx desc tstamp precision (bits) */ *result = pCap->halTstampPrecision; return HAL_OK; + case HAL_CAP_ENHANCED_DFS_SUPPORT: + return pCap->halEnhancedDfsSupport ? HAL_OK : HAL_ENOTSUPP; /* FreeBSD-specific entries for now */ case HAL_CAP_RXORN_FATAL: /* HAL_INT_RXORN treated as fatal */ Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ah.h Wed Jun 1 20:01:02 2011 (r222584) @@ -121,6 +121,9 @@ typedef enum { HAL_CAP_RTS_AGGR_LIMIT = 42, /* aggregation limit with RTS */ HAL_CAP_4ADDR_AGGR = 43, /* hardware is capable of 4addr aggregation */ + HAL_CAP_DFS_DMN = 44, /* current DFS domain */ + HAL_CAP_EXT_CHAN_DFS = 45, /* DFS support for extension channel */ + HAL_CAP_COMBINED_RADAR_RSSI = 46, /* Is combined RSSI for radar accurate */ HAL_CAP_AUTO_SLEEP = 48, /* hardware can go to network sleep automatically after waking up to receive TIM */ @@ -133,6 +136,7 @@ typedef enum { HAL_CAP_HT20_SGI = 96, /* hardware supports HT20 short GI */ HAL_CAP_RXTSTAMP_PREC = 100, /* rx desc tstamp precision (bits) */ + HAL_CAP_ENHANCED_DFS_SUPPORT = 117, /* hardware supports enhanced DFS */ /* The following are private to the FreeBSD HAL (224 onward) */ @@ -703,6 +707,34 @@ typedef enum { HAL_CAP_INTMIT_SPUR_IMMUNITY_LEVEL = 6 } HAL_CAP_INTMIT_CMD; +typedef struct { + int32_t pe_firpwr; /* FIR pwr out threshold */ + int32_t pe_rrssi; /* Radar rssi thresh */ + int32_t pe_height; /* Pulse height thresh */ + int32_t pe_prssi; /* Pulse rssi thresh */ + int32_t pe_inband; /* Inband thresh */ + + /* The following params are only for AR5413 and later */ + u_int32_t pe_relpwr; /* Relative power threshold in 0.5dB steps */ + u_int32_t pe_relstep; /* Pulse Relative step threshold in 0.5dB steps */ + u_int32_t pe_maxlen; /* Max length of radar sign in 0.8us units */ + HAL_BOOL pe_usefir128; /* Use the average in-band power measured over 128 cycles */ + HAL_BOOL pe_blockradar; /* + * Enable to block radar check if pkt detect is done via OFDM + * weak signal detect or pkt is detected immediately after tx + * to rx transition + */ + HAL_BOOL pe_enmaxrssi; /* + * Enable to use the max rssi instead of the last rssi during + * fine gain changes for radar detection + */ + HAL_BOOL pe_extchannel; /* Enable DFS on ext channel */ +} HAL_PHYERR_PARAM; + +#define HAL_PHYERR_PARAM_NOVAL 65535 +#define HAL_PHYERR_PARAM_ENABLE 0x8000 /* Enable/Disable if applicable */ + + /* * Hardware Access Layer (HAL) API. * @@ -878,6 +910,12 @@ struct ath_hal { HAL_BOOL __ahdecl(*ah_setDecompMask)(struct ath_hal*, uint16_t, int); void __ahdecl(*ah_setCoverageClass)(struct ath_hal*, uint8_t, int); + /* DFS functions */ + void __ahdecl(*ah_enableDfs)(struct ath_hal *ah, + HAL_PHYERR_PARAM *pe); + void __ahdecl(*ah_getDfsThresh)(struct ath_hal *ah, + HAL_PHYERR_PARAM *pe); + /* Key Cache Functions */ uint32_t __ahdecl(*ah_getKeyCacheSize)(struct ath_hal*); HAL_BOOL __ahdecl(*ah_resetKeyCacheEntry)(struct ath_hal*, uint16_t); Modified: head/sys/dev/ath/ath_hal/ah_desc.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_desc.h Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ah_desc.h Wed Jun 1 20:01:02 2011 (r222584) @@ -144,7 +144,7 @@ enum { HAL_PHYERR_RADAR = 5, /* Radar detect */ HAL_PHYERR_SERVICE = 6, /* Illegal service */ HAL_PHYERR_TOR = 7, /* Transmit override receive */ - /* NB: these are specific to the 5212 */ + /* NB: these are specific to the 5212 and later */ HAL_PHYERR_OFDM_TIMING = 17, /* */ HAL_PHYERR_OFDM_SIGNAL_PARITY = 18, /* */ HAL_PHYERR_OFDM_RATE_ILLEGAL = 19, /* */ @@ -152,6 +152,7 @@ enum { HAL_PHYERR_OFDM_POWER_DROP = 21, /* */ HAL_PHYERR_OFDM_SERVICE = 22, /* */ HAL_PHYERR_OFDM_RESTART = 23, /* */ + HAL_PHYERR_FALSE_RADAR_EXT = 24, /* */ HAL_PHYERR_CCK_TIMING = 25, /* */ HAL_PHYERR_CCK_HEADER_CRC = 26, /* */ HAL_PHYERR_CCK_RATE_ILLEGAL = 27, /* */ Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ah_internal.h Wed Jun 1 20:01:02 2011 (r222584) @@ -200,8 +200,10 @@ typedef struct { halRifsTxSupport : 1, hal4AddrAggrSupport : 1, halExtChanDfsSupport : 1, + halUseCombinedRadarRssi : 1, halForcePpmSupport : 1, halEnhancedPmSupport : 1, + halEnhancedDfsSupport : 1, halMbssidAggrSupport : 1, halBssidMatchSupport : 1, hal4kbSplitTransSupport : 1, Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Wed Jun 1 20:01:02 2011 (r222584) @@ -618,5 +618,7 @@ extern void ar5212AniReset(struct ath_ha extern HAL_BOOL ar5212IsNFCalInProgress(struct ath_hal *ah); extern HAL_BOOL ar5212WaitNFCalComplete(struct ath_hal *ah, int i); +extern void ar5212EnableDfs(struct ath_hal *ah, HAL_PHYERR_PARAM *pe); +extern void ar5212GetDfsThresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe); #endif /* _ATH_AR5212_H_ */ Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Wed Jun 1 20:01:02 2011 (r222584) @@ -128,6 +128,10 @@ static const struct ath_hal_private ar52 .ah_setDecompMask = ar5212SetDecompMask, .ah_setCoverageClass = ar5212SetCoverageClass, + /* DFS Functions */ + .ah_enableDfs = ar5212EnableDfs, + .ah_getDfsThresh = ar5212GetDfsThresh, + /* Key Cache Functions */ .ah_getKeyCacheSize = ar5212GetKeyCacheSize, .ah_resetKeyCacheEntry = ar5212ResetKeyCacheEntry, Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Wed Jun 1 20:01:02 2011 (r222584) @@ -1115,3 +1115,54 @@ ar5212WaitNFCalComplete(struct ath_hal * } return AH_FALSE; } + +void +ar5212EnableDfs(struct ath_hal *ah, HAL_PHYERR_PARAM *pe) +{ + uint32_t val; + val = OS_REG_READ(ah, AR_PHY_RADAR_0); + + if (pe->pe_firpwr != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_0_FIRPWR; + val |= SM(pe->pe_firpwr, AR_PHY_RADAR_0_FIRPWR); + } + if (pe->pe_rrssi != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_0_RRSSI; + val |= SM(pe->pe_rrssi, AR_PHY_RADAR_0_RRSSI); + } + if (pe->pe_height != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_0_HEIGHT; + val |= SM(pe->pe_height, AR_PHY_RADAR_0_HEIGHT); + } + if (pe->pe_prssi != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_0_PRSSI; + val |= SM(pe->pe_prssi, AR_PHY_RADAR_0_PRSSI); + } + if (pe->pe_inband != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_0_INBAND; + val |= SM(pe->pe_inband, AR_PHY_RADAR_0_INBAND); + } + OS_REG_WRITE(ah, AR_PHY_RADAR_0, val | AR_PHY_RADAR_0_ENA); +} + +void +ar5212GetDfsThresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe) +{ + uint32_t val,temp; + + val = OS_REG_READ(ah, AR_PHY_RADAR_0); + + temp = MS(val,AR_PHY_RADAR_0_FIRPWR); + temp |= 0xFFFFFF80; + pe->pe_firpwr = temp; + pe->pe_rrssi = MS(val, AR_PHY_RADAR_0_RRSSI); + pe->pe_height = MS(val, AR_PHY_RADAR_0_HEIGHT); + pe->pe_prssi = MS(val, AR_PHY_RADAR_0_PRSSI); + pe->pe_inband = MS(val, AR_PHY_RADAR_0_INBAND); + + pe->pe_relpwr = 0; + pe->pe_relstep = 0; + pe->pe_maxlen = 0; + pe->pe_extchannel = AH_FALSE; +} + Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Wed Jun 1 20:01:02 2011 (r222584) @@ -201,6 +201,8 @@ extern HAL_BOOL ar5416GetDiagState(struc void **result, uint32_t *resultsize); extern HAL_BOOL ar5416SetRifsDelay(struct ath_hal *ah, const struct ieee80211_channel *chan, HAL_BOOL enable); +extern void ar5416EnableDfs(struct ath_hal *ah, HAL_PHYERR_PARAM *pe); +extern void ar5416GetDfsThresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe); extern HAL_BOOL ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Wed Jun 1 20:01:02 2011 (r222584) @@ -143,6 +143,10 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_resetKeyCacheEntry = ar5416ResetKeyCacheEntry; ah->ah_setKeyCacheEntry = ar5416SetKeyCacheEntry; + /* DFS Functions */ + ah->ah_enableDfs = ar5416EnableDfs; + ah->ah_getDfsThresh = ar5416GetDfsThresh; + /* Power Management Functions */ ah->ah_setPowerMode = ar5416SetPowerMode; @@ -878,6 +882,7 @@ ar5416FillCapabilityInfo(struct ath_hal pCap->halBssidMatchSupport = AH_TRUE; pCap->halGTTSupport = AH_TRUE; pCap->halCSTSupport = AH_TRUE; + pCap->halEnhancedDfsSupport = AH_FALSE; if (ath_hal_eepromGetFlag(ah, AR_EEP_RFKILL) && ath_hal_eepromGet(ah, AR_EEP_RFSILENT, &ahpriv->ah_rfsilent) == HAL_OK) { Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Wed Jun 1 20:01:02 2011 (r222584) @@ -560,3 +560,106 @@ ar5416DetectBBHang(struct ath_hal *ah) #undef N } #undef NUM_STATUS_READS + +/* + * Get the radar parameter values and return them in the pe + * structure + */ +void +ar5416GetDfsThresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe) +{ + uint32_t val, temp; + + val = OS_REG_READ(ah, AR_PHY_RADAR_0); + + temp = MS(val,AR_PHY_RADAR_0_FIRPWR); + temp |= 0xFFFFFF80; + pe->pe_firpwr = temp; + pe->pe_rrssi = MS(val, AR_PHY_RADAR_0_RRSSI); + pe->pe_height = MS(val, AR_PHY_RADAR_0_HEIGHT); + pe->pe_prssi = MS(val, AR_PHY_RADAR_0_PRSSI); + pe->pe_inband = MS(val, AR_PHY_RADAR_0_INBAND); + + val = OS_REG_READ(ah, AR_PHY_RADAR_1); + temp = val & AR_PHY_RADAR_1_RELPWR_ENA; + pe->pe_relpwr = MS(val, AR_PHY_RADAR_1_RELPWR_THRESH); + if (temp) + pe->pe_relpwr |= HAL_PHYERR_PARAM_ENABLE; + temp = val & AR_PHY_RADAR_1_RELSTEP_CHECK; + pe->pe_relstep = MS(val, AR_PHY_RADAR_1_RELSTEP_THRESH); + if (temp) + pe->pe_relstep |= HAL_PHYERR_PARAM_ENABLE; + pe->pe_maxlen = MS(val, AR_PHY_RADAR_1_MAXLEN); + pe->pe_extchannel = !! (OS_REG_READ(ah, AR_PHY_RADAR_EXT) & + AR_PHY_RADAR_EXT_ENA); +} + +/* + * Enable radar detection and set the radar parameters per the + * values in pe + */ +void +ar5416EnableDfs(struct ath_hal *ah, HAL_PHYERR_PARAM *pe) +{ + uint32_t val; + + val = OS_REG_READ(ah, AR_PHY_RADAR_0); + + if (pe->pe_firpwr != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_0_FIRPWR; + val |= SM(pe->pe_firpwr, AR_PHY_RADAR_0_FIRPWR); + } + if (pe->pe_rrssi != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_0_RRSSI; + val |= SM(pe->pe_rrssi, AR_PHY_RADAR_0_RRSSI); + } + if (pe->pe_height != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_0_HEIGHT; + val |= SM(pe->pe_height, AR_PHY_RADAR_0_HEIGHT); + } + if (pe->pe_prssi != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_0_PRSSI; + val |= SM(pe->pe_prssi, AR_PHY_RADAR_0_PRSSI); + } + if (pe->pe_inband != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_0_INBAND; + val |= SM(pe->pe_inband, AR_PHY_RADAR_0_INBAND); + } + + /*Enable FFT data*/ + val |= AR_PHY_RADAR_0_FFT_ENA; + + OS_REG_WRITE(ah, AR_PHY_RADAR_0, val | AR_PHY_RADAR_0_ENA); + + val = OS_REG_READ(ah, AR_PHY_RADAR_1); + val |= (AR_PHY_RADAR_1_MAX_RRSSI | AR_PHY_RADAR_1_BLOCK_CHECK); + + if (pe->pe_maxlen != HAL_PHYERR_PARAM_NOVAL) { + val &= ~AR_PHY_RADAR_1_MAXLEN; + val |= SM(pe->pe_maxlen, AR_PHY_RADAR_1_MAXLEN); + } + OS_REG_WRITE(ah, AR_PHY_RADAR_1, val); + + /* + * Enable HT/40 if the upper layer asks; + * it should check the channel is HT/40 and HAL_CAP_EXT_CHAN_DFS + * is available. + */ + if (pe->pe_extchannel) + OS_REG_SET_BIT(ah, AR_PHY_RADAR_EXT, AR_PHY_RADAR_EXT_ENA); + else + OS_REG_CLR_BIT(ah, AR_PHY_RADAR_EXT, AR_PHY_RADAR_EXT_ENA); + + if (pe->pe_relstep != HAL_PHYERR_PARAM_NOVAL) { + val = OS_REG_READ(ah, AR_PHY_RADAR_1); + val &= ~AR_PHY_RADAR_1_RELSTEP_THRESH; + val |= SM(pe->pe_relstep, AR_PHY_RADAR_1_RELSTEP_THRESH); + OS_REG_WRITE(ah, AR_PHY_RADAR_1, val); + } + if (pe->pe_relpwr != HAL_PHYERR_PARAM_NOVAL) { + val = OS_REG_READ(ah, AR_PHY_RADAR_1); + val &= ~AR_PHY_RADAR_1_RELPWR_THRESH; + val |= SM(pe->pe_relpwr, AR_PHY_RADAR_1_RELPWR_THRESH); + OS_REG_WRITE(ah, AR_PHY_RADAR_1, val); + } +} Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h Wed Jun 1 20:01:02 2011 (r222584) @@ -21,6 +21,25 @@ #include "ar5212/ar5212phy.h" +/* For AR_PHY_RADAR0 */ +#define AR_PHY_RADAR_0_FFT_ENA 0x80000000 + +#define AR_PHY_RADAR_EXT 0x9940 +#define AR_PHY_RADAR_EXT_ENA 0x00004000 + +#define AR_PHY_RADAR_1 0x9958 +#define AR_PHY_RADAR_1_RELPWR_ENA 0x00800000 +#define AR_PHY_RADAR_1_USE_FIR128 0x00400000 +#define AR_PHY_RADAR_1_RELPWR_THRESH 0x003F0000 +#define AR_PHY_RADAR_1_RELPWR_THRESH_S 16 +#define AR_PHY_RADAR_1_BLOCK_CHECK 0x00008000 +#define AR_PHY_RADAR_1_MAX_RRSSI 0x00004000 +#define AR_PHY_RADAR_1_RELSTEP_CHECK 0x00002000 +#define AR_PHY_RADAR_1_RELSTEP_THRESH 0x00001F00 +#define AR_PHY_RADAR_1_RELSTEP_THRESH_S 8 +#define AR_PHY_RADAR_1_MAXLEN 0x000000FF +#define AR_PHY_RADAR_1_MAXLEN_S 0 + #define AR_PHY_CHIP_ID_REV_0 0x80 /* 5416 Rev 0 (owl 1.0) BB */ #define AR_PHY_CHIP_ID_REV_1 0x81 /* 5416 Rev 1 (owl 2.0) BB */ Modified: head/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c Wed Jun 1 20:01:02 2011 (r222584) @@ -289,6 +289,7 @@ ar9130FillCapabilityInfo(struct ath_hal pCap->halRifsTxSupport = AH_TRUE; pCap->halRtsAggrLimit = 64*1024; /* 802.11n max */ pCap->halExtChanDfsSupport = AH_TRUE; + pCap->halUseCombinedRadarRssi = AH_TRUE; pCap->halAutoSleepSupport = AH_FALSE; /* XXX? */ /* * MBSSID aggregation is broken in Howl v1.1, v1.2, v1.3 Modified: head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c Wed Jun 1 20:01:02 2011 (r222584) @@ -293,6 +293,7 @@ ar9160FillCapabilityInfo(struct ath_hal pCap->halRifsTxSupport = AH_TRUE; pCap->halRtsAggrLimit = 64*1024; /* 802.11n max */ pCap->halExtChanDfsSupport = AH_TRUE; + pCap->halUseCombinedRadarRssi = AH_TRUE; pCap->halAutoSleepSupport = AH_FALSE; /* XXX? */ pCap->halMbssidAggrSupport = AH_TRUE; pCap->hal4AddrAggrSupport = AH_TRUE; Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Wed Jun 1 20:01:02 2011 (r222584) @@ -783,6 +783,7 @@ ar9280FillCapabilityInfo(struct ath_hal pCap->halRifsTxSupport = AH_TRUE; pCap->halRtsAggrLimit = 64*1024; /* 802.11n max */ pCap->halExtChanDfsSupport = AH_TRUE; + pCap->halUseCombinedRadarRssi = AH_TRUE; #if 0 /* XXX bluetooth */ pCap->halBtCoexSupport = AH_TRUE; @@ -804,6 +805,7 @@ ar9280FillCapabilityInfo(struct ath_hal } pCap->halRxStbcSupport = 1; pCap->halTxStbcSupport = 1; + pCap->halEnhancedDfsSupport = AH_TRUE; return AH_TRUE; } Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Wed Jun 1 20:01:02 2011 (r222584) @@ -414,6 +414,7 @@ ar9285FillCapabilityInfo(struct ath_hal pCap->halRifsTxSupport = AH_TRUE; pCap->halRtsAggrLimit = 64*1024; /* 802.11n max */ pCap->halExtChanDfsSupport = AH_TRUE; + pCap->halUseCombinedRadarRssi = AH_TRUE; #if 0 /* XXX bluetooth */ pCap->halBtCoexSupport = AH_TRUE; Modified: head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c Wed Jun 1 20:00:25 2011 (r222583) +++ head/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c Wed Jun 1 20:01:02 2011 (r222584) @@ -430,6 +430,7 @@ ar9287FillCapabilityInfo(struct ath_hal pCap->halRifsTxSupport = AH_TRUE; pCap->halRtsAggrLimit = 64*1024; /* 802.11n max */ pCap->halExtChanDfsSupport = AH_TRUE; + pCap->halUseCombinedRadarRssi = AH_TRUE; #if 0 /* XXX bluetooth */ pCap->halBtCoexSupport = AH_TRUE; @@ -447,6 +448,8 @@ ar9287FillCapabilityInfo(struct ath_hal /* Hardware supports short-GI w/ 20MHz */ pCap->halHTSGI20Support = 1; + pCap->halEnhancedDfsSupport = AH_TRUE; + return AH_TRUE; } From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 20:09:49 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAFA21065670; Wed, 1 Jun 2011 20:09:49 +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 A85C68FC0A; Wed, 1 Jun 2011 20:09:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p51K9nGM085223; Wed, 1 Jun 2011 20:09:49 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51K9nD9085216; Wed, 1 Jun 2011 20:09:49 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201106012009.p51K9nD9085216@svn.freebsd.org> From: Adrian Chadd Date: Wed, 1 Jun 2011 20:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222585 - in head/sys: conf dev/ath dev/ath/ath_dfs dev/ath/ath_dfs/null modules/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 20:09:49 -0000 Author: adrian Date: Wed Jun 1 20:09:49 2011 New Revision: 222585 URL: http://svn.freebsd.org/changeset/base/222585 Log: Flesh out the radar detection related operations for the ath driver. This is in no way a complete DFS/radar detection implementation! It merely creates an abstracted interface which allows for future development of the DFS radar detection code. Note: Net80211 already handles the bulk of the DFS machinery, all we need to do here is figure out that a radar event has occured and inform it as such. It then drives the DFS state engine for us. The "null" DFS radar detection module is included by default; it doesn't require a device line. This commit: * Adds a simple abstracted layer for radar detection state - sys/dev/ath/ath_dfs/; * Implements a null DFS module which doesn't do anything; (ie, implements the exact behaviour at the moment); * Adds hooks to the ath driver to process received radar events and gives the DFS module a chance to determine whether a radar has been detected. Obtained from: Atheros Added: head/sys/dev/ath/ath_dfs/ head/sys/dev/ath/ath_dfs/null/ head/sys/dev/ath/ath_dfs/null/dfs_null.c (contents, props changed) head/sys/dev/ath/if_athdfs.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h head/sys/modules/ath/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Jun 1 20:01:02 2011 (r222584) +++ head/sys/conf/files Wed Jun 1 20:09:49 2011 (r222585) @@ -846,7 +846,10 @@ dev/ath/ath_rate/onoe/onoe.c optional at compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_rate/sample/sample.c optional ath_rate_sample \ compile-with "${NORMAL_C} -I$S/dev/ath" -# +# ath DFS modules +dev/ath/ath_dfs/null/dfs_null.c optional ath \ + compile-with "${NORMAL_C} -I$S/dev/ath" +# dev/bce/if_bce.c optional bce dev/bfe/if_bfe.c optional bfe dev/bge/if_bge.c optional bge Added: head/sys/dev/ath/ath_dfs/null/dfs_null.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ath/ath_dfs/null/dfs_null.c Wed Jun 1 20:09:49 2011 (r222585) @@ -0,0 +1,160 @@ +/*- + * Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ +#include +__FBSDID("$FreeBSD$"); + +/* + * This implements an empty DFS module. + */ +#include "opt_inet.h" +#include "opt_wlan.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include /* XXX for ether_sprintf */ + +#include + +#include + +#ifdef INET +#include +#include +#endif + +#include +#include + +#include + +/* + * Methods which are required + */ + +/* + * Attach DFS to the given interface + */ +int +ath_dfs_attach(struct ath_softc *sc) +{ + return 1; +} + +/* + * Detach DFS from the given interface + */ +int +ath_dfs_detach(struct ath_softc *sc) +{ + return 1; +} + +/* + * Enable radar check + */ +void +ath_dfs_radar_enable(struct ath_softc *sc, struct ieee80211_channel *chan) +{ + /* Check if the current channel is radar-enabled */ + if (! IEEE80211_IS_CHAN_DFS(chan)) + return; +} + +/* + * Process DFS related PHY errors + */ +void +ath_dfs_process_phy_err(struct ath_softc *sc, struct ath_desc *ds, + uint64_t tsf, struct ath_rx_status *rxstat) +{ + +} + +/* + * Process the radar events and determine whether a DFS event has occured. + * + * This is designed to run outside of the RX processing path. + * The RX path will call ath_dfs_tasklet_needed() to see whether + * the task/callback running this routine needs to be called. + */ +int +ath_dfs_process_radar_event(struct ath_softc *sc, + struct ieee80211_channel *chan) +{ + return 0; +} + +/* + * Determine whether the the DFS check task needs to be queued. + * + * This is called in the RX task when the current batch of packets + * have been received. It will return whether there are any radar + * events for ath_dfs_process_radar_event() to handle. + */ +int +ath_dfs_tasklet_needed(struct ath_softc *sc, struct ieee80211_channel *chan) +{ + return 0; +} + +/* + * Handle ioctl requests from the diagnostic interface + */ +int +ath_ioctl_phyerr(struct ath_softc *sc, struct ath_diag *ad) +{ + return 1; +} + +/* + * Get the current DFS thresholds from the HAL + */ +int +ath_dfs_get_thresholds(struct ath_softc *sc, HAL_PHYERR_PARAM *param) +{ + ath_hal_getdfsthresh(sc->sc_ah, param); + return 1; +} Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Wed Jun 1 20:01:02 2011 (r222584) +++ head/sys/dev/ath/if_ath.c Wed Jun 1 20:09:49 2011 (r222585) @@ -95,11 +95,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef ATH_TX99_DIAG #include #endif + /* * ATH_BCBUF determines the number of vap's that can transmit * beacons and also (currently) the number of vap's that can @@ -199,6 +201,8 @@ static void ath_setcurmode(struct ath_so static void ath_announce(struct ath_softc *); +static void ath_dfs_tasklet(void *, int); + #ifdef IEEE80211_SUPPORT_TDMA static void ath_tdma_settimers(struct ath_softc *sc, u_int32_t nexttbtt, u_int32_t bintval); @@ -471,6 +475,16 @@ ath_attach(u_int16_t devid, struct ath_s goto bad2; } + /* Attach DFS module */ + if (! ath_dfs_attach(sc)) { + device_printf(sc->sc_dev, "%s: unable to attach DFS\n", __func__); + error = EIO; + goto bad2; + } + + /* Start DFS processing tasklet */ + TASK_INIT(&sc->sc_dfstask, 0, ath_dfs_tasklet, sc); + sc->sc_blinking = 0; sc->sc_ledstate = 1; sc->sc_ledon = 0; /* low true */ @@ -771,6 +785,8 @@ ath_detach(struct ath_softc *sc) sc->sc_tx99->detach(sc->sc_tx99); #endif ath_rate_detach(sc->sc_rc); + + ath_dfs_detach(sc); ath_desc_free(sc); ath_tx_cleanup(sc); ath_hal_detach(sc->sc_ah); /* NB: sets chip in full sleep */ @@ -1554,6 +1570,9 @@ ath_init(void *arg) } ath_chan_change(sc, ic->ic_curchan); + /* Let DFS at it in case it's a DFS channel */ + ath_dfs_radar_enable(sc, ic->ic_curchan); + /* * Likewise this is set during reset so update * state cached in the driver. @@ -1699,6 +1718,10 @@ ath_reset(struct ifnet *ifp) if_printf(ifp, "%s: unable to reset hardware; hal status %u\n", __func__, status); sc->sc_diversity = ath_hal_getdiversity(ah); + + /* Let DFS at it in case it's a DFS channel */ + ath_dfs_radar_enable(sc, ic->ic_curchan); + if (ath_startrecv(sc) != 0) /* restart recv */ if_printf(ifp, "%s: unable to start recv logic\n", __func__); /* @@ -3441,6 +3464,9 @@ ath_rx_proc(void *arg, int npending) sc->sc_stats.ast_rx_fifoerr++; if (rs->rs_status & HAL_RXERR_PHY) { sc->sc_stats.ast_rx_phyerr++; + /* Process DFS radar events */ + ath_dfs_process_phy_err(sc, ds, tsf, rs); + /* Be suitably paranoid about receiving phy errors out of the stats array bounds */ if (rs->rs_phyerr < 64) sc->sc_stats.ast_rx_phy[rs->rs_phyerr]++; @@ -3682,6 +3708,10 @@ rx_next: if (ngood) sc->sc_lastrx = tsf; + /* Queue DFS tasklet if needed */ + if (ath_dfs_tasklet_needed(sc, sc->sc_curchan)) + taskqueue_enqueue(sc->sc_tq, &sc->sc_dfstask); + if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0) { #ifdef IEEE80211_SUPPORT_SUPERG ieee80211_ff_age_all(ic, 100); @@ -4399,6 +4429,9 @@ ath_chan_set(struct ath_softc *sc, struc } sc->sc_diversity = ath_hal_getdiversity(ah); + /* Let DFS at it in case it's a DFS channel */ + ath_dfs_radar_enable(sc, ic->ic_curchan); + /* * Re-enable rx framework. */ @@ -5665,5 +5698,23 @@ ath_tdma_beacon_send(struct ath_softc *s } #endif /* IEEE80211_SUPPORT_TDMA */ +static void +ath_dfs_tasklet(void *p, int npending) +{ + struct ath_softc *sc = (struct ath_softc *) p; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + + /* + * If previous processing has found a radar event, + * signal this to the net80211 layer to begin DFS + * processing. + */ + if (ath_dfs_process_radar_event(sc, sc->sc_curchan)) { + /* DFS event found, initiate channel change */ + ieee80211_dfs_notify_radar(ic, sc->sc_curchan); + } +} + MODULE_VERSION(if_ath, 1); MODULE_DEPEND(if_ath, wlan, 1, 1, 1); /* 802.11 media layer */ Added: head/sys/dev/ath/if_athdfs.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ath/if_athdfs.h Wed Jun 1 20:09:49 2011 (r222585) @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ +#ifndef __IF_ATHDFS_H__ +#define __IF_ATHDFS_H__ + +extern int ath_dfs_attach(struct ath_softc *sc); +extern int ath_dfs_detach(struct ath_softc *sc); +extern void ath_dfs_radar_enable(struct ath_softc *, + struct ieee80211_channel *chan); +extern void ath_dfs_process_phy_err(struct ath_softc *sc, struct ath_desc *ds, + uint64_t tsf, struct ath_rx_status *rxstat); +extern int ath_dfs_process_radar_event(struct ath_softc *sc, + struct ieee80211_channel *chan); +extern int ath_dfs_tasklet_needed(struct ath_softc *sc, + struct ieee80211_channel *chan); +extern int ath_ioctl_phyerr(struct ath_softc *sc, struct ath_diag *ad); +extern int ath_dfs_get_thresholds(struct ath_softc *sc, HAL_PHYERR_PARAM *param); + +#endif /* __IF_ATHDFS_H__ */ Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Wed Jun 1 20:01:02 2011 (r222584) +++ head/sys/dev/ath/if_athvar.h Wed Jun 1 20:09:49 2011 (r222585) @@ -357,6 +357,10 @@ struct ath_softc { uint16_t *sc_eepromdata; /* Local eeprom data, if AR9100 */ int sc_txchainmask; /* currently configured TX chainmask */ int sc_rxchainmask; /* currently configured RX chainmask */ + + /* DFS related state */ + void *sc_dfs; /* Used by an optional DFS module */ + struct task sc_dfstask; /* DFS processing task */ }; #define ATH_LOCK_INIT(_sc) \ @@ -694,6 +698,17 @@ void ath_intr(void *); #define ath_hal_set11nburstduration(_ah, _ds, _dur) \ ((*(_ah)->ah_set11nBurstDuration)((_ah), (_ds), (_dur))) +/* + * This is badly-named; you need to set the correct parameters + * to begin to receive useful radar events; and even then + * it doesn't "enable" DFS. See the ath_dfs/null/ module for + * more information. + */ +#define ath_hal_enabledfs(_ah, _param) \ + ((*(_ah)->ah_enableDfs)((_ah), (_param))) +#define ath_hal_getdfsthresh(_ah, _param) \ + ((*(_ah)->ah_getDfsThresh)((_ah), (_param))) + #define ath_hal_gpioCfgOutput(_ah, _gpio, _type) \ ((*(_ah)->ah_gpioCfgOutput)((_ah), (_gpio), (_type))) #define ath_hal_gpioset(_ah, _gpio, _b) \ Modified: head/sys/modules/ath/Makefile ============================================================================== --- head/sys/modules/ath/Makefile Wed Jun 1 20:01:02 2011 (r222584) +++ head/sys/modules/ath/Makefile Wed Jun 1 20:09:49 2011 (r222585) @@ -134,6 +134,10 @@ SRCS+= onoe.c SRCS+= amrr.c .endif +# DFS +.PATH: ${.CURDIR}/../../dev/ath/ath_dfs/null +SRCS+= dfs_null.c + CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${.CURDIR}/../../dev/ath/ath_hal opt_ah.h: From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 21:00:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F7191065675; Wed, 1 Jun 2011 21:00:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1C738FC12; Wed, 1 Jun 2011 21:00: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 p51L0Sxm086696; Wed, 1 Jun 2011 21:00:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p51L0Sga086688; Wed, 1 Jun 2011 21:00:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201106012100.p51L0Sga086688@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 1 Jun 2011 21:00:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222586 - in head/sys: fs/nfsclient fs/nwfs fs/smbfs nfsclient vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 21:00:29 -0000 Author: kib Date: Wed Jun 1 21:00:28 2011 New Revision: 222586 URL: http://svn.freebsd.org/changeset/base/222586 Log: In the VOP_PUTPAGES() implementations, change the default error from VM_PAGER_AGAIN to VM_PAGER_ERROR for the uwritten pages. Return VM_PAGER_AGAIN for the partially written page. Always forward at least one page in the loop of vm_object_page_clean(). VM_PAGER_ERROR causes the page reactivation and does not clear the page dirty state, so the write is not lost. The change fixes an infinite loop in vm_object_page_clean() when the filesystem returns permanent errors for some page writes. Reported and tested by: gavin Reviewed by: alc, rmacklem MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nwfs/nwfs_io.c head/sys/fs/smbfs/smbfs_io.c head/sys/nfsclient/nfs_bio.c head/sys/vm/vm_object.c head/sys/vm/vnode_pager.c head/sys/vm/vnode_pager.h Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Wed Jun 1 20:09:49 2011 (r222585) +++ head/sys/fs/nfsclient/nfs_clbio.c Wed Jun 1 21:00:28 2011 (r222586) @@ -302,7 +302,7 @@ ncl_putpages(struct vop_putpages_args *a } for (i = 0; i < npages; i++) - rtvals[i] = VM_PAGER_AGAIN; + rtvals[i] = VM_PAGER_ERROR; /* * When putting pages, do not extend file past EOF. @@ -345,16 +345,9 @@ ncl_putpages(struct vop_putpages_args *a pmap_qremove(kva, npages); relpbuf(bp, &ncl_pbuf_freecnt); - if (!error) { - int nwritten = round_page(count - uio.uio_resid) / PAGE_SIZE; - for (i = 0; i < nwritten; i++) { - rtvals[i] = VM_PAGER_OK; - vm_page_undirty(pages[i]); - } - if (must_commit) { - ncl_clearcommit(vp->v_mount); - } - } + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); + if (must_commit) + ncl_clearcommit(vp->v_mount); return rtvals[0]; } Modified: head/sys/fs/nwfs/nwfs_io.c ============================================================================== --- head/sys/fs/nwfs/nwfs_io.c Wed Jun 1 20:09:49 2011 (r222585) +++ head/sys/fs/nwfs/nwfs_io.c Wed Jun 1 21:00:28 2011 (r222586) @@ -544,7 +544,7 @@ nwfs_putpages(ap) npages = btoc(count); for (i = 0; i < npages; i++) { - rtvals[i] = VM_PAGER_AGAIN; + rtvals[i] = VM_PAGER_ERROR; } bp = getpbuf(&nwfs_pbuf_freecnt); @@ -569,13 +569,8 @@ nwfs_putpages(ap) pmap_qremove(kva, npages); relpbuf(bp, &nwfs_pbuf_freecnt); - if (!error) { - int nwritten = round_page(count - uio.uio_resid) / PAGE_SIZE; - for (i = 0; i < nwritten; i++) { - rtvals[i] = VM_PAGER_OK; - vm_page_undirty(pages[i]); - } - } + if (!error) + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); return rtvals[0]; #endif /* NWFS_RWCACHE */ } Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Wed Jun 1 20:09:49 2011 (r222585) +++ head/sys/fs/smbfs/smbfs_io.c Wed Jun 1 21:00:28 2011 (r222586) @@ -609,7 +609,7 @@ smbfs_putpages(ap) npages = btoc(count); for (i = 0; i < npages; i++) { - rtvals[i] = VM_PAGER_AGAIN; + rtvals[i] = VM_PAGER_ERROR; } bp = getpbuf(&smbfs_pbuf_freecnt); @@ -639,13 +639,8 @@ smbfs_putpages(ap) relpbuf(bp, &smbfs_pbuf_freecnt); - if (!error) { - int nwritten = round_page(count - uio.uio_resid) / PAGE_SIZE; - for (i = 0; i < nwritten; i++) { - rtvals[i] = VM_PAGER_OK; - vm_page_undirty(pages[i]); - } - } + if (!error) + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); return rtvals[0]; #endif /* SMBFS_RWGENERIC */ } Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Wed Jun 1 20:09:49 2011 (r222585) +++ head/sys/nfsclient/nfs_bio.c Wed Jun 1 21:00:28 2011 (r222586) @@ -300,7 +300,7 @@ nfs_putpages(struct vop_putpages_args *a } for (i = 0; i < npages; i++) - rtvals[i] = VM_PAGER_AGAIN; + rtvals[i] = VM_PAGER_ERROR; /* * When putting pages, do not extend file past EOF. @@ -344,11 +344,7 @@ nfs_putpages(struct vop_putpages_args *a relpbuf(bp, &nfs_pbuf_freecnt); if (!error) { - int nwritten = round_page(count - uio.uio_resid) / PAGE_SIZE; - for (i = 0; i < nwritten; i++) { - rtvals[i] = VM_PAGER_OK; - vm_page_undirty(pages[i]); - } + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); if (must_commit) { nfs_clearcommit(vp->v_mount); } Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Jun 1 20:09:49 2011 (r222585) +++ head/sys/vm/vm_object.c Wed Jun 1 21:00:28 2011 (r222586) @@ -852,6 +852,21 @@ rescan: flags, &clearobjflags); if (object->generation != curgeneration) goto rescan; + + /* + * If the VOP_PUTPAGES() did a truncated write, so + * that even the first page of the run is not fully + * written, vm_pageout_flush() returns 0 as the run + * length. Since the condition that caused truncated + * write may be permanent, e.g. exhausted free space, + * accepting n == 0 would cause an infinite loop. + * + * Forwarding the iterator leaves the unwritten page + * behind, but there is not much we can do there if + * filesystem refuses to write it. + */ + if (n == 0) + n = 1; np = vm_page_find_least(object, pi + n); } #if 0 Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Wed Jun 1 20:09:49 2011 (r222585) +++ head/sys/vm/vnode_pager.c Wed Jun 1 21:00:28 2011 (r222586) @@ -1089,7 +1089,7 @@ vnode_pager_generic_putpages(struct vnod count = bytecount / PAGE_SIZE; for (i = 0; i < count; i++) - rtvals[i] = VM_PAGER_AGAIN; + rtvals[i] = VM_PAGER_ERROR; if ((int64_t)ma[0]->pindex < 0) { printf("vnode_pager_putpages: attempt to write meta-data!!! -- 0x%lx(%lx)\n", @@ -1191,3 +1191,20 @@ vnode_pager_generic_putpages(struct vnod } return rtvals[0]; } + +void +vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written) +{ + int i, pos; + + for (i = 0, pos = 0; pos < written; i++, pos += PAGE_SIZE) { + if (pos < trunc_page(written)) { + rtvals[i] = VM_PAGER_OK; + vm_page_undirty(ma[i]); + } else { + /* Partially written page. */ + rtvals[i] = VM_PAGER_AGAIN; + vm_page_clear_dirty(ma[i], 0, written & PAGE_MASK); + } + } +} Modified: head/sys/vm/vnode_pager.h ============================================================================== --- head/sys/vm/vnode_pager.h Wed Jun 1 20:09:49 2011 (r222585) +++ head/sys/vm/vnode_pager.h Wed Jun 1 21:00:28 2011 (r222586) @@ -49,5 +49,8 @@ int vnode_pager_generic_getpages(struct int vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *m, int count, boolean_t sync, int *rtvals); + +void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written); + #endif /* _KERNEL */ #endif /* _VNODE_PAGER_ */ From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 00:34:58 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41056106566C; Thu, 2 Jun 2011 00:34:58 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31F9E8FC08; Thu, 2 Jun 2011 00:34:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p520YwJ4093290; Thu, 2 Jun 2011 00:34:58 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p520YwBu093285; Thu, 2 Jun 2011 00:34:58 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201106020034.p520YwBu093285@svn.freebsd.org> From: Jack F Vogel Date: Thu, 2 Jun 2011 00:34:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222588 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 00:34:58 -0000 Author: jfv Date: Thu Jun 2 00:34:57 2011 New Revision: 222588 URL: http://svn.freebsd.org/changeset/base/222588 Log: First off: update the driver README, the old one was horribly crusty, and this still isn't perfect, but its at least a bit more recent. Secondly, a few improvements to the driver from Andrew Boyer, support hint to allow devices to not attach, add VLAN_HWTSO capability so vlans can use TSO, fix in the interrupt handler to make sure the stack TX queue is processed. Oh, and also make sure IPv6 does not cause a re-init in the ioctl routine. Thanks for your efforts Andrew! Thanks to Claudio Jeker for noticing the ixgbe_xmit() routine was not correctly swapping the dma map from the first to the last descriptor in a multi-descriptor transmission, corrected this. Modified: head/sys/dev/ixgbe/LICENSE head/sys/dev/ixgbe/README head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixv.c Modified: head/sys/dev/ixgbe/LICENSE ============================================================================== --- head/sys/dev/ixgbe/LICENSE Wed Jun 1 22:56:02 2011 (r222587) +++ head/sys/dev/ixgbe/LICENSE Thu Jun 2 00:34:57 2011 (r222588) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/ixgbe/README ============================================================================== --- head/sys/dev/ixgbe/README Wed Jun 1 22:56:02 2011 (r222587) +++ head/sys/dev/ixgbe/README Thu Jun 2 00:34:57 2011 (r222588) @@ -1,8 +1,8 @@ -FreeBSD Driver for 10 Gigabit PCI Express Server Adapters -============================================= +FreeBSD Driver for Intel(R) Ethernet 10 Gigabit PCI Express Server Adapters +============================================================================ /*$FreeBSD$*/ -May 14, 2008 +November 12, 2010 Contents @@ -11,15 +11,15 @@ Contents - Overview - Supported Adapters - Building and Installation -- Additional Configurations +- Additional Configurations and Tuning - Known Limitations Overview ======== -This file describes the FreeBSD* driver for the 10 Gigabit PCIE Family of -Adapters. Drivers has been developed for use with FreeBSD 7 or later. +This file describes the FreeBSD* driver for the Intel(R) Ethernet 10 Gigabit +Family of Adapters. Driver has been developed for use with FreeBSD 7.2 or later. For questions related to hardware requirements, refer to the documentation supplied with your Intel 10GbE adapter. All hardware requirements listed @@ -29,100 +29,98 @@ apply to use with FreeBSD. Supported Adapters ================== -The following Intel network adapters are compatible with the drivers in this -release: - -Controller Adapter Name Physical Layer ----------- ------------ -------------- -82598EB Intel(R) 10 Gigabit XF SR/AF 10G Base -LR (850 nm optical fiber) - Dual Port Server Adapter 10G Base -SR (1310 nm optical fiber) -82598EB Intel(R) 10 Gigabit XF SR/LR - Server Adapter - Intel(R) 82598EB 10 Gigabit AF - Network Connection - Intel(R) 82598EB 10 Gigabit AT - CX4 Network Connection +The driver in this release is compatible with 82598 and 82599-based Intel +Network Connections. +SFP+ Devices with Pluggable Optics +---------------------------------- -Building and Installation -========================= - -NOTE: You must have kernel sources installed in order to compile the driver - module. - - In the instructions below, x.x.x is the driver version as indicated in - the name of the driver tar. - -1. Move the base driver tar file to the directory of your choice. For - example, use /home/username/ixgbe or /usr/local/src/ixgbe. - -2. Untar/unzip the archive: - tar xfz ixgbe-x.x.x.tar.gz - -3. To install man page: - cd ixgbe-x.x.x - gzip -c ixgbe.4 > /usr/share/man/man4/ixgbee.4.gz - -4. To load the driver onto a running system: - cd ixgbe-x.x.x/src - make load - -5. To assign an IP address to the interface, enter the following: - ifconfig ix - -6. Verify that the interface works. Enter the following, where - is the IP address for another machine on the same subnet as the interface - that is being tested: - ping - -7. If you want the driver to load automatically when the system is booted: - - cd ixgbe-x.x.x/src - make - make install - - Edit /boot/loader.conf, and add the following line: - ixgbe_load="YES" - - OR - - compile the driver into the kernel (see item 8). - - - Edit /etc/rc.conf, and create the appropriate ifconfig_ixgbe - entry: - - ifconfig_ix="" - - Example usage: - - ifconfig_ix0="inet 192.168.10.1 netmask 255.255.255.0" - - NOTE: For assistance, see the ifconfig man page. - -8. If you want to compile the driver into the kernel, enter: +82599-BASED ADAPTERS - FreeBSD 7 or later: +NOTE: If your 82599-based Intel(R) Ethernet Network Adapter came with Intel +optics, or is an Intel(R) Ethernet Server Adapter X520-2, then it only supports +Intel optics and/or the direct attach cables listed below. - cd ixgbe-x.x.x/src - - cp *.[ch] /usr/src/sys/dev/ixgbe - - cp Makefile.kernel /usr/src/sys/modules/ixgbe/Makefile - - Edit the kernel configuration file (i.e., GENERIC or MYKERNEL) in - /usr/src/sys/i386/conf (replace "i386" with the appropriate system - architecture if necessary), and ensure the following line is present: - - device ixgbe - - Compile and install the kernel. The system must be reboot for the kernel - updates to take affect. For additional information on compiling the kernel, - consult the FreeBSD operating system documentation. +When 82599-based SFP+ devices are connected back to back, they should be set to +the same Speed setting via Ethtool. Results may vary if you mix speed settings. + +Supplier Type Part Numbers +SR Modules +Intel DUAL RATE 1G/10G SFP+ SR (bailed) FTLX8571D3BCV-IT +Intel DUAL RATE 1G/10G SFP+ SR (bailed) AFBR-703SDZ-IN2 +Intel DUAL RATE 1G/10G SFP+ SR (bailed) AFBR-703SDDZ-IN1 +LR Modules +Intel DUAL RATE 1G/10G SFP+ LR (bailed) FTLX1471D3BCV-IT +Intel DUAL RATE 1G/10G SFP+ LR (bailed) AFCT-701SDZ-IN2 +Intel DUAL RATE 1G/10G SFP+ LR (bailed) AFCT-701SDDZ-IN1 + +The following is a list of 3rd party SFP+ modules and direct attach cables that +have received some testing. Not all modules are applicable to all devices. + +Supplier Type Part Numbers + +Finisar SFP+ SR bailed, 10g single rate FTLX8571D3BCL +Avago SFP+ SR bailed, 10g single rate AFBR-700SDZ +Finisar SFP+ LR bailed, 10g single rate FTLX8571D3BCV-IT + +Finisar DUAL RATE 1G/10G SFP+ SR (No Bail) FTLX8571D3QCV-IT +Avago DUAL RATE 1G/10G SFP+ SR (No Bail) AFBR-703SDZ-IN1 +Finisar DUAL RATE 1G/10G SFP+ LR (No Bail) FTLX1471D3QCV-IT +Avago DUAL RATE 1G/10G SFP+ LR (No Bail) AFCT-701SDZ-IN1 +Finistar 1000BASE-T SFP FCLF8522P2BTL +Avago 1000BASE-T SFP ABCU-5710RZ + +82599-based adapters support all passive and active limiting direct attach +cables that comply with SFF-8431 v4.1 and SFF-8472 v10.4 specifications. + +Laser turns off for SFP+ when ifconfig down +-------------------------------------------------------- +"ifconfig down" turns off the laser for 82599-based SFP+ fiber adapters. +"ifconfig up" turns on the later. + +82598-BASED ADAPTERS + +NOTES for 82598-Based Adapters: +- Intel(R) Ethernet Network Adapters that support removable optical modules + only support their original module type (i.e., the Intel(R) 10 Gigabit SR + Dual Port Express Module only supports SR optical modules). If you plug + in a different type of module, the driver will not load. +- Hot Swapping/hot plugging optical modules is not supported. +- Only single speed, 10 gigabit modules are supported. +- LAN on Motherboard (LOMs) may support DA, SR, or LR modules. Other module + types are not supported. Please see your system documentation for details. + +The following is a list of 3rd party SFP+ modules and direct attach cables that have +received some testing. Not all modules are applicable to all devices. + +Supplier Type Part Numbers + +Finisar SFP+ SR bailed, 10g single rate FTLX8571D3BCL +Avago SFP+ SR bailed, 10g single rate AFBR-700SDZ +Finisar SFP+ LR bailed, 10g single rate FTLX1471D3BCL + +82598-based adapters support all passive direct attach cables that comply +with SFF-8431 v4.1 and SFF-8472 v10.4 specifications. Active direct attach +cables are not supported. + +Third party optic modules and cables referred to above are listed only for the +purpose of highlighting third party specifications and potential compatibility, +and are not recommendations or endorsements or sponsorship of any third party's +product by Intel. Intel is not endorsing or promoting products made by any +third party and the third party reference is provided only to share information +regarding certain optic modules and cables with the above specifications. There +may be other manufacturers or suppliers, producing or supplying optic modules +and cables with similar or matching descriptions. Customers must use their own +discretion and diligence to purchase optic modules and cables from any third +party of their choice. Customer are solely responsible for assessing the +suitability of the product and/or devices and for the selection of the vendor +for purchasing any product. INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL +DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF +SUCH THIRD PARTY PRODUCTS OR SELECTION OF VENDOR BY CUSTOMERS. Configuration and Tuning -========================= +======================== The driver supports Transmit/Receive Checksum Offload and Jumbo Frames on all 10 Gigabit adapters. @@ -143,7 +141,7 @@ all 10 Gigabit adapters. The Jumbo Frames MTU range for Intel Adapters is 1500 to 16114. The default MTU range is 1500. To modify the setting, enter the following: - ifconfig ix mtu 9000 + ifconfig ix mtu 9000 To confirm an interface's MTU value, use the ifconfig command. To confirm the MTU used between two specific devices, use: @@ -200,6 +198,8 @@ all 10 Gigabit adapters. TSO --- + TSO is enabled by default. + To disable: ifconfig -tso @@ -209,23 +209,21 @@ all 10 Gigabit adapters. ifconfig tso LRO - ___ + --- - Large Receive Offload is available in version 1.4.4, it is on - by default. It can be toggled off and on by using: - sysctl dev.ix.X.enable_lro=[0,1] - - NOTE: when changing this feature you MUST be sure the interface - is reinitialized, it is easy to do this with ifconfig down/up. - The LRO code will ultimately move into the kernel stack code, - but for this first release it was included with the driver. + Large Receive Offload is available in the driver; it is on by default. + It can be disabled by using: + ifconfig -lro + To enable: + ifconfig lro + Important system configuration changes: --------------------------------------- - When there is a choice run on a 64bit OS rather than 32, it makes - a significant difference in improvement. - + When there is a choice run on a 64bit OS rather than 32, it makes a + significant difference in improvement. + The default scheduler SCHED_4BSD is not smart about SMP locality issues. Significant improvement can be achieved by switching to the ULE scheduler. @@ -233,34 +231,79 @@ all 10 Gigabit adapters. SCHED_ULE. Note that this is only advisable on FreeBSD 7, on 6.X there have been stability problems with ULE. - Change the file /etc/sysctl.conf, add the line: + The interface can generate high number of interrupts. To avoid running + into the limit set by the kernel, adjust hw.intr_storm_threshold + setting using sysctl: - hw.intr_storm_threshold: 8000 (the default is 1000) + sysctl hw.intr_storm_threshold=9000 (the default is 1000) + + For this change to take effect on boot, edit /etc/sysctl.conf and add the + line: + hw.intr_storm_threshold=9000 + + If you still see Interrupt Storm detected messages, increase the limit to a + higher number. Best throughput results are seen with a large MTU; use 9000 if possible. - The default number of descriptors is 256, increasing this to 1024 or even - 2048 may improve performance. + The default number of descriptors is 1024, increasing this to 2K or even + 4K may improve performance in some workloads, but change carefully. Known Limitations ================= + +For known hardware and troubleshooting issues, refer to the following website. + + http://support.intel.com/support/go/network/adapter/home.htm + +Either select the link for your adapter or perform a search for the adapter +number. The adapter's page lists many issues. For a complete list of hardware +issues download your adapter's user guide and read the Release Notes. + + UDP stress test with 10GbE driver + --------------------------------- Under small packets UDP stress test with 10GbE driver, the FreeBSD system will drop UDP packets due to the fullness of socket buffers. You may want to change the driver's Flow Control variables to the minimum value for controlling packet reception. + Attempting to configure larger MTUs with a large numbers of processors may + generate the error message "ix0:could not setup receive structures" + -------------------------------------------------------------------------- + When using the ixgbe driver with RSS autoconfigured based on the number of + cores (the default setting) and that number is larger than 4, increase the + memory resources allocated for the mbuf pool as follows: + + Add to the sysctl.conf file for the system: + + kern.ipc.nmbclusters=262144 + kern.ipc.nmbjumbop=262144 + + Lower than expected performance on dual port 10GbE devices + ---------------------------------------------------------- + Some PCI-E x8 slots are actually configured as x4 slots. These slots have + insufficient bandwidth for full 10Gbe line rate with dual port 10GbE devices. + The driver can detect this situation and will write the following message in + the system log: "PCI-Express bandwidth available for this card is not + sufficient for optimal performance. For optimal performance a x8 PCI-Express + slot is required." + + If this error occurs, moving your adapter to a true x8 slot will resolve the + issue. + + Support ======= For general information and support, go to the Intel support website at: - http://support.intel.com + www.intel.com/support/ If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to -the issue to freebsd@intel.com. +the issue to freebsd@intel.com Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Wed Jun 1 22:56:02 2011 (r222587) +++ head/sys/dev/ixgbe/ixgbe.c Thu Jun 2 00:34:57 2011 (r222588) @@ -34,6 +34,7 @@ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_inet.h" +#include "opt_inet6.h" #endif #include "ixgbe.h" @@ -46,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.3.10"; +char ixgbe_driver_version[] = "2.3.11"; /********************************************************************* * PCI Device ID Table @@ -318,7 +319,7 @@ static int fdir_pballoc = 1; * ixgbe_probe determines if the driver should be loaded on * adapter based on PCI vendor/device id of the adapter. * - * return 0 on success, positive on failure + * return BUS_PROBE_DEFAULT on success, positive on failure *********************************************************************/ static int @@ -357,7 +358,7 @@ ixgbe_probe(device_t dev) ixgbe_driver_version); device_set_desc_copy(dev, adapter_name); ++ixgbe_total_ports; - return (0); + return (BUS_PROBE_DEFAULT); } ent++; } @@ -385,6 +386,11 @@ ixgbe_attach(device_t dev) INIT_DEBUGOUT("ixgbe_attach: begin"); + if (resource_disabled("ixgbe", device_get_unit(dev))) { + device_printf(dev, "Disabled by device hint\n"); + return (ENXIO); + } + /* Allocate, clear, and link in our adapter structure */ adapter = device_get_softc(dev); adapter->dev = adapter->osdep.dev = dev; @@ -862,8 +868,9 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c { struct adapter *adapter = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; -#ifdef INET +#if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; + bool avoid_reset = FALSE; #endif int error = 0; @@ -871,26 +878,28 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c case SIOCSIFADDR: #ifdef INET - if (ifa->ifa_addr->sa_family == AF_INET) { - /* - * Since resetting hardware takes a very long time - * and results in link renegotiation we only - * initialize the hardware only when it is absolutely - * required. - */ + if (ifa->ifa_addr->sa_family == AF_INET) + avoid_reset = TRUE; +#endif +#ifdef INET6 + if (ifa->ifa_addr->sa_family == AF_INET6) + avoid_reset = TRUE; +#endif +#if defined(INET) || defined(INET6) + /* + ** Calling init results in link renegotiation, + ** so we avoid doing it when possible. + */ + if (avoid_reset) { ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - IXGBE_CORE_LOCK(adapter); - ixgbe_init_locked(adapter); - IXGBE_CORE_UNLOCK(adapter); - } + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + ixgbe_init(adapter); if (!(ifp->if_flags & IFF_NOARP)) arp_ifinit(ifp, ifa); } else -#endif error = ether_ioctl(ifp, command, data); break; - +#endif case SIOCSIFMTU: IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); if (ifr->ifr_mtu > IXGBE_MAX_FRAME_SIZE - ETHER_HDR_LEN) { @@ -951,6 +960,8 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if (mask & IFCAP_VLAN_HWFILTER) ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; + if (mask & IFCAP_VLAN_HWTSO) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { IXGBE_CORE_LOCK(adapter); ixgbe_init_locked(adapter); @@ -1338,7 +1349,7 @@ ixgbe_legacy_irq(void *arg) /********************************************************************* * - * MSI Queue Interrupt Service routine + * MSIX Queue Interrupt Service routine * **********************************************************************/ void @@ -1357,6 +1368,17 @@ ixgbe_msix_que(void *arg) IXGBE_TX_LOCK(txr); more_tx = ixgbe_txeof(txr); + /* + ** Make certain that if the stack + ** has anything queued the task gets + ** scheduled to handle it. + */ +#if __FreeBSD_version < 800000 + if (!IFQ_DRV_IS_EMPTY(&adapter->ifp->if_snd)) +#else + if (!drbr_empty(adapter->ifp, txr->br)) +#endif + more_tx = 1; IXGBE_TX_UNLOCK(txr); /* Do AIM now? */ @@ -1570,7 +1592,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m struct mbuf *m_head; bus_dma_segment_t segs[adapter->num_segs]; bus_dmamap_t map; - struct ixgbe_tx_buf *txbuf, *txbuf_mapped; + struct ixgbe_tx_buf *txbuf; union ixgbe_adv_tx_desc *txd = NULL; m_head = *m_headp; @@ -1589,7 +1611,6 @@ ixgbe_xmit(struct tx_ring *txr, struct m */ first = txr->next_avail_desc; txbuf = &txr->tx_buffers[first]; - txbuf_mapped = txbuf; map = txbuf->map; /* @@ -1708,6 +1729,8 @@ ixgbe_xmit(struct tx_ring *txr, struct m txr->next_avail_desc = i; txbuf->m_head = m_head; + /* Swap the dma map between the first and last descriptor */ + txr->tx_buffers[first].map = txbuf->map; txbuf->map = map; bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); @@ -2265,7 +2288,9 @@ ixgbe_setup_msix(struct adapter *adapter msi: msgs = pci_msi_count(dev); if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) - device_printf(adapter->dev,"Using MSI interrupt\n"); + device_printf(adapter->dev,"Using an MSI interrupt\n"); + else + device_printf(adapter->dev,"Using a Legacy interrupt\n"); return (msgs); } @@ -2412,19 +2437,21 @@ ixgbe_setup_interface(device_t dev, stru ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | IFCAP_VLAN_HWCSUM; - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; ifp->if_capabilities |= IFCAP_JUMBO_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING + | IFCAP_VLAN_HWTSO + | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; /* Don't enable LRO by default */ ifp->if_capabilities |= IFCAP_LRO; /* - ** Dont turn this on by default, if vlans are + ** Don't turn this on by default, if vlans are ** created on another pseudo device (eg. lagg) ** then vlan events are not passed thru, breaking ** operation, but with HW FILTER off it works. If - ** using vlans directly on the em driver you can + ** using vlans directly on the ixgbe driver you can ** enable this and get full hardware tag filtering. */ ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; @@ -5333,7 +5360,7 @@ ixgbe_add_rx_process_limit(struct adapte static int ixgbe_set_advertise(SYSCTL_HANDLER_ARGS) { - int error; + int error = 0; struct adapter *adapter; struct ixgbe_hw *hw; ixgbe_link_speed speed, last; Modified: head/sys/dev/ixgbe/ixv.c ============================================================================== --- head/sys/dev/ixgbe/ixv.c Wed Jun 1 22:56:02 2011 (r222587) +++ head/sys/dev/ixgbe/ixv.c Thu Jun 2 00:34:57 2011 (r222588) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -33,7 +33,8 @@ /*$FreeBSD$*/ #ifdef HAVE_KERNEL_OPTION_HEADERS -#include "opt_device_polling.h" +#include "opt_inet.h" +#include "opt_inet6.h" #endif #include "ixv.h" @@ -41,7 +42,7 @@ /********************************************************************* * Driver version *********************************************************************/ -char ixv_driver_version[] = "1.0.0"; +char ixv_driver_version[] = "1.0.1"; /********************************************************************* * PCI Device ID Table @@ -234,7 +235,7 @@ static u32 ixv_shadow_vfta[VFTA_SIZE]; * ixv_probe determines if the driver should be loaded on * adapter based on PCI vendor/device id of the adapter. * - * return 0 on success, positive on failure + * return BUS_PROBE_DEFAULT on success, positive on failure *********************************************************************/ static int @@ -271,7 +272,7 @@ ixv_probe(device_t dev) ixv_strings[ent->index], ixv_driver_version); device_set_desc_copy(dev, adapter_name); - return (0); + return (BUS_PROBE_DEFAULT); } ent++; } @@ -297,6 +298,11 @@ ixv_attach(device_t dev) INIT_DEBUGOUT("ixv_attach: begin"); + if (resource_disabled("ixgbe", device_get_unit(dev))) { + device_printf(dev, "Disabled by device hint\n"); + return (ENXIO); + } + /* Allocate, clear, and link in our adapter structure */ adapter = device_get_softc(dev); adapter->dev = adapter->osdep.dev = dev; @@ -690,10 +696,38 @@ ixv_ioctl(struct ifnet * ifp, u_long com { struct adapter *adapter = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; +#if defined(INET) || defined(INET6) + struct ifreq *ifa = (struct ifaddr *) data; + bool avoid_reset = FALSE; +#endif int error = 0; switch (command) { + case SIOCSIFADDR: +#ifdef INET + if (ifa->ifa_addr->sa_family == AF_INET) + avoid_reset = TRUE; +#endif +#ifdef INET6 + if (ifa->ifa_addr->sa_family == AF_INET6) + avoid_reset = TRUE; +#endif +#if defined(INET) || defined(INET6) + /* + ** Calling init results in link renegotiation, + ** so we avoid doing it when possible. + */ + if (avoid_reset) { + ifp->if_flags |= IFF_UP; + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + ixv_init(adapter); + if (!(ifp->if_flags & IFF_NOARP)) + arp_ifinit(ifp, ifa); + } else + error = ether_ioctl(ifp, command, data); + break; +#endif case SIOCSIFMTU: IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); if (ifr->ifr_mtu > IXV_MAX_FRAME_SIZE - ETHER_HDR_LEN) { @@ -1161,7 +1195,7 @@ ixv_xmit(struct tx_ring *txr, struct mbu struct mbuf *m_head; bus_dma_segment_t segs[32]; bus_dmamap_t map; - struct ixv_tx_buf *txbuf, *txbuf_mapped; + struct ixv_tx_buf *txbuf; union ixgbe_adv_tx_desc *txd = NULL; m_head = *m_headp; @@ -1180,7 +1214,6 @@ ixv_xmit(struct tx_ring *txr, struct mbu */ first = txr->next_avail_desc; txbuf = &txr->tx_buffers[first]; - txbuf_mapped = txbuf; map = txbuf->map; /* @@ -1283,6 +1316,7 @@ ixv_xmit(struct tx_ring *txr, struct mbu txr->next_avail_desc = i; txbuf->m_head = m_head; + txr->tx_buffers[first].map = txbuf->map; txbuf->map = map; bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); @@ -1820,11 +1854,15 @@ ixv_setup_interface(device_t dev, struct ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | IFCAP_VLAN_HWCSUM; - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_LRO; - + ifp->if_capabilities |= IFCAP_JUMBO_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING + | IFCAP_VLAN_HWTSO + | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; + /* Don't enable LRO by default */ + ifp->if_capabilities |= IFCAP_LRO; + /* * Specify the media types supported by this adapter and register * callbacks to update media and link information From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 00:43:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DF25106564A; Thu, 2 Jun 2011 00:43:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F4938FC0C; Thu, 2 Jun 2011 00:43:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p520hGTO093564; Thu, 2 Jun 2011 00:43:16 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p520hGZQ093560; Thu, 2 Jun 2011 00:43:16 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201106020043.p520hGZQ093560@svn.freebsd.org> From: Ed Maste Date: Thu, 2 Jun 2011 00:43:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222589 - in head: sys/dev/mfi usr.sbin/mfiutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 00:43:17 -0000 Author: emaste Date: Thu Jun 2 00:43:16 2011 New Revision: 222589 URL: http://svn.freebsd.org/changeset/base/222589 Log: There are a couple of structs in mfireg.h with members named 'class'. These cause problems when trying to include the header in a C++ project. Rename them to 'evt_class', and track the change in mfi and mfiutil. Submitted by: Mark Johnston Sponsored by: Sandvine Incorporated Reviewed by: jhb@ MFC after: 1 week Modified: head/sys/dev/mfi/mfi.c head/sys/dev/mfi/mfireg.h head/usr.sbin/mfiutil/mfi_evt.c Modified: head/sys/dev/mfi/mfi.c ============================================================================== --- head/sys/dev/mfi/mfi.c Thu Jun 2 00:34:57 2011 (r222588) +++ head/sys/dev/mfi/mfi.c Thu Jun 2 00:43:16 2011 (r222589) @@ -788,7 +788,7 @@ mfi_aen_setup(struct mfi_softc *sc, uint class_locale.members.reserved = 0; class_locale.members.locale = mfi_event_locale; - class_locale.members.class = mfi_event_class; + class_locale.members.evt_class = mfi_event_class; if (seq_start == 0) { error = mfi_get_log_state(sc, &log_state); @@ -1082,8 +1082,8 @@ mfi_decode_evt(struct mfi_softc *sc, str { device_printf(sc->mfi_dev, "%d (%s/0x%04x/%s) - %s\n", detail->seq, - format_timestamp(detail->time), detail->class.members.locale, - format_class(detail->class.members.class), detail->description); + format_timestamp(detail->time), detail->evt_class.members.locale, + format_class(detail->evt_class.members.evt_class), detail->description); } static int @@ -1099,16 +1099,16 @@ mfi_aen_register(struct mfi_softc *sc, i if (sc->mfi_aen_cm != NULL) { prior_aen.word = ((uint32_t *)&sc->mfi_aen_cm->cm_frame->dcmd.mbox)[1]; - if (prior_aen.members.class <= current_aen.members.class && + if (prior_aen.members.evt_class <= current_aen.members.evt_class && !((prior_aen.members.locale & current_aen.members.locale) ^current_aen.members.locale)) { return (0); } else { prior_aen.members.locale |= current_aen.members.locale; - if (prior_aen.members.class - < current_aen.members.class) - current_aen.members.class = - prior_aen.members.class; + if (prior_aen.members.evt_class + < current_aen.members.evt_class) + current_aen.members.evt_class = + prior_aen.members.evt_class; mfi_abort(sc, sc->mfi_aen_cm); } } @@ -1199,7 +1199,7 @@ mfi_parse_entries(struct mfi_softc *sc, class_locale.members.reserved = 0; class_locale.members.locale = mfi_event_locale; - class_locale.members.class = mfi_event_class; + class_locale.members.evt_class = mfi_event_class; size = sizeof(struct mfi_evt_list) + sizeof(struct mfi_evt_detail) * (MAX_EVENTS - 1); Modified: head/sys/dev/mfi/mfireg.h ============================================================================== --- head/sys/dev/mfi/mfireg.h Thu Jun 2 00:34:57 2011 (r222588) +++ head/sys/dev/mfi/mfireg.h Thu Jun 2 00:43:16 2011 (r222589) @@ -719,7 +719,7 @@ union mfi_evt { struct { uint16_t locale; uint8_t reserved; - int8_t class; + int8_t evt_class; } members; uint32_t word; } __packed; @@ -755,7 +755,7 @@ struct mfi_evt_detail { uint32_t seq; uint32_t time; uint32_t code; - union mfi_evt class; + union mfi_evt evt_class; uint8_t arg_type; uint8_t reserved1[15]; Modified: head/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_evt.c Thu Jun 2 00:34:57 2011 (r222588) +++ head/usr.sbin/mfiutil/mfi_evt.c Thu Jun 2 00:43:16 2011 (r222589) @@ -362,8 +362,8 @@ mfi_decode_evt(int fd, struct mfi_evt_de { printf("%5d (%s/%s/%s) - ", detail->seq, format_timestamp(detail->time), - format_locale(detail->class.members.locale), - format_class(detail->class.members.class)); + format_locale(detail->evt_class.members.locale), + format_class(detail->evt_class.members.evt_class)); switch (detail->arg_type) { case MR_EVT_ARGS_NONE: break; @@ -557,7 +557,7 @@ show_events(int ac, char **av) num_events = 15; filter.members.reserved = 0; filter.members.locale = MFI_EVT_LOCALE_ALL; - filter.members.class = MFI_EVT_CLASS_WARNING; + filter.members.evt_class = MFI_EVT_CLASS_WARNING; start = info.boot_seq_num; stop = info.newest_seq_num; verbose = 0; @@ -567,7 +567,7 @@ show_events(int ac, char **av) while ((ch = getopt(ac, av, "c:l:n:v")) != -1) { switch (ch) { case 'c': - if (parse_class(optarg, &filter.members.class) < 0) { + if (parse_class(optarg, &filter.members.evt_class) < 0) { error = errno; warn("Error parsing event class"); return (error); From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 05:02:48 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAE66106566B; Thu, 2 Jun 2011 05:02:48 +0000 (UTC) (envelope-from miwi.freebsd@googlemail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2AD298FC13; Thu, 2 Jun 2011 05:02:46 +0000 (UTC) Received: by bwz12 with SMTP id 12so943001bwz.13 for ; Wed, 01 Jun 2011 22:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:sender:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=8ZPYO87QjpMnTLJsIQujZYB5R8l5bygFc8b2nSd5HMo=; b=mc0Q3WcmS6xIrVP0G4Fu0gA2RzAD74Lo+6rRtkSwwCUCaRNpxgBPfHtx8zLFghvAxj BxiuafhwBSlT16bk4PwqaRTNQ1kJipPv7YaSguiSKjzCewdDjA7dFCrviinnAX96XQig UyDLNUttkaQhJFryl0hQEBO/LRUioR7CVDOkE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=EQAzMYqACHlV26LsnHqsYaKaJqvXUrddFfK+VOO6Z1VEVy5VzAy3AU+Vq2NkgLbrNP 62yqxsz75d/Pa7bVRMCxDduPYlP4JbNDTAwIvoPe5JaYJe6xrhU2ARdsPS6tgO8DaZ5r TPIma55ACmGXrhbuRQAnDjRVJOlKY9fi00OTA= MIME-Version: 1.0 Received: by 10.204.19.83 with SMTP id z19mr244347bka.191.1306989172693; Wed, 01 Jun 2011 21:32:52 -0700 (PDT) Sender: miwi.freebsd@googlemail.com Received: by 10.204.52.143 with HTTP; Wed, 1 Jun 2011 21:32:52 -0700 (PDT) In-Reply-To: <201106020034.p520YwBu093285@svn.freebsd.org> References: <201106020034.p520YwBu093285@svn.freebsd.org> Date: Thu, 2 Jun 2011 12:32:52 +0800 X-Google-Sender-Auth: A46ikokQs4p9so9_ny8IAF1t4jo Message-ID: From: Martin Wilke To: Jack F Vogel Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222588 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: miwi@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 05:02:48 -0000 that commit break the build .. -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-omit-frame-pointer -mno-sse -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror /usr/src/sys/dev/iwn/if_iwn.c cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-omit-frame-pointer -mno-sse -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror /usr/src/sys/dev/ixgbe/ixgbe.c -I/usr/src/sys/dev/ixgbe cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-omit-frame-pointer -mno-sse -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror /usr/src/sys/dev/ixgbe/ixv.c -I/usr/src/sys/dev/ixgbe cc1: warnings being treated as errors /usr/src/sys/dev/ixgbe/ixv.c: In function 'ixv_ioctl': /usr/src/sys/dev/ixgbe/ixv.c:700: warning: initialization from incompatible pointer type /usr/src/sys/dev/ixgbe/ixv.c:709: error: 'struct ifreq' has no member named 'ifa_addr' /usr/src/sys/dev/ixgbe/ixv.c:713: error: 'struct ifreq' has no member named 'ifa_addr' /usr/src/sys/dev/ixgbe/ixv.c:726: warning: passing argument 2 of 'arp_ifinit' from incompatible pointer type *** Error code 1 Stop in /usr/obj/usr/src/sys/GENERIC. *** Error code 1 Stop in /usr/src. *** Error code 1 On Thu, Jun 2, 2011 at 8:34 AM, Jack F Vogel wrote: > Author: jfv > Date: Thu Jun 2 00:34:57 2011 > New Revision: 222588 > URL: http://svn.freebsd.org/changeset/base/222588 > > Log: > First off: update the driver README, the old one was horribly > crusty, and this still isn't perfect, but its at least a bit > more recent. > > Secondly, a few improvements to the driver from Andrew Boyer, > support hint to allow devices to not attach, add VLAN_HWTSO > capability so vlans can use TSO, fix in the interrupt handler > to make sure the stack TX queue is processed. Oh, and also > make sure IPv6 does not cause a re-init in the ioctl routine. > Thanks for your efforts Andrew! > > Thanks to Claudio Jeker for noticing the ixgbe_xmit() routine > was not correctly swapping the dma map from the first to the > last descriptor in a multi-descriptor transmission, corrected > this. > > Modified: > head/sys/dev/ixgbe/LICENSE > head/sys/dev/ixgbe/README > head/sys/dev/ixgbe/ixgbe.c > head/sys/dev/ixgbe/ixv.c > > Modified: head/sys/dev/ixgbe/LICENSE > > ============================================================================== > --- head/sys/dev/ixgbe/LICENSE Wed Jun 1 22:56:02 2011 (r222587) > +++ head/sys/dev/ixgbe/LICENSE Thu Jun 2 00:34:57 2011 (r222588) > @@ -1,6 +1,6 @@ > > /****************************************************************************** > > - Copyright (c) 2001-2010, Intel Corporation > + Copyright (c) 2001-2011, Intel Corporation > All rights reserved. > > Redistribution and use in source and binary forms, with or without > > Modified: head/sys/dev/ixgbe/README > > ============================================================================== > --- head/sys/dev/ixgbe/README Wed Jun 1 22:56:02 2011 (r222587) > +++ head/sys/dev/ixgbe/README Thu Jun 2 00:34:57 2011 (r222588) > @@ -1,8 +1,8 @@ > -FreeBSD Driver for 10 Gigabit PCI Express Server Adapters > -============================================= > +FreeBSD Driver for Intel(R) Ethernet 10 Gigabit PCI Express Server > Adapters > > +============================================================================ > /*$FreeBSD$*/ > > -May 14, 2008 > +November 12, 2010 > > > Contents > @@ -11,15 +11,15 @@ Contents > - Overview > - Supported Adapters > - Building and Installation > -- Additional Configurations > +- Additional Configurations and Tuning > - Known Limitations > > > Overview > ======== > > -This file describes the FreeBSD* driver for the 10 Gigabit PCIE Family of > -Adapters. Drivers has been developed for use with FreeBSD 7 or later. > +This file describes the FreeBSD* driver for the Intel(R) Ethernet 10 > Gigabit > +Family of Adapters. Driver has been developed for use with FreeBSD 7.2 or > later. > > For questions related to hardware requirements, refer to the documentation > supplied with your Intel 10GbE adapter. All hardware requirements listed > @@ -29,100 +29,98 @@ apply to use with FreeBSD. > Supported Adapters > ================== > > -The following Intel network adapters are compatible with the drivers in > this > -release: > - > -Controller Adapter Name Physical Layer > ----------- ------------ -------------- > -82598EB Intel(R) 10 Gigabit XF SR/AF 10G Base -LR (850 nm optical > fiber) > - Dual Port Server Adapter 10G Base -SR (1310 nm > optical fiber) > -82598EB Intel(R) 10 Gigabit XF SR/LR > - Server Adapter > - Intel(R) 82598EB 10 Gigabit AF > - Network Connection > - Intel(R) 82598EB 10 Gigabit AT > - CX4 Network Connection > +The driver in this release is compatible with 82598 and 82599-based Intel > +Network Connections. > > +SFP+ Devices with Pluggable Optics > +---------------------------------- > > -Building and Installation > -========================= > - > -NOTE: You must have kernel sources installed in order to compile the > driver > - module. > - > - In the instructions below, x.x.x is the driver version as indicated > in > - the name of the driver tar. > - > -1. Move the base driver tar file to the directory of your choice. For > - example, use /home/username/ixgbe or /usr/local/src/ixgbe. > - > -2. Untar/unzip the archive: > - tar xfz ixgbe-x.x.x.tar.gz > - > -3. To install man page: > - cd ixgbe-x.x.x > - gzip -c ixgbe.4 > /usr/share/man/man4/ixgbee.4.gz > - > -4. To load the driver onto a running system: > - cd ixgbe-x.x.x/src > - make load > - > -5. To assign an IP address to the interface, enter the following: > - ifconfig ix > - > -6. Verify that the interface works. Enter the following, where > > - is the IP address for another machine on the same subnet as the > interface > - that is being tested: > - ping > - > -7. If you want the driver to load automatically when the system is booted: > - > - cd ixgbe-x.x.x/src > - make > - make install > - > - Edit /boot/loader.conf, and add the following line: > - ixgbe_load="YES" > - > - OR > - > - compile the driver into the kernel (see item 8). > - > - > - Edit /etc/rc.conf, and create the appropriate > ifconfig_ixgbe > - entry: > - > - ifconfig_ix="" > - > - Example usage: > - > - ifconfig_ix0="inet 192.168.10.1 netmask 255.255.255.0" > - > - NOTE: For assistance, see the ifconfig man page. > - > -8. If you want to compile the driver into the kernel, enter: > +82599-BASED ADAPTERS > > - FreeBSD 7 or later: > +NOTE: If your 82599-based Intel(R) Ethernet Network Adapter came with > Intel > +optics, or is an Intel(R) Ethernet Server Adapter X520-2, then it only > supports > +Intel optics and/or the direct attach cables listed below. > > - cd ixgbe-x.x.x/src > - > - cp *.[ch] /usr/src/sys/dev/ixgbe > - > - cp Makefile.kernel /usr/src/sys/modules/ixgbe/Makefile > - > - Edit the kernel configuration file (i.e., GENERIC or MYKERNEL) in > - /usr/src/sys/i386/conf (replace "i386" with the appropriate system > - architecture if necessary), and ensure the following line is present: > - > - device ixgbe > - > - Compile and install the kernel. The system must be reboot for the > kernel > - updates to take affect. For additional information on compiling the > kernel, > - consult the FreeBSD operating system documentation. > +When 82599-based SFP+ devices are connected back to back, they should be > set to > +the same Speed setting via Ethtool. Results may vary if you mix speed > settings. > + > +Supplier Type Part Numbers > > +SR Modules > +Intel DUAL RATE 1G/10G SFP+ SR (bailed) > FTLX8571D3BCV-IT > +Intel DUAL RATE 1G/10G SFP+ SR (bailed) > AFBR-703SDZ-IN2 > +Intel DUAL RATE 1G/10G SFP+ SR (bailed) > AFBR-703SDDZ-IN1 > +LR Modules > +Intel DUAL RATE 1G/10G SFP+ LR (bailed) > FTLX1471D3BCV-IT > +Intel DUAL RATE 1G/10G SFP+ LR (bailed) > AFCT-701SDZ-IN2 > +Intel DUAL RATE 1G/10G SFP+ LR (bailed) > AFCT-701SDDZ-IN1 > + > +The following is a list of 3rd party SFP+ modules and direct attach cables > that > +have received some testing. Not all modules are applicable to all devices. > + > +Supplier Type Part Numbers > + > +Finisar SFP+ SR bailed, 10g single rate FTLX8571D3BCL > +Avago SFP+ SR bailed, 10g single rate AFBR-700SDZ > +Finisar SFP+ LR bailed, 10g single rate > FTLX8571D3BCV-IT > + > +Finisar DUAL RATE 1G/10G SFP+ SR (No Bail) > FTLX8571D3QCV-IT > +Avago DUAL RATE 1G/10G SFP+ SR (No Bail) > AFBR-703SDZ-IN1 > +Finisar DUAL RATE 1G/10G SFP+ LR (No Bail) > FTLX1471D3QCV-IT > +Avago DUAL RATE 1G/10G SFP+ LR (No Bail) > AFCT-701SDZ-IN1 > +Finistar 1000BASE-T SFP FCLF8522P2BTL > +Avago 1000BASE-T SFP ABCU-5710RZ > + > +82599-based adapters support all passive and active limiting direct attach > +cables that comply with SFF-8431 v4.1 and SFF-8472 v10.4 specifications. > + > +Laser turns off for SFP+ when ifconfig down > +-------------------------------------------------------- > +"ifconfig down" turns off the laser for 82599-based SFP+ fiber adapters. > +"ifconfig up" turns on the later. > + > +82598-BASED ADAPTERS > + > +NOTES for 82598-Based Adapters: > +- Intel(R) Ethernet Network Adapters that support removable optical > modules > + only support their original module type (i.e., the Intel(R) 10 Gigabit > SR > + Dual Port Express Module only supports SR optical modules). If you plug > + in a different type of module, the driver will not load. > +- Hot Swapping/hot plugging optical modules is not supported. > +- Only single speed, 10 gigabit modules are supported. > +- LAN on Motherboard (LOMs) may support DA, SR, or LR modules. Other > module > + types are not supported. Please see your system documentation for > details. > + > +The following is a list of 3rd party SFP+ modules and direct attach cables > that have > +received some testing. Not all modules are applicable to all devices. > + > +Supplier Type Part Numbers > + > +Finisar SFP+ SR bailed, 10g single rate FTLX8571D3BCL > +Avago SFP+ SR bailed, 10g single rate AFBR-700SDZ > +Finisar SFP+ LR bailed, 10g single rate FTLX1471D3BCL > + > +82598-based adapters support all passive direct attach cables that comply > +with SFF-8431 v4.1 and SFF-8472 v10.4 specifications. Active direct attach > +cables are not supported. > + > +Third party optic modules and cables referred to above are listed only for > the > +purpose of highlighting third party specifications and potential > compatibility, > +and are not recommendations or endorsements or sponsorship of any third > party's > +product by Intel. Intel is not endorsing or promoting products made by any > +third party and the third party reference is provided only to share > information > +regarding certain optic modules and cables with the above specifications. > There > +may be other manufacturers or suppliers, producing or supplying optic > modules > +and cables with similar or matching descriptions. Customers must use their > own > +discretion and diligence to purchase optic modules and cables from any > third > +party of their choice. Customer are solely responsible for assessing the > +suitability of the product and/or devices and for the selection of the > vendor > +for purchasing any product. INTEL ASSUMES NO LIABILITY WHATSOEVER, AND > INTEL > +DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF > +SUCH THIRD PARTY PRODUCTS OR SELECTION OF VENDOR BY CUSTOMERS. > > Configuration and Tuning > -========================= > +======================== > > The driver supports Transmit/Receive Checksum Offload and Jumbo Frames on > all 10 Gigabit adapters. > @@ -143,7 +141,7 @@ all 10 Gigabit adapters. > The Jumbo Frames MTU range for Intel Adapters is 1500 to 16114. The > default > MTU range is 1500. To modify the setting, enter the following: > > - ifconfig ix mtu 9000 > + ifconfig ix mtu 9000 > > To confirm an interface's MTU value, use the ifconfig command. To confirm > the MTU used between two specific devices, use: > @@ -200,6 +198,8 @@ all 10 Gigabit adapters. > TSO > --- > > + TSO is enabled by default. > + > To disable: > > ifconfig -tso > @@ -209,23 +209,21 @@ all 10 Gigabit adapters. > ifconfig tso > > LRO > - ___ > + --- > > - Large Receive Offload is available in version 1.4.4, it is on > - by default. It can be toggled off and on by using: > - sysctl dev.ix.X.enable_lro=[0,1] > - > - NOTE: when changing this feature you MUST be sure the interface > - is reinitialized, it is easy to do this with ifconfig down/up. > - The LRO code will ultimately move into the kernel stack code, > - but for this first release it was included with the driver. > + Large Receive Offload is available in the driver; it is on by default. > + It can be disabled by using: > + ifconfig -lro > + To enable: > + ifconfig lro > + > > Important system configuration changes: > --------------------------------------- > > - When there is a choice run on a 64bit OS rather than 32, it makes > - a significant difference in improvement. > - > + When there is a choice run on a 64bit OS rather than 32, it makes a > + significant difference in improvement. > + > The default scheduler SCHED_4BSD is not smart about SMP locality issues. > Significant improvement can be achieved by switching to the ULE > scheduler. > > @@ -233,34 +231,79 @@ all 10 Gigabit adapters. > SCHED_ULE. Note that this is only advisable on FreeBSD 7, on 6.X there > have > been stability problems with ULE. > > - Change the file /etc/sysctl.conf, add the line: > + The interface can generate high number of interrupts. To avoid running > + into the limit set by the kernel, adjust hw.intr_storm_threshold > + setting using sysctl: > > - hw.intr_storm_threshold: 8000 (the default is 1000) > + sysctl hw.intr_storm_threshold=9000 (the default is 1000) > + > + For this change to take effect on boot, edit /etc/sysctl.conf and add > the > + line: > + hw.intr_storm_threshold=9000 > + > + If you still see Interrupt Storm detected messages, increase the limit > to a > + higher number. > > Best throughput results are seen with a large MTU; use 9000 if possible. > > - The default number of descriptors is 256, increasing this to 1024 or > even > - 2048 may improve performance. > + The default number of descriptors is 1024, increasing this to 2K or even > + 4K may improve performance in some workloads, but change carefully. > > > Known Limitations > ================= > + > +For known hardware and troubleshooting issues, refer to the following > website. > + > + http://support.intel.com/support/go/network/adapter/home.htm > + > +Either select the link for your adapter or perform a search for the > adapter > +number. The adapter's page lists many issues. For a complete list of > hardware > +issues download your adapter's user guide and read the Release Notes. > + > + UDP stress test with 10GbE driver > + --------------------------------- > Under small packets UDP stress test with 10GbE driver, the FreeBSD system > will drop UDP packets due to the fullness of socket buffers. You may want > to change the driver's Flow Control variables to the minimum value for > controlling packet reception. > > + Attempting to configure larger MTUs with a large numbers of processors > may > + generate the error message "ix0:could not setup receive structures" > + > -------------------------------------------------------------------------- > + When using the ixgbe driver with RSS autoconfigured based on the number > of > + cores (the default setting) and that number is larger than 4, increase > the > + memory resources allocated for the mbuf pool as follows: > + > + Add to the sysctl.conf file for the system: > + > + kern.ipc.nmbclusters=262144 > + kern.ipc.nmbjumbop=262144 > + > + Lower than expected performance on dual port 10GbE devices > + ---------------------------------------------------------- > + Some PCI-E x8 slots are actually configured as x4 slots. These slots > have > + insufficient bandwidth for full 10Gbe line rate with dual port 10GbE > devices. > + The driver can detect this situation and will write the following > message in > + the system log: "PCI-Express bandwidth available for this card is not > + sufficient for optimal performance. For optimal performance a x8 > PCI-Express > + slot is required." > + > + If this error occurs, moving your adapter to a true x8 slot will resolve > the > + issue. > + > + > > Support > ======= > > For general information and support, go to the Intel support website at: > > - http://support.intel.com > + www.intel.com/support/ > > If an issue is identified with the released source code on the supported > kernel with a supported adapter, email the specific information related to > -the issue to freebsd@intel.com. > +the issue to freebsd@intel.com > > > > > Modified: head/sys/dev/ixgbe/ixgbe.c > > ============================================================================== > --- head/sys/dev/ixgbe/ixgbe.c Wed Jun 1 22:56:02 2011 (r222587) > +++ head/sys/dev/ixgbe/ixgbe.c Thu Jun 2 00:34:57 2011 (r222588) > @@ -34,6 +34,7 @@ > > #ifdef HAVE_KERNEL_OPTION_HEADERS > #include "opt_inet.h" > +#include "opt_inet6.h" > #endif > > #include "ixgbe.h" > @@ -46,7 +47,7 @@ int ixgbe_display_debug_stat > /********************************************************************* > * Driver version > *********************************************************************/ > -char ixgbe_driver_version[] = "2.3.10"; > +char ixgbe_driver_version[] = "2.3.11"; > > /********************************************************************* > * PCI Device ID Table > @@ -318,7 +319,7 @@ static int fdir_pballoc = 1; > * ixgbe_probe determines if the driver should be loaded on > * adapter based on PCI vendor/device id of the adapter. > * > - * return 0 on success, positive on failure > + * return BUS_PROBE_DEFAULT on success, positive on failure > *********************************************************************/ > > static int > @@ -357,7 +358,7 @@ ixgbe_probe(device_t dev) > ixgbe_driver_version); > device_set_desc_copy(dev, adapter_name); > ++ixgbe_total_ports; > - return (0); > + return (BUS_PROBE_DEFAULT); > } > ent++; > } > @@ -385,6 +386,11 @@ ixgbe_attach(device_t dev) > > INIT_DEBUGOUT("ixgbe_attach: begin"); > > + if (resource_disabled("ixgbe", device_get_unit(dev))) { > + device_printf(dev, "Disabled by device hint\n"); > + return (ENXIO); > + } > + > /* Allocate, clear, and link in our adapter structure */ > adapter = device_get_softc(dev); > adapter->dev = adapter->osdep.dev = dev; > @@ -862,8 +868,9 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c > { > struct adapter *adapter = ifp->if_softc; > struct ifreq *ifr = (struct ifreq *) data; > -#ifdef INET > +#if defined(INET) || defined(INET6) > struct ifaddr *ifa = (struct ifaddr *)data; > + bool avoid_reset = FALSE; > #endif > int error = 0; > > @@ -871,26 +878,28 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c > > case SIOCSIFADDR: > #ifdef INET > - if (ifa->ifa_addr->sa_family == AF_INET) { > - /* > - * Since resetting hardware takes a very long time > - * and results in link renegotiation we only > - * initialize the hardware only when it is > absolutely > - * required. > - */ > + if (ifa->ifa_addr->sa_family == AF_INET) > + avoid_reset = TRUE; > +#endif > +#ifdef INET6 > + if (ifa->ifa_addr->sa_family == AF_INET6) > + avoid_reset = TRUE; > +#endif > +#if defined(INET) || defined(INET6) > + /* > + ** Calling init results in link renegotiation, > + ** so we avoid doing it when possible. > + */ > + if (avoid_reset) { > ifp->if_flags |= IFF_UP; > - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { > - IXGBE_CORE_LOCK(adapter); > - ixgbe_init_locked(adapter); > - IXGBE_CORE_UNLOCK(adapter); > - } > + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) > + ixgbe_init(adapter); > if (!(ifp->if_flags & IFF_NOARP)) > arp_ifinit(ifp, ifa); > } else > -#endif > error = ether_ioctl(ifp, command, data); > break; > - > +#endif > case SIOCSIFMTU: > IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); > if (ifr->ifr_mtu > IXGBE_MAX_FRAME_SIZE - ETHER_HDR_LEN) { > @@ -951,6 +960,8 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c > ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; > if (mask & IFCAP_VLAN_HWFILTER) > ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; > + if (mask & IFCAP_VLAN_HWTSO) > + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; > if (ifp->if_drv_flags & IFF_DRV_RUNNING) { > IXGBE_CORE_LOCK(adapter); > ixgbe_init_locked(adapter); > @@ -1338,7 +1349,7 @@ ixgbe_legacy_irq(void *arg) > > /********************************************************************* > * > - * MSI Queue Interrupt Service routine > + * MSIX Queue Interrupt Service routine > * > **********************************************************************/ > void > @@ -1357,6 +1368,17 @@ ixgbe_msix_que(void *arg) > > IXGBE_TX_LOCK(txr); > more_tx = ixgbe_txeof(txr); > + /* > + ** Make certain that if the stack > + ** has anything queued the task gets > + ** scheduled to handle it. > + */ > +#if __FreeBSD_version < 800000 > + if (!IFQ_DRV_IS_EMPTY(&adapter->ifp->if_snd)) > +#else > + if (!drbr_empty(adapter->ifp, txr->br)) > +#endif > + more_tx = 1; > IXGBE_TX_UNLOCK(txr); > > /* Do AIM now? */ > @@ -1570,7 +1592,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m > struct mbuf *m_head; > bus_dma_segment_t segs[adapter->num_segs]; > bus_dmamap_t map; > - struct ixgbe_tx_buf *txbuf, *txbuf_mapped; > + struct ixgbe_tx_buf *txbuf; > union ixgbe_adv_tx_desc *txd = NULL; > > m_head = *m_headp; > @@ -1589,7 +1611,6 @@ ixgbe_xmit(struct tx_ring *txr, struct m > */ > first = txr->next_avail_desc; > txbuf = &txr->tx_buffers[first]; > - txbuf_mapped = txbuf; > map = txbuf->map; > > /* > @@ -1708,6 +1729,8 @@ ixgbe_xmit(struct tx_ring *txr, struct m > txr->next_avail_desc = i; > > txbuf->m_head = m_head; > + /* Swap the dma map between the first and last descriptor */ > + txr->tx_buffers[first].map = txbuf->map; > txbuf->map = map; > bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); > > @@ -2265,7 +2288,9 @@ ixgbe_setup_msix(struct adapter *adapter > msi: > msgs = pci_msi_count(dev); > if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) > - device_printf(adapter->dev,"Using MSI > interrupt\n"); > + device_printf(adapter->dev,"Using an MSI > interrupt\n"); > + else > + device_printf(adapter->dev,"Using a Legacy > interrupt\n"); > return (msgs); > } > > @@ -2412,19 +2437,21 @@ ixgbe_setup_interface(device_t dev, stru > ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); > > ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | > IFCAP_VLAN_HWCSUM; > - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; > ifp->if_capabilities |= IFCAP_JUMBO_MTU; > + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING > + | IFCAP_VLAN_HWTSO > + | IFCAP_VLAN_MTU; > ifp->if_capenable = ifp->if_capabilities; > > /* Don't enable LRO by default */ > ifp->if_capabilities |= IFCAP_LRO; > > /* > - ** Dont turn this on by default, if vlans are > + ** Don't turn this on by default, if vlans are > ** created on another pseudo device (eg. lagg) > ** then vlan events are not passed thru, breaking > ** operation, but with HW FILTER off it works. If > - ** using vlans directly on the em driver you can > + ** using vlans directly on the ixgbe driver you can > ** enable this and get full hardware tag filtering. > */ > ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; > @@ -5333,7 +5360,7 @@ ixgbe_add_rx_process_limit(struct adapte > static int > ixgbe_set_advertise(SYSCTL_HANDLER_ARGS) > { > - int error; > + int error = 0; > struct adapter *adapter; > struct ixgbe_hw *hw; > ixgbe_link_speed speed, last; > > Modified: head/sys/dev/ixgbe/ixv.c > > ============================================================================== > --- head/sys/dev/ixgbe/ixv.c Wed Jun 1 22:56:02 2011 (r222587) > +++ head/sys/dev/ixgbe/ixv.c Thu Jun 2 00:34:57 2011 (r222588) > @@ -1,6 +1,6 @@ > > /****************************************************************************** > > - Copyright (c) 2001-2010, Intel Corporation > + Copyright (c) 2001-2011, Intel Corporation > All rights reserved. > > Redistribution and use in source and binary forms, with or without > @@ -33,7 +33,8 @@ > /*$FreeBSD$*/ > > #ifdef HAVE_KERNEL_OPTION_HEADERS > -#include "opt_device_polling.h" > +#include "opt_inet.h" > +#include "opt_inet6.h" > #endif > > #include "ixv.h" > @@ -41,7 +42,7 @@ > /********************************************************************* > * Driver version > *********************************************************************/ > -char ixv_driver_version[] = "1.0.0"; > +char ixv_driver_version[] = "1.0.1"; > > /********************************************************************* > * PCI Device ID Table > @@ -234,7 +235,7 @@ static u32 ixv_shadow_vfta[VFTA_SIZE]; > * ixv_probe determines if the driver should be loaded on > * adapter based on PCI vendor/device id of the adapter. > * > - * return 0 on success, positive on failure > + * return BUS_PROBE_DEFAULT on success, positive on failure > *********************************************************************/ > > static int > @@ -271,7 +272,7 @@ ixv_probe(device_t dev) > ixv_strings[ent->index], > ixv_driver_version); > device_set_desc_copy(dev, adapter_name); > - return (0); > + return (BUS_PROBE_DEFAULT); > } > ent++; > } > @@ -297,6 +298,11 @@ ixv_attach(device_t dev) > > INIT_DEBUGOUT("ixv_attach: begin"); > > + if (resource_disabled("ixgbe", device_get_unit(dev))) { > + device_printf(dev, "Disabled by device hint\n"); > + return (ENXIO); > + } > + > /* Allocate, clear, and link in our adapter structure */ > adapter = device_get_softc(dev); > adapter->dev = adapter->osdep.dev = dev; > @@ -690,10 +696,38 @@ ixv_ioctl(struct ifnet * ifp, u_long com > { > struct adapter *adapter = ifp->if_softc; > struct ifreq *ifr = (struct ifreq *) data; > +#if defined(INET) || defined(INET6) > + struct ifreq *ifa = (struct ifaddr *) data; > + bool avoid_reset = FALSE; > +#endif > int error = 0; > > switch (command) { > > + case SIOCSIFADDR: > +#ifdef INET > + if (ifa->ifa_addr->sa_family == AF_INET) > + avoid_reset = TRUE; > +#endif > +#ifdef INET6 > + if (ifa->ifa_addr->sa_family == AF_INET6) > + avoid_reset = TRUE; > +#endif > +#if defined(INET) || defined(INET6) > + /* > + ** Calling init results in link renegotiation, > + ** so we avoid doing it when possible. > + */ > + if (avoid_reset) { > + ifp->if_flags |= IFF_UP; > + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) > + ixv_init(adapter); > + if (!(ifp->if_flags & IFF_NOARP)) > + arp_ifinit(ifp, ifa); > + } else > + error = ether_ioctl(ifp, command, data); > + break; > +#endif > case SIOCSIFMTU: > IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); > if (ifr->ifr_mtu > IXV_MAX_FRAME_SIZE - ETHER_HDR_LEN) { > @@ -1161,7 +1195,7 @@ ixv_xmit(struct tx_ring *txr, struct mbu > struct mbuf *m_head; > bus_dma_segment_t segs[32]; > bus_dmamap_t map; > - struct ixv_tx_buf *txbuf, *txbuf_mapped; > + struct ixv_tx_buf *txbuf; > union ixgbe_adv_tx_desc *txd = NULL; > > m_head = *m_headp; > @@ -1180,7 +1214,6 @@ ixv_xmit(struct tx_ring *txr, struct mbu > */ > first = txr->next_avail_desc; > txbuf = &txr->tx_buffers[first]; > - txbuf_mapped = txbuf; > map = txbuf->map; > > /* > @@ -1283,6 +1316,7 @@ ixv_xmit(struct tx_ring *txr, struct mbu > txr->next_avail_desc = i; > > txbuf->m_head = m_head; > + txr->tx_buffers[first].map = txbuf->map; > txbuf->map = map; > bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); > > @@ -1820,11 +1854,15 @@ ixv_setup_interface(device_t dev, struct > ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); > > ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | > IFCAP_VLAN_HWCSUM; > - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; > - ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_LRO; > - > + ifp->if_capabilities |= IFCAP_JUMBO_MTU; > + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING > + | IFCAP_VLAN_HWTSO > + | IFCAP_VLAN_MTU; > ifp->if_capenable = ifp->if_capabilities; > > + /* Don't enable LRO by default */ > + ifp->if_capabilities |= IFCAP_LRO; > + > /* > * Specify the media types supported by this adapter and register > * callbacks to update media and link information > -- +-----------------oOO--(_)--OOo-------------------------+ With best Regards, Martin Wilke (miwi_(at)_FreeBSD.org) Mess with the Best, Die like the Rest From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 05:15:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65B2C106566B; Thu, 2 Jun 2011 05:15:22 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 975768FC0C; Thu, 2 Jun 2011 05:15:20 +0000 (UTC) Received: by vws18 with SMTP id 18so541091vws.13 for ; Wed, 01 Jun 2011 22:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=TH2zZ0xVqN5NgL72uhrjQTqS6NGyVkQ7PANScuwpqio=; b=MiboS1YvIABZlxY3vGGPa4PS20C3wyebvMbGvgbccbLF0LuOT76c1YCE+wmygeY7U3 y9JKoXMVk2fniy79xUAUNn7StEclu4J9VUqSW21M07xWbKJ/2TJiu4Cp6Vqp/WawWM1K RdNcLYZmMwyxNsRKqldWRVeJWCLYlbUDqPcDY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=CWERawS6nHcnJ963pnKr3Oz6M1RqnN1WQmDz9+rwrFy/CxPwADN2wV0wXMfF6pc/wE 21YYuB7rKcU/IUYIrg5WEh3vJ3jRfEpCxdhW1ed3yYp2Q/R5ZtmZZCw9FDUkUy3tf0Ak N4m+ZJZQTTnQcyVZ5sPZqLZGQxYMYnLVI52As= MIME-Version: 1.0 Received: by 10.52.97.101 with SMTP id dz5mr424887vdb.18.1306991719590; Wed, 01 Jun 2011 22:15:19 -0700 (PDT) Received: by 10.52.107.97 with HTTP; Wed, 1 Jun 2011 22:15:19 -0700 (PDT) In-Reply-To: References: <201106020034.p520YwBu093285@svn.freebsd.org> Date: Wed, 1 Jun 2011 22:15:19 -0700 Message-ID: From: Jack Vogel To: miwi@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Jack F Vogel , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222588 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 05:15:22 -0000 Opps, will fix directly, forgot about a last minute change to ixv.c Jack On Wed, Jun 1, 2011 at 9:32 PM, Martin Wilke wrote: > that commit break the build .. > > -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs > -fdiagnostics-show-option -nostdinc -I. -I/usr/src/sys > -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include > opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 > --param large-function-growth=1000 -fno-omit-frame-pointer -mno-sse > -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float > -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror > /usr/src/sys/dev/iwn/if_iwn.c > cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -g -Wall > -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes > -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign > -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option > -nostdinc -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common > -finline-limit=8000 --param inline-unit-growth=100 --param > large-function-growth=1000 -fno-omit-frame-pointer -mno-sse -mcmodel=kernel > -mno-red-zone -mno-mmx -msoft-float -fno-asynchronous-unwind-tables > -ffreestanding -fstack-protector -Werror /usr/src/sys/dev/ixgbe/ixgbe.c > -I/usr/src/sys/dev/ixgbe > cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -g -Wall > -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes > -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign > -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option > -nostdinc -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common > -finline-limit=8000 --param inline-unit-growth=100 --param > large-function-growth=1000 -fno-omit-frame-pointer -mno-sse -mcmodel=kernel > -mno-red-zone -mno-mmx -msoft-float -fno-asynchronous-unwind-tables > -ffreestanding -fstack-protector -Werror /usr/src/sys/dev/ixgbe/ixv.c > -I/usr/src/sys/dev/ixgbe > cc1: warnings being treated as errors > /usr/src/sys/dev/ixgbe/ixv.c: In function 'ixv_ioctl': > /usr/src/sys/dev/ixgbe/ixv.c:700: warning: initialization from incompatible > pointer type > /usr/src/sys/dev/ixgbe/ixv.c:709: error: 'struct ifreq' has no member named > 'ifa_addr' > /usr/src/sys/dev/ixgbe/ixv.c:713: error: 'struct ifreq' has no member named > 'ifa_addr' > /usr/src/sys/dev/ixgbe/ixv.c:726: warning: passing argument 2 of > 'arp_ifinit' from incompatible pointer type > *** Error code 1 > > Stop in /usr/obj/usr/src/sys/GENERIC. > *** Error code 1 > > Stop in /usr/src. > *** Error code 1 > > > > On Thu, Jun 2, 2011 at 8:34 AM, Jack F Vogel wrote: > >> Author: jfv >> Date: Thu Jun 2 00:34:57 2011 >> New Revision: 222588 >> URL: http://svn.freebsd.org/changeset/base/222588 >> >> Log: >> First off: update the driver README, the old one was horribly >> crusty, and this still isn't perfect, but its at least a bit >> more recent. >> >> Secondly, a few improvements to the driver from Andrew Boyer, >> support hint to allow devices to not attach, add VLAN_HWTSO >> capability so vlans can use TSO, fix in the interrupt handler >> to make sure the stack TX queue is processed. Oh, and also >> make sure IPv6 does not cause a re-init in the ioctl routine. >> Thanks for your efforts Andrew! >> >> Thanks to Claudio Jeker for noticing the ixgbe_xmit() routine >> was not correctly swapping the dma map from the first to the >> last descriptor in a multi-descriptor transmission, corrected >> this. >> >> Modified: >> head/sys/dev/ixgbe/LICENSE >> head/sys/dev/ixgbe/README >> head/sys/dev/ixgbe/ixgbe.c >> head/sys/dev/ixgbe/ixv.c >> >> Modified: head/sys/dev/ixgbe/LICENSE >> >> ============================================================================== >> --- head/sys/dev/ixgbe/LICENSE Wed Jun 1 22:56:02 2011 (r222587) >> +++ head/sys/dev/ixgbe/LICENSE Thu Jun 2 00:34:57 2011 (r222588) >> @@ -1,6 +1,6 @@ >> >> /****************************************************************************** >> >> - Copyright (c) 2001-2010, Intel Corporation >> + Copyright (c) 2001-2011, Intel Corporation >> All rights reserved. >> >> Redistribution and use in source and binary forms, with or without >> >> Modified: head/sys/dev/ixgbe/README >> >> ============================================================================== >> --- head/sys/dev/ixgbe/README Wed Jun 1 22:56:02 2011 (r222587) >> +++ head/sys/dev/ixgbe/README Thu Jun 2 00:34:57 2011 (r222588) >> @@ -1,8 +1,8 @@ >> -FreeBSD Driver for 10 Gigabit PCI Express Server Adapters >> -============================================= >> +FreeBSD Driver for Intel(R) Ethernet 10 Gigabit PCI Express Server >> Adapters >> >> +============================================================================ >> /*$FreeBSD$*/ >> >> -May 14, 2008 >> +November 12, 2010 >> >> >> Contents >> @@ -11,15 +11,15 @@ Contents >> - Overview >> - Supported Adapters >> - Building and Installation >> -- Additional Configurations >> +- Additional Configurations and Tuning >> - Known Limitations >> >> >> Overview >> ======== >> >> -This file describes the FreeBSD* driver for the 10 Gigabit PCIE Family of >> -Adapters. Drivers has been developed for use with FreeBSD 7 or later. >> +This file describes the FreeBSD* driver for the Intel(R) Ethernet 10 >> Gigabit >> +Family of Adapters. Driver has been developed for use with FreeBSD 7.2 >> or later. >> >> For questions related to hardware requirements, refer to the >> documentation >> supplied with your Intel 10GbE adapter. All hardware requirements listed >> @@ -29,100 +29,98 @@ apply to use with FreeBSD. >> Supported Adapters >> ================== >> >> -The following Intel network adapters are compatible with the drivers in >> this >> -release: >> - >> -Controller Adapter Name Physical Layer >> ----------- ------------ -------------- >> -82598EB Intel(R) 10 Gigabit XF SR/AF 10G Base -LR (850 nm >> optical fiber) >> - Dual Port Server Adapter 10G Base -SR (1310 nm >> optical fiber) >> -82598EB Intel(R) 10 Gigabit XF SR/LR >> - Server Adapter >> - Intel(R) 82598EB 10 Gigabit AF >> - Network Connection >> - Intel(R) 82598EB 10 Gigabit AT >> - CX4 Network Connection >> +The driver in this release is compatible with 82598 and 82599-based Intel >> +Network Connections. >> >> +SFP+ Devices with Pluggable Optics >> +---------------------------------- >> >> -Building and Installation >> -========================= >> - >> -NOTE: You must have kernel sources installed in order to compile the >> driver >> - module. >> - >> - In the instructions below, x.x.x is the driver version as indicated >> in >> - the name of the driver tar. >> - >> -1. Move the base driver tar file to the directory of your choice. For >> - example, use /home/username/ixgbe or /usr/local/src/ixgbe. >> - >> -2. Untar/unzip the archive: >> - tar xfz ixgbe-x.x.x.tar.gz >> - >> -3. To install man page: >> - cd ixgbe-x.x.x >> - gzip -c ixgbe.4 > /usr/share/man/man4/ixgbee.4.gz >> - >> -4. To load the driver onto a running system: >> - cd ixgbe-x.x.x/src >> - make load >> - >> -5. To assign an IP address to the interface, enter the following: >> - ifconfig ix >> - >> -6. Verify that the interface works. Enter the following, where >> >> - is the IP address for another machine on the same subnet as the >> interface >> - that is being tested: >> - ping >> - >> -7. If you want the driver to load automatically when the system is >> booted: >> - >> - cd ixgbe-x.x.x/src >> - make >> - make install >> - >> - Edit /boot/loader.conf, and add the following line: >> - ixgbe_load="YES" >> - >> - OR >> - >> - compile the driver into the kernel (see item 8). >> - >> - >> - Edit /etc/rc.conf, and create the appropriate >> ifconfig_ixgbe >> - entry: >> - >> - ifconfig_ix="" >> - >> - Example usage: >> - >> - ifconfig_ix0="inet 192.168.10.1 netmask 255.255.255.0" >> - >> - NOTE: For assistance, see the ifconfig man page. >> - >> -8. If you want to compile the driver into the kernel, enter: >> +82599-BASED ADAPTERS >> >> - FreeBSD 7 or later: >> +NOTE: If your 82599-based Intel(R) Ethernet Network Adapter came with >> Intel >> +optics, or is an Intel(R) Ethernet Server Adapter X520-2, then it only >> supports >> +Intel optics and/or the direct attach cables listed below. >> >> - cd ixgbe-x.x.x/src >> - >> - cp *.[ch] /usr/src/sys/dev/ixgbe >> - >> - cp Makefile.kernel /usr/src/sys/modules/ixgbe/Makefile >> - >> - Edit the kernel configuration file (i.e., GENERIC or MYKERNEL) in >> - /usr/src/sys/i386/conf (replace "i386" with the appropriate system >> - architecture if necessary), and ensure the following line is >> present: >> - >> - device ixgbe >> - >> - Compile and install the kernel. The system must be reboot for the >> kernel >> - updates to take affect. For additional information on compiling the >> kernel, >> - consult the FreeBSD operating system documentation. >> +When 82599-based SFP+ devices are connected back to back, they should be >> set to >> +the same Speed setting via Ethtool. Results may vary if you mix speed >> settings. >> + >> +Supplier Type Part Numbers >> >> +SR Modules >> +Intel DUAL RATE 1G/10G SFP+ SR (bailed) >> FTLX8571D3BCV-IT >> +Intel DUAL RATE 1G/10G SFP+ SR (bailed) >> AFBR-703SDZ-IN2 >> +Intel DUAL RATE 1G/10G SFP+ SR (bailed) >> AFBR-703SDDZ-IN1 >> +LR Modules >> +Intel DUAL RATE 1G/10G SFP+ LR (bailed) >> FTLX1471D3BCV-IT >> +Intel DUAL RATE 1G/10G SFP+ LR (bailed) >> AFCT-701SDZ-IN2 >> +Intel DUAL RATE 1G/10G SFP+ LR (bailed) >> AFCT-701SDDZ-IN1 >> + >> +The following is a list of 3rd party SFP+ modules and direct attach >> cables that >> +have received some testing. Not all modules are applicable to all >> devices. >> + >> +Supplier Type Part Numbers >> + >> +Finisar SFP+ SR bailed, 10g single rate >> FTLX8571D3BCL >> +Avago SFP+ SR bailed, 10g single rate AFBR-700SDZ >> +Finisar SFP+ LR bailed, 10g single rate >> FTLX8571D3BCV-IT >> + >> +Finisar DUAL RATE 1G/10G SFP+ SR (No Bail) >> FTLX8571D3QCV-IT >> +Avago DUAL RATE 1G/10G SFP+ SR (No Bail) >> AFBR-703SDZ-IN1 >> +Finisar DUAL RATE 1G/10G SFP+ LR (No Bail) >> FTLX1471D3QCV-IT >> +Avago DUAL RATE 1G/10G SFP+ LR (No Bail) >> AFCT-701SDZ-IN1 >> +Finistar 1000BASE-T SFP >> FCLF8522P2BTL >> +Avago 1000BASE-T SFP ABCU-5710RZ >> + >> +82599-based adapters support all passive and active limiting direct >> attach >> +cables that comply with SFF-8431 v4.1 and SFF-8472 v10.4 specifications. >> + >> +Laser turns off for SFP+ when ifconfig down >> +-------------------------------------------------------- >> +"ifconfig down" turns off the laser for 82599-based SFP+ fiber adapters. >> +"ifconfig up" turns on the later. >> + >> +82598-BASED ADAPTERS >> + >> +NOTES for 82598-Based Adapters: >> +- Intel(R) Ethernet Network Adapters that support removable optical >> modules >> + only support their original module type (i.e., the Intel(R) 10 Gigabit >> SR >> + Dual Port Express Module only supports SR optical modules). If you plug >> + in a different type of module, the driver will not load. >> +- Hot Swapping/hot plugging optical modules is not supported. >> +- Only single speed, 10 gigabit modules are supported. >> +- LAN on Motherboard (LOMs) may support DA, SR, or LR modules. Other >> module >> + types are not supported. Please see your system documentation for >> details. >> + >> +The following is a list of 3rd party SFP+ modules and direct attach >> cables that have >> +received some testing. Not all modules are applicable to all devices. >> + >> +Supplier Type Part Numbers >> + >> +Finisar SFP+ SR bailed, 10g single rate >> FTLX8571D3BCL >> +Avago SFP+ SR bailed, 10g single rate AFBR-700SDZ >> +Finisar SFP+ LR bailed, 10g single rate >> FTLX1471D3BCL >> + >> +82598-based adapters support all passive direct attach cables that comply >> +with SFF-8431 v4.1 and SFF-8472 v10.4 specifications. Active direct >> attach >> +cables are not supported. >> + >> +Third party optic modules and cables referred to above are listed only >> for the >> +purpose of highlighting third party specifications and potential >> compatibility, >> +and are not recommendations or endorsements or sponsorship of any third >> party's >> +product by Intel. Intel is not endorsing or promoting products made by >> any >> +third party and the third party reference is provided only to share >> information >> +regarding certain optic modules and cables with the above specifications. >> There >> +may be other manufacturers or suppliers, producing or supplying optic >> modules >> +and cables with similar or matching descriptions. Customers must use >> their own >> +discretion and diligence to purchase optic modules and cables from any >> third >> +party of their choice. Customer are solely responsible for assessing the >> +suitability of the product and/or devices and for the selection of the >> vendor >> +for purchasing any product. INTEL ASSUMES NO LIABILITY WHATSOEVER, AND >> INTEL >> +DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF >> +SUCH THIRD PARTY PRODUCTS OR SELECTION OF VENDOR BY CUSTOMERS. >> >> Configuration and Tuning >> -========================= >> +======================== >> >> The driver supports Transmit/Receive Checksum Offload and Jumbo Frames on >> all 10 Gigabit adapters. >> @@ -143,7 +141,7 @@ all 10 Gigabit adapters. >> The Jumbo Frames MTU range for Intel Adapters is 1500 to 16114. The >> default >> MTU range is 1500. To modify the setting, enter the following: >> >> - ifconfig ix mtu 9000 >> + ifconfig ix mtu 9000 >> >> To confirm an interface's MTU value, use the ifconfig command. To >> confirm >> the MTU used between two specific devices, use: >> @@ -200,6 +198,8 @@ all 10 Gigabit adapters. >> TSO >> --- >> >> + TSO is enabled by default. >> + >> To disable: >> >> ifconfig -tso >> @@ -209,23 +209,21 @@ all 10 Gigabit adapters. >> ifconfig tso >> >> LRO >> - ___ >> + --- >> >> - Large Receive Offload is available in version 1.4.4, it is on >> - by default. It can be toggled off and on by using: >> - sysctl dev.ix.X.enable_lro=[0,1] >> - >> - NOTE: when changing this feature you MUST be sure the interface >> - is reinitialized, it is easy to do this with ifconfig down/up. >> - The LRO code will ultimately move into the kernel stack code, >> - but for this first release it was included with the driver. >> + Large Receive Offload is available in the driver; it is on by default. >> + It can be disabled by using: >> + ifconfig -lro >> + To enable: >> + ifconfig lro >> + >> >> Important system configuration changes: >> --------------------------------------- >> >> - When there is a choice run on a 64bit OS rather than 32, it makes >> - a significant difference in improvement. >> - >> + When there is a choice run on a 64bit OS rather than 32, it makes a >> + significant difference in improvement. >> + >> The default scheduler SCHED_4BSD is not smart about SMP locality issues. >> Significant improvement can be achieved by switching to the ULE >> scheduler. >> >> @@ -233,34 +231,79 @@ all 10 Gigabit adapters. >> SCHED_ULE. Note that this is only advisable on FreeBSD 7, on 6.X there >> have >> been stability problems with ULE. >> >> - Change the file /etc/sysctl.conf, add the line: >> + The interface can generate high number of interrupts. To avoid running >> + into the limit set by the kernel, adjust hw.intr_storm_threshold >> + setting using sysctl: >> >> - hw.intr_storm_threshold: 8000 (the default is 1000) >> + sysctl hw.intr_storm_threshold=9000 (the default is 1000) >> + >> + For this change to take effect on boot, edit /etc/sysctl.conf and add >> the >> + line: >> + hw.intr_storm_threshold=9000 >> + >> + If you still see Interrupt Storm detected messages, increase the limit >> to a >> + higher number. >> >> Best throughput results are seen with a large MTU; use 9000 if possible. >> >> - The default number of descriptors is 256, increasing this to 1024 or >> even >> - 2048 may improve performance. >> + The default number of descriptors is 1024, increasing this to 2K or >> even >> + 4K may improve performance in some workloads, but change carefully. >> >> >> Known Limitations >> ================= >> + >> +For known hardware and troubleshooting issues, refer to the following >> website. >> + >> + http://support.intel.com/support/go/network/adapter/home.htm >> + >> +Either select the link for your adapter or perform a search for the >> adapter >> +number. The adapter's page lists many issues. For a complete list of >> hardware >> +issues download your adapter's user guide and read the Release Notes. >> + >> + UDP stress test with 10GbE driver >> + --------------------------------- >> Under small packets UDP stress test with 10GbE driver, the FreeBSD >> system >> will drop UDP packets due to the fullness of socket buffers. You may >> want >> to change the driver's Flow Control variables to the minimum value for >> controlling packet reception. >> >> + Attempting to configure larger MTUs with a large numbers of processors >> may >> + generate the error message "ix0:could not setup receive structures" >> + >> -------------------------------------------------------------------------- >> + When using the ixgbe driver with RSS autoconfigured based on the number >> of >> + cores (the default setting) and that number is larger than 4, increase >> the >> + memory resources allocated for the mbuf pool as follows: >> + >> + Add to the sysctl.conf file for the system: >> + >> + kern.ipc.nmbclusters=262144 >> + kern.ipc.nmbjumbop=262144 >> + >> + Lower than expected performance on dual port 10GbE devices >> + ---------------------------------------------------------- >> + Some PCI-E x8 slots are actually configured as x4 slots. These slots >> have >> + insufficient bandwidth for full 10Gbe line rate with dual port 10GbE >> devices. >> + The driver can detect this situation and will write the following >> message in >> + the system log: "PCI-Express bandwidth available for this card is not >> + sufficient for optimal performance. For optimal performance a x8 >> PCI-Express >> + slot is required." >> + >> + If this error occurs, moving your adapter to a true x8 slot will >> resolve the >> + issue. >> + >> + >> >> Support >> ======= >> >> For general information and support, go to the Intel support website at: >> >> - http://support.intel.com >> + www.intel.com/support/ >> >> If an issue is identified with the released source code on the supported >> kernel with a supported adapter, email the specific information related >> to >> -the issue to freebsd@intel.com. >> +the issue to freebsd@intel.com >> >> >> >> >> Modified: head/sys/dev/ixgbe/ixgbe.c >> >> ============================================================================== >> --- head/sys/dev/ixgbe/ixgbe.c Wed Jun 1 22:56:02 2011 (r222587) >> +++ head/sys/dev/ixgbe/ixgbe.c Thu Jun 2 00:34:57 2011 (r222588) >> @@ -34,6 +34,7 @@ >> >> #ifdef HAVE_KERNEL_OPTION_HEADERS >> #include "opt_inet.h" >> +#include "opt_inet6.h" >> #endif >> >> #include "ixgbe.h" >> @@ -46,7 +47,7 @@ int ixgbe_display_debug_stat >> /********************************************************************* >> * Driver version >> *********************************************************************/ >> -char ixgbe_driver_version[] = "2.3.10"; >> +char ixgbe_driver_version[] = "2.3.11"; >> >> /********************************************************************* >> * PCI Device ID Table >> @@ -318,7 +319,7 @@ static int fdir_pballoc = 1; >> * ixgbe_probe determines if the driver should be loaded on >> * adapter based on PCI vendor/device id of the adapter. >> * >> - * return 0 on success, positive on failure >> + * return BUS_PROBE_DEFAULT on success, positive on failure >> *********************************************************************/ >> >> static int >> @@ -357,7 +358,7 @@ ixgbe_probe(device_t dev) >> ixgbe_driver_version); >> device_set_desc_copy(dev, adapter_name); >> ++ixgbe_total_ports; >> - return (0); >> + return (BUS_PROBE_DEFAULT); >> } >> ent++; >> } >> @@ -385,6 +386,11 @@ ixgbe_attach(device_t dev) >> >> INIT_DEBUGOUT("ixgbe_attach: begin"); >> >> + if (resource_disabled("ixgbe", device_get_unit(dev))) { >> + device_printf(dev, "Disabled by device hint\n"); >> + return (ENXIO); >> + } >> + >> /* Allocate, clear, and link in our adapter structure */ >> adapter = device_get_softc(dev); >> adapter->dev = adapter->osdep.dev = dev; >> @@ -862,8 +868,9 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c >> { >> struct adapter *adapter = ifp->if_softc; >> struct ifreq *ifr = (struct ifreq *) data; >> -#ifdef INET >> +#if defined(INET) || defined(INET6) >> struct ifaddr *ifa = (struct ifaddr *)data; >> + bool avoid_reset = FALSE; >> #endif >> int error = 0; >> >> @@ -871,26 +878,28 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c >> >> case SIOCSIFADDR: >> #ifdef INET >> - if (ifa->ifa_addr->sa_family == AF_INET) { >> - /* >> - * Since resetting hardware takes a very long time >> - * and results in link renegotiation we only >> - * initialize the hardware only when it is >> absolutely >> - * required. >> - */ >> + if (ifa->ifa_addr->sa_family == AF_INET) >> + avoid_reset = TRUE; >> +#endif >> +#ifdef INET6 >> + if (ifa->ifa_addr->sa_family == AF_INET6) >> + avoid_reset = TRUE; >> +#endif >> +#if defined(INET) || defined(INET6) >> + /* >> + ** Calling init results in link renegotiation, >> + ** so we avoid doing it when possible. >> + */ >> + if (avoid_reset) { >> ifp->if_flags |= IFF_UP; >> - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { >> - IXGBE_CORE_LOCK(adapter); >> - ixgbe_init_locked(adapter); >> - IXGBE_CORE_UNLOCK(adapter); >> - } >> + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) >> + ixgbe_init(adapter); >> if (!(ifp->if_flags & IFF_NOARP)) >> arp_ifinit(ifp, ifa); >> } else >> -#endif >> error = ether_ioctl(ifp, command, data); >> break; >> - >> +#endif >> case SIOCSIFMTU: >> IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); >> if (ifr->ifr_mtu > IXGBE_MAX_FRAME_SIZE - ETHER_HDR_LEN) { >> @@ -951,6 +960,8 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c >> ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; >> if (mask & IFCAP_VLAN_HWFILTER) >> ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; >> + if (mask & IFCAP_VLAN_HWTSO) >> + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; >> if (ifp->if_drv_flags & IFF_DRV_RUNNING) { >> IXGBE_CORE_LOCK(adapter); >> ixgbe_init_locked(adapter); >> @@ -1338,7 +1349,7 @@ ixgbe_legacy_irq(void *arg) >> >> /********************************************************************* >> * >> - * MSI Queue Interrupt Service routine >> + * MSIX Queue Interrupt Service routine >> * >> **********************************************************************/ >> void >> @@ -1357,6 +1368,17 @@ ixgbe_msix_que(void *arg) >> >> IXGBE_TX_LOCK(txr); >> more_tx = ixgbe_txeof(txr); >> + /* >> + ** Make certain that if the stack >> + ** has anything queued the task gets >> + ** scheduled to handle it. >> + */ >> +#if __FreeBSD_version < 800000 >> + if (!IFQ_DRV_IS_EMPTY(&adapter->ifp->if_snd)) >> +#else >> + if (!drbr_empty(adapter->ifp, txr->br)) >> +#endif >> + more_tx = 1; >> IXGBE_TX_UNLOCK(txr); >> >> /* Do AIM now? */ >> @@ -1570,7 +1592,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m >> struct mbuf *m_head; >> bus_dma_segment_t segs[adapter->num_segs]; >> bus_dmamap_t map; >> - struct ixgbe_tx_buf *txbuf, *txbuf_mapped; >> + struct ixgbe_tx_buf *txbuf; >> union ixgbe_adv_tx_desc *txd = NULL; >> >> m_head = *m_headp; >> @@ -1589,7 +1611,6 @@ ixgbe_xmit(struct tx_ring *txr, struct m >> */ >> first = txr->next_avail_desc; >> txbuf = &txr->tx_buffers[first]; >> - txbuf_mapped = txbuf; >> map = txbuf->map; >> >> /* >> @@ -1708,6 +1729,8 @@ ixgbe_xmit(struct tx_ring *txr, struct m >> txr->next_avail_desc = i; >> >> txbuf->m_head = m_head; >> + /* Swap the dma map between the first and last descriptor */ >> + txr->tx_buffers[first].map = txbuf->map; >> txbuf->map = map; >> bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); >> >> @@ -2265,7 +2288,9 @@ ixgbe_setup_msix(struct adapter *adapter >> msi: >> msgs = pci_msi_count(dev); >> if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) >> - device_printf(adapter->dev,"Using MSI >> interrupt\n"); >> + device_printf(adapter->dev,"Using an MSI >> interrupt\n"); >> + else >> + device_printf(adapter->dev,"Using a Legacy >> interrupt\n"); >> return (msgs); >> } >> >> @@ -2412,19 +2437,21 @@ ixgbe_setup_interface(device_t dev, stru >> ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); >> >> ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | >> IFCAP_VLAN_HWCSUM; >> - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; >> ifp->if_capabilities |= IFCAP_JUMBO_MTU; >> + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING >> + | IFCAP_VLAN_HWTSO >> + | IFCAP_VLAN_MTU; >> ifp->if_capenable = ifp->if_capabilities; >> >> /* Don't enable LRO by default */ >> ifp->if_capabilities |= IFCAP_LRO; >> >> /* >> - ** Dont turn this on by default, if vlans are >> + ** Don't turn this on by default, if vlans are >> ** created on another pseudo device (eg. lagg) >> ** then vlan events are not passed thru, breaking >> ** operation, but with HW FILTER off it works. If >> - ** using vlans directly on the em driver you can >> + ** using vlans directly on the ixgbe driver you can >> ** enable this and get full hardware tag filtering. >> */ >> ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; >> @@ -5333,7 +5360,7 @@ ixgbe_add_rx_process_limit(struct adapte >> static int >> ixgbe_set_advertise(SYSCTL_HANDLER_ARGS) >> { >> - int error; >> + int error = 0; >> struct adapter *adapter; >> struct ixgbe_hw *hw; >> ixgbe_link_speed speed, last; >> >> Modified: head/sys/dev/ixgbe/ixv.c >> >> ============================================================================== >> --- head/sys/dev/ixgbe/ixv.c Wed Jun 1 22:56:02 2011 (r222587) >> +++ head/sys/dev/ixgbe/ixv.c Thu Jun 2 00:34:57 2011 (r222588) >> @@ -1,6 +1,6 @@ >> >> /****************************************************************************** >> >> - Copyright (c) 2001-2010, Intel Corporation >> + Copyright (c) 2001-2011, Intel Corporation >> All rights reserved. >> >> Redistribution and use in source and binary forms, with or without >> @@ -33,7 +33,8 @@ >> /*$FreeBSD$*/ >> >> #ifdef HAVE_KERNEL_OPTION_HEADERS >> -#include "opt_device_polling.h" >> +#include "opt_inet.h" >> +#include "opt_inet6.h" >> #endif >> >> #include "ixv.h" >> @@ -41,7 +42,7 @@ >> /********************************************************************* >> * Driver version >> *********************************************************************/ >> -char ixv_driver_version[] = "1.0.0"; >> +char ixv_driver_version[] = "1.0.1"; >> >> /********************************************************************* >> * PCI Device ID Table >> @@ -234,7 +235,7 @@ static u32 ixv_shadow_vfta[VFTA_SIZE]; >> * ixv_probe determines if the driver should be loaded on >> * adapter based on PCI vendor/device id of the adapter. >> * >> - * return 0 on success, positive on failure >> + * return BUS_PROBE_DEFAULT on success, positive on failure >> *********************************************************************/ >> >> static int >> @@ -271,7 +272,7 @@ ixv_probe(device_t dev) >> ixv_strings[ent->index], >> ixv_driver_version); >> device_set_desc_copy(dev, adapter_name); >> - return (0); >> + return (BUS_PROBE_DEFAULT); >> } >> ent++; >> } >> @@ -297,6 +298,11 @@ ixv_attach(device_t dev) >> >> INIT_DEBUGOUT("ixv_attach: begin"); >> >> + if (resource_disabled("ixgbe", device_get_unit(dev))) { >> + device_printf(dev, "Disabled by device hint\n"); >> + return (ENXIO); >> + } >> + >> /* Allocate, clear, and link in our adapter structure */ >> adapter = device_get_softc(dev); >> adapter->dev = adapter->osdep.dev = dev; >> @@ -690,10 +696,38 @@ ixv_ioctl(struct ifnet * ifp, u_long com >> { >> struct adapter *adapter = ifp->if_softc; >> struct ifreq *ifr = (struct ifreq *) data; >> +#if defined(INET) || defined(INET6) >> + struct ifreq *ifa = (struct ifaddr *) data; >> + bool avoid_reset = FALSE; >> +#endif >> int error = 0; >> >> switch (command) { >> >> + case SIOCSIFADDR: >> +#ifdef INET >> + if (ifa->ifa_addr->sa_family == AF_INET) >> + avoid_reset = TRUE; >> +#endif >> +#ifdef INET6 >> + if (ifa->ifa_addr->sa_family == AF_INET6) >> + avoid_reset = TRUE; >> +#endif >> +#if defined(INET) || defined(INET6) >> + /* >> + ** Calling init results in link renegotiation, >> + ** so we avoid doing it when possible. >> + */ >> + if (avoid_reset) { >> + ifp->if_flags |= IFF_UP; >> + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) >> + ixv_init(adapter); >> + if (!(ifp->if_flags & IFF_NOARP)) >> + arp_ifinit(ifp, ifa); >> + } else >> + error = ether_ioctl(ifp, command, data); >> + break; >> +#endif >> case SIOCSIFMTU: >> IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); >> if (ifr->ifr_mtu > IXV_MAX_FRAME_SIZE - ETHER_HDR_LEN) { >> @@ -1161,7 +1195,7 @@ ixv_xmit(struct tx_ring *txr, struct mbu >> struct mbuf *m_head; >> bus_dma_segment_t segs[32]; >> bus_dmamap_t map; >> - struct ixv_tx_buf *txbuf, *txbuf_mapped; >> + struct ixv_tx_buf *txbuf; >> union ixgbe_adv_tx_desc *txd = NULL; >> >> m_head = *m_headp; >> @@ -1180,7 +1214,6 @@ ixv_xmit(struct tx_ring *txr, struct mbu >> */ >> first = txr->next_avail_desc; >> txbuf = &txr->tx_buffers[first]; >> - txbuf_mapped = txbuf; >> map = txbuf->map; >> >> /* >> @@ -1283,6 +1316,7 @@ ixv_xmit(struct tx_ring *txr, struct mbu >> txr->next_avail_desc = i; >> >> txbuf->m_head = m_head; >> + txr->tx_buffers[first].map = txbuf->map; >> txbuf->map = map; >> bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); >> >> @@ -1820,11 +1854,15 @@ ixv_setup_interface(device_t dev, struct >> ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); >> >> ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | >> IFCAP_VLAN_HWCSUM; >> - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; >> - ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_LRO; >> - >> + ifp->if_capabilities |= IFCAP_JUMBO_MTU; >> + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING >> + | IFCAP_VLAN_HWTSO >> + | IFCAP_VLAN_MTU; >> ifp->if_capenable = ifp->if_capabilities; >> >> + /* Don't enable LRO by default */ >> + ifp->if_capabilities |= IFCAP_LRO; >> + >> /* >> * Specify the media types supported by this adapter and register >> * callbacks to update media and link information >> > > > > -- > +-----------------oOO--(_)--OOo-------------------------+ > With best Regards, > Martin Wilke (miwi_(at)_FreeBSD.org) > > Mess with the Best, Die like the Rest > > > From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 05:31:55 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CB32106564A; Thu, 2 Jun 2011 05:31:55 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3AEAD8FC12; Thu, 2 Jun 2011 05:31: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 p525VtLt002491; Thu, 2 Jun 2011 05:31:55 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p525VtEw002489; Thu, 2 Jun 2011 05:31:55 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201106020531.p525VtEw002489@svn.freebsd.org> From: Jack F Vogel Date: Thu, 2 Jun 2011 05:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222592 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 05:31:55 -0000 Author: jfv Date: Thu Jun 2 05:31:54 2011 New Revision: 222592 URL: http://svn.freebsd.org/changeset/base/222592 Log: Cut and paste mistake corrected. Modified: head/sys/dev/ixgbe/ixv.c Modified: head/sys/dev/ixgbe/ixv.c ============================================================================== --- head/sys/dev/ixgbe/ixv.c Thu Jun 2 01:44:24 2011 (r222591) +++ head/sys/dev/ixgbe/ixv.c Thu Jun 2 05:31:54 2011 (r222592) @@ -697,7 +697,7 @@ ixv_ioctl(struct ifnet * ifp, u_long com struct adapter *adapter = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; #if defined(INET) || defined(INET6) - struct ifreq *ifa = (struct ifaddr *) data; + struct ifaddr *ifa = (struct ifaddr *) data; bool avoid_reset = FALSE; #endif int error = 0; From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 09:56:42 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC531106564A; Thu, 2 Jun 2011 09:56:42 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2A958FC13; Thu, 2 Jun 2011 09:56: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 p529ugwk010843; Thu, 2 Jun 2011 09:56:42 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p529ugG0010838; Thu, 2 Jun 2011 09:56:42 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201106020956.p529ugG0010838@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 2 Jun 2011 09:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222599 - in head: sbin/geom/class/part sbin/setkey sys/boot/forth usr.bin/rctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 09:56:43 -0000 Author: uqs Date: Thu Jun 2 09:56:42 2011 New Revision: 222599 URL: http://svn.freebsd.org/changeset/base/222599 Log: mdoc: fix markup Modified: head/sbin/geom/class/part/gpart.8 head/sbin/setkey/setkey.8 head/sys/boot/forth/check-password.4th.8 head/usr.bin/rctl/rctl.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Thu Jun 2 08:39:10 2011 (r222598) +++ head/sbin/geom/class/part/gpart.8 Thu Jun 2 09:56:42 2011 (r222599) @@ -818,6 +818,7 @@ GEOM class verifies all generic partitio disk metadata. If some inconsistency is detected, partition table will be rejected with a diagnostic message: .Pa GEOM_PART: Integrity check failed (provider, scheme) . +.El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES Modified: head/sbin/setkey/setkey.8 ============================================================================== --- head/sbin/setkey/setkey.8 Thu Jun 2 08:39:10 2011 (r222598) +++ head/sbin/setkey/setkey.8 Thu Jun 2 09:56:42 2011 (r222599) @@ -441,13 +441,14 @@ protocols other than TCP, UDP and ICMP m .It Ar policy .Ar policy is expressed in one of the following three formats: -.Bd -ragged -offset indent +.Pp +.Bl -tag -compact .It Fl P Ar direction Li discard .It Fl P Ar direction Li none .It Xo Fl P Ar direction Li ipsec .Ar protocol/mode/src-dst/level Op ... .Xc -.Ed +.El .Pp The direction of a policy must be specified as one of: Modified: head/sys/boot/forth/check-password.4th.8 ============================================================================== --- head/sys/boot/forth/check-password.4th.8 Thu Jun 2 08:39:10 2011 (r222598) +++ head/sys/boot/forth/check-password.4th.8 Thu Jun 2 09:56:42 2011 (r222599) @@ -67,7 +67,7 @@ variable in .Pp Subsequent calls after a successful password has been entered will not cause reprompting -.Nd the function will silently return. +\(em the function will silently return. .El .Pp The environment variables that effect its behavior are: Modified: head/usr.bin/rctl/rctl.8 ============================================================================== --- head/usr.bin/rctl/rctl.8 Thu Jun 2 08:39:10 2011 (r222598) +++ head/usr.bin/rctl/rctl.8 Thu Jun 2 09:56:42 2011 (r222599) @@ -82,7 +82,7 @@ Use unit suffixes: Byte, Kilobyte, Megab Gigabyte, Terabyte and Petabyte. .It Fl n Display user IDs numerically rather than converting them to a user name. -.Pp +.El .Sh RULE SYNTAX Syntax for a rule is subject:subject-id:resource:action=amount/per. .Pp From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 09:56:54 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCCB2106564A; Thu, 2 Jun 2011 09:56:53 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C23208FC16; Thu, 2 Jun 2011 09:56: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 p529urc3010895; Thu, 2 Jun 2011 09:56:53 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p529ursO010882; Thu, 2 Jun 2011 09:56:53 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201106020956.p529ursO010882@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 2 Jun 2011 09:56:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222600 - in head: lib/libc/iconv share/man/man4 share/man/man9 share/misc sys/teken/libteken usr.bin/fstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 09:56:54 -0000 Author: uqs Date: Thu Jun 2 09:56:53 2011 New Revision: 222600 URL: http://svn.freebsd.org/changeset/base/222600 Log: mdoc: reorder sections consistently Modified: head/lib/libc/iconv/iconvctl.3 head/share/man/man4/bwn.4 head/share/man/man4/em.4 head/share/man/man4/igb.4 head/share/man/man4/mps.4 head/share/man/man4/uep.4 head/share/man/man4/umcs7840.4 head/share/man/man9/bus_adjust_resource.9 head/share/misc/mdoc.template head/sys/teken/libteken/teken.3 head/usr.bin/fstat/fuser.1 Modified: head/lib/libc/iconv/iconvctl.3 ============================================================================== --- head/lib/libc/iconv/iconvctl.3 Thu Jun 2 09:56:42 2011 (r222599) +++ head/lib/libc/iconv/iconvctl.3 Thu Jun 2 09:56:53 2011 (r222600) @@ -150,6 +150,9 @@ facility is a non-standard extension, wh the GNU implementation and was adopted in .Fx 9 for compatibility's sake. +.Sh AUTHORS +This manual page was written by +.An Gabor Kovesdan Aq gabor@FreeBSD.org . .Sh BUGS Transliteration is enabled in this implementation by default, so it is impossible by design to turn it off. @@ -157,6 +160,3 @@ Accordingly, trying to turn it off will returned. Getting the transliteration state will always succeed and indicate that it is turned on, though. -.Sh AUTHORS -This manual page was written by -.An Gabor Kovesdan Aq gabor@FreeBSD.org . Modified: head/share/man/man4/bwn.4 ============================================================================== --- head/share/man/man4/bwn.4 Thu Jun 2 09:56:42 2011 (r222599) +++ head/share/man/man4/bwn.4 Thu Jun 2 09:56:53 2011 (r222600) @@ -142,9 +142,6 @@ The .Nm driver first appeared in .Fx 8.1 . -.Sh CAVEATS -Some LP PHY devices have DMA operation problems that in that case try to -use PIO mode. .Sh AUTHORS .An -nosplit The @@ -155,3 +152,6 @@ driver was written by .\".Sh BUGS .\"Some card based on the BCM4306 and BCM4309 chips do not work properly .\"on channel 1, 2 and 3. +.Sh CAVEATS +Some LP PHY devices have DMA operation problems that in that case try to +use PIO mode. Modified: head/share/man/man4/em.4 ============================================================================== --- head/share/man/man4/em.4 Thu Jun 2 09:56:42 2011 (r222599) +++ head/share/man/man4/em.4 Thu Jun 2 09:56:53 2011 (r222600) @@ -227,6 +227,20 @@ If is non-zero, this tunable limits the maximum delay in which a transmit interrupt is generated. .El +.Sh FILES +.Bl -tag -width /dev/led/em* +.It Pa /dev/led/em* +identification LED device nodes +.El +.Sh EXAMPLES +Make the identification LED of em0 blink: +.Pp +.Dl "echo f2 > /dev/led/em0" +.Pp +Turn the identification LED of em0 off again: +.Pp +.Dl "echo 0 > /dev/led/em0" +.Pp .Sh DIAGNOSTICS .Bl -diag .It "em%d: Unable to allocate bus resource: memory" @@ -246,20 +260,6 @@ If an issue is identified with the relea with a supported adapter, email the specific information related to the issue to .Aq freebsdnic@mailbox.intel.com . -.Sh FILES -.Bl -tag -width /dev/led/em* -.It Pa /dev/led/em* -identification LED device nodes -.El -.Sh EXAMPLES -Make the identification LED of em0 blink: -.Pp -.Dl "echo f2 > /dev/led/em0" -.Pp -Turn the identification LED of em0 off again: -.Pp -.Dl "echo 0 > /dev/led/em0" -.Pp .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , Modified: head/share/man/man4/igb.4 ============================================================================== --- head/share/man/man4/igb.4 Thu Jun 2 09:56:42 2011 (r222599) +++ head/share/man/man4/igb.4 Thu Jun 2 09:56:53 2011 (r222600) @@ -161,6 +161,20 @@ The minimum is 80, and the maximum is 40 If set to 1, enable Adaptive Interrupt Moderation. The default is to enable Adaptive Interrupt Moderation. .El +.Sh FILES +.Bl -tag -width /dev/led/igb* +.It Pa /dev/led/igb* +identification LED device nodes +.El +.Sh EXAMPLES +Make the identification LED of igb0 blink: +.Pp +.Dl "echo f2 > /dev/led/igb0" +.Pp +Turn the identification LED of igb0 off again: +.Pp +.Dl "echo 0 > /dev/led/igb0" +.Pp .Sh DIAGNOSTICS .Bl -diag .It "igb%d: Unable to allocate bus resource: memory" @@ -180,20 +194,6 @@ If an issue is identified with the relea with a supported adapter, email the specific information related to the issue to .Aq freebsdnic@mailbox.intel.com . -.Sh FILES -.Bl -tag -width /dev/led/igb* -.It Pa /dev/led/igb* -identification LED device nodes -.El -.Sh EXAMPLES -Make the identification LED of igb0 blink: -.Pp -.Dl "echo f2 > /dev/led/igb0" -.Pp -Turn the identification LED of igb0 off again: -.Pp -.Dl "echo 0 > /dev/led/igb0" -.Pp .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , Modified: head/share/man/man4/mps.4 ============================================================================== --- head/share/man/man4/mps.4 Thu Jun 2 09:56:42 2011 (r222599) +++ head/share/man/man4/mps.4 Thu Jun 2 09:56:53 2011 (r222600) @@ -143,6 +143,19 @@ Enable prints for controller events. .Xr sa 4 , .Xr scsi 4 , .Xr targ 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 9.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was originally written by +.An Scott Long Aq scottl@FreeBSD.org . +This man page was written by +.An Ken Merry Aq ken@FreeBSD.org . .Sh BUGS This driver is still in development, it has only been tested on the amd64 architecture and has some known shortcomings: @@ -158,16 +171,3 @@ times, without user intervention. .It The error recovery code isn't complete. .El -.Sh HISTORY -The -.Nm -driver first appeared in -.Fx 9.0 . -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was originally written by -.An Scott Long Aq scottl@FreeBSD.org . -This man page was written by -.An Ken Merry Aq ken@FreeBSD.org . Modified: head/share/man/man4/uep.4 ============================================================================== --- head/share/man/man4/uep.4 Thu Jun 2 09:56:42 2011 (r222599) +++ head/share/man/man4/uep.4 Thu Jun 2 09:56:53 2011 (r222600) @@ -57,11 +57,6 @@ To get mouse working in .Xr X 7 , one needs to install .Pa ports/x11-drivers/xf86-input-egalax . -.Sh BUGS -.Nm -can't act like -.Xr sysmouse 4 , -since the latter does not support absolute motion events. .Sh FILES .Nm creates a blocking pseudo\-device file, @@ -77,3 +72,8 @@ The .Nm driver was written by .An Gleb Smirnoff Aq glebius@FreeBSD.org +.Sh BUGS +.Nm +can't act like +.Xr sysmouse 4 , +since the latter does not support absolute motion events. Modified: head/share/man/man4/umcs7840.4 ============================================================================== --- head/share/man/man4/umcs7840.4 Thu Jun 2 09:56:42 2011 (r222599) +++ head/share/man/man4/umcs7840.4 Thu Jun 2 09:56:53 2011 (r222600) @@ -80,9 +80,6 @@ ST Lab U-400 four-port serial USB adapte .Xr tty 4 , .Xr ucom 4 , .Xr usb 4 -.Sh BUGS -This driver doesn't support access to any fine tunes of -chip, like RS522/RS485 mode, non-standard baudrates, etc. .Sh HISTORY The .Nm @@ -95,3 +92,6 @@ The driver was written by .An Lev Serebryakov .Aq lev@FreeBSD.org . +.Sh BUGS +This driver doesn't support access to any fine tunes of +chip, like RS522/RS485 mode, non-standard baudrates, etc. Modified: head/share/man/man9/bus_adjust_resource.9 ============================================================================== --- head/share/man/man9/bus_adjust_resource.9 Thu Jun 2 09:56:42 2011 (r222599) +++ head/share/man/man9/bus_adjust_resource.9 Thu Jun 2 09:56:53 2011 (r222600) @@ -67,6 +67,15 @@ It is the caller's responsibility to enf The .Fn bus_adjust_resource method returns zero on success or an error code on failure. +.Sh EXAMPLES +Grow an existing memory resource by 4096 bytes. +.Bd -literal + struct resource *res; + int error; + + error = bus_adjust_resource(dev, SYS_RES_MEMORY, res, + rman_get_start(res), rman_get_end(res) + 0x1000); +.Ed .Sh ERRORS .Fn bus_adjust_resource will fail if: @@ -85,15 +94,6 @@ The new address range does not overlap w .It Bq Er EBUSY The new address range conflicts with another allocated resource. .El -.Sh EXAMPLES -Grow an existing memory resource by 4096 bytes. -.Bd -literal - struct resource *res; - int error; - - error = bus_adjust_resource(dev, SYS_RES_MEMORY, res, - rman_get_start(res), rman_get_end(res) + 0x1000); -.Ed .Sh SEE ALSO .Xr bus_alloc_resource 9 , .Xr bus_release_resource 9 , Modified: head/share/misc/mdoc.template ============================================================================== --- head/share/misc/mdoc.template Thu Jun 2 09:56:42 2011 (r222599) +++ head/share/misc/mdoc.template Thu Jun 2 09:56:53 2011 (r222600) @@ -33,3 +33,4 @@ .\" .Sh HISTORY .\" .Sh AUTHORS .\" .Sh BUGS +.\" .Sh SECURITY CONSIDERATIONS Modified: head/sys/teken/libteken/teken.3 ============================================================================== --- head/sys/teken/libteken/teken.3 Thu Jun 2 09:56:42 2011 (r222599) +++ head/sys/teken/libteken/teken.3 Thu Jun 2 09:56:53 2011 (r222600) @@ -185,22 +185,6 @@ function switches terminal emulation to which is used by versions of .Fx prior to 9.0. -.Sh SECURITY CONSIDERATIONS -The -.Fn tf_respond -callback is used to respond to device status requests commands generated -by an application. -In the past, there have been various security issues, where a malicious -application sends a device status request before termination, causing -the generated response to be interpreted by applications such as -.Xr sh 1 . -.Pp -.Nm -only implements a small subset of responses which are unlikely to cause -any harm. -Still, it is advised to leave -.Fn tf_respond -unimplemented. .Sh SEE ALSO .Xr ncurses 3 , .Xr termcap 3 , @@ -218,3 +202,19 @@ the library appeared in userspace. .Sh AUTHORS .An Ed Schouten Aq ed@FreeBSD.org +.Sh SECURITY CONSIDERATIONS +The +.Fn tf_respond +callback is used to respond to device status requests commands generated +by an application. +In the past, there have been various security issues, where a malicious +application sends a device status request before termination, causing +the generated response to be interpreted by applications such as +.Xr sh 1 . +.Pp +.Nm +only implements a small subset of responses which are unlikely to cause +any harm. +Still, it is advised to leave +.Fn tf_respond +unimplemented. Modified: head/usr.bin/fstat/fuser.1 ============================================================================== --- head/usr.bin/fstat/fuser.1 Thu Jun 2 09:56:42 2011 (r222599) +++ head/usr.bin/fstat/fuser.1 Thu Jun 2 09:56:53 2011 (r222600) @@ -130,6 +130,16 @@ The .Nm utility is expected to conform to .St -p1003.1-2004 . +.Sh HISTORY +The +.Nm +utility appeared in +.Fx 9.0 . +.Sh AUTHORS +The +.Nm +utility and this manual page was written by +.An Stanislav Sedov Aq stas@FreeBSD.org . .Sh BUGS Since .Nm @@ -141,13 +151,3 @@ interface the report will be limited to .Nm utility knows about (currently only cd9660, devfs, nfs, ntfs, nwfs, udf, ufs and zfs). -.Sh HISTORY -The -.Nm -utility appeared in -.Fx 9.0 . -.Sh AUTHORS -The -.Nm -utility and this manual page was written by -.An Stanislav Sedov Aq stas@FreeBSD.org . From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 10:18:50 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0972D1065673; Thu, 2 Jun 2011 10:18:50 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EECF38FC12; Thu, 2 Jun 2011 10:18:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52AInu8011601; Thu, 2 Jun 2011 10:18:49 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52AInNu011599; Thu, 2 Jun 2011 10:18:49 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201106021018.p52AInNu011599@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 2 Jun 2011 10:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222601 - head/usr.bin/man X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 10:18:50 -0000 Author: uqs Date: Thu Jun 2 10:18:49 2011 New Revision: 222601 URL: http://svn.freebsd.org/changeset/base/222601 Log: Fix man -t by not passing grotty flags to groff when grotty is not involved. This fixes a regression introduced with r221303. Noticed by: jilles Modified: head/usr.bin/man/man.sh Modified: head/usr.bin/man/man.sh ============================================================================== --- head/usr.bin/man/man.sh Thu Jun 2 09:56:53 2011 (r222600) +++ head/usr.bin/man/man.sh Thu Jun 2 10:18:49 2011 (r222601) @@ -895,7 +895,7 @@ NROFF='groff -S -P-c -Wall -mtty-char -m PIC=pic REFER=refer TBL=tbl -TROFF='groff -S -P-c -man' +TROFF='groff -S -man' VGRIND=vgrind COL=/usr/bin/col From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 10:21:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07BEC1065672; Thu, 2 Jun 2011 10:21:06 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ECC658FC08; Thu, 2 Jun 2011 10:21:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52AL5vt011711; Thu, 2 Jun 2011 10:21:05 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52AL5bM011709; Thu, 2 Jun 2011 10:21:05 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201106021021.p52AL5bM011709@svn.freebsd.org> From: Robert Watson Date: Thu, 2 Jun 2011 10:21:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222602 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 10:21:06 -0000 Author: rwatson Date: Thu Jun 2 10:21:05 2011 New Revision: 222602 URL: http://svn.freebsd.org/changeset/base/222602 Log: Do not leak the pcbinfohash lock in the case where in6_pcbladdr() returns an error during TCP connect(2) on an IPv6 socket. Submitted by: bz Sponsored by: Juniper Networks, Inc. Modified: head/sys/netinet/tcp_usrreq.c Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Thu Jun 2 10:18:49 2011 (r222601) +++ head/sys/netinet/tcp_usrreq.c Thu Jun 2 10:21:05 2011 (r222602) @@ -1158,7 +1158,7 @@ tcp6_connect(struct tcpcb *tp, struct so */ error = in6_pcbladdr(inp, nam, &addr6); if (error) - return error; + goto out; oinp = in6_pcblookup_hash_locked(inp->inp_pcbinfo, &sin6->sin6_addr, sin6->sin6_port, IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 12:49:46 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56AB5106564A; Thu, 2 Jun 2011 12:49:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47CF98FC12; Thu, 2 Jun 2011 12:49:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52Cnk5D017849; Thu, 2 Jun 2011 12:49:46 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52Cnksu017847; Thu, 2 Jun 2011 12:49:46 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106021249.p52Cnksu017847@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 2 Jun 2011 12:49:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222603 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 12:49:46 -0000 Author: ae Date: Thu Jun 2 12:49:45 2011 New Revision: 222603 URL: http://svn.freebsd.org/changeset/base/222603 Log: Do not hide stripeoffset from libgeom(3), it may be useful even when stripesize is zero. MFC after: 1 week Modified: head/sys/geom/geom_dump.c Modified: head/sys/geom/geom_dump.c ============================================================================== --- head/sys/geom/geom_dump.c Thu Jun 2 10:21:05 2011 (r222602) +++ head/sys/geom/geom_dump.c Thu Jun 2 12:49:45 2011 (r222603) @@ -207,10 +207,8 @@ g_conf_provider(struct sbuf *sb, struct sbuf_printf(sb, "\t %jd\n", (intmax_t)pp->mediasize); sbuf_printf(sb, "\t %u\n", pp->sectorsize); - if (pp->stripesize > 0) { - sbuf_printf(sb, "\t %u\n", pp->stripesize); - sbuf_printf(sb, "\t %u\n", pp->stripeoffset); - } + sbuf_printf(sb, "\t %u\n", pp->stripesize); + sbuf_printf(sb, "\t %u\n", pp->stripeoffset); if (pp->geom->flags & G_GEOM_WITHER) ; else if (pp->geom->dumpconf != NULL) { From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 13:12:59 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2251106566B; Thu, 2 Jun 2011 13:12:59 +0000 (UTC) (envelope-from uqs@spoerlein.net) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 3D4418FC0A; Thu, 2 Jun 2011 13:12:59 +0000 (UTC) Received: from localhost (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by acme.spoerlein.net (8.14.4/8.14.4) with ESMTP id p52DCw8E016434 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 2 Jun 2011 15:12:58 +0200 (CEST) (envelope-from uqs@spoerlein.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=spoerlein.net; s=dkim200908; t=1307020378; bh=dv5emNxbKhwNmfEoTEojEOpfS1ijWqBz+YKG90jK8Qk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=jD7vvNZRP03SxJwqVpenzTCqRDUcFy2i5IMusdatYg1K2ePjncIIeJqCYIgjgmXZ/ z4ZHJIYqQHW6fQ2NKbQCItq1FCRB5RsXe0cH+qva96D1yMcf5ZWVdxx+7HqDluo5Gw fLIta9texniCdyfKQfgjZHA5vtI5XqkSD1ZbTjv4= Date: Thu, 2 Jun 2011 15:12:58 +0200 From: Ulrich =?utf-8?B?U3DDtnJsZWlu?= To: "David E. O'Brien" Message-ID: <20110602131257.GV1002@acme.spoerlein.net> Mail-Followup-To: Ulrich =?utf-8?B?U3DDtnJsZWlu?= , "David E. O'Brien" , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201105250104.p4P14DLb092748@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201105250104.p4P14DLb092748@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r222273 - in head: gnu/usr.bin gnu/usr.bin/grep tools/build/options usr.bin usr.bin/grep X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 13:12:59 -0000 On Wed, 25.05.2011 at 01:04:13 +0000, David E. O'Brien wrote: > Author: obrien > Date: Wed May 25 01:04:12 2011 > New Revision: 222273 > URL: http://svn.freebsd.org/changeset/base/222273 > > Log: > Build and install a BSD licensed grep. > If WITH_BSD_GREP is not set, it will be 'bsdgrep' and GNUgrep will be > '[ef]grep'. Otherwise, BSD-grep will be the grep family, and GNUgrep > will be 'gnugrep'. > > Discussed with: brooks > > Modified: > head/gnu/usr.bin/Makefile > head/gnu/usr.bin/grep/Makefile > head/tools/build/options/WITH_BSD_GREP > head/usr.bin/Makefile > head/usr.bin/grep/Makefile > > Modified: head/gnu/usr.bin/Makefile > ============================================================================== > --- head/gnu/usr.bin/Makefile Wed May 25 00:34:25 2011 (r222272) > +++ head/gnu/usr.bin/Makefile Wed May 25 01:04:12 2011 (r222273) > @@ -27,9 +27,7 @@ _groff= groff > .endif > .endif > > -.if ${MK_BSD_GREP} != "yes" > _grep= grep > -.endif > You should have done the same here as in usr.bin/Makefile, i.e. get rid of the ${_grep} variable completely. Just saying ... Uli From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 13:57:50 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55B6F106566C; Thu, 2 Jun 2011 13:57:50 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 463738FC18; Thu, 2 Jun 2011 13:57:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52DvoAw020039; Thu, 2 Jun 2011 13:57:50 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52DvoE0020037; Thu, 2 Jun 2011 13:57:50 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106021357.p52DvoE0020037@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 2 Jun 2011 13:57:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222607 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 13:57:50 -0000 Author: nwhitehorn Date: Thu Jun 2 13:57:49 2011 New Revision: 222607 URL: http://svn.freebsd.org/changeset/base/222607 Log: Fix opening a shell on the new system (prevent the shell's stderr from ending up in the install log). Modified: head/usr.sbin/bsdinstall/scripts/auto Modified: head/usr.sbin/bsdinstall/scripts/auto ============================================================================== --- head/usr.sbin/bsdinstall/scripts/auto Thu Jun 2 13:57:10 2011 (r222606) +++ head/usr.sbin/bsdinstall/scripts/auto Thu Jun 2 13:57:49 2011 (r222607) @@ -199,7 +199,7 @@ finalconfig() { clear echo This shell is operating in a chroot in the new system. \ When finished making configuration changes, type \"exit\". - chroot "$BSDINSTALL_CHROOT" /bin/sh + chroot "$BSDINSTALL_CHROOT" /bin/sh 2>&1 # Don't hose local rc.conf changes cp $BSDINSTALL_CHROOT/etc/rc.conf $BSDINSTALL_TMPETC/rc.conf.manual finalconfig From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 14:08:51 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 547A21065676; Thu, 2 Jun 2011 14:08:51 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 455978FC0C; Thu, 2 Jun 2011 14:08: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 p52E8pOb020592; Thu, 2 Jun 2011 14:08:51 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52E8pIH020590; Thu, 2 Jun 2011 14:08:51 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201106021408.p52E8pIH020590@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 2 Jun 2011 14:08:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222611 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 14:08:51 -0000 Author: bz Date: Thu Jun 2 14:08:50 2011 New Revision: 222611 URL: http://svn.freebsd.org/changeset/base/222611 Log: Empty the network configuration only after the user decided to pick an interface. Otherwise an accidental start of the netowrk configuration and immediate cancel after the install has finished removes the previously configured settings. Discussed with: nwhitehorn Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems Modified: head/usr.sbin/bsdinstall/scripts/netconfig Modified: head/usr.sbin/bsdinstall/scripts/netconfig ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig Thu Jun 2 14:04:07 2011 (r222610) +++ head/usr.sbin/bsdinstall/scripts/netconfig Thu Jun 2 14:08:50 2011 (r222611) @@ -41,8 +41,6 @@ DIALOG_TAGS="" : ${DIALOG_ITEM_HELP=4} : ${DIALOG_ESC=255} -echo -n > $BSDINSTALL_TMPETC/rc.conf.net - for IF in `ifconfig -l`; do test "$IF" = "lo0" && continue (ifconfig -g wlan | egrep -wq $IF) && continue @@ -56,6 +54,8 @@ INTERFACE=`echo $DIALOG_TAGS | xargs dia if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi exec 3>&- +: > $BSDINSTALL_TMPETC/rc.conf.net + # Do a dirty check to see if this a wireless interface -- there should be a # better way IFCONFIG_PREFIX="" From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 14:12:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09BFD106564A; Thu, 2 Jun 2011 14:12:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ECE398FC23; Thu, 2 Jun 2011 14:12:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52ECbpB020890; Thu, 2 Jun 2011 14:12:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52ECbaK020881; Thu, 2 Jun 2011 14:12:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106021412.p52ECbaK020881@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 2 Jun 2011 14:12:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222613 - in head/sys/powerpc: aim include ofw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 14:12:38 -0000 Author: nwhitehorn Date: Thu Jun 2 14:12:37 2011 New Revision: 222613 URL: http://svn.freebsd.org/changeset/base/222613 Log: MFpseries: Renovate and improve the AIM Open Firmware support: - Add RTAS (Run-Time Abstraction Services) support, found on all IBM systems and some Apple ones - Improve support for 32-bit real mode Open Firmware systems - Pull some more OF bits over from the AIM directory - Fix memory detection on IBM LPARs and systems with more than one /memory node (by andreast@) Added: head/sys/powerpc/include/rtas.h (contents, props changed) head/sys/powerpc/ofw/ofwcall32.S (contents, props changed) head/sys/powerpc/ofw/ofwcall64.S (contents, props changed) head/sys/powerpc/ofw/ofwmagic.S - copied unchanged from r222507, head/sys/powerpc/aim/ofwmagic.S head/sys/powerpc/ofw/rtas.c (contents, props changed) Deleted: head/sys/powerpc/aim/ofwmagic.S Modified: head/sys/powerpc/aim/locore32.S head/sys/powerpc/aim/locore64.S head/sys/powerpc/ofw/ofw_machdep.c head/sys/powerpc/ofw/ofw_real.c Modified: head/sys/powerpc/aim/locore32.S ============================================================================== --- head/sys/powerpc/aim/locore32.S Thu Jun 2 14:09:30 2011 (r222612) +++ head/sys/powerpc/aim/locore32.S Thu Jun 2 14:12:37 2011 (r222613) @@ -87,9 +87,6 @@ GLOBAL(tmpstk) GLOBAL(esym) .long 0 /* end of symbol table */ -GLOBAL(ofmsr) - .long 0, 0, 0, 0, 0 /* msr/sprg0-3 used in Open Firmware */ - #define INTRCNT_COUNT 256 /* max(HROWPIC_IRQMAX,OPENPIC_IRQMAX) */ GLOBAL(intrnames) .space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 @@ -99,16 +96,6 @@ GLOBAL(intrcnt) .space INTRCNT_COUNT * 4 * 2 GLOBAL(eintrcnt) -/* - * File-scope for locore.S - */ -idle_u: - .long 0 /* fake uarea during idle after exit */ -openfirmware_entry: - .long 0 /* Open Firmware entry point */ -srsave: - .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .text .globl btext btext: Modified: head/sys/powerpc/aim/locore64.S ============================================================================== --- head/sys/powerpc/aim/locore64.S Thu Jun 2 14:09:30 2011 (r222612) +++ head/sys/powerpc/aim/locore64.S Thu Jun 2 14:12:37 2011 (r222613) @@ -76,7 +76,6 @@ .set kernbase, KERNBASE #define TMPSTKSZ 8192 /* 8K temporary stack */ -#define OFWSTKSZ 4096 /* 4K Open Firmware stack */ /* * Globals @@ -85,14 +84,9 @@ .align 4 GLOBAL(tmpstk) .space TMPSTKSZ -GLOBAL(ofwstk) - .space OFWSTKSZ GLOBAL(esym) .llong 0 /* end of symbol table */ -GLOBAL(ofmsr) - .llong 0, 0, 0, 0, 0 /* msr/sprg0-3 used in Open Firmware */ - #define INTRCNT_COUNT 256 /* max(HROWPIC_IRQMAX,OPENPIC_IRQMAX) */ GLOBAL(intrnames) .space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 @@ -102,16 +96,6 @@ GLOBAL(intrcnt) .space INTRCNT_COUNT * 4 * 2 GLOBAL(eintrcnt) -/* - * File-scope for locore.S - */ -idle_u: - .llong 0 /* fake uarea during idle after exit */ -openfirmware_entry: - .llong 0 /* Open Firmware entry point */ -srsave: - .llong 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .text .globl btext btext: @@ -208,122 +192,6 @@ tocbase: .llong .TOC.@tocbase /* - * Open Firmware Real-mode Entry Point. This is a huge pain. - */ - -ASENTRY(ofw_32bit_mode_entry) - mflr %r0 - std %r0,16(%r1) - stdu %r1,-208(%r1) - - /* - * We need to save the following, because OF's register save/ - * restore code assumes that the contents of registers are - * at most 32 bits wide: lr, cr, r2, r13-r31, the old MSR. These - * get placed in that order in the stack. - */ - - mfcr %r4 - std %r4,48(%r1) - std %r13,56(%r1) - std %r14,64(%r1) - std %r15,72(%r1) - std %r16,80(%r1) - std %r17,88(%r1) - std %r18,96(%r1) - std %r19,104(%r1) - std %r20,112(%r1) - std %r21,120(%r1) - std %r22,128(%r1) - std %r23,136(%r1) - std %r24,144(%r1) - std %r25,152(%r1) - std %r26,160(%r1) - std %r27,168(%r1) - std %r28,176(%r1) - std %r29,184(%r1) - std %r30,192(%r1) - std %r31,200(%r1) - - /* Record the old MSR */ - mfmsr %r6 - - /* read client interface handler */ - lis %r4,openfirmware_entry@ha - ld %r4,openfirmware_entry@l(%r4) - - /* - * Set the MSR to the OF value. This has the side effect of disabling - * exceptions, which is important for the next few steps. - */ - - lis %r5,ofmsr@ha - ld %r5,ofmsr@l(%r5) - mtmsrd %r5 - isync - - /* - * Set up OF stack. This needs to be accessible in real mode and - * use the 32-bit ABI stack frame format. The pointer to the current - * kernel stack is placed at the very top of the stack along with - * the old MSR so we can get them back later. - */ - mr %r5,%r1 - lis %r1,(ofwstk+OFWSTKSZ-32)@ha - addi %r1,%r1,(ofwstk+OFWSTKSZ-32)@l - std %r5,8(%r1) /* Save real stack pointer */ - std %r2,16(%r1) /* Save old TOC */ - std %r6,24(%r1) /* Save old MSR */ - li %r5,0 - stw %r5,4(%r1) - stw %r5,0(%r1) - - /* Finally, branch to OF */ - mtctr %r4 - bctrl - - /* Reload stack pointer and MSR from the OFW stack */ - ld %r6,24(%r1) - ld %r2,16(%r1) - ld %r1,8(%r1) - - /* Now set the real MSR */ - mtmsrd %r6 - isync - - /* Sign-extend the return value from OF */ - extsw %r3,%r3 - - /* Restore all the non-volatile registers */ - ld %r5,48(%r1) - mtcr %r5 - ld %r13,56(%r1) - ld %r14,64(%r1) - ld %r15,72(%r1) - ld %r16,80(%r1) - ld %r17,88(%r1) - ld %r18,96(%r1) - ld %r19,104(%r1) - ld %r20,112(%r1) - ld %r21,120(%r1) - ld %r22,128(%r1) - ld %r23,136(%r1) - ld %r24,144(%r1) - ld %r25,152(%r1) - ld %r26,160(%r1) - ld %r27,168(%r1) - ld %r28,176(%r1) - ld %r29,184(%r1) - ld %r30,192(%r1) - ld %r31,200(%r1) - - /* Restore the stack and link register */ - ld %r1,0(%r1) - ld %r0,16(%r1) - mtlr %r0 - blr - -/* * int setfault() * * Similar to setjmp to setup for handling faults on accesses to user memory. Added: head/sys/powerpc/include/rtas.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/include/rtas.h Thu Jun 2 14:12:37 2011 (r222613) @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 2011 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_RTAS_H_ +#define _MACHINE_RTAS_H_ + +#include +#include +#include + +/* + * RTAS functions are defined by 32-bit integer tokens. These vary from + * system to system, and can be looked up from their standardized names + * using rtas_token_lookup(). If RTAS is not available, rtas_token_lookup() + * and rtas_call_method() return -1; this can be checked in advance using + * rtas_exists(). Otherwise, rtas_call_method() returns one of the RTAS + * status codes from the bottom of this file. + */ + +int rtas_exists(void); +int rtas_call_method(cell_t token, int nargs, int nreturns, ...); +cell_t rtas_token_lookup(const char *method); + +/* RTAS Status Codes: see CHRP or PAPR specification */ +#define RTAS_OK 0 +#define RTAS_HW_ERROR -1 +#define RTAS_BUSY -2 +#define RTAS_PARAM_ERROR -3 +#define RTAS_STATE_CHANGE -7 +#define RTAS_VENDOR_BEGIN 9000 +#define RTAS_EXTENDED_DELAY 9900 +#define RTAS_ISOLATION_ERROR -9000 +#define RTAS_VENDOR_ERROR_BEGIN -9004 + +#endif /* _MACHINE_RTAS_H_ */ + Modified: head/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- head/sys/powerpc/ofw/ofw_machdep.c Thu Jun 2 14:09:30 2011 (r222612) +++ head/sys/powerpc/ofw/ofw_machdep.c Thu Jun 2 14:12:37 2011 (r222613) @@ -60,17 +60,15 @@ __FBSDID("$FreeBSD$"); #include #include -#define OFMEM_REGIONS 32 -static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3]; -static struct mem_region OFfree[OFMEM_REGIONS + 3]; -static int nOFmem; +static struct mem_region OFmem[PHYS_AVAIL_SZ], OFavail[PHYS_AVAIL_SZ]; +static struct mem_region OFfree[PHYS_AVAIL_SZ]; extern register_t ofmsr[5]; -static int (*ofwcall)(void *); +extern void *openfirmware_entry; static void *fdt; int ofw_real_mode; -int ofw_32bit_mode_entry(void *); +int ofwcall(void *); static void ofw_quiesce(void); static int openfirmware(void *args); @@ -134,11 +132,32 @@ memr_merge(struct mem_region *from, stru to->mr_size = end - to->mr_start; } +/* + * Quick sort callout for comparing memory regions. + */ +static int mr_cmp(const void *a, const void *b); + +static int +mr_cmp(const void *a, const void *b) +{ + const struct mem_region *regiona; + const struct mem_region *regionb; + + regiona = a; + regionb = b; + if (regiona->mr_start < regionb->mr_start) + return (-1); + else if (regiona->mr_start > regionb->mr_start) + return (1); + else + return (0); +} + static int parse_ofw_memory(phandle_t node, const char *prop, struct mem_region *output) { cell_t address_cells, size_cells; - cell_t OFmem[4*(OFMEM_REGIONS + 1)]; + cell_t OFmem[4 * PHYS_AVAIL_SZ]; int sz, i, j; int apple_hack_mode; phandle_t phandle; @@ -175,7 +194,7 @@ parse_ofw_memory(phandle_t node, const c * Get memory. */ if ((node == -1) || (sz = OF_getprop(node, prop, - OFmem, sizeof(OFmem[0]) * 4 * OFMEM_REGIONS)) <= 0) + OFmem, sizeof(OFmem[0]) * 4 * PHYS_AVAIL_SZ)) <= 0) panic("Physical memory map not found"); i = 0; @@ -225,7 +244,7 @@ parse_ofw_memory(phandle_t node, const c #ifdef __powerpc64__ if (apple_hack_mode) { /* Add in regions above 4 GB to the available list */ - struct mem_region himem[OFMEM_REGIONS]; + struct mem_region himem[PHYS_AVAIL_SZ]; int hisz; hisz = parse_ofw_memory(node, "reg", himem); @@ -243,6 +262,81 @@ parse_ofw_memory(phandle_t node, const c return (sz); } +static int +parse_drconf_memory(int *msz, int *asz, struct mem_region *ofmem, + struct mem_region *ofavail) +{ + phandle_t phandle; + vm_offset_t base; + int i, idx, len, lasz, lmsz, res; + uint32_t lmb_size[2]; + unsigned long *dmem, flags; + + lmsz = *msz; + lasz = *asz; + + phandle = OF_finddevice("/ibm,dynamic-reconfiguration-memory"); + if (phandle == -1) + /* No drconf node, return. */ + return (0); + + res = OF_getprop(phandle, "ibm,lmb-size", lmb_size, sizeof(lmb_size)); + if (res == -1) + return (0); + + /* Parse the /ibm,dynamic-memory. + The first position gives the # of entries. The next two words + reflect the address of the memory block. The next four words are + the DRC index, reserved, list index and flags. + (see PAPR C.6.6.2 ibm,dynamic-reconfiguration-memory) + + #el Addr DRC-idx res list-idx flags + ------------------------------------------------- + | 4 | 8 | 4 | 4 | 4 | 4 |.... + ------------------------------------------------- + */ + + len = OF_getproplen(phandle, "ibm,dynamic-memory"); + if (len > 0) { + + /* We have to use a variable length array on the stack + since we have very limited stack space. + */ + cell_t arr[len/sizeof(cell_t)]; + + res = OF_getprop(phandle, "ibm,dynamic-memory", &arr, + sizeof(arr)); + if (res == -1) + return (0); + + /* Number of elements */ + idx = arr[0]; + + /* First address. */ + dmem = (void*)&arr[1]; + + for (i = 0; i < idx; i++) { + base = *dmem; + dmem += 2; + flags = *dmem; + /* Use region only if available and not reserved. */ + if ((flags & 0x8) && !(flags & 0x80)) { + ofmem[lmsz].mr_start = base; + ofmem[lmsz].mr_size = (vm_size_t)lmb_size[1]; + ofavail[lasz].mr_start = base; + ofavail[lasz].mr_size = (vm_size_t)lmb_size[1]; + lmsz++; + lasz++; + } + dmem++; + } + } + + *msz = lmsz; + *asz = lasz; + + return (1); +} /* * This is called during powerpc_init, before the system is really initialized. * It shall provide the total and the available regions of RAM. @@ -255,31 +349,62 @@ ofw_mem_regions(struct mem_region **memp struct mem_region **availp, int *availsz) { phandle_t phandle; + vm_offset_t maxphysaddr; int asz, msz, fsz; - int i, j; + int i, j, res; int still_merging; + char name[31]; asz = msz = 0; /* - * Get memory. + * Get memory from all the /memory nodes. */ - phandle = OF_finddevice("/memory"); - if (phandle == -1) - phandle = OF_finddevice("/memory@0"); + for (phandle = OF_child(OF_peer(0)); phandle != 0; + phandle = OF_peer(phandle)) { + if (OF_getprop(phandle, "name", name, sizeof(name)) <= 0) + continue; + if (strncmp(name, "memory", sizeof(name)) != 0) + continue; + + res = parse_ofw_memory(phandle, "reg", &OFmem[msz]); + msz += res/sizeof(struct mem_region); + if (OF_getproplen(phandle, "available") >= 0) + res = parse_ofw_memory(phandle, "available", + &OFavail[asz]); + else + res = parse_ofw_memory(phandle, "reg", &OFavail[asz]); + asz += res/sizeof(struct mem_region); + } - msz = parse_ofw_memory(phandle, "reg", OFmem); - nOFmem = msz / sizeof(struct mem_region); - asz = parse_ofw_memory(phandle, "available", OFavail); + /* Check for memory in ibm,dynamic-reconfiguration-memory */ + parse_drconf_memory(&msz, &asz, OFmem, OFavail); + + qsort(OFmem, msz, sizeof(*OFmem), mr_cmp); + qsort(OFavail, asz, sizeof(*OFavail), mr_cmp); *memp = OFmem; - *memsz = nOFmem; - + *memsz = msz; + + /* + * On some firmwares (SLOF), some memory may be marked available that + * doesn't actually exist. This manifests as an extension of the last + * available segment past the end of physical memory, so truncate that + * one. + */ + maxphysaddr = 0; + for (i = 0; i < msz; i++) + if (OFmem[i].mr_start + OFmem[i].mr_size > maxphysaddr) + maxphysaddr = OFmem[i].mr_start + OFmem[i].mr_size; + + if (OFavail[asz - 1].mr_start + OFavail[asz - 1].mr_size > maxphysaddr) + OFavail[asz - 1].mr_size = maxphysaddr - + OFavail[asz - 1].mr_start; + /* * OFavail may have overlapping regions - collapse these * and copy out remaining regions to OFfree */ - asz /= sizeof(struct mem_region); do { still_merging = FALSE; for (i = 0; i < asz; i++) { @@ -318,19 +443,6 @@ OF_initial_setup(void *fdt_ptr, void *ju else ofw_real_mode = 1; - ofwcall = NULL; - - #ifdef __powerpc64__ - /* - * For PPC64, we need to use some hand-written - * asm trampolines to get to OF. - */ - if (openfirm != NULL) - ofwcall = ofw_32bit_mode_entry; - #else - ofwcall = openfirm; - #endif - fdt = fdt_ptr; #ifdef FDT_DTB_STATIC @@ -345,7 +457,7 @@ OF_bootstrap() { boolean_t status = FALSE; - if (ofwcall != NULL) { + if (openfirmware_entry != NULL) { if (ofw_real_mode) { status = OF_install(OFW_STD_REAL, 0); } else { @@ -481,12 +593,7 @@ openfirmware(void *args) int result; #ifdef SMP struct ofw_rv_args rv_args; - #endif - - if (pmap_bootstrapped && ofw_real_mode) - args = (void *)pmap_kextract((vm_offset_t)args); - #ifdef SMP rv_args.args = args; rv_args.in_progress = 1; smp_rendezvous(smp_no_rendevous_barrier, ofw_rendezvous_dispatch, Modified: head/sys/powerpc/ofw/ofw_real.c ============================================================================== --- head/sys/powerpc/ofw/ofw_real.c Thu Jun 2 14:09:30 2011 (r222612) +++ head/sys/powerpc/ofw/ofw_real.c Thu Jun 2 14:12:37 2011 (r222613) @@ -205,13 +205,14 @@ ofw_real_bounce_alloc(void *junk) /* * Allocate a page of contiguous, wired physical memory that can - * fit into a 32-bit address space. + * fit into a 32-bit address space and accessed from real mode. */ mtx_lock(&of_bounce_mtx); - of_bounce_virt = contigmalloc(PAGE_SIZE, M_OFWREAL, 0, - 0, BUS_SPACE_MAXADDR_32BIT, PAGE_SIZE, PAGE_SIZE); + of_bounce_virt = contigmalloc(PAGE_SIZE, M_OFWREAL, 0, 0, + ulmin(platform_real_maxaddr(), BUS_SPACE_MAXADDR_32BIT), PAGE_SIZE, + PAGE_SIZE); of_bounce_phys = vtophys(of_bounce_virt); of_bounce_size = PAGE_SIZE; Added: head/sys/powerpc/ofw/ofwcall32.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/ofw/ofwcall32.S Thu Jun 2 14:12:37 2011 (r222613) @@ -0,0 +1,154 @@ +/*- + * Copyright (C) 2009-2011 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include +#include +#include +#include + +#define OFWSTKSZ 4096 /* 4K Open Firmware stack */ + +/* + * Globals + */ + .data +GLOBAL(ofmsr) + .long 0, 0, 0, 0, 0 /* msr/sprg0-3 used in Open Firmware */ +GLOBAL(rtasmsr) + .long 0 +GLOBAL(openfirmware_entry) + .long 0 /* Open Firmware entry point */ +GLOBAL(rtas_entry) + .long 0 /* RTAS entry point */ + + .align 4 +ofwstk: + .space OFWSTKSZ +rtas_regsave: + .space 4 + +/* + * Open Firmware Entry Point. May need to enter real mode. + * + * C prototype: int ofwcall(void *callbuffer); + */ + +ASENTRY(ofwcall) + mflr %r0 + stw %r0,4(%r1) + + /* Record the old MSR */ + mfmsr %r6 + + /* read client interface handler */ + lis %r4,openfirmware_entry@ha + lwz %r4,openfirmware_entry@l(%r4) + + /* + * Set the MSR to the OF value. This has the side effect of disabling + * exceptions, which prevents preemption later. + */ + + lis %r5,ofmsr@ha + lwz %r5,ofmsr@l(%r5) + mtmsr %r5 + isync + + /* + * Set up OF stack. This needs to be potentially accessible in real mode + * The pointer to the current kernel stack is placed at the very + * top of the stack along with the old MSR so we can get them back + * later. + */ + mr %r5,%r1 + lis %r1,(ofwstk+OFWSTKSZ-16)@ha + addi %r1,%r1,(ofwstk+OFWSTKSZ-16)@l + stw %r5,8(%r1) /* Save real stack pointer */ + stw %r6,12(%r1) /* Save old MSR */ + li %r5,0 + stw %r5,4(%r1) + stw %r5,0(%r1) + + /* Finally, branch to OF */ + mtctr %r4 + bctrl + + /* Reload stack pointer and MSR from the OFW stack */ + lwz %r6,12(%r1) + lwz %r1,8(%r1) + + /* Now set the real MSR */ + mtmsr %r6 + isync + + /* Return */ + lwz %r0,4(%r1) + mtlr %r0 + blr + +/* + * RTAS Entry Point. Similar to the OF one, but simpler (no separate stack) + * + * C prototype: int rtascall(void *callbuffer, void *rtas_privdat); + */ + +ASENTRY(rtascall) + mflr %r0 + stw %r0,4(%r1) + + /* Record the old MSR to real-mode-accessible area */ + mfmsr %r0 + lis %r5,rtas_regsave@ha + stw %r0,rtas_regsave@l(%r5) + + /* read client interface handler */ + lis %r5,rtas_entry@ha + lwz %r5,rtas_entry@l(%r5) + + /* Set the MSR to the RTAS value */ + lis %r6,rtasmsr@ha + lwz %r6,rtasmsr@l(%r6) + mtmsr %r6 + isync + + /* Branch to RTAS */ + mtctr %r5 + bctrl + + /* Now set the MSR back */ + lis %r6,rtas_regsave@ha + lwz %r6,rtas_regsave@l(%r6) + mtmsr %r6 + isync + + /* And return */ + lwz %r0,4(%r1) + mtlr %r0 + blr + Added: head/sys/powerpc/ofw/ofwcall64.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/ofw/ofwcall64.S Thu Jun 2 14:12:37 2011 (r222613) @@ -0,0 +1,290 @@ +/*- + * Copyright (C) 2009-2011 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include +#include +#include +#include + +#define OFWSTKSZ 4096 /* 4K Open Firmware stack */ + +/* + * Globals + */ + .data + .align 4 +ofwstk: + .space OFWSTKSZ +rtas_regsave: + .space 24 /* 3 * sizeof(register_t) */ +GLOBAL(ofmsr) + .llong 0, 0, 0, 0, 0 /* msr/sprg0-3 used in Open Firmware */ +GLOBAL(rtasmsr) + .llong 0 +GLOBAL(openfirmware_entry) + .llong 0 /* Open Firmware entry point */ +GLOBAL(rtas_entry) + .llong 0 /* RTAS entry point */ + +/* + * Open Firmware Real-mode Entry Point. This is a huge pain. + */ + +ASENTRY(ofwcall) + mflr %r0 + std %r0,16(%r1) + stdu %r1,-208(%r1) + + /* + * We need to save the following, because OF's register save/ + * restore code assumes that the contents of registers are + * at most 32 bits wide: lr, cr, r2, r13-r31, the old MSR. These + * get placed in that order in the stack. + */ + + mfcr %r4 + std %r4,48(%r1) + std %r13,56(%r1) + std %r14,64(%r1) + std %r15,72(%r1) + std %r16,80(%r1) + std %r17,88(%r1) + std %r18,96(%r1) + std %r19,104(%r1) + std %r20,112(%r1) + std %r21,120(%r1) + std %r22,128(%r1) + std %r23,136(%r1) + std %r24,144(%r1) + std %r25,152(%r1) + std %r26,160(%r1) + std %r27,168(%r1) + std %r28,176(%r1) + std %r29,184(%r1) + std %r30,192(%r1) + std %r31,200(%r1) + + /* Record the old MSR */ + mfmsr %r6 + + /* read client interface handler */ + lis %r4,openfirmware_entry@ha + ld %r4,openfirmware_entry@l(%r4) + + /* + * Set the MSR to the OF value. This has the side effect of disabling + * exceptions, which is important for the next few steps. + */ + + lis %r5,ofmsr@ha + ld %r5,ofmsr@l(%r5) + mtmsrd %r5 + isync + + /* + * Set up OF stack. This needs to be accessible in real mode and + * use the 32-bit ABI stack frame format. The pointer to the current + * kernel stack is placed at the very top of the stack along with + * the old MSR so we can get them back later. + */ + mr %r5,%r1 + lis %r1,(ofwstk+OFWSTKSZ-32)@ha + addi %r1,%r1,(ofwstk+OFWSTKSZ-32)@l + std %r5,8(%r1) /* Save real stack pointer */ + std %r2,16(%r1) /* Save old TOC */ + std %r6,24(%r1) /* Save old MSR */ + li %r5,0 + stw %r5,4(%r1) + stw %r5,0(%r1) + + /* Finally, branch to OF */ + mtctr %r4 + bctrl + + /* Reload stack pointer and MSR from the OFW stack */ + ld %r6,24(%r1) + ld %r2,16(%r1) + ld %r1,8(%r1) + + /* Now set the real MSR */ + mtmsrd %r6 + isync + + /* Sign-extend the return value from OF */ + extsw %r3,%r3 + + /* Restore all the non-volatile registers */ + ld %r5,48(%r1) + mtcr %r5 + ld %r13,56(%r1) + ld %r14,64(%r1) + ld %r15,72(%r1) + ld %r16,80(%r1) + ld %r17,88(%r1) + ld %r18,96(%r1) + ld %r19,104(%r1) + ld %r20,112(%r1) + ld %r21,120(%r1) + ld %r22,128(%r1) + ld %r23,136(%r1) + ld %r24,144(%r1) + ld %r25,152(%r1) + ld %r26,160(%r1) + ld %r27,168(%r1) + ld %r28,176(%r1) + ld %r29,184(%r1) + ld %r30,192(%r1) + ld %r31,200(%r1) + + /* Restore the stack and link register */ + ld %r1,0(%r1) + ld %r0,16(%r1) + mtlr %r0 + blr + +/* + * RTAS 32-bit Entry Point. Similar to the OF one, but simpler (no separate + * stack) + * + * C prototype: int rtascall(void *callbuffer, void *rtas_privdat); + */ + +ASENTRY(rtascall) + mflr %r0 + std %r0,16(%r1) + stdu %r1,-208(%r1) + + /* + * We need to save the following, because RTAS's register save/ + * restore code assumes that the contents of registers are + * at most 32 bits wide: lr, cr, r2, r13-r31, the old MSR. These + * get placed in that order in the stack. + */ + + mfcr %r5 + std %r5,48(%r1) + std %r13,56(%r1) + std %r14,64(%r1) + std %r15,72(%r1) + std %r16,80(%r1) + std %r17,88(%r1) + std %r18,96(%r1) + std %r19,104(%r1) + std %r20,112(%r1) + std %r21,120(%r1) + std %r22,128(%r1) + std %r23,136(%r1) + std %r24,144(%r1) + std %r25,152(%r1) + std %r26,160(%r1) + std %r27,168(%r1) + std %r28,176(%r1) + std %r29,184(%r1) + std %r30,192(%r1) + std %r31,200(%r1) + + /* Record the old MSR */ + mfmsr %r6 + + /* read client interface handler */ + lis %r5,rtas_entry@ha + ld %r5,rtas_entry@l(%r5) + + /* + * Set the MSR to the RTAS value. This has the side effect of disabling + * exceptions, which is important for the next few steps. + */ + + lis %r7,rtasmsr@ha + ld %r7,rtasmsr@l(%r7) + mtmsrd %r7 + isync + + /* + * Set up RTAS register save area, so that we can get back all of + * our 64-bit pointers. Save our stack pointer, the TOC, and the MSR. + * Put this in r1, since RTAS is obliged to save it. Kernel globals + * are below 4 GB, so this is safe. + */ + mr %r7,%r1 + lis %r1,rtas_regsave@ha + addi %r1,%r1,rtas_regsave@l + std %r7,0(%r1) /* Save 64-bit stack pointer */ + std %r2,8(%r1) /* Save TOC */ + std %r6,16(%r1) /* Save MSR */ + + /* Finally, branch to RTAS */ + mtctr %r5 + bctrl + + /* + * Reload stack pointer and MSR from the reg save area in r1. We are + * running in 32-bit mode at this point, so it doesn't matter if r1 + * has become sign-extended. + */ + ld %r6,16(%r1) + ld %r2,8(%r1) + ld %r1,0(%r1) + + /* Now set the real MSR */ + mtmsrd %r6 + isync + + /* Sign-extend the return value from RTAS */ + extsw %r3,%r3 + + /* Restore all the non-volatile registers */ + ld %r5,48(%r1) + mtcr %r5 + ld %r13,56(%r1) + ld %r14,64(%r1) + ld %r15,72(%r1) + ld %r16,80(%r1) + ld %r17,88(%r1) + ld %r18,96(%r1) + ld %r19,104(%r1) + ld %r20,112(%r1) + ld %r21,120(%r1) + ld %r22,128(%r1) + ld %r23,136(%r1) + ld %r24,144(%r1) + ld %r25,152(%r1) + ld %r26,160(%r1) + ld %r27,168(%r1) + ld %r28,176(%r1) + ld %r29,184(%r1) + ld %r30,192(%r1) + ld %r31,200(%r1) + + /* Restore the stack and link register */ + ld %r1,0(%r1) + ld %r0,16(%r1) + mtlr %r0 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 14:15:44 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3A8B1065670; Thu, 2 Jun 2011 14:15:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B3E248FC1F; Thu, 2 Jun 2011 14:15:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52EFiOQ021018; Thu, 2 Jun 2011 14:15:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52EFiM0021013; Thu, 2 Jun 2011 14:15:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106021415.p52EFiM0021013@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 2 Jun 2011 14:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222614 - head/sys/powerpc/aim X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 14:15:44 -0000 Author: nwhitehorn Date: Thu Jun 2 14:15:44 2011 New Revision: 222614 URL: http://svn.freebsd.org/changeset/base/222614 Log: Remove some dead code: unnecessary isyncs and memory sorting, which are handled in mtmsr() and mem_regions(), respectively. Modified: head/sys/powerpc/aim/interrupt.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/moea64_native.c Modified: head/sys/powerpc/aim/interrupt.c ============================================================================== --- head/sys/powerpc/aim/interrupt.c Thu Jun 2 14:12:37 2011 (r222613) +++ head/sys/powerpc/aim/interrupt.c Thu Jun 2 14:15:44 2011 (r222614) @@ -100,10 +100,8 @@ powerpc_interrupt(struct trapframe *fram default: /* Re-enable interrupts if applicable. */ ee = framep->srr1 & PSL_EE; - if (ee != 0) { + if (ee != 0) mtmsr(mfmsr() | ee); - isync(); - } trap(framep); } } Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Thu Jun 2 14:12:37 2011 (r222613) +++ head/sys/powerpc/aim/mmu_oea.c Thu Jun 2 14:15:44 2011 (r222614) @@ -584,26 +584,9 @@ moea_pte_change(struct pte *pt, struct p /* * Quick sort callout for comparing memory regions. */ -static int mr_cmp(const void *a, const void *b); static int om_cmp(const void *a, const void *b); static int -mr_cmp(const void *a, const void *b) -{ - const struct mem_region *regiona; - const struct mem_region *regionb; - - regiona = a; - regionb = b; - if (regiona->mr_start < regionb->mr_start) - return (-1); - else if (regiona->mr_start > regionb->mr_start) - return (1); - else - return (0); -} - -static int om_cmp(const void *a, const void *b) { const struct ofw_map *mapa; @@ -720,7 +703,6 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k mem_regions(&pregions, &pregions_sz, ®ions, ®ions_sz); CTR0(KTR_PMAP, "moea_bootstrap: physical memory"); - qsort(pregions, pregions_sz, sizeof(*pregions), mr_cmp); for (i = 0; i < pregions_sz; i++) { vm_offset_t pa; vm_offset_t end; @@ -749,7 +731,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k if (sizeof(phys_avail)/sizeof(phys_avail[0]) < regions_sz) panic("moea_bootstrap: phys_avail too small"); - qsort(regions, regions_sz, sizeof(*regions), mr_cmp); + phys_avail_count = 0; physsz = 0; hwphyssz = 0; Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Thu Jun 2 14:12:37 2011 (r222613) +++ head/sys/powerpc/aim/mmu_oea64.c Thu Jun 2 14:15:44 2011 (r222614) @@ -162,8 +162,8 @@ __FBSDID("$FreeBSD$"); void moea64_release_vsid(uint64_t vsid); uintptr_t moea64_get_unique_vsid(void); -#define DISABLE_TRANS(msr) msr = mfmsr(); mtmsr(msr & ~PSL_DR); isync() -#define ENABLE_TRANS(msr) mtmsr(msr); isync() +#define DISABLE_TRANS(msr) msr = mfmsr(); mtmsr(msr & ~PSL_DR) +#define ENABLE_TRANS(msr) mtmsr(msr) #define VSID_MAKE(sr, hash) ((sr) | (((hash) & 0xfffff) << 4)) #define VSID_TO_HASH(vsid) (((vsid) >> 4) & 0xfffff) @@ -473,26 +473,9 @@ moea64_calc_wimg(vm_offset_t pa, vm_mema /* * Quick sort callout for comparing memory regions. */ -static int mr_cmp(const void *a, const void *b); static int om_cmp(const void *a, const void *b); static int -mr_cmp(const void *a, const void *b) -{ - const struct mem_region *regiona; - const struct mem_region *regionb; - - regiona = a; - regionb = b; - if (regiona->mr_start < regionb->mr_start) - return (-1); - else if (regiona->mr_start > regionb->mr_start) - return (1); - else - return (0); -} - -static int om_cmp(const void *a, const void *b) { const struct ofw_map *mapa; @@ -707,10 +690,9 @@ moea64_early_bootstrap(mmu_t mmup, vm_of mem_regions(&pregions, &pregions_sz, ®ions, ®ions_sz); CTR0(KTR_PMAP, "moea64_bootstrap: physical memory"); - qsort(pregions, pregions_sz, sizeof(*pregions), mr_cmp); if (sizeof(phys_avail)/sizeof(phys_avail[0]) < regions_sz) panic("moea64_bootstrap: phys_avail too small"); - qsort(regions, regions_sz, sizeof(*regions), mr_cmp); + phys_avail_count = 0; physsz = 0; hwphyssz = 0; @@ -895,7 +877,7 @@ moea64_late_bootstrap(mmu_t mmup, vm_off * Initialize MMU and remap early physical mappings */ MMU_CPU_BOOTSTRAP(mmup,0); - mtmsr(mfmsr() | PSL_DR | PSL_IR); isync(); + mtmsr(mfmsr() | PSL_DR | PSL_IR); pmap_bootstrapped++; bs_remap_earlyboot(); Modified: head/sys/powerpc/aim/moea64_native.c ============================================================================== --- head/sys/powerpc/aim/moea64_native.c Thu Jun 2 14:12:37 2011 (r222613) +++ head/sys/powerpc/aim/moea64_native.c Thu Jun 2 14:15:44 2011 (r222614) @@ -185,8 +185,8 @@ TLBIE(uint64_t vpn) { mtx_unlock_spin(&tlbie_mutex); } -#define DISABLE_TRANS(msr) msr = mfmsr(); mtmsr(msr & ~PSL_DR); isync() -#define ENABLE_TRANS(msr) mtmsr(msr); isync() +#define DISABLE_TRANS(msr) msr = mfmsr(); mtmsr(msr & ~PSL_DR) +#define ENABLE_TRANS(msr) mtmsr(msr) /* * PTEG data. @@ -344,7 +344,7 @@ moea64_cpu_bootstrap_native(mmu_t mmup, * Initialize segment registers and MMU */ - mtmsr(mfmsr() & ~PSL_DR & ~PSL_IR); isync(); + mtmsr(mfmsr() & ~PSL_DR & ~PSL_IR); /* * Install kernel SLB entries From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 14:19:19 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5438C1065686; Thu, 2 Jun 2011 14:19:19 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44D498FC1E; Thu, 2 Jun 2011 14:19:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52EJJjw021171; Thu, 2 Jun 2011 14:19:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52EJJs7021169; Thu, 2 Jun 2011 14:19:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106021419.p52EJJs7021169@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 2 Jun 2011 14:19:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222615 - head/sys/powerpc/aim X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 14:19:19 -0000 Author: nwhitehorn Date: Thu Jun 2 14:19:18 2011 New Revision: 222615 URL: http://svn.freebsd.org/changeset/base/222615 Log: Include the modules area in the mapped kernel code. This fixes the kernel's access to modules and loader metadata when started from real mode, but without a direct map. Modified: head/sys/powerpc/aim/machdep.c Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Thu Jun 2 14:15:44 2011 (r222614) +++ head/sys/powerpc/aim/machdep.c Thu Jun 2 14:19:18 2011 (r222615) @@ -251,7 +251,6 @@ powerpc_init(vm_offset_t startkernel, vm vm_offset_t basekernel, void *mdp) { struct pcpu *pc; - vm_offset_t end; void *generictrap; size_t trap_offset; void *kmdp; @@ -263,7 +262,6 @@ powerpc_init(vm_offset_t startkernel, vm int ppc64; #endif - end = 0; kmdp = NULL; trap_offset = 0; cacheline_warn = 0; @@ -279,7 +277,8 @@ powerpc_init(vm_offset_t startkernel, vm if (kmdp != NULL) { boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); - end = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); + endkernel = ulmax(endkernel, MD_FETCH(kmdp, + MODINFOMD_KERNEND, vm_offset_t)); #ifdef DDB ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 14:21:21 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A38F106564A; Thu, 2 Jun 2011 14:21:21 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AE4A8FC1B; Thu, 2 Jun 2011 14:21:21 +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 p52ELLu8021274; Thu, 2 Jun 2011 14:21:21 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52ELL4F021272; Thu, 2 Jun 2011 14:21:21 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106021421.p52ELL4F021272@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 2 Jun 2011 14:21:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222616 - head/sys/powerpc/aim X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 14:21:21 -0000 Author: nwhitehorn Date: Thu Jun 2 14:21:20 2011 New Revision: 222616 URL: http://svn.freebsd.org/changeset/base/222616 Log: Explicitly initialize the first thread's MSR to PSL_KERNSET. Modified: head/sys/powerpc/aim/machdep.c Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Thu Jun 2 14:19:18 2011 (r222615) +++ head/sys/powerpc/aim/machdep.c Thu Jun 2 14:21:20 2011 (r222616) @@ -526,7 +526,7 @@ powerpc_init(vm_offset_t startkernel, vm pmap_mmu_install(MMU_TYPE_OEA, BUS_PROBE_GENERIC); pmap_bootstrap(startkernel, endkernel); - mtmsr(mfmsr() | PSL_IR|PSL_DR|PSL_ME|PSL_RI); + mtmsr(PSL_KERNSET & ~PSL_EE); isync(); /* From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 14:22:00 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB2B41065673; Thu, 2 Jun 2011 14:22:00 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA89D8FC1D; Thu, 2 Jun 2011 14:22:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52EM0dg021329; Thu, 2 Jun 2011 14:22:00 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52EM0Ns021327; Thu, 2 Jun 2011 14:22:00 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106021422.p52EM0Ns021327@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 2 Jun 2011 14:22:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222617 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 14:22:01 -0000 Author: nwhitehorn Date: Thu Jun 2 14:22:00 2011 New Revision: 222617 URL: http://svn.freebsd.org/changeset/base/222617 Log: Missed file in r222613. Modified: head/sys/conf/files.powerpc Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Thu Jun 2 14:21:20 2011 (r222616) +++ head/sys/conf/files.powerpc Thu Jun 2 14:22:00 2011 (r222617) @@ -87,7 +87,6 @@ powerpc/aim/moea64_if.m optional aim powerpc/aim/moea64_native.c optional aim powerpc/aim/mp_cpudep.c optional aim smp powerpc/aim/nexus.c optional aim -powerpc/aim/ofwmagic.S optional aim powerpc/aim/slb.c optional aim powerpc64 powerpc/aim/swtch32.S optional aim powerpc powerpc/aim/swtch64.S optional aim powerpc64 @@ -137,6 +136,10 @@ powerpc/ofw/ofw_pcibus.c optional pci ai powerpc/ofw/ofw_pcib_pci.c optional pci aim powerpc/ofw/ofw_real.c optional aim powerpc/ofw/ofw_syscons.c optional sc aim +powerpc/ofw/ofwcall32.S optional aim powerpc +powerpc/ofw/ofwcall64.S optional aim powerpc64 +powerpc/ofw/ofwmagic.S optional aim +powerpc/ofw/rtas.c optional aim powerpc/powermac/ata_kauai.c optional powermac ata | powermac atamacio powerpc/powermac/ata_macio.c optional powermac ata | powermac atamacio powerpc/powermac/ata_dbdma.c optional powermac ata | powermac atamacio From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 14:23:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B434106564A; Thu, 2 Jun 2011 14:23:36 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7BD688FC08; Thu, 2 Jun 2011 14:23:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52ENa3Y021422; Thu, 2 Jun 2011 14:23:36 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52ENadb021420; Thu, 2 Jun 2011 14:23:36 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106021423.p52ENadb021420@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 2 Jun 2011 14:23:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222618 - head/sys/powerpc/aim X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 14:23:37 -0000 Author: nwhitehorn Date: Thu Jun 2 14:23:36 2011 New Revision: 222618 URL: http://svn.freebsd.org/changeset/base/222618 Log: If running under a hypervisor, don't yell at the user about starting unknown CPU types, instead relying on the hypervisor to have given us a reasonable environment. Modified: head/sys/powerpc/aim/mp_cpudep.c Modified: head/sys/powerpc/aim/mp_cpudep.c ============================================================================== --- head/sys/powerpc/aim/mp_cpudep.c Thu Jun 2 14:22:00 2011 (r222617) +++ head/sys/powerpc/aim/mp_cpudep.c Thu Jun 2 14:23:36 2011 (r222618) @@ -87,7 +87,6 @@ cpudep_ap_bootstrap(void) msr = PSL_KERNSET & ~PSL_EE; mtmsr(msr); - isync(); pcpup->pc_curthread = pcpup->pc_idlethread; pcpup->pc_curpcb = pcpup->pc_curthread->td_pcb; @@ -344,6 +343,10 @@ cpudep_ap_setup() break; default: +#ifdef __powerpc64__ + if (!(mfmsr() & PSL_HV)) /* Rely on HV to have set things up */ + break; +#endif printf("WARNING: Unknown CPU type. Cache performace may be " "suboptimal.\n"); break; From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 14:25:28 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37704106564A; Thu, 2 Jun 2011 14:25:28 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E7BF8FC20; Thu, 2 Jun 2011 14:25: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 p52EPSUK021515; Thu, 2 Jun 2011 14:25:28 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52EPRYZ021511; Thu, 2 Jun 2011 14:25:27 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201106021425.p52EPRYZ021511@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 2 Jun 2011 14:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222619 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 14:25:28 -0000 Author: bz Date: Thu Jun 2 14:25:27 2011 New Revision: 222619 URL: http://svn.freebsd.org/changeset/base/222619 Log: Write the multi step netconfig to a temporary file and only move that to the final name if netconfig was completely finished. This fixes reentrance problems even better than r222611. Suggested by: nwhitehorn Reviewed by: nwhitehorn Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems Modified: head/usr.sbin/bsdinstall/scripts/netconfig head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Modified: head/usr.sbin/bsdinstall/scripts/netconfig ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig Thu Jun 2 14:23:36 2011 (r222618) +++ head/usr.sbin/bsdinstall/scripts/netconfig Thu Jun 2 14:25:27 2011 (r222619) @@ -54,14 +54,14 @@ INTERFACE=`echo $DIALOG_TAGS | xargs dia if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi exec 3>&- -: > $BSDINSTALL_TMPETC/rc.conf.net +: > $BSDINSTALL_TMPETC/._rc.conf.net # Do a dirty check to see if this a wireless interface -- there should be a # better way IFCONFIG_PREFIX="" if ifconfig $INTERFACE | grep -q 'media: IEEE 802.11 Wireless'; then NEXT_WLAN_IFACE=wlan0 # XXX - echo wlans_$INTERFACE=\"$NEXT_WLAN_IFACE\" >> $BSDINSTALL_TMPETC/rc.conf.net + echo wlans_$INTERFACE=\"$NEXT_WLAN_IFACE\" >> $BSDINSTALL_TMPETC/._rc.conf.net IFCONFIG_PREFIX="WPA " if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then ifconfig $NEXT_WLAN_IFACE create wlandev $INTERFACE @@ -95,7 +95,7 @@ fi # In case wlanconfig left an option and we do not support IPv4 we need to write # it out on its own. We cannot write it out with IPv6 as that suffix. if [ ${IPV4_AVAIL} -eq 0 -a -n ${IFCONFIG_PREFIX} ]; then - echo ifconfig_${INTERFACE}=\"${IFCONFIG_PREFIX}\" >> $BSDINSTALL_TMPETC/rc.conf.net + echo ifconfig_${INTERFACE}=\"${IFCONFIG_PREFIX}\" >> $BSDINSTALL_TMPETC/._rc.conf.net fi if [ ${IPV6_AVAIL} -eq 1 ]; then dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \ @@ -192,3 +192,4 @@ BEGIN { printf "nameserver %s\n", $1; }' > ${BSDINSTALL_TMPETC}/resolv.conf +mv $BSDINSTALL_TMPETC/._rc.conf.net $BSDINSTALL_TMPETC/rc.conf.net Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu Jun 2 14:23:36 2011 (r222618) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu Jun 2 14:25:27 2011 (r222619) @@ -44,7 +44,7 @@ esac dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0 if [ $? -eq $DIALOG_OK ]; then - echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/rc.conf.net + echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/._rc.conf.net if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0 @@ -74,10 +74,10 @@ echo $INTERFACE $IF_CONFIG | awk -v prefix="$IFCONFIG_PREFIX" '{ printf("ifconfig_%s=\"%s inet %s netmask %s\"\n", $1, prefix, $2, $3); printf("defaultrouter=\"%s\"\n", $4); - }' >> $BSDINSTALL_TMPETC/rc.conf.net + }' >> $BSDINSTALL_TMPETC/._rc.conf.net if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then - . $BSDINSTALL_TMPETC/rc.conf.net + . $BSDINSTALL_TMPETC/._rc.conf.net ifconfig $INTERFACE inet `eval echo \\\$ifconfig_$INTERFACE` route delete -inet default route add -inet default $defaultrouter Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Thu Jun 2 14:23:36 2011 (r222618) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Thu Jun 2 14:25:27 2011 (r222619) @@ -69,7 +69,7 @@ while : ; do continue fi fi - echo ifconfig_${INTERFACE}_ipv6=\"inet6 accept_rtadv\" >> $BSDINSTALL_TMPETC/rc.conf.net + echo ifconfig_${INTERFACE}_ipv6=\"inet6 accept_rtadv\" >> $BSDINSTALL_TMPETC/._rc.conf.net exit 0 else break @@ -138,10 +138,10 @@ BEGIN { sub("$", "/64", $1); } printf("ifconfig_%s_ipv6=\"inet6 %s\"\n", iface, $1); -}' >> $BSDINSTALL_TMPETC/rc.conf.net +}' >> $BSDINSTALL_TMPETC/._rc.conf.net if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then - . $BSDINSTALL_TMPETC/rc.conf.net + . $BSDINSTALL_TMPETC/._rc.conf.net ifconfig ${INTERFACE} `eval echo \\\$ifconfig_${INTERFACE}_ipv6` route delete default route add default ${ipv6_defaultrouter} From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 14:25:52 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A82441065670; Thu, 2 Jun 2011 14:25:52 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9774F8FC16; Thu, 2 Jun 2011 14:25:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52EPqRJ021566; Thu, 2 Jun 2011 14:25:52 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52EPq6V021561; Thu, 2 Jun 2011 14:25:52 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106021425.p52EPq6V021561@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 2 Jun 2011 14:25:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222620 - in head/sys/powerpc: aim include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 14:25:52 -0000 Author: nwhitehorn Date: Thu Jun 2 14:25:52 2011 New Revision: 222620 URL: http://svn.freebsd.org/changeset/base/222620 Log: The POWER7 has only 32 SLB slots instead of 64, like other supported 64-bit PowerPC CPUs. Add infrastructure to support variable numbers of SLB slots and move the user slot from 63 to 0, so that it is always available. Modified: head/sys/powerpc/aim/machdep.c head/sys/powerpc/aim/slb.c head/sys/powerpc/aim/trap_subr64.S head/sys/powerpc/include/slb.h Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Thu Jun 2 14:25:27 2011 (r222619) +++ head/sys/powerpc/aim/machdep.c Thu Jun 2 14:25:52 2011 (r222620) @@ -132,6 +132,7 @@ extern vm_offset_t ksym_start, ksym_end; int cold = 1; #ifdef __powerpc64__ +extern int n_slbs; int cacheline_size = 128; #else int cacheline_size = 32; @@ -337,13 +338,13 @@ powerpc_init(vm_offset_t startkernel, vm kdb_init(); - /* - * PowerPC 970 CPUs have a misfeature requested by Apple that makes - * them pretend they have a 32-byte cacheline. Turn this off - * before we measure the cacheline size. - */ - + /* Various very early CPU fix ups */ switch (mfpvr() >> 16) { + /* + * PowerPC 970 CPUs have a misfeature requested by Apple that + * makes them pretend they have a 32-byte cacheline. Turn this + * off before we measure the cacheline size. + */ case IBM970: case IBM970FX: case IBM970MP: @@ -352,6 +353,12 @@ powerpc_init(vm_offset_t startkernel, vm scratch &= ~HID5_970_DCBZ_SIZE_HI; mtspr(SPR_HID5, scratch); break; + #ifdef __powerpc64__ + case IBMPOWER7: + /* XXX: get from ibm,slb-size in device tree */ + n_slbs = 32; + break; + #endif } /* @@ -367,7 +374,6 @@ powerpc_init(vm_offset_t startkernel, vm msr = mfmsr(); mtmsr((msr & ~(PSL_IR | PSL_DR)) | PSL_RI); - isync(); /* * Measure the cacheline size using dcbz @@ -502,7 +508,6 @@ powerpc_init(vm_offset_t startkernel, vm * Restore MSR */ mtmsr(msr); - isync(); /* Warn if cachline size was not determined */ if (cacheline_warn == 1) { @@ -527,7 +532,6 @@ powerpc_init(vm_offset_t startkernel, vm pmap_bootstrap(startkernel, endkernel); mtmsr(PSL_KERNSET & ~PSL_EE); - isync(); /* * Initialize params/tunables that are derived from memsize Modified: head/sys/powerpc/aim/slb.c ============================================================================== --- head/sys/powerpc/aim/slb.c Thu Jun 2 14:25:27 2011 (r222619) +++ head/sys/powerpc/aim/slb.c Thu Jun 2 14:25:52 2011 (r222620) @@ -51,8 +51,9 @@ uintptr_t moea64_get_unique_vsid(void); void moea64_release_vsid(uint64_t vsid); static void slb_zone_init(void *); -uma_zone_t slbt_zone; -uma_zone_t slb_cache_zone; +static uma_zone_t slbt_zone; +static uma_zone_t slb_cache_zone; +int n_slbs = 64; SYSINIT(slb_zone_init, SI_SUB_KMEM, SI_ORDER_ANY, slb_zone_init, NULL); @@ -426,16 +427,18 @@ slb_insert_kernel(uint64_t slbe, uint64_ /* Check for an unused slot, abusing the user slot as a full flag */ if (slbcache[USER_SLB_SLOT].slbe == 0) { - for (i = 0; i < USER_SLB_SLOT; i++) { + for (i = 0; i < n_slbs; i++) { + if (i == USER_SLB_SLOT) + continue; if (!(slbcache[i].slbe & SLBE_VALID)) goto fillkernslb; } - if (i == USER_SLB_SLOT) + if (i == n_slbs) slbcache[USER_SLB_SLOT].slbe = 1; } - for (i = mftb() % 64, j = 0; j < 64; j++, i = (i+1) % 64) { + for (i = mftb() % n_slbs, j = 0; j < n_slbs; j++, i = (i+1) % n_slbs) { if (i == USER_SLB_SLOT) continue; @@ -443,9 +446,11 @@ slb_insert_kernel(uint64_t slbe, uint64_ break; } - KASSERT(j < 64, ("All kernel SLB slots locked!")); + KASSERT(j < n_slbs, ("All kernel SLB slots locked!")); fillkernslb: + KASSERT(i != USER_SLB_SLOT, + ("Filling user SLB slot with a kernel mapping")); slbcache[i].slbv = slbv; slbcache[i].slbe = slbe | (uint64_t)i; @@ -466,11 +471,11 @@ slb_insert_user(pmap_t pm, struct slb *s PMAP_LOCK_ASSERT(pm, MA_OWNED); - if (pm->pm_slb_len < 64) { + if (pm->pm_slb_len < n_slbs) { i = pm->pm_slb_len; pm->pm_slb_len++; } else { - i = mftb() % 64; + i = mftb() % n_slbs; } /* Note that this replacement is atomic with respect to trap_subr */ @@ -521,8 +526,9 @@ slb_zone_init(void *dummy) slbt_zone = uma_zcreate("SLB tree node", sizeof(struct slbtnode), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); - slb_cache_zone = uma_zcreate("SLB cache", 64*sizeof(struct slb *), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); + slb_cache_zone = uma_zcreate("SLB cache", + (n_slbs + 1)*sizeof(struct slb *), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, UMA_ZONE_VM); if (platform_real_maxaddr() != VM_MAX_ADDRESS) { uma_zone_set_allocf(slb_cache_zone, slb_uma_real_alloc); Modified: head/sys/powerpc/aim/trap_subr64.S ============================================================================== --- head/sys/powerpc/aim/trap_subr64.S Thu Jun 2 14:25:27 2011 (r222619) +++ head/sys/powerpc/aim/trap_subr64.S Thu Jun 2 14:25:52 2011 (r222620) @@ -53,55 +53,53 @@ * User SRs are loaded through a pointer to the current pmap. */ restore_usersrs: - GET_CPUINFO(%r28); - ld %r28,PC_USERSLB(%r28); + GET_CPUINFO(%r28) + ld %r28,PC_USERSLB(%r28) li %r29, 0 /* Set the counter to zero */ slbia slbmfee %r31,%r29 clrrdi %r31,%r31,28 slbie %r31 -instuserslb: - ld %r31, 0(%r28); /* Load SLB entry pointer */ - cmpli 0, %r31, 0; /* If NULL, stop */ - beqlr; +1: ld %r31, 0(%r28) /* Load SLB entry pointer */ + cmpli 0, %r31, 0 /* If NULL, stop */ + beqlr ld %r30, 0(%r31) /* Load SLBV */ ld %r31, 8(%r31) /* Load SLBE */ or %r31, %r31, %r29 /* Set SLBE slot */ - slbmte %r30, %r31; /* Install SLB entry */ + slbmte %r30, %r31 /* Install SLB entry */ - addi %r28, %r28, 8; /* Advance pointer */ - addi %r29, %r29, 1; - cmpli 0, %r29, 64; /* Repeat if we are not at the end */ - blt instuserslb; - blr; + addi %r28, %r28, 8 /* Advance pointer */ + addi %r29, %r29, 1 + b 1b /* Repeat */ /* * Kernel SRs are loaded directly from the PCPU fields */ restore_kernsrs: - GET_CPUINFO(%r28); - addi %r28,%r28,PC_KERNSLB; + GET_CPUINFO(%r28) + addi %r28,%r28,PC_KERNSLB li %r29, 0 /* Set the counter to zero */ slbia slbmfee %r31,%r29 clrrdi %r31,%r31,28 slbie %r31 -instkernslb: - ld %r31, 8(%r28); /* Load SLBE */ +1: cmpli 0, %r29, USER_SLB_SLOT /* Skip the user slot */ + beq- 2f - cmpli 0, %r31, 0; /* If SLBE is not valid, stop */ - beqlr; + ld %r31, 8(%r28) /* Load SLBE */ + cmpli 0, %r31, 0 /* If SLBE is not valid, stop */ + beqlr ld %r30, 0(%r28) /* Load SLBV */ - slbmte %r30, %r31; /* Install SLB entry */ + slbmte %r30, %r31 /* Install SLB entry */ - addi %r28, %r28, 16; /* Advance pointer */ - addi %r29, %r29, 1; - cmpli 0, %r29, USER_SLB_SLOT; /* Repeat if we are not at the end */ - blt instkernslb; - blr; +2: addi %r28, %r28, 16 /* Advance pointer */ + addi %r29, %r29, 1 + cmpli 0, %r29, 64 /* Repeat if we are not at the end */ + blt 1b + blr /* * FRAME_SETUP assumes: Modified: head/sys/powerpc/include/slb.h ============================================================================== --- head/sys/powerpc/include/slb.h Thu Jun 2 14:25:27 2011 (r222619) +++ head/sys/powerpc/include/slb.h Thu Jun 2 14:25:52 2011 (r222620) @@ -65,7 +65,7 @@ /* * User segment for copyin/out */ -#define USER_SLB_SLOT 63 +#define USER_SLB_SLOT 0 #define USER_SLB_SLBE (((USER_ADDR >> ADDR_SR_SHFT) << SLBE_ESID_SHIFT) | \ SLBE_VALID | USER_SLB_SLOT) From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 16:42:36 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id CCCD31065673; Thu, 2 Jun 2011 16:42:36 +0000 (UTC) Date: Thu, 2 Jun 2011 16:42:36 +0000 From: Alexander Best To: John Baldwin Message-ID: <20110602164236.GA95713@freebsd.org> References: <201105311511.p4VFBNnu028827@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201105311511.p4VFBNnu028827@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222530 - in head: contrib/top usr.bin/top X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 16:42:36 -0000 On Tue May 31 11, John Baldwin wrote: > Author: jhb > Date: Tue May 31 15:11:23 2011 > New Revision: 222530 > URL: http://svn.freebsd.org/changeset/base/222530 > > Log: > Add a new option to toggle the display of the system idle process (per-CPU > idle threads). The process is displayed by default (subject to whether or > not system processes are displayed) to preserve existing behavior. The > system idle process can be hidden via the '-z' command line argument or the > 'z' key while top is running. When it is hidden, top more closely matches > the behavior of FreeBSD <= 4.x where idle time was not accounted to any > process. does it make sense to have the -z flag and "z" key available, when the -S flag or the "S" key was not specified? cheers. alex > > MFC after: 2 weeks > > Modified: > head/contrib/top/commands.c > head/contrib/top/machine.h > head/contrib/top/top.X > head/contrib/top/top.c > head/usr.bin/top/machine.c > > Modified: head/contrib/top/commands.c > ============================================================================== > --- head/contrib/top/commands.c Tue May 31 15:05:29 2011 (r222529) > +++ head/contrib/top/commands.c Tue May 31 15:11:23 2011 (r222530) > @@ -94,6 +94,7 @@ S - toggle the displaying of syste > a - toggle the displaying of process titles\n\ > t - toggle the display of this process\n\ > u - display processes for only one user (+ selects all users)\n\ > +z - toggle the displaying of the system idle process\n\ > \n\ > \n", stdout); > } > > Modified: head/contrib/top/machine.h > ============================================================================== > --- head/contrib/top/machine.h Tue May 31 15:05:29 2011 (r222529) > +++ head/contrib/top/machine.h Tue May 31 15:11:23 2011 (r222530) > @@ -65,6 +65,7 @@ struct process_select > int uid; /* only this uid (unless uid == -1) */ > int wcpu; /* show weighted cpu */ > int jail; /* show jail ID */ > + int kidle; /* show per-CPU idle threads */ > char *command; /* only this command (unless == NULL) */ > }; > > > Modified: head/contrib/top/top.X > ============================================================================== > --- head/contrib/top/top.X Tue May 31 15:05:29 2011 (r222529) > +++ head/contrib/top/top.X Tue May 31 15:11:23 2011 (r222530) > @@ -10,7 +10,7 @@ top \- display and update information ab > .SH SYNOPSIS > .B top > [ > -.B \-abCHIijnPqStuv > +.B \-abCHIijnPqStuvz > ] [ > .BI \-d count > ] [ > @@ -142,6 +142,9 @@ Write version number information to stde > No other processing takes place when this option is used. To see current > revision information while top is running, use the help command \*(lq?\*(rq. > .TP > +.B \-z > +Do not display the system idle process. > +.TP > .BI \-d count > Show only > .I count > @@ -303,6 +306,9 @@ ID. > Toggle the display of the > .I top > process. > +.TP > +.B z > +Toggle the display of the system idle process. > .SH "THE DISPLAY" > The actual display varies depending on the specific variant of Unix > that the machine is running. This description may not exactly match > > Modified: head/contrib/top/top.c > ============================================================================== > --- head/contrib/top/top.c Tue May 31 15:05:29 2011 (r222529) > +++ head/contrib/top/top.c Tue May 31 15:11:23 2011 (r222530) > @@ -196,9 +196,9 @@ char *argv[]; > fd_set readfds; > > #ifdef ORDER > - static char command_chars[] = "\f qh?en#sdkriIutHmSCajo"; > + static char command_chars[] = "\f qh?en#sdkriIutHmSCajzo"; > #else > - static char command_chars[] = "\f qh?en#sdkriIutHmSCaj"; > + static char command_chars[] = "\f qh?en#sdkriIutHmSCajz"; > #endif > /* these defines enumerate the "strchr"s of the commands in command_chars */ > #define CMD_redraw 0 > @@ -224,8 +224,9 @@ char *argv[]; > #define CMD_wcputog 19 > #define CMD_showargs 20 > #define CMD_jidtog 21 > +#define CMD_kidletog 22 > #ifdef ORDER > -#define CMD_order 22 > +#define CMD_order 23 > #endif > > /* set the buffer for stdout */ > @@ -258,6 +259,7 @@ char *argv[]; > ps.thread = No; > ps.wcpu = 1; > ps.jail = No; > + ps.kidle = Yes; > ps.command = NULL; > > /* get preset options from the environment */ > @@ -283,7 +285,7 @@ char *argv[]; > optind = 1; > } > > - while ((i = getopt(ac, av, "CSIHPabijnquvs:d:U:m:o:t")) != EOF) > + while ((i = getopt(ac, av, "CSIHPabijnquvzs:d:U:m:o:t")) != EOF) > { > switch(i) > { > @@ -412,10 +414,14 @@ char *argv[]; > pcpu_stats = Yes; > break; > > + case 'z': > + ps.kidle = !ps.kidle; > + break; > + > default: > fprintf(stderr, > "Top version %s\n" > -"Usage: %s [-abCHIijnPqStuv] [-d count] [-m io | cpu] [-o field] [-s time]\n" > +"Usage: %s [-abCHIijnPqStuvz] [-d count] [-m io | cpu] [-o field] [-s time]\n" > " [-U username] [number]\n", > version_string(), myname); > exit(1); > @@ -1075,7 +1081,13 @@ restart: > reset_display(); > putchar('\r'); > break; > - > + case CMD_kidletog: > + ps.kidle = !ps.kidle; > + new_message(MT_standout | MT_delayed, > + " %sisplaying system idle process.", > + ps.kidle ? "D" : "Not d"); > + putchar('\r'); > + break; > default: > new_message(MT_standout, " BAD CASE IN SWITCH!"); > putchar('\r'); > > Modified: head/usr.bin/top/machine.c > ============================================================================== > --- head/usr.bin/top/machine.c Tue May 31 15:05:29 2011 (r222529) > +++ head/usr.bin/top/machine.c Tue May 31 15:11:23 2011 (r222530) > @@ -624,6 +624,7 @@ get_process_info(struct system_info *si, > int show_system; > int show_uid; > int show_command; > + int show_kidle; > > /* > * Save the previous process info. > @@ -664,6 +665,7 @@ get_process_info(struct system_info *si, > show_system = sel->system; > show_uid = sel->uid != -1; > show_command = sel->command != NULL; > + show_kidle = sel->kidle; > > /* count up process states and get pointers to interesting procs */ > total_procs = 0; > @@ -705,6 +707,11 @@ get_process_info(struct system_info *si, > /* skip idle or non-running processes */ > continue; > > + if (displaymode == DISP_CPU && !show_kidle && > + pp->ki_tdflags & TDF_IDLETD) > + /* skip kernel idle process */ > + continue; > + > if (displaymode == DISP_IO && !show_idle && p_io == 0) > /* skip processes that aren't doing I/O */ > continue; -- a13x From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 17:14:02 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6DDF106564A; Thu, 2 Jun 2011 17:14:02 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id ACB968FC0C; Thu, 2 Jun 2011 17:14:02 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 4540C46B03; Thu, 2 Jun 2011 13:14:02 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DC73E8A01F; Thu, 2 Jun 2011 13:14:01 -0400 (EDT) From: John Baldwin To: Alexander Best Date: Thu, 2 Jun 2011 13:13:15 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <201105311511.p4VFBNnu028827@svn.freebsd.org> <20110602164236.GA95713@freebsd.org> In-Reply-To: <20110602164236.GA95713@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106021313.15386.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 02 Jun 2011 13:14:02 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222530 - in head: contrib/top usr.bin/top X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 17:14:02 -0000 On Thursday, June 02, 2011 12:42:36 pm Alexander Best wrote: > On Tue May 31 11, John Baldwin wrote: > > Author: jhb > > Date: Tue May 31 15:11:23 2011 > > New Revision: 222530 > > URL: http://svn.freebsd.org/changeset/base/222530 > > > > Log: > > Add a new option to toggle the display of the system idle process (per-CPU > > idle threads). The process is displayed by default (subject to whether or > > not system processes are displayed) to preserve existing behavior. The > > system idle process can be hidden via the '-z' command line argument or the > > 'z' key while top is running. When it is hidden, top more closely matches > > the behavior of FreeBSD <= 4.x where idle time was not accounted to any > > process. > > does it make sense to have the -z flag and "z" key available, when the -S > flag or the "S" key was not specified? I view them as independent just as 'i' and 'S' are. I'm not sure it's worth trying to make it fancier as none of the other keys are dependent on another mode. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 17:43:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AAD8106566B; Thu, 2 Jun 2011 17:43:17 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78BE98FC1E; Thu, 2 Jun 2011 17:43:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52HhHc7027604; Thu, 2 Jun 2011 17:43:17 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52HhH9O027602; Thu, 2 Jun 2011 17:43:17 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106021743.p52HhH9O027602@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 2 Jun 2011 17:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222622 - head/sys/powerpc/ofw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 17:43:17 -0000 Author: nwhitehorn Date: Thu Jun 2 17:43:17 2011 New Revision: 222622 URL: http://svn.freebsd.org/changeset/base/222622 Log: Temporarily back out those parts of r222613 related to parsing the memory map. They cause non-understood boot failures on some Apple machines with more than 2 GB of RAM (like my work desktop). Modified: head/sys/powerpc/ofw/ofw_machdep.c Modified: head/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- head/sys/powerpc/ofw/ofw_machdep.c Thu Jun 2 14:32:15 2011 (r222621) +++ head/sys/powerpc/ofw/ofw_machdep.c Thu Jun 2 17:43:17 2011 (r222622) @@ -60,15 +60,18 @@ __FBSDID("$FreeBSD$"); #include #include -static struct mem_region OFmem[PHYS_AVAIL_SZ], OFavail[PHYS_AVAIL_SZ]; -static struct mem_region OFfree[PHYS_AVAIL_SZ]; +#define OFMEM_REGIONS 32 +static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3]; +static struct mem_region OFfree[OFMEM_REGIONS + 3]; +static int nOFmem; extern register_t ofmsr[5]; +int ofwcall(void *); extern void *openfirmware_entry; static void *fdt; int ofw_real_mode; -int ofwcall(void *); +int ofw_32bit_mode_entry(void *); static void ofw_quiesce(void); static int openfirmware(void *args); @@ -132,32 +135,11 @@ memr_merge(struct mem_region *from, stru to->mr_size = end - to->mr_start; } -/* - * Quick sort callout for comparing memory regions. - */ -static int mr_cmp(const void *a, const void *b); - -static int -mr_cmp(const void *a, const void *b) -{ - const struct mem_region *regiona; - const struct mem_region *regionb; - - regiona = a; - regionb = b; - if (regiona->mr_start < regionb->mr_start) - return (-1); - else if (regiona->mr_start > regionb->mr_start) - return (1); - else - return (0); -} - static int parse_ofw_memory(phandle_t node, const char *prop, struct mem_region *output) { cell_t address_cells, size_cells; - cell_t OFmem[4 * PHYS_AVAIL_SZ]; + cell_t OFmem[4*(OFMEM_REGIONS + 1)]; int sz, i, j; int apple_hack_mode; phandle_t phandle; @@ -194,7 +176,7 @@ parse_ofw_memory(phandle_t node, const c * Get memory. */ if ((node == -1) || (sz = OF_getprop(node, prop, - OFmem, sizeof(OFmem[0]) * 4 * PHYS_AVAIL_SZ)) <= 0) + OFmem, sizeof(OFmem[0]) * 4 * OFMEM_REGIONS)) <= 0) panic("Physical memory map not found"); i = 0; @@ -244,7 +226,7 @@ parse_ofw_memory(phandle_t node, const c #ifdef __powerpc64__ if (apple_hack_mode) { /* Add in regions above 4 GB to the available list */ - struct mem_region himem[PHYS_AVAIL_SZ]; + struct mem_region himem[OFMEM_REGIONS]; int hisz; hisz = parse_ofw_memory(node, "reg", himem); @@ -262,81 +244,6 @@ parse_ofw_memory(phandle_t node, const c return (sz); } -static int -parse_drconf_memory(int *msz, int *asz, struct mem_region *ofmem, - struct mem_region *ofavail) -{ - phandle_t phandle; - vm_offset_t base; - int i, idx, len, lasz, lmsz, res; - uint32_t lmb_size[2]; - unsigned long *dmem, flags; - - lmsz = *msz; - lasz = *asz; - - phandle = OF_finddevice("/ibm,dynamic-reconfiguration-memory"); - if (phandle == -1) - /* No drconf node, return. */ - return (0); - - res = OF_getprop(phandle, "ibm,lmb-size", lmb_size, sizeof(lmb_size)); - if (res == -1) - return (0); - - /* Parse the /ibm,dynamic-memory. - The first position gives the # of entries. The next two words - reflect the address of the memory block. The next four words are - the DRC index, reserved, list index and flags. - (see PAPR C.6.6.2 ibm,dynamic-reconfiguration-memory) - - #el Addr DRC-idx res list-idx flags - ------------------------------------------------- - | 4 | 8 | 4 | 4 | 4 | 4 |.... - ------------------------------------------------- - */ - - len = OF_getproplen(phandle, "ibm,dynamic-memory"); - if (len > 0) { - - /* We have to use a variable length array on the stack - since we have very limited stack space. - */ - cell_t arr[len/sizeof(cell_t)]; - - res = OF_getprop(phandle, "ibm,dynamic-memory", &arr, - sizeof(arr)); - if (res == -1) - return (0); - - /* Number of elements */ - idx = arr[0]; - - /* First address. */ - dmem = (void*)&arr[1]; - - for (i = 0; i < idx; i++) { - base = *dmem; - dmem += 2; - flags = *dmem; - /* Use region only if available and not reserved. */ - if ((flags & 0x8) && !(flags & 0x80)) { - ofmem[lmsz].mr_start = base; - ofmem[lmsz].mr_size = (vm_size_t)lmb_size[1]; - ofavail[lasz].mr_start = base; - ofavail[lasz].mr_size = (vm_size_t)lmb_size[1]; - lmsz++; - lasz++; - } - dmem++; - } - } - - *msz = lmsz; - *asz = lasz; - - return (1); -} /* * This is called during powerpc_init, before the system is really initialized. * It shall provide the total and the available regions of RAM. @@ -349,62 +256,31 @@ ofw_mem_regions(struct mem_region **memp struct mem_region **availp, int *availsz) { phandle_t phandle; - vm_offset_t maxphysaddr; int asz, msz, fsz; - int i, j, res; + int i, j; int still_merging; - char name[31]; asz = msz = 0; /* - * Get memory from all the /memory nodes. + * Get memory. */ - for (phandle = OF_child(OF_peer(0)); phandle != 0; - phandle = OF_peer(phandle)) { - if (OF_getprop(phandle, "name", name, sizeof(name)) <= 0) - continue; - if (strncmp(name, "memory", sizeof(name)) != 0) - continue; - - res = parse_ofw_memory(phandle, "reg", &OFmem[msz]); - msz += res/sizeof(struct mem_region); - if (OF_getproplen(phandle, "available") >= 0) - res = parse_ofw_memory(phandle, "available", - &OFavail[asz]); - else - res = parse_ofw_memory(phandle, "reg", &OFavail[asz]); - asz += res/sizeof(struct mem_region); - } - - /* Check for memory in ibm,dynamic-reconfiguration-memory */ - parse_drconf_memory(&msz, &asz, OFmem, OFavail); + phandle = OF_finddevice("/memory"); + if (phandle == -1) + phandle = OF_finddevice("/memory@0"); - qsort(OFmem, msz, sizeof(*OFmem), mr_cmp); - qsort(OFavail, asz, sizeof(*OFavail), mr_cmp); + msz = parse_ofw_memory(phandle, "reg", OFmem); + nOFmem = msz / sizeof(struct mem_region); + asz = parse_ofw_memory(phandle, "available", OFavail); *memp = OFmem; - *memsz = msz; - - /* - * On some firmwares (SLOF), some memory may be marked available that - * doesn't actually exist. This manifests as an extension of the last - * available segment past the end of physical memory, so truncate that - * one. - */ - maxphysaddr = 0; - for (i = 0; i < msz; i++) - if (OFmem[i].mr_start + OFmem[i].mr_size > maxphysaddr) - maxphysaddr = OFmem[i].mr_start + OFmem[i].mr_size; - - if (OFavail[asz - 1].mr_start + OFavail[asz - 1].mr_size > maxphysaddr) - OFavail[asz - 1].mr_size = maxphysaddr - - OFavail[asz - 1].mr_start; - + *memsz = nOFmem; + /* * OFavail may have overlapping regions - collapse these * and copy out remaining regions to OFfree */ + asz /= sizeof(struct mem_region); do { still_merging = FALSE; for (i = 0; i < asz; i++) { @@ -593,7 +469,12 @@ openfirmware(void *args) int result; #ifdef SMP struct ofw_rv_args rv_args; + #endif + if (pmap_bootstrapped && ofw_real_mode) + args = (void *)pmap_kextract((vm_offset_t)args); + + #ifdef SMP rv_args.args = args; rv_args.in_progress = 1; smp_rendezvous(smp_no_rendevous_barrier, ofw_rendezvous_dispatch, From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 19:25:20 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 5B1551065670; Thu, 2 Jun 2011 19:25:20 +0000 (UTC) Date: Thu, 2 Jun 2011 19:25:20 +0000 From: Alexander Best To: John Baldwin Message-ID: <20110602192520.GA13954@freebsd.org> References: <201105311511.p4VFBNnu028827@svn.freebsd.org> <20110602164236.GA95713@freebsd.org> <201106021313.15386.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201106021313.15386.jhb@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222530 - in head: contrib/top usr.bin/top X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 19:25:20 -0000 On Thu Jun 2 11, John Baldwin wrote: > On Thursday, June 02, 2011 12:42:36 pm Alexander Best wrote: > > On Tue May 31 11, John Baldwin wrote: > > > Author: jhb > > > Date: Tue May 31 15:11:23 2011 > > > New Revision: 222530 > > > URL: http://svn.freebsd.org/changeset/base/222530 > > > > > > Log: > > > Add a new option to toggle the display of the system idle process (per-CPU > > > idle threads). The process is displayed by default (subject to whether or > > > not system processes are displayed) to preserve existing behavior. The > > > system idle process can be hidden via the '-z' command line argument or the > > > 'z' key while top is running. When it is hidden, top more closely matches > > > the behavior of FreeBSD <= 4.x where idle time was not accounted to any > > > process. > > > > does it make sense to have the -z flag and "z" key available, when the -S > > flag or the "S" key was not specified? > > I view them as independent just as 'i' and 'S' are. I'm not sure it's worth > trying to make it fancier as none of the other keys are dependent on another > mode. that's a good point. i hope this commit will survive the new vendor import of top, once it happens. :) cheers. alex > > -- > John Baldwin -- a13x From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 19:33:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4C951065670; Thu, 2 Jun 2011 19:33:33 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B315F8FC12; Thu, 2 Jun 2011 19:33: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 p52JXXNX030937; Thu, 2 Jun 2011 19:33:33 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52JXXLH030935; Thu, 2 Jun 2011 19:33:33 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201106021933.p52JXXLH030935@svn.freebsd.org> From: Rick Macklem Date: Thu, 2 Jun 2011 19:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222623 - head/usr.sbin/mountd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 19:33:34 -0000 Author: rmacklem Date: Thu Jun 2 19:33:33 2011 New Revision: 222623 URL: http://svn.freebsd.org/changeset/base/222623 Log: Fix the nfs related daemons so that they don't intermittently fail with "bind: address already in use". This problem was reported to the freebsd-stable@ mailing list on Feb. 19 under the subject heading "statd/lockd startup failure" by george+freebsd at m5p dot com. The problem is that the first combination of {udp,tcp X ipv4,ipv6} would select a port# dynamically, but one of the other three combinations would have that port# already in use. The patch is somewhat involved because it was requested by dougb@ that the four combinations use the same port# wherever possible. The patch splits the create_service() function into two functions. The first goes as far as bind(2) in a loop for up to GETPORT_MAXTRY - 1 times, attempting to use the same port# for all four cases. If these attempts fail, the last attempt allows the 4 cases to use different port #s. After this function has succeeded, the second function, called complete_service(), does the rest of what create_service() did. The three daemons mountd, rpc.lockd and rpc.statd all have a create_service() function that is patched in a similar way. However, create_service() has non-trivial differences for the three daemons that made it impractical to share the same functions between them. Reviewed by: jhb MFC after: 2 weeks Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Thu Jun 2 17:43:17 2011 (r222622) +++ head/usr.sbin/mountd/mountd.c Thu Jun 2 19:33:33 2011 (r222623) @@ -158,6 +158,8 @@ struct fhreturn { int *fhr_secflavors; }; +#define GETPORT_MAXTRY 20 /* Max tries to get a port # */ + /* Global defs */ char *add_expdir(struct dirlist **, char *, int); void add_dlist(struct dirlist **, struct dirlist *, @@ -167,7 +169,9 @@ int check_dirpath(char *); int check_options(struct dirlist *); int checkmask(struct sockaddr *sa); int chk_host(struct dirlist *, struct sockaddr *, int *, int *); -void create_service(struct netconfig *nconf); +static int create_service(struct netconfig *nconf); +static void complete_service(struct netconfig *nconf, char *port_str); +static void clearout_service(void); void del_mlist(char *hostp, char *dirp); struct dirlist *dirp_search(struct dirlist *, char *); int do_mount(struct exportlist *, struct grouplist *, int, @@ -233,6 +237,10 @@ int got_sighup = 0; int xcreated = 0; char *svcport_str = NULL; +static int mallocd_svcport = 0; +static int *sock_fd; +static int sock_fdcnt; +static int sock_fdpos; int opt_flags; static int have_v6 = 1; @@ -281,6 +289,8 @@ main(int argc, char **argv) in_port_t svcport; int c, k, s; int maxrec = RPC_MAXDATASIZE; + int attempt_cnt, port_len, port_pos, ret; + char **port_list; /* Check that another mountd isn't already running. */ pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &otherpid); @@ -451,17 +461,97 @@ main(int argc, char **argv) hosts[nhosts - 1] = "127.0.0.1"; } + attempt_cnt = 1; + sock_fdcnt = 0; + sock_fd = NULL; + port_list = NULL; + port_len = 0; + nc_handle = setnetconfig(); + while ((nconf = getnetconfig(nc_handle))) { + if (nconf->nc_flag & NC_VISIBLE) { + if (have_v6 == 0 && strcmp(nconf->nc_protofmly, + "inet6") == 0) { + /* DO NOTHING */ + } else { + ret = create_service(nconf); + if (ret == 1) + /* Ignore this call */ + continue; + if (ret < 0) { + /* + * Failed to bind port, so close off + * all sockets created and try again + * if the port# was dynamically + * assigned via bind(2). + */ + clearout_service(); + if (mallocd_svcport != 0 && + attempt_cnt < GETPORT_MAXTRY) { + free(svcport_str); + svcport_str = NULL; + mallocd_svcport = 0; + } else { + errno = EADDRINUSE; + syslog(LOG_ERR, + "bindresvport_sa: %m"); + exit(1); + } + + /* Start over at the first service. */ + free(sock_fd); + sock_fdcnt = 0; + sock_fd = NULL; + nc_handle = setnetconfig(); + attempt_cnt++; + } else if (mallocd_svcport != 0 && + attempt_cnt == GETPORT_MAXTRY) { + /* + * For the last attempt, allow + * different port #s for each nconf + * by saving the svcport_str and + * setting it back to NULL. + */ + port_list = realloc(port_list, + (port_len + 1) * sizeof(char *)); + if (port_list == NULL) + out_of_mem(); + port_list[port_len++] = svcport_str; + svcport_str = NULL; + mallocd_svcport = 0; + } + } + } + } + + /* + * Successfully bound the ports, so call complete_service() to + * do the rest of the setup on the service(s). + */ + sock_fdpos = 0; + port_pos = 0; nc_handle = setnetconfig(); while ((nconf = getnetconfig(nc_handle))) { if (nconf->nc_flag & NC_VISIBLE) { if (have_v6 == 0 && strcmp(nconf->nc_protofmly, "inet6") == 0) { /* DO NOTHING */ + } else if (port_list != NULL) { + if (port_pos >= port_len) { + syslog(LOG_ERR, "too many port#s"); + exit(1); + } + complete_service(nconf, port_list[port_pos++]); } else - create_service(nconf); + complete_service(nconf, svcport_str); } } endnetconfig(nc_handle); + free(sock_fd); + if (port_list != NULL) { + for (port_pos = 0; port_pos < port_len; port_pos++) + free(port_list[port_pos]); + free(port_list); + } if (xcreated == 0) { syslog(LOG_ERR, "could not create any services"); @@ -491,30 +581,31 @@ main(int argc, char **argv) /* * This routine creates and binds sockets on the appropriate - * addresses. It gets called one time for each transport and - * registrates the service with rpcbind on that trasport. + * addresses. It gets called one time for each transport. + * It returns 0 upon success, 1 for ingore the call and -1 to indicate + * bind failed with EADDRINUSE. + * Any file descriptors that have been created are stored in sock_fd and + * the total count of them is maintained in sock_fdcnt. */ -void +static int create_service(struct netconfig *nconf) { struct addrinfo hints, *res = NULL; struct sockaddr_in *sin; struct sockaddr_in6 *sin6; struct __rpc_sockinfo si; - struct netbuf servaddr; - SVCXPRT *transp = NULL; int aicode; int fd; int nhostsbak; int one = 1; int r; - int registered = 0; u_int32_t host_addr[4]; /* IPv4 or IPv6 */ + int mallocd_res; if ((nconf->nc_semantics != NC_TPI_CLTS) && (nconf->nc_semantics != NC_TPI_COTS) && (nconf->nc_semantics != NC_TPI_COTS_ORD)) - return; /* not my type */ + return (1); /* not my type */ /* * XXX - using RPC library internal functions. @@ -522,7 +613,7 @@ create_service(struct netconfig *nconf) if (!__rpc_nconf2sockinfo(nconf, &si)) { syslog(LOG_ERR, "cannot get information for %s", nconf->nc_netid); - return; + return (1); } /* Get mountd's address on this transport */ @@ -538,6 +629,12 @@ create_service(struct netconfig *nconf) nhostsbak = nhosts; while (nhostsbak > 0) { --nhostsbak; + sock_fd = realloc(sock_fd, (sock_fdcnt + 1) * sizeof(int)); + if (sock_fd == NULL) + out_of_mem(); + sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */ + mallocd_res = 0; + /* * XXX - using RPC library internal functions. */ @@ -549,14 +646,16 @@ create_service(struct netconfig *nconf) syslog(non_fatal ? LOG_DEBUG : LOG_ERR, "cannot create socket for %s", nconf->nc_netid); - return; + if (non_fatal != 0) + continue; + exit(1); } switch (hints.ai_family) { case AF_INET: if (inet_pton(AF_INET, hosts[nhostsbak], host_addr) == 1) { - hints.ai_flags &= AI_NUMERICHOST; + hints.ai_flags |= AI_NUMERICHOST; } else { /* * Skip if we have an AF_INET6 address. @@ -571,7 +670,7 @@ create_service(struct netconfig *nconf) case AF_INET6: if (inet_pton(AF_INET6, hosts[nhostsbak], host_addr) == 1) { - hints.ai_flags &= AI_NUMERICHOST; + hints.ai_flags |= AI_NUMERICHOST; } else { /* * Skip if we have an AF_INET address. @@ -607,6 +706,7 @@ create_service(struct netconfig *nconf) res = malloc(sizeof(struct addrinfo)); if (res == NULL) out_of_mem(); + mallocd_res = 1; res->ai_flags = hints.ai_flags; res->ai_family = hints.ai_family; res->ai_protocol = hints.ai_protocol; @@ -620,7 +720,7 @@ create_service(struct netconfig *nconf) sin->sin_addr.s_addr = htonl(INADDR_ANY); res->ai_addr = (struct sockaddr*) sin; res->ai_addrlen = (socklen_t) - sizeof(res->ai_addr); + sizeof(struct sockaddr_in); break; case AF_INET6: sin6 = malloc(sizeof(struct sockaddr_in6)); @@ -631,10 +731,12 @@ create_service(struct netconfig *nconf) sin6->sin6_addr = in6addr_any; res->ai_addr = (struct sockaddr*) sin6; res->ai_addrlen = (socklen_t) - sizeof(res->ai_addr); - break; - default: + sizeof(struct sockaddr_in6); break; + default: + syslog(LOG_ERR, "bad addr fam %d", + res->ai_family); + exit(1); } } else { if ((aicode = getaddrinfo(NULL, svcport_str, @@ -643,6 +745,7 @@ create_service(struct netconfig *nconf) "cannot get local address for %s: %s", nconf->nc_netid, gai_strerror(aicode)); + close(fd); continue; } } @@ -652,16 +755,91 @@ create_service(struct netconfig *nconf) syslog(LOG_ERR, "cannot get local address for %s: %s", nconf->nc_netid, gai_strerror(aicode)); + close(fd); continue; } } + /* Store the fd. */ + sock_fd[sock_fdcnt - 1] = fd; + + /* Now, attempt the bind. */ r = bindresvport_sa(fd, res->ai_addr); if (r != 0) { + if (errno == EADDRINUSE && mallocd_svcport != 0) { + if (mallocd_res != 0) { + free(res->ai_addr); + free(res); + } else + freeaddrinfo(res); + return (-1); + } syslog(LOG_ERR, "bindresvport_sa: %m"); exit(1); } + if (svcport_str == NULL) { + svcport_str = malloc(NI_MAXSERV * sizeof(char)); + if (svcport_str == NULL) + out_of_mem(); + mallocd_svcport = 1; + + if (getnameinfo(res->ai_addr, + res->ai_addr->sa_len, NULL, NI_MAXHOST, + svcport_str, NI_MAXSERV * sizeof(char), + NI_NUMERICHOST | NI_NUMERICSERV)) + errx(1, "Cannot get port number"); + } + if (mallocd_res != 0) { + free(res->ai_addr); + free(res); + } else + freeaddrinfo(res); + res = NULL; + } + return (0); +} + +/* + * Called after all the create_service() calls have succeeded, to complete + * the setup and registration. + */ +static void +complete_service(struct netconfig *nconf, char *port_str) +{ + struct addrinfo hints, *res = NULL; + struct __rpc_sockinfo si; + struct netbuf servaddr; + SVCXPRT *transp = NULL; + int aicode, fd, nhostsbak; + int registered = 0; + + if ((nconf->nc_semantics != NC_TPI_CLTS) && + (nconf->nc_semantics != NC_TPI_COTS) && + (nconf->nc_semantics != NC_TPI_COTS_ORD)) + return; /* not my type */ + + /* + * XXX - using RPC library internal functions. + */ + if (!__rpc_nconf2sockinfo(nconf, &si)) { + syslog(LOG_ERR, "cannot get information for %s", + nconf->nc_netid); + return; + } + + nhostsbak = nhosts; + while (nhostsbak > 0) { + --nhostsbak; + if (sock_fdpos >= sock_fdcnt) { + /* Should never happen. */ + syslog(LOG_ERR, "Ran out of socket fd's"); + return; + } + fd = sock_fd[sock_fdpos++]; + if (fd < 0) + continue; + if (nconf->nc_semantics != NC_TPI_CLTS) listen(fd, SOMAXCONN); @@ -696,19 +874,7 @@ create_service(struct netconfig *nconf) hints.ai_socktype = si.si_socktype; hints.ai_protocol = si.si_proto; - if (svcport_str == NULL) { - svcport_str = malloc(NI_MAXSERV * sizeof(char)); - if (svcport_str == NULL) - out_of_mem(); - - if (getnameinfo(res->ai_addr, - res->ai_addr->sa_len, NULL, NI_MAXHOST, - svcport_str, NI_MAXSERV * sizeof(char), - NI_NUMERICHOST | NI_NUMERICSERV)) - errx(1, "Cannot get port number"); - } - - if((aicode = getaddrinfo(NULL, svcport_str, &hints, + if ((aicode = getaddrinfo(NULL, port_str, &hints, &res)) != 0) { syslog(LOG_ERR, "cannot get local address: %s", gai_strerror(aicode)); @@ -728,6 +894,23 @@ create_service(struct netconfig *nconf) } /* end while */ } +/* + * Clear out sockets after a failure to bind one of them, so that the + * cycle of socket creation/binding can start anew. + */ +static void +clearout_service(void) +{ + int i; + + for (i = 0; i < sock_fdcnt; i++) { + if (sock_fd[i] >= 0) { + shutdown(sock_fd[i], SHUT_RDWR); + close(sock_fd[i]); + } + } +} + static void usage(void) { From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 19:49:47 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBAD9106566C; Thu, 2 Jun 2011 19:49:47 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B04868FC1A; Thu, 2 Jun 2011 19:49:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52Jnl0V031438; Thu, 2 Jun 2011 19:49:47 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52Jnleu031436; Thu, 2 Jun 2011 19:49:47 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201106021949.p52Jnleu031436@svn.freebsd.org> From: Rick Macklem Date: Thu, 2 Jun 2011 19:49:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222624 - head/usr.sbin/rpc.lockd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 19:49:48 -0000 Author: rmacklem Date: Thu Jun 2 19:49:47 2011 New Revision: 222624 URL: http://svn.freebsd.org/changeset/base/222624 Log: Fix the nfs related daemons so that they don't intermittently fail with "bind: address already in use". This problem was reported to the freebsd-stable@ mailing list on Feb. 19 under the subject heading "statd/lockd startup failure" by george+freebsd at m5p dot com. The problem is that the first combination of {udp,tcp X ipv4,ipv6} would select a port# dynamically, but one of the other three combinations would have that port# already in use. The patch is somewhat involved because it was requested by dougb@ that the four combinations use the same port# wherever possible. The patch splits the create_service() function into two functions. The first goes as far as bind(2) in a loop for up to GETPORT_MAXTRY - 1 times, attempting to use the same port# for all four cases. If these attempts fail, the last attempt allows the 4 cases to use different port #s. After this function has succeeded, the second function, called complete_service(), does the rest of what create_service() did. The three daemons mountd, rpc.lockd and rpc.statd all have a create_service() function that is patched in a similar way. However, create_service() has non-trivial differences for the three daemons that made it impractical to share the same functions between them. Reviewed by: jhb MFC after: 2 weeks Modified: head/usr.sbin/rpc.lockd/lockd.c Modified: head/usr.sbin/rpc.lockd/lockd.c ============================================================================== --- head/usr.sbin/rpc.lockd/lockd.c Thu Jun 2 19:33:33 2011 (r222623) +++ head/usr.sbin/rpc.lockd/lockd.c Thu Jun 2 19:49:47 2011 (r222624) @@ -74,6 +74,8 @@ __RCSID("$NetBSD: lockd.c,v 1.7 2000/08/ #include "lockd.h" #include +#define GETPORT_MAXTRY 20 /* Max tries to get a port # */ + int debug_level = 0; /* 0 = no debugging syslog() calls */ int _rpcsvcdirty = 0; @@ -84,13 +86,19 @@ int kernel_lockd_client; pid_t client_pid; struct mon mon_host; char **hosts, *svcport_str = NULL; +static int mallocd_svcport = 0; +static int *sock_fd; +static int sock_fdcnt; +static int sock_fdpos; int nhosts = 0; int xcreated = 0; char **addrs; /* actually (netid, uaddr) pairs */ int naddrs; /* count of how many (netid, uaddr) pairs */ char localhost[] = "localhost"; -void create_service(struct netconfig *nconf); +static int create_service(struct netconfig *nconf); +static void complete_service(struct netconfig *nconf, char *port_str); +static void clearout_service(void); void lookup_addresses(struct netconfig *nconf); void init_nsm(void); void nlm_prog_0(struct svc_req *, SVCXPRT *); @@ -119,6 +127,8 @@ main(int argc, char **argv) int have_v6 = 1; int maxrec = RPC_MAXDATASIZE; in_port_t svcport = 0; + int attempt_cnt, port_len, port_pos, ret; + char **port_list; while ((ch = getopt(argc, argv, "d:g:h:p:")) != (-1)) { switch (ch) { @@ -309,6 +319,11 @@ main(int argc, char **argv) } endnetconfig(nc_handle); } else { + attempt_cnt = 1; + sock_fdcnt = 0; + sock_fd = NULL; + port_list = NULL; + port_len = 0; nc_handle = setnetconfig(); while ((nconf = getnetconfig(nc_handle))) { /* We want to listen only on udp6, tcp6, udp, tcp transports */ @@ -317,11 +332,96 @@ main(int argc, char **argv) if (have_v6 == 0 && strcmp(nconf->nc_protofmly, "inet6") == 0) { /* DO NOTHING */ } else { - create_service(nconf); + ret = create_service(nconf); + if (ret == 1) + /* Ignore this call */ + continue; + if (ret < 0) { + /* + * Failed to bind port, so close + * off all sockets created and + * try again if the port# was + * dynamically assigned via + * bind(2). + */ + clearout_service(); + if (mallocd_svcport != 0 && + attempt_cnt < + GETPORT_MAXTRY) { + free(svcport_str); + svcport_str = NULL; + mallocd_svcport = 0; + } else { + errno = EADDRINUSE; + syslog(LOG_ERR, + "bindresvport_sa: %m"); + exit(1); + } + + /* + * Start over at the first + * service. + */ + free(sock_fd); + sock_fdcnt = 0; + sock_fd = NULL; + nc_handle = setnetconfig(); + attempt_cnt++; + } else if (mallocd_svcport != 0 && + attempt_cnt == GETPORT_MAXTRY) { + /* + * For the last attempt, allow + * different port #s for each + * nconf by saving the + * svcport_str and setting it + * back to NULL. + */ + port_list = realloc(port_list, + (port_len + 1) * + sizeof(char *)); + if (port_list == NULL) + out_of_mem(); + port_list[port_len++] = + svcport_str; + svcport_str = NULL; + mallocd_svcport = 0; + } } } } + + /* + * Successfully bound the ports, so call complete_service() to + * do the rest of the setup on the service(s). + */ + sock_fdpos = 0; + port_pos = 0; + nc_handle = setnetconfig(); + while ((nconf = getnetconfig(nc_handle))) { + /* We want to listen only on udp6, tcp6, udp, tcp transports */ + if (nconf->nc_flag & NC_VISIBLE) { + /* Skip if there's no IPv6 support */ + if (have_v6 == 0 && strcmp(nconf->nc_protofmly, "inet6") == 0) { + /* DO NOTHING */ + } else if (port_list != NULL) { + if (port_pos >= port_len) { + syslog(LOG_ERR, + "too many port#s"); + exit(1); + } + complete_service(nconf, + port_list[port_pos++]); + } else + complete_service(nconf, svcport_str); + } + } endnetconfig(nc_handle); + free(sock_fd); + if (port_list != NULL) { + for (port_pos = 0; port_pos < port_len; port_pos++) + free(port_list[port_pos]); + free(port_list); + } } /* @@ -386,29 +486,30 @@ main(int argc, char **argv) /* * This routine creates and binds sockets on the appropriate - * addresses. It gets called one time for each transport and - * registrates the service with rpcbind on that trasport. + * addresses. It gets called one time for each transport. + * It returns 0 upon success, 1 for ingore the call and -1 to indicate + * bind failed with EADDRINUSE. + * Any file descriptors that have been created are stored in sock_fd and + * the total count of them is maintained in sock_fdcnt. */ -void +static int create_service(struct netconfig *nconf) { struct addrinfo hints, *res = NULL; struct sockaddr_in *sin; struct sockaddr_in6 *sin6; struct __rpc_sockinfo si; - struct netbuf servaddr; - SVCXPRT *transp = NULL; int aicode; int fd; int nhostsbak; int r; - int registered = 0; u_int32_t host_addr[4]; /* IPv4 or IPv6 */ + int mallocd_res; if ((nconf->nc_semantics != NC_TPI_CLTS) && (nconf->nc_semantics != NC_TPI_COTS) && (nconf->nc_semantics != NC_TPI_COTS_ORD)) - return; /* not my type */ + return (1); /* not my type */ /* * XXX - using RPC library internal functions. @@ -416,7 +517,7 @@ create_service(struct netconfig *nconf) if (!__rpc_nconf2sockinfo(nconf, &si)) { syslog(LOG_ERR, "cannot get information for %s", nconf->nc_netid); - return; + return (1); } /* Get rpc.statd's address on this transport */ @@ -432,6 +533,11 @@ create_service(struct netconfig *nconf) nhostsbak = nhosts; while (nhostsbak > 0) { --nhostsbak; + sock_fd = realloc(sock_fd, (sock_fdcnt + 1) * sizeof(int)); + if (sock_fd == NULL) + out_of_mem(); + sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */ + mallocd_res = 0; /* * XXX - using RPC library internal functions. @@ -446,7 +552,7 @@ create_service(struct netconfig *nconf) case AF_INET: if (inet_pton(AF_INET, hosts[nhostsbak], host_addr) == 1) { - hints.ai_flags &= AI_NUMERICHOST; + hints.ai_flags |= AI_NUMERICHOST; } else { /* * Skip if we have an AF_INET6 address. @@ -461,7 +567,7 @@ create_service(struct netconfig *nconf) case AF_INET6: if (inet_pton(AF_INET6, hosts[nhostsbak], host_addr) == 1) { - hints.ai_flags &= AI_NUMERICHOST; + hints.ai_flags |= AI_NUMERICHOST; } else { /* * Skip if we have an AF_INET address. @@ -485,6 +591,7 @@ create_service(struct netconfig *nconf) res = malloc(sizeof(struct addrinfo)); if (res == NULL) out_of_mem(); + mallocd_res = 1; res->ai_flags = hints.ai_flags; res->ai_family = hints.ai_family; res->ai_protocol = hints.ai_protocol; @@ -498,7 +605,7 @@ create_service(struct netconfig *nconf) sin->sin_addr.s_addr = htonl(INADDR_ANY); res->ai_addr = (struct sockaddr*) sin; res->ai_addrlen = (socklen_t) - sizeof(res->ai_addr); + sizeof(struct sockaddr_in); break; case AF_INET6: sin6 = malloc(sizeof(struct sockaddr_in6)); @@ -508,10 +615,14 @@ create_service(struct netconfig *nconf) sin6->sin6_port = htons(0); sin6->sin6_addr = in6addr_any; res->ai_addr = (struct sockaddr*) sin6; - res->ai_addrlen = (socklen_t) sizeof(res->ai_addr); + res->ai_addrlen = (socklen_t) + sizeof(struct sockaddr_in6); break; default: - break; + syslog(LOG_ERR, + "bad addr fam %d", + res->ai_family); + exit(1); } } else { if ((aicode = getaddrinfo(NULL, svcport_str, @@ -520,6 +631,7 @@ create_service(struct netconfig *nconf) "cannot get local address for %s: %s", nconf->nc_netid, gai_strerror(aicode)); + close(fd); continue; } } @@ -529,16 +641,92 @@ create_service(struct netconfig *nconf) syslog(LOG_ERR, "cannot get local address for %s: %s", nconf->nc_netid, gai_strerror(aicode)); + close(fd); continue; } } + + /* Store the fd. */ + sock_fd[sock_fdcnt - 1] = fd; + + /* Now, attempt the bind. */ r = bindresvport_sa(fd, res->ai_addr); if (r != 0) { + if (errno == EADDRINUSE && mallocd_svcport != 0) { + if (mallocd_res != 0) { + free(res->ai_addr); + free(res); + } else + freeaddrinfo(res); + return (-1); + } syslog(LOG_ERR, "bindresvport_sa: %m"); exit(1); } + if (svcport_str == NULL) { + svcport_str = malloc(NI_MAXSERV * sizeof(char)); + if (svcport_str == NULL) + out_of_mem(); + mallocd_svcport = 1; + + if (getnameinfo(res->ai_addr, + res->ai_addr->sa_len, NULL, NI_MAXHOST, + svcport_str, NI_MAXSERV * sizeof(char), + NI_NUMERICHOST | NI_NUMERICSERV)) + errx(1, "Cannot get port number"); + } + if (mallocd_res != 0) { + free(res->ai_addr); + free(res); + } else + freeaddrinfo(res); + res = NULL; + } + return (0); +} + +/* + * Called after all the create_service() calls have succeeded, to complete + * the setup and registration. + */ +static void +complete_service(struct netconfig *nconf, char *port_str) +{ + struct addrinfo hints, *res = NULL; + struct __rpc_sockinfo si; + struct netbuf servaddr; + SVCXPRT *transp = NULL; + int aicode, fd, nhostsbak; + int registered = 0; + + if ((nconf->nc_semantics != NC_TPI_CLTS) && + (nconf->nc_semantics != NC_TPI_COTS) && + (nconf->nc_semantics != NC_TPI_COTS_ORD)) + return; /* not my type */ + + /* + * XXX - using RPC library internal functions. + */ + if (!__rpc_nconf2sockinfo(nconf, &si)) { + syslog(LOG_ERR, "cannot get information for %s", + nconf->nc_netid); + return; + } + + nhostsbak = nhosts; + while (nhostsbak > 0) { + --nhostsbak; + if (sock_fdpos >= sock_fdcnt) { + /* Should never happen. */ + syslog(LOG_ERR, "Ran out of socket fd's"); + return; + } + fd = sock_fd[sock_fdpos++]; + if (fd < 0) + continue; + if (nconf->nc_semantics != NC_TPI_CLTS) listen(fd, SOMAXCONN); @@ -582,19 +770,7 @@ create_service(struct netconfig *nconf) hints.ai_socktype = si.si_socktype; hints.ai_protocol = si.si_proto; - if (svcport_str == NULL) { - svcport_str = malloc(NI_MAXSERV * sizeof(char)); - if (svcport_str == NULL) - out_of_mem(); - - if (getnameinfo(res->ai_addr, - res->ai_addr->sa_len, NULL, NI_MAXHOST, - svcport_str, NI_MAXSERV * sizeof(char), - NI_NUMERICHOST | NI_NUMERICSERV)) - errx(1, "Cannot get port number"); - } - - if((aicode = getaddrinfo(NULL, svcport_str, &hints, + if ((aicode = getaddrinfo(NULL, port_str, &hints, &res)) != 0) { syslog(LOG_ERR, "cannot get local address: %s", gai_strerror(aicode)); @@ -617,6 +793,23 @@ create_service(struct netconfig *nconf) } /* + * Clear out sockets after a failure to bind one of them, so that the + * cycle of socket creation/binding can start anew. + */ +static void +clearout_service(void) +{ + int i; + + for (i = 0; i < sock_fdcnt; i++) { + if (sock_fd[i] >= 0) { + shutdown(sock_fd[i], SHUT_RDWR); + close(sock_fd[i]); + } + } +} + +/* * Look up addresses for the kernel to create transports for. */ void From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 20:15:32 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AC23106566B; Thu, 2 Jun 2011 20:15:32 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78E938FC14; Thu, 2 Jun 2011 20:15:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52KFWlT032379; Thu, 2 Jun 2011 20:15:32 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52KFW2U032377; Thu, 2 Jun 2011 20:15:32 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201106022015.p52KFW2U032377@svn.freebsd.org> From: Rick Macklem Date: Thu, 2 Jun 2011 20:15:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222627 - head/usr.sbin/rpc.statd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 20:15:32 -0000 Author: rmacklem Date: Thu Jun 2 20:15:32 2011 New Revision: 222627 URL: http://svn.freebsd.org/changeset/base/222627 Log: Fix the nfs related daemons so that they don't intermittently fail with "bind: address already in use". This problem was reported to the freebsd-stable@ mailing list on Feb. 19 under the subject heading "statd/lockd startup failure" by george+freebsd at m5p dot com. The problem is that the first combination of {udp,tcp X ipv4,ipv6} would select a port# dynamically, but one of the other three combinations would have that port# already in use. The patch is somewhat involved because it was requested by dougb@ that the four combinations use the same port# wherever possible. The patch splits the create_service() function into two functions. The first goes as far as bind(2) in a loop for up to GETPORT_MAXTRY - 1 times, attempting to use the same port# for all four cases. If these attempts fail, the last attempt allows the 4 cases to use different port #s. After this function has succeeded, the second function, called complete_service(), does the rest of what create_service() did. The three daemons mountd, rpc.lockd and rpc.statd all have a create_service() function that is patched in a similar way. However, create_service() has non-trivial differences for the three daemons that made it impractical to share the same functions between them. Reviewed by: jhb MFC after: 2 weeks Modified: head/usr.sbin/rpc.statd/statd.c Modified: head/usr.sbin/rpc.statd/statd.c ============================================================================== --- head/usr.sbin/rpc.statd/statd.c Thu Jun 2 20:03:27 2011 (r222626) +++ head/usr.sbin/rpc.statd/statd.c Thu Jun 2 20:15:32 2011 (r222627) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -55,13 +56,21 @@ __FBSDID("$FreeBSD$"); #include #include "statd.h" +#define GETPORT_MAXTRY 20 /* Max tries to get a port # */ + int debug = 0; /* Controls syslog() calls for debug messages */ char **hosts, *svcport_str = NULL; int nhosts = 0; int xcreated = 0; - -void create_service(struct netconfig *nconf); +static int mallocd_svcport = 0; +static int *sock_fd; +static int sock_fdcnt; +static int sock_fdpos; + +static int create_service(struct netconfig *nconf); +static void complete_service(struct netconfig *nconf, char *port_str); +static void clearout_service(void); static void handle_sigchld(int sig); void out_of_mem(void); @@ -78,6 +87,8 @@ main(int argc, char **argv) char *endptr, **hosts_bak; int have_v6 = 1; int maxrec = RPC_MAXDATASIZE; + int attempt_cnt, port_len, port_pos, ret; + char **port_list; while ((ch = getopt(argc, argv, "dh:p:")) != -1) switch (ch) { @@ -176,6 +187,11 @@ main(int argc, char **argv) hosts[nhosts - 1] = "127.0.0.1"; } + attempt_cnt = 1; + sock_fdcnt = 0; + sock_fd = NULL; + port_list = NULL; + port_len = 0; nc_handle = setnetconfig(); while ((nconf = getnetconfig(nc_handle))) { /* We want to listen only on udp6, tcp6, udp, tcp transports */ @@ -184,11 +200,87 @@ main(int argc, char **argv) if (have_v6 == 0 && strcmp(nconf->nc_protofmly, "inet6") == 0) { /* DO NOTHING */ } else { - create_service(nconf); + ret = create_service(nconf); + if (ret == 1) + /* Ignore this call */ + continue; + if (ret < 0) { + /* + * Failed to bind port, so close off + * all sockets created and try again + * if the port# was dynamically + * assigned via bind(2). + */ + clearout_service(); + if (mallocd_svcport != 0 && + attempt_cnt < GETPORT_MAXTRY) { + free(svcport_str); + svcport_str = NULL; + mallocd_svcport = 0; + } else { + errno = EADDRINUSE; + syslog(LOG_ERR, + "bindresvport_sa: %m"); + exit(1); + } + + /* Start over at the first service. */ + free(sock_fd); + sock_fdcnt = 0; + sock_fd = NULL; + nc_handle = setnetconfig(); + attempt_cnt++; + } else if (mallocd_svcport != 0 && + attempt_cnt == GETPORT_MAXTRY) { + /* + * For the last attempt, allow + * different port #s for each nconf + * by saving the svcport_str and + * setting it back to NULL. + */ + port_list = realloc(port_list, + (port_len + 1) * sizeof(char *)); + if (port_list == NULL) + out_of_mem(); + port_list[port_len++] = svcport_str; + svcport_str = NULL; + mallocd_svcport = 0; + } } } } + + /* + * Successfully bound the ports, so call complete_service() to + * do the rest of the setup on the service(s). + */ + sock_fdpos = 0; + port_pos = 0; + nc_handle = setnetconfig(); + while ((nconf = getnetconfig(nc_handle))) { + /* We want to listen only on udp6, tcp6, udp, tcp transports */ + if (nconf->nc_flag & NC_VISIBLE) { + /* Skip if there's no IPv6 support */ + if (have_v6 == 0 && strcmp(nconf->nc_protofmly, "inet6") == 0) { + /* DO NOTHING */ + } else if (port_list != NULL) { + if (port_pos >= port_len) { + syslog(LOG_ERR, "too many port#s"); + exit(1); + } + complete_service(nconf, port_list[port_pos++]); + } else + complete_service(nconf, svcport_str); + } + } endnetconfig(nc_handle); + free(sock_fd); + if (port_list != NULL) { + for (port_pos = 0; port_pos < port_len; port_pos++) + free(port_list[port_pos]); + free(port_list); + } + init_file("/var/db/statd.status"); /* Note that it is NOT sensible to run this program from inetd - the */ @@ -215,29 +307,30 @@ main(int argc, char **argv) /* * This routine creates and binds sockets on the appropriate - * addresses. It gets called one time for each transport and - * registrates the service with rpcbind on that trasport. + * addresses. It gets called one time for each transport. + * It returns 0 upon success, 1 for ingore the call and -1 to indicate + * bind failed with EADDRINUSE. + * Any file descriptors that have been created are stored in sock_fd and + * the total count of them is maintained in sock_fdcnt. */ -void +static int create_service(struct netconfig *nconf) { struct addrinfo hints, *res = NULL; struct sockaddr_in *sin; struct sockaddr_in6 *sin6; struct __rpc_sockinfo si; - struct netbuf servaddr; - SVCXPRT *transp = NULL; int aicode; int fd; int nhostsbak; int r; - int registered = 0; u_int32_t host_addr[4]; /* IPv4 or IPv6 */ + int mallocd_res; if ((nconf->nc_semantics != NC_TPI_CLTS) && (nconf->nc_semantics != NC_TPI_COTS) && (nconf->nc_semantics != NC_TPI_COTS_ORD)) - return; /* not my type */ + return (1); /* not my type */ /* * XXX - using RPC library internal functions. @@ -245,7 +338,7 @@ create_service(struct netconfig *nconf) if (!__rpc_nconf2sockinfo(nconf, &si)) { syslog(LOG_ERR, "cannot get information for %s", nconf->nc_netid); - return; + return (1); } /* Get rpc.statd's address on this transport */ @@ -261,6 +354,11 @@ create_service(struct netconfig *nconf) nhostsbak = nhosts; while (nhostsbak > 0) { --nhostsbak; + sock_fd = realloc(sock_fd, (sock_fdcnt + 1) * sizeof(int)); + if (sock_fd == NULL) + out_of_mem(); + sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */ + mallocd_res = 0; /* * XXX - using RPC library internal functions. @@ -274,7 +372,7 @@ create_service(struct netconfig *nconf) case AF_INET: if (inet_pton(AF_INET, hosts[nhostsbak], host_addr) == 1) { - hints.ai_flags &= AI_NUMERICHOST; + hints.ai_flags |= AI_NUMERICHOST; } else { /* * Skip if we have an AF_INET6 address. @@ -289,7 +387,7 @@ create_service(struct netconfig *nconf) case AF_INET6: if (inet_pton(AF_INET6, hosts[nhostsbak], host_addr) == 1) { - hints.ai_flags &= AI_NUMERICHOST; + hints.ai_flags |= AI_NUMERICHOST; } else { /* * Skip if we have an AF_INET address. @@ -313,6 +411,7 @@ create_service(struct netconfig *nconf) res = malloc(sizeof(struct addrinfo)); if (res == NULL) out_of_mem(); + mallocd_res = 1; res->ai_flags = hints.ai_flags; res->ai_family = hints.ai_family; res->ai_protocol = hints.ai_protocol; @@ -326,7 +425,7 @@ create_service(struct netconfig *nconf) sin->sin_addr.s_addr = htonl(INADDR_ANY); res->ai_addr = (struct sockaddr*) sin; res->ai_addrlen = (socklen_t) - sizeof(res->ai_addr); + sizeof(struct sockaddr_in); break; case AF_INET6: sin6 = malloc(sizeof(struct sockaddr_in6)); @@ -336,10 +435,13 @@ create_service(struct netconfig *nconf) sin6->sin6_port = htons(0); sin6->sin6_addr = in6addr_any; res->ai_addr = (struct sockaddr*) sin6; - res->ai_addrlen = (socklen_t) sizeof(res->ai_addr); + res->ai_addrlen = (socklen_t) + sizeof(struct sockaddr_in6); break; default: - break; + syslog(LOG_ERR, "bad addr fam %d", + res->ai_family); + exit(1); } } else { if ((aicode = getaddrinfo(NULL, svcport_str, @@ -348,6 +450,7 @@ create_service(struct netconfig *nconf) "cannot get local address for %s: %s", nconf->nc_netid, gai_strerror(aicode)); + close(fd); continue; } } @@ -357,16 +460,91 @@ create_service(struct netconfig *nconf) syslog(LOG_ERR, "cannot get local address for %s: %s", nconf->nc_netid, gai_strerror(aicode)); + close(fd); continue; } } + /* Store the fd. */ + sock_fd[sock_fdcnt - 1] = fd; + + /* Now, attempt the bind. */ r = bindresvport_sa(fd, res->ai_addr); if (r != 0) { + if (errno == EADDRINUSE && mallocd_svcport != 0) { + if (mallocd_res != 0) { + free(res->ai_addr); + free(res); + } else + freeaddrinfo(res); + return (-1); + } syslog(LOG_ERR, "bindresvport_sa: %m"); exit(1); } + if (svcport_str == NULL) { + svcport_str = malloc(NI_MAXSERV * sizeof(char)); + if (svcport_str == NULL) + out_of_mem(); + mallocd_svcport = 1; + + if (getnameinfo(res->ai_addr, + res->ai_addr->sa_len, NULL, NI_MAXHOST, + svcport_str, NI_MAXSERV * sizeof(char), + NI_NUMERICHOST | NI_NUMERICSERV)) + errx(1, "Cannot get port number"); + } + if (mallocd_res != 0) { + free(res->ai_addr); + free(res); + } else + freeaddrinfo(res); + res = NULL; + } + return (0); +} + +/* + * Called after all the create_service() calls have succeeded, to complete + * the setup and registration. + */ +static void +complete_service(struct netconfig *nconf, char *port_str) +{ + struct addrinfo hints, *res = NULL; + struct __rpc_sockinfo si; + struct netbuf servaddr; + SVCXPRT *transp = NULL; + int aicode, fd, nhostsbak; + int registered = 0; + + if ((nconf->nc_semantics != NC_TPI_CLTS) && + (nconf->nc_semantics != NC_TPI_COTS) && + (nconf->nc_semantics != NC_TPI_COTS_ORD)) + return; /* not my type */ + + /* + * XXX - using RPC library internal functions. + */ + if (!__rpc_nconf2sockinfo(nconf, &si)) { + syslog(LOG_ERR, "cannot get information for %s", + nconf->nc_netid); + return; + } + + nhostsbak = nhosts; + while (nhostsbak > 0) { + --nhostsbak; + if (sock_fdpos >= sock_fdcnt) { + /* Should never happen. */ + syslog(LOG_ERR, "Ran out of socket fd's"); + return; + } + fd = sock_fd[sock_fdpos++]; + if (fd < 0) + continue; + if (nconf->nc_semantics != NC_TPI_CLTS) listen(fd, SOMAXCONN); @@ -397,19 +575,8 @@ create_service(struct netconfig *nconf) hints.ai_socktype = si.si_socktype; hints.ai_protocol = si.si_proto; - if (svcport_str == NULL) { - svcport_str = malloc(NI_MAXSERV * sizeof(char)); - if (svcport_str == NULL) - out_of_mem(); - - if (getnameinfo(res->ai_addr, - res->ai_addr->sa_len, NULL, NI_MAXHOST, - svcport_str, NI_MAXSERV * sizeof(char), - NI_NUMERICHOST | NI_NUMERICSERV)) - errx(1, "Cannot get port number"); - } - if((aicode = getaddrinfo(NULL, svcport_str, &hints, + if ((aicode = getaddrinfo(NULL, port_str, &hints, &res)) != 0) { syslog(LOG_ERR, "cannot get local address: %s", gai_strerror(aicode)); @@ -428,6 +595,23 @@ create_service(struct netconfig *nconf) } /* end while */ } +/* + * Clear out sockets after a failure to bind one of them, so that the + * cycle of socket creation/binding can start anew. + */ +static void +clearout_service(void) +{ + int i; + + for (i = 0; i < sock_fdcnt; i++) { + if (sock_fd[i] >= 0) { + shutdown(sock_fd[i], SHUT_RDWR); + close(sock_fd[i]); + } + } +} + static void usage() { From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 20:56:42 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCE8B106566B; Thu, 2 Jun 2011 20:56:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1BA98FC24; Thu, 2 Jun 2011 20:56: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 p52Kugel033651; Thu, 2 Jun 2011 20:56:42 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52Kugvv033649; Thu, 2 Jun 2011 20:56:42 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106022056.p52Kugvv033649@svn.freebsd.org> From: Alexander Motin Date: Thu, 2 Jun 2011 20:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222628 - head/sys/cam/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 20:56:42 -0000 Author: mav Date: Thu Jun 2 20:56:42 2011 New Revision: 222628 URL: http://svn.freebsd.org/changeset/base/222628 Log: When possible, join ranges of subsequest BIO_DELETE requests to handle more (up to 2048 instead of 256 or even 64) of them with single TRIM request. OCZ Vertex2/Vertex3 SSDs can handle no more then 64 ranges per TRIM request. Due to lack of BIO_DELETE clustering now, it means that we could delete no more then 2MB per request (on FS with 32K block) with limited request rate. This change increases delete rate on Vertex2 from 250MB/s to 950MB/s. Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Thu Jun 2 20:15:32 2011 (r222627) +++ head/sys/cam/ata/ata_da.c Thu Jun 2 20:56:42 2011 (r222628) @@ -115,10 +115,11 @@ struct disk_params { }; #define TRIM_MAX_BLOCKS 4 -#define TRIM_MAX_RANGES TRIM_MAX_BLOCKS * 64 +#define TRIM_MAX_RANGES (TRIM_MAX_BLOCKS * 64) +#define TRIM_MAX_BIOS (TRIM_MAX_RANGES * 8) struct trim_request { uint8_t data[TRIM_MAX_RANGES * 8]; - struct bio *bps[TRIM_MAX_RANGES]; + struct bio *bps[TRIM_MAX_BIOS]; }; struct ada_softc { @@ -1067,7 +1068,8 @@ adastart(struct cam_periph *periph, unio (bp = bioq_first(&softc->trim_queue)) != 0) { struct trim_request *req = &softc->trim_req; struct bio *bp1; - int bps = 0, ranges = 0; + uint64_t lastlba = (uint64_t)-1; + int bps = 0, c, lastcount = 0, off, ranges = 0; softc->trim_running = 1; bzero(req, sizeof(*req)); @@ -1078,10 +1080,22 @@ adastart(struct cam_periph *periph, unio softc->params.secsize; bioq_remove(&softc->trim_queue, bp1); - while (count > 0) { - int c = min(count, 0xffff); - int off = ranges * 8; + /* Try to extend the previous range. */ + if (lba == lastlba) { + c = min(count, 0xffff - lastcount); + lastcount += c; + off = (ranges - 1) * 8; + req->data[off + 6] = lastcount & 0xff; + req->data[off + 7] = + (lastcount >> 8) & 0xff; + count -= c; + lba += c; + } + + while (count > 0) { + c = min(count, 0xffff); + off = ranges * 8; req->data[off + 0] = lba & 0xff; req->data[off + 1] = (lba >> 8) & 0xff; req->data[off + 2] = (lba >> 16) & 0xff; @@ -1092,11 +1106,14 @@ adastart(struct cam_periph *periph, unio req->data[off + 7] = (c >> 8) & 0xff; lba += c; count -= c; + lastcount = c; ranges++; } + lastlba = lba; req->bps[bps++] = bp1; bp1 = bioq_first(&softc->trim_queue); - if (bp1 == NULL || + if (bps >= TRIM_MAX_BIOS || + bp1 == NULL || bp1->bio_bcount / softc->params.secsize > (softc->trim_max_ranges - ranges) * 0xffff) break; @@ -1370,8 +1387,7 @@ adadone(struct cam_periph *periph, union (struct trim_request *)ataio->data_ptr; int i; - for (i = 1; i < softc->trim_max_ranges && - req->bps[i]; i++) { + for (i = 1; i < TRIM_MAX_BIOS && req->bps[i]; i++) { struct bio *bp1 = req->bps[i]; bp1->bio_resid = bp->bio_resid; From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 21:36:13 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 139F51065730; Thu, 2 Jun 2011 21:36:13 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id C78858FC1A; Thu, 2 Jun 2011 21:36:12 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id p52LaBdY048885; Thu, 2 Jun 2011 15:36:11 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id p52LaBHu048884; Thu, 2 Jun 2011 15:36:11 -0600 (MDT) (envelope-from ken) Date: Thu, 2 Jun 2011 15:36:11 -0600 From: "Kenneth D. Merry" To: Bruce Evans Message-ID: <20110602213611.GA47880@nargothrond.kdm.org> References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> <4DE5D72A.1020405@FreeBSD.org> <20110601193030.A1275@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110601193030.A1275@besplex.bde.org> User-Agent: Mutt/1.4.2i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andriy Gapon Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 21:36:13 -0000 On Wed, Jun 01, 2011 at 20:07:31 +1000, Bruce Evans wrote: > On Wed, 1 Jun 2011, Andriy Gapon wrote: > > >on 31/05/2011 20:29 Kenneth D. Merry said the following: > >>+ mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); > > > >Sorry that I didn't gather myself together for a review before this change > >got > >actually committed. > >Do you see any reason not to make this spinlock recursive? > > I see reasons why it must not exist. The message buffer code cannot use > any normal locking, and was carefully written to avoid doing so. > > >I am a little bit worried about "exotic" situations like receiving an NMI > >in the > >middle of printing and wanting to print in the NMI context, or similar > >things > >that penetrate contexts with disabled interrupts - e.g. Machine Check > >Exception. > >Also it's not clear to me if there won't any bigger damage in the > >situations > >like those described above. > > > >P.S. I have been thinking about fixing the problem in a different fashion, > >via > >reserving portions of dmesg buffer for a whole message using CAS: > >http://lists.freebsd.org/pipermail/freebsd-hackers/2010-April/031535.html > > Something like this might work. > > PRINTF_BUFR size should not exist either, especially now that it is > much more complicated and broken. Here is some of my old mail about > adding (necessarily not normal) locking to to printf. No one replied, > so I never finished this :-(. That particular solution doesn't lock the normal kernel printf path, and so won't fix what we're trying to fix. (We've got lots of disks in each system, and when there are various SES events and disks arriving and departing, there are multiple kernel contexts doing printfs simultaneously, and that results in scrambled dmesg output.) I think the goals should be: - console output, syslog output, and dmesg output are not scrambled. (i.e. individual kernel printfs make it out atomically, or at least with a certain granularity, like PRINTF_BUFR_SIZE.) - Can be called by any kernel routine (i.e. doesn't sleep) - Offers a string at a time interface. - Does the right thing for log messages (priority, etc.) It looks like we should add "does not use normal locking" to the list as well. As Justin mentioned, we started off down the path of using atomic operations, and then figured out that wouldn't fully work. Then we discussed doing a per-CPU message buffer, with each message tagged with a sequence number, and having the reader re-serialize the messages in the right order. The complexity started to get large enough that we decided that using a spin lock would be a much easier approach. cnputs() already uses a spinlock, so we're no worse off than before from a locking standpoint. We could perhaps make the message buffer mutex recursive and set the MTX_NOWITNESS flag as well, that might make things a little better from a side effect standpoint. If we can come up with a solution that meets the above goals, Justin and I would be happy to help implement it. Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 21:59:21 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BD98106566B; Thu, 2 Jun 2011 21:59:21 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 820128FC13; Thu, 2 Jun 2011 21:59:21 +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 p52LxLBO035621; Thu, 2 Jun 2011 21:59:21 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52LxLLv035619; Thu, 2 Jun 2011 21:59:21 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106022159.p52LxLLv035619@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 2 Jun 2011 21:59:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222630 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 21:59:21 -0000 Author: ae Date: Thu Jun 2 21:59:21 2011 New Revision: 222630 URL: http://svn.freebsd.org/changeset/base/222630 Log: Use stripesize and stripeoffset in the automatic calculation of partition offsets. If user requests specific alignment and provider's stripesize is not zero, then use a least common multiple from the stripesize and user specified value. Also fix "gpart resize" implementation: do not try to align the partition size, because the start offset may be not aligned. Instead align the end offset and then calculate size. Also use stripesize and stripeoffset for "gpart resize" command. Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Thu Jun 2 20:57:36 2011 (r222629) +++ head/sbin/geom/class/part/geom_part.c Thu Jun 2 21:59:21 2011 (r222630) @@ -306,7 +306,7 @@ gpart_autofill_resize(struct gctl_req *r struct ggeom *gp; struct gprovider *pp; off_t last, size, start, new_size; - off_t lba, new_lba, alignment; + off_t lba, new_lba, alignment, offset; const char *s; int error, idx; @@ -341,6 +341,9 @@ gpart_autofill_resize(struct gctl_req *r errc(EXIT_FAILURE, error, "Invalid alignment param"); if (alignment == 0) errx(EXIT_FAILURE, "Invalid alignment param"); + lba = pp->lg_stripesize / pp->lg_sectorsize; + if (lba % alignment) + alignment = g_lcm(lba, alignment); } error = gctl_delete_param(req, "alignment"); if (error) @@ -356,12 +359,10 @@ gpart_autofill_resize(struct gctl_req *r /* no autofill necessary. */ if (alignment == 1) goto done; - if (new_size > alignment) - new_size = ALIGNDOWN(new_size, alignment); } + offset = pp->lg_stripeoffset / pp->lg_sectorsize; last = (off_t)strtoimax(find_geomcfg(gp, "last"), NULL, 0); - last = ALIGNDOWN(last, alignment); LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { s = find_provcfg(pp, "index"); if (s == NULL) @@ -375,24 +376,32 @@ gpart_autofill_resize(struct gctl_req *r s = find_provcfg(pp, "start"); start = (off_t)strtoimax(s, NULL, 0); s = find_provcfg(pp, "end"); - lba = (off_t)strtoimax(s, NULL, 0) + 1; + lba = (off_t)strtoimax(s, NULL, 0); + size = lba - start + 1; - if (lba > last) { - geom_deletetree(&mesh); - return (ENOSPC); + if (new_size > 0 && new_size <= size) { + /* The start offset may be not aligned, so we align the end + * offset and then calculate the size. + */ + new_size = ALIGNDOWN(start + offset + new_size, + alignment) - start - offset; + goto done; } - size = lba - start; - pp = find_provider(gp, lba); - if (pp == NULL) - new_size = ALIGNDOWN(last - start + 1, alignment); - else { + + pp = find_provider(gp, lba + 1); + if (pp == NULL) { + new_size = ALIGNDOWN(last + offset + 1, alignment) - + start - offset; + if (new_size < size) + return (ENOSPC); + } else { s = find_provcfg(pp, "start"); new_lba = (off_t)strtoimax(s, NULL, 0); /* * Is there any free space between current and * next providers? */ - new_lba = ALIGNUP(new_lba, alignment); + new_lba = ALIGNDOWN(new_lba + offset, alignment) - offset; if (new_lba > lba) new_size = new_lba - start; else { @@ -482,10 +491,16 @@ gpart_autofill(struct gctl_req *req) if (has_size && has_start && !has_alignment) goto done; - /* Adjust parameters to offset value for better alignment */ - s = find_provcfg(pp, "offset"); - offset = (s == NULL) ? 0: - (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize; + /* + * If stripesize is not zero, then recalculate alignment value. + * Use LCM from stripesize and user specified alignment. + */ + len = pp->lg_stripesize / pp->lg_sectorsize; + if (len % alignment) + alignment = g_lcm(len, alignment); + + /* Adjust parameters to stripeoffset */ + offset = pp->lg_stripeoffset / pp->lg_sectorsize; start = ALIGNUP(start + offset, alignment); if (size + offset > alignment) size = ALIGNDOWN(size + offset, alignment); From owner-svn-src-head@FreeBSD.ORG Thu Jun 2 22:15:20 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A68B106566C; Thu, 2 Jun 2011 22:15:20 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EEE608FC19; Thu, 2 Jun 2011 22:15:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p52MFJau036191; Thu, 2 Jun 2011 22:15:19 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p52MFJL9036189; Thu, 2 Jun 2011 22:15:19 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106022215.p52MFJL9036189@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 2 Jun 2011 22:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222631 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2011 22:15:20 -0000 Author: ae Date: Thu Jun 2 22:15:19 2011 New Revision: 222631 URL: http://svn.freebsd.org/changeset/base/222631 Log: Always use LCM when stripesize > 0. Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Thu Jun 2 21:59:21 2011 (r222630) +++ head/sbin/geom/class/part/geom_part.c Thu Jun 2 22:15:19 2011 (r222631) @@ -342,7 +342,7 @@ gpart_autofill_resize(struct gctl_req *r if (alignment == 0) errx(EXIT_FAILURE, "Invalid alignment param"); lba = pp->lg_stripesize / pp->lg_sectorsize; - if (lba % alignment) + if (lba > 0) alignment = g_lcm(lba, alignment); } error = gctl_delete_param(req, "alignment"); @@ -496,7 +496,7 @@ gpart_autofill(struct gctl_req *req) * Use LCM from stripesize and user specified alignment. */ len = pp->lg_stripesize / pp->lg_sectorsize; - if (len % alignment) + if (len > 0 ) alignment = g_lcm(len, alignment); /* Adjust parameters to stripeoffset */ From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 00:11:13 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2F6F106566B; Fri, 3 Jun 2011 00:11:13 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92ED98FC18; Fri, 3 Jun 2011 00:11:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p530BDZ5039673; Fri, 3 Jun 2011 00:11:13 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p530BD9a039671; Fri, 3 Jun 2011 00:11:13 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106030011.p530BD9a039671@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 3 Jun 2011 00:11:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222632 - head/sys/powerpc/aim X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 00:11:13 -0000 Author: nwhitehorn Date: Fri Jun 3 00:11:13 2011 New Revision: 222632 URL: http://svn.freebsd.org/changeset/base/222632 Log: Quantities stored on the stack on ppc64 tend to be twice as large as on ppc32, so make the early stack correspondingly twice as big. Modified: head/sys/powerpc/aim/locore64.S Modified: head/sys/powerpc/aim/locore64.S ============================================================================== --- head/sys/powerpc/aim/locore64.S Thu Jun 2 22:15:19 2011 (r222631) +++ head/sys/powerpc/aim/locore64.S Fri Jun 3 00:11:13 2011 (r222632) @@ -75,7 +75,7 @@ .globl kernbase .set kernbase, KERNBASE -#define TMPSTKSZ 8192 /* 8K temporary stack */ +#define TMPSTKSZ 16384 /* 16K temporary stack */ /* * Globals From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 05:16:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC595106564A; Fri, 3 Jun 2011 05:16:33 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A41678FC19; Fri, 3 Jun 2011 05:16: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 p535GXKX049084; Fri, 3 Jun 2011 05:16:33 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p535GXau049081; Fri, 3 Jun 2011 05:16:33 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201106030516.p535GXau049081@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 3 Jun 2011 05:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222635 - head/usr.bin/man X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 05:16:33 -0000 Author: ru Date: Fri Jun 3 05:16:33 2011 New Revision: 222635 URL: http://svn.freebsd.org/changeset/base/222635 Log: Added support for the MANWIDTH environment variable: If set to a numeric value, used as the width manpages should be displayed. Otherwise, if set to a special value ``tty'', and output is to a terminal, the pages may be displayed over the whole width of the screen. Modified: head/usr.bin/man/man.1 head/usr.bin/man/man.sh Modified: head/usr.bin/man/man.1 ============================================================================== --- head/usr.bin/man/man.1 Fri Jun 3 03:39:33 2011 (r222634) +++ head/usr.bin/man/man.1 Fri Jun 3 05:16:33 2011 (r222635) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 1, 2010 +.Dd June 2, 2011 .Dt MAN 1 .Os .Sh NAME @@ -283,6 +283,12 @@ Restricts manual sections searched to th Corresponds to the .Fl S option. +.It Ev MANWIDTH +If set to a numeric value, used as the width manpages should be displayed. +Otherwise, if set to a special value +.Dq Li tty , +and output is to a terminal, +the pages may be displayed over the whole width of the screen. .It Ev PAGER Program used to display files. If unset, Modified: head/usr.bin/man/man.sh ============================================================================== --- head/usr.bin/man/man.sh Fri Jun 3 03:39:33 2011 (r222634) +++ head/usr.bin/man/man.sh Fri Jun 3 05:16:33 2011 (r222635) @@ -112,7 +112,11 @@ check_man() { setup_cattool $manpage decho " Found manpage $manpage" - if exists "$2" && is_newer $found $manpage; then + if [ -n "${use_width}" ]; then + # non-standard width + unset use_cat + decho " Skipping catpage: non-standard page width" + elif exists "$2" && is_newer $found $manpage; then # cat page found and is newer, use that use_cat=yes catpage=$found @@ -352,6 +356,10 @@ man_display_page() { ;; esac + if [ -n "${use_width}" ]; then + NROFF="$NROFF -rLL=${use_width}n -rLT=${use_width}n" + fi + if [ -n "$MANROFFSEQ" ]; then set -- -$MANROFFSEQ while getopts 'egprtv' preproc_arg; do @@ -562,6 +570,35 @@ man_setup() { build_manpath man_setup_locale + man_setup_width +} + +# Usage: man_setup_width +# Set up page width. +man_setup_width() { + local sizes + + unset use_width + case "$MANWIDTH" in + [0-9]*) + if [ "$MANWIDTH" -gt 0 2>/dev/null ]; then + use_width=$MANWIDTH + fi + ;; + [Tt][Tt][Yy]) + if { sizes=$($STTY size 0>&3 2>/dev/null); } 3>&1; then + set -- $sizes + if [ $2 -gt 80 ]; then + use_width=$(($2-2)) + fi + fi + ;; + esac + if [ -n "$use_width" ]; then + decho "Using non-standard page width: ${use_width}" + else + decho 'Using standard page width' + fi } # Usage: man_setup_locale @@ -900,6 +937,7 @@ VGRIND=vgrind COL=/usr/bin/col LOCALE=/usr/bin/locale +STTY=/bin/stty SYSCTL=/sbin/sysctl debug=0 From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 05:16:55 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3767106566B; Fri, 3 Jun 2011 05:16:54 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4FC18FC16; Fri, 3 Jun 2011 05:16:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p535GskX049129; Fri, 3 Jun 2011 05:16:54 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p535GsRU049127; Fri, 3 Jun 2011 05:16:54 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201106030516.p535GsRU049127@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 3 Jun 2011 05:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222636 - head/usr.bin/man X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 05:16:55 -0000 Author: ru Date: Fri Jun 3 05:16:54 2011 New Revision: 222636 URL: http://svn.freebsd.org/changeset/base/222636 Log: Typo. Modified: head/usr.bin/man/man.conf.5 Modified: head/usr.bin/man/man.conf.5 ============================================================================== --- head/usr.bin/man/man.conf.5 Fri Jun 3 05:16:33 2011 (r222635) +++ head/usr.bin/man/man.conf.5 Fri Jun 3 05:16:54 2011 (r222636) @@ -112,7 +112,7 @@ with the following contents: .Bd -literal -offset indent # Setup Japanese toolset MANLOCALE ja_JP.eucJP -EQN_JA /usr/local/bin/gepn +EQN_JA /usr/local/bin/geqn PIC_JA /usr/local/bin/gpic TBL_JA /usr/local/bin/gtbl NROFF_JA /usr/local/bin/groff -man -dlang=ja_JP.eucJP From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 05:56:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50E0C106566B; Fri, 3 Jun 2011 05:56:53 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4235B8FC14; Fri, 3 Jun 2011 05:56: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 p535uqkA050382; Fri, 3 Jun 2011 05:56:52 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p535uqaW050380; Fri, 3 Jun 2011 05:56:52 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201106030556.p535uqaW050380@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 3 Jun 2011 05:56:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222638 - head/usr.bin/man X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 05:56:53 -0000 Author: ru Date: Fri Jun 3 05:56:52 2011 New Revision: 222638 URL: http://svn.freebsd.org/changeset/base/222638 Log: Trim more when parsing MANCONFIG directive. Modified: head/usr.bin/man/man.sh Modified: head/usr.bin/man/man.sh ============================================================================== --- head/usr.bin/man/man.sh Fri Jun 3 05:33:38 2011 (r222637) +++ head/usr.bin/man/man.sh Fri Jun 3 05:56:52 2011 (r222638) @@ -704,7 +704,7 @@ parse_file() { manlocales="$manlocales:$tstr" ;; MANCONFIG*) decho " MANCONFIG" 3 - trim "${line#MANCONF}" + trim "${line#MANCONFIG}" config_local="$tstr" ;; # Set variables in the form of FOO_BAR From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 06:58:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A07181065670; Fri, 3 Jun 2011 06:58:24 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 916A58FC1C; Fri, 3 Jun 2011 06:58:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p536wOCY052440; Fri, 3 Jun 2011 06:58:24 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p536wOuI052438; Fri, 3 Jun 2011 06:58:24 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106030658.p536wOuI052438@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 3 Jun 2011 06:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222642 - head/sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 06:58:24 -0000 Author: ae Date: Fri Jun 3 06:58:24 2011 New Revision: 222642 URL: http://svn.freebsd.org/changeset/base/222642 Log: Add diagnostic message about not aligned partitions. Idea from: ivoras Modified: head/sys/geom/part/g_part.c Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Fri Jun 3 06:34:29 2011 (r222641) +++ head/sys/geom/part/g_part.c Fri Jun 3 06:58:24 2011 (r222642) @@ -248,6 +248,7 @@ g_part_check_integrity(struct g_part_tab { struct g_part_entry *e1, *e2; struct g_provider *pp; + off_t offset; int failed; failed = 0; @@ -294,6 +295,16 @@ g_part_check_integrity(struct g_part_tab (intmax_t)table->gpt_last); failed++; } + if (pp->stripesize > 0) { + offset = e1->gpe_start * pp->sectorsize; + if (e1->gpe_offset > offset) + offset = e1->gpe_offset; + if ((offset + pp->stripeoffset) % pp->stripesize) { + DPRINTF("partition %d is not aligned on %u " + "bytes\n", e1->gpe_index, pp->stripesize); + /* Don't treat this as a critical failure */ + } + } e2 = e1; while ((e2 = LIST_NEXT(e2, gpe_entry)) != NULL) { if (e2->gpe_deleted || e2->gpe_internal) @@ -723,7 +734,11 @@ g_part_ctl_add(struct gctl_req *req, str if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { sb = sbuf_new_auto(); G_PART_FULLNAME(table, entry, sb, gp->name); - sbuf_cat(sb, " added\n"); + if (pp->stripesize > 0 && entry->gpe_pp->stripeoffset != 0) + sbuf_printf(sb, " added, but partition is not " + "aligned on %u bytes\n", pp->stripesize); + else + sbuf_cat(sb, " added\n"); sbuf_finish(sb); gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); sbuf_delete(sb); From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 07:25:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F6551065670; Fri, 3 Jun 2011 07:25:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 309988FC0C; Fri, 3 Jun 2011 07:25:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p537PbnZ053278; Fri, 3 Jun 2011 07:25:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p537PbJb053276; Fri, 3 Jun 2011 07:25:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106030725.p537PbJb053276@svn.freebsd.org> From: Alexander Motin Date: Fri, 3 Jun 2011 07:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222643 - head/sys/cam/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 07:25:37 -0000 Author: mav Date: Fri Jun 3 07:25:36 2011 New Revision: 222643 URL: http://svn.freebsd.org/changeset/base/222643 Log: Increase maximum supported number of ranges per TRIM command from 256 to 512 to use full potential of Intel X25-M SSDs. On synthetic test with 32K ranges it gives about 20% speedup, which probably costs more then 2K of RAM. Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Fri Jun 3 06:58:24 2011 (r222642) +++ head/sys/cam/ata/ata_da.c Fri Jun 3 07:25:36 2011 (r222643) @@ -114,9 +114,9 @@ struct disk_params { u_int64_t sectors; /* Total number sectors */ }; -#define TRIM_MAX_BLOCKS 4 +#define TRIM_MAX_BLOCKS 8 #define TRIM_MAX_RANGES (TRIM_MAX_BLOCKS * 64) -#define TRIM_MAX_BIOS (TRIM_MAX_RANGES * 8) +#define TRIM_MAX_BIOS (TRIM_MAX_RANGES * 4) struct trim_request { uint8_t data[TRIM_MAX_RANGES * 8]; struct bio *bps[TRIM_MAX_BIOS]; From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 07:27:54 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A029106564A; Fri, 3 Jun 2011 07:27:54 +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 39C048FC13; Fri, 3 Jun 2011 07: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 p537RsDp053388; Fri, 3 Jun 2011 07: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 p537Rs6G053379; Fri, 3 Jun 2011 07:27:54 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201106030727.p537Rs6G053379@svn.freebsd.org> From: Adrian Chadd Date: Fri, 3 Jun 2011 07:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222644 - in head/sys/dev/ath/ath_hal: . ar5212 ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 07:27:54 -0000 Author: adrian Date: Fri Jun 3 07:27:53 2011 New Revision: 222644 URL: http://svn.freebsd.org/changeset/base/222644 Log: Bring over the relevant registers to use when implementing the quiet time portion of 802.11h. The AR5212 code has been brought over as a reference, it's currently untested. Obtained from: Atheros Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c head/sys/dev/ath/ath_hal/ar5212/ar5212reg.h head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Fri Jun 3 07:25:36 2011 (r222643) +++ head/sys/dev/ath/ath_hal/ah.h Fri Jun 3 07:27:53 2011 (r222644) @@ -736,6 +736,16 @@ typedef struct { /* + * Flag for setting QUIET period + */ +typedef enum { + HAL_QUIET_DISABLE = 0x0, + HAL_QUIET_ENABLE = 0x1, + HAL_QUIET_ADD_CURRENT_TSF = 0x2, /* add current TSF to next_start offset */ + HAL_QUIET_ADD_SWBA_RESP_TIME = 0x4, /* add beacon response time to next_start offset */ +} HAL_QUIET_FLAG; + +/* * Hardware Access Layer (HAL) API. * * Clients of the HAL call ath_hal_attach to obtain a reference to an @@ -909,6 +919,9 @@ struct ath_hal { u_int __ahdecl(*ah_getCTSTimeout)(struct ath_hal*); HAL_BOOL __ahdecl(*ah_setDecompMask)(struct ath_hal*, uint16_t, int); void __ahdecl(*ah_setCoverageClass)(struct ath_hal*, uint8_t, int); + HAL_STATUS __ahdecl(*ah_setQuiet)(struct ath_hal *ah, uint32_t period, + uint32_t duration, uint32_t nextStart, + HAL_QUIET_FLAG flag); /* DFS functions */ void __ahdecl(*ah_enableDfs)(struct ath_hal *ah, Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Fri Jun 3 07:25:36 2011 (r222643) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Fri Jun 3 07:27:53 2011 (r222644) @@ -506,6 +506,8 @@ extern HAL_BOOL ar5212SetCapability(stru extern HAL_BOOL ar5212GetDiagState(struct ath_hal *ah, int request, const void *args, uint32_t argsize, void **result, uint32_t *resultsize); +extern HAL_STATUS ar5212SetQuiet(struct ath_hal *ah, uint32_t period, + uint32_t duration, uint32_t nextStart, HAL_QUIET_FLAG flag); extern HAL_BOOL ar5212SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip); Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Fri Jun 3 07:25:36 2011 (r222643) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Fri Jun 3 07:27:53 2011 (r222644) @@ -127,6 +127,7 @@ static const struct ath_hal_private ar52 .ah_getCTSTimeout = ar5212GetCTSTimeout, .ah_setDecompMask = ar5212SetDecompMask, .ah_setCoverageClass = ar5212SetCoverageClass, + .ah_setQuiet = ar5212SetQuiet, /* DFS Functions */ .ah_enableDfs = ar5212EnableDfs, Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Fri Jun 3 07:25:36 2011 (r222643) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Fri Jun 3 07:27:53 2011 (r222644) @@ -634,6 +634,20 @@ ar5212SetCoverageClass(struct ath_hal *a } } +HAL_STATUS +ar5212SetQuiet(struct ath_hal *ah, uint32_t period, uint32_t duration, + uint32_t nextStart, HAL_QUIET_FLAG flag) +{ + OS_REG_WRITE(ah, AR_QUIET2, period | (duration << AR_QUIET2_QUIET_DUR_S)); + if (flag & HAL_QUIET_ENABLE) { + OS_REG_WRITE(ah, AR_QUIET1, nextStart | (1 << 16)); + } + else { + OS_REG_WRITE(ah, AR_QUIET1, nextStart); + } + return HAL_OK; +} + void ar5212SetPCUConfig(struct ath_hal *ah) { Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212reg.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212reg.h Fri Jun 3 07:25:36 2011 (r222643) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212reg.h Fri Jun 3 07:27:53 2011 (r222644) @@ -300,6 +300,7 @@ #define AR_QUIET1_NEXT_QUIET 0xffff #define AR_QUIET1_QUIET_ENABLE 0x10000 /* Enable Quiet time operation */ #define AR_QUIET1_QUIET_ACK_CTS_ENABLE 0x20000 /* Do we ack/cts during quiet period */ +#define AR_QUIET1_QUIET_ACK_CTS_ENABLE_S 17 #define AR_QUIET2 0x8100 /* More Quiet time programming */ #define AR_QUIET2_QUIET_PER_S 0 /* Periodicity of quiet period (TU) */ Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Fri Jun 3 07:25:36 2011 (r222643) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Fri Jun 3 07:27:53 2011 (r222644) @@ -194,6 +194,8 @@ extern uint32_t ar5416Get11nExtBusy(stru extern void ar5416Set11nMac2040(struct ath_hal *ah, HAL_HT_MACMODE mode); extern HAL_HT_RXCLEAR ar5416Get11nRxClear(struct ath_hal *ah); extern void ar5416Set11nRxClear(struct ath_hal *ah, HAL_HT_RXCLEAR rxclear); +extern HAL_STATUS ar5416SetQuiet(struct ath_hal *ah, uint32_t period, + uint32_t duration, uint32_t nextStart, HAL_QUIET_FLAG flag); extern HAL_STATUS ar5416GetCapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type, uint32_t capability, uint32_t *result); extern HAL_BOOL ar5416GetDiagState(struct ath_hal *ah, int request, Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Jun 3 07:25:36 2011 (r222643) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Fri Jun 3 07:27:53 2011 (r222644) @@ -139,6 +139,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_setAntennaSwitch = ar5416SetAntennaSwitch; ah->ah_setDecompMask = ar5416SetDecompMask; ah->ah_setCoverageClass = ar5416SetCoverageClass; + ah->ah_setQuiet = ar5416SetQuiet; ah->ah_resetKeyCacheEntry = ar5416ResetKeyCacheEntry; ah->ah_setKeyCacheEntry = ar5416SetKeyCacheEntry; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Fri Jun 3 07:25:36 2011 (r222643) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Fri Jun 3 07:27:53 2011 (r222644) @@ -273,6 +273,35 @@ ar5416Set11nRxClear(struct ath_hal *ah, } } +/* XXX shouldn't be here! */ +#define TU_TO_USEC(_tu) ((_tu) << 10) + +HAL_STATUS +ar5416SetQuiet(struct ath_hal *ah, uint32_t period, uint32_t duration, + uint32_t nextStart, HAL_QUIET_FLAG flag) +{ + uint32_t period_us = TU_TO_USEC(period); /* convert to us unit */ + uint32_t nextStart_us = TU_TO_USEC(nextStart); /* convert to us unit */ + if (flag & HAL_QUIET_ENABLE) { + if ((!nextStart) || (flag & HAL_QUIET_ADD_CURRENT_TSF)) { + /* Add the nextStart offset to the current TSF */ + nextStart_us += OS_REG_READ(ah, AR_TSF_L32); + } + if (flag & HAL_QUIET_ADD_SWBA_RESP_TIME) { + nextStart_us += ath_hal_sw_beacon_response_time; + } + OS_REG_RMW_FIELD(ah, AR_QUIET1, AR_QUIET1_QUIET_ACK_CTS_ENABLE, 1); + OS_REG_WRITE(ah, AR_QUIET2, SM(duration, AR_QUIET2_QUIET_DUR)); + OS_REG_WRITE(ah, AR_QUIET_PERIOD, period_us); + OS_REG_WRITE(ah, AR_NEXT_QUIET, nextStart_us); + OS_REG_SET_BIT(ah, AR_TIMER_MODE, AR_TIMER_MODE_QUIET); + } else { + OS_REG_CLR_BIT(ah, AR_TIMER_MODE, AR_TIMER_MODE_QUIET); + } + return HAL_OK; +} +#undef TU_TO_USEC + HAL_STATUS ar5416GetCapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type, uint32_t capability, uint32_t *result) From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 08:28:50 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 1233) id A239B1065675; Fri, 3 Jun 2011 08:28:50 +0000 (UTC) Date: Fri, 3 Jun 2011 08:28:50 +0000 From: Alexander Best To: Bruce Evans Message-ID: <20110603082850.GA91167@freebsd.org> References: <201105131848.p4DIm1j7079495@svn.freebsd.org> <201105282103.43370.pieter@degoeje.nl> <20110531004247.C4034@besplex.bde.org> <20110531032658.N5049@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20110531032658.N5049@besplex.bde.org> Cc: svn-src-head@FreeBSD.org, mdf@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pieter de Goeje Subject: Re: svn commit: r221853 - in head/sys: dev/md dev/null sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 08:28:50 -0000 On Tue May 31 11, Bruce Evans wrote: > On Mon, 30 May 2011 mdf@FreeBSD.org wrote: > > >On Mon, May 30, 2011 at 8:25 AM, Bruce Evans wrote: > >>On Sat, 28 May 2011 mdf@FreeBSD.org wrote: > >>>... > >>>Meanwhile you could try setting ZERO_REGION_SIZE to PAGE_SIZE and I > >>>think that will restore things to the original performance. > >> > >>Using /dev/zero always thrashes caches by the amount >>size> + (unless the arch uses nontemporal memory > >>accesses for uiomove, which none do AFAIK).  So a large source buffer > >>is always just a pessimization.  A large target buffer size is also a > >>pessimization, but for the target buffer a fairly large size is needed > >>to amortize the large syscall costs.  In this PR, the target buffer > >>size is 64K.  ZERO_REGION_SIZE is 64K on i386 and 2M on amd64.  64K+64K > >>on i386 is good for thrashing the L1 cache. > > > >That depends -- is the cache virtually or physically addressed? The > >zero_region only has 4k (PAGE_SIZE) of unique physical addresses. So > >most of the cache thrashing is due to the user-space buffer, if the > >cache is physically addressed. > > Oops. I now remember thinking that the much larger source buffer would be > OK since it only uses 1 physical page. But it is apparently virtually > addressed. > > >It will only have a > >>noticeable impact on a current L2 cache in competition with other > >>threads.  It is hard to fit everything in the L1 cache even with > >>non-bloated buffer sizes and 1 thread (16 for the source (I)cache, 0 > >>for the source (D)cache and 4K for the target cache might work).  On > >>amd64, 2M+2M is good for thrashing most L2 caches.  In this PR, the > >>thrashing is limited by the target buffer size to about 64K+64K, up > >>from 4K+64K, and it is marginal whether the extra thrashing from the > >>larger source buffer makes much difference. > >> > >>The old zbuf source buffer size of PAGE_SIZE was already too large. > > > >Wouldn't this depend on how far down from the use of the buffer the > >actual copy happens? Another advantage to a large virtual buffer is > >that it reduces the number of times the copy loop in uiomove has to > >return up to the device layer that initiated the copy. This is all > >pretty fast, but again assuming a physical cache fewer trips is > >better. > > Yes, I had forgotten that I have to keep going back to the uiomove() > level for each iteration. That's a lot of overhead although not nearly > as much as going back to the user level. If this is actually important > to optimize, then I might add a repeat count to uiomove() and copyout() > (actually a different function for the latter). > > linux-2.6.10 uses a mmapped /dev/zero and has had this since Y2K > according to its comment. Sigh. You will never beat that by copying, > but I think mmapping /dev/zero is only much more optimal for silly > benchmarks. > > linux-2.6.10 also has a seekable /dev/zero. Seeks don't really work, > but some of them "succeed" and keep the offset at 0 . ISTR remember > a FreeBSD PR about the file offset for /dev/zero not "working" because > it is garbage instead of 0. It is clearly a Linuxism to depend on it > being nonzero. IIRC, the file offset for device files is at best > implementation-defined in POSIX. i think you refer to [1]. i posted a patch as followup to that PR, but later noticed that it is completely wrong. there was also a discussion on @hackers i opened up with the subject line "seeking into /dev/{null,zero}". however not much came out of it. POSIX doesn't have anything to say about seeking in connection with /dev/{null,zero}. it only states that: "The behavior of lseek() on devices which are incapable of seeking is implementation-defined. The value of the file offset associated with such a device is undefined." so basically we can decide for ourselves, whether /dev/{null,zero} shall be capable or incapable of seeking. i really think this issue should be solved once and for all and then also mentioned in the zero(4) and null(4) man pages. so the question is: how do we want /dev/zero and /dev/null to behave when seeking into the devices? right now HEAD features the following semantics: reading from /dev/null != seeking writing to /dev/null != seeking reading from /dev/zero == seeking writing to /dev/zero != seeking please don't get me wrong: i'm NOT saying the current semantics are wrong. the issue in question is: the semantics need to be agreed upon and then documented once and for all in the zero(4) and null(4) man pages, so people don't trip over this questions every couple of years over and over again. cheers. alex [1] http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/152485 > > Bruce -- a13x From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 10:39:36 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B26CB106566B; Fri, 3 Jun 2011 10:39:36 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0C4C8FC0A; Fri, 3 Jun 2011 10:39:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p53Ada3H060713; Fri, 3 Jun 2011 10:39:36 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53AdaZU060711; Fri, 3 Jun 2011 10:39:36 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201106031039.p53AdaZU060711@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 3 Jun 2011 10:39:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222646 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 10:39:36 -0000 Author: ru Date: Fri Jun 3 10:39:36 2011 New Revision: 222646 URL: http://svn.freebsd.org/changeset/base/222646 Log: Generally clean up markup. Modified: head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Fri Jun 3 09:32:49 2011 (r222645) +++ head/sbin/geom/class/part/gpart.8 Fri Jun 3 10:39:36 2011 (r222646) @@ -61,7 +61,8 @@ which is used to define a logical partit The .Dv GEOM_PART_EBR_COMPAT option enables backward compatibility for partition names -in the EBR scheme. Also it makes impossible any types of actions +in the EBR scheme. +Also it makes impossible any types of actions with such partitions. The .Dv GEOM_PART_GPT @@ -170,7 +171,7 @@ utility: .\" ==== SHOW ==== .Nm .Cm show -.Op Fl l | Fl r +.Op Fl l | r .Op Fl p .Op Ar geom ... .\" ==== UNDO ==== @@ -200,11 +201,14 @@ The partition begins on the logical bloc option. Its size is given by the .Fl s Ar size -option. SI unit suffixes are allowed. One or both +option. +SI unit suffixes are allowed. +One or both .Fl b and .Fl s -options can be omitted. If so they are automatically calculated. +options can be omitted. +If so they are automatically calculated. The type of the partition is given by the .Fl t Ar type option. @@ -399,7 +403,7 @@ about its use. Recover corrupt partition's scheme metadata on the geom .Ar geom . See the section entitled -.Sx "RECOVERING" +.Sx RECOVERING below for the additional information. .Pp Additional options include: @@ -453,7 +457,7 @@ action and given from standard input. Only partition table may be restored. This action does not affect content of partitions. This mean that you should copy your data from backup after restoring -partition table and write bootcode again if it is needed. +partition table and write bootcode again if it is needed. .Pp Additional options include: .Bl -tag -width 10n @@ -474,7 +478,7 @@ about its use. .It Cm set Set the named attribute on the partition entry. See the section entitled -.Sx "ATTRIBUTES" +.Sx ATTRIBUTES below for a list of available attributes. .Pp Additional options include: @@ -511,7 +515,7 @@ action and can be used to undo any chang .It Cm unset Clear the named attribute on the partition entry. See the section entitled -.Sx "ATTRIBUTES" +.Sx ATTRIBUTES below for a list of available attributes. .Pp Additional options include: @@ -616,75 +620,75 @@ by GPT. .El .Sh ATTRIBUTES The scheme-specific attributes for EBR: -.Bl -tag -width ".Ar active" -.It Ar active +.Bl -tag -width ".Cm active" +.It Cm active .El .Pp The scheme-specific attributes for GPT: -.Bl -tag -width ".Ar bootfailed" -.It Ar bootme +.Bl -tag -width ".Cm bootfailed" +.It Cm bootme When set, the .Nm gptboot stage 1 boot loader will try to boot the system from this partition. Multiple partitions might be marked with the -.Ar bootme +.Cm bootme attribute. In such scenario the .Nm gptboot will try all -.Ar bootme +.Cm bootme partitions one by one, until the next boot stage is successfully entered. -.It Ar bootonce +.It Cm bootonce Setting this attribute automatically sets the -.Ar bootme +.Cm bootme attribute. When set, the .Nm gptboot stage 1 boot loader will try to boot the system from this partition only once. Partitions with both -.Ar bootonce +.Cm bootonce and -.Ar bootme +.Cm bootme attributes are tried before partitions with only the -.Ar bootme +.Cm bootme attribute. Before -.Ar bootonce +.Cm bootonce partition is tried, the .Nm gptboot removes the -.Ar bootme +.Cm bootme attribute and tries to execute the next boot stage. If it fails, the -.Ar bootonce +.Cm bootonce attribute that is now alone is replaced with the -.Ar bootfailed +.Cm bootfailed attribute. If the execution of the next boot stage succeeds, but the system is not fully booted, the .Nm gptboot will look for -.Ar bootonce +.Cm bootonce attributes alone (without the -.Ar bootme +.Cm bootme attribute) on the next system boot and will replace those with the -.Ar bootfailed +.Cm bootfailed attribute. If the system is fully booted, the .Pa /etc/rc.d/gptboot start-up script will look for partition with the -.Ar bootonce +.Cm bootonce attribute alone, will remove the attribute and log that the system was successfully booted from this partition. There should be at most one -.Ar bootonce +.Cm bootonce partition when system is successfully booted. Multiple partitions might be marked with the -.Ar bootonce +.Cm bootonce and -.Ar bootme +.Cm bootme attribute pairs. -.It Ar bootfailed +.It Cm bootfailed This attribute should not be manually managed. It is managed by the .Nm gptboot @@ -692,24 +696,24 @@ stage 1 boot loader and the .Pa /etc/rc.d/gptboot start-up script. This attribute is used to mark partitions that had the -.Ar bootonce +.Cm bootonce attribute set, but we failed to boot from them. Once we successfully boot, the .Pa /etc/rc.d/gptboot script will log all the partitions we failed to boot from and will remove the -.Ar bootfailed +.Cm bootfailed attributes. .El .Pp The scheme-specific attributes for MBR: -.Bl -tag -width ".Ar active" -.It Ar active +.Bl -tag -width ".Cm active" +.It Cm active .El .Pp The scheme-specific attributes for PC98: -.Bl -tag -width ".Ar bootable" -.It Ar active -.It Ar bootable +.Bl -tag -width ".Cm bootable" +.It Cm active +.It Cm bootable .El .Sh OPERATIONAL FLAGS Actions other than the @@ -747,7 +751,7 @@ reports about corruption. Any changes in corrupt table are prohibited except .Cm destroy and -.Cm recover . +.Cm recover . .Pp In case when only first sector is corrupt kernel can not detect GPT even if partition table is not corrupt. @@ -771,16 +775,15 @@ GEOM: provider: the secondary GPT table GEOM: provider: using the primary only -- recovery suggested. .Ed .Pp -Also -.Cm gpart -commands like -.Cm show , -.Cm status +Also +.Nm +commands like +.Cm show , status and .Cm list will report about corrupt table. .Pp -In case when the size of device has changed (e.g. volume expansion) the +In case when the size of device has changed (e.g.\& volume expansion) the secondary GPT header will become located not in the last sector. This is not a metadata corruption, but it is dangerous because any corruption of the primary GPT will lead to lost of partition table. @@ -789,19 +792,19 @@ Kernel reports about this problem with m GEOM: provider: the secondary GPT header is not in the last LBA. .Ed .Pp -A corrupt table can be recovered with -.Cm gpart recover +A corrupt table can be recovered with +.Cm recover command. -This command does reconstruction of corrupt metadata using +This command does reconstruction of corrupt metadata using known valid metadata. Also it can relocate secondary GPT to the end of device. .Pp -.Pa NOTE : -The GEOM class PART can detect the same partition table on different GEOM +.Em NOTE : +The GEOM class PART can detect the same partition table on different GEOM providers and some of them will be marked as corrupt. Be careful when choosing a provider for recovering. If you choose incorrectly you can destroy the metadata of another GEOM class, -e.g. GEOM MIRROR or GEOM LABEL. +e.g.\& GEOM MIRROR or GEOM LABEL. .Sh SYSCTL VARIABLES The following .Xr sysctl 8 @@ -815,20 +818,21 @@ This variable controls the behaviour of When integrity checks are enabled .Nm PART GEOM class verifies all generic partition parameters that it gets from the -disk metadata. If some inconsistency is detected, partition table will be +disk metadata. +If some inconsistency is detected, partition table will be rejected with a diagnostic message: -.Pa GEOM_PART: Integrity check failed (provider, scheme) . +.Sy "GEOM_PART: Integrity check failed (provider, scheme)" . .El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES Create GPT scheme on -.Pa ad0 . +.Pa ad0 : .Bd -literal -offset indent /sbin/gpart create -s GPT ad0 .Ed .Pp -Embed GPT bootstrap code into protective MBR. +Embed GPT bootstrap code into protective MBR: .Bd -literal -offset indent /sbin/gpart bootcode -b /boot/pmbr ad0 .Ed @@ -854,15 +858,19 @@ future need (e.g.\& from a ZFS partition .Pp Create a 512MB-sized .Cm freebsd-ufs -partition that would contain UFS where the system boots from. +partition that would contain UFS where the system boots from: .Bd -literal -offset indent /sbin/gpart add -b 162 -s 1048576 -t freebsd-ufs ad0 .Ed .Pp Create MBR scheme on .Pa ada0 , -then create 30GB-sized FreeBSD slice, mark it active and -install boot0 boot manager: +then create 30GB-sized +.Fx +slice, mark it active and +install +.Nm boot0 +boot manager: .Bd -literal -offset indent /sbin/gpart create -s MBR ada0 /sbin/gpart add -t freebsd -s 30G ada0 @@ -870,7 +878,11 @@ install boot0 boot manager: /sbin/gpart bootcode -b /boot/boot0 ada0 .Ed .Pp -Now create BSD scheme (BSD label) with ability to have up to 20 partitions: +Now create +.Bx +scheme +.Pf ( Bx +label) with ability to have up to 20 partitions: .Bd -literal -offset indent /sbin/gpart create -s BSD -n 20 ada0s1 .Ed @@ -881,20 +893,22 @@ Create 1GB-sized UFS partition and 4GB-s /sbin/gpart add -t freebsd-swap -s 4G ada0s1 .Ed .Pp -Install bootstrap code for the BSD label: +Install bootstrap code for the +.Bx +label: .Bd -literal -offset indent /sbin/gpart bootcode -b /boot/boot ada0s1 .Ed .Pp Create VTOC8 scheme on -.Pa da0 . +.Pa da0 : .Bd -literal -offset indent /sbin/gpart create -s VTOC8 da0 .Ed .Pp Create a 512MB-sized .Cm freebsd-ufs -partition that would contain UFS where the system boots from. +partition that would contain UFS where the system boots from: .Bd -literal -offset indent /sbin/gpart add -s 512M -t freebsd-ufs da0 .Ed @@ -906,29 +920,29 @@ partition that would contain UFS and ali /sbin/gpart add -s 15G -t freebsd-ufs -a 4k da0 .Ed .Pp -After having created all required partitions, embed bootstrap code into them. +After having created all required partitions, embed bootstrap code into them: .Bd -literal -offset indent /sbin/gpart bootcode -p /boot/boot1 da0 .Ed .Pp Create backup of partition table from -.Pa da0 +.Pa da0 : .Bd -literal -offset indent /sbin/gpart backup da0 > da0.backup .Ed .Pp Restore partition table from backup to -.Pa da0 +.Pa da0 : .Bd -literal -offset indent /sbin/gpart restore -l da0 < /mnt/da0.backup .Ed .Pp -Clone partition table from -.Pa ada0 -to -.Pa ada1 -and -.Pa ada2 +Clone partition table from +.Pa ada0 +to +.Pa ada1 +and +.Pa ada2 : .Bd -literal -offset indent /sbin/gpart backup ada0 | /sbin/gpart restore -F ada1 ada2 .Ed From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 10:47:12 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 142BB1065672; Fri, 3 Jun 2011 10:47:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 8A8728FC1A; Fri, 3 Jun 2011 10:47:11 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p53Al0mc028969 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Jun 2011 20:47:06 +1000 Date: Fri, 3 Jun 2011 20:47:00 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Kenneth D. Merry" In-Reply-To: <20110602213611.GA47880@nargothrond.kdm.org> Message-ID: <20110603204653.B1551@besplex.bde.org> References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> <4DE5D72A.1020405@FreeBSD.org> <20110601193030.A1275@besplex.bde.org> <20110602213611.GA47880@nargothrond.kdm.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon , Bruce Evans Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 10:47:12 -0000 On Thu, 2 Jun 2011, Kenneth D. Merry wrote: > On Wed, Jun 01, 2011 at 20:07:31 +1000, Bruce Evans wrote: >> On Wed, 1 Jun 2011, Andriy Gapon wrote: >> >>> on 31/05/2011 20:29 Kenneth D. Merry said the following: >>>> + mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); >>> >>> Sorry that I didn't gather myself together for a review before this change >>> got >>> actually committed. >>> Do you see any reason not to make this spinlock recursive? It does need to be recursive to avoid deadlock (as I described), but this prevents it actually working as a lock. I think the new code needs it to work as a lock. >> I see reasons why it must not exist. The message buffer code cannot use >> any normal locking, and was carefully written to avoid doing so. >> >>> I am a little bit worried about "exotic" situations like receiving an NMI >>> in the >>> middle of printing and wanting to print in the NMI context, or similar >>> things >>> that penetrate contexts with disabled interrupts - e.g. Machine Check >>> Exception. >>> Also it's not clear to me if there won't any bigger damage in the >>> situations >>> like those described above. >>> >>> P.S. I have been thinking about fixing the problem in a different fashion, >>> via >>> reserving portions of dmesg buffer for a whole message using CAS: >>> http://lists.freebsd.org/pipermail/freebsd-hackers/2010-April/031535.html >> >> Something like this might work. >> >> PRINTF_BUFR size should not exist either, especially now that it is >> much more complicated and broken. Here is some of my old mail about >> adding (necessarily not normal) locking to to printf. No one replied, >> so I never finished this :-(. > > That particular solution doesn't lock the normal kernel printf path, and so > won't fix what we're trying to fix. (We've got lots of disks in each > system, and when there are various SES events and disks arriving and > departing, there are multiple kernel contexts doing printfs simultaneously, > and that results in scrambled dmesg output.) But it does. PRINTF_BUFR_SIZE (at least used to) only be applied to vprintf(), but my printf_lock() is applied to all calls to kvprintf() that set TOLOG. (If I missed some, this takes 2 lines each to fix.) The calls in tprintf() and log() have comments saying that this is intentional "to serialize msgbuf", though I fear this might not be safe for at least tprintf(), since it may block unboundedly. But even when it blocks unboundedly, nothing really bad happens: the output just becomes very slow due to everything waiting for the timeout until the blockage clears, and may be interleaved. Recursion gives similar behaviour, except it takes unrecursing to clear the blockage. I consider the very slow output to be a feature. Unbounded blockages and recursion are bugs and the slow output makes them more obvious. > I think the goals should be: > > - console output, syslog output, and dmesg output are not scrambled. > (i.e. individual kernel printfs make it out atomically, or at least > with a certain granularity, like PRINTF_BUFR_SIZE.) Console output includes debugger output. This must be able to break into any otherwise-atomic kernel printf. Possibly similarly for NMIs (if they print. They really shouldn't print, but they at least used to get this horribly wrong from the beginning on i386). Similarly for certain (non maskable) traps. These really shouldn't happen while we're printing, but if they do then they may need to panic and then print for things like machine check exceptions. Debugger output is the easiest way of showing why printf cannot use any normal locking. There is an option (that I don't like or use) which supports debugger output going through normal printf. I think the message buffer is used for this. So message buffer accesses cannout use normal locking either. Apart from this, I don't know any reason why a printf or even a msgbuf write can't wait for a while (a very long while if the output is to a slow device -- don't forget to test with a 50 bps serial console) until any previous printfs complete. My simple serialization gives this if the other printfs are on other CPUs, and possibly if they are on other ithreads (the simple serialization doesn't give up control for simplicity, since it is hard to tell when it is safe to give up control, but preemption while we are spinning might get back to the other printfs). And when the printf is recursive, there is no way back to the other printfs, so we must proceed. We could proceed immediately, but my simple serialization waits in this case too for simplicity. This case should be even rarer than waiting too long for another CPU. > - Can be called by any kernel routine (i.e. doesn't sleep) Some complications for tprintf and uprintf (and maybe ordinary printf if it is connected to a pty). I think we already have the necessary complications. Something involving printing only to the message buffer in the non-sleeping part. > - Offers a string at a time interface. I don't provide this. So printf's a character or word or 2 at a time may be interleaved. It is perhaps not to much to ask that important printfs that are likely to be interleaved preprint their strings into lines. > - Does the right thing for log messages (priority, etc.) > > It looks like we should add "does not use normal locking" to the list as > well. > > As Justin mentioned, we started off down the path of using atomic > operations, and then figured out that wouldn't fully work. Then we > discussed doing a per-CPU message buffer, with each message tagged with a > sequence number, and having the reader re-serialize the messages in the > right order. The complexity started to get large enough that we decided > that using a spin lock would be a much easier approach. But almost eveyone who has worked on this before knows that a spinlock cannot be used. > cnputs() already uses a spinlock, so we're no worse off than before from a > locking standpoint. An obvious bug for PRINTF_BUFR_SIZE. But as I said, this one might work well enough if it were recursive. This depends on the lower-level console drivers supporting recursion. Most don't. Some have simple serialization, but have to bypass it open to support debugger output, much like higher levels except they have more control over the timing. But in the message buffer accesses, I think you used the lock to provide exlusive accesses. > We could perhaps make the message buffer mutex recursive and set the > MTX_NOWITNESS flag as well, that might make things a little better from a > side effect standpoint. I don't see how a recursive mutex can protect the message buffer. Don't forget to trace through the code protected by the mutex using ddb, while at the same time using this code for ddb itself. It's just too hard to make this work. Normally, this type of problem is avoided by avoiding not using code like this for the low levels like ddb itself. Ddb mostly does this, but has complications: % static void % db_putc(int c) % { % % /* % * If not in the debugger or the user requests it, output data to % * both the console and the message buffer. % */ % if (!kdb_active || ddb_use_printf) { % printf("%c", c); Here it uses ordinary printf, so it uses whatever printf uses. In particular, PRINTF_BUFR_SIZE makes printf use cnputs() and the buggy locking in it, and printf always uses the message buffer and I think the new code gives buggy locking there unconditionally. This problem is not very large, since it takes some foot shooting to get here: - there is some buggy code that uses db_printf() when !kdb_active. Perhaps this is not used recursively. - we can configure ddb to use printf. I think it is a feature that the message buffer gets used in this mode. % if (!kdb_active) % return; % if (c == '\r' || c == '\n') % db_check_interrupt(); % if (c == '\n' && db_maxlines > 0) { % db_newlines++; % if (db_newlines >= db_maxlines) % db_pager(); % } % return; % } % % /* Otherwise, output data directly to the console. */ % if (c > ' ' && c <= '~') { % /* % * Printing character. % * If we have spaces to print, print them first. % * Use tabs if possible. % */ % db_force_whitespace(); % cnputc(c); % db_capture_writech(c); % db_output_position++; % db_last_non_space = db_output_position; % } I think this routine is used mainly by db_printf() calling kvprintf() and kvprintf() calling here. kvprintf() is supposed to be reentrant and in particular not use any locking to support this. I think it still does. Bruce From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 11:58:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AA06106566B; Fri, 3 Jun 2011 11:58:17 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A8C48FC18; Fri, 3 Jun 2011 11:58:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p53BwHOs063069; Fri, 3 Jun 2011 11:58:17 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53BwHAX063067; Fri, 3 Jun 2011 11:58:17 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201106031158.p53BwHAX063067@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 3 Jun 2011 11:58:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222647 - head/share/mk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 11:58:17 -0000 Author: ru Date: Fri Jun 3 11:58:17 2011 New Revision: 222647 URL: http://svn.freebsd.org/changeset/base/222647 Log: Don't pass -o1- to groff(1) by default. If ms(7) formatted document uses the .RP macro, a separate cover page is created as page 0 which is not otherwise output. The bug was hiding by a hack in troffrc that disables SGR support in grotty(1), which I'm going to remove now. For POLA reasons, still disable SGR support in grotty(1), by passing -P-c to groff(1). If we want SGR sequences in these documents, this can be removed. MFC after: 1 week Modified: head/share/mk/bsd.doc.mk Modified: head/share/mk/bsd.doc.mk ============================================================================== --- head/share/mk/bsd.doc.mk Fri Jun 3 10:39:36 2011 (r222646) +++ head/share/mk/bsd.doc.mk Fri Jun 3 11:58:17 2011 (r222647) @@ -54,10 +54,10 @@ INDXBIB?= indxbib PIC?= pic REFER?= refer .for _dev in ${PRINTERDEVICE:Mascii} -ROFF.ascii?= groff -Tascii ${TRFLAGS} -mtty-char ${MACROS} -o${PAGES} +ROFF.ascii?= groff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1} .endfor .for _dev in ${PRINTERDEVICE:Nascii} -ROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} -o${PAGES} +ROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1} .endfor SOELIM?= soelim TBL?= tbl @@ -94,8 +94,6 @@ DFILE.${_dev}= ${DOC}.${_dev}${DCOMPRESS .endif .endfor -PAGES?= 1- - UNROFF?= unroff HTML_SPLIT?= yes UNROFFFLAGS?= -fhtml From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 12:02:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1A7F106567F; Fri, 3 Jun 2011 12:02:53 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1A398FC1A; Fri, 3 Jun 2011 12:02: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 p53C2rua063262; Fri, 3 Jun 2011 12:02:53 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53C2rJq063260; Fri, 3 Jun 2011 12:02:53 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201106031202.p53C2rJq063260@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 3 Jun 2011 12:02:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222648 - head/contrib/groff/tmac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 12:02:54 -0000 Author: ru Date: Fri Jun 3 12:02:53 2011 New Revision: 222648 URL: http://svn.freebsd.org/changeset/base/222648 Log: Re-enable SGR support (ANSI color escapes) in grotty(1) by default. Our man(1) and bsd.doc.mk still disable it for POLA reasons via the -c option to grotty(1). PR: gnu/82353 Modified: head/contrib/groff/tmac/troffrc Modified: head/contrib/groff/tmac/troffrc ============================================================================== --- head/contrib/groff/tmac/troffrc Fri Jun 3 11:58:17 2011 (r222647) +++ head/contrib/groff/tmac/troffrc Fri Jun 3 12:02:53 2011 (r222648) @@ -50,12 +50,4 @@ troffrc!X100 troffrc!X100-12 troffrc!lj4 .\" Handle paper formats .do mso papersize.tmac . -.\" Disable SGR support in grotty(1). -.if n \{\ -. do nop \X'tty: sgr 0' -. sp -1 -. nr nl 0-1 -. nr % -1 -.\} -. .\" Don't let blank lines creep in here. From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 13:44:37 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A32C21065672; Fri, 3 Jun 2011 13:44:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 773D98FC16; Fri, 3 Jun 2011 13:44:37 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 16E2D46B1A; Fri, 3 Jun 2011 09:44:37 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A8E558A027; Fri, 3 Jun 2011 09:44:36 -0400 (EDT) From: John Baldwin To: Mikolaj Golub , Bjoern Zeeb , Lawrence Stewart , Mike Silbersack Date: Fri, 3 Jun 2011 09:44:36 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <201105022105.p42L5q3j054498@svn.freebsd.org> <4DCE93BF.7000803@FreeBSD.org> <86boz5fby1.fsf@kopusha.home.net> In-Reply-To: <86boz5fby1.fsf@kopusha.home.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106030944.36200.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 03 Jun 2011 09:44:36 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221346 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 13:44:37 -0000 On Saturday, May 14, 2011 1:07:18 pm Mikolaj Golub wrote: > > On Sat, 14 May 2011 10:37:51 -0400 John Baldwin wrote: > > JB> Can you capture a tcpdump (probably easiest to do from the other host)? > > I replaced the asserts with log statements to make the host not panic and the > captured dump survive. Please try this change. What is happening is that you have a remaining window that is smaller than the window scale. You are receiving zero window updates that are received ok (becuase the socket buffer isn't completely empty), and that advance rcv_nxt. However, tcp_output() is not advancing rcv_adv because 'recwin' is calculated as zero. My invariants had assumed that the ACK that gets forced out for a reply to a zero window probe would move rcv_adv, but that isn't happening. This patch will allow rcv_adv to advance when a zero window probe is ACK'd. I'm not sure if this is the best way to fix this, but I think it will fix it: Index: tcp_output.c =================================================================== --- tcp_output.c (revision 222565) +++ tcp_output.c (working copy) @@ -1331,7 +1331,7 @@ out: * then remember the size of the advertised window. * Any pending ACK has now been sent. */ - if (recwin > 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv)) + if (recwin >= 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv)) tp->rcv_adv = tp->rcv_nxt + recwin; tp->last_ack_sent = tp->rcv_nxt; tp->t_flags &= ~(TF_ACKNOW | TF_DELACK); -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 13:45:11 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC693106566C; Fri, 3 Jun 2011 13:45:11 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B17858FC16; Fri, 3 Jun 2011 13:45:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p53DjB31066353; Fri, 3 Jun 2011 13:45:11 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53DjBWc066350; Fri, 3 Jun 2011 13:45:11 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201106031345.p53DjBWc066350@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 3 Jun 2011 13:45:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222650 - head/usr.bin/man X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 13:45:12 -0000 Author: ru Date: Fri Jun 3 13:45:11 2011 New Revision: 222650 URL: http://svn.freebsd.org/changeset/base/222650 Log: Don't use col(1) since grotty(1) never outputs reverse line feeds, and because col(1) mangles ANSI color escapes if enabled. Spaces to tabs compression is now done by passing -h to grotty(1). Discussed with: uqs Modified: head/usr.bin/man/man.conf.5 head/usr.bin/man/man.sh Modified: head/usr.bin/man/man.conf.5 ============================================================================== --- head/usr.bin/man/man.conf.5 Fri Jun 3 13:12:26 2011 (r222649) +++ head/usr.bin/man/man.conf.5 Fri Jun 3 13:45:11 2011 (r222650) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 1, 2010 +.Dd June 3, 2011 .Os .Dt MAN.CONF 5 .Sh NAME @@ -72,7 +72,6 @@ For pages in a given language, overridin display is supported via the following definitions: .Bl -tag -offset indent -compact .It EQN Ns _ Ns Va LANG -.It COL Ns _ Ns Va LANG .It NROFF Ns _ Ns Va LANG .It PIC Ns _ Ns Va LANG .It TBL Ns _ Ns Va LANG Modified: head/usr.bin/man/man.sh ============================================================================== --- head/usr.bin/man/man.sh Fri Jun 3 13:12:26 2011 (r222649) +++ head/usr.bin/man/man.sh Fri Jun 3 13:45:11 2011 (r222650) @@ -279,7 +279,7 @@ man_check_for_so() { # Usage: man_display_page # Display either the manpage or catpage depending on the use_cat variable man_display_page() { - local EQN COL NROFF PIC TBL TROFF REFER VGRIND + local EQN NROFF PIC TBL TROFF REFER VGRIND local IFS l nroff_dev pipeline preproc_arg tool # We are called with IFS set to colon. This causes really weird @@ -347,7 +347,7 @@ man_display_page() { # Allow language specific calls to override the default # set of utilities. l=$(echo $man_lang | tr [:lower:] [:upper:]) - for tool in EQN COL NROFF PIC TBL TROFF REFER VGRIND; do + for tool in EQN NROFF PIC TBL TROFF REFER VGRIND; do eval "$tool=\${${tool}_$l:-\$$tool}" done ;; @@ -368,7 +368,7 @@ man_display_page() { g) ;; # Ignore for compatability. p) pipeline="$pipeline | $PIC" ;; r) pipeline="$pipeline | $REFER" ;; - t) pipeline="$pipeline | $TBL"; use_col=yes ;; + t) pipeline="$pipeline | $TBL" ;; v) pipeline="$pipeline | $VGRIND" ;; *) usage ;; esac @@ -377,19 +377,12 @@ man_display_page() { pipeline="${pipeline#" | "}" else pipeline="$TBL" - use_col=yes fi if [ -n "$tflag" ]; then pipeline="$pipeline | $TROFF" else - pipeline="$pipeline | $NROFF" - - if [ -n "$use_col" ]; then - pipeline="$pipeline | $COL" - fi - - pipeline="$pipeline | $PAGER" + pipeline="$pipeline | $NROFF | $PAGER" fi if [ $debug -gt 0 ]; then @@ -928,14 +921,13 @@ do_whatis() { # User's PATH setting decides on the groff-suite to pick up. EQN=eqn -NROFF='groff -S -P-c -Wall -mtty-char -man' +NROFF='groff -S -P-ch -Wall -mtty-char -man' PIC=pic REFER=refer TBL=tbl TROFF='groff -S -man' VGRIND=vgrind -COL=/usr/bin/col LOCALE=/usr/bin/locale STTY=/bin/stty SYSCTL=/sbin/sysctl From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 13:47:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CECD1065672; Fri, 3 Jun 2011 13:47:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 535348FC0C; Fri, 3 Jun 2011 13:47:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p53Dl5K9066451; Fri, 3 Jun 2011 13:47:05 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53Dl5TJ066449; Fri, 3 Jun 2011 13:47:05 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201106031347.p53Dl5TJ066449@svn.freebsd.org> From: John Baldwin Date: Fri, 3 Jun 2011 13:47:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222651 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 13:47:05 -0000 Author: jhb Date: Fri Jun 3 13:47:05 2011 New Revision: 222651 URL: http://svn.freebsd.org/changeset/base/222651 Log: Properly return an ENOBUFS error if a write to a tun(4) device fails due to m_uiotombuf() failing. While here, trim unneeded error handling related to tuninit() since it can never fail. Submitted by: Martin Birgmeier la5lbtyi aon at Reviewed by: glebius MFC after: 1 week Modified: head/sys/net/if_tun.c Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Fri Jun 3 13:45:11 2011 (r222650) +++ head/sys/net/if_tun.c Fri Jun 3 13:47:05 2011 (r222651) @@ -126,7 +126,7 @@ static void tunclone(void *arg, struct u int namelen, struct cdev **dev); static void tuncreate(const char *name, struct cdev *dev); static int tunifioctl(struct ifnet *, u_long, caddr_t); -static int tuninit(struct ifnet *); +static void tuninit(struct ifnet *); static int tunmodevent(module_t, int, void *); static int tunoutput(struct ifnet *, struct mbuf *, struct sockaddr *, struct route *ro); @@ -494,14 +494,13 @@ tunclose(struct cdev *dev, int foo, int return (0); } -static int +static void tuninit(struct ifnet *ifp) { struct tun_softc *tp = ifp->if_softc; #ifdef INET struct ifaddr *ifa; #endif - int error = 0; TUNDEBUG(ifp, "tuninit\n"); @@ -528,7 +527,6 @@ tuninit(struct ifnet *ifp) if_addr_runlock(ifp); #endif mtx_unlock(&tp->tun_mtx); - return (error); } /* @@ -552,12 +550,12 @@ tunifioctl(struct ifnet *ifp, u_long cmd mtx_unlock(&tp->tun_mtx); break; case SIOCSIFADDR: - error = tuninit(ifp); - TUNDEBUG(ifp, "address set, error=%d\n", error); + tuninit(ifp); + TUNDEBUG(ifp, "address set\n"); break; case SIOCSIFDSTADDR: - error = tuninit(ifp); - TUNDEBUG(ifp, "destination address set, error=%d\n", error); + tuninit(ifp); + TUNDEBUG(ifp, "destination address set\n"); break; case SIOCSIFMTU: ifp->if_mtu = ifr->ifr_mtu; @@ -857,7 +855,6 @@ tunwrite(struct cdev *dev, struct uio *u struct tun_softc *tp = dev->si_drv1; struct ifnet *ifp = TUN2IFP(tp); struct mbuf *m; - int error = 0; uint32_t family; int isr; @@ -877,7 +874,7 @@ tunwrite(struct cdev *dev, struct uio *u if ((m = m_uiotombuf(uio, M_DONTWAIT, 0, 0, M_PKTHDR)) == NULL) { ifp->if_ierrors++; - return (error); + return (ENOBUFS); } m->m_pkthdr.rcvif = ifp; From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 13:49:18 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CE6B106564A; Fri, 3 Jun 2011 13:49:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CCC68FC1B; Fri, 3 Jun 2011 13:49:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p53DnI3X066552; Fri, 3 Jun 2011 13:49:18 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53DnI8M066550; Fri, 3 Jun 2011 13:49:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106031349.p53DnI8M066550@svn.freebsd.org> From: Alexander Motin Date: Fri, 3 Jun 2011 13:49:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222652 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 13:49:18 -0000 Author: mav Date: Fri Jun 3 13:49:18 2011 New Revision: 222652 URL: http://svn.freebsd.org/changeset/base/222652 Log: Update disk's stripesize and stripeoffset parameters on provider open. They are media-dependent and may change in run-time, same as sectorsize and/or mediasize. SCSI devices return physical sector size and offset via READ CAPACITY(16) command and so can not report it until media inserted or at least until probe sequence completed. UNMAP support is also reported there. Modified: head/sys/geom/geom_disk.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Fri Jun 3 13:47:05 2011 (r222651) +++ head/sys/geom/geom_disk.c Fri Jun 3 13:49:18 2011 (r222652) @@ -154,6 +154,12 @@ g_disk_access(struct g_provider *pp, int } pp->mediasize = dp->d_mediasize; pp->sectorsize = dp->d_sectorsize; + if (dp->d_flags & DISKFLAG_CANDELETE) + pp->flags |= G_PF_CANDELETE; + else + pp->flags &= ~G_PF_CANDELETE; + pp->stripeoffset = dp->d_stripeoffset; + pp->stripesize = dp->d_stripesize; dp->d_flags |= DISKFLAG_OPEN; if (dp->d_maxsize == 0) { printf("WARNING: Disk drive %s%d has no d_maxsize\n", From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 14:34:39 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CDE31065686; Fri, 3 Jun 2011 14:34:39 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C0EC8FC08; Fri, 3 Jun 2011 14:34:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p53EYdlO067895; Fri, 3 Jun 2011 14:34:39 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53EYd3i067892; Fri, 3 Jun 2011 14:34:39 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201106031434.p53EYd3i067892@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 3 Jun 2011 14:34:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222653 - head/usr.bin/man X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 14:34:39 -0000 Author: ru Date: Fri Jun 3 14:34:38 2011 New Revision: 222653 URL: http://svn.freebsd.org/changeset/base/222653 Log: When MANCOLOR environment variable is set, enable ANSI color escapes in grotty(1). This makes it possible to view colorized manpages in color. When MANPAGER environment variable is set, use it instead of PAGER. Why another environment variable, one might ask? With color output enabled, both a terminal and a pager should support the ANSI color escapes. On a supporting terminal, less(1) with option -R would be such a pager, while "more -s" (the current default pager for man(1)) will show garbage. It means a different default pager is needed when color output is enabled, but many people have PAGER set customary, and it's unlikely to support ANSI color escapes, so introducing yet another variable (MANPAGER) seemed like a good option to me: - if MANPAGER is set, use that unconditionally; - if you disable color support (it is by default), and don't set MANPAGER, you get an old behavior: -P pager, $PAGER, "more -s", in that order; - if you enable color support (by setting MANCOLOR), and don't set MANPAGER, we ignore PAGER which is unlikely to support ANSI color escapes, and you get: -P pager, "less -Rs", in that order; - you might have good reasons for different man(1) and general purpose pagers; - later versions of GNU man(1) support MANPAGER. Modified: head/usr.bin/man/man.1 head/usr.bin/man/man.sh Modified: head/usr.bin/man/man.1 ============================================================================== --- head/usr.bin/man/man.1 Fri Jun 3 13:49:18 2011 (r222652) +++ head/usr.bin/man/man.1 Fri Jun 3 14:34:38 2011 (r222653) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 2011 +.Dd June 3, 2011 .Dt MAN 1 .Os .Sh NAME @@ -73,8 +73,12 @@ environment variable. .It Fl P Ar pager Use specified pager. Defaults to +.Ic "less -sR" +if color support is enabled, or .Ic "more -s" . Overrides the +.Ev MANPAGER +environment variable, which in turn overrides the .Ev PAGER environment variable. .It Fl S Ar mansect @@ -289,9 +293,19 @@ Otherwise, if set to a special value .Dq Li tty , and output is to a terminal, the pages may be displayed over the whole width of the screen. -.It Ev PAGER +.It Ev MANCOLOR +If set, enables color support. +.It Ev MANPAGER Program used to display files. -If unset, +.Pp +If unset, and color support is enabled, +.Ic "less -sR" +is used. +.Pp +If unset, and color support is disabled, then +.Ev PAGER +is used. +If that has no value either, .Ic "more -s" is used. .El Modified: head/usr.bin/man/man.sh ============================================================================== --- head/usr.bin/man/man.sh Fri Jun 3 13:49:18 2011 (r222652) +++ head/usr.bin/man/man.sh Fri Jun 3 14:34:38 2011 (r222653) @@ -294,10 +294,10 @@ man_display_page() { ret=0 else if [ $debug -gt 0 ]; then - decho "Command: $cattool $catpage | $PAGER" + decho "Command: $cattool $catpage | $MANPAGER" ret=0 else - eval "$cattool $catpage | $PAGER" + eval "$cattool $catpage | $MANPAGER" ret=$? fi fi @@ -356,6 +356,10 @@ man_display_page() { ;; esac + if [ -z "$MANCOLOR" ]; then + NROFF="$NROFF -P-c" + fi + if [ -n "${use_width}" ]; then NROFF="$NROFF -rLL=${use_width}n -rLT=${use_width}n" fi @@ -382,7 +386,7 @@ man_display_page() { if [ -n "$tflag" ]; then pipeline="$pipeline | $TROFF" else - pipeline="$pipeline | $NROFF | $PAGER" + pipeline="$pipeline | $NROFF | $MANPAGER" fi if [ $debug -gt 0 ]; then @@ -484,7 +488,7 @@ man_parse_args() { while getopts 'M:P:S:adfhkm:op:tw' cmd_arg; do case "${cmd_arg}" in M) MANPATH=$OPTARG ;; - P) PAGER=$OPTARG ;; + P) MANPAGER=$OPTARG ;; S) MANSECT=$OPTARG ;; a) aflag=aflag ;; d) debug=$(( $debug + 1 )) ;; @@ -808,7 +812,7 @@ search_whatis() { bad=${bad#\\n} if [ -n "$good" ]; then - echo -e "$good" | $PAGER + echo -e "$good" | $MANPAGER fi if [ -n "$bad" ]; then @@ -832,13 +836,21 @@ setup_cattool() { } # Usage: setup_pager -# Correctly sets $PAGER +# Correctly sets $MANPAGER setup_pager() { # Setup pager. - if [ -z "$PAGER" ]; then - PAGER="more -s" + if [ -z "$MANPAGER" ]; then + if [ -n "$MANCOLOR" ]; then + MANPAGER="less -sR" + else + if [ -n "$PAGER" ]; then + MANPAGER="$PAGER" + else + MANPAGER="more -s" + fi + fi fi - decho "Using pager: $PAGER" + decho "Using pager: $MANPAGER" } # Usage: trim string @@ -921,7 +933,7 @@ do_whatis() { # User's PATH setting decides on the groff-suite to pick up. EQN=eqn -NROFF='groff -S -P-ch -Wall -mtty-char -man' +NROFF='groff -S -P-h -Wall -mtty-char -man' PIC=pic REFER=refer TBL=tbl From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 14:57:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCE7C106568B; Fri, 3 Jun 2011 14:57:38 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC5CF8FC15; Fri, 3 Jun 2011 14:57:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p53EvcwX068631; Fri, 3 Jun 2011 14:57:38 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53Evc7P068629; Fri, 3 Jun 2011 14:57:38 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <201106031457.p53Evc7P068629@svn.freebsd.org> From: "Christian S.J. Peron" Date: Fri, 3 Jun 2011 14:57:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222654 - head/contrib/libpcap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 14:57:39 -0000 Author: csjp Date: Fri Jun 3 14:57:38 2011 New Revision: 222654 URL: http://svn.freebsd.org/changeset/base/222654 Log: Explicitly initialize the packet buffer to NULL after we unmap the zero copy buffers. This fixes a segfault on exit due to calling free on a bogus pointer. This should be considered a temporary stop gap fix to avoid the crash. The complete fix re-shuffles the initializations of some of the clean-up pointers. The details of the fix can be found in the libpcap git repository: commit bc8209b71e928870b0f172d43b174ab27ba24394 Proded by: kevlo, rpaulo MFC after: 2 weeks Submitted by: Anton Yuzhaninov Modified: head/contrib/libpcap/pcap-bpf.c Modified: head/contrib/libpcap/pcap-bpf.c ============================================================================== --- head/contrib/libpcap/pcap-bpf.c Fri Jun 3 14:34:38 2011 (r222653) +++ head/contrib/libpcap/pcap-bpf.c Fri Jun 3 14:57:38 2011 (r222654) @@ -1281,6 +1281,7 @@ pcap_cleanup_bpf(pcap_t *p) munmap(p->md.zbuf1, p->md.zbufsize); if (p->md.zbuf2 != MAP_FAILED && p->md.zbuf2 != NULL) munmap(p->md.zbuf2, p->md.zbufsize); + p->buffer = NULL; } #endif if (p->md.device != NULL) { From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 17:49:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0889106564A; Fri, 3 Jun 2011 17:49:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABB388FC0C; Fri, 3 Jun 2011 17:49:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p53HnHSB073882; Fri, 3 Jun 2011 17:49:17 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53HnHkj073838; Fri, 3 Jun 2011 17:49:17 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201106031749.p53HnHkj073838@svn.freebsd.org> From: Ed Schouten Date: Fri, 3 Jun 2011 17:49:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222656 - in head: contrib/compiler-rt contrib/compiler-rt/lib contrib/compiler-rt/lib/arm contrib/compiler-rt/lib/i386 contrib/compiler-rt/lib/ppc contrib/compiler-rt/lib/x86_64 lib/li... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 17:49:17 -0000 Author: ed Date: Fri Jun 3 17:49:16 2011 New Revision: 222656 URL: http://svn.freebsd.org/changeset/base/222656 Log: Upgrade libcompiler_rt from revision 117047 to 132478. It seems there have only been a small amount to the compiler-rt source code in the mean time. I'd rather have the code in sync as much as possible by the time we release 9.0. Changes: - The libcompiler_rt library is now dual licensed under both the University of Illinois "BSD-Like" license and the MIT license. - Our local modifications for using .hidden instead of .private_extern have been upstreamed, meaning our changes to lib/assembly.h can now be reverted. - A possible endless recursion in __modsi3() has been fixed. - Support for ARM EABI has been added, but it has no effect on FreeBSD (yet). - The functions __udivmodsi4 and __divmodsi4 have been added. Requested by: many, including bf@ and Pedro Giffuni Added: head/contrib/compiler-rt/lib/abi.h - copied unchanged from r222625, vendor/compiler-rt/dist/lib/abi.h head/contrib/compiler-rt/lib/arm/divmodsi4.S - copied unchanged from r222625, vendor/compiler-rt/dist/lib/arm/divmodsi4.S head/contrib/compiler-rt/lib/arm/divsi3.S - copied unchanged from r222625, vendor/compiler-rt/dist/lib/arm/divsi3.S head/contrib/compiler-rt/lib/arm/softfloat-alias.list - copied unchanged from r222625, vendor/compiler-rt/dist/lib/arm/softfloat-alias.list head/contrib/compiler-rt/lib/arm/udivmodsi4.S - copied unchanged from r222625, vendor/compiler-rt/dist/lib/arm/udivmodsi4.S head/contrib/compiler-rt/lib/arm/udivsi3.S - copied unchanged from r222625, vendor/compiler-rt/dist/lib/arm/udivsi3.S head/contrib/compiler-rt/lib/arm/umodsi3.S - copied unchanged from r222625, vendor/compiler-rt/dist/lib/arm/umodsi3.S head/contrib/compiler-rt/lib/divmoddi4.c - copied unchanged from r222625, vendor/compiler-rt/dist/lib/divmoddi4.c head/contrib/compiler-rt/lib/divmodsi4.c - copied unchanged from r222625, vendor/compiler-rt/dist/lib/divmodsi4.c head/contrib/compiler-rt/lib/subdf3.c - copied unchanged from r222625, vendor/compiler-rt/dist/lib/subdf3.c head/contrib/compiler-rt/lib/subsf3.c - copied unchanged from r222625, vendor/compiler-rt/dist/lib/subsf3.c head/contrib/compiler-rt/lib/udivmodsi4.c - copied unchanged from r222625, vendor/compiler-rt/dist/lib/udivmodsi4.c Modified: head/contrib/compiler-rt/CREDITS.TXT head/contrib/compiler-rt/LICENSE.TXT head/contrib/compiler-rt/README.txt head/contrib/compiler-rt/lib/absvdi2.c head/contrib/compiler-rt/lib/absvsi2.c head/contrib/compiler-rt/lib/absvti2.c head/contrib/compiler-rt/lib/adddf3.c head/contrib/compiler-rt/lib/addsf3.c head/contrib/compiler-rt/lib/addvdi3.c head/contrib/compiler-rt/lib/addvsi3.c head/contrib/compiler-rt/lib/addvti3.c head/contrib/compiler-rt/lib/apple_versioning.c head/contrib/compiler-rt/lib/arm/adddf3vfp.S head/contrib/compiler-rt/lib/arm/addsf3vfp.S head/contrib/compiler-rt/lib/arm/bswapdi2.S head/contrib/compiler-rt/lib/arm/bswapsi2.S head/contrib/compiler-rt/lib/arm/comparesf2.S head/contrib/compiler-rt/lib/arm/divdf3vfp.S head/contrib/compiler-rt/lib/arm/divsf3vfp.S head/contrib/compiler-rt/lib/arm/eqdf2vfp.S head/contrib/compiler-rt/lib/arm/eqsf2vfp.S head/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S head/contrib/compiler-rt/lib/arm/fixdfsivfp.S head/contrib/compiler-rt/lib/arm/fixsfsivfp.S head/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S head/contrib/compiler-rt/lib/arm/fixunssfsivfp.S head/contrib/compiler-rt/lib/arm/floatsidfvfp.S head/contrib/compiler-rt/lib/arm/floatsisfvfp.S head/contrib/compiler-rt/lib/arm/floatunssidfvfp.S head/contrib/compiler-rt/lib/arm/floatunssisfvfp.S head/contrib/compiler-rt/lib/arm/gedf2vfp.S head/contrib/compiler-rt/lib/arm/gesf2vfp.S head/contrib/compiler-rt/lib/arm/gtdf2vfp.S head/contrib/compiler-rt/lib/arm/gtsf2vfp.S head/contrib/compiler-rt/lib/arm/ledf2vfp.S head/contrib/compiler-rt/lib/arm/lesf2vfp.S head/contrib/compiler-rt/lib/arm/ltdf2vfp.S head/contrib/compiler-rt/lib/arm/ltsf2vfp.S head/contrib/compiler-rt/lib/arm/modsi3.S head/contrib/compiler-rt/lib/arm/muldf3vfp.S head/contrib/compiler-rt/lib/arm/mulsf3vfp.S head/contrib/compiler-rt/lib/arm/nedf2vfp.S head/contrib/compiler-rt/lib/arm/negdf2vfp.S head/contrib/compiler-rt/lib/arm/negsf2vfp.S head/contrib/compiler-rt/lib/arm/nesf2vfp.S head/contrib/compiler-rt/lib/arm/restore_vfp_d8_d15_regs.S head/contrib/compiler-rt/lib/arm/save_vfp_d8_d15_regs.S head/contrib/compiler-rt/lib/arm/subdf3vfp.S head/contrib/compiler-rt/lib/arm/subsf3vfp.S head/contrib/compiler-rt/lib/arm/switch16.S head/contrib/compiler-rt/lib/arm/switch32.S head/contrib/compiler-rt/lib/arm/switch8.S head/contrib/compiler-rt/lib/arm/switchu8.S head/contrib/compiler-rt/lib/arm/sync_synchronize.S head/contrib/compiler-rt/lib/arm/truncdfsf2vfp.S head/contrib/compiler-rt/lib/arm/unorddf2vfp.S head/contrib/compiler-rt/lib/arm/unordsf2vfp.S head/contrib/compiler-rt/lib/ashldi3.c head/contrib/compiler-rt/lib/ashlti3.c head/contrib/compiler-rt/lib/ashrdi3.c head/contrib/compiler-rt/lib/ashrti3.c head/contrib/compiler-rt/lib/assembly.h head/contrib/compiler-rt/lib/clear_cache.c head/contrib/compiler-rt/lib/clzdi2.c head/contrib/compiler-rt/lib/clzsi2.c head/contrib/compiler-rt/lib/clzti2.c head/contrib/compiler-rt/lib/cmpdi2.c head/contrib/compiler-rt/lib/cmpti2.c head/contrib/compiler-rt/lib/comparedf2.c head/contrib/compiler-rt/lib/comparesf2.c head/contrib/compiler-rt/lib/ctzdi2.c head/contrib/compiler-rt/lib/ctzsi2.c head/contrib/compiler-rt/lib/ctzti2.c head/contrib/compiler-rt/lib/divdc3.c head/contrib/compiler-rt/lib/divdf3.c head/contrib/compiler-rt/lib/divdi3.c head/contrib/compiler-rt/lib/divsc3.c head/contrib/compiler-rt/lib/divsf3.c head/contrib/compiler-rt/lib/divsi3.c head/contrib/compiler-rt/lib/divti3.c head/contrib/compiler-rt/lib/divxc3.c head/contrib/compiler-rt/lib/enable_execute_stack.c head/contrib/compiler-rt/lib/endianness.h head/contrib/compiler-rt/lib/eprintf.c head/contrib/compiler-rt/lib/extendsfdf2.c head/contrib/compiler-rt/lib/ffsdi2.c head/contrib/compiler-rt/lib/ffsti2.c head/contrib/compiler-rt/lib/fixdfdi.c head/contrib/compiler-rt/lib/fixdfsi.c head/contrib/compiler-rt/lib/fixdfti.c head/contrib/compiler-rt/lib/fixsfdi.c head/contrib/compiler-rt/lib/fixsfsi.c head/contrib/compiler-rt/lib/fixsfti.c head/contrib/compiler-rt/lib/fixunsdfdi.c head/contrib/compiler-rt/lib/fixunsdfsi.c head/contrib/compiler-rt/lib/fixunsdfti.c head/contrib/compiler-rt/lib/fixunssfdi.c head/contrib/compiler-rt/lib/fixunssfsi.c head/contrib/compiler-rt/lib/fixunssfti.c head/contrib/compiler-rt/lib/fixunsxfdi.c head/contrib/compiler-rt/lib/fixunsxfsi.c head/contrib/compiler-rt/lib/fixunsxfti.c head/contrib/compiler-rt/lib/fixxfdi.c head/contrib/compiler-rt/lib/fixxfti.c head/contrib/compiler-rt/lib/floatdidf.c head/contrib/compiler-rt/lib/floatdisf.c head/contrib/compiler-rt/lib/floatdixf.c head/contrib/compiler-rt/lib/floatsidf.c head/contrib/compiler-rt/lib/floatsisf.c head/contrib/compiler-rt/lib/floattidf.c head/contrib/compiler-rt/lib/floattisf.c head/contrib/compiler-rt/lib/floattixf.c head/contrib/compiler-rt/lib/floatundidf.c head/contrib/compiler-rt/lib/floatundisf.c head/contrib/compiler-rt/lib/floatundixf.c head/contrib/compiler-rt/lib/floatunsidf.c head/contrib/compiler-rt/lib/floatunsisf.c head/contrib/compiler-rt/lib/floatuntidf.c head/contrib/compiler-rt/lib/floatuntisf.c head/contrib/compiler-rt/lib/floatuntixf.c head/contrib/compiler-rt/lib/fp_lib.h head/contrib/compiler-rt/lib/gcc_personality_v0.c head/contrib/compiler-rt/lib/i386/ashldi3.S head/contrib/compiler-rt/lib/i386/ashrdi3.S head/contrib/compiler-rt/lib/i386/divdi3.S head/contrib/compiler-rt/lib/i386/floatdidf.S head/contrib/compiler-rt/lib/i386/floatdisf.S head/contrib/compiler-rt/lib/i386/floatdixf.S head/contrib/compiler-rt/lib/i386/floatundidf.S head/contrib/compiler-rt/lib/i386/floatundisf.S head/contrib/compiler-rt/lib/i386/floatundixf.S head/contrib/compiler-rt/lib/i386/lshrdi3.S head/contrib/compiler-rt/lib/i386/moddi3.S head/contrib/compiler-rt/lib/i386/muldi3.S head/contrib/compiler-rt/lib/i386/udivdi3.S head/contrib/compiler-rt/lib/i386/umoddi3.S head/contrib/compiler-rt/lib/int_lib.h head/contrib/compiler-rt/lib/lshrdi3.c head/contrib/compiler-rt/lib/lshrti3.c head/contrib/compiler-rt/lib/moddi3.c head/contrib/compiler-rt/lib/modsi3.c head/contrib/compiler-rt/lib/modti3.c head/contrib/compiler-rt/lib/muldc3.c head/contrib/compiler-rt/lib/muldf3.c head/contrib/compiler-rt/lib/muldi3.c head/contrib/compiler-rt/lib/mulsc3.c head/contrib/compiler-rt/lib/mulsf3.c head/contrib/compiler-rt/lib/multi3.c head/contrib/compiler-rt/lib/mulvdi3.c head/contrib/compiler-rt/lib/mulvsi3.c head/contrib/compiler-rt/lib/mulvti3.c head/contrib/compiler-rt/lib/mulxc3.c head/contrib/compiler-rt/lib/negdf2.c head/contrib/compiler-rt/lib/negdi2.c head/contrib/compiler-rt/lib/negsf2.c head/contrib/compiler-rt/lib/negti2.c head/contrib/compiler-rt/lib/negvdi2.c head/contrib/compiler-rt/lib/negvsi2.c head/contrib/compiler-rt/lib/negvti2.c head/contrib/compiler-rt/lib/paritydi2.c head/contrib/compiler-rt/lib/paritysi2.c head/contrib/compiler-rt/lib/parityti2.c head/contrib/compiler-rt/lib/popcountdi2.c head/contrib/compiler-rt/lib/popcountsi2.c head/contrib/compiler-rt/lib/popcountti2.c head/contrib/compiler-rt/lib/powidf2.c head/contrib/compiler-rt/lib/powisf2.c head/contrib/compiler-rt/lib/powitf2.c head/contrib/compiler-rt/lib/powixf2.c head/contrib/compiler-rt/lib/ppc/restFP.S head/contrib/compiler-rt/lib/ppc/saveFP.S head/contrib/compiler-rt/lib/subvdi3.c head/contrib/compiler-rt/lib/subvsi3.c head/contrib/compiler-rt/lib/subvti3.c head/contrib/compiler-rt/lib/trampoline_setup.c head/contrib/compiler-rt/lib/truncdfsf2.c head/contrib/compiler-rt/lib/ucmpdi2.c head/contrib/compiler-rt/lib/ucmpti2.c head/contrib/compiler-rt/lib/udivdi3.c head/contrib/compiler-rt/lib/udivmoddi4.c head/contrib/compiler-rt/lib/udivmodti4.c head/contrib/compiler-rt/lib/udivsi3.c head/contrib/compiler-rt/lib/udivti3.c head/contrib/compiler-rt/lib/umoddi3.c head/contrib/compiler-rt/lib/umodsi3.c head/contrib/compiler-rt/lib/umodti3.c head/contrib/compiler-rt/lib/x86_64/floatundidf.S head/contrib/compiler-rt/lib/x86_64/floatundisf.S head/contrib/compiler-rt/lib/x86_64/floatundixf.S head/lib/libcompiler_rt/Makefile Directory Properties: head/contrib/compiler-rt/ (props changed) Modified: head/contrib/compiler-rt/CREDITS.TXT ============================================================================== --- head/contrib/compiler-rt/CREDITS.TXT Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/CREDITS.TXT Fri Jun 3 17:49:16 2011 (r222656) @@ -19,3 +19,6 @@ W: http://www.auroraux.org D: CMake'ify Compiler-RT build system D: Maintain Solaris & AuroraUX ports of Compiler-RT +N: Howard Hinnant +E: hhinnant@apple.com +D: Architect and primary author of compiler-rt Modified: head/contrib/compiler-rt/LICENSE.TXT ============================================================================== --- head/contrib/compiler-rt/LICENSE.TXT Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/LICENSE.TXT Fri Jun 3 17:49:16 2011 (r222656) @@ -1,10 +1,21 @@ ============================================================================== -LLVM Release License +compiler_rt License ============================================================================== + +The compiler_rt library is dual licensed under both the University of Illinois +"BSD-Like" license and the MIT license. As a user of this code you may choose +to use it under either license. As a contributor, you agree to allow your code +to be used under both. + +Full text of the relevant licenses is included below. + +============================================================================== + University of Illinois/NCSA Open Source License -Copyright (c) 2003-2009 University of Illinois at Urbana-Champaign. +Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT + All rights reserved. Developed by: @@ -43,21 +54,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWAR SOFTWARE. ============================================================================== -Copyrights and Licenses for Third Party Software Distributed with LLVM: -============================================================================== -The LLVM software contains code written by third parties. Such software will -have its own individual LICENSE.TXT file in the directory in which it appears. -This file will describe the copyrights, license, and restrictions which apply -to that code. - -The disclaimer of warranty in the University of Illinois Open Source License -applies to all code in the LLVM Distribution, and nothing in any of the -other licenses gives permission to use the names of the LLVM Team or the -University of Illinois to endorse or promote products derived from this -Software. -The following pieces of software have additional or alternate copyrights, -licenses, and/or restrictions: +Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. -Program Directory -------- --------- +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. Modified: head/contrib/compiler-rt/README.txt ============================================================================== --- head/contrib/compiler-rt/README.txt Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/README.txt Fri Jun 3 17:49:16 2011 (r222656) @@ -77,8 +77,12 @@ ti_int __modti3 (ti_int a, ti_int b); su_int __umodsi3 (su_int a, su_int b); // a % b unsigned du_int __umoddi3 (du_int a, du_int b); // a % b unsigned tu_int __umodti3 (tu_int a, tu_int b); // a % b unsigned -du_int __udivmoddi4(du_int a, du_int b, du_int* rem); // a / b, *rem = a % b -tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem); // a / b, *rem = a % b +du_int __udivmoddi4(du_int a, du_int b, du_int* rem); // a / b, *rem = a % b unsigned +tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem); // a / b, *rem = a % b unsigned +su_int __udivmodsi4(su_int a, su_int b, su_int* rem); // a / b, *rem = a % b unsigned +si_int __divmodsi4(si_int a, si_int b, si_int* rem); // a / b, *rem = a % b signed + + // Integral arithmetic with trapping overflow Copied: head/contrib/compiler-rt/lib/abi.h (from r222625, vendor/compiler-rt/dist/lib/abi.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/abi.h Fri Jun 3 17:49:16 2011 (r222656, copy of r222625, vendor/compiler-rt/dist/lib/abi.h) @@ -0,0 +1,23 @@ +/* ===------ abi.h - configuration header for compiler-rt -----------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file is a configuration header for compiler-rt. + * This file is not part of the interface of this library. + * + * ===----------------------------------------------------------------------=== + */ + +#if __ARM_EABI__ +# define ARM_EABI_FNALIAS(aeabi_name, name) \ + void __aeabi_##aeabi_name() __attribute__((alias("__" #name))); +# define COMPILER_RT_ABI __attribute__((pcs("aapcs"))) +#else +# define ARM_EABI_FNALIAS(aeabi_name, name) +# define COMPILER_RT_ABI +#endif Modified: head/contrib/compiler-rt/lib/absvdi2.c ============================================================================== --- head/contrib/compiler-rt/lib/absvdi2.c Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/absvdi2.c Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ * * The LLVM Compiler Infrastructure * - * This file is distributed under the University of Illinois Open Source - * License. See LICENSE.TXT for details. + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. * *===----------------------------------------------------------------------=== * @@ -11,6 +11,7 @@ * *===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if abs(x) < 0 */ -di_int +COMPILER_RT_ABI di_int __absvdi2(di_int a) { const int N = (int)(sizeof(di_int) * CHAR_BIT); Modified: head/contrib/compiler-rt/lib/absvsi2.c ============================================================================== --- head/contrib/compiler-rt/lib/absvsi2.c Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/absvsi2.c Fri Jun 3 17:49:16 2011 (r222656) @@ -2,15 +2,16 @@ * * The LLVM Compiler Infrastructure * - * This file is distributed under the University of Illinois Open Source - * License. See LICENSE.TXT for details. + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. * * ===----------------------------------------------------------------------=== * * This file implements __absvsi2 for the compiler_rt library. * * ===----------------------------------------------------------------------=== - */ + */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if abs(x) < 0 */ -si_int +COMPILER_RT_ABI si_int __absvsi2(si_int a) { const int N = (int)(sizeof(si_int) * CHAR_BIT); Modified: head/contrib/compiler-rt/lib/absvti2.c ============================================================================== --- head/contrib/compiler-rt/lib/absvti2.c Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/absvti2.c Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ * * The LLVM Compiler Infrastructure * - * This file is distributed under the University of Illinois Open Source - * License. See LICENSE.TXT for details. + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. * * ===----------------------------------------------------------------------=== * Modified: head/contrib/compiler-rt/lib/adddf3.c ============================================================================== --- head/contrib/compiler-rt/lib/adddf3.c Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/adddf3.c Fri Jun 3 17:49:16 2011 (r222656) @@ -1,21 +1,26 @@ -//===-- lib/adddf3.c - Double-precision addition and subtraction --*- C -*-===// +//===-- lib/adddf3.c - Double-precision addition ------------------*- C -*-===// // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // -// This file implements double-precision soft-float addition and subtraction -// with the IEEE-754 default rounding (to nearest, ties to even). +// This file implements double-precision soft-float addition with the IEEE-754 +// default rounding (to nearest, ties to even). // //===----------------------------------------------------------------------===// +#include "abi.h" + #define DOUBLE_PRECISION #include "fp_lib.h" -fp_t __adddf3(fp_t a, fp_t b) { +ARM_EABI_FNALIAS(dadd, adddf3); + +COMPILER_RT_ABI fp_t +__adddf3(fp_t a, fp_t b) { rep_t aRep = toRep(a); rep_t bRep = toRep(b); @@ -147,8 +152,3 @@ fp_t __adddf3(fp_t a, fp_t b) { if (roundGuardSticky == 0x4) result += result & 1; return fromRep(result); } - -// Subtraction; flip the sign bit of b and add. -fp_t __subdf3(fp_t a, fp_t b) { - return __adddf3(a, fromRep(toRep(b) ^ signBit)); -} Modified: head/contrib/compiler-rt/lib/addsf3.c ============================================================================== --- head/contrib/compiler-rt/lib/addsf3.c Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/addsf3.c Fri Jun 3 17:49:16 2011 (r222656) @@ -1,20 +1,24 @@ -//===-- lib/addsf3.c - Single-precision addition and subtraction --*- C -*-===// +//===-- lib/addsf3.c - Single-precision addition ------------------*- C -*-===// // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // -// This file implements single-precision soft-float addition and subtraction -// with the IEEE-754 default rounding (to nearest, ties to even). +// This file implements single-precision soft-float addition with the IEEE-754 +// default rounding (to nearest, ties to even). // //===----------------------------------------------------------------------===// +#include "abi.h" + #define SINGLE_PRECISION #include "fp_lib.h" +ARM_EABI_FNALIAS(fadd, addsf3); + fp_t __addsf3(fp_t a, fp_t b) { rep_t aRep = toRep(a); @@ -147,18 +151,3 @@ fp_t __addsf3(fp_t a, fp_t b) { if (roundGuardSticky == 0x4) result += result & 1; return fromRep(result); } - -// Subtraction; flip the sign bit of b and add. -fp_t __subsf3(fp_t a, fp_t b) { - return __addsf3(a, fromRep(toRep(b) ^ signBit)); -} - - - - - - - - - - Modified: head/contrib/compiler-rt/lib/addvdi3.c ============================================================================== --- head/contrib/compiler-rt/lib/addvdi3.c Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/addvdi3.c Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ * * The LLVM Compiler Infrastructure * - * This file is distributed under the University of Illinois Open Source - * License. See LICENSE.TXT for details. + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. * * ===----------------------------------------------------------------------=== * @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if a + b overflows */ -di_int +COMPILER_RT_ABI di_int __addvdi3(di_int a, di_int b) { di_int s = a + b; Modified: head/contrib/compiler-rt/lib/addvsi3.c ============================================================================== --- head/contrib/compiler-rt/lib/addvsi3.c Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/addvsi3.c Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ * * The LLVM Compiler Infrastructure * - * This file is distributed under the University of Illinois Open Source - * License. See LICENSE.TXT for details. + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. * * ===----------------------------------------------------------------------=== * @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if a + b overflows */ -si_int +COMPILER_RT_ABI si_int __addvsi3(si_int a, si_int b) { si_int s = a + b; Modified: head/contrib/compiler-rt/lib/addvti3.c ============================================================================== --- head/contrib/compiler-rt/lib/addvti3.c Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/addvti3.c Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ * * The LLVM Compiler Infrastructure * - * This file is distributed under the University of Illinois Open Source - * License. See LICENSE.TXT for details. + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. * * ===----------------------------------------------------------------------=== * Modified: head/contrib/compiler-rt/lib/apple_versioning.c ============================================================================== --- head/contrib/compiler-rt/lib/apple_versioning.c Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/apple_versioning.c Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ * * The LLVM Compiler Infrastructure * - * This file is distributed under the University of Illinois Open Source - * License. See LICENSE.TXT for details. + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. * * ===----------------------------------------------------------------------=== */ @@ -143,6 +143,147 @@ NOT_HERE_BEFORE_10_6(__gcc_qsub) NOT_HERE_BEFORE_10_6(__trampoline_setup) #endif /* __ppc__ */ +#if __arm__ && __DYNAMIC__ + #define NOT_HERE_UNTIL_AFTER_4_3(sym) \ + extern const char sym##_tmp1 __asm("$ld$hide$os3.0$_" #sym ); \ + __attribute__((visibility("default"))) const char sym##_tmp1 = 0; \ + extern const char sym##_tmp2 __asm("$ld$hide$os3.1$_" #sym ); \ + __attribute__((visibility("default"))) const char sym##_tmp2 = 0; \ + extern const char sym##_tmp3 __asm("$ld$hide$os3.2$_" #sym ); \ + __attribute__((visibility("default"))) const char sym##_tmp3 = 0; \ + extern const char sym##_tmp4 __asm("$ld$hide$os4.0$_" #sym ); \ + __attribute__((visibility("default"))) const char sym##_tmp4 = 0; \ + extern const char sym##_tmp5 __asm("$ld$hide$os4.1$_" #sym ); \ + __attribute__((visibility("default"))) const char sym##_tmp5 = 0; \ + extern const char sym##_tmp6 __asm("$ld$hide$os4.2$_" #sym ); \ + __attribute__((visibility("default"))) const char sym##_tmp6 = 0; \ + extern const char sym##_tmp7 __asm("$ld$hide$os4.3$_" #sym ); \ + __attribute__((visibility("default"))) const char sym##_tmp7 = 0; + +NOT_HERE_UNTIL_AFTER_4_3(__absvdi2) +NOT_HERE_UNTIL_AFTER_4_3(__absvsi2) +NOT_HERE_UNTIL_AFTER_4_3(__adddf3) +NOT_HERE_UNTIL_AFTER_4_3(__adddf3vfp) +NOT_HERE_UNTIL_AFTER_4_3(__addsf3) +NOT_HERE_UNTIL_AFTER_4_3(__addsf3vfp) +NOT_HERE_UNTIL_AFTER_4_3(__addvdi3) +NOT_HERE_UNTIL_AFTER_4_3(__addvsi3) +NOT_HERE_UNTIL_AFTER_4_3(__ashldi3) +NOT_HERE_UNTIL_AFTER_4_3(__ashrdi3) +NOT_HERE_UNTIL_AFTER_4_3(__bswapdi2) +NOT_HERE_UNTIL_AFTER_4_3(__bswapsi2) +NOT_HERE_UNTIL_AFTER_4_3(__clzdi2) +NOT_HERE_UNTIL_AFTER_4_3(__clzsi2) +NOT_HERE_UNTIL_AFTER_4_3(__cmpdi2) +NOT_HERE_UNTIL_AFTER_4_3(__ctzdi2) +NOT_HERE_UNTIL_AFTER_4_3(__ctzsi2) +NOT_HERE_UNTIL_AFTER_4_3(__divdc3) +NOT_HERE_UNTIL_AFTER_4_3(__divdf3) +NOT_HERE_UNTIL_AFTER_4_3(__divdf3vfp) +NOT_HERE_UNTIL_AFTER_4_3(__divdi3) +NOT_HERE_UNTIL_AFTER_4_3(__divsc3) +NOT_HERE_UNTIL_AFTER_4_3(__divsf3) +NOT_HERE_UNTIL_AFTER_4_3(__divsf3vfp) +NOT_HERE_UNTIL_AFTER_4_3(__divsi3) +NOT_HERE_UNTIL_AFTER_4_3(__eqdf2) +NOT_HERE_UNTIL_AFTER_4_3(__eqdf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__eqsf2) +NOT_HERE_UNTIL_AFTER_4_3(__eqsf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__extendsfdf2) +NOT_HERE_UNTIL_AFTER_4_3(__extendsfdf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__ffsdi2) +NOT_HERE_UNTIL_AFTER_4_3(__fixdfdi) +NOT_HERE_UNTIL_AFTER_4_3(__fixdfsi) +NOT_HERE_UNTIL_AFTER_4_3(__fixdfsivfp) +NOT_HERE_UNTIL_AFTER_4_3(__fixsfdi) +NOT_HERE_UNTIL_AFTER_4_3(__fixsfsi) +NOT_HERE_UNTIL_AFTER_4_3(__fixsfsivfp) +NOT_HERE_UNTIL_AFTER_4_3(__fixunsdfdi) +NOT_HERE_UNTIL_AFTER_4_3(__fixunsdfsi) +NOT_HERE_UNTIL_AFTER_4_3(__fixunsdfsivfp) +NOT_HERE_UNTIL_AFTER_4_3(__fixunssfdi) +NOT_HERE_UNTIL_AFTER_4_3(__fixunssfsi) +NOT_HERE_UNTIL_AFTER_4_3(__fixunssfsivfp) +NOT_HERE_UNTIL_AFTER_4_3(__floatdidf) +NOT_HERE_UNTIL_AFTER_4_3(__floatdisf) +NOT_HERE_UNTIL_AFTER_4_3(__floatsidf) +NOT_HERE_UNTIL_AFTER_4_3(__floatsidfvfp) +NOT_HERE_UNTIL_AFTER_4_3(__floatsisf) +NOT_HERE_UNTIL_AFTER_4_3(__floatsisfvfp) +NOT_HERE_UNTIL_AFTER_4_3(__floatundidf) +NOT_HERE_UNTIL_AFTER_4_3(__floatundisf) +NOT_HERE_UNTIL_AFTER_4_3(__floatunsidf) +NOT_HERE_UNTIL_AFTER_4_3(__floatunsisf) +NOT_HERE_UNTIL_AFTER_4_3(__floatunssidfvfp) +NOT_HERE_UNTIL_AFTER_4_3(__floatunssisfvfp) +NOT_HERE_UNTIL_AFTER_4_3(__gedf2) +NOT_HERE_UNTIL_AFTER_4_3(__gedf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__gesf2) +NOT_HERE_UNTIL_AFTER_4_3(__gesf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__gtdf2) +NOT_HERE_UNTIL_AFTER_4_3(__gtdf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__gtsf2) +NOT_HERE_UNTIL_AFTER_4_3(__gtsf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__ledf2) +NOT_HERE_UNTIL_AFTER_4_3(__ledf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__lesf2) +NOT_HERE_UNTIL_AFTER_4_3(__lesf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__lshrdi3) +NOT_HERE_UNTIL_AFTER_4_3(__ltdf2) +NOT_HERE_UNTIL_AFTER_4_3(__ltdf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__ltsf2) +NOT_HERE_UNTIL_AFTER_4_3(__ltsf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__moddi3) +NOT_HERE_UNTIL_AFTER_4_3(__modsi3) +NOT_HERE_UNTIL_AFTER_4_3(__muldc3) +NOT_HERE_UNTIL_AFTER_4_3(__muldf3) +NOT_HERE_UNTIL_AFTER_4_3(__muldf3vfp) +NOT_HERE_UNTIL_AFTER_4_3(__muldi3) +NOT_HERE_UNTIL_AFTER_4_3(__mulsc3) +NOT_HERE_UNTIL_AFTER_4_3(__mulsf3) +NOT_HERE_UNTIL_AFTER_4_3(__mulsf3vfp) +NOT_HERE_UNTIL_AFTER_4_3(__mulvdi3) +NOT_HERE_UNTIL_AFTER_4_3(__mulvsi3) +NOT_HERE_UNTIL_AFTER_4_3(__nedf2) +NOT_HERE_UNTIL_AFTER_4_3(__nedf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__negdi2) +NOT_HERE_UNTIL_AFTER_4_3(__negvdi2) +NOT_HERE_UNTIL_AFTER_4_3(__negvsi2) +NOT_HERE_UNTIL_AFTER_4_3(__nesf2) +NOT_HERE_UNTIL_AFTER_4_3(__nesf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__paritydi2) +NOT_HERE_UNTIL_AFTER_4_3(__paritysi2) +NOT_HERE_UNTIL_AFTER_4_3(__popcountdi2) +NOT_HERE_UNTIL_AFTER_4_3(__popcountsi2) +NOT_HERE_UNTIL_AFTER_4_3(__powidf2) +NOT_HERE_UNTIL_AFTER_4_3(__powisf2) +NOT_HERE_UNTIL_AFTER_4_3(__subdf3) +NOT_HERE_UNTIL_AFTER_4_3(__subdf3vfp) +NOT_HERE_UNTIL_AFTER_4_3(__subsf3) +NOT_HERE_UNTIL_AFTER_4_3(__subsf3vfp) +NOT_HERE_UNTIL_AFTER_4_3(__subvdi3) +NOT_HERE_UNTIL_AFTER_4_3(__subvsi3) +NOT_HERE_UNTIL_AFTER_4_3(__truncdfsf2) +NOT_HERE_UNTIL_AFTER_4_3(__truncdfsf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__ucmpdi2) +NOT_HERE_UNTIL_AFTER_4_3(__udivdi3) +NOT_HERE_UNTIL_AFTER_4_3(__udivmoddi4) +NOT_HERE_UNTIL_AFTER_4_3(__udivsi3) +NOT_HERE_UNTIL_AFTER_4_3(__umoddi3) +NOT_HERE_UNTIL_AFTER_4_3(__umodsi3) +NOT_HERE_UNTIL_AFTER_4_3(__unorddf2) +NOT_HERE_UNTIL_AFTER_4_3(__unorddf2vfp) +NOT_HERE_UNTIL_AFTER_4_3(__unordsf2) +NOT_HERE_UNTIL_AFTER_4_3(__unordsf2vfp) + +NOT_HERE_UNTIL_AFTER_4_3(__divmodsi4) +NOT_HERE_UNTIL_AFTER_4_3(__udivmodsi4) +#endif // __arm__ && __DYNAMIC__ + + + + + #else /* !__APPLE__ */ extern int avoid_empty_file; Modified: head/contrib/compiler-rt/lib/arm/adddf3vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/adddf3vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/adddf3vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/addsf3vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/addsf3vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/addsf3vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/bswapdi2.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/bswapdi2.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/bswapdi2.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/bswapsi2.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/bswapsi2.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/bswapsi2.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/comparesf2.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/comparesf2.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/comparesf2.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // Modified: head/contrib/compiler-rt/lib/arm/divdf3vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/divdf3vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/divdf3vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Copied: head/contrib/compiler-rt/lib/arm/divmodsi4.S (from r222625, vendor/compiler-rt/dist/lib/arm/divmodsi4.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/arm/divmodsi4.S Fri Jun 3 17:49:16 2011 (r222656, copy of r222625, vendor/compiler-rt/dist/lib/arm/divmodsi4.S) @@ -0,0 +1,47 @@ +/*===-- divmodsi4.S - 32-bit signed integer divide and modulus ------------===// + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + *===----------------------------------------------------------------------===// + * + * This file implements the __divmodsi4 (32-bit signed integer divide and + * modulus) function for the ARM architecture. A naive digit-by-digit + * computation is employed for simplicity. + * + *===----------------------------------------------------------------------===*/ + +#include "../assembly.h" + +#define ESTABLISH_FRAME \ + push {r4-r7, lr} ;\ + add r7, sp, #12 +#define CLEAR_FRAME_AND_RETURN \ + pop {r4-r7, pc} + +.syntax unified +.align 3 +DEFINE_COMPILERRT_FUNCTION(__divmodsi4) + ESTABLISH_FRAME +// Set aside the sign of the quotient and modulus, and the address for the +// modulus. + eor r4, r0, r1 + mov r5, r0 + mov r6, r2 +// Take the absolute value of a and b via abs(x) = (x^(x >> 31)) - (x >> 31). + eor ip, r0, r0, asr #31 + eor lr, r1, r1, asr #31 + sub r0, ip, r0, asr #31 + sub r1, lr, r1, asr #31 +// Unsigned divmod: + bl SYMBOL_NAME(__udivmodsi4) +// Apply the sign of quotient and modulus + ldr r1, [r6] + eor r0, r0, r4, asr #31 + eor r1, r1, r5, asr #31 + sub r0, r0, r4, asr #31 + sub r1, r1, r5, asr #31 + str r1, [r6] + CLEAR_FRAME_AND_RETURN Modified: head/contrib/compiler-rt/lib/arm/divsf3vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/divsf3vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/divsf3vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Copied: head/contrib/compiler-rt/lib/arm/divsi3.S (from r222625, vendor/compiler-rt/dist/lib/arm/divsi3.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/arm/divsi3.S Fri Jun 3 17:49:16 2011 (r222656, copy of r222625, vendor/compiler-rt/dist/lib/arm/divsi3.S) @@ -0,0 +1,41 @@ +/*===-- divsi3.S - 32-bit signed integer divide ---------------------------===// + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + *===----------------------------------------------------------------------===// + * + * This file implements the __divsi3 (32-bit signed integer divide) function + * for the ARM architecture as a wrapper around the unsigned routine. + * + *===----------------------------------------------------------------------===*/ + +#include "../assembly.h" + +#define ESTABLISH_FRAME \ + push {r4, r7, lr} ;\ + add r7, sp, #4 +#define CLEAR_FRAME_AND_RETURN \ + pop {r4, r7, pc} + +.syntax unified +.align 3 +// Ok, APCS and AAPCS agree on 32 bit args, so it's safe to use the same routine. +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_idiv, __divsi3) +DEFINE_COMPILERRT_FUNCTION(__divsi3) + ESTABLISH_FRAME +// Set aside the sign of the quotient. + eor r4, r0, r1 +// Take absolute value of a and b via abs(x) = (x^(x >> 31)) - (x >> 31). + eor r2, r0, r0, asr #31 + eor r3, r1, r1, asr #31 + sub r0, r2, r0, asr #31 + sub r1, r3, r1, asr #31 +// abs(a) / abs(b) + bl SYMBOL_NAME(__udivsi3) +// Apply sign of quotient to result and return. + eor r0, r0, r4, asr #31 + sub r0, r0, r4, asr #31 + CLEAR_FRAME_AND_RETURN Modified: head/contrib/compiler-rt/lib/arm/eqdf2vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/eqdf2vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/eqdf2vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/eqsf2vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/eqsf2vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/eqsf2vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/fixdfsivfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/fixdfsivfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/fixdfsivfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/fixsfsivfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/fixsfsivfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/fixsfsivfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/fixunssfsivfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/fixunssfsivfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/fixunssfsivfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/floatsidfvfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/floatsidfvfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/floatsidfvfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/floatsisfvfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/floatsisfvfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/floatsisfvfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/floatunssidfvfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/floatunssidfvfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/floatunssidfvfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/floatunssisfvfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/floatunssisfvfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/floatunssisfvfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/gedf2vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/gedf2vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/gedf2vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/gesf2vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/gesf2vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/gesf2vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/gtdf2vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/gtdf2vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/gtdf2vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/gtsf2vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/gtsf2vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/gtsf2vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/ledf2vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/ledf2vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/ledf2vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/lesf2vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/lesf2vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/lesf2vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/ltdf2vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/ltdf2vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/ltdf2vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/ltsf2vfp.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/ltsf2vfp.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/ltsf2vfp.S Fri Jun 3 17:49:16 2011 (r222656) @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// Modified: head/contrib/compiler-rt/lib/arm/modsi3.S ============================================================================== --- head/contrib/compiler-rt/lib/arm/modsi3.S Fri Jun 3 17:09:15 2011 (r222655) +++ head/contrib/compiler-rt/lib/arm/modsi3.S Fri Jun 3 17:49:16 2011 (r222656) @@ -1,36 +1,39 @@ -//===-------- modsi3.S - Implement modsi3 ---------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// +/*===-- modsi3.S - 32-bit signed integer modulus --------------------------===// + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + *===----------------------------------------------------------------------===// + * + * This file implements the __modsi3 (32-bit signed integer modulus) function + * for the ARM architecture as a wrapper around the unsigned routine. + * + *===----------------------------------------------------------------------===*/ #include "../assembly.h" -// -// extern int32_t __modsi3(int32_t a, int32_t b); -// -// Returns the remainder when dividing two 32-bit signed integers. -// Conceptually, the function is: { return a - (a / b) * b; } -// But if you write that in C, llvm compiles it to a call to __modsi3... -// - .align 2 -DEFINE_COMPILERRT_FUNCTION(__modsi3) - push {r4, r5, r7, lr} - add r7, sp, #8 // set stack frame - mov r5, r0 // save a - mov r4, r1 // save b - bl ___divsi3 // compute a/b -#if __ARM_ARCH_7A__ - mls r0, r4, r0, r5 // mulitple result * b and subtract from a -#else - // before armv7, does not have "mls" instruction - mul r3, r0, r4 // multiple result * b - sub r0, r5, r3 // a - result *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 18:58:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25A9A106566C; Fri, 3 Jun 2011 18:58:33 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFD348FC0A; Fri, 3 Jun 2011 18:58:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p53IwWmI076195; Fri, 3 Jun 2011 18:58:32 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53IwW9b076193; Fri, 3 Jun 2011 18:58:32 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201106031858.p53IwW9b076193@svn.freebsd.org> From: Andreas Tobler Date: Fri, 3 Jun 2011 18:58:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222658 - head/sys/dev/iicbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 18:58:33 -0000 Author: andreast Date: Fri Jun 3 18:58:32 2011 New Revision: 222658 URL: http://svn.freebsd.org/changeset/base/222658 Log: - Improve error handling. - Add a retry loop for the i2c sensor reading. - Update the sensor handling for sensors which do not have a location entry. [1] Submitted by: [1] Justin Hibbits. Approved by: nwhitehorn (mentor) Modified: head/sys/dev/iicbus/ds1775.c Modified: head/sys/dev/iicbus/ds1775.c ============================================================================== --- head/sys/dev/iicbus/ds1775.c Fri Jun 3 18:18:54 2011 (r222657) +++ head/sys/dev/iicbus/ds1775.c Fri Jun 3 18:58:32 2011 (r222658) @@ -95,20 +95,28 @@ static int ds1775_read_2(device_t dev, uint32_t addr, uint8_t reg, uint16_t *data) { uint8_t buf[4]; + int err, try = 0; struct iic_msg msg[2] = { { addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® }, { addr, IIC_M_RD, 2, buf }, }; - if (iicbus_transfer(dev, msg, 2) != 0) { - device_printf(dev, "iicbus read failed\n"); - return (EIO); + for (;;) + { + err = iicbus_transfer(dev, msg, 2); + if (err != 0) + goto retry; + + *data = *((uint16_t*)buf); + return (0); + retry: + if (++try > 5) { + device_printf(dev, "iicbus read failed\n"); + return (-1); + } + pause("ds1775_read_2", hz); } - - *data = *((uint16_t*)buf); - - return (0); } static int @@ -182,7 +190,10 @@ ds1775_start(void *xdev) ctx = device_get_sysctl_ctx(dev); sensroot_oid = device_get_sysctl_tree(dev); - OF_getprop(child, "hwsensor-zone", &sc->sc_sensor.zone, sizeof(int)); + if (OF_getprop(child, "hwsensor-zone", &sc->sc_sensor.zone, + sizeof(int)) < 0) + sc->sc_sensor.zone = 0; + plen = OF_getprop(child, "hwsensor-location", sc->sc_sensor.name, sizeof(sc->sc_sensor.name)); units = "C"; @@ -199,8 +210,14 @@ ds1775_start(void *xdev) } /* Make up target temperatures. These are low, for the drive bay. */ - sc->sc_sensor.target_temp = 300 + FCU_ZERO_C_TO_K; - sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K; + if (sc->sc_sensor.zone == 0) { + sc->sc_sensor.target_temp = 500 + FCU_ZERO_C_TO_K; + sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K; + } + else { + sc->sc_sensor.target_temp = 300 + FCU_ZERO_C_TO_K; + sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K; + } sc->sc_sensor.read = (int (*)(struct pmac_therm *sc))(ds1775_sensor_read); @@ -220,8 +237,11 @@ ds1775_sensor_read(struct ds1775_softc * { uint16_t buf[2]; uint16_t read; + int err; - ds1775_read_2(sc->sc_dev, sc->sc_addr, DS1775_TEMP, buf); + err = ds1775_read_2(sc->sc_dev, sc->sc_addr, DS1775_TEMP, buf); + if (err < 0) + return (-1); read = *((int16_t *)buf); @@ -243,6 +263,8 @@ ds1775_sensor_sysctl(SYSCTL_HANDLER_ARGS sc = device_get_softc(dev); temp = ds1775_sensor_read(sc); + if (temp < 0) + return (EIO); error = sysctl_handle_int(oidp, &temp, 0, req); From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 20:43:13 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 088FF106567E; Fri, 3 Jun 2011 20:43:13 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBF148FC0C; Fri, 3 Jun 2011 20:43:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p53KhCox079236; Fri, 3 Jun 2011 20:43:12 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53KhC8v079233; Fri, 3 Jun 2011 20:43:12 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201106032043.p53KhC8v079233@svn.freebsd.org> From: Andreas Tobler Date: Fri, 3 Jun 2011 20:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222659 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 20:43:13 -0000 Author: andreast Date: Fri Jun 3 20:43:12 2011 New Revision: 222659 URL: http://svn.freebsd.org/changeset/base/222659 Log: - Introduce a define for ZERO_C_TO_K. - Fix the printing of the temperature when we exceed the critical value. Approved by: nwhitehorn (mentor) Modified: head/sys/powerpc/powermac/powermac_thermal.c head/sys/powerpc/powermac/powermac_thermal.h Modified: head/sys/powerpc/powermac/powermac_thermal.c ============================================================================== --- head/sys/powerpc/powermac/powermac_thermal.c Fri Jun 3 18:58:32 2011 (r222658) +++ head/sys/powerpc/powermac/powermac_thermal.c Fri Jun 3 20:43:12 2011 (r222659) @@ -109,9 +109,10 @@ pmac_therm_manage_fans(void) printf("WARNING: Current temperature (%s: %d.%d C) " "exceeds critical temperature (%d.%d C)! " "Shutting down!\n", sensor->sensor->name, - sensor->last_val / 10, sensor->last_val % 10, - sensor->sensor->max_temp / 10, - sensor->sensor->max_temp % 10); + (sensor->last_val - ZERO_C_TO_K) / 10, + (sensor->last_val - ZERO_C_TO_K) % 10, + (sensor->sensor->max_temp - ZERO_C_TO_K) / 10, + (sensor->sensor->max_temp - ZERO_C_TO_K) % 10); shutdown_nice(RB_POWEROFF); } } Modified: head/sys/powerpc/powermac/powermac_thermal.h ============================================================================== --- head/sys/powerpc/powermac/powermac_thermal.h Fri Jun 3 18:58:32 2011 (r222658) +++ head/sys/powerpc/powermac/powermac_thermal.h Fri Jun 3 20:43:12 2011 (r222659) @@ -29,6 +29,8 @@ #ifndef _POWERPC_POWERMAC_POWERMAC_THERMAL_H #define _POWERPC_POWERMAC_POWERMAC_THERMAL_H +#define ZERO_C_TO_K 2732 + struct pmac_fan { int min_rpm, max_rpm, default_rpm; From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 20:59:21 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAC53106564A; Fri, 3 Jun 2011 20:59:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 914628FC14; Fri, 3 Jun 2011 20:59:21 +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 p53KxLue079791; Fri, 3 Jun 2011 20:59:21 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53KxLYY079789; Fri, 3 Jun 2011 20:59:21 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201106032059.p53KxLYY079789@svn.freebsd.org> From: John Baldwin Date: Fri, 3 Jun 2011 20:59:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222660 - head/sys/dev/puc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 20:59:21 -0000 Author: jhb Date: Fri Jun 3 20:59:21 2011 New Revision: 222660 URL: http://svn.freebsd.org/changeset/base/222660 Log: - Rename the Cronyx Omega2-PCI entry to Exar XR17C158 since that is the real owner of the device ID. Also rename the associated config function while here. - Add support for the 2-port and 4-port Exar parts as well: Exar XR17C/D152 and Exar XR17C154. Tested by: Mike Tancsa, Willy Offermans Willy of offermans rompen nl MFC after: 1 week Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Fri Jun 3 20:43:12 2011 (r222659) +++ head/sys/dev/puc/pucdata.c Fri Jun 3 20:59:21 2011 (r222660) @@ -48,8 +48,8 @@ __FBSDID("$FreeBSD$"); #include static puc_config_f puc_config_amc; -static puc_config_f puc_config_cronyx; static puc_config_f puc_config_diva; +static puc_config_f puc_config_exar; static puc_config_f puc_config_icbook; static puc_config_f puc_config_quatech; static puc_config_f puc_config_syba; @@ -548,11 +548,25 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_8S, 0x18, 0, 8, }, + { 0x13a8, 0x0152, 0xffff, 0, + "Exar XR17C/D152", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x10, 0, -1, + .config_function = puc_config_exar + }, + + { 0x13a8, 0x0154, 0xffff, 0, + "Exar XR17C154", + DEFAULT_RCLK * 8, + PUC_PORT_4S, 0x10, 0, -1, + .config_function = puc_config_exar + }, + { 0x13a8, 0x0158, 0xffff, 0, - "Cronyx Omega2-PCI", + "Exar XR17C158", DEFAULT_RCLK * 8, PUC_PORT_8S, 0x10, 0, -1, - .config_function = puc_config_cronyx + .config_function = puc_config_exar }, { 0x13a8, 0x0258, 0xffff, 0, @@ -1014,28 +1028,28 @@ puc_config_amc(struct puc_softc *sc, enu } static int -puc_config_cronyx(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, +puc_config_diva(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, intptr_t *res) { + const struct puc_cfg *cfg = sc->sc_cfg; + if (cmd == PUC_CFG_GET_OFS) { - *res = port * 0x200; + if (cfg->subdevice == 0x1282) /* Everest SP */ + port <<= 1; + else if (cfg->subdevice == 0x104b) /* Maestro SP2 */ + port = (port == 3) ? 4 : port; + *res = port * 8 + ((port > 2) ? 0x18 : 0); return (0); } return (ENXIO); } static int -puc_config_diva(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, +puc_config_exar(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, intptr_t *res) { - const struct puc_cfg *cfg = sc->sc_cfg; - if (cmd == PUC_CFG_GET_OFS) { - if (cfg->subdevice == 0x1282) /* Everest SP */ - port <<= 1; - else if (cfg->subdevice == 0x104b) /* Maestro SP2 */ - port = (port == 3) ? 4 : port; - *res = port * 8 + ((port > 2) ? 0x18 : 0); + *res = port * 0x200; return (0); } return (ENXIO); From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 21:11:08 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B2A71065746; Fri, 3 Jun 2011 21:11:08 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id 3307C8FC08; Fri, 3 Jun 2011 21:11:07 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id p53LB7j8094982; Fri, 3 Jun 2011 15:11:07 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id p53LB7XC094981; Fri, 3 Jun 2011 15:11:07 -0600 (MDT) (envelope-from ken) Date: Fri, 3 Jun 2011 15:11:07 -0600 From: "Kenneth D. Merry" To: Bruce Evans Message-ID: <20110603211107.GA91421@nargothrond.kdm.org> References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> <4DE5D72A.1020405@FreeBSD.org> <20110601193030.A1275@besplex.bde.org> <20110602213611.GA47880@nargothrond.kdm.org> <20110603204653.B1551@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110603204653.B1551@besplex.bde.org> User-Agent: Mutt/1.4.2i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 21:11:08 -0000 On Fri, Jun 03, 2011 at 20:47:00 +1000, Bruce Evans wrote: > On Thu, 2 Jun 2011, Kenneth D. Merry wrote: > > >On Wed, Jun 01, 2011 at 20:07:31 +1000, Bruce Evans wrote: > >>On Wed, 1 Jun 2011, Andriy Gapon wrote: > >> > >>>on 31/05/2011 20:29 Kenneth D. Merry said the following: > >>>>+ mtx_init(&mbp->msg_lock, "msgbuf", NULL, MTX_SPIN); > >>> > >>>Sorry that I didn't gather myself together for a review before this > >>>change > >>>got > >>>actually committed. > >>>Do you see any reason not to make this spinlock recursive? > > It does need to be recursive to avoid deadlock (as I described), but this > prevents it actually working as a lock. I think the new code needs it to > work as a lock. Yes, it does. > >>I see reasons why it must not exist. The message buffer code cannot use > >>any normal locking, and was carefully written to avoid doing so. > >> > >>>I am a little bit worried about "exotic" situations like receiving an NMI > >>>in the > >>>middle of printing and wanting to print in the NMI context, or similar > >>>things > >>>that penetrate contexts with disabled interrupts - e.g. Machine Check > >>>Exception. > >>>Also it's not clear to me if there won't any bigger damage in the > >>>situations > >>>like those described above. > >>> > >>>P.S. I have been thinking about fixing the problem in a different > >>>fashion, > >>>via > >>>reserving portions of dmesg buffer for a whole message using CAS: > >>>http://lists.freebsd.org/pipermail/freebsd-hackers/2010-April/031535.html > >> > >>Something like this might work. > >> > >>PRINTF_BUFR size should not exist either, especially now that it is > >>much more complicated and broken. Here is some of my old mail about > >>adding (necessarily not normal) locking to to printf. No one replied, > >>so I never finished this :-(. > > > >That particular solution doesn't lock the normal kernel printf path, and so > >won't fix what we're trying to fix. (We've got lots of disks in each > >system, and when there are various SES events and disks arriving and > >departing, there are multiple kernel contexts doing printfs simultaneously, > >and that results in scrambled dmesg output.) > > But it does. PRINTF_BUFR_SIZE (at least used to) only be applied to > vprintf(), but my printf_lock() is applied to all calls to kvprintf() > that set TOLOG. (If I missed some, this takes 2 lines each to fix.) > The calls in tprintf() and log() have comments saying that this is > intentional "to serialize msgbuf", though I fear this might not be safe > for at least tprintf(), since it may block unboundedly. But even when > it blocks unboundedly, nothing really bad happens: the output just > becomes very slow due to everything waiting for the timeout until the > blockage clears, and may be interleaved. Recursion gives similar > behaviour, except it takes unrecursing to clear the blockage. I > consider the very slow output to be a feature. Unbounded blockages > and recursion are bugs and the slow output makes them more obvious. Ahh. It wasn't 100% clear from looking at the patch which calls had the lock applied. In this case at least, it's skipping the lock when the priority is -1. Is this tprintf()? % /* % * Warn that a system table is full. % @@ -198,5 +221,9 @@ % pca.flags = flags; % va_start(ap, fmt); % + if (pri != -1) % + printf_lock(); /* To serialize msgbuf. XXX: long-held lock? */ % kvprintf(fmt, putchar, &pca, 10, ap); % + if (pri != -1) % + printf_unlock(); % va_end(ap); % if (sess != NULL) % > >I think the goals should be: > > > >- console output, syslog output, and dmesg output are not scrambled. > > (i.e. individual kernel printfs make it out atomically, or at least > > with a certain granularity, like PRINTF_BUFR_SIZE.) > > Console output includes debugger output. This must be able to break into > any otherwise-atomic kernel printf. Possibly similarly for NMIs (if they > print. They really shouldn't print, but they at least used to get this > horribly wrong from the beginning on i386). Similarly for certain (non > maskable) traps. These really shouldn't happen while we're printing, but > if they do then they may need to panic and then print for things like > machine check exceptions. > > Debugger output is the easiest way of showing why printf cannot use > any normal locking. There is an option (that I don't like or use) > which supports debugger output going through normal printf. I think > the message buffer is used for this. So message buffer accesses cannout > use normal locking either. > > Apart from this, I don't know any reason why a printf or even a msgbuf > write can't wait for a while (a very long while if the output is to a > slow device -- don't forget to test with a 50 bps serial console) until > any previous printfs complete. My simple serialization gives this if > the other printfs are on other CPUs, and possibly if they are on other > ithreads (the simple serialization doesn't give up control for simplicity, > since it is hard to tell when it is safe to give up control, but > preemption while we are spinning might get back to the other printfs). > And when the printf is recursive, there is no way back to the other > printfs, so we must proceed. We could proceed immediately, but my > simple serialization waits in this case too for simplicity. This case > should be even rarer than waiting too long for another CPU. Hopefully the delay won't be too bad for most consumers. It'll take some testing to see what happens. > >- Can be called by any kernel routine (i.e. doesn't sleep) > > Some complications for tprintf and uprintf (and maybe ordinary printf if > it is connected to a pty). I think we already have the necessary > complications. Something involving printing only to the message buffer > in the non-sleeping part. > > >- Offers a string at a time interface. > > I don't provide this. So printf's a character or word or 2 at a time > may be interleaved. It is perhaps not to much to ask that important > printfs that are likely to be interleaved preprint their strings into > lines. The lack of a string interface isn't that big of a deal, since your solution already serializes printf calls. > >- Does the right thing for log messages (priority, etc.) > > > >It looks like we should add "does not use normal locking" to the list as > >well. > > > >As Justin mentioned, we started off down the path of using atomic > >operations, and then figured out that wouldn't fully work. Then we > >discussed doing a per-CPU message buffer, with each message tagged with a > >sequence number, and having the reader re-serialize the messages in the > >right order. The complexity started to get large enough that we decided > >that using a spin lock would be a much easier approach. > > But almost eveyone who has worked on this before knows that a spinlock > cannot be used. We haven't worked on this before, of course. :) > >cnputs() already uses a spinlock, so we're no worse off than before from a > >locking standpoint. > > An obvious bug for PRINTF_BUFR_SIZE. But as I said, this one might > work well enough if it were recursive. This depends on the lower-level > console drivers supporting recursion. Most don't. Some have simple > serialization, but have to bypass it open to support debugger output, > much like higher levels except they have more control over the timing. Ahh. > But in the message buffer accesses, I think you used the lock to provide > exlusive accesses. Yes. The lock is used to prevent the buffer getting scrambled. Recursion probably wouldn't work very well. > >We could perhaps make the message buffer mutex recursive and set the > >MTX_NOWITNESS flag as well, that might make things a little better from a > >side effect standpoint. > > I don't see how a recursive mutex can protect the message buffer. Don't > forget to trace through the code protected by the mutex using ddb, while > at the same time using this code for ddb itself. It's just too hard to > make this work. Normally, this type of problem is avoided by avoiding > not using code like this for the low levels like ddb itself. Ddb mostly > does this, but has complications: > > % static void > % db_putc(int c) > % { > % > % /* > % * If not in the debugger or the user requests it, output data to > % * both the console and the message buffer. > % */ > % if (!kdb_active || ddb_use_printf) { > % printf("%c", c); > > Here it uses ordinary printf, so it uses whatever printf uses. In > particular, PRINTF_BUFR_SIZE makes printf use cnputs() and the buggy > locking in it, and printf always uses the message buffer and I think > the new code gives buggy locking there unconditionally. > > This problem is not very large, since it takes some foot shooting to get > here: > - there is some buggy code that uses db_printf() when !kdb_active. > Perhaps this is not used recursively. > - we can configure ddb to use printf. I think it is a feature that the > message buffer gets used in this mode. > > % if (!kdb_active) > % return; > % if (c == '\r' || c == '\n') > % db_check_interrupt(); > % if (c == '\n' && db_maxlines > 0) { > % db_newlines++; > % if (db_newlines >= db_maxlines) > % db_pager(); > % } > % return; > % } > % > % /* Otherwise, output data directly to the console. */ > % if (c > ' ' && c <= '~') { > % /* > % * Printing character. > % * If we have spaces to print, print them first. > % * Use tabs if possible. > % */ > % db_force_whitespace(); > % cnputc(c); > % db_capture_writech(c); > % db_output_position++; > % db_last_non_space = db_output_position; > % } > > I think this routine is used mainly by db_printf() calling kvprintf() and > kvprintf() calling here. kvprintf() is supposed to be reentrant and in > particular not use any locking to support this. I think it still does. > > Bruce I'll try to get some time to run some tests with your locking code and see how it works. We just need something that works, whether it's a spinlock or hand-rolled lock doesn't matter so much. Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 21:17:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10AB510656A5; Fri, 3 Jun 2011 21:17:43 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3DB88FC18; Fri, 3 Jun 2011 21:17: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 p53LHgH7080392; Fri, 3 Jun 2011 21:17:42 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p53LHg7Y080389; Fri, 3 Jun 2011 21:17:42 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106032117.p53LHg7Y080389@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Jun 2011 21:17:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222661 - head/tools/regression/bin/sh/execution X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 21:17:43 -0000 Author: jilles Date: Fri Jun 3 21:17:42 2011 New Revision: 222661 URL: http://svn.freebsd.org/changeset/base/222661 Log: sh: Add tests for -n flag. These already pass. Added: head/tools/regression/bin/sh/execution/set-n1.0 (contents, props changed) head/tools/regression/bin/sh/execution/set-n2.0 (contents, props changed) head/tools/regression/bin/sh/execution/set-n3.0 (contents, props changed) Added: head/tools/regression/bin/sh/execution/set-n1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/set-n1.0 Fri Jun 3 21:17:42 2011 (r222661) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +v=$( ($SH -n <<'EOF' +for +EOF +) 2>&1 >/dev/null) +[ $? -ne 0 ] && [ -n "$v" ] Added: head/tools/regression/bin/sh/execution/set-n2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/set-n2.0 Fri Jun 3 21:17:42 2011 (r222661) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +$SH -n <<'EOF' +echo bad +EOF Added: head/tools/regression/bin/sh/execution/set-n3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/set-n3.0 Fri Jun 3 21:17:42 2011 (r222661) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +v=$( ($SH -nc 'for') 2>&1 >/dev/null) +[ $? -ne 0 ] && [ -n "$v" ] From owner-svn-src-head@FreeBSD.ORG Fri Jun 3 22:02:35 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15919106566B; Fri, 3 Jun 2011 22:02:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id A181A8FC0A; Fri, 3 Jun 2011 22:02:34 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p53M2TW9003207 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 4 Jun 2011 08:02:32 +1000 Date: Sat, 4 Jun 2011 08:02:29 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Kenneth D. Merry" In-Reply-To: <20110603211107.GA91421@nargothrond.kdm.org> Message-ID: <20110604072808.G1143@besplex.bde.org> References: <201105311729.p4VHTwrZ033296@svn.freebsd.org> <4DE5D72A.1020405@FreeBSD.org> <20110601193030.A1275@besplex.bde.org> <20110602213611.GA47880@nargothrond.kdm.org> <20110603204653.B1551@besplex.bde.org> <20110603211107.GA91421@nargothrond.kdm.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon , Bruce Evans Subject: Re: svn commit: r222537 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 22:02:35 -0000 On Fri, 3 Jun 2011, Kenneth D. Merry wrote: > On Fri, Jun 03, 2011 at 20:47:00 +1000, Bruce Evans wrote: >> On Thu, 2 Jun 2011, Kenneth D. Merry wrote: >>> That particular solution doesn't lock the normal kernel printf path, and so >>> won't fix what we're trying to fix. (We've got lots of disks in each >>> system, and when there are various SES events and disks arriving and >>> departing, there are multiple kernel contexts doing printfs simultaneously, >>> and that results in scrambled dmesg output.) >> >> But it does. PRINTF_BUFR_SIZE (at least used to) only be applied to >> vprintf(), but my printf_lock() is applied to all calls to kvprintf() >> that set TOLOG. (If I missed some, this takes 2 lines each to fix.) >> ... > > Ahh. It wasn't 100% clear from looking at the patch which calls had the > lock applied. In this case at least, it's skipping the lock when the > priority is -1. Is this tprintf()? > > % /* > % * Warn that a system table is full. > % @@ -198,5 +221,9 @@ > % pca.flags = flags; > % va_start(ap, fmt); > % + if (pri != -1) > % + printf_lock(); /* To serialize msgbuf. XXX: long-held > lock? */ > % kvprintf(fmt, putchar, &pca, 10, ap); > % + if (pri != -1) > % + printf_unlock(); > % va_end(ap); > % if (sess != NULL) > % Hmm. -1 means `not TOLOG' (see earlier in tprintf()), and I only apply printf_lock() if the output is kernel-only _or_ uses TOLOG (cases that go TOTTY only might need some serialization, but they can probably block and I don't want to apply the low-level printf_lock() to them). Only tprintf() has this magic -1 priority, and this magic never used, at least in the FreeBSD /sys tree and matching '[^a-z]tprintf('. There are just 4 calls to tprintf(), and they are all related to nfs and all use pri = LOG_INFO. So tprintf() always goes TOLOG in practice. uprintf() is relatively popular, and never goes TOLOG. The only obvious difference between uprintf() and tprintf() with pri -1 is that the former users curthread->td_proc while the latter takes a proc pointer. The proc pointer is constructed from a thread pointer passed around by nfs so I can't see what it is, but I bet it is always curthread->td_proc or perhaps NULL. If it is NULL, then tprintf() doesn't print to a tty and reduces to a buggy version of log() if pri != -1 (log() goes TOCONS if !log_open, while the reduced tprintf() always goes TOLOG); if pri == -1, then tprintf() prints nowhere (and hopefully doesn't get confused doing this). >> ... >> Apart from this, I don't know any reason why a printf or even a msgbuf >> write can't wait for a while (a very long while if the output is to a >> slow device -- don't forget to test with a 50 bps serial console) until >> any previous printfs complete. My simple serialization gives this if >> the other printfs are on other CPUs, and possibly if they are on other >> ithreads (the simple serialization doesn't give up control for simplicity, >> since it is hard to tell when it is safe to give up control, but >> preemption while we are spinning might get back to the other printfs). >> And when the printf is recursive, there is no way back to the other >> printfs, so we must proceed. We could proceed immediately, but my >> simple serialization waits in this case too for simplicity. This case >> should be even rarer than waiting too long for another CPU. > > Hopefully the delay won't be too bad for most consumers. It'll take some > testing to see what happens. Certainly the cases of TOLOG only, and TOCONS to a synchronous console, will be very fast. > I'll try to get some time to run some tests with your locking code and see > how it works. It will be good to test on a bigger system that actually needs lots of kernel printfs. Bruce From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 01:13:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DBC71065670; Sat, 4 Jun 2011 01:13:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E6E78FC0C; Sat, 4 Jun 2011 01:13:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p541DAI7087427; Sat, 4 Jun 2011 01:13:10 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p541D9bs087425; Sat, 4 Jun 2011 01:13:10 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201106040113.p541D9bs087425@svn.freebsd.org> From: Rick Macklem Date: Sat, 4 Jun 2011 01:13:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222663 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 01:13:10 -0000 Author: rmacklem Date: Sat Jun 4 01:13:09 2011 New Revision: 222663 URL: http://svn.freebsd.org/changeset/base/222663 Log: Modify the new NFS server so that the NFSv3 Pathconf RPC doesn't return an error when the underlying file system lacks support for any of the four _PC_xxx values used, by falling back to default values. Tested by: avg MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Sat Jun 4 01:11:34 2011 (r222662) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Sat Jun 4 01:13:09 2011 (r222663) @@ -2592,6 +2592,36 @@ nfsvno_pathconf(struct vnode *vp, int fl int error; error = VOP_PATHCONF(vp, flag, retf); + if (error == EOPNOTSUPP || error == EINVAL) { + /* + * Some file systems return EINVAL for name arguments not + * supported and some return EOPNOTSUPP for this case. + * So the NFSv3 Pathconf RPC doesn't fail for these cases, + * just fake them. + */ + switch (flag) { + case _PC_LINK_MAX: + *retf = LINK_MAX; + break; + case _PC_NAME_MAX: + *retf = NAME_MAX; + break; + case _PC_CHOWN_RESTRICTED: + *retf = 1; + break; + case _PC_NO_TRUNC: + *retf = 1; + break; + default: + /* + * Only happens if a _PC_xxx is added to the server, + * but this isn't updated. + */ + *retf = 0; + printf("nfsrvd pathconf flag=%d not supp\n", flag); + }; + error = 0; + } return (error); } From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 03:22:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7210E106566C; Sat, 4 Jun 2011 03:22:17 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 626308FC12; Sat, 4 Jun 2011 03:22:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p543MHPi091628; Sat, 4 Jun 2011 03:22:17 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p543MHXs091626; Sat, 4 Jun 2011 03:22:17 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106040322.p543MHXs091626@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 4 Jun 2011 03:22:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222666 - head/sys/powerpc/aim X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 03:22:17 -0000 Author: nwhitehorn Date: Sat Jun 4 03:22:16 2011 New Revision: 222666 URL: http://svn.freebsd.org/changeset/base/222666 Log: Fix a typo derived from a mismerge from mmu_oea that would cause pmap_sync_icache() to sync random (possibly uncached or nonexisting!) memory, causing kernel page faults or machine checks, most easily triggered by using GDB. While here, add an additional safeguard to only sync cacheable memory. MFC after: 2 days Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat Jun 4 02:51:12 2011 (r222665) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Jun 4 03:22:16 2011 (r222666) @@ -2562,8 +2562,8 @@ moea64_sync_icache(mmu_t mmu, pmap_t pm, lim = round_page(va); len = MIN(lim - va, sz); pvo = moea64_pvo_find_va(pm, va & ~ADDR_POFF); - if (pvo != NULL) { - pa = (pvo->pvo_pte.pte.pte_lo & LPTE_RPGN) | + if (pvo != NULL && !(pvo->pvo_pte.lpte.pte_lo & LPTE_I)) { + pa = (pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) | (va & ADDR_POFF); moea64_syncicache(mmu, pm, va, pa, len); } From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 04:00:40 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8384D1065672; Sat, 4 Jun 2011 04:00:40 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 730468FC15; Sat, 4 Jun 2011 04:00:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5440eBt092816; Sat, 4 Jun 2011 04:00:40 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5440ea7092814; Sat, 4 Jun 2011 04:00:40 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106040400.p5440ea7092814@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 4 Jun 2011 04:00:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222667 - head/sys/powerpc/ofw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 04:00:40 -0000 Author: nwhitehorn Date: Sat Jun 4 04:00:40 2011 New Revision: 222667 URL: http://svn.freebsd.org/changeset/base/222667 Log: Retry the memory map-related portions of r222613, written by andreast, after some minor tweaks and an increase in the early-boot stack space in r222632. Modified: head/sys/powerpc/ofw/ofw_machdep.c Modified: head/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- head/sys/powerpc/ofw/ofw_machdep.c Sat Jun 4 03:22:16 2011 (r222666) +++ head/sys/powerpc/ofw/ofw_machdep.c Sat Jun 4 04:00:40 2011 (r222667) @@ -60,18 +60,15 @@ __FBSDID("$FreeBSD$"); #include #include -#define OFMEM_REGIONS 32 -static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3]; -static struct mem_region OFfree[OFMEM_REGIONS + 3]; -static int nOFmem; +static struct mem_region OFmem[PHYS_AVAIL_SZ], OFavail[PHYS_AVAIL_SZ]; +static struct mem_region OFfree[PHYS_AVAIL_SZ]; extern register_t ofmsr[5]; -int ofwcall(void *); extern void *openfirmware_entry; static void *fdt; int ofw_real_mode; -int ofw_32bit_mode_entry(void *); +int ofwcall(void *); static void ofw_quiesce(void); static int openfirmware(void *args); @@ -135,11 +132,32 @@ memr_merge(struct mem_region *from, stru to->mr_size = end - to->mr_start; } +/* + * Quick sort callout for comparing memory regions. + */ +static int mr_cmp(const void *a, const void *b); + +static int +mr_cmp(const void *a, const void *b) +{ + const struct mem_region *regiona; + const struct mem_region *regionb; + + regiona = a; + regionb = b; + if (regiona->mr_start < regionb->mr_start) + return (-1); + else if (regiona->mr_start > regionb->mr_start) + return (1); + else + return (0); +} + static int parse_ofw_memory(phandle_t node, const char *prop, struct mem_region *output) { cell_t address_cells, size_cells; - cell_t OFmem[4*(OFMEM_REGIONS + 1)]; + cell_t OFmem[4 * PHYS_AVAIL_SZ]; int sz, i, j; int apple_hack_mode; phandle_t phandle; @@ -175,8 +193,8 @@ parse_ofw_memory(phandle_t node, const c /* * Get memory. */ - if ((node == -1) || (sz = OF_getprop(node, prop, - OFmem, sizeof(OFmem[0]) * 4 * OFMEM_REGIONS)) <= 0) + if (node == -1 || (sz = OF_getprop(node, prop, + OFmem, sizeof(OFmem))) <= 0) panic("Physical memory map not found"); i = 0; @@ -226,7 +244,7 @@ parse_ofw_memory(phandle_t node, const c #ifdef __powerpc64__ if (apple_hack_mode) { /* Add in regions above 4 GB to the available list */ - struct mem_region himem[OFMEM_REGIONS]; + struct mem_region himem[16]; int hisz; hisz = parse_ofw_memory(node, "reg", himem); @@ -244,6 +262,81 @@ parse_ofw_memory(phandle_t node, const c return (sz); } +static int +parse_drconf_memory(int *msz, int *asz, struct mem_region *ofmem, + struct mem_region *ofavail) +{ + phandle_t phandle; + vm_offset_t base; + int i, idx, len, lasz, lmsz, res; + uint32_t lmb_size[2]; + unsigned long *dmem, flags; + + lmsz = *msz; + lasz = *asz; + + phandle = OF_finddevice("/ibm,dynamic-reconfiguration-memory"); + if (phandle == -1) + /* No drconf node, return. */ + return (0); + + res = OF_getprop(phandle, "ibm,lmb-size", lmb_size, sizeof(lmb_size)); + if (res == -1) + return (0); + + /* Parse the /ibm,dynamic-memory. + The first position gives the # of entries. The next two words + reflect the address of the memory block. The next four words are + the DRC index, reserved, list index and flags. + (see PAPR C.6.6.2 ibm,dynamic-reconfiguration-memory) + + #el Addr DRC-idx res list-idx flags + ------------------------------------------------- + | 4 | 8 | 4 | 4 | 4 | 4 |.... + ------------------------------------------------- + */ + + len = OF_getproplen(phandle, "ibm,dynamic-memory"); + if (len > 0) { + + /* We have to use a variable length array on the stack + since we have very limited stack space. + */ + cell_t arr[len/sizeof(cell_t)]; + + res = OF_getprop(phandle, "ibm,dynamic-memory", &arr, + sizeof(arr)); + if (res == -1) + return (0); + + /* Number of elements */ + idx = arr[0]; + + /* First address. */ + dmem = (void*)&arr[1]; + + for (i = 0; i < idx; i++) { + base = *dmem; + dmem += 2; + flags = *dmem; + /* Use region only if available and not reserved. */ + if ((flags & 0x8) && !(flags & 0x80)) { + ofmem[lmsz].mr_start = base; + ofmem[lmsz].mr_size = (vm_size_t)lmb_size[1]; + ofavail[lasz].mr_start = base; + ofavail[lasz].mr_size = (vm_size_t)lmb_size[1]; + lmsz++; + lasz++; + } + dmem++; + } + } + + *msz = lmsz; + *asz = lasz; + + return (1); +} /* * This is called during powerpc_init, before the system is really initialized. * It shall provide the total and the available regions of RAM. @@ -256,31 +349,62 @@ ofw_mem_regions(struct mem_region **memp struct mem_region **availp, int *availsz) { phandle_t phandle; + vm_offset_t maxphysaddr; int asz, msz, fsz; - int i, j; + int i, j, res; int still_merging; + char name[31]; asz = msz = 0; /* - * Get memory. + * Get memory from all the /memory nodes. */ - phandle = OF_finddevice("/memory"); - if (phandle == -1) - phandle = OF_finddevice("/memory@0"); + for (phandle = OF_child(OF_peer(0)); phandle != 0; + phandle = OF_peer(phandle)) { + if (OF_getprop(phandle, "name", name, sizeof(name)) <= 0) + continue; + if (strncmp(name, "memory", sizeof(name)) != 0) + continue; + + res = parse_ofw_memory(phandle, "reg", &OFmem[msz]); + msz += res/sizeof(struct mem_region); + if (OF_getproplen(phandle, "available") >= 0) + res = parse_ofw_memory(phandle, "available", + &OFavail[asz]); + else + res = parse_ofw_memory(phandle, "reg", &OFavail[asz]); + asz += res/sizeof(struct mem_region); + } - msz = parse_ofw_memory(phandle, "reg", OFmem); - nOFmem = msz / sizeof(struct mem_region); - asz = parse_ofw_memory(phandle, "available", OFavail); + /* Check for memory in ibm,dynamic-reconfiguration-memory */ + parse_drconf_memory(&msz, &asz, OFmem, OFavail); + + qsort(OFmem, msz, sizeof(*OFmem), mr_cmp); + qsort(OFavail, asz, sizeof(*OFavail), mr_cmp); *memp = OFmem; - *memsz = nOFmem; - + *memsz = msz; + + /* + * On some firmwares (SLOF), some memory may be marked available that + * doesn't actually exist. This manifests as an extension of the last + * available segment past the end of physical memory, so truncate that + * one. + */ + maxphysaddr = 0; + for (i = 0; i < msz; i++) + if (OFmem[i].mr_start + OFmem[i].mr_size > maxphysaddr) + maxphysaddr = OFmem[i].mr_start + OFmem[i].mr_size; + + if (OFavail[asz - 1].mr_start + OFavail[asz - 1].mr_size > maxphysaddr) + OFavail[asz - 1].mr_size = maxphysaddr - + OFavail[asz - 1].mr_start; + /* * OFavail may have overlapping regions - collapse these * and copy out remaining regions to OFfree */ - asz /= sizeof(struct mem_region); do { still_merging = FALSE; for (i = 0; i < asz; i++) { @@ -469,12 +593,7 @@ openfirmware(void *args) int result; #ifdef SMP struct ofw_rv_args rv_args; - #endif - if (pmap_bootstrapped && ofw_real_mode) - args = (void *)pmap_kextract((vm_offset_t)args); - - #ifdef SMP rv_args.args = args; rv_args.in_progress = 1; smp_rendezvous(smp_no_rendevous_barrier, ofw_rendezvous_dispatch, From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 04:15:00 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 534161065674; Sat, 4 Jun 2011 04:15:00 +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 38B868FC0A; Sat, 4 Jun 2011 04:15:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p544F0wW093324; Sat, 4 Jun 2011 04:15:00 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p544ExZO093320; Sat, 4 Jun 2011 04:14:59 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201106040414.p544ExZO093320@svn.freebsd.org> From: Adrian Chadd Date: Sat, 4 Jun 2011 04:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222668 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 04:15:00 -0000 Author: adrian Date: Sat Jun 4 04:14:59 2011 New Revision: 222668 URL: http://svn.freebsd.org/changeset/base/222668 Log: A few changes to make radar detection implementable in a hal_dfs/ module. * If sc->sc_dodfs is set to 1 by the ath_dfs_radar_enable(), set the relevant rx filter bit to begin receiving radar PHY errors. The HAL code already knows how to set the relevant error mask register to enable radar events. * Add a missing call to ath_dfs_radar_enable() after ath_hal_reset() * change ath_dfs_process_phyerr() to take a const char *buf for now, rather than a descriptor. This way it can get access to the packet buffer contents. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athdfs.h head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat Jun 4 04:00:40 2011 (r222667) +++ head/sys/dev/ath/if_ath.c Sat Jun 4 04:14:59 2011 (r222668) @@ -1261,6 +1261,10 @@ ath_resume(struct ath_softc *sc) sc->sc_curchan != NULL ? sc->sc_curchan : ic->ic_curchan, AH_FALSE, &status); ath_reset_keycache(sc); + + /* Let DFS at it in case it's a DFS channel */ + ath_dfs_radar_enable(sc, ic->ic_curchan); + if (sc->sc_resume_up) { if (ic->ic_opmode == IEEE80211_M_STA) { ath_init(sc); @@ -2013,6 +2017,10 @@ ath_calcrxfilter(struct ath_softc *sc) if (ic->ic_opmode == IEEE80211_M_MONITOR) rfilt |= HAL_RX_FILTER_CONTROL; + if (sc->sc_dodfs) { + rfilt |= HAL_RX_FILTER_PHYRADAR; + } + /* * Enable RX of compressed BAR frames only when doing * 802.11n. Required for A-MPDU. @@ -3465,7 +3473,7 @@ ath_rx_proc(void *arg, int npending) if (rs->rs_status & HAL_RXERR_PHY) { sc->sc_stats.ast_rx_phyerr++; /* Process DFS radar events */ - ath_dfs_process_phy_err(sc, ds, tsf, rs); + ath_dfs_process_phy_err(sc, mtod(m, char *), tsf, rs); /* Be suitably paranoid about receiving phy errors out of the stats array bounds */ if (rs->rs_phyerr < 64) Modified: head/sys/dev/ath/if_athdfs.h ============================================================================== --- head/sys/dev/ath/if_athdfs.h Sat Jun 4 04:00:40 2011 (r222667) +++ head/sys/dev/ath/if_athdfs.h Sat Jun 4 04:14:59 2011 (r222668) @@ -35,7 +35,7 @@ extern int ath_dfs_attach(struct ath_sof extern int ath_dfs_detach(struct ath_softc *sc); extern void ath_dfs_radar_enable(struct ath_softc *, struct ieee80211_channel *chan); -extern void ath_dfs_process_phy_err(struct ath_softc *sc, struct ath_desc *ds, +extern void ath_dfs_process_phy_err(struct ath_softc *sc, const char *buf, uint64_t tsf, struct ath_rx_status *rxstat); extern int ath_dfs_process_radar_event(struct ath_softc *sc, struct ieee80211_channel *chan); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Sat Jun 4 04:00:40 2011 (r222667) +++ head/sys/dev/ath/if_athvar.h Sat Jun 4 04:14:59 2011 (r222668) @@ -360,6 +360,7 @@ struct ath_softc { /* DFS related state */ void *sc_dfs; /* Used by an optional DFS module */ + int sc_dodfs; /* Whether to enable DFS rx filter bits */ struct task sc_dfstask; /* DFS processing task */ }; From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 05:40:02 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCBE41065678 for ; Sat, 4 Jun 2011 05:40:02 +0000 (UTC) (envelope-from silby@silby.com) Received: from relay03.pair.com (relay03.pair.com [209.68.5.17]) by mx1.freebsd.org (Postfix) with SMTP id 591808FC16 for ; Sat, 4 Jun 2011 05:40:02 +0000 (UTC) Received: (qmail 84098 invoked from network); 4 Jun 2011 05:13:20 -0000 Received: from 209.68.2.70 (HELO localhost) (209.68.2.70) by relay03.pair.com with SMTP; 4 Jun 2011 05:13:20 -0000 X-pair-Authenticated: 209.68.2.70 Date: Sat, 4 Jun 2011 00:13:19 -0500 (CDT) From: Mike Silbersack X-X-Sender: silby@telemachus.local To: John Baldwin In-Reply-To: <201106030944.36200.jhb@freebsd.org> Message-ID: References: <201105022105.p42L5q3j054498@svn.freebsd.org> <4DCE93BF.7000803@FreeBSD.org> <86boz5fby1.fsf@kopusha.home.net> <201106030944.36200.jhb@freebsd.org> User-Agent: Alpine 2.00 (OSX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, Mikolaj Golub , svn-src-head@freebsd.org, Bjoern Zeeb , Mike Silbersack , Lawrence Stewart Subject: Re: svn commit: r221346 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 05:40:02 -0000 I'm heading out of town this weekend. I can try to look at this on Tuesday, if nobody beats me to it. -Mike On Fri, 3 Jun 2011, John Baldwin wrote: > On Saturday, May 14, 2011 1:07:18 pm Mikolaj Golub wrote: >> >> On Sat, 14 May 2011 10:37:51 -0400 John Baldwin wrote: >> >> JB> Can you capture a tcpdump (probably easiest to do from the other host)? >> >> I replaced the asserts with log statements to make the host not panic and the >> captured dump survive. > > Please try this change. What is happening is that you have a remaining > window that is smaller than the window scale. You are receiving zero > window updates that are received ok (becuase the socket buffer isn't > completely empty), and that advance rcv_nxt. However, tcp_output() is > not advancing rcv_adv because 'recwin' is calculated as zero. My > invariants had assumed that the ACK that gets forced out for a reply > to a zero window probe would move rcv_adv, but that isn't happening. > This patch will allow rcv_adv to advance when a zero window probe is > ACK'd. I'm not sure if this is the best way to fix this, but I think > it will fix it: > > Index: tcp_output.c > =================================================================== > --- tcp_output.c (revision 222565) > +++ tcp_output.c (working copy) > @@ -1331,7 +1331,7 @@ out: > * then remember the size of the advertised window. > * Any pending ACK has now been sent. > */ > - if (recwin > 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv)) > + if (recwin >= 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv)) > tp->rcv_adv = tp->rcv_nxt + recwin; > tp->last_ack_sent = tp->rcv_nxt; > tp->t_flags &= ~(TF_ACKNOW | TF_DELACK); > > > -- > John Baldwin > From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 07:02:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9C34106564A; Sat, 4 Jun 2011 07:02:06 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9C7C8FC08; Sat, 4 Jun 2011 07:02:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p54726m7098339; Sat, 4 Jun 2011 07:02:06 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54726O6098336; Sat, 4 Jun 2011 07:02:06 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201106040702.p54726O6098336@svn.freebsd.org> From: Andriy Gapon Date: Sat, 4 Jun 2011 07:02:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222670 - in head/sys/cddl/compat/opensolaris: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 07:02:06 -0000 Author: avg Date: Sat Jun 4 07:02:06 2011 New Revision: 222670 URL: http://svn.freebsd.org/changeset/base/222670 Log: opensolaris compat / zfs: avoid early overflow in ddi_get_lbolt* Reported by: David P. Discher Tested by: will Reviewed by: art Discussed with: dwhite MFC after: 2 weeks Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris.c head/sys/cddl/compat/opensolaris/sys/time.h Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris.c Sat Jun 4 04:35:12 2011 (r222669) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris.c Sat Jun 4 07:02:06 2011 (r222670) @@ -40,6 +40,7 @@ cpu_core_t cpu_core[MAXCPU]; kmutex_t cpu_lock; solaris_cpu_t solaris_cpu[MAXCPU]; +int nsec_per_tick; /* * OpenSolaris subsystem initialisation. @@ -60,6 +61,8 @@ opensolaris_load(void *dummy) } mutex_init(&cpu_lock, "OpenSolaris CPU lock", MUTEX_DEFAULT, NULL); + + nsec_per_tick = NANOSEC / hz; } SYSINIT(opensolaris_register, SI_SUB_OPENSOLARIS, SI_ORDER_FIRST, opensolaris_load, NULL); Modified: head/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/time.h Sat Jun 4 04:35:12 2011 (r222669) +++ head/sys/cddl/compat/opensolaris/sys/time.h Sat Jun 4 07:02:06 2011 (r222670) @@ -62,8 +62,21 @@ gethrtime(void) { #define gethrestime(ts) getnanotime(ts) #define gethrtime_waitfree() gethrtime() -#define ddi_get_lbolt() ((gethrtime() * hz) / NANOSEC) -#define ddi_get_lbolt64() (int64_t)((gethrtime() * hz) / NANOSEC) +extern int nsec_per_tick; /* nanoseconds per clock tick */ + +static __inline int64_t +ddi_get_lbolt64(void) +{ + + return (gethrtime() / nsec_per_tick); +} + +static __inline clock_t +ddi_get_lbolt(void) +{ + + return (ddi_get_lbolt64()); +} #else From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 07:06:06 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C24D106566B; Sat, 4 Jun 2011 07:06:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B9C18FC0A; Sat, 4 Jun 2011 07:06:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p547667R098493; Sat, 4 Jun 2011 07:06:06 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54766Le098491; Sat, 4 Jun 2011 07:06:06 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201106040706.p54766Le098491@svn.freebsd.org> From: Warner Losh Date: Sat, 4 Jun 2011 07:06:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222671 - head/sys/mips/cavium X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 07:06:06 -0000 Author: imp Date: Sat Jun 4 07:06:05 2011 New Revision: 222671 URL: http://svn.freebsd.org/changeset/base/222671 Log: Add support for True IDE mode to the Octeon CF driver. This mode is signalled when the attribute address for the CF is 0 in the octeon sysinfo structure. In this mode, the DATA port is 16-bits, but the other ports are 8-bits, but on a 16-bit bus (so you have to access it a short at a time, but only believe the lower byte). See the code for more details on this slightly odd arrangement. I'm still not 100% happy with the abstractions here on many levels (starting with the globals for these settings, on down to no bus_space use, etc), but the driver had these problems before the change. Also, clean up the code a bit to make this support easier, and the code a bit easier to read. I tried to follow existing style, but may have missed a few spots. Add some comments. Fix probe/attach routine to return a proper error for the simulator. With this change, my EBH5200 eval board now recognizes the CF well enough to boot to the login prompt. Before it would say it never became ready. My CN3010-EVB-HS5 still boots properly. My older CN3860-based board won't load the 64-bit kernel, either before or after the change, and I didn't chase that down. Modified: head/sys/mips/cavium/octeon_ebt3000_cf.c Modified: head/sys/mips/cavium/octeon_ebt3000_cf.c ============================================================================== --- head/sys/mips/cavium/octeon_ebt3000_cf.c Sat Jun 4 07:02:06 2011 (r222670) +++ head/sys/mips/cavium/octeon_ebt3000_cf.c Sat Jun 4 07:06:05 2011 (r222671) @@ -104,12 +104,40 @@ __FBSDID("$FreeBSD$"); extern cvmx_bootinfo_t *octeon_bootinfo; /* Globals */ -int bus_width; +/* + * There's three bus types supported by this driver. + * + * CF_8 -- Traditional PC Card IDE interface on an 8-bit wide bus. We assume + * the bool loader has configure attribute memory properly. We then access + * the device like old-school 8-bit IDE card (which is all a traditional PC Card + * interface really is). + * CF_16 -- Traditional PC Card IDE interface on a 16-bit wide bus. Registers on + * this bus are 16-bits wide too. When accessing registers in the task file, you + * have to do it in 16-bit chunks, and worry about masking out what you don't want + * or ORing together the traditional 8-bit values. We assume the bootloader does + * the right attribute memory initialization dance. + * CF_TRUE_IDE_8 - CF Card wired to True IDE mode. There's no Attribute memory + * space at all. Instead all the traditional 8-bit registers are there, but + * on a 16-bit bus where addr0 isn't wired. This means we need to read/write them + * 16-bit chunks, but only the lower 8 bits are valid. We do not (and can not) + * access this like CF_16 with the comingled registers. Yet we can't access + * this like CF_8 because of the register offset. Except the TF_DATA register + * appears to be full width? + */ void *base_addr; +int bus_type; +#define CF_8 1 /* 8-bit bus, no offsets - PC Card */ +#define CF_16 2 /* 16-bit bus, registers shared - PC Card */ +#define CF_TRUE_IDE_8 3 /* 16-bit bus, only lower 8-bits, TrueIDE */ +const char *const cf_type[] = { + "impossible type", + "CF 8-bit", + "CF 16-bit", + "True IDE" +}; /* Device softc */ struct cf_priv { - device_t dev; struct drive_param *drive_param; @@ -230,9 +258,65 @@ static void cf_start (struct bio *bp) static int cf_ioctl (struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td) { - return (0); + return (0); +} + + +static uint8_t cf_inb_8(int port) +{ + /* + * Traditional 8-bit PC Card/CF bus access. + */ + if (bus_type == CF_8) { + volatile uint8_t *task_file = (volatile uint8_t *)base_addr; + return task_file[port]; + } + + /* + * True IDE access. lower 8 bits on a 16-bit bus (see above). + */ + volatile uint16_t *task_file = (volatile uint16_t *)base_addr; + return task_file[port] & 0xff; +} + +static void cf_outb_8(int port, uint8_t val) +{ + /* + * Traditional 8-bit PC Card/CF bus access. + */ + if (bus_type == CF_8) { + volatile uint8_t *task_file = (volatile uint8_t *)base_addr; + task_file[port] = val; + } + + /* + * True IDE access. lower 8 bits on a 16-bit bus (see above). + */ + volatile uint16_t *task_file = (volatile uint16_t *)base_addr; + task_file[port] = val & 0xff; +} + +static uint8_t cf_inb_16(int port) +{ + volatile uint16_t *task_file = (volatile uint16_t *)base_addr; + uint16_t val = task_file[port / 2]; + if (port & 1) + return (val >> 8) & 0xff; + return val & 0xff; +} + +static uint16_t cf_inw_16(int port) +{ + volatile uint16_t *task_file = (volatile uint16_t *)base_addr; + uint16_t val = task_file[port / 2]; + return val; } +static void cf_outw_16(int port, uint16_t val) +{ + volatile uint16_t *task_file = (volatile uint16_t *)base_addr; + task_file[port / 2] = val; +} /* ------------------------------------------------------------------- * * cf_cmd_read() * @@ -264,25 +348,29 @@ static int cf_cmd_read (uint32_t nr_sect return (error); } - if (bus_width == 8) { - volatile uint8_t *task_file = (volatile uint8_t*)base_addr; - volatile uint8_t dummy; + switch (bus_type) + { + case CF_8: for (count = 0; count < SECTOR_SIZE; count++) { - *ptr_8++ = task_file[TF_DATA]; - if ((count & 0xf) == 0) dummy = task_file[TF_STATUS]; + *ptr_8++ = cf_inb_8(TF_DATA); + if ((count & 0xf) == 0) + (void)cf_inb_8(TF_STATUS); } - } else { - volatile uint16_t *task_file = (volatile uint16_t*)base_addr; - volatile uint16_t dummy; + break; + case CF_TRUE_IDE_8: + case CF_16: + default: for (count = 0; count < SECTOR_SIZE; count+=2) { uint16_t temp; - temp = task_file[TF_DATA]; + temp = cf_inw_16(TF_DATA); *ptr_16++ = SWAP_SHORT(temp); - if ((count & 0xf) == 0) dummy = task_file[TF_STATUS/2]; + if ((count & 0xf) == 0) + (void)cf_inb_16(TF_STATUS); } + break; } - lba ++; + lba++; } #ifdef OCTEON_VISUAL_CF_0 octeon_led_write_char(0, ' '); @@ -320,28 +408,28 @@ static int cf_cmd_write (uint32_t nr_sec return (error); } - if (bus_width == 8) { - volatile uint8_t *task_file; - volatile uint8_t dummy; - - task_file = (volatile uint8_t *) base_addr; + switch (bus_type) + { + case CF_8: for (count = 0; count < SECTOR_SIZE; count++) { - task_file[TF_DATA] = *ptr_8++; - if ((count & 0xf) == 0) dummy = task_file[TF_STATUS]; + cf_outb_8(TF_DATA, *ptr_8++); + if ((count & 0xf) == 0) + (void)cf_inb_8(TF_STATUS); } - } else { - volatile uint16_t *task_file; - volatile uint16_t dummy; - - task_file = (volatile uint16_t *) base_addr; + break; + case CF_TRUE_IDE_8: + case CF_16: + default: for (count = 0; count < SECTOR_SIZE; count+=2) { uint16_t temp = *ptr_16++; - task_file[TF_DATA] = SWAP_SHORT(temp); - if ((count & 0xf) == 0) dummy = task_file[TF_STATUS/2]; + cf_outw_16(TF_DATA, SWAP_SHORT(temp)); + if ((count & 0xf) == 0) + (void)cf_inb_16(TF_STATUS); } + break; } - lba ++; + lba++; } #ifdef OCTEON_VISUAL_CF_1 octeon_led_write_char(1, ' '); @@ -361,59 +449,32 @@ static int cf_cmd_write (uint32_t nr_sec static int cf_cmd_identify (void) { int count; - uint8_t status; int error; - if (bus_width == 8) { - volatile uint8_t *task_file; - - task_file = (volatile uint8_t *) base_addr; - - while ((status = task_file[TF_STATUS]) & STATUS_BSY) { - DELAY(WAIT_DELAY); - } - - task_file[TF_SECTOR_COUNT] = 0; - task_file[TF_SECTOR_NUMBER] = 0; - task_file[TF_CYL_LSB] = 0; - task_file[TF_CYL_MSB] = 0; - task_file[TF_DRV_HEAD] = 0; - task_file[TF_COMMAND] = CMD_IDENTIFY; - - error = cf_wait_busy(); - if (error == 0) { - for (count = 0; count < SECTOR_SIZE; count++) - drive_param.u.buf[count] = task_file[TF_DATA]; - } - } else { - volatile uint16_t *task_file; - - task_file = (volatile uint16_t *) base_addr; - - while ((status = (task_file[TF_STATUS/2]>>8)) & STATUS_BSY) { - DELAY(WAIT_DELAY); - } - - task_file[TF_SECTOR_COUNT/2] = 0; /* this includes TF_SECTOR_NUMBER */ - task_file[TF_CYL_LSB/2] = 0; /* this includes TF_CYL_MSB */ - task_file[TF_DRV_HEAD/2] = 0 | (CMD_IDENTIFY<<8); /* this includes TF_COMMAND */ - - error = cf_wait_busy(); - if (error == 0) { - for (count = 0; count < SECTOR_SIZE; count+=2) { - uint16_t temp; - temp = task_file[TF_DATA]; - - /* endianess will be swapped below */ - drive_param.u.buf[count] = (temp & 0xff); - drive_param.u.buf[count+1] = (temp & 0xff00)>>8; - } - } - } + error = cf_send_cmd(0, CMD_IDENTIFY); if (error != 0) { printf("%s: identify failed: %d\n", __func__, error); return (error); } + switch (bus_type) + { + case CF_8: + for (count = 0; count < SECTOR_SIZE; count++) + drive_param.u.buf[count] = cf_inb_8(TF_DATA); + break; + case CF_TRUE_IDE_8: + case CF_16: + default: + for (count = 0; count < SECTOR_SIZE; count += 2) { + uint16_t temp; + temp = cf_inw_16(TF_DATA); + + /* endianess will be swapped below */ + drive_param.u.buf[count] = (temp & 0xff); + drive_param.u.buf[count + 1] = (temp & 0xff00) >> 8; + } + break; + } cf_swap_ascii(drive_param.u.driveid.model, drive_param.model); @@ -423,6 +484,7 @@ static int cf_cmd_identify (void) drive_param.sec_track = SWAP_SHORT (drive_param.u.driveid.current_sectors); drive_param.nr_sectors = (uint32_t)SWAP_SHORT (drive_param.u.driveid.lba_size_1) | ((uint32_t)SWAP_SHORT (drive_param.u.driveid.lba_size_2)); + printf("cf0: <%s> %lld sectors\n", drive_param.model, (long long)drive_param.nr_sectors); return (0); } @@ -437,37 +499,27 @@ static int cf_cmd_identify (void) */ static int cf_send_cmd (uint32_t lba, uint8_t cmd) { - uint8_t status; - - if (bus_width == 8) { - volatile uint8_t *task_file; - - task_file = (volatile uint8_t *) base_addr; - - while ( (status = task_file[TF_STATUS]) & STATUS_BSY) { + switch (bus_type) + { + case CF_8: + case CF_TRUE_IDE_8: + while (cf_inb_8(TF_STATUS) & STATUS_BSY) DELAY(WAIT_DELAY); - } - - task_file[TF_SECTOR_COUNT] = 1; - task_file[TF_SECTOR_NUMBER] = (lba & 0xff); - task_file[TF_CYL_LSB] = ((lba >> 8) & 0xff); - task_file[TF_CYL_MSB] = ((lba >> 16) & 0xff); - task_file[TF_DRV_HEAD] = ((lba >> 24) & 0xff) | 0xe0; - task_file[TF_COMMAND] = cmd; - - } else { - volatile uint16_t *task_file; - - task_file = (volatile uint16_t *) base_addr; - - while ( (status = (task_file[TF_STATUS/2]>>8)) & STATUS_BSY) { + cf_outb_8(TF_SECTOR_COUNT, 1); + cf_outb_8(TF_SECTOR_NUMBER, lba & 0xff); + cf_outb_8(TF_CYL_LSB, (lba >> 8) & 0xff); + cf_outb_8(TF_CYL_MSB, (lba >> 16) & 0xff); + cf_outb_8(TF_DRV_HEAD, ((lba >> 24) & 0xff) | 0xe0); + cf_outb_8(TF_COMMAND, cmd); + break; + case CF_16: + default: + while (cf_inb_16(TF_STATUS) & STATUS_BSY) DELAY(WAIT_DELAY); - } - - task_file[TF_SECTOR_COUNT/2] = 1 | ((lba & 0xff) << 8); - task_file[TF_CYL_LSB/2] = ((lba >> 8) & 0xff) | (((lba >> 16) & 0xff) << 8); - task_file[TF_DRV_HEAD/2] = (((lba >> 24) & 0xff) | 0xe0) | (cmd << 8); - + cf_outw_16(TF_SECTOR_COUNT, 1 | ((lba & 0xff) << 8)); + cf_outw_16(TF_CYL_LSB, ((lba >> 8) & 0xff) | (((lba >> 16) & 0xff) << 8)); + cf_outw_16(TF_DRV_HEAD, (((lba >> 24) & 0xff) | 0xe0) | (cmd << 8)); + break; } return (cf_wait_busy()); @@ -499,32 +551,32 @@ static int cf_wait_busy (void) octeon_led_run_wheel(&where0, 2); #endif - if (bus_width == 8) { - volatile uint8_t *task_file; - task_file = (volatile uint8_t *)base_addr; - - status = task_file[TF_STATUS]; + switch (bus_type) + { + case CF_8: + case CF_TRUE_IDE_8: + status = cf_inb_8(TF_STATUS); while ((status & STATUS_BSY) == STATUS_BSY) { if ((status & STATUS_DF) != 0) { printf("%s: device fault (status=%x)\n", __func__, status); return (EIO); } DELAY(WAIT_DELAY); - status = task_file[TF_STATUS]; + status = cf_inb_8(TF_STATUS); } - } else { - volatile uint16_t *task_file; - task_file = (volatile uint16_t *)base_addr; - - status = task_file[TF_STATUS/2]>>8; + break; + case CF_16: + default: + status = cf_inb_16(TF_STATUS); while ((status & STATUS_BSY) == STATUS_BSY) { if ((status & STATUS_DF) != 0) { printf("%s: device fault (status=%x)\n", __func__, status); return (EIO); } DELAY(WAIT_DELAY); - status = (uint8_t)(task_file[TF_STATUS/2]>>8); + status = cf_inb_16(TF_STATUS); } + break; } if ((status & STATUS_DRQ) == 0) { printf("%s: device not ready (status=%x)\n", __func__, status); @@ -550,9 +602,8 @@ static void cf_swap_ascii (unsigned char { int i; - for(i = 0; i < MODEL_STR_SIZE; i++) { - str2[i] = str1[i^1]; - } + for(i = 0; i < MODEL_STR_SIZE; i++) + str2[i] = str1[i ^ 1]; } @@ -562,7 +613,8 @@ static void cf_swap_ascii (unsigned char static int cf_probe (device_t dev) { - if (octeon_is_simulation()) return 1; + if (octeon_is_simulation()) + return (ENXIO); if (device_get_unit(dev) != 0) { panic("can't attach more devices\n"); @@ -582,9 +634,9 @@ static int cf_probe (device_t dev) * inserted. * */ +typedef unsigned long long llu; static void cf_identify (driver_t *drv, device_t parent) { - uint8_t status; int bus_region; int count = 0; cvmx_mio_boot_reg_cfgx_t cfg; @@ -599,34 +651,39 @@ static void cf_identify (driver_t *drv, cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(bus_region)); if (cfg.s.base == octeon_bootinfo->compact_flash_common_base_addr >> 16) { - bus_width = (cfg.s.width) ? 16: 8; - printf("Compact flash found in bootbus region %d (%d bit).\n", bus_region, bus_width); + if (octeon_bootinfo->compact_flash_attribute_base_addr == 0) + bus_type = CF_TRUE_IDE_8; + else + bus_type = (cfg.s.width) ? CF_16 : CF_8; + printf("Compact flash found in bootbus region %d (%s).\n", bus_region, cf_type[bus_type]); break; } } - if (bus_width == 8) { - volatile uint8_t *task_file; - task_file = (volatile uint8_t *) base_addr; + switch (bus_type) + { + case CF_8: + case CF_TRUE_IDE_8: /* Check if CF is inserted */ - while ( (status = task_file[TF_STATUS]) & STATUS_BSY){ - if ((count++) == NR_TRIES ) { + while (cf_inb_8(TF_STATUS) & STATUS_BSY) { + if ((count++) == NR_TRIES ) { printf("Compact Flash not present\n"); return; } DELAY(WAIT_DELAY); } - } else { - volatile uint16_t *task_file; - task_file = (volatile uint16_t *) base_addr; + break; + case CF_16: + default: /* Check if CF is inserted */ - while ( (status = (task_file[TF_STATUS/2]>>8)) & STATUS_BSY){ - if ((count++) == NR_TRIES ) { + while (cf_inb_16(TF_STATUS) & STATUS_BSY) { + if ((count++) == NR_TRIES ) { printf("Compact Flash not present\n"); return; } DELAY(WAIT_DELAY); } + break; } BUS_ADD_CHILD(parent, 0, "cf", 0); @@ -655,7 +712,7 @@ static int cf_attach_geom (void *arg, in * ------------------------------------------------------------------- */ static void cf_attach_geom_proxy (void *arg, int flag) { - cf_attach_geom(arg, flag); + cf_attach_geom(arg, flag); } @@ -668,7 +725,8 @@ static int cf_attach (device_t dev) { struct cf_priv *cf_priv; - if (octeon_is_simulation()) return 1; + if (octeon_is_simulation()) + return (ENXIO); cf_priv = device_get_softc(dev); cf_priv->dev = dev; @@ -701,4 +759,3 @@ static driver_t cf_driver = { static devclass_t cf_devclass; DRIVER_MODULE(cf, nexus, cf_driver, cf_devclass, 0, 0); - From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 08:24:58 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 891E21065675; Sat, 4 Jun 2011 08:24:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7934A8FC16; Sat, 4 Jun 2011 08:24:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p548Ow4t001087; Sat, 4 Jun 2011 08:24:58 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p548OwEv001085; Sat, 4 Jun 2011 08:24:58 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201106040824.p548OwEv001085@svn.freebsd.org> From: Adrian Chadd Date: Sat, 4 Jun 2011 08:24:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222672 - head/sys/dev/ath/ath_dfs/null X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 08:24:58 -0000 Author: adrian Date: Sat Jun 4 08:24:58 2011 New Revision: 222672 URL: http://svn.freebsd.org/changeset/base/222672 Log: Commit radar detection changes missed by my previous commit. Modified: head/sys/dev/ath/ath_dfs/null/dfs_null.c Modified: head/sys/dev/ath/ath_dfs/null/dfs_null.c ============================================================================== --- head/sys/dev/ath/ath_dfs/null/dfs_null.c Sat Jun 4 07:06:05 2011 (r222671) +++ head/sys/dev/ath/ath_dfs/null/dfs_null.c Sat Jun 4 08:24:58 2011 (r222672) @@ -107,7 +107,7 @@ ath_dfs_radar_enable(struct ath_softc *s * Process DFS related PHY errors */ void -ath_dfs_process_phy_err(struct ath_softc *sc, struct ath_desc *ds, +ath_dfs_process_phy_err(struct ath_softc *sc, const char *buf, uint64_t tsf, struct ath_rx_status *rxstat) { From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 09:19:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BE2D1065672; Sat, 4 Jun 2011 09:19:53 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BC8D8FC13; Sat, 4 Jun 2011 09:19: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 p549JrHO002740; Sat, 4 Jun 2011 09:19:53 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p549Jr0f002738; Sat, 4 Jun 2011 09:19:53 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201106040919.p549Jr0f002738@svn.freebsd.org> From: Andreas Tobler Date: Sat, 4 Jun 2011 09:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222673 - head/sys/dev/iicbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 09:19:53 -0000 Author: andreast Date: Sat Jun 4 09:19:53 2011 New Revision: 222673 URL: http://svn.freebsd.org/changeset/base/222673 Log: Replace the FCU_ZERO_C_TO_K with the ZERO_C_TO_K from powermac_thermal.h. Approved by: nwhitehorn (mentor) Modified: head/sys/dev/iicbus/ds1775.c Modified: head/sys/dev/iicbus/ds1775.c ============================================================================== --- head/sys/dev/iicbus/ds1775.c Sat Jun 4 08:24:58 2011 (r222672) +++ head/sys/dev/iicbus/ds1775.c Sat Jun 4 09:19:53 2011 (r222673) @@ -51,8 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define FCU_ZERO_C_TO_K 2732 - /* Drivebay sensor: LM75/DS1775. */ #define DS1775_TEMP 0x0 @@ -211,12 +209,12 @@ ds1775_start(void *xdev) /* Make up target temperatures. These are low, for the drive bay. */ if (sc->sc_sensor.zone == 0) { - sc->sc_sensor.target_temp = 500 + FCU_ZERO_C_TO_K; - sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K; + sc->sc_sensor.target_temp = 500 + ZERO_C_TO_K; + sc->sc_sensor.max_temp = 600 + ZERO_C_TO_K; } else { - sc->sc_sensor.target_temp = 300 + FCU_ZERO_C_TO_K; - sc->sc_sensor.max_temp = 600 + FCU_ZERO_C_TO_K; + sc->sc_sensor.target_temp = 300 + ZERO_C_TO_K; + sc->sc_sensor.max_temp = 600 + ZERO_C_TO_K; } sc->sc_sensor.read = @@ -248,7 +246,7 @@ ds1775_sensor_read(struct ds1775_softc * /* The default mode of the ADC is 9 bit, the resolution is 0.5 C per bit. The temperature is in tenth kelvin. */ - return (((int16_t)(read) >> 7) * 5 + FCU_ZERO_C_TO_K); + return (((int16_t)(read) >> 7) * 5 + ZERO_C_TO_K); } static int From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 09:23:55 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51127106564A; Sat, 4 Jun 2011 09:23:55 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 373188FC12; Sat, 4 Jun 2011 09:23:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p549NtAi002922; Sat, 4 Jun 2011 09:23:55 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p549NtXE002920; Sat, 4 Jun 2011 09:23:55 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201106040923.p549NtXE002920@svn.freebsd.org> From: Andreas Tobler Date: Sat, 4 Jun 2011 09:23:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222674 - head/sys/dev/iicbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 09:23:55 -0000 Author: andreast Date: Sat Jun 4 09:23:54 2011 New Revision: 222674 URL: http://svn.freebsd.org/changeset/base/222674 Log: - Improve error handling. - Add a retry loop for the i2c sensor reading. - Check on busy status of the chip and on invalid values. - Fix a typo in a comment. - Replace the constant 2732 with the ZERO_C_TO_K macro. Approved by: nwhitehorn (mentor) Modified: head/sys/dev/iicbus/max6690.c Modified: head/sys/dev/iicbus/max6690.c ============================================================================== --- head/sys/dev/iicbus/max6690.c Sat Jun 4 09:19:53 2011 (r222673) +++ head/sys/dev/iicbus/max6690.c Sat Jun 4 09:23:54 2011 (r222674) @@ -51,12 +51,11 @@ __FBSDID("$FreeBSD$"); #include #include -#define FCU_ZERO_C_TO_K 2732 - /* Inlet, Backside, U3 Heatsink sensor: MAX6690. */ #define MAX6690_INT_TEMP 0x0 #define MAX6690_EXT_TEMP 0x1 +#define MAX6690_RSL_STATUS 0x2 #define MAX6690_EEXT_TEMP 0x10 #define MAX6690_IEXT_TEMP 0x11 #define MAX6690_TEMP_MASK 0xe0 @@ -76,8 +75,8 @@ static int max6690_attach(device_t); static int max6690_sensor_read(struct max6690_sensor *sens); static int max6690_sensor_sysctl(SYSCTL_HANDLER_ARGS); static void max6690_start(void *xdev); -static int max6690_read_1(device_t dev, uint32_t addr, uint8_t reg, - uint8_t *data); +static int max6690_read(device_t dev, uint32_t addr, uint8_t reg, + uint8_t *data); struct max6690_softc { device_t sc_dev; @@ -105,23 +104,43 @@ DRIVER_MODULE(max6690, iicbus, max6690_d MALLOC_DEFINE(M_MAX6690, "max6690", "Temp-Monitor MAX6690"); static int -max6690_read_1(device_t dev, uint32_t addr, uint8_t reg, uint8_t *data) +max6690_read(device_t dev, uint32_t addr, uint8_t reg, uint8_t *data) { uint8_t buf[4]; + uint8_t busy[1], rsl; + int err, try = 0; - struct iic_msg msg[2] = { + /* Busy register RSL. */ + rsl = MAX6690_RSL_STATUS; + /* first read the status register, 0x2. If busy, retry. */ + struct iic_msg msg[4] = { + { addr, IIC_M_WR | IIC_M_NOSTOP, 1, &rsl }, + { addr, IIC_M_RD, 1, busy }, { addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® }, { addr, IIC_M_RD, 1, buf }, }; - if (iicbus_transfer(dev, msg, 2) != 0) { - device_printf(dev, "iicbus read failed\n"); - return (EIO); + for (;;) + { + err = iicbus_transfer(dev, msg, 4); + if (err != 0) + goto retry; + if (busy[0] & 0x80) + goto retry; + /* Check for invalid value and retry. */ + if (buf[0] == 0xff) + goto retry; + + *data = *((uint8_t*)buf); + return (0); + + retry: + if (++try > 5) { + device_printf(dev, "iicbus read failed\n"); + return (-1); + } + pause("max6690_read", hz); } - - *data = *((uint8_t*)buf); - - return (0); } static int @@ -193,8 +212,8 @@ max6690_fill_sensor_prop(device_t dev) for (j = 0; j < i; j++) { sc->sc_sensors[j].dev = dev; - sc->sc_sensors[j].therm.target_temp = 400 + 2732; - sc->sc_sensors[j].therm.max_temp = 800 + 2732; + sc->sc_sensors[j].therm.target_temp = 400 + ZERO_C_TO_K; + sc->sc_sensors[j].therm.max_temp = 800 + ZERO_C_TO_K; sc->sc_sensors[j].therm.read = (int (*)(struct pmac_therm *))(max6690_sensor_read); @@ -302,14 +321,15 @@ static int max6690_sensor_read(struct max6690_sensor *sens) { uint8_t reg_int = 0, reg_ext = 0; - uint8_t integer; - uint8_t fraction; - int temp; + uint8_t integer = 0; + uint8_t fraction = 0; + int err, temp; + struct max6690_softc *sc; sc = device_get_softc(sens->dev); - /* The internal sensor id's are even, the external ar odd. */ + /* The internal sensor id's are even, the external are odd. */ if ((sens->id % 2) == 0) { reg_int = MAX6690_INT_TEMP; reg_ext = MAX6690_IEXT_TEMP; @@ -318,9 +338,11 @@ max6690_sensor_read(struct max6690_senso reg_ext = MAX6690_EEXT_TEMP; } - max6690_read_1(sc->sc_dev, sc->sc_addr, reg_int, &integer); + err = max6690_read(sc->sc_dev, sc->sc_addr, reg_int, &integer); + err = max6690_read(sc->sc_dev, sc->sc_addr, reg_ext, &fraction); - max6690_read_1(sc->sc_dev, sc->sc_addr, reg_ext, &fraction); + if (err < 0) + return (-1); fraction &= MAX6690_TEMP_MASK; @@ -329,7 +351,7 @@ max6690_sensor_read(struct max6690_senso */ temp = (integer * 10) + (fraction >> 5) * 10 / 8; - return (temp + FCU_ZERO_C_TO_K); + return (temp + ZERO_C_TO_K); } static int From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 09:25:59 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5D28106566C; Sat, 4 Jun 2011 09:25:59 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D529F8FC13; Sat, 4 Jun 2011 09:25: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 p549PxTn003021; Sat, 4 Jun 2011 09:25:59 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p549PxwC003019; Sat, 4 Jun 2011 09:25:59 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201106040925.p549PxwC003019@svn.freebsd.org> From: Andreas Tobler Date: Sat, 4 Jun 2011 09:25:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222675 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 09:26:00 -0000 Author: andreast Date: Sat Jun 4 09:25:59 2011 New Revision: 222675 URL: http://svn.freebsd.org/changeset/base/222675 Log: - Improve error handling. - Add retry loops for the i2c read/write functions. Approved by: nwhitehorn (mentor) Modified: head/sys/powerpc/powermac/fcu.c Modified: head/sys/powerpc/powermac/fcu.c ============================================================================== --- head/sys/powerpc/powermac/fcu.c Sat Jun 4 09:23:54 2011 (r222674) +++ head/sys/powerpc/powermac/fcu.c Sat Jun 4 09:25:59 2011 (r222675) @@ -138,6 +138,8 @@ fcu_write(device_t dev, uint32_t addr, u int len) { unsigned char buf[4]; + int try = 0; + struct iic_msg msg[] = { { addr, IIC_M_WR, 0, buf } }; @@ -145,33 +147,46 @@ fcu_write(device_t dev, uint32_t addr, u msg[0].len = len + 1; buf[0] = reg; memcpy(buf + 1, buff, len); - if (iicbus_transfer(dev, msg, 1) != 0) { - device_printf(dev, "iicbus write failed\n"); - return (EIO); - } - return (0); + for (;;) + { + if (iicbus_transfer(dev, msg, 1) == 0) + return (0); + if (++try > 5) { + device_printf(dev, "iicbus write failed\n"); + return (-1); + } + pause("fcu_write", hz); + } } static int fcu_read_1(device_t dev, uint32_t addr, uint8_t reg, uint8_t *data) { uint8_t buf[4]; + int err, try = 0; struct iic_msg msg[2] = { { addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® }, { addr, IIC_M_RD, 1, buf }, }; - if (iicbus_transfer(dev, msg, 2) != 0) { - device_printf(dev, "iicbus read failed\n"); - return (EIO); + for (;;) + { + err = iicbus_transfer(dev, msg, 2); + if (err != 0) + goto retry; + + *data = *((uint8_t*)buf); + return (0); + retry: + if (++try > 5) { + device_printf(dev, "iicbus read failed\n"); + return (-1); + } + pause("fcu_read_1", hz); } - - *data = *((uint8_t*)buf); - - return (0); } static int @@ -267,13 +282,14 @@ fcu_fan_set_rpm(struct fcu_fan *fan, int fan->setpoint = rpm; } else { device_printf(fan->dev, "Unknown fan type: %d\n", fan->type); - return (EIO); + return (-1); } buf[0] = rpm >> (8 - fcu_rpm_shift); buf[1] = rpm << fcu_rpm_shift; - fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2); + if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2) < 0) + return (-1); return (0); } @@ -292,7 +308,8 @@ fcu_fan_get_rpm(struct fcu_fan *fan) if (fan->type == FCU_FAN_RPM) { /* Check if the fan is available. */ reg = FCU_RPM_AVAILABLE; - fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &avail); + if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &avail) < 0) + return (-1); if ((avail & (1 << fan->id)) == 0) { device_printf(fan->dev, "RPM Fan not available ID: %d\n", fan->id); @@ -300,7 +317,8 @@ fcu_fan_get_rpm(struct fcu_fan *fan) } /* Check if we have a failed fan. */ reg = FCU_RPM_FAIL; - fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &fail); + if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &fail) < 0) + return (-1); if ((fail & (1 << fan->id)) != 0) { device_printf(fan->dev, "RPM Fan failed ID: %d\n", fan->id); @@ -308,7 +326,8 @@ fcu_fan_get_rpm(struct fcu_fan *fan) } /* Check if fan is active. */ reg = FCU_RPM_ACTIVE; - fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &active); + if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &active) < 0) + return (-1); if ((active & (1 << fan->id)) == 0) { device_printf(fan->dev, "RPM Fan not active ID: %d\n", fan->id); @@ -322,7 +341,8 @@ fcu_fan_get_rpm(struct fcu_fan *fan) } /* It seems that we can read the fans rpm. */ - fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buff); + if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buff) < 0) + return (-1); rpm = (buff[0] << (8 - fcu_rpm_shift)) | buff[1] >> fcu_rpm_shift; @@ -356,8 +376,8 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int buf[0] = (pwm * 2550) / 1000; - fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1); - + if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1) < 0) + return (-1); return (0); } @@ -374,26 +394,29 @@ fcu_fan_get_pwm(device_t dev, struct fcu if (fan->type == FCU_FAN_PWM) { /* Check if the fan is available. */ reg = FCU_PWM_AVAILABLE; - fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &avail); + if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &avail) < 0) + return (-1); if ((avail & (1 << fan->id)) == 0) { device_printf(dev, "PWM Fan not available ID: %d\n", fan->id); - return (EIO); + return (-1); } /* Check if we have a failed fan. */ reg = FCU_PWM_FAIL; - fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &fail); + if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &fail) < 0) + return (-1); if ((fail & (1 << fan->id)) != 0) { device_printf(dev, "PWM Fan failed ID: %d\n", fan->id); - return (EIO); + return (-1); } /* Check if fan is active. */ reg = FCU_PWM_ACTIVE; - fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &active); + if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, &active) < 0) + return (-1); if ((active & (1 << fan->id)) == 0) { device_printf(dev, "PWM Fan not active ID: %d\n", fan->id); - return (ENXIO); + return (-1); } reg = FCU_PWM_SGET(fan->id); } else { @@ -402,13 +425,16 @@ fcu_fan_get_pwm(device_t dev, struct fcu } /* It seems that we can read the fans pwm. */ - fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buf); + if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buf) < 0) + return (-1); *pwm = (buf[0] * 1000) / 2550; /* Now read the rpm. */ reg = FCU_PWM_RPM(fan->id); - fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buf); + if (fcu_read_1(sc->sc_dev, sc->sc_addr, reg, buf) < 0) + return (-1); + *rpm = (buf[0] << (8 - fcu_rpm_shift)) | buf[1] >> fcu_rpm_shift; return (0); @@ -502,16 +528,20 @@ fcu_fanrpm_sysctl(SYSCTL_HANDLER_ARGS) device_t fcu; struct fcu_softc *sc; struct fcu_fan *fan; - int rpm = 0, pwm = 0, error; + int rpm = 0, pwm = 0, error = 0; fcu = arg1; sc = device_get_softc(fcu); fan = &sc->sc_fans[arg2 & 0x00ff]; if (fan->type == FCU_FAN_RPM) { rpm = fcu_fan_get_rpm(fan); + if (rpm < 0) + return (-1); error = sysctl_handle_int(oidp, &rpm, 0, req); } else { - fcu_fan_get_pwm(fcu, fan, &pwm, &rpm); + error = fcu_fan_get_pwm(fcu, fan, &pwm, &rpm); + if (error < 0) + return (-1); switch (arg2 & 0xff00) { case FCU_PWM_SYSCTL_PWM: From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 09:45:46 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AAF3106564A; Sat, 4 Jun 2011 09:45:46 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id 715C18FC08; Sat, 4 Jun 2011 09:45:44 +0000 (UTC) Received: from deuterium.andreas.nets (dhclient-91-190-8-131.flashcable.ch [91.190.8.131]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id p549jeds022080; Sat, 4 Jun 2011 11:45:41 +0200 (CEST) (envelope-from andreast@FreeBSD.org) Message-ID: <4DE9FEC4.4020507@FreeBSD.org> Date: Sat, 04 Jun 2011 11:45:40 +0200 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: Henrik Brix Andersen References: <201105291425.p4TEPggZ033861@svn.freebsd.org> <9F1CE0EF-CCA6-4A8A-8FE1-2E593626025A@FreeBSD.org> In-Reply-To: <9F1CE0EF-CCA6-4A8A-8FE1-2E593626025A@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andreas Tobler Subject: Re: svn commit: r222449 - in head/sys: conf dev/iicbus powerpc/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 09:45:46 -0000 Hi, sorry for the delay. On 29.05.11 17:10, Henrik Brix Andersen wrote: > Hi, > > On May 29, 2011, at 16:25, Andreas Tobler wrote: >> Author: andreast >> Date: Sun May 29 14:25:42 2011 >> New Revision: 222449 >> URL: http://svn.freebsd.org/changeset/base/222449 >> >> Log: >> Add a new driver, the ad7417, to read temperatures and voltages on some >> PowerMac's. >> >> Approved by: nwhitehorn (mentor) >> >> Added: >> head/sys/dev/iicbus/ad7417.c (contents, props changed) >> Modified: >> head/sys/conf/files.powerpc >> head/sys/powerpc/conf/GENERIC >> head/sys/powerpc/conf/GENERIC64 >> head/sys/powerpc/conf/NOTES > > Since this driver is powerpc-only (the chip is not powerpc-specific - but this driver depends on OFW?) shouldn't it live somewhere under sys/powerpc/ instead of the generic sys/dev/iicbus/? > > Or perhaps be rewritten to a more generic form? The chip itself is not PowerMac specific. It contains four times the functionality of the ad7418 which is already in there. (dev/iicbus) The ofw is only needed to detect the chip and to wire the sensor place to the right fan property. I think this could be refactored that it is PowerMac only and others could benefit from the driver too. The same would apply for the ds1775.c and the max6690.c. Those chips are not PowerMac only, they are simple i2c temp sensors. To get there, it would really be helpful if there are other people with non PowerMac hardware who would have an interest in these drivers. Then we could sit together, refactor and test. W/o the corresponding hardware it seems a bit difficult for me to test. A few months ago I asked on hackers@ how I could combine those two drivers. I got no feedback. Now we're heading towards 9.0 and we (nwhitehorn@) wanted to get this driver in. We need these drivers to run certain G5 PowerMac's in a silent mode. W/o we have a swarm of bees which makes it very hard to concentrate ;) Gruss, Andreas From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 10:01:49 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8DEE106564A; Sat, 4 Jun 2011 10:01:49 +0000 (UTC) (envelope-from brix@FreeBSD.org) Received: from solow.pil.dk (relay.pil.dk [195.41.47.164]) by mx1.freebsd.org (Postfix) with ESMTP id 74E148FC1B; Sat, 4 Jun 2011 10:01:49 +0000 (UTC) Received: from druadan.brixandersen.dk (0x55534f5f.adsl.cybercity.dk [85.83.79.95]) by solow.pil.dk (Postfix) with ESMTPA id 961E21CC016; Sat, 4 Jun 2011 12:01:47 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-7-309506294" From: Henrik Brix Andersen In-Reply-To: <4DE9FEC4.4020507@FreeBSD.org> Date: Sat, 4 Jun 2011 12:01:44 +0200 Content-Transfer-Encoding: 7bit Message-Id: References: <201105291425.p4TEPggZ033861@svn.freebsd.org> <9F1CE0EF-CCA6-4A8A-8FE1-2E593626025A@FreeBSD.org> <4DE9FEC4.4020507@FreeBSD.org> To: Andreas Tobler X-Pgp-Agent: GPGMail 1.3.3 X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r222449 - in head/sys: conf dev/iicbus powerpc/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 10:01:49 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-7-309506294 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi, On Jun 4, 2011, at 11:45, Andreas Tobler wrote: > The chip itself is not PowerMac specific. It contains four times the = functionality of the ad7418 which is already in there. (dev/iicbus) >=20 > The ofw is only needed to detect the chip and to wire the sensor place = to the right fan property. I think this could be refactored that it is = PowerMac only and others could benefit from the driver too. Right. Since iicbus(4) is a hinted bus, I believe the current scenario = could be improved either by having a dynamic hints system (and an OFW = specific layer that added hints about known devices at runtime) or = perhaps an OFW iicbus subclass (didn't Nathan start on this in = r186833?). > The same would apply for the ds1775.c and the max6690.c. Those chips = are not PowerMac only, they are simple i2c temp sensors. Agreed. > To get there, it would really be helpful if there are other people = with non PowerMac hardware who would have an interest in these drivers. > Then we could sit together, refactor and test. W/o the corresponding = hardware it seems a bit difficult for me to test. I'd love to help. I'll try getting my hands on the raw chips and wire = them up to my glxiic(4) based lab setup. I'll get back to you then. Brix --=20 Henrik Brix Andersen --Apple-Mail-7-309506294 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iEYEARECAAYFAk3qAogACgkQv+Q4flTiePjYsACgi/0L7Gmxty4Sjs7KVUP0viyq EbsAnRw2jlghTLvJuMuOblsjKe4WD0j0 =Uixd -----END PGP SIGNATURE----- --Apple-Mail-7-309506294-- From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 10:23:08 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C47E0106566C; Sat, 4 Jun 2011 10:23:08 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mail.vx.sk (mail.vx.sk [IPv6:2a01:4f8:100:1043::3]) by mx1.freebsd.org (Postfix) with ESMTP id 5B4858FC08; Sat, 4 Jun 2011 10:23:08 +0000 (UTC) Received: from core.vx.sk (localhost [127.0.0.1]) by mail.vx.sk (Postfix) with ESMTP id 83879177F61; Sat, 4 Jun 2011 12:23:07 +0200 (CEST) X-Virus-Scanned: amavisd-new at mail.vx.sk Received: from mail.vx.sk ([127.0.0.1]) by core.vx.sk (mail.vx.sk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id BoRSDHy8mEWt; Sat, 4 Jun 2011 12:23:01 +0200 (CEST) Received: from [10.9.8.1] (chello085216231078.chello.sk [85.216.231.78]) by mail.vx.sk (Postfix) with ESMTPSA id 88178177F47; Sat, 4 Jun 2011 12:23:01 +0200 (CEST) Message-ID: <4DEA0785.3040707@FreeBSD.org> Date: Sat, 04 Jun 2011 12:23:01 +0200 From: Martin Matuska User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; sk; rv:1.8.1.23) Gecko/20090812 Lightning/0.9 Thunderbird/2.0.0.23 Mnenhy/0.7.5.0 MIME-Version: 1.0 To: Andriy Gapon References: <201106040702.p54726O6098336@svn.freebsd.org> In-Reply-To: <201106040702.p54726O6098336@svn.freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek Subject: Re: svn commit: r222670 - in head/sys/cddl/compat/opensolaris: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 10:23:09 -0000 If we are "fixing" this, what about following pjd's rules and moving in direction vendor code (reducing diff)? Or is it too expensive? If that way: a) the nsec_per_tick is defined in vendor code "usr/src/uts/common/conf/param.c". Maybe we should define it at least in sys/cddl/compat/opensolaris/sys/param.h and not in time.h b) sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c might contain the functions as in vendor code (uts/common/os/sunddi.c): clock_t ddi_get_lbolt(void) { return ((clock_t)lbolt_hybrid()); } int64_t ddi_get_lbolt64(void) { return (lbolt_hybrid()); } c) sys/cddl/compat/opensolaris/sys/time.h: extern clock_t ddi_get_lbolt(void); extern int64_t ddi_get_lbolt64(void); d) we might want a new file called sys/cddl/compat/opensolaris/kern/opensolaris_clock.c (uts/common/os/clock.c): int64_t lbolt_hybrid(void) { return (gethrtime() / nsec_per_tick); } The d) step with lbolt_hybrid might be omitted and the function result integrated directly into opensolaris_sunddi.c. Bud regardless of that, notice the clock_t cast in ddi_get_lbolt(). mm Dňa 04.06.2011 09:02, Andriy Gapon wrote / napísal(a): > Author: avg > Date: Sat Jun 4 07:02:06 2011 > New Revision: 222670 > URL: http://svn.freebsd.org/changeset/base/222670 > > Log: > opensolaris compat / zfs: avoid early overflow in ddi_get_lbolt* > > Reported by: David P. Discher > Tested by: will > Reviewed by: art > Discussed with: dwhite > MFC after: 2 weeks > > Modified: > head/sys/cddl/compat/opensolaris/kern/opensolaris.c > head/sys/cddl/compat/opensolaris/sys/time.h > > Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris.c > ============================================================================== > --- head/sys/cddl/compat/opensolaris/kern/opensolaris.c Sat Jun 4 04:35:12 2011 (r222669) > +++ head/sys/cddl/compat/opensolaris/kern/opensolaris.c Sat Jun 4 07:02:06 2011 (r222670) > @@ -40,6 +40,7 @@ > cpu_core_t cpu_core[MAXCPU]; > kmutex_t cpu_lock; > solaris_cpu_t solaris_cpu[MAXCPU]; > +int nsec_per_tick; > > /* > * OpenSolaris subsystem initialisation. > @@ -60,6 +61,8 @@ opensolaris_load(void *dummy) > } > > mutex_init(&cpu_lock, "OpenSolaris CPU lock", MUTEX_DEFAULT, NULL); > + > + nsec_per_tick = NANOSEC / hz; > } > > SYSINIT(opensolaris_register, SI_SUB_OPENSOLARIS, SI_ORDER_FIRST, opensolaris_load, NULL); > > Modified: head/sys/cddl/compat/opensolaris/sys/time.h > ============================================================================== > --- head/sys/cddl/compat/opensolaris/sys/time.h Sat Jun 4 04:35:12 2011 (r222669) > +++ head/sys/cddl/compat/opensolaris/sys/time.h Sat Jun 4 07:02:06 2011 (r222670) > @@ -62,8 +62,21 @@ gethrtime(void) { > #define gethrestime(ts) getnanotime(ts) > #define gethrtime_waitfree() gethrtime() > > -#define ddi_get_lbolt() ((gethrtime() * hz) / NANOSEC) > -#define ddi_get_lbolt64() (int64_t)((gethrtime() * hz) / NANOSEC) > +extern int nsec_per_tick; /* nanoseconds per clock tick */ > + > +static __inline int64_t > +ddi_get_lbolt64(void) > +{ > + > + return (gethrtime() / nsec_per_tick); > +} > + > +static __inline clock_t > +ddi_get_lbolt(void) > +{ > + > + return (ddi_get_lbolt64()); > +} > > #else > From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 11:28:42 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AAB7106564A; Sat, 4 Jun 2011 11:28:42 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A4A68FC16; Sat, 4 Jun 2011 11:28: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 p54BSgDk008119; Sat, 4 Jun 2011 11:28:42 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54BSgDj008116; Sat, 4 Jun 2011 11:28:42 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106041128.p54BSgDj008116@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 4 Jun 2011 11:28:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222676 - in head: bin/sh tools/regression/bin/sh/execution X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 11:28:42 -0000 Author: jilles Date: Sat Jun 4 11:28:42 2011 New Revision: 222676 URL: http://svn.freebsd.org/changeset/base/222676 Log: sh: Honour -n while processing -c string. Added: head/tools/regression/bin/sh/execution/set-n4.0 (contents, props changed) Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sat Jun 4 09:25:59 2011 (r222675) +++ head/bin/sh/eval.c Sat Jun 4 11:28:42 2011 (r222676) @@ -165,7 +165,7 @@ evalstring(char *s, int flags) setstackmark(&smark); setinputstring(s, 1); while ((n = parsecmd(0)) != NEOF) { - if (n != NULL) { + if (n != NULL && !nflag) { if (flags_exit && preadateof()) evaltree(n, flags | EV_EXIT); else Added: head/tools/regression/bin/sh/execution/set-n4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/set-n4.0 Sat Jun 4 11:28:42 2011 (r222676) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +$SH -nc 'echo bad' From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 11:43:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 684A01065670; Sat, 4 Jun 2011 11:43:10 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EE838FC12; Sat, 4 Jun 2011 11:43:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p54BhAHJ008661; Sat, 4 Jun 2011 11:43:10 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54BhAar008659; Sat, 4 Jun 2011 11:43:10 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201106041143.p54BhAar008659@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 4 Jun 2011 11:43:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222679 - head/sys/dev/iwn X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 11:43:10 -0000 Author: bschmidt Date: Sat Jun 4 11:43:09 2011 New Revision: 222679 URL: http://svn.freebsd.org/changeset/base/222679 Log: The firmware of 4965 series adapters seems to die while trying to send probe requests at 1Mbps while being associated on a 5GHz channel. Sending those at 6Mbps does work, so use that instead during a background scan. This workaround allows us to re-enable background scan support for the 4965 adapters. Also, just enabling one antenna on 5GHz results in better reception of beacons: test 00:26:5a:c6:14:1a 40 54M -71:-95 200 E WME HTCAP ATH vs test 00:26:5a:c6:14:1a 40 54M -92:-95 200 E WME HTCAP ATH Due to roam:rssi thresholds set to 7 by default it might have been impossible to associate to that network. While here use IEEE80211_IS_CHAN_5GHZ() to determine the band. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sat Jun 4 11:30:12 2011 (r222678) +++ head/sys/dev/iwn/if_iwn.c Sat Jun 4 11:43:09 2011 (r222679) @@ -567,6 +567,7 @@ iwn_attach(device_t dev) ic->ic_caps = IEEE80211_C_STA /* station mode supported */ | IEEE80211_C_MONITOR /* monitor mode supported */ + | IEEE80211_C_BGSCAN /* background scanning */ | IEEE80211_C_TXPMGT /* tx power management */ | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_WPA @@ -576,8 +577,6 @@ iwn_attach(device_t dev) #endif | IEEE80211_C_WME /* WME */ ; - if (sc->hw_type != IWN_HW_REV_TYPE_4965) - ic->ic_caps |= IEEE80211_C_BGSCAN; /* background scanning */ /* Read MAC address, channels, etc from EEPROM. */ if ((error = iwn_read_eeprom(sc, macaddr)) != 0) { @@ -5161,7 +5160,7 @@ iwn_scan(struct iwn_softc *sc) if (IEEE80211_IS_CHAN_A(ic->ic_curchan) && sc->hw_type == IWN_HW_REV_TYPE_4965) { /* Ant A must be avoided in 5GHz because of an HW bug. */ - rxchain |= IWN_RXCHAIN_FORCE_SEL(IWN_ANT_BC); + rxchain |= IWN_RXCHAIN_FORCE_SEL(IWN_ANT_B); } else /* Use all available RX antennas. */ rxchain |= IWN_RXCHAIN_FORCE_SEL(sc->rxchainmask); hdr->rxchain = htole16(rxchain); @@ -5172,14 +5171,19 @@ iwn_scan(struct iwn_softc *sc) tx->id = sc->broadcast_id; tx->lifetime = htole32(IWN_LIFETIME_INFINITE); - if (IEEE80211_IS_CHAN_A(ic->ic_curchan)) { + if (IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan)) { /* Send probe requests at 6Mbps. */ tx->rate = htole32(0xd); rs = &ic->ic_sup_rates[IEEE80211_MODE_11A]; } else { hdr->flags = htole32(IWN_RXON_24GHZ | IWN_RXON_AUTO); - /* Send probe requests at 1Mbps. */ - tx->rate = htole32(10 | IWN_RFLAG_CCK); + if (sc->hw_type == IWN_HW_REV_TYPE_4965 && + sc->rxon.associd && sc->rxon.chan > 14) + tx->rate = htole32(0xd); + else { + /* Send probe requests at 1Mbps. */ + tx->rate = htole32(10 | IWN_RFLAG_CCK); + } rs = &ic->ic_sup_rates[IEEE80211_MODE_11G]; } /* Use the first valid TX antenna. */ From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 11:56:20 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF9CC106566B; Sat, 4 Jun 2011 11:56:20 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFD738FC0A; Sat, 4 Jun 2011 11:56: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 p54BuK67009086; Sat, 4 Jun 2011 11:56:20 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54BuKJl009084; Sat, 4 Jun 2011 11:56:20 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201106041156.p54BuKJl009084@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 4 Jun 2011 11:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222680 - head/sys/dev/iwn X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 11:56:21 -0000 Author: bschmidt Date: Sat Jun 4 11:56:20 2011 New Revision: 222680 URL: http://svn.freebsd.org/changeset/base/222680 Log: Only consider QoS frames for TX packet aggregation. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sat Jun 4 11:43:09 2011 (r222679) +++ head/sys/dev/iwn/if_iwn.c Sat Jun 4 11:56:20 2011 (r222680) @@ -3314,7 +3314,8 @@ iwn_tx_data(struct iwn_softc *sc, struct } ac = M_WME_GETAC(m); - if (IEEE80211_AMPDU_RUNNING(&ni->ni_tx_ampdu[ac])) { + if (IEEE80211_QOS_HAS_SEQ(wh) && + IEEE80211_AMPDU_RUNNING(&ni->ni_tx_ampdu[ac])) { struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[ac]; ring = &sc->txq[*(int *)tap->txa_private]; From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 12:51:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 933FD106564A; Sat, 4 Jun 2011 12:51:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8387C8FC0A; Sat, 4 Jun 2011 12:51: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 p54CpM4R010787; Sat, 4 Jun 2011 12:51:22 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54CpM8u010785; Sat, 4 Jun 2011 12:51:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201106041251.p54CpM8u010785@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 4 Jun 2011 12:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222681 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 12:51:22 -0000 Author: bz Date: Sat Jun 4 12:51:22 2011 New Revision: 222681 URL: http://svn.freebsd.org/changeset/base/222681 Log: Fix resolv.conf search list creation: 1) do not print out an empty "search ", things do not like it. 2) the search list is not comma separated. Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems Modified: head/usr.sbin/bsdinstall/scripts/netconfig Modified: head/usr.sbin/bsdinstall/scripts/netconfig ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig Sat Jun 4 11:56:20 2011 (r222680) +++ head/usr.sbin/bsdinstall/scripts/netconfig Sat Jun 4 12:51:22 2011 (r222681) @@ -173,8 +173,7 @@ exec 3>&- echo ${RESOLV} | tr ' ' '\n' | \ awk ' BEGIN { - search=1 - printf "search "; + search=-1; } { if (/^[[:space:]]+$/) { @@ -185,8 +184,13 @@ BEGIN { search=0; next; } + if (search == -1) { + printf "search "; + search=1; + } if (search > 0) { - printf "%s%s", (search > 1) ? "," : "", $1; + printf "%s%s", (search > 1) ? " " : "", $1; + search++; next; } printf "nameserver %s\n", $1; From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 14:28:09 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2E2D1065672; Sat, 4 Jun 2011 14:28:09 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D33CA8FC0C; Sat, 4 Jun 2011 14: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 p54ES9sD013621; Sat, 4 Jun 2011 14:28:09 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54ES9GI013619; Sat, 4 Jun 2011 14:28:09 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201106041428.p54ES9GI013619@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 4 Jun 2011 14:28:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222682 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 14:28:10 -0000 Author: bschmidt Date: Sat Jun 4 14:28:09 2011 New Revision: 222682 URL: http://svn.freebsd.org/changeset/base/222682 Log: Data frames sent over the mgmt path might be part of a TX aggr session too. In that case don't fiddle with the seqno as drivers are supposed to handle that. Currently only the powersave feature does sent QoS-null-data frames before and after a background scan which must be handled correctly. Due to this being quite rare we don't fiddle around with starting of aggr sessions. Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sat Jun 4 12:51:22 2011 (r222681) +++ head/sys/net80211/ieee80211_output.c Sat Jun 4 14:28:09 2011 (r222682) @@ -516,6 +516,7 @@ ieee80211_send_setup( { #define WH4(wh) ((struct ieee80211_frame_addr4 *)wh) struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211_tx_ampdu *tap; struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *); ieee80211_seq seqno; @@ -583,9 +584,15 @@ ieee80211_send_setup( } *(uint16_t *)&wh->i_dur[0] = 0; - seqno = ni->ni_txseqs[tid]++; - *(uint16_t *)&wh->i_seq[0] = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); - M_SEQNO_SET(m, seqno); + tap = &ni->ni_tx_ampdu[TID_TO_WME_AC(tid)]; + if (tid != IEEE80211_NONQOS_TID && IEEE80211_AMPDU_RUNNING(tap)) + m->m_flags |= M_AMPDU_MPDU; + else { + seqno = ni->ni_txseqs[tid]++; + *(uint16_t *)&wh->i_seq[0] = + htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); + M_SEQNO_SET(m, seqno); + } if (IEEE80211_IS_MULTICAST(wh->i_addr1)) m->m_flags |= M_MCAST; From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 14:30:48 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1101106564A; Sat, 4 Jun 2011 14:30:48 +0000 (UTC) (envelope-from kristof@sigsegv.be) Received: from mercury.codepro.be (mercury.codepro.be [IPv6:2001:4b98:dc0:51:216:3eff:feb7:3147]) by mx1.freebsd.org (Postfix) with ESMTP id A385A8FC15; Sat, 4 Jun 2011 14:30:47 +0000 (UTC) Received: from triton.sigsegv.be (triton.neptune.sigsegv.be [IPv6:2001:470:c8f4:0:200:ff:fe00:7]) by mercury.codepro.be (Postfix) with ESMTP id 68409DA8; Sat, 4 Jun 2011 16:30:45 +0200 (CEST) Received: from nereid (nereid.neptune.sigsegv.be [IPv6:2001:470:c8f4:0:200:ff:fe00:8]) by triton.sigsegv.be (Postfix) with SMTP id EFC9E1C1C7; Sat, 4 Jun 2011 16:30:43 +0200 (CEST) Received: by nereid (sSMTP sendmail emulation); Sat, 04 Jun 2011 16:30:43 +0200 Date: Sat, 4 Jun 2011 16:30:43 +0200 From: Kristof Provost To: Robert Watson Message-ID: <20110604143043.GE17764@nereid> References: <201105300943.p4U9htjI070096@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201105300943.p4U9htjI070096@svn.freebsd.org> X-PGP-Fingerprint: E114 D9EA 909E D469 8F57 17A5 7D15 91C6 9EFA F286 User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222488 - in head/sys: contrib/pf/net netinet netinet/ipfw netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 14:30:48 -0000 Hi, I'm seeing a panic when I start natd, which I suspect is related to this commit: panic: Lock pcbinfohash not exclusively locked @ /usr/src/sys/netinet/in_pcb.c:323 Backtrace: panic() ... _rw_assert() at _rw_assert+0x18d in_pcbbind() at in_pcbbind+0xf5 div_bind() at div_bind+0xb9 sobind() at sobind()+0x79 kern_bind() at kern_bind+0xde bind() at bind()+0x41 syscallenter() at syscallenter+0x1cb syscall() at syscall+0x4c Xfast_syscall() at Xfast_syscall+0xdd div_bind probably also needs to surround the call to in_pcbbind with INP_HASHW(UN)LOCK(...) I'm currently running 222680. I've only now seen the issue, but I've also just now activated INVARIANTS. Regards, Kristof On 2011-05-30 09:43:55 (+0000), Robert Watson wrote: > Author: rwatson > Date: Mon May 30 09:43:55 2011 > New Revision: 222488 > URL: http://svn.freebsd.org/changeset/base/222488 > > Log: > Decompose the current single inpcbinfo lock into two locks: > > - The existing ipi_lock continues to protect the global inpcb list and > inpcb counter. This lock is now relegated to a small number of > allocation and free operations, and occasional operations that walk > all connections (including, awkwardly, certain UDP multicast receive > operations -- something to revisit). > > - A new ipi_hash_lock protects the two inpcbinfo hash tables for > looking up connections and bound sockets, manipulated using new > INP_HASH_*() macros. This lock, combined with inpcb locks, protects > the 4-tuple address space. > > Unlike the current ipi_lock, ipi_hash_lock follows the individual inpcb > connection locks, so may be acquired while manipulating a connection on > which a lock is already held, avoiding the need to acquire the inpcbinfo > lock preemptively when a binding change might later be required. As a > result, however, lookup operations necessarily go through a reference > acquire while holding the lookup lock, later acquiring an inpcb lock -- > if required. > > A new function in_pcblookup() looks up connections, and accepts flags > indicating how to return the inpcb. Due to lock order changes, callers > no longer need acquire locks before performing a lookup: the lookup > routine will acquire the ipi_hash_lock as needed. In the future, it will > also be able to use alternative lookup and locking strategies > transparently to callers, such as pcbgroup lookup. New lookup flags are, > supplementing the existing INPLOOKUP_WILDCARD flag: > > INPLOOKUP_RLOCKPCB - Acquire a read lock on the returned inpcb > INPLOOKUP_WLOCKPCB - Acquire a write lock on the returned inpcb > > Callers must pass exactly one of these flags (for the time being). > > Some notes: > > - All protocols are updated to work within the new regime; especially, > TCP, UDPv4, and UDPv6. pcbinfo ipi_lock acquisitions are largely > eliminated, and global hash lock hold times are dramatically reduced > compared to previous locking. > - The TCP syncache still relies on the pcbinfo lock, something that we > may want to revisit. > - Support for reverting to the FreeBSD 7.x locking strategy in TCP input > is no longer available -- hash lookup locks are now held only very > briefly during inpcb lookup, rather than for potentially extended > periods. However, the pcbinfo ipi_lock will still be acquired if a > connection state might change such that a connection is added or > removed. > - Raw IP sockets continue to use the pcbinfo ipi_lock for protection, > due to maintaining their own hash tables. > - The interface in6_pcblookup_hash_locked() is maintained, which allows > callers to acquire hash locks and perform one or more lookups atomically > with 4-tuple allocation: this is required only for TCPv6, as there is no > in6_pcbconnect_setup(), which there should be. > - UDPv6 locking remains significantly more conservative than UDPv4 > locking, which relates to source address selection. This needs > attention, as it likely significantly reduces parallelism in this code > for multithreaded socket use (such as in BIND). > - In the UDPv4 and UDPv6 multicast cases, we need to revisit locking > somewhat, as they relied on ipi_lock to stablise 4-tuple matches, which > is no longer sufficient. A second check once the inpcb lock is held > should do the trick, keeping the general case from requiring the inpcb > lock for every inpcb visited. > - This work reminds us that we need to revisit locking of the v4/v6 flags, > which may be accessed lock-free both before and after this change. > - Right now, a single lock name is used for the pcbhash lock -- this is > undesirable, and probably another argument is required to take care of > this (or a char array name field in the pcbinfo?). > > This is not an MFC candidate for 8.x due to its impact on lookup and > locking semantics. It's possible some of these issues could be worked > around with compatibility wrappers, if necessary. > > Reviewed by: bz > Sponsored by: Juniper Networks, Inc. > > Modified: > head/sys/contrib/pf/net/pf.c > head/sys/netinet/in_pcb.c > head/sys/netinet/in_pcb.h > head/sys/netinet/ip_divert.c > head/sys/netinet/ipfw/ip_fw2.c > head/sys/netinet/raw_ip.c > head/sys/netinet/siftr.c > head/sys/netinet/tcp_input.c > head/sys/netinet/tcp_subr.c > head/sys/netinet/tcp_syncache.c > head/sys/netinet/tcp_timer.c > head/sys/netinet/tcp_usrreq.c > head/sys/netinet/udp_usrreq.c > head/sys/netinet6/in6_pcb.c > head/sys/netinet6/in6_pcb.h > head/sys/netinet6/in6_src.c > head/sys/netinet6/udp6_usrreq.c > > Modified: head/sys/contrib/pf/net/pf.c > ============================================================================== > --- head/sys/contrib/pf/net/pf.c Mon May 30 09:41:38 2011 (r222487) > +++ head/sys/contrib/pf/net/pf.c Mon May 30 09:43:55 2011 (r222488) > @@ -3034,16 +3034,14 @@ pf_socket_lookup(int direction, struct p > #ifdef INET > case AF_INET: > #ifdef __FreeBSD__ > - INP_INFO_RLOCK(pi); /* XXX LOR */ > - inp = in_pcblookup_hash(pi, saddr->v4, sport, daddr->v4, > - dport, 0, NULL); > + inp = in_pcblookup(pi, saddr->v4, sport, daddr->v4, > + dport, INPLOOKUP_RLOCKPCB, NULL); > if (inp == NULL) { > - inp = in_pcblookup_hash(pi, saddr->v4, sport, > - daddr->v4, dport, INPLOOKUP_WILDCARD, NULL); > - if(inp == NULL) { > - INP_INFO_RUNLOCK(pi); > + inp = in_pcblookup(pi, saddr->v4, sport, > + daddr->v4, dport, INPLOOKUP_WILDCARD | > + INPLOOKUP_RLOCKPCB, NULL); > + if (inp == NULL) > return (-1); > - } > } > #else > inp = in_pcbhashlookup(tb, saddr->v4, sport, daddr->v4, dport); > @@ -3058,16 +3056,14 @@ pf_socket_lookup(int direction, struct p > #ifdef INET6 > case AF_INET6: > #ifdef __FreeBSD__ > - INP_INFO_RLOCK(pi); > - inp = in6_pcblookup_hash(pi, &saddr->v6, sport, > - &daddr->v6, dport, 0, NULL); > + inp = in6_pcblookup(pi, &saddr->v6, sport, > + &daddr->v6, dport, INPLOOKUP_RLOCKPCB, NULL); > if (inp == NULL) { > - inp = in6_pcblookup_hash(pi, &saddr->v6, sport, > - &daddr->v6, dport, INPLOOKUP_WILDCARD, NULL); > - if (inp == NULL) { > - INP_INFO_RUNLOCK(pi); > + inp = in6_pcblookup(pi, &saddr->v6, sport, > + &daddr->v6, dport, INPLOOKUP_WILDCARD | > + INPLOOKUP_RLOCKPCB, NULL); > + if (inp == NULL) > return (-1); > - } > } > #else > inp = in6_pcbhashlookup(tb, &saddr->v6, sport, &daddr->v6, > @@ -3085,9 +3081,10 @@ pf_socket_lookup(int direction, struct p > return (-1); > } > #ifdef __FreeBSD__ > + INP_RLOCK_ASSERT(inp); > pd->lookup.uid = inp->inp_cred->cr_uid; > pd->lookup.gid = inp->inp_cred->cr_groups[0]; > - INP_INFO_RUNLOCK(pi); > + INP_RUNLOCK(inp); > #else > pd->lookup.uid = inp->inp_socket->so_euid; > pd->lookup.gid = inp->inp_socket->so_egid; > > Modified: head/sys/netinet/in_pcb.c > ============================================================================== > --- head/sys/netinet/in_pcb.c Mon May 30 09:41:38 2011 (r222487) > +++ head/sys/netinet/in_pcb.c Mon May 30 09:43:55 2011 (r222488) > @@ -127,6 +127,10 @@ static VNET_DEFINE(int, ipport_tcplastco > > #define V_ipport_tcplastcount VNET(ipport_tcplastcount) > > +static struct inpcb *in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, > + struct in_addr faddr, u_int fport_arg, > + struct in_addr laddr, u_int lport_arg, > + int lookupflags, struct ifnet *ifp); > static void in_pcbremlists(struct inpcb *inp); > > #ifdef INET > @@ -212,11 +216,13 @@ in_pcbinfo_init(struct inpcbinfo *pcbinf > { > > INP_INFO_LOCK_INIT(pcbinfo, name); > + INP_HASH_LOCK_INIT(pcbinfo, "pcbinfohash"); /* XXXRW: argument? */ > #ifdef VIMAGE > pcbinfo->ipi_vnet = curvnet; > #endif > pcbinfo->ipi_listhead = listhead; > LIST_INIT(pcbinfo->ipi_listhead); > + pcbinfo->ipi_count = 0; > pcbinfo->ipi_hashbase = hashinit(hash_nelements, M_PCB, > &pcbinfo->ipi_hashmask); > pcbinfo->ipi_porthashbase = hashinit(porthash_nelements, M_PCB, > @@ -234,10 +240,14 @@ void > in_pcbinfo_destroy(struct inpcbinfo *pcbinfo) > { > > + KASSERT(pcbinfo->ipi_count == 0, > + ("%s: ipi_count = %u", __func__, pcbinfo->ipi_count)); > + > hashdestroy(pcbinfo->ipi_hashbase, M_PCB, pcbinfo->ipi_hashmask); > hashdestroy(pcbinfo->ipi_porthashbase, M_PCB, > pcbinfo->ipi_porthashmask); > uma_zdestroy(pcbinfo->ipi_zone); > + INP_HASH_LOCK_DESTROY(pcbinfo); > INP_INFO_LOCK_DESTROY(pcbinfo); > } > > @@ -309,8 +319,8 @@ in_pcbbind(struct inpcb *inp, struct soc > { > int anonport, error; > > - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); > INP_WLOCK_ASSERT(inp); > + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); > > if (inp->inp_lport != 0 || inp->inp_laddr.s_addr != INADDR_ANY) > return (EINVAL); > @@ -351,8 +361,8 @@ in_pcb_lport(struct inpcb *inp, struct i > * Because no actual state changes occur here, a global write lock on > * the pcbinfo isn't required. > */ > - INP_INFO_LOCK_ASSERT(pcbinfo); > INP_LOCK_ASSERT(inp); > + INP_HASH_LOCK_ASSERT(pcbinfo); > > if (inp->inp_flags & INP_HIGHPORT) { > first = V_ipport_hifirstauto; /* sysctl */ > @@ -473,11 +483,10 @@ in_pcbbind_setup(struct inpcb *inp, stru > int error; > > /* > - * Because no actual state changes occur here, a global write lock on > - * the pcbinfo isn't required. > + * No state changes, so read locks are sufficient here. > */ > - INP_INFO_LOCK_ASSERT(pcbinfo); > INP_LOCK_ASSERT(inp); > + INP_HASH_LOCK_ASSERT(pcbinfo); > > if (TAILQ_EMPTY(&V_in_ifaddrhead)) /* XXX broken! */ > return (EADDRNOTAVAIL); > @@ -618,8 +627,8 @@ in_pcbconnect(struct inpcb *inp, struct > in_addr_t laddr, faddr; > int anonport, error; > > - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); > INP_WLOCK_ASSERT(inp); > + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); > > lport = inp->inp_lport; > laddr = inp->inp_laddr.s_addr; > @@ -907,8 +916,8 @@ in_pcbconnect_setup(struct inpcb *inp, s > * Because a global state change doesn't actually occur here, a read > * lock is sufficient. > */ > - INP_INFO_LOCK_ASSERT(inp->inp_pcbinfo); > INP_LOCK_ASSERT(inp); > + INP_HASH_LOCK_ASSERT(inp->inp_pcbinfo); > > if (oinpp != NULL) > *oinpp = NULL; > @@ -983,8 +992,8 @@ in_pcbconnect_setup(struct inpcb *inp, s > if (error) > return (error); > } > - oinp = in_pcblookup_hash(inp->inp_pcbinfo, faddr, fport, laddr, lport, > - 0, NULL); > + oinp = in_pcblookup_hash_locked(inp->inp_pcbinfo, faddr, fport, > + laddr, lport, 0, NULL); > if (oinp != NULL) { > if (oinpp != NULL) > *oinpp = oinp; > @@ -1007,8 +1016,8 @@ void > in_pcbdisconnect(struct inpcb *inp) > { > > - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); > INP_WLOCK_ASSERT(inp); > + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); > > inp->inp_faddr.s_addr = INADDR_ANY; > inp->inp_fport = 0; > @@ -1187,19 +1196,24 @@ void > in_pcbdrop(struct inpcb *inp) > { > > - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); > INP_WLOCK_ASSERT(inp); > > + /* > + * XXXRW: Possibly we should protect the setting of INP_DROPPED with > + * the hash lock...? > + */ > inp->inp_flags |= INP_DROPPED; > if (inp->inp_flags & INP_INHASHLIST) { > struct inpcbport *phd = inp->inp_phd; > > + INP_HASH_WLOCK(inp->inp_pcbinfo); > LIST_REMOVE(inp, inp_hash); > LIST_REMOVE(inp, inp_portlist); > if (LIST_FIRST(&phd->phd_pcblist) == NULL) { > LIST_REMOVE(phd, phd_hash); > free(phd, M_PCB); > } > + INP_HASH_WUNLOCK(inp->inp_pcbinfo); > inp->inp_flags &= ~INP_INHASHLIST; > } > } > @@ -1328,7 +1342,8 @@ in_pcbpurgeif0(struct inpcbinfo *pcbinfo > } > > /* > - * Lookup a PCB based on the local address and port. > + * Lookup a PCB based on the local address and port. Caller must hold the > + * hash lock. No inpcb locks or references are acquired. > */ > #define INP_LOOKUP_MAPPED_PCB_COST 3 > struct inpcb * > @@ -1346,7 +1361,7 @@ in_pcblookup_local(struct inpcbinfo *pcb > KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, > ("%s: invalid lookup flags %d", __func__, lookupflags)); > > - INP_INFO_LOCK_ASSERT(pcbinfo); > + INP_HASH_LOCK_ASSERT(pcbinfo); > > if ((lookupflags & INPLOOKUP_WILDCARD) == 0) { > struct inpcbhead *head; > @@ -1450,10 +1465,12 @@ in_pcblookup_local(struct inpcbinfo *pcb > #undef INP_LOOKUP_MAPPED_PCB_COST > > /* > - * Lookup PCB in hash list. > + * Lookup PCB in hash list, using pcbinfo tables. This variation assumes > + * that the caller has locked the hash list, and will not perform any further > + * locking or reference operations on either the hash list or the connection. > */ > -struct inpcb * > -in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr, > +static struct inpcb * > +in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, struct in_addr faddr, > u_int fport_arg, struct in_addr laddr, u_int lport_arg, int lookupflags, > struct ifnet *ifp) > { > @@ -1464,7 +1481,7 @@ in_pcblookup_hash(struct inpcbinfo *pcbi > KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, > ("%s: invalid lookup flags %d", __func__, lookupflags)); > > - INP_INFO_LOCK_ASSERT(pcbinfo); > + INP_HASH_LOCK_ASSERT(pcbinfo); > > /* > * First look for an exact match. > @@ -1574,6 +1591,56 @@ in_pcblookup_hash(struct inpcbinfo *pcbi > > return (NULL); > } > + > +/* > + * Lookup PCB in hash list, using pcbinfo tables. This variation locks the > + * hash list lock, and will return the inpcb locked (i.e., requires > + * INPLOOKUP_LOCKPCB). > + */ > +static struct inpcb * > +in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr, > + u_int fport, struct in_addr laddr, u_int lport, int lookupflags, > + struct ifnet *ifp) > +{ > + struct inpcb *inp; > + > + INP_HASH_RLOCK(pcbinfo); > + inp = in_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, > + (lookupflags & ~(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)), ifp); > + if (inp != NULL) { > + in_pcbref(inp); > + INP_HASH_RUNLOCK(pcbinfo); > + if (lookupflags & INPLOOKUP_WLOCKPCB) { > + INP_WLOCK(inp); > + if (in_pcbrele_wlocked(inp)) > + return (NULL); > + } else if (lookupflags & INPLOOKUP_RLOCKPCB) { > + INP_RLOCK(inp); > + if (in_pcbrele_rlocked(inp)) > + return (NULL); > + } else > + panic("%s: locking bug", __func__); > + } else > + INP_HASH_RUNLOCK(pcbinfo); > + return (inp); > +} > + > +/* > + * Public inpcb lookup routines, accepting a 4-tuple. > + */ > +struct inpcb * > +in_pcblookup(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport, > + struct in_addr laddr, u_int lport, int lookupflags, struct ifnet *ifp) > +{ > + > + KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, > + ("%s: invalid lookup flags %d", __func__, lookupflags)); > + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, > + ("%s: LOCKPCB not set", __func__)); > + > + return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, > + lookupflags, ifp)); > +} > #endif /* INET */ > > /* > @@ -1588,8 +1655,9 @@ in_pcbinshash(struct inpcb *inp) > struct inpcbport *phd; > u_int32_t hashkey_faddr; > > - INP_INFO_WLOCK_ASSERT(pcbinfo); > INP_WLOCK_ASSERT(inp); > + INP_HASH_WLOCK_ASSERT(pcbinfo); > + > KASSERT((inp->inp_flags & INP_INHASHLIST) == 0, > ("in_pcbinshash: INP_INHASHLIST")); > > @@ -1645,8 +1713,9 @@ in_pcbrehash(struct inpcb *inp) > struct inpcbhead *head; > u_int32_t hashkey_faddr; > > - INP_INFO_WLOCK_ASSERT(pcbinfo); > INP_WLOCK_ASSERT(inp); > + INP_HASH_WLOCK_ASSERT(pcbinfo); > + > KASSERT(inp->inp_flags & INP_INHASHLIST, > ("in_pcbrehash: !INP_INHASHLIST")); > > @@ -1679,12 +1748,14 @@ in_pcbremlists(struct inpcb *inp) > if (inp->inp_flags & INP_INHASHLIST) { > struct inpcbport *phd = inp->inp_phd; > > + INP_HASH_WLOCK(pcbinfo); > LIST_REMOVE(inp, inp_hash); > LIST_REMOVE(inp, inp_portlist); > if (LIST_FIRST(&phd->phd_pcblist) == NULL) { > LIST_REMOVE(phd, phd_hash); > free(phd, M_PCB); > } > + INP_HASH_WUNLOCK(pcbinfo); > inp->inp_flags &= ~INP_INHASHLIST; > } > LIST_REMOVE(inp, inp_list); > > Modified: head/sys/netinet/in_pcb.h > ============================================================================== > --- head/sys/netinet/in_pcb.h Mon May 30 09:41:38 2011 (r222487) > +++ head/sys/netinet/in_pcb.h Mon May 30 09:43:55 2011 (r222488) > @@ -268,22 +268,22 @@ struct inpcbport { > * Global data structure for each high-level protocol (UDP, TCP, ...) in both > * IPv4 and IPv6. Holds inpcb lists and information for managing them. > * > - * Each pcbinfo is protected by ipi_lock, covering mutable global fields (such > - * as the global pcb list) and hashed lookup tables. The lock order is: > + * Each pcbinfo is protected by two locks: ipi_lock and ipi_hash_lock, > + * the former covering mutable global fields (such as the global pcb list), > + * and the latter covering the hashed lookup tables. The lock order is: > * > - * ipi_lock (before) inpcb locks > + * ipi_lock (before) inpcb locks (before) ipi_hash_lock > * > * Locking key: > * > * (c) Constant or nearly constant after initialisation > * (g) Locked by ipi_lock > - * (h) Read using either ipi_lock or inpcb lock; write requires both. > + * (h) Read using either ipi_hash_lock or inpcb lock; write requires both. > * (x) Synchronisation properties poorly defined > */ > struct inpcbinfo { > /* > - * Global lock protecting global inpcb list, inpcb count, hash tables, > - * etc. > + * Global lock protecting global inpcb list, inpcb count, etc. > */ > struct rwlock ipi_lock; > > @@ -312,17 +312,22 @@ struct inpcbinfo { > struct uma_zone *ipi_zone; /* (c) */ > > /* > + * Global lock protecting hash lookup tables. > + */ > + struct rwlock ipi_hash_lock; > + > + /* > * Global hash of inpcbs, hashed by local and foreign addresses and > * port numbers. > */ > - struct inpcbhead *ipi_hashbase; /* (g) */ > - u_long ipi_hashmask; /* (g) */ > + struct inpcbhead *ipi_hashbase; /* (h) */ > + u_long ipi_hashmask; /* (h) */ > > /* > * Global hash of inpcbs, hashed by only local port number. > */ > - struct inpcbporthead *ipi_porthashbase; /* (g) */ > - u_long ipi_porthashmask; /* (g) */ > + struct inpcbporthead *ipi_porthashbase; /* (h) */ > + u_long ipi_porthashmask; /* (h) */ > > /* > * Pointer to network stack instance > @@ -406,6 +411,18 @@ void inp_4tuple_get(struct inpcb *inp, > #define INP_INFO_WLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_lock, RA_WLOCKED) > #define INP_INFO_UNLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_lock, RA_UNLOCKED) > > +#define INP_HASH_LOCK_INIT(ipi, d) \ > + rw_init_flags(&(ipi)->ipi_hash_lock, (d), 0) > +#define INP_HASH_LOCK_DESTROY(ipi) rw_destroy(&(ipi)->ipi_hash_lock) > +#define INP_HASH_RLOCK(ipi) rw_rlock(&(ipi)->ipi_hash_lock) > +#define INP_HASH_WLOCK(ipi) rw_wlock(&(ipi)->ipi_hash_lock) > +#define INP_HASH_RUNLOCK(ipi) rw_runlock(&(ipi)->ipi_hash_lock) > +#define INP_HASH_WUNLOCK(ipi) rw_wunlock(&(ipi)->ipi_hash_lock) > +#define INP_HASH_LOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_hash_lock, \ > + RA_LOCKED) > +#define INP_HASH_WLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_hash_lock, \ > + RA_WLOCKED) > + > #define INP_PCBHASH(faddr, lport, fport, mask) \ > (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) > #define INP_PCBPORTHASH(lport, mask) \ > @@ -466,7 +483,16 @@ void inp_4tuple_get(struct inpcb *inp, > #define INP_LLE_VALID 0x00000001 /* cached lle is valid */ > #define INP_RT_VALID 0x00000002 /* cached rtentry is valid */ > > -#define INPLOOKUP_WILDCARD 1 > +/* > + * Flags passed to in_pcblookup*() functions. > + */ > +#define INPLOOKUP_WILDCARD 0x00000001 /* Allow wildcard sockets. */ > +#define INPLOOKUP_RLOCKPCB 0x00000002 /* Return inpcb read-locked. */ > +#define INPLOOKUP_WLOCKPCB 0x00000004 /* Return inpcb write-locked. */ > + > +#define INPLOOKUP_MASK (INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB | \ > + INPLOOKUP_WLOCKPCB) > + > #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) > #define sotoin6pcb(so) sotoinpcb(so) /* for KAME src sync over BSD*'s */ > > @@ -527,7 +553,7 @@ struct inpcb * > in_pcblookup_local(struct inpcbinfo *, > struct in_addr, u_short, int, struct ucred *); > struct inpcb * > - in_pcblookup_hash(struct inpcbinfo *, struct in_addr, u_int, > + in_pcblookup(struct inpcbinfo *, struct in_addr, u_int, > struct in_addr, u_int, int, struct ifnet *); > void in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr, > int, struct inpcb *(*)(struct inpcb *, int)); > > Modified: head/sys/netinet/ip_divert.c > ============================================================================== > --- head/sys/netinet/ip_divert.c Mon May 30 09:41:38 2011 (r222487) > +++ head/sys/netinet/ip_divert.c Mon May 30 09:43:55 2011 (r222488) > @@ -659,9 +659,9 @@ div_pcblist(SYSCTL_HANDLER_ARGS) > INP_INFO_WLOCK(&V_divcbinfo); > for (i = 0; i < n; i++) { > inp = inp_list[i]; > - INP_WLOCK(inp); > - if (!in_pcbrele(inp)) > - INP_WUNLOCK(inp); > + INP_RLOCK(inp); > + if (!in_pcbrele_rlocked(inp)) > + INP_RUNLOCK(inp); > } > INP_INFO_WUNLOCK(&V_divcbinfo); > > > Modified: head/sys/netinet/ipfw/ip_fw2.c > ============================================================================== > --- head/sys/netinet/ipfw/ip_fw2.c Mon May 30 09:41:38 2011 (r222487) > +++ head/sys/netinet/ipfw/ip_fw2.c Mon May 30 09:43:55 2011 (r222488) > @@ -657,7 +657,7 @@ check_uidgid(ipfw_insn_u32 *insn, int pr > (struct bsd_ucred *)uc, ugid_lookupp, ((struct mbuf *)inp)->m_skb); > #else /* FreeBSD */ > struct inpcbinfo *pi; > - int wildcard; > + int lookupflags; > struct inpcb *pcb; > int match; > > @@ -682,30 +682,31 @@ check_uidgid(ipfw_insn_u32 *insn, int pr > if (*ugid_lookupp == -1) > return (0); > if (proto == IPPROTO_TCP) { > - wildcard = 0; > + lookupflags = 0; > pi = &V_tcbinfo; > } else if (proto == IPPROTO_UDP) { > - wildcard = INPLOOKUP_WILDCARD; > + lookupflags = INPLOOKUP_WILDCARD; > pi = &V_udbinfo; > } else > return 0; > + lookupflags |= INPLOOKUP_RLOCKPCB; > match = 0; > if (*ugid_lookupp == 0) { > - INP_INFO_RLOCK(pi); > pcb = (oif) ? > - in_pcblookup_hash(pi, > + in_pcblookup(pi, > dst_ip, htons(dst_port), > src_ip, htons(src_port), > - wildcard, oif) : > - in_pcblookup_hash(pi, > + lookupflags, oif) : > + in_pcblookup(pi, > src_ip, htons(src_port), > dst_ip, htons(dst_port), > - wildcard, NULL); > + lookupflags, NULL); > if (pcb != NULL) { > + INP_RLOCK_ASSERT(pcb); > *uc = crhold(pcb->inp_cred); > *ugid_lookupp = 1; > + INP_RUNLOCK(pcb); > } > - INP_INFO_RUNLOCK(pi); > if (*ugid_lookupp == 0) { > /* > * We tried and failed, set the variable to -1 > @@ -1827,21 +1828,32 @@ do { \ > else > break; > > + /* > + * XXXRW: so_user_cookie should almost > + * certainly be inp_user_cookie? > + */ > + > /* For incomming packet, lookup up the > inpcb using the src/dest ip/port tuple */ > if (inp == NULL) { > - INP_INFO_RLOCK(pi); > - inp = in_pcblookup_hash(pi, > + inp = in_pcblookup(pi, > src_ip, htons(src_port), > dst_ip, htons(dst_port), > - 0, NULL); > - INP_INFO_RUNLOCK(pi); > - } > - > - if (inp && inp->inp_socket) { > - tablearg = inp->inp_socket->so_user_cookie; > - if (tablearg) > - match = 1; > + INPLOOKUP_RLOCKPCB, NULL); > + if (inp != NULL) { > + tablearg = > + inp->inp_socket->so_user_cookie; > + if (tablearg) > + match = 1; > + INP_RUNLOCK(inp); > + } > + } else { > + if (inp->inp_socket) { > + tablearg = > + inp->inp_socket->so_user_cookie; > + if (tablearg) > + match = 1; > + } > } > break; > } > > Modified: head/sys/netinet/raw_ip.c > ============================================================================== > --- head/sys/netinet/raw_ip.c Mon May 30 09:41:38 2011 (r222487) > +++ head/sys/netinet/raw_ip.c Mon May 30 09:43:55 2011 (r222488) > @@ -226,7 +226,7 @@ rip_append(struct inpcb *last, struct ip > { > int policyfail = 0; > > - INP_RLOCK_ASSERT(last); > + INP_LOCK_ASSERT(last); > > #ifdef IPSEC > /* check AH/ESP integrity. */ > @@ -834,16 +834,19 @@ rip_detach(struct socket *so) > static void > rip_dodisconnect(struct socket *so, struct inpcb *inp) > { > + struct inpcbinfo *pcbinfo; > > - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); > - INP_WLOCK_ASSERT(inp); > - > + pcbinfo = inp->inp_pcbinfo; > + INP_INFO_WLOCK(pcbinfo); > + INP_WLOCK(inp); > rip_delhash(inp); > inp->inp_faddr.s_addr = INADDR_ANY; > rip_inshash(inp); > SOCK_LOCK(so); > so->so_state &= ~SS_ISCONNECTED; > SOCK_UNLOCK(so); > + INP_WUNLOCK(inp); > + INP_INFO_WUNLOCK(pcbinfo); > } > > static void > @@ -854,11 +857,7 @@ rip_abort(struct socket *so) > inp = sotoinpcb(so); > KASSERT(inp != NULL, ("rip_abort: inp == NULL")); > > - INP_INFO_WLOCK(&V_ripcbinfo); > - INP_WLOCK(inp); > rip_dodisconnect(so, inp); > - INP_WUNLOCK(inp); > - INP_INFO_WUNLOCK(&V_ripcbinfo); > } > > static void > @@ -869,11 +868,7 @@ rip_close(struct socket *so) > inp = sotoinpcb(so); > KASSERT(inp != NULL, ("rip_close: inp == NULL")); > > - INP_INFO_WLOCK(&V_ripcbinfo); > - INP_WLOCK(inp); > rip_dodisconnect(so, inp); > - INP_WUNLOCK(inp); > - INP_INFO_WUNLOCK(&V_ripcbinfo); > } > > static int > @@ -887,11 +882,7 @@ rip_disconnect(struct socket *so) > inp = sotoinpcb(so); > KASSERT(inp != NULL, ("rip_disconnect: inp == NULL")); > > - INP_INFO_WLOCK(&V_ripcbinfo); > - INP_WLOCK(inp); > rip_dodisconnect(so, inp); > - INP_WUNLOCK(inp); > - INP_INFO_WUNLOCK(&V_ripcbinfo); > return (0); > } > > @@ -1077,9 +1068,9 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) > INP_INFO_WLOCK(&V_ripcbinfo); > for (i = 0; i < n; i++) { > inp = inp_list[i]; > - INP_WLOCK(inp); > - if (!in_pcbrele(inp)) > - INP_WUNLOCK(inp); > + INP_RLOCK(inp); > + if (!in_pcbrele_rlocked(inp)) > + INP_RUNLOCK(inp); > } > INP_INFO_WUNLOCK(&V_ripcbinfo); > > > Modified: head/sys/netinet/siftr.c > ============================================================================== > --- head/sys/netinet/siftr.c Mon May 30 09:41:38 2011 (r222487) > +++ head/sys/netinet/siftr.c Mon May 30 09:43:55 2011 (r222488) > @@ -696,17 +696,16 @@ siftr_findinpcb(int ipver, struct ip *ip > > /* We need the tcbinfo lock. */ > INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); > - INP_INFO_RLOCK(&V_tcbinfo); > > if (dir == PFIL_IN) > inp = (ipver == INP_IPV4 ? > - in_pcblookup_hash(&V_tcbinfo, ip->ip_src, sport, ip->ip_dst, > - dport, 0, m->m_pkthdr.rcvif) > + in_pcblookup(&V_tcbinfo, ip->ip_src, sport, ip->ip_dst, > + dport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) > : > #ifdef SIFTR_IPV6 > - in6_pcblookup_hash(&V_tcbinfo, > + in6_pcblookup(&V_tcbinfo, > &((struct ip6_hdr *)ip)->ip6_src, sport, > - &((struct ip6_hdr *)ip)->ip6_dst, dport, 0, > + &((struct ip6_hdr *)ip)->ip6_dst, dport, INPLOOKUP_RLOCKPCB, > m->m_pkthdr.rcvif) > #else > NULL > @@ -715,13 +714,13 @@ siftr_findinpcb(int ipver, struct ip *ip > > else > inp = (ipver == INP_IPV4 ? > - in_pcblookup_hash(&V_tcbinfo, ip->ip_dst, dport, ip->ip_src, > - sport, 0, m->m_pkthdr.rcvif) > + in_pcblookup(&V_tcbinfo, ip->ip_dst, dport, ip->ip_src, > + sport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) > : > #ifdef SIFTR_IPV6 > - in6_pcblookup_hash(&V_tcbinfo, > + in6_pcblookup(&V_tcbinfo, > &((struct ip6_hdr *)ip)->ip6_dst, dport, > - &((struct ip6_hdr *)ip)->ip6_src, sport, 0, > + &((struct ip6_hdr *)ip)->ip6_src, sport, INPLOOKUP_RLOCKPCB, > m->m_pkthdr.rcvif) > #else > NULL > @@ -734,12 +733,7 @@ siftr_findinpcb(int ipver, struct ip *ip > ss->nskip_in_inpcb++; > else > ss->nskip_out_inpcb++; > - } else { > - /* Acquire the inpcb lock. */ > - INP_UNLOCK_ASSERT(inp); > - INP_RLOCK(inp); > } > - INP_INFO_RUNLOCK(&V_tcbinfo); > > return (inp); > } > > Modified: head/sys/netinet/tcp_input.c > ============================================================================== > --- head/sys/netinet/tcp_input.c Mon May 30 09:41:38 2011 (r222487) > +++ head/sys/netinet/tcp_input.c Mon May 30 09:43:55 2011 (r222488) > @@ -5,6 +5,7 @@ > * Swinburne University of Technology, Melbourne, Australia. > * Copyright (c) 2009-2010 Lawrence Stewart > * Copyright (c) 2010 The FreeBSD Foundation > + * Copyright (c) 2010-2011 Juniper Networks, Inc. > * All rights reserved. > * > * Portions of this software were developed at the Centre for Advanced Internet > @@ -16,6 +17,9 @@ > * Internet Architectures, Swinburne University of Technology, Melbourne, > * Australia by David Hayes under sponsorship from the FreeBSD Foundation. > * > + * Portions of this software were developed by Robert N. M. Watson under > + * contract to Juniper Networks, Inc. > + * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > * are met: > @@ -197,10 +201,6 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, > &VNET_NAME(tcp_autorcvbuf_max), 0, > "Max size of automatic receive buffer"); > > -int tcp_read_locking = 1; > -SYSCTL_INT(_net_inet_tcp, OID_AUTO, read_locking, CTLFLAG_RW, > - &tcp_read_locking, 0, "Enable read locking strategy"); > - > VNET_DEFINE(struct inpcbhead, tcb); > #define tcb6 tcb /* for KAME src sync over BSD*'s */ > VNET_DEFINE(struct inpcbinfo, tcbinfo); > @@ -591,8 +591,7 @@ tcp_input(struct mbuf *m, int off0) > char *s = NULL; /* address and port logging */ > int ti_locked; > #define TI_UNLOCKED 1 > -#define TI_RLOCKED 2 > -#define TI_WLOCKED 3 > +#define TI_WLOCKED 2 > > #ifdef TCPDEBUG > /* > @@ -756,30 +755,25 @@ tcp_input(struct mbuf *m, int off0) > drop_hdrlen = off0 + off; > > /* > - * Locate pcb for segment, which requires a lock on tcbinfo. > - * Optimisticaly acquire a global read lock rather than a write lock > - * unless header flags necessarily imply a state change. There are > - * two cases where we might discover later we need a write lock > - * despite the flags: ACKs moving a connection out of the syncache, > - * and ACKs for a connection in TIMEWAIT. > + * Locate pcb for segment; if we're likely to add or remove a > + * connection then first acquire pcbinfo lock. There are two cases > + * where we might discover later we need a write lock despite the > + * flags: ACKs moving a connection out of the syncache, and ACKs for > + * a connection in TIMEWAIT. > */ > - if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || > - tcp_read_locking == 0) { > + if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0) { > INP_INFO_WLOCK(&V_tcbinfo); > ti_locked = TI_WLOCKED; > - } else { > - INP_INFO_RLOCK(&V_tcbinfo); > - ti_locked = TI_RLOCKED; > - } > + } else > + ti_locked = TI_UNLOCKED; > > findpcb: > #ifdef INVARIANTS > - if (ti_locked == TI_RLOCKED) > - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); > - else if (ti_locked == TI_WLOCKED) > + if (ti_locked == TI_WLOCKED) { > INP_INFO_WLOCK_ASSERT(&V_tcbinfo); > - else > - panic("%s: findpcb ti_locked %d\n", __func__, ti_locked); > + } else { > + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); > + } > #endif > > #ifdef INET > @@ -797,20 +791,18 @@ findpcb: > * Transparently forwarded. Pretend to be the destination. > * already got one like this? > */ > - inp = in_pcblookup_hash(&V_tcbinfo, > - ip->ip_src, th->th_sport, > - ip->ip_dst, th->th_dport, > - 0, m->m_pkthdr.rcvif); > + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, th->th_sport, > + ip->ip_dst, th->th_dport, INPLOOKUP_WLOCKPCB, > + m->m_pkthdr.rcvif); > if (!inp) { > - /* It's new. Try to find the ambushing socket. */ > - inp = in_pcblookup_hash(&V_tcbinfo, > - ip->ip_src, th->th_sport, > - next_hop->sin_addr, > - next_hop->sin_port ? > - ntohs(next_hop->sin_port) : > - th->th_dport, > - INPLOOKUP_WILDCARD, > - m->m_pkthdr.rcvif); > + /* > + * It's new. Try to find the ambushing socket. > + */ > + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, > + th->th_sport, next_hop->sin_addr, > + next_hop->sin_port ? ntohs(next_hop->sin_port) : > + th->th_dport, INPLOOKUP_WILDCARD | > + INPLOOKUP_WLOCKPCB, m->m_pkthdr.rcvif); > } > /* Remove the tag from the packet. We don't need it anymore. */ > m_tag_delete(m, fwd_tag); > @@ -820,21 +812,19 @@ findpcb: > { > #ifdef INET6 > if (isipv6) > - inp = in6_pcblookup_hash(&V_tcbinfo, > - &ip6->ip6_src, th->th_sport, > - &ip6->ip6_dst, th->th_dport, > - INPLOOKUP_WILDCARD, > - m->m_pkthdr.rcvif); > + inp = in6_pcblookup(&V_tcbinfo, &ip6->ip6_src, > + th->th_sport, &ip6->ip6_dst, th->th_dport, > + INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, > + m->m_pkthdr.rcvif); > #endif > #if defined(INET) && defined(INET6) > else > #endif > #ifdef INET > - inp = in_pcblookup_hash(&V_tcbinfo, > - ip->ip_src, th->th_sport, > - ip->ip_dst, th->th_dport, > - INPLOOKUP_WILDCARD, > - m->m_pkthdr.rcvif); > + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, > + th->th_sport, ip->ip_dst, th->th_dport, > + INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, > + m->m_pkthdr.rcvif); > #endif > } > > @@ -865,7 +855,7 @@ findpcb: > rstreason = BANDLIM_RST_CLOSEDPORT; > goto dropwithreset; > } > - INP_WLOCK(inp); > + INP_WLOCK_ASSERT(inp); > if (!(inp->inp_flags & INP_HW_FLOWID) > && (m->m_flags & M_FLOWID) > && ((inp->inp_socket == NULL) > @@ -906,28 +896,26 @@ findpcb: > * legitimate new connection attempt the old INPCB gets removed and > * we can try again to find a listening socket. > * > - * At this point, due to earlier optimism, we may hold a read lock on > - * the inpcbinfo, rather than a write lock. If so, we need to > - * upgrade, or if that fails, acquire a reference on the inpcb, drop > - * all locks, acquire a global write lock, and then re-acquire the > - * inpcb lock. We may at that point discover that another thread has > - * tried to free the inpcb, in which case we need to loop back and > - * try to find a new inpcb to deliver to. > + * At this point, due to earlier optimism, we may hold only an inpcb > + * lock, and not the inpcbinfo write lock. If so, we need to try to > + * acquire it, or if that fails, acquire a reference on the inpcb, > + * drop all locks, acquire a global write lock, and then re-acquire > + * the inpcb lock. We may at that point discover that another thread > + * has tried to free the inpcb, in which case we need to loop back > + * and try to find a new inpcb to deliver to. > + * > + * XXXRW: It may be time to rethink timewait locking. > */ > relocked: > if (inp->inp_flags & INP_TIMEWAIT) { > - KASSERT(ti_locked == TI_RLOCKED || ti_locked == TI_WLOCKED, > - ("%s: INP_TIMEWAIT ti_locked %d", __func__, ti_locked)); > - > - if (ti_locked == TI_RLOCKED) { > - if (INP_INFO_TRY_UPGRADE(&V_tcbinfo) == 0) { > + if (ti_locked == TI_UNLOCKED) { > + if (INP_INFO_TRY_WLOCK(&V_tcbinfo) == 0) { > in_pcbref(inp); > INP_WUNLOCK(inp); > - INP_INFO_RUNLOCK(&V_tcbinfo); > INP_INFO_WLOCK(&V_tcbinfo); > ti_locked = TI_WLOCKED; > INP_WLOCK(inp); > - if (in_pcbrele(inp)) { > + if (in_pcbrele_wlocked(inp)) { > inp = NULL; > goto findpcb; > } > @@ -975,26 +963,24 @@ relocked: > > /* > * We've identified a valid inpcb, but it could be that we need an > - * inpcbinfo write lock and have only a read lock. In this case, > - * attempt to upgrade/relock using the same strategy as the TIMEWAIT > - * case above. If we relock, we have to jump back to 'relocked' as > - * the connection might now be in TIMEWAIT. > - */ > - if (tp->t_state != TCPS_ESTABLISHED || > - (thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || > - tcp_read_locking == 0) { > - KASSERT(ti_locked == TI_RLOCKED || ti_locked == TI_WLOCKED, > - ("%s: upgrade check ti_locked %d", __func__, ti_locked)); > - > - if (ti_locked == TI_RLOCKED) { > - if (INP_INFO_TRY_UPGRADE(&V_tcbinfo) == 0) { > + * inpcbinfo write lock but don't hold it. In this case, attempt to > + * acquire using the same strategy as the TIMEWAIT case above. If we > + * relock, we have to jump back to 'relocked' as the connection might > + * now be in TIMEWAIT. > + */ > +#ifdef INVARIANTS > + if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0) > + INP_INFO_WLOCK_ASSERT(&V_tcbinfo); > +#endif > + if (tp->t_state != TCPS_ESTABLISHED) { > + if (ti_locked == TI_UNLOCKED) { > + if (INP_INFO_TRY_WLOCK(&V_tcbinfo) == 0) { > in_pcbref(inp); > INP_WUNLOCK(inp); > - INP_INFO_RUNLOCK(&V_tcbinfo); > INP_INFO_WLOCK(&V_tcbinfo); > ti_locked = TI_WLOCKED; > INP_WLOCK(inp); > - if (in_pcbrele(inp)) { > + if (in_pcbrele_wlocked(inp)) { > inp = NULL; > goto findpcb; > } > @@ -1027,13 +1013,16 @@ relocked: > /* > * When the socket is accepting connections (the INPCB is in LISTEN > * state) we look into the SYN cache if this is a new connection > - * attempt or the completion of a previous one. > + * attempt or the completion of a previous one. Because listen > + * sockets are never in TCPS_ESTABLISHED, the V_tcbinfo lock will be > + * held in this case. > */ > if (so->so_options & SO_ACCEPTCONN) { > struct in_conninfo inc; > > KASSERT(tp->t_state == TCPS_LISTEN, ("%s: so accepting but " > "tp not listening", __func__)); > + INP_INFO_WLOCK_ASSERT(&V_tcbinfo); > > bzero(&inc, sizeof(inc)); > #ifdef INET6 > @@ -1371,13 +1360,17 @@ relocked: > return; > > dropwithreset: > - if (ti_locked == TI_RLOCKED) > - INP_INFO_RUNLOCK(&V_tcbinfo); > - else if (ti_locked == TI_WLOCKED) > + if (ti_locked == TI_WLOCKED) { > INP_INFO_WUNLOCK(&V_tcbinfo); > - else > - panic("%s: dropwithreset ti_locked %d", __func__, ti_locked); > - ti_locked = TI_UNLOCKED; > + ti_locked = TI_UNLOCKED; > + } > +#ifdef INVARIANTS > + else { > + KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropwithreset " > + "ti_locked: %d", __func__, ti_locked)); > + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); > + } > +#endif > > if (inp != NULL) { > tcp_dropwithreset(m, th, tp, tlen, rstreason); > @@ -1388,13 +1381,17 @@ dropwithreset: > goto drop; > > dropunlock: > - if (ti_locked == TI_RLOCKED) > - INP_INFO_RUNLOCK(&V_tcbinfo); > - else if (ti_locked == TI_WLOCKED) > + if (ti_locked == TI_WLOCKED) { > INP_INFO_WUNLOCK(&V_tcbinfo); > - else > - panic("%s: dropunlock ti_locked %d", __func__, ti_locked); > - ti_locked = TI_UNLOCKED; > + ti_locked = TI_UNLOCKED; > + } > +#ifdef INVARIANTS > + else { > + KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropunlock " > + "ti_locked: %d", __func__, ti_locked)); > + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); > + } > +#endif > > if (inp != NULL) > INP_WUNLOCK(inp); > @@ -1449,13 +1446,13 @@ tcp_do_segment(struct mbuf *m, struct tc > INP_INFO_WLOCK_ASSERT(&V_tcbinfo); > } else { > #ifdef INVARIANTS > - if (ti_locked == TI_RLOCKED) > - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 15:05:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5507E106566C; Sat, 4 Jun 2011 15:05:33 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 452E88FC12; Sat, 4 Jun 2011 15:05: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 p54F5XYI014783; Sat, 4 Jun 2011 15:05:33 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54F5XW6014781; Sat, 4 Jun 2011 15:05:33 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201106041505.p54F5XW6014781@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 4 Jun 2011 15:05:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222683 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 15:05:33 -0000 Author: bschmidt Date: Sat Jun 4 15:05:32 2011 New Revision: 222683 URL: http://svn.freebsd.org/changeset/base/222683 Log: Certain adapters have HT40 support on some but not all channels. The Intel 4965 devices for example have HT40 on 2GHz completely disabled but it is still supported for 5GHz. To handle that in sta mode we need to check if we can "upgrade" to a HT40 channel after the association, if that is not possible but we are still announcing support to the remote side we are left with a very flabby connection. Reviewed by: adrian Modified: head/sys/net80211/ieee80211_ht.c Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Sat Jun 4 14:28:09 2011 (r222682) +++ head/sys/net80211/ieee80211_ht.c Sat Jun 4 15:05:32 2011 (r222683) @@ -2520,6 +2520,7 @@ ieee80211_add_htcap_body(uint8_t *frm, s frm[1] = (v) >> 8; \ frm += 2; \ } while (0) + struct ieee80211com *ic = ni->ni_ic; struct ieee80211vap *vap = ni->ni_vap; uint16_t caps, extcaps; int rxmax, density; @@ -2543,6 +2544,17 @@ ieee80211_add_htcap_body(uint8_t *frm, s /* use advertised setting (XXX locally constraint) */ rxmax = MS(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU); density = MS(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY); + + /* + * NB: Hardware might support HT40 on some but not all + * channels. We can't determine this earlier because only + * after association the channel is upgraded to HT based + * on the negotiated capabilities. + */ + if (ni->ni_chan != IEEE80211_CHAN_ANYC && + findhtchan(ic, ni->ni_chan, IEEE80211_CHAN_HT40U) == NULL && + findhtchan(ic, ni->ni_chan, IEEE80211_CHAN_HT40D) == NULL) + caps &= ~IEEE80211_HTCAP_CHWIDTH40; } else { /* override 20/40 use based on current channel */ if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 15:05:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19D311065701; Sat, 4 Jun 2011 15:05:53 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3CFF8FC16; Sat, 4 Jun 2011 15:05:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p54F5qQ2014833; Sat, 4 Jun 2011 15:05:52 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54F5qLO014827; Sat, 4 Jun 2011 15:05:52 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106041505.p54F5qLO014827@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 4 Jun 2011 15:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222684 - in head: bin/sh tools/regression/bin/sh/builtins X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 15:05:53 -0000 Author: jilles Date: Sat Jun 4 15:05:52 2011 New Revision: 222684 URL: http://svn.freebsd.org/changeset/base/222684 Log: sh: Reduce more needless differences between error messages. Modified: head/bin/sh/alias.c head/bin/sh/input.c head/bin/sh/jobs.c head/bin/sh/main.c head/tools/regression/bin/sh/builtins/alias.1.stderr Modified: head/bin/sh/alias.c ============================================================================== --- head/bin/sh/alias.c Sat Jun 4 15:05:32 2011 (r222683) +++ head/bin/sh/alias.c Sat Jun 4 15:05:52 2011 (r222684) @@ -238,7 +238,7 @@ aliascmd(int argc, char **argv) while ((n = *++argv) != NULL) { if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */ if ((ap = lookupalias(n, 0)) == NULL) { - warning("%s not found", n); + warning("%s: not found", n); ret = 1; } else printalias(ap); Modified: head/bin/sh/input.c ============================================================================== --- head/bin/sh/input.c Sat Jun 4 15:05:32 2011 (r222683) +++ head/bin/sh/input.c Sat Jun 4 15:05:52 2011 (r222684) @@ -403,7 +403,7 @@ setinputfile(const char *fname, int push INTOFF; if ((fd = open(fname, O_RDONLY)) < 0) - error("Can't open %s: %s", fname, strerror(errno)); + error("cannot open %s: %s", fname, strerror(errno)); if (fd < 10) { fd2 = fcntl(fd, F_DUPFD, 10); close(fd); Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Sat Jun 4 15:05:32 2011 (r222683) +++ head/bin/sh/jobs.c Sat Jun 4 15:05:52 2011 (r222684) @@ -820,7 +820,7 @@ forkshell(struct job *jp, union node *n, ! fd0_redirected_p ()) { close(0); if (open(_PATH_DEVNULL, O_RDONLY) != 0) - error("Can't open %s: %s", + error("cannot open %s: %s", _PATH_DEVNULL, strerror(errno)); } } @@ -832,7 +832,7 @@ forkshell(struct job *jp, union node *n, ! fd0_redirected_p ()) { close(0); if (open(_PATH_DEVNULL, O_RDONLY) != 0) - error("Can't open %s: %s", + error("cannot open %s: %s", _PATH_DEVNULL, strerror(errno)); } } Modified: head/bin/sh/main.c ============================================================================== --- head/bin/sh/main.c Sat Jun 4 15:05:32 2011 (r222683) +++ head/bin/sh/main.c Sat Jun 4 15:05:52 2011 (r222684) @@ -264,7 +264,7 @@ readcmdfile(const char *name) if ((fd = open(name, O_RDONLY)) >= 0) setinputfd(fd, 1); else - error("Can't open %s: %s", name, strerror(errno)); + error("cannot open %s: %s", name, strerror(errno)); INTON; cmdloop(0); popfile(); Modified: head/tools/regression/bin/sh/builtins/alias.1.stderr ============================================================================== --- head/tools/regression/bin/sh/builtins/alias.1.stderr Sat Jun 4 15:05:32 2011 (r222683) +++ head/tools/regression/bin/sh/builtins/alias.1.stderr Sat Jun 4 15:05:52 2011 (r222684) @@ -1 +1 @@ -alias: foo not found +alias: foo: not found From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 14:54:32 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A5481065672; Sat, 4 Jun 2011 14:54:32 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 217538FC17; Sat, 4 Jun 2011 14:54:32 +0000 (UTC) Received: from [192.168.2.112] (host86-173-95-198.range86-173.btcentralplus.com [86.173.95.198]) by cyrus.watson.org (Postfix) with ESMTPSA id D8CBA46B03; Sat, 4 Jun 2011 10:54:29 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/mixed; boundary=Apple-Mail-7-327068992 From: "Robert N. M. Watson" In-Reply-To: <20110604143043.GE17764@nereid> Date: Sat, 4 Jun 2011 15:54:26 +0100 Message-Id: <64903CD6-7AED-4BF6-9FDF-B6748690EA8A@FreeBSD.org> References: <201105300943.p4U9htjI070096@svn.freebsd.org> <20110604143043.GE17764@nereid> To: Kristof Provost X-Mailer: Apple Mail (2.1084) X-Mailman-Approved-At: Sat, 04 Jun 2011 15:07:22 +0000 Cc: "freebsd-current@FreeBSD.org Current" Subject: Divert socket problem (was: Re: svn commit: r222488 - in head/sys: contrib/pf/net netinet netinet/ipfw netinet6) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 14:54:32 -0000 --Apple-Mail-7-327068992 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 4 Jun 2011, at 15:30, Kristof Provost wrote: > div_bind probably also needs to surround the call to in_pcbbind with > INP_HASHW(UN)LOCK(...) >=20 > I'm currently running 222680. I've only now seen the issue, but I've = also > just now activated INVARIANTS. Hi Kristof: Thanks for the detailed report, and yes, it looks like that is exactly = what is required. Could you try the attached patch? Robert --Apple-Mail-7-327068992 Content-Disposition: attachment; filename=20110604-divert-fix.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="20110604-divert-fix.diff" Content-Transfer-Encoding: 7bit IP divert sockets use their inpcbinfo for port reservation, although not for lookup. I missed its call to in_pcbbind() when preparing previous patches, which would lead to a lock assertion failure (although problem not an actual race condition due to global pcbinfo locks providing required synchronisation -- in this particular case only). This change adds the missing locking of the pcbhash lock. (Existing comments in the ipdivert code question the need for using the global hash to manage the namespace, as really it's a simple port namespace and not an address/port namespace. Also, although in_pcbbind is used to manage reservations, the hash tables aren't used for lookup. It might be a good idea to make them use hashed lookup, or to use a different reservation scheme.) Reviewed by: bz Reported by: Kristof Provost Sponsored by: Juniper Networks Index: ip_divert.c =================================================================== --- ip_divert.c (revision 222672) +++ ip_divert.c (working copy) @@ -530,7 +530,9 @@ ((struct sockaddr_in *)nam)->sin_addr.s_addr = INADDR_ANY; INP_INFO_WLOCK(&V_divcbinfo); INP_WLOCK(inp); + INP_HASH_WLOCK(&V_divcbinfo); error = in_pcbbind(inp, nam, td->td_ucred); + INP_HASH_WUNLOCK(&V_divcbinfo); INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_divcbinfo); return error; --Apple-Mail-7-327068992-- From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 15:17:35 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2A4C106564A; Sat, 4 Jun 2011 15:17:35 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E173C8FC0C; Sat, 4 Jun 2011 15:17:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p54FHZBA015280; Sat, 4 Jun 2011 15:17:35 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54FHZr0015275; Sat, 4 Jun 2011 15:17:35 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201106041517.p54FHZr0015275@svn.freebsd.org> From: Andreas Tobler Date: Sat, 4 Jun 2011 15:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222686 - in head/sys: conf powerpc/conf powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 15:17:36 -0000 Author: andreast Date: Sat Jun 4 15:17:35 2011 New Revision: 222686 URL: http://svn.freebsd.org/changeset/base/222686 Log: Add new fan controller driver for the G4 MDD PowerMac. Submitted and tested by Justin Hibbits. Approved by: nwhitehorn (mentor) Added: head/sys/powerpc/powermac/windtunnel.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/NOTES Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sat Jun 4 15:15:42 2011 (r222685) +++ head/sys/conf/files.powerpc Sat Jun 4 15:17:35 2011 (r222686) @@ -162,6 +162,7 @@ powerpc/powermac/smusat.c optional power powerpc/powermac/uninorth.c optional powermac powerpc/powermac/uninorthpci.c optional powermac pci powerpc/powermac/vcoregpio.c optional powermac +powerpc/powermac/windtunnel.c optional powermac windtunnel powerpc/powerpc/altivec.c optional aim powerpc/powerpc/atomic.S standard powerpc/powerpc/autoconf.c standard Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Sat Jun 4 15:15:42 2011 (r222685) +++ head/sys/powerpc/conf/GENERIC Sat Jun 4 15:17:35 2011 (r222686) @@ -180,6 +180,7 @@ device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor device powermac_nvram # Open Firmware configuration NVRAM device smu # Apple System Management Unit +device windtunnel # Apple G4 MDD fan controller # ADB support device adb Modified: head/sys/powerpc/conf/NOTES ============================================================================== --- head/sys/powerpc/conf/NOTES Sat Jun 4 15:15:42 2011 (r222685) +++ head/sys/powerpc/conf/NOTES Sat Jun 4 15:17:35 2011 (r222686) @@ -47,6 +47,7 @@ device pmu # Apple Power Management Un device smu # Apple System Management Unit device snd_ai2s # Apple I2S Audio device snd_davbus # Apple Davbus Audio +device windtunnel # Apple G4 MDD fan controller ##################################################################### Added: head/sys/powerpc/powermac/windtunnel.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powermac/windtunnel.c Sat Jun 4 15:17:35 2011 (r222686) @@ -0,0 +1,216 @@ +/*- + * Copyright (c) 2011 Justin Hibbits + * Copyright (c) 2010 Andreas Tobler + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include + +struct adm1030_softc { + struct pmac_fan fan; + device_t sc_dev; + struct intr_config_hook enum_hook; + uint32_t sc_addr; + phandle_t sc_thermostat_phandle; + device_t sc_thermostat_dev; +}; + +/* Regular bus attachment functions */ +static int adm1030_probe(device_t); +static int adm1030_attach(device_t); + +/* Utility functions */ +static void adm1030_start(void *xdev); +static int adm1030_write_byte(device_t dev, uint32_t addr, uint8_t reg, uint8_t buf); +static int adm1030_set(struct adm1030_softc *fan, int pwm); + +static device_method_t adm1030_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, adm1030_probe), + DEVMETHOD(device_attach, adm1030_attach), + {0, 0}, +}; + +static driver_t adm1030_driver = { + "adm1030", + adm1030_methods, + sizeof(struct adm1030_softc) +}; + +static devclass_t adm1030_devclass; + +DRIVER_MODULE(adm1030, iicbus, adm1030_driver, adm1030_devclass, 0, 0); + +static int +adm1030_write_byte(device_t dev, uint32_t addr, uint8_t reg, uint8_t byte) +{ + unsigned char buf[4]; + int try = 0; + + struct iic_msg msg[] = { + {addr, IIC_M_WR, 0, buf} + }; + + msg[0].len = 2; + buf[0] = reg; + buf[1] = byte; + + for (;;) + { + if (iicbus_transfer(dev, msg, 1) == 0) + return (0); + + if (++try > 5) { + device_printf(dev, "iicbus write failed\n"); + return (-1); + } + pause("adm1030_write_byte", hz); + } +} + +static int +adm1030_probe(device_t dev) +{ + const char *name, *compatible; + struct adm1030_softc *sc; + phandle_t handle; + phandle_t thermostat; + + name = ofw_bus_get_name(dev); + compatible = ofw_bus_get_compat(dev); + handle = ofw_bus_get_node(dev); + + if (!name) + return (ENXIO); + + if (strcmp(name, "fan") != 0 || strcmp(compatible, "adm1030") != 0) + return (ENXIO); + + /* This driver can only be used if there's an associated temp sensor. */ + if (OF_getprop(handle, "platform-getTemp", &thermostat, sizeof(thermostat)) < 0) + return (ENXIO); + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_addr = iicbus_get_addr(dev); + + device_set_desc(dev, "G4 MDD Fan driver"); + + return (0); +} + +static int +adm1030_attach(device_t dev) +{ + struct adm1030_softc *sc; + + sc = device_get_softc(dev); + + sc->enum_hook.ich_func = adm1030_start; + sc->enum_hook.ich_arg = dev; + + /* + * We have to wait until interrupts are enabled. I2C read and write + * only works if the interrupts are available. The unin/i2c is + * controlled by the htpic on unin. But this is not the master. The + * openpic on mac-io is controlling the htpic. This one gets attached + * after the mac-io probing and then the interrupts will be + * available. + */ + + if (config_intrhook_establish(&sc->enum_hook) != 0) + return (ENOMEM); + + return (0); +} + +static void +adm1030_start(void *xdev) +{ + struct adm1030_softc *sc; + + device_t dev = (device_t) xdev; + + sc = device_get_softc(dev); + + /* Start the adm1030 device. */ + adm1030_write_byte(sc->sc_dev, sc->sc_addr, 0x1, 0x1); + adm1030_write_byte(sc->sc_dev, sc->sc_addr, 0x0, 0x95); + adm1030_write_byte(sc->sc_dev, sc->sc_addr, 0x23, 0x91); + + /* Use the RPM fields as PWM duty cycles. */ + sc->fan.min_rpm = 0; + sc->fan.max_rpm = 15; + sc->fan.default_rpm = 2; + + strcpy(sc->fan.name, "MDD Case fan"); + sc->fan.zone = 0; + sc->fan.read = NULL; + sc->fan.set = (int (*)(struct pmac_fan *, int))adm1030_set; + config_intrhook_disestablish(&sc->enum_hook); + + pmac_thermal_fan_register(&sc->fan); +} + +static int adm1030_set(struct adm1030_softc *fan, int pwm) +{ + /* Clamp the PWM to 0-0xF, one nibble. */ + if (pwm > 0xF) + pwm = 0xF; + if (pwm < 0) + pwm = 0; + + if (adm1030_write_byte(fan->sc_dev, fan->sc_addr, 0x22, pwm) < 0) + return (-1); + + return (0); +} + From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 15:22:02 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 128E91065673; Sat, 4 Jun 2011 15:22:02 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 031A68FC14; Sat, 4 Jun 2011 15:22:02 +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 p54FM1Mh015464; Sat, 4 Jun 2011 15:22:01 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54FM1lq015462; Sat, 4 Jun 2011 15:22:01 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201106041522.p54FM1lq015462@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 4 Jun 2011 15:22:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222687 - head/sys/dev/iwn X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 15:22:02 -0000 Author: bschmidt Date: Sat Jun 4 15:22:01 2011 New Revision: 222687 URL: http://svn.freebsd.org/changeset/base/222687 Log: Enable HT40 (40MHz channel width) support. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sat Jun 4 15:17:35 2011 (r222686) +++ head/sys/dev/iwn/if_iwn.c Sat Jun 4 15:22:01 2011 (r222687) @@ -606,9 +606,9 @@ iwn_attach(device_t dev) ic->ic_htcaps = IEEE80211_HTCAP_SMPS_OFF /* SMPS mode disabled */ | IEEE80211_HTCAP_SHORTGI20 /* short GI in 20MHz */ -#ifdef notyet | IEEE80211_HTCAP_CHWIDTH40 /* 40MHz channel width*/ | IEEE80211_HTCAP_SHORTGI40 /* short GI in 40MHz */ +#ifdef notyet | IEEE80211_HTCAP_GREENFIELD #if IWN_RBUF_SIZE == 8192 | IEEE80211_HTCAP_MAXAMSDU_7935 /* max A-MSDU length */ From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 16:01:30 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1F4F1065670; Sat, 4 Jun 2011 16:01:30 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C21D38FC08; Sat, 4 Jun 2011 16:01:30 +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 p54G1UjV016699; Sat, 4 Jun 2011 16:01:30 GMT (envelope-from sobomax@svn.freebsd.org) Received: (from sobomax@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54G1Ut7016697; Sat, 4 Jun 2011 16:01:30 GMT (envelope-from sobomax@svn.freebsd.org) Message-Id: <201106041601.p54G1Ut7016697@svn.freebsd.org> From: Maxim Sobolev Date: Sat, 4 Jun 2011 16:01:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222688 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 16:01:30 -0000 Author: sobomax Date: Sat Jun 4 16:01:30 2011 New Revision: 222688 URL: http://svn.freebsd.org/changeset/base/222688 Log: Read from the socket using the same max buffer size as we use while sending. What happens otherwise is that the sender splits all the traffic into 32k chunks, while the receiver is waiting for the whole packet. Then for a certain packet sizes, particularly 66607 bytes in my case, the communication stucks to secondary is expecting to read one chunk of 66607 bytes, while primary is sending two chunks of 32768 bytes and third chunk of 1071. Probably due to TCP windowing and buffering the final chunk gets stuck somewhere, so neither server not client can make any progress. This patch also protect from short reads, as according to the manual page there are some cases when MSG_WAITALL can give less data than expected. MFC after: 3 days Modified: head/sbin/hastd/proto_common.c Modified: head/sbin/hastd/proto_common.c ============================================================================== --- head/sbin/hastd/proto_common.c Sat Jun 4 15:22:01 2011 (r222687) +++ head/sbin/hastd/proto_common.c Sat Jun 4 16:01:30 2011 (r222688) @@ -194,6 +194,8 @@ int proto_common_recv(int sock, unsigned char *data, size_t size, int *fdp) { ssize_t done; + size_t total_done, recvsize; + unsigned char *dp; PJDLOG_ASSERT(sock >= 0); @@ -210,9 +212,19 @@ proto_common_recv(int sock, unsigned cha PJDLOG_ASSERT(data != NULL); PJDLOG_ASSERT(size > 0); + total_done = 0; + dp = data; do { - done = recv(sock, data, size, MSG_WAITALL); - } while (done == -1 && errno == EINTR); + recvsize = size - total_done; + recvsize = recvsize < MAX_SEND_SIZE ? recvsize : MAX_SEND_SIZE; + done = recv(sock, dp, recvsize, MSG_WAITALL); + if (done == -1 && errno == EINTR) + continue; + if (done <= 0) + break; + total_done += done; + dp += done; + } while (total_done < size); if (done == 0) { return (ENOTCONN); } else if (done < 0) { From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 16:25:12 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BC9D106566C; Sat, 4 Jun 2011 16:25:12 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7AF4B8FC14; Sat, 4 Jun 2011 16:25: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 p54GPCUA017468; Sat, 4 Jun 2011 16:25:12 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54GPC4P017466; Sat, 4 Jun 2011 16:25:12 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201106041625.p54GPC4P017466@svn.freebsd.org> From: Robert Watson Date: Sat, 4 Jun 2011 16:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222689 - head/tools/regression/netinet/ipdivert X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 16:25:12 -0000 Author: rwatson Date: Sat Jun 4 16:25:12 2011 New Revision: 222689 URL: http://svn.freebsd.org/changeset/base/222689 Log: Add a very simple IPDIVERT test, which creates IP divert sockets and checks for collision/non-collision properties in binding them. This test would have identified a bug recently reported on current@ involding my disaggregation of the pcbinfo lock. It would be nice if this test also exercised packet diversion and injection, but that is for another day. MFC after: 3 days Sponsored by: Juniper Networks, Inc. Added: head/tools/regression/netinet/ipdivert/ head/tools/regression/netinet/ipdivert/Makefile (contents, props changed) head/tools/regression/netinet/ipdivert/ipdivert.c (contents, props changed) Added: head/tools/regression/netinet/ipdivert/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/netinet/ipdivert/Makefile Sat Jun 4 16:25:12 2011 (r222689) @@ -0,0 +1,11 @@ +# +# $FreeBSD$ +# + +PROG= ipdivert +SRCS= ipdivert.c +NO_MAN= + +WARNS?= 2 + +.include Added: head/tools/regression/netinet/ipdivert/ipdivert.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/netinet/ipdivert/ipdivert.c Sat Jun 4 16:25:12 2011 (r222689) @@ -0,0 +1,166 @@ +/*- + * Copyright (c) 2010-2011 Juniper Networks, Inc. + * All rights reserved. + * + * This software was developed by Robert N. M. Watson under contract + * to Juniper Networks, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * This is a test tool for IP divert sockets. For the time being, it just + * exercise creation and binding of sockets, rather than their divert + * behaviour. It would be highly desirable to broaden this test tool to + * include packet injection and diversion. + */ + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +static void +ok(const char *test) +{ + + fprintf(stderr, "%s: OK\n", test); +} + +static void +fail(const char *test, const char *note) +{ + + fprintf(stderr, "%s - %s: FAIL (%s)\n", test, note, strerror(errno)); + exit(1); +} + +static void +failx(const char *test, const char *note) +{ + + fprintf(stderr, "%s - %s: FAIL\n", test, note); + exit(1); +} + +static int +ipdivert_create(const char *test) +{ + int s; + + s = socket(PF_INET, SOCK_RAW, IPPROTO_DIVERT); + if (s < 0) + fail(test, "socket"); + return (s); +} + +static void +ipdivert_close(const char *test, int s) +{ + + if (close(s) < 0) + fail(test, "close"); +} + +static void +ipdivert_bind(const char *test, int s, u_short port, int expect) +{ + struct sockaddr_in sin; + int err; + + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = htonl(INADDR_ANY); + sin.sin_port = htons(port); + + err = bind(s, (struct sockaddr *)&sin, sizeof(sin)); + if (err < 0) { + if (expect == 0) + fail(test, "bind"); + if (errno != expect) + fail(test, "bind"); + } else { + if (expect != 0) + failx(test, "bind"); + } +} + +int +main(int argc, char *argv[]) +{ + const char *test; + int s1, s2; + + /* + * First test: create and close an IP divert socket. + */ + test = "create_close"; + s1 = ipdivert_create(test); + ipdivert_close(test, s1); + ok(test); + + /* + * Second test: create, bind, and close an IP divert socket. + */ + test = "create_bind_close"; + s1 = ipdivert_create(test); + ipdivert_bind(test, s1, 1000, 0); + ipdivert_close(test, s1); + ok(test); + + /* + * Third test: create two sockets, bind to different ports, and close. + * This should succeed due to non-conflict on the port numbers. + */ + test = "create2_bind2_close2"; + s1 = ipdivert_create(test); + s2 = ipdivert_create(test); + ipdivert_bind(test, s1, 1000, 0); + ipdivert_bind(test, s2, 1001, 0); + ipdivert_close(test, s1); + ipdivert_close(test, s2); + ok(test); + + /* + * Fourth test: create two sockets, bind to the *same* port, and + * close. This should fail due to conflicting port numbers. + */ + test = "create2_bind2_conflict_close2"; + s1 = ipdivert_create(test); + s2 = ipdivert_create(test); + ipdivert_bind(test, s1, 1000, 0); + ipdivert_bind(test, s2, 1000, EADDRINUSE); + ipdivert_close(test, s1); + ipdivert_close(test, s2); + ok(test); + + return (0); +} From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 16:26:02 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E17121065672; Sat, 4 Jun 2011 16:26:02 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1EAD8FC21; Sat, 4 Jun 2011 16:26:02 +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 p54GQ2Qg017531; Sat, 4 Jun 2011 16:26:02 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54GQ27O017529; Sat, 4 Jun 2011 16:26:02 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201106041626.p54GQ27O017529@svn.freebsd.org> From: Robert Watson Date: Sat, 4 Jun 2011 16:26:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222690 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 16:26:03 -0000 Author: rwatson Date: Sat Jun 4 16:26:02 2011 New Revision: 222690 URL: http://svn.freebsd.org/changeset/base/222690 Log: IP divert sockets use their inpcbinfo for port reservation, although not for lookup. I missed its call to in_pcbbind() when preparing previous patches, which would lead to a lock assertion failure (although problem not an actual race condition due to global pcbinfo locks providing required synchronisation -- in this particular case only). This change adds the missing locking of the pcbhash lock. (Existing comments in the ipdivert code question the need for using the global hash to manage the namespace, as really it's a simple port namespace and not an address/port namespace. Also, although in_pcbbind is used to manage reservations, the hash tables aren't used for lookup. It might be a good idea to make them use hashed lookup, or to use a different reservation scheme.) Reviewed by: bz Reported by: Kristof Provost Sponsored by: Juniper Networks Modified: head/sys/netinet/ip_divert.c Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Sat Jun 4 16:25:12 2011 (r222689) +++ head/sys/netinet/ip_divert.c Sat Jun 4 16:26:02 2011 (r222690) @@ -530,7 +530,9 @@ div_bind(struct socket *so, struct socka ((struct sockaddr_in *)nam)->sin_addr.s_addr = INADDR_ANY; INP_INFO_WLOCK(&V_divcbinfo); INP_WLOCK(inp); + INP_HASH_WLOCK(&V_divcbinfo); error = in_pcbbind(inp, nam, td->td_ucred); + INP_HASH_WUNLOCK(&V_divcbinfo); INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_divcbinfo); return error; From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 16:27:57 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B2411065672; Sat, 4 Jun 2011 16:27:57 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F3FFB8FC14; Sat, 4 Jun 2011 16:27:56 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 6F0B846B06; Sat, 4 Jun 2011 12:27:56 -0400 (EDT) Date: Sat, 4 Jun 2011 17:27:56 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Kristof Provost In-Reply-To: <20110604143043.GE17764@nereid> Message-ID: References: <201105300943.p4U9htjI070096@svn.freebsd.org> <20110604143043.GE17764@nereid> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222488 - in head/sys: contrib/pf/net netinet netinet/ipfw netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 16:27:57 -0000 On Sat, 4 Jun 2011, Kristof Provost wrote: > I'm seeing a panic when I start natd, which I suspect is related to this > commit: And, I believe now fixed in the just-committed r222690. My suggestion is that people running -CURRENT should generally keep INVARIANTS and WITNESS on -- they introduce some overhead, but are invaluable in tracking down problems. Thanks! Robert > > panic: Lock pcbinfohash not exclusively locked @ > /usr/src/sys/netinet/in_pcb.c:323 > > Backtrace: > panic() ... > _rw_assert() at _rw_assert+0x18d > in_pcbbind() at in_pcbbind+0xf5 > div_bind() at div_bind+0xb9 > sobind() at sobind()+0x79 > kern_bind() at kern_bind+0xde > bind() at bind()+0x41 > syscallenter() at syscallenter+0x1cb > syscall() at syscall+0x4c > Xfast_syscall() at Xfast_syscall+0xdd > > div_bind probably also needs to surround the call to in_pcbbind with > INP_HASHW(UN)LOCK(...) > > I'm currently running 222680. I've only now seen the issue, but I've also > just now activated INVARIANTS. > > Regards, > Kristof > > On 2011-05-30 09:43:55 (+0000), Robert Watson wrote: >> Author: rwatson >> Date: Mon May 30 09:43:55 2011 >> New Revision: 222488 >> URL: http://svn.freebsd.org/changeset/base/222488 >> >> Log: >> Decompose the current single inpcbinfo lock into two locks: >> >> - The existing ipi_lock continues to protect the global inpcb list and >> inpcb counter. This lock is now relegated to a small number of >> allocation and free operations, and occasional operations that walk >> all connections (including, awkwardly, certain UDP multicast receive >> operations -- something to revisit). >> >> - A new ipi_hash_lock protects the two inpcbinfo hash tables for >> looking up connections and bound sockets, manipulated using new >> INP_HASH_*() macros. This lock, combined with inpcb locks, protects >> the 4-tuple address space. >> >> Unlike the current ipi_lock, ipi_hash_lock follows the individual inpcb >> connection locks, so may be acquired while manipulating a connection on >> which a lock is already held, avoiding the need to acquire the inpcbinfo >> lock preemptively when a binding change might later be required. As a >> result, however, lookup operations necessarily go through a reference >> acquire while holding the lookup lock, later acquiring an inpcb lock -- >> if required. >> >> A new function in_pcblookup() looks up connections, and accepts flags >> indicating how to return the inpcb. Due to lock order changes, callers >> no longer need acquire locks before performing a lookup: the lookup >> routine will acquire the ipi_hash_lock as needed. In the future, it will >> also be able to use alternative lookup and locking strategies >> transparently to callers, such as pcbgroup lookup. New lookup flags are, >> supplementing the existing INPLOOKUP_WILDCARD flag: >> >> INPLOOKUP_RLOCKPCB - Acquire a read lock on the returned inpcb >> INPLOOKUP_WLOCKPCB - Acquire a write lock on the returned inpcb >> >> Callers must pass exactly one of these flags (for the time being). >> >> Some notes: >> >> - All protocols are updated to work within the new regime; especially, >> TCP, UDPv4, and UDPv6. pcbinfo ipi_lock acquisitions are largely >> eliminated, and global hash lock hold times are dramatically reduced >> compared to previous locking. >> - The TCP syncache still relies on the pcbinfo lock, something that we >> may want to revisit. >> - Support for reverting to the FreeBSD 7.x locking strategy in TCP input >> is no longer available -- hash lookup locks are now held only very >> briefly during inpcb lookup, rather than for potentially extended >> periods. However, the pcbinfo ipi_lock will still be acquired if a >> connection state might change such that a connection is added or >> removed. >> - Raw IP sockets continue to use the pcbinfo ipi_lock for protection, >> due to maintaining their own hash tables. >> - The interface in6_pcblookup_hash_locked() is maintained, which allows >> callers to acquire hash locks and perform one or more lookups atomically >> with 4-tuple allocation: this is required only for TCPv6, as there is no >> in6_pcbconnect_setup(), which there should be. >> - UDPv6 locking remains significantly more conservative than UDPv4 >> locking, which relates to source address selection. This needs >> attention, as it likely significantly reduces parallelism in this code >> for multithreaded socket use (such as in BIND). >> - In the UDPv4 and UDPv6 multicast cases, we need to revisit locking >> somewhat, as they relied on ipi_lock to stablise 4-tuple matches, which >> is no longer sufficient. A second check once the inpcb lock is held >> should do the trick, keeping the general case from requiring the inpcb >> lock for every inpcb visited. >> - This work reminds us that we need to revisit locking of the v4/v6 flags, >> which may be accessed lock-free both before and after this change. >> - Right now, a single lock name is used for the pcbhash lock -- this is >> undesirable, and probably another argument is required to take care of >> this (or a char array name field in the pcbinfo?). >> >> This is not an MFC candidate for 8.x due to its impact on lookup and >> locking semantics. It's possible some of these issues could be worked >> around with compatibility wrappers, if necessary. >> >> Reviewed by: bz >> Sponsored by: Juniper Networks, Inc. >> >> Modified: >> head/sys/contrib/pf/net/pf.c >> head/sys/netinet/in_pcb.c >> head/sys/netinet/in_pcb.h >> head/sys/netinet/ip_divert.c >> head/sys/netinet/ipfw/ip_fw2.c >> head/sys/netinet/raw_ip.c >> head/sys/netinet/siftr.c >> head/sys/netinet/tcp_input.c >> head/sys/netinet/tcp_subr.c >> head/sys/netinet/tcp_syncache.c >> head/sys/netinet/tcp_timer.c >> head/sys/netinet/tcp_usrreq.c >> head/sys/netinet/udp_usrreq.c >> head/sys/netinet6/in6_pcb.c >> head/sys/netinet6/in6_pcb.h >> head/sys/netinet6/in6_src.c >> head/sys/netinet6/udp6_usrreq.c >> >> Modified: head/sys/contrib/pf/net/pf.c >> ============================================================================== >> --- head/sys/contrib/pf/net/pf.c Mon May 30 09:41:38 2011 (r222487) >> +++ head/sys/contrib/pf/net/pf.c Mon May 30 09:43:55 2011 (r222488) >> @@ -3034,16 +3034,14 @@ pf_socket_lookup(int direction, struct p >> #ifdef INET >> case AF_INET: >> #ifdef __FreeBSD__ >> - INP_INFO_RLOCK(pi); /* XXX LOR */ >> - inp = in_pcblookup_hash(pi, saddr->v4, sport, daddr->v4, >> - dport, 0, NULL); >> + inp = in_pcblookup(pi, saddr->v4, sport, daddr->v4, >> + dport, INPLOOKUP_RLOCKPCB, NULL); >> if (inp == NULL) { >> - inp = in_pcblookup_hash(pi, saddr->v4, sport, >> - daddr->v4, dport, INPLOOKUP_WILDCARD, NULL); >> - if(inp == NULL) { >> - INP_INFO_RUNLOCK(pi); >> + inp = in_pcblookup(pi, saddr->v4, sport, >> + daddr->v4, dport, INPLOOKUP_WILDCARD | >> + INPLOOKUP_RLOCKPCB, NULL); >> + if (inp == NULL) >> return (-1); >> - } >> } >> #else >> inp = in_pcbhashlookup(tb, saddr->v4, sport, daddr->v4, dport); >> @@ -3058,16 +3056,14 @@ pf_socket_lookup(int direction, struct p >> #ifdef INET6 >> case AF_INET6: >> #ifdef __FreeBSD__ >> - INP_INFO_RLOCK(pi); >> - inp = in6_pcblookup_hash(pi, &saddr->v6, sport, >> - &daddr->v6, dport, 0, NULL); >> + inp = in6_pcblookup(pi, &saddr->v6, sport, >> + &daddr->v6, dport, INPLOOKUP_RLOCKPCB, NULL); >> if (inp == NULL) { >> - inp = in6_pcblookup_hash(pi, &saddr->v6, sport, >> - &daddr->v6, dport, INPLOOKUP_WILDCARD, NULL); >> - if (inp == NULL) { >> - INP_INFO_RUNLOCK(pi); >> + inp = in6_pcblookup(pi, &saddr->v6, sport, >> + &daddr->v6, dport, INPLOOKUP_WILDCARD | >> + INPLOOKUP_RLOCKPCB, NULL); >> + if (inp == NULL) >> return (-1); >> - } >> } >> #else >> inp = in6_pcbhashlookup(tb, &saddr->v6, sport, &daddr->v6, >> @@ -3085,9 +3081,10 @@ pf_socket_lookup(int direction, struct p >> return (-1); >> } >> #ifdef __FreeBSD__ >> + INP_RLOCK_ASSERT(inp); >> pd->lookup.uid = inp->inp_cred->cr_uid; >> pd->lookup.gid = inp->inp_cred->cr_groups[0]; >> - INP_INFO_RUNLOCK(pi); >> + INP_RUNLOCK(inp); >> #else >> pd->lookup.uid = inp->inp_socket->so_euid; >> pd->lookup.gid = inp->inp_socket->so_egid; >> >> Modified: head/sys/netinet/in_pcb.c >> ============================================================================== >> --- head/sys/netinet/in_pcb.c Mon May 30 09:41:38 2011 (r222487) >> +++ head/sys/netinet/in_pcb.c Mon May 30 09:43:55 2011 (r222488) >> @@ -127,6 +127,10 @@ static VNET_DEFINE(int, ipport_tcplastco >> >> #define V_ipport_tcplastcount VNET(ipport_tcplastcount) >> >> +static struct inpcb *in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, >> + struct in_addr faddr, u_int fport_arg, >> + struct in_addr laddr, u_int lport_arg, >> + int lookupflags, struct ifnet *ifp); >> static void in_pcbremlists(struct inpcb *inp); >> >> #ifdef INET >> @@ -212,11 +216,13 @@ in_pcbinfo_init(struct inpcbinfo *pcbinf >> { >> >> INP_INFO_LOCK_INIT(pcbinfo, name); >> + INP_HASH_LOCK_INIT(pcbinfo, "pcbinfohash"); /* XXXRW: argument? */ >> #ifdef VIMAGE >> pcbinfo->ipi_vnet = curvnet; >> #endif >> pcbinfo->ipi_listhead = listhead; >> LIST_INIT(pcbinfo->ipi_listhead); >> + pcbinfo->ipi_count = 0; >> pcbinfo->ipi_hashbase = hashinit(hash_nelements, M_PCB, >> &pcbinfo->ipi_hashmask); >> pcbinfo->ipi_porthashbase = hashinit(porthash_nelements, M_PCB, >> @@ -234,10 +240,14 @@ void >> in_pcbinfo_destroy(struct inpcbinfo *pcbinfo) >> { >> >> + KASSERT(pcbinfo->ipi_count == 0, >> + ("%s: ipi_count = %u", __func__, pcbinfo->ipi_count)); >> + >> hashdestroy(pcbinfo->ipi_hashbase, M_PCB, pcbinfo->ipi_hashmask); >> hashdestroy(pcbinfo->ipi_porthashbase, M_PCB, >> pcbinfo->ipi_porthashmask); >> uma_zdestroy(pcbinfo->ipi_zone); >> + INP_HASH_LOCK_DESTROY(pcbinfo); >> INP_INFO_LOCK_DESTROY(pcbinfo); >> } >> >> @@ -309,8 +319,8 @@ in_pcbbind(struct inpcb *inp, struct soc >> { >> int anonport, error; >> >> - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); >> INP_WLOCK_ASSERT(inp); >> + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); >> >> if (inp->inp_lport != 0 || inp->inp_laddr.s_addr != INADDR_ANY) >> return (EINVAL); >> @@ -351,8 +361,8 @@ in_pcb_lport(struct inpcb *inp, struct i >> * Because no actual state changes occur here, a global write lock on >> * the pcbinfo isn't required. >> */ >> - INP_INFO_LOCK_ASSERT(pcbinfo); >> INP_LOCK_ASSERT(inp); >> + INP_HASH_LOCK_ASSERT(pcbinfo); >> >> if (inp->inp_flags & INP_HIGHPORT) { >> first = V_ipport_hifirstauto; /* sysctl */ >> @@ -473,11 +483,10 @@ in_pcbbind_setup(struct inpcb *inp, stru >> int error; >> >> /* >> - * Because no actual state changes occur here, a global write lock on >> - * the pcbinfo isn't required. >> + * No state changes, so read locks are sufficient here. >> */ >> - INP_INFO_LOCK_ASSERT(pcbinfo); >> INP_LOCK_ASSERT(inp); >> + INP_HASH_LOCK_ASSERT(pcbinfo); >> >> if (TAILQ_EMPTY(&V_in_ifaddrhead)) /* XXX broken! */ >> return (EADDRNOTAVAIL); >> @@ -618,8 +627,8 @@ in_pcbconnect(struct inpcb *inp, struct >> in_addr_t laddr, faddr; >> int anonport, error; >> >> - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); >> INP_WLOCK_ASSERT(inp); >> + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); >> >> lport = inp->inp_lport; >> laddr = inp->inp_laddr.s_addr; >> @@ -907,8 +916,8 @@ in_pcbconnect_setup(struct inpcb *inp, s >> * Because a global state change doesn't actually occur here, a read >> * lock is sufficient. >> */ >> - INP_INFO_LOCK_ASSERT(inp->inp_pcbinfo); >> INP_LOCK_ASSERT(inp); >> + INP_HASH_LOCK_ASSERT(inp->inp_pcbinfo); >> >> if (oinpp != NULL) >> *oinpp = NULL; >> @@ -983,8 +992,8 @@ in_pcbconnect_setup(struct inpcb *inp, s >> if (error) >> return (error); >> } >> - oinp = in_pcblookup_hash(inp->inp_pcbinfo, faddr, fport, laddr, lport, >> - 0, NULL); >> + oinp = in_pcblookup_hash_locked(inp->inp_pcbinfo, faddr, fport, >> + laddr, lport, 0, NULL); >> if (oinp != NULL) { >> if (oinpp != NULL) >> *oinpp = oinp; >> @@ -1007,8 +1016,8 @@ void >> in_pcbdisconnect(struct inpcb *inp) >> { >> >> - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); >> INP_WLOCK_ASSERT(inp); >> + INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); >> >> inp->inp_faddr.s_addr = INADDR_ANY; >> inp->inp_fport = 0; >> @@ -1187,19 +1196,24 @@ void >> in_pcbdrop(struct inpcb *inp) >> { >> >> - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); >> INP_WLOCK_ASSERT(inp); >> >> + /* >> + * XXXRW: Possibly we should protect the setting of INP_DROPPED with >> + * the hash lock...? >> + */ >> inp->inp_flags |= INP_DROPPED; >> if (inp->inp_flags & INP_INHASHLIST) { >> struct inpcbport *phd = inp->inp_phd; >> >> + INP_HASH_WLOCK(inp->inp_pcbinfo); >> LIST_REMOVE(inp, inp_hash); >> LIST_REMOVE(inp, inp_portlist); >> if (LIST_FIRST(&phd->phd_pcblist) == NULL) { >> LIST_REMOVE(phd, phd_hash); >> free(phd, M_PCB); >> } >> + INP_HASH_WUNLOCK(inp->inp_pcbinfo); >> inp->inp_flags &= ~INP_INHASHLIST; >> } >> } >> @@ -1328,7 +1342,8 @@ in_pcbpurgeif0(struct inpcbinfo *pcbinfo >> } >> >> /* >> - * Lookup a PCB based on the local address and port. >> + * Lookup a PCB based on the local address and port. Caller must hold the >> + * hash lock. No inpcb locks or references are acquired. >> */ >> #define INP_LOOKUP_MAPPED_PCB_COST 3 >> struct inpcb * >> @@ -1346,7 +1361,7 @@ in_pcblookup_local(struct inpcbinfo *pcb >> KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, >> ("%s: invalid lookup flags %d", __func__, lookupflags)); >> >> - INP_INFO_LOCK_ASSERT(pcbinfo); >> + INP_HASH_LOCK_ASSERT(pcbinfo); >> >> if ((lookupflags & INPLOOKUP_WILDCARD) == 0) { >> struct inpcbhead *head; >> @@ -1450,10 +1465,12 @@ in_pcblookup_local(struct inpcbinfo *pcb >> #undef INP_LOOKUP_MAPPED_PCB_COST >> >> /* >> - * Lookup PCB in hash list. >> + * Lookup PCB in hash list, using pcbinfo tables. This variation assumes >> + * that the caller has locked the hash list, and will not perform any further >> + * locking or reference operations on either the hash list or the connection. >> */ >> -struct inpcb * >> -in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr, >> +static struct inpcb * >> +in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, struct in_addr faddr, >> u_int fport_arg, struct in_addr laddr, u_int lport_arg, int lookupflags, >> struct ifnet *ifp) >> { >> @@ -1464,7 +1481,7 @@ in_pcblookup_hash(struct inpcbinfo *pcbi >> KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, >> ("%s: invalid lookup flags %d", __func__, lookupflags)); >> >> - INP_INFO_LOCK_ASSERT(pcbinfo); >> + INP_HASH_LOCK_ASSERT(pcbinfo); >> >> /* >> * First look for an exact match. >> @@ -1574,6 +1591,56 @@ in_pcblookup_hash(struct inpcbinfo *pcbi >> >> return (NULL); >> } >> + >> +/* >> + * Lookup PCB in hash list, using pcbinfo tables. This variation locks the >> + * hash list lock, and will return the inpcb locked (i.e., requires >> + * INPLOOKUP_LOCKPCB). >> + */ >> +static struct inpcb * >> +in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr, >> + u_int fport, struct in_addr laddr, u_int lport, int lookupflags, >> + struct ifnet *ifp) >> +{ >> + struct inpcb *inp; >> + >> + INP_HASH_RLOCK(pcbinfo); >> + inp = in_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, >> + (lookupflags & ~(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)), ifp); >> + if (inp != NULL) { >> + in_pcbref(inp); >> + INP_HASH_RUNLOCK(pcbinfo); >> + if (lookupflags & INPLOOKUP_WLOCKPCB) { >> + INP_WLOCK(inp); >> + if (in_pcbrele_wlocked(inp)) >> + return (NULL); >> + } else if (lookupflags & INPLOOKUP_RLOCKPCB) { >> + INP_RLOCK(inp); >> + if (in_pcbrele_rlocked(inp)) >> + return (NULL); >> + } else >> + panic("%s: locking bug", __func__); >> + } else >> + INP_HASH_RUNLOCK(pcbinfo); >> + return (inp); >> +} >> + >> +/* >> + * Public inpcb lookup routines, accepting a 4-tuple. >> + */ >> +struct inpcb * >> +in_pcblookup(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport, >> + struct in_addr laddr, u_int lport, int lookupflags, struct ifnet *ifp) >> +{ >> + >> + KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, >> + ("%s: invalid lookup flags %d", __func__, lookupflags)); >> + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, >> + ("%s: LOCKPCB not set", __func__)); >> + >> + return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, >> + lookupflags, ifp)); >> +} >> #endif /* INET */ >> >> /* >> @@ -1588,8 +1655,9 @@ in_pcbinshash(struct inpcb *inp) >> struct inpcbport *phd; >> u_int32_t hashkey_faddr; >> >> - INP_INFO_WLOCK_ASSERT(pcbinfo); >> INP_WLOCK_ASSERT(inp); >> + INP_HASH_WLOCK_ASSERT(pcbinfo); >> + >> KASSERT((inp->inp_flags & INP_INHASHLIST) == 0, >> ("in_pcbinshash: INP_INHASHLIST")); >> >> @@ -1645,8 +1713,9 @@ in_pcbrehash(struct inpcb *inp) >> struct inpcbhead *head; >> u_int32_t hashkey_faddr; >> >> - INP_INFO_WLOCK_ASSERT(pcbinfo); >> INP_WLOCK_ASSERT(inp); >> + INP_HASH_WLOCK_ASSERT(pcbinfo); >> + >> KASSERT(inp->inp_flags & INP_INHASHLIST, >> ("in_pcbrehash: !INP_INHASHLIST")); >> >> @@ -1679,12 +1748,14 @@ in_pcbremlists(struct inpcb *inp) >> if (inp->inp_flags & INP_INHASHLIST) { >> struct inpcbport *phd = inp->inp_phd; >> >> + INP_HASH_WLOCK(pcbinfo); >> LIST_REMOVE(inp, inp_hash); >> LIST_REMOVE(inp, inp_portlist); >> if (LIST_FIRST(&phd->phd_pcblist) == NULL) { >> LIST_REMOVE(phd, phd_hash); >> free(phd, M_PCB); >> } >> + INP_HASH_WUNLOCK(pcbinfo); >> inp->inp_flags &= ~INP_INHASHLIST; >> } >> LIST_REMOVE(inp, inp_list); >> >> Modified: head/sys/netinet/in_pcb.h >> ============================================================================== >> --- head/sys/netinet/in_pcb.h Mon May 30 09:41:38 2011 (r222487) >> +++ head/sys/netinet/in_pcb.h Mon May 30 09:43:55 2011 (r222488) >> @@ -268,22 +268,22 @@ struct inpcbport { >> * Global data structure for each high-level protocol (UDP, TCP, ...) in both >> * IPv4 and IPv6. Holds inpcb lists and information for managing them. >> * >> - * Each pcbinfo is protected by ipi_lock, covering mutable global fields (such >> - * as the global pcb list) and hashed lookup tables. The lock order is: >> + * Each pcbinfo is protected by two locks: ipi_lock and ipi_hash_lock, >> + * the former covering mutable global fields (such as the global pcb list), >> + * and the latter covering the hashed lookup tables. The lock order is: >> * >> - * ipi_lock (before) inpcb locks >> + * ipi_lock (before) inpcb locks (before) ipi_hash_lock >> * >> * Locking key: >> * >> * (c) Constant or nearly constant after initialisation >> * (g) Locked by ipi_lock >> - * (h) Read using either ipi_lock or inpcb lock; write requires both. >> + * (h) Read using either ipi_hash_lock or inpcb lock; write requires both. >> * (x) Synchronisation properties poorly defined >> */ >> struct inpcbinfo { >> /* >> - * Global lock protecting global inpcb list, inpcb count, hash tables, >> - * etc. >> + * Global lock protecting global inpcb list, inpcb count, etc. >> */ >> struct rwlock ipi_lock; >> >> @@ -312,17 +312,22 @@ struct inpcbinfo { >> struct uma_zone *ipi_zone; /* (c) */ >> >> /* >> + * Global lock protecting hash lookup tables. >> + */ >> + struct rwlock ipi_hash_lock; >> + >> + /* >> * Global hash of inpcbs, hashed by local and foreign addresses and >> * port numbers. >> */ >> - struct inpcbhead *ipi_hashbase; /* (g) */ >> - u_long ipi_hashmask; /* (g) */ >> + struct inpcbhead *ipi_hashbase; /* (h) */ >> + u_long ipi_hashmask; /* (h) */ >> >> /* >> * Global hash of inpcbs, hashed by only local port number. >> */ >> - struct inpcbporthead *ipi_porthashbase; /* (g) */ >> - u_long ipi_porthashmask; /* (g) */ >> + struct inpcbporthead *ipi_porthashbase; /* (h) */ >> + u_long ipi_porthashmask; /* (h) */ >> >> /* >> * Pointer to network stack instance >> @@ -406,6 +411,18 @@ void inp_4tuple_get(struct inpcb *inp, >> #define INP_INFO_WLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_lock, RA_WLOCKED) >> #define INP_INFO_UNLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_lock, RA_UNLOCKED) >> >> +#define INP_HASH_LOCK_INIT(ipi, d) \ >> + rw_init_flags(&(ipi)->ipi_hash_lock, (d), 0) >> +#define INP_HASH_LOCK_DESTROY(ipi) rw_destroy(&(ipi)->ipi_hash_lock) >> +#define INP_HASH_RLOCK(ipi) rw_rlock(&(ipi)->ipi_hash_lock) >> +#define INP_HASH_WLOCK(ipi) rw_wlock(&(ipi)->ipi_hash_lock) >> +#define INP_HASH_RUNLOCK(ipi) rw_runlock(&(ipi)->ipi_hash_lock) >> +#define INP_HASH_WUNLOCK(ipi) rw_wunlock(&(ipi)->ipi_hash_lock) >> +#define INP_HASH_LOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_hash_lock, \ >> + RA_LOCKED) >> +#define INP_HASH_WLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_hash_lock, \ >> + RA_WLOCKED) >> + >> #define INP_PCBHASH(faddr, lport, fport, mask) \ >> (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) >> #define INP_PCBPORTHASH(lport, mask) \ >> @@ -466,7 +483,16 @@ void inp_4tuple_get(struct inpcb *inp, >> #define INP_LLE_VALID 0x00000001 /* cached lle is valid */ >> #define INP_RT_VALID 0x00000002 /* cached rtentry is valid */ >> >> -#define INPLOOKUP_WILDCARD 1 >> +/* >> + * Flags passed to in_pcblookup*() functions. >> + */ >> +#define INPLOOKUP_WILDCARD 0x00000001 /* Allow wildcard sockets. */ >> +#define INPLOOKUP_RLOCKPCB 0x00000002 /* Return inpcb read-locked. */ >> +#define INPLOOKUP_WLOCKPCB 0x00000004 /* Return inpcb write-locked. */ >> + >> +#define INPLOOKUP_MASK (INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB | \ >> + INPLOOKUP_WLOCKPCB) >> + >> #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) >> #define sotoin6pcb(so) sotoinpcb(so) /* for KAME src sync over BSD*'s */ >> >> @@ -527,7 +553,7 @@ struct inpcb * >> in_pcblookup_local(struct inpcbinfo *, >> struct in_addr, u_short, int, struct ucred *); >> struct inpcb * >> - in_pcblookup_hash(struct inpcbinfo *, struct in_addr, u_int, >> + in_pcblookup(struct inpcbinfo *, struct in_addr, u_int, >> struct in_addr, u_int, int, struct ifnet *); >> void in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr, >> int, struct inpcb *(*)(struct inpcb *, int)); >> >> Modified: head/sys/netinet/ip_divert.c >> ============================================================================== >> --- head/sys/netinet/ip_divert.c Mon May 30 09:41:38 2011 (r222487) >> +++ head/sys/netinet/ip_divert.c Mon May 30 09:43:55 2011 (r222488) >> @@ -659,9 +659,9 @@ div_pcblist(SYSCTL_HANDLER_ARGS) >> INP_INFO_WLOCK(&V_divcbinfo); >> for (i = 0; i < n; i++) { >> inp = inp_list[i]; >> - INP_WLOCK(inp); >> - if (!in_pcbrele(inp)) >> - INP_WUNLOCK(inp); >> + INP_RLOCK(inp); >> + if (!in_pcbrele_rlocked(inp)) >> + INP_RUNLOCK(inp); >> } >> INP_INFO_WUNLOCK(&V_divcbinfo); >> >> >> Modified: head/sys/netinet/ipfw/ip_fw2.c >> ============================================================================== >> --- head/sys/netinet/ipfw/ip_fw2.c Mon May 30 09:41:38 2011 (r222487) >> +++ head/sys/netinet/ipfw/ip_fw2.c Mon May 30 09:43:55 2011 (r222488) >> @@ -657,7 +657,7 @@ check_uidgid(ipfw_insn_u32 *insn, int pr >> (struct bsd_ucred *)uc, ugid_lookupp, ((struct mbuf *)inp)->m_skb); >> #else /* FreeBSD */ >> struct inpcbinfo *pi; >> - int wildcard; >> + int lookupflags; >> struct inpcb *pcb; >> int match; >> >> @@ -682,30 +682,31 @@ check_uidgid(ipfw_insn_u32 *insn, int pr >> if (*ugid_lookupp == -1) >> return (0); >> if (proto == IPPROTO_TCP) { >> - wildcard = 0; >> + lookupflags = 0; >> pi = &V_tcbinfo; >> } else if (proto == IPPROTO_UDP) { >> - wildcard = INPLOOKUP_WILDCARD; >> + lookupflags = INPLOOKUP_WILDCARD; >> pi = &V_udbinfo; >> } else >> return 0; >> + lookupflags |= INPLOOKUP_RLOCKPCB; >> match = 0; >> if (*ugid_lookupp == 0) { >> - INP_INFO_RLOCK(pi); >> pcb = (oif) ? >> - in_pcblookup_hash(pi, >> + in_pcblookup(pi, >> dst_ip, htons(dst_port), >> src_ip, htons(src_port), >> - wildcard, oif) : >> - in_pcblookup_hash(pi, >> + lookupflags, oif) : >> + in_pcblookup(pi, >> src_ip, htons(src_port), >> dst_ip, htons(dst_port), >> - wildcard, NULL); >> + lookupflags, NULL); >> if (pcb != NULL) { >> + INP_RLOCK_ASSERT(pcb); >> *uc = crhold(pcb->inp_cred); >> *ugid_lookupp = 1; >> + INP_RUNLOCK(pcb); >> } >> - INP_INFO_RUNLOCK(pi); >> if (*ugid_lookupp == 0) { >> /* >> * We tried and failed, set the variable to -1 >> @@ -1827,21 +1828,32 @@ do { \ >> else >> break; >> >> + /* >> + * XXXRW: so_user_cookie should almost >> + * certainly be inp_user_cookie? >> + */ >> + >> /* For incomming packet, lookup up the >> inpcb using the src/dest ip/port tuple */ >> if (inp == NULL) { >> - INP_INFO_RLOCK(pi); >> - inp = in_pcblookup_hash(pi, >> + inp = in_pcblookup(pi, >> src_ip, htons(src_port), >> dst_ip, htons(dst_port), >> - 0, NULL); >> - INP_INFO_RUNLOCK(pi); >> - } >> - >> - if (inp && inp->inp_socket) { >> - tablearg = inp->inp_socket->so_user_cookie; >> - if (tablearg) >> - match = 1; >> + INPLOOKUP_RLOCKPCB, NULL); >> + if (inp != NULL) { >> + tablearg = >> + inp->inp_socket->so_user_cookie; >> + if (tablearg) >> + match = 1; >> + INP_RUNLOCK(inp); >> + } >> + } else { >> + if (inp->inp_socket) { >> + tablearg = >> + inp->inp_socket->so_user_cookie; >> + if (tablearg) >> + match = 1; >> + } >> } >> break; >> } >> >> Modified: head/sys/netinet/raw_ip.c >> ============================================================================== >> --- head/sys/netinet/raw_ip.c Mon May 30 09:41:38 2011 (r222487) >> +++ head/sys/netinet/raw_ip.c Mon May 30 09:43:55 2011 (r222488) >> @@ -226,7 +226,7 @@ rip_append(struct inpcb *last, struct ip >> { >> int policyfail = 0; >> >> - INP_RLOCK_ASSERT(last); >> + INP_LOCK_ASSERT(last); >> >> #ifdef IPSEC >> /* check AH/ESP integrity. */ >> @@ -834,16 +834,19 @@ rip_detach(struct socket *so) >> static void >> rip_dodisconnect(struct socket *so, struct inpcb *inp) >> { >> + struct inpcbinfo *pcbinfo; >> >> - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); >> - INP_WLOCK_ASSERT(inp); >> - >> + pcbinfo = inp->inp_pcbinfo; >> + INP_INFO_WLOCK(pcbinfo); >> + INP_WLOCK(inp); >> rip_delhash(inp); >> inp->inp_faddr.s_addr = INADDR_ANY; >> rip_inshash(inp); >> SOCK_LOCK(so); >> so->so_state &= ~SS_ISCONNECTED; >> SOCK_UNLOCK(so); >> + INP_WUNLOCK(inp); >> + INP_INFO_WUNLOCK(pcbinfo); >> } >> >> static void >> @@ -854,11 +857,7 @@ rip_abort(struct socket *so) >> inp = sotoinpcb(so); >> KASSERT(inp != NULL, ("rip_abort: inp == NULL")); >> >> - INP_INFO_WLOCK(&V_ripcbinfo); >> - INP_WLOCK(inp); >> rip_dodisconnect(so, inp); >> - INP_WUNLOCK(inp); >> - INP_INFO_WUNLOCK(&V_ripcbinfo); >> } >> >> static void >> @@ -869,11 +868,7 @@ rip_close(struct socket *so) >> inp = sotoinpcb(so); >> KASSERT(inp != NULL, ("rip_close: inp == NULL")); >> >> - INP_INFO_WLOCK(&V_ripcbinfo); >> - INP_WLOCK(inp); >> rip_dodisconnect(so, inp); >> - INP_WUNLOCK(inp); >> - INP_INFO_WUNLOCK(&V_ripcbinfo); >> } >> >> static int >> @@ -887,11 +882,7 @@ rip_disconnect(struct socket *so) >> inp = sotoinpcb(so); >> KASSERT(inp != NULL, ("rip_disconnect: inp == NULL")); >> >> - INP_INFO_WLOCK(&V_ripcbinfo); >> - INP_WLOCK(inp); >> rip_dodisconnect(so, inp); >> - INP_WUNLOCK(inp); >> - INP_INFO_WUNLOCK(&V_ripcbinfo); >> return (0); >> } >> >> @@ -1077,9 +1068,9 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) >> INP_INFO_WLOCK(&V_ripcbinfo); >> for (i = 0; i < n; i++) { >> inp = inp_list[i]; >> - INP_WLOCK(inp); >> - if (!in_pcbrele(inp)) >> - INP_WUNLOCK(inp); >> + INP_RLOCK(inp); >> + if (!in_pcbrele_rlocked(inp)) >> + INP_RUNLOCK(inp); >> } >> INP_INFO_WUNLOCK(&V_ripcbinfo); >> >> >> Modified: head/sys/netinet/siftr.c >> ============================================================================== >> --- head/sys/netinet/siftr.c Mon May 30 09:41:38 2011 (r222487) >> +++ head/sys/netinet/siftr.c Mon May 30 09:43:55 2011 (r222488) >> @@ -696,17 +696,16 @@ siftr_findinpcb(int ipver, struct ip *ip >> >> /* We need the tcbinfo lock. */ >> INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); >> - INP_INFO_RLOCK(&V_tcbinfo); >> >> if (dir == PFIL_IN) >> inp = (ipver == INP_IPV4 ? >> - in_pcblookup_hash(&V_tcbinfo, ip->ip_src, sport, ip->ip_dst, >> - dport, 0, m->m_pkthdr.rcvif) >> + in_pcblookup(&V_tcbinfo, ip->ip_src, sport, ip->ip_dst, >> + dport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) >> : >> #ifdef SIFTR_IPV6 >> - in6_pcblookup_hash(&V_tcbinfo, >> + in6_pcblookup(&V_tcbinfo, >> &((struct ip6_hdr *)ip)->ip6_src, sport, >> - &((struct ip6_hdr *)ip)->ip6_dst, dport, 0, >> + &((struct ip6_hdr *)ip)->ip6_dst, dport, INPLOOKUP_RLOCKPCB, >> m->m_pkthdr.rcvif) >> #else >> NULL >> @@ -715,13 +714,13 @@ siftr_findinpcb(int ipver, struct ip *ip >> >> else >> inp = (ipver == INP_IPV4 ? >> - in_pcblookup_hash(&V_tcbinfo, ip->ip_dst, dport, ip->ip_src, >> - sport, 0, m->m_pkthdr.rcvif) >> + in_pcblookup(&V_tcbinfo, ip->ip_dst, dport, ip->ip_src, >> + sport, INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif) >> : >> #ifdef SIFTR_IPV6 >> - in6_pcblookup_hash(&V_tcbinfo, >> + in6_pcblookup(&V_tcbinfo, >> &((struct ip6_hdr *)ip)->ip6_dst, dport, >> - &((struct ip6_hdr *)ip)->ip6_src, sport, 0, >> + &((struct ip6_hdr *)ip)->ip6_src, sport, INPLOOKUP_RLOCKPCB, >> m->m_pkthdr.rcvif) >> #else >> NULL >> @@ -734,12 +733,7 @@ siftr_findinpcb(int ipver, struct ip *ip >> ss->nskip_in_inpcb++; >> else >> ss->nskip_out_inpcb++; >> - } else { >> - /* Acquire the inpcb lock. */ >> - INP_UNLOCK_ASSERT(inp); >> - INP_RLOCK(inp); >> } >> - INP_INFO_RUNLOCK(&V_tcbinfo); >> >> return (inp); >> } >> >> Modified: head/sys/netinet/tcp_input.c >> ============================================================================== >> --- head/sys/netinet/tcp_input.c Mon May 30 09:41:38 2011 (r222487) >> +++ head/sys/netinet/tcp_input.c Mon May 30 09:43:55 2011 (r222488) >> @@ -5,6 +5,7 @@ >> * Swinburne University of Technology, Melbourne, Australia. >> * Copyright (c) 2009-2010 Lawrence Stewart >> * Copyright (c) 2010 The FreeBSD Foundation >> + * Copyright (c) 2010-2011 Juniper Networks, Inc. >> * All rights reserved. >> * >> * Portions of this software were developed at the Centre for Advanced Internet >> @@ -16,6 +17,9 @@ >> * Internet Architectures, Swinburne University of Technology, Melbourne, >> * Australia by David Hayes under sponsorship from the FreeBSD Foundation. >> * >> + * Portions of this software were developed by Robert N. M. Watson under >> + * contract to Juniper Networks, Inc. >> + * >> * Redistribution and use in source and binary forms, with or without >> * modification, are permitted provided that the following conditions >> * are met: >> @@ -197,10 +201,6 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, >> &VNET_NAME(tcp_autorcvbuf_max), 0, >> "Max size of automatic receive buffer"); >> >> -int tcp_read_locking = 1; >> -SYSCTL_INT(_net_inet_tcp, OID_AUTO, read_locking, CTLFLAG_RW, >> - &tcp_read_locking, 0, "Enable read locking strategy"); >> - >> VNET_DEFINE(struct inpcbhead, tcb); >> #define tcb6 tcb /* for KAME src sync over BSD*'s */ >> VNET_DEFINE(struct inpcbinfo, tcbinfo); >> @@ -591,8 +591,7 @@ tcp_input(struct mbuf *m, int off0) >> char *s = NULL; /* address and port logging */ >> int ti_locked; >> #define TI_UNLOCKED 1 >> -#define TI_RLOCKED 2 >> -#define TI_WLOCKED 3 >> +#define TI_WLOCKED 2 >> >> #ifdef TCPDEBUG >> /* >> @@ -756,30 +755,25 @@ tcp_input(struct mbuf *m, int off0) >> drop_hdrlen = off0 + off; >> >> /* >> - * Locate pcb for segment, which requires a lock on tcbinfo. >> - * Optimisticaly acquire a global read lock rather than a write lock >> - * unless header flags necessarily imply a state change. There are >> - * two cases where we might discover later we need a write lock >> - * despite the flags: ACKs moving a connection out of the syncache, >> - * and ACKs for a connection in TIMEWAIT. >> + * Locate pcb for segment; if we're likely to add or remove a >> + * connection then first acquire pcbinfo lock. There are two cases >> + * where we might discover later we need a write lock despite the >> + * flags: ACKs moving a connection out of the syncache, and ACKs for >> + * a connection in TIMEWAIT. >> */ >> - if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || >> - tcp_read_locking == 0) { >> + if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0) { >> INP_INFO_WLOCK(&V_tcbinfo); >> ti_locked = TI_WLOCKED; >> - } else { >> - INP_INFO_RLOCK(&V_tcbinfo); >> - ti_locked = TI_RLOCKED; >> - } >> + } else >> + ti_locked = TI_UNLOCKED; >> >> findpcb: >> #ifdef INVARIANTS >> - if (ti_locked == TI_RLOCKED) >> - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); >> - else if (ti_locked == TI_WLOCKED) >> + if (ti_locked == TI_WLOCKED) { >> INP_INFO_WLOCK_ASSERT(&V_tcbinfo); >> - else >> - panic("%s: findpcb ti_locked %d\n", __func__, ti_locked); >> + } else { >> + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); >> + } >> #endif >> >> #ifdef INET >> @@ -797,20 +791,18 @@ findpcb: >> * Transparently forwarded. Pretend to be the destination. >> * already got one like this? >> */ >> - inp = in_pcblookup_hash(&V_tcbinfo, >> - ip->ip_src, th->th_sport, >> - ip->ip_dst, th->th_dport, >> - 0, m->m_pkthdr.rcvif); >> + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, th->th_sport, >> + ip->ip_dst, th->th_dport, INPLOOKUP_WLOCKPCB, >> + m->m_pkthdr.rcvif); >> if (!inp) { >> - /* It's new. Try to find the ambushing socket. */ >> - inp = in_pcblookup_hash(&V_tcbinfo, >> - ip->ip_src, th->th_sport, >> - next_hop->sin_addr, >> - next_hop->sin_port ? >> - ntohs(next_hop->sin_port) : >> - th->th_dport, >> - INPLOOKUP_WILDCARD, >> - m->m_pkthdr.rcvif); >> + /* >> + * It's new. Try to find the ambushing socket. >> + */ >> + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, >> + th->th_sport, next_hop->sin_addr, >> + next_hop->sin_port ? ntohs(next_hop->sin_port) : >> + th->th_dport, INPLOOKUP_WILDCARD | >> + INPLOOKUP_WLOCKPCB, m->m_pkthdr.rcvif); >> } >> /* Remove the tag from the packet. We don't need it anymore. */ >> m_tag_delete(m, fwd_tag); >> @@ -820,21 +812,19 @@ findpcb: >> { >> #ifdef INET6 >> if (isipv6) >> - inp = in6_pcblookup_hash(&V_tcbinfo, >> - &ip6->ip6_src, th->th_sport, >> - &ip6->ip6_dst, th->th_dport, >> - INPLOOKUP_WILDCARD, >> - m->m_pkthdr.rcvif); >> + inp = in6_pcblookup(&V_tcbinfo, &ip6->ip6_src, >> + th->th_sport, &ip6->ip6_dst, th->th_dport, >> + INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, >> + m->m_pkthdr.rcvif); >> #endif >> #if defined(INET) && defined(INET6) >> else >> #endif >> #ifdef INET >> - inp = in_pcblookup_hash(&V_tcbinfo, >> - ip->ip_src, th->th_sport, >> - ip->ip_dst, th->th_dport, >> - INPLOOKUP_WILDCARD, >> - m->m_pkthdr.rcvif); >> + inp = in_pcblookup(&V_tcbinfo, ip->ip_src, >> + th->th_sport, ip->ip_dst, th->th_dport, >> + INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, >> + m->m_pkthdr.rcvif); >> #endif >> } >> >> @@ -865,7 +855,7 @@ findpcb: >> rstreason = BANDLIM_RST_CLOSEDPORT; >> goto dropwithreset; >> } >> - INP_WLOCK(inp); >> + INP_WLOCK_ASSERT(inp); >> if (!(inp->inp_flags & INP_HW_FLOWID) >> && (m->m_flags & M_FLOWID) >> && ((inp->inp_socket == NULL) >> @@ -906,28 +896,26 @@ findpcb: >> * legitimate new connection attempt the old INPCB gets removed and >> * we can try again to find a listening socket. >> * >> - * At this point, due to earlier optimism, we may hold a read lock on >> - * the inpcbinfo, rather than a write lock. If so, we need to >> - * upgrade, or if that fails, acquire a reference on the inpcb, drop >> - * all locks, acquire a global write lock, and then re-acquire the >> - * inpcb lock. We may at that point discover that another thread has >> - * tried to free the inpcb, in which case we need to loop back and >> - * try to find a new inpcb to deliver to. >> + * At this point, due to earlier optimism, we may hold only an inpcb >> + * lock, and not the inpcbinfo write lock. If so, we need to try to >> + * acquire it, or if that fails, acquire a reference on the inpcb, >> + * drop all locks, acquire a global write lock, and then re-acquire >> + * the inpcb lock. We may at that point discover that another thread >> + * has tried to free the inpcb, in which case we need to loop back >> + * and try to find a new inpcb to deliver to. >> + * >> + * XXXRW: It may be time to rethink timewait locking. >> */ >> relocked: >> if (inp->inp_flags & INP_TIMEWAIT) { >> - KASSERT(ti_locked == TI_RLOCKED || ti_locked == TI_WLOCKED, >> - ("%s: INP_TIMEWAIT ti_locked %d", __func__, ti_locked)); >> - >> - if (ti_locked == TI_RLOCKED) { >> - if (INP_INFO_TRY_UPGRADE(&V_tcbinfo) == 0) { >> + if (ti_locked == TI_UNLOCKED) { >> + if (INP_INFO_TRY_WLOCK(&V_tcbinfo) == 0) { >> in_pcbref(inp); >> INP_WUNLOCK(inp); >> - INP_INFO_RUNLOCK(&V_tcbinfo); >> INP_INFO_WLOCK(&V_tcbinfo); >> ti_locked = TI_WLOCKED; >> INP_WLOCK(inp); >> - if (in_pcbrele(inp)) { >> + if (in_pcbrele_wlocked(inp)) { >> inp = NULL; >> goto findpcb; >> } >> @@ -975,26 +963,24 @@ relocked: >> >> /* >> * We've identified a valid inpcb, but it could be that we need an >> - * inpcbinfo write lock and have only a read lock. In this case, >> - * attempt to upgrade/relock using the same strategy as the TIMEWAIT >> - * case above. If we relock, we have to jump back to 'relocked' as >> - * the connection might now be in TIMEWAIT. >> - */ >> - if (tp->t_state != TCPS_ESTABLISHED || >> - (thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || >> - tcp_read_locking == 0) { >> - KASSERT(ti_locked == TI_RLOCKED || ti_locked == TI_WLOCKED, >> - ("%s: upgrade check ti_locked %d", __func__, ti_locked)); >> - >> - if (ti_locked == TI_RLOCKED) { >> - if (INP_INFO_TRY_UPGRADE(&V_tcbinfo) == 0) { >> + * inpcbinfo write lock but don't hold it. In this case, attempt to >> + * acquire using the same strategy as the TIMEWAIT case above. If we >> + * relock, we have to jump back to 'relocked' as the connection might >> + * now be in TIMEWAIT. >> + */ >> +#ifdef INVARIANTS >> + if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0) >> + INP_INFO_WLOCK_ASSERT(&V_tcbinfo); >> +#endif >> + if (tp->t_state != TCPS_ESTABLISHED) { >> + if (ti_locked == TI_UNLOCKED) { >> + if (INP_INFO_TRY_WLOCK(&V_tcbinfo) == 0) { >> in_pcbref(inp); >> INP_WUNLOCK(inp); >> - INP_INFO_RUNLOCK(&V_tcbinfo); >> INP_INFO_WLOCK(&V_tcbinfo); >> ti_locked = TI_WLOCKED; >> INP_WLOCK(inp); >> - if (in_pcbrele(inp)) { >> + if (in_pcbrele_wlocked(inp)) { >> inp = NULL; >> goto findpcb; >> } >> @@ -1027,13 +1013,16 @@ relocked: >> /* >> * When the socket is accepting connections (the INPCB is in LISTEN >> * state) we look into the SYN cache if this is a new connection >> - * attempt or the completion of a previous one. >> + * attempt or the completion of a previous one. Because listen >> + * sockets are never in TCPS_ESTABLISHED, the V_tcbinfo lock will be >> + * held in this case. >> */ >> if (so->so_options & SO_ACCEPTCONN) { >> struct in_conninfo inc; >> >> KASSERT(tp->t_state == TCPS_LISTEN, ("%s: so accepting but " >> "tp not listening", __func__)); >> + INP_INFO_WLOCK_ASSERT(&V_tcbinfo); >> >> bzero(&inc, sizeof(inc)); >> #ifdef INET6 >> @@ -1371,13 +1360,17 @@ relocked: >> return; >> >> dropwithreset: >> - if (ti_locked == TI_RLOCKED) >> - INP_INFO_RUNLOCK(&V_tcbinfo); >> - else if (ti_locked == TI_WLOCKED) >> + if (ti_locked == TI_WLOCKED) { >> INP_INFO_WUNLOCK(&V_tcbinfo); >> - else >> - panic("%s: dropwithreset ti_locked %d", __func__, ti_locked); >> - ti_locked = TI_UNLOCKED; >> + ti_locked = TI_UNLOCKED; >> + } >> +#ifdef INVARIANTS >> + else { >> + KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropwithreset " >> + "ti_locked: %d", __func__, ti_locked)); >> + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); >> + } >> +#endif >> >> if (inp != NULL) { >> tcp_dropwithreset(m, th, tp, tlen, rstreason); >> @@ -1388,13 +1381,17 @@ dropwithreset: >> goto drop; >> >> dropunlock: >> - if (ti_locked == TI_RLOCKED) >> - INP_INFO_RUNLOCK(&V_tcbinfo); >> - else if (ti_locked == TI_WLOCKED) >> + if (ti_locked == TI_WLOCKED) { >> INP_INFO_WUNLOCK(&V_tcbinfo); >> - else >> - panic("%s: dropunlock ti_locked %d", __func__, ti_locked); >> - ti_locked = TI_UNLOCKED; >> + ti_locked = TI_UNLOCKED; >> + } >> +#ifdef INVARIANTS >> + else { >> + KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropunlock " >> + "ti_locked: %d", __func__, ti_locked)); >> + INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); >> + } >> +#endif >> >> if (inp != NULL) >> INP_WUNLOCK(inp); >> @@ -1449,13 +1446,13 @@ tcp_do_segment(struct mbuf *m, struct tc >> INP_INFO_WLOCK_ASSERT(&V_tcbinfo); >> } else { >> #ifdef INVARIANTS >> - if (ti_locked == TI_RLOCKED) >> - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); >> >> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >> _______________________________________________ >> svn-src-head@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/svn-src-head >> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >> > From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 16:33:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F9DF106566C; Sat, 4 Jun 2011 16:33:07 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DF298FC17; Sat, 4 Jun 2011 16:33: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 p54GX74F017779; Sat, 4 Jun 2011 16:33:07 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54GX7H8017769; Sat, 4 Jun 2011 16:33:07 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201106041633.p54GX7H8017769@svn.freebsd.org> From: Robert Watson Date: Sat, 4 Jun 2011 16:33:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222691 - in head/sys: contrib/pf/net netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 16:33:07 -0000 Author: rwatson Date: Sat Jun 4 16:33:06 2011 New Revision: 222691 URL: http://svn.freebsd.org/changeset/base/222691 Log: Add _mbuf() variants of various inpcb-related interfaces, including lookup, hash install, etc. For now, these are arguments are unused, but as we add RSS support, we will want to use hashes extracted from mbufs, rather than manually calculated hashes of header fields, due to the expensive of the software version of Toeplitz (and similar hashes). Add notes that it would be nice to be able to pass mbufs into lookup routines in pf(4), optimising firewall lookup in the same way, but the code structure there doesn't facilitate that currently. (In principle there is no reason this couldn't be MFCed -- the change extends rather than modifies the KBI. However, it won't be useful without other previous possibly less MFCable changes.) Reviewed by: bz Sponsored by: Juniper Networks, Inc. Modified: head/sys/contrib/pf/net/pf.c head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_syncache.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_pcb.h head/sys/netinet6/udp6_usrreq.c Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Sat Jun 4 16:26:02 2011 (r222690) +++ head/sys/contrib/pf/net/pf.c Sat Jun 4 16:33:06 2011 (r222691) @@ -3034,6 +3034,10 @@ pf_socket_lookup(int direction, struct p #ifdef INET case AF_INET: #ifdef __FreeBSD__ + /* + * XXXRW: would be nice if we had an mbuf here so that we + * could use in_pcblookup_mbuf(). + */ inp = in_pcblookup(pi, saddr->v4, sport, daddr->v4, dport, INPLOOKUP_RLOCKPCB, NULL); if (inp == NULL) { @@ -3056,6 +3060,10 @@ pf_socket_lookup(int direction, struct p #ifdef INET6 case AF_INET6: #ifdef __FreeBSD__ + /* + * XXXRW: would be nice if we had an mbuf here so that we + * could use in6_pcblookup_mbuf(). + */ inp = in6_pcblookup(pi, &saddr->v6, sport, &daddr->v6, dport, INPLOOKUP_RLOCKPCB, NULL); if (inp == NULL) { Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Sat Jun 4 16:26:02 2011 (r222690) +++ head/sys/netinet/in_pcb.c Sat Jun 4 16:33:06 2011 (r222691) @@ -621,7 +621,8 @@ in_pcbbind_setup(struct inpcb *inp, stru * then pick one. */ int -in_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred) +in_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam, + struct ucred *cred, struct mbuf *m) { u_short lport, fport; in_addr_t laddr, faddr; @@ -654,13 +655,20 @@ in_pcbconnect(struct inpcb *inp, struct inp->inp_laddr.s_addr = laddr; inp->inp_faddr.s_addr = faddr; inp->inp_fport = fport; - in_pcbrehash(inp); + in_pcbrehash_mbuf(inp, m); if (anonport) inp->inp_flags |= INP_ANONPORT; return (0); } +int +in_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred) +{ + + return (in_pcbconnect_mbuf(inp, nam, cred, NULL)); +} + /* * Do proper source address selection on an unbound socket in case * of connect. Take jails into account as well. @@ -1626,7 +1634,8 @@ in_pcblookup_hash(struct inpcbinfo *pcbi } /* - * Public inpcb lookup routines, accepting a 4-tuple. + * Public inpcb lookup routines, accepting a 4-tuple, and optionally, an mbuf + * from which a pre-calculated hash value may be extracted. */ struct inpcb * in_pcblookup(struct inpcbinfo *pcbinfo, struct in_addr faddr, u_int fport, @@ -1641,6 +1650,21 @@ in_pcblookup(struct inpcbinfo *pcbinfo, return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, lookupflags, ifp)); } + +struct inpcb * +in_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in_addr faddr, + u_int fport, struct in_addr laddr, u_int lport, int lookupflags, + struct ifnet *ifp, struct mbuf *m) +{ + + KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, + ("%s: invalid lookup flags %d", __func__, lookupflags)); + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, + ("%s: LOCKPCB not set", __func__)); + + return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, + lookupflags, ifp)); +} #endif /* INET */ /* @@ -1707,7 +1731,7 @@ in_pcbinshash(struct inpcb *inp) * not change after in_pcbinshash() has been called. */ void -in_pcbrehash(struct inpcb *inp) +in_pcbrehash_mbuf(struct inpcb *inp, struct mbuf *m) { struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; struct inpcbhead *head; @@ -1733,6 +1757,13 @@ in_pcbrehash(struct inpcb *inp) LIST_INSERT_HEAD(head, inp, inp_hash); } +void +in_pcbrehash(struct inpcb *inp) +{ + + in_pcbrehash_mbuf(inp, NULL); +} + /* * Remove PCB from various lists. */ Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Sat Jun 4 16:26:02 2011 (r222690) +++ head/sys/netinet/in_pcb.h Sat Jun 4 16:33:06 2011 (r222691) @@ -541,6 +541,8 @@ int in_pcb_lport(struct inpcb *, struct int in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *, u_short *, struct ucred *); int in_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *); +int in_pcbconnect_mbuf(struct inpcb *, struct sockaddr *, struct ucred *, + struct mbuf *); int in_pcbconnect_setup(struct inpcb *, struct sockaddr *, in_addr_t *, u_short *, in_addr_t *, u_short *, struct inpcb **, struct ucred *); @@ -555,10 +557,14 @@ struct inpcb * struct inpcb * in_pcblookup(struct inpcbinfo *, struct in_addr, u_int, struct in_addr, u_int, int, struct ifnet *); +struct inpcb * + in_pcblookup_mbuf(struct inpcbinfo *, struct in_addr, u_int, + struct in_addr, u_int, int, struct ifnet *, struct mbuf *); void in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr, int, struct inpcb *(*)(struct inpcb *, int)); void in_pcbref(struct inpcb *); void in_pcbrehash(struct inpcb *); +void in_pcbrehash_mbuf(struct inpcb *, struct mbuf *); int in_pcbrele(struct inpcb *); int in_pcbrele_rlocked(struct inpcb *); int in_pcbrele_wlocked(struct inpcb *); Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sat Jun 4 16:26:02 2011 (r222690) +++ head/sys/netinet/tcp_input.c Sat Jun 4 16:33:06 2011 (r222691) @@ -791,12 +791,14 @@ findpcb: * Transparently forwarded. Pretend to be the destination. * already got one like this? */ - inp = in_pcblookup(&V_tcbinfo, ip->ip_src, th->th_sport, + inp = in_pcblookup_mbuf(&V_tcbinfo, ip->ip_src, th->th_sport, ip->ip_dst, th->th_dport, INPLOOKUP_WLOCKPCB, - m->m_pkthdr.rcvif); + m->m_pkthdr.rcvif, m); if (!inp) { /* * It's new. Try to find the ambushing socket. + * Because we've rewritten the destination address, + * any hardware-generated hash is ignored. */ inp = in_pcblookup(&V_tcbinfo, ip->ip_src, th->th_sport, next_hop->sin_addr, @@ -812,19 +814,19 @@ findpcb: { #ifdef INET6 if (isipv6) - inp = in6_pcblookup(&V_tcbinfo, &ip6->ip6_src, + inp = in6_pcblookup_mbuf(&V_tcbinfo, &ip6->ip6_src, th->th_sport, &ip6->ip6_dst, th->th_dport, INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, - m->m_pkthdr.rcvif); + m->m_pkthdr.rcvif, m); #endif #if defined(INET) && defined(INET6) else #endif #ifdef INET - inp = in_pcblookup(&V_tcbinfo, ip->ip_src, + inp = in_pcblookup_mbuf(&V_tcbinfo, ip->ip_src, th->th_sport, ip->ip_dst, th->th_dport, INPLOOKUP_WILDCARD | INPLOOKUP_WLOCKPCB, - m->m_pkthdr.rcvif); + m->m_pkthdr.rcvif, m); #endif } Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Sat Jun 4 16:26:02 2011 (r222690) +++ head/sys/netinet/tcp_syncache.c Sat Jun 4 16:33:06 2011 (r222691) @@ -730,8 +730,8 @@ syncache_socket(struct syncache *sc, str laddr6 = inp->in6p_laddr; if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) inp->in6p_laddr = sc->sc_inc.inc6_laddr; - if ((error = in6_pcbconnect(inp, (struct sockaddr *)&sin6, - thread0.td_ucred)) != 0) { + if ((error = in6_pcbconnect_mbuf(inp, (struct sockaddr *)&sin6, + thread0.td_ucred, m)) != 0) { inp->in6p_laddr = laddr6; if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: in6_pcbconnect failed " @@ -770,8 +770,8 @@ syncache_socket(struct syncache *sc, str laddr = inp->inp_laddr; if (inp->inp_laddr.s_addr == INADDR_ANY) inp->inp_laddr = sc->sc_inc.inc_laddr; - if ((error = in_pcbconnect(inp, (struct sockaddr *)&sin, - thread0.td_ucred)) != 0) { + if ((error = in_pcbconnect_mbuf(inp, (struct sockaddr *)&sin, + thread0.td_ucred, m)) != 0) { inp->inp_laddr = laddr; if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: in_pcbconnect failed " Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Sat Jun 4 16:26:02 2011 (r222690) +++ head/sys/netinet/udp_usrreq.c Sat Jun 4 16:33:06 2011 (r222691) @@ -567,9 +567,9 @@ udp_input(struct mbuf *m, int off) /* * Locate pcb for datagram. */ - inp = in_pcblookup(&V_udbinfo, ip->ip_src, uh->uh_sport, + inp = in_pcblookup_mbuf(&V_udbinfo, ip->ip_src, uh->uh_sport, ip->ip_dst, uh->uh_dport, INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, - ifp); + ifp, m); if (inp == NULL) { if (udp_log_in_vain) { char buf[4*sizeof "123"]; Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Sat Jun 4 16:26:02 2011 (r222690) +++ head/sys/netinet6/in6_pcb.c Sat Jun 4 16:33:06 2011 (r222691) @@ -364,8 +364,8 @@ in6_pcbladdr(register struct inpcb *inp, * then pick one. */ int -in6_pcbconnect(register struct inpcb *inp, struct sockaddr *nam, - struct ucred *cred) +in6_pcbconnect_mbuf(register struct inpcb *inp, struct sockaddr *nam, + struct ucred *cred, struct mbuf *m) { struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; register struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; @@ -405,11 +405,18 @@ in6_pcbconnect(register struct inpcb *in inp->inp_flow |= (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK); - in_pcbrehash(inp); + in_pcbrehash_mbuf(inp, m); return (0); } +int +in6_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred) +{ + + return (in6_pcbconnect_mbuf(inp, nam, cred, NULL)); +} + void in6_pcbdisconnect(struct inpcb *inp) { @@ -974,13 +981,27 @@ in6_pcblookup_hash(struct inpcbinfo *pcb } /* - * Public inpcb lookup routines, accepting a 4-tuple. + * Public inpcb lookup routines, accepting a 4-tuple, and optionally, an mbuf + * from which a pre-calculated hash value may be extracted. */ struct inpcb * in6_pcblookup(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport, struct in6_addr *laddr, u_int lport, int lookupflags, struct ifnet *ifp) { + KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, + ("%s: invalid lookup flags %d", __func__, lookupflags)); + KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, + ("%s: LOCKPCB not set", __func__)); + + return (in6_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, + lookupflags, ifp)); +} +struct inpcb * +in6_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, + u_int fport, struct in6_addr *laddr, u_int lport, int lookupflags, + struct ifnet *ifp, struct mbuf *m) +{ KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, Modified: head/sys/netinet6/in6_pcb.h ============================================================================== --- head/sys/netinet6/in6_pcb.h Sat Jun 4 16:26:02 2011 (r222690) +++ head/sys/netinet6/in6_pcb.h Sat Jun 4 16:33:06 2011 (r222691) @@ -73,6 +73,8 @@ void in6_pcbpurgeif0 __P((struct inpcbin void in6_losing __P((struct inpcb *)); int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct ucred *)); int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct ucred *)); +int in6_pcbconnect_mbuf __P((struct inpcb *, struct sockaddr *, + struct ucred *, struct mbuf *)); void in6_pcbdisconnect __P((struct inpcb *)); int in6_pcbladdr(struct inpcb *, struct sockaddr *, struct in6_addr *); struct inpcb * @@ -87,6 +89,10 @@ struct inpcb * in6_pcblookup_hash_locked __P((struct inpcbinfo *, struct in6_addr *, u_int, struct in6_addr *, u_int, int, struct ifnet *)); +struct inpcb * + in6_pcblookup_mbuf __P((struct inpcbinfo *, struct in6_addr *, + u_int, struct in6_addr *, u_int, int, + struct ifnet *ifp, struct mbuf *)); void in6_pcbnotify __P((struct inpcbinfo *, struct sockaddr *, u_int, const struct sockaddr *, u_int, int, void *, struct inpcb *(*)(struct inpcb *, int))); Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Sat Jun 4 16:26:02 2011 (r222690) +++ head/sys/netinet6/udp6_usrreq.c Sat Jun 4 16:33:06 2011 (r222691) @@ -377,9 +377,9 @@ udp6_input(struct mbuf **mp, int *offp, /* * Locate pcb for datagram. */ - inp = in6_pcblookup(&V_udbinfo, &ip6->ip6_src, uh->uh_sport, + inp = in6_pcblookup_mbuf(&V_udbinfo, &ip6->ip6_src, uh->uh_sport, &ip6->ip6_dst, uh->uh_dport, INPLOOKUP_WILDCARD | - INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif); + INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif, m); if (inp == NULL) { if (udp_log_in_vain) { char ip6bufs[INET6_ADDRSTRLEN]; From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 16:33:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3917B1065755; Sat, 4 Jun 2011 16:33:13 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id D8CF08FC13; Sat, 4 Jun 2011 16:33:12 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id D5B6925D3899; Sat, 4 Jun 2011 16:33:11 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 3E5FE15A1028; Sat, 4 Jun 2011 16:33:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id PXM2V6cE+UMU; Sat, 4 Jun 2011 16:33:10 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 39E4215A1026; Sat, 4 Jun 2011 16:33:10 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201106041601.p54G1Ut7016697@svn.freebsd.org> Date: Sat, 4 Jun 2011 16:33:08 +0000 Content-Transfer-Encoding: 7bit Message-Id: References: <201106041601.p54G1Ut7016697@svn.freebsd.org> To: Maxim Sobolev X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222688 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 16:33:14 -0000 On Jun 4, 2011, at 4:01 PM, Maxim Sobolev wrote: > Author: sobomax > Date: Sat Jun 4 16:01:30 2011 > New Revision: 222688 > URL: http://svn.freebsd.org/changeset/base/222688 > > Log: > Read from the socket using the same max buffer size as we use while > sending. What happens otherwise is that the sender splits all the > traffic into 32k chunks, while the receiver is waiting for the whole > packet. Then for a certain packet sizes, particularly 66607 bytes in > my case, the communication stucks to secondary is expecting to > read one chunk of 66607 bytes, while primary is sending two chunks > of 32768 bytes and third chunk of 1071. Probably due to TCP windowing > and buffering the final chunk gets stuck somewhere, so neither server > not client can make any progress. I don't know about the hast internal protocol but the above reads kind of wrong to me. -- Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 17:24:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8E42106564A; Sat, 4 Jun 2011 17:24:14 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail.sippysoft.com (mail.sippysoft.com [4.59.13.245]) by mx1.freebsd.org (Postfix) with ESMTP id A01E58FC13; Sat, 4 Jun 2011 17:24:14 +0000 (UTC) Received: from s0106005004e13421.vs.shawcable.net ([70.71.175.212] helo=[192.168.1.79]) by mail.sippysoft.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.72 (FreeBSD)) (envelope-from ) id 1QSuFa-000BrK-SM; Sat, 04 Jun 2011 10:03:03 -0700 Message-ID: <4DEA653F.7070503@FreeBSD.org> Date: Sat, 04 Jun 2011 10:02:55 -0700 From: Maxim Sobolev Organization: Sippy Software, Inc. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <201106041601.p54G1Ut7016697@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: sobomax@sippysoft.com X-ssp-trusted: yes Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222688 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 17:24:14 -0000 On 6/4/2011 9:33 AM, Bjoern A. Zeeb wrote: > I don't know about the hast internal protocol but the above reads kind of > wrong to me. Hmm, not sure what exactly is wrong? Sender does 3 writes to the TCP socket - 32k, 32k and 1071 bytes, while receiver does one recv(MSG_WAITALL) with the size of 66607. So I suspect sender's kernel does deliver two 32k packets and fills up receiver's buffer or something. And the remaining 1071 bytes stay somewhere in sender's kernel indefinitely, while recv() cannot complete in receiver's. Using the same size when doing recv() solves the issue for me. -Maxim From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 20:40:24 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7FE6106564A; Sat, 4 Jun 2011 20:40:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C500B8FC08; Sat, 4 Jun 2011 20:40:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p54KeOF3025414; Sat, 4 Jun 2011 20:40:24 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54KeOkq025405; Sat, 4 Jun 2011 20:40:24 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201106042040.p54KeOkq025405@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 4 Jun 2011 20:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222696 - in head: share/man/man4 sys/conf sys/dev/usb/serial sys/modules/usb sys/modules/usb/umcs sys/modules/usb/umcs7840 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 20:40:24 -0000 Author: hselasky Date: Sat Jun 4 20:40:24 2011 New Revision: 222696 URL: http://svn.freebsd.org/changeset/base/222696 Log: Rename recently added USB serial driver. Suggested by: YongHyeon PYUN MFC after: 7 days Added: head/share/man/man4/umcs.4 - copied, changed from r222578, head/share/man/man4/umcs7840.4 head/sys/dev/usb/serial/umcs.c - copied, changed from r222578, head/sys/dev/usb/serial/umcs7840.c head/sys/dev/usb/serial/umcs.h - copied unchanged from r222578, head/sys/dev/usb/serial/umcs7840.h head/sys/modules/usb/umcs/ - copied from r222578, head/sys/modules/usb/umcs7840/ Deleted: head/share/man/man4/umcs7840.4 head/sys/dev/usb/serial/umcs7840.c head/sys/dev/usb/serial/umcs7840.h head/sys/modules/usb/umcs7840/ Modified: head/share/man/man4/Makefile head/share/man/man4/ucom.4 head/sys/conf/files head/sys/modules/usb/Makefile head/sys/modules/usb/umcs/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sat Jun 4 19:16:46 2011 (r222695) +++ head/share/man/man4/Makefile Sat Jun 4 20:40:24 2011 (r222696) @@ -475,7 +475,7 @@ MAN= aac.4 \ ukbd.4 \ ulpt.4 \ umass.4 \ - umcs7840.4 \ + umcs.4 \ umct.4 \ umodem.4 \ ums.4 \ Modified: head/share/man/man4/ucom.4 ============================================================================== --- head/share/man/man4/ucom.4 Sat Jun 4 19:16:46 2011 (r222695) +++ head/share/man/man4/ucom.4 Sat Jun 4 20:40:24 2011 (r222696) @@ -78,7 +78,7 @@ multiple external ports. .Xr uark 4 , .Xr uchcom 4 , .Xr uftdi 4 , -.Xr umcs7840 4 , +.Xr umcs 4 , .Xr umct 4 , .Xr umodem 4 , .Xr uplcom 4 , Copied and modified: head/share/man/man4/umcs.4 (from r222578, head/share/man/man4/umcs7840.4) ============================================================================== --- head/share/man/man4/umcs7840.4 Wed Jun 1 17:58:27 2011 (r222578, copy source) +++ head/share/man/man4/umcs.4 Sat Jun 4 20:40:24 2011 (r222696) @@ -29,24 +29,24 @@ .\" $FreeBSD$ .\" .Dd December 10, 2010 -.Dt UMCS7840 4 +.Dt UMCS 4 .Os .Sh NAME -.Nm umcs7840 +.Nm umcs .Nd USB support for serial adapters based on the MCS7820 and MCS7840 chips .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent -.Cd "device umcs7840" +.Cd "device umcs" .Ed .Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -umcs7840_load="YES" +umcs_load="YES" .Ed .Sh DESCRIPTION The Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Jun 4 19:16:46 2011 (r222695) +++ head/sys/conf/files Sat Jun 4 20:40:24 2011 (r222696) @@ -1958,7 +1958,7 @@ dev/usb/serial/uftdi.c optional uftdi dev/usb/serial/ugensa.c optional ugensa dev/usb/serial/uipaq.c optional uipaq dev/usb/serial/ulpt.c optional ulpt -dev/usb/serial/umcs7840.c optional umcs7840 +dev/usb/serial/umcs.c optional umcs dev/usb/serial/umct.c optional umct dev/usb/serial/umodem.c optional umodem dev/usb/serial/umoscom.c optional umoscom @@ -1968,7 +1968,7 @@ dev/usb/serial/uvisor.c optional uvisor dev/usb/serial/uvscom.c optional uvscom dev/usb/serial/usb_serial.c optional ucom | u3g | uark | ubsa | ubser | \ uchcom | ucycom | ufoma | uftdi | \ - ugensa | uipaq | umcs7840 | umct | \ + ugensa | uipaq | umcs | umct | \ umodem | umoscom | uplcom | uslcom | \ uvisor | uvscom # Copied and modified: head/sys/dev/usb/serial/umcs.c (from r222578, head/sys/dev/usb/serial/umcs7840.c) ============================================================================== --- head/sys/dev/usb/serial/umcs7840.c Wed Jun 1 17:58:27 2011 (r222578, copy source) +++ head/sys/dev/usb/serial/umcs.c Sat Jun 4 20:40:24 2011 (r222696) @@ -66,21 +66,21 @@ __FBSDID("$FreeBSD$"); #include #include "usbdevs.h" -#define USB_DEBUG_VAR umcs7840_debug +#define USB_DEBUG_VAR umcs_debug #include #include #include -#include +#include #define UMCS7840_MODVER 1 #ifdef USB_DEBUG -static int umcs7840_debug = 0; +static int umcs_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, umcs7840, CTLFLAG_RW, 0, "USB umcs7840 quadport serial adapter"); -SYSCTL_INT(_hw_usb_umcs7840, OID_AUTO, debug, CTLFLAG_RW, &umcs7840_debug, 0, "Debug level"); +SYSCTL_NODE(_hw_usb, OID_AUTO, umcs, CTLFLAG_RW, 0, "USB umcs quadport serial adapter"); +SYSCTL_INT(_hw_usb_umcs, OID_AUTO, debug, CTLFLAG_RW, &umcs_debug, 0, "Debug level"); #endif /* USB_DEBUG */ Copied: head/sys/dev/usb/serial/umcs.h (from r222578, head/sys/dev/usb/serial/umcs7840.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/serial/umcs.h Sat Jun 4 20:40:24 2011 (r222696, copy of r222578, head/sys/dev/usb/serial/umcs7840.h) @@ -0,0 +1,644 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2010 Lev Serebryakov . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef _UMCS7840_H_ +#define _UMCS7840_H_ + +#define UMCS7840_MAX_PORTS 4 + +#define UMCS7840_READ_LENGTH 1 /* bytes */ +#define UMCS7840_CTRL_TIMEOUT 500 /* ms */ + +/* Read/Wrtire registers vendor commands */ +#define MCS7840_RDREQ 0x0d +#define MCS7840_WRREQ 0x0e + +/* Read/Wrtie EEPROM values */ +#define MCS7840_EEPROM_RW_WVALUE 0x0900 + +/* + * All these registers are documented only in full datasheet, + * which can be requested from MosChip tech support. + */ +#define MCS7840_DEV_REG_SP1 0x00 /* Options for for UART 1, R/W */ +#define MCS7840_DEV_REG_CONTROL1 0x01 /* Control bits for UART 1, + * R/W */ +#define MCS7840_DEV_REG_PINPONGHIGH 0x02 /* High bits of ping-pong + * register, R/W */ +#define MCS7840_DEV_REG_PINPONGLOW 0x03 /* Low bits of ping-pong + * register, R/W */ +/* DCRx_1 Registers goes here (see below, they are documented) */ +#define MCS7840_DEV_REG_GPIO 0x07 /* GPIO_0 and GPIO_1 bits, + * undocumented, see notes + * below R/W */ +#define MCS7840_DEV_REG_SP2 0x08 /* Options for for UART 2, R/W */ +#define MCS7840_DEV_REG_CONTROL2 0x09 /* Control bits for UART 2, + * R/W */ +#define MCS7840_DEV_REG_SP3 0x0a /* Options for for UART 3, R/W */ +#define MCS7840_DEV_REG_CONTROL3 0x0b /* Control bits for UART 3, + * R/W */ +#define MCS7840_DEV_REG_SP4 0x0c /* Options for for UART 4, R/W */ +#define MCS7840_DEV_REG_CONTROL4 0x0d /* Control bits for UART 4, + * R/W */ +#define MCS7840_DEV_REG_PLL_DIV_M 0x0e /* Pre-diviedr for PLL, R/W */ +#define MCS7840_DEV_REG_UNKNOWN1 0x0f /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_PLL_DIV_N 0x10 /* Loop divider for PLL, R/W */ +#define MCS7840_DEV_REG_CLOCK_MUX 0x12 /* PLL input clock & Interrupt + * endpoint control, R/W */ +#define MCS7840_DEV_REG_UNKNOWN2 0x11 /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_CLOCK_SELECT12 0x13 /* Clock source for ports 1 & + * 2, R/W */ +#define MCS7840_DEV_REG_CLOCK_SELECT34 0x14 /* Clock source for ports 3 & + * 4, R/W */ +#define MCS7840_DEV_REG_UNKNOWN3 0x15 /* NOT MENTIONED AND NOT USED */ +/* DCRx_2-DCRx_4 Registers goes here (see below, they are documented) */ +#define MCS7840_DEV_REG_UNKNOWN4 0x1f /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_UNKNOWN5 0x20 /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_UNKNOWN6 0x21 /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_UNKNOWN7 0x22 /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_UNKNOWN8 0x23 /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_UNKNOWN9 0x24 /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_UNKNOWNA 0x25 /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_UNKNOWNB 0x26 /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_UNKNOWNC 0x27 /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_UNKNOWND 0x28 /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_UNKNOWNE 0x29 /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_UNKNOWNF 0x2a /* NOT MENTIONED AND NOT USED */ +#define MCS7840_DEV_REG_MODE 0x2b /* Hardware configuration, + * R/Only */ +#define MCS7840_DEV_REG_SP1_ICG 0x2c /* Inter character gap + * configuration for Port 1, + * R/W */ +#define MCS7840_DEV_REG_SP2_ICG 0x2d /* Inter character gap + * configuration for Port 2, + * R/W */ +#define MCS7840_DEV_REG_SP3_ICG 0x2e /* Inter character gap + * configuration for Port 3, + * R/W */ +#define MCS7840_DEV_REG_SP4_ICG 0x2f /* Inter character gap + * configuration for Port 4, + * R/W */ +#define MCS7840_DEV_REG_RX_SAMPLING12 0x30 /* RX sampling for ports 1 & + * 2, R/W */ +#define MCS7840_DEV_REG_RX_SAMPLING34 0x31 /* RX sampling for ports 3 & + * 4, R/W */ +#define MCS7840_DEV_REG_BI_FIFO_STAT1 0x32 /* Bulk-In FIFO Stat for Port + * 1, contains number of + * availiable bytes, R/Only */ +#define MCS7840_DEV_REG_BO_FIFO_STAT1 0x33 /* Bulk-out FIFO Stat for Port + * 1, contains number of + * availiable bytes, R/Only */ +#define MCS7840_DEV_REG_BI_FIFO_STAT2 0x34 /* Bulk-In FIFO Stat for Port + * 2, contains number of + * availiable bytes, R/Only */ +#define MCS7840_DEV_REG_BO_FIFO_STAT2 0x35 /* Bulk-out FIFO Stat for Port + * 2, contains number of + * availiable bytes, R/Only */ +#define MCS7840_DEV_REG_BI_FIFO_STAT3 0x36 /* Bulk-In FIFO Stat for Port + * 3, contains number of + * availiable bytes, R/Only */ +#define MCS7840_DEV_REG_BO_FIFO_STAT3 0x37 /* Bulk-out FIFO Stat for Port + * 3, contains number of + * availiable bytes, R/Only */ +#define MCS7840_DEV_REG_BI_FIFO_STAT4 0x38 /* Bulk-In FIFO Stat for Port + * 4, contains number of + * availiable bytes, R/Only */ +#define MCS7840_DEV_REG_BO_FIFO_STAT4 0x39 /* Bulk-out FIFO Stat for Port + * 4, contains number of + * availiable bytes, R/Only */ +#define MCS7840_DEV_REG_ZERO_PERIOD1 0x3a /* Period between zero out + * frames for Port 1, R/W */ +#define MCS7840_DEV_REG_ZERO_PERIOD2 0x3b /* Period between zero out + * frames for Port 1, R/W */ +#define MCS7840_DEV_REG_ZERO_PERIOD3 0x3c /* Period between zero out + * frames for Port 1, R/W */ +#define MCS7840_DEV_REG_ZERO_PERIOD4 0x3d /* Period between zero out + * frames for Port 1, R/W */ +#define MCS7840_DEV_REG_ZERO_ENABLE 0x3e /* Enable/disable of zero out + * frames, R/W */ +#define MCS7840_DEV_REG_THR_VAL_LOW1 0x3f /* Low 8 bits of threshhold + * value for Bulk-Out for Port + * 1, R/W */ +#define MCS7840_DEV_REG_THR_VAL_HIGH1 0x40 /* High 1 bit of threshhold + * value for Bulk-Out and + * enable flag for Port 1, R/W */ +#define MCS7840_DEV_REG_THR_VAL_LOW2 0x41 /* Low 8 bits of threshhold + * value for Bulk-Out for Port + * 2, R/W */ +#define MCS7840_DEV_REG_THR_VAL_HIGH2 0x42 /* High 1 bit of threshhold + * value for Bulk-Out and + * enable flag for Port 2, R/W */ +#define MCS7840_DEV_REG_THR_VAL_LOW3 0x43 /* Low 8 bits of threshhold + * value for Bulk-Out for Port + * 3, R/W */ +#define MCS7840_DEV_REG_THR_VAL_HIGH3 0x44 /* High 1 bit of threshhold + * value for Bulk-Out and + * enable flag for Port 3, R/W */ +#define MCS7840_DEV_REG_THR_VAL_LOW4 0x45 /* Low 8 bits of threshhold + * value for Bulk-Out for Port + * 4, R/W */ +#define MCS7840_DEV_REG_THR_VAL_HIGH4 0x46 /* High 1 bit of threshhold + * value for Bulk-Out and + * enable flag for Port 4, R/W */ + +/* Bits for SPx registers */ +#define MCS7840_DEV_SPx_LOOP_PIPES 0x01 /* Loop Bulk-Out FIFO to the + * Bulk-In FIFO, default = 0 */ +#define MCS7840_DEV_SPx_SKIP_ERR_DATA 0x02 /* Drop data bytes from UART, + * which were recevied with + * errors, default = 0 */ +#define MCS7840_DEV_SPx_RESET_OUT_FIFO 0x04 /* Reset Bulk-Out FIFO */ +#define MCS7840_DEV_SPx_RESET_IN_FIFO 0x08 /* Reset Bulk-In FIFO */ +#define MCS7840_DEV_SPx_CLOCK_MASK 0x70 /* Mask to extract Baud CLK + * source */ +#define MCS7840_DEV_SPx_CLOCK_X1 0x00 /* CLK = 1.8432Mhz, max speed + * = 115200 bps, default */ +#define MCS7840_DEV_SPx_CLOCK_X2 0x10 /* CLK = 3.6864Mhz, max speed + * = 230400 bps */ +#define MCS7840_DEV_SPx_CLOCK_X35 0x20 /* CLK = 6.4512Mhz, max speed + * = 403200 bps */ +#define MCS7840_DEV_SPx_CLOCK_X4 0x30 /* CLK = 7.3728Mhz, max speed + * = 460800 bps */ +#define MCS7840_DEV_SPx_CLOCK_X7 0x40 /* CLK = 12.9024Mhz, max speed + * = 806400 bps */ +#define MCS7840_DEV_SPx_CLOCK_X8 0x50 /* CLK = 14.7456Mhz, max speed + * = 921600 bps */ +#define MCS7840_DEV_SPx_CLOCK_24MHZ 0x60 /* CLK = 24.0000Mhz, max speed + * = 1.5 Mbps */ +#define MCS7840_DEV_SPx_CLOCK_48MHZ 0x70 /* CLK = 48.0000Mhz, max speed + * = 3.0 Mbps */ +#define MCS7840_DEV_SPx_CLOCK_SHIFT 4 /* Value 0..7 can be shifted + * to get clock value */ +#define MCS7840_DEV_SPx_UART_RESET 0x80 /* Reset UART */ + +/* Bits for CONTROLx registers */ +#define MCS7840_DEV_CONTROLx_HWFC 0x01 /* Enable hardware flow + * control (when power + * down? It is unclear + * in documents), + * default = 0 */ +#define MCS7840_DEV_CONTROLx_UNUNSED1 0x02 /* Reserved */ +#define MCS7840_DEV_CONTROLx_CTS_ENABLE 0x04 /* CTS changes are + * translated to MSR, + * default = 0 */ +#define MCS7840_DEV_CONTROLx_UNUSED2 0x08 /* Reserved for ports + * 2,3,4 */ +#define MCS7840_DEV_CONTROL1_DRIVER_DONE 0x08 /* USB enumerating is + * finished, USB + * enumeration memory + * can be used as FIFOs */ +#define MCS7840_DEV_CONTROLx_RX_NEGATE 0x10 /* Negate RX input, + * works for IrDA mode + * only, default = 0 */ +#define MCS7840_DEV_CONTROLx_RX_DISABLE 0x20 /* Disable RX logic, + * works only for + * RS-232/RS-485 mode, + * default = 0 */ +#define MCS7840_DEV_CONTROLx_FSM_CONTROL 0x40 /* Disable RX FSM when + * TX is in progress, + * works for IrDA mode + * only, default = 0 */ +#define MCS7840_DEV_CONTROLx_UNUSED3 0x80 /* Reserved */ + +/* + * Bits for PINPONGx registers + * These registers control how often two input buffers + * for Bulk-In FIFOs are swapped. One of buffers is used + * for USB trnasfer, other for receiving data from UART. + * Exact meaning of 15 bit value in these registers is unknown + */ +#define MCS7840_DEV_PINPONGHIGH_MULT 128 /* Only 7 bits in PINPONGLOW + * register */ +#define MCS7840_DEV_PINPONGLOW_BITS 7 /* Only 7 bits in PINPONGLOW + * register */ + +/* + * THIS ONE IS UNDOCUMENTED IN FULL DATASHEET, but e-mail from tech support + * confirms, that it is register for GPIO_0 and GPIO_1 data input/output. + * Chips has 2 GPIO, but first one (lower bit) MUST be used by device + * authors as "number of port" indicator, grounded (0) for two-port + * devices and pulled-up to 1 for 4-port devices. + */ +#define MCS7840_DEV_GPIO_4PORTS 0x01 /* Device has 4 ports + * configured */ +#define MCS7840_DEV_GPIO_GPIO_0 0x01 /* The same as above */ +#define MCS7840_DEV_GPIO_GPIO_1 0x02 /* GPIO_1 data */ + +/* + * Constants for PLL dividers + * Ouptut frequency of PLL is: + * Fout = (N/M) * Fin. + * Default PLL input frequency Fin is 12Mhz (on-chip). + */ +#define MCS7840_DEV_PLL_DIV_M_BITS 6 /* Number of useful bits for M + * divider */ +#define MCS7840_DEV_PLL_DIV_M_MASK 0x3f /* Mask for M divider */ +#define MCS7840_DEV_PLL_DIV_M_MIN 1 /* Minimum value for M, 0 is + * forbidden */ +#define MCS7840_DEV_PLL_DIV_M_DEF 1 /* Default value for M */ +#define MCS7840_DEV_PLL_DIV_M_MAX 63 /* Maximum value for M */ +#define MCS7840_DEV_PLL_DIV_N_BITS 6 /* Number of useful bits for N + * divider */ +#define MCS7840_DEV_PLL_DIV_N_MASK 0x3f /* Mask for N divider */ +#define MCS7840_DEV_PLL_DIV_N_MIN 1 /* Minimum value for N, 0 is + * forbidden */ +#define MCS7840_DEV_PLL_DIV_N_DEF 8 /* Default value for N */ +#define MCS7840_DEV_PLL_DIV_N_MAX 63 /* Maximum value for N */ + +/* Bits for CLOCK_MUX register */ +#define MCS7840_DEV_CLOCK_MUX_INPUTMASK 0x03 /* Mask to extract PLL clock + * input */ +#define MCS7840_DEV_CLOCK_MUX_IN12MHZ 0x00 /* 12Mhz PLL input, default */ +#define MCS7840_DEV_CLOCK_MUX_INEXTRN 0x01 /* External (device-depended) + * PLL input */ +#define MCS7840_DEV_CLOCK_MUX_INRSV1 0x02 /* Reserved */ +#define MCS7840_DEV_CLOCK_MUX_INRSV2 0x03 /* Reserved */ +#define MCS7840_DEV_CLOCK_MUX_PLLHIGH 0x04 /* 0 = PLL Output is + * 20MHz-100MHz (default), 1 = + * 100MHz-300MHz range */ +#define MCS7840_DEV_CLOCK_MUX_INTRFIFOS 0x08 /* Enable additional 8 bytes + * fro Interrupt USB pipe with + * USB FIFOs statuses, default + * = 0 */ +#define MCS7840_DEV_CLOCK_MUX_RESERVED1 0x10 /* Unused */ +#define MCS7840_DEV_CLOCK_MUX_RESERVED2 0x20 /* Unused */ +#define MCS7840_DEV_CLOCK_MUX_RESERVED3 0x40 /* Unused */ +#define MCS7840_DEV_CLOCK_MUX_RESERVED4 0x80 /* Unused */ + +/* Bits for CLOCK_SELECTxx registers */ +#define MCS7840_DEV_CLOCK_SELECT1_MASK 0x07 /* Bits for port 1 in + * CLOCK_SELECT12 */ +#define MCS7840_DEV_CLOCK_SELECT1_SHIFT 0 /* Shift for port 1in + * CLOCK_SELECT12 */ +#define MCS7840_DEV_CLOCK_SELECT2_MASK 0x38 /* Bits for port 2 in + * CLOCK_SELECT12 */ +#define MCS7840_DEV_CLOCK_SELECT2_SHIFT 3 /* Shift for port 2 in + * CLOCK_SELECT12 */ +#define MCS7840_DEV_CLOCK_SELECT3_MASK 0x07 /* Bits for port 3 in + * CLOCK_SELECT23 */ +#define MCS7840_DEV_CLOCK_SELECT3_SHIFT 0 /* Shift for port 3 in + * CLOCK_SELECT23 */ +#define MCS7840_DEV_CLOCK_SELECT4_MASK 0x38 /* Bits for port 4 in + * CLOCK_SELECT23 */ +#define MCS7840_DEV_CLOCK_SELECT4_SHIFT 3 /* Shift for port 4 in + * CLOCK_SELECT23 */ +#define MCS7840_DEV_CLOCK_SELECT_STD 0x00 /* STANDARD baudrate derived + * from 96Mhz, default for all + * ports */ +#define MCS7840_DEV_CLOCK_SELECT_30MHZ 0x01 /* 30Mhz */ +#define MCS7840_DEV_CLOCK_SELECT_96MHZ 0x02 /* 96Mhz direct */ +#define MCS7840_DEV_CLOCK_SELECT_120MHZ 0x03 /* 120Mhz */ +#define MCS7840_DEV_CLOCK_SELECT_PLL 0x04 /* PLL output (see for M and N + * dividers) */ +#define MCS7840_DEV_CLOCK_SELECT_EXT 0x05 /* External clock input + * (device-dependend) */ +#define MCS7840_DEV_CLOCK_SELECT_RES1 0x06 /* Unused */ +#define MCS7840_DEV_CLOCK_SELECT_RES2 0x07 /* Unused */ + +/* Bits for MODE register */ +#define MCS7840_DEV_MODE_RESERVED1 0x01 /* Unused */ +#define MCS7840_DEV_MODE_RESET 0x02 /* 0: RESET = Active High + * (default), 1: Reserved (?) */ +#define MCS7840_DEV_MODE_SER_PRSNT 0x04 /* 0: Reserved, 1: Do not use + * hardocded values (default) + * (?) */ +#define MCS7840_DEV_MODE_PLLBYPASS 0x08 /* 1: PLL output is bypassed, + * default = 0 */ +#define MCS7840_DEV_MODE_PORBYPASS 0x10 /* 1: Power-On Reset is + * bypassed, default = 0 */ +#define MCS7840_DEV_MODE_SELECT24S 0x20 /* 0: 4 Serial Ports / IrDA + * active, 1: 2 Serial Ports / + * IrDA active */ +#define MCS7840_DEV_MODE_EEPROMWR 0x40 /* EEPROM write is enabled, + * default */ +#define MCS7840_DEV_MODE_IRDA 0x80 /* IrDA mode is activated + * (could be turned on), + * default */ + +/* Bits for SPx ICG */ +#define MCS7840_DEV_SPx_ICG_DEF 0x24 /* All 8 bits is used as + * number of BAUD clocks of + * pause */ + +/* + * Bits for RX_SAMPLINGxx registers + * These registers control when bit value will be sampled within + * the baud period. + * 0 is very beginning of period, 15 is very end, 7 is the middle. + */ +#define MCS7840_DEV_RX_SAMPLING1_MASK 0x0f /* Bits for port 1 in + * RX_SAMPLING12 */ +#define MCS7840_DEV_RX_SAMPLING1_SHIFT 0 /* Shift for port 1in + * RX_SAMPLING12 */ +#define MCS7840_DEV_RX_SAMPLING2_MASK 0xf0 /* Bits for port 2 in + * RX_SAMPLING12 */ +#define MCS7840_DEV_RX_SAMPLING2_SHIFT 4 /* Shift for port 2 in + * RX_SAMPLING12 */ +#define MCS7840_DEV_RX_SAMPLING3_MASK 0x0f /* Bits for port 3 in + * RX_SAMPLING23 */ +#define MCS7840_DEV_RX_SAMPLING3_SHIFT 0 /* Shift for port 3 in + * RX_SAMPLING23 */ +#define MCS7840_DEV_RX_SAMPLING4_MASK 0xf0 /* Bits for port 4 in + * RX_SAMPLING23 */ +#define MCS7840_DEV_RX_SAMPLING4_SHIFT 4 /* Shift for port 4 in + * RX_SAMPLING23 */ +#define MCS7840_DEV_RX_SAMPLINGx_MIN 0 /* Max for any RX Sampling */ +#define MCS7840_DEV_RX_SAMPLINGx_DEF 7 /* Default for any RX + * Sampling, center of period */ +#define MCS7840_DEV_RX_SAMPLINGx_MAX 15 /* Min for any RX Sampling */ + +/* Bits for ZERO_PERIODx */ +#define MCS7840_DEV_ZERO_PERIODx_DEF 20 /* Number of Bulk-in requests + * befor sending zero-sized + * reply */ + +/* Bits for ZERO_ENABLE */ +#define MCS7840_DEV_ZERO_ENABLE_PORT1 0x01 /* Enable of sending + * zero-sized replies for port + * 1, default */ +#define MCS7840_DEV_ZERO_ENABLE_PORT2 0x02 /* Enable of sending + * zero-sized replies for port + * 2, default */ +#define MCS7840_DEV_ZERO_ENABLE_PORT3 0x04 /* Enable of sending + * zero-sized replies for port + * 3, default */ +#define MCS7840_DEV_ZERO_ENABLE_PORT4 0x08 /* Enable of sending + * zero-sized replies for port + * 4, default */ + +/* Bits for THR_VAL_HIGHx */ +#define MCS7840_DEV_THR_VAL_HIGH_MASK 0x01 /* Only one bit is used */ +#define MCS7840_DEV_THR_VAL_HIGH_MUL 256 /* This one bit is means "256" */ +#define MCS7840_DEV_THR_VAL_HIGH_SHIFT 8 /* This one bit is means "256" */ +#define MCS7840_DEV_THR_VAL_HIGH_ENABLE 0x80 /* Enable threshold */ + +/* These are documented in "public" datasheet */ +#define MCS7840_DEV_REG_DCR0_1 0x04 /* Device contol register 0 for Port + * 1, R/W */ +#define MCS7840_DEV_REG_DCR1_1 0x05 /* Device contol register 1 for Port + * 1, R/W */ +#define MCS7840_DEV_REG_DCR2_1 0x06 /* Device contol register 2 for Port + * 1, R/W */ +#define MCS7840_DEV_REG_DCR0_2 0x16 /* Device contol register 0 for Port + * 2, R/W */ +#define MCS7840_DEV_REG_DCR1_2 0x17 /* Device contol register 1 for Port + * 2, R/W */ +#define MCS7840_DEV_REG_DCR2_2 0x18 /* Device contol register 2 for Port + * 2, R/W */ +#define MCS7840_DEV_REG_DCR0_3 0x19 /* Device contol register 0 for Port + * 3, R/W */ +#define MCS7840_DEV_REG_DCR1_3 0x1a /* Device contol register 1 for Port + * 3, R/W */ +#define MCS7840_DEV_REG_DCR2_3 0x1b /* Device contol register 2 for Port + * 3, R/W */ +#define MCS7840_DEV_REG_DCR0_4 0x1c /* Device contol register 0 for Port + * 4, R/W */ +#define MCS7840_DEV_REG_DCR1_4 0x1d /* Device contol register 1 for Port + * 4, R/W */ +#define MCS7840_DEV_REG_DCR2_4 0x1e /* Device contol register 2 for Port + * 4, R/W */ + +/* Bits of DCR0 registers, documented in datasheet */ +#define MCS7840_DEV_DCR0_PWRSAVE 0x01 /* Shutdown transiver + * when USB Suspend is + * engaged, default = 1 */ +#define MCS7840_DEV_DCR0_RESERVED1 0x02 /* Unused */ +#define MCS7840_DEV_DCR0_GPIO_MODE_MASK 0x0c /* GPIO Mode bits, WORKS + * ONLY FOR PORT 1 */ +#define MCS7840_DEV_DCR0_GPIO_MODE_IN 0x00 /* GPIO Mode - Input + * (0b00), WORKS ONLY + * FOR PORT 1 */ +#define MCS7840_DEV_DCR0_GPIO_MODE_OUT 0x08 /* GPIO Mode - Input + * (0b10), WORKS ONLY + * FOR PORT 1 */ +#define MCS7840_DEV_DCR0_RTS_ACTIVE_HIGH 0x10 /* RTS Active is HIGH, + * default = 0 (low) */ +#define MCS7840_DEV_DCR0_RTS_AUTO 0x20 /* RTS is controlled by + * state of TX buffer, + * default = 0 + * (controlled by MCR) */ +#define MCS7840_DEV_DCR0_IRDA 0x40 /* IrDA mode */ +#define MCS7840_DEV_DCR0_RESERVED2 0x80 /* Unused */ + +/* Bits of DCR1 registers, documented in datasheet */ +#define MCS7840_DEV_DCR1_GPIO_CURRENT_MASK 0x03 /* Mask to extract GPIO + * current value, WORKS + * ONLY FOR PORT 1 */ +#define MCS7840_DEV_DCR1_GPIO_CURRENT_6MA 0x00 /* GPIO output current + * 6mA, WORKS ONLY FOR + * PORT 1 */ +#define MCS7840_DEV_DCR1_GPIO_CURRENT_8MA 0x01 /* GPIO output current + * 8mA, defauilt, WORKS + * ONLY FOR PORT 1 */ +#define MCS7840_DEV_DCR1_GPIO_CURRENT_10MA 0x02 /* GPIO output current + * 10mA, WORKS ONLY FOR + * PORT 1 */ +#define MCS7840_DEV_DCR1_GPIO_CURRENT_12MA 0x03 /* GPIO output current + * 12mA, WORKS ONLY FOR + * PORT 1 */ +#define MCS7840_DEV_DCR1_UART_CURRENT_MASK 0x0c /* Mask to extract UART + * signals current value */ +#define MCS7840_DEV_DCR1_UART_CURRENT_6MA 0x00 /* UART output current + * 6mA */ +#define MCS7840_DEV_DCR1_UART_CURRENT_8MA 0x04 /* UART output current + * 8mA, defauilt */ +#define MCS7840_DEV_DCR1_UART_CURRENT_10MA 0x08 /* UART output current + * 10mA */ +#define MCS7840_DEV_DCR1_UART_CURRENT_12MA 0x0c /* UART output current + * 12mA */ +#define MCS7840_DEV_DCR1_WAKEUP_DISABLE 0x10 /* Disable Remote USB + * Wakeup */ +#define MCS7840_DEV_DCR1_PLLPWRDOWN_DISABLE 0x20 /* Disable PLL power + * down when not needed, + * WORKS ONLY FOR PORT 1 */ +#define MCS7840_DEV_DCR1_LONG_INTERRUPT 0x40 /* Enable 13 bytes of + * interrupt data, with + * FIFO statistics, + * WORKS ONLY FOR PORT 1 */ +#define MCS7840_DEV_DCR1_RESERVED1 0x80 /* Unused */ + +/* + * Bits of DCR2 registers, documented in datasheet + * Wakeup will work only if DCR0_IRDA = 0 (RS-xxx mode) and + * DCR1_WAKEUP_DISABLE = 0 (wakeup enabled). + */ +#define MCS7840_DEV_DCR2_WAKEUP_CTS 0x01 /* Wakeup on CTS change, + * default = 0 */ +#define MCS7840_DEV_DCR2_WAKEUP_DCD 0x02 /* Wakeup on DCD change, + * default = 0 */ +#define MCS7840_DEV_DCR2_WAKEUP_RI 0x04 /* Wakeup on RI change, + * default = 1 */ +#define MCS7840_DEV_DCR2_WAKEUP_DSR 0x08 /* Wakeup on DSR change, + * default = 0 */ +#define MCS7840_DEV_DCR2_WAKEUP_RXD 0x10 /* Wakeup on RX Data change, + * default = 0 */ +#define MCS7840_DEV_DCR2_WAKEUP_RESUME 0x20 /* Wakeup issues RESUME + * signal, DISCONNECT + * otherwise, default = 1 */ +#define MCS7840_DEV_DCR2_RESERVED1 0x40 /* Unused */ +#define MCS7840_DEV_DCR2_SHDN_POLARITY 0x80 /* 0: Pin 12 Active Low, 1: + * Pin 12 Active High, default + * = 0 */ + +/* Interrupt endpoint bytes & bits */ +#define MCS7840_IEP_FIFO_STATUS_INDEX 5 +/* + * Thesse can be calculated as "1 << portnumber" for Bulk-out and + * "1 << (portnumber+1)" for Bulk-in + */ +#define MCS7840_IEP_BO_PORT1_HASDATA 0x01 +#define MCS7840_IEP_BI_PORT1_HASDATA 0x02 +#define MCS7840_IEP_BO_PORT2_HASDATA 0x04 +#define MCS7840_IEP_BI_PORT2_HASDATA 0x08 +#define MCS7840_IEP_BO_PORT3_HASDATA 0x10 +#define MCS7840_IEP_BI_PORT3_HASDATA 0x20 +#define MCS7840_IEP_BO_PORT4_HASDATA 0x40 +#define MCS7840_IEP_BI_PORT4_HASDATA 0x80 + +/* Documented UART registers (fully compatible with 16550 UART) */ +#define MCS7840_UART_REG_THR 0x00 /* Transmitter Holding + * Register W/Only */ +#define MCS7840_UART_REG_RHR 0x00 /* Receiver Holding Register + * R/Only */ +#define MCS7840_UART_REG_IER 0x01 /* Interrupt enable register - + * R/W */ +#define MCS7840_UART_REG_FCR 0x02 /* FIFO Control register - + * W/Only */ +#define MCS7840_UART_REG_ISR 0x02 /* Interrupt Status Registter + * R/Only */ +#define MCS7840_UART_REG_LCR 0x03 /* Line control register R/W */ +#define MCS7840_UART_REG_MCR 0x04 /* Modem control register R/W */ +#define MCS7840_UART_REG_LSR 0x05 /* Line status register R/Only */ +#define MCS7840_UART_REG_MSR 0x06 /* Modem status register + * R/Only */ +#define MCS7840_UART_REG_SCRATCHPAD 0x07 /* Scratch pad register */ + +#define MCS7840_UART_REG_DLL 0x00 /* Low bits of BAUD divider */ +#define MCS7840_UART_REG_DLM 0x01 /* High bits of BAUD divider */ + +/* IER bits */ +#define MCS7840_UART_IER_RXREADY 0x01 /* RX Ready interrumpt mask */ +#define MCS7840_UART_IER_TXREADY 0x02 /* TX Ready interrumpt mask */ +#define MCS7840_UART_IER_RXSTAT 0x04 /* RX Status interrumpt mask */ +#define MCS7840_UART_IER_MODEM 0x08 /* Modem status change + * interrumpt mask */ +#define MCS7840_UART_IER_SLEEP 0x10 /* SLEEP enable */ + +/* FCR bits */ +#define MCS7840_UART_FCR_ENABLE 0x01 /* Enable FIFO */ +#define MCS7840_UART_FCR_FLUSHRHR 0x02 /* Flush RHR and FIFO */ +#define MCS7840_UART_FCR_FLUSHTHR 0x04 /* Flush THR and FIFO */ +#define MCS7840_UART_FCR_RTLMASK 0xa0 /* Mask to select RHR + * Interrupt Trigger level */ +#define MCS7840_UART_FCR_RTL_1_1 0x00 /* L1 = 1, L2 = 1 */ +#define MCS7840_UART_FCR_RTL_1_4 0x40 /* L1 = 1, L2 = 4 */ +#define MCS7840_UART_FCR_RTL_1_8 0x80 /* L1 = 1, L2 = 8 */ +#define MCS7840_UART_FCR_RTL_1_14 0xa0 /* L1 = 1, L2 = 14 */ + +/* ISR bits */ +#define MCS7840_UART_ISR_NOPENDING 0x01 /* No interrupt pending */ +#define MCS7840_UART_ISR_INTMASK 0x3f /* Mask to select interrupt + * source */ +#define MCS7840_UART_ISR_RXERR 0x06 /* Recevir error */ +#define MCS7840_UART_ISR_RXHASDATA 0x04 /* Recevier has data */ +#define MCS7840_UART_ISR_RXTIMEOUT 0x0c /* Recevier timeout */ +#define MCS7840_UART_ISR_TXEMPTY 0x02 /* Transmitter empty */ +#define MCS7840_UART_ISR_MSCHANGE 0x00 /* Modem status change */ + +/* LCR bits */ +#define MCS7840_UART_LCR_DATALENMASK 0x03 /* Mask for data length */ +#define MCS7840_UART_LCR_DATALEN5 0x00 /* 5 data bits */ +#define MCS7840_UART_LCR_DATALEN6 0x01 /* 6 data bits */ +#define MCS7840_UART_LCR_DATALEN7 0x02 /* 7 data bits */ +#define MCS7840_UART_LCR_DATALEN8 0x03 /* 8 data bits */ + +#define MCS7840_UART_LCR_STOPBMASK 0x04 /* Mask for stop bits */ +#define MCS7840_UART_LCR_STOPB1 0x00 /* 1 stop bit in any case */ +#define MCS7840_UART_LCR_STOPB2 0x04 /* 1.5-2 stop bits depends on + * data length */ + +#define MCS7840_UART_LCR_PARITYMASK 0x38 /* Mask for all parity data */ +#define MCS7840_UART_LCR_PARITYON 0x08 /* Parity ON/OFF - ON */ +#define MCS7840_UART_LCR_PARITYODD 0x00 /* Parity Odd */ +#define MCS7840_UART_LCR_PARITYEVEN 0x10 /* Parity Even */ +#define MCS7840_UART_LCR_PARITYODD 0x00 /* Parity Odd */ +#define MCS7840_UART_LCR_PARITYFORCE 0x20 /* Force parity odd/even */ + +#define MCS7840_UART_LCR_BREAK 0x40 /* Send BREAK */ +#define MCS7840_UART_LCR_DIVISORS 0x80 /* Map DLL/DLM instead of + * xHR/IER */ + +/* LSR bits */ +#define MCS7840_UART_LSR_RHRAVAIL 0x01 /* Data available for read */ +#define MCS7840_UART_LSR_RHROVERRUN 0x02 /* Data FIFO/register overflow */ +#define MCS7840_UART_LSR_PARITYERR 0x04 /* Parity error */ +#define MCS7840_UART_LSR_FRAMEERR 0x10 /* Framing error */ +#define MCS7840_UART_LSR_BREAKERR 0x20 /* BREAK sigmal received */ +#define MCS7840_UART_LSR_THREMPTY 0x40 /* THR register is empty, + * ready for transmit */ +#define MCS7840_UART_LSR_HASERR 0x80 /* Has error in receiver FIFO */ + +/* MCR bits */ +#define MCS7840_UART_MCR_DTR 0x01 /* Force DTR to be active + * (low) */ +#define MCS7840_UART_MCR_RTS 0x02 /* Force RTS to be active + * (low) */ +#define MCS7840_UART_MCR_IE 0x04 /* Enable interrupts (from + * code, not documented) */ +#define MCS7840_UART_MCR_LOOPBACK 0x10 /* Enable local loopback test + * mode */ +#define MCS7840_UART_MCR_CTSRTS 0x20 /* Enable CTS/RTS flow control + * in 550 (FIFO) mode */ +#define MCS7840_UART_MCR_DTRDSR 0x40 /* Enable DTR/DSR flow control + * in 550 (FIFO) mode */ +#define MCS7840_UART_MCR_DCD 0x80 /* Enable DCD flow control in + * 550 (FIFO) mode */ + +/* MSR bits */ +#define MCS7840_UART_MSR_DELTACTS 0x01 /* CTS was changed since last + * read */ +#define MCS7840_UART_MSR_DELTADSR 0x02 /* DSR was changed since last + * read */ +#define MCS7840_UART_MSR_DELTARI 0x04 /* RI was changed from low to + * high since last read */ +#define MCS7840_UART_MSR_DELTADCD 0x08 /* DCD was changed since last + * read */ +#define MCS7840_UART_MSR_NEGCTS 0x10 /* Negated CTS signal */ +#define MCS7840_UART_MSR_NEGDSR 0x20 /* Negated DSR signal */ +#define MCS7840_UART_MSR_NEGRI 0x40 /* Negated RI signal */ +#define MCS7840_UART_MSR_NEGDCD 0x80 /* Negated DCD signal */ + +/* SCRATCHPAD bits */ +#define MCS7840_UART_SCRATCHPAD_RS232 0x00 /* RS-485 disabled */ +#define MCS7840_UART_SCRATCHPAD_RS485_DTRRX 0x80 /* RS-485 mode, DTR High + * = RX */ +#define MCS7840_UART_SCRATCHPAD_RS485_DTRTX 0xc0 /* RS-485 mode, DTR High + * = TX */ + +#define MCS7840_CONFIG_INDEX 0 +#define MCS7840_IFACE_INDEX 0 + +#endif Modified: head/sys/modules/usb/Makefile ============================================================================== --- head/sys/modules/usb/Makefile Sat Jun 4 19:16:46 2011 (r222695) +++ head/sys/modules/usb/Makefile Sat Jun 4 20:40:24 2011 (r222696) @@ -30,7 +30,7 @@ SUBDIR += ehci musb ohci uhci xhci uss82 SUBDIR += rum run uath upgt ural zyd ${_urtw} SUBDIR += atp uhid ukbd ums udbp ufm uep SUBDIR += ucom u3g uark ubsa ubser uchcom ucycom ufoma uftdi ugensa uipaq ulpt \ - umct umcs7840 umodem umoscom uplcom uslcom uvisor uvscom + umct umcs umodem umoscom uplcom uslcom uvisor uvscom SUBDIR += uether aue axe cdce cue kue mos rue udav uhso ipheth SUBDIR += usfs umass urio SUBDIR += quirk template Modified: head/sys/modules/usb/umcs/Makefile ============================================================================== --- head/sys/modules/usb/umcs7840/Makefile Wed Jun 1 17:58:27 2011 (r222578) +++ head/sys/modules/usb/umcs/Makefile Sat Jun 4 20:40:24 2011 (r222696) @@ -29,8 +29,8 @@ S= ${.CURDIR}/../../.. .PATH: $S/dev/usb/serial -KMOD= umcs7840 +KMOD= umcs SRCS= opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h usbdevs.h \ - umcs7840.c + umcs.c .include From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 21:59:55 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA2341065670; Sat, 4 Jun 2011 21:59:55 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CAB488FC19; Sat, 4 Jun 2011 21:59: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 p54Lxt7t027791; Sat, 4 Jun 2011 21:59:55 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54LxtxG027789; Sat, 4 Jun 2011 21:59:55 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106042159.p54LxtxG027789@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 4 Jun 2011 21:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222697 - head/usr.bin/find X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 21:59:56 -0000 Author: jilles Date: Sat Jun 4 21:59:55 2011 New Revision: 222697 URL: http://svn.freebsd.org/changeset/base/222697 Log: find: Exit if there is an unknown option. Ignoring the parameter with the unknown options is unlikely to be what was intended. Example: find -n . Note that things like find -n already caused an exit, equivalent to "find" by itself. Modified: head/usr.bin/find/main.c Modified: head/usr.bin/find/main.c ============================================================================== --- head/usr.bin/find/main.c Sat Jun 4 20:40:24 2011 (r222696) +++ head/usr.bin/find/main.c Sat Jun 4 21:59:55 2011 (r222697) @@ -120,7 +120,7 @@ main(int argc, char *argv[]) break; case '?': default: - break; + usage(); } argc -= optind; From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 22:19:01 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EA3A106566C; Sat, 4 Jun 2011 22:19:01 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F34F8FC16; Sat, 4 Jun 2011 22:19:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p54MJ1PO028536; Sat, 4 Jun 2011 22:19:01 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54MJ1kw028534; Sat, 4 Jun 2011 22:19:01 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106042219.p54MJ1kw028534@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 4 Jun 2011 22:19:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222699 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 22:19:01 -0000 Author: jilles Date: Sat Jun 4 22:19:00 2011 New Revision: 222699 URL: http://svn.freebsd.org/changeset/base/222699 Log: sh: Improve error message if the script cannot be opened. Avoid ": cannot open : ...". Modified: head/bin/sh/options.c Modified: head/bin/sh/options.c ============================================================================== --- head/bin/sh/options.c Sat Jun 4 22:05:20 2011 (r222698) +++ head/bin/sh/options.c Sat Jun 4 22:19:00 2011 (r222699) @@ -83,6 +83,7 @@ void procargs(int argc, char **argv) { int i; + char *scriptname; argptr = argv; if (argc > 0) @@ -105,8 +106,9 @@ procargs(int argc, char **argv) optlist[i].val = 0; arg0 = argv[0]; if (sflag == 0 && minusc == NULL) { - commandname = arg0 = *argptr++; - setinputfile(commandname, 0); + scriptname = *argptr++; + setinputfile(scriptname, 0); + commandname = arg0 = scriptname; } /* POSIX 1003.2: first arg after -c cmd is $0, remainder $1... */ if (argptr && minusc && *argptr) From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 22:28:49 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 055B3106566B; Sat, 4 Jun 2011 22:28:49 +0000 (UTC) (envelope-from kristof@sigsegv.be) Received: from mercury.codepro.be (mercury.codepro.be [IPv6:2001:4b98:dc0:51:216:3eff:feb7:3147]) by mx1.freebsd.org (Postfix) with ESMTP id 910EC8FC08; Sat, 4 Jun 2011 22:28:48 +0000 (UTC) Received: from triton.sigsegv.be (triton.neptune.sigsegv.be [IPv6:2001:470:c8f4:0:200:ff:fe00:7]) by mercury.codepro.be (Postfix) with ESMTP id 3E5F05E9; Sun, 5 Jun 2011 00:28:47 +0200 (CEST) Received: from nereid (nereid.neptune.sigsegv.be [IPv6:2001:470:c8f4:0:200:ff:fe00:8]) by triton.sigsegv.be (Postfix) with SMTP id D1C151C1C7; Sun, 5 Jun 2011 00:28:45 +0200 (CEST) Received: by nereid (sSMTP sendmail emulation); Sun, 05 Jun 2011 00:28:45 +0200 Date: Sun, 5 Jun 2011 00:28:45 +0200 From: Kristof Provost To: Robert Watson Message-ID: <20110604222845.GG17764@nereid> References: <201105300943.p4U9htjI070096@svn.freebsd.org> <20110604143043.GE17764@nereid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-Fingerprint: E114 D9EA 909E D469 8F57 17A5 7D15 91C6 9EFA F286 User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222488 - in head/sys: contrib/pf/net netinet netinet/ipfw netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 22:28:49 -0000 On 2011-06-04 17:27:56 (+0100), Robert Watson wrote: > > On Sat, 4 Jun 2011, Kristof Provost wrote: > > >I'm seeing a panic when I start natd, which I suspect is related > >to this commit: > > And, I believe now fixed in the just-committed r222690. My > suggestion is that people running -CURRENT should generally keep > INVARIANTS and WITNESS on -- they introduce some overhead, but are > invaluable in tracking down problems. > I've just been able to test your patch. The panic is now gone. I'll also test 222690, but that'll be a job for tomorrow. > Thanks! Thanks for the quick response. Kristof From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 23:31:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79E2010656F9; Sat, 4 Jun 2011 23:31:33 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A3D98FC17; Sat, 4 Jun 2011 23:31: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 p54NVX8G030713; Sat, 4 Jun 2011 23:31:33 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54NVX4v030710; Sat, 4 Jun 2011 23:31:33 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201106042331.p54NVX4v030710@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 4 Jun 2011 23:31:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222701 - head/sys/dev/cxgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 23:31:33 -0000 Author: np Date: Sat Jun 4 23:31:33 2011 New Revision: 222701 URL: http://svn.freebsd.org/changeset/base/222701 Log: Allow lazy fill up of freelists. MFC after: 3 days Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Sat Jun 4 22:51:06 2011 (r222700) +++ head/sys/dev/cxgbe/adapter.h Sat Jun 4 23:31:33 2011 (r222701) @@ -396,6 +396,7 @@ struct sge_ctrlq { struct sge { uint16_t timer_val[SGE_NTIMERS]; uint8_t counter_val[SGE_NCOUNTERS]; + int fl_starve_threshold; int nrxq; /* total rx queues (all ports and the rest) */ int ntxq; /* total tx queues (all ports and the rest) */ Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sat Jun 4 22:51:06 2011 (r222700) +++ head/sys/dev/cxgbe/t4_sge.c Sat Jun 4 23:31:33 2011 (r222701) @@ -203,6 +203,9 @@ t4_sge_init(struct adapter *sc) FL_BUF_SIZE(i)); } + i = t4_read_reg(sc, A_SGE_CONM_CTRL); + s->fl_starve_threshold = G_EGRTHRESHOLD(i) * 2 + 1; + t4_write_reg(sc, A_SGE_INGRESS_RX_THRESHOLD, V_THRESHOLD_0(s->counter_val[0]) | V_THRESHOLD_1(s->counter_val[1]) | @@ -1233,7 +1236,8 @@ alloc_iq_fl(struct port_info *pi, struct sc->sge.eqmap[cntxt_id] = (void *)fl; FL_LOCK(fl); - refill_fl(sc, fl, -1, 8); + /* Just enough to make sure it doesn't starve right away. */ + refill_fl(sc, fl, roundup(sc->sge.fl_starve_threshold, 8), 8); FL_UNLOCK(fl); } @@ -1389,6 +1393,10 @@ alloc_rxq(struct port_info *pi, struct s if (rc != 0) return (rc); + FL_LOCK(&rxq->fl); + refill_fl(pi->adapter, &rxq->fl, rxq->fl.needed / 8, 8); + FL_UNLOCK(&rxq->fl); + #ifdef INET rc = tcp_lro_init(&rxq->lro); if (rc != 0) From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 23:31:42 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FBCD10656FA; Sat, 4 Jun 2011 23:31:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 062C98FC16; Sat, 4 Jun 2011 23:31: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 p54NVfUK030753; Sat, 4 Jun 2011 23:31:41 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54NVfC0030751; Sat, 4 Jun 2011 23:31:41 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201106042331.p54NVfC0030751@svn.freebsd.org> From: Robert Watson Date: Sat, 4 Jun 2011 23:31:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222702 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 23:31:42 -0000 Author: rwatson Date: Sat Jun 4 23:31:41 2011 New Revision: 222702 URL: http://svn.freebsd.org/changeset/base/222702 Log: Allocate four bits from the mbuf flags field to represent the hash type of a software- or hardware-generated hash held in the mbuf.m_pkthdr.flowid field, and provide accessor macros to easily clear, set, receive, and test for hash values. Some of these constants correspond to RSS hash types, but we don't want to limit ourselves to that, as a number of other hashing techniques are in use on hardware supported by FreeBSD. Mark the M_FLOWID flag as deprecated; I hope to remove this before 9.0, changing drivers and the stack over to using the new M_HASHTYPEBITS, most likely to use M_HASHTYPE_OPAQUE as we don't yet want to nail down the KPI for RSS key/bucket management for device drivers. MFC after: 3 days Reviewed by: bz Sponsored by: Juniper Networks, Inc. Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat Jun 4 23:31:33 2011 (r222701) +++ head/sys/sys/mbuf.h Sat Jun 4 23:31:41 2011 (r222702) @@ -199,7 +199,9 @@ struct mbuf { #define M_PROTO6 0x00080000 /* protocol-specific */ #define M_PROTO7 0x00100000 /* protocol-specific */ #define M_PROTO8 0x00200000 /* protocol-specific */ -#define M_FLOWID 0x00400000 /* flowid is valid */ +#define M_FLOWID 0x00400000 /* deprecated: flowid is valid */ +#define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid hash type */ + /* * For RELENG_{6,7} steal these flags for limited multiple routing table * support. In RELENG_8 and beyond, use just one flag and a tag. @@ -215,11 +217,45 @@ struct mbuf { (M_PROTO1|M_PROTO2|M_PROTO3|M_PROTO4|M_PROTO5|M_PROTO6|M_PROTO7|M_PROTO8) /* + * Network interface cards are able to hash protocol fields (such as IPv4 + * addresses and TCP port numbers) classify packets into flows. These flows + * can then be used to maintain ordering while delivering packets to the OS + * via parallel input queues, as well as to provide a stateless affinity + * model. NIC drivers can pass up the hash via m->m_pkthdr.flowid, and set + * m_flag fields to indicate how the hash should be interpreted by the + * network stack. + * + * Most NICs support RSS, which provides ordering and explicit affinity, and + * use the hash m_flag bits to indicate what header fields were covered by + * the hash. M_HASHTYPE_OPAQUE can be set by non-RSS cards or configurations + * that provide an opaque flow identifier, allowing for ordering and + * distribution without explicit affinity. + */ +#define M_HASHTYPE_SHIFT 24 +#define M_HASHTYPE_NONE 0x0 +#define M_HASHTYPE_RSS_IPV4 0x1 /* IPv4 2-tuple */ +#define M_HASHTYPE_RSS_TCP_IPV4 0x2 /* TCPv4 4-tuple */ +#define M_HASHTYPE_RSS_IPV6 0x3 /* IPv6 2-tuple */ +#define M_HASHTYPE_RSS_TCP_IPV6 0x4 /* TCPv6 4-tuple */ +#define M_HASHTYPE_RSS_IPV6_EX 0x5 /* IPv6 2-tuple + ext hdrs */ +#define M_HASHTYPE_RSS_TCP_IPV6_EX 0x6 /* TCPv6 4-tiple + ext hdrs */ +#define M_HASHTYPE_OPAQUE 0xf /* ordering, not affinity */ + +#define M_HASHTYPE_CLEAR(m) (m)->m_flags &= ~(M_HASHTYPEBITS) +#define M_HASHTYPE_GET(m) (((m)->m_flags & M_HASHTYPEBITS) >> \ + M_HASHTYPE_SHIFT) +#define M_HASHTYPE_SET(m, v) do { \ + (m)->m_flags &= ~M_HASHTYPEBITS; \ + (m)->m_flags |= ((v) << M_HASHTYPE_SHIFT); \ +while (0) +#define M_HASHTYPE_TEST(m, v) (M_HASHTYPE_GET(m) == (v)) + +/* * Flags preserved when copying m_pkthdr. */ #define M_COPYFLAGS \ (M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_SKIP_FIREWALL|M_BCAST|M_MCAST|\ - M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG|M_PROMISC|M_FIB) + M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG|M_PROMISC|M_FIB|M_HASHTYPEBITS) /* * External buffer types: identify ext_buf type. From owner-svn-src-head@FreeBSD.ORG Sat Jun 4 23:36:19 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 695E71065670; Sat, 4 Jun 2011 23:36:19 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A2CA8FC16; Sat, 4 Jun 2011 23:36:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p54NaJxJ030938; Sat, 4 Jun 2011 23:36:19 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p54NaJij030936; Sat, 4 Jun 2011 23:36:19 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201106042336.p54NaJij030936@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 4 Jun 2011 23:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222703 - head/sys/dev/cxgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 23:36:19 -0000 Author: np Date: Sat Jun 4 23:36:19 2011 New Revision: 222703 URL: http://svn.freebsd.org/changeset/base/222703 Log: Cause backpressure (instead of dropping frames) on congestion. MFC after: 3 days Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sat Jun 4 23:31:41 2011 (r222702) +++ head/sys/dev/cxgbe/t4_main.c Sat Jun 4 23:36:19 2011 (r222703) @@ -492,6 +492,8 @@ t4_attach(device_t dev) V_RXTSHIFTMAXR2(15) | V_PERSHIFTBACKOFFMAX(8) | V_PERSHIFTMAX(8) | V_KEEPALIVEMAXR1(4) | V_KEEPALIVEMAXR2(9)); t4_write_reg(sc, A_ULP_RX_TDDP_PSZ, V_HPZ0(PAGE_SHIFT - 12)); + t4_set_reg_field(sc, A_TP_PARA_REG3, F_TUNNELCNGDROP0 | + F_TUNNELCNGDROP1 | F_TUNNELCNGDROP2 | F_TUNNELCNGDROP3, 0); setup_memwin(sc);