From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 03:33: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 0D6E81065670; Sun, 5 Jun 2011 03:33: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 F20E38FC0C; Sun, 5 Jun 2011 03:33: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 p553Xk56038340; Sun, 5 Jun 2011 03:33:46 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p553XkCB038338; Sun, 5 Jun 2011 03:33:46 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201106050333.p553XkCB038338@svn.freebsd.org> From: Adrian Chadd Date: Sun, 5 Jun 2011 03:33: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: r222707 - 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: Sun, 05 Jun 2011 03:33:47 -0000 Author: adrian Date: Sun Jun 5 03:33:46 2011 New Revision: 222707 URL: http://svn.freebsd.org/changeset/base/222707 Log: Add a missing call to sync the DMAed buffer before the radar event data is extracted. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sun Jun 5 02:44:04 2011 (r222706) +++ head/sys/dev/ath/if_ath.c Sun Jun 5 03:33:46 2011 (r222707) @@ -3473,7 +3473,15 @@ 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, mtod(m, char *), tsf, rs); + if ((rs->rs_phyerr == HAL_PHYERR_RADAR) || + (rs->rs_phyerr == HAL_PHYERR_FALSE_RADAR_EXT)) { + /* Since we're touching the frame data, sync it */ + bus_dmamap_sync(sc->sc_dmat, + bf->bf_dmamap, + BUS_DMASYNC_POSTREAD); + /* Now pass it to the radar processing code */ + 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) From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 08:53: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 7327B106566B; Sun, 5 Jun 2011 08:53:59 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 3F7238FC0A; Sun, 5 Jun 2011 08:53:59 +0000 (UTC) Received: from julian-mac.elischer.org (home-nat.elischer.org [67.100.89.137]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id p558K7jN008461 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 5 Jun 2011 01:20:08 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <4DEB3C32.9070709@freebsd.org> Date: Sun, 05 Jun 2011 01:20:02 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Robert Watson References: <201106042331.p54NVfC0030751@svn.freebsd.org> In-Reply-To: <201106042331.p54NVfC0030751@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: 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: Sun, 05 Jun 2011 08:53:59 -0000 On 6/4/11 4:31 PM, Robert Watson wrote: > 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. > > hmm note that my stealing of 4 bits for FIB was supposed to go away for 8 and beyond. We need to do an mbuf redesign.. at this stage, I guess it's a project for 10. From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 09:20: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 365971065670; Sun, 5 Jun 2011 09:20:35 +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 115C08FC08; Sun, 5 Jun 2011 09:20:35 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 7138E46B03; Sun, 5 Jun 2011 05:20:34 -0400 (EDT) Date: Sun, 5 Jun 2011 10:20:34 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Julian Elischer In-Reply-To: <4DEB3C32.9070709@freebsd.org> Message-ID: References: <201106042331.p54NVfC0030751@svn.freebsd.org> <4DEB3C32.9070709@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: 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: Sun, 05 Jun 2011 09:20:35 -0000 On Sun, 5 Jun 2011, Julian Elischer wrote: > hmm note that my stealing of 4 bits for FIB was supposed to go away for 8 > and beyond. We need to do an mbuf redesign.. at this stage, I guess it's a > project for 10. Indeed -- it would be nice not just to reclaim the FIB bits, but also to support more simultaneous FIBs. We still need to do a KBI analysis of mbuf for 9.0 across various architectures, but it would be pretty late to fix the FIB thing. On a redesign, clearly too late for that as well. I still hope we can get the variable size mbuf cluster in for 10 though. Robert From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 10:07: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 43BCB1065678; Sun, 5 Jun 2011 10:07:13 +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 334D98FC12; Sun, 5 Jun 2011 10:07: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 p55A7DAp050921; Sun, 5 Jun 2011 10:07:13 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55A7DAn050912; Sun, 5 Jun 2011 10:07:13 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201106051007.p55A7DAn050912@svn.freebsd.org> From: Robert Watson Date: Sun, 5 Jun 2011 10:07: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: r222709 - 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: Sun, 05 Jun 2011 10:07:13 -0000 Author: rwatson Date: Sun Jun 5 10:07:12 2011 New Revision: 222709 URL: http://svn.freebsd.org/changeset/base/222709 Log: Correct a last minute merge error for new M_HASHTYPE macros. This didn't turn up as a build problem because the macros aren't used (yet). MFC after: 3 days Sponsored by: Juniper Networks, Inc. Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sun Jun 5 07:55:51 2011 (r222708) +++ head/sys/sys/mbuf.h Sun Jun 5 10:07:12 2011 (r222709) @@ -247,7 +247,7 @@ struct mbuf { #define M_HASHTYPE_SET(m, v) do { \ (m)->m_flags &= ~M_HASHTYPEBITS; \ (m)->m_flags |= ((v) << M_HASHTYPE_SHIFT); \ -while (0) +} while (0) #define M_HASHTYPE_TEST(m, v) (M_HASHTYPE_GET(m) == (v)) /* From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 11:37: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 5E4101065674; Sun, 5 Jun 2011 11:37:21 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DC818FC26; Sun, 5 Jun 2011 11:37: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 p55BbLV2054502; Sun, 5 Jun 2011 11:37:21 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55BbLv5054499; Sun, 5 Jun 2011 11:37:21 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106051137.p55BbLv5054499@svn.freebsd.org> From: Hiroki Sato Date: Sun, 5 Jun 2011 11:37: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: r222711 - 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: Sun, 05 Jun 2011 11:37:21 -0000 Author: hrs Date: Sun Jun 5 11:37:20 2011 New Revision: 222711 URL: http://svn.freebsd.org/changeset/base/222711 Log: Add the "nd6 options" line handler as af_other_status() of AF_INET6, not as an own address family. Reviewed by: bz Modified: head/sbin/ifconfig/af_inet6.c head/sbin/ifconfig/af_nd6.c Modified: head/sbin/ifconfig/af_inet6.c ============================================================================== --- head/sbin/ifconfig/af_inet6.c Sun Jun 5 11:20:19 2011 (r222710) +++ head/sbin/ifconfig/af_inet6.c Sun Jun 5 11:37:20 2011 (r222711) @@ -69,6 +69,7 @@ static int explicit_prefix = 0; extern void setnd6flags(const char *, int, int, const struct afswtch *); extern void setnd6defif(const char *, int, int, const struct afswtch *); +extern void nd6_status(int); static char addr_buf[MAXHOSTNAMELEN *2 + 1]; /*for getnameinfo()*/ @@ -519,6 +520,7 @@ static struct afswtch af_inet6 = { .af_status = in6_status, .af_getaddr = in6_getaddr, .af_getprefix = in6_getprefix, + .af_other_status = nd6_status, .af_postproc = in6_postproc, .af_status_tunnel = in6_status_tunnel, .af_settunnel = in6_set_tunnel, Modified: head/sbin/ifconfig/af_nd6.c ============================================================================== --- head/sbin/ifconfig/af_nd6.c Sun Jun 5 11:20:19 2011 (r222710) +++ head/sbin/ifconfig/af_nd6.c Sun Jun 5 11:37:20 2011 (r222711) @@ -63,6 +63,7 @@ static const char rcsid[] = static int isnd6defif(int); void setnd6flags(const char *, int, int, const struct afswtch *); void setnd6defif(const char *, int, int, const struct afswtch *); +void nd6_status(int); void setnd6flags(const char *dummyaddr __unused, @@ -136,64 +137,13 @@ isnd6defif(int s) return (ndifreq.ifindex == ifindex); } -static void +void nd6_status(int s) { struct in6_ndireq nd; - struct rt_msghdr *rtm; - size_t needed; - char *buf, *next; - int mib[6], ntry; int s6; int error; - int isinet6, isdefif; - - /* Check if the interface has at least one IPv6 address. */ - mib[0] = CTL_NET; - mib[1] = PF_ROUTE; - mib[2] = 0; - mib[3] = AF_INET6; - mib[4] = NET_RT_IFLIST; - mib[5] = if_nametoindex(ifr.ifr_name); - - /* Try to prevent a race between two sysctls. */ - ntry = 0; - do { - error = sysctl(mib, 6, NULL, &needed, NULL, 0); - if (error) { - warn("sysctl(NET_RT_IFLIST)/estimate"); - return; - } - buf = malloc(needed); - if (buf == NULL) { - warn("malloc for sysctl(NET_RT_IFLIST) failed"); - return; - } - if ((error = sysctl(mib, 6, buf, &needed, NULL, 0)) < 0) { - if (errno != ENOMEM || ++ntry >= MAX_SYSCTL_TRY) { - warn("sysctl(NET_RT_IFLIST)/get"); - free(buf); - return; - } - free(buf); - buf = NULL; - } - } while (buf == NULL); - - isinet6 = 0; - for (next = buf; next < buf + needed; next += rtm->rtm_msglen) { - rtm = (struct rt_msghdr *)next; - - if (rtm->rtm_version != RTM_VERSION) - continue; - if (rtm->rtm_type == RTM_NEWADDR) { - isinet6 = 1; - break; - } - } - free(buf); - if (!isinet6) - return; + int isdefif; memset(&nd, 0, sizeof(nd)); strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname)); @@ -215,19 +165,3 @@ nd6_status(int s) (unsigned int)(nd.ndi.flags | (isdefif << 15)), ND6BITS); putchar('\n'); } - -static struct afswtch af_nd6 = { - .af_name = "nd6", - .af_af = AF_LOCAL, - .af_other_status= nd6_status, -}; - -static __constructor void -nd6_ctor(void) -{ - - if (!feature_present("inet6")) - return; - - af_register(&af_nd6); -} From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 11:40: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 0B69A1065674; Sun, 5 Jun 2011 11:40:31 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF84E8FC0C; Sun, 5 Jun 2011 11:40: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 p55BeULS054768; Sun, 5 Jun 2011 11:40:30 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55BeUXV054766; Sun, 5 Jun 2011 11:40:30 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106051140.p55BeUXV054766@svn.freebsd.org> From: Hiroki Sato Date: Sun, 5 Jun 2011 11:40: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: r222712 - head/sys/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: Sun, 05 Jun 2011 11:40:31 -0000 Author: hrs Date: Sun Jun 5 11:40:30 2011 New Revision: 222712 URL: http://svn.freebsd.org/changeset/base/222712 Log: Use uint8_t for sockaddr sa_len. Reviewed by: bz Modified: head/sys/netinet6/send.h Modified: head/sys/netinet6/send.h ============================================================================== --- head/sys/netinet6/send.h Sun Jun 5 11:37:20 2011 (r222711) +++ head/sys/netinet6/send.h Sun Jun 5 11:40:30 2011 (r222712) @@ -33,7 +33,7 @@ #define SND_IN 1 /* Incoming traffic. */ struct sockaddr_send { - unsigned char send_len; /* total length */ + uint8_t send_len; /* total length */ sa_family_t send_family; /* address family */ int send_direction; int send_ifidx; From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 12:46: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 DEC701065673; Sun, 5 Jun 2011 12:46:26 +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 CDF478FC0C; Sun, 5 Jun 2011 12:46: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 p55CkQiB060818; Sun, 5 Jun 2011 12:46:26 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55CkQ2U060817; Sun, 5 Jun 2011 12:46:26 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106051246.p55CkQ2U060817@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 5 Jun 2011 12:46: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: r222715 - head/tools/regression/bin/sh/expansion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Jun 2011 12:46:27 -0000 Author: jilles Date: Sun Jun 5 12:46:26 2011 New Revision: 222715 URL: http://svn.freebsd.org/changeset/base/222715 Log: sh: Add already working testcases for $? in here-document. If the here-document is attached to a compound command or subshell, $? already works properly. This is both a workaround for bin/41410 and a requirement for a true fix for bin/41410. PR: bin/41410 MFC after: 1 week Added: head/tools/regression/bin/sh/expansion/heredoc1.0 (contents, props changed) Added: head/tools/regression/bin/sh/expansion/heredoc1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/heredoc1.0 Sun Jun 5 12:46:26 2011 (r222715) @@ -0,0 +1,25 @@ +# $FreeBSD$ + +f() { return $1; } + +[ `f 42; { cat; } < Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D268106564A; Sun, 5 Jun 2011 14:13:16 +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 5C1DD8FC0A; Sun, 5 Jun 2011 14:13:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p55EDGi7084230; Sun, 5 Jun 2011 14:13:16 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55EDGPD084227; Sun, 5 Jun 2011 14:13:16 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106051413.p55EDGPD084227@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 5 Jun 2011 14:13: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: r222716 - in head: bin/sh tools/regression/bin/sh/expansion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Jun 2011 14:13:16 -0000 Author: jilles Date: Sun Jun 5 14:13:15 2011 New Revision: 222716 URL: http://svn.freebsd.org/changeset/base/222716 Log: sh: Fix $? in heredocs on simple commands. PR: bin/41410 Added: head/tools/regression/bin/sh/expansion/heredoc2.0 (contents, props changed) Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Jun 5 12:46:26 2011 (r222715) +++ head/bin/sh/eval.c Sun Jun 5 14:13:15 2011 (r222716) @@ -409,6 +409,7 @@ evalsubshell(union node *n, int flags) struct job *jp; int backgnd = (n->type == NBACKGND); + oexitstatus = exitstatus; expredir(n->nredir.redirect); if ((!backgnd && flags & EV_EXIT && !have_traps()) || forkshell(jp = makejob(n, 1), n, backgnd) == 0) { @@ -436,6 +437,7 @@ evalredir(union node *n, int flags) struct jmploc *savehandler; volatile int in_redirect = 1; + oexitstatus = exitstatus; expredir(n->nredir.redirect); savehandler = handler; if (setjmp(jmploc.loc)) { @@ -478,7 +480,6 @@ expredir(union node *n) for (redir = n ; redir ; redir = redir->nfile.next) { struct arglist fn; fn.lastp = &fn.list; - oexitstatus = exitstatus; switch (redir->type) { case NFROM: case NTO: Added: head/tools/regression/bin/sh/expansion/heredoc2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/heredoc2.0 Sun Jun 5 14:13:15 2011 (r222716) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +f() { return $1; } + +[ `f 42; cat < Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2315510656D0; Sun, 5 Jun 2011 17:31:45 +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 B9FC78FC18; Sun, 5 Jun 2011 17:31: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 p55HViAs090673; Sun, 5 Jun 2011 17:31:44 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55HVi0h090671; Sun, 5 Jun 2011 17:31:44 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201106051731.p55HVi0h090671@svn.freebsd.org> From: Rick Macklem Date: Sun, 5 Jun 2011 17:31: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: r222718 - 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: Sun, 05 Jun 2011 17:31:45 -0000 Author: rmacklem Date: Sun Jun 5 17:31:44 2011 New Revision: 222718 URL: http://svn.freebsd.org/changeset/base/222718 Log: Fix the new NFSv4 client so that it doesn't crash when a mount is done for a VIMAGE kernel. Tested by: glz at hidden-powers dot com Reviewed by: bz MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clport.c Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Sun Jun 5 14:46:42 2011 (r222717) +++ head/sys/fs/nfsclient/nfs_clport.c Sun Jun 5 17:31:44 2011 (r222718) @@ -943,6 +943,7 @@ nfscl_getmyip(struct nfsmount *nmp, int sad.sin_family = AF_INET; sad.sin_len = sizeof (struct sockaddr_in); sad.sin_addr.s_addr = sin->sin_addr.s_addr; + CURVNET_SET(CRED_TO_VNET(nmp->nm_sockreq.nr_cred)); rt = rtalloc1((struct sockaddr *)&sad, 0, 0UL); if (rt != NULL) { if (rt->rt_ifp != NULL && @@ -956,6 +957,7 @@ nfscl_getmyip(struct nfsmount *nmp, int } RTFREE_LOCKED(rt); } + CURVNET_RESTORE(); #ifdef INET6 } else if (nmp->nm_nam->sa_family == AF_INET6) { struct sockaddr_in6 sad6, *sin6; @@ -966,6 +968,7 @@ nfscl_getmyip(struct nfsmount *nmp, int sad6.sin6_family = AF_INET6; sad6.sin6_len = sizeof (struct sockaddr_in6); sad6.sin6_addr = sin6->sin6_addr; + CURVNET_SET(CRED_TO_VNET(nmp->nm_sockreq.nr_cred)); rt = rtalloc1((struct sockaddr *)&sad6, 0, 0UL); if (rt != NULL) { if (rt->rt_ifp != NULL && @@ -980,6 +983,7 @@ nfscl_getmyip(struct nfsmount *nmp, int } RTFREE_LOCKED(rt); } + CURVNET_RESTORE(); #endif } return (retp); From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 18:17: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 EBE1E106564A; Sun, 5 Jun 2011 18:17:37 +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 DA4F78FC15; Sun, 5 Jun 2011 18:17: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 p55IHbYE092052; Sun, 5 Jun 2011 18:17:37 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55IHb0Y092046; Sun, 5 Jun 2011 18:17:37 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201106051817.p55IHb0Y092046@svn.freebsd.org> From: Rick Macklem Date: Sun, 5 Jun 2011 18:17: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: r222719 - in head/sys/fs: nfs 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, 05 Jun 2011 18:17:38 -0000 Author: rmacklem Date: Sun Jun 5 18:17:37 2011 New Revision: 222719 URL: http://svn.freebsd.org/changeset/base/222719 Log: The new NFSv4 client was erroneously using "p" instead of "p_leader" for the "id" for POSIX byte range locking. I think this would only have affected processes created by rfork(2) with the RFTHREAD flag specified. This patch fixes that by passing the "id" down through the various functions from nfs_advlock(). MFC after: 2 weeks Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsclient/nfs_clstate.c head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Sun Jun 5 17:31:44 2011 (r222718) +++ head/sys/fs/nfs/nfs_var.h Sun Jun 5 18:17:37 2011 (r222719) @@ -401,10 +401,10 @@ int nfsrpc_readdirplus(vnode_t, struct u int nfsrpc_commit(vnode_t, u_quad_t, int, struct ucred *, NFSPROC_T *, u_char *, struct nfsvattr *, int *, void *); int nfsrpc_advlock(vnode_t, off_t, int, struct flock *, int, - struct ucred *, NFSPROC_T *); + struct ucred *, NFSPROC_T *, void *, int); int nfsrpc_lockt(struct nfsrv_descript *, vnode_t, struct nfsclclient *, u_int64_t, u_int64_t, struct flock *, - struct ucred *, NFSPROC_T *); + struct ucred *, NFSPROC_T *, void *, int); int nfsrpc_lock(struct nfsrv_descript *, struct nfsmount *, vnode_t, u_int8_t *, int, struct nfscllockowner *, int, int, u_int64_t, u_int64_t, short, struct ucred *, NFSPROC_T *, int); @@ -439,16 +439,16 @@ struct nfsclclient *nfscl_findcl(struct void nfscl_clientrelease(struct nfsclclient *); void nfscl_freelock(struct nfscllock *, int); int nfscl_getbytelock(vnode_t, u_int64_t, u_int64_t, short, - struct ucred *, NFSPROC_T *, struct nfsclclient *, int, u_int8_t *, - u_int8_t *, struct nfscllockowner **, int *, int *); + struct ucred *, NFSPROC_T *, struct nfsclclient *, int, void *, int, + u_int8_t *, u_int8_t *, struct nfscllockowner **, int *, int *); int nfscl_relbytelock(vnode_t, u_int64_t, u_int64_t, struct ucred *, NFSPROC_T *, int, struct nfsclclient *, - struct nfscllockowner **, int *); + void *, int, struct nfscllockowner **, int *); int nfscl_checkwritelocked(vnode_t, struct flock *, - struct ucred *, NFSPROC_T *); + struct ucred *, NFSPROC_T *, void *, int); void nfscl_lockrelease(struct nfscllockowner *, int, int); void nfscl_fillclid(u_int64_t, char *, u_int8_t *, u_int16_t); -void nfscl_filllockowner(NFSPROC_T *, u_int8_t *); +void nfscl_filllockowner(void *, u_int8_t *, int); void nfscl_freeopen(struct nfsclopen *, int); void nfscl_umount(struct nfsmount *, NFSPROC_T *); void nfscl_renewthread(struct nfsclclient *, NFSPROC_T *); @@ -466,9 +466,10 @@ void nfscl_lockexcl(struct nfsv4lock *, void nfscl_lockunlock(struct nfsv4lock *); void nfscl_lockderef(struct nfsv4lock *); void nfscl_docb(struct nfsrv_descript *, NFSPROC_T *); -void nfscl_releasealllocks(struct nfsclclient *, vnode_t, NFSPROC_T *); +void nfscl_releasealllocks(struct nfsclclient *, vnode_t, NFSPROC_T *, void *, + int); int nfscl_lockt(vnode_t, struct nfsclclient *, u_int64_t, - u_int64_t, struct flock *, NFSPROC_T *); + u_int64_t, struct flock *, NFSPROC_T *, void *, int); int nfscl_mustflush(vnode_t); int nfscl_nodeleg(vnode_t, int); int nfscl_removedeleg(vnode_t, NFSPROC_T *, nfsv4stateid_t *); Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Sun Jun 5 17:31:44 2011 (r222718) +++ head/sys/fs/nfsclient/nfs_clport.c Sun Jun 5 18:17:37 2011 (r222719) @@ -500,7 +500,7 @@ nfscl_fillclid(u_int64_t clval, char *uu * Fill in a lock owner name. For now, pid + the process's creation time. */ void -nfscl_filllockowner(struct thread *td, u_int8_t *cp) +nfscl_filllockowner(void *id, u_int8_t *cp, int flags) { union { u_int32_t lval; @@ -508,37 +508,32 @@ nfscl_filllockowner(struct thread *td, u } tl; struct proc *p; -if (td == NULL) { - printf("NULL td\n"); - bzero(cp, 12); - return; -} - p = td->td_proc; -if (p == NULL) { - printf("NULL pid\n"); - bzero(cp, 12); - return; -} - tl.lval = p->p_pid; - *cp++ = tl.cval[0]; - *cp++ = tl.cval[1]; - *cp++ = tl.cval[2]; - *cp++ = tl.cval[3]; -if (p->p_stats == NULL) { - printf("pstats null\n"); - bzero(cp, 8); - return; -} - tl.lval = p->p_stats->p_start.tv_sec; - *cp++ = tl.cval[0]; - *cp++ = tl.cval[1]; - *cp++ = tl.cval[2]; - *cp++ = tl.cval[3]; - tl.lval = p->p_stats->p_start.tv_usec; - *cp++ = tl.cval[0]; - *cp++ = tl.cval[1]; - *cp++ = tl.cval[2]; - *cp = tl.cval[3]; + if (id == NULL) { + printf("NULL id\n"); + bzero(cp, NFSV4CL_LOCKNAMELEN); + return; + } + if ((flags & F_POSIX) != 0) { + p = (struct proc *)id; + tl.lval = p->p_pid; + *cp++ = tl.cval[0]; + *cp++ = tl.cval[1]; + *cp++ = tl.cval[2]; + *cp++ = tl.cval[3]; + tl.lval = p->p_stats->p_start.tv_sec; + *cp++ = tl.cval[0]; + *cp++ = tl.cval[1]; + *cp++ = tl.cval[2]; + *cp++ = tl.cval[3]; + tl.lval = p->p_stats->p_start.tv_usec; + *cp++ = tl.cval[0]; + *cp++ = tl.cval[1]; + *cp++ = tl.cval[2]; + *cp = tl.cval[3]; + } else { + printf("nfscl_filllockowner: not F_POSIX\n"); + bzero(cp, NFSV4CL_LOCKNAMELEN); + } } /* Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Sun Jun 5 17:31:44 2011 (r222718) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Sun Jun 5 18:17:37 2011 (r222719) @@ -3459,7 +3459,7 @@ nfsmout: */ APPLESTATIC int nfsrpc_advlock(vnode_t vp, off_t size, int op, struct flock *fl, - int reclaim, struct ucred *cred, NFSPROC_T *p) + int reclaim, struct ucred *cred, NFSPROC_T *p, void *id, int flags) { struct nfscllockowner *lp; struct nfsclclient *clp; @@ -3511,11 +3511,11 @@ nfsrpc_advlock(vnode_t vp, off_t size, i error = nfscl_getcl(vp, cred, p, &clp); if (error) return (error); - error = nfscl_lockt(vp, clp, off, len, fl, p); + error = nfscl_lockt(vp, clp, off, len, fl, p, id, flags); if (!error) { clidrev = clp->nfsc_clientidrev; error = nfsrpc_lockt(nd, vp, clp, off, len, fl, cred, - p); + p, id, flags); } else if (error == -1) { error = 0; } @@ -3530,7 +3530,7 @@ nfsrpc_advlock(vnode_t vp, off_t size, i return (error); do { error = nfscl_relbytelock(vp, off, len, cred, p, callcnt, - clp, &lp, &dorpc); + clp, id, flags, &lp, &dorpc); /* * If it returns a NULL lp, we're done. */ @@ -3538,7 +3538,7 @@ nfsrpc_advlock(vnode_t vp, off_t size, i if (callcnt == 0) nfscl_clientrelease(clp); else - nfscl_releasealllocks(clp, vp, p); + nfscl_releasealllocks(clp, vp, p, id, flags); return (error); } if (nmp->nm_clp != NULL) @@ -3572,10 +3572,10 @@ nfsrpc_advlock(vnode_t vp, off_t size, i } callcnt++; } while (error == 0 && nd->nd_repstat == 0); - nfscl_releasealllocks(clp, vp, p); + nfscl_releasealllocks(clp, vp, p, id, flags); } else if (op == F_SETLK) { error = nfscl_getbytelock(vp, off, len, fl->l_type, cred, p, - NULL, 0, NULL, NULL, &lp, &newone, &donelocally); + NULL, 0, id, flags, NULL, NULL, &lp, &newone, &donelocally); if (error || donelocally) { return (error); } @@ -3625,7 +3625,7 @@ nfsrpc_advlock(vnode_t vp, off_t size, i APPLESTATIC int nfsrpc_lockt(struct nfsrv_descript *nd, vnode_t vp, struct nfsclclient *clp, u_int64_t off, u_int64_t len, struct flock *fl, - struct ucred *cred, NFSPROC_T *p) + struct ucred *cred, NFSPROC_T *p, void *id, int flags) { u_int32_t *tl; int error, type, size; @@ -3643,7 +3643,7 @@ nfsrpc_lockt(struct nfsrv_descript *nd, tl += 2; *tl++ = clp->nfsc_clientid.lval[0]; *tl = clp->nfsc_clientid.lval[1]; - nfscl_filllockowner(p, own); + nfscl_filllockowner(id, own, flags); (void) nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN); error = nfscl_request(nd, vp, p, cred, NULL); if (error) Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Sun Jun 5 17:31:44 2011 (r222718) +++ head/sys/fs/nfsclient/nfs_clstate.c Sun Jun 5 18:17:37 2011 (r222719) @@ -226,7 +226,7 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i * If none found, add the new one or return error, depending upon * "create". */ - nfscl_filllockowner(p, own); + nfscl_filllockowner(p->td_proc, own, F_POSIX); NFSLOCKCLSTATE(); dp = NULL; /* First check the delegation list */ @@ -521,7 +521,7 @@ nfscl_getstateid(vnode_t vp, u_int8_t *n * If p != NULL, we want to search the parentage tree * for a matching OpenOwner and use that. */ - nfscl_filllockowner(p, own); + nfscl_filllockowner(p->td_proc, own, F_POSIX); error = nfscl_getopen(&clp->nfsc_owner, nfhp, fhlen, NULL, p, mode, NULL, &op); if (error == 0) { @@ -596,7 +596,7 @@ nfscl_getopen(struct nfsclownerhead *ohp op = NULL; while (op == NULL && (nproc != NULL || rown != NULL)) { if (nproc != NULL) { - nfscl_filllockowner(nproc, own); + nfscl_filllockowner(nproc->td_proc, own, F_POSIX); ownp = own; } else { ownp = rown; @@ -881,7 +881,7 @@ nfscl_clientrelease(struct nfsclclient * APPLESTATIC int nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t len, short type, struct ucred *cred, NFSPROC_T *p, struct nfsclclient *rclp, - int recovery, u_int8_t *rownp, u_int8_t *ropenownp, + int recovery, void *id, int flags, u_int8_t *rownp, u_int8_t *ropenownp, struct nfscllockowner **lpp, int *newonep, int *donelocallyp) { struct nfscllockowner *lp; @@ -942,7 +942,7 @@ nfscl_getbytelock(vnode_t vp, u_int64_t if (recovery) { ownp = rownp; } else { - nfscl_filllockowner(p, own); + nfscl_filllockowner(id, own, flags); ownp = own; } if (!recovery) { @@ -1079,7 +1079,8 @@ nfscl_getbytelock(vnode_t vp, u_int64_t APPLESTATIC int nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t len, __unused struct ucred *cred, NFSPROC_T *p, int callcnt, - struct nfsclclient *clp, struct nfscllockowner **lpp, int *dorpcp) + struct nfsclclient *clp, void *id, int flags, + struct nfscllockowner **lpp, int *dorpcp) { struct nfscllockowner *lp; struct nfsclowner *owp; @@ -1116,7 +1117,7 @@ nfscl_relbytelock(vnode_t vp, u_int64_t sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK); *other_lop = *nlop; } - nfscl_filllockowner(p, own); + nfscl_filllockowner(id, own, flags); dp = NULL; NFSLOCKCLSTATE(); if (callcnt == 0) @@ -1188,7 +1189,8 @@ nfscl_relbytelock(vnode_t vp, u_int64_t * Release all lockowners marked in progess for this process and file. */ APPLESTATIC void -nfscl_releasealllocks(struct nfsclclient *clp, vnode_t vp, NFSPROC_T *p) +nfscl_releasealllocks(struct nfsclclient *clp, vnode_t vp, NFSPROC_T *p, + void *id, int flags) { struct nfsclowner *owp; struct nfsclopen *op; @@ -1197,7 +1199,7 @@ nfscl_releasealllocks(struct nfsclclient u_int8_t own[NFSV4CL_LOCKNAMELEN]; np = VTONFS(vp); - nfscl_filllockowner(p, own); + nfscl_filllockowner(id, own, flags); NFSLOCKCLSTATE(); LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { @@ -1226,7 +1228,7 @@ nfscl_releasealllocks(struct nfsclclient */ APPLESTATIC int nfscl_checkwritelocked(vnode_t vp, struct flock *fl, - struct ucred *cred, NFSPROC_T *p) + struct ucred *cred, NFSPROC_T *p, void *id, int flags) { struct nfsclowner *owp; struct nfscllockowner *lp; @@ -1266,7 +1268,7 @@ nfscl_checkwritelocked(vnode_t vp, struc error = nfscl_getcl(vp, cred, p, &clp); if (error) return (1); - nfscl_filllockowner(p, own); + nfscl_filllockowner(id, own, flags); NFSLOCKCLSTATE(); /* @@ -1641,7 +1643,7 @@ nfscl_cleanup(NFSPROC_T *p) if (!nfscl_inited) return; - nfscl_filllockowner(p, own); + nfscl_filllockowner(p->td_proc, own, F_POSIX); NFSLOCKCLSTATE(); /* @@ -3322,7 +3324,7 @@ nfscl_checkconflict(struct nfscllockowne */ APPLESTATIC int nfscl_lockt(vnode_t vp, struct nfsclclient *clp, u_int64_t off, - u_int64_t len, struct flock *fl, NFSPROC_T *p) + u_int64_t len, struct flock *fl, NFSPROC_T *p, void *id, int flags) { struct nfscllock *lop, nlck; struct nfscldeleg *dp; @@ -3340,7 +3342,7 @@ nfscl_lockt(vnode_t vp, struct nfsclclie return (NFSERR_INVAL); } np = VTONFS(vp); - nfscl_filllockowner(p, own); + nfscl_filllockowner(id, own, flags); NFSLOCKCLSTATE(); dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); error = nfscl_localconflict(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len, @@ -3615,7 +3617,7 @@ nfscl_relock(vnode_t vp, struct nfsclcli off = lop->nfslo_first; len = lop->nfslo_end - lop->nfslo_first; error = nfscl_getbytelock(vp, off, len, lop->nfslo_type, cred, p, - clp, 1, lp->nfsl_owner, lp->nfsl_openowner, &nlp, &newone, + clp, 1, NULL, 0, lp->nfsl_owner, lp->nfsl_openowner, &nlp, &newone, &donelocally); if (error || donelocally) return (error); Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Sun Jun 5 17:31:44 2011 (r222718) +++ head/sys/fs/nfsclient/nfs_clvnops.c Sun Jun 5 18:17:37 2011 (r222719) @@ -2898,7 +2898,8 @@ nfs_advlock(struct vop_advlock_args *ap) * RFC3530 Sec. 9.3.2. */ if (ap->a_op == F_UNLCK && - nfscl_checkwritelocked(vp, ap->a_fl, cred, td)) + nfscl_checkwritelocked(vp, ap->a_fl, cred, td, ap->a_id, + ap->a_flags)) (void) ncl_flush(vp, MNT_WAIT, cred, td, 1, 0); /* @@ -2907,7 +2908,7 @@ nfs_advlock(struct vop_advlock_args *ap) */ do { ret = nfsrpc_advlock(vp, np->n_size, ap->a_op, - ap->a_fl, 0, cred, td); + ap->a_fl, 0, cred, td, ap->a_id, ap->a_flags); if (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) && ap->a_op == F_SETLK) { VOP_UNLOCK(vp, 0); From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 19:15: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 D8EEA106566C; Sun, 5 Jun 2011 19:15:10 +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 173368FC15; Sun, 5 Jun 2011 19:15:08 +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 WAA09408; Sun, 05 Jun 2011 22:15:07 +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 1QTImx-000810-Am; Sun, 05 Jun 2011 22:15:07 +0300 Message-ID: <4DEBD5B9.9040908@FreeBSD.org> Date: Sun, 05 Jun 2011 22:15:05 +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: Martin Matuska References: <201106040702.p54726O6098336@svn.freebsd.org> <4DEA0785.3040707@FreeBSD.org> In-Reply-To: <4DEA0785.3040707@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: Sun, 05 Jun 2011 19:15:11 -0000 on 04/06/2011 13:23 Martin Matuska said the following: > If we are "fixing" this, I am not sure why you used the quotes here. I think that it's a real issue and I believe that this commit is a reasonable fix. > what about following pjd's rules and moving in > direction vendor code (reducing diff)? Or is it too expensive? Well, it seems that the code before the change was not compliant with the rules. I certainly like those rules, but maybe in this case they would be an overkill. > 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 >> -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 19:20: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 C707B1065672; Sun, 5 Jun 2011 19:20:39 +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 B697A8FC13; Sun, 5 Jun 2011 19:20: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 p55JKdro094066; Sun, 5 Jun 2011 19:20:39 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55JKd9b094064; Sun, 5 Jun 2011 19:20:39 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201106051920.p55JKd9b094064@svn.freebsd.org> From: Andriy Gapon Date: Sun, 5 Jun 2011 19:20: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: r222720 - 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, 05 Jun 2011 19:20:39 -0000 Author: avg Date: Sun Jun 5 19:20:39 2011 New Revision: 222720 URL: http://svn.freebsd.org/changeset/base/222720 Log: amdsbwd.4: fix spelling of my name Pointed out by: ru MFC after: 3 days Modified: head/share/man/man4/amdsbwd.4 Modified: head/share/man/man4/amdsbwd.4 ============================================================================== --- head/share/man/man4/amdsbwd.4 Sun Jun 5 18:17:37 2011 (r222719) +++ head/share/man/man4/amdsbwd.4 Sun Jun 5 19:20:39 2011 (r222720) @@ -67,6 +67,6 @@ driver first appeared in The .Nm driver was written by -.An Andiry Gapon Aq avg@FreeBSD.org . +.An Andriy Gapon Aq avg@FreeBSD.org . This manual page was written by -.An Andiry Gapon Aq avg@FreeBSD.org . +.An Andriy Gapon Aq avg@FreeBSD.org . From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 19:25: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 C7AF8106566B; Sun, 5 Jun 2011 19:25:30 +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 B73248FC18; Sun, 5 Jun 2011 19:25: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 p55JPUS9094248; Sun, 5 Jun 2011 19:25:30 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55JPUgC094246; Sun, 5 Jun 2011 19:25:30 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201106051925.p55JPUgC094246@svn.freebsd.org> From: Andriy Gapon Date: Sun, 5 Jun 2011 19:25: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: r222721 - 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, 05 Jun 2011 19:25:30 -0000 Author: avg Date: Sun Jun 5 19:25:30 2011 New Revision: 222721 URL: http://svn.freebsd.org/changeset/base/222721 Log: amdsbwd.4: fix history to reflect correct releases Pointed out by: ru MFC after: 4 days Modified: head/share/man/man4/amdsbwd.4 Modified: head/share/man/man4/amdsbwd.4 ============================================================================== --- head/share/man/man4/amdsbwd.4 Sun Jun 5 19:20:39 2011 (r222720) +++ head/share/man/man4/amdsbwd.4 Sun Jun 5 19:25:30 2011 (r222721) @@ -61,7 +61,9 @@ AMD SB600 and SB7xx south bridge chips. The .Nm driver first appeared in -.Fx 9.0 . +.Fx 7.3 +and +.Fx 8.1 . .Sh AUTHORS .An -nosplit The From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 20: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 9880A1065676; Sun, 5 Jun 2011 20:19:01 +0000 (UTC) (envelope-from andreast@fgznet.ch) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id 2DEBF8FC13; Sun, 5 Jun 2011 20:19:00 +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 p55JnW7D068670; Sun, 5 Jun 2011 21:49:33 +0200 (CEST) (envelope-from andreast@fgznet.ch) Message-ID: <4DEBDDCC.6090407@fgznet.ch> Date: Sun, 05 Jun 2011 21:49:32 +0200 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: Nathan Whitehorn References: <201106040322.p543MHXs091626@svn.freebsd.org> In-Reply-To: <201106040322.p543MHXs091626@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: 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: Sun, 05 Jun 2011 20:19:01 -0000 On 04.06.11 05:22, Nathan Whitehorn wrote: > 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. A big, big thank you!!! The core is working now! Next is fine tuning. ---- [bohrium:head/objdir/gdb] andreast% ./gdb -v GNU gdb (GDB) 7.3.50.20110605-cvs This GDB was configured as "powerpc64-unknown-freebsd9.0". ---- Andreas From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 20:22: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 B3567106564A; Sun, 5 Jun 2011 20:22:56 +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 A1A9E8FC0C; Sun, 5 Jun 2011 20:22: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 p55KMuvi096293; Sun, 5 Jun 2011 20:22:56 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55KMugI096290; Sun, 5 Jun 2011 20:22:56 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201106052022.p55KMugI096290@svn.freebsd.org> From: Rick Macklem Date: Sun, 5 Jun 2011 20:22: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: r222722 - 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: Sun, 05 Jun 2011 20:22:57 -0000 Author: rmacklem Date: Sun Jun 5 20:22:56 2011 New Revision: 222722 URL: http://svn.freebsd.org/changeset/base/222722 Log: Add support for flock(2) locks to the new NFSv4 client. I think this should be ok, since the client now delays NFSv4 Close operations until VOP_INACTIVE()/VOP_RECLAIM(). As such, there should be no risk that the NFSv4 Open is closed while an associated byte range lock still exists. Tested by: avg MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Sun Jun 5 19:25:30 2011 (r222721) +++ head/sys/fs/nfsclient/nfs_clport.c Sun Jun 5 20:22:56 2011 (r222722) @@ -530,8 +530,11 @@ nfscl_filllockowner(void *id, u_int8_t * *cp++ = tl.cval[1]; *cp++ = tl.cval[2]; *cp = tl.cval[3]; + } else if ((flags & F_FLOCK) != 0) { + bcopy(&id, cp, sizeof(id)); + bzero(&cp[sizeof(id)], NFSV4CL_LOCKNAMELEN - sizeof(id)); } else { - printf("nfscl_filllockowner: not F_POSIX\n"); + printf("nfscl_filllockowner: not F_POSIX or F_FLOCK\n"); bzero(cp, NFSV4CL_LOCKNAMELEN); } } Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Sun Jun 5 19:25:30 2011 (r222721) +++ head/sys/fs/nfsclient/nfs_clvnops.c Sun Jun 5 20:22:56 2011 (r222722) @@ -2884,8 +2884,11 @@ nfs_advlock(struct vop_advlock_args *ap) int ret, error = EOPNOTSUPP; u_quad_t size; - if (NFS_ISV4(vp) && (ap->a_flags & F_POSIX)) { - cred = p->p_ucred; + if (NFS_ISV4(vp) && (ap->a_flags & (F_POSIX | F_FLOCK)) != 0) { + if ((ap->a_flags & F_POSIX) != 0) + cred = p->p_ucred; + else + cred = td->td_ucred; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { VOP_UNLOCK(vp, 0); From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 21:01: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 0F11D106564A; Sun, 5 Jun 2011 21:01:42 +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 F1C688FC1B; Sun, 5 Jun 2011 21:01:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p55L1f12097422; Sun, 5 Jun 2011 21:01:41 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55L1feL097420; Sun, 5 Jun 2011 21:01:41 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201106052101.p55L1feL097420@svn.freebsd.org> From: Andriy Gapon Date: Sun, 5 Jun 2011 21:01: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: r222723 - 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: Sun, 05 Jun 2011 21:01:42 -0000 Author: avg Date: Sun Jun 5 21:01:41 2011 New Revision: 222723 URL: http://svn.freebsd.org/changeset/base/222723 Log: add SNDCTL_DSP_HALT specified by OSS This is really a new name for SNDCTL_DSP_RESET. PR: kern/156874 Submitted by: gerald MFC after: 1 week Modified: head/sys/sys/soundcard.h Modified: head/sys/sys/soundcard.h ============================================================================== --- head/sys/sys/soundcard.h Sun Jun 5 20:22:56 2011 (r222722) +++ head/sys/sys/soundcard.h Sun Jun 5 21:01:41 2011 (r222723) @@ -311,7 +311,8 @@ typedef struct _snd_capabilities { * IOCTL Commands for /dev/sequencer */ -#define SNDCTL_SEQ_RESET _IO ('Q', 0) +#define SNDCTL_SEQ_HALT _IO ('Q', 0) +#define SNDCTL_SEQ_RESET SNDCTL_SEQ_HALT /* Historic interface */ #define SNDCTL_SEQ_SYNC _IO ('Q', 1) #define SNDCTL_SYNTH_INFO _IOWR('Q', 2, struct synth_info) #define SNDCTL_SEQ_CTRLRATE _IOWR('Q', 3, int) /* Set/get timer res.(hz) */ From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 21:23: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 C625E106564A; Sun, 5 Jun 2011 21:23:28 +0000 (UTC) (envelope-from inyaoo@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 BF0598FC17; Sun, 5 Jun 2011 21:23:27 +0000 (UTC) Received: by wyf23 with SMTP id 23so3331686wyf.13 for ; Sun, 05 Jun 2011 14:23:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=Y0IHHGBkskSZXFyGZht0dFISXEfnH3TPVoiD6bjptJo=; b=L6dBMXXR9zu8yiyCeL4r5Zjlmm3/KC0E/RyvRFaoOOtH9R+7ZA+KDZ2w6tdTQJV1ZH aGXkt15k0HSa3sdky1z4NZdN4erFtUYC9Ws5/cVlGV4u36QEtyEke9wS5yLWkqepCC9h uJpAJSsoNxTS+7F4NMW7WWEqPNt9eg3BBDj1g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=HG07DXx9zjj1yoKeg7kQflUqLtftPvv57uVlQeOP+KCbaXOGvZ1rv17UUhoNDBhTWp u/wo0ohBef6zRnhUChWgvQHdaIGb8LF03aLwjwV27Rbi7tU71mG6AXA4rBkJZG34t+Jx B01QvXaR5XlqzHAofkXaipTAhDfKvXKFWSbgw= Received: by 10.227.201.142 with SMTP id fa14mr4225225wbb.48.1307309006401; Sun, 05 Jun 2011 14:23:26 -0700 (PDT) Received: from localhost (tor.efferia.fr [46.105.3.188]) by mx.google.com with ESMTPS id fl19sm569381wbb.49.2011.06.05.14.23.24 (version=SSLv3 cipher=OTHER); Sun, 05 Jun 2011 14:23:25 -0700 (PDT) From: Pan Tsu To: Andriy Gapon References: <201106052101.p55L1feL097420@svn.freebsd.org> Date: Mon, 06 Jun 2011 01:23:16 +0400 In-Reply-To: <201106052101.p55L1feL097420@svn.freebsd.org> (Andriy Gapon's message of "Sun, 5 Jun 2011 21:01:41 +0000 (UTC)") Message-ID: <86zklwezwb.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222723 - 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: Sun, 05 Jun 2011 21:23:28 -0000 Andriy Gapon writes: > Author: avg > Date: Sun Jun 5 21:01:41 2011 > New Revision: 222723 > URL: http://svn.freebsd.org/changeset/base/222723 > > Log: > add SNDCTL_DSP_HALT specified by OSS > > This is really a new name for SNDCTL_DSP_RESET. > > PR: kern/156874 > Submitted by: gerald > MFC after: 1 week > > Modified: > head/sys/sys/soundcard.h > > Modified: head/sys/sys/soundcard.h > ============================================================================== > --- head/sys/sys/soundcard.h Sun Jun 5 20:22:56 2011 (r222722) > +++ head/sys/sys/soundcard.h Sun Jun 5 21:01:41 2011 (r222723) > @@ -311,7 +311,8 @@ typedef struct _snd_capabilities { > * IOCTL Commands for /dev/sequencer > */ > > -#define SNDCTL_SEQ_RESET _IO ('Q', 0) > +#define SNDCTL_SEQ_HALT _IO ('Q', 0) > +#define SNDCTL_SEQ_RESET SNDCTL_SEQ_HALT /* Historic interface */ Apparently, the one for /dev/sequencer is too new to be documented. http://manuals.opensound.com/developer/SNDCTL_SEQ_HALT.html -> "Not found" > #define SNDCTL_SEQ_SYNC _IO ('Q', 1) > #define SNDCTL_SYNTH_INFO _IOWR('Q', 2, struct synth_info) > #define SNDCTL_SEQ_CTRLRATE _IOWR('Q', 3, int) /* Set/get timer res.(hz) */ From owner-svn-src-head@FreeBSD.ORG Sun Jun 5 22:36: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 02A94106566C; Sun, 5 Jun 2011 22:36:31 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E46C78FC15; Sun, 5 Jun 2011 22:36: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 p55MaUT4000379; Sun, 5 Jun 2011 22:36:30 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p55MaU2L000377; Sun, 5 Jun 2011 22:36:30 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201106052236.p55MaU2L000377@svn.freebsd.org> From: Kirk McKusick Date: Sun, 5 Jun 2011 22:36: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: r222724 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Jun 2011 22:36:31 -0000 Author: mckusick Date: Sun Jun 5 22:36:30 2011 New Revision: 222724 URL: http://svn.freebsd.org/changeset/base/222724 Log: Grammer fix in comment. Eliminate one (of several) possible conflicting buffer locks when trying to reclaim blocks. Rest of fix to be incorporated as part of SUJ update by jeff. Pointed out by: Kostik Belousov Modified: head/sys/ufs/ffs/ffs_alloc.c Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Sun Jun 5 21:01:41 2011 (r222723) +++ head/sys/ufs/ffs/ffs_alloc.c Sun Jun 5 22:36:30 2011 (r222724) @@ -420,13 +420,13 @@ nospace: */ if (reclaimed == 0) { reclaimed = 1; - softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); UFS_UNLOCK(ump); if (bp) { brelse(bp); bp = NULL; } UFS_LOCK(ump); + softdep_request_cleanup(fs, vp, cred, FLUSH_BLOCKS_WAIT); goto retry; } UFS_UNLOCK(ump); @@ -2356,8 +2356,8 @@ ffs_fserr(fs, inum, cp) * specified inode by the specified amount. Under normal * operation the count should always go down. Decrementing * the count to zero will cause the inode to be freed. - * adjblkcnt(inode, amt) - adjust the number of blocks used to - * by the specifed amount. + * adjblkcnt(inode, amt) - adjust the number of blocks used by the + * inode by the specified amount. * adjndir, adjbfree, adjifree, adjffree, adjnumclusters(amt) - * adjust the superblock summary. * freedirs(inode, count) - directory inodes [inode..inode + count - 1] From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 01:52: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 BFD34106564A; Mon, 6 Jun 2011 01:52:15 +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 98B478FC12; Mon, 6 Jun 2011 01:52: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 p561qF1p006331; Mon, 6 Jun 2011 01:52:15 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p561qF5M006329; Mon, 6 Jun 2011 01:52:15 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201106060152.p561qF5M006329@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 6 Jun 2011 01:52: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: r222726 - head/release/ia64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 01:52:15 -0000 Author: marcel Date: Mon Jun 6 01:52:15 2011 New Revision: 222726 URL: http://svn.freebsd.org/changeset/base/222726 Log: Fix ia64 ISO creation: o boot/mfsroot.gz is no more. Copy it only when it exists so as still to be compatible with Makefile.sysinstall. o while here, make ispfw.ko optional as well. o '-b bootimage' is not a valid argument for makefs. What was meant was '-o bootimage'. o create the boot image in the current directory so that makefs can find the file. Previously it had to be created under $BASE because that's how mkisofs wanted it. Modified: head/release/ia64/mkisoimages.sh Modified: head/release/ia64/mkisoimages.sh ============================================================================== --- head/release/ia64/mkisoimages.sh Mon Jun 6 01:18:53 2011 (r222725) +++ head/release/ia64/mkisoimages.sh Mon Jun 6 01:52:15 2011 (r222726) @@ -48,28 +48,32 @@ EFIPART=efipart.sys if [ $bootable = yes ]; then EFISZ=65536 MNT=/mnt - dd if=/dev/zero of=$BASE/$EFIPART count=$EFISZ - md=`mdconfig -a -t vnode -f $BASE/$EFIPART` + dd if=/dev/zero of=$EFIPART count=$EFISZ + md=`mdconfig -a -t vnode -f $EFIPART` newfs_msdos -F 12 -S 512 -h 4 -o 0 -s $EFISZ -u 16 $md mount -t msdosfs /dev/$md $MNT mkdir -p $MNT/efi/boot $MNT/boot $MNT/boot/kernel cp -R $BASE/boot/defaults $MNT/boot cp $BASE/boot/kernel/kernel $MNT/boot/kernel - cp $BASE/boot/kernel/ispfw.ko $MNT/boot/kernel + if [ -s $BASE/boot/kernel/ispfw.ko ]; then + cp $BASE/boot/kernel/ispfw.ko $MNT/boot/kernel + fi cp $BASE/boot/device.hints $MNT/boot cp $BASE/boot/loader.* $MNT/boot - cp $BASE/boot/mfsroot.gz $MNT/boot + if [ -s $BASE/boot/mfsroot.gz ]; then + cp $BASE/boot/mfsroot.gz $MNT/boot + fi cp $BASE/boot/support.4th $MNT/boot mv $MNT/boot/loader.efi $MNT/efi/boot/bootia64.efi umount $MNT mdconfig -d -u $md - BOOTOPTS="-b bootimage=i386;$EFIPART -o no-emul-boot" + BOOTOPTS="-o bootimage=i386;$EFIPART -o no-emul-boot" else BOOTOPTS="" fi echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab makefs -t cd9660 $BOOTOPTS -o rockridge -o label=$LABEL $NAME $BASE $* -rm -f $BASE/$EFIPART +rm -f $EFIPART rm $1/etc/fstab exit 0 From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 02:14: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 8D352106564A; Mon, 6 Jun 2011 02:14:23 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7DE578FC13; Mon, 6 Jun 2011 02:14: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 p562ENlY007050; Mon, 6 Jun 2011 02:14:23 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p562EN5G007040; Mon, 6 Jun 2011 02:14:23 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106060214.p562EN5G007040@svn.freebsd.org> From: Hiroki Sato Date: Mon, 6 Jun 2011 02:14: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: r222728 - in head: sbin/ifconfig sys/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, 06 Jun 2011 02:14:23 -0000 Author: hrs Date: Mon Jun 6 02:14:23 2011 New Revision: 222728 URL: http://svn.freebsd.org/changeset/base/222728 Log: - Accept Router Advertisement messages even when net.inet6.ip6.forwarding=1. - A new per-interface knob IFF_ND6_NO_RADR and sysctl IPV6CTL_NO_RADR. This controls if accepting a route in an RA message as the default route. The default value for each interface can be set by net.inet6.ip6.no_radr. The system wide default value is 0. - A new sysctl: net.inet6.ip6.norbit_raif. This controls if setting R-bit in NA on RA accepting interfaces. The default is 0 (R-bit is set based on net.inet6.ip6.forwarding). Background: IPv6 host/router model suggests a router sends an RA and a host accepts it for router discovery. Because of that, KAME implementation does not allow accepting RAs when net.inet6.ip6.forwarding=1. Accepting RAs on a router can make the routing table confused since it can change the default router unintentionally. However, in practice there are cases where we cannot distinguish a host from a router clearly. For example, a customer edge router often works as a host against the ISP, and as a router against the LAN at the same time. Another example is a complex network configurations like an L2TP tunnel for IPv6 connection to Internet over an Ethernet link with another native IPv6 subnet. In this case, the physical interface for the native IPv6 subnet works as a host, and the pseudo-interface for L2TP works as the default IP forwarding route. Problem: Disabling processing RA messages when net.inet6.ip6.forwarding=1 and accepting them when net.inet6.ip6.forward=0 cause the following practical issues: - A router cannot perform SLAAC. It becomes a problem if a box has multiple interfaces and you want to use SLAAC on some of them, for example. A customer edge router for IPv6 Internet access service using an IPv6-over-IPv6 tunnel sometimes needs SLAAC on the physical interface for administration purpose; updating firmware and so on (link-local addresses can be used there, but GUAs by SLAAC are often used for scalability). - When a host has multiple IPv6 interfaces and it receives multiple RAs on them, controlling the default route is difficult. Router preferences defined in RFC 4191 works only when the routers on the links are under your control. Details of Implementation Changes: Router Advertisement messages will be accepted even when net.inet6.ip6.forwarding=1. More precisely, the conditions are as follow: (ACCEPT_RTADV && !NO_RADR && !ip6.forwarding) => Normal RA processing on that interface. (as IPv6 host) (ACCEPT_RTADV && (NO_RADR || ip6.forwarding)) => Accept RA but add the router to the defroute list with rtlifetime=0 unconditionally. This effectively prevents from setting the received router address as the box's default route. (!ACCEPT_RTADV) => No RA processing on that interface. ACCEPT_RTADV and NO_RADR are per-interface knob. In short, all interface are classified as "RA-accepting" or not. An RA-accepting interface always processes RA messages regardless of ip6.forwarding. The difference caused by NO_RADR or ip6.forwarding is whether the RA source address is considered as the default router or not. R-bit in NA on the RA accepting interfaces is set based on net.inet6.ip6.forwarding. While RFC 6204 W-1 rule (for CPE case) suggests a router should disable the R-bit completely even when the box has net.inet6.ip6.forwarding=1, I believe there is no technical reason with doing so. This behavior can be set by a new sysctl net.inet6.ip6.norbit_raif (the default is 0). Usage: # ifconfig fxp0 inet6 accept_rtadv => accept RA on fxp0 # ifconfig fxp0 inet6 accept_rtadv no_radr => accept RA on fxp0 but ignore default route information in it. # sysctl net.inet6.ip6.norbit_no_radr=1 => R-bit in NAs on RA accepting interfaces will always be set to 0. Modified: head/sbin/ifconfig/af_inet6.c head/sbin/ifconfig/af_nd6.c head/sys/netinet6/in6.h head/sys/netinet6/in6_proto.c head/sys/netinet6/ip6_var.h head/sys/netinet6/nd6.c head/sys/netinet6/nd6.h head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c Modified: head/sbin/ifconfig/af_inet6.c ============================================================================== --- head/sbin/ifconfig/af_inet6.c Mon Jun 6 01:53:31 2011 (r222727) +++ head/sbin/ifconfig/af_inet6.c Mon Jun 6 02:14:23 2011 (r222728) @@ -499,6 +499,8 @@ static struct cmd inet6_cmds[] = { DEF_CMD("-autoconf", -IN6_IFF_AUTOCONF, setip6flags), DEF_CMD("accept_rtadv", ND6_IFF_ACCEPT_RTADV, setnd6flags), DEF_CMD("-accept_rtadv",-ND6_IFF_ACCEPT_RTADV, setnd6flags), + DEF_CMD("no_radr", ND6_IFF_NO_RADR, setnd6flags), + DEF_CMD("-no_radr", -ND6_IFF_NO_RADR, setnd6flags), DEF_CMD("defaultif", 1, setnd6defif), DEF_CMD("-defaultif", -1, setnd6defif), DEF_CMD("ifdisabled", ND6_IFF_IFDISABLED, setnd6flags), Modified: head/sbin/ifconfig/af_nd6.c ============================================================================== --- head/sbin/ifconfig/af_nd6.c Mon Jun 6 01:53:31 2011 (r222727) +++ head/sbin/ifconfig/af_nd6.c Mon Jun 6 02:14:23 2011 (r222728) @@ -58,7 +58,7 @@ static const char rcsid[] = #define MAX_SYSCTL_TRY 5 #define ND6BITS "\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \ "\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \ - "\020DEFAULTIF" + "\007NO_RADR\020DEFAULTIF" static int isnd6defif(int); void setnd6flags(const char *, int, int, const struct afswtch *); Modified: head/sys/netinet6/in6.h ============================================================================== --- head/sys/netinet6/in6.h Mon Jun 6 01:53:31 2011 (r222727) +++ head/sys/netinet6/in6.h Mon Jun 6 02:14:23 2011 (r222728) @@ -611,7 +611,10 @@ struct ip6_mtuinfo { #define IPV6CTL_STEALTH 45 #define ICMPV6CTL_ND6_ONLINKNSRFC4861 47 -#define IPV6CTL_MAXID 48 +#define IPV6CTL_NO_RADR 48 /* No defroute from RA */ +#define IPV6CTL_NORBIT_RAIF 49 /* Disable R-bit in NA on RA + * receiving IF. */ +#define IPV6CTL_MAXID 50 #endif /* __BSD_VISIBLE */ /* Modified: head/sys/netinet6/in6_proto.c ============================================================================== --- head/sys/netinet6/in6_proto.c Mon Jun 6 01:53:31 2011 (r222727) +++ head/sys/netinet6/in6_proto.c Mon Jun 6 02:14:23 2011 (r222728) @@ -409,6 +409,8 @@ VNET_DEFINE(int, ip6_sendredirects) = IP VNET_DEFINE(int, ip6_defhlim) = IPV6_DEFHLIM; VNET_DEFINE(int, ip6_defmcasthlim) = IPV6_DEFAULT_MULTICAST_HOPS; VNET_DEFINE(int, ip6_accept_rtadv) = 0; +VNET_DEFINE(int, ip6_no_radr) = 0; +VNET_DEFINE(int, ip6_norbit_raif) = 0; VNET_DEFINE(int, ip6_maxfragpackets); /* initialized in frag6.c:frag6_init() */ VNET_DEFINE(int, ip6_maxfrags); /* initialized in frag6.c:frag6_init() */ VNET_DEFINE(int, ip6_log_interval) = 5; @@ -537,6 +539,15 @@ SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_ CTLFLAG_RW, &VNET_NAME(ip6_accept_rtadv), 0, "Default value of per-interface flag for accepting ICMPv6 Router" "Advertisement messages"); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_NO_RADR, no_radr, + CTLFLAG_RW, &VNET_NAME(ip6_no_radr), 0, + "Default value of per-interface flag to control whether routers " + "sending ICMPv6 RA messages on that interface are added into the " + "default router list."); +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_NORBIT_RAIF, norbit_raif, CTLFLAG_RW, + &VNET_NAME(ip6_norbit_raif), 0, + "Always set 0 to R flag in ICMPv6 NA messages when accepting RA" + " on the interface."); SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_KEEPFAITH, keepfaith, CTLFLAG_RW, &VNET_NAME(ip6_keepfaith), 0, ""); SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_LOG_INTERVAL, log_interval, Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Mon Jun 6 01:53:31 2011 (r222727) +++ head/sys/netinet6/ip6_var.h Mon Jun 6 02:14:23 2011 (r222728) @@ -316,6 +316,9 @@ VNET_DECLARE(int, ip6_maxfragpackets); / VNET_DECLARE(int, ip6_maxfrags); /* Maximum fragments in reassembly * queue */ VNET_DECLARE(int, ip6_accept_rtadv); /* Acts as a host not a router */ +VNET_DECLARE(int, ip6_no_radr); /* No defroute from RA */ +VNET_DECLARE(int, ip6_norbit_raif); /* Disable R-bit in NA on RA + * receiving IF. */ VNET_DECLARE(int, ip6_keepfaith); /* Firewall Aided Internet Translator */ VNET_DECLARE(int, ip6_log_interval); VNET_DECLARE(time_t, ip6_log_time); @@ -327,6 +330,8 @@ VNET_DECLARE(int, ip6_dad_count); /* Dup #define V_ip6_maxfragpackets VNET(ip6_maxfragpackets) #define V_ip6_maxfrags VNET(ip6_maxfrags) #define V_ip6_accept_rtadv VNET(ip6_accept_rtadv) +#define V_ip6_no_radr VNET(ip6_no_radr) +#define V_ip6_norbit_raif VNET(ip6_norbit_raif) #define V_ip6_keepfaith VNET(ip6_keepfaith) #define V_ip6_log_interval VNET(ip6_log_interval) #define V_ip6_log_time VNET(ip6_log_time) Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon Jun 6 01:53:31 2011 (r222727) +++ head/sys/netinet6/nd6.c Mon Jun 6 02:14:23 2011 (r222728) @@ -193,6 +193,8 @@ nd6_ifattach(struct ifnet *ifp) /* A loopback interface does not need to accept RTADV. */ if (V_ip6_accept_rtadv && !(ifp->if_flags & IFF_LOOPBACK)) nd->flags |= ND6_IFF_ACCEPT_RTADV; + if (V_ip6_no_radr && !(ifp->if_flags & IFF_LOOPBACK)) + nd->flags |= ND6_IFF_NO_RADR; /* XXX: we cannot call nd6_setmtu since ifp is not fully initialized */ nd6_setmtu0(ifp, nd); @@ -825,7 +827,7 @@ nd6_purge(struct ifnet *ifp) if (V_nd6_defifindex == ifp->if_index) nd6_setdefaultiface(0); - if (!V_ip6_forwarding && ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) { + if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) { /* Refresh default router list. */ defrouter_select(); } @@ -958,10 +960,9 @@ nd6_is_new_addr_neighbor(struct sockaddr /* * If the default router list is empty, all addresses are regarded * as on-link, and thus, as a neighbor. - * XXX: we restrict the condition to hosts, because routers usually do - * not have the "default router list". */ - if (!V_ip6_forwarding && TAILQ_FIRST(&V_nd_defrouter) == NULL && + if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV && + TAILQ_FIRST(&V_nd_defrouter) == NULL && V_nd6_defifindex == ifp->if_index) { return (1); } @@ -1022,8 +1023,7 @@ nd6_free(struct llentry *ln, int gc) ifp = ln->lle_tbl->llt_ifp; - if (!V_ip6_forwarding) { - + if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) { dr = defrouter_lookup(&L3_ADDR_SIN6(ln)->sin6_addr, ifp); if (dr != NULL && dr->expire && @@ -1340,7 +1340,7 @@ nd6_ioctl(u_long cmd, caddr_t data, stru continue; ia = (struct in6_ifaddr *)ifa; if ((ia->ia6_flags & IN6_IFF_DUPLICATED) && - IN6_IS_ADDR_LINKLOCAL(&ia->ia_addr.sin6_addr)) { + IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) { duplicated_linklocal = 1; break; } @@ -1718,7 +1718,7 @@ nd6_cache_lladdr(struct ifnet *ifp, stru * for those are not autoconfigured hosts, we explicitly avoid such * cases for safety. */ - if (do_update && router && !V_ip6_forwarding && + if (do_update && router && ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) { /* * guaranteed recursion Modified: head/sys/netinet6/nd6.h ============================================================================== --- head/sys/netinet6/nd6.h Mon Jun 6 01:53:31 2011 (r222727) +++ head/sys/netinet6/nd6.h Mon Jun 6 02:14:23 2011 (r222728) @@ -85,6 +85,7 @@ struct nd_ifinfo { */ #define ND6_IFF_DONT_SET_IFROUTE 0x10 #define ND6_IFF_AUTO_LINKLOCAL 0x20 +#define ND6_IFF_NO_RADR 0x40 #define ND6_CREATE LLE_CREATE #define ND6_EXCLUSIVE LLE_EXCLUSIVE Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Mon Jun 6 01:53:31 2011 (r222727) +++ head/sys/netinet6/nd6_nbr.c Mon Jun 6 02:14:23 2011 (r222728) @@ -112,10 +112,14 @@ nd6_ns_input(struct mbuf *m, int off, in int lladdrlen = 0; int anycast = 0, proxy = 0, tentative = 0; int tlladdr; + int rflag; union nd_opts ndopts; struct sockaddr_dl proxydl; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; + rflag = (V_ip6_forwarding) ? ND_NA_FLAG_ROUTER : 0; + if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV && V_ip6_norbit_raif) + rflag = 0; #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, icmp6len,); nd_ns = (struct nd_neighbor_solicit *)((caddr_t)ip6 + off); @@ -339,8 +343,7 @@ nd6_ns_input(struct mbuf *m, int off, in goto bad; nd6_na_output(ifp, &in6_all, &taddr6, ((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) | - (V_ip6_forwarding ? ND_NA_FLAG_ROUTER : 0), - tlladdr, proxy ? (struct sockaddr *)&proxydl : NULL); + rflag, tlladdr, proxy ? (struct sockaddr *)&proxydl : NULL); goto freeit; } @@ -349,8 +352,8 @@ nd6_ns_input(struct mbuf *m, int off, in nd6_na_output(ifp, &saddr6, &taddr6, ((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) | - (V_ip6_forwarding ? ND_NA_FLAG_ROUTER : 0) | ND_NA_FLAG_SOLICITED, - tlladdr, proxy ? (struct sockaddr *)&proxydl : NULL); + rflag | ND_NA_FLAG_SOLICITED, tlladdr, + proxy ? (struct sockaddr *)&proxydl : NULL); freeit: if (ifa != NULL) ifa_free(ifa); @@ -862,7 +865,8 @@ nd6_na_input(struct mbuf *m, int off, in dr = defrouter_lookup(in6, ln->lle_tbl->llt_ifp); if (dr) defrtrlist_del(dr); - else if (!V_ip6_forwarding) { + else if (ND_IFINFO(ln->lle_tbl->llt_ifp)->flags & + ND6_IFF_ACCEPT_RTADV) { /* * Even if the neighbor is not in the default * router list, the neighbor may be used Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Mon Jun 6 01:53:31 2011 (r222727) +++ head/sys/netinet6/nd6_rtr.c Mon Jun 6 02:14:23 2011 (r222728) @@ -127,8 +127,11 @@ nd6_rs_input(struct mbuf *m, int off, in union nd_opts ndopts; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; - /* If I'm not a router, ignore it. */ - if (!V_ip6_forwarding) + /* + * Accept RS only when V_ip6_forwarding=1 and the interface has + * no ND6_IFF_ACCEPT_RTADV. + */ + if (!V_ip6_forwarding || ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) goto freeit; /* Sanity checks */ @@ -213,11 +216,10 @@ nd6_ra_input(struct mbuf *m, int off, in char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; /* - * We only accept RAs only when - * the node is not a router and - * per-interface variable allows RAs on the receiving interface. + * We only accept RAs only when the per-interface flag + * ND6_IFF_ACCEPT_RTADV is on the receiving interface. */ - if (V_ip6_forwarding || !(ndi->flags & ND6_IFF_ACCEPT_RTADV)) + if (!(ndi->flags & ND6_IFF_ACCEPT_RTADV)) goto freeit; if (ip6->ip6_hlim != 255) { @@ -266,7 +268,15 @@ nd6_ra_input(struct mbuf *m, int off, in bzero(&dr0, sizeof(dr0)); dr0.rtaddr = saddr6; dr0.flags = nd_ra->nd_ra_flags_reserved; - dr0.rtlifetime = ntohs(nd_ra->nd_ra_router_lifetime); + /* + * Effectively-disable the route in the RA packet + * when ND6_IFF_NO_RADR on the receiving interface or + * ip6.forwarding=1. + */ + if (ndi->flags & ND6_IFF_NO_RADR || V_ip6_forwarding) + dr0.rtlifetime = 0; + else + dr0.rtlifetime = ntohs(nd_ra->nd_ra_router_lifetime); dr0.expire = time_second + dr0.rtlifetime; dr0.ifp = ifp; /* unspecified or not? (RFC 2461 6.3.4) */ @@ -557,7 +567,7 @@ defrtrlist_del(struct nd_defrouter *dr) * Flush all the routing table entries that use the router * as a next hop. */ - if (!V_ip6_forwarding) + if (ND_IFINFO(dr->ifp)->flags & ND6_IFF_ACCEPT_RTADV) rt6_flush(&dr->rtaddr, dr->ifp); if (dr->installed) { @@ -616,20 +626,6 @@ defrouter_select(void) struct llentry *ln = NULL; /* - * This function should be called only when acting as an autoconfigured - * host. Although the remaining part of this function is not effective - * if the node is not an autoconfigured host, we explicitly exclude - * such cases here for safety. - */ - if (V_ip6_forwarding) { - nd6log((LOG_WARNING, - "defrouter_select: called unexpectedly (forwarding=%d)\n", - V_ip6_forwarding)); - splx(s); - return; - } - - /* * Let's handle easy case (3) first: * If default router list is empty, there's nothing to be done. */ From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 02:37: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 7F9C1106564A; Mon, 6 Jun 2011 02:37:39 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F3298FC08; Mon, 6 Jun 2011 02:37: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 p562bdAf007773; Mon, 6 Jun 2011 02:37:39 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p562bduR007770; Mon, 6 Jun 2011 02:37:39 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106060237.p562bduR007770@svn.freebsd.org> From: Hiroki Sato Date: Mon, 6 Jun 2011 02:37: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: r222730 - head/sys/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, 06 Jun 2011 02:37:39 -0000 Author: hrs Date: Mon Jun 6 02:37:38 2011 New Revision: 222730 URL: http://svn.freebsd.org/changeset/base/222730 Log: - Make the code more proactively clear an ND6_IFF_IFDISABLED flag when an explicit action for INET6 configuration happens. The changes are: 1. When an ND6 flag is changed via SIOCSIFINFO_FLAGS ioctl, setting ND6_IFF_ACCEPT_RTADV and/or ND6_IFF_AUTO_LINKLOCAL now triggers an attempt to clear the ND6_IFF_IFDISABLED flag. 2. When an AF_INET6 address is added successfully to an interface and it is marked as ND6_IFF_IFDISABLED, an attempt to clear the ND6_IFF_IFDISABLED happens. This simplifies ND6_IFF_IFDISABLED flag manipulation by users via ifconfig(8); in most cases manual configuration is no longer needed. - When ND6_IFF_AUTO_LINKLOCAL is set and no link-local address is assigned to an interface, SIOCSIFINFO_FLAGS ioctl now calls in6_ifattach() to configure a link-local address. This change ensures link-local address configuration when "ifconfig IF inet6" command is invoked. For example, "ifconfig IF inet6 auto_linklocal" now always try to configure an LL addr even if ND6_IFF_AUTO_LINKLOCAL is already set to 1 (i.e. down/up cycle is no longer needed). Reviewed by: bz Modified: head/sys/netinet6/in6.c head/sys/netinet6/nd6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Mon Jun 6 02:25:53 2011 (r222729) +++ head/sys/netinet6/in6.c Mon Jun 6 02:37:38 2011 (r222730) @@ -652,8 +652,32 @@ in6_control(struct socket *so, u_long cm * that is, this address might make other addresses detached. */ pfxlist_onlink_check(); - if (error == 0 && ia) + if (error == 0 && ia) { + if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) { + /* + * Try to clear the flag when a new + * IPv6 address is added onto an + * IFDISABLED interface and it + * succeeds. + */ + struct in6_ndireq nd; + + memset(&nd, 0, sizeof(nd)); + nd.ndi.flags = ND_IFINFO(ifp)->flags; + nd.ndi.flags &= ~ND6_IFF_IFDISABLED; + if (nd6_ioctl(SIOCSIFINFO_FLAGS, + (caddr_t)&nd, ifp) < 0) + log(LOG_NOTICE, "SIOCAIFADDR_IN6: " + "SIOCSIFINFO_FLAGS for -ifdisabled " + "failed."); + /* + * Ignore failure of clearing the flag + * intentionally. The failure means + * address duplication was detected. + */ + } EVENTHANDLER_INVOKE(ifaddr_event, ifp); + } break; } Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon Jun 6 02:25:53 2011 (r222729) +++ head/sys/netinet6/nd6.c Mon Jun 6 02:37:38 2011 (r222730) @@ -1322,6 +1322,15 @@ nd6_ioctl(u_long cmd, caddr_t data, stru struct ifaddr *ifa; struct in6_ifaddr *ia; + /* + * Try to clear ifdisabled flag when enabling + * accept_rtadv or auto_linklocal. + */ + if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && + (ND.flags & (ND6_IFF_ACCEPT_RTADV | + ND6_IFF_AUTO_LINKLOCAL))) + ND.flags &= ~ND6_IFF_IFDISABLED; + if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && !(ND.flags & ND6_IFF_IFDISABLED)) { /* ifdisabled 1->0 transision */ @@ -1379,6 +1388,27 @@ nd6_ioctl(u_long cmd, caddr_t data, stru /* If no link-local address on ifp, configure */ ND_IFINFO(ifp)->flags |= ND6_IFF_AUTO_LINKLOCAL; in6_ifattach(ifp, NULL); + } else if (ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) { + /* + * When the IF already has + * ND6_IFF_AUTO_LINKLOCAL and no link-local + * address is assigned, try to assign one. + */ + int haslinklocal = 0; + + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + ia = (struct in6_ifaddr *)ifa; + if (IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) { + haslinklocal = 1; + break; + } + } + IF_ADDR_UNLOCK(ifp); + if (!haslinklocal) + in6_ifattach(ifp, NULL); } } ND_IFINFO(ifp)->flags = ND.flags; From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 03:06: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 9448A1065670; Mon, 6 Jun 2011 03:06:43 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 849448FC19; Mon, 6 Jun 2011 03:06: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 p5636hT7008907; Mon, 6 Jun 2011 03:06:43 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5636hR5008901; Mon, 6 Jun 2011 03:06:43 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106060306.p5636hR5008901@svn.freebsd.org> From: Hiroki Sato Date: Mon, 6 Jun 2011 03:06: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: r222732 - in head: sys/netinet usr.sbin/rtadvd usr.sbin/rtsold X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 03:06:43 -0000 Author: hrs Date: Mon Jun 6 03:06:43 2011 New Revision: 222732 URL: http://svn.freebsd.org/changeset/base/222732 Log: - Implement RDNSS and DNSSL options (RFC 6106, IPv6 Router Advertisement Options for DNS Configuration) into rtadvd(8) and rtsold(8). DNS information received by rtsold(8) will go to resolv.conf(5) by resolvconf(8) script. This is based on work by J.R. Oldroyd (kern/156259) but revised extensively[1]. - rtadvd(8) now supports "noifprefix" to disable gathering on-link prefixes from interfaces when no "addr" is specified[2]. An entry in rtadvd.conf with "noifprefix" + no "addr" generates an RA message with no prefix information option. - rtadvd(8) now supports RTM_IFANNOUNCE message to fix crashes when an interface is added or removed. - Correct bogus ND_OPT_ROUTE_INFO value to one in RFC 4191. Reviewed by: bz[1] PR: kern/156259 [1] PR: bin/152458 [2] Modified: head/sys/netinet/icmp6.h head/usr.sbin/rtadvd/Makefile head/usr.sbin/rtadvd/advcap.c head/usr.sbin/rtadvd/config.c head/usr.sbin/rtadvd/config.h head/usr.sbin/rtadvd/dump.c head/usr.sbin/rtadvd/dump.h head/usr.sbin/rtadvd/if.c head/usr.sbin/rtadvd/if.h head/usr.sbin/rtadvd/pathnames.h head/usr.sbin/rtadvd/rrenum.c head/usr.sbin/rtadvd/rrenum.h head/usr.sbin/rtadvd/rtadvd.8 head/usr.sbin/rtadvd/rtadvd.c head/usr.sbin/rtadvd/rtadvd.conf head/usr.sbin/rtadvd/rtadvd.conf.5 head/usr.sbin/rtadvd/rtadvd.h head/usr.sbin/rtadvd/timer.c head/usr.sbin/rtadvd/timer.h head/usr.sbin/rtsold/Makefile head/usr.sbin/rtsold/dump.c head/usr.sbin/rtsold/if.c head/usr.sbin/rtsold/probe.c head/usr.sbin/rtsold/rtsock.c head/usr.sbin/rtsold/rtsol.c head/usr.sbin/rtsold/rtsold.8 head/usr.sbin/rtsold/rtsold.c head/usr.sbin/rtsold/rtsold.h Modified: head/sys/netinet/icmp6.h ============================================================================== --- head/sys/netinet/icmp6.h Mon Jun 6 02:46:22 2011 (r222731) +++ head/sys/netinet/icmp6.h Mon Jun 6 03:06:43 2011 (r222732) @@ -297,8 +297,9 @@ struct nd_opt_hdr { /* Neighbor discove #define ND_OPT_PREFIX_INFORMATION 3 #define ND_OPT_REDIRECTED_HEADER 4 #define ND_OPT_MTU 5 - -#define ND_OPT_ROUTE_INFO 200 /* draft-ietf-ipngwg-router-preference, not officially assigned yet */ +#define ND_OPT_ROUTE_INFO 24 /* RFC 4191 */ +#define ND_OPT_RDNSS 25 /* RFC 6016 */ +#define ND_OPT_DNSSL 31 /* RFC 6016 */ struct nd_opt_prefix_info { /* prefix information */ u_int8_t nd_opt_pi_type; @@ -338,6 +339,22 @@ struct nd_opt_route_info { /* route info /* prefix follows */ } __packed; +struct nd_opt_rdnss { /* RDNSS option (RFC 6106) */ + u_int8_t nd_opt_rdnss_type; + u_int8_t nd_opt_rdnss_len; + u_int16_t nd_opt_rdnss_reserved; + u_int32_t nd_opt_rdnss_lifetime; + /* followed by list of recursive DNS servers */ +} __packed; + +struct nd_opt_dnssl { /* DNSSL option (RFC 6106) */ + u_int8_t nd_opt_dnssl_type; + u_int8_t nd_opt_dnssl_len; + u_int16_t nd_opt_dnssl_reserved; + u_int32_t nd_opt_dnssl_lifetime; + /* followed by list of DNS search domains */ +} __packed; + /* * icmp6 namelookup */ Modified: head/usr.sbin/rtadvd/Makefile ============================================================================== --- head/usr.sbin/rtadvd/Makefile Mon Jun 6 02:46:22 2011 (r222731) +++ head/usr.sbin/rtadvd/Makefile Mon Jun 6 03:06:43 2011 (r222732) @@ -23,6 +23,6 @@ LDADD= -lutil CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DROUTEINFO -WARNS?= 1 +WARNS?= 6 .include Modified: head/usr.sbin/rtadvd/advcap.c ============================================================================== --- head/usr.sbin/rtadvd/advcap.c Mon Jun 6 02:46:22 2011 (r222731) +++ head/usr.sbin/rtadvd/advcap.c Mon Jun 6 03:06:43 2011 (r222732) @@ -64,8 +64,6 @@ #define V_TERM "HOST" #endif -char *RM; - /* * termcap - routines for dealing with the terminal capability data base * @@ -83,12 +81,11 @@ char *RM; static char *tbuf; static int hopcount; /* detect infinite loops in termcap, init 0 */ -static char *remotefile; - -extern char *conffile; +static const char *remotefile; +extern const char *conffile; int tgetent(char *, char *); -int getent(char *, char *, char *); +int getent(char *, char *, const char *); int tnchktc(void); int tnamatch(char *); static char *tskip(char *); @@ -103,22 +100,18 @@ static char *tdecode(char *, char **); * we just notice escaped newlines. */ int -tgetent(bp, name) - char *bp, *name; +tgetent(char *bp, char *name) { - char *cp; - - remotefile = cp = conffile ? conffile : _PATH_RTADVDCONF; - return (getent(bp, name, cp)); + return (getent(bp, name, conffile)); } int -getent(bp, name, cp) - char *bp, *name, *cp; +getent(char *bp, char *name, const char *cfile) { int c; int i = 0, cnt = 0; char ibuf[BUFSIZ]; + char *cp; int tf; tbuf = bp; @@ -130,9 +123,9 @@ getent(bp, name, cp) * use so we don't have to read the file. In this case it * has to already have the newlines crunched out. */ - if (cp && *cp) { - tf = open(RM = cp, O_RDONLY); - } + if (cfile && *cfile) + tf = open(cfile, O_RDONLY); + if (tf < 0) { syslog(LOG_INFO, "<%s> open: %s", __func__, strerror(errno)); @@ -184,7 +177,7 @@ getent(bp, name, cp) * Note that this works because of the left to right scan. */ int -tnchktc() +tnchktc(void) { char *p, *q; char tcname[16]; /* name of similar terminal */ @@ -233,8 +226,7 @@ tnchktc() * name (before the first field) stops us. */ int -tnamatch(np) - char *np; +tnamatch(char *np) { char *Np, *Bp; @@ -260,8 +252,7 @@ tnamatch(np) * into the termcap file in octal. */ static char * -tskip(bp) - char *bp; +tskip(char *bp) { int dquote; @@ -305,8 +296,7 @@ breakbreak: * Note that we handle octal numbers beginning with 0. */ int64_t -tgetnum(id) - char *id; +tgetnum(char *id) { int64_t i; int base; @@ -341,8 +331,7 @@ tgetnum(id) * not given. */ int -tgetflag(id) - char *id; +tgetflag(char *id) { char *bp = tbuf; @@ -369,8 +358,7 @@ tgetflag(id) * No checking on area overflow. */ char * -tgetstr(id, area) - char *id, **area; +tgetstr(char *id, char **area) { char *bp = tbuf; @@ -395,13 +383,11 @@ tgetstr(id, area) * string capability escapes. */ static char * -tdecode(str, area) - char *str; - char **area; +tdecode(char *str, char **area) { char *cp; int c; - char *dp; + const char *dp; int i; char term; Modified: head/usr.sbin/rtadvd/config.c ============================================================================== --- head/usr.sbin/rtadvd/config.c Mon Jun 6 02:46:22 2011 (r222731) +++ head/usr.sbin/rtadvd/config.c Mon Jun 6 03:06:43 2011 (r222732) @@ -4,7 +4,7 @@ /* * Copyright (C) 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -53,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -65,29 +65,55 @@ #include "if.h" #include "config.h" +/* label of tcapcode + number + domain name + zero octet */ +static char entbuf[10 + 3 + NI_MAXHOST + 1]; +static char oentbuf[10 + 3 + NI_MAXHOST + 1]; +static char abuf[DNAME_LABELENC_MAXLEN]; + static time_t prefix_timo = (60 * 120); /* 2 hours. * XXX: should be configurable. */ -extern struct rainfo *ralist; static struct rtadvd_timer *prefix_timeout(void *); -static void makeentry(char *, size_t, int, char *); -static int getinet6sysctl(int); +static void makeentry(char *, size_t, int, const char *); +static size_t dname_labelenc(char *, const char *); -void -getconfig(intface) - char *intface; +/* Encode domain name label encoding in RFC 1035 Section 3.1 */ +static size_t +dname_labelenc(char *dst, const char *src) { - int stat, i; - char tbuf[BUFSIZ]; - struct rainfo *tmp; - long val; - int64_t val64; - char buf[BUFSIZ]; - char *bp = buf; - char *addr, *flagstr; - static int forwarding = -1; + char *dst_origin; + char *p; + size_t len; -#define MUSTHAVE(var, cap) \ + dst_origin = dst; + len = strlen(src); + + /* Length fields per 63 octets + '\0' (<= DNAME_LABELENC_MAXLEN) */ + memset(dst, 0, len + len / 64 + 1 + 1); + + syslog(LOG_DEBUG, "<%s> labelenc = %s", __func__, src); + while (src && (len = strlen(src)) != 0) { + /* Put a length field with 63 octet limitation first. */ + p = strchr(src, '.'); + if (p == NULL) + *dst++ = len = MIN(63, len); + else + *dst++ = len = MIN(63, p - src); + /* Copy 63 octets at most. */ + memcpy(dst, src, len); + dst += len; + if (p == NULL) /* the last label */ + break; + src = p + 1; + } + /* Always need a 0-length label at the tail. */ + *dst++ = '\0'; + + syslog(LOG_DEBUG, "<%s> labellen = %d", __func__, dst - dst_origin); + return (dst - dst_origin); +} + +#define MUSTHAVE(var, cap) \ do { \ int64_t t; \ if ((t = agetnum(cap)) < 0) { \ @@ -97,60 +123,158 @@ getconfig(intface) } \ var = t; \ } while (0) -#define MAYHAVE(var, cap, def) \ + +#define MAYHAVE(var, cap, def) \ do { \ if ((var = agetnum(cap)) < 0) \ var = def; \ } while (0) +#define ELM_MALLOC(p,error_action) \ + do { \ + p = malloc(sizeof(*p)); \ + if (p == NULL) { \ + syslog(LOG_ERR, "<%s> malloc failed: %s", \ + __func__, strerror(errno)); \ + error_action; \ + } \ + memset(p, 0, sizeof(*p)); \ + } while(0) + +int +rmconfig(int idx) +{ + struct rainfo *rai; + struct prefix *pfx; + struct soliciter *sol; + struct rdnss *rdn; + struct rdnss_addr *rdna; + struct dnssl *dns; + struct rtinfo *rti; + + rai = if_indextorainfo(idx); + if (rai == NULL) { + syslog(LOG_ERR, "<%s>: rainfo not found (idx=%d)", + __func__, idx); + return (-1); + } + + TAILQ_REMOVE(&railist, rai, rai_next); + syslog(LOG_DEBUG, "<%s>: rainfo (idx=%d) removed.", + __func__, idx); + + /* Free all of allocated memories for this entry. */ + rtadvd_remove_timer(rai->rai_timer); + + if (rai->rai_ra_data != NULL) + free(rai->rai_ra_data); + + if (rai->rai_sdl != NULL) + free(rai->rai_sdl); + + while ((pfx = TAILQ_FIRST(&rai->rai_prefix)) != NULL) { + TAILQ_REMOVE(&rai->rai_prefix, pfx, pfx_next); + free(pfx); + } + while ((sol = TAILQ_FIRST(&rai->rai_soliciter)) != NULL) { + TAILQ_REMOVE(&rai->rai_soliciter, sol, sol_next); + free(sol); + } + while ((rdn = TAILQ_FIRST(&rai->rai_rdnss)) != NULL) { + TAILQ_REMOVE(&rai->rai_rdnss, rdn, rd_next); + while ((rdna = TAILQ_FIRST(&rdn->rd_list)) != NULL) { + TAILQ_REMOVE(&rdn->rd_list, rdna, ra_next); + free(rdna); + } + free(rdn); + } + while ((dns = TAILQ_FIRST(&rai->rai_dnssl)) != NULL) { + TAILQ_REMOVE(&rai->rai_dnssl, dns, dn_next); + free(dns); + } + while ((rti = TAILQ_FIRST(&rai->rai_route)) != NULL) { + TAILQ_REMOVE(&rai->rai_route, rti, rti_next); + free(rti); + } + free(rai); + + return (0); +} + +int +getconfig(int idx) +{ + int stat, i; + char tbuf[BUFSIZ]; + struct rainfo *rai; + long val; + int64_t val64; + char buf[BUFSIZ]; + char *bp = buf; + char *addr, *flagstr; + char intface[IFNAMSIZ]; + + if (if_indextoname(idx, intface) == NULL) { + syslog(LOG_ERR, "<%s> invalid index number (%d)", + __func__, idx); + return (-1); + } + if ((stat = agetent(tbuf, intface)) <= 0) { memset(tbuf, 0, sizeof(tbuf)); syslog(LOG_INFO, - "<%s> %s isn't defined in the configuration file" - " or the configuration file doesn't exist." - " Treat it as default", - __func__, intface); + "<%s> %s isn't defined in the configuration file" + " or the configuration file doesn't exist." + " Treat it as default", + __func__, intface); } - tmp = (struct rainfo *)malloc(sizeof(*ralist)); - if (tmp == NULL) { + rai = malloc(sizeof(*rai)); + if (rai == NULL) { syslog(LOG_INFO, "<%s> %s: can't allocate enough memory", __func__, intface); exit(1); } - memset(tmp, 0, sizeof(*tmp)); - tmp->prefix.next = tmp->prefix.prev = &tmp->prefix; + memset(rai, 0, sizeof(*rai)); + TAILQ_INIT(&rai->rai_prefix); #ifdef ROUTEINFO - tmp->route.next = tmp->route.prev = &tmp->route; + TAILQ_INIT(&rai->rai_route); #endif - - /* check if we are allowed to forward packets (if not determined) */ - if (forwarding < 0) { - if ((forwarding = getinet6sysctl(IPV6CTL_FORWARDING)) < 0) - exit(1); - } + TAILQ_INIT(&rai->rai_rdnss); + TAILQ_INIT(&rai->rai_dnssl); + TAILQ_INIT(&rai->rai_soliciter); + + /* gather on-link prefixes from the network interfaces. */ + if (agetflag("noifprefix")) + rai->rai_advifprefix = 0; + else + rai->rai_advifprefix = 1; /* get interface information */ if (agetflag("nolladdr")) - tmp->advlinkopt = 0; + rai->rai_advlinkopt = 0; else - tmp->advlinkopt = 1; - if (tmp->advlinkopt) { - if ((tmp->sdl = if_nametosdl(intface)) == NULL) { + rai->rai_advlinkopt = 1; + if (rai->rai_advlinkopt) { + if ((rai->rai_sdl = if_nametosdl(intface)) == NULL) { syslog(LOG_ERR, - "<%s> can't get information of %s", - __func__, intface); - exit(1); + "<%s> can't get information of %s", + __func__, intface); + return (-1); } - tmp->ifindex = tmp->sdl->sdl_index; + rai->rai_ifindex = rai->rai_sdl->sdl_index; } else - tmp->ifindex = if_nametoindex(intface); - strncpy(tmp->ifname, intface, sizeof(tmp->ifname)); - if ((tmp->phymtu = if_getmtu(intface)) == 0) { - tmp->phymtu = IPV6_MMTU; + rai->rai_ifindex = if_nametoindex(intface); + strncpy(rai->rai_ifname, intface, sizeof(rai->rai_ifname)); + syslog(LOG_DEBUG, + "<%s> ifindex = %d on %s", __func__, rai->rai_ifindex, + rai->rai_ifname); + + if ((rai->rai_phymtu = if_getmtu(intface)) == 0) { + rai->rai_phymtu = IPV6_MMTU; syslog(LOG_WARNING, - "<%s> can't get interface mtu of %s. Treat as %d", - __func__, intface, IPV6_MMTU); + "<%s> can't get interface mtu of %s. Treat as %d", + __func__, intface, IPV6_MMTU); } /* @@ -159,25 +283,27 @@ getconfig(intface) MAYHAVE(val, "maxinterval", DEF_MAXRTRADVINTERVAL); if (val < MIN_MAXINTERVAL || val > MAX_MAXINTERVAL) { syslog(LOG_ERR, - "<%s> maxinterval (%ld) on %s is invalid " - "(must be between %u and %u)", __func__, val, - intface, MIN_MAXINTERVAL, MAX_MAXINTERVAL); - exit(1); - } - tmp->maxinterval = (u_int)val; - MAYHAVE(val, "mininterval", tmp->maxinterval/3); - if (val < MIN_MININTERVAL || val > (tmp->maxinterval * 3) / 4) { + "<%s> maxinterval (%ld) on %s is invalid " + "(must be between %u and %u)", __func__, val, + intface, MIN_MAXINTERVAL, MAX_MAXINTERVAL); + return (-1); + } + rai->rai_maxinterval = (u_int)val; + + MAYHAVE(val, "mininterval", rai->rai_maxinterval/3); + if ((u_int)val < MIN_MININTERVAL || + (u_int)val > (rai->rai_maxinterval * 3) / 4) { syslog(LOG_ERR, - "<%s> mininterval (%ld) on %s is invalid " - "(must be between %d and %d)", - __func__, val, intface, MIN_MININTERVAL, - (tmp->maxinterval * 3) / 4); - exit(1); + "<%s> mininterval (%ld) on %s is invalid " + "(must be between %d and %d)", + __func__, val, intface, MIN_MININTERVAL, + (rai->rai_maxinterval * 3) / 4); + return (-1); } - tmp->mininterval = (u_int)val; + rai->rai_mininterval = (u_int)val; MAYHAVE(val, "chlim", DEF_ADVCURHOPLIMIT); - tmp->hoplimit = val & 0xff; + rai->rai_hoplimit = val & 0xff; if ((flagstr = (char *)agetstr("raflags", &bp))) { val = 0; @@ -191,77 +317,61 @@ getconfig(intface) if ((val & ND_RA_FLAG_RTPREF_HIGH)) { syslog(LOG_ERR, "<%s> the \'h\' and \'l\'" " router flags are exclusive", __func__); - exit(1); + return (-1); } val |= ND_RA_FLAG_RTPREF_LOW; } - } else { + } else MAYHAVE(val, "raflags", 0); - } - tmp->managedflg = val & ND_RA_FLAG_MANAGED; - tmp->otherflg = val & ND_RA_FLAG_OTHER; + + rai->rai_managedflg = val & ND_RA_FLAG_MANAGED; + rai->rai_otherflg = val & ND_RA_FLAG_OTHER; #ifndef ND_RA_FLAG_RTPREF_MASK #define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ #define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */ #endif - tmp->rtpref = val & ND_RA_FLAG_RTPREF_MASK; - if (tmp->rtpref == ND_RA_FLAG_RTPREF_RSV) { + rai->rai_rtpref = val & ND_RA_FLAG_RTPREF_MASK; + if (rai->rai_rtpref == ND_RA_FLAG_RTPREF_RSV) { syslog(LOG_ERR, "<%s> invalid router preference (%02x) on %s", - __func__, tmp->rtpref, intface); - exit(1); + __func__, rai->rai_rtpref, intface); + return (-1); } - MAYHAVE(val, "rltime", tmp->maxinterval * 3); - if (val && (val < tmp->maxinterval || val > MAXROUTERLIFETIME)) { - syslog(LOG_ERR, - "<%s> router lifetime (%ld) on %s is invalid " - "(must be 0 or between %d and %d)", - __func__, val, intface, - tmp->maxinterval, - MAXROUTERLIFETIME); - exit(1); - } - /* - * Basically, hosts MUST NOT send Router Advertisement messages at any - * time (RFC 2461, Section 6.2.3). However, it would sometimes be - * useful to allow hosts to advertise some parameters such as prefix - * information and link MTU. Thus, we allow hosts to invoke rtadvd - * only when router lifetime (on every advertising interface) is - * explicitly set zero. (see also the above section) - */ - if (val && forwarding == 0) { + MAYHAVE(val, "rltime", rai->rai_maxinterval * 3); + if ((u_int)val && ((u_int)val < rai->rai_maxinterval || + (u_int)val > MAXROUTERLIFETIME)) { syslog(LOG_ERR, - "<%s> non zero router lifetime is specified for %s, " - "which must not be allowed for hosts. you must " - "change router lifetime or enable IPv6 forwarding.", - __func__, intface); - exit(1); + "<%s> router lifetime (%ld) on %s is invalid " + "(must be 0 or between %d and %d)", + __func__, val, intface, rai->rai_maxinterval, + MAXROUTERLIFETIME); + return (-1); } - tmp->lifetime = val & 0xffff; + rai->rai_lifetime = val & 0xffff; MAYHAVE(val, "rtime", DEF_ADVREACHABLETIME); if (val < 0 || val > MAXREACHABLETIME) { syslog(LOG_ERR, - "<%s> reachable time (%ld) on %s is invalid " - "(must be no greater than %d)", - __func__, val, intface, MAXREACHABLETIME); - exit(1); + "<%s> reachable time (%ld) on %s is invalid " + "(must be no greater than %d)", + __func__, val, intface, MAXREACHABLETIME); + return (-1); } - tmp->reachabletime = (u_int32_t)val; + rai->rai_reachabletime = (u_int32_t)val; MAYHAVE(val64, "retrans", DEF_ADVRETRANSTIMER); if (val64 < 0 || val64 > 0xffffffff) { syslog(LOG_ERR, "<%s> retrans time (%lld) on %s out of range", - __func__, (long long)val64, intface); - exit(1); + __func__, (long long)val64, intface); + return (-1); } - tmp->retranstimer = (u_int32_t)val64; + rai->rai_retranstimer = (u_int32_t)val64; if (agetnum("hapref") != -1 || agetnum("hatime") != -1) { syslog(LOG_ERR, - "<%s> mobile-ip6 configuration not supported", - __func__); - exit(1); + "<%s> mobile-ip6 configuration not supported", + __func__); + return (-1); } /* prefix information */ @@ -271,12 +381,11 @@ getconfig(intface) * checking consistency of advertised lifetimes. */ MAYHAVE(val, "clockskew", 0); - tmp->clockskew = val; + rai->rai_clockskew = val; - tmp->pfxs = 0; + rai->rai_pfxs = 0; for (i = -1; i < MAXPREFIX; i++) { struct prefix *pfx; - char entbuf[256]; makeentry(entbuf, sizeof(entbuf), i, "addr"); addr = (char *)agetstr(entbuf, &bp); @@ -284,49 +393,41 @@ getconfig(intface) continue; /* allocate memory to store prefix information */ - if ((pfx = malloc(sizeof(struct prefix))) == NULL) { - syslog(LOG_ERR, - "<%s> can't allocate enough memory", - __func__); - exit(1); - } - memset(pfx, 0, sizeof(*pfx)); + ELM_MALLOC(pfx, exit(1)); /* link into chain */ - insque(pfx, &tmp->prefix); - tmp->pfxs++; - pfx->rainfo = tmp; - - pfx->origin = PREFIX_FROM_CONFIG; + TAILQ_INSERT_TAIL(&rai->rai_prefix, pfx, pfx_next); + rai->rai_pfxs++; + pfx->pfx_origin = PREFIX_FROM_CONFIG; - if (inet_pton(AF_INET6, addr, &pfx->prefix) != 1) { + if (inet_pton(AF_INET6, addr, &pfx->pfx_prefix) != 1) { syslog(LOG_ERR, - "<%s> inet_pton failed for %s", - __func__, addr); - exit(1); + "<%s> inet_pton failed for %s", + __func__, addr); + return (-1); } - if (IN6_IS_ADDR_MULTICAST(&pfx->prefix)) { + if (IN6_IS_ADDR_MULTICAST(&pfx->pfx_prefix)) { syslog(LOG_ERR, - "<%s> multicast prefix (%s) must " - "not be advertised on %s", - __func__, addr, intface); - exit(1); + "<%s> multicast prefix (%s) must " + "not be advertised on %s", + __func__, addr, intface); + return (-1); } - if (IN6_IS_ADDR_LINKLOCAL(&pfx->prefix)) + if (IN6_IS_ADDR_LINKLOCAL(&pfx->pfx_prefix)) syslog(LOG_NOTICE, - "<%s> link-local prefix (%s) will be" - " advertised on %s", - __func__, addr, intface); + "<%s> link-local prefix (%s) will be" + " advertised on %s", + __func__, addr, intface); makeentry(entbuf, sizeof(entbuf), i, "prefixlen"); MAYHAVE(val, entbuf, 64); if (val < 0 || val > 128) { syslog(LOG_ERR, "<%s> prefixlen (%ld) for %s " - "on %s out of range", - __func__, val, addr, intface); - exit(1); + "on %s out of range", + __func__, val, addr, intface); + return (-1); } - pfx->prefixlen = (int)val; + pfx->pfx_prefixlen = (int)val; makeentry(entbuf, sizeof(entbuf), i, "pinfoflags"); if ((flagstr = (char *)agetstr(entbuf, &bp))) { @@ -339,8 +440,8 @@ getconfig(intface) MAYHAVE(val, entbuf, (ND_OPT_PI_FLAG_ONLINK|ND_OPT_PI_FLAG_AUTO)); } - pfx->onlinkflg = val & ND_OPT_PI_FLAG_ONLINK; - pfx->autoconfflg = val & ND_OPT_PI_FLAG_AUTO; + pfx->pfx_onlinkflg = val & ND_OPT_PI_FLAG_ONLINK; + pfx->pfx_autoconfflg = val & ND_OPT_PI_FLAG_AUTO; makeentry(entbuf, sizeof(entbuf), i, "vltime"); MAYHAVE(val64, entbuf, DEF_ADVVALIDLIFETIME); @@ -348,17 +449,17 @@ getconfig(intface) syslog(LOG_ERR, "<%s> vltime (%lld) for " "%s/%d on %s is out of range", __func__, (long long)val64, - addr, pfx->prefixlen, intface); - exit(1); + addr, pfx->pfx_prefixlen, intface); + return (-1); } - pfx->validlifetime = (u_int32_t)val64; + pfx->pfx_validlifetime = (u_int32_t)val64; makeentry(entbuf, sizeof(entbuf), i, "vltimedecr"); if (agetflag(entbuf)) { struct timeval now; gettimeofday(&now, 0); - pfx->vltimeexpire = - now.tv_sec + pfx->validlifetime; + pfx->pfx_vltimeexpire = + now.tv_sec + pfx->pfx_validlifetime; } makeentry(entbuf, sizeof(entbuf), i, "pltime"); @@ -368,44 +469,45 @@ getconfig(intface) "<%s> pltime (%lld) for %s/%d on %s " "is out of range", __func__, (long long)val64, - addr, pfx->prefixlen, intface); - exit(1); + addr, pfx->pfx_prefixlen, intface); + return (-1); } - pfx->preflifetime = (u_int32_t)val64; + pfx->pfx_preflifetime = (u_int32_t)val64; makeentry(entbuf, sizeof(entbuf), i, "pltimedecr"); if (agetflag(entbuf)) { struct timeval now; gettimeofday(&now, 0); - pfx->pltimeexpire = - now.tv_sec + pfx->preflifetime; + pfx->pfx_pltimeexpire = + now.tv_sec + pfx->pfx_preflifetime; } } - if (tmp->pfxs == 0) - get_prefix(tmp); + if (rai->rai_advifprefix && rai->rai_pfxs == 0) + get_prefix(rai); MAYHAVE(val, "mtu", 0); - if (val < 0 || val > 0xffffffff) { + if (val < 0 || (u_int)val > 0xffffffff) { syslog(LOG_ERR, - "<%s> mtu (%ld) on %s out of range", - __func__, val, intface); - exit(1); + "<%s> mtu (%ld) on %s out of range", + __func__, val, intface); + return (-1); } - tmp->linkmtu = (u_int32_t)val; - if (tmp->linkmtu == 0) { + rai->rai_linkmtu = (u_int32_t)val; + if (rai->rai_linkmtu == 0) { char *mtustr; if ((mtustr = (char *)agetstr("mtu", &bp)) && strcmp(mtustr, "auto") == 0) - tmp->linkmtu = tmp->phymtu; + rai->rai_linkmtu = rai->rai_phymtu; } - else if (tmp->linkmtu < IPV6_MMTU || tmp->linkmtu > tmp->phymtu) { + else if (rai->rai_linkmtu < IPV6_MMTU || + rai->rai_linkmtu > rai->rai_phymtu) { syslog(LOG_ERR, - "<%s> advertised link mtu (%lu) on %s is invalid (must " - "be between least MTU (%d) and physical link MTU (%d)", - __func__, (unsigned long)tmp->linkmtu, intface, - IPV6_MMTU, tmp->phymtu); - exit(1); + "<%s> advertised link mtu (%lu) on %s is invalid (must " + "be between least MTU (%d) and physical link MTU (%d)", + __func__, (unsigned long)rai->rai_linkmtu, intface, + IPV6_MMTU, rai->rai_phymtu); + return (-1); } #ifdef SIOCSIFINFO_IN6 @@ -415,65 +517,56 @@ getconfig(intface) if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { syslog(LOG_ERR, "<%s> socket: %s", __func__, - strerror(errno)); + strerror(errno)); exit(1); } memset(&ndi, 0, sizeof(ndi)); strncpy(ndi.ifname, intface, IFNAMSIZ); - if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&ndi) < 0) { + if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&ndi) < 0) syslog(LOG_INFO, "<%s> ioctl:SIOCGIFINFO_IN6 at %s: %s", - __func__, intface, strerror(errno)); - } + __func__, intface, strerror(errno)); /* reflect the RA info to the host variables in kernel */ - ndi.ndi.chlim = tmp->hoplimit; - ndi.ndi.retrans = tmp->retranstimer; - ndi.ndi.basereachable = tmp->reachabletime; - if (ioctl(s, SIOCSIFINFO_IN6, (caddr_t)&ndi) < 0) { + ndi.ndi.chlim = rai->rai_hoplimit; + ndi.ndi.retrans = rai->rai_retranstimer; + ndi.ndi.basereachable = rai->rai_reachabletime; + if (ioctl(s, SIOCSIFINFO_IN6, (caddr_t)&ndi) < 0) syslog(LOG_INFO, "<%s> ioctl:SIOCSIFINFO_IN6 at %s: %s", - __func__, intface, strerror(errno)); - } + __func__, intface, strerror(errno)); + close(s); } #endif /* route information */ #ifdef ROUTEINFO - tmp->routes = 0; + rai->rai_routes = 0; for (i = -1; i < MAXROUTE; i++) { struct rtinfo *rti; - char entbuf[256], oentbuf[256]; makeentry(entbuf, sizeof(entbuf), i, "rtprefix"); addr = (char *)agetstr(entbuf, &bp); if (addr == NULL) { makeentry(oentbuf, sizeof(oentbuf), i, "rtrprefix"); addr = (char *)agetstr(oentbuf, &bp); - if (addr) { + if (addr) fprintf(stderr, "%s was obsoleted. Use %s.\n", - oentbuf, entbuf); - } + oentbuf, entbuf); } if (addr == NULL) continue; /* allocate memory to store prefix information */ - if ((rti = malloc(sizeof(struct rtinfo))) == NULL) { - syslog(LOG_ERR, - "<%s> can't allocate enough memory", - __func__); - exit(1); - } - memset(rti, 0, sizeof(*rti)); + ELM_MALLOC(rti, exit(1)); /* link into chain */ - insque(rti, &tmp->route); - tmp->routes++; + TAILQ_INSERT_TAIL(&rai->rai_route, rti, rti_next); + rai->rai_routes++; - if (inet_pton(AF_INET6, addr, &rti->prefix) != 1) { + if (inet_pton(AF_INET6, addr, &rti->rti_prefix) != 1) { syslog(LOG_ERR, "<%s> inet_pton failed for %s", - __func__, addr); - exit(1); + __func__, addr); + return (-1); } #if 0 /* @@ -485,17 +578,17 @@ getconfig(intface) MAYHAVE(val64, entbuf, DEF_ADVVALIDLIFETIME); if (IN6_IS_ADDR_MULTICAST(&rti->prefix)) { syslog(LOG_ERR, - "<%s> multicast route (%s) must " - "not be advertised on %s", - __func__, addr, intface); - exit(1); + "<%s> multicast route (%s) must " + "not be advertised on %s", + __func__, addr, intface); + return (-1); } if (IN6_IS_ADDR_LINKLOCAL(&rti->prefix)) { syslog(LOG_NOTICE, - "<%s> link-local route (%s) will " - "be advertised on %s", - __func__, addr, intface); - exit(1); + "<%s> link-local route (%s) will " + "be advertised on %s", + __func__, addr, intface); + return (-1); } #endif @@ -505,19 +598,19 @@ getconfig(intface) if (val == 256) { makeentry(oentbuf, sizeof(oentbuf), i, "rtrplen"); MAYHAVE(val, oentbuf, 256); - if (val != 256) { + if (val != 256) fprintf(stderr, "%s was obsoleted. Use %s.\n", - oentbuf, entbuf); - } else + oentbuf, entbuf); + else val = 64; } if (val < 0 || val > 128) { syslog(LOG_ERR, "<%s> prefixlen (%ld) for %s on %s " - "out of range", - __func__, val, addr, intface); - exit(1); + "out of range", + __func__, val, addr, intface); + return (-1); } - rti->prefixlen = (int)val; + rti->rti_prefixlen = (int)val; makeentry(entbuf, sizeof(entbuf), i, "rtflags"); if ((flagstr = (char *)agetstr(entbuf, &bp))) { @@ -541,17 +634,17 @@ getconfig(intface) MAYHAVE(val, oentbuf, 256); if (val != 256) { fprintf(stderr, "%s was obsoleted. Use %s.\n", - oentbuf, entbuf); + oentbuf, entbuf); } else val = 0; } - rti->rtpref = val & ND_RA_FLAG_RTPREF_MASK; - if (rti->rtpref == ND_RA_FLAG_RTPREF_RSV) { + rti->rti_rtpref = val & ND_RA_FLAG_RTPREF_MASK; + if (rti->rti_rtpref == ND_RA_FLAG_RTPREF_RSV) { syslog(LOG_ERR, "<%s> invalid route preference (%02x) " - "for %s/%d on %s", - __func__, rti->rtpref, addr, - rti->prefixlen, intface); - exit(1); + "for %s/%d on %s", + __func__, rti->rti_rtpref, addr, + rti->rti_prefixlen, intface); + return (-1); } /* @@ -565,60 +658,143 @@ getconfig(intface) if (val64 == -1) { makeentry(oentbuf, sizeof(oentbuf), i, "rtrltime"); MAYHAVE(val64, oentbuf, -1); - if (val64 != -1) { + if (val64 != -1) fprintf(stderr, "%s was obsoleted. Use %s.\n", - oentbuf, entbuf); - } else { + oentbuf, entbuf); + else { fprintf(stderr, "%s should be specified " - "for interface %s.\n", - entbuf, intface); - val64 = tmp->lifetime; + "for interface %s.\n", entbuf, intface); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 03:37: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 0453A106564A; Mon, 6 Jun 2011 03:37:34 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAB7C8FC0C; Mon, 6 Jun 2011 03:37: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 p563bXlk010023; Mon, 6 Jun 2011 03:37:33 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p563bXeG010021; Mon, 6 Jun 2011 03:37:33 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106060337.p563bXeG010021@svn.freebsd.org> From: Hiroki Sato Date: Mon, 6 Jun 2011 03:37: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: r222733 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 03:37:34 -0000 Author: hrs Date: Mon Jun 6 03:37:33 2011 New Revision: 222733 URL: http://svn.freebsd.org/changeset/base/222733 Log: Remove "ifconfig IF inet6 -accept_rtadv" when ipv6_gateway_enable=YES because this is no longer needed. Modified: head/etc/network.subr Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Mon Jun 6 03:06:43 2011 (r222732) +++ head/etc/network.subr Mon Jun 6 03:37:33 2011 (r222733) @@ -100,25 +100,19 @@ ifconfig_up() # inet6 specific if afexists inet6; then - if ipv6if $1; then - if checkyesno ipv6_gateway_enable; then - _ipv6_opts="-accept_rtadv" - fi + if checkyesno ipv6_activate_all_interfaces; then + _ipv6_opts="-ifdisabled" else - if checkyesno ipv6_activate_all_interfaces; then - _ipv6_opts="-ifdisabled" - else - _ipv6_opts="ifdisabled" - fi - - # backward compatibility: $ipv6_enable - case $ipv6_enable in - [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) - _ipv6_opts="${_ipv6_opts} accept_rtadv" - ;; - esac + _ipv6_opts="ifdisabled" fi + # backward compatibility: $ipv6_enable + case $ipv6_enable in + [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) + _ipv6_opts="${_ipv6_opts} accept_rtadv" + ;; + esac + if [ -n "${_ipv6_opts}" ]; then ifconfig $1 inet6 ${_ipv6_opts} fi From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 03:40: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 799F2106566C; Mon, 6 Jun 2011 03:40:06 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from agogare.doit.wisc.edu (agogare.doit.wisc.edu [144.92.197.211]) by mx1.freebsd.org (Postfix) with ESMTP id 485248FC13; Mon, 6 Jun 2011 03:40:06 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth2.wiscmail.wisc.edu by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0LMC00J00NITMW00@smtpauth2.wiscmail.wisc.edu>; Sun, 05 Jun 2011 22:40:05 -0500 (CDT) Received: from comporellon.tachypleus.net ([unknown] [76.210.62.252]) by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0LMC005U8NIRFH10@smtpauth2.wiscmail.wisc.edu>; Sun, 05 Jun 2011 22:40:04 -0500 (CDT) Date: Sun, 05 Jun 2011 22:40:03 -0500 From: Nathan Whitehorn In-reply-to: <201106060152.p561qF5M006329@svn.freebsd.org> To: Marcel Moolenaar Message-id: <4DEC4C13.6040304@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.210.62.252 X-Spam-PmxInfo: Server=avs-9, Version=5.6.0.2009776, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.6.6.32715, SenderIP=76.210.62.252 References: <201106060152.p561qF5M006329@svn.freebsd.org> User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.17) Gecko/20110429 Thunderbird/3.1.10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222726 - head/release/ia64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 03:40:06 -0000 On 06/05/11 20:52, Marcel Moolenaar wrote: > Author: marcel > Date: Mon Jun 6 01:52:15 2011 > New Revision: 222726 > URL: http://svn.freebsd.org/changeset/base/222726 > > Log: > Fix ia64 ISO creation: > o boot/mfsroot.gz is no more. Copy it only when it exists so as still > to be compatible with Makefile.sysinstall. > o while here, make ispfw.ko optional as well. > o '-b bootimage' is not a valid argument for makefs. What was meant > was '-o bootimage'. > o create the boot image in the current directory so that makefs can > find the file. Previously it had to be created under $BASE because > that's how mkisofs wanted it. Sorry to have broken it, and thanks for patching this up! -Nathan From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 04:12: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 D7082106564A; Mon, 6 Jun 2011 04:12:57 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FCBF8FC1F; Mon, 6 Jun 2011 04:12: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 p564Cv1R011172; Mon, 6 Jun 2011 04:12:57 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p564Cvm4011170; Mon, 6 Jun 2011 04:12:57 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106060412.p564Cvm4011170@svn.freebsd.org> From: Hiroki Sato Date: Mon, 6 Jun 2011 04:12: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: r222734 - head/sys/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, 06 Jun 2011 04:12:57 -0000 Author: hrs Date: Mon Jun 6 04:12:57 2011 New Revision: 222734 URL: http://svn.freebsd.org/changeset/base/222734 Log: Do not activate automatic LL addr configuration when 0/1->1 transition of ND6_IFF_IFDISABLED flag. Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon Jun 6 03:37:33 2011 (r222733) +++ head/sys/netinet6/nd6.c Mon Jun 6 04:12:57 2011 (r222734) @@ -1327,6 +1327,7 @@ nd6_ioctl(u_long cmd, caddr_t data, stru * accept_rtadv or auto_linklocal. */ if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && + !(ND.flags & ND6_IFF_IFDISABLED) && (ND.flags & (ND6_IFF_ACCEPT_RTADV | ND6_IFF_AUTO_LINKLOCAL))) ND.flags &= ~ND6_IFF_IFDISABLED; @@ -1388,7 +1389,8 @@ nd6_ioctl(u_long cmd, caddr_t data, stru /* If no link-local address on ifp, configure */ ND_IFINFO(ifp)->flags |= ND6_IFF_AUTO_LINKLOCAL; in6_ifattach(ifp, NULL); - } else if (ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) { + } else if ((ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) && + !(ND.flags & ND6_IFF_IFDISABLED)) { /* * When the IF already has * ND6_IFF_AUTO_LINKLOCAL and no link-local From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 05:31: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 3F39F106566C; Mon, 6 Jun 2011 05:31:06 +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 0425A8FC14; Mon, 6 Jun 2011 05:31:05 +0000 (UTC) Received: from dhcp-192-168-2-22.wifi.xcllnt.net (atm.xcllnt.net [70.36.220.6]) (authenticated bits=0) by mail.xcllnt.net (8.14.4/8.14.4) with ESMTP id p565Ux4p002438 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 5 Jun 2011 22:31:05 -0700 (PDT) (envelope-from marcel@xcllnt.net) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=utf-8 From: Marcel Moolenaar In-Reply-To: <4DEC4C13.6040304@freebsd.org> Date: Sun, 5 Jun 2011 22:30:59 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201106060152.p561qF5M006329@svn.freebsd.org> <4DEC4C13.6040304@freebsd.org> To: Nathan Whitehorn X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org Subject: Re: svn commit: r222726 - head/release/ia64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 05:31:06 -0000 On Jun 5, 2011, at 8:40 PM, Nathan Whitehorn wrote: > On 06/05/11 20:52, Marcel Moolenaar wrote: >> Author: marcel >> Date: Mon Jun 6 01:52:15 2011 >> New Revision: 222726 >> URL: http://svn.freebsd.org/changeset/base/222726 >>=20 >> Log: >> Fix ia64 ISO creation: >> o boot/mfsroot.gz is no more. Copy it only when it exists so as = still >> to be compatible with Makefile.sysinstall. >> o while here, make ispfw.ko optional as well. >> o '-b bootimage' is not a valid argument for makefs. What was = meant >> was '-o bootimage'. >> o create the boot image in the current directory so that makefs = can >> find the file. Previously it had to be created under $BASE = because >> that's how mkisofs wanted it. >=20 > Sorry to have broken it, and thanks for patching this up! No worries. I just did a fresh install and the whole process is just a delight. There's only 1 real problem: the new boot menu is crashing the loader, so I'll be removing that. Other than that, only aesthetic "issues": : /etc/rc: WARNING: $hostname is not set -- see rc.conf(5). : FreeBSD Installer = =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80 =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80Archive = Extraction=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =90 =E2=94=82 =E2=94= =82 =20 =E2=94=82 base.txz [ Done ] =E2=94= =82 =20 =E2=94=82 kernel.txz [ Done ] =E2=94= =82 =20 =E2=94=82 games.txz [ Done ] =E2=94= =82 =20 =E2=94=82 ports.txz [ 99% ] =E2=94= =82 =20 =E2=94=82 src.txz [ Pending = ]mpt0: QUEUE FULL EVENT: Bus 0x00 Target 0x03 Depth 65 = =E2=94=82 =20 mpt0: QUEUE FULL EVENT: Bus 0x00 Target 0x03 Depth 65 =E2=94=82 =20= mpt0: QUEUE FULL EVENT: Bus 0x00 Target 0x03 Depth 65 =E2=94=82 =20= mpt0: QUEUE FULL EVENT: Bus 0x00 Target 0x03 Depth 65=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=90 =E2=94=82 =20 mpt0: QUEUE FULL EVENT: Bus 0x00 Target 0x03 Depth 65 =E2=94=82 =E2=94= =82 =20 mpt0: QUEUE FULL EVENT: Bus 0x00 Target 0x03 Depth 65=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=98 =E2=94=82 =20 mpt0: QUEUE FULL EVENT: Bus 0x00 Target 0x03 Depth = 65=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=98 =20 mpt0: QUEUE FULL EVENT: Bus 0x00 Target 0x03 Depth 65 =20 FreeBSD Installer =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Please select a password for the system management account (root): mpt0: QUEUE FULL EVENT: Bus 0x00 Target 0x03 Depth 65 mpt0: QUEUE FULL EVENT: Bus 0x00 Target 0x03 Depth 65 New Password:mpt0: QUEUE FULL EVENT: Bus 0x00 Target 0x03 Depth 65 BTW, one thing to note: my source tree (from which the release was made) wasn't owned by root and some of the file ownership ended up "wrong": eris# ls -al /boot/kernel/ total 41504 drwxr-xr-x 2 root 99 1024 Jun 6 04:55 . drwxr-xr-x 7 root 99 512 Jun 5 22:20 .. -r-xr-xr-x 1 root wheel 21706 Jun 5 22:20 geom_part_apm.ko -r-xr-xr-x 1 root wheel 39239 Jun 5 22:20 = geom_part_apm.ko.symbols -r-xr-xr-x 1 root wheel 21424 Jun 5 22:20 geom_part_bsd.ko -r-xr-xr-x 1 root wheel 44693 Jun 5 22:20 = geom_part_bsd.ko.symbols -r-xr-xr-x 1 root wheel 22771 Jun 5 22:20 geom_part_ebr.ko -r-xr-xr-x 1 root wheel 39400 Jun 5 22:20 = geom_part_ebr.ko.symbols -r-xr-xr-x 1 root wheel 40421 Jun 5 22:20 geom_part_gpt.ko -r-xr-xr-x 1 root wheel 67106 Jun 5 22:20 = geom_part_gpt.ko.symbols -r-xr-xr-x 1 root wheel 21270 Jun 5 22:20 geom_part_mbr.ko -r-xr-xr-x 1 root wheel 37715 Jun 5 22:20 = geom_part_mbr.ko.symbols -r-xr-xr-x 1 root wheel 21995 Jun 5 22:20 geom_part_pc98.ko -r-xr-xr-x 1 root wheel 39225 Jun 5 22:20 = geom_part_pc98.ko.symbols -r-xr-xr-x 1 root wheel 21780 Jun 5 22:20 geom_part_vtoc8.ko -r-xr-xr-x 1 root wheel 47979 Jun 5 22:20 = geom_part_vtoc8.ko.symbols -r-xr-xr-x 1 root wheel 11030943 Jun 5 21:56 kernel -r-xr-xr-x 1 root wheel 21760529 Jun 5 21:56 kernel.symbols -rw-r--r-- 1 root 99 5228 Jun 5 22:20 linker.hints -r-xr-xr-x 1 root wheel 22153 Jun 5 22:20 opensolaris.ko -r-xr-xr-x 1 root wheel 96888 Jun 5 22:20 opensolaris.ko.symbols -r-xr-xr-x 1 root wheel 2472977 Jun 5 22:20 zfs.ko -r-xr-xr-x 1 root wheel 6383611 Jun 5 22:20 zfs.ko.symbols eris# ls -al /usr total 80 drwxr-xr-x 15 root wheel 512 Jun 6 04:55 . drwxr-xr-x 19 root wheel 1024 Jun 6 05:29 .. drwxr-xr-x 2 root wheel 7680 Jun 5 22:12 bin drwxr-xr-x 2 root wheel 512 Jun 6 04:55 games drwxr-xr-x 51 root wheel 5632 Jun 5 22:11 include drwxr-xr-x 7 root wheel 12288 Jun 5 22:12 lib drwxr-xr-x 4 root wheel 512 Jun 5 21:39 lib32 drwxr-xr-x 5 root wheel 512 Jun 5 21:39 libdata drwxr-xr-x 6 root wheel 1536 Jun 5 22:12 libexec drwxr-xr-x 2 root wheel 512 Jun 5 21:39 local drwxr-xr-x 2 root wheel 512 Jun 5 21:39 obj drwxr-xr-x 68 501 99 1536 May 31 03:24 ports drwxr-xr-x 2 root wheel 5120 Jun 5 22:12 sbin drwxr-xr-x 27 root wheel 512 Jun 5 22:12 share drwxrwxr-x 22 501 99 1024 Jun 6 05:00 src --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 06:32: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 C7F1D1065670; Mon, 6 Jun 2011 06:32:47 +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 79A438FC18; Mon, 6 Jun 2011 06:32:46 +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 JAA17641; Mon, 06 Jun 2011 09:32:43 +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 1QTTMg-000Als-QV; Mon, 06 Jun 2011 09:32:42 +0300 Message-ID: <4DEC748A.8000204@FreeBSD.org> Date: Mon, 06 Jun 2011 09:32:42 +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: Pan Tsu , Gerald Pfeifer References: <201106052101.p55L1feL097420@svn.freebsd.org> <86zklwezwb.fsf@gmail.com> In-Reply-To: <86zklwezwb.fsf@gmail.com> 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: r222723 - 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: Mon, 06 Jun 2011 06:32:47 -0000 on 06/06/2011 00:23 Pan Tsu said the following: > Andriy Gapon writes: > >> Author: avg >> Date: Sun Jun 5 21:01:41 2011 >> New Revision: 222723 >> URL: http://svn.freebsd.org/changeset/base/222723 >> >> Log: >> add SNDCTL_DSP_HALT specified by OSS >> >> This is really a new name for SNDCTL_DSP_RESET. >> >> PR: kern/156874 >> Submitted by: gerald >> MFC after: 1 week >> >> Modified: >> head/sys/sys/soundcard.h >> >> Modified: head/sys/sys/soundcard.h >> ============================================================================== >> --- head/sys/sys/soundcard.h Sun Jun 5 20:22:56 2011 (r222722) >> +++ head/sys/sys/soundcard.h Sun Jun 5 21:01:41 2011 (r222723) >> @@ -311,7 +311,8 @@ typedef struct _snd_capabilities { >> * IOCTL Commands for /dev/sequencer >> */ >> >> -#define SNDCTL_SEQ_RESET _IO ('Q', 0) >> +#define SNDCTL_SEQ_HALT _IO ('Q', 0) >> +#define SNDCTL_SEQ_RESET SNDCTL_SEQ_HALT /* Historic interface */ > > Apparently, the one for /dev/sequencer is too new to be documented. > > http://manuals.opensound.com/developer/SNDCTL_SEQ_HALT.html -> "Not found" Woops! I admit I just copied the description and the patch from the PR. How inattentive I could be while doing that? Gerald, should the patch have actually introduced SNDCTL_DSP_HALT as the description says? >> #define SNDCTL_SEQ_SYNC _IO ('Q', 1) >> #define SNDCTL_SYNTH_INFO _IOWR('Q', 2, struct synth_info) >> #define SNDCTL_SEQ_CTRLRATE _IOWR('Q', 3, int) /* Set/get timer res.(hz) */ -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 07:39: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 4DCFA106564A; Mon, 6 Jun 2011 07:39:59 +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 C763D8FC13; Mon, 6 Jun 2011 07:39:58 +0000 (UTC) Received: from core.vx.sk (localhost [127.0.0.1]) by mail.vx.sk (Postfix) with ESMTP id 9BA5E170F81; Mon, 6 Jun 2011 09:39:57 +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 Npj1Ot1dMmXj; Mon, 6 Jun 2011 09:39:55 +0200 (CEST) Received: from [10.0.3.160] (188-167-50-235.dynamic.chello.sk [188.167.50.235]) by mail.vx.sk (Postfix) with ESMTPSA id 1D5F0170F76; Mon, 6 Jun 2011 09:39:55 +0200 (CEST) Message-ID: <4DEC844A.5090301@FreeBSD.org> Date: Mon, 06 Jun 2011 09:39:54 +0200 From: Martin Matuska User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: Andriy Gapon References: <201106040702.p54726O6098336@svn.freebsd.org> <4DEA0785.3040707@FreeBSD.org> <4DEBD5B9.9040908@FreeBSD.org> In-Reply-To: <4DEBD5B9.9040908@FreeBSD.org> 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: Mon, 06 Jun 2011 07:39:59 -0000 The quotes don't mean the fix isn't complete - it is complete. I was just discussing the way we put it in the code and comparing how it looks like upstream (so if there are any code updates in the future it should be easier to integrate them). Btw. pjd is ok with this commit as the vendor code did not get altered so you may ignore my thoughts. Cheers, mm Dňa 05.06.2011 21:15, Andriy Gapon wrote / napísal(a): > on 04/06/2011 13:23 Martin Matuska said the following: >> If we are "fixing" this, > I am not sure why you used the quotes here. I think that it's a real issue and > I believe that this commit is a reasonable fix. > >> what about following pjd's rules and moving in >> direction vendor code (reducing diff)? Or is it too expensive? > Well, it seems that the code before the change was not compliant with the rules. > I certainly like those rules, but maybe in this case they would be an overkill. > >> 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 Mon Jun 6 09: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 1DA021065672; Mon, 6 Jun 2011 09:32:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 7B2688FC1D; Mon, 6 Jun 2011 09:32:53 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:fd51:79c7:b47f:35f4] (unknown [IPv6:2001:7b8:3a7:0:fd51:79c7:b47f:35f4]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 877E65C37; Mon, 6 Jun 2011 11:32:52 +0200 (CEST) Message-ID: <4DEC9EC1.9070206@FreeBSD.org> Date: Mon, 06 Jun 2011 11:32:49 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18pre) Gecko/20110527 Lanikai/3.1.11pre MIME-Version: 1.0 To: Hiroki Sato References: <201106060306.p5636hR5008901@svn.freebsd.org> In-Reply-To: <201106060306.p5636hR5008901@svn.freebsd.org> Content-Type: multipart/mixed; boundary="------------060203090403090309070709" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222732 - in head: sys/netinet usr.sbin/rtadvd usr.sbin/rtsold X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 09:32:54 -0000 This is a multi-part message in MIME format. --------------060203090403090309070709 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2011-06-06 05:06, Hiroki Sato wrote: > Author: hrs > Date: Mon Jun 6 03:06:43 2011 > New Revision: 222732 > URL: http://svn.freebsd.org/changeset/base/222732 > > Log: > - Implement RDNSS and DNSSL options (RFC 6106, IPv6 Router Advertisement > Options for DNS Configuration) into rtadvd(8) and rtsold(8). DNS > information received by rtsold(8) will go to resolv.conf(5) by > resolvconf(8) script. This is based on work by J.R. Oldroyd (kern/156259) > but revised extensively[1]. > > - rtadvd(8) now supports "noifprefix" to disable gathering on-link prefixes > from interfaces when no "addr" is specified[2]. An entry in rtadvd.conf > with "noifprefix" + no "addr" generates an RA message with no prefix > information option. > > - rtadvd(8) now supports RTM_IFANNOUNCE message to fix crashes when an > interface is added or removed. > > - Correct bogus ND_OPT_ROUTE_INFO value to one in RFC 4191. ... > Modified: head/usr.sbin/rtadvd/Makefile > ============================================================================== > --- head/usr.sbin/rtadvd/Makefile Mon Jun 6 02:46:22 2011 (r222731) > +++ head/usr.sbin/rtadvd/Makefile Mon Jun 6 03:06:43 2011 (r222732) > @@ -23,6 +23,6 @@ LDADD= -lutil > > CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DROUTEINFO > > -WARNS?= 1 > +WARNS?= 6 Hi, This code is not yet WARNS=6 clean, at least not on amd64: cc1: warnings being treated as errors /usr/src/usr.sbin/rtadvd/rtadvd.c: In function 'rtadvd_input': /usr/src/usr.sbin/rtadvd/rtadvd.c:793: warning: format '%d' expects type 'int', but argument 4 has type 'ssize_t' /usr/src/usr.sbin/rtadvd/rtadvd.c:834: warning: format '%d' expects type 'int', but argument 6 has type 'ssize_t' /usr/src/usr.sbin/rtadvd/rtadvd.c:880: warning: format '%d' expects type 'int', but argument 6 has type 'ssize_t' *** Error code 1 (continuing) cc1: warnings being treated as errors /usr/src/usr.sbin/rtadvd/config.c: In function 'dname_labelenc': /usr/src/usr.sbin/rtadvd/config.c:112: warning: format '%d' expects type 'int', but argument 4 has type 'long int' *** Error code 1 (continuing) `all' not remade because of errors. 1 error Please apply the attached patch, which fixes the warnings. --------------060203090403090309070709 Content-Type: text/plain; name="rtadvd-fmt-1.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="rtadvd-fmt-1.diff" SW5kZXg6IHVzci5zYmluL3J0YWR2ZC9jb25maWcuYwo9PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSB1c3Iu c2Jpbi9ydGFkdmQvY29uZmlnLmMJKHJldmlzaW9uIDIyMjczNykKKysrIHVzci5zYmluL3J0 YWR2ZC9jb25maWcuYwkod29ya2luZyBjb3B5KQpAQCAtMTA5LDcgKzEwOSw3IEBAIGRuYW1l X2xhYmVsZW5jKGNoYXIgKmRzdCwgY29uc3QgY2hhciAqc3JjKQogCS8qIEFsd2F5cyBuZWVk IGEgMC1sZW5ndGggbGFiZWwgYXQgdGhlIHRhaWwuICovCiAJKmRzdCsrID0gJ1wwJzsKIAot CXN5c2xvZyhMT0dfREVCVUcsICI8JXM+IGxhYmVsbGVuID0gJWQiLCBfX2Z1bmNfXywgZHN0 IC0gZHN0X29yaWdpbik7CisJc3lzbG9nKExPR19ERUJVRywgIjwlcz4gbGFiZWxsZW4gPSAl dGQiLCBfX2Z1bmNfXywgZHN0IC0gZHN0X29yaWdpbik7CiAJcmV0dXJuIChkc3QgLSBkc3Rf b3JpZ2luKTsKIH0KIApJbmRleDogdXNyLnNiaW4vcnRhZHZkL2R1bXAuYwo9PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09Ci0tLSB1c3Iuc2Jpbi9ydGFkdmQvZHVtcC5jCShyZXZpc2lvbiAyMjI3MzcpCisrKyB1 c3Iuc2Jpbi9ydGFkdmQvZHVtcC5jCSh3b3JraW5nIGNvcHkpCkBAIC0zMTAsNyArMzEwLDcg QEAgZG5hbWVfbGFiZWxkZWMoY2hhciAqZHN0LCBzaXplX3QgZGxlbiwgY29uc3QgY2hhcgog CSAgICAoc3JjICsgbGVuKSA8PSBzcmNfbGFzdCkgewogCQlpZiAoZHN0ICE9IGRzdF9vcmln aW4pCiAJCQkqZHN0KysgPSAnLic7Ci0JCXN5c2xvZyhMT0dfREVCVUcsICI8JXM+IGxhYmVs bGVuID0gJWQiLCBfX2Z1bmNfXywgbGVuKTsKKwkJc3lzbG9nKExPR19ERUJVRywgIjwlcz4g bGFiZWxsZW4gPSAlemQiLCBfX2Z1bmNfXywgbGVuKTsKIAkJbWVtY3B5KGRzdCwgc3JjLCBs ZW4pOwogCQlzcmMgKz0gbGVuOwogCQlkc3QgKz0gbGVuOwpJbmRleDogdXNyLnNiaW4vcnRh ZHZkL3J0YWR2ZC5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHVzci5zYmluL3J0YWR2ZC9ydGFkdmQu YwkocmV2aXNpb24gMjIyNzM3KQorKysgdXNyLnNiaW4vcnRhZHZkL3J0YWR2ZC5jCSh3b3Jr aW5nIGNvcHkpCkBAIC03ODksNyArNzg5LDcgQEAgcnRhZHZkX2lucHV0KHZvaWQpCiAjZWxz ZQogCWlmICgoc2l6ZV90KWkgPCBzaXplb2Yoc3RydWN0IGljbXA2X2hkcikpIHsKIAkJc3lz bG9nKExPR19FUlIsCi0JCSAgICAiPCVzPiBwYWNrZXQgc2l6ZSglZCkgaXMgdG9vIHNob3J0 IiwKKwkJICAgICI8JXM+IHBhY2tldCBzaXplKCV6ZCkgaXMgdG9vIHNob3J0IiwKIAkJICAg IF9fZnVuY19fLCBpKTsKIAkJcmV0dXJuOwogCX0KQEAgLTgyNyw3ICs4MjcsNyBAQCBydGFk dmRfaW5wdXQodm9pZCkKIAkJaWYgKChzaXplX3QpaSA8IHNpemVvZihzdHJ1Y3QgbmRfcm91 dGVyX3NvbGljaXQpKSB7CiAJCQlzeXNsb2coTE9HX05PVElDRSwKIAkJCSAgICAiPCVzPiBS UyBmcm9tICVzIG9uICVzIGRvZXMgbm90IGhhdmUgZW5vdWdoICIKLQkJCSAgICAibGVuZ3Ro IChsZW4gPSAlZCkiLAorCQkJICAgICJsZW5ndGggKGxlbiA9ICV6ZCkiLAogCQkJICAgIF9f ZnVuY19fLAogCQkJICAgIGluZXRfbnRvcChBRl9JTkVUNiwgJnJjdmZyb20uc2luNl9hZGRy LCBudG9wYnVmLAogCQkJICAgIHNpemVvZihudG9wYnVmKSksCkBAIC04NzMsNyArODczLDcg QEAgcnRhZHZkX2lucHV0KHZvaWQpCiAJCWlmICgoc2l6ZV90KWkgPCBzaXplb2Yoc3RydWN0 IG5kX3JvdXRlcl9hZHZlcnQpKSB7CiAJCQlzeXNsb2coTE9HX05PVElDRSwKIAkJCSAgICAi PCVzPiBSQSBmcm9tICVzIG9uICVzIGRvZXMgbm90IGhhdmUgZW5vdWdoICIKLQkJCSAgICAi bGVuZ3RoIChsZW4gPSAlZCkiLAorCQkJICAgICJsZW5ndGggKGxlbiA9ICV6ZCkiLAogCQkJ ICAgIF9fZnVuY19fLAogCQkJICAgIGluZXRfbnRvcChBRl9JTkVUNiwgJnJjdmZyb20uc2lu Nl9hZGRyLCBudG9wYnVmLAogCQkJICAgIHNpemVvZihudG9wYnVmKSksCg== --------------060203090403090309070709-- From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 10:39: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 992F8106566B; Mon, 6 Jun 2011 10:39:38 +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 890A38FC13; Mon, 6 Jun 2011 10:39: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 p56Adc9r027204; Mon, 6 Jun 2011 10:39:38 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56Adccf027202; Mon, 6 Jun 2011 10:39:38 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106061039.p56Adccf027202@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 6 Jun 2011 10:39: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: r222742 - 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, 06 Jun 2011 10:39:38 -0000 Author: ae Date: Mon Jun 6 10:39:38 2011 New Revision: 222742 URL: http://svn.freebsd.org/changeset/base/222742 Log: Do not return EINVAL when user does `ipfw set N flush` on an empty set. 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 Jun 6 09:36:46 2011 (r222741) +++ head/sys/netinet/ipfw/ip_fw_sockopt.c Mon Jun 6 10:39:38 2011 (r222742) @@ -349,12 +349,13 @@ del_entry(struct ip_fw_chain *chain, uin } if (n == 0) { - /* A flush request (arg == 0) on empty ruleset - * returns with no error. On the contrary, + /* A flush request (arg == 0 or cmd == 1) on empty + * ruleset returns with no error. On the contrary, * if there is no match on a specific request, * we return EINVAL. */ - error = (arg == 0) ? 0 : EINVAL; + if (arg != 0 && cmd != 1) + error = EINVAL; break; } From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 10:51: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 85C6F106564A; Mon, 6 Jun 2011 10:51:00 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C18F8FC0A; Mon, 6 Jun 2011 10:51: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 p56Ap0MW027663; Mon, 6 Jun 2011 10:51:00 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56Ap0FN027659; Mon, 6 Jun 2011 10:51:00 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106061051.p56Ap0FN027659@svn.freebsd.org> From: Hiroki Sato Date: Mon, 6 Jun 2011 10:51: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: r222743 - head/usr.sbin/rtadvd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 10:51:00 -0000 Author: hrs Date: Mon Jun 6 10:51:00 2011 New Revision: 222743 URL: http://svn.freebsd.org/changeset/base/222743 Log: Fix build on 64-bit arch. Submitted by: dim Pointy hat to: hrs Modified: head/usr.sbin/rtadvd/config.c head/usr.sbin/rtadvd/dump.c head/usr.sbin/rtadvd/rtadvd.c Modified: head/usr.sbin/rtadvd/config.c ============================================================================== --- head/usr.sbin/rtadvd/config.c Mon Jun 6 10:39:38 2011 (r222742) +++ head/usr.sbin/rtadvd/config.c Mon Jun 6 10:51:00 2011 (r222743) @@ -109,7 +109,7 @@ dname_labelenc(char *dst, const char *sr /* Always need a 0-length label at the tail. */ *dst++ = '\0'; - syslog(LOG_DEBUG, "<%s> labellen = %d", __func__, dst - dst_origin); + syslog(LOG_DEBUG, "<%s> labellen = %td", __func__, dst - dst_origin); return (dst - dst_origin); } Modified: head/usr.sbin/rtadvd/dump.c ============================================================================== --- head/usr.sbin/rtadvd/dump.c Mon Jun 6 10:39:38 2011 (r222742) +++ head/usr.sbin/rtadvd/dump.c Mon Jun 6 10:51:00 2011 (r222743) @@ -310,7 +310,7 @@ dname_labeldec(char *dst, size_t dlen, c (src + len) <= src_last) { if (dst != dst_origin) *dst++ = '.'; - syslog(LOG_DEBUG, "<%s> labellen = %d", __func__, len); + syslog(LOG_DEBUG, "<%s> labellen = %zd", __func__, len); memcpy(dst, src, len); src += len; dst += len; Modified: head/usr.sbin/rtadvd/rtadvd.c ============================================================================== --- head/usr.sbin/rtadvd/rtadvd.c Mon Jun 6 10:39:38 2011 (r222742) +++ head/usr.sbin/rtadvd/rtadvd.c Mon Jun 6 10:51:00 2011 (r222743) @@ -789,7 +789,7 @@ rtadvd_input(void) #else if ((size_t)i < sizeof(struct icmp6_hdr)) { syslog(LOG_ERR, - "<%s> packet size(%d) is too short", + "<%s> packet size(%zd) is too short", __func__, i); return; } @@ -827,7 +827,7 @@ rtadvd_input(void) if ((size_t)i < sizeof(struct nd_router_solicit)) { syslog(LOG_NOTICE, "<%s> RS from %s on %s does not have enough " - "length (len = %d)", + "length (len = %zd)", __func__, inet_ntop(AF_INET6, &rcvfrom.sin6_addr, ntopbuf, sizeof(ntopbuf)), @@ -873,7 +873,7 @@ rtadvd_input(void) if ((size_t)i < sizeof(struct nd_router_advert)) { syslog(LOG_NOTICE, "<%s> RA from %s on %s does not have enough " - "length (len = %d)", + "length (len = %zd)", __func__, inet_ntop(AF_INET6, &rcvfrom.sin6_addr, ntopbuf, sizeof(ntopbuf)), From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 10:52: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 BF223106566B; Mon, 6 Jun 2011 10:52: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 AF1338FC08; Mon, 6 Jun 2011 10:52: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 p56AqQfN027795; Mon, 6 Jun 2011 10:52:26 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56AqQro027793; Mon, 6 Jun 2011 10:52:26 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106061052.p56AqQro027793@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 6 Jun 2011 10:52: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: r222744 - head/sbin/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, 06 Jun 2011 10:52:26 -0000 Author: ae Date: Mon Jun 6 10:52:26 2011 New Revision: 222744 URL: http://svn.freebsd.org/changeset/base/222744 Log: Increase buffer size for the command line. PR: bin/125370 Submitted by: sem MFC after: 2 weeks Modified: head/sbin/ipfw/main.c Modified: head/sbin/ipfw/main.c ============================================================================== --- head/sbin/ipfw/main.c Mon Jun 6 10:51:00 2011 (r222743) +++ head/sbin/ipfw/main.c Mon Jun 6 10:52:26 2011 (r222744) @@ -444,7 +444,7 @@ static void ipfw_readfile(int ac, char *av[]) { #define MAX_ARGS 32 - char buf[BUFSIZ]; + char buf[4096]; char *progname = av[0]; /* original program name */ const char *cmd = NULL; /* preprocessor name, if any */ const char *filename = av[ac-1]; /* file to read */ @@ -552,7 +552,7 @@ ipfw_readfile(int ac, char *av[]) } } - while (fgets(buf, BUFSIZ, f)) { /* read commands */ + while (fgets(buf, sizeof(buf), f)) { /* read commands */ char linename[20]; char *args[2]; From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 11:10: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 8961A106568C; Mon, 6 Jun 2011 11:10:38 +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 793808FC25; Mon, 6 Jun 2011 11:10: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 p56BAcKl028485; Mon, 6 Jun 2011 11:10:38 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56BAcmv028483; Mon, 6 Jun 2011 11:10:38 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106061110.p56BAcmv028483@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 6 Jun 2011 11:10: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: r222745 - head/sbin/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, 06 Jun 2011 11:10:38 -0000 Author: ae Date: Mon Jun 6 11:10:38 2011 New Revision: 222745 URL: http://svn.freebsd.org/changeset/base/222745 Log: Initialize co.use_set variable before parsing each new rule. PR: bin/134975 MFC after: 2 weeks Modified: head/sbin/ipfw/main.c Modified: head/sbin/ipfw/main.c ============================================================================== --- head/sbin/ipfw/main.c Mon Jun 6 10:52:26 2011 (r222744) +++ head/sbin/ipfw/main.c Mon Jun 6 11:10:38 2011 (r222745) @@ -356,6 +356,7 @@ ipfw_main(int oldac, char **oldav) */ co.do_nat = 0; co.do_pipe = 0; + co.use_set = 0; if (!strncmp(*av, "nat", strlen(*av))) co.do_nat = 1; else if (!strncmp(*av, "pipe", strlen(*av))) From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 11:27: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 1A7681065673; Mon, 6 Jun 2011 11:27:08 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.vlsi.ee.noda.tus.ac.jp (sekine00.ee.noda.sut.ac.jp [133.31.107.40]) by mx1.freebsd.org (Postfix) with ESMTP id 9301B8FC2C; Mon, 6 Jun 2011 11:27:07 +0000 (UTC) Received: from alph.allbsd.org (p2237-ipbf904funabasi.chiba.ocn.ne.jp [122.26.37.237]) (user=hrs mech=DIGEST-MD5 bits=128) by mail.vlsi.ee.noda.tus.ac.jp (8.14.4/8.14.4) with ESMTP id p56As6bt085052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 6 Jun 2011 19:54:17 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.14.4/8.14.4) with ESMTP id p56As5Ie084561; Mon, 6 Jun 2011 19:54:06 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Mon, 06 Jun 2011 19:53:48 +0900 (JST) Message-Id: <20110606.195348.722786496150655516.hrs@allbsd.org> To: dim@FreeBSD.org From: Hiroki Sato In-Reply-To: <4DEC9EC1.9070206@FreeBSD.org> References: <201106060306.p5636hR5008901@svn.freebsd.org> <4DEC9EC1.9070206@FreeBSD.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.3 on Emacs 23.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Mon_Jun__6_19_53_48_2011_367)--" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.vlsi.ee.noda.tus.ac.jp [133.31.107.40]); Mon, 06 Jun 2011 19:54:17 +0900 (JST) X-Spam-Status: No, score=6.4 required=14.0 tests=BAYES_50, CONTENT_TYPE_PRESENT, RCVD_IN_CHINA, RCVD_IN_CHINA_KR, RCVD_IN_PBL, RCVD_IN_RP_RNBL, RCVD_IN_TAIWAN, SPF_SOFTFAIL,X_MAILER_PRESENT autolearn=no version=3.3.1 X-Spam-Level: ****** X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.vlsi.ee.noda.tus.ac.jp Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r222732 - in head: sys/netinet usr.sbin/rtadvd usr.sbin/rtsold X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 11:27:08 -0000 ----Security_Multipart(Mon_Jun__6_19_53_48_2011_367)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Dimitry Andric wrote in <4DEC9EC1.9070206@FreeBSD.org>: di> > Modified: head/usr.sbin/rtadvd/Makefile di> > ============================================================================== di> > --- head/usr.sbin/rtadvd/Makefile Mon Jun 6 02:46:22 2011 (r222731) di> > +++ head/usr.sbin/rtadvd/Makefile Mon Jun 6 03:06:43 2011 (r222732) di> > @@ -23,6 +23,6 @@ LDADD= -lutil di> > di> > CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DROUTEINFO di> > di> > -WARNS?= 1 di> > +WARNS?= 6 di> di> Hi, di> di> This code is not yet WARNS=6 clean, at least not on amd64: Oh, thank you for pointing out. I overlooked that. Committed just now. -- Hiroki ----Security_Multipart(Mon_Jun__6_19_53_48_2011_367)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAk3ssbwACgkQTyzT2CeTzy1ZaACgg0c2GFtLSYQ3xbEQiz/ICtBP bD8An1m9o/euCdDsl+9vXJj+tNkKvS89 =wpPI -----END PGP SIGNATURE----- ----Security_Multipart(Mon_Jun__6_19_53_48_2011_367)---- From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 11:28: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 B57F51065676; Mon, 6 Jun 2011 11:28:12 +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 91A5C8FC14; Mon, 6 Jun 2011 11:28:12 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 32A3346B03; Mon, 6 Jun 2011 07:28:12 -0400 (EDT) Date: Mon, 6 Jun 2011 12:28:12 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Rick Macklem In-Reply-To: <201106051817.p55IHb0Y092046@svn.freebsd.org> Message-ID: References: <201106051817.p55IHb0Y092046@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: r222719 - in head/sys/fs: nfs 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: Mon, 06 Jun 2011 11:28:12 -0000 On Sun, 5 Jun 2011, Rick Macklem wrote: > The new NFSv4 client was erroneously using "p" instead of > "p_leader" for the "id" for POSIX byte range locking. I think > this would only have affected processes created by rfork(2) > with the RFTHREAD flag specified. This patch fixes that by > passing the "id" down through the various functions from > nfs_advlock(). And therefore probably threaded Linux processes? Robert From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 11:36: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 E97841065670; Mon, 6 Jun 2011 11:36:10 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9DA88FC17; Mon, 6 Jun 2011 11:36: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 p56BaAgc029318; Mon, 6 Jun 2011 11:36:10 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56BaAX0029316; Mon, 6 Jun 2011 11:36:10 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106061136.p56BaAX0029316@svn.freebsd.org> From: Hiroki Sato Date: Mon, 6 Jun 2011 11:36: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: r222746 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 11:36:11 -0000 Author: hrs Date: Mon Jun 6 11:36:10 2011 New Revision: 222746 URL: http://svn.freebsd.org/changeset/base/222746 Log: Do not mark lo0 as IFDISABLED even if there is no $ifconfig_lo0_ipv6 line. Modified: head/etc/network.subr Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Mon Jun 6 11:10:38 2011 (r222745) +++ head/etc/network.subr Mon Jun 6 11:36:10 2011 (r222746) @@ -102,7 +102,7 @@ ifconfig_up() if afexists inet6; then if checkyesno ipv6_activate_all_interfaces; then _ipv6_opts="-ifdisabled" - else + elif [ "$1" != "lo0" ]; then _ipv6_opts="ifdisabled" fi From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 12:21: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 056CB106564A; Mon, 6 Jun 2011 12:21:43 +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 E94818FC0C; Mon, 6 Jun 2011 12:21: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 p56CLgZD030704; Mon, 6 Jun 2011 12:21:42 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56CLg0A030702; Mon, 6 Jun 2011 12:21:42 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201106061221.p56CLg0A030702@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 6 Jun 2011 12:21: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: r222747 - 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, 06 Jun 2011 12:21:43 -0000 Author: bz Date: Mon Jun 6 12:21:42 2011 New Revision: 222747 URL: http://svn.freebsd.org/changeset/base/222747 Log: Remove TODO which is not longer needed and the default. Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Mon Jun 6 11:36:10 2011 (r222746) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Mon Jun 6 12:21:42 2011 (r222747) @@ -33,7 +33,6 @@ # # TODO: -# - Add -R /sbin/resolvconf to rtsol once support is in tree. # - Add DHCPv6 support once FreeBSD ships with it. # From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 12:55: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 424F4106566B; Mon, 6 Jun 2011 12:55:03 +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 2AB1B8FC08; Mon, 6 Jun 2011 12:55: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 p56Ct3Yn031802; Mon, 6 Jun 2011 12:55:03 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56Ct3qN031795; Mon, 6 Jun 2011 12:55:03 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201106061255.p56Ct3qN031795@svn.freebsd.org> From: Robert Watson Date: Mon, 6 Jun 2011 12:55: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: r222748 - in head/sys: conf 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, 06 Jun 2011 12:55:03 -0000 Author: rwatson Date: Mon Jun 6 12:55:02 2011 New Revision: 222748 URL: http://svn.freebsd.org/changeset/base/222748 Log: Implement a CPU-affine TCP and UDP connection lookup data structure, struct inpcbgroup. pcbgroups, or "connection groups", supplement the existing inpcbinfo connection hash table, which when pcbgroups are enabled, might now be thought of more usefully as a per-protocol 4-tuple reservation table. Connections are assigned to connection groups base on a hash of their 4-tuple; wildcard sockets require special handling, and are members of all connection groups. During a connection lookup, a per-connection group lock is employed rather than the global pcbinfo lock. By aligning connection groups with input path processing, connection groups take on an effective CPU affinity, especially when aligned with RSS work placement (see a forthcoming commit for details). This eliminates cache line migration associated with global, protocol-layer data structures in steady state TCP and UDP processing (with the exception of protocol-layer statistics; further commit to follow). Elements of this approach were inspired by Willman, Rixner, and Cox's 2006 USENIX paper, "An Evaluation of Network Stack Parallelization Strategies in Modern Operating Systems". However, there are also significant differences: we maintain the inpcb lock, rather than using the connection group lock for per-connection state. Likewise, the focus of this implementation is alignment with NIC packet distribution strategies such as RSS, rather than pure software strategies. Despite that focus, software distribution is supported through the parallel netisr implementation, and works well in configurations where the number of hardware threads is greater than the number of NIC input queues, such as in the RMI XLR threaded MIPS architecture. Another important difference is the continued maintenance of existing hash tables as "reservation tables" -- these are useful both to distinguish the resource allocation aspect of protocol name management and the more common-case lookup aspect. In configurations where connection tables are aligned with hardware hashes, it is desirable to use the traditional lookup tables for loopback or encapsulated traffic rather than take the expense of hardware hashes that are hard to implement efficiently in software (such as RSS Toeplitz). Connection group support is enabled by compiling "options PCBGROUP" into your kernel configuration; for the time being, this is an experimental feature, and hence is not enabled by default. Subject to the limited MFCability of change dependencies in inpcb, and its change to the inpcbinfo init function signature, this change in principle could be merged to FreeBSD 8.x. Reviewed by: bz Sponsored by: Juniper Networks, Inc. Added: head/sys/netinet/in_pcbgroup.c (contents, props changed) head/sys/netinet6/in6_pcbgroup.c (contents, props changed) Modified: head/sys/conf/files head/sys/conf/options 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/tcp_subr.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 Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Jun 6 12:21:42 2011 (r222747) +++ head/sys/conf/files Mon Jun 6 12:55:02 2011 (r222748) @@ -2748,6 +2748,7 @@ netinet/ip_gre.c optional gre inet netinet/ip_id.c optional inet netinet/in_mcast.c optional inet netinet/in_pcb.c optional inet | inet6 +netinet/in_pcbgroup.c optional inet pcbgroup | inet6 pcbgroup netinet/in_proto.c optional inet | inet6 \ compile-with "${NORMAL_C} -I$S/contrib/pf" netinet/in_rmx.c optional inet @@ -2825,6 +2826,7 @@ netinet6/in6_gif.c optional gif inet6 | netinet6/in6_ifattach.c optional inet6 netinet6/in6_mcast.c optional inet6 netinet6/in6_pcb.c optional inet6 +netinet6/in6_pcbgroup.c optional inet6 pcbgroup netinet6/in6_proto.c optional inet6 netinet6/in6_rmx.c optional inet6 netinet6/in6_src.c optional inet6 Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Jun 6 12:21:42 2011 (r222747) +++ head/sys/conf/options Mon Jun 6 12:55:02 2011 (r222748) @@ -419,6 +419,7 @@ MROUTING opt_mrouting.h NCP NETATALK opt_atalk.h NFSLOCKD +PCBGROUP opt_pcbgroup.h RADIX_MPATH opt_mpath.h ROUTETABLES opt_route.h SLIP_IFF_OPTS opt_slip.h Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Mon Jun 6 12:21:42 2011 (r222747) +++ head/sys/netinet/in_pcb.c Mon Jun 6 12:55:02 2011 (r222748) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ipsec.h" #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_pcbgroup.h" #include #include @@ -212,7 +213,7 @@ void in_pcbinfo_init(struct inpcbinfo *pcbinfo, const char *name, struct inpcbhead *listhead, int hash_nelements, int porthash_nelements, char *inpcbzone_name, uma_init inpcbzone_init, uma_fini inpcbzone_fini, - uint32_t inpcbzone_flags) + uint32_t inpcbzone_flags, u_int hashfields) { INP_INFO_LOCK_INIT(pcbinfo, name); @@ -227,6 +228,9 @@ in_pcbinfo_init(struct inpcbinfo *pcbinf &pcbinfo->ipi_hashmask); pcbinfo->ipi_porthashbase = hashinit(porthash_nelements, M_PCB, &pcbinfo->ipi_porthashmask); +#ifdef PCBGROUP + in_pcbgroup_init(pcbinfo, hashfields, hash_nelements); +#endif pcbinfo->ipi_zone = uma_zcreate(inpcbzone_name, sizeof(struct inpcb), NULL, NULL, inpcbzone_init, inpcbzone_fini, UMA_ALIGN_PTR, inpcbzone_flags); @@ -246,6 +250,9 @@ in_pcbinfo_destroy(struct inpcbinfo *pcb hashdestroy(pcbinfo->ipi_hashbase, M_PCB, pcbinfo->ipi_hashmask); hashdestroy(pcbinfo->ipi_porthashbase, M_PCB, pcbinfo->ipi_porthashmask); +#ifdef PCBGROUP + in_pcbgroup_destroy(pcbinfo); +#endif uma_zdestroy(pcbinfo->ipi_zone); INP_HASH_LOCK_DESTROY(pcbinfo); INP_INFO_LOCK_DESTROY(pcbinfo); @@ -1053,7 +1060,8 @@ in_pcbdetach(struct inpcb *inp) * in_pcbref() bumps the reference count on an inpcb in order to maintain * stability of an inpcb pointer despite the inpcb lock being released. This * is used in TCP when the inpcbinfo lock needs to be acquired or upgraded, - * but where the inpcb lock is already held. + * but where the inpcb lock may already held, or when acquiring a reference + * via a pcbgroup. * * in_pcbref() should be used only to provide brief memory stability, and * must always be followed by a call to INP_WLOCK() and in_pcbrele() to @@ -1223,6 +1231,9 @@ in_pcbdrop(struct inpcb *inp) } INP_HASH_WUNLOCK(inp->inp_pcbinfo); inp->inp_flags &= ~INP_INHASHLIST; +#ifdef PCBGROUP + in_pcbgroup_remove(inp); +#endif } } @@ -1472,6 +1483,148 @@ in_pcblookup_local(struct inpcbinfo *pcb } #undef INP_LOOKUP_MAPPED_PCB_COST +#ifdef PCBGROUP +/* + * Lookup PCB in hash list, using pcbgroup tables. + */ +static struct inpcb * +in_pcblookup_group(struct inpcbinfo *pcbinfo, struct inpcbgroup *pcbgroup, + struct in_addr faddr, u_int fport_arg, struct in_addr laddr, + u_int lport_arg, int lookupflags, struct ifnet *ifp) +{ + struct inpcbhead *head; + struct inpcb *inp, *tmpinp; + u_short fport = fport_arg, lport = lport_arg; + + /* + * First look for an exact match. + */ + tmpinp = NULL; + INP_GROUP_LOCK(pcbgroup); + head = &pcbgroup->ipg_hashbase[INP_PCBHASH(faddr.s_addr, lport, fport, + pcbgroup->ipg_hashmask)]; + LIST_FOREACH(inp, head, inp_pcbgrouphash) { +#ifdef INET6 + /* XXX inp locking */ + if ((inp->inp_vflag & INP_IPV4) == 0) + continue; +#endif + if (inp->inp_faddr.s_addr == faddr.s_addr && + inp->inp_laddr.s_addr == laddr.s_addr && + inp->inp_fport == fport && + inp->inp_lport == lport) { + /* + * XXX We should be able to directly return + * the inp here, without any checks. + * Well unless both bound with SO_REUSEPORT? + */ + if (prison_flag(inp->inp_cred, PR_IP4)) + goto found; + if (tmpinp == NULL) + tmpinp = inp; + } + } + if (tmpinp != NULL) { + inp = tmpinp; + goto found; + } + + /* + * Then look for a wildcard match, if requested. + */ + if ((lookupflags & INPLOOKUP_WILDCARD) != 0) { + struct inpcb *local_wild = NULL, *local_exact = NULL; +#ifdef INET6 + struct inpcb *local_wild_mapped = NULL; +#endif + struct inpcb *jail_wild = NULL; + struct inpcbhead *head; + int injail; + + /* + * Order of socket selection - we always prefer jails. + * 1. jailed, non-wild. + * 2. jailed, wild. + * 3. non-jailed, non-wild. + * 4. non-jailed, wild. + */ + head = &pcbinfo->ipi_wildbase[INP_PCBHASH(INADDR_ANY, lport, + 0, pcbinfo->ipi_wildmask)]; + LIST_FOREACH(inp, head, inp_pcbgroup_wild) { +#ifdef INET6 + /* XXX inp locking */ + if ((inp->inp_vflag & INP_IPV4) == 0) + continue; +#endif + if (inp->inp_faddr.s_addr != INADDR_ANY || + inp->inp_lport != lport) + continue; + + /* XXX inp locking */ + if (ifp && ifp->if_type == IFT_FAITH && + (inp->inp_flags & INP_FAITH) == 0) + continue; + + injail = prison_flag(inp->inp_cred, PR_IP4); + if (injail) { + if (prison_check_ip4(inp->inp_cred, + &laddr) != 0) + continue; + } else { + if (local_exact != NULL) + continue; + } + + if (inp->inp_laddr.s_addr == laddr.s_addr) { + if (injail) + goto found; + else + local_exact = inp; + } else if (inp->inp_laddr.s_addr == INADDR_ANY) { +#ifdef INET6 + /* XXX inp locking, NULL check */ + if (inp->inp_vflag & INP_IPV6PROTO) + local_wild_mapped = inp; + else +#endif /* INET6 */ + if (injail) + jail_wild = inp; + else + local_wild = inp; + } + } /* LIST_FOREACH */ + inp = jail_wild; + if (inp == NULL) + inp = local_exact; + if (inp == NULL) + inp = local_wild; +#ifdef INET6 + if (inp == NULL) + inp = local_wild_mapped; +#endif /* defined(INET6) */ + if (inp != NULL) + goto found; + } /* if (lookupflags & INPLOOKUP_WILDCARD) */ + INP_GROUP_UNLOCK(pcbgroup); + return (NULL); + +found: + in_pcbref(inp); + INP_GROUP_UNLOCK(pcbgroup); + 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__); + return (inp); +} +#endif /* PCBGROUP */ + /* * 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 @@ -1636,17 +1789,30 @@ in_pcblookup_hash(struct inpcbinfo *pcbi /* * Public inpcb lookup routines, accepting a 4-tuple, and optionally, an mbuf * from which a pre-calculated hash value may be extracted. + * + * Possibly more of this logic should be in in_pcbgroup.c. */ 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) { +#if defined(PCBGROUP) + struct inpcbgroup *pcbgroup; +#endif KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, ("%s: LOCKPCB not set", __func__)); +#if defined(PCBGROUP) + if (in_pcbgroup_enabled(pcbinfo)) { + pcbgroup = in_pcbgroup_bytuple(pcbinfo, laddr, lport, faddr, + fport); + return (in_pcblookup_group(pcbinfo, pcbgroup, faddr, fport, + laddr, lport, lookupflags, ifp)); + } +#endif return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, lookupflags, ifp)); } @@ -1656,12 +1822,28 @@ in_pcblookup_mbuf(struct inpcbinfo *pcbi u_int fport, struct in_addr laddr, u_int lport, int lookupflags, struct ifnet *ifp, struct mbuf *m) { +#ifdef PCBGROUP + struct inpcbgroup *pcbgroup; +#endif KASSERT((lookupflags & ~INPLOOKUP_MASK) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0, ("%s: LOCKPCB not set", __func__)); +#ifdef PCBGROUP + if (in_pcbgroup_enabled(pcbinfo)) { + pcbgroup = in_pcbgroup_byhash(pcbinfo, M_HASHTYPE_GET(m), + m->m_pkthdr.flowid); + if (pcbgroup != NULL) + return (in_pcblookup_group(pcbinfo, pcbgroup, faddr, + fport, laddr, lport, lookupflags, ifp)); + pcbgroup = in_pcbgroup_bytuple(pcbinfo, laddr, lport, faddr, + fport); + return (in_pcblookup_group(pcbinfo, pcbgroup, faddr, fport, + laddr, lport, lookupflags, ifp)); + } +#endif return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport, lookupflags, ifp)); } @@ -1670,8 +1852,8 @@ in_pcblookup_mbuf(struct inpcbinfo *pcbi /* * Insert PCB onto various hash lists. */ -int -in_pcbinshash(struct inpcb *inp) +static int +in_pcbinshash_internal(struct inpcb *inp, int do_pcbgroup_update) { struct inpcbhead *pcbhash; struct inpcbporthead *pcbporthash; @@ -1721,10 +1903,39 @@ in_pcbinshash(struct inpcb *inp) LIST_INSERT_HEAD(&phd->phd_pcblist, inp, inp_portlist); LIST_INSERT_HEAD(pcbhash, inp, inp_hash); inp->inp_flags |= INP_INHASHLIST; +#ifdef PCBGROUP + if (do_pcbgroup_update) + in_pcbgroup_update(inp); +#endif return (0); } /* + * For now, there are two public interfaces to insert an inpcb into the hash + * lists -- one that does update pcbgroups, and one that doesn't. The latter + * is used only in the TCP syncache, where in_pcbinshash is called before the + * full 4-tuple is set for the inpcb, and we don't want to install in the + * pcbgroup until later. + * + * XXXRW: This seems like a misfeature. in_pcbinshash should always update + * connection groups, and partially initialised inpcbs should not be exposed + * to either reservation hash tables or pcbgroups. + */ +int +in_pcbinshash(struct inpcb *inp) +{ + + return (in_pcbinshash_internal(inp, 1)); +} + +int +in_pcbinshash_nopcbgroup(struct inpcb *inp) +{ + + return (in_pcbinshash_internal(inp, 0)); +} + +/* * Move PCB to the proper hash bucket when { faddr, fport } have been * changed. NOTE: This does not handle the case of the lport changing (the * hashed port list would have to be updated as well), so the lport must @@ -1755,6 +1966,13 @@ in_pcbrehash_mbuf(struct inpcb *inp, str LIST_REMOVE(inp, inp_hash); LIST_INSERT_HEAD(head, inp, inp_hash); + +#ifdef PCBGROUP + if (m != NULL) + in_pcbgroup_update_mbuf(inp, m); + else + in_pcbgroup_update(inp); +#endif } void @@ -1791,6 +2009,9 @@ in_pcbremlists(struct inpcb *inp) } LIST_REMOVE(inp, inp_list); pcbinfo->ipi_count--; +#ifdef PCBGROUP + in_pcbgroup_remove(inp); +#endif } /* Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Mon Jun 6 12:21:42 2011 (r222747) +++ head/sys/netinet/in_pcb.h Mon Jun 6 12:55:02 2011 (r222748) @@ -141,6 +141,7 @@ struct icmp6_filter; * * Key: * (c) - Constant after initialization + * (g) - Protected by the pcbgroup lock * (i) - Protected by the inpcb lock * (p) - Protected by the pcbinfo lock for the inpcb * (s) - Protected by another subsystem's locks @@ -160,9 +161,12 @@ struct icmp6_filter; */ struct inpcb { LIST_ENTRY(inpcb) inp_hash; /* (i/p) hash list */ + LIST_ENTRY(inpcb) inp_pcbgrouphash; /* (g/i) hash list */ LIST_ENTRY(inpcb) inp_list; /* (i/p) list for all PCBs for proto */ void *inp_ppcb; /* (i) pointer to per-protocol pcb */ struct inpcbinfo *inp_pcbinfo; /* (c) PCB list info */ + struct inpcbgroup *inp_pcbgroup; /* (g/i) PCB group list */ + LIST_ENTRY(inpcb) inp_pcbgroup_wild; /* (g/i/p) group wildcard entry */ struct socket *inp_socket; /* (i) back pointer to socket */ struct ucred *inp_cred; /* (c) cache of socket cred */ u_int32_t inp_flow; /* (i) IPv6 flow information */ @@ -272,13 +276,14 @@ struct inpcbport { * 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 (before) ipi_hash_lock + * ipi_lock (before) inpcb locks (before) {ipi_hash_lock, pcbgroup locks} * * Locking key: * * (c) Constant or nearly constant after initialisation * (g) Locked by ipi_lock - * (h) Read using either ipi_hash_lock or inpcb lock; write requires both. + * (h) Read using either ipi_hash_lock or inpcb lock; write requires both + * (p) Protected by one or more pcbgroup locks * (x) Synchronisation properties poorly defined */ struct inpcbinfo { @@ -312,7 +317,16 @@ struct inpcbinfo { struct uma_zone *ipi_zone; /* (c) */ /* - * Global lock protecting hash lookup tables. + * Connection groups associated with this protocol. These fields are + * constant, but pcbgroup structures themselves are protected by + * per-pcbgroup locks. + */ + struct inpcbgroup *ipi_pcbgroups; /* (c) */ + u_int ipi_npcbgroups; /* (c) */ + u_int ipi_hashfields; /* (c) */ + + /* + * Global lock protecting non-pcbgroup hash lookup tables. */ struct rwlock ipi_hash_lock; @@ -330,6 +344,14 @@ struct inpcbinfo { u_long ipi_porthashmask; /* (h) */ /* + * List of wildcard inpcbs for use with pcbgroups. In the past, was + * per-pcbgroup but is now global. All pcbgroup locks must be held + * to modify the list, so any is sufficient to read it. + */ + struct inpcbhead *ipi_wildbase; /* (p) */ + u_long ipi_wildmask; /* (p) */ + + /* * Pointer to network stack instance */ struct vnet *ipi_vnet; /* (c) */ @@ -340,6 +362,31 @@ struct inpcbinfo { void *ipi_pspare[2]; }; +/* + * Connection groups hold sets of connections that have similar CPU/thread + * affinity. Each connection belongs to exactly one connection group. + */ +struct inpcbgroup { + /* + * Per-connection group hash of inpcbs, hashed by local and foreign + * addresses and port numbers. + */ + struct inpcbhead *ipg_hashbase; /* (c) */ + u_long ipg_hashmask; /* (c) */ + + /* + * Notional affinity of this pcbgroup. + */ + u_int ipg_cpu; /* (p) */ + + /* + * Per-connection group lock, not to be confused with ipi_lock. + * Protects the hash table hung off the group, but also the global + * wildcard list in inpcbinfo. + */ + struct mtx ipg_lock; +} __aligned(CACHE_LINE_SIZE); + #define INP_LOCK_INIT(inp, d, t) \ rw_init_flags(&(inp)->inp_lock, (t), RW_RECURSE | RW_DUPOK) #define INP_LOCK_DESTROY(inp) rw_destroy(&(inp)->inp_lock) @@ -423,6 +470,14 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_HASH_WLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_hash_lock, \ RA_WLOCKED) +#define INP_GROUP_LOCK_INIT(ipg, d) mtx_init(&(ipg)->ipg_lock, (d), NULL, \ + MTX_DEF | MTX_DUPOK) +#define INP_GROUP_LOCK_DESTROY(ipg) mtx_destroy(&(ipg)->ipg_lock) + +#define INP_GROUP_LOCK(ipg) mtx_lock(&(ipg)->ipg_lock) +#define INP_GROUP_LOCK_ASSERT(ipg) mtx_assert(&(ipg)->ipg_lock, MA_OWNED) +#define INP_GROUP_UNLOCK(ipg) mtx_unlock(&(ipg)->ipg_lock) + #define INP_PCBHASH(faddr, lport, fport, mask) \ (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) #define INP_PCBPORTHASH(lport, mask) \ @@ -482,6 +537,7 @@ 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 INP_PCBGROUPWILD 0x00000004 /* in pcbgroup wildcard list */ /* * Flags passed to in_pcblookup*() functions. @@ -500,6 +556,13 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_CHECK_SOCKAF(so, af) (INP_SOCKAF(so) == af) +/* + * Constants for pcbinfo.ipi_hashfields. + */ +#define IPI_HASHFIELDS_NONE 0 +#define IPI_HASHFIELDS_2TUPLE 1 +#define IPI_HASHFIELDS_4TUPLE 2 + #ifdef _KERNEL VNET_DECLARE(int, ipport_reservedhigh); VNET_DECLARE(int, ipport_reservedlow); @@ -531,7 +594,21 @@ VNET_DECLARE(int, ipport_tcpallocs); void in_pcbinfo_destroy(struct inpcbinfo *); void in_pcbinfo_init(struct inpcbinfo *, const char *, struct inpcbhead *, - int, int, char *, uma_init, uma_fini, uint32_t); + int, int, char *, uma_init, uma_fini, uint32_t, u_int); + +struct inpcbgroup * + in_pcbgroup_byhash(struct inpcbinfo *, u_int, uint32_t); +struct inpcbgroup * + in_pcbgroup_byinpcb(struct inpcb *); +struct inpcbgroup * + in_pcbgroup_bytuple(struct inpcbinfo *, struct in_addr, u_short, + struct in_addr, u_short); +void in_pcbgroup_destroy(struct inpcbinfo *); +int in_pcbgroup_enabled(struct inpcbinfo *); +void in_pcbgroup_init(struct inpcbinfo *, u_int, int); +void in_pcbgroup_remove(struct inpcb *); +void in_pcbgroup_update(struct inpcb *); +void in_pcbgroup_update_mbuf(struct inpcb *, struct mbuf *); void in_pcbpurgeif0(struct inpcbinfo *, struct ifnet *); int in_pcballoc(struct socket *, struct inpcbinfo *); @@ -551,6 +628,7 @@ void in_pcbdisconnect(struct inpcb *); void in_pcbdrop(struct inpcb *); void in_pcbfree(struct inpcb *); int in_pcbinshash(struct inpcb *); +int in_pcbinshash_nopcbgroup(struct inpcb *); struct inpcb * in_pcblookup_local(struct inpcbinfo *, struct in_addr, u_short, int, struct ucred *); Added: head/sys/netinet/in_pcbgroup.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/in_pcbgroup.c Mon Jun 6 12:55:02 2011 (r222748) @@ -0,0 +1,457 @@ +/*- + * 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. + */ + +#include + +__FBSDID("$FreeBSD$"); + +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#ifdef INET6 +#include +#endif /* INET6 */ + +/* + * pcbgroups, or "connection groups" are based on Willman, Rixner, and Cox's + * 2006 USENIX paper, "An Evaluation of Network Stack Parallelization + * Strategies in Modern Operating Systems". This implementation differs + * significantly from that described in the paper, in that it attempts to + * introduce not just notions of affinity for connections and distribute work + * so as to reduce lock contention, but also align those notions with + * hardware work distribution strategies such as RSS. In this construction, + * connection groups supplement, rather than replace, existing reservation + * tables for protocol 4-tuples, offering CPU-affine lookup tables with + * minimal cache line migration and lock contention during steady state + * operation. + * + * Internet protocols, such as UDP and TCP, register to use connection groups + * by providing an ipi_hashfields value other than IPI_HASHFIELDS_NONE; this + * indicates to the connection group code whether a 2-tuple or 4-tuple is + * used as an argument to hashes that assign a connection to a particular + * group. This must be aligned with any hardware offloaded distribution + * model, such as RSS or similar approaches taken in embedded network boards. + * Wildcard sockets require special handling, as in Willman 2006, and are + * shared between connection groups -- while being protected by group-local + * locks. This means that connection establishment and teardown can be + * signficantly more expensive than without connection groups, but that + * steady-state processing can be significantly faster. + * + * Most of the implementation of connection groups is in this file; however, + * connection group lookup is implemented in in_pcb.c alongside reservation + * table lookups -- see in_pcblookup_group(). + * + * TODO: + * + * Implement dynamic rebalancing of buckets with connection groups; when + * load is unevenly distributed, search for more optimal balancing on + * demand. This might require scaling up the number of connection groups + * by <<1. + * + * Provide an IP 2-tuple or 4-tuple netisr m2cpu handler based on connection + * groups for ip_input and ip6_input, allowing non-offloaded work + * distribution. + * + * Expose effective CPU affinity of connections to userspace using socket + * options. + * + * Investigate per-connection affinity overrides based on socket options; an + * option could be set, certainly resulting in work being distributed + * differently in software, and possibly propagated to supporting hardware + * with TCAMs or hardware hash tables. This might require connections to + * exist in more than one connection group at a time. + * + * Hook netisr thread reconfiguration events, and propagate those to RSS so + * that rebalancing can occur when the thread pool grows or shrinks. + * + * Expose per-pcbgroup statistics to userspace monitoring tools such as + * netstat, in order to allow better debugging and profiling. + */ + +void +in_pcbgroup_init(struct inpcbinfo *pcbinfo, u_int hashfields, + int hash_nelements) +{ + struct inpcbgroup *pcbgroup; + u_int numpcbgroups, pgn; + + /* + * Only enable connection groups for a protocol if it has been + * specifically requested. + */ + if (hashfields == IPI_HASHFIELDS_NONE) + return; + + /* + * Connection groups are about multi-processor load distribution, + * lock contention, and connection CPU affinity. As such, no point + * in turning them on for a uniprocessor machine, it only wastes + * memory. + */ + if (mp_ncpus == 1) + return; + + /* + * Use one group per CPU for now. If we decide to do dynamic + * rebalancing a la RSS, we'll need to shift left by at least 1. + */ + numpcbgroups = mp_ncpus; + + pcbinfo->ipi_hashfields = hashfields; + pcbinfo->ipi_pcbgroups = malloc(numpcbgroups * + sizeof(*pcbinfo->ipi_pcbgroups), M_PCB, M_WAITOK | M_ZERO); + pcbinfo->ipi_npcbgroups = numpcbgroups; + pcbinfo->ipi_wildbase = hashinit(hash_nelements, M_PCB, + &pcbinfo->ipi_wildmask); + for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++) { + pcbgroup = &pcbinfo->ipi_pcbgroups[pgn]; + pcbgroup->ipg_hashbase = hashinit(hash_nelements, M_PCB, + &pcbgroup->ipg_hashmask); + INP_GROUP_LOCK_INIT(pcbgroup, "pcbgroup"); + + /* + * Initialise notional affinity of the pcbgroup -- for RSS, + * we want the same notion of affinity as NICs to be used. + * Just round robin for the time being. + */ + pcbgroup->ipg_cpu = (pgn % mp_ncpus); + } +} + +void +in_pcbgroup_destroy(struct inpcbinfo *pcbinfo) +{ + struct inpcbgroup *pcbgroup; + u_int pgn; + + if (pcbinfo->ipi_npcbgroups == 0) + return; + + for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++) { + pcbgroup = &pcbinfo->ipi_pcbgroups[pgn]; + KASSERT(LIST_EMPTY(pcbinfo->ipi_listhead), + ("in_pcbinfo_destroy: listhead not empty")); + INP_GROUP_LOCK_DESTROY(pcbgroup); + hashdestroy(pcbgroup->ipg_hashbase, M_PCB, + pcbgroup->ipg_hashmask); + } + hashdestroy(pcbinfo->ipi_wildbase, M_PCB, pcbinfo->ipi_wildmask); + free(pcbinfo->ipi_pcbgroups, M_PCB); + pcbinfo->ipi_pcbgroups = NULL; + pcbinfo->ipi_npcbgroups = 0; + pcbinfo->ipi_hashfields = 0; +} + +/* + * Given a hash of whatever the covered tuple might be, return a pcbgroup + * index. + */ +static __inline u_int +in_pcbgroup_getbucket(struct inpcbinfo *pcbinfo, uint32_t hash) +{ + + return (hash % pcbinfo->ipi_npcbgroups); +} + +/* + * Map a (hashtype, hash) tuple into a connection group, or NULL if the hash + * information is insufficient to identify the pcbgroup. + */ +struct inpcbgroup * +in_pcbgroup_byhash(struct inpcbinfo *pcbinfo, u_int hashtype, uint32_t hash) +{ + + return (NULL); +} + +static struct inpcbgroup * +in_pcbgroup_bymbuf(struct inpcbinfo *pcbinfo, struct mbuf *m) +{ + + return (in_pcbgroup_byhash(pcbinfo, M_HASHTYPE_GET(m), + m->m_pkthdr.flowid)); +} + +struct inpcbgroup * +in_pcbgroup_bytuple(struct inpcbinfo *pcbinfo, struct in_addr laddr, + u_short lport, struct in_addr faddr, u_short fport) +{ + uint32_t hash; + + switch (pcbinfo->ipi_hashfields) { + case IPI_HASHFIELDS_4TUPLE: + hash = faddr.s_addr ^ fport; + break; + + case IPI_HASHFIELDS_2TUPLE: + hash = faddr.s_addr ^ laddr.s_addr; + break; + + default: + hash = 0; + } + return (&pcbinfo->ipi_pcbgroups[in_pcbgroup_getbucket(pcbinfo, + hash)]); +} + +struct inpcbgroup * +in_pcbgroup_byinpcb(struct inpcb *inp) +{ + + return (in_pcbgroup_bytuple(inp->inp_pcbinfo, inp->inp_laddr, + inp->inp_lport, inp->inp_faddr, inp->inp_fport)); +} + +static void +in_pcbwild_add(struct inpcb *inp) +{ + struct inpcbinfo *pcbinfo; + struct inpcbhead *head; + u_int pgn; + + INP_WLOCK_ASSERT(inp); + KASSERT(!(inp->inp_flags2 & INP_PCBGROUPWILD), + ("%s: is wild",__func__)); + + pcbinfo = inp->inp_pcbinfo; + for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++) + INP_GROUP_LOCK(&pcbinfo->ipi_pcbgroups[pgn]); + head = &pcbinfo->ipi_wildbase[INP_PCBHASH(INADDR_ANY, inp->inp_lport, + 0, pcbinfo->ipi_wildmask)]; + LIST_INSERT_HEAD(head, inp, inp_pcbgroup_wild); + inp->inp_flags2 |= INP_PCBGROUPWILD; + for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++) + INP_GROUP_UNLOCK(&pcbinfo->ipi_pcbgroups[pgn]); +} + +static void +in_pcbwild_remove(struct inpcb *inp) +{ + struct inpcbinfo *pcbinfo; + u_int pgn; + + INP_WLOCK_ASSERT(inp); + KASSERT((inp->inp_flags2 & INP_PCBGROUPWILD), + ("%s: not wild", __func__)); + + pcbinfo = inp->inp_pcbinfo; + for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++) + INP_GROUP_LOCK(&pcbinfo->ipi_pcbgroups[pgn]); + LIST_REMOVE(inp, inp_pcbgroup_wild); + for (pgn = 0; pgn < pcbinfo->ipi_npcbgroups; pgn++) + INP_GROUP_UNLOCK(&pcbinfo->ipi_pcbgroups[pgn]); + inp->inp_flags2 &= ~INP_PCBGROUPWILD; +} + +static __inline int +in_pcbwild_needed(struct inpcb *inp) +{ + +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6) + return (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)); + else +#endif + return (inp->inp_faddr.s_addr == htonl(INADDR_ANY)); +} + +static void +in_pcbwild_update_internal(struct inpcb *inp) +{ + int wildcard_needed; + + wildcard_needed = in_pcbwild_needed(inp); + if (wildcard_needed && !(inp->inp_flags2 & INP_PCBGROUPWILD)) + in_pcbwild_add(inp); + else if (!wildcard_needed && (inp->inp_flags2 & INP_PCBGROUPWILD)) + in_pcbwild_remove(inp); +} + +/* + * Update the pcbgroup of an inpcb, which might include removing an old + * pcbgroup reference and/or adding a new one. Wildcard processing is not + * performed here, although ideally we'll never install a pcbgroup for a + * wildcard inpcb (asserted below). + */ +static void +in_pcbgroup_update_internal(struct inpcbinfo *pcbinfo, + struct inpcbgroup *newpcbgroup, struct inpcb *inp) +{ + struct inpcbgroup *oldpcbgroup; + struct inpcbhead *pcbhash; + uint32_t hashkey_faddr; + + INP_WLOCK_ASSERT(inp); + + oldpcbgroup = inp->inp_pcbgroup; + if (oldpcbgroup != NULL && oldpcbgroup != newpcbgroup) { + INP_GROUP_LOCK(oldpcbgroup); + LIST_REMOVE(inp, inp_pcbgrouphash); + inp->inp_pcbgroup = NULL; + INP_GROUP_UNLOCK(oldpcbgroup); + } + if (newpcbgroup != NULL && oldpcbgroup != newpcbgroup) { +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6) + hashkey_faddr = inp->in6p_faddr.s6_addr32[3]; /* XXX */ + else +#endif + hashkey_faddr = inp->inp_faddr.s_addr; + INP_GROUP_LOCK(newpcbgroup); + pcbhash = &newpcbgroup->ipg_hashbase[ + INP_PCBHASH(hashkey_faddr, inp->inp_lport, inp->inp_fport, + newpcbgroup->ipg_hashmask)]; + LIST_INSERT_HEAD(pcbhash, inp, inp_pcbgrouphash); + inp->inp_pcbgroup = newpcbgroup; + INP_GROUP_UNLOCK(newpcbgroup); + } + + KASSERT(!(newpcbgroup != NULL && in_pcbwild_needed(inp)), + ("%s: pcbgroup and wildcard!", __func__)); +} + +/* + * Two update paths: one in which the 4-tuple on an inpcb has been updated + * and therefore connection groups may need to change (or a wildcard entry + * may needed to be installed), and another in which the 4-tuple has been + * set as a result of a packet received, in which case we may be able to use + * the hash on the mbuf to avoid doing a software hash calculation for RSS. + * + * In each case: first, let the wildcard code have a go at placing it as a + * wildcard socket. If it was a wildcard, or if the connection has been + * dropped, then no pcbgroup is required (so potentially clear it); + * otherwise, calculate and update the pcbgroup for the inpcb. + */ +void +in_pcbgroup_update(struct inpcb *inp) +{ + struct inpcbinfo *pcbinfo; + struct inpcbgroup *newpcbgroup; + + INP_WLOCK_ASSERT(inp); + + pcbinfo = inp->inp_pcbinfo; + if (!in_pcbgroup_enabled(pcbinfo)) + return; + + in_pcbwild_update_internal(inp); + if (!(inp->inp_flags2 & INP_PCBGROUPWILD) && + !(inp->inp_flags & INP_DROPPED)) { +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6) + newpcbgroup = in6_pcbgroup_byinpcb(inp); + else +#endif + newpcbgroup = in_pcbgroup_byinpcb(inp); + } else + newpcbgroup = NULL; + in_pcbgroup_update_internal(pcbinfo, newpcbgroup, inp); +} + +void +in_pcbgroup_update_mbuf(struct inpcb *inp, struct mbuf *m) +{ + struct inpcbinfo *pcbinfo; + struct inpcbgroup *newpcbgroup; + + INP_WLOCK_ASSERT(inp); + + pcbinfo = inp->inp_pcbinfo; + if (!in_pcbgroup_enabled(pcbinfo)) + return; + + /* + * Possibly should assert !INP_PCBGROUPWILD rather than testing for + * it; presumably this function should never be called for anything + * other than non-wildcard socket? + */ + in_pcbwild_update_internal(inp); + if (!(inp->inp_flags2 & INP_PCBGROUPWILD) && + !(inp->inp_flags & INP_DROPPED)) { + newpcbgroup = in_pcbgroup_bymbuf(pcbinfo, m); +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6) { + if (newpcbgroup == NULL) + newpcbgroup = in6_pcbgroup_byinpcb(inp); + } else { +#endif + if (newpcbgroup == NULL) + newpcbgroup = in_pcbgroup_byinpcb(inp); +#ifdef INET6 + } +#endif + } else + newpcbgroup = NULL; + in_pcbgroup_update_internal(pcbinfo, newpcbgroup, inp); +} + +/* + * Remove pcbgroup entry and optional pcbgroup wildcard entry for this inpcb. + */ +void +in_pcbgroup_remove(struct inpcb *inp) +{ + struct inpcbgroup *pcbgroup; + + INP_WLOCK_ASSERT(inp); + + if (!in_pcbgroup_enabled(inp->inp_pcbinfo)) + return; + + if (inp->inp_flags2 & INP_PCBGROUPWILD) + in_pcbwild_remove(inp); + + pcbgroup = inp->inp_pcbgroup; + if (pcbgroup != NULL) { + INP_GROUP_LOCK(pcbgroup); + LIST_REMOVE(inp, inp_pcbgrouphash); + inp->inp_pcbgroup = NULL; + INP_GROUP_UNLOCK(pcbgroup); + } +} + +/* + * Query whether or not it is appropriate to use pcbgroups to look up inpcbs + * for a protocol. + */ +int +in_pcbgroup_enabled(struct inpcbinfo *pcbinfo) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 13: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 9ED151065670; Mon, 6 Jun 2011 13:08:51 +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 73A938FC19; Mon, 6 Jun 2011 13:08:51 +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 106C246B39; Mon, 6 Jun 2011 09:08:51 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 691858A01F; Mon, 6 Jun 2011 09:08:50 -0400 (EDT) From: John Baldwin To: Henrik Brix Andersen Date: Mon, 6 Jun 2011 08:44:49 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <201105291425.p4TEPggZ033861@svn.freebsd.org> <4DE9FEC4.4020507@FreeBSD.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201106060844.49421.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 06 Jun 2011 09:08:50 -0400 (EDT) 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: Mon, 06 Jun 2011 13:08:51 -0000 On Saturday, June 04, 2011 6:01:44 am Henrik Brix Andersen wrote: > 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) > > > > 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?). I would vote for the latter. It is what we do for the ISA bus when PnPBIOS or ACPI enumerate devices on it. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 13:12: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 A07EB1065679; Mon, 6 Jun 2011 13:12:56 +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 9050E8FC17; Mon, 6 Jun 2011 13:12: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 p56DCuM8032420; Mon, 6 Jun 2011 13:12:56 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56DCuqi032418; Mon, 6 Jun 2011 13:12:56 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201106061312.p56DCuqi032418@svn.freebsd.org> From: John Baldwin Date: Mon, 6 Jun 2011 13:12: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: r222750 - 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: Mon, 06 Jun 2011 13:12:56 -0000 Author: jhb Date: Mon Jun 6 13:12:56 2011 New Revision: 222750 URL: http://svn.freebsd.org/changeset/base/222750 Log: Clear the device_t pointer in 'struct resource' when releasing a device as otherwise the sysctl to export rman info can dereference a stale pointer. PR: kern/115371 Submitted by: Arthur Hartwig MFC after: 1 week Modified: head/sys/kern/subr_rman.c Modified: head/sys/kern/subr_rman.c ============================================================================== --- head/sys/kern/subr_rman.c Mon Jun 6 12:55:19 2011 (r222749) +++ head/sys/kern/subr_rman.c Mon Jun 6 13:12:56 2011 (r222750) @@ -839,6 +839,7 @@ int_rman_release_resource(struct rman *r * without freeing anything. */ r->r_flags &= ~RF_ALLOCATED; + r->r_dev = NULL; return 0; } From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 13:13: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 C6527106566C; Mon, 6 Jun 2011 13:13:48 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B653E8FC0C; Mon, 6 Jun 2011 13:13: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 p56DDm3r032481; Mon, 6 Jun 2011 13:13:48 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56DDmcF032479; Mon, 6 Jun 2011 13:13:48 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201106061313.p56DDmcF032479@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 6 Jun 2011 13:13: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: r222751 - head/sbin/rcorder X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 13:13:48 -0000 Author: gavin Date: Mon Jun 6 13:13:48 2011 New Revision: 222751 URL: http://svn.freebsd.org/changeset/base/222751 Log: Document that REQUIRES, PROVIDES and KEYWORDS are alos accepted. This chnage is different to the one suggested in the PR to try to avoid cluttering the man page too much. PR: docs/154494 Submitted by: kilian MFC after: 1 week Modified: head/sbin/rcorder/rcorder.8 Modified: head/sbin/rcorder/rcorder.8 ============================================================================== --- head/sbin/rcorder/rcorder.8 Mon Jun 6 13:12:56 2011 (r222750) +++ head/sbin/rcorder/rcorder.8 Mon Jun 6 13:13:48 2011 (r222751) @@ -89,6 +89,12 @@ and lines may appear, but all such lines must appear in a sequence without any intervening lines, as once a line that does not follow the format is reached, parsing stops. +Note that for historical reasons, +.Dq Li REQUIRES , +.Dq Li PROVIDES , +and +.Dq Li KEYWORDS +are also accepted in addition to the above. .Pp The options are as follows: .Bl -tag -width indent From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 13:18: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 12248106566B; Mon, 6 Jun 2011 13:18:30 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCB588FC1A; Mon, 6 Jun 2011 13:18: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 p56DITVs032666; Mon, 6 Jun 2011 13:18:29 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56DITNC032664; Mon, 6 Jun 2011 13:18:29 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201106061318.p56DITNC032664@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 6 Jun 2011 13:18: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: r222752 - head/sbin/rcorder X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 13:18:30 -0000 Author: gavin Date: Mon Jun 6 13:18:29 2011 New Revision: 222752 URL: http://svn.freebsd.org/changeset/base/222752 Log: Bump .Dd Forgotten by: gavin MFC after: 1 week Modified: head/sbin/rcorder/rcorder.8 Modified: head/sbin/rcorder/rcorder.8 ============================================================================== --- head/sbin/rcorder/rcorder.8 Mon Jun 6 13:13:48 2011 (r222751) +++ head/sbin/rcorder/rcorder.8 Mon Jun 6 13:18:29 2011 (r222752) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 9, 2008 +.Dd June 6, 2011 .Dt RCORDER 8 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 13:21: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 0103C106566B; Mon, 6 Jun 2011 13:21:12 +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 CB9118FC1B; Mon, 6 Jun 2011 13:21: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 p56DLBNx032784; Mon, 6 Jun 2011 13:21:11 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56DLBWn032781; Mon, 6 Jun 2011 13:21:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201106061321.p56DLBWn032781@svn.freebsd.org> From: John Baldwin Date: Mon, 6 Jun 2011 13:21: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: r222753 - in head/sys/dev: cardbus pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Jun 2011 13:21:12 -0000 Author: jhb Date: Mon Jun 6 13:21:11 2011 New Revision: 222753 URL: http://svn.freebsd.org/changeset/base/222753 Log: More properly handle Cardbus cards that that store their CIS in a BAR after the recent changes to track BAR state explicitly. The code would now attempt to add the same BAR twice in this case. Instead, change this so that it recognizes this case and only adds it once and do not delete the BAR outright after parsing the CIS. Tested by: bschmidt Modified: head/sys/dev/cardbus/cardbus_cis.c head/sys/dev/pci/pci.c Modified: head/sys/dev/cardbus/cardbus_cis.c ============================================================================== --- head/sys/dev/cardbus/cardbus_cis.c Mon Jun 6 13:18:29 2011 (r222752) +++ head/sys/dev/cardbus/cardbus_cis.c Mon Jun 6 13:21:11 2011 (r222753) @@ -324,7 +324,7 @@ decode_tuple_bar(device_t cbdev, device_ * hint when the cardbus bridge is a child of pci0 (the main * bus). The PC Card spec seems to indicate that this should * only be done on x86 based machines, which suggests that on - * non-x86 machines the adddresses can be anywhere. Since the + * non-x86 machines the addresses can be anywhere. Since the * hardware can do it on non-x86 machines, it should be able * to do it on x86 machines too. Therefore, we can and should * ignore this hint. Furthermore, the PC Card spec recommends @@ -430,7 +430,6 @@ cardbus_read_tuple_finish(device_t cbdev { if (res != CIS_CONFIG_SPACE) { bus_release_resource(child, SYS_RES_MEMORY, rid, res); - bus_delete_resource(child, SYS_RES_MEMORY, rid); } } @@ -467,7 +466,7 @@ cardbus_read_tuple_init(device_t cbdev, } /* allocate the memory space to read CIS */ - res = bus_alloc_resource(child, SYS_RES_MEMORY, rid, 0, ~0, 1, + res = bus_alloc_resource_any(child, SYS_RES_MEMORY, rid, rman_make_alignment_flags(4096) | RF_ACTIVE); if (res == NULL) { device_printf(cbdev, "Unable to allocate resource " Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Mon Jun 6 13:18:29 2011 (r222752) +++ head/sys/dev/pci/pci.c Mon Jun 6 13:21:11 2011 (r222753) @@ -2576,6 +2576,17 @@ pci_add_map(device_t bus, device_t dev, uint16_t cmd; struct resource *res; + /* + * The BAR may already exist if the device is a CardBus card + * whose CIS is stored in this BAR. + */ + pm = pci_find_bar(dev, reg); + if (pm != NULL) { + maprange = pci_maprange(pm->pm_value); + barlen = maprange == 64 ? 2 : 1; + return (barlen); + } + pci_read_bar(dev, reg, &map, &testval); if (PCI_BAR_MEM(map)) { type = SYS_RES_MEMORY; From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 13:24: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 9E8B610656D3; Mon, 6 Jun 2011 13:24:54 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E9518FC2A; Mon, 6 Jun 2011 13:24: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 p56DOsiE032934; Mon, 6 Jun 2011 13:24:54 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56DOsfu032932; Mon, 6 Jun 2011 13:24:54 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201106061324.p56DOsfu032932@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 6 Jun 2011 13:24: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: r222754 - head/sbin/mount X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 13:24:54 -0000 Author: gavin Date: Mon Jun 6 13:24:54 2011 New Revision: 222754 URL: http://svn.freebsd.org/changeset/base/222754 Log: Add another example to mount(8) on using the "-o" argument. PR: docs/157389 Submitted by: Warren Block MFC after: 1 week Modified: head/sbin/mount/mount.8 Modified: head/sbin/mount/mount.8 ============================================================================== --- head/sbin/mount/mount.8 Mon Jun 6 13:21:11 2011 (r222753) +++ head/sbin/mount/mount.8 Mon Jun 6 13:24:54 2011 (r222754) @@ -28,7 +28,7 @@ .\" @(#)mount.8 8.8 (Berkeley) 6/16/94 .\" $FreeBSD$ .\" -.Dd April 28, 2011 +.Dd June 6, 2011 .Dt MOUNT 8 .Os .Sh NAME @@ -348,7 +348,6 @@ option) may be passed as a comma separat distinguished by a leading .Dq \&- (dash). -Options that take a value are specified using the syntax -option=value. For example, the .Nm command: @@ -363,6 +362,16 @@ to execute the equivalent of: /sbin/mount_cd9660 -e /dev/cd0 /cdrom .Ed .Pp +Options that take a value are specified using the -option=value syntax: +.Bd -literal -offset indent +mount -t msdosfs -o -u=fred,-g=wheel /dev/da0s1 /mnt +.Ed +.Pp +is equivalent to +.Bd -literal -offset indent +/sbin/mount_msdosfs -u fred -g wheel /dev/da0s1 /mnt +.Ed +.Pp Additional options specific to file system types which are not internally known (see the description of the From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 13:50: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 551261065670; Mon, 6 Jun 2011 13:50:30 +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 451FC8FC1E; Mon, 6 Jun 2011 13:50: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 p56DoU5K033735; Mon, 6 Jun 2011 13:50:30 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56DoUdA033733; Mon, 6 Jun 2011 13:50:30 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201106061350.p56DoUdA033733@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 6 Jun 2011 13:50: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: r222755 - head/usr.bin/calendar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 13:50:30 -0000 Author: jh Date: Mon Jun 6 13:50:29 2011 New Revision: 222755 URL: http://svn.freebsd.org/changeset/base/222755 Log: Pass correct size to write(2). PR: bin/155915 Submitted by: John Levine MFC after: 2 weeks Modified: head/usr.bin/calendar/io.c Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Mon Jun 6 13:24:54 2011 (r222754) +++ head/usr.bin/calendar/io.c Mon Jun 6 13:50:29 2011 (r222755) @@ -346,7 +346,7 @@ closecal(FILE *fp) write(pdes[1], pw->pw_name, strlen(pw->pw_name)); write(pdes[1], ">\nTo: <", 7); write(pdes[1], pw->pw_name, strlen(pw->pw_name)); - write(pdes[1], ">\nSubject: ", 12); + write(pdes[1], ">\nSubject: ", 11); write(pdes[1], dayname, strlen(dayname)); write(pdes[1], "'s Calendar\nPrecedence: bulk\n\n", 30); From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 14:02: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 63BA91065674; Mon, 6 Jun 2011 14:02:59 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115]) by mx1.freebsd.org (Postfix) with ESMTP id 12F5D8FC18; Mon, 6 Jun 2011 14:02:58 +0000 (UTC) Received: from a91-153-123-205.elisa-laajakaista.fi (a91-153-123-205.elisa-laajakaista.fi [91.153.123.205]) by gw01.mail.saunalahti.fi (Postfix) with SMTP id 3B179151685; Mon, 6 Jun 2011 17:02:52 +0300 (EEST) Date: Mon, 6 Jun 2011 17:02:51 +0300 From: Jaakko Heinonen To: Hiroki Sato Message-ID: <20110606140251.GA2089@a91-153-123-205.elisa-laajakaista.fi> References: <201106060306.p5636hR5008901@svn.freebsd.org> <4DEC9EC1.9070206@FreeBSD.org> <20110606.195348.722786496150655516.hrs@allbsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110606.195348.722786496150655516.hrs@allbsd.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, dim@FreeBSD.org Subject: Re: svn commit: r222732 - in head: sys/netinet usr.sbin/rtadvd usr.sbin/rtsold X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 14:02:59 -0000 On 2011-06-06, Hiroki Sato wrote: > di> > -WARNS?= 1 > di> > +WARNS?= 6 Shouldn't you just remove the WARNS line because the default for usr.sbin/ is 6? -- Jaakko From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 14:23: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 A16AA106566B; Mon, 6 Jun 2011 14:23:13 +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 9115F8FC0A; Mon, 6 Jun 2011 14:23: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 p56ENDY6034879; Mon, 6 Jun 2011 14:23:13 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56ENDKi034876; Mon, 6 Jun 2011 14:23:13 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201106061423.p56ENDKi034876@svn.freebsd.org> From: Andriy Gapon Date: Mon, 6 Jun 2011 14:23: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: r222756 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 14:23:13 -0000 Author: avg Date: Mon Jun 6 14:23:13 2011 New Revision: 222756 URL: http://svn.freebsd.org/changeset/base/222756 Log: don't use cpuid level 4 in x86 cpu topology detection if it's not supported This regression was introduced in r213323. There are probably no Intel cpus that support amd64 mode, but do not support cpuid level 4, but it's better to keep i386 and amd64 versions of this code in sync. Discovered by: pho Tested by: pho MFC after: 2 weeks Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/i386/i386/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Mon Jun 6 13:50:29 2011 (r222755) +++ head/sys/amd64/amd64/mp_machdep.c Mon Jun 6 14:23:13 2011 (r222756) @@ -241,8 +241,11 @@ topo_probe_0x4(void) * logical processors that belong to the same core * as BSP thus deducing number of threads per core. */ - cpuid_count(0x04, 0, p); - max_cores = ((p[0] >> 26) & 0x3f) + 1; + if (cpu_high >= 0x4) { + cpuid_count(0x04, 0, p); + max_cores = ((p[0] >> 26) & 0x3f) + 1; + } else + max_cores = 1; core_id_bits = mask_width(max_logical/max_cores); if (core_id_bits < 0) return; Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Mon Jun 6 13:50:29 2011 (r222755) +++ head/sys/i386/i386/mp_machdep.c Mon Jun 6 14:23:13 2011 (r222756) @@ -289,8 +289,11 @@ topo_probe_0x4(void) * logical processors that belong to the same core * as BSP thus deducing number of threads per core. */ - cpuid_count(0x04, 0, p); - max_cores = ((p[0] >> 26) & 0x3f) + 1; + if (cpu_high >= 0x4) { + cpuid_count(0x04, 0, p); + max_cores = ((p[0] >> 26) & 0x3f) + 1; + } else + max_cores = 1; core_id_bits = mask_width(max_logical/max_cores); if (core_id_bits < 0) return; From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 14:46: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 1FFEF1065672; Mon, 6 Jun 2011 14:46:44 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FDA88FC18; Mon, 6 Jun 2011 14:46: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 p56Ekhst035617; Mon, 6 Jun 2011 14:46:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56EkhXn035615; Mon, 6 Jun 2011 14:46:43 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201106061446.p56EkhXn035615@svn.freebsd.org> From: Martin Matuska Date: Mon, 6 Jun 2011 14:46: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: r222757 - head/sys/cddl/compat/opensolaris/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Jun 2011 14:46:44 -0000 Author: mm Date: Mon Jun 6 14:46:43 2011 New Revision: 222757 URL: http://svn.freebsd.org/changeset/base/222757 Log: Remove empty #ifndef MFC after: 3 days Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/atomic.h Mon Jun 6 14:23:13 2011 (r222756) +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Mon Jun 6 14:46:43 2011 (r222757) @@ -40,8 +40,6 @@ extern void atomic_add_64(volatile uint64_t *target, int64_t delta); extern void atomic_dec_64(volatile uint64_t *target); #endif -#ifndef __LP64__ -#endif #ifndef __sparc64__ extern uint32_t atomic_cas_32(volatile uint32_t *target, uint32_t cmp, uint32_t newval); From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 15:17: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 1B4B5106564A; Mon, 6 Jun 2011 15:17:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BAC28FC15; Mon, 6 Jun 2011 15:17: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 p56FHtc5036595; Mon, 6 Jun 2011 15:17:55 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56FHtrT036593; Mon, 6 Jun 2011 15:17:55 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201106061517.p56FHtrT036593@svn.freebsd.org> From: Glen Barber Date: Mon, 6 Jun 2011 15:17: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: r222758 - head/usr.bin/su X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 15:17:56 -0000 Author: gjb (doc committer) Date: Mon Jun 6 15:17:55 2011 New Revision: 222758 URL: http://svn.freebsd.org/changeset/base/222758 Log: Document that when running 'su -m -c ', is run within a shell as . PR: 157078 Submitted by: Warren Block MFC after: 5 days Modified: head/usr.bin/su/su.1 Modified: head/usr.bin/su/su.1 ============================================================================== --- head/usr.bin/su/su.1 Mon Jun 6 14:46:43 2011 (r222757) +++ head/usr.bin/su/su.1 Mon Jun 6 15:17:55 2011 (r222758) @@ -193,10 +193,10 @@ PAM configuration for .Sh EXAMPLES .Bl -tag -width 5n -compact .It Li "su -m man -c catman" -Runs the command -.Li catman -as user -.Li man . +Starts a shell as user +.Li man , +and runs the command +.Li catman . You will be asked for man's password unless your real UID is 0. Note that the .Fl m From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 15:21: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 385E2106564A; Mon, 6 Jun 2011 15:21:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F5878FC08; Mon, 6 Jun 2011 15:21: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 p56FLrn5036757; Mon, 6 Jun 2011 15:21:53 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56FLriS036755; Mon, 6 Jun 2011 15:21:53 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201106061521.p56FLriS036755@svn.freebsd.org> From: Glen Barber Date: Mon, 6 Jun 2011 15:21: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: r222759 - head/usr.bin/su X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 15:21:54 -0000 Author: gjb (doc committer) Date: Mon Jun 6 15:21:53 2011 New Revision: 222759 URL: http://svn.freebsd.org/changeset/base/222759 Log: Bump date from previous commit. :( MFC after: 5 days Modified: head/usr.bin/su/su.1 Modified: head/usr.bin/su/su.1 ============================================================================== --- head/usr.bin/su/su.1 Mon Jun 6 15:17:55 2011 (r222758) +++ head/usr.bin/su/su.1 Mon Jun 6 15:21:53 2011 (r222759) @@ -28,7 +28,7 @@ .\" @(#)su.1 8.2 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd July 1, 2008 +.Dd June 6, 2011 .Dt SU 1 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 15:33: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 334D7106566C; Mon, 6 Jun 2011 15:33:16 +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 238A48FC12; Mon, 6 Jun 2011 15:33: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 p56FXGbU037186; Mon, 6 Jun 2011 15:33:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56FXG2r037184; Mon, 6 Jun 2011 15:33:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201106061533.p56FXG2r037184@svn.freebsd.org> From: John Baldwin Date: Mon, 6 Jun 2011 15:33: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: r222760 - 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: Mon, 06 Jun 2011 15:33:16 -0000 Author: jhb Date: Mon Jun 6 15:33:15 2011 New Revision: 222760 URL: http://svn.freebsd.org/changeset/base/222760 Log: Some style fixes. Submitted by: bde Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Mon Jun 6 15:21:53 2011 (r222759) +++ head/sys/dev/puc/pucdata.c Mon Jun 6 15:33:15 2011 (r222760) @@ -51,12 +51,12 @@ static puc_config_f puc_config_amc; 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_oxford_pcie; static puc_config_f puc_config_quatech; static puc_config_f puc_config_syba; static puc_config_f puc_config_siig; static puc_config_f puc_config_timedia; static puc_config_f puc_config_titan; -static puc_config_f puc_config_oxford_pcie; const struct puc_cfg puc_pci_devices[] = { @@ -1366,14 +1366,12 @@ puc_config_oxford_pcie(struct puc_softc bar = puc_get_bar(sc, cfg->rid); if (bar == NULL) return (ENXIO); - for (idx = 0; idx < sc->sc_nports; idx++) { - value = bus_read_1(bar->b_res, 0x1000 + (idx << 9) - + 0x92); + value = bus_read_1(bar->b_res, 0x1000 + (idx << 9) + + 0x92); bus_write_1(bar->b_res, 0x1000 + (idx << 9) + 0x92, - value | 0x10); + value | 0x10); } - return (0); case PUC_CFG_GET_LEN: *res = 0x200; From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 16:27: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 B9CD51065670; Mon, 6 Jun 2011 16:27:38 +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 AA05C8FC15; Mon, 6 Jun 2011 16:27: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 p56GRcIn039079; Mon, 6 Jun 2011 16:27:38 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56GRcLw039077; Mon, 6 Jun 2011 16:27:38 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201106061627.p56GRcLw039077@svn.freebsd.org> From: Warner Losh Date: Mon, 6 Jun 2011 16:27: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: r222764 - head/sys/dev/pccard X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 16:27:38 -0000 Author: imp Date: Mon Jun 6 16:27:38 2011 New Revision: 222764 URL: http://svn.freebsd.org/changeset/base/222764 Log: Make a couple of debug printfs DEVPRINTF. Modified: head/sys/dev/pccard/pccard.c Modified: head/sys/dev/pccard/pccard.c ============================================================================== --- head/sys/dev/pccard/pccard.c Mon Jun 6 16:17:56 2011 (r222763) +++ head/sys/dev/pccard/pccard.c Mon Jun 6 16:27:38 2011 (r222764) @@ -1405,8 +1405,8 @@ pccard_ccr_read_impl(device_t brdev, dev struct pccard_ivar *devi = PCCARD_IVAR(child); *val = pccard_ccr_read(devi->pf, offset); - device_printf(child, "ccr_read of %#x (%#x) is %#x\n", offset, - devi->pf->pf_ccr_offset, *val); + DEVPRINTF((child, "ccr_read of %#x (%#x) is %#x\n", offset, + devi->pf->pf_ccr_offset, *val)); return 0; } @@ -1421,8 +1421,8 @@ pccard_ccr_write_impl(device_t brdev, de * Can't use pccard_ccr_write since client drivers may access * registers not contained in the 'mask' if they are non-standard. */ - device_printf(child, "ccr_write of %#x to %#x (%#x)\n", val, offset, - devi->pf->pf_ccr_offset); + DEVPRINTF((child, "ccr_write of %#x to %#x (%#x)\n", val, offset, + devi->pf->pf_ccr_offset)); bus_space_write_1(pf->pf_ccrt, pf->pf_ccrh, pf->pf_ccr_offset + offset, val); return 0; From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 17: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 E3B21106566C; Mon, 6 Jun 2011 17:07:38 +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 D3D5B8FC08; Mon, 6 Jun 2011 17:07: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 p56H7c0b040285; Mon, 6 Jun 2011 17:07:38 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56H7ckw040283; Mon, 6 Jun 2011 17:07:38 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201106061707.p56H7ckw040283@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 6 Jun 2011 17:07: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: r222765 - head/usr.sbin/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, 06 Jun 2011 17:07:39 -0000 Author: bz Date: Mon Jun 6 17:07:38 2011 New Revision: 222765 URL: http://svn.freebsd.org/changeset/base/222765 Log: Include param.h for CACHE_LINE_SIZE to unbreak the build. Modified: head/usr.sbin/tcpdrop/tcpdrop.c Modified: head/usr.sbin/tcpdrop/tcpdrop.c ============================================================================== --- head/usr.sbin/tcpdrop/tcpdrop.c Mon Jun 6 16:27:38 2011 (r222764) +++ head/usr.sbin/tcpdrop/tcpdrop.c Mon Jun 6 17:07:38 2011 (r222765) @@ -20,12 +20,13 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include #include -#include +#include #include #define TCPSTATES #include From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 17:53: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 2F74B106564A; Mon, 6 Jun 2011 17:53:20 +0000 (UTC) (envelope-from inyaoo@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 5E9898FC12; Mon, 6 Jun 2011 17:53:18 +0000 (UTC) Received: by wyf23 with SMTP id 23so4126136wyf.13 for ; Mon, 06 Jun 2011 10:53:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=6wNMt+2IBH1Y7MJQKxeYN1IURa6QVLaau2dCoGGJOvc=; b=CBcsGotcjC0F90aKL/9o+HIRriP2daU120/FedN7B98Y5ywEQJl2v/VID23efjSTx+ oOh2prptQzMQEknHC7hd5KrAK4z+mQI9WhLg/IPdb1ljeC8Ov1zlJfqj8TzIfglTMQPy mIyeLKIjBcq82BQ11AJ7suY0LewxJdct1oqaA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=pHtN2HLhu01uXH4mLnnaX8ZoFvc508YepXnkqWASUmkpM99aER54tKBLdUsExUg7y4 4drGwkqZKwxZyjdg7pCtu8cfcIZ/Z3NU5y9mrtd4xK/UBCDET7UH95kngjAdsfrDPnZ5 Zwzurdu3oV7HpLb45DbJlyojdmFSwAxOBw2RE= Received: by 10.216.132.133 with SMTP id o5mr2690095wei.94.1307382797922; Mon, 06 Jun 2011 10:53:17 -0700 (PDT) Received: from localhost (84-74-176-234.dclient.hispeed.ch [84.74.176.234]) by mx.google.com with ESMTPS id b70sm2440036wek.20.2011.06.06.10.53.14 (version=SSLv3 cipher=OTHER); Mon, 06 Jun 2011 10:53:16 -0700 (PDT) From: Pan Tsu To: Robert Watson References: <201106061255.p56Ct3qN031795__3239.16238635338$1307364936$gmane$org@svn.freebsd.org> Date: Mon, 06 Jun 2011 21:53:06 +0400 In-Reply-To: <201106061255.p56Ct3qN031795__3239.16238635338$1307364936$gmane$org@svn.freebsd.org> (Robert Watson's message of "Mon, 6 Jun 2011 12:55:03 +0000 (UTC)") Message-ID: <86y61ehmnx.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222748 - in head/sys: conf 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, 06 Jun 2011 17:53:20 -0000 Robert Watson writes: > Author: rwatson > Date: Mon Jun 6 12:55:02 2011 > New Revision: 222748 > URL: http://svn.freebsd.org/changeset/base/222748 > > Log: [...] > Connection group support is enabled by compiling "options PCBGROUP" > into your kernel configuration; for the time being, this is an > experimental feature, and hence is not enabled by default. Doesn't build with "nooption WITNESS" as in6_pcbgroup.c relies on including unconditionally, e.g. $ make -s buildkernel [...] -------------------------------------------------------------- >>> stage 3.1: making dependencies -------------------------------------------------------------- In file included from /usr/src/sys/netinet/in_pcb.h:47, from /usr/src/sys/netinet6/in6_pcbgroup.c:40: /usr/src/sys/sys/rwlock.h:152:2: error: #error LOCK_DEBUG not defined, include before mkdep: compile failed *** Error code 1 From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 18:07: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 E39D9106564A; Mon, 6 Jun 2011 18:07:28 +0000 (UTC) (envelope-from kaduk@mit.edu) Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU [18.9.25.14]) by mx1.freebsd.org (Postfix) with ESMTP id 5ADC58FC12; Mon, 6 Jun 2011 18:07:27 +0000 (UTC) X-AuditID: 1209190e-b7c39ae000000a8c-06-4ded13cc392e Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP id A2.6A.02700.CC31DED4; Mon, 6 Jun 2011 13:52:12 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id p56HqPit028383; Mon, 6 Jun 2011 13:52:25 -0400 Received: from multics.mit.edu (MULTICS.MIT.EDU [18.187.1.73]) (authenticated bits=56) (User authenticated as kaduk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p56HqNcm005156 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 6 Jun 2011 13:52:25 -0400 (EDT) Received: (from kaduk@localhost) by multics.mit.edu (8.12.9.20060308) id p56HqMHn029605; Mon, 6 Jun 2011 13:52:22 -0400 (EDT) Date: Mon, 6 Jun 2011 13:52:21 -0400 (EDT) From: Benjamin Kaduk To: Jilian Elischer In-Reply-To: Message-ID: References: <201106042331.p54NVfC0030751@svn.freebsd.org> <4DEB3C32.9070709@freebsd.org> User-Agent: Alpine 1.10 (GSO 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIIsWRmVeSWpSXmKPExsUixCmqrXtG+K2vwd3d4hZX5/5ktvjTPoXF 4s+mhawWTV8WMDmweMz4NJ8lgDGKyyYlNSezLLVI3y6BK+PevOvsBdOYK159Os3UwLiLqYuR k0NCwETi+PS9jBC2mMSFe+vZQGwhgX2MEsteCXUxcgHZ6xklHh49xwKR2M8ksei0O4RdL3Hh xm2wZhYBLYmmhvPMIDabgIrEzDcbwQaJCGhIXJv6B6yGWSBKYvG2PrAaYQF9iU0/noHFOQUc JT7caGAFsXkFHCTePmpmhljcyyjxZeIVdpCEqICOxOr9U1ggigQlTs58wgIx1FLi39pfrBMY BWchSc1CklrAyLSKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI11gvN7NELzWldBMjOGQl+XYwfj2o dIhRgINRiYf30Zc3vkKsiWXFlbmHGCU5mJREeQuF3voK8SXlp1RmJBZnxBeV5qQWH2KU4GBW EuGNfwNUzpuSWFmVWpQPk5LmYFES550pqe4rJJCeWJKanZpakFoEk5Xh4FCS4DUExqaQYFFq empFWmZOCUKaiYMTZDgP0PB5HEA1vMUFibnFmekQ+VOMilLivIIgzQIgiYzSPLheWEp5xSgO 9IowrzZIFQ8wHcF1vwIazAQ0+LjTK5DBJYkIKakGxim6jJ+n1wsY5ZfMXT43M8Z699bwrSum r9y+/aHzQbcMu2elE31Lg7e8kj2+ZYebBCs3n+tD15uJs6ZOP9fPunzut5wqqdO9AnHHwn4G FLXp5XCF+My/lGgmHPQype7vKqXdKpHCnjs+LnX/IB1VHit0o7eX8U3cKz39Gwc9g7q0LbL9 27udlFiKMxINtZiLihMBhKM7gQQDAAA= Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: 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: Mon, 06 Jun 2011 18:07:29 -0000 > On 6/5/11 4:20 AM, Julian Elischer wrote: > > hmm note that my stealing of 4 bits for FIB was supposed to go away > for 8 and beyond. Hmm, perhaps my patch to setfib.2 in http://www.freebsd.org/cgi/query-pr.cgi?pr=docs/157453 is not quite right, then. Do you have any comments on it? Thanks, Ben Kaduk > We need to do an mbuf redesign.. at this stage, I guess it's a project for 10. From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 18:11: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 8B4AC106566C; Mon, 6 Jun 2011 18:11:41 +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 19C948FC18; Mon, 6 Jun 2011 18:11:41 +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 295E825D3870; Mon, 6 Jun 2011 18:11:40 +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 5EC0D15A032E; Mon, 6 Jun 2011 18:11:39 +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 JrUTGECs3LUa; Mon, 6 Jun 2011 18:11:38 +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 41C5A159EDFC; Mon, 6 Jun 2011 18:11:38 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <86y61ehmnx.fsf@gmail.com> Date: Mon, 6 Jun 2011 18:11:37 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <728B04A6-7C27-43D5-BAB5-71EBC5F6622A@FreeBSD.org> References: <201106061255.p56Ct3qN031795__3239.16238635338$1307364936$gmane$org@svn.freebsd.org> <86y61ehmnx.fsf@gmail.com> To: Pan Tsu X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson Subject: Re: svn commit: r222748 - in head/sys: conf 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, 06 Jun 2011 18:11:41 -0000 On Jun 6, 2011, at 5:53 PM, Pan Tsu wrote: > Robert Watson writes: >=20 >> Author: rwatson >> Date: Mon Jun 6 12:55:02 2011 >> New Revision: 222748 >> URL: http://svn.freebsd.org/changeset/base/222748 >>=20 >> Log: > [...] >> Connection group support is enabled by compiling "options PCBGROUP" >> into your kernel configuration; for the time being, this is an >> experimental feature, and hence is not enabled by default. >=20 > Doesn't build with "nooption WITNESS" as in6_pcbgroup.c relies on > including unconditionally, e.g. >=20 > $ make -s buildkernel > [...] > -------------------------------------------------------------- >>>> stage 3.1: making dependencies > -------------------------------------------------------------- > In file included from /usr/src/sys/netinet/in_pcb.h:47, > from /usr/src/sys/netinet6/in6_pcbgroup.c:40: > /usr/src/sys/sys/rwlock.h:152:2: error: #error LOCK_DEBUG not = defined, include before > mkdep: compile failed > *** Error code 1 I'll fix it soon. --=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 Jun 6 18: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 0F0311065686; Mon, 6 Jun 2011 18:25:12 +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 F35D78FC08; Mon, 6 Jun 2011 18:25:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p56IPBMx042619; Mon, 6 Jun 2011 18:25:11 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56IPBG2042617; Mon, 6 Jun 2011 18:25:11 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201106061825.p56IPBG2042617@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 6 Jun 2011 18:25:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222766 - head/release/ia64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 18:25:12 -0000 Author: marcel Date: Mon Jun 6 18:25:11 2011 New Revision: 222766 URL: http://svn.freebsd.org/changeset/base/222766 Log: Don't clobber the hosts /etc/fstab. $1 is empty at this point. Modified: head/release/ia64/mkisoimages.sh Modified: head/release/ia64/mkisoimages.sh ============================================================================== --- head/release/ia64/mkisoimages.sh Mon Jun 6 17:07:38 2011 (r222765) +++ head/release/ia64/mkisoimages.sh Mon Jun 6 18:25:11 2011 (r222766) @@ -72,8 +72,8 @@ else BOOTOPTS="" fi -echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab +echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $BASE/etc/fstab makefs -t cd9660 $BOOTOPTS -o rockridge -o label=$LABEL $NAME $BASE $* +rm $BASE/etc/fstab rm -f $EFIPART -rm $1/etc/fstab exit 0 From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 18:40: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 CBB791065672; Mon, 6 Jun 2011 18:40:01 +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 AA1718FC08; Mon, 6 Jun 2011 18:40: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 p56Ie1N3043077; Mon, 6 Jun 2011 18:40:01 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56Ie1FG043075; Mon, 6 Jun 2011 18:40:01 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201106061840.p56Ie1FG043075@svn.freebsd.org> From: Ed Schouten Date: Mon, 6 Jun 2011 18:40: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: r222767 - head/usr.sbin/lastlogin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 18:40:01 -0000 Author: ed Date: Mon Jun 6 18:40:01 2011 New Revision: 222767 URL: http://svn.freebsd.org/changeset/base/222767 Log: Allow custom files to be opened and allow sorting by timestamp. While implementing a tool to import lastlog entries into utmpx, I noticed lastlogin doesn't allow custom database files to be opened. Add a -f switch to support this. Also, add -r and -t similar to ls(1), ruptime(1), etc. where you can sort entries by timestamp and reverse them. This allows you to spot active/idle users more easily. Modified: head/usr.sbin/lastlogin/lastlogin.8 head/usr.sbin/lastlogin/lastlogin.c Modified: head/usr.sbin/lastlogin/lastlogin.8 ============================================================================== --- head/usr.sbin/lastlogin/lastlogin.8 Mon Jun 6 18:25:11 2011 (r222766) +++ head/usr.sbin/lastlogin/lastlogin.8 Mon Jun 6 18:40:01 2011 (r222767) @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 11, 1996 +.Dd June 6, 2011 .Dt LASTLOGIN 8 .Os .Sh NAME @@ -39,6 +39,8 @@ .Nd indicate last login time of users .Sh SYNOPSIS .Nm +.Op Fl f Ar file +.Op Fl rt .Op Ar user ... .Sh DESCRIPTION The @@ -54,8 +56,8 @@ If more than one .Ar user is given, the session information for each user is printed in the order given on the command line. -Otherwise, information -for all users is printed, sorted by name. +Otherwise, information for all users is printed. +By default, the entries are sorted by user name. .Pp The .Nm @@ -63,6 +65,18 @@ utility differs from .Xr last 1 in that it only prints information regarding the very last login session. The last login database is never turned over or deleted in standard usage. +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl f Ar file +Open last login database +.Ar file +instead of the system-wide database. +.It Fl r +Print the entries in reverse sorted order. +.It Fl t +Sort the elements by last login time, instead of user name. +.El .Sh FILES .Bl -tag -width /var/log/utx.lastlogin -compact .It Pa /var/log/utx.lastlogin Modified: head/usr.sbin/lastlogin/lastlogin.c ============================================================================== --- head/usr.sbin/lastlogin/lastlogin.c Mon Jun 6 18:25:11 2011 (r222766) +++ head/usr.sbin/lastlogin/lastlogin.c Mon Jun 6 18:40:01 2011 (r222767) @@ -47,30 +47,59 @@ __RCSID("$NetBSD: lastlogin.c,v 1.4 1998 int main(int, char **); static void output(struct utmpx *); static void usage(void); +static int utcmp_user(const void *, const void *); + +static int order = 1; +static const char *file = NULL; +static int (*utcmp)(const void *, const void *) = utcmp_user; static int -utcmp(const void *u1, const void *u2) +utcmp_user(const void *u1, const void *u2) { - return (strcmp(((const struct utmpx *)u1)->ut_user, + return (order * strcmp(((const struct utmpx *)u1)->ut_user, ((const struct utmpx *)u2)->ut_user)); } +static int +utcmp_time(const void *u1, const void *u2) +{ + time_t t1, t2; + + t1 = ((const struct utmpx *)u1)->ut_tv.tv_sec; + t2 = ((const struct utmpx *)u2)->ut_tv.tv_sec; + return (t1 < t2 ? order : t1 > t2 ? -order : 0); +} + int main(int argc, char *argv[]) { int ch, i, ulistsize; struct utmpx *u, *ulist; - while ((ch = getopt(argc, argv, "")) != -1) { - usage(); + while ((ch = getopt(argc, argv, "f:rt")) != -1) { + switch (ch) { + case 'f': + file = optarg; + break; + case 'r': + order = -1; + break; + case 't': + utcmp = utcmp_time; + break; + default: + usage(); + } } + argc -= optind; + argv += optind; - /* Process usernames given on the command line. */ - if (argc > 1) { - for (i = 1; i < argc; ++i) { - if (setutxdb(UTXDB_LASTLOGIN, NULL) != 0) - errx(1, "failed to open lastlog database"); + if (argc > 0) { + /* Process usernames given on the command line. */ + for (i = 0; i < argc; i++) { + if (setutxdb(UTXDB_LASTLOGIN, file) != 0) + err(1, "failed to open lastlog database"); if ((u = getutxuser(argv[i])) == NULL) { warnx("user '%s' not found", argv[i]); continue; @@ -78,11 +107,10 @@ main(int argc, char *argv[]) output(u); endutxent(); } - } - /* Read all lastlog entries, looking for active ones */ - else { - if (setutxdb(UTXDB_LASTLOGIN, NULL) != 0) - errx(1, "failed to open lastlog database"); + } else { + /* Read all lastlog entries, looking for active ones. */ + if (setutxdb(UTXDB_LASTLOGIN, file) != 0) + err(1, "failed to open lastlog database"); ulist = NULL; ulistsize = 0; while ((u = getutxent()) != NULL) { @@ -119,6 +147,6 @@ output(struct utmpx *u) static void usage(void) { - fprintf(stderr, "usage: lastlogin [user ...]\n"); + fprintf(stderr, "usage: lastlogin [-f file] [-rt] [user ...]\n"); exit(1); } From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 19:00: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 C98101065772; Mon, 6 Jun 2011 19:00:38 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B95A58FC08; Mon, 6 Jun 2011 19:00: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 p56J0csY043745; Mon, 6 Jun 2011 19:00:38 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56J0c1H043743; Mon, 6 Jun 2011 19:00:38 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201106061900.p56J0c1H043743@svn.freebsd.org> From: Dmitry Chagin Date: Mon, 6 Jun 2011 19:00: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: r222768 - head/usr.bin/kdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 19:00:38 -0000 Author: dchagin Date: Mon Jun 6 19:00:38 2011 New Revision: 222768 URL: http://svn.freebsd.org/changeset/base/222768 Log: Fix regex for ptraceopname(). PR: bin/157663 Submitted by: jason wright MFC after: 10 days Modified: head/usr.bin/kdump/mksubr Modified: head/usr.bin/kdump/mksubr ============================================================================== --- head/usr.bin/kdump/mksubr Mon Jun 6 18:40:01 2011 (r222767) +++ head/usr.bin/kdump/mksubr Mon Jun 6 19:00:38 2011 (r222768) @@ -345,7 +345,7 @@ auto_if_type "sockfamilyname" "AF_[[:aln auto_if_type "sockipprotoname" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h" auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" auto_switch_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h" -auto_switch_type "ptraceopname" "PT_[[:alnum:]]+[[:space:]]+[0-9]+" "sys/ptrace.h" +auto_switch_type "ptraceopname" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h" cat <<_EOF_ /* From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 19:06: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 4766A1065692; Mon, 6 Jun 2011 19:06:16 +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 2CC688FC17; Mon, 6 Jun 2011 19:06: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 p56J6Gc4043947; Mon, 6 Jun 2011 19:06:16 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56J6GiN043943; Mon, 6 Jun 2011 19:06:16 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201106061906.p56J6GiN043943@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 6 Jun 2011 19:06: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: r222769 - in head/sys/ia64: acpica ia64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 19:06:16 -0000 Author: marcel Date: Mon Jun 6 19:06:15 2011 New Revision: 222769 URL: http://svn.freebsd.org/changeset/base/222769 Log: Improve cpu_idle(): o cpu_idle_hook is expected to be called with interrupts disabled and re-enables interrupts on return. o sync with x86: don't idle when the CPU has runnable tasks o have callers of ia64_call_pal_static() disable interrupts and re-enable interrupts. o add, but compile-out, support for idle mode. This will be enabled at some later time, after proper testing. Modified: head/sys/ia64/acpica/acpi_machdep.c head/sys/ia64/ia64/machdep.c head/sys/ia64/ia64/pal.S Modified: head/sys/ia64/acpica/acpi_machdep.c ============================================================================== --- head/sys/ia64/acpica/acpi_machdep.c Mon Jun 6 19:00:38 2011 (r222768) +++ head/sys/ia64/acpica/acpi_machdep.c Mon Jun 6 19:06:15 2011 (r222769) @@ -56,7 +56,14 @@ acpi_machdep_quirks(int *quirks) void acpi_cpu_c1() { +#ifdef INVARIANTS + register_t ie; + + ie = intr_disable(); + KASSERT(ie == 0, ("%s called with interrupts enabled\n", __func__)); +#endif ia64_call_pal_static(PAL_HALT_LIGHT, 0, 0, 0); + ia64_enable_intr(); } void * Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Mon Jun 6 19:00:38 2011 (r222768) +++ head/sys/ia64/ia64/machdep.c Mon Jun 6 19:06:15 2011 (r222769) @@ -411,12 +411,34 @@ cpu_halt() void cpu_idle(int busy) { - struct ia64_pal_result res; + register_t ie; - if (cpu_idle_hook != NULL) +#if 0 + if (!busy) { + critical_enter(); + cpu_idleclock(); + } +#endif + + ie = intr_disable(); + KASSERT(ie != 0, ("%s called with interrupts disabled\n", __func__)); + + if (sched_runnable()) + ia64_enable_intr(); + else if (cpu_idle_hook != NULL) { (*cpu_idle_hook)(); - else - res = ia64_call_pal_static(PAL_HALT_LIGHT, 0, 0, 0); + /* The hook must enable interrupts! */ + } else { + ia64_call_pal_static(PAL_HALT_LIGHT, 0, 0, 0); + ia64_enable_intr(); + } + +#if 0 + if (!busy) { + cpu_activeclock(); + critical_exit(); + } +#endif } int @@ -644,9 +666,12 @@ calculate_frequencies(void) { struct ia64_sal_result sal; struct ia64_pal_result pal; + register_t ie; + ie = intr_disable(); sal = ia64_sal_entry(SAL_FREQ_BASE, 0, 0, 0, 0, 0, 0, 0); pal = ia64_call_pal_static(PAL_FREQ_RATIOS, 0, 0, 0); + intr_restore(ie); if (sal.sal_status == 0 && pal.pal_status == 0) { if (bootverbose) { Modified: head/sys/ia64/ia64/pal.S ============================================================================== --- head/sys/ia64/ia64/pal.S Mon Jun 6 19:00:38 2011 (r222768) +++ head/sys/ia64/ia64/pal.S Mon Jun 6 19:06:15 2011 (r222769) @@ -38,43 +38,40 @@ ia64_pal_entry: .quad 0 * u_int64_t arg1, u_int64_t arg2, u_int64_t arg3) */ ENTRY(ia64_call_pal_static, 4) - - .regstk 4,5,0,0 + + .regstk 4,4,0,0 palret = loc0 entry = loc1 rpsave = loc2 pfssave = loc3 -psrsave = loc4 - alloc pfssave=ar.pfs,4,5,0,0 + alloc pfssave=ar.pfs,4,4,0,0 ;; mov rpsave=rp - movl entry=@gprel(ia64_pal_entry) + 1: mov palret=ip // for return address ;; add entry=entry,gp - mov psrsave=psr + add palret=2f-1b,palret // calculate return address mov r28=in0 // procedure number - ;; - ld8 entry=[entry] // read entry point mov r29=in1 // copy arguments mov r30=in2 mov r31=in3 ;; - mov b6=entry - add palret=2f-1b,palret // calculate return address - ;; + ld8 entry=[entry] // read entry point mov b0=palret - rsm psr.i // disable interrupts + ;; + mov b6=entry ;; br.cond.sptk b6 // call into firmware -2: mov psr.l=psrsave + ;; +2: mov rp=rpsave mov ar.pfs=pfssave ;; - srlz.d br.ret.sptk rp + ;; END(ia64_call_pal_static) /* From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 19:33: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 D91BA1065688; Mon, 6 Jun 2011 19:33:19 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C99168FC1D; Mon, 6 Jun 2011 19:33: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 p56JXJ2r044834; Mon, 6 Jun 2011 19:33:19 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56JXJp3044832; Mon, 6 Jun 2011 19:33:19 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201106061933.p56JXJp3044832@svn.freebsd.org> From: Glen Barber Date: Mon, 6 Jun 2011 19:33: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: r222770 - head/usr.bin/su X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 19:33:20 -0000 Author: gjb (doc committer) Date: Mon Jun 6 19:33:19 2011 New Revision: 222770 URL: http://svn.freebsd.org/changeset/base/222770 Log: Attempt to clear up some confusion in the following example, by stating the '-c' argument is passed to the shell, not to su(1), which would indicate the login class. 'su -m -c ' Submitted by: Warren Block (followup to 157078) MFC after: 5 days Modified: head/usr.bin/su/su.1 Modified: head/usr.bin/su/su.1 ============================================================================== --- head/usr.bin/su/su.1 Mon Jun 6 19:06:15 2011 (r222769) +++ head/usr.bin/su/su.1 Mon Jun 6 19:33:19 2011 (r222770) @@ -203,6 +203,12 @@ Note that the option is required since user .Dq man does not have a valid shell by default. +In this example, +.Fl c +is passed to the shell of the user +.Dq man , +and is not interpreted as an argument to +.Nm . .It Li "su -m man -c 'catman /usr/share/man /usr/local/man'" Same as above, but the target command consists of more than a single word and hence is quoted for use with the From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 20:14: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 B99AB1065676; Mon, 6 Jun 2011 20:14:50 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 906138FC29; Mon, 6 Jun 2011 20:14: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 p56KEoIp046240; Mon, 6 Jun 2011 20:14:50 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56KEoD3046238; Mon, 6 Jun 2011 20:14:50 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106062014.p56KEoD3046238@svn.freebsd.org> From: Hiroki Sato Date: Mon, 6 Jun 2011 20:14: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: r222771 - head/usr.sbin/rtadvd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 20:14:50 -0000 Author: hrs Date: Mon Jun 6 20:14:50 2011 New Revision: 222771 URL: http://svn.freebsd.org/changeset/base/222771 Log: Set WARNS=1 temporarily to unbreak universe. Modified: head/usr.sbin/rtadvd/Makefile Modified: head/usr.sbin/rtadvd/Makefile ============================================================================== --- head/usr.sbin/rtadvd/Makefile Mon Jun 6 19:33:19 2011 (r222770) +++ head/usr.sbin/rtadvd/Makefile Mon Jun 6 20:14:50 2011 (r222771) @@ -23,6 +23,6 @@ LDADD= -lutil CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DROUTEINFO -WARNS?= 6 +WARNS?= 1 .include From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 20:24: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 19840106564A; Mon, 6 Jun 2011 20:24:18 +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 F3A788FC08; Mon, 6 Jun 2011 20:24: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 p56KOHLC046636; Mon, 6 Jun 2011 20:24:17 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56KOHeK046627; Mon, 6 Jun 2011 20:24:17 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201106062024.p56KOHeK046627@svn.freebsd.org> From: Ed Schouten Date: Mon, 6 Jun 2011 20:24: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: r222772 - in head: lib/libiconv sbin/geom/class/sched usr.bin/grep usr.bin/iconv usr.bin/rctl usr.sbin/bluetooth/ath3kfw usr.sbin/bsnmpd/modules/snmp_wlan usr.sbin/rtsold X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 20:24:18 -0000 Author: ed Date: Mon Jun 6 20:24:17 2011 New Revision: 222772 URL: http://svn.freebsd.org/changeset/base/222772 Log: Remove redundant assignments to WARNS. For these directories, WARNS is already implied to be 6. Modified: head/lib/libiconv/Makefile head/sbin/geom/class/sched/Makefile head/usr.bin/grep/Makefile head/usr.bin/iconv/Makefile head/usr.bin/rctl/Makefile head/usr.sbin/bluetooth/ath3kfw/Makefile head/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile head/usr.sbin/rtsold/Makefile Modified: head/lib/libiconv/Makefile ============================================================================== --- head/lib/libiconv/Makefile Mon Jun 6 20:14:50 2011 (r222771) +++ head/lib/libiconv/Makefile Mon Jun 6 20:24:17 2011 (r222772) @@ -19,7 +19,6 @@ SRCS= citrus_bcs.c citrus_bcs_strtol.c c citrus_module.c citrus_none.c citrus_pivot_factory.c \ citrus_prop.c citrus_stdenc.c iconv.c -WARNS?= 6 CFLAGS+= --param max-inline-insns-single=128 -I ${.CURDIR}/../../include -I${.CURDIR}/../libc/include .include Modified: head/sbin/geom/class/sched/Makefile ============================================================================== --- head/sbin/geom/class/sched/Makefile Mon Jun 6 20:14:50 2011 (r222771) +++ head/sbin/geom/class/sched/Makefile Mon Jun 6 20:24:17 2011 (r222772) @@ -5,6 +5,4 @@ GEOM_CLASS= sched -WARNS?= 6 - .include Modified: head/usr.bin/grep/Makefile ============================================================================== --- head/usr.bin/grep/Makefile Mon Jun 6 20:14:50 2011 (r222771) +++ head/usr.bin/grep/Makefile Mon Jun 6 20:24:17 2011 (r222772) @@ -28,8 +28,6 @@ MLINKS= grep.1 egrep.1 \ bsdgrep.1: grep.1 cp ${.ALLSRC} ${.TARGET} -WARNS?= 6 - LDADD= -lz -lbz2 DPADD= ${LIBZ} ${LIBBZ2} Modified: head/usr.bin/iconv/Makefile ============================================================================== --- head/usr.bin/iconv/Makefile Mon Jun 6 20:14:50 2011 (r222771) +++ head/usr.bin/iconv/Makefile Mon Jun 6 20:24:17 2011 (r222772) @@ -7,8 +7,6 @@ PROG= iconv #SRCS= iconv.c MAN= iconv.1 -WARNS?= 6 - LDADD+= -lcrypt DPADD+= ${LIBCRYPT} Modified: head/usr.bin/rctl/Makefile ============================================================================== --- head/usr.bin/rctl/Makefile Mon Jun 6 20:14:50 2011 (r222771) +++ head/usr.bin/rctl/Makefile Mon Jun 6 20:24:17 2011 (r222772) @@ -6,6 +6,4 @@ MAN= rctl.8 DPADD= ${LIBUTIL} LDADD= -lutil -WARNS?= 6 - .include Modified: head/usr.sbin/bluetooth/ath3kfw/Makefile ============================================================================== --- head/usr.sbin/bluetooth/ath3kfw/Makefile Mon Jun 6 20:14:50 2011 (r222771) +++ head/usr.sbin/bluetooth/ath3kfw/Makefile Mon Jun 6 20:24:17 2011 (r222772) @@ -2,7 +2,6 @@ PROG= ath3kfw MAN= ath3kfw.8 -WARNS?= 6 DPADD+= ${LIBUSB} LDADD+= -lusb Modified: head/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile Mon Jun 6 20:14:50 2011 (r222771) +++ head/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile Mon Jun 6 20:24:17 2011 (r222772) @@ -6,8 +6,6 @@ MOD= wlan SRCS= wlan_snmp.c wlan_sys.c CFLAGS+= -DSNMPTREE_TYPES -WARNS= 6 - XSYM= begemotWlan BMIBS= BEGEMOT-WIRELESS-MIB.txt Modified: head/usr.sbin/rtsold/Makefile ============================================================================== --- head/usr.sbin/rtsold/Makefile Mon Jun 6 20:14:50 2011 (r222771) +++ head/usr.sbin/rtsold/Makefile Mon Jun 6 20:24:17 2011 (r222772) @@ -19,7 +19,6 @@ MAN= rtsold.8 MLINKS= rtsold.8 rtsol.8 SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c -WARNS?= 6 CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H DPADD= ${LIBKVM} LDADD= -lkvm From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 20:27: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 7ACD6106564A; Mon, 6 Jun 2011 20:27:31 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id BAD5A8FC0A; Mon, 6 Jun 2011 20:27:30 +0000 (UTC) Received: from [10.30.101.53] ([209.117.142.2]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p56KLCHG091779 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Mon, 6 Jun 2011 14:21:13 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <20110606140251.GA2089@a91-153-123-205.elisa-laajakaista.fi> Date: Mon, 6 Jun 2011 14:21:07 -0600 Content-Transfer-Encoding: 7bit Message-Id: References: <201106060306.p5636hR5008901@svn.freebsd.org> <4DEC9EC1.9070206@FreeBSD.org> <20110606.195348.722786496150655516.hrs@allbsd.org> <20110606140251.GA2089@a91-153-123-205.elisa-laajakaista.fi> To: Jaakko Heinonen X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Mon, 06 Jun 2011 14:21:14 -0600 (MDT) Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, Hiroki Sato , dim@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r222732 - in head: sys/netinet usr.sbin/rtadvd usr.sbin/rtsold X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 20:27:31 -0000 On Jun 6, 2011, at 8:02 AM, Jaakko Heinonen wrote: > On 2011-06-06, Hiroki Sato wrote: >> di> > -WARNS?= 1 >> di> > +WARNS?= 6 > > Shouldn't you just remove the WARNS line because the default for > usr.sbin/ is 6? No, the change should be reverted, since it breaks ARM. Warner From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 20:35: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 4DC281065673; Mon, 6 Jun 2011 20:35:23 +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 797778FC13; Mon, 6 Jun 2011 20:35:21 +0000 (UTC) Received: by vws18 with SMTP id 18so4348202vws.13 for ; Mon, 06 Jun 2011 13:35:21 -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=SovDlXuZSBefxuBwr+NpD6kocVDiCgxk66mTol8JLXg=; b=edPi5uRrr7C8qIGQE/h093vx5f0QUSILUlnxwgnI52PXYIajfxX+lXz6soHP8AAV/U M5prLeOH2RloqE4ehj3wkWJqgCDh9zK+TbsUjtjkMAqAT4Y9u29WgW3cmMBagqxW/tqt 3UgL94qpsWauaxBHp9FYdRIGBJhK63nvQqT2E= 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=iPOAka++zUBVGzqehGpdz7MDXTJI66SfYzQbWV9F/QuC8XFrAc0ZGoynBlz1KaYv3l XKOk1oaQJzYRUfMBQk7+k6PyDDn1dPk9DUOb/zdeoI8mVzWqWfEmpS53IpDxQd2qh8ga 9WQRTta22saALIX3GjYW+O8vLzGHfnNEPrhM0= MIME-Version: 1.0 Received: by 10.220.213.195 with SMTP id gx3mr746785vcb.23.1307392521008; Mon, 06 Jun 2011 13:35:21 -0700 (PDT) Received: by 10.220.189.202 with HTTP; Mon, 6 Jun 2011 13:35:20 -0700 (PDT) In-Reply-To: References: <201106060306.p5636hR5008901@svn.freebsd.org> <4DEC9EC1.9070206@FreeBSD.org> <20110606.195348.722786496150655516.hrs@allbsd.org> <20110606140251.GA2089@a91-153-123-205.elisa-laajakaista.fi> Date: Mon, 6 Jun 2011 13:35:20 -0700 Message-ID: From: Garrett Cooper To: Warner Losh Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Jaakko Heinonen , src-committers@freebsd.org, svn-src-all@freebsd.org, Hiroki Sato , dim@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r222732 - in head: sys/netinet usr.sbin/rtadvd usr.sbin/rtsold X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 20:35:23 -0000 On Mon, Jun 6, 2011 at 1:21 PM, Warner Losh wrote: > > On Jun 6, 2011, at 8:02 AM, Jaakko Heinonen wrote: > >> On 2011-06-06, Hiroki Sato wrote: >>> di> > -WARNS?=3D =A0 =A0 =A0 1 >>> di> > +WARNS?=3D =A0 =A0 =A0 6 >> >> Shouldn't you just remove the WARNS line because the default for >> usr.sbin/ is 6? > > No, the change should be reverted, since it breaks ARM. ... and ia64. Thanks! -Garrett From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 20:36: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 DF6D1106564A; Mon, 6 Jun 2011 20:36:41 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.vlsi.ee.noda.tus.ac.jp (sekine00.ee.noda.sut.ac.jp [133.31.107.40]) by mx1.freebsd.org (Postfix) with ESMTP id E61428FC0C; Mon, 6 Jun 2011 20:36:40 +0000 (UTC) Received: from alph.allbsd.org (p2237-ipbf904funabasi.chiba.ocn.ne.jp [122.26.37.237]) (user=hrs mech=DIGEST-MD5 bits=128) by mail.vlsi.ee.noda.tus.ac.jp (8.14.4/8.14.4) with ESMTP id p56KaI0r090219 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Jun 2011 05:36:28 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.14.4/8.14.4) with ESMTP id p56KaGfc089293; Tue, 7 Jun 2011 05:36:18 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Tue, 07 Jun 2011 05:36:10 +0900 (JST) Message-Id: <20110607.053610.1090078171174632126.hrs@allbsd.org> To: imp@bsdimp.com From: Hiroki Sato In-Reply-To: References: <20110606.195348.722786496150655516.hrs@allbsd.org> <20110606140251.GA2089@a91-153-123-205.elisa-laajakaista.fi> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.3 on Emacs 23.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Tue_Jun__7_05_36_11_2011_288)--" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.vlsi.ee.noda.tus.ac.jp [133.31.107.40]); Tue, 07 Jun 2011 05:36:29 +0900 (JST) X-Spam-Status: No, score=5.5 required=14.0 tests=BAYES_40, CONTENT_TYPE_PRESENT, QENCPTR1,RCVD_IN_PBL,RCVD_IN_RP_RNBL,SPF_SOFTFAIL,X_MAILER_PRESENT autolearn=no version=3.3.1 X-Spam-Level: ***** X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.vlsi.ee.noda.tus.ac.jp Cc: svn-src-head@FreeBSD.org, jh@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, dim@FreeBSD.org Subject: Re: svn commit: r222732 - in head: sys/netinet usr.sbin/rtadvd usr.sbin/rtsold X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 20:36:42 -0000 ----Security_Multipart(Tue_Jun__7_05_36_11_2011_288)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Warner Losh wrote in : im> im> On Jun 6, 2011, at 8:02 AM, Jaakko Heinonen wrote: im> im> > On 2011-06-06, Hiroki Sato wrote: im> >> di> > -WARNS?= 1 im> >> di> > +WARNS?= 6 im> > im> > Shouldn't you just remove the WARNS line because the default for im> > usr.sbin/ is 6? im> im> No, the change should be reverted, since it breaks ARM. Sorry, reverted it just now. -- Hiroki ----Security_Multipart(Tue_Jun__7_05_36_11_2011_288)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAk3tOjsACgkQTyzT2CeTzy1nEQCfdXq1KTQD4JX6SrjdSFkNxjJM o5wAoKyS/LblSdSA38ka55rB05yktOFN =7fpV -----END PGP SIGNATURE----- ----Security_Multipart(Tue_Jun__7_05_36_11_2011_288)---- From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 21:02: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 7CDB1106566C; Mon, 6 Jun 2011 21:02:26 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C5B08FC28; Mon, 6 Jun 2011 21:02: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 p56L2QNf048173; Mon, 6 Jun 2011 21:02:26 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56L2QsC048171; Mon, 6 Jun 2011 21:02:26 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201106062102.p56L2QsC048171@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 6 Jun 2011 21:02: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: r222778 - 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, 06 Jun 2011 21:02:26 -0000 Author: gavin Date: Mon Jun 6 21:02:26 2011 New Revision: 222778 URL: http://svn.freebsd.org/changeset/base/222778 Log: Rework parts of this man page to improve grammar. Inspired by, and parts submitted by... PR: docs/157467 Submitted by: Ben Kaduk MFC after: 2 weeks Modified: head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Mon Jun 6 20:58:15 2011 (r222777) +++ head/sbin/geom/class/part/gpart.8 Mon Jun 6 21:02:26 2011 (r222778) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 30, 2011 +.Dd June 6, 2011 .Dt GPART 8 .Os .Sh NAME @@ -530,16 +530,17 @@ about its use. .El .\" .Sh PARTITION TYPES +Partition types are identified on disk by particular strings or magic +values. The .Nm -utility uses symbolic names for common partition types to avoid that the -user needs to know what the partitioning scheme in question is and what -the actual number or identification needs to be used for a particular -type. +utility uses symbolic names for common partition types to avoid the +user needing to know these values or other details of the partitioning +scheme in question. The .Nm utility also allows the user to specify scheme-specific partition types -for partition types that do not have symbol names. +for partition types that do not have symbolic names. The symbolic names currently understood are: .Bl -tag -width ".Cm freebsd-vinum" .It Cm bios-boot @@ -740,30 +741,30 @@ action or reverted with the .Cm undo action. .Sh RECOVERING -The GEOM class PART supports recovering of partition tables only for GPT. +The GEOM PART class supports recovering of partition tables only for GPT. The GUID partition table has a primary and secondary (backup) copy of -metadata for redundance. -They are stored in the begining and in the end of device respectively. -Therefore it is acceptable to have some corruptions in the metadata that -are not fatal to work with GPT. -When kernel detects corrupt metadata it marks this table as corrupt and -reports about corruption. -Any changes in corrupt table are prohibited except +metadata for redundance, these are stored at the begining and the end +of the device respectively. +As a result of having two copies, it is acceptable to have some corruption +within the metadata that is not fatal to the working of GPT. +When the kernel detects corrupt metadata it marks this table as corrupt and +reports the corruption. +Any operations on corrupt tables are prohibited except for .Cm destroy and .Cm recover . .Pp -In case when only first sector is corrupt kernel can not detect GPT even -if partition table is not corrupt. -You can write protective MBR with +If the first sector of a provider is corrupt, the kernel can not detect GPT +even if partition table itself is not corrupt. +You can rewrite the protective MBR using the .Xr dd 1 -command to restore ability of GPT detection. -The copy of protective MBR is usually located in the +command, to restore the ability to detect the GPT. +The copy of the protective MBR is usually located in the .Pa /boot/pmbr file. .Pp -In case when some of metadata is corrupt you will get to know about this -from kernel's messages like these: +If one GPT header appears to be corrupt but the other copy remains intact, +the kernel will log the following: .Bd -literal -offset indent GEOM: provider: the primary GPT table is corrupt or invalid. GEOM: provider: using the secondary instead -- recovery strongly advised. @@ -777,32 +778,31 @@ GEOM: provider: using the primary only - .Pp Also .Nm -commands like +commands such as .Cm show , status and .Cm list -will report about corrupt table. +will report about corrupt tables. .Pp -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. +If the size of the device has changed (e.g.\& volume expansion) the +secondary GPT header will no longer be located 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. -Kernel reports about this problem with message: +corruption of the primary GPT will lead to loss of partition table. +This problem is reported by the kernel with the message: .Bd -literal -offset indent GEOM: provider: the secondary GPT header is not in the last LBA. .Ed .Pp -A corrupt table can be recovered with +This situation can be recovered with the .Cm recover command. -This command does reconstruction of corrupt metadata using -known valid metadata. -Also it can relocate secondary GPT to the end of device. +This command reconstructs the corrupt metadata using known valid +metadata and relocates the secondary GPT to the end of the device. .Pp .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. +The GEOM PART class can detect the same partition table visible through +different GEOM providers, and some of them will be marked as corrupt. +Be careful when choosing a provider for recovery. If you choose incorrectly you can destroy the metadata of another GEOM class, e.g.\& GEOM MIRROR or GEOM LABEL. .Sh SYSCTL VARIABLES @@ -815,11 +815,11 @@ The default value is shown next to each .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 +When integrity checks are enabled, the .Nm PART -GEOM class verifies all generic partition parameters that it gets from the +GEOM class verifies all generic partition parameters obtained from the disk metadata. -If some inconsistency is detected, partition table will be +If some inconsistency is detected, the partition table will be rejected with a diagnostic message: .Sy "GEOM_PART: Integrity check failed (provider, scheme)" . .El From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 21:45: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 40EA91065672; Mon, 6 Jun 2011 21:45:10 +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 303078FC08; Mon, 6 Jun 2011 21:45: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 p56LjAxD050192; Mon, 6 Jun 2011 21:45:10 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56Lj9C2050184; Mon, 6 Jun 2011 21:45:10 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201106062145.p56Lj9C2050184@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 6 Jun 2011 21:45: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: r222786 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 21:45:10 -0000 Author: hselasky Date: Mon Jun 6 21:45:09 2011 New Revision: 222786 URL: http://svn.freebsd.org/changeset/base/222786 Log: Improve enumeration of Low- and Full-speed devices connected through a High-speed USB HUB by resetting the transaction translator (TT) before trying re-enumeration. Also when clear-stall fails multiple times try a re-enumeration. Suggested by: Trevor Blackwell MFC after: 14 days Modified: head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_freebsd.h head/sys/dev/usb/usb_generic.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_request.c head/sys/dev/usb/usb_request.h head/sys/dev/usb/usbdi.h Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Mon Jun 6 21:41:10 2011 (r222785) +++ head/sys/dev/usb/usb_device.h Mon Jun 6 21:45:09 2011 (r222786) @@ -187,6 +187,8 @@ struct usb_device { struct usb_host_endpoint *linux_endpoint_end; uint16_t devnum; #endif + + uint32_t clear_stall_errors; /* number of clear-stall failures */ }; /* globals */ Modified: head/sys/dev/usb/usb_freebsd.h ============================================================================== --- head/sys/dev/usb/usb_freebsd.h Mon Jun 6 21:41:10 2011 (r222785) +++ head/sys/dev/usb/usb_freebsd.h Mon Jun 6 21:45:09 2011 (r222786) @@ -66,6 +66,7 @@ #define USB_HUB_MAX_DEPTH 5 #define USB_EP0_BUFSIZE 1024 /* bytes */ +#define USB_CS_RESET_LIMIT 20 /* failures = 20 * 50 ms = 1sec */ typedef uint32_t usb_timeout_t; /* milliseconds */ typedef uint32_t usb_frlength_t; /* bytes */ Modified: head/sys/dev/usb/usb_generic.c ============================================================================== --- head/sys/dev/usb/usb_generic.c Mon Jun 6 21:41:10 2011 (r222785) +++ head/sys/dev/usb/usb_generic.c Mon Jun 6 21:45:09 2011 (r222786) @@ -966,10 +966,8 @@ ugen_re_enumerate(struct usb_fifo *f) /* ignore any errors */ DPRINTFN(6, "no FIFOs\n"); } - if (udev->re_enumerate_wait == 0) { - udev->re_enumerate_wait = 1; - usb_needs_explore(udev->bus, 0); - } + /* start re-enumeration of device */ + usbd_start_re_enumerate(udev); return (0); } Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Mon Jun 6 21:41:10 2011 (r222785) +++ head/sys/dev/usb/usb_hub.c Mon Jun 6 21:45:09 2011 (r222786) @@ -242,9 +242,14 @@ uhub_explore_sub(struct uhub_softc *sc, if (child->flags.usb_mode == USB_MODE_HOST) { usbd_enum_lock(child); if (child->re_enumerate_wait) { - err = usbd_set_config_index(child, USB_UNCONFIG_INDEX); - if (err == 0) - err = usbd_req_re_enumerate(child, NULL); + err = usbd_set_config_index(child, + USB_UNCONFIG_INDEX); + if (err != 0) { + DPRINTF("Unconfigure failed: " + "%s: Ignored.\n", + usbd_errstr(err)); + } + err = usbd_req_re_enumerate(child, NULL); if (err == 0) err = usbd_set_config_index(child, 0); if (err == 0) { @@ -2471,3 +2476,19 @@ usbd_filter_power_mode(struct usb_device /* use fixed power mode given by hardware driver */ return (temp); } + +/*------------------------------------------------------------------------* + * usbd_start_re_enumerate + * + * This function starts re-enumeration of the given USB device. This + * function does not need to be called BUS-locked. This function does + * not wait until the re-enumeration is completed. + *------------------------------------------------------------------------*/ +void +usbd_start_re_enumerate(struct usb_device *udev) +{ + if (udev->re_enumerate_wait == 0) { + udev->re_enumerate_wait = 1; + usb_needs_explore(udev->bus, 0); + } +} Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Mon Jun 6 21:41:10 2011 (r222785) +++ head/sys/dev/usb/usb_request.c Mon Jun 6 21:45:09 2011 (r222786) @@ -238,6 +238,10 @@ usb_do_clear_stall_callback(struct usb_x switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: + + /* reset error counter */ + udev->clear_stall_errors = 0; + if (ep == NULL) goto tr_setup; /* device was unconfigured */ if (ep->edesc && @@ -289,8 +293,23 @@ tr_setup: goto tr_setup; default: - if (xfer->error == USB_ERR_CANCELLED) { + if (error == USB_ERR_CANCELLED) break; + + DPRINTF("Clear stall failed.\n"); + if (udev->clear_stall_errors == USB_CS_RESET_LIMIT) + goto tr_setup; + + if (error == USB_ERR_TIMEOUT) { + udev->clear_stall_errors = USB_CS_RESET_LIMIT; + DPRINTF("Trying to re-enumerate.\n"); + usbd_start_re_enumerate(udev); + } else { + udev->clear_stall_errors++; + if (udev->clear_stall_errors == USB_CS_RESET_LIMIT) { + DPRINTF("Trying to re-enumerate.\n"); + usbd_start_re_enumerate(udev); + } } goto tr_setup; } @@ -1936,6 +1955,23 @@ usbd_req_re_enumerate(struct usb_device return (USB_ERR_INVAL); } retry: + /* + * Try to reset the High Speed parent HUB of a LOW- or FULL- + * speed device, if any. + */ + if (udev->parent_hs_hub != NULL && + udev->speed != USB_SPEED_HIGH) { + DPRINTF("Trying to reset parent High Speed TT.\n"); + err = usbd_req_reset_tt(udev->parent_hs_hub, NULL, + udev->hs_port_no); + if (err) { + DPRINTF("Resetting parent High " + "Speed TT failed (%s).\n", + usbd_errstr(err)); + } + } + + /* Try to reset the parent HUB port. */ err = usbd_req_reset_port(parent_hub, mtx, udev->port_no); if (err) { DPRINTFN(0, "addr=%d, port reset failed, %s\n", @@ -2033,3 +2069,65 @@ usbd_req_set_device_feature(struct usb_d USETW(req.wLength, 0); return (usbd_do_request(udev, mtx, &req, 0)); } + +/*------------------------------------------------------------------------* + * usbd_req_reset_tt + * + * Returns: + * 0: Success + * Else: Failure + *------------------------------------------------------------------------*/ +usb_error_t +usbd_req_reset_tt(struct usb_device *udev, struct mtx *mtx, + uint8_t port) +{ + struct usb_device_request req; + + /* For single TT HUBs the port should be 1 */ + + if (udev->ddesc.bDeviceClass == UDCLASS_HUB && + udev->ddesc.bDeviceProtocol == UDPROTO_HSHUBSTT) + port = 1; + + req.bmRequestType = UT_WRITE_CLASS_OTHER; + req.bRequest = UR_RESET_TT; + USETW(req.wValue, 0); + req.wIndex[0] = port; + req.wIndex[1] = 0; + USETW(req.wLength, 0); + return (usbd_do_request(udev, mtx, &req, 0)); +} + +/*------------------------------------------------------------------------* + * usbd_req_clear_tt_buffer + * + * For single TT HUBs the port should be 1. + * + * Returns: + * 0: Success + * Else: Failure + *------------------------------------------------------------------------*/ +usb_error_t +usbd_req_clear_tt_buffer(struct usb_device *udev, struct mtx *mtx, + uint8_t port, uint8_t addr, uint8_t type, uint8_t endpoint) +{ + struct usb_device_request req; + uint16_t wValue; + + /* For single TT HUBs the port should be 1 */ + + if (udev->ddesc.bDeviceClass == UDCLASS_HUB && + udev->ddesc.bDeviceProtocol == UDPROTO_HSHUBSTT) + port = 1; + + wValue = (endpoint & 0xF) | ((addr & 0x7F) << 4) | + ((endpoint & 0x80) << 8) | ((type & 3) << 12); + + req.bmRequestType = UT_WRITE_CLASS_OTHER; + req.bRequest = UR_CLEAR_TT_BUFFER; + USETW(req.wValue, wValue); + req.wIndex[0] = port; + req.wIndex[1] = 0; + USETW(req.wLength, 0); + return (usbd_do_request(udev, mtx, &req, 0)); +} Modified: head/sys/dev/usb/usb_request.h ============================================================================== --- head/sys/dev/usb/usb_request.h Mon Jun 6 21:41:10 2011 (r222785) +++ head/sys/dev/usb/usb_request.h Mon Jun 6 21:45:09 2011 (r222786) @@ -85,5 +85,9 @@ usb_error_t usbd_req_set_hub_u2_timeout( struct mtx *mtx, uint8_t port, uint8_t timeout); usb_error_t usbd_req_set_hub_depth(struct usb_device *udev, struct mtx *mtx, uint16_t depth); +usb_error_t usbd_req_reset_tt(struct usb_device *udev, struct mtx *mtx, + uint8_t port); +usb_error_t usbd_req_clear_tt_buffer(struct usb_device *udev, struct mtx *mtx, + uint8_t port, uint8_t addr, uint8_t type, uint8_t endpoint); #endif /* _USB_REQUEST_H_ */ Modified: head/sys/dev/usb/usbdi.h ============================================================================== --- head/sys/dev/usb/usbdi.h Mon Jun 6 21:41:10 2011 (r222785) +++ head/sys/dev/usb/usbdi.h Mon Jun 6 21:45:09 2011 (r222786) @@ -542,6 +542,7 @@ void usbd_m_copy_in(struct usb_page_cach struct mbuf *m, usb_size_t src_offset, usb_frlength_t src_len); void usbd_frame_zero(struct usb_page_cache *cache, usb_frlength_t offset, usb_frlength_t len); +void usbd_start_re_enumerate(struct usb_device *udev); int usb_fifo_attach(struct usb_device *udev, void *priv_sc, struct mtx *priv_mtx, struct usb_fifo_methods *pm, From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 21:45: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 6A210106564A; Mon, 6 Jun 2011 21:45:32 +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 5ACD38FC08; Mon, 6 Jun 2011 21:45: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 p56LjWTk050245; Mon, 6 Jun 2011 21:45:32 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56LjW4X050243; Mon, 6 Jun 2011 21:45:32 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201106062145.p56LjW4X050243@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 6 Jun 2011 21:45: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: r222787 - 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, 06 Jun 2011 21:45:32 -0000 Author: bz Date: Mon Jun 6 21:45:32 2011 New Revision: 222787 URL: http://svn.freebsd.org/changeset/base/222787 Log: Unbreak kernels with non-default PCBGROUP included but no WITNESS. Rather than including lock.h in in_pcbgroup.c in right order, fix it for all consumers of in_pcb.h by further header file pollution under #ifdef KERNEL. Reported by: Pan Tsu (inyaoo gmail.com) Modified: head/sys/netinet/in_pcb.h Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Mon Jun 6 21:45:09 2011 (r222786) +++ head/sys/netinet/in_pcb.h Mon Jun 6 21:45:32 2011 (r222787) @@ -44,6 +44,7 @@ #include #ifdef _KERNEL +#include #include #include #include From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 22:03: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 2CCA0106566B; Mon, 6 Jun 2011 22:03:10 +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 1D0808FC1A; Mon, 6 Jun 2011 22:03: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 p56M3AIp050949; Mon, 6 Jun 2011 22:03:10 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56M39jO050947; Mon, 6 Jun 2011 22:03:09 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201106062203.p56M39jO050947@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 6 Jun 2011 22:03: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: r222790 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 22:03:10 -0000 Author: hselasky Date: Mon Jun 6 22:03:09 2011 New Revision: 222790 URL: http://svn.freebsd.org/changeset/base/222790 Log: Reset clear-stall error counter before setting up the USB control transfers. MFC after: 14 days Modified: head/sys/dev/usb/usb_transfer.c Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Mon Jun 6 21:51:35 2011 (r222789) +++ head/sys/dev/usb/usb_transfer.c Mon Jun 6 22:03:09 2011 (r222790) @@ -2928,6 +2928,11 @@ repeat: usbd_transfer_unsetup(udev->ctrl_xfer, USB_CTRL_XFER_MAX); /* + * Reset clear stall error counter. + */ + udev->clear_stall_errors = 0; + + /* * Try to setup a new USB transfer for the * default control endpoint: */ From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 22:18: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 3191D106566B; Mon, 6 Jun 2011 22:18:41 +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 084D98FC13; Mon, 6 Jun 2011 22:18:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p56MIeth051566; Mon, 6 Jun 2011 22:18:40 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56MIedR051562; Mon, 6 Jun 2011 22:18:40 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201106062218.p56MIedR051562@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 6 Jun 2011 22:18: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: r222793 - in head: share/man/man4 sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 22:18:41 -0000 Author: jkim Date: Mon Jun 6 22:18:40 2011 New Revision: 222793 URL: http://svn.freebsd.org/changeset/base/222793 Log: Revert r222152. The root cause was analysed and better fix is upcoming. Discussed with: delphij Modified: head/share/man/man4/atkbd.4 head/sys/dev/atkbdc/atkbd.c head/sys/dev/atkbdc/atkbdreg.h Modified: head/share/man/man4/atkbd.4 ============================================================================== --- head/share/man/man4/atkbd.4 Mon Jun 6 22:14:46 2011 (r222792) +++ head/share/man/man4/atkbd.4 Mon Jun 6 22:18:40 2011 (r222793) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2011 +.Dd January 29, 2008 .Dt ATKBD 4 .Os .Sh NAME @@ -176,11 +176,6 @@ When this option is given, the .Nm driver will not test the keyboard port during the probe routine. Some machines hang during boot when this test is performed. -.It bit 4 (PROBE_TYPEMATIC) -When this option is given, the -.Nm -driver will try to probe the keyboard typematic rate on boot. -Some machines hang during boot when this test is performed. .El .\".Sh FILES .Sh EXAMPLES Modified: head/sys/dev/atkbdc/atkbd.c ============================================================================== --- head/sys/dev/atkbdc/atkbd.c Mon Jun 6 22:14:46 2011 (r222792) +++ head/sys/dev/atkbdc/atkbd.c Mon Jun 6 22:18:40 2011 (r222793) @@ -1097,9 +1097,6 @@ get_typematic(keyboard_t *kbd) x86regs_t regs; uint8_t *p; - if (!(kbd->kb_config & KB_CONF_PROBE_TYPEMATIC)) - return (ENODEV); - if (x86bios_get_intr(0x15) == 0 || x86bios_get_intr(0x16) == 0) return (ENODEV); Modified: head/sys/dev/atkbdc/atkbdreg.h ============================================================================== --- head/sys/dev/atkbdc/atkbdreg.h Mon Jun 6 22:14:46 2011 (r222792) +++ head/sys/dev/atkbdc/atkbdreg.h Mon Jun 6 22:18:40 2011 (r222793) @@ -36,7 +36,6 @@ #define KB_CONF_NO_RESET (1 << 1) /* don't reset the keyboard */ #define KB_CONF_ALT_SCANCODESET (1 << 2) /* assume the XT type keyboard */ #define KB_CONF_NO_PROBE_TEST (1 << 3) /* don't test keyboard during probe */ -#define KB_CONF_PROBE_TYPEMATIC (1 << 4) /* probe keyboard typematic */ #ifdef _KERNEL From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 23:03: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 5A365106564A; Mon, 6 Jun 2011 23:03:38 +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 4A5878FC12; Mon, 6 Jun 2011 23:03: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 p56N3cNk053026; Mon, 6 Jun 2011 23:03:38 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56N3cjs053024; Mon, 6 Jun 2011 23:03:38 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201106062303.p56N3cjs053024@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 6 Jun 2011 23:03: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: r222795 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 23:03:38 -0000 Author: jkim Date: Mon Jun 6 23:03:37 2011 New Revision: 222795 URL: http://svn.freebsd.org/changeset/base/222795 Log: Validate INT 15h and 16h vectors more strictly. Traditionally these entry points are fixed addresses and (U)EFI CSM specification also mandated that. Unfortunately, (U)EFI CSM specification does not specifically mention this is to call service routine via interrupt vector table or to jump directly to the entry point. As a result, some CSM seems to install two routines and acts differently, depending on how it was executed, unfortunately. When INT 15h is used, it calls a function pointer (which is probably a UEFI service function). When it jumps directly to the entry point, it executes a simple and traditional INT 15h service routine. Therefore, actually there are two possible fixes, i. e., this fix or jumping directly to the fixed entry point. However, we chose this fix because a) keyboard typematic support via BIOS is becoming extremely rarer and b) we cannot support random service routine installed by a firmware or a boot loader. This should fix Lenovo X220 laptop, specifically. Reviewed by: delphij MFC after: 3 days Modified: head/sys/dev/atkbdc/atkbd.c Modified: head/sys/dev/atkbdc/atkbd.c ============================================================================== --- head/sys/dev/atkbdc/atkbd.c Mon Jun 6 22:26:02 2011 (r222794) +++ head/sys/dev/atkbdc/atkbd.c Mon Jun 6 23:03:37 2011 (r222795) @@ -1097,7 +1097,8 @@ get_typematic(keyboard_t *kbd) x86regs_t regs; uint8_t *p; - if (x86bios_get_intr(0x15) == 0 || x86bios_get_intr(0x16) == 0) + if (x86bios_get_intr(0x15) != 0xf000f859 || + x86bios_get_intr(0x16) != 0xf000e82e) return (ENODEV); /* Is BIOS system configuration table supported? */ From owner-svn-src-head@FreeBSD.ORG Mon Jun 6 23:48: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 57FB1106566C; Mon, 6 Jun 2011 23:48:49 +0000 (UTC) (envelope-from jlaffaye@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47E818FC13; Mon, 6 Jun 2011 23:48: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 p56Nmn65056710; Mon, 6 Jun 2011 23:48:49 GMT (envelope-from jlaffaye@svn.freebsd.org) Received: (from jlaffaye@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p56Nmnhm056708; Mon, 6 Jun 2011 23:48:49 GMT (envelope-from jlaffaye@svn.freebsd.org) Message-Id: <201106062348.p56Nmnhm056708@svn.freebsd.org> From: Julien Laffaye Date: Mon, 6 Jun 2011 23:48: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: r222797 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Jun 2011 23:48:49 -0000 Author: jlaffaye (ports committer) Date: Mon Jun 6 23:48:48 2011 New Revision: 222797 URL: http://svn.freebsd.org/changeset/base/222797 Log: Add myself to committers-ports.dot Approved by: tabthorpe@ (mentor) Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Mon Jun 6 23:36:39 2011 (r222796) +++ head/share/misc/committers-ports.dot Mon Jun 6 23:48:48 2011 (r222797) @@ -97,6 +97,7 @@ itetcu [label="Ion-Mihai Tetcu\nitetcu@F jacula [label="Giuseppe Pilichi\njacula@FreeBSD.org\n2010/04/05"] jadawin [label="Philippe Audeoud\njadawin@FreeBSD.org\n2008/03/02"] jkim [label="Jung-uk Kim\njkim@FreeBSD.org\n2007/09/12"] +jlaffaye [label="Julien Laffaye\njlaffaye@FreeBSD.org\n2011/06/06"] jmelo [label="Jean Milanez Melo\njmelo@FreeBSD.org\n2006/03/31"] joerg [label="Joerg Wunsch\njoerg@FreeBSD.org\n1994/08/22"] johans [label="Johan Selst\njohans@FreeBSD.org\n2006/04/01"] From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 00:39: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 CB1AC1065678; Tue, 7 Jun 2011 00:39:15 +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 B0BD18FC18; Tue, 7 Jun 2011 00:39: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 p570dFkn058219; Tue, 7 Jun 2011 00:39:15 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p570dFJN058214; Tue, 7 Jun 2011 00:39:15 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201106070039.p570dFJN058214@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 7 Jun 2011 00:39: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: r222798 - head/sys/boot/ia64/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: Tue, 07 Jun 2011 00:39:16 -0000 Author: marcel Date: Tue Jun 7 00:39:15 2011 New Revision: 222798 URL: http://svn.freebsd.org/changeset/base/222798 Log: Add ia64_sync_icache() and use it to make the I-cache coherent after loading the kernel's text segment. The kernel will do the same for loaded modules, so don't worry about that. Added: head/sys/boot/ia64/common/icache.c (contents, props changed) Modified: head/sys/boot/ia64/common/Makefile head/sys/boot/ia64/common/exec.c head/sys/boot/ia64/common/libia64.h Modified: head/sys/boot/ia64/common/Makefile ============================================================================== --- head/sys/boot/ia64/common/Makefile Mon Jun 6 23:48:48 2011 (r222797) +++ head/sys/boot/ia64/common/Makefile Tue Jun 7 00:39:15 2011 (r222798) @@ -6,7 +6,7 @@ MK_SSP= no LIB= ia64 INTERNALLIB= -SRCS= autoload.c bootinfo.c copy.c devicename.c exec.c +SRCS= autoload.c bootinfo.c copy.c devicename.c exec.c icache.c CFLAGS+= -I${.CURDIR}/../../efi/include CFLAGS+= -I${.CURDIR}/../../efi/include/${MACHINE_CPUARCH} Modified: head/sys/boot/ia64/common/exec.c ============================================================================== --- head/sys/boot/ia64/common/exec.c Mon Jun 6 23:48:48 2011 (r222797) +++ head/sys/boot/ia64/common/exec.c Tue Jun 7 00:39:15 2011 (r222798) @@ -258,6 +258,8 @@ ia64_loadseg(Elf_Ehdr *eh, Elf_Phdr *ph, if (ph->p_flags & PF_X) { ia64_text_start = ph->p_vaddr + delta; ia64_text_size = ph->p_memsz; + + ia64_sync_icache(ia64_text_start, ia64_text_size); } else { ia64_data_start = ph->p_vaddr + delta; ia64_data_size = ph->p_memsz; Added: head/sys/boot/ia64/common/icache.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/ia64/common/icache.c Tue Jun 7 00:39:15 2011 (r222798) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2011 Marcel Moolenaar + * 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 "libia64.h" + +void +ia64_sync_icache(vm_offset_t va, size_t sz) +{ + uintptr_t pa; + size_t cnt, max; + + while (sz > 0) { + max = sz; + pa = (uintptr_t)ia64_va2pa(va, &max); + for (cnt = 0; cnt < max; cnt += 32) + ia64_fc_i(pa + cnt); + ia64_sync_i(); + va += max; + sz -= max; + } + ia64_srlz_i(); +} Modified: head/sys/boot/ia64/common/libia64.h ============================================================================== --- head/sys/boot/ia64/common/libia64.h Mon Jun 6 23:48:48 2011 (r222797) +++ head/sys/boot/ia64/common/libia64.h Tue Jun 7 00:39:15 2011 (r222798) @@ -64,6 +64,7 @@ void ia64_loadseg(void *, void *, uint64 ssize_t ia64_copyin(const void *, vm_offset_t, size_t); ssize_t ia64_copyout(vm_offset_t, void *, size_t); +void ia64_sync_icache(vm_offset_t, size_t); ssize_t ia64_readin(int, vm_offset_t, size_t); void *ia64_va2pa(vm_offset_t, size_t *); From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 00:59: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 81F801065674; Tue, 7 Jun 2011 00:59:31 +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 715E58FC0A; Tue, 7 Jun 2011 00:59:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p570xVak058820; Tue, 7 Jun 2011 00:59:31 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p570xVj2058816; Tue, 7 Jun 2011 00:59:31 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201106070059.p570xVj2058816@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 7 Jun 2011 00:59:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222799 - head/sys/boot/ia64/efi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 00:59:31 -0000 Author: marcel Date: Tue Jun 7 00:59:31 2011 New Revision: 222799 URL: http://svn.freebsd.org/changeset/base/222799 Log: o Bump the EFI loader version to 3.1. o Add the about, pbvm and reboot commands. o Trim the banner (suppress maker and date). Modified: head/sys/boot/ia64/efi/efimd.c head/sys/boot/ia64/efi/main.c head/sys/boot/ia64/efi/version Modified: head/sys/boot/ia64/efi/efimd.c ============================================================================== --- head/sys/boot/ia64/efi/efimd.c Tue Jun 7 00:39:15 2011 (r222798) +++ head/sys/boot/ia64/efi/efimd.c Tue Jun 7 00:59:31 2011 (r222799) @@ -230,3 +230,35 @@ ia64_platform_enter(const char *kernel) return (0); } + +COMMAND_SET(pbvm, "pbvm", "show PBVM details", command_pbvm); + +static int +command_pbvm(int argc, char *argv[]) +{ + uint64_t limit, pg, start; + u_int idx; + + printf("Page table @ %p, size %x\n", ia64_pgtbl, ia64_pgtblsz); + + if (ia64_pgtbl == NULL) + return (0); + + limit = ~0; + start = ~0; + idx = 0; + while (ia64_pgtbl[idx] != 0) { + pg = ia64_pgtbl[idx]; + if (pg != limit) { + if (start != ~0) + printf("%#lx-%#lx\n", start, limit); + start = pg; + } + limit = pg + IA64_PBVM_PAGE_SIZE; + idx++; + } + if (start != ~0) + printf("%#lx-%#lx\n", start, limit); + + return (0); +} Modified: head/sys/boot/ia64/efi/main.c ============================================================================== --- head/sys/boot/ia64/efi/main.c Tue Jun 7 00:39:15 2011 (r222798) +++ head/sys/boot/ia64/efi/main.c Tue Jun 7 00:59:31 2011 (r222799) @@ -153,9 +153,7 @@ main(int argc, CHAR16 *argv[]) */ cons_probe(); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s, Revision %s\n", bootprog_name, bootprog_rev); find_pal_proc(); @@ -214,6 +212,18 @@ static int command_quit(int argc, char *argv[]) { exit(0); + /* NOTREACHED */ + return (CMD_OK); +} + +COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); + +static int +command_reboot(int argc, char *argv[]) +{ + + RS->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL); + /* NOTREACHED */ return (CMD_OK); } @@ -585,3 +595,24 @@ command_hcdp(int argc, char *argv[]) printf("\n"); return (CMD_OK); } + +COMMAND_SET(about, "about", "about the loader", command_about); + +extern uint64_t _start_plabel[]; + +static int +command_about(int argc, char *argv[]) +{ + EFI_LOADED_IMAGE *img; + + printf("%s\n", bootprog_name); + printf("revision %s\n", bootprog_rev); + printf("built by %s\n", bootprog_maker); + printf("built on %s\n", bootprog_date); + + printf("\n"); + + BS->HandleProtocol(IH, &imgid, (VOID**)&img); + printf("image loaded at %p\n", img->ImageBase); + printf("entry at %#lx (%#lx)\n", _start_plabel[0], _start_plabel[1]); +} Modified: head/sys/boot/ia64/efi/version ============================================================================== --- head/sys/boot/ia64/efi/version Tue Jun 7 00:39:15 2011 (r222798) +++ head/sys/boot/ia64/efi/version Tue Jun 7 00:59:31 2011 (r222799) @@ -3,6 +3,8 @@ $FreeBSD$ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important. Make sure the current version number is on line 6. +3.1: Add the about, reboot and pbvm commands. + I-cache coherency is maintained. 3.0: Add support for PBVM. 2.2: Create direct mapping based on start address instead of mapping first 256M. From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 01:06: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 AC5481065672; Tue, 7 Jun 2011 01:06:49 +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 9C5D88FC19; Tue, 7 Jun 2011 01:06:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5716ni9059083; Tue, 7 Jun 2011 01:06:49 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5716nBk059081; Tue, 7 Jun 2011 01:06:49 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201106070106.p5716nBk059081@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 7 Jun 2011 01:06: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: r222800 - head/sys/ia64/ia64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 01:06:49 -0000 Author: marcel Date: Tue Jun 7 01:06:49 2011 New Revision: 222800 URL: http://svn.freebsd.org/changeset/base/222800 Log: Call set_cputicker() to have the time counter use the ITC register. Note that the ITC frequency is fixed. Modified: head/sys/ia64/ia64/machdep.c Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Tue Jun 7 00:59:31 2011 (r222799) +++ head/sys/ia64/ia64/machdep.c Tue Jun 7 01:06:49 2011 (r222800) @@ -786,6 +786,8 @@ ia64_init(void) ia64_sal_init(); calculate_frequencies(); + set_cputicker(ia64_get_itc, (u_long)itc_freq * 1000000, 0); + /* * Setup the PCPU data for the bootstrap processor. It is needed * by printf(). Also, since printf() has critical sections, we From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 01:28: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 11AA71065670; Tue, 7 Jun 2011 01:28:13 +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 EB1CD8FC08; Tue, 7 Jun 2011 01:28:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p571SCZY059718; Tue, 7 Jun 2011 01:28:12 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p571SCVI059714; Tue, 7 Jun 2011 01:28:12 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201106070128.p571SCVI059714@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 7 Jun 2011 01:28: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: r222801 - in head/sys: ddb 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, 07 Jun 2011 01:28:13 -0000 Author: marcel Date: Tue Jun 7 01:28:12 2011 New Revision: 222801 URL: http://svn.freebsd.org/changeset/base/222801 Log: Fix making kernel dumps from the debugger by creating a command for it. Do not not expect a developer to call doadump(). Calling doadump does not necessarily work when it's declared static. Nor does it necessarily do what was intended in the context of text dumps. The dump command always creates a core dump. Move printing of error messages from doadump to the dump command, now that we don't have to worry about being called from DDB. Modified: head/sys/ddb/db_command.c head/sys/kern/kern_shutdown.c head/sys/sys/conf.h Modified: head/sys/ddb/db_command.c ============================================================================== --- head/sys/ddb/db_command.c Tue Jun 7 01:06:49 2011 (r222800) +++ head/sys/ddb/db_command.c Tue Jun 7 01:28:12 2011 (r222801) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -64,6 +65,7 @@ db_addr_t db_last_addr; db_addr_t db_prev; db_addr_t db_next; +static db_cmdfcn_t db_dump; static db_cmdfcn_t db_fncall; static db_cmdfcn_t db_gdb; static db_cmdfcn_t db_halt; @@ -102,6 +104,7 @@ static struct command db_cmds[] = { { "w", db_write_cmd, CS_MORE|CS_SET_DOT, 0 }, { "delete", db_delete_cmd, 0, 0 }, { "d", db_delete_cmd, 0, 0 }, + { "dump", db_dump, 0, 0 }, { "break", db_breakpoint_cmd, 0, 0 }, { "b", db_breakpoint_cmd, 0, 0 }, { "dwatch", db_deletewatch_cmd, 0, 0 }, @@ -526,6 +529,27 @@ db_error(s) kdb_reenter(); } +static void +db_dump(db_expr_t dummy, boolean_t dummy2, db_expr_t dummy3, char *dummy4) +{ + int error; + + error = doadump(FALSE); + if (error) { + db_printf("Cannot dump: "); + switch (error) { + case EBUSY: + db_printf("debugger got invoked while dumping.\n"); + break; + case ENXIO: + db_printf("no dump device specified.\n"); + break; + default: + db_printf("unknown error (error=%d).\n", error); + break; + } + } +} /* * Call random function: Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Tue Jun 7 01:06:49 2011 (r222800) +++ head/sys/kern/kern_shutdown.c Tue Jun 7 01:28:12 2011 (r222801) @@ -233,30 +233,32 @@ print_uptime(void) printf("%lds\n", (long)ts.tv_sec); } -static void -doadump(void) +int +doadump(boolean_t textdump) { + boolean_t coredump; - /* - * Sometimes people have to call this from the kernel debugger. - * (if 'panic' can not dump) - * Give them a clue as to why they can't dump. - */ - if (dumper.dumper == NULL) { - printf("Cannot dump. Device not defined or unavailable.\n"); - return; - } + if (dumping) + return (EBUSY); + if (dumper.dumper == NULL) + return (ENXIO); savectx(&dumppcb); dumptid = curthread->td_tid; dumping++; + + coredump = TRUE; #ifdef DDB - if (textdump_pending) + if (textdump && textdump_pending) { + coredump = FALSE; textdump_dumpsys(&dumper); - else + } #endif + if (coredump) dumpsys(&dumper); + dumping--; + return (0); } static int @@ -425,7 +427,7 @@ kern_reboot(int howto) EVENTHANDLER_INVOKE(shutdown_post_sync, howto); if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping) - doadump(); + doadump(TRUE); /* Now that we're going to really halt the system... */ EVENTHANDLER_INVOKE(shutdown_final, howto); Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Tue Jun 7 01:06:49 2011 (r222800) +++ head/sys/sys/conf.h Tue Jun 7 01:28:12 2011 (r222801) @@ -332,6 +332,7 @@ struct dumperinfo { int set_dumper(struct dumperinfo *); int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t); void dumpsys(struct dumperinfo *); +int doadump(boolean_t); extern int dumping; /* system is dumping */ #endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 01:30: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 88B901065670; Tue, 7 Jun 2011 01:30:50 +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 E35E58FC16; Tue, 7 Jun 2011 01:30:49 +0000 (UTC) Received: by vws18 with SMTP id 18so4551854vws.13 for ; Mon, 06 Jun 2011 18:30:49 -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=dWoiKenNNO+11zS2AdZoxIiGA02SheQl5PMLShkpHc0=; b=RRgxE96qUuGY7G8ptM6Ot0BSOn2QoRls56hAYcU4rxfhpeawaOHGEYjCS8YLq07VQ+ zqVf+7LR5xMpUZTaCDyRptosoLp74cyy/zIZlug+uXYoH8y/ouq8epMwrORN2NmSx7DZ 77nQxk7ttsYTakNHCuounfEpguOaG3Hpvtga0= 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=bfBNTzPIEW1x5/qMy7msJGsJlxWMJlk+79ES7RVLLYvlRN2WnN45YHbllqvdw6P50m DfzCDuS9msfeY5WWUPErTiLlmef9Ii+pLnM5d0swqS4RLdBbY4dOIuLfNv6RjdgTRCXV TLtasUe1HUBiGG9bt0H1n8ij0OBojdHUJAeHY= MIME-Version: 1.0 Received: by 10.220.213.195 with SMTP id gx3mr839552vcb.23.1307410249030; Mon, 06 Jun 2011 18:30:49 -0700 (PDT) Received: by 10.220.189.202 with HTTP; Mon, 6 Jun 2011 18:30:48 -0700 (PDT) In-Reply-To: <201106070128.p571SCVI059714@svn.freebsd.org> References: <201106070128.p571SCVI059714@svn.freebsd.org> Date: Mon, 6 Jun 2011 18:30:48 -0700 Message-ID: From: Garrett Cooper To: Marcel Moolenaar 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: r222801 - in head/sys: ddb 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, 07 Jun 2011 01:30:50 -0000 On Mon, Jun 6, 2011 at 6:28 PM, Marcel Moolenaar wrote= : > Author: marcel > Date: Tue Jun =A07 01:28:12 2011 > New Revision: 222801 > URL: http://svn.freebsd.org/changeset/base/222801 > > Log: > =A0Fix making kernel dumps from the debugger by creating a command > =A0for it. Do not not expect a developer to call doadump(). Calling > =A0doadump does not necessarily work when it's declared static. Nor > =A0does it necessarily do what was intended in the context of text > =A0dumps. The dump command always creates a core dump. > > =A0Move printing of error messages from doadump to the dump command, > =A0now that we don't have to worry about being called from DDB. > > Modified: > =A0head/sys/ddb/db_command.c > =A0head/sys/kern/kern_shutdown.c > =A0head/sys/sys/conf.h You rock Marcel! Thanks, -Garrett From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 02:50: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 63EC41065672; Tue, 7 Jun 2011 02:50:14 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53A858FC14; Tue, 7 Jun 2011 02:50: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 p572oEtb062093; Tue, 7 Jun 2011 02:50:14 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p572oEET062091; Tue, 7 Jun 2011 02:50:14 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201106070250.p572oEET062091@svn.freebsd.org> From: David Xu Date: Tue, 7 Jun 2011 02:50: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: r222802 - 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, 07 Jun 2011 02:50:14 -0000 Author: davidxu Date: Tue Jun 7 02:50:14 2011 New Revision: 222802 URL: http://svn.freebsd.org/changeset/base/222802 Log: Use p4prio_to_tsprio to calculate TS priority instead of using p4prio_to_rtpprio which is for RT priority. PR: kern/157657 Submitted by: krivenok.dmitry at gmail dot com MFC after: 3 days Modified: head/sys/kern/ksched.c Modified: head/sys/kern/ksched.c ============================================================================== --- head/sys/kern/ksched.c Tue Jun 7 01:28:12 2011 (r222801) +++ head/sys/kern/ksched.c Tue Jun 7 02:50:14 2011 (r222802) @@ -206,7 +206,7 @@ ksched_setscheduler(struct ksched *ksche if (param->sched_priority >= 0 && param->sched_priority <= (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE)) { rtp.type = RTP_PRIO_NORMAL; - rtp.prio = p4prio_to_rtpprio(param->sched_priority); + rtp.prio = p4prio_to_tsprio(param->sched_priority); rtp_to_pri(&rtp, td); } else e = EINVAL; From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 04:38: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 98AC21065677; Tue, 7 Jun 2011 04:38:33 +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 87AFA8FC0C; Tue, 7 Jun 2011 04:38: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 p574cXrn065655; Tue, 7 Jun 2011 04:38:33 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p574cXSP065653; Tue, 7 Jun 2011 04:38:33 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201106070438.p574cXSP065653@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 7 Jun 2011 04:38: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: r222803 - head/usr.sbin/rtsold X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 04:38:33 -0000 Author: marcel Date: Tue Jun 7 04:38:33 2011 New Revision: 222803 URL: http://svn.freebsd.org/changeset/base/222803 Log: Lower WARNS level to 3 to eliminate alignment warnings related to casting inherent in CMSG_DATA(). Modified: head/usr.sbin/rtsold/Makefile Modified: head/usr.sbin/rtsold/Makefile ============================================================================== --- head/usr.sbin/rtsold/Makefile Tue Jun 7 02:50:14 2011 (r222802) +++ head/usr.sbin/rtsold/Makefile Tue Jun 7 04:38:33 2011 (r222803) @@ -19,6 +19,7 @@ MAN= rtsold.8 MLINKS= rtsold.8 rtsol.8 SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c +WARNS?= 3 CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H DPADD= ${LIBKVM} LDADD= -lkvm From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 05:04: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 0722E106564A; Tue, 7 Jun 2011 05:04:38 +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 EA4ED8FC0A; Tue, 7 Jun 2011 05:04: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 p5754bdU066433; Tue, 7 Jun 2011 05:04:37 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5754bsm066431; Tue, 7 Jun 2011 05:04:37 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201106070504.p5754bsm066431@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 7 Jun 2011 05:04: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: r222804 - 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, 07 Jun 2011 05:04:38 -0000 Author: ken Date: Tue Jun 7 05:04:37 2011 New Revision: 222804 URL: http://svn.freebsd.org/changeset/base/222804 Log: Set pca.p_bufr to NULL when we haven't allocated a buffer. Otherwise, p_bufr is set to garbage on the stack, and if that garbage happens to be non-NULL, and the TOLOG or TOCONS flag is set, putbuf() will get called and attempt to fill the non-existent buffer. This is really only relevant for tprintf() (and only when the priority is not -1), but set it in uprintf() and ttyprintf() for completeness. The next step, to avoid log buffer scrambling, would be to add the PRINTF_BUFR_SIZE code to tprintf(), but this should prevent panics. Submitted by: rmacklem Found by: pho Modified: head/sys/kern/subr_prf.c Modified: head/sys/kern/subr_prf.c ============================================================================== --- head/sys/kern/subr_prf.c Tue Jun 7 04:38:33 2011 (r222803) +++ head/sys/kern/subr_prf.c Tue Jun 7 05:04:37 2011 (r222804) @@ -163,6 +163,7 @@ uprintf(const char *fmt, ...) goto out; } pca.flags = TOTTY; + pca.p_bufr = NULL; va_start(ap, fmt); tty_lock(pca.tty); retval = kvprintf(fmt, putchar, &pca, 10, ap); @@ -206,6 +207,7 @@ tprintf(struct proc *p, int pri, const c pca.pri = pri; pca.tty = tp; pca.flags = flags; + pca.p_bufr = NULL; va_start(ap, fmt); if (pca.tty != NULL) tty_lock(pca.tty); @@ -234,6 +236,7 @@ ttyprintf(struct tty *tp, const char *fm va_start(ap, fmt); pca.tty = tp; pca.flags = TOTTY; + pca.p_bufr = NULL; retval = kvprintf(fmt, putchar, &pca, 10, ap); va_end(ap); return (retval); From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 05:42: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 008AD106564A; Tue, 7 Jun 2011 05:42:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id 74DF78FC0A; Tue, 7 Jun 2011 05:42:30 +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 mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p575gCed016377 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Jun 2011 15:42:28 +1000 Date: Tue, 7 Jun 2011 15:42:12 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pan Tsu In-Reply-To: <86y61ehmnx.fsf@gmail.com> Message-ID: <20110607153624.B975@besplex.bde.org> References: <201106061255.p56Ct3qN031795__3239.16238635338$1307364936$gmane$org@svn.freebsd.org> <86y61ehmnx.fsf@gmail.com> 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, Robert Watson Subject: Re: svn commit: r222748 - in head/sys: conf 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: Tue, 07 Jun 2011 05:42:31 -0000 On Mon, 6 Jun 2011, Pan Tsu wrote: > Robert Watson writes: > >> Author: rwatson >> Date: Mon Jun 6 12:55:02 2011 >> New Revision: 222748 >> URL: http://svn.freebsd.org/changeset/base/222748 >> >> Log: > [...] >> Connection group support is enabled by compiling "options PCBGROUP" >> into your kernel configuration; for the time being, this is an >> experimental feature, and hence is not enabled by default. > > Doesn't build with "nooption WITNESS" as in6_pcbgroup.c relies on > including unconditionally, e.g. > > $ make -s buildkernel > [...] > -------------------------------------------------------------- > >>> stage 3.1: making dependencies > -------------------------------------------------------------- > In file included from /usr/src/sys/netinet/in_pcb.h:47, > from /usr/src/sys/netinet6/in6_pcbgroup.c:40: > /usr/src/sys/sys/rwlock.h:152:2: error: #error LOCK_DEBUG not defined, include before > mkdep: compile failed > *** Error code 1 was disgustingly polluted even before it included . Bruce From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 06:18: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 73231106566C; Tue, 7 Jun 2011 06:18:02 +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 57DBC8FC12; Tue, 7 Jun 2011 06:18: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 p576I2Wj068608; Tue, 7 Jun 2011 06:18:02 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p576I2t7068605; Tue, 7 Jun 2011 06:18:02 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201106070618.p576I2t7068605@svn.freebsd.org> From: Andriy Gapon Date: Tue, 7 Jun 2011 06:18: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: r222805 - in head: share/man/man4 sys/dev/amdsbwd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 06:18:02 -0000 Author: avg Date: Tue Jun 7 06:18:02 2011 New Revision: 222805 URL: http://svn.freebsd.org/changeset/base/222805 Log: amdsbwd: update to support SB8xx southbridges Many thanks to Tino for drawing my attention to this, for doing a lot of testing and providing great feedback. Many thanks to AMD for continuing to release public specifications for their chipsets. PR: kern/157568 Tested by: Tino MFC after: 1 week Modified: head/share/man/man4/amdsbwd.4 head/sys/dev/amdsbwd/amdsbwd.c Modified: head/share/man/man4/amdsbwd.4 ============================================================================== --- head/share/man/man4/amdsbwd.4 Tue Jun 7 05:04:37 2011 (r222804) +++ head/share/man/man4/amdsbwd.4 Tue Jun 7 06:18:02 2011 (r222805) @@ -25,12 +25,12 @@ .\" .\" $FreeBSD$ .\" -.Dd November 30, 2009 +.Dd June 7, 2011 .Dt AMDSBWD 4 .Os .Sh NAME .Nm amdsbwd -.Nd device driver for the AMD SB600/SB700/SB710/SB750 watchdog timer +.Nd device driver for the AMD SB600/SB7xx/SB8xx watchdog timers .Sh SYNOPSIS To compile this driver into the kernel, place the following line in your @@ -51,7 +51,7 @@ The driver provides .Xr watchdog 4 support for the watchdog timers present on -AMD SB600 and SB7xx south bridge chips. +AMD SB600, SB7xx and SB8xx southbridges. .Sh SEE ALSO .Xr watchdog 4 , .Xr watchdog 8 , Modified: head/sys/dev/amdsbwd/amdsbwd.c ============================================================================== --- head/sys/dev/amdsbwd/amdsbwd.c Tue Jun 7 05:04:37 2011 (r222804) +++ head/sys/dev/amdsbwd/amdsbwd.c Tue Jun 7 06:18:02 2011 (r222805) @@ -25,8 +25,8 @@ */ /* - * This is a driver for watchdog timer present in AMD SB600/SB7xx - * south bridges and other watchdog timers advertised via WDRT ACPI table. + * This is a driver for watchdog timer present in AMD SB600/SB7xx/SB8xx + * southbridges. * Please see the following specifications for the descriptions of the * registers and flags: * - AMD SB600 Register Reference Guide, Public Version, Rev. 3.03 (SB600 RRG) @@ -35,11 +35,13 @@ * http://developer.amd.com/assets/43009_sb7xx_rrg_pub_1.00.pdf * - AMD SB700/710/750 Register Programming Requirements (RPR) * http://developer.amd.com/assets/42413_sb7xx_rpr_pub_1.00.pdf + * - AMD SB800-Series Southbridges Register Reference Guide (RRG) + * http://support.amd.com/us/Embedded_TechDocs/45482.pdf * Please see the following for Watchdog Resource Table specification: * - Watchdog Timer Hardware Requirements for Windows Server 2003 (WDRT) * http://www.microsoft.com/whdc/system/sysinternals/watchdog.mspx - * AMD SB600/SB7xx watchdog hardware seems to conform to the above, - * but my system doesn't provide the table. + * AMD SB600/SB7xx/SB8xx watchdog hardware seems to conform to the above + * specifications, but the table hasn't been spotted in the wild yet. */ #include @@ -59,15 +61,15 @@ __FBSDID("$FreeBSD$"); #include #include -/* RRG 2.3.3.1.1, page 161. */ +/* SB7xx RRG 2.3.3.1.1. */ #define AMDSB_PMIO_INDEX 0xcd6 #define AMDSB_PMIO_DATA (PMIO_INDEX + 1) #define AMDSB_PMIO_WIDTH 2 -/* RRG 2.3.3.2, page 181. */ +/* SB7xx RRG 2.3.3.2. */ #define AMDSB_PM_RESET_STATUS0 0x44 #define AMDSB_PM_RESET_STATUS1 0x45 #define AMDSB_WD_RST_STS 0x02 -/* RRG 2.3.3.2, page 188; RPR 2.36, page 30. */ +/* SB7xx RRG 2.3.3.2, RPR 2.36. */ #define AMDSB_PM_WDT_CTRL 0x69 #define AMDSB_WDT_DISABLE 0x01 #define AMDSB_WDT_RES_MASK (0x02 | 0x04) @@ -77,7 +79,18 @@ __FBSDID("$FreeBSD$"); #define AMDSB_WDT_RES_1S 0x06 #define AMDSB_PM_WDT_BASE_LSB 0x6c #define AMDSB_PM_WDT_BASE_MSB 0x6f -/* RRG 2.3.4, page 223, WDRT. */ +/* SB8xx RRG 2.3.3. */ +#define AMDSB8_PM_WDT_EN 0x48 +#define AMDSB8_WDT_DEC_EN 0x01 +#define AMDSB8_WDT_DISABLE 0x02 +#define AMDSB8_PM_WDT_CTRL 0x4c +#define AMDSB8_WDT_32KHZ 0x00 +#define AMDSB8_WDT_1HZ 0x03 +#define AMDSB8_WDT_RES_MASK 0x03 +#define AMDSB8_PM_RESET_STATUS0 0xC0 +#define AMDSB8_PM_RESET_STATUS1 0xC1 +#define AMDSB8_WD_RST_STS 0x20 +/* SB7xx RRG 2.3.4, WDRT. */ #define AMDSB_WD_CTRL 0x00 #define AMDSB_WD_RUN 0x01 #define AMDSB_WD_FIRED 0x02 @@ -90,8 +103,9 @@ __FBSDID("$FreeBSD$"); #define AMDSB_WDIO_REG_WIDTH 4 /* WDRT */ #define MAXCOUNT_MIN_VALUE 511 -/* RRG 2.3.1.1, page 122; SB600 RRG 2.3.1.1, page 97. */ -#define AMDSB7xx_SMBUS_DEVID 0x43851002 +/* SB7xx RRG 2.3.1.1, SB600 RRG 2.3.1.1, SB8xx RRG 2.3.1. */ +#define AMDSB_SMBUS_DEVID 0x43851002 +#define AMDSB8_SMBUS_REVID 0x40 #define amdsbwd_verbose_printf(dev, ...) \ do { \ @@ -265,7 +279,7 @@ amdsbwd_identify(driver_t *driver, devic smb_dev = pci_find_bsf(0, 20, 0); if (smb_dev == NULL) return; - if (pci_get_devid(smb_dev) != AMDSB7xx_SMBUS_DEVID) + if (pci_get_devid(smb_dev) != AMDSB_SMBUS_DEVID) return; child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "amdsbwd", -1); @@ -273,15 +287,102 @@ amdsbwd_identify(driver_t *driver, devic device_printf(parent, "add amdsbwd child failed\n"); } + +static void +amdsbwd_probe_sb7xx(device_t dev, struct resource *pmres, uint32_t *addr) +{ + uint32_t val; + int i; + + /* Report cause of previous reset for user's convenience. */ + val = pmio_read(pmres, AMDSB_PM_RESET_STATUS0); + if (val != 0) + amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val); + val = pmio_read(pmres, AMDSB_PM_RESET_STATUS1); + if (val != 0) + amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val); + if ((val & AMDSB_WD_RST_STS) != 0) + device_printf(dev, "Previous Reset was caused by Watchdog\n"); + + /* Find base address of memory mapped WDT registers. */ + for (*addr = 0, i = 0; i < 4; i++) { + *addr <<= 8; + *addr |= pmio_read(pmres, AMDSB_PM_WDT_BASE_MSB - i); + } + /* Set watchdog timer tick to 1s. */ + val = pmio_read(pmres, AMDSB_PM_WDT_CTRL); + val &= ~AMDSB_WDT_RES_MASK; + val |= AMDSB_WDT_RES_10MS; + pmio_write(pmres, AMDSB_PM_WDT_CTRL, val); + + /* Enable watchdog device (in stopped state). */ + val = pmio_read(pmres, AMDSB_PM_WDT_CTRL); + val &= ~AMDSB_WDT_DISABLE; + pmio_write(pmres, AMDSB_PM_WDT_CTRL, val); + + /* + * XXX TODO: Ensure that watchdog decode is enabled + * (register 0x41, bit 3). + */ + device_set_desc(dev, "AMD SB600/SB7xx Watchdog Timer"); +} + +static void +amdsbwd_probe_sb8xx(device_t dev, struct resource *pmres, uint32_t *addr) +{ + uint32_t val; + int i; + + /* Report cause of previous reset for user's convenience. */ + val = pmio_read(pmres, AMDSB8_PM_RESET_STATUS0); + if (val != 0) + amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val); + val = pmio_read(pmres, AMDSB8_PM_RESET_STATUS1); + if (val != 0) + amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val); + if ((val & AMDSB8_WD_RST_STS) != 0) + device_printf(dev, "Previous Reset was caused by Watchdog\n"); + + /* Find base address of memory mapped WDT registers. */ + for (*addr = 0, i = 0; i < 4; i++) { + *addr <<= 8; + *addr |= pmio_read(pmres, AMDSB8_PM_WDT_EN + 3 - i); + } + *addr &= ~0x07u; + + /* Set watchdog timer tick to 1s. */ + val = pmio_read(pmres, AMDSB8_PM_WDT_CTRL); + val &= ~AMDSB8_WDT_RES_MASK; + val |= AMDSB8_WDT_1HZ; + pmio_write(pmres, AMDSB8_PM_WDT_CTRL, val); +#ifdef AMDSBWD_DEBUG + val = pmio_read(pmres, AMDSB8_PM_WDT_CTRL); + amdsbwd_verbose_printf(dev, "AMDSB8_PM_WDT_CTRL value = %#02x\n", val); +#endif + + /* + * Enable watchdog device (in stopped state) + * and decoding of its address. + */ + val = pmio_read(pmres, AMDSB8_PM_WDT_EN); + val &= ~AMDSB8_WDT_DISABLE; + val |= AMDSB8_WDT_DEC_EN; + pmio_write(pmres, AMDSB8_PM_WDT_EN, val); +#ifdef AMDSBWD_DEBUG + val = pmio_read(pmres, AMDSB8_PM_WDT_EN); + device_printf(dev, "AMDSB8_PM_WDT_EN value = %#02x\n", val); +#endif + device_set_desc(dev, "AMD SB8xx Watchdog Timer"); +} + static int amdsbwd_probe(device_t dev) { struct resource *res; + device_t smb_dev; uint32_t addr; - uint32_t val; int rid; int rc; - int i; /* Do not claim some ISA PnP device by accident. */ if (isa_get_logicalid(dev) != 0) @@ -301,21 +402,16 @@ amdsbwd_probe(device_t dev) return (ENXIO); } - /* Report cause of previous reset for user's convenience. */ - val = pmio_read(res, AMDSB_PM_RESET_STATUS0); - if (val != 0) - amdsbwd_verbose_printf(dev, "ResetStatus0 = %#04x\n", val); - val = pmio_read(res, AMDSB_PM_RESET_STATUS1); - if (val != 0) - amdsbwd_verbose_printf(dev, "ResetStatus1 = %#04x\n", val); - if ((val & AMDSB_WD_RST_STS) != 0) - device_printf(dev, "Previous Reset was caused by Watchdog\n"); + smb_dev = pci_find_bsf(0, 20, 0); + KASSERT(smb_dev != NULL, ("can't find SMBus PCI device\n")); + if (pci_get_revid(smb_dev) < AMDSB8_SMBUS_REVID) + amdsbwd_probe_sb7xx(dev, res, &addr); + else + amdsbwd_probe_sb8xx(dev, res, &addr); + + bus_release_resource(dev, SYS_RES_IOPORT, rid, res); + bus_delete_resource(dev, SYS_RES_IOPORT, rid); - /* Find base address of memory mapped WDT registers. */ - for (addr = 0, i = 0; i < 4; i++) { - addr <<= 8; - addr |= pmio_read(res, AMDSB_PM_WDT_BASE_MSB - i); - } amdsbwd_verbose_printf(dev, "memory base address = %#010x\n", addr); rc = bus_set_resource(dev, SYS_RES_MEMORY, 0, addr + AMDSB_WD_CTRL, AMDSB_WDIO_REG_WIDTH); @@ -330,36 +426,25 @@ amdsbwd_probe(device_t dev) return (ENXIO); } - /* Set watchdog timer tick to 10ms. */ - val = pmio_read(res, AMDSB_PM_WDT_CTRL); - val &= ~AMDSB_WDT_RES_MASK; - val |= AMDSB_WDT_RES_10MS; - pmio_write(res, AMDSB_PM_WDT_CTRL, val); - - /* Enable watchdog device (in stopped state). */ - val = pmio_read(res, AMDSB_PM_WDT_CTRL); - val &= ~AMDSB_WDT_DISABLE; - pmio_write(res, AMDSB_PM_WDT_CTRL, val); - - /* - * XXX TODO: Ensure that watchdog decode is enabled - * (register 0x41, bit 3). - */ - bus_release_resource(dev, SYS_RES_IOPORT, rid, res); - bus_delete_resource(dev, SYS_RES_IOPORT, rid); - - device_set_desc(dev, "AMD SB600/SB7xx Watchdog Timer"); return (0); } static int amdsbwd_attach_sb(device_t dev, struct amdsbwd_softc *sc) { + device_t smb_dev; + sc->max_ticks = UINT16_MAX; - sc->ms_per_tick = 10; sc->rid_ctrl = 0; sc->rid_count = 1; + smb_dev = pci_find_bsf(0, 20, 0); + KASSERT(smb_dev != NULL, ("can't find SMBus PCI device\n")); + if (pci_get_revid(smb_dev) < AMDSB8_SMBUS_REVID) + sc->ms_per_tick = 10; + else + sc->ms_per_tick = 1000; + sc->res_ctrl = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid_ctrl, RF_ACTIVE); if (sc->res_ctrl == NULL) { @@ -388,6 +473,11 @@ amdsbwd_attach(device_t dev) if (rc != 0) goto fail; +#ifdef AMDSBWD_DEBUG + device_printf(dev, "wd ctrl = %#04x\n", wdctrl_read(sc)); + device_printf(dev, "wd count = %#04x\n", wdcount_read(sc)); +#endif + /* Setup initial state of Watchdog Control. */ wdctrl_write(sc, AMDSB_WD_FIRED); From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 06:42: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 6206B106564A; Tue, 7 Jun 2011 06:42:29 +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 514FC8FC13; Tue, 7 Jun 2011 06:42: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 p576gTHU069348; Tue, 7 Jun 2011 06:42:29 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p576gT61069346; Tue, 7 Jun 2011 06:42:29 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106070642.p576gT61069346@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 7 Jun 2011 06:42: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: r222806 - 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: Tue, 07 Jun 2011 06:42:29 -0000 Author: ae Date: Tue Jun 7 06:42:29 2011 New Revision: 222806 URL: http://svn.freebsd.org/changeset/base/222806 Log: Make a behaviour of the libalias based in-kernel NAT a bit closer to how natd(8) does work. natd(8) drops packets only when libalias returns PKT_ALIAS_IGNORED and "deny_incoming" option is set, but ipfw_nat always did drop packets that were not aliased, even if they should not be aliased and just are going through. PR: kern/122109, kern/129093, kern/157379 Submitted by: Alexander V. Chernikov (previous version) MFC after: 1 month Modified: head/sys/netinet/ipfw/ip_fw_nat.c Modified: head/sys/netinet/ipfw/ip_fw_nat.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_nat.c Tue Jun 7 06:18:02 2011 (r222805) +++ head/sys/netinet/ipfw/ip_fw_nat.c Tue Jun 7 06:42:29 2011 (r222806) @@ -262,17 +262,27 @@ ipfw_nat(struct ip_fw_args *args, struct else retval = LibAliasOut(t->lib, c, mcl->m_len + M_TRAILINGSPACE(mcl)); - if (retval == PKT_ALIAS_RESPOND) { - m->m_flags |= M_SKIP_FIREWALL; - retval = PKT_ALIAS_OK; - } - if (retval != PKT_ALIAS_OK && - retval != PKT_ALIAS_FOUND_HEADER_FRAGMENT) { + + /* + * We drop packet when: + * 1. libalias returns PKT_ALIAS_ERROR; + * 2. For incoming packets: + * a) for unresolved fragments; + * b) libalias returns PKT_ALIAS_IGNORED and + * PKT_ALIAS_DENY_INCOMING flag is set. + */ + if (retval == PKT_ALIAS_ERROR || + (args->oif == NULL && (retval == PKT_ALIAS_UNRESOLVED_FRAGMENT || + (retval == PKT_ALIAS_IGNORED && + (t->lib->packetAliasMode & PKT_ALIAS_DENY_INCOMING) != 0)))) { /* XXX - should i add some logging? */ m_free(mcl); args->m = NULL; return (IP_FW_DENY); } + + if (retval == PKT_ALIAS_RESPOND) + m->m_flags |= M_SKIP_FIREWALL; mcl->m_pkthdr.len = mcl->m_len = ntohs(ip->ip_len); /* From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 06:48: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 8C95B1065670; Tue, 7 Jun 2011 06:48:42 +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 624568FC0A; Tue, 7 Jun 2011 06:48: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 p576mg8r069620; Tue, 7 Jun 2011 06:48:42 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p576mgqv069618; Tue, 7 Jun 2011 06:48:42 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106070648.p576mgqv069618@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 7 Jun 2011 06:48: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: r222808 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 06:48:42 -0000 Author: ae Date: Tue Jun 7 06:48:42 2011 New Revision: 222808 URL: http://svn.freebsd.org/changeset/base/222808 Log: Sync ng_nat with recent (r222806) ipfw_nat changes: Make a behaviour of the libalias based in-kernel NAT a bit closer to how natd(8) does work. natd(8) drops packets only when libalias returns PKT_ALIAS_IGNORED and "deny_incoming" option is set, but ipfw_nat always did drop packets that were not aliased, even if they should not be aliased and just are going through. Also add SCTP support: mark response packets to skip firewall processing. MFC after: 1 month Modified: head/sys/netgraph/ng_nat.c Modified: head/sys/netgraph/ng_nat.c ============================================================================== --- head/sys/netgraph/ng_nat.c Tue Jun 7 06:45:51 2011 (r222807) +++ head/sys/netgraph/ng_nat.c Tue Jun 7 06:48:42 2011 (r222808) @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -696,22 +697,35 @@ ng_nat_rcvdata(hook_p hook, item_p item KASSERT(m->m_pkthdr.len == ntohs(ip->ip_len), ("ng_nat: ip_len != m_pkthdr.len")); + /* + * We drop packet when: + * 1. libalias returns PKT_ALIAS_ERROR; + * 2. For incoming packets: + * a) for unresolved fragments; + * b) libalias returns PKT_ALIAS_IGNORED and + * PKT_ALIAS_DENY_INCOMING flag is set. + */ if (hook == priv->in) { rval = LibAliasIn(priv->lib, c, m->m_len + M_TRAILINGSPACE(m)); - if (rval != PKT_ALIAS_OK && - rval != PKT_ALIAS_FOUND_HEADER_FRAGMENT) { + if (rval == PKT_ALIAS_ERROR || + rval == PKT_ALIAS_UNRESOLVED_FRAGMENT || + (rval == PKT_ALIAS_IGNORED && + (priv->lib->packetAliasMode & + PKT_ALIAS_DENY_INCOMING) != 0)) { NG_FREE_ITEM(item); return (EINVAL); } } else if (hook == priv->out) { rval = LibAliasOut(priv->lib, c, m->m_len + M_TRAILINGSPACE(m)); - if (rval != PKT_ALIAS_OK) { + if (rval == PKT_ALIAS_ERROR) { NG_FREE_ITEM(item); return (EINVAL); } } else panic("ng_nat: unknown hook!\n"); + if (rval == PKT_ALIAS_RESPOND) + m->m_flags |= M_SKIP_FIREWALL; m->m_pkthdr.len = m->m_len = ntohs(ip->ip_len); if ((ip->ip_off & htons(IP_OFFMASK)) == 0 && From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 06:57: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 AE675106566C; Tue, 7 Jun 2011 06:57:22 +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 9DB7D8FC08; Tue, 7 Jun 2011 06:57: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 p576vM3J069912; Tue, 7 Jun 2011 06:57:22 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p576vMem069910; Tue, 7 Jun 2011 06:57:22 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106070657.p576vMem069910@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 7 Jun 2011 06:57: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: r222809 - head/sys/netinet/libalias X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 06:57:22 -0000 Author: ae Date: Tue Jun 7 06:57:22 2011 New Revision: 222809 URL: http://svn.freebsd.org/changeset/base/222809 Log: Fix indentation. Modified: head/sys/netinet/libalias/alias_sctp.h Modified: head/sys/netinet/libalias/alias_sctp.h ============================================================================== --- head/sys/netinet/libalias/alias_sctp.h Tue Jun 7 06:48:42 2011 (r222808) +++ head/sys/netinet/libalias/alias_sctp.h Tue Jun 7 06:57:22 2011 (r222809) @@ -135,13 +135,13 @@ struct sctp_nat_assoc { struct in_addr a_addr; /**< alias ip address */ int state; /**< current state of NAT association */ int TableRegister; /**< stores which look up tables association is registered in */ - int exp; /**< timer expiration in seconds from uptime */ + int exp; /**< timer expiration in seconds from uptime */ int exp_loc; /**< current location in timer_Q */ int num_Gaddr; /**< number of global IP addresses in the list */ LIST_HEAD(sctpGlobalAddresshead,sctp_GlobalAddress) Gaddr; /**< List of global addresses */ - LIST_ENTRY (sctp_nat_assoc) list_L; /**< Linked list of pointers for Local table*/ - LIST_ENTRY (sctp_nat_assoc) list_G; /**< Linked list of pointers for Global table */ - LIST_ENTRY (sctp_nat_assoc) timer_Q; /**< Linked list of pointers for timer Q */ + LIST_ENTRY (sctp_nat_assoc) list_L; /**< Linked list of pointers for Local table*/ + LIST_ENTRY (sctp_nat_assoc) list_G; /**< Linked list of pointers for Global table */ + LIST_ENTRY (sctp_nat_assoc) timer_Q; /**< Linked list of pointers for timer Q */ //Using libalias locking }; From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 07:33: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 62517106566B; Tue, 7 Jun 2011 07:33: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 BB9508FC13; Tue, 7 Jun 2011 07:33:40 +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 p577XbbN021747 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Jun 2011 17:33:38 +1000 Date: Tue, 7 Jun 2011 17:33:37 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Marcel Moolenaar In-Reply-To: <201106070128.p571SCVI059714@svn.freebsd.org> Message-ID: <20110607161510.M1142@besplex.bde.org> References: <201106070128.p571SCVI059714@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222801 - in head/sys: ddb 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, 07 Jun 2011 07:33:41 -0000 On Tue, 7 Jun 2011, Marcel Moolenaar wrote: > Log: > Fix making kernel dumps from the debugger by creating a command > for it. It is impossible to fix this. It is only possible to make it less broken. Making kernel dumps touches far to much space to be controllable by a debugger. Debugger commands really should put back everything the way that it was before the command, except possibly for changing a byte or two of memory, and this is too hard to do for a complicated operation like making dumps. The "byte or two" changed by it should strictly be all bytes in the dump image but nothing in the system state anywhere else. > Do not not expect a developer to call doadump(). Calling > doadump does not necessarily work when it's declared static. Nor The bug that breaks static doadump() is presumably gcc -finline-functions-called-once. This breaks lots of other things. E.g., it breaks stack traces. A stack tracer with full debugging info might be able to restore all the inlined functions virtually, but I've mever seen gdb doing that, and a primitive stack tracer like the one used by ddb and panic can't do that. However, we already use the technique of putting static functions that are normally called not at all, but might be useful for ddb, by wrapping them as ddb functions so that they might be called at least once. They sometimes remain static, but are still hard to inline and remove if they are called once since, since the calls to them are via function pointers in the ddb command tables. > does it necessarily do what was intended in the context of text > dumps. The dump command always creates a core dump. > > Move printing of error messages from doadump to the dump command, > now that we don't have to worry about being called from DDB. Printing in doadump() (when called from ddb) is still quite broken (like the entire command. doadump() still uses printf() for at least status messages. I think there are hacks to turn printf() into db_printf() when in ddb context, so you gain little from moving the first printf() into a db_printf() in the dump command. However, since the other printf()s are actually db_printf()s, they don't operate normally. In particular, they don't go to the message buffer. This may be a feature. The problem with turning a cally to the any() function into an 'any' command is that it confuses naive developers into thinking that the 'any' operation is actually supported by ddb. ddb should use trampolines for all calls to the any() function and for unsafe `any' commands. This involves backing out of ddb context into a normal context and arranging to come back. A breakpoint in the trampoline might be enough to come back, but perhaps there should be options to keep more control, e.g.: - keep interrupts masked while running the trampoline. But this has never worked right even for single stepping -- single stepping involves backing out of ddb and coming back with a trace trap; it is important that the single step steps only a single instruction, but it actually allows any number of instructions to execute via interrupts on the current CPU (because it enables interrupts on the current CPU, and interrupts have precedence over the trace trap on at least i386), and it allows any number of instructions to execute on other CPUs (since it unstops other CPUs) - keep other CPUs stopped while running the trampoline. Otherwise you have the same bugs as for trace traps. It is unclear if an any() function can run safely either with all CPUs stopped or without them stopped. In general it can't, since it might be the start function or the stop function. [k]gdb runs in a separate address space and/or machine, so it must use a a trampoline to call the any() function and would need similar to have commands. I think gdb gets this right, but kgdb doesn't. At best, the kernel part of kgdb could install the trampoline and back out of kdb to run the trampoline; it cannot keep enough control to work right since kdb/ddb doesn't support keeping enough control for even trace traps to work right. kgdb also cannot reasonably have a builtin dump command. It couldn't do much better than calling doadump(). doadump() needs to be non-inline to support this, and the problems with calling it directly are obvious. > Modified: > head/sys/ddb/db_command.c > head/sys/kern/kern_shutdown.c > head/sys/sys/conf.h > > Modified: head/sys/ddb/db_command.c > ============================================================================== > --- head/sys/ddb/db_command.c Tue Jun 7 01:06:49 2011 (r222800) > +++ head/sys/ddb/db_command.c Tue Jun 7 01:28:12 2011 (r222801) > @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > Style bug (includes more unsorted than before ('f' < 's'). > @@ -526,6 +529,27 @@ db_error(s) > kdb_reenter(); > } > > +static void > +db_dump(db_expr_t dummy, boolean_t dummy2, db_expr_t dummy3, char *dummy4) > +{ > + int error; > + > + error = doadump(FALSE); > + if (error) { > + db_printf("Cannot dump: "); > + switch (error) { > + case EBUSY: > + db_printf("debugger got invoked while dumping.\n"); > + break; > + case ENXIO: > + db_printf("no dump device specified.\n"); > + break; > + default: > + db_printf("unknown error (error=%d).\n", error); > + break; > + } > + } > +} > > /* > * Call random function: > Style bugs (kernel messages are not terminated with a "."). > Modified: head/sys/kern/kern_shutdown.c > ============================================================================== > --- head/sys/kern/kern_shutdown.c Tue Jun 7 01:06:49 2011 (r222800) > +++ head/sys/kern/kern_shutdown.c Tue Jun 7 01:28:12 2011 (r222801) > @@ -233,30 +233,32 @@ print_uptime(void) > printf("%lds\n", (long)ts.tv_sec); > } > > -static void > -doadump(void) > +int > +doadump(boolean_t textdump) > { > + boolean_t coredump; Style bugs (use of boolean_t. KNF uses plain int. boolean_t is a Mach vm type which I made the mistake of starting to centralize in FreeBSD-1, but it is still used in only about 10 places in /sys/kern). > > - /* > - * Sometimes people have to call this from the kernel debugger. > - * (if 'panic' can not dump) This fixes a style bug (the "." was not at the end of the sentence). > - * Give them a clue as to why they can't dump. > - */ > - if (dumper.dumper == NULL) { > - printf("Cannot dump. Device not defined or unavailable.\n"); > - return; > - } This fixes a style bug (sentence break of 1 space instead of 2). Termination with a "." may be acceptable for multiple sentences (but you changed the output into 1 sentence by replacing the first "." with a ":"). The new message for ENXIO gives less detail than this. The comment seems to have been wrong in limiting itself to the interactive case. doadump() used to return void, so callers couldn't tell if it worked. Now it returns int, but the kern_reboot() caller still doesn't check. So no message is printed when one was before when RB_DUMP is specified but dumping is not available. There was never any message for suppression of dumps due to cold or recursive dumping. The call to doadump() from kern_reboot() avoids these cases, but the one from the dump command is as blind as a developer calling doadump() without knowing about these cases. This may be a feature. > + if (dumping) > + return (EBUSY); Oops, recursive dumping is prevented here, so it is impossible to force even if it might work. > + if (dumper.dumper == NULL) > + return (ENXIO); > ... > @@ -425,7 +427,7 @@ kern_reboot(int howto) > EVENTHANDLER_INVOKE(shutdown_post_sync, howto); > > if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping) > - doadump(); > + doadump(TRUE); > > /* Now that we're going to really halt the system... */ > EVENTHANDLER_INVOKE(shutdown_final, howto); > The check for recursion is now redundant here. There was no warning for recursion. Now there is a warning for the dump command but not for here (not sure if we can get here with dumping != 0 -- it is probably a recursive panic then). doadump() still doesn't check `cold', a blind developer can fall into a cold dump and a non-blind developer can try to force it. But maybe `cold' implies dumper.dumper == NULL, so the check of `cold' here is just redundant. > Modified: head/sys/sys/conf.h > ============================================================================== > --- head/sys/sys/conf.h Tue Jun 7 01:06:49 2011 (r222800) > +++ head/sys/sys/conf.h Tue Jun 7 01:28:12 2011 (r222801) > @@ -332,6 +332,7 @@ struct dumperinfo { > int set_dumper(struct dumperinfo *); > int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t); > void dumpsys(struct dumperinfo *); > +int doadump(boolean_t); > extern int dumping; /* system is dumping */ > > #endif /* _KERNEL */ > Style bug (declarations more unsorted than before ('o' < 'u'). Bruce From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 08:46: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 0EF3E1065673; Tue, 7 Jun 2011 08:46:14 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE9158FC0A; Tue, 7 Jun 2011 08:46: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 p578kDLD073486; Tue, 7 Jun 2011 08:46:13 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p578kD4K073476; Tue, 7 Jun 2011 08:46:13 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201106070846.p578kD4K073476@svn.freebsd.org> From: Attilio Rao Date: Tue, 7 Jun 2011 08:46: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: r222813 - in head: . contrib/top gnu/usr.bin/gdb/kgdb lib/libkvm lib/libmemstat share/man/man4 share/mk sys/amd64/acpica sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sy... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 08:46:14 -0000 Author: attilio Date: Tue Jun 7 08:46:13 2011 New Revision: 222813 URL: http://svn.freebsd.org/changeset/base/222813 Log: etire the cpumask_t type and replace it with cpuset_t usage. This is intended to fix the bug where cpu mask objects are capped to 32. MAXCPU, then, can now arbitrarely bumped to whatever value. Anyway, as long as several structures in the kernel are statically allocated and sized as MAXCPU, it is suggested to keep it as low as possible for the time being. Technical notes on this commit itself: - More functions to handle with cpuset_t objects are introduced. The most notable are cpusetobj_ffs() (which calculates a ffs(3) for a cpuset_t object), cpusetobj_strprint() (which prepares a string representing a cpuset_t object) and cpusetobj_strscan() (which creates a valid cpuset_t starting from a string representation). - pc_cpumask and pc_other_cpus are target to be removed soon. With the moving from cpumask_t to cpuset_t they are now inefficient and not really useful. Anyway, for the time being, please note that access to pcpu datas is protected by sched_pin() in order to avoid migrating the CPU while reading more than one (possible) word - Please note that size of cpuset_t objects may differ between kernel and userland. While this is not directly related to the patch itself, it is good to understand that concept and possibly use the patch as a reference on how to deal with cpuset_t objects in userland, when accessing kernland members. - KTR_CPUMASK is changed and now is represented through a string, to be set as the example reported in NOTES. Please additively note that no MAXCPU is bumped in this patch, but private testing has been done until to MAXCPU=128 on a real 8x8x2(htt) machine (amd64). Please note that the FreeBSD version is not yet bumped because of the upcoming pcpu changes. However, note that this patch is not targeted for MFC. People to thank for the time spent on this patch: - sbruno, pluknet and Nicholas Esborn (nick AT desert DOT net) tested several revision of the patches and really helped in improving stability of this work. - marius fixed several bugs in the sparc64 implementation and reviewed patches related to ktr. - jeff and jhb discussed the basic approach followed. - kib and marcel made targeted review on some specific part of the patch. - marius, art, nwhitehorn and andreast reviewed MD specific part of the patch. - marius, andreast, gonzo, nwhitehorn and jceel tested MD specific implementations of the patch. - Other people have made contributions on other patches that have been already committed and have been listed separately. Companies that should be mentioned for having participated at several degrees: - Yahoo! for having offered the machines used for testing on big count of CPUs. - The FreeBSD Foundation for having sponsored my devsummit attendance, which has been instrumental. - Sandvine for having offered offices and infrastructure during development. (I really hope I didn't forget anyone, if it happened I apologize in advance). Added: head/sys/sys/_cpuset.h - copied unchanged from r222812, projects/largeSMP/sys/sys/_cpuset.h Replaced: head/share/man/man4/geom_map.4 - copied unchanged from r222812, projects/largeSMP/share/man/man4/geom_map.4 head/sys/dev/iicbus/ad7417.c - copied unchanged from r222812, projects/largeSMP/sys/dev/iicbus/ad7417.c head/sys/nfs/nfs_kdtrace.h - copied unchanged from r222812, projects/largeSMP/sys/nfs/nfs_kdtrace.h head/sys/sys/_stdint.h - copied unchanged from r222812, projects/largeSMP/sys/sys/_stdint.h head/tools/build/options/WITHOUT_GPIO - copied unchanged from r222812, projects/largeSMP/tools/build/options/WITHOUT_GPIO head/tools/build/options/WITH_OFED - copied unchanged from r222812, projects/largeSMP/tools/build/options/WITH_OFED head/tools/regression/bin/sh/builtins/set1.0 - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/builtins/set1.0 head/tools/regression/bin/sh/parser/dollar-quote1.0 - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote1.0 head/tools/regression/bin/sh/parser/dollar-quote2.0 - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote2.0 head/tools/regression/bin/sh/parser/dollar-quote3.0 - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote3.0 head/tools/regression/bin/sh/parser/dollar-quote4.0 - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote4.0 head/tools/regression/bin/sh/parser/dollar-quote5.0 - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote5.0 head/tools/regression/bin/sh/parser/dollar-quote6.0 - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote6.0 head/tools/regression/bin/sh/parser/dollar-quote7.0 - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote7.0 head/tools/regression/bin/sh/parser/dollar-quote8.0 - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote8.0 head/tools/regression/bin/sh/parser/dollar-quote9.0 - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote9.0 Modified: head/UPDATING head/gnu/usr.bin/gdb/kgdb/kthr.c head/lib/libkvm/kvm_pcpu.c head/lib/libmemstat/memstat_uma.c head/sys/amd64/acpica/acpi_wakeup.c head/sys/amd64/amd64/intr_machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/pmap.c head/sys/amd64/amd64/vm_machdep.c head/sys/amd64/include/_types.h head/sys/amd64/include/pmap.h head/sys/amd64/include/smp.h head/sys/arm/arm/pmap.c head/sys/arm/include/_types.h head/sys/arm/include/pmap.h head/sys/cddl/dev/cyclic/i386/cyclic_machdep.c head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c head/sys/cddl/dev/dtrace/i386/dtrace_subr.c head/sys/conf/NOTES head/sys/dev/hwpmc/hwpmc_mod.c head/sys/dev/xen/control/control.c head/sys/geom/eli/g_eli.c head/sys/i386/i386/intr_machdep.c head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/pmap.c head/sys/i386/i386/vm_machdep.c head/sys/i386/include/_types.h head/sys/i386/include/pmap.h head/sys/i386/include/sf_buf.h head/sys/i386/include/smp.h head/sys/i386/xen/mp_machdep.c head/sys/i386/xen/pmap.c head/sys/ia64/ia64/mp_machdep.c head/sys/ia64/include/_types.h head/sys/ia64/include/smp.h head/sys/kern/kern_cpuset.c head/sys/kern/kern_ktr.c head/sys/kern/kern_pmc.c head/sys/kern/kern_rmlock.c head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c head/sys/kern/subr_kdb.c head/sys/kern/subr_pcpu.c head/sys/kern/subr_smp.c head/sys/mips/cavium/octeon_mp.c head/sys/mips/include/_types.h head/sys/mips/include/hwfunc.h head/sys/mips/include/pmap.h head/sys/mips/include/smp.h head/sys/mips/mips/mp_machdep.c head/sys/mips/mips/pmap.c head/sys/mips/rmi/xlr_machdep.c head/sys/mips/sibyte/sb_scd.c head/sys/ofed/include/linux/list.h head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/platform_bare.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/include/_types.h head/sys/powerpc/include/openpicvar.h head/sys/powerpc/include/pmap.h head/sys/powerpc/include/smp.h head/sys/powerpc/mpc85xx/openpic_fdt.c head/sys/powerpc/powerpc/intr_machdep.c head/sys/powerpc/powerpc/mp_machdep.c head/sys/powerpc/powerpc/openpic.c head/sys/powerpc/powerpc/pic_if.m head/sys/sparc64/include/_types.h head/sys/sparc64/include/ktr.h head/sys/sparc64/include/pmap.h head/sys/sparc64/include/smp.h head/sys/sparc64/sparc64/genassym.c head/sys/sparc64/sparc64/intr_machdep.c head/sys/sparc64/sparc64/mp_exception.S head/sys/sparc64/sparc64/mp_machdep.c head/sys/sparc64/sparc64/pmap.c head/sys/sparc64/sparc64/swtch.S head/sys/sparc64/sparc64/tlb.c head/sys/sys/_rmlock.h head/sys/sys/cpuset.h head/sys/sys/ktr.h head/sys/sys/pcpu.h head/sys/sys/pmckern.h head/sys/sys/smp.h head/sys/sys/types.h head/sys/x86/x86/local_apic.c head/usr.sbin/pmccontrol/pmccontrol.c Directory Properties: head/ (props changed) head/cddl/contrib/opensolaris/ (props changed) head/contrib/bind9/ (props changed) head/contrib/binutils/ (props changed) head/contrib/bzip2/ (props changed) head/contrib/compiler-rt/ (props changed) head/contrib/dialog/ (props changed) head/contrib/ee/ (props changed) head/contrib/expat/ (props changed) head/contrib/file/ (props changed) head/contrib/gcc/ (props changed) head/contrib/gdb/ (props changed) head/contrib/gdtoa/ (props changed) head/contrib/gnu-sort/ (props changed) head/contrib/groff/ (props changed) head/contrib/less/ (props changed) head/contrib/libpcap/ (props changed) head/contrib/libstdc++/ (props changed) head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) head/contrib/ncurses/ (props changed) head/contrib/netcat/ (props changed) head/contrib/ntp/ (props changed) head/contrib/one-true-awk/ (props changed) head/contrib/openbsm/ (props changed) head/contrib/openpam/ (props changed) head/contrib/pf/ (props changed) head/contrib/sendmail/ (props changed) head/contrib/tcpdump/ (props changed) head/contrib/tcsh/ (props changed) head/contrib/top/ (props changed) head/contrib/top/install-sh (props changed) head/contrib/tzcode/stdtime/ (props changed) head/contrib/tzcode/zic/ (props changed) head/contrib/tzdata/ (props changed) head/contrib/wpa/ (props changed) head/contrib/xz/ (props changed) head/crypto/openssh/ (props changed) head/crypto/openssl/ (props changed) head/gnu/lib/ (props changed) head/gnu/usr.bin/binutils/ (props changed) head/gnu/usr.bin/cc/cc_tools/ (props changed) head/gnu/usr.bin/gdb/ (props changed) head/lib/libc/ (props changed) head/lib/libc/stdtime/ (props changed) head/lib/libutil/ (props changed) head/lib/libz/ (props changed) head/sbin/ (props changed) head/sbin/ipfw/ (props changed) head/share/mk/bsd.arch.inc.mk (props changed) head/share/zoneinfo/ (props changed) head/sys/ (props changed) head/sys/amd64/include/xen/ (props changed) head/sys/boot/ (props changed) head/sys/boot/i386/efi/ (props changed) head/sys/boot/ia64/efi/ (props changed) head/sys/boot/ia64/ski/ (props changed) head/sys/boot/powerpc/boot1.chrp/ (props changed) head/sys/boot/powerpc/ofw/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) head/sys/conf/ (props changed) head/sys/contrib/dev/acpica/ (props changed) head/sys/contrib/octeon-sdk/ (props changed) head/sys/contrib/pf/ (props changed) head/sys/contrib/x86emu/ (props changed) head/usr.bin/calendar/ (props changed) head/usr.bin/csup/ (props changed) head/usr.bin/procstat/ (props changed) head/usr.sbin/ndiscvt/ (props changed) head/usr.sbin/zic/ (props changed) Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Jun 7 08:24:29 2011 (r222812) +++ head/UPDATING Tue Jun 7 08:46:13 2011 (r222813) @@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20110607: + cpumask_t type is retired and cpuset_t is used in order to describe + a mask of CPUs. + 20110513: Support for sun4v architecture is officially dropped Modified: head/gnu/usr.bin/gdb/kgdb/kthr.c ============================================================================== --- head/gnu/usr.bin/gdb/kgdb/kthr.c Tue Jun 7 08:24:29 2011 (r222812) +++ head/gnu/usr.bin/gdb/kgdb/kthr.c Tue Jun 7 08:46:13 2011 (r222813) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -37,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -48,7 +50,7 @@ static CORE_ADDR dumppcb; static int dumptid; static CORE_ADDR stoppcbs; -static __cpumask_t stopped_cpus; +static cpuset_t stopped_cpus; static struct kthr *first; struct kthr *curkthr; @@ -76,6 +78,7 @@ kgdb_thr_init(void) { struct proc p; struct thread td; + long cpusetsize; struct kthr *kt; CORE_ADDR addr; uintptr_t paddr; @@ -102,10 +105,11 @@ kgdb_thr_init(void) dumptid = -1; addr = kgdb_lookup("stopped_cpus"); - if (addr != 0) - kvm_read(kvm, addr, &stopped_cpus, sizeof(stopped_cpus)); - else - stopped_cpus = 0; + CPU_ZERO(&stopped_cpus); + cpusetsize = sysconf(_SC_CPUSET_SIZE); + if (cpusetsize != -1 && (u_long)cpusetsize <= sizeof(cpuset_t) && + addr != 0) + kvm_read(kvm, addr, &stopped_cpus, cpusetsize); stoppcbs = kgdb_lookup("stoppcbs"); @@ -126,8 +130,8 @@ kgdb_thr_init(void) kt->kaddr = addr; if (td.td_tid == dumptid) kt->pcb = dumppcb; - else if (td.td_state == TDS_RUNNING && ((1 << td.td_oncpu) & stopped_cpus) - && stoppcbs != 0) + else if (td.td_state == TDS_RUNNING && stoppcbs != 0 && + CPU_ISSET(td.td_oncpu, &stopped_cpus)) kt->pcb = (uintptr_t) stoppcbs + sizeof(struct pcb) * td.td_oncpu; else kt->pcb = (uintptr_t)td.td_pcb; Modified: head/lib/libkvm/kvm_pcpu.c ============================================================================== --- head/lib/libkvm/kvm_pcpu.c Tue Jun 7 08:24:29 2011 (r222812) +++ head/lib/libkvm/kvm_pcpu.c Tue Jun 7 08:46:13 2011 (r222813) @@ -39,11 +39,13 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include #include #include +#include #include "kvm_private.h" @@ -118,6 +120,9 @@ _kvm_pcpu_clear(void) void * kvm_getpcpu(kvm_t *kd, int cpu) { + long kcpusetsize; + ssize_t nbytes; + uintptr_t readptr; char *buf; if (kd == NULL) { @@ -125,6 +130,10 @@ kvm_getpcpu(kvm_t *kd, int cpu) return (NULL); } + kcpusetsize = sysconf(_SC_CPUSET_SIZE); + if (kcpusetsize == -1 || (u_long)kcpusetsize > sizeof(cpuset_t)) + return ((void *)-1); + if (maxcpu == 0) if (_kvm_pcpu_init(kd) < 0) return ((void *)-1); @@ -137,8 +146,26 @@ kvm_getpcpu(kvm_t *kd, int cpu) _kvm_err(kd, kd->program, "out of memory"); return ((void *)-1); } - if (kvm_read(kd, (uintptr_t)pcpu_data[cpu], buf, sizeof(struct pcpu)) != - sizeof(struct pcpu)) { + nbytes = sizeof(struct pcpu) - 2 * kcpusetsize; + readptr = (uintptr_t)pcpu_data[cpu]; + if (kvm_read(kd, readptr, buf, nbytes) != nbytes) { + _kvm_err(kd, kd->program, "unable to read per-CPU data"); + free(buf); + return ((void *)-1); + } + + /* Fetch the valid cpuset_t objects. */ + CPU_ZERO((cpuset_t *)(buf + nbytes)); + CPU_ZERO((cpuset_t *)(buf + nbytes + sizeof(cpuset_t))); + readptr += nbytes; + if (kvm_read(kd, readptr, buf + nbytes, kcpusetsize) != kcpusetsize) { + _kvm_err(kd, kd->program, "unable to read per-CPU data"); + free(buf); + return ((void *)-1); + } + readptr += kcpusetsize; + if (kvm_read(kd, readptr, buf + nbytes + sizeof(cpuset_t), + kcpusetsize) != kcpusetsize) { _kvm_err(kd, kd->program, "unable to read per-CPU data"); free(buf); return ((void *)-1); Modified: head/lib/libmemstat/memstat_uma.c ============================================================================== --- head/lib/libmemstat/memstat_uma.c Tue Jun 7 08:24:29 2011 (r222812) +++ head/lib/libmemstat/memstat_uma.c Tue Jun 7 08:46:13 2011 (r222813) @@ -27,6 +27,7 @@ */ #include +#include #include #define LIBMEMSTAT /* Cause vm_page.h not to include opt_vmpage.h */ @@ -44,6 +45,7 @@ #include #include #include +#include #include "memstat.h" #include "memstat_internal.h" @@ -313,7 +315,8 @@ memstat_kvm_uma(struct memory_type_list struct uma_keg *kzp, kz; int hint_dontsearch, i, mp_maxid, ret; char name[MEMTYPE_MAXNAME]; - __cpumask_t all_cpus; + cpuset_t all_cpus; + long cpusetsize; kvm_t *kvm; kvm = (kvm_t *)kvm_handle; @@ -337,7 +340,13 @@ memstat_kvm_uma(struct memory_type_list list->mtl_error = ret; return (-1); } - ret = kread_symbol(kvm, X_ALL_CPUS, &all_cpus, sizeof(all_cpus), 0); + cpusetsize = sysconf(_SC_CPUSET_SIZE); + if (cpusetsize == -1 || (u_long)cpusetsize > sizeof(cpuset_t)) { + list->mtl_error = MEMSTAT_ERROR_KVM_NOSYMBOL; + return (-1); + } + CPU_ZERO(&all_cpus); + ret = kread_symbol(kvm, X_ALL_CPUS, &all_cpus, cpusetsize, 0); if (ret != 0) { list->mtl_error = ret; return (-1); @@ -407,7 +416,7 @@ memstat_kvm_uma(struct memory_type_list if (kz.uk_flags & UMA_ZFLAG_INTERNAL) goto skip_percpu; for (i = 0; i < mp_maxid + 1; i++) { - if ((all_cpus & (1 << i)) == 0) + if (!CPU_ISSET(i, &all_cpus)) continue; ucp = &ucp_array[i]; mtp->mt_numallocs += ucp->uc_allocs; Copied: head/share/man/man4/geom_map.4 (from r222812, projects/largeSMP/share/man/man4/geom_map.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/geom_map.4 Tue Jun 7 08:46:13 2011 (r222813, copy of r222812, projects/largeSMP/share/man/man4/geom_map.4) @@ -0,0 +1,211 @@ +.\" +.\" Copyright (c) 2011 Aleksandr Rybalko +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 17, 2011 +.Dt GEOM_MAP 4 +.Os +.Sh NAME +.Nm geom_map +.Nd "GEOM module that maps defined items as separate partitions" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device geom_map" +.Ed +.Sh DESCRIPTION +The +.Nm +framework provides support for mapping defined parts of the media. +Basically it is helpful for embedded devices where in the one continuous +flash are loader, kernel and rootfs parts. +.Nm +allows making them available as separate parts and protects the loader from +being overwritten. +.Pp +At boot time +.Nm +partitions are listed (only with bootverbose) as: +.Bd -literal -offset indent +MAP: 0x30000, data=0x30000 "/dev/map/bootloader" +MAP: 30000x10000, data=0x10000 "/dev/map/factory" +MAP: 40000x7a0000, data=0x7a0000 "/dev/map/upgrade" +MAP: search key ".!/bin/sh" from 0x100000, step 0x10000 +MAP: 40000x110000, data=0x110000 "/dev/map/kernel" +MAP: search key ".!/bin/sh" from 0x100000, step 0x10000 +MAP: 150000x690000, data=0x690000 "/dev/map/rootfs" +MAP: 7e0000x20000, data=0x20000 "/dev/map/config" +.Ed +.Pp +The current +.Nm +configuration can be accessed with the following +.Xr sysctl 8 +nodes: +.Va kern.geom.conftxt , kern.geom.confxml , +and +.Va kern.geom.confdot +or by using +.Dq Li "geom map list" . +.Bd -literal -offset indent +# sysctl -n kern.geom.conftxt +0 MD md0 10485760 512 u 0 s 512 f 0 fs 0 l 10485760 t malloc +0 DISK cfid0 8388608 4 hd 0 sc 0 +1 MAP map/config 131072 4 i 5 o 8257536 entry 0 dsize 131072 +1 MAP map/rootfs 6881280 4 i 4 o 1376256 entry 0 dsize 6881280 +2 UNCOMPRESS map/rootfs.uncompress 18677760 512 +1 MAP map/kernel 1114112 4 i 3 o 262144 entry 0 dsize 1114112 +1 MAP map/upgrade 7995392 4 i 2 o 262144 entry 0 dsize 7995392 +1 MAP map/factory 65536 4 i 1 o 196608 entry 0 dsize 65536 +1 MAP map/bootloader 196608 4 i 0 o 0 entry 0 dsize 196608 +.Ed +.Pp +Driver configuration can be done in +.Xr device.hints 5 . +List of used parameters: +.Bl -tag -width indent +.It Va at +select media to attach +.It Va name +name of partition (will create device +.Pa /dev/map/ Ns Ar that_name ) +.It Va start +offset from the beginning of the parent media to start of the mapped partition. +This field can also have a special value +.Qq Li search: Ns Ar searchstart Ns Li : Ns Ar searchstep Ns Li : Ns Ar searchkey , +where: +.Bl -tag -width indent +.It Ar searchstart +offset from the beginning of the parent media where search will be started +.It Ar searchstep +value of the increment used while searching for the partition boundary markers +.It Ar searchkey +key which will be used to find partition boundary markers. +The wildcard +.Ql .\& +can be used to match any character on that position +.El +.It Va end +offset from the beginning of the parent media to the end of the mapped partition. +This field can also have the special value +.Qq Li search: Ns Ar searchstart Ns Li : Ns Ar searchstep Ns Li : Ns Ar searchkey , +as described above. +.It Va offset +offset where the data of the mapped partition begins +.El +.Pp +Each record contains the start address (in bytes) from the media begin, size +(in bytes), offset where the data of mapped partition begins, and the name of +new device. +.Bd -literal -offset indent +MAP: 150000x690000, data=0x690000 "/dev/map/rootfs" +.Ed +.Bd -literal +00150000 - start address +00690000 - size +00000000 - data begin from zero offset +00690000 - data size +"map/rootfs" - new media will be accessible via /dev/map/rootfs dev. +.Ed +.Sh EXAMPLES +If we need to implement layout shown above, we need to define the following +hints: +.Bd -literal -offset indent +hint.map.0.at="cfid0" +hint.map.0.start=0x00000000 +hint.map.0.end=0x00030000 +hint.map.0.name="bootloader" +hint.map.0.readonly=1 +.Ed +.Pp +This defines +.Pa /dev/map/bootloader +at disk +.Pa cfid0 +starting at +.Li 0x00000000 +and ending at +.Li 0x00030000 , +it is also marked as readonly. +.Bd -literal -offset indent +hint.map.1.at="cfid0" +hint.map.1.start=0x00030000 +hint.map.1.end=0x00040000 +hint.map.1.name="factory" + +hint.map.2.at="cfid0" +hint.map.2.start=0x00040000 +hint.map.2.end=0x007e0000 +hint.map.2.name="upgrade" + +hint.map.3.at="cfid0" +hint.map.3.name="kernel" +hint.map.3.start=0x00040000 +hint.map.3.end="search:0x00100000:0x10000:.!/bin/sh" +.Ed +.Pp +This defines +.Pa /dev/map/kernel +at disk +.Pa cfid0 +starting at +.Li 0x00040000 , +but the end position must be searched by finding the key +.Dq Li ".!/bin/sh" , +from offset +.Li 0x00100000 +to the end of media with step +.Li 0x10000 . +The real marker in this case is +.Dq Li "#!/bin/sh" , +but +.Ql # +terminates the line when the hints file is parsed, so we need to use wildcard +.Ql .\& +instead of +.Ql # . +.Bd -literal -offset indent +hint.map.4.at="cfid0" +hint.map.4.name="rootfs" +hint.map.4.start="search:0x00100000:0x10000:.!/bin/sh" +hint.map.4.end=0x007e0000 + +hint.map.5.at="cfid0" +hint.map.5.start=0x007e0000 +hint.map.5.end=0x00800000 +hint.map.5.name="config" +.Ed +.Sh SEE ALSO +.Xr geom 4 , +.Xr geom 8 , +.Xr sysctl 8 +.Sh AUTHORS +The +.Nm +driver was written by +.An "Aleksandr Rybalko" Aq ray@ddteam.net . Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Tue Jun 7 08:24:29 2011 (r222812) +++ head/sys/amd64/acpica/acpi_wakeup.c Tue Jun 7 08:46:13 2011 (r222813) @@ -78,7 +78,7 @@ static void acpi_stop_beep(void *); #ifdef SMP static int acpi_wakeup_ap(struct acpi_softc *, int); -static void acpi_wakeup_cpus(struct acpi_softc *, cpumask_t); +static void acpi_wakeup_cpus(struct acpi_softc *, const cpuset_t *); #endif #define WAKECODE_VADDR(sc) ((sc)->acpi_wakeaddr + (3 * PAGE_SIZE)) @@ -173,7 +173,7 @@ acpi_wakeup_ap(struct acpi_softc *sc, in #define BIOS_WARM (0x0a) static void -acpi_wakeup_cpus(struct acpi_softc *sc, cpumask_t wakeup_cpus) +acpi_wakeup_cpus(struct acpi_softc *sc, const cpuset_t *wakeup_cpus) { uint32_t mpbioswarmvec; int cpu; @@ -192,7 +192,7 @@ acpi_wakeup_cpus(struct acpi_softc *sc, /* Wake up each AP. */ for (cpu = 1; cpu < mp_ncpus; cpu++) { - if ((wakeup_cpus & (1 << cpu)) == 0) + if (!CPU_ISSET(cpu, wakeup_cpus)) continue; if (acpi_wakeup_ap(sc, cpu) == 0) { /* restore the warmstart vector */ @@ -214,7 +214,7 @@ int acpi_sleep_machdep(struct acpi_softc *sc, int state) { #ifdef SMP - cpumask_t wakeup_cpus; + cpuset_t wakeup_cpus; #endif register_t cr3, rf; ACPI_STATUS status; @@ -244,10 +244,9 @@ acpi_sleep_machdep(struct acpi_softc *sc if (savectx(susppcbs[0])) { #ifdef SMP - if (wakeup_cpus != 0 && suspend_cpus(wakeup_cpus) == 0) { - device_printf(sc->acpi_dev, - "Failed to suspend APs: CPU mask = 0x%jx\n", - (uintmax_t)(wakeup_cpus & ~stopped_cpus)); + if (!CPU_EMPTY(&wakeup_cpus) && + suspend_cpus(wakeup_cpus) == 0) { + device_printf(sc->acpi_dev, "Failed to suspend APs\n"); goto out; } #endif @@ -282,8 +281,8 @@ acpi_sleep_machdep(struct acpi_softc *sc PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); #ifdef SMP - if (wakeup_cpus != 0) - acpi_wakeup_cpus(sc, wakeup_cpus); + if (!CPU_EMPTY(&wakeup_cpus)) + acpi_wakeup_cpus(sc, &wakeup_cpus); #endif acpi_resync_clock(sc); ret = 0; @@ -291,7 +290,7 @@ acpi_sleep_machdep(struct acpi_softc *sc out: #ifdef SMP - if (wakeup_cpus != 0) + if (!CPU_EMPTY(&wakeup_cpus)) restart_cpus(wakeup_cpus); #endif Modified: head/sys/amd64/amd64/intr_machdep.c ============================================================================== --- head/sys/amd64/amd64/intr_machdep.c Tue Jun 7 08:24:29 2011 (r222812) +++ head/sys/amd64/amd64/intr_machdep.c Tue Jun 7 08:46:13 2011 (r222813) @@ -443,8 +443,7 @@ DB_SHOW_COMMAND(irqs, db_show_irqs) * allocate CPUs round-robin. */ -/* The BSP is always a valid target. */ -static cpumask_t intr_cpus = (1 << 0); +static cpuset_t intr_cpus; static int current_cpu; /* @@ -466,7 +465,7 @@ intr_next_cpu(void) current_cpu++; if (current_cpu > mp_maxid) current_cpu = 0; - } while (!(intr_cpus & (1 << current_cpu))); + } while (!CPU_ISSET(current_cpu, &intr_cpus)); mtx_unlock_spin(&icu_lock); return (apic_id); } @@ -497,7 +496,7 @@ intr_add_cpu(u_int cpu) printf("INTR: Adding local APIC %d as a target\n", cpu_apic_ids[cpu]); - intr_cpus |= (1 << cpu); + CPU_SET(cpu, &intr_cpus); } /* @@ -510,6 +509,9 @@ intr_shuffle_irqs(void *arg __unused) struct intsrc *isrc; int i; + /* The BSP is always a valid target. */ + CPU_SETOF(0, &intr_cpus); + /* Don't bother on UP. */ if (mp_ncpus == 1) return; Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Tue Jun 7 08:24:29 2011 (r222812) +++ head/sys/amd64/amd64/mp_machdep.c Tue Jun 7 08:46:13 2011 (r222813) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef GPROF #include #endif @@ -125,7 +126,7 @@ extern inthand_t IDTVEC(fast_syscall), I * Local data and functions. */ -static volatile cpumask_t ipi_nmi_pending; +static volatile cpuset_t ipi_nmi_pending; /* used to hold the AP's until we are ready to release them */ static struct mtx ap_boot_mtx; @@ -161,7 +162,7 @@ static void release_aps(void *dummy); static int hlt_logical_cpus; static u_int hyperthreading_cpus; /* logical cpus sharing L1 cache */ -static cpumask_t hyperthreading_cpus_mask; +static cpuset_t hyperthreading_cpus_mask; static int hyperthreading_allowed = 1; static struct sysctl_ctx_list logical_cpu_clist; static u_int bootMP_size; @@ -337,7 +338,7 @@ topo_probe(void) if (cpu_topo_probed) return; - logical_cpus_mask = 0; + CPU_ZERO(&logical_cpus_mask); if (mp_ncpus <= 1) cpu_cores = cpu_logical = 1; else if (cpu_vendor_id == CPU_VENDOR_AMD) @@ -481,7 +482,7 @@ cpu_mp_probe(void) * Always record BSP in CPU map so that the mbuf init code works * correctly. */ - all_cpus = 1; + CPU_SETOF(0, &all_cpus); if (mp_ncpus == 0) { /* * No CPUs were found, so this must be a UP system. Setup @@ -608,6 +609,7 @@ cpu_mp_announce(void) void init_secondary(void) { + cpuset_t tcpuset, tallcpus; struct pcpu *pc; struct nmi_pcpu *np; u_int64_t msr, cr0; @@ -739,19 +741,22 @@ init_secondary(void) CTR1(KTR_SMP, "SMP: AP CPU #%d Launched", PCPU_GET(cpuid)); printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid)); + tcpuset = PCPU_GET(cpumask); /* Determine if we are a logical CPU. */ /* XXX Calculation depends on cpu_logical being a power of 2, e.g. 2 */ if (cpu_logical > 1 && PCPU_GET(apic_id) % cpu_logical != 0) - logical_cpus_mask |= PCPU_GET(cpumask); - + CPU_OR(&logical_cpus_mask, &tcpuset); + /* Determine if we are a hyperthread. */ if (hyperthreading_cpus > 1 && PCPU_GET(apic_id) % hyperthreading_cpus != 0) - hyperthreading_cpus_mask |= PCPU_GET(cpumask); + CPU_OR(&hyperthreading_cpus_mask, &tcpuset); /* Build our map of 'other' CPUs. */ - PCPU_SET(other_cpus, all_cpus & ~PCPU_GET(cpumask)); + tallcpus = all_cpus; + CPU_NAND(&tallcpus, &tcpuset); + PCPU_SET(other_cpus, tallcpus); if (bootverbose) lapic_dump("AP"); @@ -894,6 +899,7 @@ assign_cpu_ids(void) static int start_all_aps(void) { + cpuset_t tallcpus, tcpuset; vm_offset_t va = boot_address + KERNBASE; u_int64_t *pt4, *pt3, *pt2; u_int32_t mpbioswarmvec; @@ -958,11 +964,14 @@ start_all_aps(void) panic("AP #%d (PHY# %d) failed!", cpu, apic_id); } - all_cpus |= (1 << cpu); /* record AP in CPU map */ + CPU_SET(cpu, &all_cpus); /* record AP in CPU map */ } /* build our map of 'other' CPUs */ - PCPU_SET(other_cpus, all_cpus & ~PCPU_GET(cpumask)); + tallcpus = all_cpus; + tcpuset = PCPU_GET(cpumask); + CPU_NAND(&tallcpus, &tcpuset); + PCPU_SET(other_cpus, tallcpus); /* restore the warmstart vector */ *(u_int32_t *) WARMBOOT_OFF = mpbioswarmvec; @@ -1091,6 +1100,30 @@ SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_ #endif /* COUNT_XINVLTLB_HITS */ /* + * Send an IPI to specified CPU handling the bitmap logic. + */ +static void +ipi_send_cpu(int cpu, u_int ipi) +{ + u_int bitmap, old_pending, new_pending; + + KASSERT(cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu)); + + if (IPI_IS_BITMAPED(ipi)) { + bitmap = 1 << ipi; + ipi = IPI_BITMAP_VECTOR; + do { + old_pending = cpu_ipi_pending[cpu]; + new_pending = old_pending | bitmap; + } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], + old_pending, new_pending)); + if (old_pending) + return; + } + lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); +} + +/* * Flush the TLB on all other CPU's */ static void @@ -1114,28 +1147,19 @@ smp_tlb_shootdown(u_int vector, vm_offse } static void -smp_targeted_tlb_shootdown(cpumask_t mask, u_int vector, vm_offset_t addr1, vm_offset_t addr2) +smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, vm_offset_t addr1, vm_offset_t addr2) { - int ncpu, othercpus; + int cpu, ncpu, othercpus; othercpus = mp_ncpus - 1; - if (mask == (cpumask_t)-1) { - ncpu = othercpus; - if (ncpu < 1) + if (CPU_ISFULLSET(&mask)) { + if (othercpus < 1) return; } else { - mask &= ~PCPU_GET(cpumask); - if (mask == 0) - return; - ncpu = bitcount32(mask); - if (ncpu > othercpus) { - /* XXX this should be a panic offence */ - printf("SMP: tlb shootdown to %d other cpus (only have %d)\n", - ncpu, othercpus); - ncpu = othercpus; - } - /* XXX should be a panic, implied by mask == 0 above */ - if (ncpu < 1) + sched_pin(); + CPU_NAND(&mask, PCPU_PTR(cpumask)); + sched_unpin(); + if (CPU_EMPTY(&mask)) return; } if (!(read_rflags() & PSL_I)) @@ -1144,39 +1168,25 @@ smp_targeted_tlb_shootdown(cpumask_t mas smp_tlb_addr1 = addr1; smp_tlb_addr2 = addr2; atomic_store_rel_int(&smp_tlb_wait, 0); - if (mask == (cpumask_t)-1) + if (CPU_ISFULLSET(&mask)) { + ncpu = othercpus; ipi_all_but_self(vector); - else - ipi_selected(mask, vector); + } else { + ncpu = 0; + while ((cpu = cpusetobj_ffs(&mask)) != 0) { + cpu--; + CPU_CLR(cpu, &mask); + CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, + cpu, vector); + ipi_send_cpu(cpu, vector); + ncpu++; + } + } while (smp_tlb_wait < ncpu) ia32_pause(); mtx_unlock_spin(&smp_ipi_mtx); } -/* - * Send an IPI to specified CPU handling the bitmap logic. - */ -static void -ipi_send_cpu(int cpu, u_int ipi) -{ - u_int bitmap, old_pending, new_pending; - - KASSERT(cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu)); - - if (IPI_IS_BITMAPED(ipi)) { - bitmap = 1 << ipi; - ipi = IPI_BITMAP_VECTOR; - do { - old_pending = cpu_ipi_pending[cpu]; - new_pending = old_pending | bitmap; - } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], - old_pending, new_pending)); - if (old_pending) - return; - } - lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); -} - void smp_cache_flush(void) { @@ -1223,7 +1233,7 @@ smp_invlpg_range(vm_offset_t addr1, vm_o } void -smp_masked_invltlb(cpumask_t mask) +smp_masked_invltlb(cpuset_t mask) { if (smp_started) { @@ -1235,7 +1245,7 @@ smp_masked_invltlb(cpumask_t mask) } void -smp_masked_invlpg(cpumask_t mask, vm_offset_t addr) +smp_masked_invlpg(cpuset_t mask, vm_offset_t addr) { if (smp_started) { @@ -1247,7 +1257,7 @@ smp_masked_invlpg(cpumask_t mask, vm_off } void -smp_masked_invlpg_range(cpumask_t mask, vm_offset_t addr1, vm_offset_t addr2) +smp_masked_invlpg_range(cpuset_t mask, vm_offset_t addr1, vm_offset_t addr2) { if (smp_started) { @@ -1300,7 +1310,7 @@ ipi_bitmap_handler(struct trapframe fram * send an IPI to a set of cpus. */ void -ipi_selected(cpumask_t cpus, u_int ipi) +ipi_selected(cpuset_t cpus, u_int ipi) { int cpu; @@ -1310,12 +1320,12 @@ ipi_selected(cpumask_t cpus, u_int ipi) * Set the mask of receiving CPUs for this purpose. */ if (ipi == IPI_STOP_HARD) - atomic_set_int(&ipi_nmi_pending, cpus); + CPU_OR_ATOMIC(&ipi_nmi_pending, &cpus); - CTR3(KTR_SMP, "%s: cpus: %x ipi: %x", __func__, cpus, ipi); - while ((cpu = ffs(cpus)) != 0) { + while ((cpu = cpusetobj_ffs(&cpus)) != 0) { cpu--; - cpus &= ~(1 << cpu); + CPU_CLR(cpu, &cpus); + CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); ipi_send_cpu(cpu, ipi); } } @@ -1333,7 +1343,7 @@ ipi_cpu(int cpu, u_int ipi) * Set the mask of receiving CPUs for this purpose. */ if (ipi == IPI_STOP_HARD) - atomic_set_int(&ipi_nmi_pending, 1 << cpu); + CPU_SET_ATOMIC(cpu, &ipi_nmi_pending); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); ipi_send_cpu(cpu, ipi); @@ -1346,8 +1356,10 @@ void ipi_all_but_self(u_int ipi) { + sched_pin(); if (IPI_IS_BITMAPED(ipi)) { ipi_selected(PCPU_GET(other_cpus), ipi); + sched_unpin(); return; } @@ -1357,7 +1369,8 @@ ipi_all_but_self(u_int ipi) * Set the mask of receiving CPUs for this purpose. */ if (ipi == IPI_STOP_HARD) - atomic_set_int(&ipi_nmi_pending, PCPU_GET(other_cpus)); + CPU_OR_ATOMIC(&ipi_nmi_pending, PCPU_PTR(other_cpus)); + sched_unpin(); CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS); @@ -1366,7 +1379,7 @@ ipi_all_but_self(u_int ipi) int ipi_nmi_handler() { - cpumask_t cpumask; + cpuset_t cpumask; /* * As long as there is not a simple way to know about a NMI's @@ -1374,11 +1387,13 @@ ipi_nmi_handler() * the global pending bitword an IPI_STOP_HARD has been issued * and should be handled. */ + sched_pin(); cpumask = PCPU_GET(cpumask); - if ((ipi_nmi_pending & cpumask) == 0) + sched_unpin(); + if (!CPU_OVERLAP(&ipi_nmi_pending, &cpumask)) return (1); - atomic_clear_int(&ipi_nmi_pending, cpumask); + CPU_NAND_ATOMIC(&ipi_nmi_pending, &cpumask); cpustop_handler(); return (0); } @@ -1390,23 +1405,25 @@ ipi_nmi_handler() void cpustop_handler(void) { - cpumask_t cpumask; + cpuset_t cpumask; u_int cpu; + sched_pin(); cpu = PCPU_GET(cpuid); cpumask = PCPU_GET(cpumask); + sched_unpin(); savectx(&stoppcbs[cpu]); /* Indicate that we are stopped */ - atomic_set_int(&stopped_cpus, cpumask); + CPU_OR_ATOMIC(&stopped_cpus, &cpumask); /* Wait for restart */ - while (!(started_cpus & cpumask)) + while (!CPU_OVERLAP(&started_cpus, &cpumask)) ia32_pause(); - atomic_clear_int(&started_cpus, cpumask); - atomic_clear_int(&stopped_cpus, cpumask); + CPU_NAND_ATOMIC(&started_cpus, &cpumask); + CPU_NAND_ATOMIC(&stopped_cpus, &cpumask); if (cpu == 0 && cpustop_restartfunc != NULL) { cpustop_restartfunc(); @@ -1421,7 +1438,7 @@ cpustop_handler(void) void cpususpend_handler(void) { - cpumask_t cpumask; + cpuset_t cpumask; register_t cr3, rf; u_int cpu; @@ -1433,7 +1450,7 @@ cpususpend_handler(void) if (savectx(susppcbs[cpu])) { wbinvd(); - atomic_set_int(&stopped_cpus, cpumask); + CPU_OR_ATOMIC(&stopped_cpus, &cpumask); } else { pmap_init_pat(); PCPU_SET(switchtime, 0); @@ -1441,11 +1458,11 @@ cpususpend_handler(void) } /* Wait for resume */ - while (!(started_cpus & cpumask)) + while (!CPU_OVERLAP(&started_cpus, &cpumask)) ia32_pause(); - atomic_clear_int(&started_cpus, cpumask); - atomic_clear_int(&stopped_cpus, cpumask); + CPU_NAND_ATOMIC(&started_cpus, &cpumask); + CPU_NAND_ATOMIC(&stopped_cpus, &cpumask); /* Restore CR3 and enable interrupts */ load_cr3(cr3); @@ -1473,30 +1490,30 @@ SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_ static int sysctl_hlt_cpus(SYSCTL_HANDLER_ARGS) { - cpumask_t mask; + cpuset_t mask; int error; mask = hlt_cpus_mask; - error = sysctl_handle_int(oidp, &mask, 0, req); + error = sysctl_handle_opaque(oidp, &mask, sizeof(mask), req); if (error || !req->newptr) return (error); - if (logical_cpus_mask != 0 && - (mask & logical_cpus_mask) == logical_cpus_mask) + if (!CPU_EMPTY(&logical_cpus_mask) && + CPU_SUBSET(&mask, &logical_cpus_mask)) hlt_logical_cpus = 1; else hlt_logical_cpus = 0; if (! hyperthreading_allowed) - mask |= hyperthreading_cpus_mask; + CPU_OR(&mask, &hyperthreading_cpus_mask); - if ((mask & all_cpus) == all_cpus) - mask &= ~(1<<0); + if (CPU_SUBSET(&mask, &all_cpus)) + CPU_CLR(0, &mask); hlt_cpus_mask = mask; return (error); } -SYSCTL_PROC(_machdep, OID_AUTO, hlt_cpus, CTLTYPE_INT|CTLFLAG_RW, - 0, 0, sysctl_hlt_cpus, "IU", +SYSCTL_PROC(_machdep, OID_AUTO, hlt_cpus, + CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, sysctl_hlt_cpus, "S", "Bitmap of CPUs to halt. 101 (binary) will halt CPUs 0 and 2."); static int @@ -1510,15 +1527,15 @@ sysctl_hlt_logical_cpus(SYSCTL_HANDLER_A return (error); if (disable) - hlt_cpus_mask |= logical_cpus_mask; + CPU_OR(&hlt_cpus_mask, &logical_cpus_mask); else - hlt_cpus_mask &= ~logical_cpus_mask; + CPU_NAND(&hlt_cpus_mask, &logical_cpus_mask); if (! hyperthreading_allowed) - hlt_cpus_mask |= hyperthreading_cpus_mask; + CPU_OR(&hlt_cpus_mask, &hyperthreading_cpus_mask); - if ((hlt_cpus_mask & all_cpus) == all_cpus) - hlt_cpus_mask &= ~(1<<0); + if (CPU_SUBSET(&hlt_cpus_mask, &all_cpus)) + CPU_CLR(0, &hlt_cpus_mask); hlt_logical_cpus = disable; return (error); @@ -1545,18 +1562,18 @@ sysctl_hyperthreading_allowed(SYSCTL_HAN #endif if (allowed) - hlt_cpus_mask &= ~hyperthreading_cpus_mask; + CPU_NAND(&hlt_cpus_mask, &hyperthreading_cpus_mask); else - hlt_cpus_mask |= hyperthreading_cpus_mask; + CPU_OR(&hlt_cpus_mask, &hyperthreading_cpus_mask); - if (logical_cpus_mask != 0 && - (hlt_cpus_mask & logical_cpus_mask) == logical_cpus_mask) + if (!CPU_EMPTY(&logical_cpus_mask) && + CPU_SUBSET(&hlt_cpus_mask, &logical_cpus_mask)) hlt_logical_cpus = 1; else hlt_logical_cpus = 0; - if ((hlt_cpus_mask & all_cpus) == all_cpus) - hlt_cpus_mask &= ~(1<<0); + if (CPU_SUBSET(&hlt_cpus_mask, &all_cpus)) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 09:03: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 86F091065670; Tue, 7 Jun 2011 09:03:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 763728FC0A; Tue, 7 Jun 2011 09:03: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 p5793SSj074087; Tue, 7 Jun 2011 09:03:28 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5793SC9074078; Tue, 7 Jun 2011 09:03:28 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201106070903.p5793SC9074078@svn.freebsd.org> From: Adrian Chadd Date: Tue, 7 Jun 2011 09:03: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: r222815 - in head/sys/dev/ath: . ath_hal ath_hal/ar5212 ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2011 09:03:28 -0000 Author: adrian Date: Tue Jun 7 09:03:28 2011 New Revision: 222815 URL: http://svn.freebsd.org/changeset/base/222815 Log: Flesh out a new HAL method to fetch the radar PHY error frame information. For the AR5211/AR5212, this is apparently a one byte pulse duration counter value. It is only coded up here for the AR5212 as I don't have any AR5211-series hardware to test it on. This information was extracted from the Madwifi DFS branch along with some local additions. Please note - all this does is extract out the radar event duration, it in no way reflects the presence of a radar. Further code is needed to take a set of radar events and filter them to extract out correct radar pulse trains (and ignore other events.) For further information, please see: http://wiki.freebsd.org/dev/ath_hal%284%29/RadarDetection This includes references to the relevant patents which describe what is going on. Obtained from: Madwifi 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/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/if_athvar.h Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Tue Jun 7 09:02:25 2011 (r222814) +++ head/sys/dev/ath/ath_hal/ah.h Tue Jun 7 09:03:28 2011 (r222815) @@ -745,6 +745,17 @@ typedef enum { HAL_QUIET_ADD_SWBA_RESP_TIME = 0x4, /* add beacon response time to next_start offset */ } HAL_QUIET_FLAG; +#define HAL_DFS_EVENT_PRICH 0x0000001 + +struct dfs_event { + uint64_t re_full_ts; /* 64-bit full timestamp from interrupt time */ + uint32_t re_ts; /* Original 15 bit recv timestamp */ + uint8_t re_rssi; /* rssi of radar event */ + uint8_t re_dur; /* duration of radar pulse */ + uint32_t re_flags; /* Flags (see above) */ +}; +typedef struct dfs_event HAL_DFS_EVENT; + /* * Hardware Access Layer (HAL) API. * @@ -928,6 +939,9 @@ struct ath_hal { HAL_PHYERR_PARAM *pe); void __ahdecl(*ah_getDfsThresh)(struct ath_hal *ah, HAL_PHYERR_PARAM *pe); + HAL_BOOL __ahdecl(*ah_procRadarEvent)(struct ath_hal *ah, + struct ath_rx_status *rxs, uint64_t fulltsf, + const char *buf, HAL_DFS_EVENT *event); /* Key Cache Functions */ uint32_t __ahdecl(*ah_getKeyCacheSize)(struct ath_hal*); Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Tue Jun 7 09:02:25 2011 (r222814) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Tue Jun 7 09:03:28 2011 (r222815) @@ -622,5 +622,8 @@ extern HAL_BOOL ar5212IsNFCalInProgress( 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); +extern HAL_BOOL ar5212ProcessRadarEvent(struct ath_hal *ah, + struct ath_rx_status *rxs, uint64_t fulltsf, const char *buf, + HAL_DFS_EVENT *event); #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 Tue Jun 7 09:02:25 2011 (r222814) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Tue Jun 7 09:03:28 2011 (r222815) @@ -132,6 +132,7 @@ static const struct ath_hal_private ar52 /* DFS Functions */ .ah_enableDfs = ar5212EnableDfs, .ah_getDfsThresh = ar5212GetDfsThresh, + .ah_procRadarEvent = ar5212ProcessRadarEvent, /* Key Cache Functions */ .ah_getKeyCacheSize = ar5212GetKeyCacheSize, Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Tue Jun 7 09:02:25 2011 (r222814) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Tue Jun 7 09:03:28 2011 (r222815) @@ -1180,3 +1180,47 @@ ar5212GetDfsThresh(struct ath_hal *ah, H pe->pe_extchannel = AH_FALSE; } +/* + * Process the radar phy error and extract the pulse duration. + */ +HAL_BOOL +ar5212ProcessRadarEvent(struct ath_hal *ah, struct ath_rx_status *rxs, + uint64_t fulltsf, const char *buf, HAL_DFS_EVENT *event) +{ + uint8_t dur; + uint8_t rssi; + + /* Check whether the given phy error is a radar event */ + if ((rxs->rs_phyerr != HAL_PHYERR_RADAR) && + (rxs->rs_phyerr != HAL_PHYERR_FALSE_RADAR_EXT)) + return AH_FALSE; + + /* + * The first byte is the pulse width - if there's + * no data, simply set the duration to 0 + */ + if (rxs->rs_datalen >= 1) + /* The pulse width is byte 0 of the data */ + dur = ((uint8_t) buf[0]) & 0xff; + else + dur = 0; + + /* Pulse RSSI is the normal reported RSSI */ + rssi = (uint8_t) rxs->rs_rssi; + + /* 0 duration/rssi is not a valid radar event */ + if (dur == 0 && rssi == 0) + return AH_FALSE; + + HALDEBUG(ah, HAL_DEBUG_DFS, "%s: rssi=%d, dur=%d\n", + __func__, rssi, dur); + + /* Record the event */ + event->re_full_ts = fulltsf; + event->re_ts = rxs->rs_tstamp; + event->re_rssi = rssi; + event->re_dur = dur; + event->re_flags = HAL_DFS_EVENT_PRICH; + + return AH_TRUE; +} Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Tue Jun 7 09:02:25 2011 (r222814) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Tue Jun 7 09:03:28 2011 (r222815) @@ -205,6 +205,9 @@ extern HAL_BOOL ar5416SetRifsDelay(struc 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 ar5416ProcessRadarEvent(struct ath_hal *ah, + struct ath_rx_status *rxs, uint64_t fulltsf, const char *buf, + HAL_DFS_EVENT *event); 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 Tue Jun 7 09:02:25 2011 (r222814) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Tue Jun 7 09:03:28 2011 (r222815) @@ -147,6 +147,7 @@ ar5416InitState(struct ath_hal_5416 *ahp /* DFS Functions */ ah->ah_enableDfs = ar5416EnableDfs; ah->ah_getDfsThresh = ar5416GetDfsThresh; + ah->ah_procRadarEvent = ar5416ProcessRadarEvent; /* Power Management Functions */ ah->ah_setPowerMode = ar5416SetPowerMode; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Tue Jun 7 09:02:25 2011 (r222814) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Tue Jun 7 09:03:28 2011 (r222815) @@ -692,3 +692,19 @@ ar5416EnableDfs(struct ath_hal *ah, HAL_ OS_REG_WRITE(ah, AR_PHY_RADAR_1, val); } } + +/* + * Extract the radar event information from the given phy error. + * + * Returns AH_TRUE if the phy error was actually a phy error, + * AH_FALSE if the phy error wasn't a phy error. + */ +HAL_BOOL +ar5416ProcessRadarEvent(struct ath_hal *ah, struct ath_rx_status *rxs, + uint64_t fulltsf, const char *buf, HAL_DFS_EVENT *event) +{ + /* + * For now, this isn't implemented. + */ + return AH_FALSE; +} Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Tue Jun 7 09:02:25 2011 (r222814) +++ head/sys/dev/ath/if_athvar.h Tue Jun 7 09:03:28 2011 (r222815) @@ -709,6 +709,8 @@ void ath_intr(void *); ((*(_ah)->ah_enableDfs)((_ah), (_param))) #define ath_hal_getdfsthresh(_ah, _param) \ ((*(_ah)->ah_getDfsThresh)((_ah), (_param))) +#define ath_hal_procradarevent(_ah, _rxs, _fulltsf, _buf, _event) \ + ((*(_ah)->ah_procRadarEvent)((_ah), (_rxs), (_fulltsf), (_buf), (_event))) #define ath_hal_gpioCfgOutput(_ah, _gpio, _type) \ ((*(_ah)->ah_gpioCfgOutput)((_ah), (_gpio), (_type))) From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 09:06: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 DA09D1065674; Tue, 7 Jun 2011 09:06:15 +0000 (UTC) (envelope-from jlaffaye@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA6D58FC1A; Tue, 7 Jun 2011 09:06: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 p5796FB2074239; Tue, 7 Jun 2011 09:06:15 GMT (envelope-from jlaffaye@svn.freebsd.org) Received: (from jlaffaye@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5796Fnv074236; Tue, 7 Jun 2011 09:06:15 GMT (envelope-from jlaffaye@svn.freebsd.org) Message-Id: <201106070906.p5796Fnv074236@svn.freebsd.org> From: Julien Laffaye Date: Tue, 7 Jun 2011 09:06: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: r222817 - in head: share/misc usr.bin/calendar/calendars X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 09:06:16 -0000 Author: jlaffaye (ports committer) Date: Tue Jun 7 09:06:15 2011 New Revision: 222817 URL: http://svn.freebsd.org/changeset/base/222817 Log: - Add myself to calendar.freebsd - Add the forgotten relation to mentors in committers-ports.dot Approved by: bapt@ (mentor) Modified: head/share/misc/committers-ports.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Tue Jun 7 09:03:41 2011 (r222816) +++ head/share/misc/committers-ports.dot Tue Jun 7 09:06:15 2011 (r222817) @@ -205,6 +205,8 @@ arved -> stefan asami -> obrien +bapt -> jlaffaye + beat -> decke beech -> glarkin @@ -402,6 +404,7 @@ tabthorpe -> dhn tabthorpe -> fluffy tabthorpe -> jacula tabthorpe -> jadawin +tabthorpe -> jlaffaye tabthorpe -> pgj tabthorpe -> rene Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Tue Jun 7 09:03:41 2011 (r222816) +++ head/usr.bin/calendar/calendars/calendar.freebsd Tue Jun 7 09:06:15 2011 (r222817) @@ -294,6 +294,7 @@ 10/22 Jean-Sebastien Pedron born in Redon, Ille-et-Vilaine, France, 1980 10/23 Mario Sergio Fujikawa Ferreira born in Brasilia, Distrito Federal, Brazil, 1976 10/25 Eric Melville born in Los Gatos, California, United States, 1980 +10/25 Julien Laffaye born in Toulouse, France, 1988 10/26 Philip M. Gollucci born in Silver Spring, Maryland, United States, 1979 10/27 Takanori Watanabe born in Numazu, Shizuoka, Japan, 1972 11/05 M. Warner Losh born in Kansas City, Kansas, United States, 1966 From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 11:11: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 11E101065674; Tue, 7 Jun 2011 11:11:12 +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 02D148FC1A; Tue, 7 Jun 2011 11:11: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 p57BBBU7081296; Tue, 7 Jun 2011 11:11:11 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57BBBH6081294; Tue, 7 Jun 2011 11:11:11 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106071111.p57BBBH6081294@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 7 Jun 2011 11:11: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: r222819 - 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: Tue, 07 Jun 2011 11:11:12 -0000 Author: ae Date: Tue Jun 7 11:11:11 2011 New Revision: 222819 URL: http://svn.freebsd.org/changeset/base/222819 Log: Do not use LCM from stripesize and user specified alignment value. When user wants have specific alignment - do what user wants. Use stripesize as alignment value in case, when some of gpart's arguments are ommitted for automatic calculation. Suggested by: mav 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 Tue Jun 7 09:37:08 2011 (r222818) +++ head/sbin/geom/class/part/geom_part.c Tue Jun 7 11:11:11 2011 (r222819) @@ -341,9 +341,10 @@ gpart_autofill_resize(struct gctl_req *r errc(EXIT_FAILURE, error, "Invalid alignment param"); if (alignment == 0) errx(EXIT_FAILURE, "Invalid alignment param"); + } else { lba = pp->lg_stripesize / pp->lg_sectorsize; if (lba > 0) - alignment = g_lcm(lba, alignment); + alignment = lba; } error = gctl_delete_param(req, "alignment"); if (error) @@ -491,13 +492,9 @@ gpart_autofill(struct gctl_req *req) if (has_size && has_start && !has_alignment) goto done; - /* - * 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 > 0 ) - alignment = g_lcm(len, alignment); + if (len > 0 && !has_alignment) + alignment = len; /* Adjust parameters to stripeoffset */ offset = pp->lg_stripeoffset / pp->lg_sectorsize; From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 12: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 CCFD710656F3; Tue, 7 Jun 2011 12:00:29 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDC128FC93; Tue, 7 Jun 2011 12:00: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 p57C0TTC082813; Tue, 7 Jun 2011 12:00:29 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57C0TLR082811; Tue, 7 Jun 2011 12:00:29 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106071200.p57C0TLR082811@svn.freebsd.org> From: Hiroki Sato Date: Tue, 7 Jun 2011 12:00: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: r222820 - head/usr.sbin/rtadvd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 12:00:29 -0000 Author: hrs Date: Tue Jun 7 12:00:29 2011 New Revision: 222820 URL: http://svn.freebsd.org/changeset/base/222820 Log: - Use ELM_MALLOC() for struct rainfo. - Fix a missing back pointer assignment in struct prefix to struct rainfo when addr="" is specified. This caused SIGSEGV. - Insert a prefix element to a tail queue after setting parameters. Modified: head/usr.sbin/rtadvd/config.c Modified: head/usr.sbin/rtadvd/config.c ============================================================================== --- head/usr.sbin/rtadvd/config.c Tue Jun 7 11:11:11 2011 (r222819) +++ head/usr.sbin/rtadvd/config.c Tue Jun 7 12:00:29 2011 (r222820) @@ -229,13 +229,7 @@ getconfig(int idx) __func__, intface); } - rai = malloc(sizeof(*rai)); - if (rai == NULL) { - syslog(LOG_INFO, "<%s> %s: can't allocate enough memory", - __func__, intface); - exit(1); - } - memset(rai, 0, sizeof(*rai)); + ELM_MALLOC(rai, exit(1)); TAILQ_INIT(&rai->rai_prefix); #ifdef ROUTEINFO TAILQ_INIT(&rai->rai_route); @@ -394,10 +388,7 @@ getconfig(int idx) /* allocate memory to store prefix information */ ELM_MALLOC(pfx, exit(1)); - - /* link into chain */ - TAILQ_INSERT_TAIL(&rai->rai_prefix, pfx, pfx_next); - rai->rai_pfxs++; + pfx->pfx_rainfo = rai; pfx->pfx_origin = PREFIX_FROM_CONFIG; if (inet_pton(AF_INET6, addr, &pfx->pfx_prefix) != 1) { @@ -481,6 +472,9 @@ getconfig(int idx) pfx->pfx_pltimeexpire = now.tv_sec + pfx->pfx_preflifetime; } + /* link into chain */ + TAILQ_INSERT_TAIL(&rai->rai_prefix, pfx, pfx_next); + rai->rai_pfxs++; } if (rai->rai_advifprefix && rai->rai_pfxs == 0) get_prefix(rai); From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 13:52: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 119141065672; Tue, 7 Jun 2011 13:52:51 +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 DD82B8FC08; Tue, 7 Jun 2011 13:52:50 +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 7B80146B2D; Tue, 7 Jun 2011 09:52:50 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0F5DD8A027; Tue, 7 Jun 2011 09:52:50 -0400 (EDT) From: John Baldwin To: "Jung-uk Kim" Date: Tue, 7 Jun 2011 09:52:49 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <201106062303.p56N3cjs053024@svn.freebsd.org> In-Reply-To: <201106062303.p56N3cjs053024@svn.freebsd.org> MIME-Version: 1.0 Message-Id: <201106070952.49563.jhb@freebsd.org> Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 07 Jun 2011 09:52:50 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222795 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 13:52:51 -0000 On Monday, June 06, 2011 7:03:38 pm Jung-uk Kim wrote: > Author: jkim > Date: Mon Jun 6 23:03:37 2011 > New Revision: 222795 > URL: http://svn.freebsd.org/changeset/base/222795 > > Log: > Validate INT 15h and 16h vectors more strictly. Traditionally these entry > points are fixed addresses and (U)EFI CSM specification also mandated that. > Unfortunately, (U)EFI CSM specification does not specifically mention this > is to call service routine via interrupt vector table or to jump directly > to the entry point. As a result, some CSM seems to install two routines > and acts differently, depending on how it was executed, unfortunately. > When INT 15h is used, it calls a function pointer (which is probably a UEFI > service function). When it jumps directly to the entry point, it executes > a simple and traditional INT 15h service routine. Therefore, actually there > are two possible fixes, i. e., this fix or jumping directly to the fixed > entry point. However, we chose this fix because a) keyboard typematic > support via BIOS is becoming extremely rarer and b) we cannot support random > service routine installed by a firmware or a boot loader. This should fix > Lenovo X220 laptop, specifically. So we really think that all valid BIOSes ever produced for x86 use these exact entry points for these two interrupts? Actually, my desktop here at work (a modern i5 system) fails this test: > sudo dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd 00000000 9a e9 00 f0 2e e8 00 f0 |........| Here INT 15 uses the (perfectly valid and not from an option ROM) entry point of 0xf000:e99a. Note that EFI is not a spec for all BIOSen, just a limited subset of very recent BIOS implementations. I have another machine (1U server from a few years ago): CPU: Intel(R) Xeon(R) CPU 5160 @ 3.00GHz (2992.51-MHz K8-class CPU) Origin = "GenuineIntel" Id = 0x6f6 Family = 6 Model = f Stepping = 6 Features=0xbfebfbff Features2=0x4e3bd AMD Features=0x20100800 AMD Features2=0x1 TSC: P-state invariant Cores per package: 2 And it has these entry points: > sudo dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd 00000000 59 f8 00 f0 09 3f fb e5 |Y....?..| Note that INT 16 is 0xfbe5:3f09. This is also in the valid BIOS ROM range (0xf0000 - 0xfffff). You might as well just turn the check off on all machines at this point rather than using completely arbitrary tests that are only valid on a small fraction of the x86 universe. I would favor adding logic to the loader to query these values and pass them into the kernel as metadata instead as we do for SMAP. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 14:00: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 8B42F1065670; Tue, 7 Jun 2011 14:00: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 7B9338FC14; Tue, 7 Jun 2011 14:00: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 p57E0lnD086429; Tue, 7 Jun 2011 14:00:47 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57E0lXR086427; Tue, 7 Jun 2011 14:00:47 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201106071400.p57E0lXR086427@svn.freebsd.org> From: Adrian Chadd Date: Tue, 7 Jun 2011 14:00: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: r222821 - head/sys/dev/ath/ath_hal/ar5212 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 14:00:47 -0000 Author: adrian Date: Tue Jun 7 14:00:47 2011 New Revision: 222821 URL: http://svn.freebsd.org/changeset/base/222821 Log: Since HAL_PHYERR_* is used in the radar code, always include ah_desc.h. Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Tue Jun 7 12:00:29 2011 (r222820) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Tue Jun 7 14:00:47 2011 (r222821) @@ -21,9 +21,7 @@ #include "ah.h" #include "ah_internal.h" #include "ah_devid.h" -#ifdef AH_DEBUG #include "ah_desc.h" /* NB: for HAL_PHYERR* */ -#endif #include "ar5212/ar5212.h" #include "ar5212/ar5212reg.h" From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 15:39:50 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 531F71065676; Tue, 7 Jun 2011 15:39:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: John Baldwin Date: Tue, 7 Jun 2011 11:39:26 -0400 User-Agent: KMail/1.6.2 References: <201106062303.p56N3cjs053024@svn.freebsd.org> <201106070952.49563.jhb@freebsd.org> In-Reply-To: <201106070952.49563.jhb@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106071139.41955.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222795 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 15:39:50 -0000 On Tuesday 07 June 2011 09:52 am, John Baldwin wrote: > On Monday, June 06, 2011 7:03:38 pm Jung-uk Kim wrote: > > Author: jkim > > Date: Mon Jun 6 23:03:37 2011 > > New Revision: 222795 > > URL: http://svn.freebsd.org/changeset/base/222795 > > > > Log: > > Validate INT 15h and 16h vectors more strictly. Traditionally > > these entry points are fixed addresses and (U)EFI CSM > > specification also mandated that. Unfortunately, (U)EFI CSM > > specification does not specifically mention this is to call > > service routine via interrupt vector table or to jump directly to > > the entry point. As a result, some CSM seems to install two > > routines and acts differently, depending on how it was executed, > > unfortunately. When INT 15h is used, it calls a function pointer > > (which is probably a UEFI service function). When it jumps > > directly to the entry point, it executes a simple and traditional > > INT 15h service routine. Therefore, actually there are two > > possible fixes, i. e., this fix or jumping directly to the fixed > > entry point. However, we chose this fix because a) keyboard > > typematic support via BIOS is becoming extremely rarer and b) we > > cannot support random service routine installed by a firmware or > > a boot loader. This should fix Lenovo X220 laptop, specifically. > > So we really think that all valid BIOSes ever produced for x86 use > these exact entry points for these two interrupts? In fact, I didn't think so. I tried to explain the rationale as much as possible but I guess I failed. Sigh... Please see below. > Actually, my desktop here at work (a modern i5 system) fails this test: > > sudo dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd > > 00000000 9a e9 00 f0 2e e8 00 f0 > |........| > > Here INT 15 uses the (perfectly valid and not from an option ROM) > entry point of 0xf000:e99a. > > Note that EFI is not a spec for all BIOSen, just a limited subset > of very recent BIOS implementations. > > I have another machine (1U server from a few years ago): > > CPU: Intel(R) Xeon(R) CPU 5160 @ 3.00GHz (2992.51-MHz > K8-class CPU) Origin = "GenuineIntel" Id = 0x6f6 Family = 6 > Model = f Stepping = 6 > Features=0xbfebfbffR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,T >M,PBE> > Features2=0x4e3bdR,PDCM,DCA> AMD Features=0x20100800 > AMD Features2=0x1 > TSC: P-state invariant > Cores per package: 2 > > And it has these entry points: > > sudo dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd > > 00000000 59 f8 00 f0 09 3f fb e5 > |Y....?..| > > Note that INT 16 is 0xfbe5:3f09. This is also in the valid BIOS > ROM range (0xf0000 - 0xfffff). The whole point of this commit is to blacklist *recent* BIOS (or CSM) from probing keyboard typematic information, more specifically, recent Intel chipset platforms. They don't support many INT 15h/16h functions but only cause trouble at best. OTOH, I haven't seen such problems with AMD chipset systems and they all seem to have traditional entry points at the interrupt vector table, for example. > You might as well just turn the check off on all machines at this > point rather than using completely arbitrary tests that are only > valid on a small fraction of the x86 universe. I don't think it is "completely" arbitrary. If it doesn't have the traditional entry points, it is very unlikely to support keyboard typematic in the first place. Please let me know if you have any counter example. > I would favor adding logic to the loader to query these values and > pass them into the kernel as metadata instead as we do for SMAP. Actually, I thought about that, too. However, I didn't implement it because I thought it is too much trouble for such tiny feature. Shrug... Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 15:40: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 567A2106578A; Tue, 7 Jun 2011 15:40:18 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 473BA8FC13; Tue, 7 Jun 2011 15:40: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 p57FeIfA089776; Tue, 7 Jun 2011 15:40:18 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57FeI4Y089774; Tue, 7 Jun 2011 15:40:18 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106071540.p57FeI4Y089774@svn.freebsd.org> From: Hiroki Sato Date: Tue, 7 Jun 2011 15:40: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: r222824 - head/usr.sbin/rtadvd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 15:40:18 -0000 Author: hrs Date: Tue Jun 7 15:40:17 2011 New Revision: 222824 URL: http://svn.freebsd.org/changeset/base/222824 Log: Fix a bug that prevents tc=xxx from working. Modified: head/usr.sbin/rtadvd/advcap.c Modified: head/usr.sbin/rtadvd/advcap.c ============================================================================== --- head/usr.sbin/rtadvd/advcap.c Tue Jun 7 14:36:13 2011 (r222823) +++ head/usr.sbin/rtadvd/advcap.c Tue Jun 7 15:40:17 2011 (r222824) @@ -81,7 +81,6 @@ static char *tbuf; static int hopcount; /* detect infinite loops in termcap, init 0 */ -static const char *remotefile; extern const char *conffile; int tgetent(char *, char *); @@ -204,7 +203,7 @@ tnchktc(void) write(STDERR_FILENO, "Infinite tc= loop\n", 18); return (0); } - if (getent(tcbuf, tcname, remotefile) != 1) { + if (getent(tcbuf, tcname, conffile) != 1) { return (0); } for (q = tcbuf; *q++ != ':'; ) From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 16:23: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 8C4CD106566B; Tue, 7 Jun 2011 16:23:27 +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 7CC0B8FC14; Tue, 7 Jun 2011 16:23: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 p57GNRQY091197; Tue, 7 Jun 2011 16:23:27 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57GNRn1091195; Tue, 7 Jun 2011 16:23:27 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201106071623.p57GNRn1091195@svn.freebsd.org> From: Jaakko Heinonen Date: Tue, 7 Jun 2011 16:23: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: r222825 - head/libexec/comsat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 16:23:27 -0000 Author: jh Date: Tue Jun 7 16:23:27 2011 New Revision: 222825 URL: http://svn.freebsd.org/changeset/base/222825 Log: Remove a gratuitous newline. This should be a non-functional change. PR: bin/153667 Submitted by: Craig Leres MFC after: 1 week Modified: head/libexec/comsat/comsat.c Modified: head/libexec/comsat/comsat.c ============================================================================== --- head/libexec/comsat/comsat.c Tue Jun 7 15:40:17 2011 (r222824) +++ head/libexec/comsat/comsat.c Tue Jun 7 16:23:27 2011 (r222825) @@ -180,7 +180,7 @@ notify(struct utmpx *utp, char file[], o dsyslog(LOG_DEBUG, "%s: wrong mode on %s", utp->ut_user, tty); return; } - dsyslog(LOG_DEBUG, "notify %s on %s\n", utp->ut_user, tty); + dsyslog(LOG_DEBUG, "notify %s on %s", utp->ut_user, tty); switch (fork()) { case -1: syslog(LOG_NOTICE, "fork failed (%m)"); From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 17:01: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 7C23E106564A; Tue, 7 Jun 2011 17:01:52 +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 6BF4D8FC0C; Tue, 7 Jun 2011 17:01: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 p57H1qmB092372; Tue, 7 Jun 2011 17:01:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57H1qvN092370; Tue, 7 Jun 2011 17:01:52 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106071701.p57H1qvN092370@svn.freebsd.org> From: Alexander Motin Date: Tue, 7 Jun 2011 17:01: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: r222826 - head/sys/dev/sound/pcm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 17:01:52 -0000 Author: mav Date: Tue Jun 7 17:01:52 2011 New Revision: 222826 URL: http://svn.freebsd.org/changeset/base/222826 Log: Make automatic hw.snd.default_unit choice a bit more intelligent. Instead of just setting it to the first registered device, reevaluate it for each device registered, trying to choose best candidate, unless one was forced. For now use such preference order: play&rec, play, rec. As side effect, this should workaround the situation when HDMI audio output of the video card, usually not connected to anything, becomes default, that requires manual user intervention to make sound working. If at some point this won't be enough, we can try to fetch some additional priority flags from the device driver. Modified: head/sys/dev/sound/pcm/sound.c Modified: head/sys/dev/sound/pcm/sound.c ============================================================================== --- head/sys/dev/sound/pcm/sound.c Tue Jun 7 16:23:27 2011 (r222825) +++ head/sys/dev/sound/pcm/sound.c Tue Jun 7 17:01:52 2011 (r222826) @@ -51,7 +51,7 @@ int pcm_veto_load = 1; int snd_unit = -1; TUNABLE_INT("hw.snd.default_unit", &snd_unit); -static int snd_unit_auto = 0; +static int snd_unit_auto = -1; TUNABLE_INT("hw.snd.default_auto", &snd_unit_auto); SYSCTL_INT(_hw_snd, OID_AUTO, default_auto, CTLFLAG_RW, &snd_unit_auto, 0, "assign default unit to a newly attached device"); @@ -443,6 +443,7 @@ sysctl_hw_snd_default_unit(SYSCTL_HANDLE if (!PCM_REGISTERED(d) || CHN_EMPTY(d, channels.pcm)) return EINVAL; snd_unit = unit; + snd_unit_auto = 0; } return (error); } @@ -737,6 +738,32 @@ pcm_killchan(device_t dev) return (pcm_chn_destroy(ch)); } +static int +pcm_best_unit(int old) +{ + struct snddev_info *d; + int i, best, bestprio, prio; + + best = -1; + bestprio = -100; + for (i = 0; pcm_devclass != NULL && + i < devclass_get_maxunit(pcm_devclass); i++) { + d = devclass_get_softc(pcm_devclass, i); + if (!PCM_REGISTERED(d)) + continue; + prio = 0; + if (d->playcount == 0) + prio -= 10; + if (d->reccount == 0) + prio -= 2; + if (prio > bestprio || (prio == bestprio && i == old)) { + best = i; + bestprio = prio; + } + } + return (best); +} + int pcm_setstatus(device_t dev, char *str) { @@ -770,8 +797,12 @@ pcm_setstatus(device_t dev, char *str) PCM_UNLOCK(d); - if (snd_unit < 0 || snd_unit_auto != 0) + if (snd_unit_auto < 0) + snd_unit_auto = (snd_unit < 0) ? 1 : 0; + if (snd_unit < 0 || snd_unit_auto > 1) snd_unit = device_get_unit(dev); + else if (snd_unit_auto == 1) + snd_unit = pcm_best_unit(snd_unit); return (0); } @@ -1113,7 +1144,6 @@ pcm_unregister(device_t dev) struct snddev_info *d; struct pcm_channel *ch; struct thread *td; - int i; td = curthread; d = device_get_softc(dev); @@ -1216,21 +1246,9 @@ pcm_unregister(device_t dev) sndstat_release(td); if (snd_unit == device_get_unit(dev)) { - /* - * Reassign default unit to the next available dev, but - * first, reset snd_unit to something ridiculous. - */ - snd_unit = -1; - for (i = 0; pcm_devclass != NULL && - i < devclass_get_maxunit(pcm_devclass); i++) { - if (device_get_unit(dev) == i) - continue; - d = devclass_get_softc(pcm_devclass, i); - if (PCM_REGISTERED(d)) { - snd_unit = i; - break; - } - } + snd_unit = pcm_best_unit(-1); + if (snd_unit_auto == 0) + snd_unit_auto = 1; } return (0); From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 17:19: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 871731065670; Tue, 7 Jun 2011 17:19:14 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D9F78FC0C; Tue, 7 Jun 2011 17:19: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 p57HJEPJ092910; Tue, 7 Jun 2011 17:19:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57HJEwl092908; Tue, 7 Jun 2011 17:19:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201106071719.p57HJEwl092908@svn.freebsd.org> From: Marius Strobl Date: Tue, 7 Jun 2011 17:19: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: r222827 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2011 17:19:14 -0000 Author: marius Date: Tue Jun 7 17:19:14 2011 New Revision: 222827 URL: http://svn.freebsd.org/changeset/base/222827 Log: Fix a problem with r222813; given that we may only operate on interrupt globals here but clobber %y save and restore the latter. Modified: head/sys/sparc64/sparc64/mp_exception.S Modified: head/sys/sparc64/sparc64/mp_exception.S ============================================================================== --- head/sys/sparc64/sparc64/mp_exception.S Tue Jun 7 17:01:52 2011 (r222826) +++ head/sys/sparc64/sparc64/mp_exception.S Tue Jun 7 17:19:14 2011 (r222827) @@ -38,7 +38,8 @@ __FBSDID("$FreeBSD$"); .register %g2, #ignore .register %g3, #ignore -#define IPI_DONE(r1, r2, r3, r4, r5) \ +#define IPI_DONE(r1, r2, r3, r4, r5, r6) \ + rd %y, r6 ; \ lduw [PCPU(CPUID)], r2 ; \ mov _NCPUBITS, r3 ; \ mov %g0, %y ; \ @@ -50,6 +51,7 @@ __FBSDID("$FreeBSD$"); sub r2, r3, r3 ; \ mov 1, r4 ; \ sllx r4, r3, r4 ; \ + wr r6, %y ; \ ATOMIC_CLEAR_LONG(r1, r2, r3, r4) /* @@ -87,7 +89,7 @@ ENTRY(tl_ipi_spitfire_dcache_page_inval) 2: brgz,pt %g2, 1b sub %g2, %g4, %g2 - IPI_DONE(%g5, %g1, %g2, %g3, %g4) + IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) retry END(tl_ipi_spitfire_dcache_page_inval) @@ -127,7 +129,7 @@ ENTRY(tl_ipi_spitfire_icache_page_inval) 2: brgz,pt %g2, 1b sub %g2, %g4, %g2 - IPI_DONE(%g5, %g1, %g2, %g3, %g4) + IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) retry END(tl_ipi_spitfire_icache_page_inval) @@ -158,7 +160,7 @@ ENTRY(tl_ipi_cheetah_dcache_page_inval) blt,a,pt %xcc, 1b nop - IPI_DONE(%g5, %g1, %g2, %g3, %g4) + IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) retry END(tl_ipi_cheetah_dcache_page_inval) @@ -214,7 +216,7 @@ ENTRY(tl_ipi_tlb_page_demap) stxa %g0, [%g2] ASI_IMMU_DEMAP flush %g3 - IPI_DONE(%g5, %g1, %g2, %g3, %g4) + IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) retry END(tl_ipi_tlb_page_demap) @@ -257,7 +259,7 @@ ENTRY(tl_ipi_tlb_range_demap) blt,a,pt %xcc, 1b nop - IPI_DONE(%g5, %g1, %g2, %g3, %g4) + IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) retry END(tl_ipi_tlb_range_demap) @@ -281,7 +283,7 @@ ENTRY(tl_ipi_tlb_context_demap) stxa %g0, [%g1] ASI_IMMU_DEMAP flush %g3 - IPI_DONE(%g5, %g1, %g2, %g3, %g4) + IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) retry END(tl_ipi_tlb_context_demap) @@ -293,7 +295,7 @@ ENTRY(tl_ipi_stick_rd) rd %asr24, %g2 stx %g2, [%g1] - IPI_DONE(%g5, %g1, %g2, %g3, %g4) + IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) retry END(tl_ipi_stick_rd) @@ -305,6 +307,6 @@ ENTRY(tl_ipi_tick_rd) rd %tick, %g2 stx %g2, [%g1] - IPI_DONE(%g5, %g1, %g2, %g3, %g4) + IPI_DONE(%g5, %g1, %g2, %g3, %g4, %g6) retry END(tl_ipi_tick_rd) From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 17:32: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 34FE21065676; Tue, 7 Jun 2011 17:32:13 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe08.c2i.net [212.247.154.226]) by mx1.freebsd.org (Postfix) with ESMTP id E3EAB8FC1B; Tue, 7 Jun 2011 17:32:11 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=PvOwS0pD1JWuCk2fMyCiv7x8TRi/oBifOus6FmFACNc= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=T3xg-fz5BeEA:10 a=WQU8e4WWZSUA:10 a=N659UExz7-8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=6I5d2MoRAAAA:8 a=M5xNTXWlDeJN2m3o8woA:9 a=HX4OEtGSOkArBYGJaIYA:7 a=pILNOxqGKmIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe08.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 136935603; Tue, 07 Jun 2011 19:32:10 +0200 From: Hans Petter Selasky To: Alexander Motin Date: Tue, 7 Jun 2011 19:30:49 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201106071701.p57H1qvN092370@svn.freebsd.org> In-Reply-To: <201106071701.p57H1qvN092370@svn.freebsd.org> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201106071930.49724.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r222826 - head/sys/dev/sound/pcm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 17:32:13 -0000 On Tuesday 07 June 2011 19:01:52 Alexander Motin wrote: > Author: mav > Date: Tue Jun 7 17:01:52 2011 > New Revision: 222826 > URL: http://svn.freebsd.org/changeset/base/222826 > > Log: > Make automatic hw.snd.default_unit choice a bit more intelligent. Instead > of just setting it to the first registered device, reevaluate it for each > device registered, trying to choose best candidate, unless one was > forced. For now use such preference order: play&rec, play, rec. > > As side effect, this should workaround the situation when HDMI audio > output of the video card, usually not connected to anything, becomes > default, that requires manual user intervention to make sound working. If > at some point this won't be enough, we can try to fetch some additional > priority flags from the device driver. > > Modified: > head/sys/dev/sound/pcm/sound.c > > Modified: head/sys/dev/sound/pcm/sound.c > =========================================================================== > === --- head/sys/dev/sound/pcm/sound.c Tue Jun 7 16:23:27 2011 (r222825) > +++ head/sys/dev/sound/pcm/sound.c Tue Jun 7 17:01:52 2011 (r222826) @@ > -51,7 +51,7 @@ int pcm_veto_load = 1; > int snd_unit = -1; > TUNABLE_INT("hw.snd.default_unit", &snd_unit); > > -static int snd_unit_auto = 0; > +static int snd_unit_auto = -1; > TUNABLE_INT("hw.snd.default_auto", &snd_unit_auto); > SYSCTL_INT(_hw_snd, OID_AUTO, default_auto, CTLFLAG_RW, > &snd_unit_auto, 0, "assign default unit to a newly attached device"); > @@ -443,6 +443,7 @@ sysctl_hw_snd_default_unit(SYSCTL_HANDLE > if (!PCM_REGISTERED(d) || CHN_EMPTY(d, channels.pcm)) > return EINVAL; > snd_unit = unit; > + snd_unit_auto = 0; > } > return (error); > } > @@ -737,6 +738,32 @@ pcm_killchan(device_t dev) > return (pcm_chn_destroy(ch)); > } > > +static int > +pcm_best_unit(int old) > +{ > + struct snddev_info *d; > + int i, best, bestprio, prio; > + > + best = -1; > + bestprio = -100; > + for (i = 0; pcm_devclass != NULL && > + i < devclass_get_maxunit(pcm_devclass); i++) { > + d = devclass_get_softc(pcm_devclass, i); > + if (!PCM_REGISTERED(d)) > + continue; > + prio = 0; > + if (d->playcount == 0) > + prio -= 10; > + if (d->reccount == 0) > + prio -= 2; > + if (prio > bestprio || (prio == bestprio && i == old)) { > + best = i; > + bestprio = prio; > + } > + } > + return (best); > +} > + > int > pcm_setstatus(device_t dev, char *str) > { > @@ -770,8 +797,12 @@ pcm_setstatus(device_t dev, char *str) > > PCM_UNLOCK(d); > > - if (snd_unit < 0 || snd_unit_auto != 0) > + if (snd_unit_auto < 0) > + snd_unit_auto = (snd_unit < 0) ? 1 : 0; > + if (snd_unit < 0 || snd_unit_auto > 1) > snd_unit = device_get_unit(dev); > + else if (snd_unit_auto == 1) > + snd_unit = pcm_best_unit(snd_unit); > > return (0); > } > @@ -1113,7 +1144,6 @@ pcm_unregister(device_t dev) > struct snddev_info *d; > struct pcm_channel *ch; > struct thread *td; > - int i; > > td = curthread; > d = device_get_softc(dev); > @@ -1216,21 +1246,9 @@ pcm_unregister(device_t dev) > sndstat_release(td); > > if (snd_unit == device_get_unit(dev)) { > - /* > - * Reassign default unit to the next available dev, but > - * first, reset snd_unit to something ridiculous. > - */ > - snd_unit = -1; > - for (i = 0; pcm_devclass != NULL && > - i < devclass_get_maxunit(pcm_devclass); i++) { > - if (device_get_unit(dev) == i) > - continue; > - d = devclass_get_softc(pcm_devclass, i); > - if (PCM_REGISTERED(d)) { > - snd_unit = i; > - break; > - } > - } > + snd_unit = pcm_best_unit(-1); > + if (snd_unit_auto == 0) > + snd_unit_auto = 1; > } > > return (0); Idea: I would be cool if some GTK mixer apps can set this value. --HPS From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 17:33: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 B319D106564A; Tue, 7 Jun 2011 17:33:39 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A17DD8FC17; Tue, 7 Jun 2011 17:33: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 p57HXd28093387; Tue, 7 Jun 2011 17:33:39 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57HXdsg093382; Tue, 7 Jun 2011 17:33:39 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201106071733.p57HXdsg093382@svn.freebsd.org> From: Marius Strobl Date: Tue, 7 Jun 2011 17:33: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: r222828 - in head/sys/sparc64: include sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2011 17:33:39 -0000 Author: marius Date: Tue Jun 7 17:33:39 2011 New Revision: 222828 URL: http://svn.freebsd.org/changeset/base/222828 Log: Adapt CATR() to r222813. This is somewhat tricky as we can't afford using more than three temporary register in several places CATR() is used so this code trades instructions in for registers. Actually, this still isn't sufficient and CATR() has the side-effect of clobbering %y. Luckily, with the current uses of CATR() this either doesn't matter or we are able to (save and) restore it. Now that there's only one use of AND() and TEST() left inline these. Modified: head/sys/sparc64/include/ktr.h head/sys/sparc64/sparc64/exception.S head/sys/sparc64/sparc64/mp_locore.S head/sys/sparc64/sparc64/mp_machdep.c Modified: head/sys/sparc64/include/ktr.h ============================================================================== --- head/sys/sparc64/include/ktr.h Tue Jun 7 17:19:14 2011 (r222827) +++ head/sys/sparc64/include/ktr.h Tue Jun 7 17:33:39 2011 (r222828) @@ -40,16 +40,6 @@ #else -#define AND(var, mask, r1, r2) \ - SET(var, r2, r1) ; \ - lduw [r1], r2 ; \ - and r2, mask, r1 - -#define TEST(var, mask, r1, r2, l1) \ - AND(var, mask, r1, r2) ; \ - brz r1, l1 ## f ; \ - nop - /* * XXX could really use another register... */ @@ -79,15 +69,37 @@ l2: add r2, 1, r3 ; \ SET(l1 ## b, r3, r2) ; \ stx r2, [r1 + KTR_DESC] +/* + * NB: this clobbers %y. + */ #define CATR(mask, desc, r1, r2, r3, l1, l2, l3) \ set mask, r1 ; \ - TEST(ktr_mask, r1, r2, r2, l3) ; \ - lduw [PCPU(MID)], r1 ; \ + SET(ktr_mask, r3, r2) ; \ + lduw [r2], r2 ; \ + and r2, r1, r1 ; \ + brz r1, l3 ## f ; \ + nop ; \ + lduw [PCPU(CPUID)], r2 ; \ + mov _NCPUBITS, r3 ; \ + mov %g0, %y ; \ + udiv r2, r3, r2 ; \ + srl r2, 0, r2 ; \ + sllx r2, PTR_SHIFT, r2 ; \ + SET(ktr_cpumask, r3, r1) ; \ + ldx [r1 + r2], r1 ; \ + lduw [PCPU(CPUID)], r2 ; \ + mov _NCPUBITS, r3 ; \ + mov %g0, %y ; \ + udiv r2, r3, r2 ; \ + srl r2, 0, r2 ; \ + smul r2, r3, r3 ; \ + lduw [PCPU(CPUID)], r2 ; \ + sub r2, r3, r3 ; \ mov 1, r2 ; \ - sllx r2, r1, r1 ; \ -#ifdef notyet \ - TEST(ktr_cpumask, r1, r2, r3, l3) ; \ -#endif \ + sllx r2, r3, r2 ; \ + andn r1, r2, r1 ; \ + brz r1, l3 ## f ; \ + nop ; \ ATR(desc, r1, r2, r3, l1, l2) #endif /* LOCORE */ Modified: head/sys/sparc64/sparc64/exception.S ============================================================================== --- head/sys/sparc64/sparc64/exception.S Tue Jun 7 17:19:14 2011 (r222827) +++ head/sys/sparc64/sparc64/exception.S Tue Jun 7 17:33:39 2011 (r222828) @@ -2615,9 +2615,9 @@ ENTRY(tl0_ret) andn %l4, TSTATE_CWP_MASK, %g2 /* - * Restore %y. Could also be below if we had more alternate globals. + * Save %y in an alternate global. */ - wr %l5, 0, %y + mov %l5, %g4 /* * Setup %wstate for return. We need to restore the user window state @@ -2662,8 +2662,8 @@ tl0_ret_fill: * Fixup %tstate so the saved %cwp points to the current window and * restore it. */ - rdpr %cwp, %g4 - wrpr %g2, %g4, %tstate + rdpr %cwp, %g1 + wrpr %g2, %g1, %tstate /* * Restore the user window state. The transition bit was set above @@ -2673,20 +2673,25 @@ tl0_ret_fill: #if KTR_COMPILE & KTR_TRAP CATR(KTR_TRAP, "tl0_ret: td=%#lx pil=%#lx pc=%#lx npc=%#lx sp=%#lx" - , %g2, %g3, %g4, 7, 8, 9) - ldx [PCPU(CURTHREAD)], %g3 - stx %g3, [%g2 + KTR_PARM1] - rdpr %pil, %g3 - stx %g3, [%g2 + KTR_PARM2] - rdpr %tpc, %g3 - stx %g3, [%g2 + KTR_PARM3] - rdpr %tnpc, %g3 - stx %g3, [%g2 + KTR_PARM4] - stx %sp, [%g2 + KTR_PARM5] + , %g1, %g2, %g3, 7, 8, 9) + ldx [PCPU(CURTHREAD)], %g2 + stx %g2, [%g1 + KTR_PARM1] + rdpr %pil, %g2 + stx %g2, [%g1 + KTR_PARM2] + rdpr %tpc, %g2 + stx %g2, [%g1 + KTR_PARM3] + rdpr %tnpc, %g2 + stx %g2, [%g1 + KTR_PARM4] + stx %sp, [%g1 + KTR_PARM5] 9: #endif /* + * Restore %y. Note that the CATR above clobbered it. + */ + wr %g4, 0, %y + + /* * Return to usermode. */ retry @@ -2700,6 +2705,11 @@ tl0_ret_fill_end: stx %l5, [%l0 + KTR_PARM2] stx %sp, [%l0 + KTR_PARM3] 9: + + /* + * Restore %y clobbered by the CATR. This was saved in %l5 above. + */ + wr %l5, 0, %y #endif /* @@ -2867,34 +2877,36 @@ ENTRY(tl1_ret) andn %l0, TSTATE_CWP_MASK, %g1 mov %l1, %g2 mov %l2, %g3 + mov %l4, %g4 wrpr %l3, 0, %pil - wr %l4, 0, %y restore wrpr %g0, 2, %tl - rdpr %cwp, %g4 - wrpr %g1, %g4, %tstate wrpr %g2, 0, %tpc wrpr %g3, 0, %tnpc + rdpr %cwp, %g2 + wrpr %g1, %g2, %tstate #if KTR_COMPILE & KTR_TRAP CATR(KTR_TRAP, "tl1_ret: td=%#lx pil=%#lx ts=%#lx pc=%#lx sp=%#lx" - , %g2, %g3, %g4, 7, 8, 9) - ldx [PCPU(CURTHREAD)], %g3 - stx %g3, [%g2 + KTR_PARM1] - rdpr %pil, %g3 - stx %g3, [%g2 + KTR_PARM2] - rdpr %tstate, %g3 - stx %g3, [%g2 + KTR_PARM3] - rdpr %tpc, %g3 - stx %g3, [%g2 + KTR_PARM4] - stx %sp, [%g2 + KTR_PARM5] + , %g1, %g2, %g3, 7, 8, 9) + ldx [PCPU(CURTHREAD)], %g2 + stx %g2, [%g1 + KTR_PARM1] + rdpr %pil, %g2 + stx %g2, [%g1 + KTR_PARM2] + rdpr %tstate, %g2 + stx %g2, [%g1 + KTR_PARM3] + rdpr %tpc, %g2 + stx %g2, [%g1 + KTR_PARM4] + stx %sp, [%g1 + KTR_PARM5] 9: #endif + wr %g4, 0, %y + retry END(tl1_ret) @@ -2995,33 +3007,35 @@ ENTRY(tl1_intr) andn %l0, TSTATE_CWP_MASK, %g1 mov %l1, %g2 mov %l2, %g3 + mov %l4, %g4 wrpr %l3, 0, %pil - wr %l4, 0, %y restore wrpr %g0, 2, %tl - rdpr %cwp, %g4 - wrpr %g1, %g4, %tstate wrpr %g2, 0, %tpc wrpr %g3, 0, %tnpc + rdpr %cwp, %g2 + wrpr %g1, %g2, %tstate #if KTR_COMPILE & KTR_INTR CATR(KTR_INTR, "tl1_intr: td=%#x pil=%#lx ts=%#lx pc=%#lx sp=%#lx" - , %g2, %g3, %g4, 7, 8, 9) - ldx [PCPU(CURTHREAD)], %g3 - stx %g3, [%g2 + KTR_PARM1] - rdpr %pil, %g3 - stx %g3, [%g2 + KTR_PARM2] - rdpr %tstate, %g3 - stx %g3, [%g2 + KTR_PARM3] - rdpr %tpc, %g3 - stx %g3, [%g2 + KTR_PARM4] - stx %sp, [%g2 + KTR_PARM5] + , %g1, %g2, %g3, 7, 8, 9) + ldx [PCPU(CURTHREAD)], %g2 + stx %g2, [%g1 + KTR_PARM1] + rdpr %pil, %g2 + stx %g2, [%g1 + KTR_PARM2] + rdpr %tstate, %g2 + stx %g2, [%g1 + KTR_PARM3] + rdpr %tpc, %g2 + stx %g2, [%g1 + KTR_PARM4] + stx %sp, [%g1 + KTR_PARM5] 9: #endif + wr %g4, 0, %y + retry END(tl1_intr) Modified: head/sys/sparc64/sparc64/mp_locore.S ============================================================================== --- head/sys/sparc64/sparc64/mp_locore.S Tue Jun 7 17:19:14 2011 (r222827) +++ head/sys/sparc64/sparc64/mp_locore.S Tue Jun 7 17:33:39 2011 (r222828) @@ -269,13 +269,17 @@ ENTRY(mp_startup) add %l1, %l2, %l1 sub %l1, SPOFF + CCFSZ, %sp + /* Initialize global registers. */ + call cpu_setregs + mov %l1, %o0 + #if KTR_COMPILE & KTR_SMP CATR(KTR_SMP, "mp_startup: bootstrap cpuid=%d mid=%d pcpu=%#lx data=%#lx sp=%#lx" , %g1, %g2, %g3, 7, 8, 9) - lduw [%l1 + PC_CPUID], %g2 + lduw [PCPU(CPUID)], %g2 stx %g2, [%g1 + KTR_PARM1] - lduw [%l1 + PC_MID], %g2 + lduw [PCPU(MID)], %g2 stx %g2, [%g1 + KTR_PARM2] stx %l1, [%g1 + KTR_PARM3] stx %sp, [%g1 + KTR_PARM5] Modified: head/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/mp_machdep.c Tue Jun 7 17:19:14 2011 (r222827) +++ head/sys/sparc64/sparc64/mp_machdep.c Tue Jun 7 17:33:39 2011 (r222828) @@ -457,9 +457,6 @@ cpu_mp_bootstrap(struct pcpu *pc) */ tlb_flush_nonlocked(); - /* Initialize global registers. */ - cpu_setregs(pc); - /* * Enable interrupts. * Note that the PIL we be lowered indirectly via sched_throw(NULL) From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 17:40: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 0B389106566B; Tue, 7 Jun 2011 17:40:34 +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 EFC788FC1B; Tue, 7 Jun 2011 17:40: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 p57HeXhm093616; Tue, 7 Jun 2011 17:40:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57HeX1R093614; Tue, 7 Jun 2011 17:40:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201106071740.p57HeX1R093614@svn.freebsd.org> From: John Baldwin Date: Tue, 7 Jun 2011 17:40: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: r222829 - 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, 07 Jun 2011 17:40:34 -0000 Author: jhb Date: Tue Jun 7 17:40:33 2011 New Revision: 222829 URL: http://svn.freebsd.org/changeset/base/222829 Log: Log the socket address passed as the destination to sendto() and sendmsg() via ktrace. MFC after: 1 week Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Tue Jun 7 17:33:39 2011 (r222828) +++ head/sys/kern/uipc_syscalls.c Tue Jun 7 17:40:33 2011 (r222829) @@ -747,6 +747,10 @@ kern_sendit(td, s, mp, flags, control, s return (error); so = (struct socket *)fp->f_data; +#ifdef KTRACE + if (mp->msg_name != NULL && KTRPOINT(td, KTR_STRUCT)) + ktrsockaddr(mp->msg_name); +#endif #ifdef MAC if (mp->msg_name != NULL) { error = mac_socket_check_connect(td->td_ucred, so, From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 17:48: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 A08C2106566C; Tue, 7 Jun 2011 17:48:16 +0000 (UTC) (envelope-from mavbsd@gmail.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 BD87E8FC0C; Tue, 7 Jun 2011 17:48:15 +0000 (UTC) Received: by bwz12 with SMTP id 12so6629981bwz.13 for ; Tue, 07 Jun 2011 10:48:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=70fUFSZF/8bmsHrqztW7KYuLMU5ZfgVImC/0b1+0DOg=; b=iDIFTMlsbmuMWX0EiBhDSMu8qwDlHLN4GFHfqPc5hM0dZo6LlKgWABf7aaDe8yPHsO VGdrTxMyGEbtDabNUVtKMEJmi+pKSb8y/fC+4VKpHZRHrgWSVOBgpId8a0oCTaYM9M2k YuhH6UqnwaKtLvzywlluDRdViZ05QNpZ4/N/Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=H78MRvEFN1YbKv98CB5O40t6IFtB1pwRomi44mg8CMJTX6b8CuCUxnLS5tC6TXpwJ5 EcnHpz2lPNlthyznvjX0J5BH7V22QZwaBVkJmQf2YLInTxCLdUdfH01JlVPKVsHFozC3 dRrVV0Cc063fMnLLUIHcMd8PTr9PTkK7GB+bI= Received: by 10.204.151.204 with SMTP id d12mr568999bkw.127.1307468894510; Tue, 07 Jun 2011 10:48:14 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id j7sm820464bka.20.2011.06.07.10.48.12 (version=SSLv3 cipher=OTHER); Tue, 07 Jun 2011 10:48:13 -0700 (PDT) Sender: Alexander Motin Message-ID: <4DEE6434.5030406@FreeBSD.org> Date: Tue, 07 Jun 2011 20:47:32 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Hans Petter Selasky References: <201106071701.p57H1qvN092370@svn.freebsd.org> <201106071930.49724.hselasky@c2i.net> In-Reply-To: <201106071930.49724.hselasky@c2i.net> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r222826 - head/sys/dev/sound/pcm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 17:48:16 -0000 Hans Petter Selasky wrote: > On Tuesday 07 June 2011 19:01:52 Alexander Motin wrote: >> Author: mav >> Date: Tue Jun 7 17:01:52 2011 >> New Revision: 222826 >> URL: http://svn.freebsd.org/changeset/base/222826 >> >> Log: >> Make automatic hw.snd.default_unit choice a bit more intelligent. Instead >> of just setting it to the first registered device, reevaluate it for each >> device registered, trying to choose best candidate, unless one was >> forced. For now use such preference order: play&rec, play, rec. >> >> As side effect, this should workaround the situation when HDMI audio >> output of the video card, usually not connected to anything, becomes >> default, that requires manual user intervention to make sound working. If >> at some point this won't be enough, we can try to fetch some additional >> priority flags from the device driver. > > Idea: I would be cool if some GTK mixer apps can set this value. Definitely. This patch only tries to set more or less reasonable initial default, which later may need to be tuned. I am personally using two different playback devices depending on situation: digital (SPDIF) pcm1 at home and analog pcm0 when out. Now I am switching it via sysctl, but obviously it is not the "right way". -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 18:02: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 22F6F1065679; Tue, 7 Jun 2011 18:02:13 +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 ECD8D8FC13; Tue, 7 Jun 2011 18:02:12 +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 9946A46B46; Tue, 7 Jun 2011 14:02:12 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 14E138A01F; Tue, 7 Jun 2011 14:02:12 -0400 (EDT) From: John Baldwin To: "Jung-uk Kim" Date: Tue, 7 Jun 2011 14:02:11 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <201106062303.p56N3cjs053024@svn.freebsd.org> <201106070952.49563.jhb@freebsd.org> <201106071139.41955.jkim@FreeBSD.org> In-Reply-To: <201106071139.41955.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106071402.11620.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 07 Jun 2011 14:02:12 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222795 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 18:02:13 -0000 On Tuesday, June 07, 2011 11:39:26 am Jung-uk Kim wrote: > On Tuesday 07 June 2011 09:52 am, John Baldwin wrote: > The whole point of this commit is to blacklist *recent* BIOS (or CSM) > from probing keyboard typematic information, more specifically, > recent Intel chipset platforms. They don't support many INT 15h/16h > functions but only cause trouble at best. OTOH, I haven't seen such > problems with AMD chipset systems and they all seem to have > traditional entry points at the interrupt vector table, for example. Err, but you didn't blacklist recent BIOS. You blacklist _all_ BIOS that use entry points other than the ones from the UEFI spec, including BIOSes that don't claim to support UEFI and the BIOS from the two systems I quoted. > > You might as well just turn the check off on all machines at this > > point rather than using completely arbitrary tests that are only > > valid on a small fraction of the x86 universe. > > I don't think it is "completely" arbitrary. If it doesn't have the > traditional entry points, it is very unlikely to support keyboard > typematic in the first place. Please let me know if you have any > counter example. Umm, I just gave you two examples. UEFI is not a standard appropriate to the vast majority of x86 BIOS implementations. It is far, far too narrow. Put another way, we should assume that all non-recent BIOSes do not conform to UEFI (since many older systems pre-date the UEFI spec for one) and that they have all been effectively blacklisted now. Given that, you've now restricted this functionality to only a subset of recent BIOSes and have blacklisted the rest of the known universe. However, the simplest fix is probably to just remove this entirely as I doubt anyone really depends on the BIOS settings for these anyway. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 18:48: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 DD9AB106564A; Tue, 7 Jun 2011 18:48:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3E3F8FC1F; Tue, 7 Jun 2011 18:48: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 p57ImnqX096030; Tue, 7 Jun 2011 18:48:49 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57Imn3u096027; Tue, 7 Jun 2011 18:48:49 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201106071848.p57Imn3u096027@svn.freebsd.org> From: Xin LI Date: Tue, 7 Jun 2011 18:48: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: r222832 - in head: sbin/mount share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 18:48:50 -0000 Author: delphij Date: Tue Jun 7 18:48:49 2011 New Revision: 222832 URL: http://svn.freebsd.org/changeset/base/222832 Log: Add a special mount option "failok" to indicate that the administrator wants the system to proceed to boot without bailing out into single user mode, even when the file system can not be successfully mounted. This option is implemented in mount(8) and not passed into kernel. MFC after: 1 month Modified: head/sbin/mount/mount.c head/share/man/man5/fstab.5 Modified: head/sbin/mount/mount.c ============================================================================== --- head/sbin/mount/mount.c Tue Jun 7 18:43:02 2011 (r222831) +++ head/sbin/mount/mount.c Tue Jun 7 18:48:49 2011 (r222832) @@ -243,7 +243,7 @@ main(int argc, char *argv[]) const char *mntfromname, **vfslist, *vfstype; struct fstab *fs; struct statfs *mntbuf; - int all, ch, i, init_flags, late, mntsize, rval, have_fstab, ro; + int all, ch, i, init_flags, late, failok, mntsize, rval, have_fstab, ro; char *cp, *ep, *options; all = init_flags = late = 0; @@ -328,6 +328,10 @@ main(int argc, char *argv[]) continue; if (hasopt(fs->fs_mntops, "late") && !late) continue; + if (hasopt(fs->fs_mntops, "failok")) + failok = 1; + else + failok = 0; if (!(init_flags & MNT_UPDATE) && ismounted(fs, mntbuf, mntsize)) continue; @@ -335,7 +339,7 @@ main(int argc, char *argv[]) mntbuf->f_flags); if (mountfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file, init_flags, options, - fs->fs_mntops)) + fs->fs_mntops) && !failok) rval = 1; } } else if (fstab_style) { @@ -717,6 +721,14 @@ mangle(char *options, struct cpa *a) * before mountd starts. */ continue; + } else if (strcmp(p, "failok") == 0) { + /* + * "failok" is used to prevent certain file + * systems from being causing the system to + * drop into single user mode in the boot + * cycle, and is not a real mount option. + */ + continue; } else if (strncmp(p, "mountprog", 9) == 0) { /* * "mountprog" is used to force the use of Modified: head/share/man/man5/fstab.5 ============================================================================== --- head/share/man/man5/fstab.5 Tue Jun 7 18:43:02 2011 (r222831) +++ head/share/man/man5/fstab.5 Tue Jun 7 18:48:49 2011 (r222832) @@ -32,7 +32,7 @@ .\" @(#)fstab.5 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd November 23, 2008 +.Dd June 7, 2011 .Dt FSTAB 5 .Os .Sh NAME @@ -147,6 +147,13 @@ this location can be specified as: userquota=/var/quotas/tmp.user .Ed .Pp +If the option ``failok'' is specified, +the system will ignore any error which happens during the mount of that filesystem, +which would otherwise cause the system to drop into single user mode. +This option is implemented by the +.Xr mount 8 +command and will not be passed to the kernel. +.Pp If the option ``noauto'' is specified, the file system will not be automatically mounted at system startup. Note that, for network file systems From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 19:08:41 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id DCF8E106566C; Tue, 7 Jun 2011 19:08:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: John Baldwin Date: Tue, 7 Jun 2011 15:08:29 -0400 User-Agent: KMail/1.6.2 References: <201106062303.p56N3cjs053024@svn.freebsd.org> <201106071139.41955.jkim@FreeBSD.org> <201106071402.11620.jhb@freebsd.org> In-Reply-To: <201106071402.11620.jhb@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106071508.31068.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222795 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 19:08:41 -0000 On Tuesday 07 June 2011 02:02 pm, John Baldwin wrote: > On Tuesday, June 07, 2011 11:39:26 am Jung-uk Kim wrote: > > On Tuesday 07 June 2011 09:52 am, John Baldwin wrote: > > The whole point of this commit is to blacklist *recent* BIOS (or > > CSM) from probing keyboard typematic information, more > > specifically, recent Intel chipset platforms. They don't support > > many INT 15h/16h functions but only cause trouble at best. OTOH, > > I haven't seen such problems with AMD chipset systems and they > > all seem to have traditional entry points at the interrupt vector > > table, for example. > > Err, but you didn't blacklist recent BIOS. You blacklist _all_ > BIOS that use entry points other than the ones from the UEFI spec, > including BIOSes that don't claim to support UEFI and the BIOS from > the two systems I quoted. Relax. The entry points were originally from IBM PC/AT and PS/2 systems and UEFI CSM spec. was written to ensure backward compatibility with the *real* BIOS. I am quite sure your BIOS doesn't support keyboard typematic, i.e., it doesn't have sufficient compatibility with the original IBM BIOS. If it does, I'll happily revert the change. :-) > > > You might as well just turn the check off on all machines at > > > this point rather than using completely arbitrary tests that > > > are only valid on a small fraction of the x86 universe. > > > > I don't think it is "completely" arbitrary. If it doesn't have > > the traditional entry points, it is very unlikely to support > > keyboard typematic in the first place. Please let me know if you > > have any counter example. > > Umm, I just gave you two examples. UEFI is not a standard > appropriate to the vast majority of x86 BIOS implementations. It > is far, far too narrow. Please see above. > Put another way, we should assume that all non-recent BIOSes do not > conform to UEFI (since many older systems pre-date the UEFI spec > for one) and that they have all been effectively blacklisted now. > Given that, you've now restricted this functionality to only a > subset of recent BIOSes and have blacklisted the rest of the known > universe. I mentioned UEFI CSM spec. in the commit log because it *also* mandated the entry points, not because new BIOS must conform to CSM spec., which would be totally non-sensical. > However, the simplest fix is probably to just remove this entirely > as I doubt anyone really depends on the BIOS settings for these > anyway. My 11-year old *Intel* Pentium III motherboard has the exact entry points and it still works fine. ;-) Anyway, I don't mind this feature gets retired. Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 19:08: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 312161065672; Tue, 7 Jun 2011 19:08:49 +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 AA8438FC12; Tue, 7 Jun 2011 19:08:47 +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 WAA28931; Tue, 07 Jun 2011 22:08:45 +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 1QU1dt-000Eqb-Fo; Tue, 07 Jun 2011 22:08:45 +0300 Message-ID: <4DEE773B.9090903@FreeBSD.org> Date: Tue, 07 Jun 2011 22:08:43 +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: John Baldwin , Jung-uk Kim References: <201106062303.p56N3cjs053024@svn.freebsd.org> <201106070952.49563.jhb@freebsd.org> <201106071139.41955.jkim@FreeBSD.org> <201106071402.11620.jhb@freebsd.org> In-Reply-To: <201106071402.11620.jhb@freebsd.org> X-Enigmail-Version: 1.1.2 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: r222795 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 19:08:49 -0000 on 07/06/2011 21:02 John Baldwin said the following: > On Tuesday, June 07, 2011 11:39:26 am Jung-uk Kim wrote: >> On Tuesday 07 June 2011 09:52 am, John Baldwin wrote: >> The whole point of this commit is to blacklist *recent* BIOS (or CSM) >> from probing keyboard typematic information, more specifically, >> recent Intel chipset platforms. They don't support many INT 15h/16h >> functions but only cause trouble at best. OTOH, I haven't seen such >> problems with AMD chipset systems and they all seem to have >> traditional entry points at the interrupt vector table, for example. > > Err, but you didn't blacklist recent BIOS. You blacklist _all_ BIOS that use > entry points other than the ones from the UEFI spec, including BIOSes that > don't claim to support UEFI and the BIOS from the two systems I quoted. I'd like to simply add two datapoints: 1) recent AMD system: $ dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd 00000000 59 f8 00 f0 2e e8 00 f0 2) very old PIIX/440BX system (manufactured ~1999): $ dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd 00000000 9a 06 b8 9c 2e e8 00 f0 -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 19:32:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id F1BB7106566B; Tue, 7 Jun 2011 19:32:08 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: Andriy Gapon Date: Tue, 7 Jun 2011 15:31:58 -0400 User-Agent: KMail/1.6.2 References: <201106062303.p56N3cjs053024@svn.freebsd.org> <201106071402.11620.jhb@freebsd.org> <4DEE773B.9090903@FreeBSD.org> In-Reply-To: <4DEE773B.9090903@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106071532.01179.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r222795 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 19:32:10 -0000 On Tuesday 07 June 2011 03:08 pm, Andriy Gapon wrote: > on 07/06/2011 21:02 John Baldwin said the following: > > On Tuesday, June 07, 2011 11:39:26 am Jung-uk Kim wrote: > >> On Tuesday 07 June 2011 09:52 am, John Baldwin wrote: > >> The whole point of this commit is to blacklist *recent* BIOS (or > >> CSM) from probing keyboard typematic information, more > >> specifically, recent Intel chipset platforms. They don't > >> support many INT 15h/16h functions but only cause trouble at > >> best. OTOH, I haven't seen such problems with AMD chipset > >> systems and they all seem to have traditional entry points at > >> the interrupt vector table, for example. > > > > Err, but you didn't blacklist recent BIOS. You blacklist _all_ > > BIOS that use entry points other than the ones from the UEFI > > spec, including BIOSes that don't claim to support UEFI and the > > BIOS from the two systems I quoted. > > I'd like to simply add two datapoints: > 1) recent AMD system: > > $ dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd > 00000000 59 f8 00 f0 2e e8 00 f0 Yes, that's exactly what I am seeing from all of my AMD systems and a 11-year old Pentium III system. > 2) very old PIIX/440BX system (manufactured ~1999): > $ dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd > 00000000 9a 06 b8 9c 2e e8 00 f0 INT 15h is relocated under 0xa0000, i.e., "highmem". Are you using non-FreeBSD chain loader? Do you have "relocate to highmem" option in the BIOS configuration? Most importantly, does it support keyboard typematic feature? Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 19:39: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 800091065672; Tue, 7 Jun 2011 19:39:34 +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 70A268FC13; Tue, 7 Jun 2011 19:39: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 p57JdYAM097670; Tue, 7 Jun 2011 19:39:34 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57JdYaS097668; Tue, 7 Jun 2011 19:39:34 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201106071939.p57JdYaS097668@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 7 Jun 2011 19:39: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: r222833 - 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, 07 Jun 2011 19:39:34 -0000 Author: bz Date: Tue Jun 7 19:39:34 2011 New Revision: 222833 URL: http://svn.freebsd.org/changeset/base/222833 Log: For the moment document the possible problem introduced with dynamic address family detection in world, mostly noticed by ifconfig(8), when running with an old kernel. Reported by: Andrzej Tobola (ato iem.pw.edu.pl) Reported by: gcooper Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Jun 7 18:48:49 2011 (r222832) +++ head/UPDATING Tue Jun 7 19:39:34 2011 (r222833) @@ -26,6 +26,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. cpumask_t type is retired and cpuset_t is used in order to describe a mask of CPUs. +20110531: + Changes to ifconfig(8) for dynamic address family detection mandate + that you are running a kernel of 20110525 or later. Make sure to + follow the update procedure to boot a new kernel before installing + world. + 20110513: Support for sun4v architecture is officially dropped From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 19:45:15 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 3EAF2106566B; Tue, 7 Jun 2011 19:45:14 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: Andriy Gapon Date: Tue, 7 Jun 2011 15:45:01 -0400 User-Agent: KMail/1.6.2 References: <201106062303.p56N3cjs053024@svn.freebsd.org> <4DEE773B.9090903@FreeBSD.org> <201106071532.01179.jkim@FreeBSD.org> In-Reply-To: <201106071532.01179.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106071545.02850.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r222795 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 19:45:15 -0000 On Tuesday 07 June 2011 03:31 pm, Jung-uk Kim wrote: > On Tuesday 07 June 2011 03:08 pm, Andriy Gapon wrote: > > on 07/06/2011 21:02 John Baldwin said the following: > > > On Tuesday, June 07, 2011 11:39:26 am Jung-uk Kim wrote: > > >> On Tuesday 07 June 2011 09:52 am, John Baldwin wrote: > > >> The whole point of this commit is to blacklist *recent* BIOS > > >> (or CSM) from probing keyboard typematic information, more > > >> specifically, recent Intel chipset platforms. They don't > > >> support many INT 15h/16h functions but only cause trouble at > > >> best. OTOH, I haven't seen such problems with AMD chipset > > >> systems and they all seem to have traditional entry points at > > >> the interrupt vector table, for example. > > > > > > Err, but you didn't blacklist recent BIOS. You blacklist _all_ > > > BIOS that use entry points other than the ones from the UEFI > > > spec, including BIOSes that don't claim to support UEFI and the > > > BIOS from the two systems I quoted. > > > > I'd like to simply add two datapoints: > > 1) recent AMD system: > > > > $ dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd > > 00000000 59 f8 00 f0 2e e8 00 f0 > > Yes, that's exactly what I am seeing from all of my AMD systems and > a 11-year old Pentium III system. > > > 2) very old PIIX/440BX system (manufactured ~1999): > > $ dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd > > 00000000 9a 06 b8 9c 2e e8 00 f0 > > INT 15h is relocated under 0xa0000, i.e., "highmem". Are you using > non-FreeBSD chain loader? Do you have "relocate to highmem" option > in the BIOS configuration? Sorry, it's actually under 640KB in conventional memory. It must be done by TSR or boot loader. Ah, good ol'days... :-P Jung-uk Kim > Most importantly, does it support keyboard typematic feature? > > Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 20:20: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 1C3F3106566B; Tue, 7 Jun 2011 20:20:17 +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 E61228FC13; Tue, 7 Jun 2011 20:20:16 +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 8312546B46; Tue, 7 Jun 2011 16:20:16 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0560D8A01F; Tue, 7 Jun 2011 16:20:16 -0400 (EDT) From: John Baldwin To: "Jung-uk Kim" Date: Tue, 7 Jun 2011 16:05:30 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <201106062303.p56N3cjs053024@svn.freebsd.org> <201106071402.11620.jhb@freebsd.org> <201106071508.31068.jkim@FreeBSD.org> In-Reply-To: <201106071508.31068.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106071605.30586.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 07 Jun 2011 16:20:16 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222795 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 07 Jun 2011 20:20:17 -0000 On Tuesday, June 07, 2011 3:08:29 pm Jung-uk Kim wrote: > On Tuesday 07 June 2011 02:02 pm, John Baldwin wrote: > > On Tuesday, June 07, 2011 11:39:26 am Jung-uk Kim wrote: > > > On Tuesday 07 June 2011 09:52 am, John Baldwin wrote: > > > The whole point of this commit is to blacklist *recent* BIOS (or > > > CSM) from probing keyboard typematic information, more > > > specifically, recent Intel chipset platforms. They don't support > > > many INT 15h/16h functions but only cause trouble at best. OTOH, > > > I haven't seen such problems with AMD chipset systems and they > > > all seem to have traditional entry points at the interrupt vector > > > table, for example. > > > > Err, but you didn't blacklist recent BIOS. You blacklist _all_ > > BIOS that use entry points other than the ones from the UEFI spec, > > including BIOSes that don't claim to support UEFI and the BIOS from > > the two systems I quoted. > > Relax. The entry points were originally from IBM PC/AT and PS/2 > systems and UEFI CSM spec. was written to ensure backward > compatibility with the *real* BIOS. I am quite sure your BIOS > doesn't support keyboard typematic, i.e., it doesn't have sufficient > compatibility with the original IBM BIOS. If it does, I'll happily > revert the change. :-) Hmm, I had not expected such consistency among BIOS implementations given the number of vendors, etc. I would probably be fine with just removing this feature entirely though unless it is truly useful. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 20:46: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 8F1E21065675; Tue, 7 Jun 2011 20:46:03 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F97E8FC12; Tue, 7 Jun 2011 20:46: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 p57Kk3lZ099719; Tue, 7 Jun 2011 20:46:03 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57Kk3TC099716; Tue, 7 Jun 2011 20:46:03 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201106072046.p57Kk3TC099716@svn.freebsd.org> From: Marko Zec Date: Tue, 7 Jun 2011 20:46: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: r222834 - 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: Tue, 07 Jun 2011 20:46:03 -0000 Author: zec Date: Tue Jun 7 20:46:03 2011 New Revision: 222834 URL: http://svn.freebsd.org/changeset/base/222834 Log: Set curvnet context in a callout-trigerred code path. MFC after: 3 days Modified: head/sys/net/bridgestp.c head/sys/net/bridgestp.h Modified: head/sys/net/bridgestp.c ============================================================================== --- head/sys/net/bridgestp.c Tue Jun 7 19:39:34 2011 (r222833) +++ head/sys/net/bridgestp.c Tue Jun 7 20:46:03 2011 (r222834) @@ -1860,6 +1860,8 @@ bstp_tick(void *arg) if (bs->bs_running == 0) return; + CURVNET_SET(bs->bs_vnet); + /* slow timer to catch missed link events */ if (bstp_timer_expired(&bs->bs_link_timer)) { LIST_FOREACH(bp, &bs->bs_bplist, bp_next) @@ -1893,6 +1895,8 @@ bstp_tick(void *arg) bp->bp_txcount--; } + CURVNET_RESTORE(); + callout_reset(&bs->bs_bstpcallout, hz, bstp_tick, bs); } @@ -2126,6 +2130,7 @@ bstp_attach(struct bstp_state *bs, struc bs->bs_protover = BSTP_PROTO_RSTP; bs->bs_state_cb = cb->bcb_state; bs->bs_rtage_cb = cb->bcb_rtage; + bs->bs_vnet = curvnet; getmicrotime(&bs->bs_last_tc_time); Modified: head/sys/net/bridgestp.h ============================================================================== --- head/sys/net/bridgestp.h Tue Jun 7 19:39:34 2011 (r222833) +++ head/sys/net/bridgestp.h Tue Jun 7 20:46:03 2011 (r222834) @@ -358,6 +358,7 @@ struct bstp_state { LIST_HEAD(, bstp_port) bs_bplist; bstp_state_cb_t bs_state_cb; bstp_rtage_cb_t bs_rtage_cb; + struct vnet *bs_vnet; }; #define BSTP_LOCK_INIT(_bs) mtx_init(&(_bs)->bs_mtx, "bstp", NULL, MTX_DEF) From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 20:46: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 AE9B41065748; Tue, 7 Jun 2011 20:46:31 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EBC88FC1A; Tue, 7 Jun 2011 20:46:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p57KkVPI099792; Tue, 7 Jun 2011 20:46:31 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57KkVBO099790; Tue, 7 Jun 2011 20:46:31 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201106072046.p57KkVBO099790@svn.freebsd.org> From: Martin Matuska Date: Tue, 7 Jun 2011 20:46:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222835 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2011 20:46:31 -0000 Author: mm Date: Tue Jun 7 20:46:31 2011 New Revision: 222835 URL: http://svn.freebsd.org/changeset/base/222835 Log: Silence notice on pool creation, import and access. Suggested by: Jeremy Chadwick (freebsd-stable@) Discussed with: pjd MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Tue Jun 7 20:46:03 2011 (r222834) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Tue Jun 7 20:46:31 2011 (r222835) @@ -500,9 +500,11 @@ spa_history_log_version(spa_t *spa, hist utsname.nodename, utsname.release, utsname.version, utsname.machine); } +#if 0 cmn_err(CE_CONT, "!%s version %llu pool %s using %llu", event == LOG_POOL_IMPORT ? "imported" : event == LOG_POOL_CREATE ? "created" : "accessed", (u_longlong_t)current_vers, spa_name(spa), SPA_VERSION); #endif +#endif } From owner-svn-src-head@FreeBSD.ORG Tue Jun 7 23: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 3D8291065670; Tue, 7 Jun 2011 23:15:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DC9D8FC08; Tue, 7 Jun 2011 23:15: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 p57NFM0A004560; Tue, 7 Jun 2011 23:15:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p57NFMg4004559; Tue, 7 Jun 2011 23:15:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201106072315.p57NFMg4004559@svn.freebsd.org> From: Marius Strobl Date: Tue, 7 Jun 2011 23:15: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: r222840 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2011 23:15:22 -0000 Author: marius Date: Tue Jun 7 23:15:21 2011 New Revision: 222840 URL: http://svn.freebsd.org/changeset/base/222840 Log: - For the case when tl1_align(_trap) is used to call rsf_fatal via RSF_FATAL we need to switch to alternate globals for KSTACK_CHECK just like tl1_data_excptn(_trap) does. This is more or less cosmetic because in case RSF_FATAL is called we're already heading south. - Correct an END(). - Read the window state from the correct register for a CATR(). Modified: head/sys/sparc64/sparc64/exception.S Modified: head/sys/sparc64/sparc64/exception.S ============================================================================== --- head/sys/sparc64/sparc64/exception.S Tue Jun 7 21:48:36 2011 (r222839) +++ head/sys/sparc64/sparc64/exception.S Tue Jun 7 23:15:21 2011 (r222840) @@ -1280,6 +1280,7 @@ ENTRY(tl1_data_excptn_trap) END(tl1_data_excptn_trap) .macro tl1_align + wrpr %g0, PSTATE_ALT, %pstate ba,a %xcc, tl1_align_trap nop .align 32 @@ -1289,7 +1290,7 @@ ENTRY(tl1_align_trap) RESUME_SPILLFILL_ALIGN ba %xcc, tl1_sfsr_trap mov T_MEM_ADDRESS_NOT_ALIGNED | T_KERNEL, %g2 -END(tl1_data_excptn_trap) +END(tl1_align_trap) ENTRY(tl1_sfsr_trap) wr %g0, ASI_DMMU, %asi @@ -2702,7 +2703,7 @@ tl0_ret_fill_end: , %l0, %l1, %l2, 7, 8, 9) rdpr %pstate, %l1 stx %l1, [%l0 + KTR_PARM1] - stx %l5, [%l0 + KTR_PARM2] + stx %l6, [%l0 + KTR_PARM2] stx %sp, [%l0 + KTR_PARM3] 9: From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 00:10: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 B7665106564A; Wed, 8 Jun 2011 00:10:25 +0000 (UTC) (envelope-from skipford9@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 3FD768FC08; Wed, 8 Jun 2011 00:10:24 +0000 (UTC) Received: by qyk35 with SMTP id 35so1934747qyk.13 for ; Tue, 07 Jun 2011 17:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=dsMVsTsSd5DYA6Xq7tZ+tvTvvrPfHYWjOxkTw2cGMOs=; b=EICpFKyyZ1jXJKDhSIzMTcTfQEVKz/w4f/fzYJUtMUoDnt10gxHw8Ue/wLNWfrVBp5 9e4oAFbzuPKLCHyyWDLKfS2AM/W34E7/5Q9iKSpG3DuPfuGZMFb8YQbbIOkYyE4UZVoP gdnRaXCQz8Uqh2eoGi/Es1D0oWMz020vHkCwk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=R/9ucl1kmcEHml1AE1xhf/weGHwKcKpOdtPE30LbZwNMIf5DVURVeXwKtSxAXjHls/ KXCOF9lFuoTYgfuUj/MFNh6Hx33ZZvuDAMlS8GuxBJ0qUsCijbhElrntIbS/GVVVRbn7 t00Cv04NVJSN6/grDd8DUIUp/tWZ+22ZSWRQE= Received: by 10.224.105.139 with SMTP id t11mr3487830qao.282.1307490439261; Tue, 07 Jun 2011 16:47:19 -0700 (PDT) Received: from ws.menantico.com (pool-71-168-248-198.cmdnnj.east.verizon.net [71.168.248.198]) by mx.google.com with ESMTPS id j18sm4001616qck.15.2011.06.07.16.47.18 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 07 Jun 2011 16:47:18 -0700 (PDT) Date: Tue, 7 Jun 2011 19:47:16 -0400 From: Skip Ford To: Alexander Motin Message-ID: <20110607234715.GA62676@ws.menantico.com> References: <201106071701.p57H1qvN092370@svn.freebsd.org> <201106071930.49724.hselasky@c2i.net> <4DEE6434.5030406@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DEE6434.5030406@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" , Hans Petter Selasky Subject: Re: svn commit: r222826 - head/sys/dev/sound/pcm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 00:10:25 -0000 On Tue, Jun 07, 2011 at 08:47:32PM +0300, Alexander Motin wrote: > Hans Petter Selasky wrote: > > On Tuesday 07 June 2011 19:01:52 Alexander Motin wrote: > >> Author: mav > >> Date: Tue Jun 7 17:01:52 2011 > >> New Revision: 222826 > >> URL: http://svn.freebsd.org/changeset/base/222826 > >> > >> Log: > >> Make automatic hw.snd.default_unit choice a bit more intelligent. Instead > >> of just setting it to the first registered device, reevaluate it for each > >> device registered, trying to choose best candidate, unless one was > >> forced. For now use such preference order: play&rec, play, rec. > >> > >> As side effect, this should workaround the situation when HDMI audio > >> output of the video card, usually not connected to anything, becomes > >> default, that requires manual user intervention to make sound working. If > >> at some point this won't be enough, we can try to fetch some additional > >> priority flags from the device driver. > > > > Idea: I would be cool if some GTK mixer apps can set this value. > > Definitely. This patch only tries to set more or less reasonable initial > default, which later may need to be tuned. I am personally using two > different playback devices depending on situation: digital (SPDIF) pcm1 > at home and analog pcm0 when out. Now I am switching it via sysctl, but > obviously it is not the "right way". I switch back and forth between a soundcard and wireless headphones, and have always felt that the sysctl is misnamed. It really acts as a combination of default_unit and current_unit. If I set the default_unit to my wireless headphones, then unplug the usb dongle, the kernel changes my default_unit setting since my preferred device disappears. The kernel changing my default setting is contrary to what I'd expect. It would seem more natural if the kernel maintained its own currently_active_unit variable and just used default_unit as a hint for when to switch back and forth. Just feels like it shouldn't overwrite, and lose, a setting that I've specified. -- Skip From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 00:31: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 F27E3106566B; Wed, 8 Jun 2011 00:31:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C940C8FC14; Wed, 8 Jun 2011 00:31: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 p580VA8g006770; Wed, 8 Jun 2011 00:31:10 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p580VA71006768; Wed, 8 Jun 2011 00:31:10 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201106080031.p580VA71006768@svn.freebsd.org> From: Xin LI Date: Wed, 8 Jun 2011 00:31: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: r222841 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 00:31:11 -0000 Author: delphij Date: Wed Jun 8 00:31:10 2011 New Revision: 222841 URL: http://svn.freebsd.org/changeset/base/222841 Log: Use .Dq instead of hardcoding `` and ''. Suggested by: gjb Modified: head/share/man/man5/fstab.5 Modified: head/share/man/man5/fstab.5 ============================================================================== --- head/share/man/man5/fstab.5 Tue Jun 7 23:15:21 2011 (r222840) +++ head/share/man/man5/fstab.5 Wed Jun 8 00:31:10 2011 (r222841) @@ -70,7 +70,8 @@ remote file system to be mounted. The second field, .Pq Fa fs_file , describes the mount point for the file system. -For swap partitions, this field should be specified as ``none''. +For swap partitions, this field should be specified as +.Dq none . .Pp The third field, .Pq Fa fs_vfstype , @@ -125,7 +126,11 @@ sync,noatime,-m=644,-M=755,-u=foo,-g=bar in the option field of .Nm . .Pp -If the options ``userquota'' and/or ``groupquota'' are specified, +If the options +.Dq userquota +and/or +.Dq groupquota +are specified, the file system is automatically processed by the .Xr quotacheck 8 command, and user and/or group disk quotas are enabled with @@ -147,14 +152,18 @@ this location can be specified as: userquota=/var/quotas/tmp.user .Ed .Pp -If the option ``failok'' is specified, +If the option +.Dq failok +is specified, the system will ignore any error which happens during the mount of that filesystem, which would otherwise cause the system to drop into single user mode. This option is implemented by the .Xr mount 8 command and will not be passed to the kernel. .Pp -If the option ``noauto'' is specified, the file system will not be automatically +If the option +.Dq noauto +is specified, the file system will not be automatically mounted at system startup. Note that, for network file systems of third party types @@ -177,13 +186,19 @@ field (it is not deleted from the field). If .Fa fs_type -is ``rw'' or ``ro'' then the file system whose name is given in the +is +.Dq rw +or +.Dq ro +then the file system whose name is given in the .Fa fs_file field is normally mounted read-write or read-only on the specified special file. If .Fa fs_type -is ``sw'' then the special file is made available as a piece of swap +is +.Dq sw +then the special file is made available as a piece of swap space by the .Xr swapon 8 command at the end of the system reboot procedure. @@ -194,7 +209,9 @@ and are unused. If .Fa fs_type -is specified as ``xx'' the entry is ignored. +is specified as +.Dq xx +the entry is ignored. This is useful to show disk partitions which are currently unused. .Pp The fifth field, From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 03:02: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 0D3D8106564A; Wed, 8 Jun 2011 03:02:12 +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 E6C0F8FC15; Wed, 8 Jun 2011 03:02: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 p5832BUd011529; Wed, 8 Jun 2011 03:02:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5832Br3011525; Wed, 8 Jun 2011 03:02:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201106080302.p5832Br3011525@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 8 Jun 2011 03:02: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: r222845 - in head/sys: 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: Wed, 08 Jun 2011 03:02:12 -0000 Author: bz Date: Wed Jun 8 03:02:11 2011 New Revision: 222845 URL: http://svn.freebsd.org/changeset/base/222845 Log: Correct comments and debug logging in ipsec to better match reality. MFC after: 3 days Modified: head/sys/netinet/ip_input.c head/sys/netinet/ip_ipsec.c head/sys/netinet6/ip6_ipsec.c Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Wed Jun 8 01:28:46 2011 (r222844) +++ head/sys/netinet/ip_input.c Wed Jun 8 03:02:11 2011 (r222845) @@ -488,7 +488,7 @@ tooshort: } #ifdef IPSEC /* - * Bypass packet filtering for packets from a tunnel (gif). + * Bypass packet filtering for packets previously handled by IPsec. */ if (ip_ipsec_filtertunnel(m)) goto passin; Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Wed Jun 8 01:28:46 2011 (r222844) +++ head/sys/netinet/ip_ipsec.c Wed Jun 8 03:02:11 2011 (r222845) @@ -95,7 +95,7 @@ ip_ipsec_filtertunnel(struct mbuf *m) #if defined(IPSEC) /* - * Bypass packet filtering for packets from a tunnel. + * Bypass packet filtering for packets previously handled by IPsec. */ if (!V_ip4_ipsec_filtertunnel && m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL) != NULL) Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Wed Jun 8 01:28:46 2011 (r222844) +++ head/sys/netinet6/ip6_ipsec.c Wed Jun 8 03:02:11 2011 (r222845) @@ -97,7 +97,7 @@ SYSCTL_VNET_INT(_net_inet6_ipsec6, OID_A /* * Check if we have to jump over firewall processing for this packet. - * Called from ip_input(). + * Called from ip6_input(). * 1 = jump over firewall, 0 = packet goes through firewall. */ int @@ -106,7 +106,7 @@ ip6_ipsec_filtertunnel(struct mbuf *m) #if defined(IPSEC) /* - * Bypass packet filtering for packets from a tunnel. + * Bypass packet filtering for packets previously handled by IPsec. */ if (!V_ip6_ipsec6_filtertunnel && m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL) != NULL) @@ -118,7 +118,7 @@ ip6_ipsec_filtertunnel(struct mbuf *m) /* * Check if this packet has an active SA and needs to be dropped instead * of forwarded. - * Called from ip_input(). + * Called from ip6_input(). * 1 = drop packet, 0 = forward packet. */ int @@ -141,7 +141,7 @@ ip6_ipsec_fwd(struct mbuf *m) if (sp == NULL) { /* NB: can happen if error */ splx(s); /*XXX error stat???*/ - DPRINTF(("ip_input: no SP for forwarding\n")); /*XXX*/ + DPRINTF(("%s: no SP for forwarding\n", __func__)); /*XXX*/ return 1; } @@ -163,7 +163,7 @@ ip6_ipsec_fwd(struct mbuf *m) * Check if protocol type doesn't have a further header and do IPSEC * decryption or reject right now. Protocols with further headers get * their IPSEC treatment within the protocol specific processing. - * Called from ip_input(). + * Called from ip6_input(). * 1 = drop packet, 0 = continue processing packet. */ int @@ -206,7 +206,7 @@ ip6_ipsec_input(struct mbuf *m, int nxt) } else { /* XXX error stat??? */ error = EINVAL; - DPRINTF(("ip_input: no SP, packet discarded\n"));/*XXX*/ + DPRINTF(("%s: no SP, packet discarded\n", __func__));/*XXX*/ return 1; } splx(s); From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 04:06: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 B5299106564A; Wed, 8 Jun 2011 04:06:56 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A54A68FC0A; Wed, 8 Jun 2011 04:06: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 p5846uNZ013727; Wed, 8 Jun 2011 04:06:56 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5846uVP013724; Wed, 8 Jun 2011 04:06:56 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106080406.p5846uVP013724@svn.freebsd.org> From: Hiroki Sato Date: Wed, 8 Jun 2011 04:06: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: r222848 - head/usr.sbin/rtsold X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 04:06:56 -0000 Author: hrs Date: Wed Jun 8 04:06:56 2011 New Revision: 222848 URL: http://svn.freebsd.org/changeset/base/222848 Log: - Disable "resolvconf -d" temporarily to avoid extra invocations of the script under a certain condition. - Fix argv handling. Spotted by: ume Modified: head/usr.sbin/rtsold/rtsol.c head/usr.sbin/rtsold/rtsold.c Modified: head/usr.sbin/rtsold/rtsol.c ============================================================================== --- head/usr.sbin/rtsold/rtsol.c Wed Jun 8 03:55:58 2011 (r222847) +++ head/usr.sbin/rtsold/rtsol.c Wed Jun 8 04:06:56 2011 (r222848) @@ -625,8 +625,10 @@ free1: if (!TAILQ_EMPTY(&sm_rdnss_head)) CALL_SCRIPT(RESADD, &sm_rdnss_head); +#if 0 else CALL_SCRIPT(RESDEL, NULL); +#endif ra_opt_handler_freeit: /* Clear script message queue. */ Modified: head/usr.sbin/rtsold/rtsold.c ============================================================================== --- head/usr.sbin/rtsold/rtsold.c Wed Jun 8 03:55:58 2011 (r222847) +++ head/usr.sbin/rtsold/rtsold.c Wed Jun 8 04:06:56 2011 (r222848) @@ -124,6 +124,7 @@ main(int argc, char **argv) int maxfd; #endif int rtsock; + char *argv0; #ifndef SMALL /* rtsold */ @@ -134,6 +135,8 @@ main(int argc, char **argv) fflag = 1; once = 1; #endif + argv0 = argv[0]; + while ((ch = getopt(argc, argv, opts)) != -1) { switch (ch) { case 'a': @@ -185,9 +188,9 @@ main(int argc, char **argv) if (!fflag) { char *ident; - ident = strrchr(argv[0], '/'); + ident = strrchr(argv0, '/'); if (!ident) - ident = argv[0]; + ident = argv0; else ident++; openlog(ident, LOG_NDELAY|LOG_PID, LOG_DAEMON); From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 06:17: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 ADD7C106564A; Wed, 8 Jun 2011 06:17:08 +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 385638FC08; Wed, 8 Jun 2011 06:17:06 +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 JAA08272; Wed, 08 Jun 2011 09:17:04 +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 1QUC4e-000HbX-Gl; Wed, 08 Jun 2011 09:17:04 +0300 Message-ID: <4DEF13DF.4090103@FreeBSD.org> Date: Wed, 08 Jun 2011 09:17:03 +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: Jung-uk Kim References: <201106062303.p56N3cjs053024@svn.freebsd.org> <4DEE773B.9090903@FreeBSD.org> <201106071532.01179.jkim@FreeBSD.org> <201106071545.02850.jkim@FreeBSD.org> In-Reply-To: <201106071545.02850.jkim@FreeBSD.org> X-Enigmail-Version: 1.1.2 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, John Baldwin Subject: Re: svn commit: r222795 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 06:17:08 -0000 on 07/06/2011 22:45 Jung-uk Kim said the following: > On Tuesday 07 June 2011 03:31 pm, Jung-uk Kim wrote: >> On Tuesday 07 June 2011 03:08 pm, Andriy Gapon wrote: >>> on 07/06/2011 21:02 John Baldwin said the following: >>>> On Tuesday, June 07, 2011 11:39:26 am Jung-uk Kim wrote: >>>>> On Tuesday 07 June 2011 09:52 am, John Baldwin wrote: >>>>> The whole point of this commit is to blacklist *recent* BIOS >>>>> (or CSM) from probing keyboard typematic information, more >>>>> specifically, recent Intel chipset platforms. They don't >>>>> support many INT 15h/16h functions but only cause trouble at >>>>> best. OTOH, I haven't seen such problems with AMD chipset >>>>> systems and they all seem to have traditional entry points at >>>>> the interrupt vector table, for example. >>>> >>>> Err, but you didn't blacklist recent BIOS. You blacklist _all_ >>>> BIOS that use entry points other than the ones from the UEFI >>>> spec, including BIOSes that don't claim to support UEFI and the >>>> BIOS from the two systems I quoted. >>> >>> I'd like to simply add two datapoints: >>> 1) recent AMD system: >>> >>> $ dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd >>> 00000000 59 f8 00 f0 2e e8 00 f0 >> >> Yes, that's exactly what I am seeing from all of my AMD systems and >> a 11-year old Pentium III system. >> >>> 2) very old PIIX/440BX system (manufactured ~1999): >>> $ dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd >>> 00000000 9a 06 b8 9c 2e e8 00 f0 >> >> INT 15h is relocated under 0xa0000, i.e., "highmem". Are you using >> non-FreeBSD chain loader? Ah, yes, it's a diskless boot using gpxe. > Do you have "relocate to highmem" option >> in the BIOS configuration? > > Sorry, it's actually under 640KB in conventional memory. It must be > done by TSR or boot loader. Ah, good ol'days... :-P > >> Most importantly, does it support keyboard typematic feature? At least there is a BIOS option for setting it. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 08:08: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 E18F51065672; Wed, 8 Jun 2011 08:08:42 +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 D023F8FC0C; Wed, 8 Jun 2011 08:08: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 p5888gii021096; Wed, 8 Jun 2011 08:08:42 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5888gnu021091; Wed, 8 Jun 2011 08:08:42 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201106080808.p5888gnu021091@svn.freebsd.org> From: Ruslan Ermilov Date: Wed, 8 Jun 2011 08:08: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: r222852 - in head: contrib/groff/tmac gnu/usr.bin/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: Wed, 08 Jun 2011 08:08:43 -0000 Author: ru Date: Wed Jun 8 08:08:42 2011 New Revision: 222852 URL: http://svn.freebsd.org/changeset/base/222852 Log: Pull up all vendor changes to mdoc(7). This also replaces the local fix in r219209 that made .Ac emit ASCII angle quotes with an official fix. In the official fix, ASCII quotes are output when using the .Aq, .Ao and .Ac calls, but only when nested into the .An macro. PR: gnu/154822 Modified: head/contrib/groff/tmac/doc-common head/contrib/groff/tmac/doc-syms head/contrib/groff/tmac/doc.tmac head/gnu/usr.bin/groff/tmac/mdoc.local Modified: head/contrib/groff/tmac/doc-common ============================================================================== --- head/contrib/groff/tmac/doc-common Wed Jun 8 04:57:14 2011 (r222851) +++ head/contrib/groff/tmac/doc-common Wed Jun 8 08:08:42 2011 (r222852) @@ -543,6 +543,7 @@ .ds doc-operating-system-FreeBSD-7.3 7.3 .ds doc-operating-system-FreeBSD-8.0 8.0 .ds doc-operating-system-FreeBSD-8.1 8.1 +.ds doc-operating-system-FreeBSD-8.2 8.2 . .ds doc-operating-system-Darwin-8.0.0 8.0.0 .ds doc-operating-system-Darwin-8.1.0 8.1.0 @@ -563,6 +564,17 @@ .ds doc-operating-system-Darwin-9.4.0 9.4.0 .ds doc-operating-system-Darwin-9.5.0 9.5.0 .ds doc-operating-system-Darwin-9.6.0 9.6.0 +.ds doc-operating-system-Darwin-9.7.0 9.7.0 +.ds doc-operating-system-Darwin-9.8.0 9.8.0 +.ds doc-operating-system-Darwin-10.6.0 10.6.0 +.ds doc-operating-system-Darwin-10.1.0 10.1.0 +.ds doc-operating-system-Darwin-10.2.0 10.2.0 +.ds doc-operating-system-Darwin-10.3.0 10.3.0 +.ds doc-operating-system-Darwin-10.4.0 10.4.0 +.ds doc-operating-system-Darwin-10.5.0 10.5.0 +.ds doc-operating-system-Darwin-10.6.0 10.6.0 +.ds doc-operating-system-Darwin-10.7.0 10.7.0 +.ds doc-operating-system-Darwin-11.0.0 11.0.0 . .ds doc-operating-system-DragonFly-1.0 1.0 .ds doc-operating-system-DragonFly-1.1 1.1 Modified: head/contrib/groff/tmac/doc-syms ============================================================================== --- head/contrib/groff/tmac/doc-syms Wed Jun 8 04:57:14 2011 (r222851) +++ head/contrib/groff/tmac/doc-syms Wed Jun 8 08:08:42 2011 (r222852) @@ -617,6 +617,8 @@ .\" POSIX Part 1: System API .ds doc-str-St--p1003.1 \*[doc-Tn-font-size]\%IEEE\*[doc-str-St] Std 1003.1 .as doc-str-St--p1003.1 " (\*[Lq]\)\*[Px]\*[doc-str-St].1\*[Rq]) +.ds doc-str-St--p1003.1b \*[doc-Tn-font-size]\%IEEE\*[doc-str-St] Std 1003.1b +.as doc-str-St--p1003.1b " (\*[Lq]\)\*[Px]\*[doc-str-St].1\*[Rq]) .ds doc-str-St--p1003.1-88 \*[doc-Tn-font-size]\%IEEE\*[doc-str-St] Std 1003.1-1988 .as doc-str-St--p1003.1-88 " (\*[Lq]\)\*[Px]\*[doc-str-St].1\*[Rq]) .ds doc-str-St--p1003.1-90 \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9945-1:1990 @@ -754,6 +756,7 @@ . .ds doc-str-Lb-libarm ARM Architecture Library (libarm, \-larm) .ds doc-str-Lb-libarm32 ARM32 Architecture Library (libarm32, \-larm32) +.ds doc-str-Lb-libbsm Basic Security Module Library (libbsm, \-lbsm) .ds doc-str-Lb-libc Standard C\~Library (libc, \-lc) .ds doc-str-Lb-libcdk Curses Development Kit Library (libcdk, \-lcdk) .ds doc-str-Lb-libcompat Compatibility Library (libcompat, \-lcompat) @@ -779,6 +782,7 @@ .ds doc-str-Lb-libpthread \*[Px] \*[doc-str-Lb]Threads Library (libpthread, \-lpthread) .ds doc-str-Lb-libresolv DNS Resolver Library (libresolv, \-lresolv) .ds doc-str-Lb-librt \*[Px] \*[doc-str-Lb]Real-time Library (librt, \-lrt) +.ds doc-str-Lb-libSystem System Library (libSystem, \-lSystem) .ds doc-str-Lb-libtermcap Termcap Access Library (libtermcap, \-ltermcap) .ds doc-str-Lb-libusbhid USB Human Interface Devices Library (libusbhid, \-lusbhid) .ds doc-str-Lb-libutil System Utilities Library (libutil, \-lutil) Modified: head/contrib/groff/tmac/doc.tmac ============================================================================== --- head/contrib/groff/tmac/doc.tmac Wed Jun 8 04:57:14 2011 (r222851) +++ head/contrib/groff/tmac/doc.tmac Wed Jun 8 08:08:42 2011 (r222852) @@ -1197,8 +1197,14 @@ . if !\n[doc-arg-limit] \ . ds doc-macro-name Aq . -. ds doc-quote-left < -. ds doc-quote-right > +. ie "\*[doc-macro-name]"An" \{\ +. ds doc-quote-left < +. ds doc-quote-right > +. \} +. el \{\ +. ds doc-quote-left \[la] +. ds doc-quote-right \[ra] +. \} . . doc-enclose-string \$@ .. @@ -1527,7 +1533,10 @@ . if !\n[doc-arg-limit] \ . ds doc-macro-name Ao . -. ds doc-quote-left \[la] +. ie "\*[doc-macro-name]"An" \ +. ds doc-quote-left < +. el \ +. ds doc-quote-left \[la] . . doc-enclose-open \$@ .. @@ -1546,7 +1555,10 @@ . if !\n[doc-arg-limit] \ . ds doc-macro-name Ac . -. ds doc-quote-right \[ra] +. ie "\*[doc-macro-name]"An" \ +. ds doc-quote-right > +. el \ +. ds doc-quote-right \[ra] . . doc-enclose-close \$@ .. Modified: head/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- head/gnu/usr.bin/groff/tmac/mdoc.local Wed Jun 8 04:57:14 2011 (r222851) +++ head/gnu/usr.bin/groff/tmac/mdoc.local Wed Jun 8 08:08:42 2011 (r222852) @@ -34,7 +34,6 @@ .\" FreeBSD .Lb values .ds doc-str-Lb-libarchive Streaming Archive Library (libarchive, \-larchive) .ds doc-str-Lb-libbluetooth Bluetooth User Library (libbluetooth, \-lbluetooth) -.ds doc-str-Lb-libbsm Basic Security Module User Library (libbsm, \-lbsm) .ds doc-str-Lb-libc_r Reentrant C\~Library (libc_r, \-lc_r) .ds doc-str-Lb-libcalendar Calendar Arithmetic Library (libcalendar, \-lcalendar) .ds doc-str-Lb-libcam Common Access Method User Library (libcam, \-lcam) @@ -75,7 +74,6 @@ . .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-7.4 7.4 -.ds doc-operating-system-FreeBSD-8.2 8.2 .ds doc-operating-system-FreeBSD-9.0 9.0 . .\" Definitions not (yet) in doc-syms From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 08:12: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 A6319106564A; Wed, 8 Jun 2011 08:12:15 +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 93C568FC1C; Wed, 8 Jun 2011 08:12: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 p588CFHV021276; Wed, 8 Jun 2011 08:12:15 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p588CFjb021267; Wed, 8 Jun 2011 08:12:15 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201106080812.p588CFjb021267@svn.freebsd.org> From: Andriy Gapon Date: Wed, 8 Jun 2011 08:12: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: r222853 - in head: . sys/amd64/amd64 sys/amd64/include sys/i386/i386 sys/i386/include sys/pc98/pc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2011 08:12:15 -0000 Author: avg Date: Wed Jun 8 08:12:15 2011 New Revision: 222853 URL: http://svn.freebsd.org/changeset/base/222853 Log: remove code for dynamic offlining/onlining of CPUs on x86 The code has definitely been broken for SCHED_ULE, which is a default scheduler. It may have been broken for SCHED_4BSD in more subtle ways, e.g. with manually configured CPU affinities and for interrupt devilery purposes. We still provide a way to disable individual CPUs or all hyperthreading "twin" CPUs before SMP startup. See the UPDATING entry for details. Interaction between building CPU topology and disabling CPUs still remains fuzzy: topology is first built using all availble CPUs and then the disabled CPUs should be "subtracted" from it. That doesn't work well if the resulting topology becomes non-uniform. This work is done in cooperation with Attilio Rao who in addition to reviewing also provided parts of code. PR: kern/145385 Discussed with: gcooper, ambrisko, mdf, sbruno Reviewed by: attilio Tested by: pho, pluknet X-MFC after: never Modified: head/UPDATING head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/include/smp.h head/sys/i386/i386/machdep.c head/sys/i386/i386/mp_machdep.c head/sys/i386/include/smp.h head/sys/pc98/pc98/machdep.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Jun 8 08:08:42 2011 (r222852) +++ head/UPDATING Wed Jun 8 08:12:15 2011 (r222853) @@ -22,6 +22,23 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20110608: + The following sysctls and tunables are retired on x86 platforms: + machdep.hlt_cpus + machdep.hlt_logical_cpus + The following sysctl is retired: + machdep.hyperthreading_allowed + The sysctls were supposed to provide a way to dynamically offline and + online selected CPUs on x86 platforms, but the implementation has not + been reliable especially with SCHED_ULE scheduler. + machdep.hyperthreading_allowed tunable is still available to ignore + hyperthreading CPUs at OS level. + Individual CPUs can be disabled using hint.lapic.X.disabled tunable, + where X is an APIC ID of a CPU. Be advised, though, that disabling + CPUs in non-uniform fashion will result in non-uniform topology and + may lead to sub-optimal system performance with SCHED_ULE, which is + a default scheduler. + 20110607: cpumask_t type is retired and cpuset_t is used in order to describe a mask of CPUs. Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed Jun 8 08:08:42 2011 (r222852) +++ head/sys/amd64/amd64/machdep.c Wed Jun 8 08:12:15 2011 (r222853) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include "opt_isa.h" #include "opt_kstack_pages.h" #include "opt_maxmem.h" +#include "opt_mp_watchdog.h" #include "opt_perfmon.h" #include "opt_sched.h" #include "opt_kdtrace.h" @@ -116,6 +117,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -734,9 +736,8 @@ cpu_idle(int busy) CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", busy, curcpu); -#ifdef SMP - if (mp_grab_cpu_hlt()) - return; +#ifdef MP_WATCHDOG + ap_watchdog(PCPU_GET(cpuid)); #endif /* If we are busy - try to use fast methods. */ if (busy) { Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Wed Jun 8 08:08:42 2011 (r222852) +++ head/sys/amd64/amd64/mp_machdep.c Wed Jun 8 08:12:15 2011 (r222853) @@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$"); #include "opt_cpu.h" #include "opt_kstack_pages.h" -#include "opt_mp_watchdog.h" #include "opt_sched.h" #include "opt_smp.h" @@ -64,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -160,11 +158,8 @@ static int start_all_aps(void); static int start_ap(int apic_id); static void release_aps(void *dummy); -static int hlt_logical_cpus; static u_int hyperthreading_cpus; /* logical cpus sharing L1 cache */ -static cpuset_t hyperthreading_cpus_mask; static int hyperthreading_allowed = 1; -static struct sysctl_ctx_list logical_cpu_clist; static u_int bootMP_size; static void @@ -748,11 +743,6 @@ init_secondary(void) if (cpu_logical > 1 && PCPU_GET(apic_id) % cpu_logical != 0) CPU_OR(&logical_cpus_mask, &tcpuset); - /* Determine if we are a hyperthread. */ - if (hyperthreading_cpus > 1 && - PCPU_GET(apic_id) % hyperthreading_cpus != 0) - CPU_OR(&hyperthreading_cpus_mask, &tcpuset); - /* Build our map of 'other' CPUs. */ tallcpus = all_cpus; CPU_NAND(&tallcpus, &tcpuset); @@ -843,7 +833,7 @@ assign_cpu_ids(void) if (hyperthreading_cpus > 1 && i % hyperthreading_cpus != 0) { cpu_info[i].cpu_hyperthread = 1; -#if defined(SCHED_ULE) + /* * Don't use HT CPU if it has been disabled by a * tunable. @@ -852,7 +842,6 @@ assign_cpu_ids(void) cpu_info[i].cpu_disabled = 1; continue; } -#endif } /* Don't use this CPU if it has been disabled by a tunable. */ @@ -862,6 +851,11 @@ assign_cpu_ids(void) } } + if (hyperthreading_allowed == 0 && hyperthreading_cpus > 1) { + hyperthreading_cpus = 0; + cpu_logical = 1; + } + /* * Assign CPU IDs to local APIC IDs and disable any CPUs * beyond MAXCPU. CPU 0 is always assigned to the BSP. @@ -1487,159 +1481,6 @@ release_aps(void *dummy __unused) } SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, release_aps, NULL); -static int -sysctl_hlt_cpus(SYSCTL_HANDLER_ARGS) -{ - cpuset_t mask; - int error; - - mask = hlt_cpus_mask; - error = sysctl_handle_opaque(oidp, &mask, sizeof(mask), req); - if (error || !req->newptr) - return (error); - - if (!CPU_EMPTY(&logical_cpus_mask) && - CPU_SUBSET(&mask, &logical_cpus_mask)) - hlt_logical_cpus = 1; - else - hlt_logical_cpus = 0; - - if (! hyperthreading_allowed) - CPU_OR(&mask, &hyperthreading_cpus_mask); - - if (CPU_SUBSET(&mask, &all_cpus)) - CPU_CLR(0, &mask); - hlt_cpus_mask = mask; - return (error); -} -SYSCTL_PROC(_machdep, OID_AUTO, hlt_cpus, - CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, sysctl_hlt_cpus, "S", - "Bitmap of CPUs to halt. 101 (binary) will halt CPUs 0 and 2."); - -static int -sysctl_hlt_logical_cpus(SYSCTL_HANDLER_ARGS) -{ - int disable, error; - - disable = hlt_logical_cpus; - error = sysctl_handle_int(oidp, &disable, 0, req); - if (error || !req->newptr) - return (error); - - if (disable) - CPU_OR(&hlt_cpus_mask, &logical_cpus_mask); - else - CPU_NAND(&hlt_cpus_mask, &logical_cpus_mask); - - if (! hyperthreading_allowed) - CPU_OR(&hlt_cpus_mask, &hyperthreading_cpus_mask); - - if (CPU_SUBSET(&hlt_cpus_mask, &all_cpus)) - CPU_CLR(0, &hlt_cpus_mask); - - hlt_logical_cpus = disable; - return (error); -} - -static int -sysctl_hyperthreading_allowed(SYSCTL_HANDLER_ARGS) -{ - int allowed, error; - - allowed = hyperthreading_allowed; - error = sysctl_handle_int(oidp, &allowed, 0, req); - if (error || !req->newptr) - return (error); - -#ifdef SCHED_ULE - /* - * SCHED_ULE doesn't allow enabling/disabling HT cores at - * run-time. - */ - if (allowed != hyperthreading_allowed) - return (ENOTSUP); - return (error); -#endif - - if (allowed) - CPU_NAND(&hlt_cpus_mask, &hyperthreading_cpus_mask); - else - CPU_OR(&hlt_cpus_mask, &hyperthreading_cpus_mask); - - if (!CPU_EMPTY(&logical_cpus_mask) && - CPU_SUBSET(&hlt_cpus_mask, &logical_cpus_mask)) - hlt_logical_cpus = 1; - else - hlt_logical_cpus = 0; - - if (CPU_SUBSET(&hlt_cpus_mask, &all_cpus)) - CPU_CLR(0, &hlt_cpus_mask); - - hyperthreading_allowed = allowed; - return (error); -} - -static void -cpu_hlt_setup(void *dummy __unused) -{ - - if (!CPU_EMPTY(&logical_cpus_mask)) { - TUNABLE_INT_FETCH("machdep.hlt_logical_cpus", - &hlt_logical_cpus); - sysctl_ctx_init(&logical_cpu_clist); - SYSCTL_ADD_PROC(&logical_cpu_clist, - SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO, - "hlt_logical_cpus", CTLTYPE_INT|CTLFLAG_RW, 0, 0, - sysctl_hlt_logical_cpus, "IU", ""); - SYSCTL_ADD_UINT(&logical_cpu_clist, - SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO, - "logical_cpus_mask", CTLTYPE_INT|CTLFLAG_RD, - &logical_cpus_mask, 0, ""); - - if (hlt_logical_cpus) - CPU_OR(&hlt_cpus_mask, &logical_cpus_mask); - - /* - * If necessary for security purposes, force - * hyperthreading off, regardless of the value - * of hlt_logical_cpus. - */ - if (!CPU_EMPTY(&hyperthreading_cpus_mask)) { - SYSCTL_ADD_PROC(&logical_cpu_clist, - SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO, - "hyperthreading_allowed", CTLTYPE_INT|CTLFLAG_RW, - 0, 0, sysctl_hyperthreading_allowed, "IU", ""); - if (! hyperthreading_allowed) - CPU_OR(&hlt_cpus_mask, - &hyperthreading_cpus_mask); - } - } -} -SYSINIT(cpu_hlt, SI_SUB_SMP, SI_ORDER_ANY, cpu_hlt_setup, NULL); - -int -mp_grab_cpu_hlt(void) -{ - cpuset_t mask; -#ifdef MP_WATCHDOG - u_int cpuid; -#endif - int retval; - - mask = PCPU_GET(cpumask); -#ifdef MP_WATCHDOG - cpuid = PCPU_GET(cpuid); - ap_watchdog(cpuid); -#endif - - retval = 0; - while (CPU_OVERLAP(&mask, &hlt_cpus_mask)) { - retval = 1; - __asm __volatile("sti; hlt" : : : "memory"); - } - return (retval); -} - #ifdef COUNT_IPIS /* * Setup interrupt counters for IPI handlers. Modified: head/sys/amd64/include/smp.h ============================================================================== --- head/sys/amd64/include/smp.h Wed Jun 8 08:08:42 2011 (r222852) +++ head/sys/amd64/include/smp.h Wed Jun 8 08:12:15 2011 (r222853) @@ -65,7 +65,6 @@ void ipi_cpu(int cpu, u_int ipi); int ipi_nmi_handler(void); void ipi_selected(cpuset_t cpus, u_int ipi); u_int mp_bootaddress(u_int); -int mp_grab_cpu_hlt(void); void smp_cache_flush(void); void smp_invlpg(vm_offset_t addr); void smp_masked_invlpg(cpuset_t mask, vm_offset_t addr); Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Wed Jun 8 08:08:42 2011 (r222852) +++ head/sys/i386/i386/machdep.c Wed Jun 8 08:12:15 2011 (r222853) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include "opt_isa.h" #include "opt_kstack_pages.h" #include "opt_maxmem.h" +#include "opt_mp_watchdog.h" #include "opt_npx.h" #include "opt_perfmon.h" #include "opt_xbox.h" @@ -118,6 +119,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1357,9 +1359,8 @@ cpu_idle(int busy) CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", busy, curcpu); -#if defined(SMP) && !defined(XEN) - if (mp_grab_cpu_hlt()) - return; +#if defined(MP_WATCHDOG) && !defined(XEN) + ap_watchdog(PCPU_GET(cpuid)); #endif #ifndef XEN /* If we are busy - try to use fast methods. */ Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Wed Jun 8 08:08:42 2011 (r222852) +++ head/sys/i386/i386/mp_machdep.c Wed Jun 8 08:12:15 2011 (r222853) @@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$"); #include "opt_apic.h" #include "opt_cpu.h" #include "opt_kstack_pages.h" -#include "opt_mp_watchdog.h" #include "opt_pmap.h" #include "opt_sched.h" #include "opt_smp.h" @@ -78,7 +77,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -209,11 +207,8 @@ static int start_all_aps(void); static int start_ap(int apic_id); static void release_aps(void *dummy); -static int hlt_logical_cpus; static u_int hyperthreading_cpus; /* logical cpus sharing L1 cache */ -static cpuset_t hyperthreading_cpus_mask; static int hyperthreading_allowed = 1; -static struct sysctl_ctx_list logical_cpu_clist; static void mem_range_AP_init(void) @@ -794,11 +789,6 @@ init_secondary(void) /* XXX Calculation depends on cpu_logical being a power of 2, e.g. 2 */ if (cpu_logical > 1 && PCPU_GET(apic_id) % cpu_logical != 0) CPU_OR(&logical_cpus_mask, &tcpuset); - - /* Determine if we are a hyperthread. */ - if (hyperthreading_cpus > 1 && - PCPU_GET(apic_id) % hyperthreading_cpus != 0) - CPU_OR(&hyperthreading_cpus_mask, &tcpuset); /* Build our map of 'other' CPUs. */ tallcpus = all_cpus; @@ -882,7 +872,7 @@ assign_cpu_ids(void) if (hyperthreading_cpus > 1 && i % hyperthreading_cpus != 0) { cpu_info[i].cpu_hyperthread = 1; -#if defined(SCHED_ULE) + /* * Don't use HT CPU if it has been disabled by a * tunable. @@ -891,7 +881,6 @@ assign_cpu_ids(void) cpu_info[i].cpu_disabled = 1; continue; } -#endif } /* Don't use this CPU if it has been disabled by a tunable. */ @@ -901,6 +890,11 @@ assign_cpu_ids(void) } } + if (hyperthreading_allowed == 0 && hyperthreading_cpus > 1) { + hyperthreading_cpus = 0; + cpu_logical = 1; + } + /* * Assign CPU IDs to local APIC IDs and disable any CPUs * beyond MAXCPU. CPU 0 is always assigned to the BSP. @@ -1550,159 +1544,6 @@ release_aps(void *dummy __unused) } SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, release_aps, NULL); -static int -sysctl_hlt_cpus(SYSCTL_HANDLER_ARGS) -{ - cpuset_t mask; - int error; - - mask = hlt_cpus_mask; - error = sysctl_handle_opaque(oidp, &mask, sizeof(mask), req); - if (error || !req->newptr) - return (error); - - if (!CPU_EMPTY(&logical_cpus_mask) && - CPU_SUBSET(&mask, &logical_cpus_mask)) - hlt_logical_cpus = 1; - else - hlt_logical_cpus = 0; - - if (! hyperthreading_allowed) - CPU_OR(&mask, &hyperthreading_cpus_mask); - - if (CPU_SUBSET(&mask, &all_cpus)) - CPU_CLR(0, &mask); - hlt_cpus_mask = mask; - return (error); -} -SYSCTL_PROC(_machdep, OID_AUTO, hlt_cpus, - CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, sysctl_hlt_cpus, "S", - "Bitmap of CPUs to halt. 101 (binary) will halt CPUs 0 and 2."); - -static int -sysctl_hlt_logical_cpus(SYSCTL_HANDLER_ARGS) -{ - int disable, error; - - disable = hlt_logical_cpus; - error = sysctl_handle_int(oidp, &disable, 0, req); - if (error || !req->newptr) - return (error); - - if (disable) - CPU_OR(&hlt_cpus_mask, &logical_cpus_mask); - else - CPU_NAND(&hlt_cpus_mask, &logical_cpus_mask); - - if (! hyperthreading_allowed) - CPU_OR(&hlt_cpus_mask, &hyperthreading_cpus_mask); - - if (CPU_SUBSET(&hlt_cpus_mask, &all_cpus)) - CPU_CLR(0, &hlt_cpus_mask); - - hlt_logical_cpus = disable; - return (error); -} - -static int -sysctl_hyperthreading_allowed(SYSCTL_HANDLER_ARGS) -{ - int allowed, error; - - allowed = hyperthreading_allowed; - error = sysctl_handle_int(oidp, &allowed, 0, req); - if (error || !req->newptr) - return (error); - -#ifdef SCHED_ULE - /* - * SCHED_ULE doesn't allow enabling/disabling HT cores at - * run-time. - */ - if (allowed != hyperthreading_allowed) - return (ENOTSUP); - return (error); -#endif - - if (allowed) - CPU_NAND(&hlt_cpus_mask, &hyperthreading_cpus_mask); - else - CPU_OR(&hlt_cpus_mask, &hyperthreading_cpus_mask); - - if (!CPU_EMPTY(&logical_cpus_mask) && - CPU_SUBSET(&hlt_cpus_mask, &logical_cpus_mask)) - hlt_logical_cpus = 1; - else - hlt_logical_cpus = 0; - - if (CPU_SUBSET(&hlt_cpus_mask, &all_cpus)) - CPU_CLR(0, &hlt_cpus_mask); - - hyperthreading_allowed = allowed; - return (error); -} - -static void -cpu_hlt_setup(void *dummy __unused) -{ - - if (!CPU_EMPTY(&logical_cpus_mask)) { - TUNABLE_INT_FETCH("machdep.hlt_logical_cpus", - &hlt_logical_cpus); - sysctl_ctx_init(&logical_cpu_clist); - SYSCTL_ADD_PROC(&logical_cpu_clist, - SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO, - "hlt_logical_cpus", CTLTYPE_INT|CTLFLAG_RW, 0, 0, - sysctl_hlt_logical_cpus, "IU", ""); - SYSCTL_ADD_UINT(&logical_cpu_clist, - SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO, - "logical_cpus_mask", CTLTYPE_INT|CTLFLAG_RD, - &logical_cpus_mask, 0, ""); - - if (hlt_logical_cpus) - CPU_OR(&hlt_cpus_mask, &logical_cpus_mask); - - /* - * If necessary for security purposes, force - * hyperthreading off, regardless of the value - * of hlt_logical_cpus. - */ - if (!CPU_EMPTY(&hyperthreading_cpus_mask)) { - SYSCTL_ADD_PROC(&logical_cpu_clist, - SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO, - "hyperthreading_allowed", CTLTYPE_INT|CTLFLAG_RW, - 0, 0, sysctl_hyperthreading_allowed, "IU", ""); - if (! hyperthreading_allowed) - CPU_OR(&hlt_cpus_mask, - &hyperthreading_cpus_mask); - } - } -} -SYSINIT(cpu_hlt, SI_SUB_SMP, SI_ORDER_ANY, cpu_hlt_setup, NULL); - -int -mp_grab_cpu_hlt(void) -{ - cpuset_t mask; -#ifdef MP_WATCHDOG - u_int cpuid; -#endif - int retval; - - mask = PCPU_GET(cpumask); -#ifdef MP_WATCHDOG - cpuid = PCPU_GET(cpuid); - ap_watchdog(cpuid); -#endif - - retval = 0; - while (CPU_OVERLAP(&mask, &hlt_cpus_mask)) { - retval = 1; - __asm __volatile("sti; hlt" : : : "memory"); - } - return (retval); -} - #ifdef COUNT_IPIS /* * Setup interrupt counters for IPI handlers. Modified: head/sys/i386/include/smp.h ============================================================================== --- head/sys/i386/include/smp.h Wed Jun 8 08:08:42 2011 (r222852) +++ head/sys/i386/include/smp.h Wed Jun 8 08:12:15 2011 (r222853) @@ -68,7 +68,6 @@ void ipi_cpu(int cpu, u_int ipi); int ipi_nmi_handler(void); void ipi_selected(cpuset_t cpus, u_int ipi); u_int mp_bootaddress(u_int); -int mp_grab_cpu_hlt(void); void smp_cache_flush(void); void smp_invlpg(vm_offset_t addr); void smp_masked_invlpg(cpuset_t mask, vm_offset_t addr); Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Wed Jun 8 08:08:42 2011 (r222852) +++ head/sys/pc98/pc98/machdep.c Wed Jun 8 08:12:15 2011 (r222853) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include "opt_isa.h" #include "opt_kstack_pages.h" #include "opt_maxmem.h" +#include "opt_mp_watchdog.h" #include "opt_npx.h" #include "opt_perfmon.h" @@ -115,6 +116,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1193,9 +1195,8 @@ cpu_idle(int busy) CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", busy, curcpu); -#ifdef SMP - if (mp_grab_cpu_hlt()) - return; +#ifdef MP_WATCHDOG + ap_watchdog(PCPU_GET(cpuid)); #endif /* If we are busy - try to use fast methods. */ if (busy) { From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 08:16: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 8D2CF106566B; Wed, 8 Jun 2011 08:16:32 +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 7D5778FC08; Wed, 8 Jun 2011 08:16: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 p588GWFk021512; Wed, 8 Jun 2011 08:16:32 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p588GWnI021510; Wed, 8 Jun 2011 08:16:32 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201106080816.p588GWnI021510@svn.freebsd.org> From: Ruslan Ermilov Date: Wed, 8 Jun 2011 08:16: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: r222854 - head/gnu/usr.bin/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: Wed, 08 Jun 2011 08:16:32 -0000 Author: ru Date: Wed Jun 8 08:16:32 2011 New Revision: 222854 URL: http://svn.freebsd.org/changeset/base/222854 Log: Added FreeBSD 8.3. Modified: head/gnu/usr.bin/groff/tmac/mdoc.local Modified: head/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- head/gnu/usr.bin/groff/tmac/mdoc.local Wed Jun 8 08:12:15 2011 (r222853) +++ head/gnu/usr.bin/groff/tmac/mdoc.local Wed Jun 8 08:16:32 2011 (r222854) @@ -74,6 +74,7 @@ . .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-7.4 7.4 +.ds doc-operating-system-FreeBSD-8.3 8.3 .ds doc-operating-system-FreeBSD-9.0 9.0 . .\" Definitions not (yet) in doc-syms From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 10:59: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 8A5FB106564A; Wed, 8 Jun 2011 10:59:36 +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 7A4A48FC08; Wed, 8 Jun 2011 10:59: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 p58Axa3k028055; Wed, 8 Jun 2011 10:59:36 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58Axa8D028053; Wed, 8 Jun 2011 10:59:36 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201106081059.p58Axa8D028053@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 8 Jun 2011 10:59: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: r222856 - head/sys/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: Wed, 08 Jun 2011 10:59:36 -0000 Author: bz Date: Wed Jun 8 10:59:36 2011 New Revision: 222856 URL: http://svn.freebsd.org/changeset/base/222856 Log: Add the missing call to ip6_ipsec_filtertunnel() to be able to control whether decapsulated IPsec packets will be passed to pfil again depending on the setting of the net.ip6.ipsec6.filtertunnel sysctl. PR: kern/157670 Submitted by: Manuel Kasper (mk neon1.net) MFC after: 2 weeks Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Wed Jun 8 08:22:54 2011 (r222855) +++ head/sys/netinet6/ip6_input.c Wed Jun 8 10:59:36 2011 (r222856) @@ -504,6 +504,13 @@ ip6_input(struct mbuf *m) goto bad; } #endif +#ifdef IPSEC + /* + * Bypass packet filtering for packets previously handled by IPsec. + */ + if (ip6_ipsec_filtertunnel(m)) + goto passin; +#endif /* IPSEC */ /* * Run through list of hooks for input packets. From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 13:23: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 05D60106564A; Wed, 8 Jun 2011 13: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 E9D728FC0C; Wed, 8 Jun 2011 13:23: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 p58DNZBp032523; Wed, 8 Jun 2011 13:23:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58DNZ3j032521; Wed, 8 Jun 2011 13:23:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106081323.p58DNZ3j032521@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 8 Jun 2011 13:23: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: r222859 - head/libexec/rtld-elf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 13:23:36 -0000 Author: nwhitehorn Date: Wed Jun 8 13:23:35 2011 New Revision: 222859 URL: http://svn.freebsd.org/changeset/base/222859 Log: Compile RTLD with global dot symbols on 64-bit PowerPC, as a crutch for GDB's ability to locate r_debug_state (which is actually the only function that need be compiled this way). Modified: head/libexec/rtld-elf/Makefile Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Wed Jun 8 12:03:34 2011 (r222858) +++ head/libexec/rtld-elf/Makefile Wed Jun 8 13:23:35 2011 (r222859) @@ -17,6 +17,7 @@ RTLD_ARCH= ${MACHINE_CPUARCH} .endif CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR} .if ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -mcall-aixdesc LDFLAGS+= -nostdlib -e _rtld_start .else LDFLAGS+= -nostdlib -e .rtld_start From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 16:00:31 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A920106564A; Wed, 8 Jun 2011 16:00:31 +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 4843A8FC1C; Wed, 8 Jun 2011 16:00:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p58G0Vt8037450; Wed, 8 Jun 2011 16:00:31 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58G0V6E037448; Wed, 8 Jun 2011 16:00:31 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201106081600.p58G0V6E037448@svn.freebsd.org> From: Andreas Tobler Date: Wed, 8 Jun 2011 16:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222860 - 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: Wed, 08 Jun 2011 16:00:31 -0000 Author: andreast Date: Wed Jun 8 16:00:30 2011 New Revision: 222860 URL: http://svn.freebsd.org/changeset/base/222860 Log: - Improve error handling. - Add retry loops in the i2c read/write functions. - Combied the ADC channel selection and readout of the value into one iicbus_transfer to avoid possible races. Reviewed by: nwhitehorn Modified: head/sys/dev/iicbus/ad7417.c Modified: head/sys/dev/iicbus/ad7417.c ============================================================================== --- head/sys/dev/iicbus/ad7417.c Wed Jun 8 13:23:35 2011 (r222859) +++ head/sys/dev/iicbus/ad7417.c Wed Jun 8 16:00:30 2011 (r222860) @@ -51,8 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define FCU_ZERO_C_TO_K 2732 - /* CPU A/B sensors, temp and adc: AD7417. */ #define AD7417_TEMP 0x00 @@ -73,6 +71,16 @@ struct ad7417_sensor { } type; }; +struct write_data { + uint8_t reg; + uint8_t val; +}; + +struct read_data { + uint8_t reg; + uint16_t val; +}; + /* Regular bus attachment functions */ static int ad7417_probe(device_t); static int ad7417_attach(device_t); @@ -85,6 +93,8 @@ 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_write_read(device_t dev, uint32_t addr, + struct write_data out, struct read_data *in); 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); @@ -118,6 +128,8 @@ static int ad7417_write(device_t dev, uint32_t addr, uint8_t reg, uint8_t *buff, int len) { unsigned char buf[4]; + int try = 0; + struct iic_msg msg[] = { { addr, IIC_M_WR, 0, buf } }; @@ -126,76 +138,134 @@ ad7417_write(device_t dev, uint32_t addr buf[0] = reg; memcpy(buf + 1, buff, len); - if (iicbus_transfer(dev, msg, 1) != 0) { - device_printf(dev, "iicbus write failed\n"); - return (EIO); + for (;;) + { + if (iicbus_transfer(dev, msg, 1) == 0) + return (0); + + if (++try > 5) { + device_printf(dev, "iicbus write failed\n"); + return (-1); + } + pause("ad7417_write", hz); } - - return (0); - } static int ad7417_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("ad7417_read_1", hz); } - - *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]; + 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("ad7417_read_2", hz); } +} - *data = *((uint16_t*)buf); +static int +ad7417_write_read(device_t dev, uint32_t addr, struct write_data out, + struct read_data *in) +{ + uint8_t buf[4]; + int err, try = 0; - return (0); + /* Do a combined write/read. */ + struct iic_msg msg[3] = { + { addr, IIC_M_WR, 2, buf }, + { addr, IIC_M_WR | IIC_M_NOSTOP, 1, &in->reg }, + { addr, IIC_M_RD, 2, buf }, + }; + + /* Prepare the write msg. */ + buf[0] = out.reg; + buf[1] = out.val & 0xff; + + for (;;) + { + err = iicbus_transfer(dev, msg, 3); + if (err != 0) + goto retry; + + in->val = *((uint16_t*)buf); + return (0); + retry: + if (++try > 5) { + device_printf(dev, "iicbus write/read failed\n"); + return (-1); + } + pause("ad7417_write_read", hz); + } } static int ad7417_init_adc(device_t dev, uint32_t addr) { uint8_t buf; + int err; adc741x_config = 0; /* Clear Config2 */ buf = 0; - ad7417_write(dev, addr, AD7417_CONFIG2, &buf, 1); + + err = 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); + err = ad7417_write(dev, addr, AD7417_CONFIG, &buf, 1); + err = 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); + err = ad7417_write(dev, addr, AD7417_CONFIG, &buf, 1); + if (err < 0) + return (-1); return (0); @@ -300,8 +370,8 @@ ad7417_fill_sensor_prop(device_t dev) continue; /* Make up some ranges */ - sc->sc_sensors[j].therm.target_temp = 500 + 2732; - sc->sc_sensors[j].therm.max_temp = 900 + 2732; + sc->sc_sensors[j].therm.target_temp = 500 + ZERO_C_TO_K; + sc->sc_sensors[j].therm.max_temp = 900 + ZERO_C_TO_K; pmac_thermal_sensor_register(&sc->sc_sensors[j].therm); } @@ -391,8 +461,13 @@ ad7417_get_temp(device_t dev, uint32_t a { uint16_t buf[2]; uint16_t read; + int err; + + err = ad7417_read_2(dev, addr, AD7417_TEMP, buf); + + if (err < 0) + return (-1); - ad7417_read_2(dev, addr, AD7417_TEMP, buf); read = *((int16_t*)buf); /* The ADC is 10 bit, the resolution is 0.25 C. @@ -406,22 +481,25 @@ 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); + uint8_t tmp; + int err; + struct write_data config; + struct read_data data; tmp = chan << 5; + config.reg = AD7417_CONFIG; + data.reg = AD7417_ADC; + data.val = 0; - cfg1 = (cfg1 & ~AD7417_CONFMASK) | (tmp & AD7417_CONFMASK); + err = ad7417_read_1(dev, addr, AD7417_CONFIG, &config.val); - ad7417_write(dev, addr, AD7417_CONFIG, &cfg1, 1); + config.val = (config.val & ~AD7417_CONFMASK) | (tmp & AD7417_CONFMASK); - ad7417_read_2(dev, addr, AD7417_ADC, buf); + err = ad7417_write_read(dev, addr, config, &data); + if (err < 0) + return (-1); - read = *((uint16_t*)buf); - - *value = ((uint32_t)read) >> 6; + *value = ((uint32_t)data.val) >> 6; return (0); } @@ -444,6 +522,9 @@ ad7417_diode_read(struct ad7417_sensor * } rawval = ad7417_adc_read(sens); + if (rawval < 0) + return (-1); + if (strstr(sens->therm.name, "CPU B") != NULL) { diode_slope = eeprom[1][0x11] >> 16; diode_offset = (int16_t)(eeprom[1][0x11] & 0xffff) << 12; @@ -455,7 +536,7 @@ ad7417_diode_read(struct ad7417_sensor * temp = (rawval*diode_slope + diode_offset) >> 2; temp = (10*(temp >> 16)) + ((10*(temp & 0xffff)) >> 16); - return (temp + FCU_ZERO_C_TO_K); + return (temp + ZERO_C_TO_K); } static int @@ -488,7 +569,8 @@ ad7417_adc_read(struct ad7417_sensor *se chan = 1; } - ad7417_get_adc(sc->sc_dev, sc->sc_addr, &temp, chan); + if (ad7417_get_adc(sc->sc_dev, sc->sc_addr, &temp, chan) < 0) + return (-1); return (temp); } @@ -503,11 +585,13 @@ ad7417_sensor_read(struct ad7417_sensor sc = device_get_softc(sens->dev); /* Init the ADC. */ - ad7417_init_adc(sc->sc_dev, sc->sc_addr); + if (ad7417_init_adc(sc->sc_dev, sc->sc_addr) < 0) + return (-1); if (sens->type == ADC7417_TEMP_SENSOR) { - ad7417_get_temp(sc->sc_dev, sc->sc_addr, &temp); - temp += FCU_ZERO_C_TO_K; + if (ad7417_get_temp(sc->sc_dev, sc->sc_addr, &temp) < 0) + return (-1); + temp += ZERO_C_TO_K; } else { temp = ad7417_adc_read(sens); } From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 16:03: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 B48F4106566B; Wed, 8 Jun 2011 16:03:29 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A38E78FC15; Wed, 8 Jun 2011 16:03: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 p58G3TfT037574; Wed, 8 Jun 2011 16:03:29 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58G3TL5037569; Wed, 8 Jun 2011 16:03:29 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106081603.p58G3TL5037569@svn.freebsd.org> From: Hiroki Sato Date: Wed, 8 Jun 2011 16:03: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: r222861 - head/usr.sbin/rtsold X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 16:03:29 -0000 Author: hrs Date: Wed Jun 8 16:03:29 2011 New Revision: 222861 URL: http://svn.freebsd.org/changeset/base/222861 Log: - Accumulate RA options instead of replacing old ones when a new RA arrived. RFC 4861 6.3.4 clearly defines handling multiple RAs in this way. - RDNSS/DNSSL options from multiple RAs on a single link will be gathered and sent to resolvconf(8). - Call "resolvconf -d" only after at least one RDNSS or DNSSL option is received and then all of them are expired. - The rtsold.dump output now supports displaying a list of the RA options. - Use more human-readable expression for logging values of struct timeval. Discussed with: ume Modified: head/usr.sbin/rtsold/dump.c head/usr.sbin/rtsold/rtsol.c head/usr.sbin/rtsold/rtsold.c head/usr.sbin/rtsold/rtsold.h Modified: head/usr.sbin/rtsold/dump.c ============================================================================== --- head/usr.sbin/rtsold/dump.c Wed Jun 8 16:00:30 2011 (r222860) +++ head/usr.sbin/rtsold/dump.c Wed Jun 8 16:03:29 2011 (r222861) @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -53,14 +54,16 @@ static FILE *fp; extern struct ifinfo *iflist; static void dump_interface_status(void); -static const char *sec2str(time_t); static const char * const ifstatstr[] = {"IDLE", "DELAY", "PROBE", "DOWN", "TENTATIVE"}; static void dump_interface_status(void) { struct ifinfo *ifi; + struct rainfo *rai; + struct ra_opt *rao; struct timeval now; + char ntopbuf[INET6_ADDRSTRLEN]; gettimeofday(&now, NULL); @@ -91,9 +94,33 @@ dump_interface_status(void) (int)ifi->timer.tv_sec, (int)ifi->timer.tv_usec, (ifi->expire.tv_sec < now.tv_sec) ? "expired" - : sec2str(ifi->expire.tv_sec - now.tv_sec)); + : sec2str(&ifi->expire)); } fprintf(fp, " number of valid RAs: %d\n", ifi->racnt); + + TAILQ_FOREACH(rai, &ifi->ifi_rainfo, rai_next) { + fprintf(fp, " RA from %s\n", + inet_ntop(AF_INET6, &rai->rai_saddr.sin6_addr, + ntopbuf, sizeof(ntopbuf))); + TAILQ_FOREACH(rao, &rai->rai_ra_opt, rao_next) { + fprintf(fp, " option: "); + switch (rao->rao_type) { + case ND_OPT_RDNSS: + fprintf(fp, "RDNSS: %s (expire: %s)\n", + (char *)rao->rao_msg, + sec2str(&rao->rao_expire)); + break; + case ND_OPT_DNSSL: + fprintf(fp, "DNSSL: %s (expire: %s)\n", + (char *)rao->rao_msg, + sec2str(&rao->rao_expire)); + break; + default: + break; + } + } + fprintf(fp, "\n"); + } } } @@ -109,8 +136,8 @@ rtsold_dump_file(const char *dumpfile) fclose(fp); } -static const char * -sec2str(time_t total) +const char * +sec2str(const struct timeval *total) { static char result[256]; int days, hours, mins, secs; @@ -118,11 +145,19 @@ sec2str(time_t total) char *p = result; char *ep = &result[sizeof(result)]; int n; + struct timeval now; + time_t tsec; - days = total / 3600 / 24; - hours = (total / 3600) % 24; - mins = (total / 60) % 60; - secs = total % 60; + gettimeofday(&now, NULL); + tsec = total->tv_sec; + tsec += total->tv_usec / 1000000; + tsec -= now.tv_sec; + tsec -= now.tv_usec / 1000000; + + days = tsec / 3600 / 24; + hours = (tsec / 3600) % 24; + mins = (tsec / 60) % 60; + secs = tsec % 60; if (days) { first = 0; Modified: head/usr.sbin/rtsold/rtsol.c ============================================================================== --- head/usr.sbin/rtsold/rtsol.c Wed Jun 8 16:00:30 2011 (r222860) +++ head/usr.sbin/rtsold/rtsol.c Wed Jun 8 16:03:29 2011 (r222861) @@ -85,6 +85,7 @@ static const struct sockaddr_in6 sin6_al static void call_script(const int, const char *const *, void *); static size_t dname_labeldec(char *, size_t, const char *); static int safefile(const char *); +static struct ra_opt *find_raopt(struct rainfo *, int, void *, size_t); #define _ARGS_OTHER otherconf_script, ifi->ifname #define _ARGS_RESADD resolvconf_script, "-a", ifi->ifname @@ -240,6 +241,7 @@ rtsol_input(int s) struct icmp6_hdr *icp; struct nd_router_advert *nd_ra; struct cmsghdr *cm; + struct rainfo *rai; char *raoptp; char *p; struct in6_addr *addr; @@ -251,6 +253,8 @@ rtsol_input(int s) char dname[NI_MAXHOST]; struct timeval now; struct timeval lifetime; + int newent_rai; + int newent_rao; /* get message. namelen and controllen must always be initialized. */ rcvmhdr.msg_namelen = sizeof(from); @@ -367,22 +371,20 @@ rtsol_input(int s) ifi->otherconfig = 1; CALL_SCRIPT(OTHER, NULL); } - - /* Initialize ra_opt per-interface structure. */ gettimeofday(&now, NULL); - if (!TAILQ_EMPTY(&ifi->ifi_ra_opt)) - while ((rao = TAILQ_FIRST(&ifi->ifi_ra_opt)) != NULL) { - if (rao->rao_msg != NULL) - free(rao->rao_msg); - TAILQ_REMOVE(&ifi->ifi_ra_opt, rao, rao_next); - free(rao); - } - else - TAILQ_INIT(&ifi->ifi_ra_opt); + newent_rai = 0; + rai = find_rainfo(ifi, &from); + if (rai == NULL) { + ELM_MALLOC(rai, exit(1)); + rai->rai_ifinfo = ifi; + TAILQ_INIT(&rai->rai_ra_opt); + memcpy(&rai->rai_saddr.sin6_addr, &from.sin6_addr, + sizeof(rai->rai_saddr.sin6_addr)); + newent_rai = 1; + } #define RA_OPT_NEXT_HDR(x) (struct nd_opt_hdr *)((char *)x + \ (((struct nd_opt_hdr *)x)->nd_opt_len * 8)) - /* Process RA options. */ warnmsg(LOG_DEBUG, __func__, "Processing RA"); raoptp = (char *)icp + sizeof(struct nd_router_advert); @@ -439,25 +441,35 @@ rtsol_input(int s) warnmsg(LOG_DEBUG, __func__, "nsbuf = %s", nsbuf); - ELM_MALLOC(rao, break); - rao->rao_type = ndo->nd_opt_type; - rao->rao_len = strlen(nsbuf); - rao->rao_msg = strdup(nsbuf); - if (rao->rao_msg == NULL) { - warnmsg(LOG_ERR, __func__, - "strdup failed: %s", - strerror(errno)); - free(rao); - addr++; - continue; + newent_rao = 0; + rao = find_raopt(rai, ndo->nd_opt_type, nsbuf, + strlen(nsbuf)); + if (rao == NULL) { + ELM_MALLOC(rao, break); + rao->rao_type = ndo->nd_opt_type; + rao->rao_len = strlen(nsbuf); + rao->rao_msg = strdup(nsbuf); + if (rao->rao_msg == NULL) { + warnmsg(LOG_ERR, __func__, + "strdup failed: %s", + strerror(errno)); + free(rao); + addr++; + continue; + } + newent_rao = 1; } /* Set expiration timer */ - memset(&rao->rao_expire, 0, sizeof(rao->rao_expire)); + memset(&rao->rao_expire, 0, + sizeof(rao->rao_expire)); memset(&lifetime, 0, sizeof(lifetime)); - lifetime.tv_sec = ntohl(rdnss->nd_opt_rdnss_lifetime); + lifetime.tv_sec = + ntohl(rdnss->nd_opt_rdnss_lifetime); timeradd(&now, &lifetime, &rao->rao_expire); - TAILQ_INSERT_TAIL(&ifi->ifi_ra_opt, rao, rao_next); + if (newent_rao) + TAILQ_INSERT_TAIL(&rai->rai_ra_opt, + rao, rao_next); addr++; } break; @@ -488,24 +500,35 @@ rtsol_input(int s) warnmsg(LOG_DEBUG, __func__, "dname = %s", dname); - ELM_MALLOC(rao, break); - rao->rao_type = ndo->nd_opt_type; - rao->rao_len = strlen(dname); - rao->rao_msg = strdup(dname); - if (rao->rao_msg == NULL) { - warnmsg(LOG_ERR, __func__, - "strdup failed: %s", - strerror(errno)); - free(rao); - break; + newent_rao = 0; + rao = find_raopt(rai, ndo->nd_opt_type, dname, + strlen(dname)); + if (rao == NULL) { + ELM_MALLOC(rao, break); + rao->rao_type = ndo->nd_opt_type; + rao->rao_len = strlen(dname); + rao->rao_msg = strdup(dname); + if (rao->rao_msg == NULL) { + warnmsg(LOG_ERR, __func__, + "strdup failed: %s", + strerror(errno)); + free(rao); + addr++; + continue; + } + newent_rao = 1; } /* Set expiration timer */ - memset(&rao->rao_expire, 0, sizeof(rao->rao_expire)); + memset(&rao->rao_expire, 0, + sizeof(rao->rao_expire)); memset(&lifetime, 0, sizeof(lifetime)); - lifetime.tv_sec = ntohl(dnssl->nd_opt_dnssl_lifetime); + lifetime.tv_sec = + ntohl(dnssl->nd_opt_dnssl_lifetime); timeradd(&now, &lifetime, &rao->rao_expire); - TAILQ_INSERT_TAIL(&ifi->ifi_ra_opt, rao, rao_next); + if (newent_rao) + TAILQ_INSERT_TAIL(&rai->rai_ra_opt, + rao, rao_next); p += len; } break; @@ -515,6 +538,9 @@ rtsol_input(int s) } raoptp = (char *)RA_OPT_NEXT_HDR(raoptp); } + if (newent_rai) + TAILQ_INSERT_TAIL(&ifi->ifi_rainfo, rai, rai_next); + ra_opt_handler(ifi); ifi->racnt++; @@ -539,6 +565,7 @@ int ra_opt_handler(struct ifinfo *ifi) { struct ra_opt *rao; + struct rainfo *rai; struct script_msg *smp1, *smp2, *smp3; struct timeval now; TAILQ_HEAD(, script_msg) sm_rdnss_head = @@ -550,70 +577,87 @@ ra_opt_handler(struct ifinfo *ifi) dcount = 0; dlen = strlen(resstr_sh_prefix) + strlen(resstr_nl); gettimeofday(&now, NULL); - TAILQ_FOREACH(rao, &ifi->ifi_ra_opt, rao_next) { - switch (rao->rao_type) { - case ND_OPT_RDNSS: - if (timercmp(&now, &rao->rao_expire, >)) { - warnmsg(LOG_INFO, __func__, - "expired rdnss entry: %s", - (char *)rao->rao_msg); - break; - } - ELM_MALLOC(smp1, continue); - ELM_MALLOC(smp2, goto free1); - ELM_MALLOC(smp3, goto free2); - smp1->sm_msg = resstr_ns_prefix; - TAILQ_INSERT_TAIL(&sm_rdnss_head, smp1, sm_next); - smp2->sm_msg = rao->rao_msg; - TAILQ_INSERT_TAIL(&sm_rdnss_head, smp2, sm_next); - smp3->sm_msg = resstr_nl; - TAILQ_INSERT_TAIL(&sm_rdnss_head, smp3, sm_next); - break; - case ND_OPT_DNSSL: - if (timercmp(&now, &rao->rao_expire, >)) { - warnmsg(LOG_INFO, __func__, - "expired dnssl entry: %s", - (char *)rao->rao_msg); + /* + * All options from multiple RAs with the same or different + * source addresses on a single interface will be gathered and + * handled, not overridden. [RFC 4861 6.3.4] + */ + TAILQ_FOREACH(rai, &ifi->ifi_rainfo, rai_next) { + TAILQ_FOREACH(rao, &rai->rai_ra_opt, rao_next) { + switch (rao->rao_type) { + case ND_OPT_RDNSS: + if (timercmp(&now, &rao->rao_expire, >)) { + warnmsg(LOG_INFO, __func__, + "expired rdnss entry: %s", + (char *)rao->rao_msg); + break; + } + ELM_MALLOC(smp1, continue); + ELM_MALLOC(smp2, goto free1); + ELM_MALLOC(smp3, goto free2); + smp1->sm_msg = resstr_ns_prefix; + TAILQ_INSERT_TAIL(&sm_rdnss_head, smp1, + sm_next); + smp2->sm_msg = rao->rao_msg; + TAILQ_INSERT_TAIL(&sm_rdnss_head, smp2, + sm_next); + smp3->sm_msg = resstr_nl; + TAILQ_INSERT_TAIL(&sm_rdnss_head, smp3, + sm_next); + ifi->ifi_rdnss = IFI_DNSOPT_STATE_RECEIVED; + break; - } - dcount++; - /* Check resolv.conf(5) restrictions. */ - if (dcount > 6) { - warnmsg(LOG_INFO, __func__, - "dnssl entry exceeding maximum count (%d>6)" - ": %s", dcount, (char *)rao->rao_msg); + case ND_OPT_DNSSL: + if (timercmp(&now, &rao->rao_expire, >)) { + warnmsg(LOG_INFO, __func__, + "expired dnssl entry: %s", + (char *)rao->rao_msg); + break; + } + dcount++; + /* Check resolv.conf(5) restrictions. */ + if (dcount > 6) { + warnmsg(LOG_INFO, __func__, + "dnssl entry exceeding maximum count (%d>6)" + ": %s", dcount, (char *)rao->rao_msg); + break; + } + if (256 < dlen + strlen(rao->rao_msg) + + strlen(resstr_sp)) { + warnmsg(LOG_INFO, __func__, + "dnssl entry exceeding maximum length " + "(>256): %s", (char *)rao->rao_msg); + break; + } + ELM_MALLOC(smp1, continue); + ELM_MALLOC(smp2, goto free1); + if (TAILQ_EMPTY(&sm_dnssl_head)) { + ELM_MALLOC(smp3, goto free2); + smp3->sm_msg = resstr_sh_prefix; + TAILQ_INSERT_TAIL(&sm_dnssl_head, smp3, + sm_next); + } + smp1->sm_msg = rao->rao_msg; + TAILQ_INSERT_TAIL(&sm_dnssl_head, smp1, + sm_next); + smp2->sm_msg = resstr_sp; + TAILQ_INSERT_TAIL(&sm_dnssl_head, smp2, + sm_next); + dlen += strlen(rao->rao_msg) + + strlen(resstr_sp); break; - } - if (256 < dlen + strlen(rao->rao_msg) + - strlen(resstr_sp)) { - warnmsg(LOG_INFO, __func__, - "dnssl entry exceeding maximum length " - "(>256): %s", (char *)rao->rao_msg); + + ifi->ifi_dnssl = IFI_DNSOPT_STATE_RECEIVED; + default: break; } - ELM_MALLOC(smp1, continue); - ELM_MALLOC(smp2, goto free1); - if (TAILQ_EMPTY(&sm_dnssl_head)) { - ELM_MALLOC(smp3, goto free2); - smp3->sm_msg = resstr_sh_prefix; - TAILQ_INSERT_TAIL(&sm_dnssl_head, smp3, - sm_next); - } - smp1->sm_msg = rao->rao_msg; - TAILQ_INSERT_TAIL(&sm_dnssl_head, smp1, sm_next); - smp2->sm_msg = resstr_sp; - TAILQ_INSERT_TAIL(&sm_dnssl_head, smp2, sm_next); - dlen += strlen(rao->rao_msg) + strlen(resstr_sp); - break; - default: - break; - } - continue; + continue; free2: - free(smp2); + free(smp2); free1: - free(smp1); + free(smp1); + } } /* Add \n for DNSSL list. */ if (!TAILQ_EMPTY(&sm_dnssl_head)) { @@ -625,10 +669,12 @@ free1: if (!TAILQ_EMPTY(&sm_rdnss_head)) CALL_SCRIPT(RESADD, &sm_rdnss_head); -#if 0 - else + else if (ifi->ifi_rdnss == IFI_DNSOPT_STATE_RECEIVED || + ifi->ifi_dnssl == IFI_DNSOPT_STATE_RECEIVED) { CALL_SCRIPT(RESDEL, NULL); -#endif + ifi->ifi_rdnss = IFI_DNSOPT_STATE_NOINFO; + ifi->ifi_dnssl = IFI_DNSOPT_STATE_NOINFO; + } ra_opt_handler_freeit: /* Clear script message queue. */ @@ -638,9 +684,30 @@ ra_opt_handler_freeit: free(smp1); } } + if (!TAILQ_EMPTY(&sm_dnssl_head)) { + while ((smp1 = TAILQ_FIRST(&sm_dnssl_head)) != NULL) { + TAILQ_REMOVE(&sm_dnssl_head, smp1, sm_next); + free(smp1); + } + } return (0); } +static struct ra_opt * +find_raopt(struct rainfo *rai, int type, void *msg, size_t len) +{ + struct ra_opt *rao; + + TAILQ_FOREACH(rao, &rai->rai_ra_opt, rao_next) { + if (rao->rao_type == type && + rao->rao_len == strlen(msg) && + memcmp(rao->rao_msg, msg, len) == 0) + break; + } + + return (rao); +} + static void call_script(const int argc, const char *const argv[], void *head) { Modified: head/usr.sbin/rtsold/rtsold.c ============================================================================== --- head/usr.sbin/rtsold/rtsold.c Wed Jun 8 16:00:30 2011 (r222860) +++ head/usr.sbin/rtsold/rtsold.c Wed Jun 8 16:03:29 2011 (r222861) @@ -44,6 +44,7 @@ #include #include #include +#include #include @@ -408,7 +409,9 @@ ifconfig(char *ifname) } memset(ifi, 0, sizeof(*ifi)); ifi->sdl = sdl; - + ifi->ifi_rdnss = IFI_DNSOPT_STATE_NOINFO; + ifi->ifi_dnssl = IFI_DNSOPT_STATE_NOINFO; + TAILQ_INIT(&ifi->ifi_rainfo); strlcpy(ifi->ifname, ifname, sizeof(ifi->ifname)); /* construct a router solicitation message */ @@ -500,6 +503,19 @@ ifreconfig(char *ifname) } #endif +struct rainfo * +find_rainfo(struct ifinfo *ifi, struct sockaddr_in6 *sin6) +{ + struct rainfo *rai; + + TAILQ_FOREACH(rai, &ifi->ifi_rainfo, rai_next) + if (memcmp(&rai->rai_saddr.sin6_addr, &sin6->sin6_addr, + sizeof(rai->rai_saddr.sin6_addr)) == 0) + return (rai); + + return (NULL); +} + struct ifinfo * find_ifinfo(int ifindex) { @@ -556,6 +572,7 @@ rtsol_check_timer(void) static struct timeval returnval; struct timeval now, rtsol_timer; struct ifinfo *ifi; + struct rainfo *rai; struct ra_opt *rao; int flags; @@ -565,18 +582,21 @@ rtsol_check_timer(void) TAILQ_FOREACH(ifi, &ifinfo_head, ifi_next) { if (timercmp(&ifi->expire, &now, <=)) { - if (dflag > 1) - warnmsg(LOG_DEBUG, __func__, - "timer expiration on %s, " - "state = %d", ifi->ifname, - ifi->state); - - /* Remove all RA options. */ - while ((rao = TAILQ_FIRST(&ifi->ifi_ra_opt)) != NULL) { - if (rao->rao_msg != NULL) - free(rao->rao_msg); - TAILQ_REMOVE(&ifi->ifi_ra_opt, rao, rao_next); - free(rao); + warnmsg(LOG_DEBUG, __func__, "timer expiration on %s, " + "state = %d", ifi->ifname, ifi->state); + + while((rai = TAILQ_FIRST(&ifi->ifi_rainfo)) != NULL) { + /* Remove all RA options. */ + TAILQ_REMOVE(&ifi->ifi_rainfo, rai, rai_next); + while ((rao = TAILQ_FIRST(&rai->rai_ra_opt)) != + NULL) { + TAILQ_REMOVE(&rai->rai_ra_opt, rao, + rao_next); + if (rao->rao_msg != NULL) + free(rao->rao_msg); + free(rao); + } + free(rai); } switch (ifi->state) { case IFS_DOWN: @@ -645,21 +665,27 @@ rtsol_check_timer(void) rtsol_timer_update(ifi); } else { /* Expiration check for RA options. */ - struct ra_opt *rao_tmp; int expire = 0; - TAILQ_FOREACH_SAFE(rao, &ifi->ifi_ra_opt, rao_next, rao_tmp) { - warnmsg(LOG_DEBUG, __func__, - "RA expiration timer: " - "type=%d, msg=%s, timer=%ld:%08ld", - rao->rao_type, (char *)rao->rao_msg, - (long)rao->rao_expire.tv_sec, - (long)rao->rao_expire.tv_usec); - if (timercmp(&now, &rao->rao_expire, >=)) { + TAILQ_FOREACH(rai, &ifi->ifi_rainfo, rai_next) { + TAILQ_FOREACH(rao, &rai->rai_ra_opt, rao_next) { warnmsg(LOG_DEBUG, __func__, - "RA expiration timer: expired."); - TAILQ_REMOVE(&ifi->ifi_ra_opt, rao, rao_next); - expire = 1; + "RA expiration timer: " + "type=%d, msg=%s, expire=%s", + rao->rao_type, (char *)rao->rao_msg, + sec2str(&rao->rao_expire)); + if (timercmp(&now, &rao->rao_expire, + >=)) { + warnmsg(LOG_DEBUG, __func__, + "RA expiration timer: " + "expired."); + TAILQ_REMOVE(&rai->rai_ra_opt, + rao, rao_next); + if (rao->rao_msg != NULL) + free(rao->rao_msg); + free(rao); + expire = 1; + } } } if (expire) @@ -678,9 +704,10 @@ rtsol_check_timer(void) else timersub(&rtsol_timer, &now, &returnval); - if (dflag > 1) - warnmsg(LOG_DEBUG, __func__, "New timer is %ld:%08ld", - (long)returnval.tv_sec, (long)returnval.tv_usec); + now.tv_sec += returnval.tv_sec; + now.tv_usec += returnval.tv_usec; + warnmsg(LOG_DEBUG, __func__, "New timer is %s", + sec2str(&now)); return (&returnval); } @@ -751,11 +778,10 @@ rtsol_timer_update(struct ifinfo *ifi) gettimeofday(&now, NULL); timeradd(&now, &ifi->timer, &ifi->expire); - if (dflag > 1) - warnmsg(LOG_DEBUG, __func__, - "set timer for %s to %d:%d", ifi->ifname, - (int)ifi->timer.tv_sec, - (int)ifi->timer.tv_usec); + now.tv_sec += ifi->timer.tv_sec; + now.tv_usec += ifi->timer.tv_usec; + warnmsg(LOG_DEBUG, __func__, "set timer for %s to %s", + ifi->ifname, sec2str(&now)); } #undef MILLION Modified: head/usr.sbin/rtsold/rtsold.h ============================================================================== --- head/usr.sbin/rtsold/rtsold.h Wed Jun 8 16:00:30 2011 (r222860) +++ head/usr.sbin/rtsold/rtsold.h Wed Jun 8 16:03:29 2011 (r222861) @@ -46,6 +46,16 @@ struct ra_opt { void *rao_msg; }; +TAILQ_HEAD(rainfo_head, ra_opt); + +struct rainfo { + TAILQ_ENTRY(rainfo) rai_next; + + struct ifinfo *rai_ifinfo; + struct sockaddr_in6 rai_saddr; + TAILQ_HEAD(, ra_opt) rai_ra_opt; +}; + struct ifinfo { TAILQ_ENTRY(ifinfo) ifi_next; /* pointer to the next interface */ @@ -64,13 +74,16 @@ struct ifinfo { struct timeval timer; struct timeval expire; int errors; /* # of errors we've got - detect wedge */ +#define IFI_DNSOPT_STATE_NOINFO 0 +#define IFI_DNSOPT_STATE_RECEIVED 1 + int ifi_rdnss; /* RDNSS option state */ + int ifi_dnssl; /* DNSSL option state */ int racnt; /* total # of valid RAs it have got */ + TAILQ_HEAD(, rainfo) ifi_rainfo; size_t rs_datalen; u_char *rs_data; - - TAILQ_HEAD(, ra_opt) ifi_ra_opt; }; /* per interface status */ @@ -118,6 +131,7 @@ extern const char *resolvconf_script; extern int ifconfig(char *); extern void iflist_init(void); struct ifinfo *find_ifinfo(int); +struct rainfo *find_rainfo(struct ifinfo *, struct sockaddr_in6 *); void rtsol_timer_update(struct ifinfo *); extern void warnmsg(int, const char *, const char *, ...) __attribute__((__format__(__printf__, 3, 4))); @@ -145,6 +159,7 @@ extern void defrouter_probe(struct ifinf /* dump.c */ extern void rtsold_dump_file(const char *); +extern const char *sec2str(const struct timeval *); /* rtsock.c */ extern int rtsock_open(void); From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 16:21: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 90B21106566C; Wed, 8 Jun 2011 16:21:20 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1296E8FC26; Wed, 8 Jun 2011 16:21:19 +0000 (UTC) Received: by yxd30 with SMTP id 30so418785yxd.13 for ; Wed, 08 Jun 2011 09:21: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=WmNDKxEMxbeo2jVutuGW2/P7xTXSQdTKKEapwNlZ1Kc=; b=NNNxrusOu7xCOzqCZ1vHd7Z9NZRapwHxKWc+LHK0J/gwGolllxmiX4Llt/nnAAi+Ha u/KYWtev0KbyEUeAgpMcSIRBlxQjCNduG9h2BH0/AWBUY8gfdlMIyH/8O6ZYc5fISRjc P5h14yCzb9KP9u3epXOAftGdb9FHNfOrkSTvg= 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=MUBJA2fz/JW595WeXvdfGrPqMpr66AtjFzus4J9POTgLyT1kFVhM2tgaiq47+cRUsE Z7zjgC1CCEnQmnlh/IfC9Qfw65lPA0uvm21oPhTfACuKc4PflIaowODuDa65arHQB9In NgziC+cmiacmAmAofEZ9L+24qQZcGTHH8lLKM= MIME-Version: 1.0 Received: by 10.236.26.103 with SMTP id b67mr1869620yha.331.1307549758333; Wed, 08 Jun 2011 09:15:58 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.105.147 with HTTP; Wed, 8 Jun 2011 09:15:58 -0700 (PDT) In-Reply-To: <201106080812.p588CFjb021267@svn.freebsd.org> References: <201106080812.p588CFjb021267@svn.freebsd.org> Date: Wed, 8 Jun 2011 12:15:58 -0400 X-Google-Sender-Auth: Q1Ss6sIaQ7F9P-HB3Ppk12PBlnk Message-ID: From: Attilio Rao To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222853 - in head: . sys/amd64/amd64 sys/amd64/include sys/i386/i386 sys/i386/include sys/pc98/pc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2011 16:21:20 -0000 2011/6/8 Andriy Gapon : > Author: avg > Date: Wed Jun =C2=A08 08:12:15 2011 > New Revision: 222853 > URL: http://svn.freebsd.org/changeset/base/222853 > > Log: > =C2=A0remove code for dynamic offlining/onlining of CPUs on x86 Thanks. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 18:52: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 9FA42106564A; Wed, 8 Jun 2011 18:52:42 +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 7675E8FC15; Wed, 8 Jun 2011 18:52: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 p58IqgtD042826; Wed, 8 Jun 2011 18:52:42 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58IqgvQ042824; Wed, 8 Jun 2011 18:52:42 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201106081852.p58IqgvQ042824@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 8 Jun 2011 18:52: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: r222864 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 18:52:42 -0000 Author: jkim Date: Wed Jun 8 18:52:42 2011 New Revision: 222864 URL: http://svn.freebsd.org/changeset/base/222864 Log: Remove a redundant assignment since r221703. Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Wed Jun 8 16:07:44 2011 (r222863) +++ head/sys/x86/x86/tsc.c Wed Jun 8 18:52:42 2011 (r222864) @@ -166,9 +166,6 @@ tsc_freq_vmware(void) tsc_freq = regs[0] | ((uint64_t)regs[1] << 32); } tsc_is_invariant = 1; -#ifdef SMP - smp_tsc = 1; /* XXX */ -#endif return (1); } From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 19:28: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 B79CA106564A; Wed, 8 Jun 2011 19:28:59 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7AB68FC17; Wed, 8 Jun 2011 19:28: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 p58JSxcM043928; Wed, 8 Jun 2011 19:28:59 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58JSxuB043926; Wed, 8 Jun 2011 19:28:59 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201106081928.p58JSxuB043926@svn.freebsd.org> From: Attilio Rao Date: Wed, 8 Jun 2011 19:28: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: r222865 - 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: Wed, 08 Jun 2011 19:28:59 -0000 Author: attilio Date: Wed Jun 8 19:28:59 2011 New Revision: 222865 URL: http://svn.freebsd.org/changeset/base/222865 Log: In the current code, a double panic condition may lead to dumps interleaving. Signal dumping to happen only for the first panic which should be the most important. Sponsored by: Sandvine Incorporated Submitted by: Nima Misaghian (nmisaghian AT sandvine DOT com) MFC after: 2 weeks Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Wed Jun 8 18:52:42 2011 (r222864) +++ head/sys/kern/kern_shutdown.c Wed Jun 8 19:28:59 2011 (r222865) @@ -555,11 +555,12 @@ panic(const char *fmt, ...) ; /* nothing */ #endif - bootopt = RB_AUTOBOOT | RB_DUMP; + bootopt = RB_AUTOBOOT; newpanic = 0; if (panicstr) bootopt |= RB_NOSYNC; else { + bootopt |= RB_DUMP; panicstr = fmt; newpanic = 1; } From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 19:38:32 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61B8E106566C; Wed, 8 Jun 2011 19:38:32 +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 47E6D8FC08; Wed, 8 Jun 2011 19:38:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p58JcWCE044254; Wed, 8 Jun 2011 19:38:32 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58JcWuB044252; Wed, 8 Jun 2011 19:38:32 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201106081938.p58JcWuB044252@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 8 Jun 2011 19:38: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: r222866 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 19:38:32 -0000 Author: jkim Date: Wed Jun 8 19:38:31 2011 New Revision: 222866 URL: http://svn.freebsd.org/changeset/base/222866 Log: Introduce low-resolution TSC timecounter "TSC-low". It replaces the normal TSC timecounter if TSC frequency is higher than ~4.29 MHz (or 2^32-1 Hz) or multiple CPUs are present. The "TSC-low" frequency is always lower than a preset maximum value and derived from TSC frequency (by being halved until it becomes lower than the maximum). Note the maximum value for SMP case is significantly lower than UP case because we want to reduce (rare but known) "temporal anomalies" caused by non-serialized RDTSC instruction. Normally, it is still higher than "ACPI-fast" timecounter frequency (which was default timecounter hardware for long time until r222222) to be useful. Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Wed Jun 8 19:28:59 2011 (r222865) +++ head/sys/x86/x86/tsc.c Wed Jun 8 19:38:31 2011 (r222866) @@ -79,7 +79,8 @@ static void tsc_freq_changed(void *arg, int status); static void tsc_freq_changing(void *arg, const struct cf_level *level, int *status); -static unsigned tsc_get_timecount(struct timecounter *tc); +static unsigned tsc_get_timecount(struct timecounter *tc); +static unsigned tsc_get_timecount_lowres(struct timecounter *tc); static void tsc_levels_changed(void *arg, int unit); static struct timecounter tsc_timecounter = { @@ -392,11 +393,19 @@ test_smp_tsc(void) static void init_TSC_tc(void) { + uint64_t max_freq; + int shift; if ((cpu_feature & CPUID_TSC) == 0 || tsc_disabled) return; /* + * Limit timecounter frequency to fit in an int and prevent it from + * overflowing too fast. + */ + max_freq = UINT_MAX; + + /* * We can not use the TSC if we support APM. Precise timekeeping * on an APM'ed machine is at best a fools pursuit, since * any and all of the time spent in various SMM code can't @@ -418,13 +427,27 @@ init_TSC_tc(void) * We can not use the TSC in SMP mode unless the TSCs on all CPUs are * synchronized. If the user is sure that the system has synchronized * TSCs, set kern.timecounter.smp_tsc tunable to a non-zero value. + * We also limit the frequency even lower to avoid "temporal anomalies" + * as much as possible. */ - if (smp_cpus > 1) + if (smp_cpus > 1) { tsc_timecounter.tc_quality = test_smp_tsc(); + max_freq >>= 8; + } #endif init: + for (shift = 0; shift < 32 && (tsc_freq >> shift) > max_freq; shift++) + ; + if (shift > 0) { + tsc_timecounter.tc_get_timecount = tsc_get_timecount_lowres; + tsc_timecounter.tc_name = "TSC-low"; + if (bootverbose) + printf("TSC timecounter discards lower %d bit(s).\n", + shift); + } if (tsc_freq != 0) { - tsc_timecounter.tc_frequency = tsc_freq; + tsc_timecounter.tc_frequency = tsc_freq >> shift; + tsc_timecounter.tc_priv = (void *)(intptr_t)shift; tc_init(&tsc_timecounter); } } @@ -496,7 +519,8 @@ tsc_freq_changed(void *arg, const struct /* Total setting for this level gives the new frequency in MHz. */ freq = (uint64_t)level->total_set.freq * 1000000; atomic_store_rel_64(&tsc_freq, freq); - atomic_store_rel_64(&tsc_timecounter.tc_frequency, freq); + tsc_timecounter.tc_frequency = + freq >> (int)(intptr_t)tsc_timecounter.tc_priv; } static int @@ -511,7 +535,8 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_A error = sysctl_handle_64(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) { atomic_store_rel_64(&tsc_freq, freq); - atomic_store_rel_64(&tsc_timecounter.tc_frequency, freq); + tsc_timecounter.tc_frequency = + freq >> (int)(intptr_t)tsc_timecounter.tc_priv; } return (error); } @@ -520,8 +545,15 @@ SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq 0, 0, sysctl_machdep_tsc_freq, "QU", "Time Stamp Counter frequency"); static u_int -tsc_get_timecount(struct timecounter *tc) +tsc_get_timecount(struct timecounter *tc __unused) { return (rdtsc32()); } + +static u_int +tsc_get_timecount_lowres(struct timecounter *tc) +{ + + return (rdtsc() >> (int)(intptr_t)tc->tc_priv); +} From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 20: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 907D0106566B; Wed, 8 Jun 2011 20:08:06 +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 807978FC0A; Wed, 8 Jun 2011 20:08: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 p58K86Ku045313; Wed, 8 Jun 2011 20:08:06 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58K860F045311; Wed, 8 Jun 2011 20:08:06 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201106082008.p58K860F045311@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 8 Jun 2011 20:08: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: r222869 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 20:08:06 -0000 Author: jkim Date: Wed Jun 8 20:08:06 2011 New Revision: 222869 URL: http://svn.freebsd.org/changeset/base/222869 Log: Increase quality of TSC (or TSC-low) timecounter to 1000 if it is P-state invariant. For SMP case (TSC-low), it also has to pass SMP synchronization test and the CPU vendor/model has to be white-listed explicitly. Currently, all Intel CPUs and single-socket AMD Family 15h processors are listed here. Discussed with: hackers Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Wed Jun 8 19:58:20 2011 (r222868) +++ head/sys/x86/x86/tsc.c Wed Jun 8 20:08:06 2011 (r222869) @@ -383,7 +383,29 @@ test_smp_tsc(void) if (bootverbose) printf("SMP: %sed TSC synchronization test\n", smp_tsc ? "pass" : "fail"); - return (smp_tsc ? 800 : -100); + if (smp_tsc && tsc_is_invariant) { + switch (cpu_vendor_id) { + case CPU_VENDOR_AMD: + /* + * Starting with Family 15h processors, TSC clock + * source is in the north bridge. Check whether + * we have a single-socket/multi-core platform. + * XXX Need more work for complex cases. + */ + if (CPUID_TO_FAMILY(cpu_id) < 0x15 || + (amd_feature2 & AMDID2_CMP) == 0 || + smp_cpus > (cpu_procinfo2 & AMDID_CMP_CORES) + 1) + break; + return (1000); + case CPU_VENDOR_INTEL: + /* + * XXX Assume Intel platforms have synchronized TSCs. + */ + return (1000); + } + return (800); + } + return (-100); } #undef N @@ -433,8 +455,11 @@ init_TSC_tc(void) if (smp_cpus > 1) { tsc_timecounter.tc_quality = test_smp_tsc(); max_freq >>= 8; - } + } else #endif + if (tsc_is_invariant) + tsc_timecounter.tc_quality = 1000; + init: for (shift = 0; shift < 32 && (tsc_freq >> shift) > max_freq; shift++) ; From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 20:46: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 DE71F106566B; Wed, 8 Jun 2011 20:46:16 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 617158FC15; Wed, 8 Jun 2011 20:46:14 +0000 (UTC) Received: by fxm11 with SMTP id 11so873533fxm.13 for ; Wed, 08 Jun 2011 13:46:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:references:x-comment-to :sender:date:in-reply-to:message-id:user-agent:mime-version :content-type; bh=+W/waNc4e5ZigtzzTGqy2XjcSZCtdCWDP+iqhfvZvhI=; b=alANlN9ZdAHpInRtb7LMksIeHAON9CFFnV7eYYoxDbwHqMdi5TKO8CUIcywuY+UNq9 a/gZX1x1ybEH9Un/DVYUGP6CUx5bqVxAuz6JsAg7UO5XJe3NAFvHM9jN+Qqteu77t4nt VFTMekOio8gBn6p6CfBCFDliWTp4B9cygx1rg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; b=NZw4U4eXuehtCAMzhrRPMIcgINW70C372WKNUvHoe7DZlMhe2hWtjD/SxJX8DhOY0P 9Q5UAdr2lHEJ1CZp53xjVUzDHgJY9VByoVrbjoiRyrfG0qGgQX00ngmM3Pvg5U2rKhn9 Jc4+Umwiozhj1qBQTRLGUka8zeFMUCazckcZA= Received: by 10.223.102.131 with SMTP id g3mr714430fao.68.1307565974111; Wed, 08 Jun 2011 13:46:14 -0700 (PDT) Received: from localhost ([95.69.172.154]) by mx.google.com with ESMTPS id g7sm377752fac.15.2011.06.08.13.46.08 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Jun 2011 13:46:09 -0700 (PDT) From: Mikolaj Golub To: John Baldwin References: <201105022105.p42L5q3j054498@svn.freebsd.org> <4DCE93BF.7000803@FreeBSD.org> <86boz5fby1.fsf@kopusha.home.net> <201106030944.36200.jhb@freebsd.org> X-Comment-To: John Baldwin Sender: Mikolaj Golub Date: Wed, 08 Jun 2011 23:46:06 +0300 In-Reply-To: <201106030944.36200.jhb@freebsd.org> (John Baldwin's message of "Fri, 3 Jun 2011 09:44:36 -0400") Message-ID: <86tyc0xd9t.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Mike Silbersack , src-committers@freebsd.org, svn-src-all@freebsd.org, Bjoern Zeeb , svn-src-head@freebsd.org, 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: Wed, 08 Jun 2011 20:46:17 -0000 On Fri, 3 Jun 2011 09:44:36 -0400 John Baldwin wrote: JB> Please try this change. What is happening is that you have a remaining JB> window that is smaller than the window scale. You are receiving zero JB> window updates that are received ok (becuase the socket buffer isn't JB> completely empty), and that advance rcv_nxt. However, tcp_output() is JB> not advancing rcv_adv because 'recwin' is calculated as zero. My JB> invariants had assumed that the ACK that gets forced out for a reply JB> to a zero window probe would move rcv_adv, but that isn't happening. JB> This patch will allow rcv_adv to advance when a zero window probe is JB> ACK'd. I'm not sure if this is the best way to fix this, but I think JB> it will fix it: JB> Index: tcp_output.c JB> =================================================================== JB> --- tcp_output.c (revision 222565) JB> +++ tcp_output.c (working copy) JB> @@ -1331,7 +1331,7 @@ out: JB> * then remember the size of the advertised window. JB> * Any pending ACK has now been sent. JB> */ JB> - if (recwin > 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv)) JB> + if (recwin >= 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv)) JB> tp->rcv_adv = tp->rcv_nxt + recwin; JB> tp->last_ack_sent = tp->rcv_nxt; JB> tp->t_flags &= ~(TF_ACKNOW | TF_DELACK); Sorry for the delay -- I was offline :-). Thanks, with the patch I can't reproduce the issue. I am going to run additional tests in the coming days and will inform you if I find something suspicious. -- Mikolaj Golub From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 20:55: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 B57A1106564A; Wed, 8 Jun 2011 20:55:37 +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 3D0E78FC08; Wed, 8 Jun 2011 20:55:36 +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 p58KtX1w023649 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Jun 2011 06:55:35 +1000 Date: Thu, 9 Jun 2011 06:55:33 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jung-uk Kim In-Reply-To: <201106081938.p58JcWuB044252@svn.freebsd.org> Message-ID: <20110609055112.P2870@besplex.bde.org> References: <201106081938.p58JcWuB044252@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r222866 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 20:55:37 -0000 On Wed, 8 Jun 2011, Jung-uk Kim wrote: > Log: > Introduce low-resolution TSC timecounter "TSC-low". It replaces the normal > TSC timecounter if TSC frequency is higher than ~4.29 MHz (or 2^32-1 Hz) or Off by a factor of 1024. > multiple CPUs are present. The "TSC-low" frequency is always lower than a > preset maximum value and derived from TSC frequency (by being halved until > it becomes lower than the maximum). Note the maximum value for SMP case is > significantly lower than UP case because we want to reduce (rare but known) > "temporal anomalies" caused by non-serialized RDTSC instruction. Normally, > it is still higher than "ACPI-fast" timecounter frequency (which was default > timecounter hardware for long time until r222222) to be useful. It should be a separate timecounter so that the user can choose it independently, at least in the SMP case where it is very low (at most ~4.29 GHz >> 8 ~= 17 MHz). > Modified: > head/sys/x86/x86/tsc.c > > Modified: head/sys/x86/x86/tsc.c > ============================================================================== > --- head/sys/x86/x86/tsc.c Wed Jun 8 19:28:59 2011 (r222865) > +++ head/sys/x86/x86/tsc.c Wed Jun 8 19:38:31 2011 (r222866) > @@ -79,7 +79,8 @@ static void tsc_freq_changed(void *arg, > int status); > static void tsc_freq_changing(void *arg, const struct cf_level *level, > int *status); > -static unsigned tsc_get_timecount(struct timecounter *tc); > +static unsigned tsc_get_timecount(struct timecounter *tc); > +static unsigned tsc_get_timecount_lowres(struct timecounter *tc); Should be spelled low or lowres throughout. > static void tsc_levels_changed(void *arg, int unit); > > static struct timecounter tsc_timecounter = { > @@ -392,11 +393,19 @@ test_smp_tsc(void) > static void > init_TSC_tc(void) This seems to only be called once at boot time. So the lowness may be much lower than necessary if the levels are reduced significantly later. > { > + uint64_t max_freq; > + int shift; > > if ((cpu_feature & CPUID_TSC) == 0 || tsc_disabled) > return; > > /* > + * Limit timecounter frequency to fit in an int and prevent it from > + * overflowing too fast. > + */ > + max_freq = UINT_MAX; > + > + /* > * We can not use the TSC if we support APM. Precise timekeeping > * on an APM'ed machine is at best a fools pursuit, since > * any and all of the time spent in various SMM code can't > @@ -418,13 +427,27 @@ init_TSC_tc(void) > * We can not use the TSC in SMP mode unless the TSCs on all CPUs are > * synchronized. If the user is sure that the system has synchronized > * TSCs, set kern.timecounter.smp_tsc tunable to a non-zero value. > + * We also limit the frequency even lower to avoid "temporal anomalies" > + * as much as possible. > */ > - if (smp_cpus > 1) > + if (smp_cpus > 1) { > tsc_timecounter.tc_quality = test_smp_tsc(); > + max_freq >>= 8; > + } This gives especially low lowness if the levels are reduced significantly. Maybe as low as 100 MHz >> 8 = ~390 KHz = lower than an i8254. OTOH, maybe the temporal anomalies scale with the TSC frequency, so you need to right shift by a few irrespective of the TSC frequency. A shift count of 8 seems too much, but if the initial TSC frequency is already < 2**32 shifted by 8, then the final shift is 0. > #endif > init: > + for (shift = 0; shift < 32 && (tsc_freq >> shift) > max_freq; shift++) > + ; > + if (shift > 0) { > + tsc_timecounter.tc_get_timecount = tsc_get_timecount_lowres; > + tsc_timecounter.tc_name = "TSC-low"; > + if (bootverbose) > + printf("TSC timecounter discards lower %d bit(s).\n", > + shift); Error messages are not terminated by a "." in KNF. > + } > if (tsc_freq != 0) { > - tsc_timecounter.tc_frequency = tsc_freq; > + tsc_timecounter.tc_frequency = tsc_freq >> shift; > + tsc_timecounter.tc_priv = (void *)(intptr_t)shift; > tc_init(&tsc_timecounter); > } > } > @@ -496,7 +519,8 @@ tsc_freq_changed(void *arg, const struct > /* Total setting for this level gives the new frequency in MHz. */ > freq = (uint64_t)level->total_set.freq * 1000000; > atomic_store_rel_64(&tsc_freq, freq); I thought you would scale the low-level tsc_freq too, but this is not so easy (the shift would have to be put in rdtsc()). > - atomic_store_rel_64(&tsc_timecounter.tc_frequency, freq); > + tsc_timecounter.tc_frequency = > + freq >> (int)(intptr_t)tsc_timecounter.tc_priv; Perhaps the levels can also be increased significantly later. Then the timecounter frequency may exceed 4.29 GHz despite its scaling. > } > > static int > @@ -511,7 +535,8 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_A > error = sysctl_handle_64(oidp, &freq, 0, req); > if (error == 0 && req->newptr != NULL) { > atomic_store_rel_64(&tsc_freq, freq); > - atomic_store_rel_64(&tsc_timecounter.tc_frequency, freq); > + tsc_timecounter.tc_frequency = > + freq >> (int)(intptr_t)tsc_timecounter.tc_priv; Root can easily increase this frequency from below 4.29 GHz (with no scaling) to above (still with no scaling). And this change might even be correct if it is from 4.29 GHz - epsilon to 4.29 GHz plus epsilon. Micro-adjustments that cross the 4.29 GHz threshold are precisely the ones that need the atomic op. > } > return (error); > } > @@ -520,8 +545,15 @@ SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq > 0, 0, sysctl_machdep_tsc_freq, "QU", "Time Stamp Counter frequency"); > > static u_int > -tsc_get_timecount(struct timecounter *tc) > +tsc_get_timecount(struct timecounter *tc __unused) > { > > return (rdtsc32()); > } > + > +static u_int > +tsc_get_timecount_lowres(struct timecounter *tc) > +{ > + > + return (rdtsc() >> (int)(intptr_t)tc->tc_priv); This forces a slow 64-bit shift (shrdl; shrl) in all cases. rdtsc32() with a scaled tc_counter_mask should work OK (essentially the same as the non-low timecounter except for reduced accuracy; the only loss is an decrease in the time until counter overflow to the same as for the non-low timecounter). > +} > Blindly changing the scale factor on every change to tsc_freq would give some nice races, but ones that are essentially the same as for changing the timecounter hardware. This gives me an idea for another implementation: have an array of TSC timecounters with 1 element for each small shift count, and switch using the timecounter hardware switch code, and let the user select the element. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 21:18: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 18CC01065670; Wed, 8 Jun 2011 21:18:15 +0000 (UTC) (envelope-from davidch@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 077BA8FC19; Wed, 8 Jun 2011 21:18: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 p58LIFup047768; Wed, 8 Jun 2011 21:18:15 GMT (envelope-from davidch@svn.freebsd.org) Received: (from davidch@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58LIE8h047762; Wed, 8 Jun 2011 21:18:14 GMT (envelope-from davidch@svn.freebsd.org) Message-Id: <201106082118.p58LIE8h047762@svn.freebsd.org> From: David Christensen Date: Wed, 8 Jun 2011 21:18: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: r222875 - head/sys/dev/bxe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 21:18:15 -0000 Author: davidch Date: Wed Jun 8 21:18:14 2011 New Revision: 222875 URL: http://svn.freebsd.org/changeset/base/222875 Log: - Major reorganization of mbuf handling throughout the driver to increase robustness (no more calls to panic(9)) and simplify code. - Allocate RX/TX data structures as a single buffer rather than an array of 4KB pages to simplify code. - Fixed LRO (aka TPA) code. Removed kernel module parameter and support enabling disabling LRO through ifconfig(8) command line. LRO is still disabled by default but should be enabled for best performance on an endpoint device. - Fixed statistcs code and removed kernel module parameter (stats should just work). - Added many software counters to help identify the cause of some performance issues. - Streamlined adapter internal init/stop code paths. - Fiddled with debug code (adding some here, removing some there). - Continued style(9) adjustments. Modified: head/sys/dev/bxe/bxe_debug.h head/sys/dev/bxe/bxe_link.c head/sys/dev/bxe/if_bxe.c head/sys/dev/bxe/if_bxe.h Modified: head/sys/dev/bxe/bxe_debug.h ============================================================================== --- head/sys/dev/bxe/bxe_debug.h Wed Jun 8 21:14:04 2011 (r222874) +++ head/sys/dev/bxe/bxe_debug.h Wed Jun 8 21:18:14 2011 (r222875) @@ -41,21 +41,22 @@ extern uint32_t bxe_debug; * Debugging macros and definitions. */ -#define BXE_CP_LOAD 0x00000001 -#define BXE_CP_SEND 0x00000002 -#define BXE_CP_RECV 0x00000004 -#define BXE_CP_INTR 0x00000008 -#define BXE_CP_UNLOAD 0x00000010 -#define BXE_CP_RESET 0x00000020 -#define BXE_CP_IOCTL 0x00000040 -#define BXE_CP_STATS 0x00000080 -#define BXE_CP_MISC 0x00000100 -#define BXE_CP_PHY 0x00000200 -#define BXE_CP_RAMROD 0x00000400 -#define BXE_CP_NVRAM 0x00000800 -#define BXE_CP_REGS 0x00001000 -#define BXE_CP_ALL 0x00FFFFFF -#define BXE_CP_MASK 0x00FFFFFF +#define BXE_CP_LOAD 0x00000001 +#define BXE_CP_SEND 0x00000002 +#define BXE_CP_RECV 0x00000004 +#define BXE_CP_INTR 0x00000008 +#define BXE_CP_UNLOAD 0x00000010 +#define BXE_CP_RESET 0x00000020 +#define BXE_CP_IOCTL 0x00000040 +#define BXE_CP_STATS 0x00000080 +#define BXE_CP_MISC 0x00000100 +#define BXE_CP_PHY 0x00000200 +#define BXE_CP_RAMROD 0x00000400 +#define BXE_CP_NVRAM 0x00000800 +#define BXE_CP_REGS 0x00001000 +#define BXE_CP_TPA 0x00002000 +#define BXE_CP_ALL 0x00FFFFFF +#define BXE_CP_MASK 0x00FFFFFF #define BXE_LEVEL_FATAL 0x00000000 #define BXE_LEVEL_WARN 0x01000000 @@ -144,12 +145,18 @@ extern uint32_t bxe_debug; #define BXE_EXTREME_REGS (BXE_CP_REGS | BXE_LEVEL_EXTREME) #define BXE_INSANE_REGS (BXE_CP_REGS | BXE_LEVEL_INSANE) -#define BXE_FATAL (BXE_CP_ALL | BXE_LEVEL_FATAL) -#define BXE_WARN (BXE_CP_ALL | BXE_LEVEL_WARN) -#define BXE_INFO (BXE_CP_ALL | BXE_LEVEL_INFO) -#define BXE_VERBOSE (BXE_CP_ALL | BXE_LEVEL_VERBOSE) -#define BXE_EXTREME (BXE_CP_ALL | BXE_LEVEL_EXTREME) -#define BXE_INSANE (BXE_CP_ALL | BXE_LEVEL_INSANE) +#define BXE_WARN_TPA (BXE_CP_TPA | BXE_LEVEL_WARN) +#define BXE_INFO_TPA (BXE_CP_TPA | BXE_LEVEL_INFO) +#define BXE_VERBOSE_TPA (BXE_CP_TPA | BXE_LEVEL_VERBOSE) +#define BXE_EXTREME_TPA (BXE_CP_TPA | BXE_LEVEL_EXTREME) +#define BXE_INSANE_TPA (BXE_CP_TPA | BXE_LEVEL_INSANE) + +#define BXE_FATAL (BXE_CP_ALL | BXE_LEVEL_FATAL) +#define BXE_WARN (BXE_CP_ALL | BXE_LEVEL_WARN) +#define BXE_INFO (BXE_CP_ALL | BXE_LEVEL_INFO) +#define BXE_VERBOSE (BXE_CP_ALL | BXE_LEVEL_VERBOSE) +#define BXE_EXTREME (BXE_CP_ALL | BXE_LEVEL_EXTREME) +#define BXE_INSANE (BXE_CP_ALL | BXE_LEVEL_INSANE) #define BXE_CODE_PATH(cp) ((cp & BXE_CP_MASK) & bxe_debug) #define BXE_MSG_LEVEL(lv) ((lv & BXE_LEVEL_MASK) <= (bxe_debug & BXE_LEVEL_MASK)) Modified: head/sys/dev/bxe/bxe_link.c ============================================================================== --- head/sys/dev/bxe/bxe_link.c Wed Jun 8 21:14:04 2011 (r222874) +++ head/sys/dev/bxe/bxe_link.c Wed Jun 8 21:18:14 2011 (r222875) @@ -1168,15 +1168,17 @@ bxe_set_parallel_detection(struct link_p control2 |= MDIO_SERDES_DIGITAL_A_1000X_CONTROL2_PRL_DT_EN; else control2 &= ~MDIO_SERDES_DIGITAL_A_1000X_CONTROL2_PRL_DT_EN; - DBPRINT(sc, 1, "params->speed_cap_mask = 0x%x, control2 = 0x%x\n", - params->speed_cap_mask, control2); + + DBPRINT(sc, BXE_VERBOSE_PHY, "%s(): params->speed_cap_mask = 0x%x, " + "control2 = 0x%x\n", __FUNCTION__, params->speed_cap_mask, control2); + CL45_WR_OVER_CL22(sc, params->port, params->phy_addr, MDIO_REG_BANK_SERDES_DIGITAL, MDIO_SERDES_DIGITAL_A_1000X_CONTROL2, control2); if ((phy_flags & PHY_XGXS_FLAG) && (params->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) { - DBPRINT(sc, BXE_INFO, "XGXS\n"); + DBPRINT(sc, BXE_VERBOSE_PHY, "%s(): XGXS\n", __FUNCTION__); CL45_WR_OVER_CL22(sc, params->port, params->phy_addr, MDIO_REG_BANK_10G_PARALLEL_DETECT, @@ -1688,7 +1690,9 @@ bxe_flow_ctrl_resolve(struct link_params } bxe_pause_resolve(vars, pause_result); } - DBPRINT(sc, BXE_INFO, "flow_ctrl 0x%x\n", vars->flow_ctrl); + + DBPRINT(sc, BXE_VERBOSE_PHY, "%s(): flow_ctrl 0x%x\n", + __FUNCTION__, vars->flow_ctrl); } static void @@ -1698,13 +1702,16 @@ bxe_check_fallback_to_cl37(struct link_p uint16_t rx_status, ustat_val, cl37_fsm_recieved; sc = params->sc; - DBPRINT(sc, BXE_INFO, "bxe_check_fallback_to_cl37\n"); + + DBPRINT(sc, BXE_VERBOSE_PHY, "%s(): IEEE 802.3 Clause 37 Fallback\n", + __FUNCTION__); + CL45_RD_OVER_CL22(sc, params->port, params->phy_addr, MDIO_REG_BANK_RX0, MDIO_RX0_RX_STATUS, &rx_status); if ((rx_status & MDIO_RX0_RX_STATUS_SIGDET) != (MDIO_RX0_RX_STATUS_SIGDET)) { DBPRINT(sc, BXE_VERBOSE_PHY, - "Signal is not detected. Restoring CL73." + "No signal detected. Restoring CL73." "rx_status(0x80b0) = 0x%x\n", rx_status); CL45_WR_OVER_CL22(sc, params->port, params->phy_addr, MDIO_REG_BANK_CL73_IEEEB0, MDIO_CL73_IEEEB0_CL73_AN_CONTROL, @@ -1738,7 +1745,9 @@ bxe_check_fallback_to_cl37(struct link_p CL45_WR_OVER_CL22(sc, params->port, params->phy_addr, MDIO_REG_BANK_CL73_IEEEB0, MDIO_CL73_IEEEB0_CL73_AN_CONTROL, 0); bxe_restart_autoneg(params, 0); - DBPRINT(sc, BXE_INFO, "Disabling CL73, and restarting CL37 autoneg\n"); + + DBPRINT(sc, BXE_INFO, "%s(): Disabling CL73 and restarting CL37 " + "autoneg\n", __FUNCTION__); } static void @@ -3391,7 +3400,8 @@ bxe_init_internal_phy(struct link_params ((XGXS_EXT_PHY_TYPE(params->ext_phy_config) == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) && params->loopback_mode == LOOPBACK_EXT)) { - DBPRINT(sc, BXE_INFO, "not SGMII, no AN\n"); + DBPRINT(sc, BXE_VERBOSE_PHY, "%s(): Not SGMII, no AN\n", + __FUNCTION__); /* Disable autoneg. */ bxe_set_autoneg(params, vars, 0); @@ -5338,9 +5348,6 @@ bxe_set_led(struct link_params *params, emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config); - DBPRINT(sc, BXE_INFO, "bxe_set_led: port %x, mode %d\n", port, mode); - DBPRINT(sc, BXE_VERBOSE_PHY, "speed 0x%x, hw_led_mode 0x%x\n", speed, - hw_led_mode); switch (mode) { case LED_MODE_OFF: REG_WR(sc, NIG_REG_LED_10G_P0 + port * 4, 0); @@ -5382,7 +5389,7 @@ bxe_set_led(struct link_params *params, default: rc = -EINVAL; DBPRINT(sc, BXE_VERBOSE_PHY, - "bxe_set_led: Invalid led mode %d\n", mode); + "%s(): Invalid led mode (%d)!\n", __FUNCTION__, mode); break; } return (rc); @@ -5635,7 +5642,10 @@ bxe_link_reset(struct link_params *param ext_phy_type = XGXS_EXT_PHY_TYPE(ext_phy_config); val = REG_RD(sc, params->shmem_base + offsetof(struct shmem_region, dev_info.port_feature_config[params->port].config)); - DBPRINT(sc, BXE_INFO, "Resetting the link of port %d\n", port); + + DBPRINT(sc, BXE_INFO, "%s(): Resetting port %d link.\n", + __FUNCTION__, port); + /* Disable attentions. */ vars->link_status = 0; bxe_update_mng(params, vars->link_status); Modified: head/sys/dev/bxe/if_bxe.c ============================================================================== --- head/sys/dev/bxe/if_bxe.c Wed Jun 8 21:14:04 2011 (r222874) +++ head/sys/dev/bxe/if_bxe.c Wed Jun 8 21:18:14 2011 (r222875) @@ -70,7 +70,6 @@ __FBSDID("$FreeBSD$"); #ifdef BXE_DEBUG uint32_t bxe_debug = BXE_WARN; - /* 0 = Never */ /* 1 = 1 in 2,147,483,648 */ /* 256 = 1 in 8,388,608 */ @@ -84,12 +83,9 @@ uint32_t bxe_debug = BXE_WARN; /* Controls how often to simulate an mbuf allocation failure. */ int bxe_debug_mbuf_allocation_failure = 0; -/* Controls how often to simulate a DMA mapping failure. */ +/* Controls how often to simulate a DMA mapping failure. */ int bxe_debug_dma_map_addr_failure = 0; -/* Controls how often to received frame error. */ -int bxe_debug_received_frame_error = 0; - /* Controls how often to simulate a bootcode failure. */ int bxe_debug_bootcode_running_failure = 0; #endif @@ -103,7 +99,7 @@ int bxe_debug_bootcode_running_failure = /* BXE Build Time Options */ /* #define BXE_NVRAM_WRITE 1 */ -#define USE_DMAE 1 +#define BXE_USE_DMAE 1 /* * PCI Device ID Table @@ -132,14 +128,17 @@ static int bxe_attach(device_t); static int bxe_detach(device_t); static int bxe_shutdown(device_t); -static void bxe_set_tunables(struct bxe_softc *); +/* + * Driver local functions. + */ +static void bxe_tunables_set(struct bxe_softc *); static void bxe_print_adapter_info(struct bxe_softc *); static void bxe_probe_pci_caps(struct bxe_softc *); static void bxe_link_settings_supported(struct bxe_softc *, uint32_t); static void bxe_link_settings_requested(struct bxe_softc *); -static int bxe_get_function_hwinfo(struct bxe_softc *); -static void bxe_get_port_hwinfo(struct bxe_softc *); -static void bxe_get_common_hwinfo(struct bxe_softc *); +static int bxe_hwinfo_function_get(struct bxe_softc *); +static int bxe_hwinfo_port_get(struct bxe_softc *); +static int bxe_hwinfo_common_get(struct bxe_softc *); static void bxe_undi_unload(struct bxe_softc *); static int bxe_setup_leading(struct bxe_softc *); static int bxe_stop_leading(struct bxe_softc *); @@ -241,8 +240,8 @@ static int bxe_tx_encap(struct bxe_fast static void bxe_tx_start(struct ifnet *); static void bxe_tx_start_locked(struct ifnet *, struct bxe_fastpath *); static int bxe_tx_mq_start(struct ifnet *, struct mbuf *); -static int bxe_tx_mq_start_locked(struct ifnet *, struct bxe_fastpath *, - struct mbuf *); +static int bxe_tx_mq_start_locked(struct ifnet *, + struct bxe_fastpath *, struct mbuf *); static void bxe_mq_flush(struct ifnet *ifp); static int bxe_ioctl(struct ifnet *, u_long, caddr_t); static __inline int bxe_has_rx_work(struct bxe_fastpath *); @@ -254,33 +253,34 @@ static void bxe_intr_sp(void *); static void bxe_task_fp(void *, int); static void bxe_intr_fp(void *); static void bxe_zero_sb(struct bxe_softc *, int); -static void bxe_init_sb(struct bxe_softc *, struct host_status_block *, - bus_addr_t, int); +static void bxe_init_sb(struct bxe_softc *, + struct host_status_block *, bus_addr_t, int); static void bxe_zero_def_sb(struct bxe_softc *); -static void bxe_init_def_sb(struct bxe_softc *, struct host_def_status_block *, - bus_addr_t, int); +static void bxe_init_def_sb(struct bxe_softc *, + struct host_def_status_block *, bus_addr_t, int); static void bxe_update_coalesce(struct bxe_softc *); static __inline void bxe_update_rx_prod(struct bxe_softc *, - struct bxe_fastpath *, uint16_t, uint16_t, uint16_t); + struct bxe_fastpath *, uint16_t, uint16_t, uint16_t); static void bxe_clear_sge_mask_next_elems(struct bxe_fastpath *); static __inline void bxe_init_sge_ring_bit_mask(struct bxe_fastpath *); -static __inline void bxe_free_tpa_pool(struct bxe_fastpath *, int); -static __inline void bxe_free_rx_sge(struct bxe_softc *, struct bxe_fastpath *, - uint16_t); -static __inline void bxe_free_rx_sge_range(struct bxe_softc *, - struct bxe_fastpath *, int); -static struct mbuf *bxe_alloc_mbuf(struct bxe_fastpath *, int); -static int bxe_map_mbuf(struct bxe_fastpath *, struct mbuf *, bus_dma_tag_t, - bus_dmamap_t, bus_dma_segment_t *); -static struct mbuf *bxe_alloc_tpa_mbuf(struct bxe_fastpath *, int, int); -static void bxe_alloc_mutexes(struct bxe_softc *); -static void bxe_free_mutexes(struct bxe_softc *); -static int bxe_alloc_rx_sge(struct bxe_softc *, struct bxe_fastpath *, - uint16_t); -static void bxe_init_rx_chains(struct bxe_softc *); +static int bxe_alloc_tpa_mbuf(struct bxe_fastpath *, int); +static int bxe_fill_tpa_pool(struct bxe_fastpath *); +static void bxe_free_tpa_pool(struct bxe_fastpath *); + +static int bxe_alloc_rx_sge_mbuf(struct bxe_fastpath *, uint16_t); +static int bxe_fill_sg_chain(struct bxe_fastpath *); +static void bxe_free_sg_chain(struct bxe_fastpath *); + +static int bxe_alloc_rx_bd_mbuf(struct bxe_fastpath *, uint16_t); +static int bxe_fill_rx_bd_chain(struct bxe_fastpath *); +static void bxe_free_rx_bd_chain(struct bxe_fastpath *); + +static void bxe_mutexes_alloc(struct bxe_softc *); +static void bxe_mutexes_free(struct bxe_softc *); +static void bxe_clear_rx_chains(struct bxe_softc *); +static int bxe_init_rx_chains(struct bxe_softc *); +static void bxe_clear_tx_chains(struct bxe_softc *); static void bxe_init_tx_chains(struct bxe_softc *); -static void bxe_free_rx_chains(struct bxe_softc *); -static void bxe_free_tx_chains(struct bxe_softc *); static void bxe_init_sp_ring(struct bxe_softc *); static void bxe_init_context(struct bxe_softc *); static void bxe_init_ind_table(struct bxe_softc *); @@ -291,8 +291,7 @@ static void bxe_init_internal_port(struc static void bxe_init_internal_func(struct bxe_softc *); static void bxe_init_internal(struct bxe_softc *, uint32_t); -static void bxe_init_nic(struct bxe_softc *, uint32_t); -static int bxe_gunzip_init(struct bxe_softc *); +static int bxe_init_nic(struct bxe_softc *, uint32_t); static void bxe_lb_pckt(struct bxe_softc *); static int bxe_int_mem_test(struct bxe_softc *); static void bxe_enable_blocks_attention (struct bxe_softc *); @@ -304,13 +303,9 @@ static void bxe_ilt_wr(struct bxe_softc static int bxe_init_func(struct bxe_softc *); static int bxe_init_hw(struct bxe_softc *, uint32_t); static int bxe_fw_command(struct bxe_softc *, uint32_t); -static void bxe_dma_free(struct bxe_softc *); -static void bxe_dmamem_free(struct bxe_softc *, bus_dma_tag_t, caddr_t, - bus_dmamap_t); +static void bxe_host_structures_free(struct bxe_softc *); static void bxe_dma_map_addr(void *, bus_dma_segment_t *, int, int); -static int bxe_dma_alloc(device_t); -static int bxe_dmamem_alloc(struct bxe_softc *, bus_dma_tag_t, bus_dmamap_t, - void *, uint32_t, bus_addr_t *); +static int bxe_host_structures_alloc(device_t); static void bxe_set_mac_addr_e1(struct bxe_softc *, int); static void bxe_set_mac_addr_e1h(struct bxe_softc *, int); static void bxe_set_rx_mode(struct bxe_softc *); @@ -330,15 +325,12 @@ static void bxe_tpa_stop(struct bxe_soft int, int, union eth_rx_cqe *, uint16_t); static void bxe_rxeof(struct bxe_fastpath *); static void bxe_txeof(struct bxe_fastpath *); -static int bxe_get_buf(struct bxe_fastpath *, struct mbuf *, uint16_t); static int bxe_watchdog(struct bxe_fastpath *fp); -static int bxe_change_mtu(struct bxe_softc *, int); static void bxe_tick(void *); static void bxe_add_sysctls(struct bxe_softc *); -static void bxe_gunzip_end(struct bxe_softc *); -static void bxe_write_dmae_phys_len(struct bxe_softc *, bus_addr_t, uint32_t, - uint32_t); +static void bxe_write_dmae_phys_len(struct bxe_softc *, + bus_addr_t, uint32_t, uint32_t); void bxe_write_dmae(struct bxe_softc *, bus_addr_t, uint32_t, uint32_t); void bxe_read_dmae(struct bxe_softc *, uint32_t, uint32_t); @@ -360,32 +352,33 @@ static int bxe_sysctl_dump_rx_bd_chain(S static int bxe_sysctl_dump_tx_chain(SYSCTL_HANDLER_ARGS); static int bxe_sysctl_reg_read(SYSCTL_HANDLER_ARGS); static int bxe_sysctl_breakpoint(SYSCTL_HANDLER_ARGS); -static void bxe_validate_rx_packet(struct bxe_fastpath *, uint16_t, - union eth_rx_cqe *, struct mbuf *); +static __noinline void bxe_validate_rx_packet(struct bxe_fastpath *, + uint16_t, union eth_rx_cqe *, struct mbuf *); static void bxe_grcdump(struct bxe_softc *, int); -static void bxe_dump_enet(struct bxe_softc *,struct mbuf *); -static void bxe_dump_mbuf (struct bxe_softc *, struct mbuf *); -static void bxe_dump_tx_mbuf_chain(struct bxe_softc *, int, int); -static void bxe_dump_rx_mbuf_chain(struct bxe_softc *, int, int); -static void bxe_dump_tx_parsing_bd(struct bxe_fastpath *,int, - struct eth_tx_parse_bd *); -static void bxe_dump_txbd(struct bxe_fastpath *, int, - union eth_tx_bd_types *); -static void bxe_dump_rxbd(struct bxe_fastpath *, int, - struct eth_rx_bd *); -static void bxe_dump_cqe(struct bxe_fastpath *, int, union eth_rx_cqe *); -static void bxe_dump_tx_chain(struct bxe_fastpath *, int, int); -static void bxe_dump_rx_cq_chain(struct bxe_fastpath *, int, int); -static void bxe_dump_rx_bd_chain(struct bxe_fastpath *, int, int); -static void bxe_dump_status_block(struct bxe_softc *); -static void bxe_dump_stats_block(struct bxe_softc *); -static void bxe_dump_fp_state(struct bxe_fastpath *); -static void bxe_dump_port_state_locked(struct bxe_softc *); -static void bxe_dump_link_vars_state_locked(struct bxe_softc *); -static void bxe_dump_link_params_state_locked(struct bxe_softc *); -static void bxe_dump_driver_state(struct bxe_softc *); -static void bxe_dump_hw_state(struct bxe_softc *); -static void bxe_dump_fw(struct bxe_softc *); +static __noinline void bxe_dump_enet(struct bxe_softc *,struct mbuf *); +static __noinline void bxe_dump_mbuf (struct bxe_softc *, struct mbuf *); +static __noinline void bxe_dump_tx_mbuf_chain(struct bxe_softc *, int, int); +static __noinline void bxe_dump_rx_mbuf_chain(struct bxe_softc *, int, int); +static __noinline void bxe_dump_tx_parsing_bd(struct bxe_fastpath *,int, + struct eth_tx_parse_bd *); +static __noinline void bxe_dump_txbd(struct bxe_fastpath *, int, + union eth_tx_bd_types *); +static __noinline void bxe_dump_rxbd(struct bxe_fastpath *, int, + struct eth_rx_bd *); +static __noinline void bxe_dump_cqe(struct bxe_fastpath *, + int, union eth_rx_cqe *); +static __noinline void bxe_dump_tx_chain(struct bxe_fastpath *, int, int); +static __noinline void bxe_dump_rx_cq_chain(struct bxe_fastpath *, int, int); +static __noinline void bxe_dump_rx_bd_chain(struct bxe_fastpath *, int, int); +static __noinline void bxe_dump_status_block(struct bxe_softc *); +static __noinline void bxe_dump_stats_block(struct bxe_softc *); +static __noinline void bxe_dump_fp_state(struct bxe_fastpath *); +static __noinline void bxe_dump_port_state_locked(struct bxe_softc *); +static __noinline void bxe_dump_link_vars_state_locked(struct bxe_softc *); +static __noinline void bxe_dump_link_params_state_locked(struct bxe_softc *); +static __noinline void bxe_dump_driver_state(struct bxe_softc *); +static __noinline void bxe_dump_hw_state(struct bxe_softc *); +static __noinline void bxe_dump_fw(struct bxe_softc *); static void bxe_decode_mb_msgs(struct bxe_softc *, uint32_t, uint32_t); static void bxe_decode_ramrod_cmd(struct bxe_softc *, int); static void bxe_breakpoint(struct bxe_softc *); @@ -433,11 +426,6 @@ DRIVER_MODULE(bxe, pci, bxe_driver, bxe_ SYSCTL_NODE(_hw, OID_AUTO, bxe, CTLFLAG_RD, 0, "bxe driver parameters"); /* Allowable values are TRUE (1) or FALSE (0). */ -static int bxe_stats_enable = FALSE; -TUNABLE_INT("hw.bxe.stats_enable", &bxe_stats_enable); -SYSCTL_UINT(_hw_bxe, OID_AUTO, stats_enable, CTLFLAG_RDTUN, &bxe_stats_enable, - 0, "stats Enable/Disable"); - static int bxe_dcc_enable = FALSE; TUNABLE_INT("hw.bxe.dcc_enable", &bxe_dcc_enable); SYSCTL_UINT(_hw_bxe, OID_AUTO, dcc_enable, CTLFLAG_RDTUN, &bxe_dcc_enable, @@ -456,18 +444,6 @@ SYSCTL_UINT(_hw_bxe, OID_AUTO, int_mode, 0, "Interrupt (MSI-X|MSI|INTx) mode"); /* - * Specifies whether the driver should disable Transparent Packet - * Aggregation (TPA, also known as LRO). By default TPA is enabled. - * - * Allowable values are TRUE (1) or FALSE (0). - */ -static int bxe_tpa_enable = FALSE; -TUNABLE_INT("hw.bxe.tpa_enable", &bxe_tpa_enable); -SYSCTL_UINT(_hw_bxe, OID_AUTO, tpa_enable, CTLFLAG_RDTUN, &bxe_tpa_enable, - 0, "TPA Enable/Disable"); - - -/* * Specifies the number of queues that will be used when a multi-queue * RSS mode is selected using bxe_multi_mode below. * @@ -480,8 +456,8 @@ SYSCTL_UINT(_hw_bxe, OID_AUTO, queue_cou /* * ETH_RSS_MODE_DISABLED (0) - * Disables all multi-queue/packet sorting algorithms. Each - * received frame is routed to the same receive queue. + * Disables all multi-queue/packet sorting algorithms. All + * received frames are routed to a single receive queue. * * ETH_RSS_MODE_REGULAR (1) * The default mode which assigns incoming frames to receive @@ -579,7 +555,7 @@ bxe_reg_write32(struct bxe_softc *sc, bu (uintmax_t)offset); } - DBPRINT(sc, BXE_INSANE, "%s(): offset = 0x%jX, val = 0x%08X\n", + DBPRINT(sc, BXE_INSANE_REGS, "%s(): offset = 0x%jX, val = 0x%08X\n", __FUNCTION__, (uintmax_t)offset, val); bus_space_write_4(sc->bxe_btag, sc->bxe_bhandle, offset, val); @@ -602,7 +578,7 @@ bxe_reg_write16(struct bxe_softc *sc, bu (uintmax_t)offset); } - DBPRINT(sc, BXE_INSANE, "%s(): offset = 0x%jX, val = 0x%04X\n", + DBPRINT(sc, BXE_INSANE_REGS, "%s(): offset = 0x%jX, val = 0x%04X\n", __FUNCTION__, (uintmax_t)offset, val); bus_space_write_2(sc->bxe_btag, sc->bxe_bhandle, offset, val); @@ -619,7 +595,7 @@ static void bxe_reg_write8(struct bxe_softc *sc, bus_size_t offset, uint8_t val) { - DBPRINT(sc, BXE_INSANE, "%s(): offset = 0x%jX, val = 0x%02X\n", + DBPRINT(sc, BXE_INSANE_REGS, "%s(): offset = 0x%jX, val = 0x%02X\n", __FUNCTION__, (uintmax_t)offset, val); bus_space_write_1(sc->bxe_btag, sc->bxe_bhandle, offset, val); @@ -645,7 +621,7 @@ bxe_reg_read32(struct bxe_softc *sc, bus val = bus_space_read_4(sc->bxe_btag, sc->bxe_bhandle, offset); - DBPRINT(sc, BXE_INSANE, "%s(): offset = 0x%jX, val = 0x%08X\n", + DBPRINT(sc, BXE_INSANE_REGS, "%s(): offset = 0x%jX, val = 0x%08X\n", __FUNCTION__, (uintmax_t)offset, val); return (val); @@ -671,7 +647,7 @@ bxe_reg_read16(struct bxe_softc *sc, bus val = bus_space_read_2(sc->bxe_btag, sc->bxe_bhandle, offset); - DBPRINT(sc, BXE_INSANE, "%s(): offset = 0x%jX, val = 0x%08X\n", + DBPRINT(sc, BXE_INSANE_REGS, "%s(): offset = 0x%jX, val = 0x%08X\n", __FUNCTION__, (uintmax_t)offset, val); return (val); @@ -690,10 +666,10 @@ bxe_reg_read8(struct bxe_softc *sc, bus_ { uint8_t val = bus_space_read_1(sc->bxe_btag, sc->bxe_bhandle, offset); - DBPRINT(sc, BXE_INSANE, "%s(): offset = 0x%jX, val = 0x%02X\n", + DBPRINT(sc, BXE_INSANE_REGS, "%s(): offset = 0x%jX, val = 0x%02X\n", __FUNCTION__, (uintmax_t)offset, val); - return(val); + return (val); } #endif @@ -996,6 +972,7 @@ bxe_probe(device_t dev) * Returns: * None. */ +/* ToDo: Create a sysctl for this info. */ static void bxe_print_adapter_info(struct bxe_softc *sc) { @@ -1025,19 +1002,14 @@ bxe_print_adapter_info(struct bxe_softc printf("); Flags ("); /* Miscellaneous flags. */ - if (sc->bxe_flags & BXE_USING_MSI_FLAG) + if (sc->msi_count > 0) printf("MSI"); - if (sc->bxe_flags & BXE_USING_MSIX_FLAG) { + if (sc->msix_count > 0) { if (i > 0) printf("|"); printf("MSI-X"); i++; } - if (sc->bxe_flags & BXE_SAFC_TX_FLAG) { - if (i > 0) printf("|"); - printf("SAFC"); i++; - } - if (TPA_ENABLED(sc)) { if (i > 0) printf("|"); printf("TPA"); i++; @@ -1056,6 +1028,9 @@ bxe_print_adapter_info(struct bxe_softc break; } + printf("); BD's (RX:%d,TX:%d", + (int) USABLE_RX_BD, (int) USABLE_TX_BD); + /* Firmware versions and device features. */ printf("); Firmware (%d.%d.%d); Bootcode (%d.%d.%d)\n", BCM_5710_FW_MAJOR_VERSION, @@ -1069,6 +1044,64 @@ bxe_print_adapter_info(struct bxe_softc } /* + * Release any interrupts allocated by the driver. + * + * Returns: + * None + */ +static void +bxe_interrupt_free(struct bxe_softc *sc) +{ + device_t dev; + int i; + + DBENTER(BXE_VERBOSE_RESET | BXE_VERBOSE_UNLOAD); + + dev = sc->dev; + + if (sc->msix_count > 0) { + /* Free MSI-X resources. */ + + for (i = 0; i < sc->msix_count; i++) { + DBPRINT(sc, (BXE_VERBOSE_LOAD | BXE_VERBOSE_RESET | + BXE_VERBOSE_INTR), "%s(): Releasing MSI-X[%d] " + "vector.\n", __FUNCTION__, i); + if (sc->bxe_msix_res[i] && sc->bxe_msix_rid[i]) + bus_release_resource(dev, SYS_RES_IRQ, + sc->bxe_msix_rid[i], sc->bxe_msix_res[i]); + } + + pci_release_msi(dev); + + } else if (sc->msi_count > 0) { + /* Free MSI resources. */ + + for (i = 0; i < sc->msi_count; i++) { + DBPRINT(sc, (BXE_VERBOSE_LOAD | BXE_VERBOSE_RESET | + BXE_VERBOSE_INTR), "%s(): Releasing MSI[%d] " + "vector.\n", __FUNCTION__, i); + if (sc->bxe_msi_res[i] && sc->bxe_msi_rid[i]) + bus_release_resource(dev, SYS_RES_IRQ, + sc->bxe_msi_rid[i], sc->bxe_msi_res[i]); + } + + pci_release_msi(dev); + + } else { + /* Free legacy interrupt resources. */ + + DBPRINT(sc, (BXE_VERBOSE_LOAD | BXE_VERBOSE_RESET | + BXE_VERBOSE_INTR), "%s(): Releasing legacy interrupt.\n", + __FUNCTION__); + if (sc->bxe_irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, + sc->bxe_irq_rid, sc->bxe_irq_res); + } + + DBEXIT(BXE_VERBOSE_RESET | BXE_VERBOSE_UNLOAD); +} + +/* * This function determines and allocates the appropriate * interrupt based on system capabilites and user request. * @@ -1086,30 +1119,19 @@ bxe_print_adapter_info(struct bxe_softc * 0 = Success, !0 = Failure. */ static int -bxe_interrupt_allocate(struct bxe_softc *sc) +bxe_interrupt_alloc(struct bxe_softc *sc) { device_t dev; - int i, rid, rc; + int error, i, rid, rc; int msi_count, msi_required, msi_allocated; int msix_count, msix_required, msix_allocated; - rc = 0; - dev = sc->dev; - msi_count = 0; - msi_required = 0; - msi_allocated = 0; - msix_count = 0; - msix_required = 0; - msix_allocated = 0; - DBENTER(BXE_VERBOSE_LOAD | BXE_VERBOSE_INTR); - /* Assume SAFC not enabled for TX. */ - sc->bxe_flags &= ~BXE_SAFC_TX_FLAG; - - /* Clear any previous priority queue mappings. */ - for (i = 0; i < BXE_MAX_PRIORITY; i++) - sc->pri_map[i] = 0; + rc = 0; + dev = sc->dev; + msi_count = msi_required = msi_allocated = 0; + msix_count = msix_required = msix_allocated = 0; /* Get the number of available MSI/MSI-X interrupts from the OS. */ if (sc->int_mode > 0) { @@ -1140,7 +1162,8 @@ bxe_interrupt_allocate(struct bxe_softc /* BSD resource identifier */ rid = 1; - if (pci_alloc_msix(dev, &msix_allocated) == 0) { + error = pci_alloc_msix(dev, &msix_allocated); + if (error == 0) { DBPRINT(sc, (BXE_VERBOSE_LOAD | BXE_VERBOSE_INTR), "%s(): Required/Allocated (%d/%d) MSI-X vector(s).\n", __FUNCTION__, msix_required, msix_allocated); @@ -1148,7 +1171,6 @@ bxe_interrupt_allocate(struct bxe_softc /* Make sure we got all the interrupts we asked for. */ if (msix_allocated >= msix_required) { sc->msix_count = msix_required; - sc->bxe_flags |= BXE_USING_MSIX_FLAG; msi_count = 0; /* Allocate the MSI-X vectors. */ @@ -1165,7 +1187,7 @@ bxe_interrupt_allocate(struct bxe_softc "%s(%d): Failed to map MSI-X[%d] vector!\n", __FILE__, __LINE__, (3)); rc = ENXIO; - goto bxe_interrupt_allocate_exit; + goto bxe_interrupt_alloc_exit; } } } else { @@ -1176,7 +1198,6 @@ bxe_interrupt_allocate(struct bxe_softc /* Release any resources acquired. */ pci_release_msi(dev); - sc->bxe_flags &= ~BXE_USING_MSIX_FLAG; sc->msix_count = msix_count = 0; /* We'll try MSI next. */ @@ -1200,7 +1221,8 @@ bxe_interrupt_allocate(struct bxe_softc msi_required); rid = 1; - if (pci_alloc_msi(dev, &msi_allocated) == 0) { + error = pci_alloc_msi(dev, &msi_allocated); + if (error == 0) { DBPRINT(sc, (BXE_VERBOSE_LOAD | BXE_VERBOSE_INTR), "%s(): Required/Allocated (%d/%d) MSI vector(s).\n", __FUNCTION__, msi_required, msi_allocated); @@ -1212,7 +1234,6 @@ bxe_interrupt_allocate(struct bxe_softc */ if (msi_required >= msi_allocated) { sc->msi_count = msi_required; - sc->bxe_flags |= BXE_USING_MSI_FLAG; /* Allocate the MSI vectors. */ for (i = 0; i < msi_required; i++) { sc->bxe_msi_rid[i] = i + rid; @@ -1226,7 +1247,7 @@ bxe_interrupt_allocate(struct bxe_softc "%s(%d): Failed to map MSI vector (%d)!\n", __FILE__, __LINE__, (i)); rc = ENXIO; - goto bxe_interrupt_allocate_exit; + goto bxe_interrupt_alloc_exit; } } } @@ -1237,7 +1258,6 @@ bxe_interrupt_allocate(struct bxe_softc /* Release any resources acquired. */ pci_release_msi(dev); - sc->bxe_flags &= ~BXE_USING_MSI_FLAG; sc->msi_count = msi_count = 0; /* We'll try INTx next. */ @@ -1262,7 +1282,7 @@ bxe_interrupt_allocate(struct bxe_softc BXE_PRINTF("%s(%d): PCI map interrupt failed!\n", __FILE__, __LINE__); rc = ENXIO; - goto bxe_interrupt_allocate_exit; + goto bxe_interrupt_alloc_exit; } sc->bxe_irq_rid = rid; } @@ -1271,27 +1291,55 @@ bxe_interrupt_allocate(struct bxe_softc "%s(): Actual: int_mode = %d, multi_mode = %d, num_queues = %d\n", __FUNCTION__, sc->int_mode, sc->multi_mode, sc->num_queues); -bxe_interrupt_allocate_exit: +bxe_interrupt_alloc_exit: DBEXIT(BXE_VERBOSE_LOAD | BXE_VERBOSE_INTR); return (rc); } +/* + * This function releases taskqueues. + * + * Returns: + * None + */ static void bxe_interrupt_detach(struct bxe_softc *sc) { +#ifdef BXE_TASK + struct bxe_fastpath *fp; +#endif device_t dev; int i; + DBENTER(BXE_VERBOSE_UNLOAD); + dev = sc->dev; - DBENTER(BXE_VERBOSE_RESET | BXE_VERBOSE_UNLOAD); + +#ifdef BXE_TASK + /* Free the OS taskqueue resources. */ + for (i = 0; i < sc->num_queues; i++) { + fp = &sc->fp[i]; + + if (fp->tq != NULL) { + taskqueue_drain(fp->tq, &fp->task); + taskqueue_free(fp->tq); + } + } + + if (sc->tq != NULL) { + taskqueue_drain(sc->tq, &sc->task); + taskqueue_free(sc->tq); + } +#endif + /* Release interrupt resources. */ - if ((sc->bxe_flags & BXE_USING_MSIX_FLAG) && sc->msix_count) { + if (sc->msix_count > 0) { for (i = 0; i < sc->msix_count; i++) { if (sc->bxe_msix_tag[i] && sc->bxe_msix_res[i]) bus_teardown_intr(dev, sc->bxe_msix_res[i], sc->bxe_msix_tag[i]); } - } else if ((sc->bxe_flags & BXE_USING_MSI_FLAG) && sc->msi_count) { + } else if (sc->msi_count > 0) { for (i = 0; i < sc->msi_count; i++) { if (sc->bxe_msi_tag[i] && sc->bxe_msi_res[i]) bus_teardown_intr(dev, sc->bxe_msi_res[i], @@ -1302,6 +1350,8 @@ bxe_interrupt_detach(struct bxe_softc *s bus_teardown_intr(dev, sc->bxe_irq_res, sc->bxe_irq_tag); } + + DBEXIT(BXE_VERBOSE_UNLOAD); } /* @@ -1336,7 +1386,7 @@ bxe_interrupt_attach(struct bxe_softc *s #endif /* Setup interrupt handlers. */ - if (sc->bxe_flags & BXE_USING_MSIX_FLAG) { + if (sc->msix_count > 0) { DBPRINT(sc, (BXE_VERBOSE_LOAD | BXE_VERBOSE_INTR), "%s(): Enabling slowpath MSI-X[0] vector.\n",__FUNCTION__); /* @@ -1344,13 +1394,9 @@ bxe_interrupt_attach(struct bxe_softc *s * driver instance to the interrupt handler for the * slowpath. */ - rc = bus_setup_intr(sc->dev, - sc->bxe_msix_res[0], - INTR_TYPE_NET | INTR_MPSAFE, - NULL, - bxe_intr_sp, - sc, - &sc->bxe_msix_tag[0]); + rc = bus_setup_intr(sc->dev, sc->bxe_msix_res[0], + INTR_TYPE_NET | INTR_MPSAFE, NULL, bxe_intr_sp, + sc, &sc->bxe_msix_tag[0]); if (rc) { BXE_PRINTF( @@ -1360,10 +1406,8 @@ bxe_interrupt_attach(struct bxe_softc *s } #if __FreeBSD_version >= 800504 - bus_describe_intr(sc->dev, - sc->bxe_msix_res[0], - sc->bxe_msix_tag[0], - "sp"); + bus_describe_intr(sc->dev, sc->bxe_msix_res[0], + sc->bxe_msix_tag[0], "sp"); #endif /* Now initialize the fastpath vectors. */ @@ -1377,13 +1421,9 @@ bxe_interrupt_attach(struct bxe_softc *s * fastpath context to the interrupt handler in this * case. Also the first msix_res was used by the sp. */ - rc = bus_setup_intr(sc->dev, - sc->bxe_msix_res[i + 1], - INTR_TYPE_NET | INTR_MPSAFE, - NULL, - bxe_intr_fp, - fp, - &sc->bxe_msix_tag[i + 1]); + rc = bus_setup_intr(sc->dev, sc->bxe_msix_res[i + 1], + INTR_TYPE_NET | INTR_MPSAFE, NULL, bxe_intr_fp, + fp, &sc->bxe_msix_tag[i + 1]); if (rc) { BXE_PRINTF( @@ -1393,11 +1433,8 @@ bxe_interrupt_attach(struct bxe_softc *s } #if __FreeBSD_version >= 800504 - bus_describe_intr(sc->dev, - sc->bxe_msix_res[i + 1], - sc->bxe_msix_tag[i + 1], - "fp[%02d]", - i); + bus_describe_intr(sc->dev, sc->bxe_msix_res[i + 1], + sc->bxe_msix_tag[i + 1], "fp[%02d]", i); #endif /* Bind the fastpath instance to a CPU. */ @@ -1409,13 +1446,13 @@ bxe_interrupt_attach(struct bxe_softc *s #ifdef BXE_TASK TASK_INIT(&fp->task, 0, bxe_task_fp, fp); fp->tq = taskqueue_create_fast("bxe_fpq", M_NOWAIT, - taskqueue_thread_enqueue, &fp->tq); + taskqueue_thread_enqueue, &fp->tq); taskqueue_start_threads(&fp->tq, 1, PI_NET, "%s fpq", - device_get_nameunit(sc->dev)); + device_get_nameunit(sc->dev)); #endif fp->state = BXE_FP_STATE_IRQ; } - } else if (sc->bxe_flags & BXE_USING_MSI_FLAG) { + } else if (sc->msi_count > 0) { DBPRINT(sc, (BXE_VERBOSE_LOAD | BXE_VERBOSE_INTR), "%s(): Enabling slowpath MSI[0] vector.\n", __FUNCTION__); @@ -1424,12 +1461,8 @@ bxe_interrupt_attach(struct bxe_softc *s * instance to the interrupt handler for the slowpath. */ rc = bus_setup_intr(sc->dev,sc->bxe_msi_res[0], - INTR_TYPE_NET | INTR_MPSAFE, - NULL, - bxe_intr_sp, - sc, - &sc->bxe_msi_tag[0] - ); + INTR_TYPE_NET | INTR_MPSAFE, NULL, bxe_intr_sp, + sc, &sc->bxe_msi_tag[0]); if (rc) { BXE_PRINTF( @@ -1439,10 +1472,8 @@ bxe_interrupt_attach(struct bxe_softc *s } #if __FreeBSD_version >= 800504 - bus_describe_intr(sc->dev, - sc->bxe_msi_res[0], - sc->bxe_msi_tag[0], - "sp"); + bus_describe_intr(sc->dev, sc->bxe_msi_res[0], + sc->bxe_msi_tag[0], "sp"); #endif /* Now initialize the fastpath vectors. */ @@ -1457,14 +1488,9 @@ bxe_interrupt_attach(struct bxe_softc *s * fastpath context to the interrupt handler in this * case. */ - rc = bus_setup_intr(sc->dev, - sc->bxe_msi_res[i + 1], - INTR_TYPE_NET | INTR_MPSAFE, - NULL, - bxe_intr_fp, - fp, - &sc->bxe_msi_tag[i + 1] - ); + rc = bus_setup_intr(sc->dev, sc->bxe_msi_res[i + 1], + INTR_TYPE_NET | INTR_MPSAFE, NULL, bxe_intr_fp, + fp, &sc->bxe_msi_tag[i + 1]); if (rc) { BXE_PRINTF( @@ -1474,19 +1500,16 @@ bxe_interrupt_attach(struct bxe_softc *s } #if __FreeBSD_version >= 800504 - bus_describe_intr(sc->dev, - sc->bxe_msi_res[i + 1], - sc->bxe_msi_tag[i + 1], - "fp[%02d]", - i); + bus_describe_intr(sc->dev, sc->bxe_msi_res[i + 1], + sc->bxe_msi_tag[i + 1], "fp[%02d]", i); #endif #ifdef BXE_TASK TASK_INIT(&fp->task, 0, bxe_task_fp, fp); fp->tq = taskqueue_create_fast("bxe_fpq", M_NOWAIT, - taskqueue_thread_enqueue, &fp->tq); + taskqueue_thread_enqueue, &fp->tq); taskqueue_start_threads(&fp->tq, 1, PI_NET, "%s fpq", - device_get_nameunit(sc->dev)); + device_get_nameunit(sc->dev)); #endif } @@ -1495,23 +1518,19 @@ bxe_interrupt_attach(struct bxe_softc *s fp = &sc->fp[0]; #endif DBPRINT(sc, (BXE_VERBOSE_LOAD | BXE_VERBOSE_INTR), - "%s(): Enabling INTx interrupts.\n", __FUNCTION__); + "%s(): Enabling INTx interrupts.\n", __FUNCTION__); /* * Setup the interrupt handler. Note that we pass the * driver instance to the interrupt handler which * will handle both the slowpath and fastpath. */ - rc = bus_setup_intr(sc->dev,sc->bxe_irq_res, - INTR_TYPE_NET | INTR_MPSAFE, - NULL, - bxe_intr_legacy, - sc, - &sc->bxe_irq_tag); + rc = bus_setup_intr(sc->dev,sc->bxe_irq_res, INTR_TYPE_NET | + INTR_MPSAFE, NULL, bxe_intr_legacy, sc, &sc->bxe_irq_tag); if (rc) { BXE_PRINTF("%s(%d): Failed to allocate interrupt!\n", - __FILE__, __LINE__); + __FILE__, __LINE__); goto bxe_interrupt_attach_exit; } #ifdef BXE_TASK @@ -1616,56 +1635,78 @@ bxe_probe_pci_caps(struct bxe_softc *sc) DBEXIT(BXE_EXTREME_LOAD); } +/* + * Setup firmware pointers for BCM57710. + * + * Returns: + * None + */ static void bxe_init_e1_firmware(struct bxe_softc *sc) { - INIT_OPS(sc) = (struct raw_op *)init_ops_e1; - INIT_DATA(sc) = (const uint32_t *)init_data_e1; - INIT_OPS_OFFSETS(sc) = (const uint16_t *)init_ops_offsets_e1; - INIT_TSEM_INT_TABLE_DATA(sc) = tsem_int_table_data_e1; - INIT_TSEM_PRAM_DATA(sc) = tsem_pram_data_e1; - INIT_USEM_INT_TABLE_DATA(sc) = usem_int_table_data_e1; - INIT_USEM_PRAM_DATA(sc) = usem_pram_data_e1; - INIT_XSEM_INT_TABLE_DATA(sc) = xsem_int_table_data_e1; - INIT_XSEM_PRAM_DATA(sc) = xsem_pram_data_e1; - INIT_CSEM_INT_TABLE_DATA(sc) = csem_int_table_data_e1; - INIT_CSEM_PRAM_DATA(sc) = csem_pram_data_e1; + INIT_OPS(sc) = (struct raw_op *)init_ops_e1; + INIT_DATA(sc) = (const uint32_t *)init_data_e1; + INIT_OPS_OFFSETS(sc) = (const uint16_t *)init_ops_offsets_e1; + INIT_TSEM_INT_TABLE_DATA(sc) = tsem_int_table_data_e1; + INIT_TSEM_PRAM_DATA(sc) = tsem_pram_data_e1; + INIT_USEM_INT_TABLE_DATA(sc) = usem_int_table_data_e1; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 21:29: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 C8C881065673; Wed, 8 Jun 2011 21:29:33 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8A5A8FC12; Wed, 8 Jun 2011 21:29: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 p58LTX6I048287; Wed, 8 Jun 2011 21:29:33 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58LTX2T048285; Wed, 8 Jun 2011 21:29:33 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201106082129.p58LTX2T048285@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 8 Jun 2011 21:29: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: r222878 - head/gnu/usr.bin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 21:29:33 -0000 Author: obrien Date: Wed Jun 8 21:29:33 2011 New Revision: 222878 URL: http://svn.freebsd.org/changeset/base/222878 Log: Simply post r222273. Modified: head/gnu/usr.bin/Makefile Modified: head/gnu/usr.bin/Makefile ============================================================================== --- head/gnu/usr.bin/Makefile Wed Jun 8 21:29:12 2011 (r222877) +++ head/gnu/usr.bin/Makefile Wed Jun 8 21:29:33 2011 (r222878) @@ -11,7 +11,7 @@ SUBDIR= ${_binutils} \ ${_dtc} \ ${_gdb} \ ${_gperf} \ - ${_grep} \ + grep \ ${_groff} \ patch \ ${_rcs} \ @@ -27,8 +27,6 @@ _groff= groff .endif .endif -_grep= grep - .if ${MK_CVS} != "no" _cvs= cvs .endif From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 21:58: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 714C41065677; Wed, 8 Jun 2011 21:58:19 +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 610198FC0A; Wed, 8 Jun 2011 21:58: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 p58LwJqq049399; Wed, 8 Jun 2011 21:58:19 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58LwJ88049397; Wed, 8 Jun 2011 21:58:19 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106082158.p58LwJ88049397@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 8 Jun 2011 21:58: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: r222882 - 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: Wed, 08 Jun 2011 21:58:19 -0000 Author: jilles Date: Wed Jun 8 21:58:19 2011 New Revision: 222882 URL: http://svn.freebsd.org/changeset/base/222882 Log: sh: Add simple tests for set -x and PS4. Added: head/tools/regression/bin/sh/execution/set-x1.0 (contents, props changed) head/tools/regression/bin/sh/execution/set-x2.0 (contents, props changed) Added: head/tools/regression/bin/sh/execution/set-x1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/set-x1.0 Wed Jun 8 21:58:19 2011 (r222882) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +key='must_contain_this' +{ r=`set -x; { : "$key"; } 2>&1 >/dev/null`; } 2>/dev/null +case $r in +*"$key"*) true ;; +*) false ;; +esac Added: head/tools/regression/bin/sh/execution/set-x2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/set-x2.0 Wed Jun 8 21:58:19 2011 (r222882) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +key='must contain this' +PS4="$key+ " +{ r=`set -x; { :; } 2>&1 >/dev/null`; } 2>/dev/null +case $r in +*"$key"*) true ;; +*) false ;; +esac From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 21:59: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 95AAC1065675; Wed, 8 Jun 2011 21:59:07 +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 860118FC1B; Wed, 8 Jun 2011 21:59: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 p58Lx7dU049459; Wed, 8 Jun 2011 21:59:07 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58Lx74l049457; Wed, 8 Jun 2011 21:59:07 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201106082159.p58Lx74l049457@svn.freebsd.org> From: "Kenneth D. Merry" Date: Wed, 8 Jun 2011 21:59: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: r222883 - head/sbin/rtsol X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 21:59:07 -0000 Author: ken Date: Wed Jun 8 21:59:07 2011 New Revision: 222883 URL: http://svn.freebsd.org/changeset/base/222883 Log: Add dump.c to the rtsol build. It is needed now that sec2str is non-static and used in rtsold.c. Modified: head/sbin/rtsol/Makefile Modified: head/sbin/rtsol/Makefile ============================================================================== --- head/sbin/rtsol/Makefile Wed Jun 8 21:58:19 2011 (r222882) +++ head/sbin/rtsol/Makefile Wed Jun 8 21:59:07 2011 (r222883) @@ -19,7 +19,7 @@ SRCDIR= ${.CURDIR}/../../usr.sbin/rtsold .PATH: ${SRCDIR} PROG= rtsol -SRCS= rtsold.c rtsol.c if.c probe.c rtsock.c +SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c NO_MAN= WARNS?= 3 From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 23:13:27 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 6790E106566B; Wed, 8 Jun 2011 23:13:22 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: Bruce Evans Date: Wed, 8 Jun 2011 19:13:06 -0400 User-Agent: KMail/1.6.2 References: <201106081938.p58JcWuB044252@svn.freebsd.org> <20110609055112.P2870@besplex.bde.org> In-Reply-To: <20110609055112.P2870@besplex.bde.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106081913.09272.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222866 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 23:13:27 -0000 On Wednesday 08 June 2011 04:55 pm, Bruce Evans wrote: > On Wed, 8 Jun 2011, Jung-uk Kim wrote: > > Log: > > Introduce low-resolution TSC timecounter "TSC-low". It replaces > > the normal TSC timecounter if TSC frequency is higher than ~4.29 > > MHz (or 2^32-1 Hz) or > > Off by a factor of 1024. Oops, GHz. Sorry. > > multiple CPUs are present. The "TSC-low" frequency is always > > lower than a preset maximum value and derived from TSC frequency > > (by being halved until it becomes lower than the maximum). Note > > the maximum value for SMP case is significantly lower than UP > > case because we want to reduce (rare but known) "temporal > > anomalies" caused by non-serialized RDTSC instruction. Normally, > > it is still higher than "ACPI-fast" timecounter frequency (which > > was default timecounter hardware for long time until r222222) to > > be useful. > > It should be a separate timecounter so that the user can choose it > independently, at least in the SMP case where it is very low (at > most ~4.29 GHz >> 8 ~= 17 MHz). As I noted in the log, it is still higher than the previous default ACPI-fast, which is ~3.68 MHz and I've never heard of any complaint about ACPI-fast being too low. ;-) Nothing prevents us from making a separate timecounter, though. In fact, we can do the same for ACPI-fast/ACPI-safe. However, that'll only confuse users, IMHO. > > Modified: > > head/sys/x86/x86/tsc.c > > > > Modified: head/sys/x86/x86/tsc.c > > ================================================================= > >============= --- head/sys/x86/x86/tsc.c Wed Jun 8 19:28:59 > > 2011 (r222865) +++ head/sys/x86/x86/tsc.c Wed Jun 8 19:38:31 > > 2011 (r222866) @@ -79,7 +79,8 @@ static void > > tsc_freq_changed(void *arg, int status); > > static void tsc_freq_changing(void *arg, const struct cf_level > > *level, int *status); > > -static unsigned tsc_get_timecount(struct timecounter *tc); > > +static unsigned tsc_get_timecount(struct timecounter *tc); > > +static unsigned tsc_get_timecount_lowres(struct timecounter > > *tc); > > Should be spelled low or lowres throughout. Hmm... Maybe... > > static void tsc_levels_changed(void *arg, int unit); > > > > static struct timecounter tsc_timecounter = { > > @@ -392,11 +393,19 @@ test_smp_tsc(void) > > static void > > init_TSC_tc(void) > > This seems to only be called once at boot time. So the lowness may > be much lower than necessary if the levels are reduced > significantly later. It'll only happen when the CPU is started at the highest frequency and TSC is not invariant. In this case, its quality will be set to 800 and HPET or ACPI timecounter will be selected by default. I don't see much problem with the default choice here. > > { > > + uint64_t max_freq; > > + int shift; > > > > if ((cpu_feature & CPUID_TSC) == 0 || tsc_disabled) > > return; > > > > /* > > + * Limit timecounter frequency to fit in an int and prevent it > > from + * overflowing too fast. > > + */ > > + max_freq = UINT_MAX; > > + > > + /* > > * We can not use the TSC if we support APM. Precise > > timekeeping * on an APM'ed machine is at best a fools pursuit, > > since * any and all of the time spent in various SMM code can't > > @@ -418,13 +427,27 @@ init_TSC_tc(void) > > * We can not use the TSC in SMP mode unless the TSCs on all > > CPUs are * synchronized. If the user is sure that the system has > > synchronized * TSCs, set kern.timecounter.smp_tsc tunable to a > > non-zero value. + * We also limit the frequency even lower to > > avoid "temporal anomalies" + * as much as possible. > > */ > > - if (smp_cpus > 1) > > + if (smp_cpus > 1) { > > tsc_timecounter.tc_quality = test_smp_tsc(); > > + max_freq >>= 8; > > + } > > This gives especially low lowness if the levels are reduced > significantly. Maybe as low as 100 MHz >> 8 = ~390 KHz = lower than > an i8254. I don't remember any SMP-capable x86 ever running at 100 MHz unless it is seriously under-clocked. Even if it existed, it won't be available today. :-P > OTOH, maybe the temporal anomalies scale with the TSC frequency, so > you need to right shift by a few irrespective of the TSC frequency. > A shift count of 8 seems too much, but if the initial TSC frequency > is already < 2**32 shifted by 8, then the final shift is 0. > > > #endif > > init: > > + for (shift = 0; shift < 32 && (tsc_freq >> shift) > max_freq; > > shift++) + ; > > + if (shift > 0) { > > + tsc_timecounter.tc_get_timecount = tsc_get_timecount_lowres; > > + tsc_timecounter.tc_name = "TSC-low"; > > + if (bootverbose) > > + printf("TSC timecounter discards lower %d bit(s).\n", > > + shift); > > Error messages are not terminated by a "." in KNF. I'll fix that next time, thanks. > > + } > > if (tsc_freq != 0) { > > - tsc_timecounter.tc_frequency = tsc_freq; > > + tsc_timecounter.tc_frequency = tsc_freq >> shift; > > + tsc_timecounter.tc_priv = (void *)(intptr_t)shift; > > tc_init(&tsc_timecounter); > > } > > } > > @@ -496,7 +519,8 @@ tsc_freq_changed(void *arg, const struct > > /* Total setting for this level gives the new frequency in MHz. > > */ freq = (uint64_t)level->total_set.freq * 1000000; > > atomic_store_rel_64(&tsc_freq, freq); > > I thought you would scale the low-level tsc_freq too, but this is > not so easy (the shift would have to be put in rdtsc()). Yup, it was far too ugly for my taste. > > - atomic_store_rel_64(&tsc_timecounter.tc_frequency, freq); > > + tsc_timecounter.tc_frequency = > > + freq >> (int)(intptr_t)tsc_timecounter.tc_priv; > > Perhaps the levels can also be increased significantly later. Then > the timecounter frequency may exceed 4.29 GHz despite its scaling. Again, it can only happen when the CPU was started at low frequency and the TSC is not invariant. For that case, TSC won't be selected by default unless both HPET and ACPI timers are disabled/unavailable. Please note the whole point of this commit (and r222867) is to make the default selection good enough for most users. If a user decided to turn off other timers, let him/her suffer the consequences. ;-) > > } > > > > static int > > @@ -511,7 +535,8 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_A > > error = sysctl_handle_64(oidp, &freq, 0, req); > > if (error == 0 && req->newptr != NULL) { > > atomic_store_rel_64(&tsc_freq, freq); > > - atomic_store_rel_64(&tsc_timecounter.tc_frequency, freq); > > + tsc_timecounter.tc_frequency = > > + freq >> (int)(intptr_t)tsc_timecounter.tc_priv; > > Root can easily increase this frequency from below 4.29 GHz (with > no scaling) to above (still with no scaling). And this change might > even be correct if it is from 4.29 GHz - epsilon to 4.29 GHz plus > epsilon. Micro-adjustments that cross the 4.29 GHz threshold are > precisely the ones that need the atomic op. Hmm... I thought I took care of that but you're right. The atomic op should be back. > > } > > return (error); > > } > > @@ -520,8 +545,15 @@ SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq > > 0, 0, sysctl_machdep_tsc_freq, "QU", "Time Stamp Counter > > frequency"); > > > > static u_int > > -tsc_get_timecount(struct timecounter *tc) > > +tsc_get_timecount(struct timecounter *tc __unused) > > { > > > > return (rdtsc32()); > > } > > + > > +static u_int > > +tsc_get_timecount_lowres(struct timecounter *tc) > > +{ > > + > > + return (rdtsc() >> (int)(intptr_t)tc->tc_priv); > > This forces a slow 64-bit shift (shrdl; shrl) in all cases. Yes, it does, unfortunately. I have no clue why AMD didn't implement native 64-bit RDTSC (and RDMSR/WRMSR) in the first place. :-( > rdtsc32() with a scaled tc_counter_mask should work OK (essentially > the same as the non-low timecounter except for reduced accuracy; > the only loss is an decrease in the time until counter overflow to > the same as for the non-low timecounter). I thought about that but I didn't like that idea, i.e., losing resolution and accuracy at the same time. > > +} > > Blindly changing the scale factor on every change to tsc_freq would > give some nice races, but ones that are essentially the same as for > changing the timecounter hardware. This gives me an idea for > another implementation: have an array of TSC timecounters with 1 > element for each small shift count, and switch using the > timecounter hardware switch code, and let the user select the > element. 8-) Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 23:45: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 30494106566C; Wed, 8 Jun 2011 23:45:00 +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 0675B8FC15; Wed, 8 Jun 2011 23:45: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 p58NixBH052582; Wed, 8 Jun 2011 23:44:59 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p58NixUl052580; Wed, 8 Jun 2011 23:44:59 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201106082344.p58NixUl052580@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 8 Jun 2011 23:44: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: r222884 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 23:45:00 -0000 Author: jkim Date: Wed Jun 8 23:44:59 2011 New Revision: 222884 URL: http://svn.freebsd.org/changeset/base/222884 Log: Tidy up r222866. - Re-add accidentally removed atomic op. for sysctl(9) handler. - Remove a period(`.') at the end of a debugging message. - Consistently spell "low" for "TSC-low" timecounter throughout. Pointed out by: bde Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Wed Jun 8 21:59:07 2011 (r222883) +++ head/sys/x86/x86/tsc.c Wed Jun 8 23:44:59 2011 (r222884) @@ -80,7 +80,7 @@ static void tsc_freq_changed(void *arg, static void tsc_freq_changing(void *arg, const struct cf_level *level, int *status); static unsigned tsc_get_timecount(struct timecounter *tc); -static unsigned tsc_get_timecount_lowres(struct timecounter *tc); +static unsigned tsc_get_timecount_low(struct timecounter *tc); static void tsc_levels_changed(void *arg, int unit); static struct timecounter tsc_timecounter = { @@ -464,10 +464,10 @@ init: for (shift = 0; shift < 32 && (tsc_freq >> shift) > max_freq; shift++) ; if (shift > 0) { - tsc_timecounter.tc_get_timecount = tsc_get_timecount_lowres; + tsc_timecounter.tc_get_timecount = tsc_get_timecount_low; tsc_timecounter.tc_name = "TSC-low"; if (bootverbose) - printf("TSC timecounter discards lower %d bit(s).\n", + printf("TSC timecounter discards lower %d bit(s)\n", shift); } if (tsc_freq != 0) { @@ -560,8 +560,8 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_A error = sysctl_handle_64(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) { atomic_store_rel_64(&tsc_freq, freq); - tsc_timecounter.tc_frequency = - freq >> (int)(intptr_t)tsc_timecounter.tc_priv; + atomic_store_rel_64(&tsc_timecounter.tc_frequency, + freq >> (int)(intptr_t)tsc_timecounter.tc_priv); } return (error); } @@ -577,7 +577,7 @@ tsc_get_timecount(struct timecounter *tc } static u_int -tsc_get_timecount_lowres(struct timecounter *tc) +tsc_get_timecount_low(struct timecounter *tc) { return (rdtsc() >> (int)(intptr_t)tc->tc_priv); From owner-svn-src-head@FreeBSD.ORG Wed Jun 8 23:54: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 0C516106564A; Wed, 8 Jun 2011 23:54:28 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.vlsi.ee.noda.tus.ac.jp (sekine00.ee.noda.sut.ac.jp [133.31.107.40]) by mx1.freebsd.org (Postfix) with ESMTP id 9EAA18FC0C; Wed, 8 Jun 2011 23:54:27 +0000 (UTC) Received: from alph.allbsd.org (p2237-ipbf904funabasi.chiba.ocn.ne.jp [122.26.37.237]) (user=hrs mech=DIGEST-MD5 bits=128) by mail.vlsi.ee.noda.tus.ac.jp (8.14.4/8.14.4) with ESMTP id p58NsB0d015223 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Jun 2011 08:54:21 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.14.4/8.14.4) with ESMTP id p58Ns99X004748; Thu, 9 Jun 2011 08:54:11 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Thu, 09 Jun 2011 08:54:05 +0900 (JST) Message-Id: <20110609.085405.458609701822925157.hrs@allbsd.org> To: ken@FreeBSD.org From: Hiroki Sato In-Reply-To: <201106082159.p58Lx74l049457@svn.freebsd.org> References: <201106082159.p58Lx74l049457@svn.freebsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.3 on Emacs 23.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Thu_Jun__9_08_54_05_2011_926)--" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.vlsi.ee.noda.tus.ac.jp [133.31.107.40]); Thu, 09 Jun 2011 08:54:21 +0900 (JST) X-Spam-Status: No, score=6.6 required=14.0 tests=BAYES_50, CONTENT_TYPE_PRESENT, QENCPTR1,RCVD_IN_CHINA,RCVD_IN_CHINA_KR,RCVD_IN_PBL,RCVD_IN_RP_RNBL, RCVD_IN_TAIWAN, SPF_SOFTFAIL, X_MAILER_PRESENT autolearn=no version=3.3.1 X-Spam-Level: ****** X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.vlsi.ee.noda.tus.ac.jp Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r222883 - head/sbin/rtsol X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 08 Jun 2011 23:54:28 -0000 ----Security_Multipart(Thu_Jun__9_08_54_05_2011_926)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit "Kenneth D. Merry" wrote in <201106082159.p58Lx74l049457@svn.freebsd.org>: ke> Author: ken ke> Date: Wed Jun 8 21:59:07 2011 ke> New Revision: 222883 ke> URL: http://svn.freebsd.org/changeset/base/222883 ke> ke> Log: ke> Add dump.c to the rtsol build. It is needed now that sec2str is non-static ke> and used in rtsold.c. Thank you for fixing! I forgot to commit changes in the different directory... I'll be careful. -- Hiroki ----Security_Multipart(Thu_Jun__9_08_54_05_2011_926)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAk3wC50ACgkQTyzT2CeTzy2YtQCcDzuXOwcc0Jr0PwjKTWWr2za9 lycAoL60ASp6BpAbtpM2ILQghes2HD9J =7cBD -----END PGP SIGNATURE----- ----Security_Multipart(Thu_Jun__9_08_54_05_2011_926)---- From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 06:09: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 BA5FE106564A; Thu, 9 Jun 2011 06:09:14 +0000 (UTC) (envelope-from gordon@tetlows.org) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 864DD8FC13; Thu, 9 Jun 2011 06:09:14 +0000 (UTC) Received: by pzk27 with SMTP id 27so749953pzk.13 for ; Wed, 08 Jun 2011 23:09:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.199.10 with SMTP id w10mr49105wff.41.1307597862318; Wed, 08 Jun 2011 22:37:42 -0700 (PDT) Received: by 10.143.66.11 with HTTP; Wed, 8 Jun 2011 22:37:42 -0700 (PDT) In-Reply-To: <201106070846.p578kD4K073476@svn.freebsd.org> References: <201106070846.p578kD4K073476@svn.freebsd.org> Date: Wed, 8 Jun 2011 22:37:42 -0700 Message-ID: From: Gordon Tetlow To: Attilio Rao 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: r222813 - in head: . contrib/top gnu/usr.bin/gdb/kgdb lib/libkvm lib/libmemstat share/man/man4 share/mk sys/amd64/acpica sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sy... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 06:09:14 -0000 On Tue, Jun 7, 2011 at 1:46 AM, Attilio Rao wrote: > Author: attilio > Date: Tue Jun =A07 08:46:13 2011 > New Revision: 222813 > URL: http://svn.freebsd.org/changeset/base/222813 > > Log: > =A0etire the cpumask_t type and replace it with cpuset_t usage. snip > Replaced: > =A0head/share/man/man4/geom_map.4 > =A0 =A0 - copied unchanged from r222812, projects/largeSMP/share/man/man4= /geom_map.4 Was there a reason this geom manpage was merged as part of this commit? I don't see it in the commit message. Regards, Gordon From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 06:10: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 B5D1F106564A; Thu, 9 Jun 2011 06:10:41 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5E4A8FC12; Thu, 9 Jun 2011 06:10:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p596Af6f064469; Thu, 9 Jun 2011 06:10:41 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p596Adv1064466; Thu, 9 Jun 2011 06:10:39 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201106090610.p596Adv1064466@svn.freebsd.org> From: Doug Barton Date: Thu, 9 Jun 2011 06:10: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: r222890 - head/games/fortune/datfiles X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 06:10:41 -0000 Author: dougb Date: Thu Jun 9 06:10:39 2011 New Revision: 222890 URL: http://svn.freebsd.org/changeset/base/222890 Log: Minor typo, fix 2 attributions Modified: head/games/fortune/datfiles/fortunes Modified: head/games/fortune/datfiles/fortunes ============================================================================== --- head/games/fortune/datfiles/fortunes Thu Jun 9 05:24:28 2011 (r222889) +++ head/games/fortune/datfiles/fortunes Thu Jun 9 06:10:39 2011 (r222890) @@ -2057,7 +2057,7 @@ promised me faithfully that you'd be bac nine. It just can't take that long to play 18 holes of golf." "Honey, wait," said Harry. "Let me explain. I know what I promised you, but I have a very good reason for being late. Fred and I tee'd off -right on time and everything was find for the first three holes. Then, on +right on time and everything was fine for the first three holes. Then, on the fourth tee Fred had a stroke. I ran back to the clubhouse but couldn't find a doctor. And, by the time I got back to Fred, he was dead. So, for the next 15 holes, it was hit the ball, drag Fred, hit the ball, drag Fred... @@ -25523,7 +25523,9 @@ him, prussic acid could solve our popula % If everybody minded their own business, the world would go around a deal faster. - -- The Duchess, "Through the Looking Glass" + -- The Duchess; Lewis Carroll, + "Through the Looking-Glass, + and What Alice Found There" (1871) % If everything is coming your way then you're in the wrong lane. % @@ -42420,7 +42422,7 @@ in peoples' memories never really happen Some of them want to use you, Some of them want to be used by you, ...Everybody's looking for something. - -- Eurythmics + -- Eurythmics, "Sweet Dreams (Are Made Of This)" % Some of us are becoming the men we wanted to marry. -- Gloria Steinem From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 12:43: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 74CAA106564A; Thu, 9 Jun 2011 12:43:30 +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 329618FC08; Thu, 9 Jun 2011 12:43:30 +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 A9E6C46B42; Thu, 9 Jun 2011 08:43:29 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 36FCC8A01F; Thu, 9 Jun 2011 08:43:29 -0400 (EDT) From: John Baldwin To: Attilio Rao Date: Thu, 9 Jun 2011 08:43:28 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <201106070846.p578kD4K073476@svn.freebsd.org> In-Reply-To: <201106070846.p578kD4K073476@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201106090843.28669.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 09 Jun 2011 08:43:29 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222813 - in head: . contrib/top gnu/usr.bin/gdb/kgdb lib/libkvm lib/libmemstat share/man/man4 share/mk sys/amd64/acpica sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sy... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 12:43:30 -0000 On Tuesday, June 07, 2011 4:46:13 am Attilio Rao wrote: > Author: attilio > Date: Tue Jun 7 08:46:13 2011 > New Revision: 222813 > URL: http://svn.freebsd.org/changeset/base/222813 > > Log: > etire the cpumask_t type and replace it with cpuset_t usage. > > Replaced: > head/share/man/man4/geom_map.4 > - copied unchanged from r222812, projects/largeSMP/share/man/man4/geom_map.4 > head/sys/dev/iicbus/ad7417.c > - copied unchanged from r222812, projects/largeSMP/sys/dev/iicbus/ad7417.c > head/sys/nfs/nfs_kdtrace.h > - copied unchanged from r222812, projects/largeSMP/sys/nfs/nfs_kdtrace.h > head/sys/sys/_stdint.h > - copied unchanged from r222812, projects/largeSMP/sys/sys/_stdint.h > head/tools/build/options/WITHOUT_GPIO > - copied unchanged from r222812, projects/largeSMP/tools/build/options/WITHOUT_GPIO > head/tools/build/options/WITH_OFED > - copied unchanged from r222812, projects/largeSMP/tools/build/options/WITH_OFED > head/tools/regression/bin/sh/builtins/set1.0 > - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/builtins/set1.0 > head/tools/regression/bin/sh/parser/dollar-quote1.0 > - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote1.0 > head/tools/regression/bin/sh/parser/dollar-quote2.0 > - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote2.0 > head/tools/regression/bin/sh/parser/dollar-quote3.0 > - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote3.0 > head/tools/regression/bin/sh/parser/dollar-quote4.0 > - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote4.0 > head/tools/regression/bin/sh/parser/dollar-quote5.0 > - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote5.0 > head/tools/regression/bin/sh/parser/dollar-quote6.0 > - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote6.0 > head/tools/regression/bin/sh/parser/dollar-quote7.0 > - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote7.0 > head/tools/regression/bin/sh/parser/dollar-quote8.0 > - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote8.0 > head/tools/regression/bin/sh/parser/dollar-quote9.0 > - copied unchanged from r222812, projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote9.0 It would appear that svn destroyed the history on all these files. I suspect svn merge --reintegrate is too broken to be used safely and should probably not be used in the future until/unless svn fixes it to not suck. I suspect this is related to the manual fixups Attilio did in the largeSMP branch for merges that didn't quite work right (I know sys/_stdint.h was one such file) and that the manual fixups confused svn when it came time to do the merge. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 16:30: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 38B061065670; Thu, 9 Jun 2011 16:30:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F6C08FC13; Thu, 9 Jun 2011 16:30: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 p59GUDKb086253; Thu, 9 Jun 2011 16:30:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p59GUDGP086251; Thu, 9 Jun 2011 16:30:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201106091630.p59GUDGP086251@svn.freebsd.org> From: Alexander Motin Date: Thu, 9 Jun 2011 16:30: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: r222897 - head/sys/dev/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, 09 Jun 2011 16:30:14 -0000 Author: mav Date: Thu Jun 9 16:30:13 2011 New Revision: 222897 URL: http://svn.freebsd.org/changeset/base/222897 Log: Intel NM10 chipset's SATA controller has same PCI ID and revision as ICH7's, but has only 2 SATA ports instead of 4. The worst part is that SStatus and SError registers for missing ports are not implemented and return wrong values (0xffffffff), that caused infinite reset loop. Just ignore that SError value while I found no better way to identify them. Modified: head/sys/dev/ata/ata-sata.c Modified: head/sys/dev/ata/ata-sata.c ============================================================================== --- head/sys/dev/ata/ata-sata.c Thu Jun 9 11:54:11 2011 (r222896) +++ head/sys/dev/ata/ata-sata.c Thu Jun 9 16:30:13 2011 (r222897) @@ -54,6 +54,11 @@ ata_sata_phy_check_events(device_t dev, u_int32_t error, status; ata_sata_scr_read(ch, port, ATA_SERROR, &error); + + /* Check that SError value is sane. */ + if (error == 0xffffffff) + return; + /* Clear set error bits/interrupt. */ if (error) ata_sata_scr_write(ch, port, ATA_SERROR, error); @@ -163,18 +168,18 @@ ata_sata_phy_reset(device_t dev, int por if (bootverbose) { if (port < 0) { - device_printf(dev, "hardware reset ...\n"); + device_printf(dev, "hard reset ...\n"); } else { - device_printf(dev, "p%d: hardware reset ...\n", port); + device_printf(dev, "p%d: hard reset ...\n", port); } } for (retry = 0; retry < 10; retry++) { for (loop = 0; loop < 10; loop++) { if (ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_RESET)) - return (0); + goto fail; ata_udelay(100); if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) - return (0); + goto fail; if ((val & ATA_SC_DET_MASK) == ATA_SC_DET_RESET) break; } @@ -183,15 +188,26 @@ ata_sata_phy_reset(device_t dev, int por if (ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_IDLE | ((ch->pm_level > 0) ? 0 : ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER))) - return (0); + goto fail; ata_udelay(100); if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) - return (0); + goto fail; if ((val & ATA_SC_DET_MASK) == 0) return ata_sata_connect(ch, port, 0); } } - return 0; +fail: + /* Clear SATA error register. */ + ata_sata_scr_write(ch, port, ATA_SERROR, 0xffffffff); + + if (bootverbose) { + if (port < 0) { + device_printf(dev, "hard reset failed\n"); + } else { + device_printf(dev, "p%d: hard reset failed\n", port); + } + } + return (0); } int From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 16:48: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 20F08106564A; Thu, 9 Jun 2011 16:48:32 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 945738FC0A; Thu, 9 Jun 2011 16:48:31 +0000 (UTC) Received: by gxk28 with SMTP id 28so1304979gxk.13 for ; Thu, 09 Jun 2011 09:48:30 -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=k6mb48bYiHALS2PNfvmwr0Y6CjVdXc/uMi4PhvEVlDc=; b=Mdnr8PLKTyWmnESURwTkCyAjFoHHrCtdTdeeUyY1pv97RPrQ6uVdW1KnDxxlljNo8e ffIzGIj3Upb8RHssL6unoD4CIGFrcwAghJ8zrEvX6mVdIgc2/v02YDVW8cy8JoulqRxf P12CyOLk6jtwfZe0SJ9/NHEdykLp1nGf0kHXI= 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=iBvnA8N0CxnJeER+mQo5lBatSCPdYQo6zL8ZOuGFgh2IGjKjHVqUVgyTlUR6ebAaty REy0irKP1alOIyCx5aLr7SeZiT0IRu8BsLK0QG1/Hbozvt7TpF0Hoeu6YW1AeohL11bk 1bzjNheAF3y7CS8tdao87a9jTrO4/Y/KxDaFE= MIME-Version: 1.0 Received: by 10.236.109.19 with SMTP id r19mr1232364yhg.289.1307638110787; Thu, 09 Jun 2011 09:48:30 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.67.81 with HTTP; Thu, 9 Jun 2011 09:48:30 -0700 (PDT) In-Reply-To: <201106090843.28669.jhb@freebsd.org> References: <201106070846.p578kD4K073476@svn.freebsd.org> <201106090843.28669.jhb@freebsd.org> Date: Thu, 9 Jun 2011 12:48:30 -0400 X-Google-Sender-Auth: R5o6ewcDSsAQjftdn-wXzN1SVQQ Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222813 - in head: . contrib/top gnu/usr.bin/gdb/kgdb lib/libkvm lib/libmemstat share/man/man4 share/mk sys/amd64/acpica sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sy... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 16:48:32 -0000 2011/6/9 John Baldwin : > On Tuesday, June 07, 2011 4:46:13 am Attilio Rao wrote: >> Author: attilio >> Date: Tue Jun =C2=A07 08:46:13 2011 >> New Revision: 222813 >> URL: http://svn.freebsd.org/changeset/base/222813 >> >> Log: >> =C2=A0 etire the cpumask_t type and replace it with cpuset_t usage. >> >> Replaced: >> =C2=A0 head/share/man/man4/geom_map.4 >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/share/man/man4/geom_map.4 >> =C2=A0 head/sys/dev/iicbus/ad7417.c >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/sys/dev/iicbus/ad7417.c >> =C2=A0 head/sys/nfs/nfs_kdtrace.h >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/sys/nfs/nfs_kdtrace.h >> =C2=A0 head/sys/sys/_stdint.h >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, projects/largeSMP/s= ys/sys/_stdint.h >> =C2=A0 head/tools/build/options/WITHOUT_GPIO >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/build/options/WITHOUT_GPIO >> =C2=A0 head/tools/build/options/WITH_OFED >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/build/options/WITH_OFED >> =C2=A0 head/tools/regression/bin/sh/builtins/set1.0 >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/regression/bin/sh/builtins/set1.0 >> =C2=A0 head/tools/regression/bin/sh/parser/dollar-quote1.0 >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote1.0 >> =C2=A0 head/tools/regression/bin/sh/parser/dollar-quote2.0 >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote2.0 >> =C2=A0 head/tools/regression/bin/sh/parser/dollar-quote3.0 >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote3.0 >> =C2=A0 head/tools/regression/bin/sh/parser/dollar-quote4.0 >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote4.0 >> =C2=A0 head/tools/regression/bin/sh/parser/dollar-quote5.0 >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote5.0 >> =C2=A0 head/tools/regression/bin/sh/parser/dollar-quote6.0 >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote6.0 >> =C2=A0 head/tools/regression/bin/sh/parser/dollar-quote7.0 >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote7.0 >> =C2=A0 head/tools/regression/bin/sh/parser/dollar-quote8.0 >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote8.0 >> =C2=A0 head/tools/regression/bin/sh/parser/dollar-quote9.0 >> =C2=A0 =C2=A0 =C2=A0- copied unchanged from r222812, > projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote9.0 > > It would appear that svn destroyed the history on all these files. =C2=A0= I suspect > svn merge --reintegrate is too broken to be used safely and should probab= ly > not be used in the future until/unless svn fixes it to not suck. That was suggested by re@ officials, so I can't really argue :) What would you use instead? the "write me" option? > I suspect this is related to the manual fixups Attilio did in the largeSM= P > branch for merges that didn't quite work right (I know sys/_stdint.h was = one > such file) and that the manual fixups confused svn when it came time to d= o > the merge. BINGO John, I completely forgot about it, but that may be the cause. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 17:25: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 87F551065670; Thu, 9 Jun 2011 17:25:20 +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 527FA8FC08; Thu, 9 Jun 2011 17:25:20 +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 p59HPKj9054209 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 9 Jun 2011 11:25:20 -0600 (MDT) (envelope-from gibbs@FreeBSD.org) Message-ID: <4DF101F9.4020600@FreeBSD.org> Date: Thu, 09 Jun 2011 11:25: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: "Andrey V. Elsukov" References: <201105031854.p43IsIJ5006816@svn.freebsd.org> In-Reply-To: <201105031854.p43IsIJ5006816@svn.freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (aslan.scsiguy.com [70.89.174.89]); Thu, 09 Jun 2011 11:25:20 -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 Subject: Re: svn commit: r221397 - 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: Thu, 09 Jun 2011 17:25:20 -0000 On 5/3/11 12:54 PM, Andrey V. Elsukov wrote: > Author: ae > Date: Tue May 3 18:54:18 2011 > New Revision: 221397 > URL: http://svn.freebsd.org/changeset/base/221397 > > Log: > Add make_dev_alias_p() function. It is similar to make_dev_alias(), > but it may return an error like make_dev_p() does. Sorry for the late reply on this change. I noticed it during some recent merge activity at work where my make_dev_credv() conflicted with your make_dev_cred_v(). It seems that the existing convention in this file for "function variants" is to append a single letter to the function name without an underscore (e.g. make_dev_credv, make_dev_credf). make_dev_alias_v() and make_dev_p(), break this convention. It would be nice to clean up this API so that the naming conventions are consistent. So which should it be? Underscore or no underscore? -- Justin From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 17:42:51 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id CDDF3106566B; Thu, 9 Jun 2011 17:42:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: Andriy Gapon Date: Thu, 9 Jun 2011 13:42:21 -0400 User-Agent: KMail/1.6.2 References: <201106062303.p56N3cjs053024@svn.freebsd.org> <201106071545.02850.jkim@FreeBSD.org> <4DEF13DF.4090103@FreeBSD.org> In-Reply-To: <4DEF13DF.4090103@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106091342.41548.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r222795 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 17:42:51 -0000 On Wednesday 08 June 2011 02:17 am, Andriy Gapon wrote: > on 07/06/2011 22:45 Jung-uk Kim said the following: > > On Tuesday 07 June 2011 03:31 pm, Jung-uk Kim wrote: > >> On Tuesday 07 June 2011 03:08 pm, Andriy Gapon wrote: > >>> on 07/06/2011 21:02 John Baldwin said the following: > >>>> On Tuesday, June 07, 2011 11:39:26 am Jung-uk Kim wrote: > >>>>> On Tuesday 07 June 2011 09:52 am, John Baldwin wrote: > >>>>> The whole point of this commit is to blacklist *recent* BIOS > >>>>> (or CSM) from probing keyboard typematic information, more > >>>>> specifically, recent Intel chipset platforms. They don't > >>>>> support many INT 15h/16h functions but only cause trouble at > >>>>> best. OTOH, I haven't seen such problems with AMD chipset > >>>>> systems and they all seem to have traditional entry points at > >>>>> the interrupt vector table, for example. > >>>> > >>>> Err, but you didn't blacklist recent BIOS. You blacklist > >>>> _all_ BIOS that use entry points other than the ones from the > >>>> UEFI spec, including BIOSes that don't claim to support UEFI > >>>> and the BIOS from the two systems I quoted. > >>> > >>> I'd like to simply add two datapoints: > >>> 1) recent AMD system: > >>> > >>> $ dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd > >>> 00000000 59 f8 00 f0 2e e8 00 f0 > >> > >> Yes, that's exactly what I am seeing from all of my AMD systems > >> and a 11-year old Pentium III system. > >> > >>> 2) very old PIIX/440BX system (manufactured ~1999): > >>> $ dd if=/dev/mem bs=4 iseek=0x15 count=2 | hd > >>> 00000000 9a 06 b8 9c 2e e8 00 f0 > >> > >> INT 15h is relocated under 0xa0000, i.e., "highmem". Are you > >> using non-FreeBSD chain loader? > > Ah, yes, it's a diskless boot using gpxe. Installing custom BIOS services on conventional memory and replacing INT 15h vector (to reserve the page or to hide itself from e820h subfunction queries), was a very widely used technique back then, for TSRs and boot loaders (and for virii). :-) > > Do you have "relocate to highmem" option > > > >> in the BIOS configuration? > > > > Sorry, it's actually under 640KB in conventional memory. It must > > be done by TSR or boot loader. Ah, good ol'days... :-P > > > >> Most importantly, does it support keyboard typematic feature? > > At least there is a BIOS option for setting it. If you don't use the pixie boot loader, then the interrupt vector will be back to normal, I guess. Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 17:55: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 7B19E1065674; Thu, 9 Jun 2011 17:55:19 +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 4DD108FC1A; Thu, 9 Jun 2011 17:55:19 +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 F1E0C46B4C; Thu, 9 Jun 2011 13:55:18 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 878928A02B; Thu, 9 Jun 2011 13:55:18 -0400 (EDT) From: John Baldwin To: Attilio Rao Date: Thu, 9 Jun 2011 13:52:04 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <201106070846.p578kD4K073476@svn.freebsd.org> <201106090843.28669.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201106091352.04738.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 09 Jun 2011 13:55:18 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222813 - in head: . contrib/top gnu/usr.bin/gdb/kgdb lib/libkvm lib/libmemstat share/man/man4 share/mk sys/amd64/acpica sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sy... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 17:55:19 -0000 On Thursday, June 09, 2011 12:48:30 pm Attilio Rao wrote: > 2011/6/9 John Baldwin : > > On Tuesday, June 07, 2011 4:46:13 am Attilio Rao wrote: > >> Author: attilio > >> Date: Tue Jun 7 08:46:13 2011 > >> New Revision: 222813 > >> URL: http://svn.freebsd.org/changeset/base/222813 > >> > > It would appear that svn destroyed the history on all these files. I suspect > > svn merge --reintegrate is too broken to be used safely and should probably > > not be used in the future until/unless svn fixes it to not suck. > > That was suggested by re@ officials, so I can't really argue :) Well, I don't think it has blown up in the past, so at the time that recommendation was probably fine. > What would you use instead? the "write me" option? svn diff | patch (basically what folks do for branches in p4). I'm not sure if svn stat would have shown an unusual state for these files after the svn merge. If so perhaps we could just recommend that folks check for that and fall back to diff | patch if they notice those sorts of problems instead. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 17:57: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 06D95106566B; Thu, 9 Jun 2011 17:57:32 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 748628FC14; Thu, 9 Jun 2011 17:57:31 +0000 (UTC) Received: by gxk28 with SMTP id 28so1352545gxk.13 for ; Thu, 09 Jun 2011 10:57:30 -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=QyTf4BkZMVALMsK5UEdBglDsz4rvmETktkqsuaVo2bY=; b=MS5RPeYrCMmHSyXjQuWV+74YRFJbETvtoV9Lo76dUzo4fcFPuCAZ9Ig7APVu/inM1M /0gsyrbscjWE3WAvUDWxclUcPMV0rzaUubyn3J2O/giQKCnQY1kXukL+7g8D/sqUKnPT zO57ikMuLn+8zzauetIQr6bKSSoDGhF0YL3qM= 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=GNpuT35+34xJtgVkCYqiCpSVxE2xGhuBqLww1thgU3TotygTZWnUCZhycg2D+gIv0S DJrn8mlGTsiG7xORXvmz4RkLEAbKcOfZkAa3npFVx6IUPzpyuIXMoyuBbC7aZ02uB5rt Jm97bKzTvyvjejrowm/QoRIYJxd285gPRiGRI= MIME-Version: 1.0 Received: by 10.236.201.129 with SMTP id b1mr1620571yho.88.1307642250449; Thu, 09 Jun 2011 10:57:30 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.67.81 with HTTP; Thu, 9 Jun 2011 10:57:30 -0700 (PDT) In-Reply-To: <201106091352.04738.jhb@freebsd.org> References: <201106070846.p578kD4K073476@svn.freebsd.org> <201106090843.28669.jhb@freebsd.org> <201106091352.04738.jhb@freebsd.org> Date: Thu, 9 Jun 2011 13:57:30 -0400 X-Google-Sender-Auth: ImxR0W1c3vJENMmamJ3ZoLeZv7U Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222813 - in head: . contrib/top gnu/usr.bin/gdb/kgdb lib/libkvm lib/libmemstat share/man/man4 share/mk sys/amd64/acpica sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sy... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 17:57:32 -0000 2011/6/9 John Baldwin : > On Thursday, June 09, 2011 12:48:30 pm Attilio Rao wrote: >> 2011/6/9 John Baldwin : >> > On Tuesday, June 07, 2011 4:46:13 am Attilio Rao wrote: >> >> Author: attilio >> >> Date: Tue Jun =C2=A07 08:46:13 2011 >> >> New Revision: 222813 >> >> URL: http://svn.freebsd.org/changeset/base/222813 >> >> >> > It would appear that svn destroyed the history on all these files. =C2= =A0I suspect >> > svn merge --reintegrate is too broken to be used safely and should pro= bably >> > not be used in the future until/unless svn fixes it to not suck. >> >> That was suggested by re@ officials, so I can't really argue :) > > Well, I don't think it has blown up in the past, so at the time that > recommendation was probably fine. > >> What would you use instead? the "write me" option? > > svn diff | patch (basically what folks do for branches in p4). > > I'm not sure if svn stat would have shown an unusual state for these file= s > after the svn merge. =C2=A0If so perhaps we could just recommend that fol= ks check > for that and fall back to diff | patch if they notice those sorts of prob= lems > instead. I did svn status on the branch and didn't actually find anything, if it can help. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 18:40: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 909B2106566C; Thu, 9 Jun 2011 18:40: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 67C048FC17; Thu, 9 Jun 2011 18:40: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 1D89546B4C; Thu, 9 Jun 2011 14:40:37 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AF0D18A01F; Thu, 9 Jun 2011 14:40:36 -0400 (EDT) From: John Baldwin To: gibbs@freebsd.org Date: Thu, 9 Jun 2011 14:40:35 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <201105031854.p43IsIJ5006816@svn.freebsd.org> <4DF101F9.4020600@FreeBSD.org> In-Reply-To: <4DF101F9.4020600@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201106091440.36182.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 09 Jun 2011 14:40:36 -0400 (EDT) Cc: svn-src-head@freebsd.org, "Andrey V. Elsukov" , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221397 - 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, 09 Jun 2011 18:40:37 -0000 On Thursday, June 09, 2011 1:25:13 pm Justin T. Gibbs wrote: > On 5/3/11 12:54 PM, Andrey V. Elsukov wrote: > > Author: ae > > Date: Tue May 3 18:54:18 2011 > > New Revision: 221397 > > URL: http://svn.freebsd.org/changeset/base/221397 > > > > Log: > > Add make_dev_alias_p() function. It is similar to make_dev_alias(), > > but it may return an error like make_dev_p() does. > > Sorry for the late reply on this change. I noticed it during some recent > merge activity at work where my make_dev_credv() conflicted with your > make_dev_cred_v(). > > It seems that the existing convention in this file for "function variants" > is to append a single letter to the function name without an underscore > (e.g. make_dev_credv, make_dev_credf). make_dev_alias_v() and make_dev_p(), > break this convention. It would be nice to clean up this API so that > the naming conventions are consistent. So which should it be? Underscore > or no underscore? Hmm, could we take advantage of 9 being an API "breaking point" to simplify the API back down so there are fewer variants perhaps? Maybe we could make the 'flags' argument to make_dev() mandatory and change make_dev and make_dev_alias to always use the _p semantics (return an error and use a parameter to optionally return the new cdev)? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 18:50: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 85308106564A; Thu, 9 Jun 2011 18:50:13 +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 F3BB28FC12; Thu, 9 Jun 2011 18:50:11 +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 VAA15505; Thu, 09 Jun 2011 21:50:09 +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 1QUkIz-000Lmo-HI; Thu, 09 Jun 2011 21:50:09 +0300 Message-ID: <4DF115DF.4020501@FreeBSD.org> Date: Thu, 09 Jun 2011 21:50:07 +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: John Baldwin References: <201106070846.p578kD4K073476@svn.freebsd.org> <201106090843.28669.jhb@freebsd.org> <201106091352.04738.jhb@freebsd.org> In-Reply-To: <201106091352.04738.jhb@freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Attilio Rao , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r222813 - in head: . contrib/top gnu/usr.bin/gdb/kgdb lib/libkvm lib/libmemstat share/man/man4 share/mk sys/amd64/acpica sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sy... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 18:50:13 -0000 on 09/06/2011 20:52 John Baldwin said the following: > svn diff | patch (basically what folks do for branches in p4). svn diff doesn't always produce a diff suitable for patch. I remember having to do diff -r... between two svn checkouts. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 19:00: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 0FE54106566C; Thu, 9 Jun 2011 19:00:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D819C8FC0A; Thu, 9 Jun 2011 19:00:33 +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 8B48E46B0A; Thu, 9 Jun 2011 15:00:33 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 179438A01F; Thu, 9 Jun 2011 15:00:33 -0400 (EDT) From: John Baldwin To: Andriy Gapon Date: Thu, 9 Jun 2011 15:00:32 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <201106070846.p578kD4K073476@svn.freebsd.org> <201106091352.04738.jhb@freebsd.org> <4DF115DF.4020501@FreeBSD.org> In-Reply-To: <4DF115DF.4020501@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201106091500.32540.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 09 Jun 2011 15:00:33 -0400 (EDT) Cc: Attilio Rao , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222813 - in head: . contrib/top gnu/usr.bin/gdb/kgdb lib/libkvm lib/libmemstat share/man/man4 share/mk sys/amd64/acpica sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sy... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 19:00:34 -0000 On Thursday, June 09, 2011 2:50:07 pm Andriy Gapon wrote: > on 09/06/2011 20:52 John Baldwin said the following: > > svn diff | patch (basically what folks do for branches in p4). > > svn diff doesn't always produce a diff suitable for patch. > I remember having to do diff -r... between two svn checkouts. Hmm, I think an svn diff between two URLs will generally DTRT though, but you'll want your branch up to date to reduce noise in the diff. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 19:35: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 5839F106564A; Thu, 9 Jun 2011 19:35:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 14F208FC0C; Thu, 9 Jun 2011 19:35:34 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:2dae:f11:a41a:c0fe] (unknown [IPv6:2001:7b8:3a7:0:2dae:f11:a41a:c0fe]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 20ADE5C37; Thu, 9 Jun 2011 21:35:33 +0200 (CEST) Message-ID: <4DF12081.5050504@FreeBSD.org> Date: Thu, 09 Jun 2011 21:35:29 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18pre) Gecko/20110527 Lanikai/3.1.11pre MIME-Version: 1.0 To: John Baldwin References: <201106070846.p578kD4K073476@svn.freebsd.org> <201106091352.04738.jhb@freebsd.org> <4DF115DF.4020501@FreeBSD.org> <201106091500.32540.jhb@freebsd.org> In-Reply-To: <201106091500.32540.jhb@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Attilio Rao , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r222813 - in head: . contrib/top gnu/usr.bin/gdb/kgdb lib/libkvm lib/libmemstat share/man/man4 share/mk sys/amd64/acpica sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sy... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 19:35:34 -0000 On 2011-06-09 21:00, John Baldwin wrote: > On Thursday, June 09, 2011 2:50:07 pm Andriy Gapon wrote: >> on 09/06/2011 20:52 John Baldwin said the following: >>> svn diff | patch (basically what folks do for branches in p4). >> >> svn diff doesn't always produce a diff suitable for patch. >> I remember having to do diff -r... between two svn checkouts. > > Hmm, I think an svn diff between two URLs will generally DTRT though, > but you'll want your branch up to date to reduce noise in the diff. One problem is that svn diff does *not* expand $FreeBSD$ keywords, so feeding these diffs to patch usually leads to at least a few failed hunks. :) From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 19:47: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 58AA7106564A; Thu, 9 Jun 2011 19:47:31 +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 490BD8FC15; Thu, 9 Jun 2011 19:47:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p59JlVEE092225; Thu, 9 Jun 2011 19:47:31 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p59JlVsS092223; Thu, 9 Jun 2011 19:47:31 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106091947.p59JlVsS092223@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 9 Jun 2011 19:47:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222898 - 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, 09 Jun 2011 19:47:31 -0000 Author: nwhitehorn Date: Thu Jun 9 19:47:30 2011 New Revision: 222898 URL: http://svn.freebsd.org/changeset/base/222898 Log: Add -Wa,-many to CFLAGS on PowerPC. This aids in building a kernel using clang, which would otherwise complain about some 64-bit bridge mode instructions. Modified: head/sys/conf/Makefile.powerpc Modified: head/sys/conf/Makefile.powerpc ============================================================================== --- head/sys/conf/Makefile.powerpc Thu Jun 9 16:30:13 2011 (r222897) +++ head/sys/conf/Makefile.powerpc Thu Jun 9 19:47:30 2011 (r222898) @@ -35,7 +35,7 @@ LDSCRIPT_NAME?= ldscript.${MACHINE_ARCH} INCLUDES+= -I$S/contrib/libfdt -CFLAGS+= -msoft-float +CFLAGS+= -msoft-float -Wa,-many DDB_ENABLED!= grep DDB opt_ddb.h || true .if !empty(DDB_ENABLED) From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 19: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 4538C1065676; Thu, 9 Jun 2011 19:52: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 34A548FC12; Thu, 9 Jun 2011 19:52: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 p59JqTWX092409; Thu, 9 Jun 2011 19:52:29 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p59JqTqA092401; Thu, 9 Jun 2011 19:52:29 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201106091952.p59JqTqA092401@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 9 Jun 2011 19:52: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: r222899 - head/usr.sbin/mfiutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jun 2011 19:52:29 -0000 Author: bz Date: Thu Jun 9 19:52:28 2011 New Revision: 222899 URL: http://svn.freebsd.org/changeset/base/222899 Log: Contrary to when returning in all-good cases at the end of functions we did not free memory (1) or close the file descriptor (2) in error cases. Reported by: Mark Johnston (1) Reported by: attilio (2) Reviewed by: jhb Sponsored by: Sandvine Incorporated MFC after: 1 week Modified: head/usr.sbin/mfiutil/mfi_config.c head/usr.sbin/mfiutil/mfi_drive.c head/usr.sbin/mfiutil/mfi_evt.c head/usr.sbin/mfiutil/mfi_flash.c head/usr.sbin/mfiutil/mfi_patrol.c head/usr.sbin/mfiutil/mfi_show.c head/usr.sbin/mfiutil/mfi_volume.c Modified: head/usr.sbin/mfiutil/mfi_config.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_config.c Thu Jun 9 19:47:30 2011 (r222898) +++ head/usr.sbin/mfiutil/mfi_config.c Thu Jun 9 19:52:28 2011 (r222899) @@ -85,6 +85,7 @@ mfi_config_read(int fd, struct mfi_confi { struct mfi_config_data *config; uint32_t config_size; + int error; /* * Keep fetching the config in a loop until we have a large enough @@ -97,8 +98,12 @@ fetch: if (config == NULL) return (-1); if (mfi_dcmd_command(fd, MFI_DCMD_CFG_READ, config, - config_size, NULL, 0, NULL) < 0) + config_size, NULL, 0, NULL) < 0) { + error = errno; + free(config); + errno = error; return (-1); + } if (config->size > config_size) { config_size = config->size; @@ -162,12 +167,14 @@ clear_config(int ac, char **av) if (!mfi_reconfig_supported()) { warnx("The current mfi(4) driver does not support " "configuration changes."); + close(fd); return (EOPNOTSUPP); } if (mfi_ld_get_list(fd, &list, NULL) < 0) { error = errno; warn("Failed to get volume list"); + close(fd); return (error); } @@ -175,6 +182,7 @@ clear_config(int ac, char **av) if (mfi_volume_busy(fd, list.ld_list[i].ld.v.target_id)) { warnx("Volume %s is busy and cannot be deleted", mfi_volume_name(fd, list.ld_list[i].ld.v.target_id)); + close(fd); return (EBUSY); } } @@ -185,12 +193,14 @@ clear_config(int ac, char **av) ch = getchar(); if (ch != 'y' && ch != 'Y') { printf("\nAborting\n"); + close(fd); return (0); } if (mfi_dcmd_command(fd, MFI_DCMD_CFG_CLEAR, NULL, 0, NULL, 0, NULL) < 0) { error = errno; warn("Failed to clear configuration"); + close(fd); return (error); } @@ -336,17 +346,21 @@ parse_array(int fd, int raid_type, char for (pinfo = info->drives; (cp = strsep(&array_str, ",")) != NULL; pinfo++) { error = mfi_lookup_drive(fd, cp, &device_id); - if (error) + if (error) { + free(info->drives); return (error); + } if (mfi_pd_get_info(fd, device_id, pinfo, NULL) < 0) { error = errno; warn("Failed to fetch drive info for drive %s", cp); + free(info->drives); return (error); } if (pinfo->fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) { warnx("Drive %u is not available", device_id); + free(info->drives); return (EINVAL); } } @@ -551,7 +565,12 @@ create_volume(int ac, char **av) return (EINVAL); } - + bzero(&state, sizeof(state)); + config = NULL; + arrays = NULL; + narrays = 0; + error = 0; + fd = mfi_open(mfi_unit); if (fd < 0) { error = errno; @@ -562,7 +581,8 @@ create_volume(int ac, char **av) if (!mfi_reconfig_supported()) { warnx("The current mfi(4) driver does not support " "configuration changes."); - return (EOPNOTSUPP); + error = EOPNOTSUPP; + goto error; } /* Lookup the RAID type first. */ @@ -575,7 +595,8 @@ create_volume(int ac, char **av) if (raid_type == -1) { warnx("Unknown or unsupported volume type %s", av[1]); - return (EINVAL); + error = EINVAL; + goto error; } /* Parse any options. */ @@ -603,7 +624,8 @@ create_volume(int ac, char **av) break; case '?': default: - return (EINVAL); + error = EINVAL; + goto error; } } ac -= optind; @@ -613,7 +635,8 @@ create_volume(int ac, char **av) narrays = ac; if (narrays == 0) { warnx("At least one drive list is required"); - return (EINVAL); + error = EINVAL; + goto error; } switch (raid_type) { case RT_RAID0: @@ -623,7 +646,8 @@ create_volume(int ac, char **av) case RT_CONCAT: if (narrays != 1) { warnx("Only one drive list can be specified"); - return (EINVAL); + error = EINVAL; + goto error; } break; case RT_RAID10: @@ -632,24 +656,27 @@ create_volume(int ac, char **av) if (narrays < 1) { warnx("RAID10, RAID50, and RAID60 require at least " "two drive lists"); - return (EINVAL); + error = EINVAL; + goto error; } if (narrays > MFI_MAX_SPAN_DEPTH) { warnx("Volume spans more than %d arrays", MFI_MAX_SPAN_DEPTH); - return (EINVAL); + error = EINVAL; + goto error; } break; } arrays = calloc(narrays, sizeof(*arrays)); if (arrays == NULL) { warnx("malloc failed"); - return (ENOMEM); + error = ENOMEM; + goto error; } for (i = 0; i < narrays; i++) { error = parse_array(fd, raid_type, av[i], &arrays[i]); if (error) - return (error); + goto error; } switch (raid_type) { @@ -660,7 +687,8 @@ create_volume(int ac, char **av) if (arrays[i].drive_count != arrays[0].drive_count) { warnx("All arrays must contain the same " "number of drives"); - return (EINVAL); + error = EINVAL; + goto error; } } break; @@ -673,7 +701,7 @@ create_volume(int ac, char **av) if (mfi_config_read(fd, &config) < 0) { error = errno; warn("Failed to read configuration"); - return (error); + goto error; } p = (char *)config->array; state.array_ref = 0xffff; @@ -683,7 +711,8 @@ create_volume(int ac, char **av) state.arrays = calloc(config->array_count, sizeof(int)); if (state.arrays == NULL) { warnx("malloc failed"); - return (ENOMEM); + error = ENOMEM; + goto error; } for (i = 0; i < config->array_count; i++) { ar = (struct mfi_array *)p; @@ -699,7 +728,8 @@ create_volume(int ac, char **av) state.volumes = calloc(config->log_drv_count, sizeof(int)); if (state.volumes == NULL) { warnx("malloc failed"); - return (ENOMEM); + error = ENOMEM; + goto error; } for (i = 0; i < config->log_drv_count; i++) { ld = (struct mfi_ld_config *)p; @@ -739,7 +769,8 @@ create_volume(int ac, char **av) config = calloc(1, config_size); if (config == NULL) { warnx("malloc failed"); - return (ENOMEM); + error = ENOMEM; + goto error; } config->size = config_size; config->array_count = narrays; @@ -776,21 +807,20 @@ create_volume(int ac, char **av) NULL, 0, NULL) < 0) { error = errno; warn("Failed to add volume"); - return (error); + /* FALLTHROUGH */ } +error: /* Clean up. */ free(config); - if (state.log_drv_count > 0) - free(state.volumes); - if (state.array_count > 0) - free(state.arrays); + free(state.volumes); + free(state.arrays); for (i = 0; i < narrays; i++) free(arrays[i].drives); free(arrays); close(fd); - return (0); + return (error); } MFI_COMMAND(top, create, create_volume); @@ -831,24 +861,28 @@ delete_volume(int ac, char **av) if (!mfi_reconfig_supported()) { warnx("The current mfi(4) driver does not support " "configuration changes."); + close(fd); return (EOPNOTSUPP); } if (mfi_lookup_volume(fd, av[1], &target_id) < 0) { error = errno; warn("Invalid volume %s", av[1]); + close(fd); return (error); } if (mfi_ld_get_info(fd, target_id, &info, NULL) < 0) { error = errno; warn("Failed to get info for volume %d", target_id); + close(fd); return (error); } if (mfi_volume_busy(fd, target_id)) { warnx("Volume %s is busy and cannot be deleted", mfi_volume_name(fd, target_id)); + close(fd); return (EBUSY); } @@ -857,6 +891,7 @@ delete_volume(int ac, char **av) sizeof(mbox), NULL) < 0) { error = errno; warn("Failed to delete volume"); + close(fd); return (error); } @@ -891,40 +926,44 @@ add_spare(int ac, char **av) return (error); } + config = NULL; + spare = NULL; error = mfi_lookup_drive(fd, av[1], &device_id); if (error) - return (error); + goto error; if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { error = errno; warn("Failed to fetch drive info"); - return (error); + goto error; } if (info.fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) { warnx("Drive %u is not available", device_id); - return (EINVAL); + error = EINVAL; + goto error; } if (ac > 2) { if (mfi_lookup_volume(fd, av[2], &target_id) < 0) { error = errno; warn("Invalid volume %s", av[2]); - return (error); + goto error; } } if (mfi_config_read(fd, &config) < 0) { error = errno; warn("Failed to read configuration"); - return (error); + goto error; } spare = malloc(sizeof(struct mfi_spare) + sizeof(uint16_t) * config->array_count); if (spare == NULL) { warnx("malloc failed"); - return (ENOMEM); + error = ENOMEM; + goto error; } bzero(spare, sizeof(struct mfi_spare)); spare->ref = info.ref; @@ -937,7 +976,8 @@ add_spare(int ac, char **av) if (ar->size > info.coerced_size) { warnx("Spare isn't large enough for array %u", ar->array_ref); - return (EINVAL); + error = EINVAL; + goto error; } p += config->array_size; } @@ -950,7 +990,8 @@ add_spare(int ac, char **av) ld = mfi_config_lookup_volume(config, target_id); if (ld == NULL) { warnx("Did not find volume %d", target_id); - return (EINVAL); + error = EINVAL; + goto error; } spare->spare_type |= MFI_SPARE_DEDICATED; @@ -960,29 +1001,33 @@ add_spare(int ac, char **av) ld->span[i].array_ref); if (ar == NULL) { warnx("Missing array; inconsistent config?"); - return (ENXIO); + error = ENXIO; + goto error; } if (ar->size > info.coerced_size) { warnx("Spare isn't large enough for array %u", ar->array_ref); - return (EINVAL); + error = EINVAL; + goto error; } spare->array_ref[i] = ar->array_ref; } } - free(config); if (mfi_dcmd_command(fd, MFI_DCMD_CFG_MAKE_SPARE, spare, sizeof(struct mfi_spare) + sizeof(uint16_t) * spare->array_count, NULL, 0, NULL) < 0) { error = errno; warn("Failed to assign spare"); - return (error); + /* FALLTHROUGH. */ } +error: + free(spare); + free(config); close(fd); - return (0); + return (error); } MFI_COMMAND(top, add, add_spare); @@ -1007,18 +1052,22 @@ remove_spare(int ac, char **av) } error = mfi_lookup_drive(fd, av[1], &device_id); - if (error) + if (error) { + close(fd); return (error); + } /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { error = errno; warn("Failed to fetch info for drive %u", device_id); + close(fd); return (error); } if (info.fw_state != MFI_PD_STATE_HOT_SPARE) { warnx("Drive %u is not a hot spare", device_id); + close(fd); return (EINVAL); } @@ -1027,6 +1076,7 @@ remove_spare(int ac, char **av) sizeof(mbox), NULL) < 0) { error = errno; warn("Failed to delete spare"); + close(fd); return (error); } @@ -1151,6 +1201,7 @@ debug_config(int ac, char **av) if (mfi_config_read(fd, &config) < 0) { error = errno; warn("Failed to get config"); + close(fd); return (error); } @@ -1190,17 +1241,21 @@ dump(int ac, char **av) warn("Failed to read debug command"); if (error == ENOENT) error = EOPNOTSUPP; + close(fd); return (error); } config = malloc(len); if (config == NULL) { warnx("malloc failed"); + close(fd); return (ENOMEM); } if (sysctlbyname(buf, config, &len, NULL, 0) < 0) { error = errno; warn("Failed to read debug command"); + free(config); + close(fd); return (error); } dump_config(fd, config); Modified: head/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_drive.c Thu Jun 9 19:47:30 2011 (r222898) +++ head/usr.sbin/mfiutil/mfi_drive.c Thu Jun 9 19:52:28 2011 (r222899) @@ -310,19 +310,23 @@ drive_set_state(char *drive, uint16_t ne } error = mfi_lookup_drive(fd, drive, &device_id); - if (error) + if (error) { + close(fd); return (error); + } /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { error = errno; warn("Failed to fetch info for drive %u", device_id); + close(fd); return (error); } /* Try to change the state. */ if (info.fw_state == new_state) { warnx("Drive %u is already in the desired state", device_id); + close(fd); return (EINVAL); } @@ -334,6 +338,7 @@ drive_set_state(char *drive, uint16_t ne error = errno; warn("Failed to set drive %u to %s", device_id, mfi_pdstate(new_state)); + close(fd); return (error); } @@ -406,19 +411,23 @@ start_rebuild(int ac, char **av) } error = mfi_lookup_drive(fd, av[1], &device_id); - if (error) + if (error) { + close(fd); return (error); + } /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { error = errno; warn("Failed to fetch info for drive %u", device_id); + close(fd); return (error); } /* Check the state, must be REBUILD. */ if (info.fw_state != MFI_PD_STATE_REBUILD) { warnx("Drive %d is not in the REBUILD state", device_id); + close(fd); return (EINVAL); } @@ -428,6 +437,7 @@ start_rebuild(int ac, char **av) NULL) < 0) { error = errno; warn("Failed to start rebuild on drive %u", device_id); + close(fd); return (error); } close(fd); @@ -458,19 +468,23 @@ abort_rebuild(int ac, char **av) } error = mfi_lookup_drive(fd, av[1], &device_id); - if (error) + if (error) { + close(fd); return (error); + } /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { error = errno; warn("Failed to fetch info for drive %u", device_id); + close(fd); return (error); } /* Check the state, must be REBUILD. */ if (info.fw_state != MFI_PD_STATE_REBUILD) { warn("Drive %d is not in the REBUILD state", device_id); + close(fd); return (EINVAL); } @@ -480,6 +494,7 @@ abort_rebuild(int ac, char **av) NULL) < 0) { error = errno; warn("Failed to abort rebuild on drive %u", device_id); + close(fd); return (error); } close(fd); @@ -509,13 +524,16 @@ drive_progress(int ac, char **av) } error = mfi_lookup_drive(fd, av[1], &device_id); - if (error) + if (error) { + close(fd); return (error); + } /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { error = errno; warn("Failed to fetch info for drive %u", device_id); + close(fd); return (error); } close(fd); @@ -570,13 +588,16 @@ drive_clear(int ac, char **av) } error = mfi_lookup_drive(fd, av[1], &device_id); - if (error) + if (error) { + close(fd); return (error); + } /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { error = errno; warn("Failed to fetch info for drive %u", device_id); + close(fd); return (error); } @@ -586,6 +607,7 @@ drive_clear(int ac, char **av) warn("Failed to %s clear on drive %u", opcode == MFI_DCMD_PD_CLEAR_START ? "start" : "stop", device_id); + close(fd); return (error); } @@ -626,8 +648,10 @@ drive_locate(int ac, char **av) } error = mfi_lookup_drive(fd, av[1], &device_id); - if (error) + if (error) { + close(fd); return (error); + } mbox_store_device_id(&mbox[0], device_id); @@ -638,6 +662,7 @@ drive_locate(int ac, char **av) warn("Failed to %s locate on drive %u", opcode == MFI_DCMD_PD_LOCATE_START ? "start" : "stop", device_id); + close(fd); return (error); } close(fd); Modified: head/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_evt.c Thu Jun 9 19:47:30 2011 (r222898) +++ head/usr.sbin/mfiutil/mfi_evt.c Thu Jun 9 19:52:28 2011 (r222899) @@ -83,6 +83,7 @@ show_logstate(int ac, char **av) if (mfi_event_get_info(fd, &info, NULL) < 0) { error = errno; warn("Failed to get event log info"); + close(fd); return (error); } @@ -550,6 +551,7 @@ show_events(int ac, char **av) if (mfi_event_get_info(fd, &info, NULL) < 0) { error = errno; warn("Failed to get event log info"); + close(fd); return (error); } @@ -570,6 +572,7 @@ show_events(int ac, char **av) if (parse_class(optarg, &filter.members.evt_class) < 0) { error = errno; warn("Error parsing event class"); + close(fd); return (error); } break; @@ -577,6 +580,7 @@ show_events(int ac, char **av) if (parse_locale(optarg, &filter.members.locale) < 0) { error = errno; warn("Error parsing event locale"); + close(fd); return (error); } break; @@ -584,6 +588,7 @@ show_events(int ac, char **av) val = strtol(optarg, &cp, 0); if (*cp != '\0' || val <= 0) { warnx("Invalid event count"); + close(fd); return (EINVAL); } num_events = val; @@ -593,6 +598,7 @@ show_events(int ac, char **av) break; case '?': default: + close(fd); return (EINVAL); } } @@ -604,28 +610,33 @@ show_events(int ac, char **av) (num_events - 1); if (size > getpagesize()) { warnx("Event count is too high"); + close(fd); return (EINVAL); } /* Handle optional start and stop sequence numbers. */ if (ac > 2) { warnx("show events: extra arguments"); + close(fd); return (EINVAL); } if (ac > 0 && parse_seq(&info, av[0], &start) < 0) { error = errno; warn("Error parsing starting sequence number"); + close(fd); return (error); } if (ac > 1 && parse_seq(&info, av[1], &stop) < 0) { error = errno; warn("Error parsing ending sequence number"); + close(fd); return (error); } list = malloc(size); if (list == NULL) { warnx("malloc failed"); + close(fd); return (ENOMEM); } for (seq = start;;) { @@ -633,6 +644,8 @@ show_events(int ac, char **av) &status) < 0) { error = errno; warn("Failed to fetch events"); + free(list); + close(fd); return (error); } if (status == MFI_STAT_NOT_FOUND) { @@ -642,6 +655,8 @@ show_events(int ac, char **av) } if (status != MFI_STAT_OK) { warnx("Error fetching events: %s", mfi_status(status)); + free(list); + close(fd); return (EIO); } Modified: head/usr.sbin/mfiutil/mfi_flash.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_flash.c Thu Jun 9 19:47:30 2011 (r222898) +++ head/usr.sbin/mfiutil/mfi_flash.c Thu Jun 9 19:52:28 2011 (r222899) @@ -136,21 +136,25 @@ flash_adapter(int ac, char **av) return (error); } + buf = NULL; + fd = -1; + if (fstat(flash, &sb) < 0) { error = errno; warn("fstat(%s)", av[1]); - return (error); + goto error; } if (sb.st_size % 1024 != 0 || sb.st_size > 0x7fffffff) { warnx("Invalid flash file size"); - return (EINVAL); + error = EINVAL; + goto error; } fd = mfi_open(mfi_unit); if (fd < 0) { error = errno; warn("mfi_open"); - return (error); + goto error; } /* First, ask the firmware to allocate space for the flash file. */ @@ -158,14 +162,16 @@ flash_adapter(int ac, char **av) mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_OPEN, NULL, 0, mbox, 4, &status); if (status != MFI_STAT_OK) { warnx("Failed to alloc flash memory: %s", mfi_status(status)); - return (EIO); + error = EIO; + goto error; } /* Upload the file 64k at a time. */ buf = malloc(FLASH_BUF_SIZE); if (buf == NULL) { warnx("malloc failed"); - return (ENOMEM); + error = ENOMEM; + goto error; } offset = 0; while (sb.st_size > 0) { @@ -174,7 +180,8 @@ flash_adapter(int ac, char **av) warnx("Bad read from flash file"); mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_CLOSE, NULL, 0, NULL, 0, NULL); - return (ENXIO); + error = ENXIO; + goto error; } mbox_store_word(mbox, offset); @@ -184,12 +191,12 @@ flash_adapter(int ac, char **av) warnx("Flash download failed: %s", mfi_status(status)); mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_CLOSE, NULL, 0, NULL, 0, NULL); - return (ENXIO); + error = ENXIO; + goto error; } sb.st_size -= nread; offset += nread; } - close(flash); /* Kick off the flash. */ printf("WARNING: Firmware flash in progress, do not reboot machine... "); @@ -198,12 +205,17 @@ flash_adapter(int ac, char **av) NULL, 0, &status); if (status != MFI_STAT_OK) { printf("failed:\n\t%s\n", mfi_status(status)); - return (ENXIO); + error = ENXIO; + goto error; } printf("finished\n"); error = display_pending_firmware(fd); - close(fd); +error: + free(buf); + if (fd >= 0) + close(fd); + close(flash); return (error); } Modified: head/usr.sbin/mfiutil/mfi_patrol.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_patrol.c Thu Jun 9 19:47:30 2011 (r222898) +++ head/usr.sbin/mfiutil/mfi_patrol.c Thu Jun 9 19:52:28 2011 (r222899) @@ -96,8 +96,10 @@ show_patrol(int ac, char **av) time(&now); mfi_get_time(fd, &at); error = patrol_get_props(fd, &prop); - if (error) + if (error) { + close(fd); return (error); + } printf("Operation Mode: "); switch (prop.op_mode) { case MFI_PR_OPMODE_AUTO: @@ -128,6 +130,7 @@ show_patrol(int ac, char **av) sizeof(status), NULL, 0, NULL) < 0) { error = errno; warn("Failed to get patrol read properties"); + close(fd); return (error); } printf("Runs Completed: %u\n", status.num_iteration); @@ -153,6 +156,7 @@ show_patrol(int ac, char **av) if (mfi_pd_get_list(fd, &list, NULL) < 0) { error = errno; warn("Failed to get drive list"); + close(fd); return (error); } @@ -165,6 +169,8 @@ show_patrol(int ac, char **av) error = errno; warn("Failed to fetch info for drive %u", list->addr[i].device_id); + free(list); + close(fd); return (error); } if (info.prog_info.active & MFI_PD_PROGRESS_PATROL) { @@ -174,6 +180,7 @@ show_patrol(int ac, char **av) &info.prog_info.patrol); } } + free(list); } close(fd); @@ -198,6 +205,7 @@ start_patrol(int ac, char **av) 0) { error = errno; warn("Failed to start patrol read"); + close(fd); return (error); } @@ -223,6 +231,7 @@ stop_patrol(int ac, char **av) 0) { error = errno; warn("Failed to stop patrol read"); + close(fd); return (error); } @@ -289,8 +298,10 @@ patrol_config(int ac, char **av) } error = patrol_get_props(fd, &prop); - if (error) + if (error) { + close(fd); return (error); + } prop.op_mode = op_mode; if (op_mode == MFI_PR_OPMODE_AUTO) { if (ac > 2) @@ -298,8 +309,10 @@ patrol_config(int ac, char **av) if (ac > 3) { time(&now); mfi_get_time(fd, &at); - if (at == 0) + if (at == 0) { + close(fd); return (ENXIO); + } prop.next_exec = at + next_exec; printf("Starting next patrol read at %s", adapter_time(now, at, prop.next_exec)); @@ -309,6 +322,7 @@ patrol_config(int ac, char **av) sizeof(prop), NULL, 0, NULL) < 0) { error = errno; warn("Failed to set patrol read properties"); + close(fd); return (error); } Modified: head/usr.sbin/mfiutil/mfi_show.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_show.c Thu Jun 9 19:47:30 2011 (r222898) +++ head/usr.sbin/mfiutil/mfi_show.c Thu Jun 9 19:52:28 2011 (r222899) @@ -71,6 +71,7 @@ show_adapter(int ac, char **av) if (mfi_ctrl_get_info(fd, &info, NULL) < 0) { error = errno; warn("Failed to get controller info"); + close(fd); return (error); } printf("mfi%d Adapter:\n", mfi_unit); @@ -158,10 +159,12 @@ show_battery(int ac, char **av) sizeof(cap), NULL, 0, &status) < 0) { if (status == MFI_STAT_NO_HW_PRESENT) { printf("mfi%d: No battery present\n", mfi_unit); + close(fd); return (0); } error = errno; warn("Failed to get capacity info"); + close(fd); return (error); } @@ -169,6 +172,7 @@ show_battery(int ac, char **av) sizeof(design), NULL, 0, NULL) < 0) { error = errno; warn("Failed to get design info"); + close(fd); return (error); } @@ -176,6 +180,7 @@ show_battery(int ac, char **av) NULL, 0, NULL) < 0) { error = errno; warn("Failed to get status"); + close(fd); return (error); } @@ -308,6 +313,7 @@ show_config(int ac, char **av) if (mfi_config_read(fd, &config) < 0) { error = errno; warn("Failed to get config"); + close(fd); return (error); } @@ -376,6 +382,7 @@ show_config(int ac, char **av) printf("\n"); p += config->spares_size; } + free(config); close(fd); return (0); @@ -406,6 +413,7 @@ show_volumes(int ac, char **av) if (mfi_ld_get_list(fd, &list, NULL) < 0) { error = errno; warn("Failed to get volume list"); + close(fd); return (error); } @@ -431,6 +439,7 @@ show_volumes(int ac, char **av) error = errno; warn("Failed to get info for volume %d", list.ld_list[i].ld.v.target_id); + close(fd); return (error); } printf("%6s ", @@ -483,10 +492,11 @@ show_drives(int ac, char **av) return (error); } + list = NULL; if (mfi_pd_get_list(fd, &list, NULL) < 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 20:21: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 483A9106564A; Thu, 9 Jun 2011 20:21:46 +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 370CF8FC1B; Thu, 9 Jun 2011 20:21: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 p59KLkO0093306; Thu, 9 Jun 2011 20:21:46 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p59KLkNl093301; Thu, 9 Jun 2011 20:21:46 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201106092021.p59KLkNl093301@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 9 Jun 2011 20:21: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: r222900 - in head/tools/tools: . cxgbetool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 20:21:46 -0000 Author: np Date: Thu Jun 9 20:21:45 2011 New Revision: 222900 URL: http://svn.freebsd.org/changeset/base/222900 Log: cxgbetool: a tool for the cxgbe(4) driver. Added: head/tools/tools/cxgbetool/ head/tools/tools/cxgbetool/Makefile (contents, props changed) head/tools/tools/cxgbetool/cxgbetool.c (contents, props changed) head/tools/tools/cxgbetool/reg_defs_t4.c (contents, props changed) head/tools/tools/cxgbetool/reg_defs_t4vf.c (contents, props changed) Modified: head/tools/tools/README Modified: head/tools/tools/README ============================================================================== --- head/tools/tools/README Thu Jun 9 19:52:28 2011 (r222899) +++ head/tools/tools/README Thu Jun 9 20:21:45 2011 (r222900) @@ -16,6 +16,7 @@ cfi Common Flash Interface (CFI) tool commitsdb A tool for reconstructing commit history using md5 checksums of the commit logs. crypto Test and exercise tools related to the crypto framework +cxgbetool A tool for the cxgbe(4) driver. diffburst OBSOLETE: equivalent functionality is available via split -p. For example: "split -p ^diff < patchfile". See split(1). editing Editor modes and the like to help editing FreeBSD code. Added: head/tools/tools/cxgbetool/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/cxgbetool/Makefile Thu Jun 9 20:21:45 2011 (r222900) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PROG= cxgbetool +SRCS= cxgbetool.c +NO_MAN= +CFLAGS+= -I${.CURDIR}/../../../sys/dev/cxgbe -I. +BINDIR?= /usr/sbin + +.include Added: head/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/cxgbetool/cxgbetool.c Thu Jun 9 20:21:45 2011 (r222900) @@ -0,0 +1,1218 @@ +/*- + * Copyright (c) 2011 Chelsio Communications, Inc. + * All rights reserved. + * Written by: Navdeep Parhar + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "t4_ioctl.h" + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + +static const char *progname, *nexus; + +struct reg_info { + const char *name; + uint32_t addr; + uint32_t len; +}; + +struct mod_regs { + const char *name; + const struct reg_info *ri; +}; + +#include "reg_defs_t4.c" +#include "reg_defs_t4vf.c" + +static void +usage(FILE *fp) +{ + fprintf(fp, "Usage: %s [operation]\n", progname); + fprintf(fp, + "\tfilter [ ] ... set a filter\n" + "\tfilter delete|clear delete a filter\n" + "\tfilter list list all filters\n" + "\tfilter mode [] ... get/set global filter mode\n" + "\treg
[=] read/write register\n" + "\treg64
[=] read/write 64 bit register\n" + "\tregdump [] ... dump registers\n" + "\tstdio interactive mode\n" + ); +} + +static inline unsigned int +get_card_vers(unsigned int version) +{ + return (version & 0x3ff); +} + +static int +real_doit(unsigned long cmd, void *data, const char *cmdstr) +{ + static int fd = -1; + int rc = 0; + + if (fd == -1) { + char buf[64]; + + snprintf(buf, sizeof(buf), "/dev/%s", nexus); + if ((fd = open(buf, O_RDWR)) < 0) { + warn("open(%s)", nexus); + rc = errno; + return (rc); + } + } + + rc = ioctl(fd, cmd, data); + if (rc < 0) { + warn("%s", cmdstr); + rc = errno; + } + + return (rc); +} +#define doit(x, y) real_doit(x, y, #x) + +static char * +str_to_number(const char *s, long *val, long long *vall) +{ + char *p; + + if (vall) + *vall = strtoll(s, &p, 0); + else if (val) + *val = strtol(s, &p, 0); + else + p = NULL; + + return (p); +} + +static int +read_reg(long addr, int size, long long *val) +{ + struct t4_reg reg; + int rc; + + reg.addr = (uint32_t) addr; + reg.size = (uint32_t) size; + reg.val = 0; + + rc = doit(CHELSIO_T4_GETREG, ®); + + *val = reg.val; + + return (rc); +} + +static int +write_reg(long addr, int size, long long val) +{ + struct t4_reg reg; + + reg.addr = (uint32_t) addr; + reg.size = (uint32_t) size; + reg.val = (uint64_t) val; + + return doit(CHELSIO_T4_SETREG, ®); +} + +static int +register_io(int argc, const char *argv[], int size) +{ + char *p, *v; + long addr; + long long val; + int w = 0, rc; + + if (argc == 1) { + /* OR = */ + + p = str_to_number(argv[0], &addr, NULL); + if (*p) { + if (*p != '=') { + warnx("invalid register \"%s\"", argv[0]); + return (EINVAL); + } + + w = 1; + v = p + 1; + p = str_to_number(v, NULL, &val); + + if (*p) { + warnx("invalid value \"%s\"", v); + return (EINVAL); + } + } + + } else if (argc == 2) { + /* */ + + w = 1; + + p = str_to_number(argv[0], &addr, NULL); + if (*p) { + warnx("invalid register \"%s\"", argv[0]); + return (EINVAL); + } + + p = str_to_number(argv[1], NULL, &val); + if (*p) { + warnx("invalid value \"%s\"", argv[1]); + return (EINVAL); + } + } else { + warnx("reg: invalid number of arguments (%d)", argc); + return (EINVAL); + } + + if (w) + rc = write_reg(addr, size, val); + else { + rc = read_reg(addr, size, &val); + if (rc == 0) + printf("0x%llx [%llu]\n", val, val); + } + + return (rc); +} + +static inline uint32_t +xtract(uint32_t val, int shift, int len) +{ + return (val >> shift) & ((1 << len) - 1); +} + +static int +dump_block_regs(const struct reg_info *reg_array, const uint32_t *regs) +{ + uint32_t reg_val = 0; + + for ( ; reg_array->name; ++reg_array) + if (!reg_array->len) { + reg_val = regs[reg_array->addr / 4]; + printf("[%#7x] %-47s %#-10x %u\n", reg_array->addr, + reg_array->name, reg_val, reg_val); + } else { + uint32_t v = xtract(reg_val, reg_array->addr, + reg_array->len); + + printf(" %*u:%u %-47s %#-10x %u\n", + reg_array->addr < 10 ? 3 : 2, + reg_array->addr + reg_array->len - 1, + reg_array->addr, reg_array->name, v, v); + } + + return (1); +} + +static int +dump_regs_table(int argc, const char *argv[], const uint32_t *regs, + const struct mod_regs *modtab, int nmodules) +{ + int i, j, match; + + for (i = 0; i < argc; i++) { + for (j = 0; j < nmodules; j++) { + if (!strcmp(argv[i], modtab[j].name)) + break; + } + + if (j == nmodules) { + warnx("invalid register block \"%s\"", argv[i]); + fprintf(stderr, "\nAvailable blocks:"); + for ( ; nmodules; nmodules--, modtab++) + fprintf(stderr, " %s", modtab->name); + fprintf(stderr, "\n"); + return (EINVAL); + } + } + + for ( ; nmodules; nmodules--, modtab++) { + + match = argc == 0 ? 1 : 0; + for (i = 0; !match && i < argc; i++) { + if (!strcmp(argv[i], modtab->name)) + match = 1; + } + + if (match) + dump_block_regs(modtab->ri, regs); + } + + return (0); +} + +#define T4_MODREGS(name) { #name, t4_##name##_regs } +static int +dump_regs_t4(int argc, const char *argv[], const uint32_t *regs) +{ + static struct mod_regs t4_mod[] = { + T4_MODREGS(sge), + { "pci", t4_pcie_regs }, + T4_MODREGS(dbg), + T4_MODREGS(mc), + T4_MODREGS(ma), + { "edc0", t4_edc_0_regs }, + { "edc1", t4_edc_1_regs }, + T4_MODREGS(cim), + T4_MODREGS(tp), + T4_MODREGS(ulp_rx), + T4_MODREGS(ulp_tx), + { "pmrx", t4_pm_rx_regs }, + { "pmtx", t4_pm_tx_regs }, + T4_MODREGS(mps), + { "cplsw", t4_cpl_switch_regs }, + T4_MODREGS(smb), + { "i2c", t4_i2cm_regs }, + T4_MODREGS(mi), + T4_MODREGS(uart), + T4_MODREGS(pmu), + T4_MODREGS(sf), + T4_MODREGS(pl), + T4_MODREGS(le), + T4_MODREGS(ncsi), + T4_MODREGS(xgmac) + }; + + return dump_regs_table(argc, argv, regs, t4_mod, ARRAY_SIZE(t4_mod)); +} +#undef T4_MODREGS + +static int +dump_regs_t4vf(int argc, const char *argv[], const uint32_t *regs) +{ + static struct mod_regs t4vf_mod[] = { + { "sge", t4vf_sge_regs }, + { "mps", t4vf_mps_regs }, + { "pl", t4vf_pl_regs }, + { "mbdata", t4vf_mbdata_regs }, + { "cim", t4vf_cim_regs }, + }; + + return dump_regs_table(argc, argv, regs, t4vf_mod, + ARRAY_SIZE(t4vf_mod)); +} + +static int +dump_regs(int argc, const char *argv[]) +{ + int vers, revision, is_pcie, rc; + struct t4_regdump regs; + + regs.data = calloc(1, T4_REGDUMP_SIZE); + if (regs.data == NULL) { + warnc(ENOMEM, "regdump"); + return (ENOMEM); + } + + regs.len = T4_REGDUMP_SIZE; + rc = doit(CHELSIO_T4_REGDUMP, ®s); + if (rc != 0) + return (rc); + + vers = get_card_vers(regs.version); + revision = (regs.version >> 10) & 0x3f; + is_pcie = (regs.version & 0x80000000) != 0; + + if (vers == 4) { + if (revision == 0x3f) + rc = dump_regs_t4vf(argc, argv, regs.data); + else + rc = dump_regs_t4(argc, argv, regs.data); + } else { + warnx("%s (type %d, rev %d) is not a T4 card.", + nexus, vers, revision); + return (ENOTSUP); + } + + free(regs.data); + return (rc); +} + +static void +do_show_info_header(uint32_t mode) +{ + uint32_t i; + + printf ("%4s %8s", "Idx", "Hits"); + for (i = T4_FILTER_FCoE; i <= T4_FILTER_IP_FRAGMENT; i <<= 1) { + switch (mode & i) { + case T4_FILTER_FCoE: + printf (" FCoE"); + break; + + case T4_FILTER_PORT: + printf (" Port"); + break; + + case T4_FILTER_OVLAN: + printf (" vld:oVLAN"); + break; + + case T4_FILTER_IVLAN: + printf (" vld:iVLAN"); + break; + + case T4_FILTER_IP_TOS: + printf (" TOS"); + break; + + case T4_FILTER_IP_PROTO: + printf (" Prot"); + break; + + case T4_FILTER_ETH_TYPE: + printf (" EthType"); + break; + + case T4_FILTER_MAC_IDX: + printf (" MACIdx"); + break; + + case T4_FILTER_MPS_HIT_TYPE: + printf (" MPS"); + break; + + case T4_FILTER_IP_FRAGMENT: + printf (" Frag"); + break; + + default: + /* compressed filter field not enabled */ + break; + } + } + printf(" %20s %20s %9s %9s %s\n", + "DIP", "SIP", "DPORT", "SPORT", "Action"); +} + +/* + * Parse an argument sub-vector as a { [:] } + * ordered tuple. If the parameter name in the argument sub-vector does not + * match the passed in parameter name, then a zero is returned for the + * function and no parsing is performed. If there is a match, then the value + * and optional mask are parsed and returned in the provided return value + * pointers. If no optional mask is specified, then a default mask of all 1s + * will be returned. + * + * An error in parsing the value[:mask] will result in an error message and + * program termination. + */ +static int +parse_val_mask(const char *param, const char *args[], uint32_t *val, + uint32_t *mask) +{ + char *p; + + if (strcmp(param, args[0]) != 0) + return (EINVAL); + + *val = strtoul(args[1], &p, 0); + if (p > args[1]) { + if (p[0] == 0) { + *mask = ~0; + return (0); + } + + if (p[0] == ':' && p[1] != 0) { + *mask = strtoul(p+1, &p, 0); + if (p[0] == 0) + return (0); + } + } + + warnx("parameter \"%s\" has bad \"value[:mask]\" %s", + args[0], args[1]); + + return (EINVAL); +} + +/* + * Parse an argument sub-vector as a { [/] } + * ordered tuple. If the parameter name in the argument sub-vector does not + * match the passed in parameter name, then a zero is returned for the + * function and no parsing is performed. If there is a match, then the value + * and optional mask are parsed and returned in the provided return value + * pointers. If no optional mask is specified, then a default mask of all 1s + * will be returned. + * + * The value return parameter "afp" is used to specify the expected address + * family -- IPv4 or IPv6 -- of the address[/mask] and return its actual + * format. A passed in value of AF_UNSPEC indicates that either IPv4 or IPv6 + * is acceptable; AF_INET means that only IPv4 addresses are acceptable; and + * AF_INET6 means that only IPv6 are acceptable. AF_INET is returned for IPv4 + * and AF_INET6 for IPv6 addresses, respectively. IPv4 address/mask pairs are + * returned in the first four bytes of the address and mask return values with + * the address A.B.C.D returned with { A, B, C, D } returned in addresses { 0, + * 1, 2, 3}, respectively. + * + * An error in parsing the value[:mask] will result in an error message and + * program termination. + */ +static int +parse_ipaddr(const char *param, const char *args[], int *afp, uint8_t addr[], + uint8_t mask[]) +{ + const char *colon, *afn; + char *slash; + uint8_t *m; + int af, ret; + unsigned int masksize; + + /* + * Is this our parameter? + */ + if (strcmp(param, args[0]) != 0) + return (EINVAL); + + /* + * Fundamental IPv4 versus IPv6 selection. + */ + colon = strchr(args[1], ':'); + if (!colon) { + afn = "IPv4"; + af = AF_INET; + masksize = 32; + } else { + afn = "IPv6"; + af = AF_INET6; + masksize = 128; + } + if (*afp == AF_UNSPEC) + *afp = af; + else if (*afp != af) { + warnx("address %s is not of expected family %s", + args[1], *afp == AF_INET ? "IP" : "IPv6"); + return (EINVAL); + } + + /* + * Parse address (temporarily stripping off any "/mask" + * specification). + */ + slash = strchr(args[1], '/'); + if (slash) + *slash = 0; + ret = inet_pton(af, args[1], addr); + if (slash) + *slash = '/'; + if (ret <= 0) { + warnx("Cannot parse %s %s address %s", param, afn, args[1]); + return (EINVAL); + } + + /* + * Parse optional mask specification. + */ + if (slash) { + char *p; + unsigned int prefix = strtoul(slash + 1, &p, 10); + + if (p == slash + 1) { + warnx("missing address prefix for %s", param); + return (EINVAL); + } + if (*p) { + warnx("%s is not a valid address prefix", slash + 1); + return (EINVAL); + } + if (prefix > masksize) { + warnx("prefix %u is too long for an %s address", + prefix, afn); + return (EINVAL); + } + memset(mask, 0, masksize / 8); + masksize = prefix; + } + + /* + * Fill in mask. + */ + for (m = mask; masksize >= 8; m++, masksize -= 8) + *m = ~0; + if (masksize) + *m = ~0 << (8 - masksize); + + return (0); +} + +/* + * Parse an argument sub-vector as a { } ordered + * tuple. If the parameter name in the argument sub-vector does not match the + * passed in parameter name, then a zero is returned for the function and no + * parsing is performed. If there is a match, then the value is parsed and + * returned in the provided return value pointer. + */ +static int +parse_val(const char *param, const char *args[], uint32_t *val) +{ + char *p; + + if (strcmp(param, args[0]) != 0) + return (EINVAL); + + *val = strtoul(args[1], &p, 0); + if (p > args[1] && p[0] == 0) + return (0); + + warnx("parameter \"%s\" has bad \"value\" %s", args[0], args[1]); + return (EINVAL); +} + +static void +filters_show_ipaddr(int type, uint8_t *addr, uint8_t *addrm) +{ + int noctets, octet; + + printf(" "); + if (type == 0) { + noctets = 4; + printf("%3s", " "); + } else + noctets = 16; + + for (octet = 0; octet < noctets; octet++) + printf("%02x", addr[octet]); + printf("/"); + for (octet = 0; octet < noctets; octet++) + printf("%02x", addrm[octet]); +} + +static void +do_show_one_filter_info(struct t4_filter *t, uint32_t mode) +{ + uint32_t i; + + printf("%4d", t->idx); + if (t->hits == UINT64_MAX) + printf(" %8s", "-"); + else + printf(" %8ju", t->hits); + + /* + * Compressed header portion of filter. + */ + for (i = T4_FILTER_FCoE; i <= T4_FILTER_IP_FRAGMENT; i <<= 1) { + switch (mode & i) { + case T4_FILTER_FCoE: + printf(" %1d/%1d", t->fs.val.fcoe, t->fs.mask.fcoe); + break; + + case T4_FILTER_PORT: + printf(" %1d/%1d", t->fs.val.iport, t->fs.mask.iport); + break; + + case T4_FILTER_OVLAN: + printf(" %1d:%1x:%02x/%1d:%1x:%02x", + t->fs.val.ovlan_vld, (t->fs.val.ovlan >> 7) & 0x7, + t->fs.val.ovlan & 0x7f, t->fs.mask.ovlan_vld, + (t->fs.mask.ovlan >> 7) & 0x7, + t->fs.mask.ovlan & 0x7f); + break; + + case T4_FILTER_IVLAN: + printf(" %1d:%04x/%1d:%04x", + t->fs.val.ivlan_vld, t->fs.val.ivlan, + t->fs.mask.ivlan_vld, t->fs.mask.ivlan); + break; + + case T4_FILTER_IP_TOS: + printf(" %02x/%02x", t->fs.val.tos, t->fs.mask.tos); + break; + + case T4_FILTER_IP_PROTO: + printf(" %02x/%02x", t->fs.val.proto, t->fs.mask.proto); + break; + + case T4_FILTER_ETH_TYPE: + printf(" %04x/%04x", t->fs.val.ethtype, + t->fs.mask.ethtype); + break; + + case T4_FILTER_MAC_IDX: + printf(" %03x/%03x", t->fs.val.macidx, + t->fs.mask.macidx); + break; + + case T4_FILTER_MPS_HIT_TYPE: + printf(" %1x/%1x", t->fs.val.matchtype, + t->fs.mask.matchtype); + break; + + case T4_FILTER_IP_FRAGMENT: + printf(" %1d/%1d", t->fs.val.frag, t->fs.mask.frag); + break; + + default: + /* compressed filter field not enabled */ + break; + } + } + + /* + * Fixed portion of filter. + */ + filters_show_ipaddr(t->fs.type, t->fs.val.dip, t->fs.mask.dip); + filters_show_ipaddr(t->fs.type, t->fs.val.sip, t->fs.mask.sip); + printf(" %04x/%04x %04x/%04x", + t->fs.val.dport, t->fs.mask.dport, + t->fs.val.sport, t->fs.mask.sport); + + /* + * Variable length filter action. + */ + if (t->fs.action == FILTER_DROP) + printf(" Drop"); + else if (t->fs.action == FILTER_SWITCH) { + printf(" Switch: port=%d", t->fs.eport); + if (t->fs.newdmac) + printf( + ", dmac=%02x:%02x:%02x:%02x:%02x:%02x " + ", l2tidx=%d", + t->fs.dmac[0], t->fs.dmac[1], + t->fs.dmac[2], t->fs.dmac[3], + t->fs.dmac[4], t->fs.dmac[5], + t->l2tidx); + if (t->fs.newsmac) + printf( + ", smac=%02x:%02x:%02x:%02x:%02x:%02x " + ", smtidx=%d", + t->fs.smac[0], t->fs.smac[1], + t->fs.smac[2], t->fs.smac[3], + t->fs.smac[4], t->fs.smac[5], + t->smtidx); + if (t->fs.newvlan == VLAN_REMOVE) + printf(", vlan=none"); + else if (t->fs.newvlan == VLAN_INSERT) + printf(", vlan=insert(%x)", t->fs.vlan); + else if (t->fs.newvlan == VLAN_REWRITE) + printf(", vlan=rewrite(%x)", t->fs.vlan); + } else { + printf(" Pass: Q="); + if (t->fs.dirsteer == 0) { + printf("RSS"); + if (t->fs.maskhash) + printf("(TCB=hash)"); + } else { + printf("%d", t->fs.iq); + if (t->fs.dirsteerhash == 0) + printf("(QID)"); + else + printf("(hash)"); + } + } + if (t->fs.prio) + printf(" Prio"); + if (t->fs.rpttid) + printf(" RptTID"); + printf("\n"); +} + +static int +show_filters(void) +{ + uint32_t mode = 0, header = 0; + struct t4_filter t; + int rc; + + /* Get the global filter mode first */ + rc = doit(CHELSIO_T4_GET_FILTER_MODE, &mode); + if (rc != 0) + return (rc); + + t.idx = 0; + for (t.idx = 0; ; t.idx++) { + rc = doit(CHELSIO_T4_GET_FILTER, &t); + if (rc != 0 || t.idx == 0xffffffff) + break; + + if (!header) { + do_show_info_header(mode); + header = 1; + } + do_show_one_filter_info(&t, mode); + }; + + return (rc); +} + +static int +get_filter_mode(void) +{ + uint32_t mode = 0; + int rc; + + rc = doit(CHELSIO_T4_GET_FILTER_MODE, &mode); + if (rc != 0) + return (rc); + + if (mode & T4_FILTER_IPv4) + printf("ipv4 "); + + if (mode & T4_FILTER_IPv6) + printf("ipv6 "); + + if (mode & T4_FILTER_IP_SADDR) + printf("sip "); + + if (mode & T4_FILTER_IP_DADDR) + printf("dip "); + + if (mode & T4_FILTER_IP_SPORT) + printf("sport "); + + if (mode & T4_FILTER_IP_DPORT) + printf("dport "); + + if (mode & T4_FILTER_MPS_HIT_TYPE) + printf("matchtype "); + + if (mode & T4_FILTER_MAC_IDX) + printf("macidx "); + + if (mode & T4_FILTER_ETH_TYPE) + printf("ethtype "); + + if (mode & T4_FILTER_IP_PROTO) + printf("proto "); + + if (mode & T4_FILTER_IP_TOS) + printf("tos "); + + if (mode & T4_FILTER_IVLAN) + printf("ivlan "); + + if (mode & T4_FILTER_OVLAN) + printf("ovlan "); + + if (mode & T4_FILTER_PORT) + printf("iport "); + + if (mode & T4_FILTER_FCoE) + printf("fcoe "); + + printf("\n"); + + return (0); +} + +static int +set_filter_mode(int argc, const char *argv[]) +{ + uint32_t mode = 0; + + for (; argc; argc--, argv++) { + if (!strcmp(argv[0], "matchtype")) + mode |= T4_FILTER_MPS_HIT_TYPE; + + if (!strcmp(argv[0], "macidx")) + mode |= T4_FILTER_MAC_IDX; + + if (!strcmp(argv[0], "ethtype")) + mode |= T4_FILTER_ETH_TYPE; + + if (!strcmp(argv[0], "proto")) + mode |= T4_FILTER_IP_PROTO; + + if (!strcmp(argv[0], "tos")) + mode |= T4_FILTER_IP_TOS; + + if (!strcmp(argv[0], "ivlan")) + mode |= T4_FILTER_IVLAN; + + if (!strcmp(argv[0], "ovlan")) + mode |= T4_FILTER_OVLAN; + + if (!strcmp(argv[0], "iport")) + mode |= T4_FILTER_PORT; + + if (!strcmp(argv[0], "fcoe")) + mode |= T4_FILTER_FCoE; + } + + return doit(CHELSIO_T4_SET_FILTER_MODE, &mode); +} + +static int +del_filter(uint32_t idx) +{ + struct t4_filter t; + + t.idx = idx; + + return doit(CHELSIO_T4_DEL_FILTER, &t); +} + +static int +set_filter(uint32_t idx, int argc, const char *argv[]) +{ + int af = AF_UNSPEC, start_arg = 0; + struct t4_filter t; + + if (argc < 2) { + warnc(EINVAL, "%s", __func__); + return (EINVAL); + }; + bzero(&t, sizeof (t)); + t.idx = idx; + + for (start_arg = 0; start_arg + 2 <= argc; start_arg += 2) { + const char **args = &argv[start_arg]; + uint32_t val, mask; + + if (!strcmp(argv[start_arg], "type")) { + int newaf; + if (!strcasecmp(argv[start_arg + 1], "ipv4")) + newaf = AF_INET; + else if (!strcasecmp(argv[start_arg + 1], "ipv6")) + newaf = AF_INET6; + else { + warnx("invalid type \"%s\"; " + "must be one of \"ipv4\" or \"ipv6\"", + argv[start_arg + 1]); + return (EINVAL); + } + + if (af != AF_UNSPEC && af != newaf) { + warnx("conflicting IPv4/IPv6 specifications."); + return (EINVAL); + } + af = newaf; + } else if (!parse_val_mask("fcoe", args, &val, &mask)) { + t.fs.val.fcoe = val; + t.fs.mask.fcoe = mask; + } else if (!parse_val_mask("iport", args, &val, &mask)) { + t.fs.val.iport = val; + t.fs.mask.iport = mask; + } else if (!parse_val_mask("ovlan", args, &val, &mask)) { + t.fs.val.ovlan = val; + t.fs.mask.ovlan = mask; + t.fs.val.ovlan_vld = 1; + t.fs.mask.ovlan_vld = 1; + } else if (!parse_val_mask("ivlan", args, &val, &mask)) { + t.fs.val.ivlan = val; + t.fs.mask.ivlan = mask; + t.fs.val.ivlan_vld = 1; + t.fs.mask.ivlan_vld = 1; + } else if (!parse_val_mask("tos", args, &val, &mask)) { + t.fs.val.tos = val; + t.fs.mask.tos = mask; + } else if (!parse_val_mask("proto", args, &val, &mask)) { + t.fs.val.proto = val; + t.fs.mask.proto = mask; + } else if (!parse_val_mask("ethtype", args, &val, &mask)) { + t.fs.val.ethtype = val; + t.fs.mask.ethtype = mask; + } else if (!parse_val_mask("macidx", args, &val, &mask)) { + t.fs.val.macidx = val; + t.fs.mask.macidx = mask; + } else if (!parse_val_mask("matchtype", args, &val, &mask)) { + t.fs.val.matchtype = val; + t.fs.mask.matchtype = mask; + } else if (!parse_val_mask("frag", args, &val, &mask)) { + t.fs.val.frag = val; + t.fs.mask.frag = mask; + } else if (!parse_val_mask("dport", args, &val, &mask)) { + t.fs.val.dport = val; + t.fs.mask.dport = mask; + } else if (!parse_val_mask("sport", args, &val, &mask)) { + t.fs.val.sport = val; + t.fs.mask.sport = mask; + } else if (!parse_ipaddr("dip", args, &af, t.fs.val.dip, + t.fs.mask.dip)) { + /* nada */; + } else if (!parse_ipaddr("sip", args, &af, t.fs.val.sip, + t.fs.mask.sip)) { + /* nada */; + } else if (!strcmp(argv[start_arg], "action")) { + if (!strcmp(argv[start_arg + 1], "pass")) + t.fs.action = FILTER_PASS; + else if (!strcmp(argv[start_arg + 1], "drop")) + t.fs.action = FILTER_DROP; + else if (!strcmp(argv[start_arg + 1], "switch")) + t.fs.action = FILTER_SWITCH; + else { + warnx("invalid action \"%s\"; must be one of" + " \"pass\", \"drop\" or \"switch\"", *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 21:37: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 60210106564A; Thu, 9 Jun 2011 21:37:31 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 17A8F8FC17; Thu, 9 Jun 2011 21:37:31 +0000 (UTC) Received: from [10.30.101.53] ([209.117.142.2]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p59LSUkL032513 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Thu, 9 Jun 2011 15:28:33 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <201106091352.04738.jhb@freebsd.org> Date: Thu, 9 Jun 2011 15:28:25 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <1FCA7CC7-3B61-4379-96BB-6E8976B9983A@bsdimp.com> References: <201106070846.p578kD4K073476@svn.freebsd.org> <201106090843.28669.jhb@freebsd.org> <201106091352.04738.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Thu, 09 Jun 2011 15:28:34 -0600 (MDT) Cc: Attilio Rao , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222813 - in head: . contrib/top gnu/usr.bin/gdb/kgdb lib/libkvm lib/libmemstat share/man/man4 share/mk sys/amd64/acpica sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sy... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 21:37:31 -0000 On Jun 9, 2011, at 11:52 AM, John Baldwin wrote: > On Thursday, June 09, 2011 12:48:30 pm Attilio Rao wrote: >> 2011/6/9 John Baldwin : >>> On Tuesday, June 07, 2011 4:46:13 am Attilio Rao wrote: >>>> Author: attilio >>>> Date: Tue Jun 7 08:46:13 2011 >>>> New Revision: 222813 >>>> URL: http://svn.freebsd.org/changeset/base/222813 >>>>=20 >>> It would appear that svn destroyed the history on all these files. = I suspect >>> svn merge --reintegrate is too broken to be used safely and should = probably >>> not be used in the future until/unless svn fixes it to not suck. >>=20 >> That was suggested by re@ officials, so I can't really argue :) >=20 > Well, I don't think it has blown up in the past, so at the time that > recommendation was probably fine. >=20 >> What would you use instead? the "write me" option? >=20 > svn diff | patch (basically what folks do for branches in p4). BTW, I discovered similar things when I was doing the mips work on a = branch... svn is good for 'dolphin' branches, but not so good when you want to = cherry pick changes back to the main while you are also pulling changes = from the main. Warner From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 22:52: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 D2C8D1065678; Thu, 9 Jun 2011 22:52:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C24058FC0A; Thu, 9 Jun 2011 22:52: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 p59MqvR9098082; Thu, 9 Jun 2011 22:52:57 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p59Mqv4a098067; Thu, 9 Jun 2011 22:52:57 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201106092252.p59Mqv4a098067@svn.freebsd.org> From: Xin LI Date: Thu, 9 Jun 2011 22:52: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: r222906 - head/contrib/less X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 09 Jun 2011 22:52:57 -0000 Author: delphij Date: Thu Jun 9 22:52:57 2011 New Revision: 222906 URL: http://svn.freebsd.org/changeset/base/222906 Log: MFV: Update to less v444. MFC after: 2 weeks Modified: head/contrib/less/NEWS head/contrib/less/README head/contrib/less/command.c head/contrib/less/funcs.h head/contrib/less/less.man head/contrib/less/less.nro head/contrib/less/lessecho.man head/contrib/less/lessecho.nro head/contrib/less/lesskey.man head/contrib/less/lesskey.nro head/contrib/less/optfunc.c head/contrib/less/opttbl.c head/contrib/less/version.c Directory Properties: head/contrib/less/ (props changed) Modified: head/contrib/less/NEWS ============================================================================== --- head/contrib/less/NEWS Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/NEWS Thu Jun 9 22:52:57 2011 (r222906) @@ -12,6 +12,15 @@ ====================================================================== + Major changes between "less" versions 443 and 444 + +* Fix bug in unget handling that can cause strange effects on the + command line. + +* Remove vestiges of obsolete -l option that can cause a crash. + +====================================================================== + Major changes between "less" versions 436 and 443 * Change search behavior such that when a search is given an explicit Modified: head/contrib/less/README ============================================================================== --- head/contrib/less/README Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/README Thu Jun 9 22:52:57 2011 (r222906) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 443 + Less, version 444 - This is the distribution of less, version 443, released 09 Apr 2011. + This is the distribution of less, version 444, released 09 Jun 2011. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or Modified: head/contrib/less/command.c ============================================================================== --- head/contrib/less/command.c Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/command.c Thu Jun 9 22:52:57 2011 (r222906) @@ -302,7 +302,7 @@ is_erase_char(c) */ static int mca_opt_first_char(c) - int c; + int c; { int flag = (optflag & ~OPT_NO_PROMPT); if (flag == OPT_NO_TOGGLE) @@ -846,6 +846,7 @@ ungetcc(c) ug->ug_char = c; ug->ug_next = ungot; ungot = ug; + unget_end = 0; } /* Modified: head/contrib/less/funcs.h ============================================================================== --- head/contrib/less/funcs.h Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/funcs.h Thu Jun 9 22:52:57 2011 (r222906) @@ -194,7 +194,6 @@ public void unmark (); public void opt_o (); public void opt__O (); - public void opt_l (); public void opt_j (); public void calc_jump_sline (); public void opt_shift (); Modified: head/contrib/less/less.man ============================================================================== --- head/contrib/less/less.man Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/less.man Thu Jun 9 22:52:57 2011 (r222906) @@ -1156,7 +1156,7 @@ LESS(1) next 8bcccbcc18b95.bb125.bb If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings - "UTF-8", "UTF8", "utf-8" or "utf8" is found in the LC_ALL, LC_TYPE or + "UTF-8", "UTF8", "utf-8" or "utf8" is found in the LC_ALL, LC_CTYPE or LANG environment variables, then the default character set is utf-8. If that string is not found, but your system supports the setlocale @@ -1580,4 +1580,4 @@ LESS(1) - Version 443: 09 Apr 2011 LESS(1) + Version 444: 09 Jun 2011 LESS(1) Modified: head/contrib/less/less.nro ============================================================================== --- head/contrib/less/less.nro Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/less.nro Thu Jun 9 22:52:57 2011 (r222906) @@ -1,4 +1,4 @@ -.TH LESS 1 "Version 443: 09 Apr 2011" +.TH LESS 1 "Version 444: 09 Jun 2011" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -1276,7 +1276,7 @@ to each of the possible values for LESSC .PP If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8" -is found in the LC_ALL, LC_TYPE or LANG +is found in the LC_ALL, LC_CTYPE or LANG environment variables, then the default character set is utf-8. .PP If that string is not found, but your system supports the Modified: head/contrib/less/lessecho.man ============================================================================== --- head/contrib/less/lessecho.man Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/lessecho.man Thu Jun 9 22:52:57 2011 (r222906) @@ -46,4 +46,4 @@ LESSECHO(1) - Version 443: 09 Apr 2011 LESSECHO(1) + Version 444: 09 Jun 2011 LESSECHO(1) Modified: head/contrib/less/lessecho.nro ============================================================================== --- head/contrib/less/lessecho.nro Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/lessecho.nro Thu Jun 9 22:52:57 2011 (r222906) @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 443: 09 Apr 2011" +.TH LESSECHO 1 "Version 444: 09 Jun 2011" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS Modified: head/contrib/less/lesskey.man ============================================================================== --- head/contrib/less/lesskey.man Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/lesskey.man Thu Jun 9 22:52:57 2011 (r222906) @@ -354,4 +354,4 @@ LESSKEY(1) - Version 443: 09 Apr 2011 LESSKEY(1) + Version 444: 09 Jun 2011 LESSKEY(1) Modified: head/contrib/less/lesskey.nro ============================================================================== --- head/contrib/less/lesskey.nro Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/lesskey.nro Thu Jun 9 22:52:57 2011 (r222906) @@ -1,4 +1,4 @@ -.TH LESSKEY 1 "Version 443: 09 Apr 2011" +.TH LESSKEY 1 "Version 444: 09 Jun 2011" .SH NAME lesskey \- specify key bindings for less .SH SYNOPSIS Modified: head/contrib/less/optfunc.c ============================================================================== --- head/contrib/less/optfunc.c Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/optfunc.c Thu Jun 9 22:52:57 2011 (r222906) @@ -132,34 +132,6 @@ opt__O(type, s) #endif /* - * Handlers for -l option. - */ - public void -opt_l(type, s) - int type; - char *s; -{ - int err; - int n; - char *t; - - switch (type) - { - case INIT: - t = s; - n = getnum(&t, "l", &err); - if (err || n <= 0) - { - error("Line number is required after -l", NULL_PARG); - return; - } - plusoption = TRUE; - ungetsc(s); - break; - } -} - -/* * Handlers for -j option. */ public void Modified: head/contrib/less/opttbl.c ============================================================================== --- head/contrib/less/opttbl.c Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/opttbl.c Thu Jun 9 22:52:57 2011 (r222906) @@ -263,10 +263,6 @@ static struct loption option[] = NULL } }, - { 'l', NULL, - STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_l, - { NULL, NULL, NULL } - }, { 'L', &L__optname, BOOL, OPT_ON, &use_lessopen, NULL, { Modified: head/contrib/less/version.c ============================================================================== --- head/contrib/less/version.c Thu Jun 9 22:51:05 2011 (r222905) +++ head/contrib/less/version.c Thu Jun 9 22:52:57 2011 (r222906) @@ -742,6 +742,7 @@ v441 1/21/11 Fix semi-infinite loop i v442 3/2/11 Fix search bug. Add ctrl-G line edit command. v443 4/9/11 Fix Windows build. +v444 6/8/11 Fix ungetc bug; remove vestiges of obsolete -l option. */ -char version[] = "443"; +char version[] = "444"; From owner-svn-src-head@FreeBSD.ORG Thu Jun 9 23:12: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 2284E106566B; Thu, 9 Jun 2011 23:12:24 +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 11B418FC16; Thu, 9 Jun 2011 23:12: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 p59NCNg1098692; Thu, 9 Jun 2011 23:12:23 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p59NCNqY098685; Thu, 9 Jun 2011 23:12:23 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106092312.p59NCNqY098685@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 9 Jun 2011 23:12: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: r222907 - 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: Thu, 09 Jun 2011 23:12:24 -0000 Author: jilles Date: Thu Jun 9 23:12:23 2011 New Revision: 222907 URL: http://svn.freebsd.org/changeset/base/222907 Log: sh: Do parameter expansion before printing PS4 (set -x). The function name expandstr() and the general idea of doing this kind of expansion by treating the text as a here document without end marker is from dash. All variants of parameter expansion and arithmetic expansion also work (the latter is not required by POSIX but it does not take extra code and many other shells also allow it). Command substitution is prevented because I think it causes too much code to be re-entered (for example creating an unbounded recursion of trace lines). Unfortunately, our LINENO is somewhat crude, otherwise PS4='$LINENO+ ' would be quite useful. Added: head/tools/regression/bin/sh/execution/set-x3.0 (contents, props changed) Modified: head/bin/sh/eval.c head/bin/sh/expand.c head/bin/sh/parser.c head/bin/sh/parser.h head/bin/sh/sh.1 Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Thu Jun 9 22:52:57 2011 (r222906) +++ head/bin/sh/eval.c Thu Jun 9 23:12:23 2011 (r222907) @@ -745,8 +745,9 @@ evalcommand(union node *cmd, int flags, /* Print the command if xflag is set. */ if (xflag) { char sep = 0; - const char *p; - out2str(ps4val()); + const char *p, *ps4; + ps4 = expandstr(ps4val()); + out2str(ps4 != NULL ? ps4 : ps4val()); for (sp = varlist.list ; sp ; sp = sp->next) { if (sep != 0) out2c(' '); Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Thu Jun 9 22:52:57 2011 (r222906) +++ head/bin/sh/expand.c Thu Jun 9 23:12:23 2011 (r222907) @@ -174,6 +174,7 @@ expandarg(union node *arg, struct arglis ifslastp = NULL; argstr(arg->narg.text, flag); if (arglist == NULL) { + STACKSTRNUL(expdest); return; /* here document expanded */ } STPUTC('\0', expdest); Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Thu Jun 9 22:52:57 2011 (r222906) +++ head/bin/sh/parser.c Thu Jun 9 23:12:23 2011 (r222907) @@ -2029,3 +2029,47 @@ getprompt(void *unused __unused) ps[i] = '\0'; return (ps); } + + +const char * +expandstr(char *ps) +{ + union node n; + struct jmploc jmploc; + struct jmploc *const savehandler = handler; + const int saveprompt = doprompt; + struct parsefile *const savetopfile = getcurrentfile(); + struct parser_temp *const saveparser_temp = parser_temp; + const char *result = NULL; + + if (!setjmp(jmploc.loc)) { + handler = &jmploc; + parser_temp = NULL; + setinputstring(ps, 1); + doprompt = 0; + readtoken1(pgetc(), DQSYNTAX, "\n\n", 0); + if (backquotelist != NULL) + error("Command substitution not allowed here"); + + n.narg.type = NARG; + n.narg.next = NULL; + n.narg.text = wordtext; + n.narg.backquote = backquotelist; + + expandarg(&n, NULL, 0); + result = stackblock(); + INTOFF; + } + handler = savehandler; + doprompt = saveprompt; + popfilesupto(savetopfile); + if (parser_temp != saveparser_temp) { + parser_temp_free_all(); + parser_temp = saveparser_temp; + } + if (result != NULL) { + INTON; + } else if (exception == EXINT) + raise(SIGINT); + return result; +} Modified: head/bin/sh/parser.h ============================================================================== --- head/bin/sh/parser.h Thu Jun 9 22:52:57 2011 (r222906) +++ head/bin/sh/parser.h Thu Jun 9 23:12:23 2011 (r222907) @@ -82,3 +82,4 @@ void fixredir(union node *, const char * int goodname(const char *); int isassignment(const char *); char *getprompt(void *); +const char *expandstr(char *); Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Thu Jun 9 22:52:57 2011 (r222906) +++ head/bin/sh/sh.1 Thu Jun 9 23:12:23 2011 (r222907) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd May 21, 2011 +.Dd June 9, 2011 .Dt SH 1 .Os .Sh NAME @@ -324,7 +324,7 @@ Useful for debugging. Write each command (preceded by the value of the .Va PS4 -variable) +variable subjected to parameter expansion and arithmetic expansion) to standard error before it is executed. Useful for debugging. .El Added: head/tools/regression/bin/sh/execution/set-x3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/set-x3.0 Thu Jun 9 23:12:23 2011 (r222907) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +key='must contain this' +PS4='$key+ ' +{ r=`set -x; { :; } 2>&1 >/dev/null`; } 2>/dev/null +case $r in +*"$key"*) true ;; +*) false ;; +esac From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 01:13: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 A71A8106566C; Fri, 10 Jun 2011 01:13:15 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 971588FC18; Fri, 10 Jun 2011 01:13: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 p5A1DFqo003203; Fri, 10 Jun 2011 01:13:15 GMT (envelope-from rodrigc@svn.freebsd.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5A1DFUx003201; Fri, 10 Jun 2011 01:13:15 GMT (envelope-from rodrigc@svn.freebsd.org) Message-Id: <201106100113.p5A1DFUx003201@svn.freebsd.org> From: Craig Rodrigues Date: Fri, 10 Jun 2011 01:13: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: r222908 - head/lib/libstand X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 10 Jun 2011 01:13:15 -0000 Author: rodrigc Date: Fri Jun 10 01:13:15 2011 New Revision: 222908 URL: http://svn.freebsd.org/changeset/base/222908 Log: Obtain bswap64() function implementation from version 1.3 of src/common/lib/libc/gen/bswap64.c in NetBSD. Obtained from: NetBSD Modified: head/lib/libstand/bswap.c Modified: head/lib/libstand/bswap.c ============================================================================== --- head/lib/libstand/bswap.c Thu Jun 9 23:12:23 2011 (r222907) +++ head/lib/libstand/bswap.c Fri Jun 10 01:13:15 2011 (r222908) @@ -8,7 +8,7 @@ __FBSDID("$FreeBSD$"); #if defined(LIBC_SCCS) && !defined(lint) static char *rcsid = "$NetBSD: bswap32.c,v 1.1 1997/10/09 15:42:33 bouyer Exp $"; -static char *rcsid = "$NetBSD: bswap64.c,v 1.1 1997/10/09 15:42:33 bouyer Exp $"; +static char *rcsid = "$NetBSD: bswap64.c,v 1.3 2009/03/16 05:59:21 cegger Exp $"; #endif #include @@ -30,12 +30,28 @@ bswap32(u_int32_t x) u_int64_t bswap64(u_int64_t x) -{ - u_int32_t *p = (u_int32_t*)&x; - u_int32_t t; - t = bswap32(p[0]); - p[0] = bswap32(p[1]); - p[1] = t; - return x; -} - +{ +#ifdef _LP64 + /* + * Assume we have wide enough registers to do it without touching + * memory. + */ + return ( (x << 56) & 0xff00000000000000UL ) | + ( (x << 40) & 0x00ff000000000000UL ) | + ( (x << 24) & 0x0000ff0000000000UL ) | + ( (x << 8) & 0x000000ff00000000UL ) | + ( (x >> 8) & 0x00000000ff000000UL ) | + ( (x >> 24) & 0x0000000000ff0000UL ) | + ( (x >> 40) & 0x000000000000ff00UL ) | + ( (x >> 56) & 0x00000000000000ffUL ); +#else + /* + * Split the operation in two 32bit steps. + */ + u_int32_t tl, th; + + th = bswap32((u_int32_t)(x & 0x00000000ffffffffULL)); + tl = bswap32((u_int32_t)((x >> 32) & 0x00000000ffffffffULL)); + return ((u_int64_t)th << 32) | tl; +#endif +} From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 07:08: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 44E1E1065672; Fri, 10 Jun 2011 07:08:57 +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 CD8DC8FC0A; Fri, 10 Jun 2011 07:08:56 +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 p5A78o3M026322 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 10 Jun 2011 17:08:54 +1000 Date: Fri, 10 Jun 2011 17:08:50 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Craig Rodrigues In-Reply-To: <201106100113.p5A1DFUx003201@svn.freebsd.org> Message-ID: <20110610160628.Y1015@besplex.bde.org> References: <201106100113.p5A1DFUx003201@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r222908 - head/lib/libstand X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 10 Jun 2011 07:08:57 -0000 On Fri, 10 Jun 2011, Craig Rodrigues wrote: > Log: > Obtain bswap64() function implementation from > version 1.3 of src/common/lib/libc/gen/bswap64.c in NetBSD. > > Obtained from: NetBSD Why not use the better (actually, differently bad, but in the correct place to fix) implementation already in FreeBSD (in ? libstand isn't so standalone that it can't use basic system headers. > Modified: head/lib/libstand/bswap.c > ============================================================================== > --- head/lib/libstand/bswap.c Thu Jun 9 23:12:23 2011 (r222907) > +++ head/lib/libstand/bswap.c Fri Jun 10 01:13:15 2011 (r222908) > ... > @@ -30,12 +30,28 @@ bswap32(u_int32_t x) > > u_int64_t > bswap64(u_int64_t x) > -{ > - u_int32_t *p = (u_int32_t*)&x; > - u_int32_t t; > - t = bswap32(p[0]); > - p[0] = bswap32(p[1]); > - p[1] = t; > - return x; > -} This was adequate on some arches, but has style bugs and bad type puns which might break it on other arches. > - > +{ > +#ifdef _LP64 > + /* > + * Assume we have wide enough registers to do it without touching > + * memory. > + */ There are negative reasons to optimize this for libstand, but already does similar optimizations, with messy ifdefs for each of about 10 different arches. > + return ( (x << 56) & 0xff00000000000000UL ) | > + ( (x << 40) & 0x00ff000000000000UL ) | > + ( (x << 24) & 0x0000ff0000000000UL ) | > + ( (x << 8) & 0x000000ff00000000UL ) | > + ( (x >> 8) & 0x00000000ff000000UL ) | > + ( (x >> 24) & 0x0000000000ff0000UL ) | > + ( (x >> 40) & 0x000000000000ff00UL ) | > + ( (x >> 56) & 0x00000000000000ffUL ); This has different style bugs (excessive whitespace), but it otherwise formatted better than the similar expression which is spammed into too many 's. This expression is MI except for the constants in it. But it is far from optimal with some compilers, so too many of 's only use it when a compile-time constant expression is needed -- they use asms with bswap instructions in them in other cases. OTOH, this expression is optimal for clang, both for amd64 and i386 IIRC -- clang turns it into 1 bswap for amd64, and (after adjusting the constants) into 2 bswaps for i386. gcc3.x and gcc-4.2.1 generate large slow code for this expression. > +#else > + /* > + * Split the operation in two 32bit steps. > + */ > + u_int32_t tl, th; > + > + th = bswap32((u_int32_t)(x & 0x00000000ffffffffULL)); > + tl = bswap32((u_int32_t)((x >> 32) & 0x00000000ffffffffULL)); > + return ((u_int64_t)th << 32) | tl; This is a good way to avoid the type puns in the original version, except for the style bugs in it (use of the long long abomination, in a way that doesn't even have any effect). On i386, this results in essentially the same good code that clang generates for the big MI expression (one (virtual) swap of a register pair to swap 2 32-bit words, then 2 bswaps to swap the words internally. then more virtual instructions to recombine the words), provided bswap32 is inline and reduces to the bswap instruction, either via an asm or by optimization (but in libstand it is neither). (At least if bswap32() in the above is replaced by _bswap32() from , clang optimizes the above to exactly the same 2 bswaps as it does for the big MI expression; gcc is not so good, and generates about 8 movl instructions instead of the virtual swapping.) The above is not so optimal for LP64 (even clang doesn't manage to convert the 2 32-bit bswaps to 1 64-bit one, at least if bswap32() is in asm), but is adequate in libstand. > +#endif > +} Anyway, the messy ifdefs and micro-optimizations for this should not be duplicated here. When gcc optimization catches up with where clang already is, all the messy ifdefs and MD asms in 's can be replaced by single MI expressions, and everything that doesn't roll its own endian functions will benefit automatically. The different badness now in i386/include/endian.h is now: - the big MI expressions for bswap32 and bswap64 (named __bswapNN_const) are spammed into this and all (?) other MD files - these expressions are missing some casts. For example, if the _x arg is either signed (with the sign bit set), or of a larger type (with higher bits set), then (_x) >> 56 gives a wrong value. - these expressions are poorly formatted - the big MI expression for bswap64 is used for both the "const" and the "var" cases. This is good for the "const" case, but for the "var" case it pessimal for gcc. This badness is sort of the opposite of the above for libstand -- i386/include/endian.h should optimize and use the !_LP64 code above, while libstand doesn't need this optimization but has it. amd64 doesn't have this problem since it uses a MD asm for bswap64_var. There is a PR about bswap64 not being optimized for i386. Apparently, the optimization actually matters for some cases (for something like swab(3) on large data?). See the PR for more details. My followup explains why fancy asms are not needed to fix this -- as above, the big MI expression works perfectly for clang, but for gcc an optimization like the above is good (generate 2 bswap instructions using the asms for bswap32, but don't use asms to combine these. But use a better C expression than the above to combine them, so that gcc doesn't generate so many movls). Bruce From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 12:30: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 2C747106564A; Fri, 10 Jun 2011 12:30:17 +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 124FA8FC0A; Fri, 10 Jun 2011 12:30: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 p5ACUG2s026742; Fri, 10 Jun 2011 12:30:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5ACUGjo026738; Fri, 10 Jun 2011 12:30:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201106101230.p5ACUGjo026738@svn.freebsd.org> From: John Baldwin Date: Fri, 10 Jun 2011 12:30: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: r222929 - in head/sys: amd64/amd64 dev/acpica i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 10 Jun 2011 12:30:17 -0000 Author: jhb Date: Fri Jun 10 12:30:16 2011 New Revision: 222929 URL: http://svn.freebsd.org/changeset/base/222929 Log: Implement BUS_ADJUST_RESOURCE() for the x86 drivers that sit between the Host-PCI bridge drivers and nexus. Modified: head/sys/amd64/amd64/legacy.c head/sys/dev/acpica/acpi.c head/sys/i386/i386/legacy.c Modified: head/sys/amd64/amd64/legacy.c ============================================================================== --- head/sys/amd64/amd64/legacy.c Fri Jun 10 10:43:49 2011 (r222928) +++ head/sys/amd64/amd64/legacy.c Fri Jun 10 12:30:16 2011 (r222929) @@ -81,6 +81,7 @@ static device_method_t legacy_methods[] DEVMETHOD(bus_read_ivar, legacy_read_ivar), DEVMETHOD(bus_write_ivar, legacy_write_ivar), DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Fri Jun 10 10:43:49 2011 (r222928) +++ head/sys/dev/acpica/acpi.c Fri Jun 10 12:30:16 2011 (r222929) @@ -123,6 +123,8 @@ static int acpi_set_resource(device_t de static struct resource *acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); +static int acpi_adjust_resource(device_t bus, device_t child, int type, + struct resource *r, u_long start, u_long end); static int acpi_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r); static void acpi_delete_resource(device_t bus, device_t child, int type, @@ -193,6 +195,7 @@ static device_method_t acpi_methods[] = DEVMETHOD(bus_set_resource, acpi_set_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_alloc_resource, acpi_alloc_resource), + DEVMETHOD(bus_adjust_resource, acpi_adjust_resource), DEVMETHOD(bus_release_resource, acpi_release_resource), DEVMETHOD(bus_delete_resource, acpi_delete_resource), DEVMETHOD(bus_child_pnpinfo_str, acpi_child_pnpinfo_str_method), @@ -1325,29 +1328,40 @@ acpi_alloc_resource(device_t bus, device } static int -acpi_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) +acpi_is_resource_managed(int type, struct resource *r) { - struct rman *rm; - int ret; /* We only handle memory and IO resources through rman. */ switch (type) { case SYS_RES_IOPORT: - rm = &acpi_rman_io; - break; + return (rman_is_region_manager(r, &acpi_rman_io)); case SYS_RES_MEMORY: - rm = &acpi_rman_mem; - break; - default: - rm = NULL; + return (rman_is_region_manager(r, &acpi_rman_mem)); } + return (0); +} + +static int +acpi_adjust_resource(device_t bus, device_t child, int type, struct resource *r, + u_long start, u_long end) +{ + + if (acpi_is_resource_managed(type, r)) + return (rman_adjust_resource(r, start, end)); + return (bus_generic_adjust_resource(bus, child, type, r, start, end)); +} + +static int +acpi_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + int ret; /* * If this resource belongs to one of our internal managers, * deactivate it and release it to the local pool. */ - if (rm != NULL && rman_is_region_manager(r, rm)) { + if (acpi_is_resource_managed(type, r)) { if (rman_get_flags(r) & RF_ACTIVE) { ret = bus_deactivate_resource(child, type, rid, r); if (ret != 0) Modified: head/sys/i386/i386/legacy.c ============================================================================== --- head/sys/i386/i386/legacy.c Fri Jun 10 10:43:49 2011 (r222928) +++ head/sys/i386/i386/legacy.c Fri Jun 10 12:30:16 2011 (r222929) @@ -86,6 +86,7 @@ static device_method_t legacy_methods[] DEVMETHOD(bus_read_ivar, legacy_read_ivar), DEVMETHOD(bus_write_ivar, legacy_write_ivar), DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 13: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 2738C1065674; Fri, 10 Jun 2011 13:24:57 +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 17CF28FC1E; Fri, 10 Jun 2011 13:24: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 p5ADOuiJ028526; Fri, 10 Jun 2011 13:24:56 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5ADOu5B028524; Fri, 10 Jun 2011 13:24:56 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201106101324.p5ADOu5B028524@svn.freebsd.org> From: John Baldwin Date: Fri, 10 Jun 2011 13:24: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: r222930 - head/sys/dev/pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2011 13:24:57 -0000 Author: jhb Date: Fri Jun 10 13:24:56 2011 New Revision: 222930 URL: http://svn.freebsd.org/changeset/base/222930 Log: Fix some off-by-one errors with the ending address of candidate regions when attempting to grow a window. Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Fri Jun 10 12:30:16 2011 (r222929) +++ head/sys/dev/pci/pci_pci.c Fri Jun 10 13:24:56 2011 (r222930) @@ -916,7 +916,8 @@ pcib_grow_window(struct pcib_softc *sc, /* Move end_free down until it is properly aligned. */ end_free &= ~(align - 1); - front = end_free - count; + end_free--; + front = end_free - (count - 1); /* * The resource would now be allocated at (front, @@ -944,7 +945,7 @@ pcib_grow_window(struct pcib_softc *sc, /* Move start_free up until it is properly aligned. */ start_free = roundup2(start_free, align); - back = start_free + count; + back = start_free + count - 1; /* * The resource would now be allocated at (start_free, @@ -957,7 +958,7 @@ pcib_grow_window(struct pcib_softc *sc, if (bootverbose) printf("\tback candidate range: %#lx-%#lx\n", start_free, back); - back = roundup2(back, w->step) - 1; + back = roundup2(back + 1, w->step) - 1; back -= rman_get_end(w->res); } else back = 0; From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 13:47: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 DA5F6106566B; Fri, 10 Jun 2011 13:47:11 +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 CAD7D8FC0A; Fri, 10 Jun 2011 13:47: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 p5ADlBak029266; Fri, 10 Jun 2011 13:47:11 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5ADlBQa029264; Fri, 10 Jun 2011 13:47:11 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106101347.p5ADlBQa029264@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 10 Jun 2011 13:47: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: r222932 - head/share/skel X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 10 Jun 2011 13:47:11 -0000 Author: jilles Date: Fri Jun 10 13:47:11 2011 New Revision: 222932 URL: http://svn.freebsd.org/changeset/base/222932 Log: skel/.shrc: Improve commented CDPATH example for POSIX requirements. POSIX says an empty entry in CDPATH shall not result in the new directory being printed, while any non-empty entry shall result in the new directory being printed, including ".". Therefore, the value of CDPATH should almost always start with a colon, not dot and colon. Our sh does not print the name for empty entries as well as "." entries. MFC after: 1 week Modified: head/share/skel/dot.shrc Modified: head/share/skel/dot.shrc ============================================================================== --- head/share/skel/dot.shrc Fri Jun 10 13:28:14 2011 (r222931) +++ head/share/skel/dot.shrc Fri Jun 10 13:47:11 2011 (r222932) @@ -44,4 +44,4 @@ alias g='egrep -i' # esac # search path for cd(1) -# CDPATH=.:$HOME +# CDPATH=:$HOME From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 17:06: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 0ADB61065680; Fri, 10 Jun 2011 17:06: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 E54168FC0C; Fri, 10 Jun 2011 17:06: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 p5AH6PFA035236; Fri, 10 Jun 2011 17:06:25 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5AH6PpL035234; Fri, 10 Jun 2011 17:06:25 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201106101706.p5AH6PpL035234@svn.freebsd.org> From: Bernhard Schmidt Date: Fri, 10 Jun 2011 17:06: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: r222933 - 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: Fri, 10 Jun 2011 17:06:26 -0000 Author: bschmidt Date: Fri Jun 10 17:06:25 2011 New Revision: 222933 URL: http://svn.freebsd.org/changeset/base/222933 Log: Make sure to drop the IEEE80211_RATE_BASIC flag even for MCS rates. Reported by: Maciej Milewski Tested by: Maciej Milewski Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Fri Jun 10 13:47:11 2011 (r222932) +++ head/sys/dev/iwn/if_iwn.c Fri Jun 10 17:06:25 2011 (r222933) @@ -2105,6 +2105,7 @@ rate2plcp(int rate) static void iwn_newassoc(struct ieee80211_node *ni, int isnew) { +#define RV(v) ((v) & IEEE80211_RATE_VAL) struct ieee80211com *ic = ni->ni_ic; struct iwn_softc *sc = ic->ic_ifp->if_softc; struct iwn_node *wn = (void *)ni; @@ -2118,7 +2119,7 @@ iwn_newassoc(struct ieee80211_node *ni, if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { ridx = ni->ni_rates.rs_nrates - 1; for (i = ni->ni_htrates.rs_nrates - 1; i >= 0; i--) { - plcp = ni->ni_htrates.rs_rates[i] | IWN_RFLAG_MCS; + plcp = RV(ni->ni_htrates.rs_rates[i]) | IWN_RFLAG_MCS; if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { plcp |= IWN_RFLAG_HT40; if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) @@ -2130,8 +2131,7 @@ iwn_newassoc(struct ieee80211_node *ni, else plcp |= IWN_RFLAG_ANT(txant1); if (ridx >= 0) { - rate = ni->ni_rates.rs_rates[ridx]; - rate &= IEEE80211_RATE_VAL; + rate = RV(ni->ni_rates.rs_rates[ridx]); wn->ridx[rate] = plcp; } wn->ridx[IEEE80211_RATE_MCS | i] = plcp; @@ -2139,8 +2139,7 @@ iwn_newassoc(struct ieee80211_node *ni, } } else { for (i = 0; i < ni->ni_rates.rs_nrates; i++) { - rate = ni->ni_rates.rs_rates[i] & IEEE80211_RATE_VAL; - + rate = RV(ni->ni_rates.rs_rates[i]); plcp = rate2plcp(rate); ridx = ic->ic_rt->rateCodeToIndex[rate]; if (ridx < IWN_RIDX_OFDM6 && @@ -2150,6 +2149,7 @@ iwn_newassoc(struct ieee80211_node *ni, wn->ridx[rate] = htole32(plcp); } } +#undef RV } static int @@ -3993,6 +3993,7 @@ iwn5000_add_node(struct iwn_softc *sc, s static int iwn_set_link_quality(struct iwn_softc *sc, struct ieee80211_node *ni) { +#define RV(v) ((v) & IEEE80211_RATE_VAL) struct iwn_node *wn = (void *)ni; struct ieee80211_rateset *rs = &ni->ni_rates; struct iwn_cmd_link_quality linkq; @@ -4019,11 +4020,11 @@ iwn_set_link_quality(struct iwn_softc *s if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) rate = IEEE80211_RATE_MCS | txrate; else - rate = rs->rs_rates[txrate] & IEEE80211_RATE_VAL; + rate = RV(rs->rs_rates[txrate]); linkq.retry[i] = wn->ridx[rate]; if ((le32toh(wn->ridx[rate]) & IWN_RFLAG_MCS) && - (le32toh(wn->ridx[rate]) & 0xff) > 7) + RV(le32toh(wn->ridx[rate])) > 7) linkq.mimo = i + 1; /* Next retry at immediate lower bit-rate. */ @@ -4031,6 +4032,7 @@ iwn_set_link_quality(struct iwn_softc *s txrate--; } return iwn_cmd(sc, IWN_CMD_LINK_QUALITY, &linkq, sizeof linkq, 1); +#undef RV } /* From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 20:10: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 35B141065672; Fri, 10 Jun 2011 20:10:31 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 229FE8FC18; Fri, 10 Jun 2011 20:10:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5AKAVRV041550; Fri, 10 Jun 2011 20:10:31 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5AKAV8G041541; Fri, 10 Jun 2011 20:10:31 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201106102010.p5AKAV8G041541@svn.freebsd.org> From: "Justin T. Gibbs" Date: Fri, 10 Jun 2011 20:10:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222950 - in head: cddl/compat/opensolaris/include sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs/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, 10 Jun 2011 20:10:31 -0000 Author: gibbs Date: Fri Jun 10 20:10:30 2011 New Revision: 222950 URL: http://svn.freebsd.org/changeset/base/222950 Log: Remove C constructs that are incompatible with C++ from various OpenSolaris and ZFS header files. These changes are sufficient to allow a C++ program to use the libzfs library. Note: The majority of these files already included 'extern "C"' declarations, so the intention of providing C++ compatibility already existed even if it wasn't provided. cddl/compat/opensolaris/include/assert.h: Wrap our compatibility assert implementation in 'extern "C"'. Since this is a compatibility header I matched the Solaris style of doing this explicitly rather than rely on FreeBSD's __BEGIN/END_DECLS macro. sys/cddl/compat/opensolaris/sys/kstat.h: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h: Rename parameters in function declarations that conflict with C++ keywords. This was the solution preferred by members of the Illumos community. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h: In C, nested structures are visible in the global namespace, but in C++, they take on the namespace of the structure in which they are contained. Flatten nested structure definitions within struct zfs_cmd so these structures are visible in the global namespace when compiled in both languages. Sponsored by: Spectra Logic Corporation Modified: head/cddl/compat/opensolaris/include/assert.h head/sys/cddl/compat/opensolaris/sys/kstat.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Modified: head/cddl/compat/opensolaris/include/assert.h ============================================================================== --- head/cddl/compat/opensolaris/include/assert.h Fri Jun 10 19:16:50 2011 (r222949) +++ head/cddl/compat/opensolaris/include/assert.h Fri Jun 10 20:10:30 2011 (r222950) @@ -43,6 +43,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + static __inline void __assert(const char *expr, const char *file, int line) { @@ -52,4 +56,9 @@ __assert(const char *expr, const char *f abort(); /* NOTREACHED */ } + +#ifdef __cplusplus +} +#endif + #endif /* !_ASSERT_H_ */ Modified: head/sys/cddl/compat/opensolaris/sys/kstat.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/kstat.h Fri Jun 10 19:16:50 2011 (r222949) +++ head/sys/cddl/compat/opensolaris/sys/kstat.h Fri Jun 10 20:10:30 2011 (r222950) @@ -58,7 +58,7 @@ typedef struct kstat_named { } value; } kstat_named_t; -kstat_t *kstat_create(char *module, int instance, char *name, char *class, +kstat_t *kstat_create(char *module, int instance, char *name, char *cls, uchar_t type, ulong_t ndata, uchar_t flags); void kstat_install(kstat_t *ksp); void kstat_delete(kstat_t *ksp); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Fri Jun 10 19:16:50 2011 (r222949) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Fri Jun 10 20:10:30 2011 (r222950) @@ -37,8 +37,8 @@ extern "C" { typedef struct arc_buf_hdr arc_buf_hdr_t; typedef struct arc_buf arc_buf_t; -typedef void arc_done_func_t(zio_t *zio, arc_buf_t *buf, void *private); -typedef int arc_evict_func_t(void *private); +typedef void arc_done_func_t(zio_t *zio, arc_buf_t *buf, void *priv); +typedef int arc_evict_func_t(void *priv); /* generic arc_done_func_t's which you can use */ arc_done_func_t arc_bcopy_func; @@ -103,17 +103,17 @@ int arc_referenced(arc_buf_t *buf); #endif int arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_buf_t *pbuf, - arc_done_func_t *done, void *private, int priority, int zio_flags, + arc_done_func_t *done, void *priv, int priority, int zio_flags, uint32_t *arc_flags, const zbookmark_t *zb); int arc_read_nolock(zio_t *pio, spa_t *spa, const blkptr_t *bp, - arc_done_func_t *done, void *private, int priority, int flags, + arc_done_func_t *done, void *priv, int priority, int flags, uint32_t *arc_flags, const zbookmark_t *zb); zio_t *arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp, - arc_done_func_t *ready, arc_done_func_t *done, void *private, + arc_done_func_t *ready, arc_done_func_t *done, void *priv, int priority, int zio_flags, const zbookmark_t *zb); -void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *private); +void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *priv); int arc_buf_evict(arc_buf_t *buf); void arc_flush(spa_t *spa); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h Fri Jun 10 19:16:50 2011 (r222949) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h Fri Jun 10 20:10:30 2011 (r222950) @@ -169,15 +169,15 @@ typedef struct ddt_ops { #define DDT_NAMELEN 80 extern void ddt_object_name(ddt_t *ddt, enum ddt_type type, - enum ddt_class class, char *name); + enum ddt_class cls, char *name); extern int ddt_object_walk(ddt_t *ddt, enum ddt_type type, - enum ddt_class class, uint64_t *walk, ddt_entry_t *dde); + enum ddt_class cls, uint64_t *walk, ddt_entry_t *dde); extern uint64_t ddt_object_count(ddt_t *ddt, enum ddt_type type, - enum ddt_class class); + enum ddt_class cls); extern int ddt_object_info(ddt_t *ddt, enum ddt_type type, - enum ddt_class class, dmu_object_info_t *); + enum ddt_class cls, dmu_object_info_t *); extern boolean_t ddt_object_exists(ddt_t *ddt, enum ddt_type type, - enum ddt_class class); + enum ddt_class cls); extern void ddt_bp_fill(const ddt_phys_t *ddp, blkptr_t *bp, uint64_t txg); @@ -235,7 +235,7 @@ extern void ddt_unload(spa_t *spa); extern void ddt_sync(spa_t *spa, uint64_t txg); extern int ddt_walk(spa_t *spa, ddt_bookmark_t *ddb, ddt_entry_t *dde); extern int ddt_object_update(ddt_t *ddt, enum ddt_type type, - enum ddt_class class, ddt_entry_t *dde, dmu_tx_t *tx); + enum ddt_class cls, ddt_entry_t *dde, dmu_tx_t *tx); extern const ddt_ops_t ddt_zap_ops; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Fri Jun 10 19:16:50 2011 (r222949) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Fri Jun 10 20:10:30 2011 (r222950) @@ -126,10 +126,10 @@ void dsl_free(dsl_pool_t *dp, uint64_t t void dsl_free_sync(zio_t *pio, dsl_pool_t *dp, uint64_t txg, const blkptr_t *bpp); int dsl_read(zio_t *pio, spa_t *spa, const blkptr_t *bpp, arc_buf_t *pbuf, - arc_done_func_t *done, void *private, int priority, int zio_flags, + arc_done_func_t *done, void *priv, int priority, int zio_flags, uint32_t *arc_flags, const zbookmark_t *zb); int dsl_read_nolock(zio_t *pio, spa_t *spa, const blkptr_t *bpp, - arc_done_func_t *done, void *private, int priority, int zio_flags, + arc_done_func_t *done, void *priv, int priority, int zio_flags, uint32_t *arc_flags, const zbookmark_t *zb); void dsl_pool_create_origin(dsl_pool_t *dp, dmu_tx_t *tx); void dsl_pool_upgrade_clones(dsl_pool_t *dp, dmu_tx_t *tx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Fri Jun 10 19:16:50 2011 (r222949) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Fri Jun 10 20:10:30 2011 (r222950) @@ -655,7 +655,7 @@ extern void spa_history_log_version(spa_ /* error handling */ struct zbookmark; extern void spa_log_error(spa_t *spa, zio_t *zio); -extern void zfs_ereport_post(const char *class, spa_t *spa, vdev_t *vd, +extern void zfs_ereport_post(const char *cls, spa_t *spa, vdev_t *vd, zio_t *zio, uint64_t stateoroffset, uint64_t length); extern void zfs_post_remove(spa_t *spa, vdev_t *vd); extern void zfs_post_state_change(spa_t *spa, vdev_t *vd); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Fri Jun 10 19:16:50 2011 (r222949) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Fri Jun 10 20:10:30 2011 (r222950) @@ -115,6 +115,87 @@ typedef enum drr_headertype { /* * zfs ioctl command structure */ +struct drr_begin { + uint64_t drr_magic; + uint64_t drr_versioninfo; /* was drr_version */ + uint64_t drr_creation_time; + dmu_objset_type_t drr_type; + uint32_t drr_flags; + uint64_t drr_toguid; + uint64_t drr_fromguid; + char drr_toname[MAXNAMELEN]; +}; + +struct drr_end { + zio_cksum_t drr_checksum; + uint64_t drr_toguid; +}; + +struct drr_object { + uint64_t drr_object; + dmu_object_type_t drr_type; + dmu_object_type_t drr_bonustype; + uint32_t drr_blksz; + uint32_t drr_bonuslen; + uint8_t drr_checksumtype; + uint8_t drr_compress; + uint8_t drr_pad[6]; + uint64_t drr_toguid; + /* bonus content follows */ +}; + +struct drr_freeobjects { + uint64_t drr_firstobj; + uint64_t drr_numobjs; + uint64_t drr_toguid; +}; + +struct drr_write { + uint64_t drr_object; + dmu_object_type_t drr_type; + uint32_t drr_pad; + uint64_t drr_offset; + uint64_t drr_length; + uint64_t drr_toguid; + uint8_t drr_checksumtype; + uint8_t drr_checksumflags; + uint8_t drr_pad2[6]; + ddt_key_t drr_key; /* deduplication key */ + /* content follows */ +}; + +struct drr_free { + uint64_t drr_object; + uint64_t drr_offset; + uint64_t drr_length; + uint64_t drr_toguid; +}; + +struct drr_write_byref { + /* where to put the data */ + uint64_t drr_object; + uint64_t drr_offset; + uint64_t drr_length; + uint64_t drr_toguid; + /* where to find the prior copy of the data */ + uint64_t drr_refguid; + uint64_t drr_refobject; + uint64_t drr_refoffset; + /* properties of the data */ + uint8_t drr_checksumtype; + uint8_t drr_checksumflags; + uint8_t drr_pad2[6]; + ddt_key_t drr_key; /* deduplication key */ +}; + +struct drr_spill { + uint64_t drr_object; + uint64_t drr_length; + uint64_t drr_toguid; + uint64_t drr_pad[4]; /* needed for crypto */ + /* spill data follows */ +}; + typedef struct dmu_replay_record { enum { DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS, @@ -123,79 +204,14 @@ typedef struct dmu_replay_record { } drr_type; uint32_t drr_payloadlen; union { - struct drr_begin { - uint64_t drr_magic; - uint64_t drr_versioninfo; /* was drr_version */ - uint64_t drr_creation_time; - dmu_objset_type_t drr_type; - uint32_t drr_flags; - uint64_t drr_toguid; - uint64_t drr_fromguid; - char drr_toname[MAXNAMELEN]; - } drr_begin; - struct drr_end { - zio_cksum_t drr_checksum; - uint64_t drr_toguid; - } drr_end; - struct drr_object { - uint64_t drr_object; - dmu_object_type_t drr_type; - dmu_object_type_t drr_bonustype; - uint32_t drr_blksz; - uint32_t drr_bonuslen; - uint8_t drr_checksumtype; - uint8_t drr_compress; - uint8_t drr_pad[6]; - uint64_t drr_toguid; - /* bonus content follows */ - } drr_object; - struct drr_freeobjects { - uint64_t drr_firstobj; - uint64_t drr_numobjs; - uint64_t drr_toguid; - } drr_freeobjects; - struct drr_write { - uint64_t drr_object; - dmu_object_type_t drr_type; - uint32_t drr_pad; - uint64_t drr_offset; - uint64_t drr_length; - uint64_t drr_toguid; - uint8_t drr_checksumtype; - uint8_t drr_checksumflags; - uint8_t drr_pad2[6]; - ddt_key_t drr_key; /* deduplication key */ - /* content follows */ - } drr_write; - struct drr_free { - uint64_t drr_object; - uint64_t drr_offset; - uint64_t drr_length; - uint64_t drr_toguid; - } drr_free; - struct drr_write_byref { - /* where to put the data */ - uint64_t drr_object; - uint64_t drr_offset; - uint64_t drr_length; - uint64_t drr_toguid; - /* where to find the prior copy of the data */ - uint64_t drr_refguid; - uint64_t drr_refobject; - uint64_t drr_refoffset; - /* properties of the data */ - uint8_t drr_checksumtype; - uint8_t drr_checksumflags; - uint8_t drr_pad2[6]; - ddt_key_t drr_key; /* deduplication key */ - } drr_write_byref; - struct drr_spill { - uint64_t drr_object; - uint64_t drr_length; - uint64_t drr_toguid; - uint64_t drr_pad[4]; /* needed for crypto */ - /* spill data follows */ - } drr_spill; + struct drr_begin drr_begin; + struct drr_end drr_end; + struct drr_object drr_object; + struct drr_freeobjects drr_freeobjects; + struct drr_write drr_write; + struct drr_free drr_free; + struct drr_write_byref drr_write_byref; + struct drr_spill drr_spill; } drr_u; } dmu_replay_record_t; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Jun 10 19:16:50 2011 (r222949) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Jun 10 20:10:30 2011 (r222950) @@ -426,22 +426,22 @@ struct zio { }; extern zio_t *zio_null(zio_t *pio, spa_t *spa, vdev_t *vd, - zio_done_func_t *done, void *private, enum zio_flag flags); + zio_done_func_t *done, void *priv, enum zio_flag flags); extern zio_t *zio_root(spa_t *spa, - zio_done_func_t *done, void *private, enum zio_flag flags); + zio_done_func_t *done, void *priv, enum zio_flag flags); extern zio_t *zio_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, void *data, - uint64_t size, zio_done_func_t *done, void *private, + uint64_t size, zio_done_func_t *done, void *priv, int priority, enum zio_flag flags, const zbookmark_t *zb); extern zio_t *zio_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, void *data, uint64_t size, const zio_prop_t *zp, - zio_done_func_t *ready, zio_done_func_t *done, void *private, + zio_done_func_t *ready, zio_done_func_t *done, void *priv, int priority, enum zio_flag flags, const zbookmark_t *zb); extern zio_t *zio_rewrite(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, - void *data, uint64_t size, zio_done_func_t *done, void *private, + void *data, uint64_t size, zio_done_func_t *done, void *priv, int priority, enum zio_flag flags, zbookmark_t *zb); extern void zio_write_override(zio_t *zio, blkptr_t *bp, int copies); @@ -450,19 +450,20 @@ extern void zio_free(spa_t *spa, uint64_ extern zio_t *zio_claim(zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp, - zio_done_func_t *done, void *private, enum zio_flag flags); + zio_done_func_t *done, void *priv, enum zio_flag flags); extern zio_t *zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd, - zio_done_func_t *done, void *private, int priority, enum zio_flag flags); + zio_done_func_t *done, void *priv, int priority, + enum zio_flag flags); extern zio_t *zio_read_phys(zio_t *pio, vdev_t *vd, uint64_t offset, uint64_t size, void *data, int checksum, - zio_done_func_t *done, void *private, int priority, enum zio_flag flags, + zio_done_func_t *done, void *priv, int priority, enum zio_flag flags, boolean_t labels); extern zio_t *zio_write_phys(zio_t *pio, vdev_t *vd, uint64_t offset, uint64_t size, void *data, int checksum, - zio_done_func_t *done, void *private, int priority, enum zio_flag flags, + zio_done_func_t *done, void *priv, int priority, enum zio_flag flags, boolean_t labels); extern zio_t *zio_free_sync(zio_t *pio, spa_t *spa, uint64_t txg, @@ -493,11 +494,11 @@ extern void zio_resubmit_stage_async(voi extern zio_t *zio_vdev_child_io(zio_t *zio, blkptr_t *bp, vdev_t *vd, uint64_t offset, void *data, uint64_t size, int type, int priority, - enum zio_flag flags, zio_done_func_t *done, void *private); + enum zio_flag flags, zio_done_func_t *done, void *priv); extern zio_t *zio_vdev_delegated_io(vdev_t *vd, uint64_t offset, void *data, uint64_t size, int type, int priority, - enum zio_flag flags, zio_done_func_t *done, void *private); + enum zio_flag flags, zio_done_func_t *done, void *priv); extern void zio_vdev_io_bypass(zio_t *zio); extern void zio_vdev_io_reissue(zio_t *zio); From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 20:23: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 48B80106566B; Fri, 10 Jun 2011 20:23:57 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F2E48FC08; Fri, 10 Jun 2011 20:23: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 p5AKNv7G042046; Fri, 10 Jun 2011 20:23:57 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5AKNvbd042043; Fri, 10 Jun 2011 20:23:57 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201106102023.p5AKNvbd042043@svn.freebsd.org> From: Attilio Rao Date: Fri, 10 Jun 2011 20:23: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: r222951 - head/sys/dev/aac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 10 Jun 2011 20:23:57 -0000 Author: attilio Date: Fri Jun 10 20:23:56 2011 New Revision: 222951 URL: http://svn.freebsd.org/changeset/base/222951 Log: - Fix races on detach handling of AAC_IFFLAGS_* mask - Fix races on setting AAC_AIFFLAGS_ALLOCFIBS - Remove some unused AAC_IFFLAGS_* bits. Please note that the kthread still makes a difference between the total mask and AAC_AIFFLAGS_ALLOCFIBS because more flags may be added in the future to aifflags. Sponsored by: Sandvine Incorporated Reported and reviewed by: emaste MFC after: 2 weeks Modified: head/sys/dev/aac/aac.c head/sys/dev/aac/aacvar.h Modified: head/sys/dev/aac/aac.c ============================================================================== --- head/sys/dev/aac/aac.c Fri Jun 10 20:10:30 2011 (r222950) +++ head/sys/dev/aac/aac.c Fri Jun 10 20:23:56 2011 (r222951) @@ -661,6 +661,16 @@ aac_detach(device_t dev) callout_drain(&sc->aac_daemontime); + mtx_lock(&sc->aac_io_lock); + while (sc->aifflags & AAC_AIFFLAGS_RUNNING) { + sc->aifflags |= AAC_AIFFLAGS_EXIT; + wakeup(sc->aifthread); + msleep(sc->aac_dev, &sc->aac_io_lock, PUSER, "aacdch", 0); + } + mtx_unlock(&sc->aac_io_lock); + KASSERT((sc->aifflags & AAC_AIFFLAGS_RUNNING) == 0, + ("%s: invalid detach state", __func__)); + /* Remove the child containers */ while ((co = TAILQ_FIRST(&sc->aac_container_tqh)) != NULL) { error = device_delete_child(dev, co->co_disk); @@ -679,15 +689,6 @@ aac_detach(device_t dev) free(sim, M_AACBUF); } - if (sc->aifflags & AAC_AIFFLAGS_RUNNING) { - sc->aifflags |= AAC_AIFFLAGS_EXIT; - wakeup(sc->aifthread); - tsleep(sc->aac_dev, PUSER | PCATCH, "aacdch", 30 * hz); - } - - if (sc->aifflags & AAC_AIFFLAGS_RUNNING) - panic("Cannot shutdown AIF thread"); - if ((error = aac_shutdown(dev))) return(error); @@ -1020,7 +1021,7 @@ aac_command_thread(struct aac_softc *sc) /* * First see if any FIBs need to be allocated. This needs * to be called without the driver lock because contigmalloc - * will grab Giant, and would result in an LOR. + * can sleep. */ if ((sc->aifflags & AAC_AIFFLAGS_ALLOCFIBS) != 0) { mtx_unlock(&sc->aac_io_lock); @@ -1372,7 +1373,9 @@ aac_alloc_command(struct aac_softc *sc, if ((cm = aac_dequeue_free(sc)) == NULL) { if (sc->total_fibs < sc->aac_max_fibs) { + mtx_lock(&sc->aac_io_lock); sc->aifflags |= AAC_AIFFLAGS_ALLOCFIBS; + mtx_unlock(&sc->aac_io_lock); wakeup(sc->aifthread); } return (EBUSY); Modified: head/sys/dev/aac/aacvar.h ============================================================================== --- head/sys/dev/aac/aacvar.h Fri Jun 10 20:10:30 2011 (r222950) +++ head/sys/dev/aac/aacvar.h Fri Jun 10 20:23:56 2011 (r222951) @@ -386,13 +386,12 @@ struct aac_softc struct proc *aifthread; int aifflags; #define AAC_AIFFLAGS_RUNNING (1 << 0) -#define AAC_AIFFLAGS_AIF (1 << 1) +#define AAC_AIFFLAGS_UNUSED0 (1 << 1) #define AAC_AIFFLAGS_EXIT (1 << 2) #define AAC_AIFFLAGS_EXITED (1 << 3) -#define AAC_AIFFLAGS_PRINTF (1 << 4) +#define AAC_AIFFLAGS_UNUSED1 (1 << 4) #define AAC_AIFFLAGS_ALLOCFIBS (1 << 5) -#define AAC_AIFFLAGS_PENDING (AAC_AIFFLAGS_AIF | AAC_AIFFLAGS_PRINTF | \ - AAC_AIFFLAGS_ALLOCFIBS) +#define AAC_AIFFLAGS_PENDING AAC_AIFFLAGS_ALLOCFIBS u_int32_t flags; #define AAC_FLAGS_PERC2QC (1 << 0) #define AAC_FLAGS_ENABLE_CAM (1 << 1) /* No SCSI passthrough */ From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 20:51: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 679051065672; Fri, 10 Jun 2011 20:51:41 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 581F58FC19; Fri, 10 Jun 2011 20:51:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5AKpfgk042847; Fri, 10 Jun 2011 20:51:41 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5AKpfNO042845; Fri, 10 Jun 2011 20:51:41 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201106102051.p5AKpfNO042845@svn.freebsd.org> From: "Justin T. Gibbs" Date: Fri, 10 Jun 2011 20:51: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: r222952 - head/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, 10 Jun 2011 20:51:41 -0000 Author: gibbs Date: Fri Jun 10 20:51:41 2011 New Revision: 222952 URL: http://svn.freebsd.org/changeset/base/222952 Log: Include sys/xen in cscope tag file generation. Modified: head/sys/Makefile Modified: head/sys/Makefile ============================================================================== --- head/sys/Makefile Fri Jun 10 20:23:56 2011 (r222951) +++ head/sys/Makefile Fri Jun 10 20:51:41 2011 (r222952) @@ -12,7 +12,7 @@ CSCOPEDIRS= boot bsm cam cddl compat con geom gnu isa kern libkern modules net net80211 netatalk \ netgraph netinet netinet6 netipsec netipx netnatm netncp \ netsmb nfs nfsclient nfsserver nlm opencrypto \ - pci rpc security sys ufs vm xdr ${CSCOPE_ARCHDIR} + pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} .if defined(ALL_ARCH) CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86 .else From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 22:15: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 26B3010656D2; Fri, 10 Jun 2011 22:15:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16ECA8FC0C; Fri, 10 Jun 2011 22:15: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 p5AMFaSI045369; Fri, 10 Jun 2011 22:15:36 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5AMFaPu045367; Fri, 10 Jun 2011 22:15:36 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201106102215.p5AMFaPu045367@svn.freebsd.org> From: Jeff Roberson Date: Fri, 10 Jun 2011 22:15: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: r222953 - 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: Fri, 10 Jun 2011 22:15:37 -0000 Author: jeff Date: Fri Jun 10 22:15:36 2011 New Revision: 222953 URL: http://svn.freebsd.org/changeset/base/222953 Log: - When printing bufs with show buf the lblkno is often more useful than the blkno. Print them both. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Fri Jun 10 20:51:41 2011 (r222952) +++ head/sys/kern/vfs_bio.c Fri Jun 10 22:15:36 2011 (r222953) @@ -3999,10 +3999,11 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) db_printf("b_flags = 0x%b\n", (u_int)bp->b_flags, PRINT_BUF_FLAGS); db_printf( "b_error = %d, b_bufsize = %ld, b_bcount = %ld, b_resid = %ld\n" - "b_bufobj = (%p), b_data = %p, b_blkno = %jd, b_dep = %p\n", + "b_bufobj = (%p), b_data = %p, b_blkno = %jd, b_lblkno = %jd, " + "b_dep = %p\n", bp->b_error, bp->b_bufsize, bp->b_bcount, bp->b_resid, bp->b_bufobj, bp->b_data, (intmax_t)bp->b_blkno, - bp->b_dep.lh_first); + (intmax_t)bp->b_lblkno, bp->b_dep.lh_first); if (bp->b_npages) { int i; db_printf("b_npages = %d, pages(OBJ, IDX, PA): ", bp->b_npages); From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 22:18: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 56F361065674; Fri, 10 Jun 2011 22:18:26 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0EF498FC0A; Fri, 10 Jun 2011 22:18: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 p5AMIPB1045496; Fri, 10 Jun 2011 22:18:25 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5AMIPoR045494; Fri, 10 Jun 2011 22:18:25 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201106102218.p5AMIPoR045494@svn.freebsd.org> From: Jeff Roberson Date: Fri, 10 Jun 2011 22:18: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: r222954 - head/sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2011 22:18:26 -0000 Author: jeff Date: Fri Jun 10 22:18:25 2011 New Revision: 222954 URL: http://svn.freebsd.org/changeset/base/222954 Log: - If the fsync in ufs_direnter fails SUJ can later panic because we have partially added a name. Allow ufs_direnter() to continue in the hopes that it is a transient error. If it is not, the directory is corrupted already from IO errors and writing this new block is not likely to make things worse. Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Fri Jun 10 22:15:36 2011 (r222953) +++ head/sys/ufs/ufs/ufs_lookup.c Fri Jun 10 22:18:25 2011 (r222954) @@ -967,7 +967,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdir return (0); if (tvp != NULL) VOP_UNLOCK(tvp, 0); - error = VOP_FSYNC(dvp, MNT_WAIT, td); + (void) VOP_FSYNC(dvp, MNT_WAIT, td); if (tvp != NULL) vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY); return (error); From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 22:19: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 B8E051065670; Fri, 10 Jun 2011 22:19:44 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A91D38FC0C; Fri, 10 Jun 2011 22:19: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 p5AMJiba045567; Fri, 10 Jun 2011 22:19:44 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5AMJiWf045564; Fri, 10 Jun 2011 22:19:44 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201106102219.p5AMJiWf045564@svn.freebsd.org> From: Jeff Roberson Date: Fri, 10 Jun 2011 22:19: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: r222955 - head/sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2011 22:19:44 -0000 Author: jeff Date: Fri Jun 10 22:19:44 2011 New Revision: 222955 URL: http://svn.freebsd.org/changeset/base/222955 Log: - Add support for referencing quota structures without needing the inode pointer for softupdates. Submitted by: mckusick Modified: head/sys/ufs/ufs/quota.h head/sys/ufs/ufs/ufs_quota.c Modified: head/sys/ufs/ufs/quota.h ============================================================================== --- head/sys/ufs/ufs/quota.h Fri Jun 10 22:18:25 2011 (r222954) +++ head/sys/ufs/ufs/quota.h Fri Jun 10 22:19:44 2011 (r222955) @@ -239,6 +239,12 @@ int setuse(struct thread *, struct mount int getquotasize(struct thread *, struct mount *, u_long, int, void *); vfs_quotactl_t ufs_quotactl; +#ifdef SOFTUPDATES +int quotaref(struct vnode *, struct dquot **); +void quotarele(struct dquot **); +void quotaadj(struct dquot **, struct ufsmount *, int64_t); +#endif /* SOFTUPDATES */ + #else /* !_KERNEL */ #include Modified: head/sys/ufs/ufs/ufs_quota.c ============================================================================== --- head/sys/ufs/ufs/ufs_quota.c Fri Jun 10 22:18:25 2011 (r222954) +++ head/sys/ufs/ufs/ufs_quota.c Fri Jun 10 22:19:44 2011 (r222955) @@ -1613,6 +1613,101 @@ dqflush(struct vnode *vp) } /* + * The following three functions are provided for the adjustment of + * quotas by the soft updates code. + */ +#ifdef SOFTUPDATES +/* + * Acquire a reference to the quota structures associated with a vnode. + * Return count of number of quota structures found. + */ +int +quotaref(vp, qrp) + struct vnode *vp; + struct dquot **qrp; +{ + struct inode *ip; + struct dquot *dq; + int i, found; + + for (i = 0; i < MAXQUOTAS; i++) + qrp[i] = NODQUOT; + /* + * Disk quotas must be turned off for system files. Currently + * snapshot and quota files. + */ + if ((vp->v_vflag & VV_SYSTEM) != 0) + return (0); + /* + * Iterate through and copy active quotas. + */ + found = 0; + ip = VTOI(vp); + for (i = 0; i < MAXQUOTAS; i++) { + if ((dq = ip->i_dquot[i]) == NODQUOT) + continue; + DQREF(dq); + qrp[i] = dq; + found++; + } + return (found); +} + +/* + * Release a set of quota structures obtained from a vnode. + */ +void +quotarele(qrp) + struct dquot **qrp; +{ + struct dquot *dq; + int i; + + for (i = 0; i < MAXQUOTAS; i++) { + if ((dq = qrp[i]) == NODQUOT) + continue; + dqrele(NULL, dq); + } +} + +/* + * Adjust the number of blocks associated with a quota. + * Positive numbers when adding blocks; negative numbers when freeing blocks. + */ +void +quotaadj(qrp, ump, blkcount) + struct dquot **qrp; + struct ufsmount *ump; + int64_t blkcount; +{ + struct dquot *dq; + ufs2_daddr_t ncurblocks; + int i; + + if (blkcount == 0) + return; + for (i = 0; i < MAXQUOTAS; i++) { + if ((dq = qrp[i]) == NODQUOT) + continue; + DQI_LOCK(dq); + DQI_WAIT(dq, PINOD+1, "adjqta"); + ncurblocks = dq->dq_curblocks + blkcount; + if (ncurblocks >= 0) + dq->dq_curblocks = ncurblocks; + else + dq->dq_curblocks = 0; + if (blkcount < 0) + dq->dq_flags &= ~DQ_BLKS; + else if (dq->dq_curblocks + blkcount >= dq->dq_bsoftlimit && + dq->dq_curblocks < dq->dq_bsoftlimit) + dq->dq_btime = time_second + ump->um_btime[i]; + dq->dq_flags |= DQ_MOD; + DQI_UNLOCK(dq); + } +} +#endif /* SOFTUPDATES */ + +/* * 32-bit / 64-bit conversion functions. * * 32-bit quota records are stored in native byte order. Attention must From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 22:38:32 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24F33106567B; Fri, 10 Jun 2011 22:38:32 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AFCA8FC13; Fri, 10 Jun 2011 22:38:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5AMcVnh046200; Fri, 10 Jun 2011 22:38:31 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5AMcVLK046198; Fri, 10 Jun 2011 22:38:31 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201106102238.p5AMcVLK046198@svn.freebsd.org> From: Jeff Roberson Date: Fri, 10 Jun 2011 22:38:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222956 - 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: Fri, 10 Jun 2011 22:38:32 -0000 Author: jeff Date: Fri Jun 10 22:38:31 2011 New Revision: 222956 URL: http://svn.freebsd.org/changeset/base/222956 Log: - Eliminate an incorrect include path from the mthca build. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Jun 10 22:19:44 2011 (r222955) +++ head/sys/conf/files Fri Jun 10 22:38:31 2011 (r222956) @@ -3152,41 +3152,41 @@ ofed/drivers/net/mlx4/en_tx.c optional compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" ofed/drivers/infiniband/hw/mthca/mthca_allocator.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_av.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_catas.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_cmd.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_cq.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_eq.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_mad.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_main.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_mcg.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_memfree.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_mr.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_pd.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_profile.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_provider.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_qp.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_reset.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_srq.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_uar.c optional mthca \ - no-depend compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/mthca/" + no-depend compile-with "${OFED_C}" # crypto support opencrypto/cast.c optional crypto | ipsec From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 22:42: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 16CA81065670; Fri, 10 Jun 2011 22:42: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 F0C108FC14; Fri, 10 Jun 2011 22:42: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 p5AMg0Sx046343; Fri, 10 Jun 2011 22:42:00 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5AMg0PN046338; Fri, 10 Jun 2011 22:42:00 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201106102242.p5AMg0PN046338@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 10 Jun 2011 22:42: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: r222957 - in head: bin/sh tools/regression/bin/sh/parameters X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 10 Jun 2011 22:42:01 -0000 Author: jilles Date: Fri Jun 10 22:42:00 2011 New Revision: 222957 URL: http://svn.freebsd.org/changeset/base/222957 Log: sh: Do parameter expansion on ENV before using it. This is required by POSIX, and allows things like ENV=\$HOME/.shrc. Note that tilde expansion is explicitly not performed. Added: head/tools/regression/bin/sh/parameters/env1.0 (contents, props changed) Modified: head/bin/sh/main.c head/bin/sh/sh.1 Modified: head/bin/sh/main.c ============================================================================== --- head/bin/sh/main.c Fri Jun 10 22:38:31 2011 (r222956) +++ head/bin/sh/main.c Fri Jun 10 22:42:00 2011 (r222957) @@ -78,7 +78,7 @@ int rootshell; struct jmploc main_handler; int localeisutf8, initial_localeisutf8; -static void read_profile(const char *); +static void read_profile(char *); static char *find_dot_file(char *); /* @@ -92,7 +92,7 @@ static char *find_dot_file(char *); int main(int argc, char *argv[]) { - struct stackmark smark; + struct stackmark smark, smark2; volatile int state; char *shinit; @@ -139,6 +139,7 @@ main(int argc, char *argv[]) rootshell = 1; init(); setstackmark(&smark); + setstackmark(&smark2); procargs(argc, argv); pwd_init(iflag); if (iflag) @@ -163,6 +164,7 @@ state2: } state3: state = 4; + popstackmark(&smark2); if (minusc) { evalstring(minusc, sflag ? 0 : EV_EXIT); } @@ -235,12 +237,16 @@ cmdloop(int top) */ static void -read_profile(const char *name) +read_profile(char *name) { int fd; + const char *expandedname; + expandedname = expandstr(name); + if (expandedname == NULL) + return; INTOFF; - if ((fd = open(name, O_RDONLY)) >= 0) + if ((fd = open(expandedname, O_RDONLY)) >= 0) setinputfd(fd, 1); INTON; if (fd < 0) Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Fri Jun 10 22:38:31 2011 (r222956) +++ head/bin/sh/sh.1 Fri Jun 10 22:42:00 2011 (r222957) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd June 9, 2011 +.Dd June 10, 2011 .Dt SH 1 .Os .Sh NAME @@ -124,8 +124,8 @@ If the environment variable .Ev ENV is set on entry to a shell, or is set in the .Pa .profile -of a login shell, the shell then reads commands from the file named in -.Ev ENV . +of a login shell, the shell then subjects its value to parameter expansion +and arithmetic expansion and reads commands from the named file. Therefore, a user should place commands that are to be executed only at login time in the .Pa .profile Added: head/tools/regression/bin/sh/parameters/env1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/parameters/env1.0 Fri Jun 10 22:42:00 2011 (r222957) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +export key='must contain this' +unset x +r=$(ENV="\${x?\$key}" ${SH} -i +m 2>&1 >/dev/null <<\EOF +exit 0 +EOF +) && case $r in +*"$key"*) true ;; +*) false ;; +esac From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 22:48: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 D38B6106564A; Fri, 10 Jun 2011 22:48:35 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1D5F8FC18; Fri, 10 Jun 2011 22:48: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 p5AMmZop046576; Fri, 10 Jun 2011 22:48:35 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5AMmZ0W046567; Fri, 10 Jun 2011 22:48:35 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201106102248.p5AMmZ0W046567@svn.freebsd.org> From: Jeff Roberson Date: Fri, 10 Jun 2011 22:48: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: r222958 - in head: sbin/fsck_ffs sys/sys sys/ufs/ffs sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2011 22:48:35 -0000 Author: jeff Date: Fri Jun 10 22:48:35 2011 New Revision: 222958 URL: http://svn.freebsd.org/changeset/base/222958 Log: Implement fully asynchronous partial truncation with softupdates journaling to resolve errors which can cause corruption on recovery with the old synchronous mechanism. - Append partial truncation freework structures to indirdeps while truncation is proceeding. These prevent new block pointers from becoming valid until truncation completes and serialize truncations. - On completion of a partial truncate journal work waits for zeroed pointers to hit indirects. - softdep_journal_freeblocks() handles last frag allocation and last block zeroing. - vtruncbuf/ffs_page_remove moved into softdep_*_freeblocks() so it is only implemented in one place. - Block allocation failure handling moved up one level so it does not proceed with buf locks held. This permits us to do more extensive reclaims when filesystem space is exhausted. - softdep_sync_metadata() is broken into two parts, the first executes once at the start of ffs_syncvnode() and flushes truncations and inode dependencies. The second is called on each locked buf. This eliminates excessive looping and rollbacks. - Improve the mechanism in process_worklist_item() that handles acquiring vnode locks for handle_workitem_remove() so that it works more generally and does not loop excessively over the same worklist items on each call. - Don't corrupt directories by zeroing the tail in fsck. This is only done for regular files. - Push a fsync complete record for files that need it so the checker knows a truncation in the journal is no longer valid. Discussed with: mckusick, kib (ffs_pages_remove and ffs_truncate parts) Tested by: pho Modified: head/sbin/fsck_ffs/suj.c head/sys/sys/vnode.h head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_balloc.c head/sys/ufs/ffs/ffs_extern.h head/sys/ufs/ffs/ffs_inode.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/ffs_vnops.c head/sys/ufs/ffs/fs.h head/sys/ufs/ffs/softdep.h head/sys/ufs/ufs/inode.h head/sys/ufs/ufs/ufsmount.h Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Fri Jun 10 22:42:00 2011 (r222957) +++ head/sbin/fsck_ffs/suj.c Fri Jun 10 22:48:35 2011 (r222958) @@ -1604,7 +1604,7 @@ ino_trunc(ino_t ino, off_t size) * uninitialized space later. */ off = blkoff(fs, size); - if (off) { + if (off && DIP(ip, di_mode) != IFDIR) { uint8_t *buf; long clrsize; @@ -1775,13 +1775,18 @@ cg_trunc(struct suj_cg *sc) struct suj_ino *sino; int i; - for (i = 0; i < SUJ_HASHSIZE; i++) - LIST_FOREACH(sino, &sc->sc_inohash[i], si_next) + for (i = 0; i < SUJ_HASHSIZE; i++) { + LIST_FOREACH(sino, &sc->sc_inohash[i], si_next) { if (sino->si_trunc) { ino_trunc(sino->si_ino, sino->si_trunc->jt_size); + sino->si_blkadj = 0; sino->si_trunc = NULL; } + if (sino->si_blkadj) + ino_adjblks(sino); + } + } } /* @@ -1791,7 +1796,6 @@ cg_trunc(struct suj_cg *sc) static void cg_check_blk(struct suj_cg *sc) { - struct suj_ino *sino; struct suj_blk *sblk; int i; @@ -1799,15 +1803,6 @@ cg_check_blk(struct suj_cg *sc) for (i = 0; i < SUJ_HASHSIZE; i++) LIST_FOREACH(sblk, &sc->sc_blkhash[i], sb_next) blk_check(sblk); - /* - * Now that we've freed blocks which are not referenced we - * make a second pass over all inodes to adjust their block - * counts. - */ - for (i = 0; i < SUJ_HASHSIZE; i++) - LIST_FOREACH(sino, &sc->sc_inohash[i], si_next) - if (sino->si_blkadj) - ino_adjblks(sino); } /* @@ -1961,14 +1956,7 @@ ino_append(union jrec *rec) "parent %d, diroff %jd\n", refrec->jr_op, refrec->jr_ino, refrec->jr_nlink, refrec->jr_parent, refrec->jr_diroff); - /* - * Lookup the ino and clear truncate if one is found. Partial - * truncates are always done synchronously so if we discover - * an operation that requires a lock the truncation has completed - * and can be discarded. - */ sino = ino_lookup(((struct jrefrec *)rec)->jr_ino, 1); - sino->si_trunc = NULL; sino->si_hasrecs = 1; srec = errmalloc(sizeof(*srec)); srec->sr_rec = rec; @@ -2174,9 +2162,7 @@ blk_build(struct jblkrec *blkrec) struct suj_rec *srec; struct suj_blk *sblk; struct jblkrec *blkrn; - struct suj_ino *sino; ufs2_daddr_t blk; - off_t foff; int frag; if (debug) @@ -2185,17 +2171,6 @@ blk_build(struct jblkrec *blkrec) blkrec->jb_op, blkrec->jb_blkno, blkrec->jb_frags, blkrec->jb_oldfrags, blkrec->jb_ino, blkrec->jb_lbn); - /* - * Look up the inode and clear the truncate if any lbns after the - * truncate lbn are freed or allocated. - */ - sino = ino_lookup(blkrec->jb_ino, 0); - if (sino && sino->si_trunc) { - foff = lblktosize(fs, blkrec->jb_lbn); - foff += lfragtosize(fs, blkrec->jb_frags); - if (foff > sino->si_trunc->jt_size) - sino->si_trunc = NULL; - } blk = blknum(fs, blkrec->jb_blkno); frag = fragnum(fs, blkrec->jb_blkno); sblk = blk_lookup(blk, 1); @@ -2242,10 +2217,15 @@ ino_build_trunc(struct jtrncrec *rec) struct suj_ino *sino; if (debug) - printf("ino_build_trunc: ino %d, size %jd\n", - rec->jt_ino, rec->jt_size); + printf("ino_build_trunc: op %d ino %d, size %jd\n", + rec->jt_op, rec->jt_ino, rec->jt_size); sino = ino_lookup(rec->jt_ino, 1); - sino->si_trunc = rec; + if (rec->jt_op == JOP_SYNC) { + sino->si_trunc = NULL; + return; + } + if (sino->si_trunc == NULL || sino->si_trunc->jt_size > rec->jt_size) + sino->si_trunc = rec; } /* Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Fri Jun 10 22:42:00 2011 (r222957) +++ head/sys/sys/vnode.h Fri Jun 10 22:48:35 2011 (r222958) @@ -302,6 +302,7 @@ struct vattr { #define IO_EXT 0x0400 /* operate on external attributes */ #define IO_NORMAL 0x0800 /* operate on regular data */ #define IO_NOMACCHECK 0x1000 /* MAC checks unnecessary */ +#define IO_BUFLOCKED 0x2000 /* ffs flag; indir buf is locked */ #define IO_SEQMAX 0x7F /* seq heuristic max value */ #define IO_SEQSHIFT 16 /* seq heuristic in upper 16 bits */ Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Fri Jun 10 22:42:00 2011 (r222957) +++ head/sys/ufs/ffs/ffs_alloc.c Fri Jun 10 22:48:35 2011 (r222958) @@ -217,7 +217,7 @@ nospace: (void) chkdq(ip, -btodb(size), cred, FORCE); UFS_LOCK(ump); #endif - if (reclaimed == 0) { + if (reclaimed == 0 && (flags & IO_BUFLOCKED) == 0) { reclaimed = 1; softdep_request_cleanup(fs, ITOV(ip), cred, FLUSH_BLOCKS_WAIT); goto retry; @@ -418,7 +418,7 @@ nospace: /* * no space available */ - if (reclaimed == 0) { + if (reclaimed == 0 && (flags & IO_BUFLOCKED) == 0) { reclaimed = 1; UFS_UNLOCK(ump); if (bp) { Modified: head/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_balloc.c Fri Jun 10 22:42:00 2011 (r222957) +++ head/sys/ufs/ffs/ffs_balloc.c Fri Jun 10 22:48:35 2011 (r222958) @@ -105,6 +105,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t ufs2_daddr_t *lbns_remfree, lbns[NIADDR + 1]; int unwindidx = -1; int saved_inbdflush; + int reclaimed; ip = VTOI(vp); dp = ip->i_din1; @@ -112,6 +113,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t ump = ip->i_ump; lbn = lblkno(fs, startoffset); size = blkoff(fs, startoffset) + size; + reclaimed = 0; if (size > fs->fs_bsize) panic("ffs_balloc_ufs1: blk too big"); *bpp = NULL; @@ -276,6 +278,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t /* * Fetch through the indirect blocks, allocating as necessary. */ +retry: for (i = 1;;) { error = bread(vp, indirs[i].in_lbn, (int)fs->fs_bsize, NOCRED, &bp); @@ -296,8 +299,15 @@ ffs_balloc_ufs1(struct vnode *vp, off_t if (pref == 0) pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, - flags, cred, &newb)) != 0) { + flags | IO_BUFLOCKED, cred, &newb)) != 0) { brelse(bp); + if (++reclaimed == 1) { + UFS_LOCK(ump); + softdep_request_cleanup(fs, vp, cred, + FLUSH_BLOCKS_WAIT); + UFS_UNLOCK(ump); + goto retry; + } goto fail; } nb = newb; @@ -349,10 +359,17 @@ ffs_balloc_ufs1(struct vnode *vp, off_t if (nb == 0) { UFS_LOCK(ump); pref = ffs_blkpref_ufs1(ip, lbn, indirs[i].in_off, &bap[0]); - error = ffs_alloc(ip, - lbn, pref, (int)fs->fs_bsize, flags, cred, &newb); + error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, + flags | IO_BUFLOCKED, cred, &newb); if (error) { brelse(bp); + if (++reclaimed == 1) { + UFS_LOCK(ump); + softdep_request_cleanup(fs, vp, cred, + FLUSH_BLOCKS_WAIT); + UFS_UNLOCK(ump); + goto retry; + } goto fail; } nb = newb; @@ -506,6 +523,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t int deallocated, osize, nsize, num, i, error; int unwindidx = -1; int saved_inbdflush; + int reclaimed; ip = VTOI(vp); dp = ip->i_din2; @@ -513,6 +531,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t ump = ip->i_ump; lbn = lblkno(fs, startoffset); size = blkoff(fs, startoffset) + size; + reclaimed = 0; if (size > fs->fs_bsize) panic("ffs_balloc_ufs2: blk too big"); *bpp = NULL; @@ -787,6 +806,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t /* * Fetch through the indirect blocks, allocating as necessary. */ +retry: for (i = 1;;) { error = bread(vp, indirs[i].in_lbn, (int)fs->fs_bsize, NOCRED, &bp); @@ -807,8 +827,15 @@ ffs_balloc_ufs2(struct vnode *vp, off_t if (pref == 0) pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, - flags, cred, &newb)) != 0) { + flags | IO_BUFLOCKED, cred, &newb)) != 0) { brelse(bp); + if (++reclaimed == 1) { + UFS_LOCK(ump); + softdep_request_cleanup(fs, vp, cred, + FLUSH_BLOCKS_WAIT); + UFS_UNLOCK(ump); + goto retry; + } goto fail; } nb = newb; @@ -860,10 +887,17 @@ ffs_balloc_ufs2(struct vnode *vp, off_t if (nb == 0) { UFS_LOCK(ump); pref = ffs_blkpref_ufs2(ip, lbn, indirs[i].in_off, &bap[0]); - error = ffs_alloc(ip, - lbn, pref, (int)fs->fs_bsize, flags, cred, &newb); + error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, + flags | IO_BUFLOCKED, cred, &newb); if (error) { brelse(bp); + if (++reclaimed == 1) { + UFS_LOCK(ump); + softdep_request_cleanup(fs, vp, cred, + FLUSH_BLOCKS_WAIT); + UFS_UNLOCK(ump); + goto retry; + } goto fail; } nb = newb; Modified: head/sys/ufs/ffs/ffs_extern.h ============================================================================== --- head/sys/ufs/ffs/ffs_extern.h Fri Jun 10 22:42:00 2011 (r222957) +++ head/sys/ufs/ffs/ffs_extern.h Fri Jun 10 22:48:35 2011 (r222958) @@ -74,6 +74,7 @@ int ffs_isfreeblock(struct fs *, u_char void ffs_load_inode(struct buf *, struct inode *, struct fs *, ino_t); int ffs_mountroot(void); void ffs_oldfscompat_write(struct fs *, struct ufsmount *); +void ffs_pages_remove(struct vnode *vp, vm_pindex_t start, vm_pindex_t end); int ffs_reallocblks(struct vop_reallocblks_args *); int ffs_realloccg(struct inode *, ufs2_daddr_t, ufs2_daddr_t, ufs2_daddr_t, int, int, int, struct ucred *, struct buf **); @@ -107,7 +108,6 @@ extern struct vop_vector ffs_fifoops2; int softdep_check_suspend(struct mount *, struct vnode *, int, int, int, int); -int softdep_complete_trunc(struct vnode *, void *); void softdep_get_depcounts(struct mount *, int *, int *); void softdep_initialize(void); void softdep_uninitialize(void); @@ -139,14 +139,17 @@ void softdep_setup_blkfree(struct mount void softdep_setup_inofree(struct mount *, struct buf *, ino_t, struct workhead *); void softdep_setup_sbupdate(struct ufsmount *, struct fs *, struct buf *); -void *softdep_setup_trunc(struct vnode *vp, off_t length, int flags); void softdep_fsync_mountdev(struct vnode *); int softdep_sync_metadata(struct vnode *); +int softdep_sync_buf(struct vnode *, struct buf *, int); int softdep_process_worklist(struct mount *, int); int softdep_fsync(struct vnode *); int softdep_waitidle(struct mount *); int softdep_prealloc(struct vnode *, int); int softdep_journal_lookup(struct mount *, struct vnode **); +void softdep_journal_freeblocks(struct inode *, struct ucred *, off_t, int); +void softdep_journal_fsync(struct inode *); + /* * Things to request flushing in softdep_request_cleanup() Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Fri Jun 10 22:42:00 2011 (r222957) +++ head/sys/ufs/ffs/ffs_inode.c Fri Jun 10 22:48:35 2011 (r222958) @@ -120,7 +120,7 @@ ffs_update(vp, waitfor) } } -static void +void ffs_pages_remove(struct vnode *vp, vm_pindex_t start, vm_pindex_t end) { vm_object_t object; @@ -151,12 +151,12 @@ ffs_truncate(vp, length, flags, cred, td ufs2_daddr_t bn, lbn, lastblock, lastiblock[NIADDR], indir_lbn[NIADDR]; ufs2_daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; ufs2_daddr_t count, blocksreleased = 0, datablocks; - void *cookie; struct bufobj *bo; struct fs *fs; struct buf *bp; struct ufsmount *ump; - int needextclean, softdepslowdown, extblocks; + int softdeptrunc, journaltrunc; + int needextclean, extblocks; int offset, size, level, nblocks; int i, error, allerror; off_t osize; @@ -165,7 +165,6 @@ ffs_truncate(vp, length, flags, cred, td fs = ip->i_fs; ump = ip->i_ump; bo = &vp->v_bufobj; - cookie = NULL; ASSERT_VOP_LOCKED(vp, "ffs_truncate"); @@ -173,6 +172,11 @@ ffs_truncate(vp, length, flags, cred, td return (EINVAL); if (length > fs->fs_maxfilesize) return (EFBIG); +#ifdef QUOTA + error = getinoquota(ip); + if (error) + return (error); +#endif /* * Historically clients did not have to specify which data * they were truncating. So, if not specified, we assume @@ -191,7 +195,10 @@ ffs_truncate(vp, length, flags, cred, td */ allerror = 0; needextclean = 0; - softdepslowdown = DOINGSOFTDEP(vp) && softdep_slowdown(vp); + softdeptrunc = 0; + journaltrunc = DOINGSUJ(vp); + if (journaltrunc == 0 && DOINGSOFTDEP(vp) && length == 0) + softdeptrunc = !softdep_slowdown(vp); extblocks = 0; datablocks = DIP(ip, i_blocks); if (fs->fs_magic == FS_UFS2_MAGIC && ip->i_din2->di_extsize > 0) { @@ -199,27 +206,23 @@ ffs_truncate(vp, length, flags, cred, td datablocks -= extblocks; } if ((flags & IO_EXT) && extblocks > 0) { - if (DOINGSOFTDEP(vp) && softdepslowdown == 0 && length == 0) { - if ((flags & IO_NORMAL) == 0) { - softdep_setup_freeblocks(ip, length, IO_EXT); - return (0); - } + if (length != 0) + panic("ffs_truncate: partial trunc of extdata"); + if (softdeptrunc || journaltrunc) { + if ((flags & IO_NORMAL) == 0) + goto extclean; needextclean = 1; } else { - if (length != 0) - panic("ffs_truncate: partial trunc of extdata"); if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0) return (error); - if (DOINGSUJ(vp)) - cookie = softdep_setup_trunc(vp, length, flags); - osize = ip->i_din2->di_extsize; - ip->i_din2->di_blocks -= extblocks; #ifdef QUOTA (void) chkdq(ip, -extblocks, NOCRED, 0); #endif vinvalbuf(vp, V_ALT, 0, 0); ffs_pages_remove(vp, OFF_TO_IDX(lblktosize(fs, -extblocks)), 0); + osize = ip->i_din2->di_extsize; + ip->i_din2->di_blocks -= extblocks; ip->i_din2->di_extsize = 0; for (i = 0; i < NXADDR; i++) { oldblks[i] = ip->i_din2->di_extb[i]; @@ -227,7 +230,7 @@ ffs_truncate(vp, length, flags, cred, td } ip->i_flag |= IN_CHANGE; if ((error = ffs_update(vp, 1))) - goto out; + return (error); for (i = 0; i < NXADDR; i++) { if (oldblks[i] == 0) continue; @@ -236,10 +239,8 @@ ffs_truncate(vp, length, flags, cred, td } } } - if ((flags & IO_NORMAL) == 0) { - error = 0; - goto out; - } + if ((flags & IO_NORMAL) == 0) + return (0); if (vp->v_type == VLNK && (ip->i_size < vp->v_mount->mnt_maxsymlinklen || datablocks == 0)) { @@ -252,24 +253,17 @@ ffs_truncate(vp, length, flags, cred, td DIP_SET(ip, i_size, 0); ip->i_flag |= IN_CHANGE | IN_UPDATE; if (needextclean) - softdep_setup_freeblocks(ip, length, IO_EXT); - error = ffs_update(vp, 1); - goto out; + goto extclean; + return ffs_update(vp, 1); } if (ip->i_size == length) { ip->i_flag |= IN_CHANGE | IN_UPDATE; if (needextclean) - softdep_setup_freeblocks(ip, length, IO_EXT); - error = ffs_update(vp, 0); - goto out; + goto extclean; + return ffs_update(vp, 0); } if (fs->fs_ronly) panic("ffs_truncate: read-only filesystem"); -#ifdef QUOTA - error = getinoquota(ip); - if (error) - goto out; -#endif if ((ip->i_flags & SF_SNAPSHOT) != 0) ffs_snapremove(vp); vp->v_lasta = vp->v_clen = vp->v_cstart = vp->v_lastw = 0; @@ -285,7 +279,7 @@ ffs_truncate(vp, length, flags, cred, td error = UFS_BALLOC(vp, length - 1, 1, cred, flags, &bp); if (error) { vnode_pager_setsize(vp, osize); - goto out; + return (error); } ip->i_size = length; DIP_SET(ip, i_size, length); @@ -296,11 +290,10 @@ ffs_truncate(vp, length, flags, cred, td else bawrite(bp); ip->i_flag |= IN_CHANGE | IN_UPDATE; - error = ffs_update(vp, 1); - goto out; + return ffs_update(vp, 1); } if (DOINGSOFTDEP(vp)) { - if (length > 0 || softdepslowdown) { + if (softdeptrunc == 0 && journaltrunc == 0) { /* * If a file is only partially truncated, then * we have to clean up the data structures @@ -311,29 +304,20 @@ ffs_truncate(vp, length, flags, cred, td * so that it will have no data structures left. */ if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0) - goto out; - /* - * We have to journal the truncation before we change - * any blocks so we don't leave the file partially - * truncated. - */ - if (DOINGSUJ(vp) && cookie == NULL) - cookie = softdep_setup_trunc(vp, length, flags); + return (error); } else { -#ifdef QUOTA - (void) chkdq(ip, -datablocks, NOCRED, 0); -#endif - softdep_setup_freeblocks(ip, length, needextclean ? - IO_EXT | IO_NORMAL : IO_NORMAL); + flags = IO_NORMAL | (needextclean ? IO_EXT: 0); + if (journaltrunc) + softdep_journal_freeblocks(ip, cred, length, + flags); + else + softdep_setup_freeblocks(ip, length, flags); ASSERT_VOP_LOCKED(vp, "ffs_truncate1"); - vinvalbuf(vp, needextclean ? 0 : V_NORMAL, 0, 0); - if (!needextclean) - ffs_pages_remove(vp, 0, - OFF_TO_IDX(lblktosize(fs, -extblocks))); - vnode_pager_setsize(vp, 0); - ip->i_flag |= IN_CHANGE | IN_UPDATE; - error = ffs_update(vp, 0); - goto out; + if (journaltrunc == 0) { + ip->i_flag |= IN_CHANGE | IN_UPDATE; + error = ffs_update(vp, 0); + } + return (error); } } /* @@ -353,7 +337,7 @@ ffs_truncate(vp, length, flags, cred, td flags |= BA_CLRBUF; error = UFS_BALLOC(vp, length - 1, 1, cred, flags, &bp); if (error) - goto out; + return (error); /* * When we are doing soft updates and the UFS_BALLOC * above fills in a direct block hole with a full sized @@ -365,7 +349,7 @@ ffs_truncate(vp, length, flags, cred, td if (DOINGSOFTDEP(vp) && lbn < NDADDR && fragroundup(fs, blkoff(fs, length)) < fs->fs_bsize && (error = ffs_syncvnode(vp, MNT_WAIT)) != 0) - goto out; + return (error); ip->i_size = length; DIP_SET(ip, i_size, length); size = blksize(fs, ip, lbn); @@ -411,13 +395,7 @@ ffs_truncate(vp, length, flags, cred, td DIP_SET(ip, i_db[i], 0); } ip->i_flag |= IN_CHANGE | IN_UPDATE; - /* - * When doing softupdate journaling we must preserve the size along - * with the old pointers until they are freed or we might not - * know how many fragments remain. - */ - if (!DOINGSUJ(vp)) - allerror = ffs_update(vp, 1); + allerror = ffs_update(vp, 1); /* * Having written the new inode to disk, save its new configuration @@ -541,14 +519,14 @@ done: #ifdef QUOTA (void) chkdq(ip, -blocksreleased, NOCRED, 0); #endif - error = allerror; -out: - if (cookie) { - allerror = softdep_complete_trunc(vp, cookie); - if (allerror != 0 && error == 0) - error = allerror; - } - return (error); + return (allerror); + +extclean: + if (journaltrunc) + softdep_journal_freeblocks(ip, cred, length, IO_EXT); + else + softdep_setup_freeblocks(ip, length, IO_EXT); + return ffs_update(vp, MNT_WAIT); } /* Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri Jun 10 22:42:00 2011 (r222957) +++ head/sys/ufs/ffs/ffs_softdep.c Fri Jun 10 22:48:35 2011 (r222958) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -71,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include #include #include @@ -82,6 +84,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include @@ -214,6 +218,25 @@ softdep_setup_allocindir_meta(nbp, ip, b } void +softdep_journal_freeblocks(ip, cred, length, flags) + struct inode *ip; + struct ucred *cred; + off_t length; + int flags; +{ + + panic("softdep_journal_freeblocks called"); +} + +void +softdep_journal_fsync(ip) + struct inode *ip; +{ + + panic("softdep_journal_fsync called"); +} + +void softdep_setup_freeblocks(ip, length, flags) struct inode *ip; off_t length; @@ -282,29 +305,6 @@ softdep_setup_directory_change(bp, dp, i panic("softdep_setup_directory_change called"); } -void * -softdep_setup_trunc(vp, length, flags) - struct vnode *vp; - off_t length; - int flags; -{ - - panic("%s called", __FUNCTION__); - - return (NULL); -} - -int -softdep_complete_trunc(vp, cookie) - struct vnode *vp; - void *cookie; -{ - - panic("%s called", __FUNCTION__); - - return (0); -} - void softdep_setup_blkfree(mp, bp, blkno, frags, wkhd) struct mount *mp; @@ -499,6 +499,13 @@ softdep_sync_metadata(struct vnode *vp) } int +softdep_sync_buf(struct vnode *vp, struct buf *bp, int waitfor) +{ + + return (0); +} + +int softdep_slowdown(vp) struct vnode *vp; { @@ -614,10 +621,13 @@ FEATURE(softupdates, "FFS soft-updates s #define D_JSEGDEP 23 #define D_SBDEP 24 #define D_JTRUNC 25 -#define D_LAST D_JTRUNC +#define D_JFSYNC 26 +#define D_SENTINAL 27 +#define D_LAST D_SENTINAL unsigned long dep_current[D_LAST + 1]; unsigned long dep_total[D_LAST + 1]; +unsigned long dep_write[D_LAST + 1]; SYSCTL_NODE(_debug, OID_AUTO, softdep, CTLFLAG_RW, 0, "soft updates stats"); @@ -625,13 +635,17 @@ SYSCTL_NODE(_debug_softdep, OID_AUTO, to "total dependencies allocated"); SYSCTL_NODE(_debug_softdep, OID_AUTO, current, CTLFLAG_RW, 0, "current dependencies allocated"); +SYSCTL_NODE(_debug_softdep, OID_AUTO, write, CTLFLAG_RW, 0, + "current dependencies written"); #define SOFTDEP_TYPE(type, str, long) \ static MALLOC_DEFINE(M_ ## type, #str, long); \ SYSCTL_ULONG(_debug_softdep_total, OID_AUTO, str, CTLFLAG_RD, \ &dep_total[D_ ## type], 0, ""); \ SYSCTL_ULONG(_debug_softdep_current, OID_AUTO, str, CTLFLAG_RD, \ - &dep_current[D_ ## type], 0, ""); + &dep_current[D_ ## type], 0, ""); \ + SYSCTL_ULONG(_debug_softdep_write, OID_AUTO, str, CTLFLAG_RD, \ + &dep_write[D_ ## type], 0, ""); SOFTDEP_TYPE(PAGEDEP, pagedep, "File page dependencies"); SOFTDEP_TYPE(INODEDEP, inodedep, "Inode dependencies"); @@ -660,6 +674,7 @@ SOFTDEP_TYPE(JSEG, jseg, "Journal segmen SOFTDEP_TYPE(JSEGDEP, jsegdep, "Journal segment complete"); SOFTDEP_TYPE(SBDEP, sbdep, "Superblock write dependency"); SOFTDEP_TYPE(JTRUNC, jtrunc, "Journal inode truncation"); +SOFTDEP_TYPE(JFSYNC, jfsync, "Journal fsync complete"); static MALLOC_DEFINE(M_SAVEDINO, "savedino", "Saved inodes"); static MALLOC_DEFINE(M_JBLOCKS, "jblocks", "Journal block locations"); @@ -694,7 +709,8 @@ static struct malloc_type *memtype[] = { M_JSEG, M_JSEGDEP, M_SBDEP, - M_JTRUNC + M_JTRUNC, + M_JFSYNC }; static LIST_HEAD(mkdirlist, mkdir) mkdirlisthd; @@ -734,10 +750,11 @@ static void clear_unlinked_inodedep(stru static struct inodedep *first_unlinked_inodedep(struct ufsmount *); static int flush_pagedep_deps(struct vnode *, struct mount *, struct diraddhd *); -static void free_pagedep(struct pagedep *); +static int free_pagedep(struct pagedep *); static int flush_newblk_dep(struct vnode *, struct mount *, ufs_lbn_t); -static int flush_inodedep_deps(struct mount *, ino_t); +static int flush_inodedep_deps(struct vnode *, struct mount *, ino_t); static int flush_deplist(struct allocdirectlst *, int, int *); +static int sync_cgs(struct mount *, int); static int handle_written_filepage(struct pagedep *, struct buf *); static int handle_written_sbdep(struct sbdep *, struct buf *); static void initiate_write_sbdep(struct sbdep *); @@ -750,7 +767,7 @@ static void handle_written_jaddref(struc static void handle_written_jremref(struct jremref *); static void handle_written_jseg(struct jseg *, struct buf *); static void handle_written_jnewblk(struct jnewblk *); -static void handle_written_jfreeblk(struct jfreeblk *); +static void handle_written_jblkdep(struct jblkdep *); static void handle_written_jfreefrag(struct jfreefrag *); static void complete_jseg(struct jseg *); static void jseg_write(struct ufsmount *ump, struct jseg *, uint8_t *); @@ -758,6 +775,7 @@ static void jaddref_write(struct jaddref static void jremref_write(struct jremref *, struct jseg *, uint8_t *); static void jmvref_write(struct jmvref *, struct jseg *, uint8_t *); static void jtrunc_write(struct jtrunc *, struct jseg *, uint8_t *); +static void jfsync_write(struct jfsync *, struct jseg *, uint8_t *data); static void jnewblk_write(struct jnewblk *, struct jseg *, uint8_t *); static void jfreeblk_write(struct jfreeblk *, struct jseg *, uint8_t *); static void jfreefrag_write(struct jfreefrag *, struct jseg *, uint8_t *); @@ -768,7 +786,9 @@ static void handle_allocdirect_partdone( static struct jnewblk *cancel_newblk(struct newblk *, struct worklist *, struct workhead *); static void indirdep_complete(struct indirdep *); -static int indirblk_inseg(struct mount *, ufs2_daddr_t); +static int indirblk_lookup(struct mount *, ufs2_daddr_t); +static void indirblk_insert(struct freework *); +static void indirblk_remove(struct freework *); static void handle_allocindir_partdone(struct allocindir *); static void initiate_write_filepage(struct pagedep *, struct buf *); static void initiate_write_indirdep(struct indirdep*, struct buf *); @@ -777,10 +797,12 @@ static void initiate_write_bmsafemap(str static void initiate_write_inodeblock_ufs1(struct inodedep *, struct buf *); static void initiate_write_inodeblock_ufs2(struct inodedep *, struct buf *); static void handle_workitem_freefile(struct freefile *); -static void handle_workitem_remove(struct dirrem *, struct vnode *); +static int handle_workitem_remove(struct dirrem *, int); static struct dirrem *newdirrem(struct buf *, struct inode *, struct inode *, int, struct dirrem **); -static void cancel_indirdep(struct indirdep *, struct buf *, struct inodedep *, +static struct indirdep *indirdep_lookup(struct mount *, struct inode *, + struct buf *); +static void cancel_indirdep(struct indirdep *, struct buf *, struct freeblks *); static void free_indirdep(struct indirdep *); static void free_diradd(struct diradd *, struct workhead *); @@ -795,8 +817,13 @@ static void cancel_diradd(struct diradd struct jremref *, struct jremref *); static void dirrem_journal(struct dirrem *, struct jremref *, struct jremref *, struct jremref *); -static void cancel_allocindir(struct allocindir *, struct inodedep *, - struct freeblks *); +static void cancel_allocindir(struct allocindir *, struct buf *bp, + struct freeblks *, int); +static int setup_trunc_indir(struct freeblks *, struct inode *, + ufs_lbn_t, ufs_lbn_t, ufs2_daddr_t); +static void complete_trunc_indir(struct freework *); +static void trunc_indirdep(struct indirdep *, struct freeblks *, struct buf *, + int); static void complete_mkdir(struct mkdir *); static void free_newdirblk(struct newdirblk *); static void free_jremref(struct jremref *); @@ -806,7 +833,7 @@ static void free_jsegs(struct jblocks *) static void rele_jseg(struct jseg *); static void free_jseg(struct jseg *, struct jblocks *); static void free_jnewblk(struct jnewblk *); -static void free_jfreeblk(struct jfreeblk *); +static void free_jblkdep(struct jblkdep *); static void free_jfreefrag(struct jfreefrag *); static void free_freedep(struct freedep *); static void journal_jremref(struct dirrem *, struct jremref *, @@ -818,30 +845,33 @@ static void cancel_jfreefrag(struct jfre static inline void setup_freedirect(struct freeblks *, struct inode *, int, int); static inline void setup_freeext(struct freeblks *, struct inode *, int, int); -static inline void setup_freeindir(struct freeblks *, struct inode *, int i, +static inline void setup_freeindir(struct freeblks *, struct inode *, int, ufs_lbn_t, int); static inline struct freeblks *newfreeblks(struct mount *, struct inode *); static void indir_trunc(struct freework *, ufs2_daddr_t, ufs_lbn_t); -static void softdep_trunc_deps(struct vnode *, struct freeblks *, ufs_lbn_t, +ufs2_daddr_t blkcount(struct fs *, ufs2_daddr_t, off_t); +static int trunc_check_buf(struct buf *, int *, ufs_lbn_t, int, int); +static void trunc_dependencies(struct inode *, struct freeblks *, ufs_lbn_t, int, int); -static int cancel_pagedep(struct pagedep *, struct inodedep *, - struct freeblks *); -static int deallocate_dependencies(struct buf *, struct inodedep *, - struct freeblks *, int off); +static void trunc_pages(struct inode *, off_t, ufs2_daddr_t, int); +static int cancel_pagedep(struct pagedep *, struct freeblks *, int); +static int deallocate_dependencies(struct buf *, struct freeblks *, int); +static void newblk_freefrag(struct newblk*); static void free_newblk(struct newblk *); static void cancel_allocdirect(struct allocdirectlst *, - struct allocdirect *, struct freeblks *, int); + struct allocdirect *, struct freeblks *); static int check_inode_unwritten(struct inodedep *); static int free_inodedep(struct inodedep *); static void freework_freeblock(struct freework *); -static void handle_workitem_freeblocks(struct freeblks *, int); -static void handle_complete_freeblocks(struct freeblks *); +static void freework_enqueue(struct freework *); +static int handle_workitem_freeblocks(struct freeblks *, int); +static int handle_complete_freeblocks(struct freeblks *, int); static void handle_workitem_indirblk(struct freework *); -static void handle_written_freework(struct freework *); +static void handle_written_freework(struct freework *, int); static void merge_inode_lists(struct allocdirectlst *,struct allocdirectlst *); static struct worklist *jnewblk_merge(struct worklist *, struct worklist *, struct workhead *); -static void setup_allocindir_phase2(struct buf *, struct inode *, +static struct freefrag *setup_allocindir_phase2(struct buf *, struct inode *, struct inodedep *, struct allocindir *, ufs_lbn_t); static struct allocindir *newallocindir(struct inode *, int, ufs2_daddr_t, ufs2_daddr_t, ufs_lbn_t); @@ -862,16 +892,20 @@ static int newblk_lookup(struct mount *, static int inodedep_find(struct inodedep_hashhead *, struct fs *, ino_t, struct inodedep **); static int inodedep_lookup(struct mount *, ino_t, int, struct inodedep **); -static int pagedep_lookup(struct mount *, ino_t, ufs_lbn_t, int, - struct pagedep **); +static int pagedep_lookup(struct mount *, struct buf *bp, ino_t, ufs_lbn_t, + int, struct pagedep **); static int pagedep_find(struct pagedep_hashhead *, ino_t, ufs_lbn_t, struct mount *mp, int, struct pagedep **); static void pause_timer(void *); static int request_cleanup(struct mount *, int); -static int process_worklist_item(struct mount *, int); +static int process_worklist_item(struct mount *, int, int); static void process_removes(struct vnode *); +static void process_truncates(struct vnode *); static void jwork_move(struct workhead *, struct workhead *); +static void jwork_insert(struct workhead *, struct jsegdep *); static void add_to_worklist(struct worklist *, int); +static void wake_worklist(struct worklist *); +static void wait_worklist(struct worklist *, char *); static void remove_from_worklist(struct worklist *); static void softdep_flush(void); static int softdep_speedup(void); @@ -889,17 +923,20 @@ static struct jremref *newjremref(struct struct inode *ip, off_t, nlink_t); static struct jaddref *newjaddref(struct inode *, ino_t, off_t, int16_t, uint16_t); -static inline void newinoref(struct inoref *, ino_t, ino_t, off_t, nlink_t, +static inline void newinoref(struct inoref *, ino_t, ino_t, off_t, nlink_t, uint16_t); -static inline struct jsegdep *inoref_jseg(struct inoref *); +static inline struct jsegdep *inoref_jseg(struct inoref *); static struct jmvref *newjmvref(struct inode *, ino_t, off_t, off_t); static struct jfreeblk *newjfreeblk(struct freeblks *, ufs_lbn_t, ufs2_daddr_t, int); +static struct jtrunc *newjtrunc(struct freeblks *, off_t, int); +static void move_newblock_dep(struct jaddref *, struct inodedep *); +static void cancel_jfreeblk(struct freeblks *, ufs2_daddr_t); static struct jfreefrag *newjfreefrag(struct freefrag *, struct inode *, ufs2_daddr_t, long, ufs_lbn_t); static struct freework *newfreework(struct ufsmount *, struct freeblks *, - struct freework *, ufs_lbn_t, ufs2_daddr_t, int, int); -static void jwait(struct worklist *wk); + struct freework *, ufs_lbn_t, ufs2_daddr_t, int, int, int); +static int jwait(struct worklist *, int); static struct inodedep *inodedep_lookup_ip(struct inode *); static int bmsafemap_rollbacks(struct bmsafemap *); static struct freefile *handle_bufwait(struct inodedep *, struct workhead *); @@ -1064,6 +1101,30 @@ jwork_move(dst, src) } } +static void +jwork_insert(dst, jsegdep) + struct workhead *dst; + struct jsegdep *jsegdep; +{ + struct jsegdep *jsegdepn; + struct worklist *wk; + + LIST_FOREACH(wk, dst, wk_list) + if (wk->wk_type == D_JSEGDEP) + break; + if (wk == NULL) { + WORKLIST_INSERT(dst, &jsegdep->jd_list); + return; + } + jsegdepn = WK_JSEGDEP(wk); + if (jsegdep->jd_seg->js_seq < jsegdepn->jd_seg->js_seq) { + WORKLIST_REMOVE(wk); + free_jsegdep(jsegdepn); + WORKLIST_INSERT(dst, &jsegdep->jd_list); + } else + free_jsegdep(jsegdep); +} + /* * Routines for tracking and managing workitems. */ @@ -1088,6 +1149,8 @@ workitem_free(item, type) panic("workitem_free: type mismatch %s != %s", TYPENAME(item->wk_type), TYPENAME(type)); #endif + if (item->wk_state & IOWAITING) + wakeup(item); ump = VFSTOUFS(item->wk_mp); if (--ump->softdep_deps == 0 && ump->softdep_req) wakeup(&ump->softdep_deps); @@ -1101,14 +1164,18 @@ workitem_alloc(item, type, mp) int type; struct mount *mp; { + struct ufsmount *ump; + item->wk_type = type; item->wk_mp = mp; item->wk_state = 0; + + ump = VFSTOUFS(mp); ACQUIRE_LOCK(&lk); dep_current[type]++; dep_total[type]++; - VFSTOUFS(mp)->softdep_deps++; - VFSTOUFS(mp)->softdep_accdeps++; + ump->softdep_deps++; + ump->softdep_accdeps++; FREE_LOCK(&lk); } @@ -1270,8 +1337,7 @@ softdep_flush(void) vfslocked = VFS_LOCK_GIANT(mp); progress += softdep_process_worklist(mp, 0); ump = VFSTOUFS(mp); - remaining += ump->softdep_on_worklist - - ump->softdep_on_worklist_inprogress; + remaining += ump->softdep_on_worklist; VFS_UNLOCK_GIANT(vfslocked); mtx_lock(&mountlist_mtx); nmp = TAILQ_NEXT(mp, mnt_list); @@ -1314,10 +1380,14 @@ softdep_speedup(void) * The following routine is the only one that removes items * and does so in order from first to last. */ + +#define WK_HEAD 0x0001 /* Add to HEAD. */ +#define WK_NODELAY 0x0002 /* Process immediately. */ + static void -add_to_worklist(wk, nodelay) +add_to_worklist(wk, flags) struct worklist *wk; - int nodelay; + int flags; { struct ufsmount *ump; @@ -1327,13 +1397,17 @@ add_to_worklist(wk, nodelay) panic("add_to_worklist: %s(0x%X) already on list", TYPENAME(wk->wk_type), wk->wk_state); wk->wk_state |= ONWORKLIST; - if (LIST_EMPTY(&ump->softdep_workitem_pending)) + if (ump->softdep_on_worklist == 0) { LIST_INSERT_HEAD(&ump->softdep_workitem_pending, wk, wk_list); - else + ump->softdep_worklist_tail = wk; + } else if (flags & WK_HEAD) { + LIST_INSERT_HEAD(&ump->softdep_workitem_pending, wk, wk_list); + } else { LIST_INSERT_AFTER(ump->softdep_worklist_tail, wk, wk_list); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Jun 10 23:24: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 9AE411065676; Fri, 10 Jun 2011 23:24:39 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 628308FC12; Fri, 10 Jun 2011 23:24:39 +0000 (UTC) Received: by pwj8 with SMTP id 8so1866550pwj.13 for ; Fri, 10 Jun 2011 16:24:38 -0700 (PDT) Received: by 10.142.171.7 with SMTP id t7mr422837wfe.409.1307746463764; Fri, 10 Jun 2011 15:54:23 -0700 (PDT) Received: from [10.0.1.198] ([72.253.42.56]) by mx.google.com with ESMTPS id d15sm3281216wfl.18.2011.06.10.15.54.19 (version=SSLv3 cipher=OTHER); Fri, 10 Jun 2011 15:54:21 -0700 (PDT) Date: Fri, 10 Jun 2011 12:58:23 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Jeff Roberson In-Reply-To: <201106102248.p5AMmZ0W046567@svn.freebsd.org> Message-ID: References: <201106102248.p5AMmZ0W046567@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: r222958 - in head: sbin/fsck_ffs sys/sys sys/ufs/ffs sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2011 23:24:39 -0000 On Fri, 10 Jun 2011, Jeff Roberson wrote: > Author: jeff > Date: Fri Jun 10 22:48:35 2011 > New Revision: 222958 > URL: http://svn.freebsd.org/changeset/base/222958 > > Log: > Implement fully asynchronous partial truncation with softupdates journaling > to resolve errors which can cause corruption on recovery with the old > synchronous mechanism. > This diff is enormous and took months of work. I'm sorry to get it in so close to 9.0, I had no idea it would take so long. pho has tested multiple versions of the patch with and without journaling for days of test time and it has probably racked up a week of machine time for me but there may be problems given that it is so huge. There is still a snapshot problem with SUJ that mckusick and I are working on. Expect to see some checkins for that soon. Thanks, Jeff > - Append partial truncation freework structures to indirdeps while > truncation is proceeding. These prevent new block pointers from > becoming valid until truncation completes and serialize truncations. > - On completion of a partial truncate journal work waits for zeroed > pointers to hit indirects. > - softdep_journal_freeblocks() handles last frag allocation and last > block zeroing. > - vtruncbuf/ffs_page_remove moved into softdep_*_freeblocks() so it > is only implemented in one place. > - Block allocation failure handling moved up one level so it does not > proceed with buf locks held. This permits us to do more extensive > reclaims when filesystem space is exhausted. > - softdep_sync_metadata() is broken into two parts, the first executes > once at the start of ffs_syncvnode() and flushes truncations and > inode dependencies. The second is called on each locked buf. This > eliminates excessive looping and rollbacks. > - Improve the mechanism in process_worklist_item() that handles > acquiring vnode locks for handle_workitem_remove() so that it works > more generally and does not loop excessively over the same worklist > items on each call. > - Don't corrupt directories by zeroing the tail in fsck. This is only > done for regular files. > - Push a fsync complete record for files that need it so the checker > knows a truncation in the journal is no longer valid. > > Discussed with: mckusick, kib (ffs_pages_remove and ffs_truncate parts) > Tested by: pho > > Modified: > head/sbin/fsck_ffs/suj.c > head/sys/sys/vnode.h > head/sys/ufs/ffs/ffs_alloc.c > head/sys/ufs/ffs/ffs_balloc.c > head/sys/ufs/ffs/ffs_extern.h > head/sys/ufs/ffs/ffs_inode.c > head/sys/ufs/ffs/ffs_softdep.c > head/sys/ufs/ffs/ffs_vfsops.c > head/sys/ufs/ffs/ffs_vnops.c > head/sys/ufs/ffs/fs.h > head/sys/ufs/ffs/softdep.h > head/sys/ufs/ufs/inode.h > head/sys/ufs/ufs/ufsmount.h > > Modified: head/sbin/fsck_ffs/suj.c > ============================================================================== > --- head/sbin/fsck_ffs/suj.c Fri Jun 10 22:42:00 2011 (r222957) > +++ head/sbin/fsck_ffs/suj.c Fri Jun 10 22:48:35 2011 (r222958) > @@ -1604,7 +1604,7 @@ ino_trunc(ino_t ino, off_t size) > * uninitialized space later. > */ > off = blkoff(fs, size); > - if (off) { > + if (off && DIP(ip, di_mode) != IFDIR) { > uint8_t *buf; > long clrsize; > > @@ -1775,13 +1775,18 @@ cg_trunc(struct suj_cg *sc) > struct suj_ino *sino; > int i; > > - for (i = 0; i < SUJ_HASHSIZE; i++) > - LIST_FOREACH(sino, &sc->sc_inohash[i], si_next) > + for (i = 0; i < SUJ_HASHSIZE; i++) { > + LIST_FOREACH(sino, &sc->sc_inohash[i], si_next) { > if (sino->si_trunc) { > ino_trunc(sino->si_ino, > sino->si_trunc->jt_size); > + sino->si_blkadj = 0; > sino->si_trunc = NULL; > } > + if (sino->si_blkadj) > + ino_adjblks(sino); > + } > + } > } > > /* > @@ -1791,7 +1796,6 @@ cg_trunc(struct suj_cg *sc) > static void > cg_check_blk(struct suj_cg *sc) > { > - struct suj_ino *sino; > struct suj_blk *sblk; > int i; > > @@ -1799,15 +1803,6 @@ cg_check_blk(struct suj_cg *sc) > for (i = 0; i < SUJ_HASHSIZE; i++) > LIST_FOREACH(sblk, &sc->sc_blkhash[i], sb_next) > blk_check(sblk); > - /* > - * Now that we've freed blocks which are not referenced we > - * make a second pass over all inodes to adjust their block > - * counts. > - */ > - for (i = 0; i < SUJ_HASHSIZE; i++) > - LIST_FOREACH(sino, &sc->sc_inohash[i], si_next) > - if (sino->si_blkadj) > - ino_adjblks(sino); > } > > /* > @@ -1961,14 +1956,7 @@ ino_append(union jrec *rec) > "parent %d, diroff %jd\n", > refrec->jr_op, refrec->jr_ino, refrec->jr_nlink, > refrec->jr_parent, refrec->jr_diroff); > - /* > - * Lookup the ino and clear truncate if one is found. Partial > - * truncates are always done synchronously so if we discover > - * an operation that requires a lock the truncation has completed > - * and can be discarded. > - */ > sino = ino_lookup(((struct jrefrec *)rec)->jr_ino, 1); > - sino->si_trunc = NULL; > sino->si_hasrecs = 1; > srec = errmalloc(sizeof(*srec)); > srec->sr_rec = rec; > @@ -2174,9 +2162,7 @@ blk_build(struct jblkrec *blkrec) > struct suj_rec *srec; > struct suj_blk *sblk; > struct jblkrec *blkrn; > - struct suj_ino *sino; > ufs2_daddr_t blk; > - off_t foff; > int frag; > > if (debug) > @@ -2185,17 +2171,6 @@ blk_build(struct jblkrec *blkrec) > blkrec->jb_op, blkrec->jb_blkno, blkrec->jb_frags, > blkrec->jb_oldfrags, blkrec->jb_ino, blkrec->jb_lbn); > > - /* > - * Look up the inode and clear the truncate if any lbns after the > - * truncate lbn are freed or allocated. > - */ > - sino = ino_lookup(blkrec->jb_ino, 0); > - if (sino && sino->si_trunc) { > - foff = lblktosize(fs, blkrec->jb_lbn); > - foff += lfragtosize(fs, blkrec->jb_frags); > - if (foff > sino->si_trunc->jt_size) > - sino->si_trunc = NULL; > - } > blk = blknum(fs, blkrec->jb_blkno); > frag = fragnum(fs, blkrec->jb_blkno); > sblk = blk_lookup(blk, 1); > @@ -2242,10 +2217,15 @@ ino_build_trunc(struct jtrncrec *rec) > struct suj_ino *sino; > > if (debug) > - printf("ino_build_trunc: ino %d, size %jd\n", > - rec->jt_ino, rec->jt_size); > + printf("ino_build_trunc: op %d ino %d, size %jd\n", > + rec->jt_op, rec->jt_ino, rec->jt_size); > sino = ino_lookup(rec->jt_ino, 1); > - sino->si_trunc = rec; > + if (rec->jt_op == JOP_SYNC) { > + sino->si_trunc = NULL; > + return; > + } > + if (sino->si_trunc == NULL || sino->si_trunc->jt_size > rec->jt_size) > + sino->si_trunc = rec; > } > > /* > > Modified: head/sys/sys/vnode.h > ============================================================================== > --- head/sys/sys/vnode.h Fri Jun 10 22:42:00 2011 (r222957) > +++ head/sys/sys/vnode.h Fri Jun 10 22:48:35 2011 (r222958) > @@ -302,6 +302,7 @@ struct vattr { > #define IO_EXT 0x0400 /* operate on external attributes */ > #define IO_NORMAL 0x0800 /* operate on regular data */ > #define IO_NOMACCHECK 0x1000 /* MAC checks unnecessary */ > +#define IO_BUFLOCKED 0x2000 /* ffs flag; indir buf is locked */ > > #define IO_SEQMAX 0x7F /* seq heuristic max value */ > #define IO_SEQSHIFT 16 /* seq heuristic in upper 16 bits */ > > Modified: head/sys/ufs/ffs/ffs_alloc.c > ============================================================================== > --- head/sys/ufs/ffs/ffs_alloc.c Fri Jun 10 22:42:00 2011 (r222957) > +++ head/sys/ufs/ffs/ffs_alloc.c Fri Jun 10 22:48:35 2011 (r222958) > @@ -217,7 +217,7 @@ nospace: > (void) chkdq(ip, -btodb(size), cred, FORCE); > UFS_LOCK(ump); > #endif > - if (reclaimed == 0) { > + if (reclaimed == 0 && (flags & IO_BUFLOCKED) == 0) { > reclaimed = 1; > softdep_request_cleanup(fs, ITOV(ip), cred, FLUSH_BLOCKS_WAIT); > goto retry; > @@ -418,7 +418,7 @@ nospace: > /* > * no space available > */ > - if (reclaimed == 0) { > + if (reclaimed == 0 && (flags & IO_BUFLOCKED) == 0) { > reclaimed = 1; > UFS_UNLOCK(ump); > if (bp) { > > Modified: head/sys/ufs/ffs/ffs_balloc.c > ============================================================================== > --- head/sys/ufs/ffs/ffs_balloc.c Fri Jun 10 22:42:00 2011 (r222957) > +++ head/sys/ufs/ffs/ffs_balloc.c Fri Jun 10 22:48:35 2011 (r222958) > @@ -105,6 +105,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t > ufs2_daddr_t *lbns_remfree, lbns[NIADDR + 1]; > int unwindidx = -1; > int saved_inbdflush; > + int reclaimed; > > ip = VTOI(vp); > dp = ip->i_din1; > @@ -112,6 +113,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t > ump = ip->i_ump; > lbn = lblkno(fs, startoffset); > size = blkoff(fs, startoffset) + size; > + reclaimed = 0; > if (size > fs->fs_bsize) > panic("ffs_balloc_ufs1: blk too big"); > *bpp = NULL; > @@ -276,6 +278,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t > /* > * Fetch through the indirect blocks, allocating as necessary. > */ > +retry: > for (i = 1;;) { > error = bread(vp, > indirs[i].in_lbn, (int)fs->fs_bsize, NOCRED, &bp); > @@ -296,8 +299,15 @@ ffs_balloc_ufs1(struct vnode *vp, off_t > if (pref == 0) > pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0); > if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, > - flags, cred, &newb)) != 0) { > + flags | IO_BUFLOCKED, cred, &newb)) != 0) { > brelse(bp); > + if (++reclaimed == 1) { > + UFS_LOCK(ump); > + softdep_request_cleanup(fs, vp, cred, > + FLUSH_BLOCKS_WAIT); > + UFS_UNLOCK(ump); > + goto retry; > + } > goto fail; > } > nb = newb; > @@ -349,10 +359,17 @@ ffs_balloc_ufs1(struct vnode *vp, off_t > if (nb == 0) { > UFS_LOCK(ump); > pref = ffs_blkpref_ufs1(ip, lbn, indirs[i].in_off, &bap[0]); > - error = ffs_alloc(ip, > - lbn, pref, (int)fs->fs_bsize, flags, cred, &newb); > + error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, > + flags | IO_BUFLOCKED, cred, &newb); > if (error) { > brelse(bp); > + if (++reclaimed == 1) { > + UFS_LOCK(ump); > + softdep_request_cleanup(fs, vp, cred, > + FLUSH_BLOCKS_WAIT); > + UFS_UNLOCK(ump); > + goto retry; > + } > goto fail; > } > nb = newb; > @@ -506,6 +523,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t > int deallocated, osize, nsize, num, i, error; > int unwindidx = -1; > int saved_inbdflush; > + int reclaimed; > > ip = VTOI(vp); > dp = ip->i_din2; > @@ -513,6 +531,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t > ump = ip->i_ump; > lbn = lblkno(fs, startoffset); > size = blkoff(fs, startoffset) + size; > + reclaimed = 0; > if (size > fs->fs_bsize) > panic("ffs_balloc_ufs2: blk too big"); > *bpp = NULL; > @@ -787,6 +806,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t > /* > * Fetch through the indirect blocks, allocating as necessary. > */ > +retry: > for (i = 1;;) { > error = bread(vp, > indirs[i].in_lbn, (int)fs->fs_bsize, NOCRED, &bp); > @@ -807,8 +827,15 @@ ffs_balloc_ufs2(struct vnode *vp, off_t > if (pref == 0) > pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0); > if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, > - flags, cred, &newb)) != 0) { > + flags | IO_BUFLOCKED, cred, &newb)) != 0) { > brelse(bp); > + if (++reclaimed == 1) { > + UFS_LOCK(ump); > + softdep_request_cleanup(fs, vp, cred, > + FLUSH_BLOCKS_WAIT); > + UFS_UNLOCK(ump); > + goto retry; > + } > goto fail; > } > nb = newb; > @@ -860,10 +887,17 @@ ffs_balloc_ufs2(struct vnode *vp, off_t > if (nb == 0) { > UFS_LOCK(ump); > pref = ffs_blkpref_ufs2(ip, lbn, indirs[i].in_off, &bap[0]); > - error = ffs_alloc(ip, > - lbn, pref, (int)fs->fs_bsize, flags, cred, &newb); > + error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, > + flags | IO_BUFLOCKED, cred, &newb); > if (error) { > brelse(bp); > + if (++reclaimed == 1) { > + UFS_LOCK(ump); > + softdep_request_cleanup(fs, vp, cred, > + FLUSH_BLOCKS_WAIT); > + UFS_UNLOCK(ump); > + goto retry; > + } > goto fail; > } > nb = newb; > > Modified: head/sys/ufs/ffs/ffs_extern.h > ============================================================================== > --- head/sys/ufs/ffs/ffs_extern.h Fri Jun 10 22:42:00 2011 (r222957) > +++ head/sys/ufs/ffs/ffs_extern.h Fri Jun 10 22:48:35 2011 (r222958) > @@ -74,6 +74,7 @@ int ffs_isfreeblock(struct fs *, u_char > void ffs_load_inode(struct buf *, struct inode *, struct fs *, ino_t); > int ffs_mountroot(void); > void ffs_oldfscompat_write(struct fs *, struct ufsmount *); > +void ffs_pages_remove(struct vnode *vp, vm_pindex_t start, vm_pindex_t end); > int ffs_reallocblks(struct vop_reallocblks_args *); > int ffs_realloccg(struct inode *, ufs2_daddr_t, ufs2_daddr_t, > ufs2_daddr_t, int, int, int, struct ucred *, struct buf **); > @@ -107,7 +108,6 @@ extern struct vop_vector ffs_fifoops2; > > int softdep_check_suspend(struct mount *, struct vnode *, > int, int, int, int); > -int softdep_complete_trunc(struct vnode *, void *); > void softdep_get_depcounts(struct mount *, int *, int *); > void softdep_initialize(void); > void softdep_uninitialize(void); > @@ -139,14 +139,17 @@ void softdep_setup_blkfree(struct mount > void softdep_setup_inofree(struct mount *, struct buf *, ino_t, > struct workhead *); > void softdep_setup_sbupdate(struct ufsmount *, struct fs *, struct buf *); > -void *softdep_setup_trunc(struct vnode *vp, off_t length, int flags); > void softdep_fsync_mountdev(struct vnode *); > int softdep_sync_metadata(struct vnode *); > +int softdep_sync_buf(struct vnode *, struct buf *, int); > int softdep_process_worklist(struct mount *, int); > int softdep_fsync(struct vnode *); > int softdep_waitidle(struct mount *); > int softdep_prealloc(struct vnode *, int); > int softdep_journal_lookup(struct mount *, struct vnode **); > +void softdep_journal_freeblocks(struct inode *, struct ucred *, off_t, int); > +void softdep_journal_fsync(struct inode *); > + > > /* > * Things to request flushing in softdep_request_cleanup() > > Modified: head/sys/ufs/ffs/ffs_inode.c > ============================================================================== > --- head/sys/ufs/ffs/ffs_inode.c Fri Jun 10 22:42:00 2011 (r222957) > +++ head/sys/ufs/ffs/ffs_inode.c Fri Jun 10 22:48:35 2011 (r222958) > @@ -120,7 +120,7 @@ ffs_update(vp, waitfor) > } > } > > -static void > +void > ffs_pages_remove(struct vnode *vp, vm_pindex_t start, vm_pindex_t end) > { > vm_object_t object; > @@ -151,12 +151,12 @@ ffs_truncate(vp, length, flags, cred, td > ufs2_daddr_t bn, lbn, lastblock, lastiblock[NIADDR], indir_lbn[NIADDR]; > ufs2_daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; > ufs2_daddr_t count, blocksreleased = 0, datablocks; > - void *cookie; > struct bufobj *bo; > struct fs *fs; > struct buf *bp; > struct ufsmount *ump; > - int needextclean, softdepslowdown, extblocks; > + int softdeptrunc, journaltrunc; > + int needextclean, extblocks; > int offset, size, level, nblocks; > int i, error, allerror; > off_t osize; > @@ -165,7 +165,6 @@ ffs_truncate(vp, length, flags, cred, td > fs = ip->i_fs; > ump = ip->i_ump; > bo = &vp->v_bufobj; > - cookie = NULL; > > ASSERT_VOP_LOCKED(vp, "ffs_truncate"); > > @@ -173,6 +172,11 @@ ffs_truncate(vp, length, flags, cred, td > return (EINVAL); > if (length > fs->fs_maxfilesize) > return (EFBIG); > +#ifdef QUOTA > + error = getinoquota(ip); > + if (error) > + return (error); > +#endif > /* > * Historically clients did not have to specify which data > * they were truncating. So, if not specified, we assume > @@ -191,7 +195,10 @@ ffs_truncate(vp, length, flags, cred, td > */ > allerror = 0; > needextclean = 0; > - softdepslowdown = DOINGSOFTDEP(vp) && softdep_slowdown(vp); > + softdeptrunc = 0; > + journaltrunc = DOINGSUJ(vp); > + if (journaltrunc == 0 && DOINGSOFTDEP(vp) && length == 0) > + softdeptrunc = !softdep_slowdown(vp); > extblocks = 0; > datablocks = DIP(ip, i_blocks); > if (fs->fs_magic == FS_UFS2_MAGIC && ip->i_din2->di_extsize > 0) { > @@ -199,27 +206,23 @@ ffs_truncate(vp, length, flags, cred, td > datablocks -= extblocks; > } > if ((flags & IO_EXT) && extblocks > 0) { > - if (DOINGSOFTDEP(vp) && softdepslowdown == 0 && length == 0) { > - if ((flags & IO_NORMAL) == 0) { > - softdep_setup_freeblocks(ip, length, IO_EXT); > - return (0); > - } > + if (length != 0) > + panic("ffs_truncate: partial trunc of extdata"); > + if (softdeptrunc || journaltrunc) { > + if ((flags & IO_NORMAL) == 0) > + goto extclean; > needextclean = 1; > } else { > - if (length != 0) > - panic("ffs_truncate: partial trunc of extdata"); > if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0) > return (error); > - if (DOINGSUJ(vp)) > - cookie = softdep_setup_trunc(vp, length, flags); > - osize = ip->i_din2->di_extsize; > - ip->i_din2->di_blocks -= extblocks; > #ifdef QUOTA > (void) chkdq(ip, -extblocks, NOCRED, 0); > #endif > vinvalbuf(vp, V_ALT, 0, 0); > ffs_pages_remove(vp, > OFF_TO_IDX(lblktosize(fs, -extblocks)), 0); > + osize = ip->i_din2->di_extsize; > + ip->i_din2->di_blocks -= extblocks; > ip->i_din2->di_extsize = 0; > for (i = 0; i < NXADDR; i++) { > oldblks[i] = ip->i_din2->di_extb[i]; > @@ -227,7 +230,7 @@ ffs_truncate(vp, length, flags, cred, td > } > ip->i_flag |= IN_CHANGE; > if ((error = ffs_update(vp, 1))) > - goto out; > + return (error); > for (i = 0; i < NXADDR; i++) { > if (oldblks[i] == 0) > continue; > @@ -236,10 +239,8 @@ ffs_truncate(vp, length, flags, cred, td > } > } > } > - if ((flags & IO_NORMAL) == 0) { > - error = 0; > - goto out; > - } > + if ((flags & IO_NORMAL) == 0) > + return (0); > if (vp->v_type == VLNK && > (ip->i_size < vp->v_mount->mnt_maxsymlinklen || > datablocks == 0)) { > @@ -252,24 +253,17 @@ ffs_truncate(vp, length, flags, cred, td > DIP_SET(ip, i_size, 0); > ip->i_flag |= IN_CHANGE | IN_UPDATE; > if (needextclean) > - softdep_setup_freeblocks(ip, length, IO_EXT); > - error = ffs_update(vp, 1); > - goto out; > + goto extclean; > + return ffs_update(vp, 1); > } > if (ip->i_size == length) { > ip->i_flag |= IN_CHANGE | IN_UPDATE; > if (needextclean) > - softdep_setup_freeblocks(ip, length, IO_EXT); > - error = ffs_update(vp, 0); > - goto out; > + goto extclean; > + return ffs_update(vp, 0); > } > if (fs->fs_ronly) > panic("ffs_truncate: read-only filesystem"); > -#ifdef QUOTA > - error = getinoquota(ip); > - if (error) > - goto out; > -#endif > if ((ip->i_flags & SF_SNAPSHOT) != 0) > ffs_snapremove(vp); > vp->v_lasta = vp->v_clen = vp->v_cstart = vp->v_lastw = 0; > @@ -285,7 +279,7 @@ ffs_truncate(vp, length, flags, cred, td > error = UFS_BALLOC(vp, length - 1, 1, cred, flags, &bp); > if (error) { > vnode_pager_setsize(vp, osize); > - goto out; > + return (error); > } > ip->i_size = length; > DIP_SET(ip, i_size, length); > @@ -296,11 +290,10 @@ ffs_truncate(vp, length, flags, cred, td > else > bawrite(bp); > ip->i_flag |= IN_CHANGE | IN_UPDATE; > - error = ffs_update(vp, 1); > - goto out; > + return ffs_update(vp, 1); > } > if (DOINGSOFTDEP(vp)) { > - if (length > 0 || softdepslowdown) { > + if (softdeptrunc == 0 && journaltrunc == 0) { > /* > * If a file is only partially truncated, then > * we have to clean up the data structures > @@ -311,29 +304,20 @@ ffs_truncate(vp, length, flags, cred, td > * so that it will have no data structures left. > */ > if ((error = ffs_syncvnode(vp, MNT_WAIT)) != 0) > - goto out; > - /* > - * We have to journal the truncation before we change > - * any blocks so we don't leave the file partially > - * truncated. > - */ > - if (DOINGSUJ(vp) && cookie == NULL) > - cookie = softdep_setup_trunc(vp, length, flags); > + return (error); > } else { > -#ifdef QUOTA > - (void) chkdq(ip, -datablocks, NOCRED, 0); > -#endif > - softdep_setup_freeblocks(ip, length, needextclean ? > - IO_EXT | IO_NORMAL : IO_NORMAL); > + flags = IO_NORMAL | (needextclean ? IO_EXT: 0); > + if (journaltrunc) > + softdep_journal_freeblocks(ip, cred, length, > + flags); > + else > + softdep_setup_freeblocks(ip, length, flags); > ASSERT_VOP_LOCKED(vp, "ffs_truncate1"); > - vinvalbuf(vp, needextclean ? 0 : V_NORMAL, 0, 0); > - if (!needextclean) > - ffs_pages_remove(vp, 0, > - OFF_TO_IDX(lblktosize(fs, -extblocks))); > - vnode_pager_setsize(vp, 0); > - ip->i_flag |= IN_CHANGE | IN_UPDATE; > - error = ffs_update(vp, 0); > - goto out; > + if (journaltrunc == 0) { > + ip->i_flag |= IN_CHANGE | IN_UPDATE; > + error = ffs_update(vp, 0); > + } > + return (error); > } > } > /* > @@ -353,7 +337,7 @@ ffs_truncate(vp, length, flags, cred, td > flags |= BA_CLRBUF; > error = UFS_BALLOC(vp, length - 1, 1, cred, flags, &bp); > if (error) > - goto out; > + return (error); > /* > * When we are doing soft updates and the UFS_BALLOC > * above fills in a direct block hole with a full sized > @@ -365,7 +349,7 @@ ffs_truncate(vp, length, flags, cred, td > if (DOINGSOFTDEP(vp) && lbn < NDADDR && > fragroundup(fs, blkoff(fs, length)) < fs->fs_bsize && > (error = ffs_syncvnode(vp, MNT_WAIT)) != 0) > - goto out; > + return (error); > ip->i_size = length; > DIP_SET(ip, i_size, length); > size = blksize(fs, ip, lbn); > @@ -411,13 +395,7 @@ ffs_truncate(vp, length, flags, cred, td > DIP_SET(ip, i_db[i], 0); > } > ip->i_flag |= IN_CHANGE | IN_UPDATE; > - /* > - * When doing softupdate journaling we must preserve the size along > - * with the old pointers until they are freed or we might not > - * know how many fragments remain. > - */ > - if (!DOINGSUJ(vp)) > - allerror = ffs_update(vp, 1); > + allerror = ffs_update(vp, 1); > > /* > * Having written the new inode to disk, save its new configuration > @@ -541,14 +519,14 @@ done: > #ifdef QUOTA > (void) chkdq(ip, -blocksreleased, NOCRED, 0); > #endif > - error = allerror; > -out: > - if (cookie) { > - allerror = softdep_complete_trunc(vp, cookie); > - if (allerror != 0 && error == 0) > - error = allerror; > - } > - return (error); > + return (allerror); > + > +extclean: > + if (journaltrunc) > + softdep_journal_freeblocks(ip, cred, length, IO_EXT); > + else > + softdep_setup_freeblocks(ip, length, IO_EXT); > + return ffs_update(vp, MNT_WAIT); > } > > /* > > Modified: head/sys/ufs/ffs/ffs_softdep.c > ============================================================================== > --- head/sys/ufs/ffs/ffs_softdep.c Fri Jun 10 22:42:00 2011 (r222957) > +++ head/sys/ufs/ffs/ffs_softdep.c Fri Jun 10 22:48:35 2011 (r222958) > @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -71,6 +72,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > + > #include > #include > #include > @@ -82,6 +84,8 @@ __FBSDID("$FreeBSD$"); > #include > > #include > +#include > +#include > > #include > > @@ -214,6 +218,25 @@ softdep_setup_allocindir_meta(nbp, ip, b > } > > void > +softdep_journal_freeblocks(ip, cred, length, flags) > + struct inode *ip; > + struct ucred *cred; > + off_t length; > + int flags; > +{ > + > + panic("softdep_journal_freeblocks called"); > +} > + > +void > +softdep_journal_fsync(ip) > + struct inode *ip; > +{ > + > + panic("softdep_journal_fsync called"); > +} > + > +void > softdep_setup_freeblocks(ip, length, flags) > struct inode *ip; > off_t length; > @@ -282,29 +305,6 @@ softdep_setup_directory_change(bp, dp, i > panic("softdep_setup_directory_change called"); > } > > -void * > -softdep_setup_trunc(vp, length, flags) > - struct vnode *vp; > - off_t length; > - int flags; > -{ > - > - panic("%s called", __FUNCTION__); > - > - return (NULL); > -} > - > -int > -softdep_complete_trunc(vp, cookie) > - struct vnode *vp; > - void *cookie; > -{ > - > - panic("%s called", __FUNCTION__); > - > - return (0); > -} > - > void > softdep_setup_blkfree(mp, bp, blkno, frags, wkhd) > struct mount *mp; > @@ -499,6 +499,13 @@ softdep_sync_metadata(struct vnode *vp) > } > > int > +softdep_sync_buf(struct vnode *vp, struct buf *bp, int waitfor) > +{ > + > + return (0); > +} > + > +int > softdep_slowdown(vp) > struct vnode *vp; > { > @@ -614,10 +621,13 @@ FEATURE(softupdates, "FFS soft-updates s > #define D_JSEGDEP 23 > #define D_SBDEP 24 > #define D_JTRUNC 25 > -#define D_LAST D_JTRUNC > +#define D_JFSYNC 26 > +#define D_SENTINAL 27 > +#define D_LAST D_SENTINAL > > unsigned long dep_current[D_LAST + 1]; > unsigned long dep_total[D_LAST + 1]; > +unsigned long dep_write[D_LAST + 1]; > > > SYSCTL_NODE(_debug, OID_AUTO, softdep, CTLFLAG_RW, 0, "soft updates stats"); > @@ -625,13 +635,17 @@ SYSCTL_NODE(_debug_softdep, OID_AUTO, to > "total dependencies allocated"); > SYSCTL_NODE(_debug_softdep, OID_AUTO, current, CTLFLAG_RW, 0, > "current dependencies allocated"); > +SYSCTL_NODE(_debug_softdep, OID_AUTO, write, CTLFLAG_RW, 0, > + "current dependencies written"); > > #define SOFTDEP_TYPE(type, str, long) \ > static MALLOC_DEFINE(M_ ## type, #str, long); \ > SYSCTL_ULONG(_debug_softdep_total, OID_AUTO, str, CTLFLAG_RD, \ > &dep_total[D_ ## type], 0, ""); \ > SYSCTL_ULONG(_debug_softdep_current, OID_AUTO, str, CTLFLAG_RD, \ > - &dep_current[D_ ## type], 0, ""); > + &dep_current[D_ ## type], 0, ""); \ > + SYSCTL_ULONG(_debug_softdep_write, OID_AUTO, str, CTLFLAG_RD, \ > + &dep_write[D_ ## type], 0, ""); > > SOFTDEP_TYPE(PAGEDEP, pagedep, "File page dependencies"); > SOFTDEP_TYPE(INODEDEP, inodedep, "Inode dependencies"); > @@ -660,6 +674,7 @@ SOFTDEP_TYPE(JSEG, jseg, "Journal segmen > SOFTDEP_TYPE(JSEGDEP, jsegdep, "Journal segment complete"); > SOFTDEP_TYPE(SBDEP, sbdep, "Superblock write dependency"); > SOFTDEP_TYPE(JTRUNC, jtrunc, "Journal inode truncation"); > +SOFTDEP_TYPE(JFSYNC, jfsync, "Journal fsync complete"); > > static MALLOC_DEFINE(M_SAVEDINO, "savedino", "Saved inodes"); > static MALLOC_DEFINE(M_JBLOCKS, "jblocks", "Journal block locations"); > @@ -694,7 +709,8 @@ static struct malloc_type *memtype[] = { > M_JSEG, > M_JSEGDEP, > M_SBDEP, > - M_JTRUNC > + M_JTRUNC, > + M_JFSYNC > }; > > static LIST_HEAD(mkdirlist, mkdir) mkdirlisthd; > @@ -734,10 +750,11 @@ static void clear_unlinked_inodedep(stru > static struct inodedep *first_unlinked_inodedep(struct ufsmount *); > static int flush_pagedep_deps(struct vnode *, struct mount *, > struct diraddhd *); > -static void free_pagedep(struct pagedep *); > +static int free_pagedep(struct pagedep *); > static int flush_newblk_dep(struct vnode *, struct mount *, ufs_lbn_t); > -static int flush_inodedep_deps(struct mount *, ino_t); > +static int flush_inodedep_deps(struct vnode *, struct mount *, ino_t); > static int flush_deplist(struct allocdirectlst *, int, int *); > +static int sync_cgs(struct mount *, int); > static int handle_written_filepage(struct pagedep *, struct buf *); > static int handle_written_sbdep(struct sbdep *, struct buf *); > static void initiate_write_sbdep(struct sbdep *); > @@ -750,7 +767,7 @@ static void handle_written_jaddref(struc > static void handle_written_jremref(struct jremref *); > static void handle_written_jseg(struct jseg *, struct buf *); > static void handle_written_jnewblk(struct jnewblk *); > -static void handle_written_jfreeblk(struct jfreeblk *); > +static void handle_written_jblkdep(struct jblkdep *); > static void handle_written_jfreefrag(struct jfreefrag *); > static void complete_jseg(struct jseg *); > static void jseg_write(struct ufsmount *ump, struct jseg *, uint8_t *); > @@ -758,6 +775,7 @@ static void jaddref_write(struct jaddref > static void jremref_write(struct jremref *, struct jseg *, uint8_t *); > static void jmvref_write(struct jmvref *, struct jseg *, uint8_t *); > static void jtrunc_write(struct jtrunc *, struct jseg *, uint8_t *); > +static void jfsync_write(struct jfsync *, struct jseg *, uint8_t *data); > static void jnewblk_write(struct jnewblk *, struct jseg *, uint8_t *); > static void jfreeblk_write(struct jfreeblk *, struct jseg *, uint8_t *); > static void jfreefrag_write(struct jfreefrag *, struct jseg *, uint8_t *); > @@ -768,7 +786,9 @@ static void handle_allocdirect_partdone( > static struct jnewblk *cancel_newblk(struct newblk *, struct worklist *, > struct workhead *); > static void indirdep_complete(struct indirdep *); > -static int indirblk_inseg(struct mount *, ufs2_daddr_t); > +static int indirblk_lookup(struct mount *, ufs2_daddr_t); > +static void indirblk_insert(struct freework *); > +static void indirblk_remove(struct freework *); > static void handle_allocindir_partdone(struct allocindir *); > static void initiate_write_filepage(struct pagedep *, struct buf *); > static void initiate_write_indirdep(struct indirdep*, struct buf *); > @@ -777,10 +797,12 @@ static void initiate_write_bmsafemap(str > static void initiate_write_inodeblock_ufs1(struct inodedep *, struct buf *); > static void initiate_write_inodeblock_ufs2(struct inodedep *, struct buf *); > static void handle_workitem_freefile(struct freefile *); > -static void handle_workitem_remove(struct dirrem *, struct vnode *); > +static int handle_workitem_remove(struct dirrem *, int); > static struct dirrem *newdirrem(struct buf *, struct inode *, > struct inode *, int, struct dirrem **); > -static void cancel_indirdep(struct indirdep *, struct buf *, struct inodedep *, > +static struct indirdep *indirdep_lookup(struct mount *, struct inode *, > + struct buf *); > +static void cancel_indirdep(struct indirdep *, struct buf *, > struct freeblks *); > static void free_indirdep(struct indirdep *); > static void free_diradd(struct diradd *, struct workhead *); > @@ -795,8 +817,13 @@ static void cancel_diradd(struct diradd > struct jremref *, struct jremref *); > static void dirrem_journal(struct dirrem *, struct jremref *, struct jremref *, > struct jremref *); > -static void cancel_allocindir(struct allocindir *, struct inodedep *, > - struct freeblks *); > +static void cancel_allocindir(struct allocindir *, struct buf *bp, > + struct freeblks *, int); > +static int setup_trunc_indir(struct freeblks *, struct inode *, > + ufs_lbn_t, ufs_lbn_t, ufs2_daddr_t); > +static void complete_trunc_indir(struct freework *); > +static void trunc_indirdep(struct indirdep *, struct freeblks *, struct buf *, > + int); > static void complete_mkdir(struct mkdir *); > static void free_newdirblk(struct newdirblk *); > static void free_jremref(struct jremref *); > @@ -806,7 +833,7 @@ static void free_jsegs(struct jblocks *) > static void rele_jseg(struct jseg *); > static void free_jseg(struct jseg *, struct jblocks *); > static void free_jnewblk(struct jnewblk *); > -static void free_jfreeblk(struct jfreeblk *); > +static void free_jblkdep(struct jblkdep *); > static void free_jfreefrag(struct jfreefrag *); > static void free_freedep(struct freedep *); > static void journal_jremref(struct dirrem *, struct jremref *, > @@ -818,30 +845,33 @@ static void cancel_jfreefrag(struct jfre > static inline void setup_freedirect(struct freeblks *, struct inode *, > int, int); > static inline void setup_freeext(struct freeblks *, struct inode *, int, int); > -static inline void setup_freeindir(struct freeblks *, struct inode *, int i, > +static inline void setup_freeindir(struct freeblks *, struct inode *, int, > ufs_lbn_t, int); > static inline struct freeblks *newfreeblks(struct mount *, struct inode *); > static void indir_trunc(struct freework *, ufs2_daddr_t, ufs_lbn_t); > -static void softdep_trunc_deps(struct vnode *, struct freeblks *, ufs_lbn_t, > +ufs2_daddr_t blkcount(struct fs *, ufs2_daddr_t, off_t); > +static int trunc_check_buf(struct buf *, int *, ufs_lbn_t, int, int); > +static void trunc_dependencies(struct inode *, struct freeblks *, ufs_lbn_t, > int, int); > -static int cancel_pagedep(struct pagedep *, struct inodedep *, > - struct freeblks *); > -static int deallocate_dependencies(struct buf *, struct inodedep *, > - struct freeblks *, int off); > +static void trunc_pages(struct inode *, off_t, ufs2_daddr_t, int); > +static int cancel_pagedep(struct pagedep *, struct freeblks *, int); > +static int deallocate_dependencies(struct buf *, struct freeblks *, int); > +static void newblk_freefrag(struct newblk*); > static void free_newblk(struct newblk *); > static void cancel_allocdirect(struct allocdirectlst *, > - struct allocdirect *, struct freeblks *, int); > + struct allocdirect *, struct freeblks *); > static int check_inode_unwritten(struct inodedep *); > static int free_inodedep(struct inodedep *); > static void freework_freeblock(struct freework *); > -static void handle_workitem_freeblocks(struct freeblks *, int); > -static void handle_complete_freeblocks(struct freeblks *); > +static void freework_enqueue(struct freework *); > +static int handle_workitem_freeblocks(struct freeblks *, int); > +static int handle_complete_freeblocks(struct freeblks *, int); > static void handle_workitem_indirblk(struct freework *); > -static void handle_written_freework(struct freework *); > +static void handle_written_freework(struct freework *, int); > static void merge_inode_lists(struct allocdirectlst *,struct allocdirectlst *); > static struct worklist *jnewblk_merge(struct worklist *, struct worklist *, > struct workhead *); > -static void setup_allocindir_phase2(struct buf *, struct inode *, > +static struct freefrag *setup_allocindir_phase2(struct buf *, struct inode *, > struct inodedep *, struct allocindir *, ufs_lbn_t); > static struct allocindir *newallocindir(struct inode *, int, ufs2_daddr_t, > ufs2_daddr_t, ufs_lbn_t); > @@ -862,16 +892,20 @@ static int newblk_lookup(struct mount *, > static int inodedep_find(struct inodedep_hashhead *, struct fs *, ino_t, > struct inodedep **); > static int inodedep_lookup(struct mount *, ino_t, int, struct inodedep **); > -static int pagedep_lookup(struct mount *, ino_t, ufs_lbn_t, int, > - struct pagedep **); > +static int pagedep_lookup(struct mount *, struct buf *bp, ino_t, ufs_lbn_t, > + int, struct pagedep **); > static int pagedep_find(struct pagedep_hashhead *, ino_t, ufs_lbn_t, > struct mount *mp, int, struct pagedep **); > static void pause_timer(void *); > static int request_cleanup(struct mount *, int); > -static int process_worklist_item(struct mount *, int); > +static int process_worklist_item(struct mount *, int, int); > static void process_removes(struct vnode *); > +static void process_truncates(struct vnode *); > static void jwork_move(struct workhead *, struct workhead *); > +static void jwork_insert(struct workhead *, struct jsegdep *); > static void add_to_worklist(struct worklist *, int); > +static void wake_worklist(struct worklist *); > +static void wait_worklist(struct worklist *, char *); > static void remove_from_worklist(struct worklist *); > static void softdep_flush(void); > static int softdep_speedup(void); > @@ -889,17 +923,20 @@ static struct jremref *newjremref(struct > struct inode *ip, off_t, nlink_t); > static struct jaddref *newjaddref(struct inode *, ino_t, off_t, int16_t, > uint16_t); > -static inline void newinoref(struct inoref *, ino_t, ino_t, off_t, nlink_t, > +static inline void newinoref(struct inoref *, ino_t, ino_t, off_t, nlink_t, > uint16_t); > -static inline struct jsegdep *inoref_jseg(struct inoref *); > +static inline struct jsegdep *inoref_jseg(struct inoref *); > static struct jmvref *newjmvref(struct inode *, ino_t, off_t, off_t); > static struct jfreeblk *newjfreeblk(struct freeblks *, ufs_lbn_t, > ufs2_daddr_t, int); > +static struct jtrunc *newjtrunc(struct freeblks *, off_t, int); > +static void move_newblock_dep(struct jaddref *, struct inodedep *); > +static void cancel_jfreeblk(struct freeblks *, ufs2_daddr_t); > static struct jfreefrag *newjfreefrag(struct freefrag *, struct inode *, > ufs2_daddr_t, long, ufs_lbn_t); > static struct freework *newfreework(struct ufsmount *, struct freeblks *, > - struct freework *, ufs_lbn_t, ufs2_daddr_t, int, int); > -static void jwait(struct worklist *wk); > + struct freework *, ufs_lbn_t, ufs2_daddr_t, int, int, int); > +static int jwait(struct worklist *, int); > static struct inodedep *inodedep_lookup_ip(struct inode *); > static int bmsafemap_rollbacks(struct bmsafemap *); > static struct freefile *handle_bufwait(struct inodedep *, struct workhead *); > @@ -1064,6 +1101,30 @@ jwork_move(dst, src) > } > } > > +static void > +jwork_insert(dst, jsegdep) > + struct workhead *dst; > + struct jsegdep *jsegdep; > +{ > + struct jsegdep *jsegdepn; > + struct worklist *wk; > + > + LIST_FOREACH(wk, dst, wk_list) > + if (wk->wk_type == D_JSEGDEP) > + break; > + if (wk == NULL) { > + WORKLIST_INSERT(dst, &jsegdep->jd_list); > + return; > + } > + jsegdepn = WK_JSEGDEP(wk); > + if (jsegdep->jd_seg->js_seq < jsegdepn->jd_seg->js_seq) { > + WORKLIST_REMOVE(wk); > + free_jsegdep(jsegdepn); > + WORKLIST_INSERT(dst, &jsegdep->jd_list); > + } else > + free_jsegdep(jsegdep); > +} > + > /* > * Routines for tracking and managing workitems. > */ > @@ -1088,6 +1149,8 @@ workitem_free(item, type) > panic("workitem_free: type mismatch %s != %s", > TYPENAME(item->wk_type), TYPENAME(type)); > #endif > + if (item->wk_state & IOWAITING) > + wakeup(item); > ump = VFSTOUFS(item->wk_mp); > if (--ump->softdep_deps == 0 && ump->softdep_req) > wakeup(&ump->softdep_deps); > @@ -1101,14 +1164,18 @@ workitem_alloc(item, type, mp) > int type; > struct mount *mp; > { > + struct ufsmount *ump; > + > item->wk_type = type; > item->wk_mp = mp; > item->wk_state = 0; > + > + ump = VFSTOUFS(mp); > ACQUIRE_LOCK(&lk); > dep_current[type]++; > dep_total[type]++; > - VFSTOUFS(mp)->softdep_deps++; > - VFSTOUFS(mp)->softdep_accdeps++; > + ump->softdep_deps++; > + ump->softdep_accdeps++; > FREE_LOCK(&lk); > } > > @@ -1270,8 +1337,7 @@ softdep_flush(void) > vfslocked = VFS_LOCK_GIANT(mp); > progress += softdep_process_worklist(mp, 0); > ump = VFSTOUFS(mp); > - remaining += ump->softdep_on_worklist - > - ump->softdep_on_worklist_inprogress; > + remaining += ump->softdep_on_worklist; > VFS_UNLOCK_GIANT(vfslocked); > mtx_lock(&mountlist_mtx); > nmp = TAILQ_NEXT(mp, mnt_list); > @@ -1314,10 +1380,14 @@ softdep_speedup(void) > * The following routine is the only one that removes items > * and does so in order from first to last. > */ > + > +#define WK_HEAD 0x0001 /* Add to HEAD. */ > +#define WK_NODELAY 0x0002 /* Process immediately. */ > + > static void > -add_to_worklist(wk, nodelay) > +add_to_worklist(wk, flags) > struct worklist *wk; > - int nodelay; > + int flags; > { > struct ufsmount *ump; > > @@ -1327,13 +1397,17 @@ add_to_worklist(wk, nodelay) > panic("add_to_worklist: %s(0x%X) already on list", > TYPENAME(wk->wk_type), wk->wk_state); > wk->wk_state |= ONWORKLIST; > - if (LIST_EMPTY(&ump->softdep_workitem_pending)) > + if (ump->softdep_on_worklist == 0) { > LIST_INSERT_HEAD(&ump->softdep_workitem_pending, wk, wk_list); > - else > + ump->softdep_worklist_tail = wk; > + } else if (flags & WK_HEAD) { > + LIST_INSERT_HEAD(&ump->softdep_workitem_pending, wk, wk_list); > + } else { > LIST_INSERT_AFTER(ump->softdep_worklist_tail, wk, wk_list); > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 01: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 D908F106566B; Sat, 11 Jun 2011 01:19:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C99B88FC08; Sat, 11 Jun 2011 01: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 p5B1JJU5051647; Sat, 11 Jun 2011 01:19:19 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5B1JJP9051645; Sat, 11 Jun 2011 01:19:19 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201106110119.p5B1JJP9051645@svn.freebsd.org> From: Xin LI Date: Sat, 11 Jun 2011 01: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: r222967 - head/sys/dev/atkbdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 11 Jun 2011 01:19:19 -0000 Author: delphij Date: Sat Jun 11 01:19:19 2011 New Revision: 222967 URL: http://svn.freebsd.org/changeset/base/222967 Log: Add comments about the validation. Modified: head/sys/dev/atkbdc/atkbd.c Modified: head/sys/dev/atkbdc/atkbd.c ============================================================================== --- head/sys/dev/atkbdc/atkbd.c Sat Jun 11 00:31:37 2011 (r222966) +++ head/sys/dev/atkbdc/atkbd.c Sat Jun 11 01:19:19 2011 (r222967) @@ -1097,6 +1097,15 @@ get_typematic(keyboard_t *kbd) x86regs_t regs; uint8_t *p; + /* + * Traditional entry points of int 0x15 and 0x16 are fixed + * and later BIOSes follow them. (U)EFI CSM specification + * also mandate these fixed entry points. + * + * Validate the entry points here before we proceed further. + * It's known that some recent laptops does not have the + * same entry point and hang on boot if we call it. + */ if (x86bios_get_intr(0x15) != 0xf000f859 || x86bios_get_intr(0x16) != 0xf000e82e) return (ENODEV); From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 02:22: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 25FD81065670; Sat, 11 Jun 2011 02:22:12 +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 165FC8FC0C; Sat, 11 Jun 2011 02:22: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 p5B2MBQX053776; Sat, 11 Jun 2011 02:22:11 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5B2MBF3053774; Sat, 11 Jun 2011 02:22:11 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201106110222.p5B2MBF3053774@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 11 Jun 2011 02:22: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: r222971 - head/sys/ia64/ia64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 11 Jun 2011 02:22:12 -0000 Author: marcel Date: Sat Jun 11 02:22:11 2011 New Revision: 222971 URL: http://svn.freebsd.org/changeset/base/222971 Log: Add the model number for the Montvale processor (marketed as Itanium 2 9100). At this time we're missing just one: Tukwila (Itanium 2 9300). Modified: head/sys/ia64/ia64/machdep.c Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Sat Jun 11 01:58:31 2011 (r222970) +++ head/sys/ia64/ia64/machdep.c Sat Jun 11 02:22:11 2011 (r222971) @@ -232,6 +232,9 @@ identifycpu(void) case 0x00: model_name = "Montecito"; break; + case 0x01: + model_name = "Montvale"; + break; } break; } From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 03:25: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 44304106564A; Sat, 11 Jun 2011 03:25:11 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 336F28FC15; Sat, 11 Jun 2011 03:25:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5B3PBcQ055900; Sat, 11 Jun 2011 03:25:11 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5B3PBmA055894; Sat, 11 Jun 2011 03:25:11 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106110325.p5B3PBmA055894@svn.freebsd.org> From: Hiroki Sato Date: Sat, 11 Jun 2011 03:25:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222972 - head/usr.sbin/rtadvd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 11 Jun 2011 03:25:11 -0000 Author: hrs Date: Sat Jun 11 03:25:10 2011 New Revision: 222972 URL: http://svn.freebsd.org/changeset/base/222972 Log: Support SIGHUP for reloading /etc/rtadvd.conf. Modified: head/usr.sbin/rtadvd/config.c head/usr.sbin/rtadvd/config.h head/usr.sbin/rtadvd/rtadvd.8 head/usr.sbin/rtadvd/rtadvd.c head/usr.sbin/rtadvd/rtadvd.h Modified: head/usr.sbin/rtadvd/config.c ============================================================================== --- head/usr.sbin/rtadvd/config.c Sat Jun 11 02:22:11 2011 (r222971) +++ head/usr.sbin/rtadvd/config.c Sat Jun 11 03:25:10 2011 (r222972) @@ -142,6 +142,33 @@ dname_labelenc(char *dst, const char *sr } while(0) int +loadconfig(char *ifl_names[], const int ifl_len) +{ + int i; + int idx; + int error; + + for (i = 0; i < ifl_len; i++) { + idx = if_nametoindex(ifl_names[i]); + if (idx == 0) { + syslog(LOG_ERR, + "<%s> interface %s not found. " + "Ignored at this moment.", __func__, ifl_names[i]); + continue; + } + syslog(LOG_INFO, + "<%s> loading config for %s.", __func__, ifl_names[i]); + error = getconfig(idx); + if (error) + syslog(LOG_ERR, + "<%s> invalid configuration for %s. " + "Ignored at this moment.", __func__, ifl_names[i]); + } + + return (0); +} + +int rmconfig(int idx) { struct rainfo *rai; @@ -207,6 +234,7 @@ getconfig(int idx) int stat, i; char tbuf[BUFSIZ]; struct rainfo *rai; + struct rainfo *rai_old; long val; int64_t val64; char buf[BUFSIZ]; @@ -220,6 +248,10 @@ getconfig(int idx) return (-1); } + TAILQ_FOREACH(rai_old, &railist, rai_next) + if (idx == rai_old->rai_ifindex) + break; + if ((stat = agetent(tbuf, intface)) <= 0) { memset(tbuf, 0, sizeof(tbuf)); syslog(LOG_INFO, @@ -254,7 +286,7 @@ getconfig(int idx) syslog(LOG_ERR, "<%s> can't get information of %s", __func__, intface); - return (-1); + goto getconfig_free_rai; } rai->rai_ifindex = rai->rai_sdl->sdl_index; } else @@ -280,7 +312,7 @@ getconfig(int idx) "<%s> maxinterval (%ld) on %s is invalid " "(must be between %u and %u)", __func__, val, intface, MIN_MAXINTERVAL, MAX_MAXINTERVAL); - return (-1); + goto getconfig_free_rai; } rai->rai_maxinterval = (u_int)val; @@ -292,7 +324,7 @@ getconfig(int idx) "(must be between %d and %d)", __func__, val, intface, MIN_MININTERVAL, (rai->rai_maxinterval * 3) / 4); - return (-1); + goto getconfig_free_rai; } rai->rai_mininterval = (u_int)val; @@ -311,7 +343,7 @@ getconfig(int idx) if ((val & ND_RA_FLAG_RTPREF_HIGH)) { syslog(LOG_ERR, "<%s> the \'h\' and \'l\'" " router flags are exclusive", __func__); - return (-1); + goto getconfig_free_rai; } val |= ND_RA_FLAG_RTPREF_LOW; } @@ -328,7 +360,7 @@ getconfig(int idx) if (rai->rai_rtpref == ND_RA_FLAG_RTPREF_RSV) { syslog(LOG_ERR, "<%s> invalid router preference (%02x) on %s", __func__, rai->rai_rtpref, intface); - return (-1); + goto getconfig_free_rai; } MAYHAVE(val, "rltime", rai->rai_maxinterval * 3); @@ -339,7 +371,7 @@ getconfig(int idx) "(must be 0 or between %d and %d)", __func__, val, intface, rai->rai_maxinterval, MAXROUTERLIFETIME); - return (-1); + goto getconfig_free_rai; } rai->rai_lifetime = val & 0xffff; @@ -349,7 +381,7 @@ getconfig(int idx) "<%s> reachable time (%ld) on %s is invalid " "(must be no greater than %d)", __func__, val, intface, MAXREACHABLETIME); - return (-1); + goto getconfig_free_rai; } rai->rai_reachabletime = (u_int32_t)val; @@ -357,7 +389,7 @@ getconfig(int idx) if (val64 < 0 || val64 > 0xffffffff) { syslog(LOG_ERR, "<%s> retrans time (%lld) on %s out of range", __func__, (long long)val64, intface); - return (-1); + goto getconfig_free_rai; } rai->rai_retranstimer = (u_int32_t)val64; @@ -365,7 +397,7 @@ getconfig(int idx) syslog(LOG_ERR, "<%s> mobile-ip6 configuration not supported", __func__); - return (-1); + goto getconfig_free_rai; } /* prefix information */ @@ -395,14 +427,14 @@ getconfig(int idx) syslog(LOG_ERR, "<%s> inet_pton failed for %s", __func__, addr); - return (-1); + goto getconfig_free_pfx; } if (IN6_IS_ADDR_MULTICAST(&pfx->pfx_prefix)) { syslog(LOG_ERR, "<%s> multicast prefix (%s) must " "not be advertised on %s", __func__, addr, intface); - return (-1); + goto getconfig_free_pfx; } if (IN6_IS_ADDR_LINKLOCAL(&pfx->pfx_prefix)) syslog(LOG_NOTICE, @@ -416,7 +448,7 @@ getconfig(int idx) syslog(LOG_ERR, "<%s> prefixlen (%ld) for %s " "on %s out of range", __func__, val, addr, intface); - return (-1); + goto getconfig_free_pfx; } pfx->pfx_prefixlen = (int)val; @@ -441,7 +473,7 @@ getconfig(int idx) "%s/%d on %s is out of range", __func__, (long long)val64, addr, pfx->pfx_prefixlen, intface); - return (-1); + goto getconfig_free_pfx; } pfx->pfx_validlifetime = (u_int32_t)val64; @@ -461,7 +493,7 @@ getconfig(int idx) "is out of range", __func__, (long long)val64, addr, pfx->pfx_prefixlen, intface); - return (-1); + goto getconfig_free_pfx; } pfx->pfx_preflifetime = (u_int32_t)val64; @@ -475,6 +507,9 @@ getconfig(int idx) /* link into chain */ TAILQ_INSERT_TAIL(&rai->rai_prefix, pfx, pfx_next); rai->rai_pfxs++; + continue; +getconfig_free_pfx: + free(pfx); } if (rai->rai_advifprefix && rai->rai_pfxs == 0) get_prefix(rai); @@ -484,7 +519,7 @@ getconfig(int idx) syslog(LOG_ERR, "<%s> mtu (%ld) on %s out of range", __func__, val, intface); - return (-1); + goto getconfig_free_rai; } rai->rai_linkmtu = (u_int32_t)val; if (rai->rai_linkmtu == 0) { @@ -501,7 +536,7 @@ getconfig(int idx) "be between least MTU (%d) and physical link MTU (%d)", __func__, (unsigned long)rai->rai_linkmtu, intface, IPV6_MMTU, rai->rai_phymtu); - return (-1); + goto getconfig_free_rai; } #ifdef SIOCSIFINFO_IN6 @@ -553,14 +588,10 @@ getconfig(int idx) /* allocate memory to store prefix information */ ELM_MALLOC(rti, exit(1)); - /* link into chain */ - TAILQ_INSERT_TAIL(&rai->rai_route, rti, rti_next); - rai->rai_routes++; - if (inet_pton(AF_INET6, addr, &rti->rti_prefix) != 1) { syslog(LOG_ERR, "<%s> inet_pton failed for %s", __func__, addr); - return (-1); + goto getconfig_free_rti; } #if 0 /* @@ -575,14 +606,14 @@ getconfig(int idx) "<%s> multicast route (%s) must " "not be advertised on %s", __func__, addr, intface); - return (-1); + goto getconfig_free_rti; } if (IN6_IS_ADDR_LINKLOCAL(&rti->prefix)) { syslog(LOG_NOTICE, "<%s> link-local route (%s) will " "be advertised on %s", __func__, addr, intface); - return (-1); + goto getconfig_free_rti; } #endif @@ -602,7 +633,7 @@ getconfig(int idx) syslog(LOG_ERR, "<%s> prefixlen (%ld) for %s on %s " "out of range", __func__, val, addr, intface); - return (-1); + goto getconfig_free_rti; } rti->rti_prefixlen = (int)val; @@ -617,7 +648,7 @@ getconfig(int idx) "<%s> the \'h\' and \'l\' route" " preferences are exclusive", __func__); - exit(1); + goto getconfig_free_rti; } val |= ND_RA_FLAG_RTPREF_LOW; } @@ -638,7 +669,7 @@ getconfig(int idx) "for %s/%d on %s", __func__, rti->rti_rtpref, addr, rti->rti_prefixlen, intface); - return (-1); + goto getconfig_free_rti; } /* @@ -665,9 +696,16 @@ getconfig(int idx) syslog(LOG_ERR, "<%s> route lifetime (%lld) for " "%s/%d on %s out of range", __func__, (long long)val64, addr, rti->rti_prefixlen, intface); - return (-1); + goto getconfig_free_rti; } rti->rti_ltime = (u_int32_t)val64; + + /* link into chain */ + TAILQ_INSERT_TAIL(&rai->rai_route, rti, rti_next); + rai->rai_routes++; + continue; +getconfig_free_rti: + free(rti); } #endif /* DNS server and DNS search list information */ @@ -689,12 +727,12 @@ getconfig(int idx) c = strcspn(ap, ","); strncpy(abuf, ap, c); abuf[c] = '\0'; - ELM_MALLOC(rdna, exit(1)); + ELM_MALLOC(rdna, goto getconfig_free_rdn); if (inet_pton(AF_INET6, abuf, &rdna->ra_dns) != 1) { syslog(LOG_ERR, "<%s> inet_pton failed for %s", __func__, abuf); free(rdna); - return (-1); + goto getconfig_free_rdn; } TAILQ_INSERT_TAIL(&rdn->rd_list, rdna, ra_next); } @@ -707,12 +745,19 @@ getconfig(int idx) "(must be between %d and %d)", entbuf, val, intface, rai->rai_maxinterval, rai->rai_maxinterval * 2); - return (-1); + goto getconfig_free_rdn; } rdn->rd_ltime = val; /* link into chain */ TAILQ_INSERT_TAIL(&rai->rai_rdnss, rdn, rd_next); + continue; +getconfig_free_rdn: + while ((rdna = TAILQ_FIRST(&rdn->rd_list)) != NULL) { + TAILQ_REMOVE(&rdn->rd_list, rdna, ra_next); + free(rdna); + } + free(rdn); } for (i = -1; i < MAXDNSSLENT ; i++) { @@ -734,7 +779,7 @@ getconfig(int idx) c = strcspn(ap, ","); strncpy(abuf, ap, c); abuf[c] = '\0'; - ELM_MALLOC(dnsa, exit(1)); + ELM_MALLOC(dnsa, goto getconfig_free_dns); dnsa->da_len = dname_labelenc(dnsa->da_dom, abuf); syslog(LOG_DEBUG, "<%s>: dnsa->da_len = %d", __func__, dnsa->da_len); @@ -749,15 +794,46 @@ getconfig(int idx) "(must be between %d and %d)", entbuf, val, intface, rai->rai_maxinterval, rai->rai_maxinterval * 2); - return (-1); + goto getconfig_free_dns; } dns->dn_ltime = val; /* link into chain */ TAILQ_INSERT_TAIL(&rai->rai_dnssl, dns, dn_next); + continue; +getconfig_free_dns: + while ((dnsa = TAILQ_FIRST(&dns->dn_list)) != NULL) { + TAILQ_REMOVE(&dns->dn_list, dnsa, da_next); + free(dnsa); + } + free(dns); } /* construct the sending packet */ make_packet(rai); + + /* + * If an entry with the same ifindex exists, remove it first. + * Before the removal, RDNSS and DNSSL options with + * zero-lifetime will be sent. + */ + if (rai_old != NULL) { + const int retrans = MAX_FINAL_RTR_ADVERTISEMENTS; + struct rdnss *rdn; + struct dnssl *dns; + + rai_old->rai_lifetime = 0; + TAILQ_FOREACH(rdn, &rai_old->rai_rdnss, rd_next) + rdn->rd_ltime = 0; + TAILQ_FOREACH(dns, &rai_old->rai_dnssl, dn_next) + dns->dn_ltime = 0; + + make_packet(rai_old); + for (i = 0; i < retrans; i++) { + ra_output(rai_old); + sleep(MIN_DELAY_BETWEEN_RAS); + } + rmconfig(idx); + } TAILQ_INSERT_TAIL(&railist, rai, rai_next); /* set timer */ @@ -767,6 +843,9 @@ getconfig(int idx) rtadvd_set_timer(&rai->rai_timer->rat_tm, rai->rai_timer); return (0); +getconfig_free_rai: + free(rai); + return (-1); } void Modified: head/usr.sbin/rtadvd/config.h ============================================================================== --- head/usr.sbin/rtadvd/config.h Sat Jun 11 02:22:11 2011 (r222971) +++ head/usr.sbin/rtadvd/config.h Sat Jun 11 03:25:10 2011 (r222972) @@ -32,6 +32,7 @@ extern int getconfig(int); extern int rmconfig(int); +extern int loadconfig(char *[], const int); extern void delete_prefix(struct prefix *); extern void invalidate_prefix(struct prefix *); extern void update_prefix(struct prefix *); Modified: head/usr.sbin/rtadvd/rtadvd.8 ============================================================================== --- head/usr.sbin/rtadvd/rtadvd.8 Sat Jun 11 02:22:11 2011 (r222971) +++ head/usr.sbin/rtadvd/rtadvd.8 Sat Jun 11 03:25:10 2011 (r222972) @@ -169,6 +169,18 @@ or the file specified with option .Fl F . .Pp Use +.Dv SIGHUP +to reload the configuration file +.Pa /etc/rtadvd.conf . +If an invalid parameter is found in the configuration file upon the reload, +the entry will be ignored and the old configuration will be used. +When parameters in an existing entry are updated, +.Nm +will send Router Advertisement messages with the old configuration but +zero router lifetime to the interface first, and then start to send a new +message. +.Pp +Use .Dv SIGTERM to kill .Nm Modified: head/usr.sbin/rtadvd/rtadvd.c ============================================================================== --- head/usr.sbin/rtadvd/rtadvd.c Sat Jun 11 02:22:11 2011 (r222971) +++ head/usr.sbin/rtadvd/rtadvd.c Sat Jun 11 03:25:10 2011 (r222972) @@ -83,6 +83,7 @@ static u_char *sndcmsgbuf = NULL; static size_t sndcmsgbuflen; volatile sig_atomic_t do_dump; volatile sig_atomic_t do_die; +volatile sig_atomic_t do_reload; struct msghdr sndmhdr; struct iovec rcviov[2]; struct iovec sndiov[2]; @@ -161,6 +162,7 @@ struct sockaddr_in6 sin6_sitelocal_allro .sin6_addr = IN6ADDR_SITELOCAL_ALLROUTERS_INIT, }; +static void set_reload(int); static void set_die(int); static void die(void); static void sock_open(void); @@ -175,7 +177,6 @@ static int prefix_check(struct nd_opt_pr static int nd6_options(struct nd_opt_hdr *, int, union nd_opt *, u_int32_t); static void free_ndopts(union nd_opt *); -static void ra_output(struct rainfo *); static void rtmsg_input(void); static void rtadvd_set_dump_file(int); static void set_short_delay(struct rainfo *); @@ -197,7 +198,6 @@ main(int argc, char *argv[]) int i, ch; int fflag = 0, logopt; pid_t pid, otherpid; - int error; /* get command line options and arguments */ while ((ch = getopt(argc, argv, "c:dDfF:M:p:Rs")) != -1) { @@ -273,22 +273,7 @@ main(int argc, char *argv[]) ifl_names = argv; ifl_len = argc; - for (i = 0; i < ifl_len; i++) { - int idx; - - idx = if_nametoindex(ifl_names[i]); - if (idx == 0) { - syslog(LOG_INFO, - "<%s> interface %s not found." - "Ignored at this moment.", __func__, ifl_names[i]); - continue; - } - error = getconfig(idx); - if (error) - syslog(LOG_INFO, - "<%s> invalid configuration for %s." - "Ignored at this moment.", __func__, ifl_names[i]); - } + loadconfig(argv, argc); pfh = pidfile_open(pidfilename, 0600, &otherpid); if (pfh == NULL) { @@ -343,6 +328,7 @@ main(int argc, char *argv[]) #endif signal(SIGTERM, set_die); signal(SIGUSR1, rtadvd_set_dump_file); + signal(SIGHUP, set_reload); while (1) { #ifndef HAVE_POLL_H @@ -358,6 +344,11 @@ main(int argc, char *argv[]) /*NOTREACHED*/ } + if (do_reload) { + loadconfig(argv, argc); + do_reload = 0; + } + /* timer expiration check and reset the timer */ timeout = rtadvd_check_timer(); @@ -421,6 +412,13 @@ rtadvd_set_dump_file(int sig __unused) } static void +set_reload(int sig __unused) +{ + + do_reload = 1; +} + +static void set_die(int sig __unused) { @@ -1698,7 +1696,7 @@ if_indextorainfo(int idx) return (NULL); /* search failed */ } -static void +void ra_output(struct rainfo *rai) { int i; Modified: head/usr.sbin/rtadvd/rtadvd.h ============================================================================== --- head/usr.sbin/rtadvd/rtadvd.h Sat Jun 11 02:22:11 2011 (r222971) +++ head/usr.sbin/rtadvd/rtadvd.h Sat Jun 11 03:25:10 2011 (r222972) @@ -233,6 +233,7 @@ extern TAILQ_HEAD(railist_head_t, rainfo struct rtadvd_timer *ra_timeout(void *); void ra_timer_update(void *, struct timeval *); +void ra_output(struct rainfo *); int prefix_match(struct in6_addr *, int, struct in6_addr *, int); From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 04:50: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 BD98F106566B; Sat, 11 Jun 2011 04:50:54 +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 AD14D8FC0A; Sat, 11 Jun 2011 04:50: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 p5B4ossC058546; Sat, 11 Jun 2011 04:50:54 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5B4osaW058541; Sat, 11 Jun 2011 04:50:54 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201106110450.p5B4osaW058541@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 11 Jun 2011 04:50: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: r222973 - 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, 11 Jun 2011 04:50:54 -0000 Author: np Date: Sat Jun 11 04:50:54 2011 New Revision: 222973 URL: http://svn.freebsd.org/changeset/base/222973 Log: - driver ioctl to get SGE context for any given queue. - sysctls to display the context id, cidx, and pidx of all kinds of queues. MFC after: 3 days Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_ioctl.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 Sat Jun 11 03:25:10 2011 (r222972) +++ head/sys/dev/cxgbe/adapter.h Sat Jun 11 04:50:54 2011 (r222973) @@ -297,7 +297,7 @@ struct sge_eq { uint16_t pidx; /* producer idx (desc idx) */ uint16_t pending; /* # of descriptors used since last doorbell */ uint16_t iqid; /* iq that gets egr_update for the eq */ - uint32_t cntxt_id; /* SGE context id for the eq */ + unsigned int cntxt_id; /* SGE context id for the eq */ }; struct sge_fl { Modified: head/sys/dev/cxgbe/t4_ioctl.h ============================================================================== --- head/sys/dev/cxgbe/t4_ioctl.h Sat Jun 11 03:25:10 2011 (r222972) +++ head/sys/dev/cxgbe/t4_ioctl.h Sat Jun 11 04:50:54 2011 (r222973) @@ -46,6 +46,7 @@ enum { T4_GET_FILTER, /* get information about a filter */ T4_SET_FILTER, /* program a filter */ T4_DEL_FILTER, /* delete a filter */ + T4_GET_SGE_CONTEXT, /* get SGE context for a queue */ }; struct t4_reg { @@ -184,6 +185,20 @@ struct t4_filter { struct t4_filter_specification fs; }; +#define T4_SGE_CONTEXT_SIZE 24 +enum { + SGE_CONTEXT_EGRESS, + SGE_CONTEXT_INGRESS, + SGE_CONTEXT_FLM, + SGE_CONTEXT_CNM +}; + +struct t4_sge_context { + uint32_t mem_id; + uint32_t cid; + uint32_t data[T4_SGE_CONTEXT_SIZE / 4]; +}; + #define CHELSIO_T4_GETREG _IOWR('f', T4_GETREG, struct t4_reg) #define CHELSIO_T4_SETREG _IOW('f', T4_SETREG, struct t4_reg) #define CHELSIO_T4_REGDUMP _IOWR('f', T4_REGDUMP, struct t4_regdump) @@ -192,4 +207,6 @@ struct t4_filter { #define CHELSIO_T4_GET_FILTER _IOWR('f', T4_GET_FILTER, struct t4_filter) #define CHELSIO_T4_SET_FILTER _IOW('f', T4_SET_FILTER, struct t4_filter) #define CHELSIO_T4_DEL_FILTER _IOW('f', T4_DEL_FILTER, struct t4_filter) +#define CHELSIO_T4_GET_SGE_CONTEXT _IOWR('f', T4_GET_SGE_CONTEXT, \ + struct t4_sge_context) #endif Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sat Jun 11 03:25:10 2011 (r222972) +++ head/sys/dev/cxgbe/t4_main.c Sat Jun 11 04:50:54 2011 (r222973) @@ -313,6 +313,7 @@ static void clear_filter(struct filter_e 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 *); +static int get_sge_context(struct adapter *, struct t4_sge_context *); static int t4_mod_event(module_t, int, void *); struct t4_pciids { @@ -3417,6 +3418,35 @@ filter_rpl(struct adapter *sc, const str } } +static int +get_sge_context(struct adapter *sc, struct t4_sge_context *cntxt) +{ + int rc = EINVAL; + + if (cntxt->cid > M_CTXTQID) + return (rc); + + if (cntxt->mem_id != CTXT_EGRESS && cntxt->mem_id != CTXT_INGRESS && + cntxt->mem_id != CTXT_FLM && cntxt->mem_id != CTXT_CNM) + return (rc); + + if (sc->flags & FW_OK) { + ADAPTER_LOCK(sc); /* Avoid parallel t4_wr_mbox */ + rc = -t4_sge_ctxt_rd(sc, sc->mbox, cntxt->cid, cntxt->mem_id, + &cntxt->data[0]); + ADAPTER_UNLOCK(sc); + } + + if (rc != 0) { + /* Read via firmware failed or wasn't even attempted */ + + rc = -t4_sge_ctxt_rd_bd(sc, cntxt->cid, cntxt->mem_id, + &cntxt->data[0]); + } + + return (rc); +} + int t4_os_find_pci_capability(struct adapter *sc, int cap) { @@ -3580,6 +3610,9 @@ t4_ioctl(struct cdev *dev, unsigned long rc = del_filter(sc, (struct t4_filter *)data); ADAPTER_UNLOCK(sc); break; + case CHELSIO_T4_GET_SGE_CONTEXT: + rc = get_sge_context(sc, (struct t4_sge_context *)data); + break; default: rc = EINVAL; } Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sat Jun 11 03:25:10 2011 (r222972) +++ head/sys/dev/cxgbe/t4_sge.c Sat Jun 11 04:50:54 2011 (r222973) @@ -1368,6 +1368,12 @@ alloc_fwq(struct adapter *sc, int intr_i children = SYSCTL_CHILDREN(sc->oid_fwq); + SYSCTL_ADD_PROC(&sc->ctx, children, OID_AUTO, "abs_id", + CTLTYPE_INT | CTLFLAG_RD, &fwq->abs_id, 0, sysctl_uint16, "I", + "absolute id of the queue"); + SYSCTL_ADD_PROC(&sc->ctx, children, OID_AUTO, "cntxt_id", + CTLTYPE_INT | CTLFLAG_RD, &fwq->cntxt_id, 0, sysctl_uint16, "I", + "SGE context id of the queue"); SYSCTL_ADD_PROC(&sc->ctx, children, OID_AUTO, "cidx", CTLTYPE_INT | CTLFLAG_RD, &fwq->cidx, 0, sysctl_uint16, "I", "consumer index"); @@ -1418,6 +1424,12 @@ alloc_rxq(struct port_info *pi, struct s SYSCTL_ADD_PROC(&pi->ctx, children, OID_AUTO, "abs_id", CTLTYPE_INT | CTLFLAG_RD, &rxq->iq.abs_id, 0, sysctl_uint16, "I", "absolute id of the queue"); + SYSCTL_ADD_PROC(&pi->ctx, children, OID_AUTO, "cntxt_id", + CTLTYPE_INT | CTLFLAG_RD, &rxq->iq.cntxt_id, 0, sysctl_uint16, "I", + "SGE context id of the queue"); + SYSCTL_ADD_PROC(&pi->ctx, children, OID_AUTO, "cidx", + CTLTYPE_INT | CTLFLAG_RD, &rxq->iq.cidx, 0, sysctl_uint16, "I", + "consumer index"); #ifdef INET SYSCTL_ADD_INT(&pi->ctx, children, OID_AUTO, "lro_queued", CTLFLAG_RD, &rxq->lro.lro_queued, 0, NULL); @@ -1430,6 +1442,19 @@ alloc_rxq(struct port_info *pi, struct s CTLFLAG_RD, &rxq->vlan_extraction, "# of times hardware extracted 802.1Q tag"); + children = SYSCTL_CHILDREN(oid); + oid = SYSCTL_ADD_NODE(&pi->ctx, children, OID_AUTO, "fl", CTLFLAG_RD, + NULL, "freelist"); + children = SYSCTL_CHILDREN(oid); + + SYSCTL_ADD_PROC(&pi->ctx, children, OID_AUTO, "cntxt_id", + CTLTYPE_INT | CTLFLAG_RD, &rxq->fl.cntxt_id, 0, sysctl_uint16, "I", + "SGE context id of the queue"); + SYSCTL_ADD_UINT(&pi->ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, + &rxq->fl.cidx, 0, "consumer index"); + SYSCTL_ADD_UINT(&pi->ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, + &rxq->fl.pidx, 0, "producer index"); + return (rc); } @@ -1652,6 +1677,15 @@ alloc_txq(struct port_info *pi, struct s NULL, "tx queue"); children = SYSCTL_CHILDREN(oid); + SYSCTL_ADD_UINT(&pi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, + &eq->cntxt_id, 0, "SGE context id of the queue"); + SYSCTL_ADD_PROC(&pi->ctx, children, OID_AUTO, "cidx", + CTLTYPE_INT | CTLFLAG_RD, &eq->cidx, 0, sysctl_uint16, "I", + "consumer index"); + SYSCTL_ADD_PROC(&pi->ctx, children, OID_AUTO, "pidx", + CTLTYPE_INT | CTLFLAG_RD, &eq->pidx, 0, sysctl_uint16, "I", + "producer index"); + SYSCTL_ADD_UQUAD(&pi->ctx, children, OID_AUTO, "txcsum", CTLFLAG_RD, &txq->txcsum, "# of times hardware assisted with checksum"); SYSCTL_ADD_UQUAD(&pi->ctx, children, OID_AUTO, "vlan_insertion", From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 04:55: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 E87E91065670; Sat, 11 Jun 2011 04:55:15 +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 D7AF68FC0A; Sat, 11 Jun 2011 04:55: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 p5B4tF9j058711; Sat, 11 Jun 2011 04:55:15 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5B4tFf9058709; Sat, 11 Jun 2011 04:55:15 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201106110455.p5B4tFf9058709@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 11 Jun 2011 04:55: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: r222974 - head/tools/tools/cxgbetool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 11 Jun 2011 04:55:16 -0000 Author: np Date: Sat Jun 11 04:55:15 2011 New Revision: 222974 URL: http://svn.freebsd.org/changeset/base/222974 Log: Add "context" subcommand to fetch and display SGE context. Modified: head/tools/tools/cxgbetool/cxgbetool.c Modified: head/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- head/tools/tools/cxgbetool/cxgbetool.c Sat Jun 11 04:50:54 2011 (r222973) +++ head/tools/tools/cxgbetool/cxgbetool.c Sat Jun 11 04:55:15 2011 (r222974) @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#define max(x, y) ((x) > (y) ? (x) : (y)) + static const char *progname, *nexus; struct reg_info { @@ -59,6 +61,15 @@ struct mod_regs { const struct reg_info *ri; }; +struct field_desc { + const char *name; /* Field name */ + unsigned short start; /* Start bit position */ + unsigned short end; /* End bit position */ + unsigned char shift; /* # of low order bits omitted and implicitly 0 */ + unsigned char hex; /* Print field in hex instead of decimal */ + unsigned char islog2; /* Field contains the base-2 log of the value */ +}; + #include "reg_defs_t4.c" #include "reg_defs_t4vf.c" @@ -67,6 +78,7 @@ usage(FILE *fp) { fprintf(fp, "Usage: %s [operation]\n", progname); fprintf(fp, + "\tcontext show an SGE context\n" "\tfilter [ ] ... set a filter\n" "\tfilter delete|clear delete a filter\n" "\tfilter list list all filters\n" @@ -1113,6 +1125,227 @@ filter_cmd(int argc, const char *argv[]) return set_filter(idx, argc - 1, argv + 1); } +/* + * Shows the fields of a multi-word structure. The structure is considered to + * consist of @nwords 32-bit words (i.e, it's an (@nwords * 32)-bit structure) + * whose fields are described by @fd. The 32-bit words are given in @words + * starting with the least significant 32-bit word. + */ +static void +show_struct(const uint32_t *words, int nwords, const struct field_desc *fd) +{ + unsigned int w = 0; + const struct field_desc *p; + + for (p = fd; p->name; p++) + w = max(w, strlen(p->name)); + + while (fd->name) { + unsigned long long data; + int first_word = fd->start / 32; + int shift = fd->start % 32; + int width = fd->end - fd->start + 1; + unsigned long long mask = (1ULL << width) - 1; + + data = (words[first_word] >> shift) | + ((uint64_t)words[first_word + 1] << (32 - shift)); + if (shift) + data |= ((uint64_t)words[first_word + 2] << (64 - shift)); + data &= mask; + if (fd->islog2) + data = 1 << data; + printf("%-*s ", w, fd->name); + printf(fd->hex ? "%#llx\n" : "%llu\n", data << fd->shift); + fd++; + } +} + +#define FIELD(name, start, end) { name, start, end, 0, 0, 0 } +#define FIELD1(name, start) FIELD(name, start, start) + +static void +show_sge_context(const struct t4_sge_context *p) +{ + static struct field_desc egress[] = { + FIELD1("StatusPgNS:", 180), + FIELD1("StatusPgRO:", 179), + FIELD1("FetchNS:", 178), + FIELD1("FetchRO:", 177), + FIELD1("Valid:", 176), + FIELD("PCIeDataChannel:", 174, 175), + FIELD1("DCAEgrQEn:", 173), + FIELD("DCACPUID:", 168, 172), + FIELD1("FCThreshOverride:", 167), + FIELD("WRLength:", 162, 166), + FIELD1("WRLengthKnown:", 161), + FIELD1("ReschedulePending:", 160), + FIELD1("OnChipQueue:", 159), + FIELD1("FetchSizeMode", 158), + { "FetchBurstMin:", 156, 157, 4, 0, 1 }, + { "FetchBurstMax:", 153, 154, 6, 0, 1 }, + FIELD("uPToken:", 133, 152), + FIELD1("uPTokenEn:", 132), + FIELD1("UserModeIO:", 131), + FIELD("uPFLCredits:", 123, 130), + FIELD1("uPFLCreditEn:", 122), + FIELD("FID:", 111, 121), + FIELD("HostFCMode:", 109, 110), + FIELD1("HostFCOwner:", 108), + { "CIDXFlushThresh:", 105, 107, 0, 0, 1 }, + FIELD("CIDX:", 89, 104), + FIELD("PIDX:", 73, 88), + { "BaseAddress:", 18, 72, 9, 1 }, + FIELD("QueueSize:", 2, 17), + FIELD1("QueueType:", 1), + FIELD1("CachePriority:", 0), + { NULL } + }; + static struct field_desc fl[] = { + FIELD1("StatusPgNS:", 180), + FIELD1("StatusPgRO:", 179), + FIELD1("FetchNS:", 178), + FIELD1("FetchRO:", 177), + FIELD1("Valid:", 176), + FIELD("PCIeDataChannel:", 174, 175), + FIELD1("DCAEgrQEn:", 173), + FIELD("DCACPUID:", 168, 172), + FIELD1("FCThreshOverride:", 167), + FIELD("WRLength:", 162, 166), + FIELD1("WRLengthKnown:", 161), + FIELD1("ReschedulePending:", 160), + FIELD1("OnChipQueue:", 159), + FIELD1("FetchSizeMode", 158), + { "FetchBurstMin:", 156, 157, 4, 0, 1 }, + { "FetchBurstMax:", 153, 154, 6, 0, 1 }, + FIELD1("FLMcongMode:", 152), + FIELD("MaxuPFLCredits:", 144, 151), + FIELD("FLMcontextID:", 133, 143), + FIELD1("uPTokenEn:", 132), + FIELD1("UserModeIO:", 131), + FIELD("uPFLCredits:", 123, 130), + FIELD1("uPFLCreditEn:", 122), + FIELD("FID:", 111, 121), + FIELD("HostFCMode:", 109, 110), + FIELD1("HostFCOwner:", 108), + { "CIDXFlushThresh:", 105, 107, 0, 0, 1 }, + FIELD("CIDX:", 89, 104), + FIELD("PIDX:", 73, 88), + { "BaseAddress:", 18, 72, 9, 1 }, + FIELD("QueueSize:", 2, 17), + FIELD1("QueueType:", 1), + FIELD1("CachePriority:", 0), + { NULL } + }; + static struct field_desc ingress[] = { + FIELD1("NoSnoop:", 145), + FIELD1("RelaxedOrdering:", 144), + FIELD1("GTSmode:", 143), + FIELD1("ISCSICoalescing:", 142), + FIELD1("Valid:", 141), + FIELD1("TimerPending:", 140), + FIELD1("DropRSS:", 139), + FIELD("PCIeChannel:", 137, 138), + FIELD1("SEInterruptArmed:", 136), + FIELD1("CongestionMgtEnable:", 135), + FIELD1("DCAIngQEnable:", 134), + FIELD("DCACPUID:", 129, 133), + FIELD1("UpdateScheduling:", 128), + FIELD("UpdateDelivery:", 126, 127), + FIELD1("InterruptSent:", 125), + FIELD("InterruptIDX:", 114, 124), + FIELD1("InterruptDestination:", 113), + FIELD1("InterruptArmed:", 112), + FIELD("RxIntCounter:", 106, 111), + FIELD("RxIntCounterThreshold:", 104, 105), + FIELD1("Generation:", 103), + { "BaseAddress:", 48, 102, 9, 1 }, + FIELD("PIDX:", 32, 47), + FIELD("CIDX:", 16, 31), + { "QueueSize:", 4, 15, 4, 0 }, + { "QueueEntrySize:", 2, 3, 4, 0, 1 }, + FIELD1("QueueEntryOverride:", 1), + FIELD1("CachePriority:", 0), + { NULL } + }; + static struct field_desc flm[] = { + FIELD1("NoSnoop:", 79), + FIELD1("RelaxedOrdering:", 78), + FIELD1("Valid:", 77), + FIELD("DCACPUID:", 72, 76), + FIELD1("DCAFLEn:", 71), + FIELD("EQid:", 54, 70), + FIELD("SplitEn:", 52, 53), + FIELD1("PadEn:", 51), + FIELD1("PackEn:", 50), + FIELD1("DBpriority:", 48), + FIELD("PackOffset:", 16, 47), + FIELD("CIDX:", 8, 15), + FIELD("PIDX:", 0, 7), + { NULL } + }; + static struct field_desc conm[] = { + FIELD1("CngDBPHdr:", 6), + FIELD1("CngDBPData:", 5), + FIELD1("CngIMSG:", 4), + FIELD("CngChMap:", 0, 3), + { NULL } + }; + + if (p->mem_id == SGE_CONTEXT_EGRESS) + show_struct(p->data, 6, (p->data[0] & 2) ? fl : egress); + else if (p->mem_id == SGE_CONTEXT_FLM) + show_struct(p->data, 3, flm); + else if (p->mem_id == SGE_CONTEXT_INGRESS) + show_struct(p->data, 5, ingress); + else if (p->mem_id == SGE_CONTEXT_CNM) + show_struct(p->data, 1, conm); +} + +#undef FIELD +#undef FIELD1 + +static int +get_sge_context(int argc, const char *argv[]) +{ + int rc; + char *p; + long cid; + struct t4_sge_context cntxt = {0}; + + if (argc != 2) { + warnx("sge_context: incorrect number of arguments."); + return (EINVAL); + } + + if (!strcmp(argv[0], "egress")) + cntxt.mem_id = SGE_CONTEXT_EGRESS; + else if (!strcmp(argv[0], "ingress")) + cntxt.mem_id = SGE_CONTEXT_INGRESS; + else if (!strcmp(argv[0], "fl")) + cntxt.mem_id = SGE_CONTEXT_FLM; + else if (!strcmp(argv[0], "cong")) + cntxt.mem_id = SGE_CONTEXT_CNM; + else { + warnx("unknown context type \"%s\"; known types are egress, " + "ingress, fl, and cong.", argv[0]); + return (EINVAL); + } + + p = str_to_number(argv[1], &cid, NULL); + if (*p) { + warnx("invalid context id \"%s\"", argv[1]); + return (EINVAL); + } + cntxt.cid = cid; + + rc = doit(CHELSIO_T4_GET_SGE_CONTEXT, &cntxt); + if (rc != 0) + return (rc); + + show_sge_context(&cntxt); + return (0); +} + static int run_cmd(int argc, const char *argv[]) { @@ -1131,6 +1364,8 @@ run_cmd(int argc, const char *argv[]) rc = dump_regs(argc, argv); else if (!strcmp(cmd, "filter")) rc = filter_cmd(argc, argv); + else if (!strcmp(cmd, "context")) + rc = get_sge_context(argc, argv); else { rc = EINVAL; warnx("invalid command \"%s\"", cmd); From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 04:59: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 B8041106566B; Sat, 11 Jun 2011 04:59:01 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A54C68FC17; Sat, 11 Jun 2011 04:59: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 p5B4x1Fk058865; Sat, 11 Jun 2011 04:59:01 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5B4x1AH058850; Sat, 11 Jun 2011 04:59:01 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201106110459.p5B4x1AH058850@svn.freebsd.org> From: "Justin T. Gibbs" Date: Sat, 11 Jun 2011 04:59: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: r222975 - in head/sys: dev/xen/blkback dev/xen/blkfront dev/xen/control dev/xen/netfront xen/interface/io xen/xenbus xen/xenstore X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 11 Jun 2011 04:59:01 -0000 Author: gibbs Date: Sat Jun 11 04:59:01 2011 New Revision: 222975 URL: http://svn.freebsd.org/changeset/base/222975 Log: Monitor and emit events for XenStore changes to XenBus trees of the devices we manage. These changes can be due to writes we make ourselves or due to changes made by the control domain. The goal of these changes is to insure that all state transitions can be detected regardless of their source and to allow common device policies (e.g. "onlined" backend devices) to be centralized in the XenBus bus code. sys/xen/xenbus/xenbusvar.h: sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbus_if.m: Add a new method for XenBus drivers "localend_changed". This method is invoked whenever a write is detected to a device's XenBus tree. The default implementation of this method is a no-op. sys/xen/xenbus/xenbus_if.m: sys/dev/xen/netfront/netfront.c: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkback/blkback.c: Change the signature of the "otherend_changed" method. This notification cannot fail, so it should return void. sys/xen/xenbus/xenbusb_back.c: Add "online" device handling to the XenBus Back Bus support code. An online backend device remains active after a front-end detaches as a reconnect is expected to occur in the near future. sys/xen/interface/io/xenbus.h: Add comment block further explaining the meaning and driver responsibilities associated with the XenBus Closed state. sys/xen/xenbus/xenbusb.c: sys/xen/xenbus/xenbusb.h: sys/xen/xenbus/xenbusb_back.c: sys/xen/xenbus/xenbusb_front.c: sys/xen/xenbus/xenbusb_if.m: o Register a XenStore watch against the local XenBus tree for all devices. o Cache the string length of the path to our local tree. o Allow the xenbus front and back drivers to hook/filter both local and otherend watch processing. o Update the device ivar version of "state" when we detect a XenStore update of that node. sys/dev/xen/control/control.c: sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbusb.c: sys/xen/xenbus/xenbusb.h: sys/xen/xenbus/xenbusvar.h: sys/xen/xenstore/xenstorevar.h: Allow clients of the XenStore watch mechanism to attach a single uintptr_t worth of client data to the watch. This removes the need to carefully place client watch data within enclosing objects so that a cast or offsetof calculation can be used to convert from watch to enclosing object. Sponsored by: Spectra Logic Corporation MFC after: 1 week Modified: head/sys/dev/xen/blkback/blkback.c head/sys/dev/xen/blkfront/blkfront.c head/sys/dev/xen/control/control.c head/sys/dev/xen/netfront/netfront.c head/sys/xen/interface/io/xenbus.h head/sys/xen/xenbus/xenbus.c head/sys/xen/xenbus/xenbus_if.m head/sys/xen/xenbus/xenbusb.c head/sys/xen/xenbus/xenbusb.h head/sys/xen/xenbus/xenbusb_back.c head/sys/xen/xenbus/xenbusb_front.c head/sys/xen/xenbus/xenbusb_if.m head/sys/xen/xenbus/xenbusvar.h head/sys/xen/xenstore/xenstorevar.h Modified: head/sys/dev/xen/blkback/blkback.c ============================================================================== --- head/sys/dev/xen/blkback/blkback.c Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/dev/xen/blkback/blkback.c Sat Jun 11 04:59:01 2011 (r222975) @@ -2921,7 +2921,7 @@ xbb_resume(device_t dev) * * \return 0 for success, errno codes for failure. */ -static int +static void xbb_frontend_changed(device_t dev, XenbusState frontend_state) { struct xbb_softc *xbb = device_get_softc(dev); @@ -2948,7 +2948,6 @@ xbb_frontend_changed(device_t dev, Xenbu frontend_state); break; } - return (0); } /*---------------------------- NewBus Registration ---------------------------*/ Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/dev/xen/blkfront/blkfront.c Sat Jun 11 04:59:01 2011 (r222975) @@ -739,7 +739,7 @@ setup_blkring(struct xb_softc *sc) /** * Callback received when the backend's state changes. */ -static int +static void blkfront_backend_changed(device_t dev, XenbusState backend_state) { struct xb_softc *sc = device_get_softc(dev); @@ -772,8 +772,6 @@ blkfront_backend_changed(device_t dev, X blkfront_closing(dev); break; } - - return (0); } /* Modified: head/sys/dev/xen/control/control.c ============================================================================== --- head/sys/dev/xen/control/control.c Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/dev/xen/control/control.c Sat Jun 11 04:59:01 2011 (r222975) @@ -173,8 +173,6 @@ static struct xctrl_shutdown_reason xctr }; struct xctrl_softc { - - /** Must be first */ struct xs_watch xctrl_watch; }; @@ -450,6 +448,7 @@ xctrl_attach(device_t dev) /* Activate watch */ xctrl->xctrl_watch.node = "control/shutdown"; xctrl->xctrl_watch.callback = xctrl_on_watch_event; + xctrl->xctrl_watch.callback_data = (uintptr_t)xctrl; xs_register_watch(&xctrl->xctrl_watch); #ifndef XENHVM Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/dev/xen/netfront/netfront.c Sat Jun 11 04:59:01 2011 (r222975) @@ -650,7 +650,7 @@ netfront_send_fake_arp(device_t dev, str /** * Callback received when the backend's state changes. */ -static int +static void netfront_backend_changed(device_t dev, XenbusState newstate) { struct netfront_info *sc = device_get_softc(dev); @@ -680,7 +680,6 @@ netfront_backend_changed(device_t dev, X xenbus_set_state(dev, XenbusStateClosed); break; } - return (0); } static void Modified: head/sys/xen/interface/io/xenbus.h ============================================================================== --- head/sys/xen/interface/io/xenbus.h Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/xen/interface/io/xenbus.h Sat Jun 11 04:59:01 2011 (r222975) @@ -64,6 +64,15 @@ enum xenbus_state { /* * Closed: No connection exists between front and back end. + * + * For backend devices with the "online" attribute, the front can + * request a reconnect at any time. To handle this transition + * gracefully, backend devices must reinitialize any XenStore data + * used to negotiate features with a peer before transitioning to + * the closed state. When a reconnect request occurs, the + * XenBus backend support code will automatically transition the + * backend device from Closed to InitWait, kicking off the ring + * and feature negotiation process. */ XenbusStateClosed = 6, Modified: head/sys/xen/xenbus/xenbus.c ============================================================================== --- head/sys/xen/xenbus/xenbus.c Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/xen/xenbus/xenbus.c Sat Jun 11 04:59:01 2011 (r222975) @@ -103,12 +103,13 @@ xenbus_strstate(XenbusState state) int xenbus_watch_path(device_t dev, char *path, struct xs_watch *watch, - xs_watch_cb_t *callback) + xs_watch_cb_t *callback, uintptr_t callback_data) { int error; watch->node = path; watch->callback = callback; + watch->callback_data = callback_data; error = xs_register_watch(watch); @@ -124,7 +125,7 @@ xenbus_watch_path(device_t dev, char *pa int xenbus_watch_path2(device_t dev, const char *path, const char *path2, struct xs_watch *watch, - xs_watch_cb_t *callback) + xs_watch_cb_t *callback, uintptr_t callback_data) { int error; char *state = malloc(strlen(path) + 1 + strlen(path2) + 1, @@ -134,7 +135,7 @@ xenbus_watch_path2(device_t dev, const c strcat(state, "/"); strcat(state, path2); - error = xenbus_watch_path(dev, state, watch, callback); + error = xenbus_watch_path(dev, state, watch, callback, callback_data); if (error) { free(state,M_XENBUS); } @@ -286,3 +287,8 @@ xenbus_dev_is_online(device_t dev) return (value); } + +void +xenbus_localend_changed(device_t dev, const char *path) +{ +} Modified: head/sys/xen/xenbus/xenbus_if.m ============================================================================== --- head/sys/xen/xenbus/xenbus_if.m Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/xen/xenbus/xenbus_if.m Sat Jun 11 04:59:01 2011 (r222975) @@ -27,7 +27,11 @@ # #include -#include + +#include +#include +#include +#include INTERFACE xenbus; @@ -39,7 +43,21 @@ INTERFACE xenbus; * state has changed.. * \param _newstate The new state of the otherend device. */ -METHOD int otherend_changed { +METHOD void otherend_changed { device_t _dev; enum xenbus_state _newstate; }; + +/** + * \brief Callback triggered when the XenStore tree of the local end + * of a split device changes. + * + * \param _dev NewBus device_t for this XenBus device whose otherend's + * state has changed.. + * \param _path The tree relative sub-path to the modified node. The empty + * string indicates the root of the tree was destroyed. + */ +METHOD void localend_changed { + device_t _dev; + const char * _path; +} DEFAULT xenbus_localend_changed; Modified: head/sys/xen/xenbus/xenbusb.c ============================================================================== --- head/sys/xen/xenbus/xenbusb.c Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/xen/xenbus/xenbusb.c Sat Jun 11 04:59:01 2011 (r222975) @@ -90,10 +90,16 @@ xenbusb_free_child_ivars(struct xenbus_d ivars->xd_otherend_watch.node = NULL; } + if (ivars->xd_local_watch.node != NULL) { + xs_unregister_watch(&ivars->xd_local_watch); + ivars->xd_local_watch.node = NULL; + } + if (ivars->xd_node != NULL) { free(ivars->xd_node, M_XENBUS); ivars->xd_node = NULL; } + ivars->xd_node_len = 0; if (ivars->xd_type != NULL) { free(ivars->xd_type, M_XENBUS); @@ -104,6 +110,7 @@ xenbusb_free_child_ivars(struct xenbus_d free(ivars->xd_otherend_path, M_XENBUS); ivars->xd_otherend_path = NULL; } + ivars->xd_otherend_path_len = 0; free(ivars, M_XENBUS); } @@ -121,30 +128,64 @@ xenbusb_free_child_ivars(struct xenbus_d * watch event data. The vector should be indexed via the * xs_watch_type enum in xs_wire.h. * \param vec_size The number of elements in vec. - * - * \return The device_t of the found device if any, or NULL. - * - * \note device_t is a pointer type, so it can be compared against - * NULL for validity. */ static void -xenbusb_otherend_changed(struct xs_watch *watch, const char **vec, +xenbusb_otherend_watch_cb(struct xs_watch *watch, const char **vec, unsigned int vec_size __unused) { struct xenbus_device_ivars *ivars; - device_t dev; + device_t child; + device_t bus; + const char *path; enum xenbus_state newstate; - ivars = (struct xenbus_device_ivars *) watch; - dev = ivars->xd_dev; - - if (!ivars->xd_otherend_path - || strncmp(ivars->xd_otherend_path, vec[XS_WATCH_PATH], - strlen(ivars->xd_otherend_path))) + ivars = (struct xenbus_device_ivars *)watch->callback_data; + child = ivars->xd_dev; + bus = device_get_parent(child); + + path = vec[XS_WATCH_PATH]; + if (ivars->xd_otherend_path == NULL + || strncmp(ivars->xd_otherend_path, path, ivars->xd_otherend_path_len)) return; newstate = xenbus_read_driver_state(ivars->xd_otherend_path); - XENBUS_OTHEREND_CHANGED(dev, newstate); + XENBUSB_OTHEREND_CHANGED(bus, child, newstate); +} + +/** + * XenBus watch callback registered against the XenStore sub-tree + * represnting the local half of a split device connection. + * + * This callback is invoked whenever any XenStore data in the subtree + * is modified, either by us or another privledged domain. + * + * \param watch The xs_watch object used to register this callback + * function. + * \param vec An array of pointers to NUL terminated strings containing + * watch event data. The vector should be indexed via the + * xs_watch_type enum in xs_wire.h. + * \param vec_size The number of elements in vec. + * + */ +static void +xenbusb_local_watch_cb(struct xs_watch *watch, const char **vec, + unsigned int vec_size __unused) +{ + struct xenbus_device_ivars *ivars; + device_t child; + device_t bus; + const char *path; + + ivars = (struct xenbus_device_ivars *)watch->callback_data; + child = ivars->xd_dev; + bus = device_get_parent(child); + + path = vec[XS_WATCH_PATH]; + if (ivars->xd_node == NULL + || strncmp(ivars->xd_node, path, ivars->xd_node_len)) + return; + + XENBUSB_LOCALEND_CHANGED(bus, child, &path[ivars->xd_node_len]); } /** @@ -193,12 +234,14 @@ xenbusb_delete_child(device_t dev, devic /* * We no longer care about the otherend of the - * connection. Cancel the watch now so that we + * connection. Cancel the watches now so that we * don't try to handle an event for a partially * detached child. */ if (ivars->xd_otherend_watch.node != NULL) xs_unregister_watch(&ivars->xd_otherend_watch); + if (ivars->xd_local_watch.node != NULL) + xs_unregister_watch(&ivars->xd_local_watch); device_delete_child(dev, child); xenbusb_free_child_ivars(ivars); @@ -421,6 +464,7 @@ xenbusb_probe_children(device_t dev) */ ivars = device_get_ivars(kids[i]); xs_register_watch(&ivars->xd_otherend_watch); + xs_register_watch(&ivars->xd_local_watch); } free(kids, M_TEMP); } @@ -475,7 +519,7 @@ xenbusb_devices_changed(struct xs_watch char *p; u_int component; - xbs = (struct xenbusb_softc *)watch; + xbs = (struct xenbusb_softc *)watch->callback_data; dev = xbs->xbs_dev; if (len <= XS_WATCH_PATH) { @@ -620,6 +664,7 @@ xenbusb_add_device(device_t dev, const c sx_init(&ivars->xd_lock, "xdlock"); ivars->xd_flags = XDF_CONNECTING; ivars->xd_node = strdup(devpath, M_XENBUS); + ivars->xd_node_len = strlen(devpath); ivars->xd_type = strdup(type, M_XENBUS); ivars->xd_state = XenbusStateInitialising; @@ -630,12 +675,16 @@ xenbusb_add_device(device_t dev, const c goto out; } - statepath = malloc(strlen(ivars->xd_otherend_path) + statepath = malloc(ivars->xd_otherend_path_len + strlen("/state") + 1, M_XENBUS, M_WAITOK); sprintf(statepath, "%s/state", ivars->xd_otherend_path); - ivars->xd_otherend_watch.node = statepath; - ivars->xd_otherend_watch.callback = xenbusb_otherend_changed; + ivars->xd_otherend_watch.callback = xenbusb_otherend_watch_cb; + ivars->xd_otherend_watch.callback_data = (uintptr_t)ivars; + + ivars->xd_local_watch.node = ivars->xd_node; + ivars->xd_local_watch.callback = xenbusb_local_watch_cb; + ivars->xd_local_watch.callback_data = (uintptr_t)ivars; mtx_lock(&xbs->xbs_lock); xbs->xbs_connecting_children++; @@ -693,6 +742,7 @@ xenbusb_attach(device_t dev, char *bus_n xbs->xbs_device_watch.node = bus_node; xbs->xbs_device_watch.callback = xenbusb_devices_changed; + xbs->xbs_device_watch.callback_data = (uintptr_t)xbs; TASK_INIT(&xbs->xbs_probe_children, 0, xenbusb_probe_children_cb, dev); @@ -735,7 +785,7 @@ xenbusb_resume(device_t dev) DEVICE_RESUME(kids[i]); - statepath = malloc(strlen(ivars->xd_otherend_path) + statepath = malloc(ivars->xd_otherend_path_len + strlen("/state") + 1, M_XENBUS, M_WAITOK); sprintf(statepath, "%s/state", ivars->xd_otherend_path); @@ -819,7 +869,7 @@ xenbusb_write_ivar(device_t dev, device_ { int error; - newstate = (enum xenbus_state) value; + newstate = (enum xenbus_state)value; sx_xlock(&ivars->xd_lock); if (ivars->xd_state == newstate) { error = 0; @@ -876,3 +926,24 @@ xenbusb_write_ivar(device_t dev, device_ return (ENOENT); } + +void +xenbusb_otherend_changed(device_t bus, device_t child, enum xenbus_state state) +{ + XENBUS_OTHEREND_CHANGED(child, state); +} + +void +xenbusb_localend_changed(device_t bus, device_t child, const char *path) +{ + + if (strcmp(path, "/state") != 0) { + struct xenbus_device_ivars *ivars; + + ivars = device_get_ivars(child); + sx_xlock(&ivars->xd_lock); + ivars->xd_state = xenbus_read_driver_state(ivars->xd_node); + sx_xunlock(&ivars->xd_lock); + } + XENBUS_LOCALEND_CHANGED(child, path); +} Modified: head/sys/xen/xenbus/xenbusb.h ============================================================================== --- head/sys/xen/xenbus/xenbusb.h Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/xen/xenbus/xenbusb.h Sat Jun 11 04:59:01 2011 (r222975) @@ -41,7 +41,6 @@ * Datastructures and function declarations for use in implementing * bus attachements (e.g. frontend and backend device busses) for XenBus. */ -#include "xenbusb_if.h" /** * Enumeration of state flag values for the xbs_flags field of @@ -61,10 +60,6 @@ struct xenbusb_softc { * XenStore watch used to monitor the subtree of the * XenStore where devices for this bus attachment arrive * and depart. - * - * \note This field must be the first in the softc structure - * so that a simple cast can be used to retrieve the - * softc from within a XenStore watch event callback. */ struct xs_watch xbs_device_watch; @@ -129,14 +124,17 @@ struct xenbus_device_ivars { * XenStore watch used to monitor the subtree of the * XenStore where information about the otherend of * the split Xen device this device instance represents. - * - * \note This field must be the first in the instance - * variable structure so that a simple cast can be - * used to retrieve ivar data from within a XenStore - * watch event callback. */ struct xs_watch xd_otherend_watch; + /** + * XenStore watch used to monitor the XenStore sub-tree + * associated with this device. This watch will fire + * for modifications that we make from our domain as + * well as for those made by the control domain. + */ + struct xs_watch xd_local_watch; + /** Sleepable lock used to protect instance data. */ struct sx xd_lock; @@ -152,6 +150,9 @@ struct xenbus_device_ivars { */ char *xd_node; + /** The length of xd_node. */ + int xd_node_len; + /** XenBus device type ("vbd", "vif", etc.). */ char *xd_type; @@ -168,6 +169,9 @@ struct xenbus_device_ivars { * about the otherend of this split device instance. */ char *xd_otherend_path; + + /** The length of xd_otherend_path. */ + int xd_otherend_path_len; }; /** @@ -247,6 +251,26 @@ int xenbusb_write_ivar(device_t dev, dev uintptr_t value); /** + * \brief Common XenBus method implementing responses to peer state changes. + * + * \param bus The XenBus bus parent of child. + * \param child The XenBus child whose peer stat has changed. + * \param state The current state of the peer. + */ +void xenbusb_otherend_changed(device_t bus, device_t child, + enum xenbus_state state); + +/** + * \brief Common XenBus method implementing responses to local XenStore changes. + * + * \param bus The XenBus bus parent of child. + * \param child The XenBus child whose peer stat has changed. + * \param path The tree relative sub-path to the modified node. The empty + * string indicates the root of the tree was destroyed. + */ +void xenbusb_localend_changed(device_t bus, device_t child, const char *path); + +/** * \brief Attempt to add a XenBus device instance to this XenBus bus. * * \param dev The NewBus device representing this XenBus bus. @@ -269,4 +293,6 @@ int xenbusb_write_ivar(device_t dev, dev */ int xenbusb_add_device(device_t dev, const char *type, const char *id); +#include "xenbusb_if.h" + #endif /* _XEN_XENBUS_XENBUSB_H */ Modified: head/sys/xen/xenbus/xenbusb_back.c ============================================================================== --- head/sys/xen/xenbus/xenbusb_back.c Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/xen/xenbus/xenbusb_back.c Sat Jun 11 04:59:01 2011 (r222975) @@ -208,57 +208,79 @@ xenbusb_back_get_otherend_node(device_t if (error == 0) { ivars->xd_otherend_path = strdup(otherend_path, M_XENBUS); + ivars->xd_otherend_path_len = strlen(otherend_path); free(otherend_path, M_XENSTORE); } return (error); } /** - * \brief Backend XenBus child instance variable write access method. - * - * \param dev The NewBus device representing this XenBus bus. - * \param child The NewBus device representing a child of dev%'s XenBus bus. - * \param index The index of the instance variable to access. - * \param value The new value to set in the instance variable accessed. - * - * \return On success, 0. Otherwise an errno value indicating the - * type of failure. - * - * Xenbus_back overrides this method so that it can trap state transitions - * of local backend devices and clean up their XenStore entries as necessary - * during device instance teardown. + * \brief Backend XenBus method implementing responses to peer state changes. + * + * \param bus The XenBus bus parent of child. + * \param child The XenBus child whose peer stat has changed. + * \param state The current state of the peer. */ -static int -xenbusb_back_write_ivar(device_t dev, device_t child, int index, - uintptr_t value) +static void +xenbusb_back_otherend_changed(device_t bus, device_t child, + enum xenbus_state peer_state) { - int error; + /* Perform default processing of state. */ + xenbusb_otherend_changed(bus, child, peer_state); - error = xenbusb_write_ivar(dev, child, index, value); + /* + * "Online" devices are never fully detached in the + * newbus sense. Only the front<->back connection is + * torn down. If the front returns to the initialising + * state after closing a previous connection, signal + * our willingness to reconnect and that all necessary + * XenStore data for feature negotiation is present. + */ + if (peer_state == XenbusStateInitialising + && xenbus_dev_is_online(child) != 0 + && xenbus_get_state(child) == XenbusStateClosed) + xenbus_set_state(child, XenbusStateInitWait); +} - if (index == XENBUS_IVAR_STATE - && (enum xenbus_state)value == XenbusStateClosed - && xenbus_dev_is_online(child) == 0) { - - /* - * Cleanup the hotplug entry in the XenStore if - * present. The control domain expects any userland - * component associated with this device to destroy - * this node in order to signify it is safe to - * teardown the device. However, not all backends - * rely on userland components, and those that - * do should either use a communication channel - * other than the XenStore, or ensure the hotplug - * data is already cleaned up. - * - * This removal ensures that no matter what path - * is taken to mark a back-end closed, the control - * domain will understand that it is closed. - */ - xs_rm(XST_NIL, xenbus_get_node(child), "hotplug-status"); - } +/** + * \brief Backend XenBus method implementing responses to local + * XenStore changes. + * + * \param bus The XenBus bus parent of child. + * \param child The XenBus child whose peer stat has changed. + * \param_path The tree relative sub-path to the modified node. The empty + * string indicates the root of the tree was destroyed. + */ +static void +xenbusb_back_localend_changed(device_t bus, device_t child, const char *path) +{ - return (error); + xenbusb_localend_changed(bus, child, path); + + if (strcmp(path, "/state") != 0 + && strcmp(path, "/online") != 0) + return; + + if (xenbus_get_state(child) != XenbusStateClosed + || xenbus_dev_is_online(child) != 0) + return; + + /* + * Cleanup the hotplug entry in the XenStore if + * present. The control domain expects any userland + * component associated with this device to destroy + * this node in order to signify it is safe to + * teardown the device. However, not all backends + * rely on userland components, and those that + * do should either use a communication channel + * other than the XenStore, or ensure the hotplug + * data is already cleaned up. + * + * This removal ensures that no matter what path + * is taken to mark a back-end closed, the control + * domain will understand that it is closed. + */ + xs_rm(XST_NIL, xenbus_get_node(child), "hotplug-status"); } /*-------------------- Private Device Attachment Data -----------------------*/ @@ -275,7 +297,7 @@ static device_method_t xenbusb_back_meth /* Bus Interface */ DEVMETHOD(bus_print_child, xenbusb_print_child), DEVMETHOD(bus_read_ivar, xenbusb_read_ivar), - DEVMETHOD(bus_write_ivar, xenbusb_back_write_ivar), + DEVMETHOD(bus_write_ivar, xenbusb_write_ivar), DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), @@ -284,6 +306,8 @@ static device_method_t xenbusb_back_meth /* XenBus Bus Interface */ DEVMETHOD(xenbusb_enumerate_type, xenbusb_back_enumerate_type), DEVMETHOD(xenbusb_get_otherend_node, xenbusb_back_get_otherend_node), + DEVMETHOD(xenbusb_otherend_changed, xenbusb_back_otherend_changed), + DEVMETHOD(xenbusb_localend_changed, xenbusb_back_localend_changed), { 0, 0 } }; Modified: head/sys/xen/xenbus/xenbusb_front.c ============================================================================== --- head/sys/xen/xenbus/xenbusb_front.c Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/xen/xenbus/xenbusb_front.c Sat Jun 11 04:59:01 2011 (r222975) @@ -156,6 +156,7 @@ xenbusb_front_get_otherend_node(device_t if (error == 0) { ivars->xd_otherend_path = strdup(otherend_path, M_XENBUS); + ivars->xd_otherend_path_len = strlen(otherend_path); free(otherend_path, M_XENSTORE); } return (error); Modified: head/sys/xen/xenbus/xenbusb_if.m ============================================================================== --- head/sys/xen/xenbus/xenbusb_if.m Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/xen/xenbus/xenbusb_if.m Sat Jun 11 04:59:01 2011 (r222975) @@ -31,10 +31,12 @@ # #include +#include +#include +#include -HEADER { -struct xenbus_device_ivars; -} +#include +#include INTERFACE xenbusb; @@ -76,3 +78,34 @@ METHOD int get_otherend_node { device_t _dev; struct xenbus_device_ivars *_ivars; } + +/** + * \brief Handle a XenStore change detected in the peer tree of a child + * device of the bus. + * + * \param _bus NewBus device_t for this XenBus (front/back) bus instance. + * \param _child NewBus device_t for the child device whose peer XenStore + * tree has changed. + * \param _state The current state of the peer. + */ +METHOD void otherend_changed { + device_t _bus; + device_t _child; + enum xenbus_state _state; +} DEFAULT xenbusb_otherend_changed; + +/** + * \brief Handle a XenStore change detected in the local tree of a child + * device of the bus. + * + * \param _bus NewBus device_t for this XenBus (front/back) bus instance. + * \param _child NewBus device_t for the child device whose peer XenStore + * tree has changed. + * \param _path The tree relative sub-path to the modified node. The empty + * string indicates the root of the tree was destroyed. + */ +METHOD void localend_changed { + device_t _bus; + device_t _child; + const char * _path; +} DEFAULT xenbusb_localend_changed; Modified: head/sys/xen/xenbus/xenbusvar.h ============================================================================== --- head/sys/xen/xenbus/xenbusvar.h Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/xen/xenbus/xenbusvar.h Sat Jun 11 04:59:01 2011 (r222975) @@ -51,8 +51,6 @@ #include -#include "xenbus_if.h" - /* XenBus allocations including XenStore data returned to clients. */ MALLOC_DECLARE(M_XENBUS); @@ -116,6 +114,8 @@ XenbusState xenbus_read_driver_state(con * must be stable for the lifetime of the watch. * \param callback The function to call when XenStore objects at or below * path are modified. + * \param cb_data Client data that can be retrieved from the watch object + * during the callback. * * \return On success, 0. Otherwise an errno value indicating the * type of failure. @@ -126,7 +126,8 @@ XenbusState xenbus_read_driver_state(con */ int xenbus_watch_path(device_t dev, char *path, struct xs_watch *watch, - xs_watch_cb_t *callback); + xs_watch_cb_t *callback, + uintptr_t cb_data); /** * Initialize and register a watch at path/path2 in the XenStore. @@ -138,6 +139,8 @@ int xenbus_watch_path(device_t dev, char * must be stable for the lifetime of the watch. * \param callback The function to call when XenStore objects at or below * path are modified. + * \param cb_data Client data that can be retrieved from the watch object + * during the callback. * * \return On success, 0. Otherwise an errno value indicating the * type of failure. @@ -153,7 +156,8 @@ int xenbus_watch_path(device_t dev, char */ int xenbus_watch_path2(device_t dev, const char *path, const char *path2, struct xs_watch *watch, - xs_watch_cb_t *callback); + xs_watch_cb_t *callback, + uintptr_t cb_data); /** * Grant access to the given ring_mfn to the peer of the given device. @@ -275,4 +279,16 @@ const char *xenbus_strstate(enum xenbus_ */ int xenbus_dev_is_online(device_t dev); +/** + * Default callback invoked when a change to the local XenStore sub-tree + * for a device is modified. + * + * \param dev The XenBus device whose tree was modified. + * \param path The tree relative sub-path to the modified node. The empty + * string indicates the root of the tree was destroyed. + */ +void xenbus_localend_changed(device_t dev, const char *path); + +#include "xenbus_if.h" + #endif /* _XEN_XENBUS_XENBUSVAR_H */ Modified: head/sys/xen/xenstore/xenstorevar.h ============================================================================== --- head/sys/xen/xenstore/xenstorevar.h Sat Jun 11 04:55:15 2011 (r222974) +++ head/sys/xen/xenstore/xenstorevar.h Sat Jun 11 04:59:01 2011 (r222975) @@ -56,8 +56,8 @@ struct xenstore_domain_interface; struct xs_watch; extern struct xenstore_domain_interface *xen_store; -typedef void (xs_watch_cb_t)(struct xs_watch *, - const char **vec, unsigned int len); +typedef void (xs_watch_cb_t)(struct xs_watch *, const char **vec, + unsigned int len); /* Register callback to watch subtree (node) in the XenStore. */ struct xs_watch @@ -69,6 +69,9 @@ struct xs_watch /* Callback (executed in a process context with no locks held). */ xs_watch_cb_t *callback; + + /* Callback client data untouched by the XenStore watch mechanism. */ + uintptr_t callback_data; }; LIST_HEAD(xs_watch_list, xs_watch); @@ -301,7 +304,7 @@ int xs_gather(struct xs_transaction t, c * XenStore watches allow a client to be notified via a callback (embedded * within the watch object) of changes to an object in the XenStore. * - * \param watch A xenbus_watch struct with it's node and callback fields + * \param watch An xs_watch struct with it's node and callback fields * properly initialized. * * \return On success, 0. Otherwise an errno value indicating the From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 09:08: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 660DB106564A; Sat, 11 Jun 2011 09:08:47 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D5CD8FC17; Sat, 11 Jun 2011 09:08: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 p5B98kRB066712; Sat, 11 Jun 2011 09:08:46 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5B98kkE066709; Sat, 11 Jun 2011 09:08:46 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201106110908.p5B98kkE066709@svn.freebsd.org> From: Joel Dahl Date: Sat, 11 Jun 2011 09:08: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: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 09:08:47 -0000 Author: joel (doc committer) Date: Sat Jun 11 09:08:46 2011 New Revision: 222980 URL: http://svn.freebsd.org/changeset/base/222980 Log: Enable sound support by default on i386 and amd64. The generic sound driver has been added, along with enough device-specific drivers to support the most common audio chipsets. We've discussed enabling it from time to time over the years and we've received numerous requests from users, so we decided that shipping 9.0 with working audio by default would be the best thing to do. Bug reports should be sent to the multimedia@ mailing list, as usual. Approved by: mav No objection: re Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Sat Jun 11 08:03:44 2011 (r222979) +++ head/sys/amd64/conf/GENERIC Sat Jun 11 09:08:46 2011 (r222980) @@ -337,3 +337,11 @@ device fwe # Ethernet over FireWire (n device fwip # IP over FireWire (RFC 2734,3146) device dcons # Dumb console driver device dcons_crom # Configuration ROM for dcons + +# Sound support +device sound # Generic sound driver (required) +device snd_es137x # Ensoniq AudioPCI ES137x +device snd_hda # Intel High Definition Audio +device snd_ich # Intel, NVidia and other ICH AC'97 Audio +device snd_uaudio # USB Audio +device snd_via8233 # VIA VT8233x Audio Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Sat Jun 11 08:03:44 2011 (r222979) +++ head/sys/i386/conf/GENERIC Sat Jun 11 09:08:46 2011 (r222980) @@ -350,3 +350,11 @@ device fwe # Ethernet over FireWire (n device fwip # IP over FireWire (RFC 2734,3146) device dcons # Dumb console driver device dcons_crom # Configuration ROM for dcons + +# Sound support +device sound # Generic sound driver (required) +device snd_es137x # Ensoniq AudioPCI ES137x +device snd_hda # Intel High Definition Audio +device snd_ich # Intel, NVidia and other ICH AC'97 Audio +device snd_uaudio # USB Audio +device snd_via8233 # VIA VT8233x Audio From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 10:22: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 5B9C9106564A; Sat, 11 Jun 2011 10:22:11 +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 C69488FC0C; Sat, 11 Jun 2011 10:22:10 +0000 (UTC) Received: by vws18 with SMTP id 18so3936593vws.13 for ; Sat, 11 Jun 2011 03:22:10 -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=+WTON8kZmOzqDm+sYAWlo/Uz8CtmxHlxkMhR3jsa9PQ=; b=pQCa1nsSRVQt3PD7fprmBFt99u5LQnAwsteCJgi0y4QfZucHOB4CdPdty/sdKzp0RJ AKZ07W5zdm5RSBLXiJcns/OXUMraKTpA+vrQYCayA5w3xztXKQ16zaoEch620VaOcLGc H156Qo2rjt6WDkIhE+r8P5lN3dY6vbSyqLl0s= 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=MjcY4hT1YM+9ty1xaVjl9ebfyPEKKBMFsfHxGY9IRv7l5Eq+0F0zsICcJgjcnaTKON Jt9XYixt2pVMrMk4fe4hU2mXVTLFk4gtVM9XAF9rjP+jPSaw/0u9DChhzTCfdAj5GXhZ Tm7oiV1KwKPzMT4JV0uQ+QktInH7uZtmtyyzk= MIME-Version: 1.0 Received: by 10.220.213.195 with SMTP id gx3mr1214334vcb.23.1307787729720; Sat, 11 Jun 2011 03:22:09 -0700 (PDT) Received: by 10.220.189.202 with HTTP; Sat, 11 Jun 2011 03:22:09 -0700 (PDT) In-Reply-To: <201105310025.p4V0PqTB099414@svn.freebsd.org> References: <201105310025.p4V0PqTB099414@svn.freebsd.org> Date: Sat, 11 Jun 2011 03:22:09 -0700 Message-ID: From: Garrett Cooper To: "Bjoern A. Zeeb" 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: 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: Sat, 11 Jun 2011 10:22:11 -0000 On Mon, May 30, 2011 at 5:25 PM, Bjoern A. Zeeb wrote: > Author: bz > Date: Tue May 31 00:25:52 2011 > New Revision: 222515 > URL: http://svn.freebsd.org/changeset/base/222515 > > Log: > =A0No logner set an IPv4 loopback address by default in defaults/rc.conf. > =A0If not specified, network.subr will add it automatically if we have > =A0INET support (1). > > =A0In network.subr only call the address family up/down functions > =A0if the respective AF is available. > > =A0Switch to new kern.features variables for inet and inet6 as the > =A0inet sysctl tree is also available for IPv6-only kernels leading > =A0to unexpected results. Please document this change in UPDATING (requiring ifconfig_lo0 in rc.conf). It breaks standard IPv4 only configurations out of the box. Thanks, -Garrett From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 10:23: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 B7C921065674; Sat, 11 Jun 2011 10:23:18 +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 331078FC1C; Sat, 11 Jun 2011 10:23:18 +0000 (UTC) Received: by vws18 with SMTP id 18so3936998vws.13 for ; Sat, 11 Jun 2011 03:23:17 -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=tzTQJExwZ/0P7rRr4paQvUJHS/wbcc/Ga4iLyAYEFOA=; b=mzrfHuZTAvopkwCxGkgyx1Bb8e+bY0kx05VbgGlLaVevtUeQ9zH2bmvmjKhhzp4cgQ jdpGLpzN+GexbGvdMF9GhqIwZbqr0lIU7utHZbEZW7iN82OFSthbfcOonjftTeLKW6jZ EJ3+JUMlEpCE9bPHNTT0FZhntegUpNaAGwpmg= 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=cWJJ4406ZFwmPWXGYH63/ms4K2vsih9qtrxRBt6qjjj6/dcxiH9Ztf1tUPwCUjvWRU h/Iwh49iFBlEEgSJ7ZTWwi/SzlAgV1wAaOZUuyrelTjELypq78xDZifKg9WY97mACeEE k51kND1xwLnl6JLQ07aYB5uWIHf41rAOQXVzs= MIME-Version: 1.0 Received: by 10.220.210.69 with SMTP id gj5mr417963vcb.58.1307787797397; Sat, 11 Jun 2011 03:23:17 -0700 (PDT) Received: by 10.220.189.202 with HTTP; Sat, 11 Jun 2011 03:23:17 -0700 (PDT) In-Reply-To: References: <201105310025.p4V0PqTB099414@svn.freebsd.org> Date: Sat, 11 Jun 2011 03:23:17 -0700 Message-ID: From: Garrett Cooper To: "Bjoern A. Zeeb" 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: 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: Sat, 11 Jun 2011 10:23:18 -0000 On Sat, Jun 11, 2011 at 3:22 AM, Garrett Cooper wrote: > On Mon, May 30, 2011 at 5:25 PM, Bjoern A. Zeeb wrote: >> Author: bz >> Date: Tue May 31 00:25:52 2011 >> New Revision: 222515 >> URL: http://svn.freebsd.org/changeset/base/222515 >> >> Log: >> =A0No logner set an IPv4 loopback address by default in defaults/rc.conf= . >> =A0If not specified, network.subr will add it automatically if we have >> =A0INET support (1). >> >> =A0In network.subr only call the address family up/down functions >> =A0if the respective AF is available. >> >> =A0Switch to new kern.features variables for inet and inet6 as the >> =A0inet sysctl tree is also available for IPv6-only kernels leading >> =A0to unexpected results. > > =A0 =A0Please document this change in UPDATING (requiring ifconfig_lo0 in > rc.conf). It breaks standard IPv4 only configurations out of the box. Oh that's right... feature_present("inet") doesn't work for me for some bloody reason -_-... Arg. -Garrett From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 10:37: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 03B48106564A; Sat, 11 Jun 2011 10:37:12 +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 874488FC0A; Sat, 11 Jun 2011 10:37:11 +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 903B225D3810; Sat, 11 Jun 2011 10:37:10 +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 CB77815A1679; Sat, 11 Jun 2011 10:37:09 +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 NRCuC1T-2+tp; Sat, 11 Jun 2011 10:37:08 +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 3765115A1673; Sat, 11 Jun 2011 10:37:08 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: Date: Sat, 11 Jun 2011 10:37:06 +0000 Content-Transfer-Encoding: 7bit Message-Id: References: <201105310025.p4V0PqTB099414@svn.freebsd.org> To: Garrett Cooper 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: 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: Sat, 11 Jun 2011 10:37:12 -0000 On Jun 11, 2011, at 10:23 AM, Garrett Cooper wrote: > On Sat, Jun 11, 2011 at 3:22 AM, Garrett Cooper wrote: >> On Mon, May 30, 2011 at 5:25 PM, Bjoern A. Zeeb wrote: >>> 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. >> >> Please document this change in UPDATING (requiring ifconfig_lo0 in >> rc.conf). It breaks standard IPv4 only configurations out of the box. > > Oh that's right... feature_present("inet") doesn't work for me for > some bloody reason -_-... > Arg. Yes, I think by now you should go and figure out how you managed to foobar your system before further breaking it. Maybe just get a clean source tree and do the full buildworld, buildkernel, installkernel reboot, installworld, mergemaster cycle and see. It by now sounds to me very much like an individual problem to me. If there is anything to further help you, let me know. Regards, Bjoern -- 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 11 12:34: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 32C4B106566C; Sat, 11 Jun 2011 12:34:09 +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 06E7A8FC08; Sat, 11 Jun 2011 12:34: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 p5BCY8od075198; Sat, 11 Jun 2011 12:34:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5BCY8sd075195; Sat, 11 Jun 2011 12:34:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106111234.p5BCY8sd075195@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 11 Jun 2011 12:34:08 +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: r222982 - head/sys/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, 11 Jun 2011 12:34:09 -0000 Author: nwhitehorn Date: Sat Jun 11 12:34:08 2011 New Revision: 222982 URL: http://svn.freebsd.org/changeset/base/222982 Log: Follow up r222980 on PowerPC: add sound(4) and common device drivers to PowerPC GENERIC (along with a small rearrangement). Modified: head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Sat Jun 11 10:35:53 2011 (r222981) +++ head/sys/powerpc/conf/GENERIC Sat Jun 11 12:34:08 2011 (r222982) @@ -174,7 +174,9 @@ device sbp # SCSI over FireWire (Requi device fwe # Ethernet over FireWire (non-standard!) # Misc -device ad7417 # PowerMac7,2 temperature sensor +device iicbus # I2C bus code +device kiic # Keywest I2C +device ad7417 # PowerMac7,2 temperature sensor device ds1775 # PowerMac7,2 temperature sensor device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor @@ -187,7 +189,9 @@ device adb device cuda device pmu -# Powermac I2C support -device iicbus # I2C bus code -device kiic # Keywest I2C +# Sound support +device sound # Generic sound driver (required) +device snd_ai2s # Apple I2S audio +device snd_davbus # Apple DAVBUS audio +device snd_uaudio # USB Audio Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Sat Jun 11 10:35:53 2011 (r222981) +++ head/sys/powerpc/conf/GENERIC64 Sat Jun 11 12:34:08 2011 (r222982) @@ -175,7 +175,9 @@ device sbp # SCSI over FireWire (Requi device fwe # Ethernet over FireWire (non-standard!) # Misc -device ad7417 # PowerMac7,2 temperature sensor +device iicbus # I2C bus code +device kiic # Keywest I2C +device ad7417 # PowerMac7,2 temperature sensor device ds1775 # PowerMac7,2 temperature sensor device fcu # Apple Fan Control Unit device max6690 # PowerMac7,2 temperature sensor @@ -186,7 +188,8 @@ device smu # Apple System Management U device adb device pmu -# Powermac I2C support -device iicbus # I2C bus code -device kiic # Keywest I2C +# Sound support +device sound # Generic sound driver (required) +device snd_ai2s # Apple I2S audio +device snd_uaudio # USB Audio From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 13:07: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 798621065674; Sat, 11 Jun 2011 13:07:18 +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 569968FC13; Sat, 11 Jun 2011 13:07:18 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id EA18146B39; Sat, 11 Jun 2011 09:07:17 -0400 (EDT) Date: Sat, 11 Jun 2011 14:07:17 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Joel Dahl In-Reply-To: <201106110908.p5B98kkE066709@svn.freebsd.org> Message-ID: References: <201106110908.p5B98kkE066709@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: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 13:07:18 -0000 On Sat, 11 Jun 2011, Joel Dahl wrote: > Log: > Enable sound support by default on i386 and amd64. > > The generic sound driver has been added, along with enough > device-specific drivers to support the most common audio > chipsets. > > We've discussed enabling it from time to time over the years > and we've received numerous requests from users, so we decided > that shipping 9.0 with working audio by default would be the > best thing to do. > > Bug reports should be sent to the multimedia@ mailing list, as > usual. To me, this seems like the wrong direction. Over the last decade, we've been trying to move away from conditional compilation of features to having them be loadable as modules. The arrival of freebsd-update has only increased the pressure to take this approach: we want to avoid the need to customise kernel configurations as much as possible, so that users get binary updates in the common case. As sound already fully supported being loaded as a module, and isn't needed to boot the system, it seems unfortunate that we'd move from loading it as a module to compiling it in. It seems like what we almost want is a default set of modules for loader.conf, which are automatically loaded (but not compiled in). What we need to supplement that is a way to detect that modules *should* be loaded based on PCI IDs or similar, which could then trigger loading of the sound drivers, and other similar supplementary modules. While it seems like memory is "free" these days, that's not really the case. The base kernel footprint is quite observable in VM configurations, where it's common to configure quite low memory footprints -- 256M, 512M, etc, in order to improve VM density. It would be great if devd could subsume unmatched PCI ID attachment and reference a database of device drivers to figure out what to load. Robert From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 13:22: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 05B1D106566C; Sat, 11 Jun 2011 13:22:47 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8B2208FC13; Sat, 11 Jun 2011 13:22:46 +0000 (UTC) Received: by yxm34 with SMTP id 34so467176yxm.13 for ; Sat, 11 Jun 2011 06:22:45 -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=zbMV6T9NHEEX9xAKEXwNTsdzx6J38pTZ2mLcveYT6nc=; b=OI0W11EcF8JXFsFU1unfq4b3+/WOl+/Nw5DrxG8FMN2ZJM55jX3Ntew0q9qJeijaB1 HxcXmTv/r5za7kTU7xyYk0HyFkmGy7zs9m9kO6tWv3rxAiPfIUlUJhuyM31IUypW4zFH 2upqnEiW5RlzffqXsA0uhbLB7SveANWECCOGQ= 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=uxpdQ2o3nNotblq441FF82mQofBMMBPE7sgs2mggieHmzKoTlOvB55skuKqd5WOqn4 2xmUxUOe4RQDLISa1ayyEJrpcI1SYppVjjrRqIbG0X3+n0MLCj4JB5k4g/h067F49DUo KY4V8/a08pvqTRFWEdrogfGas9aZ85AueA2ww= MIME-Version: 1.0 Received: by 10.150.13.15 with SMTP id 15mr4298417ybm.103.1307798565599; Sat, 11 Jun 2011 06:22:45 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.150.216.3 with HTTP; Sat, 11 Jun 2011 06:22:45 -0700 (PDT) In-Reply-To: References: <201106110908.p5B98kkE066709@svn.freebsd.org> Date: Sat, 11 Jun 2011 21:22:45 +0800 X-Google-Sender-Auth: G3ZhDfC5VH0AmEQA7_SXeW6T6sE Message-ID: From: Adrian Chadd To: Robert Watson 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, Joel Dahl Subject: Re: svn commit: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 13:22:47 -0000 btw, I just posted something similar to this on -arch. adrian On 11 June 2011 21:07, Robert Watson wrote: > To me, this seems like the wrong direction. =A0Over the last decade, we'v= e > been trying to move away from conditional compilation of features to havi= ng > them be loadable as modules. =A0The arrival of freebsd-update has only > increased the pressure to take this approach: we want to avoid the need t= o > customise kernel configurations as much as possible, so that users get > binary updates in the common case. =A0As sound already fully supported be= ing > loaded as a module, and isn't needed to boot the system, it seems > unfortunate that we'd move from loading it as a module to compiling it in= . > > It seems like what we almost want is a default set of modules for > loader.conf, which are automatically loaded (but not compiled in). =A0Wha= t we > need to supplement that is a way to detect that modules *should* be loade= d > based on PCI IDs or similar, which could then trigger loading of the soun= d > drivers, and other similar supplementary modules. > > While it seems like memory is "free" these days, that's not really the ca= se. > The base kernel footprint is quite observable in VM configurations, where > it's common to configure quite low memory footprints -- 256M, 512M, etc, = in > order to improve VM density. > > It would be great if devd could subsume unmatched PCI ID attachment and > reference a database of device drivers to figure out what to load. From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 13:39: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 4A89A106566C; Sat, 11 Jun 2011 13:39:15 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 0F0F18FC1F; Sat, 11 Jun 2011 13:39:14 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id BDFAE7300A; Sat, 11 Jun 2011 15:45:15 +0200 (CEST) Date: Sat, 11 Jun 2011 15:45:15 +0200 From: Luigi Rizzo To: Robert Watson Message-ID: <20110611134515.GA65992@onelab2.iet.unipi.it> References: <201106110908.p5B98kkE066709@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.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Joel Dahl Subject: Re: svn commit: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 13:39:15 -0000 On Sat, Jun 11, 2011 at 02:07:17PM +0100, Robert Watson wrote: > > On Sat, 11 Jun 2011, Joel Dahl wrote: > > >Log: > > Enable sound support by default on i386 and amd64. ... > To me, this seems like the wrong direction. Over the last decade, we've > been trying to move away from conditional compilation of features to having > them be loadable as modules. The arrival of freebsd-update has only i agree, we should move towards modules and not just to reduce the kernel footprint but because it is a lot easier to update individual drivers than to update the whole kernel. In my experience, whenever i buy new motherboards it is often the case that network cards, audio cards and several usb things are not recognised just because a change in the device id. Having the driver embedded in the kernel is very annoying in these cases. cheers luigi From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 13:47: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 9B472106564A; Sat, 11 Jun 2011 13:47:49 +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 730C28FC08; Sat, 11 Jun 2011 13:47:49 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 249AD46B29; Sat, 11 Jun 2011 09:47:49 -0400 (EDT) Date: Sat, 11 Jun 2011 14:47:49 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Adrian Chadd In-Reply-To: Message-ID: References: <201106110908.p5B98kkE066709@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="621616949-730146219-1307800069=:44950" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Joel Dahl Subject: Re: svn commit: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 13:47:49 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --621616949-730146219-1307800069=:44950 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8BIT On Sat, 11 Jun 2011, Adrian Chadd wrote: > btw, I just posted something similar to this on -arch. FWIW, it doesn't have to be pretty, it really just has to work. It would be nice if the same data could be used by both the boot loader and devd to load driver modules, and if the data were structured so that it could be easily extended. I.e., /etc/driverdb with individual .xml or .whatever files, one per device driver, laying claim to things. That way if there's going to be duking out for ownership of the device during early device, it's all worked out then. Anyhow, I don't have really strong opinions on how it's done, except that it needs to be. And ideally soon :-). Robert > > > adrian > > On 11 June 2011 21:07, Robert Watson wrote: > >> To me, this seems like the wrong direction.  Over the last decade, we've >> been trying to move away from conditional compilation of features to having >> them be loadable as modules.  The arrival of freebsd-update has only >> increased the pressure to take this approach: we want to avoid the need to >> customise kernel configurations as much as possible, so that users get >> binary updates in the common case.  As sound already fully supported being >> loaded as a module, and isn't needed to boot the system, it seems >> unfortunate that we'd move from loading it as a module to compiling it in. >> >> It seems like what we almost want is a default set of modules for >> loader.conf, which are automatically loaded (but not compiled in).  What we >> need to supplement that is a way to detect that modules *should* be loaded >> based on PCI IDs or similar, which could then trigger loading of the sound >> drivers, and other similar supplementary modules. >> >> While it seems like memory is "free" these days, that's not really the case. >> The base kernel footprint is quite observable in VM configurations, where >> it's common to configure quite low memory footprints -- 256M, 512M, etc, in >> order to improve VM density. >> >> It would be great if devd could subsume unmatched PCI ID attachment and >> reference a database of device drivers to figure out what to load. > --621616949-730146219-1307800069=:44950-- From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 14:07:01 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 993D81065673; Sat, 11 Jun 2011 14:07:01 +0000 (UTC) Date: Sat, 11 Jun 2011 14:07:01 +0000 From: Alexey Dokuchaev To: Luigi Rizzo Message-ID: <20110611140701.GA98162@FreeBSD.org> References: <201106110908.p5B98kkE066709@svn.freebsd.org> <20110611134515.GA65992@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20110611134515.GA65992@onelab2.iet.unipi.it> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson , Joel Dahl Subject: Re: svn commit: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 14:07:01 -0000 On Sat, Jun 11, 2011 at 03:45:15PM +0200, Luigi Rizzo wrote: > In my experience, whenever i buy new motherboards it is often the > case that network cards, audio cards and several usb things > are not recognised just because a change in the device id. > Having the driver embedded in the kernel is very annoying in these cases. Not to mention that it's sometimes required to unload/reload some module so it can reinitialize its hardware when something breaks. I've always been recompiling minimal kernel with everything possible (down to io and mem devices) factored out into modules. Works perfectly. ./danfe From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 16:47: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 4C8AE106567B; Sat, 11 Jun 2011 16:47:24 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 055F68FC27; Sat, 11 Jun 2011 16:47:23 +0000 (UTC) Received: from [10.0.0.63] (63.imp.bsdimp.com [10.0.0.63]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p5BGiJ2X055470 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Sat, 11 Jun 2011 10:44:22 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Sat, 11 Jun 2011 10:44:14 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <75DAEF7E-F43E-427E-8AFA-586E0B56D450@bsdimp.com> References: <201106110908.p5B98kkE066709@svn.freebsd.org> To: Robert Watson X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Sat, 11 Jun 2011 10:44:22 -0600 (MDT) Cc: svn-src-head@freebsd.org, Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, Joel Dahl Subject: Re: svn commit: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 16:47:24 -0000 On Jun 11, 2011, at 7:47 AM, Robert Watson wrote: >=20 > On Sat, 11 Jun 2011, Adrian Chadd wrote: >=20 >> btw, I just posted something similar to this on -arch. >=20 > FWIW, it doesn't have to be pretty, it really just has to work. It = would be nice if the same data could be used by both the boot loader and = devd to load driver modules, and if the data were structured so that it = could be easily extended. I.e., /etc/driverdb with individual .xml or = .whatever files, one per device driver, laying claim to things. That = way if there's going to be duking out for ownership of the device during = early device, it's all worked out then. Yea, that's not going to happen for 9. Sorry. I've been trying to get = people interested in the problem of putting the device data in drivers = in a standard for for years and there's been nobody that wants to do it. = Having /etc/driverdb is going to be obsolete very quickly and be a = nightmare to maintain. I think our best bet for 9 is to strip GENERIC to the bone and have a = 'generic.conf' if you will that loads everything we compile in today. For 10 we can move to having all the driver data exported in sections in = the .ko files so that devd can load them. We don't need to have them loaded by loader.conf. All you need for that = are the boot devices. I've run my laptops for years like this. Warner= From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 18:17:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id B808C1065670; Sat, 11 Jun 2011 18:17:17 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from [127.0.0.1] (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 20B1514F415; Sat, 11 Jun 2011 18:17:17 +0000 (UTC) Message-ID: <4DF3B12C.8020505@FreeBSD.org> Date: Sat, 11 Jun 2011 11:17:16 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Robert Watson References: <201106110908.p5B98kkE066709@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Joel Dahl Subject: Re: svn commit: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 18:17:17 -0000 On 6/11/2011 6:07 AM, Robert Watson wrote: > To me, this seems like the wrong direction. Over the last decade, we've > been trying to move away from conditional compilation of features to > having them be loadable as modules. FWIW, I agree. I'm wondering though, is there still a performance penalty for modules? My understanding in the past was that there is, although for most use cases it's in the statistical noise. Is that still true? Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 18:52: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 D16D7106564A; Sat, 11 Jun 2011 18:52:16 +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 695DB8FC14; Sat, 11 Jun 2011 18:52:15 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 8C0D245F1F; Sat, 11 Jun 2011 20:52:13 +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 0FE3C45F34; Sat, 11 Jun 2011 20:52:07 +0200 (CEST) Date: Sat, 11 Jun 2011 20:51:32 +0200 From: Pawel Jakub Dawidek To: Warner Losh Message-ID: <20110611184549.GB3284@garage.freebsd.pl> References: <201106110908.p5B98kkE066709@svn.freebsd.org> <75DAEF7E-F43E-427E-8AFA-586E0B56D450@bsdimp.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UPT3ojh+0CqEDtpF" Content-Disposition: inline In-Reply-To: <75DAEF7E-F43E-427E-8AFA-586E0B56D450@bsdimp.com> 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: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, Robert Watson , Joel Dahl , svn-src-head@freebsd.org Subject: Re: svn commit: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 18:52:16 -0000 --UPT3ojh+0CqEDtpF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 11, 2011 at 10:44:14AM -0600, Warner Losh wrote: >=20 > On Jun 11, 2011, at 7:47 AM, Robert Watson wrote: >=20 > >=20 > > On Sat, 11 Jun 2011, Adrian Chadd wrote: > >=20 > >> btw, I just posted something similar to this on -arch. > >=20 > > FWIW, it doesn't have to be pretty, it really just has to work. It wou= ld be nice if the same data could be used by both the boot loader and devd = to load driver modules, and if the data were structured so that it could be= easily extended. I.e., /etc/driverdb with individual .xml or .whatever fi= les, one per device driver, laying claim to things. That way if there's go= ing to be duking out for ownership of the device during early device, it's = all worked out then. >=20 > Yea, that's not going to happen for 9. Sorry. I've been trying to get p= eople interested in the problem of putting the device data in drivers in a = standard for for years and there's been nobody that wants to do it. Having= /etc/driverdb is going to be obsolete very quickly and be a nightmare to m= aintain. >=20 > I think our best bet for 9 is to strip GENERIC to the bone and have a 'ge= neric.conf' if you will that loads everything we compile in today. I think trasz@ tried that and there is a problem. Loading modules on boot is very slow. If you try to load everything that GENERIC has as modules the boot will take forever. This is very unfortunate, as such MINIMAL kernel would be great for binary updates. On all my servers and my laptop I use such minimalistic kernels and load everything from modules. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --UPT3ojh+0CqEDtpF Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk3zuTMACgkQForvXbEpPzTxiACdFQPbJa97llJGSOj+qvaoptTz JKIAn2l2z09tcD1M/+1IzID9m034SYry =uihC -----END PGP SIGNATURE----- --UPT3ojh+0CqEDtpF-- From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 19:58: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 C738F1065676; Sat, 11 Jun 2011 19:58: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 A1D128FC16; Sat, 11 Jun 2011 19:58:57 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id EEE8546B35; Sat, 11 Jun 2011 15:58:56 -0400 (EDT) Date: Sat, 11 Jun 2011 20:58:56 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Doug Barton In-Reply-To: <4DF3B12C.8020505@FreeBSD.org> Message-ID: References: <201106110908.p5B98kkE066709@svn.freebsd.org> <4DF3B12C.8020505@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, Joel Dahl Subject: Re: svn commit: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 19:58:57 -0000 On Sat, 11 Jun 2011, Doug Barton wrote: > On 6/11/2011 6:07 AM, Robert Watson wrote: >> To me, this seems like the wrong direction. Over the last decade, we've >> been trying to move away from conditional compilation of features to having >> them be loadable as modules. > > FWIW, I agree. I'm wondering though, is there still a performance penalty > for modules? My understanding in the past was that there is, although for > most use cases it's in the statistical noise. Is that still true? I think there's two aspects to the question: (1) What effect does using modules have on boot time? (2) What effect does using modules have in the run-time performance of features they implement (or features they interact with in the base kernel or other modules)? I don't know too much about the former, but when it comes to the latter, it's really down to the subsystem in question. Making things more dynamic implies more need for synchronisation. In some places, the synchronisation is probably about right -- in other places, it might be too heavy (poor performance), or too light (synchronisation bugs, perhaps, or especially, on dynamic load/unload). For a while, dynamically loaded system calls, for example, incured extra synchronisation overhead (and still might). And in the MAC Framework, modules that have been loaded dynamically, and might be unloaded dynamically, require more synchronisation coming in from the kernel in order to ensure they can't be unloaded while in execution. However, in the big picture, and for many features (especially device drivers and file systems), this doesn't appear to be measurable as far as I can tell. Robert From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 20: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 456961065676; Sat, 11 Jun 2011 20:07:35 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id B04A88FC14; Sat, 11 Jun 2011 20:07:34 +0000 (UTC) Received: from [10.0.0.63] (63.imp.bsdimp.com [10.0.0.63]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p5BK2dIn056710 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Sat, 11 Jun 2011 14:03:15 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <4DF3B12C.8020505@FreeBSD.org> Date: Sat, 11 Jun 2011 14:02:54 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <9583277B-6EC0-4B7F-9640-2B128A96C6B8@bsdimp.com> References: <201106110908.p5B98kkE066709@svn.freebsd.org> <4DF3B12C.8020505@FreeBSD.org> To: Doug Barton X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Sat, 11 Jun 2011 14:03:15 -0600 (MDT) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Robert Watson , Joel Dahl Subject: Re: svn commit: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 20:07:35 -0000 On Jun 11, 2011, at 12:17 PM, Doug Barton wrote: > On 6/11/2011 6:07 AM, Robert Watson wrote: >> To me, this seems like the wrong direction. Over the last decade, = we've >> been trying to move away from conditional compilation of features to >> having them be loadable as modules. >=20 > FWIW, I agree. I'm wondering though, is there still a performance = penalty for modules? My understanding in the past was that there is, = although for most use cases it's in the statistical noise. Is that still = true? At run time, I believe that's true. At load time, lots of modules can = take a few seconds longer. Warner From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 20:13: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 E1B601065673; Sat, 11 Jun 2011 20:13:28 +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 D216E8FC16; Sat, 11 Jun 2011 20:13: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 p5BKDSOc089593; Sat, 11 Jun 2011 20:13:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5BKDSAY089591; Sat, 11 Jun 2011 20:13:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201106112013.p5BKDSAY089591@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 11 Jun 2011 20:13: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: r222991 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jun 2011 20:13:29 -0000 Author: kib Date: Sat Jun 11 20:13:28 2011 New Revision: 222991 URL: http://svn.freebsd.org/changeset/base/222991 Log: Fix a bug in r222586. Lock the page owner object around the modification of the m->dirty. Reported and tested by: nwhitehorn Reviewed by: alc Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Sat Jun 11 18:39:55 2011 (r222990) +++ head/sys/vm/vnode_pager.c Sat Jun 11 20:13:28 2011 (r222991) @@ -1195,8 +1195,13 @@ vnode_pager_generic_putpages(struct vnod void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written) { + vm_object_t obj; int i, pos; + if (written == 0) + return; + obj = ma[0]->object; + VM_OBJECT_LOCK(obj); for (i = 0, pos = 0; pos < written; i++, pos += PAGE_SIZE) { if (pos < trunc_page(written)) { rtvals[i] = VM_PAGER_OK; @@ -1207,4 +1212,5 @@ vnode_pager_undirty_pages(vm_page_t *ma, vm_page_clear_dirty(ma[i], 0, written & PAGE_MASK); } } + VM_OBJECT_UNLOCK(obj); } From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 20: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 53BB6106564A; Sat, 11 Jun 2011 20:15:20 +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 442BE8FC08; Sat, 11 Jun 2011 20:15: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 p5BKFKkT089683; Sat, 11 Jun 2011 20:15:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5BKFKWL089680; Sat, 11 Jun 2011 20:15:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201106112015.p5BKFKWL089680@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 11 Jun 2011 20:15: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: r222992 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jun 2011 20:15:20 -0000 Author: kib Date: Sat Jun 11 20:15:19 2011 New Revision: 222992 URL: http://svn.freebsd.org/changeset/base/222992 Log: Assert that page is VPO_BUSY or page owner object is locked in vm_page_undirty(). The assert is not precise due to VPO_BUSY owner to tracked, so assertion does not catch the case when VPO_BUSY is owned by other thread. Reviewed by: alc Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Jun 11 20:13:28 2011 (r222991) +++ head/sys/vm/vm_page.c Sat Jun 11 20:15:19 2011 (r222992) @@ -2636,6 +2636,23 @@ vm_page_cowsetup(vm_page_t m) return (0); } +#ifdef INVARIANTS +void +vm_page_object_lock_assert(vm_page_t m) +{ + + /* + * Certain of the page's fields may only be modified by the + * holder of the containing object's lock or the setter of the + * page's VPO_BUSY flag. Unfortunately, the setter of the + * VPO_BUSY flag is not recorded, and thus cannot be checked + * here. + */ + if (m->object != NULL && (m->oflags & VPO_BUSY) == 0) + VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); +} +#endif + #include "opt_ddb.h" #ifdef DDB #include Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sat Jun 11 20:13:28 2011 (r222991) +++ head/sys/vm/vm_page.h Sat Jun 11 20:15:19 2011 (r222992) @@ -383,6 +383,13 @@ void vm_page_cowfault (vm_page_t); int vm_page_cowsetup(vm_page_t); void vm_page_cowclear (vm_page_t); +#ifdef INVARIANTS +void vm_page_object_lock_assert(vm_page_t m); +#define VM_PAGE_OBJECT_LOCK_ASSERT(m) vm_page_object_lock_assert(m) +#else +#define VM_PAGE_OBJECT_LOCK_ASSERT(m) (void)0 +#endif + /* * vm_page_sleep_if_busy: * @@ -412,6 +419,8 @@ vm_page_sleep_if_busy(vm_page_t m, int a static __inline void vm_page_undirty(vm_page_t m) { + + VM_PAGE_OBJECT_LOCK_ASSERT(m); m->dirty = 0; } From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 20:55:16 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id E769C106566B; Sat, 11 Jun 2011 20:55:16 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from [127.0.0.1] (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 03F9B14DAFC; Sat, 11 Jun 2011 20:55:15 +0000 (UTC) Message-ID: <4DF3D633.5060506@FreeBSD.org> Date: Sat, 11 Jun 2011 13:55:15 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Warner Losh References: <201106110908.p5B98kkE066709@svn.freebsd.org> <4DF3B12C.8020505@FreeBSD.org> <9583277B-6EC0-4B7F-9640-2B128A96C6B8@bsdimp.com> In-Reply-To: <9583277B-6EC0-4B7F-9640-2B128A96C6B8@bsdimp.com> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Robert Watson , Joel Dahl Subject: Re: svn commit: r222980 - in head/sys: amd64/conf i386/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, 11 Jun 2011 20:55:17 -0000 On 6/11/2011 1:02 PM, Warner Losh wrote: > > On Jun 11, 2011, at 12:17 PM, Doug Barton wrote: > >> On 6/11/2011 6:07 AM, Robert Watson wrote: >>> To me, this seems like the wrong direction. Over the last decade, we've >>> been trying to move away from conditional compilation of features to >>> having them be loadable as modules. >> >> FWIW, I agree. I'm wondering though, is there still a performance penalty for modules? My understanding in the past was that there is, although for most use cases it's in the statistical noise. Is that still true? > > At run time, I believe that's true. At load time, lots of modules can take a few seconds longer. I have 3 or 4 modules loaded via loader.conf at boot time. They take at least 2 seconds each. IMO loading everything via loader.conf would slow the boot so much as to be a non-starter. OTOH, I could imagine an rc.d script that depends on mountcritlocal that could load a list of modules. Unless I'm missing something that would be several times faster. Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 21:14: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 7F701106566B; Sat, 11 Jun 2011 21:14:22 +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 562078FC08; Sat, 11 Jun 2011 21:14: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 p5BLEMgQ091460; Sat, 11 Jun 2011 21:14:22 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5BLEMmK091456; Sat, 11 Jun 2011 21:14:22 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201106112114.p5BLEMmK091456@svn.freebsd.org> From: Rick Macklem Date: Sat, 11 Jun 2011 21:14: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: r222993 - in head/etc: defaults rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 11 Jun 2011 21:14:22 -0000 Author: rmacklem Date: Sat Jun 11 21:14:22 2011 New Revision: 222993 URL: http://svn.freebsd.org/changeset/base/222993 Log: Make three one line changes to the rc scripts so that they work with the new NFS client being the default, since the new NFS client's module name is nfscl and not nfsclient. Modified: head/etc/defaults/rc.conf head/etc/rc.d/mountcritremote head/etc/rc.d/nfsclient Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Sat Jun 11 20:15:19 2011 (r222992) +++ head/etc/defaults/rc.conf Sat Jun 11 21:14:22 2011 (r222993) @@ -89,7 +89,7 @@ fsck_y_enable="NO" # Set to YES to do fs fsck_y_flags="" # Additional flags for fsck -y background_fsck="YES" # Attempt to run fsck in the background where possible. background_fsck_delay="60" # Time to wait (seconds) before starting the fsck. -netfs_types="nfs:NFS newnfs:NEWNFS smbfs:SMB portalfs:PORTAL nwfs:NWFS" # Net filesystems. +netfs_types="nfs:NFS oldnfs:OLDNFS smbfs:SMB portalfs:PORTAL nwfs:NWFS" # Net filesystems. extra_netfs_types="NO" # List of network extra filesystem types for delayed # mount at startup (or NO). Modified: head/etc/rc.d/mountcritremote ============================================================================== --- head/etc/rc.d/mountcritremote Sat Jun 11 20:15:19 2011 (r222992) +++ head/etc/rc.d/mountcritremote Sat Jun 11 21:14:22 2011 (r222993) @@ -26,7 +26,7 @@ mountcritremote_precmd() case "`mount -d -a -t nfs 2> /dev/null`" in *mount_nfs*) # Handle absent nfs client support - load_kld -m nfs nfsclient || return 1 + load_kld -m nfs nfscl || return 1 ;; esac return 0 Modified: head/etc/rc.d/nfsclient ============================================================================== --- head/etc/rc.d/nfsclient Sat Jun 11 20:15:19 2011 (r222992) +++ head/etc/rc.d/nfsclient Sat Jun 11 21:14:22 2011 (r222993) @@ -13,7 +13,7 @@ name="nfsclient" rcvar="nfs_client_enable" start_cmd="nfsclient_start" stop_cmd="unmount_all" -required_modules="nfsclient:oldnfs" +required_modules="nfscl:nfs" nfsclient_start() { From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 21:26: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 B479F1065672; Sat, 11 Jun 2011 21:26:12 +0000 (UTC) (envelope-from crees@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4B248FC15; Sat, 11 Jun 2011 21:26: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 p5BLQCsh091859; Sat, 11 Jun 2011 21:26:12 GMT (envelope-from crees@svn.freebsd.org) Received: (from crees@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5BLQC5x091857; Sat, 11 Jun 2011 21:26:12 GMT (envelope-from crees@svn.freebsd.org) Message-Id: <201106112126.p5BLQC5x091857@svn.freebsd.org> From: Chris Rees Date: Sat, 11 Jun 2011 21:26: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: r222994 - head/usr.bin/calendar/calendars X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 11 Jun 2011 21:26:12 -0000 Author: crees (ports committer) Date: Sat Jun 11 21:26:12 2011 New Revision: 222994 URL: http://svn.freebsd.org/changeset/base/222994 Log: Add self to calendar Approved by: rene (mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sat Jun 11 21:14:22 2011 (r222993) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sat Jun 11 21:26:12 2011 (r222994) @@ -260,6 +260,7 @@ 09/05 Mark Robert Vaughan Murray born in Harare, Mashonaland, Zimbabwe, 1961 09/05 Adrian Harold Chadd born in Perth, Western Australia, Australia, 1979 09/07 Tim Bishop born in Cornwall, United Kingdom, 1978 +09/07 Chris Rees born in Kettering, United Kingdom, 1987 09/08 Boris Samorodov born in Krasnodar, Russian Federation, 1963 09/09 Yoshio Mita born in Hiroshima, Japan, 1972 09/10 Wesley R. Peters born in Hartford, Alabama, United States, 1961 From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 21:27: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 9C1D1106567B; Sat, 11 Jun 2011 21:27:14 +0000 (UTC) (envelope-from crees@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C7AD8FC08; Sat, 11 Jun 2011 21:27: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 p5BLRE7l091932; Sat, 11 Jun 2011 21:27:14 GMT (envelope-from crees@svn.freebsd.org) Received: (from crees@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5BLREH1091930; Sat, 11 Jun 2011 21:27:14 GMT (envelope-from crees@svn.freebsd.org) Message-Id: <201106112127.p5BLREH1091930@svn.freebsd.org> From: Chris Rees Date: Sat, 11 Jun 2011 21:27: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: r222995 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 11 Jun 2011 21:27:14 -0000 Author: crees (ports committer) Date: Sat Jun 11 21:27:14 2011 New Revision: 222995 URL: http://svn.freebsd.org/changeset/base/222995 Log: Add self Approved by: rene (mentor) Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Sat Jun 11 21:26:12 2011 (r222994) +++ head/share/misc/committers-ports.dot Sat Jun 11 21:27:14 2011 (r222995) @@ -67,6 +67,7 @@ chinsan [label="Chinsan Huang\nchinsan@F clement [label="Clement Laforet\nclement@FreeBSD.org\n2003/12/17"] clsung [label="Cheng-Lung Sung\nclsung@FreeBSD.org\n2004/8/18"] cperciva [label="Colin Percival\ncperciva@FreeBSD.org\n2006/01/31"] +crees [label="Chris Rees\ncrees@FreeBSD.org\n2011/06/11"] culot [label="Frederic Culot\nculot@FreeBSD.org\n2010/10/16"] daichi [label="Daichi Goto\ndaichi@FreeBSD.org\n2002/10/17"] danfe [label="Alexey Dokuchaev\ndanfe@FreeBSD.org\n2004/08/20"] @@ -375,6 +376,8 @@ philip -> koitsu rafan -> chinsan +rene -> crees + sahil -> culot sat -> beech From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 21:40: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 A277E10656AD; Sat, 11 Jun 2011 21:40:37 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92C538FC08; Sat, 11 Jun 2011 21:40: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 p5BLebLA093131; Sat, 11 Jun 2011 21:40:37 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5BLebvH093128; Sat, 11 Jun 2011 21:40:37 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106112140.p5BLebvH093128@svn.freebsd.org> From: Hiroki Sato Date: Sat, 11 Jun 2011 21:40: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: r222996 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 11 Jun 2011 21:40:37 -0000 Author: hrs Date: Sat Jun 11 21:40:37 2011 New Revision: 222996 URL: http://svn.freebsd.org/changeset/base/222996 Log: Add a helper function to check kern.features.* sysctls. Discussed with: dougb Modified: head/etc/network.subr head/etc/rc.subr Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Sat Jun 11 21:27:14 2011 (r222995) +++ head/etc/network.subr Sat Jun 11 21:40:37 2011 (r222996) @@ -349,11 +349,8 @@ afexists() _af=$1 case ${_af} in - inet) - ${SYSCTL_N} kern.features.inet > /dev/null 2>&1 - ;; - inet6) - ${SYSCTL_N} kern.features.inet6 > /dev/null 2>&1 + inet|inet6) + check_kern_features ${_af} ;; ipx) ${SYSCTL_N} net.ipx > /dev/null 2>&1 Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sat Jun 11 21:27:14 2011 (r222995) +++ head/etc/rc.subr Sat Jun 11 21:40:37 2011 (r222996) @@ -1734,6 +1734,28 @@ check_required_after() fi +# check_kern_features mib +# Return existence of kern.features.* sysctl MIB as true or +# false. The result will be cached in $_rc_cache_kern_features_ +# namespace. "0" means the kern.features.X exists. + +check_kern_features() +{ + local _v + + [ -n "$1" ] || return 1; + _v=`eval echo "\\$_rc_cache_kern_features_$1"` + [ -n "$_v" ] && return "$_v"; + + if ${SYSCTL_N} kern.features.$1 > /dev/null 2>&1; then + eval _rc_cache_kern_features_$1=0 + return 0 + else + eval _rc_cache_kern_features_$1=1 + return 1 + fi +} + # _echoonce var msg mode # mode=0: Echo $msg if ${$var} is empty. # After doing echo, a string is set to ${$var}. From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 21:41: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 D27351065673; Sat, 11 Jun 2011 21:41:44 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C36D18FC1F; Sat, 11 Jun 2011 21:41: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 p5BLfiar093289; Sat, 11 Jun 2011 21:41:44 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5BLfidN093287; Sat, 11 Jun 2011 21:41:44 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201106112141.p5BLfidN093287@svn.freebsd.org> From: Hiroki Sato Date: Sat, 11 Jun 2011 21:41: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: r222997 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 11 Jun 2011 21:41:44 -0000 Author: hrs Date: Sat Jun 11 21:41:44 2011 New Revision: 222997 URL: http://svn.freebsd.org/changeset/base/222997 Log: - Remove $ipv6_gateway_enable check. - Use list_net_interfaces() instead of "ifconfig -l". Modified: head/etc/rc.d/rtadvd Modified: head/etc/rc.d/rtadvd ============================================================================== --- head/etc/rc.d/rtadvd Sat Jun 11 21:40:37 2011 (r222996) +++ head/etc/rc.d/rtadvd Sat Jun 11 21:41:44 2011 (r222997) @@ -18,12 +18,6 @@ start_precmd="rtadvd_precmd" rtadvd_precmd() { - if ! checkyesno ipv6_gateway_enable ; then - warn \ - "${name} cannot be used on IPv6 host, only on an IPv6 router." - return 1 - fi - # This should be enabled with a great care. # You may want to fine-tune /etc/rtadvd.conf. # @@ -42,7 +36,7 @@ rtadvd_precmd() # case ${rtadvd_interfaces} in [Aa][Uu][Tt][Oo]|'') - for i in `ifconfig -l` ; do + for i in `list_net_interfaces`; do case $i in lo0) continue ;; esac From owner-svn-src-head@FreeBSD.ORG Sat Jun 11 21:44:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C332106566B; Sat, 11 Jun 2011 21:44:07 +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 7B2D58FC13; Sat, 11 Jun 2011 21:44:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5BLi7YK093578; Sat, 11 Jun 2011 21:44:07 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5BLi7WO093575; Sat, 11 Jun 2011 21:44:07 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201106112144.p5BLi7WO093575@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 11 Jun 2011 21:44: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: r222998 - head/usr.sbin/bsdinstall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 11 Jun 2011 21:44:07 -0000 Author: nwhitehorn Date: Sat Jun 11 21:44:07 2011 New Revision: 222998 URL: http://svn.freebsd.org/changeset/base/222998 Log: Long-overdue man page for bsdinstall. Added: head/usr.sbin/bsdinstall/bsdinstall.8 (contents, props changed) Modified: head/usr.sbin/bsdinstall/Makefile Modified: head/usr.sbin/bsdinstall/Makefile ============================================================================== --- head/usr.sbin/bsdinstall/Makefile Sat Jun 11 21:41:44 2011 (r222997) +++ head/usr.sbin/bsdinstall/Makefile Sat Jun 11 21:44:07 2011 (r222998) @@ -2,5 +2,6 @@ SUBDIR= distextract distfetch partedit scripts SCRIPTS= bsdinstall +MAN= bsdinstall.8 .include Added: head/usr.sbin/bsdinstall/bsdinstall.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdinstall/bsdinstall.8 Sat Jun 11 21:44:07 2011 (r222998) @@ -0,0 +1,187 @@ +.\"- +.\" 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 ``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. +.\" +.\" $FreeBSD$ +.\" +.Dd June 11, 2010 +.Dt bsdinstall 8 +.Os +.Sh NAME +.Nm bsdinstall +.Nd system installer +.Sh SYNOPSIS +.Nm +.Op Ar target +.Op Ar ... +.Sh DESCRIPTION +.Nm +is used for installation of new systems, both for system setup from +installation media (e.g. CD-ROMs) and for use on live systems to prepare +VM images and jails. +.Pp +Much like +.Xr make 1 , Nm +takes a target and possible parameters of the target as arguments. If +invoked with no arguments, it will invoke the +.Cm auto +target, which provides a standard interactive installation, invoking the +others in sequence. To perform a scripted installation, these subtargets +can be invoked separately by an installation script. +.Sh TARGETS +Most of the following targets are only useful for scripting the installer. +For interactive use, most users will be interested only in the +.Cm auto +and +.Cm jail +targets. +.Bl -tag -width ".Cm jail Ar destination" +.It Cm auto +Run the standard interactive installation, including disk partitioning. +.It Cm jail Ar destination +Sets up a new chroot system at +.Pa destination , +suitable for use with +.Xr jail 8 . +Behavior is generally similar to +.Cm auto , +except that disk partitioning and network setup are skipped and a kernel is +not installed into the new system. +.It Cm keymap +If the current controlling TTY is a +.Xr syscons 4 +console, asks the user to set the current keymap, and saves the result to the +new system's +.Pa rc.conf . +.It Cm hostname +Prompts the user for a host name for the new system and saves the result to the +new system's +.Pa rc.conf . +If +.Ev BSDINSTALL_CONFIGCURRENT +is set, also sets the host name of the current system. +.It Cm netconfig +Interactively configures network interfaces (first invoking +.Cm wlanconfig +on wireless interfaces), saving the result to the new system's +.Pa rc.conf +and +.Pa resolv.conf . +If +.Ev BSDINSTALL_CONFIGCURRENT +is set, also configures the network interfaces of the current system to match. +.It Cm autopart +Provides the installer's interactive guided disk partitioner for single-disk +installations. Partitions disks, runs +.Xr newfs 8 , +and writes the new system's +.Pa fstab . +.It Cm partedit +Provides the installer's interactive manual disk partitioner, with support +for multi disk setups, non-UFS file systems, and manual selection of +partition schemes. Partitions disks, runs +.Xr newfs 8 , +and writes the new system's +.Pa fstab . +.It Cm mount +Mounts the file systems previously configured by +.Cm autopart +or +.Cm partedit +under +.Ev BSDINSTALL_CHROOT . +.It Cm distfetch +Fetches the distributions in +.Ev DISTRIBUTIONS +to +.Ev BSDINSTALL_DISTDIR +from +.Ev BSDINSTALL_DISTSITE . +.It Cm checksum +Verifies the checksums of the distributions listed in +.Ev DISTRIBUTIONS +against the distribution manifest. +.It Cm distextract +Extracts the distributions listed in +.Ev DISTRIBUTIONS +into +.Ev BSDINSTALL_CHROOT . +.It Cm rootpass +Interactively invokes +.Xr passwd 1 +in the new system to set the root user's password. +.It Cm adduser +Interactively invokes +.Xr adduser 8 +in the new system. +.It Cm time +Interactively sets the time, date, and time zone of the new system. +.It Cm services +Queries the user for the system daemons to begin at system startup, +writing the result into the new system's +.Pa rc.conf . +.It Cm config +Installs the configuration files destined for the new system (e.g. rc.conf +fragments generated by +.Cm netconfig , +etc.) onto the new system. +.El +.Sh ENVIRONMENT VARIABLES +The following environment variables control various aspects of the installation +process. Many are used internally during installation and have reasonable +default values for most installation scenarios. Others are set by various +interactive user prompts, and can be usefully overridden when making scripted +or customized installers. +.Bl -tag -width ".Ev BSDINSTALL_DISTDIR" +.It Ev DISTRIBUTIONS +The set of distributions to install (e.g. "base kernel ports"). Default: none +.It Ev BSDINSTALL_DISTDIR +The directory in which the distribution files can be found (or to which they +should be downloaded). Default: +.Pa /usr/freebsd-dist +.It Ev BSDINSTALL_CHROOT +The directory into which the distribution files should be unpacked and the +directory at which the root file system of the new system should be mounted. +Default: +.Pa /mnt +.It Ev BSDINSTALL_LOG +Path to a log file for the installation. Default: +.Pa /tmp/bsdinstall_log +.It Ev BSDINSTALL_TMPETC +Directory where files destined for the new system's +.Pa /etc +will be stored until the +.Cm config +target is executed. If this directory does not already exist, it will be +created. Default: +.Pa /tmp/bsdinstall_etc +.El +.Sh HISTORY +This version of +.Nm +first appeared in +.Fx 9.0 . +.Sh AUTHORS +.An -nosplit +.An Nathan Whitehorn Aq nwhitehorn@FreeBSD.org