From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 00:16:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D38A6106566C; Sun, 19 Apr 2009 00:16:04 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFC968FC08; Sun, 19 Apr 2009 00:16:04 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J0G4hY090918; Sun, 19 Apr 2009 00:16:04 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J0G4rA090911; Sun, 19 Apr 2009 00:16:04 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904190016.n3J0G4rA090911@svn.freebsd.org> From: Kip Macy Date: Sun, 19 Apr 2009 00:16:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191255 - in head/sys: amd64/conf conf i386/conf 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: Sun, 19 Apr 2009 00:16:05 -0000 Author: kmacy Date: Sun Apr 19 00:16:04 2009 New Revision: 191255 URL: http://svn.freebsd.org/changeset/base/191255 Log: - Import infrastructure for caching flows as a means of accelerating L3 and L2 lookups as well as providing stateful load balancing when used with RADIX_MPATH. - Currently compiled in to i386 and amd64 but disabled by default, it can be enabled at runtime with 'sysctl net.inet.flowtable.enable=1'. - Embedded users can remove it entirely from the kernel by adding 'nooption FLOWTABLE' to their kernel config files. - A minimal hookup will be added to ip_output in a subsequent commit. I would like to see more review before bringing in changes that require more churn. Supported by: Bitgravity Inc. Added: head/sys/net/flowtable.c (contents, props changed) head/sys/net/flowtable.h (contents, props changed) Modified: head/sys/amd64/conf/DEFAULTS head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/i386/conf/DEFAULTS Modified: head/sys/amd64/conf/DEFAULTS ============================================================================== --- head/sys/amd64/conf/DEFAULTS Sat Apr 18 22:16:46 2009 (r191254) +++ head/sys/amd64/conf/DEFAULTS Sun Apr 19 00:16:04 2009 (r191255) @@ -20,3 +20,5 @@ options GEOM_PART_BSD options GEOM_PART_EBR options GEOM_PART_EBR_COMPAT options GEOM_PART_MBR + +options FLOWTABLE Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Apr 18 22:16:46 2009 (r191254) +++ head/sys/conf/NOTES Sun Apr 19 00:16:04 2009 (r191255) @@ -553,6 +553,9 @@ options LIBMCHAIN # libalias library, performing NAT options LIBALIAS +# flowtable cache +options FLOWTABLE + # # SCTP is a NEW transport protocol defined by # RFC2960 updated by RFC3309 and RFC3758.. and Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Apr 18 22:16:46 2009 (r191254) +++ head/sys/conf/files Sun Apr 19 00:16:04 2009 (r191255) @@ -2145,6 +2145,7 @@ net/bpf_jitter.c optional bpf_jitter net/bpf_filter.c optional bpf | netgraph_bpf net/bpf_zerocopy.c optional bpf net/bridgestp.c optional bridge | if_bridge +net/flowtable.c optional flowtable net/ieee8023ad_lacp.c optional lagg net/if.c standard net/if_arcsubr.c optional arcnet Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sat Apr 18 22:16:46 2009 (r191254) +++ head/sys/conf/options Sun Apr 19 00:16:04 2009 (r191255) @@ -417,6 +417,7 @@ TCP_OFFLOAD_DISABLE opt_inet.h #Disable TCP_SIGNATURE opt_inet.h VLAN_ARRAY opt_vlan.h XBONEHACK +FLOWTABLE opt_route.h # # SCTP Modified: head/sys/i386/conf/DEFAULTS ============================================================================== --- head/sys/i386/conf/DEFAULTS Sat Apr 18 22:16:46 2009 (r191254) +++ head/sys/i386/conf/DEFAULTS Sun Apr 19 00:16:04 2009 (r191255) @@ -28,3 +28,5 @@ options GEOM_PART_MBR # enable support for native hardware options NATIVE device atpic + +options FLOWTABLE Added: head/sys/net/flowtable.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net/flowtable.c Sun Apr 19 00:16:04 2009 (r191255) @@ -0,0 +1,1105 @@ +/************************************************************************** + +Copyright (c) 2008-2009, BitGravity Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Neither the name of the BitGravity Corporation 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 "opt_route.h" +#include "opt_mpath.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Taken from http://burtleburtle.net/bob/c/lookup3.c + */ + +#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) + +/* +------------------------------------------------------------------------------- +mix -- mix 3 32-bit values reversibly. + +This is reversible, so any information in (a,b,c) before mix() is +still in (a,b,c) after mix(). + +If four pairs of (a,b,c) inputs are run through mix(), or through +mix() in reverse, there are at least 32 bits of the output that +are sometimes the same for one pair and different for another pair. +This was tested for: +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that +satisfy this are + 4 6 8 16 19 4 + 9 15 3 18 27 15 + 14 9 3 7 17 3 +Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing +for "differ" defined as + with a one-bit base and a two-bit delta. I +used http://burtleburtle.net/bob/hash/avalanche.html to choose +the operations, constants, and arrangements of the variables. + +This does not achieve avalanche. There are input bits of (a,b,c) +that fail to affect some output bits of (a,b,c), especially of a. The +most thoroughly mixed value is c, but it doesn't really even achieve +avalanche in c. + +This allows some parallelism. Read-after-writes are good at doubling +the number of bits affected, so the goal of mixing pulls in the opposite +direction as the goal of parallelism. I did what I could. Rotates +seem to cost as much as shifts on every machine I could lay my hands +on, and rotates are much kinder to the top and bottom bits, so I used +rotates. +------------------------------------------------------------------------------- +*/ +#define mix(a,b,c) \ +{ \ + a -= c; a ^= rot(c, 4); c += b; \ + b -= a; b ^= rot(a, 6); a += c; \ + c -= b; c ^= rot(b, 8); b += a; \ + a -= c; a ^= rot(c,16); c += b; \ + b -= a; b ^= rot(a,19); a += c; \ + c -= b; c ^= rot(b, 4); b += a; \ +} + +/* +------------------------------------------------------------------------------- +final -- final mixing of 3 32-bit values (a,b,c) into c + +Pairs of (a,b,c) values differing in only a few bits will usually +produce values of c that look totally different. This was tested for +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +These constants passed: + 14 11 25 16 4 14 24 + 12 14 25 16 4 14 24 +and these came close: + 4 8 15 26 3 22 24 + 10 8 15 26 3 22 24 + 11 8 15 26 3 22 24 +------------------------------------------------------------------------------- +*/ +#define final(a,b,c) \ +{ \ + c ^= b; c -= rot(b,14); \ + a ^= c; a -= rot(c,11); \ + b ^= a; b -= rot(a,25); \ + c ^= b; c -= rot(b,16); \ + a ^= c; a -= rot(c,4); \ + b ^= a; b -= rot(a,14); \ + c ^= b; c -= rot(b,24); \ +} + +/* +-------------------------------------------------------------------- + This works on all machines. To be useful, it requires + -- that the key be an array of uint32_t's, and + -- that the length be the number of uint32_t's in the key + + The function hashword() is identical to hashlittle() on little-endian + machines, and identical to hashbig() on big-endian machines, + except that the length has to be measured in uint32_ts rather than in + bytes. hashlittle() is more complicated than hashword() only because + hashlittle() has to dance around fitting the key bytes into registers. +-------------------------------------------------------------------- +*/ +static uint32_t hashword( +const uint32_t *k, /* the key, an array of uint32_t values */ +size_t length, /* the length of the key, in uint32_ts */ +uint32_t initval) /* the previous hash, or an arbitrary value */ +{ + uint32_t a,b,c; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval; + + /*------------------------------------------------- handle most of the key */ + while (length > 3) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 3; + k += 3; + } + + /*------------------------------------------- handle the last 3 uint32_t's */ + switch(length) /* all the case statements fall through */ + { + case 3 : c+=k[2]; + case 2 : b+=k[1]; + case 1 : a+=k[0]; + final(a,b,c); + case 0: /* case 0: nothing left to add */ + break; + } + /*------------------------------------------------------ report the result */ + return c; +} + + +struct ipv4_tuple { + uint16_t ip_sport; /* source port */ + uint16_t ip_dport; /* destination port */ + in_addr_t ip_saddr; /* source address */ + in_addr_t ip_daddr; /* destination address */ +}; + +union ipv4_flow { + struct ipv4_tuple ipf_ipt; + uint32_t ipf_key[3]; +}; + +struct ipv6_tuple { + uint16_t ip_sport; /* source port */ + uint16_t ip_dport; /* destination port */ + struct in6_addr ip_saddr; /* source address */ + struct in6_addr ip_daddr; /* destination address */ +}; + +union ipv6_flow { + struct ipv6_tuple ipf_ipt; + uint32_t ipf_key[9]; +}; + +struct flentry { + volatile uint32_t f_fhash; /* hash flowing forward */ + uint16_t f_flags; /* flow flags */ + uint8_t f_pad; /* alignment */ + uint8_t f_proto; /* protocol */ + uint32_t f_uptime; /* uptime at last access */ + struct flentry *f_next; /* pointer to collision entry */ + volatile struct rtentry *f_rt; /* rtentry for flow */ + volatile struct llentry *f_lle; /* llentry for flow */ +}; + +struct flentry_v4 { + struct flentry fl_entry; + union ipv4_flow fl_flow; +}; + +struct flentry_v6 { + struct flentry fl_entry; + union ipv6_flow fl_flow; +}; + +#define fl_fhash fl_entry.fl_fhash +#define fl_flags fl_entry.fl_flags +#define fl_proto fl_entry.fl_proto +#define fl_uptime fl_entry.fl_uptime +#define fl_rt fl_entry.fl_rt +#define fl_lle fl_entry.fl_lle + +#define SECS_PER_HOUR 3600 +#define SECS_PER_DAY (24*SECS_PER_HOUR) + +#define SYN_IDLE 300 +#define UDP_IDLE 300 +#define FIN_WAIT_IDLE 600 +#define TCP_IDLE SECS_PER_DAY + + +typedef void fl_lock_t(struct flowtable *, uint32_t); +typedef void fl_rtalloc_t(struct route *, uint32_t, u_int); + +union flentryp { + struct flentry **global; + struct flentry **pcpu[MAXCPU]; +}; + +struct flowtable { + union flentryp ft_table; + int ft_size; + bitstr_t *ft_masks[MAXCPU]; + struct mtx *ft_locks; + int ft_lock_count; + uint32_t ft_flags; + uint32_t ft_collisions; + uint32_t ft_allocated; + uint64_t ft_hits; + + uint32_t ft_udp_idle; + uint32_t ft_fin_wait_idle; + uint32_t ft_syn_idle; + uint32_t ft_tcp_idle; + + fl_lock_t *ft_lock; + fl_lock_t *ft_unlock; + fl_rtalloc_t *ft_rtalloc; + + struct flowtable *ft_next; +}; + +static struct proc *flowcleanerproc; +static struct flowtable *flow_list_head; +static uint32_t hashjitter; +static uma_zone_t ipv4_zone; +static uma_zone_t ipv6_zone; + +/* + * TODO: + * - Add per flowtable sysctls for statistics and configuring timeouts + * - add IPv6 support to flow lookup + * - add saturation counter to rtentry to support per-packet load-balancing + * add flag to indicate round-robin flow, add list lookup from head + for flows + * - add sysctl / device node / syscall to support exporting and importing + * of flows with flag to indicate that a flow was imported so should + * not be considered for auto-cleaning + * - support explicit connection state (currently only ad-hoc for DSR) + */ +SYSCTL_NODE(_net_inet, OID_AUTO, flowtable, CTLFLAG_RD, NULL, "flowtable"); +int flowtable_enable = 0; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, enable, CTLFLAG_RW, + &flowtable_enable, 0, "enable flowtable caching."); +static int flowtable_hits = 0; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, hits, CTLFLAG_RD, + &flowtable_hits, 0, "# flowtable hits."); +static int flowtable_lookups = 0; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, lookups, CTLFLAG_RD, + &flowtable_lookups, 0, "# flowtable lookups."); +static int flowtable_misses = 0; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, misses, CTLFLAG_RD, + &flowtable_misses, 0, "#flowtable misses."); +static int flowtable_frees = 0; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, frees, CTLFLAG_RD, + &flowtable_frees, 0, "#flows freed."); +static int flowtable_free_checks = 0; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, free_checks, CTLFLAG_RD, + &flowtable_free_checks, 0, "#flows free checks."); +static int flowtable_max_depth = 0; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, max_depth, CTLFLAG_RD, + &flowtable_max_depth, 0, "max collision list length."); +static int flowtable_collisions = 0; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, collisions, CTLFLAG_RD, + &flowtable_collisions, 0, "#flowtable collisions."); + +/* + * XXX This does not end up updating timeouts at runtime + * and only reflects the value for the last table added :-/ + */ +static int flowtable_syn_expire = SYN_IDLE; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, syn_expire, CTLFLAG_RW, + &flowtable_syn_expire, 0, "seconds after which to remove syn allocated flow."); +static int flowtable_udp_expire = UDP_IDLE; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, udp_expire, CTLFLAG_RW, + &flowtable_udp_expire, 0, "seconds after which to remove flow allocated to UDP."); +static int flowtable_fin_wait_expire = FIN_WAIT_IDLE; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, fin_wait_expire, CTLFLAG_RW, + &flowtable_fin_wait_expire, 0, "seconds after which to remove a flow in FIN_WAIT."); +static int flowtable_tcp_expire = TCP_IDLE; +SYSCTL_INT(_net_inet_flowtable, OID_AUTO, tcp_expire, CTLFLAG_RW, + &flowtable_tcp_expire, 0, "seconds after which to remove flow allocated to a TCP connection."); + + +/* + * Maximum number of flows that can be allocated of a given type. + * + * The table is allocated at boot time (for the pure caching case + * there is no reason why this could not be changed at runtime) + * and thus (currently) needs to be set with a tunable. + */ +static int nmbflows = 4096; + +static int +sysctl_nmbflows(SYSCTL_HANDLER_ARGS) +{ + int error, newnmbflows; + + newnmbflows = nmbflows; + error = sysctl_handle_int(oidp, &newnmbflows, 0, req); + if (error == 0 && req->newptr) { + if (newnmbflows > nmbflows) { + nmbflows = newnmbflows; + uma_zone_set_max(ipv4_zone, nmbflows); + uma_zone_set_max(ipv6_zone, nmbflows); + } else + error = EINVAL; + } + return (error); +} +SYSCTL_PROC(_net_inet_flowtable, OID_AUTO, nmbflows, CTLTYPE_INT|CTLFLAG_RW, + &nmbflows, 0, sysctl_nmbflows, "IU", "Maximum number of flows allowed"); + +#ifndef RADIX_MPATH +static void +in_rtalloc_ign_wrapper(struct route *ro, uint32_t hash, u_int fib) +{ + + in_rtalloc_ign(ro, 0, fib); +} +#endif + +static void +flowtable_global_lock(struct flowtable *table, uint32_t hash) +{ + int lock_index = (hash)&(table->ft_lock_count - 1); + + mtx_lock(&table->ft_locks[lock_index]); +} + +static void +flowtable_global_unlock(struct flowtable *table, uint32_t hash) +{ + int lock_index = (hash)&(table->ft_lock_count - 1); + + mtx_unlock(&table->ft_locks[lock_index]); +} + +static void +flowtable_pcpu_lock(struct flowtable *table, uint32_t hash) +{ + + critical_enter(); +} + +static void +flowtable_pcpu_unlock(struct flowtable *table, uint32_t hash) +{ + + mb(); + critical_exit(); +} + +#define FL_ENTRY_INDEX(table, hash)((hash) % (table)->ft_size) +#define FL_ENTRY(table, hash) *flowtable_entry((table), (hash)) +#define FL_ENTRY_LOCK(table, hash) (table)->ft_lock((table), (hash)) +#define FL_ENTRY_UNLOCK(table, hash) (table)->ft_unlock((table), (hash)) + +#define FL_STALE (1<<8) +#define FL_IPV6 (1<<9) + +static uint32_t +ipv4_flow_lookup_hash_internal(struct mbuf *m, struct route *ro, + uint32_t *key, uint16_t *flags, uint8_t *protop) +{ + uint16_t sport = 0, dport = 0; + struct ip *ip = NULL; + uint8_t proto = 0; + int iphlen; + uint32_t hash; + struct sockaddr_in *sin; + struct tcphdr *th; + struct udphdr *uh; + struct sctphdr *sh; + + if (flowtable_enable == 0) + return (0); + + key[1] = key[0] = 0; + sin = (struct sockaddr_in *)&ro->ro_dst; + if (m != NULL) { + ip = mtod(m, struct ip *); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_addr = ip->ip_dst; + } else + *flags &= ~FL_HASH_PORTS; + + key[2] = sin->sin_addr.s_addr; + + if ((*flags & FL_HASH_PORTS) == 0) + goto skipports; + + proto = ip->ip_p; + iphlen = ip->ip_hl << 2; /* XXX options? */ + key[1] = ip->ip_src.s_addr; + + switch (proto) { + case IPPROTO_TCP: + th = (struct tcphdr *)((caddr_t)ip + iphlen); + sport = ntohs(th->th_sport); + dport = ntohs(th->th_dport); + *flags |= th->th_flags; + if (*flags & TH_RST) + *flags |= FL_STALE; + break; + case IPPROTO_UDP: + uh = (struct udphdr *)((caddr_t)ip + iphlen); + sport = uh->uh_sport; + dport = uh->uh_dport; + break; + case IPPROTO_SCTP: + sh = (struct sctphdr *)((caddr_t)ip + iphlen); + sport = sh->src_port; + dport = sh->dest_port; + break; + default: + if (*flags & FL_HASH_PORTS) + goto noop; + /* no port - hence not a protocol we care about */ + break;; + + } + *protop = proto; + + /* + * If this is a transmit route cache then + * hash all flows to a given destination to + * the same bucket + */ + if ((*flags & FL_HASH_PORTS) == 0) + proto = sport = dport = 0; + + ((uint16_t *)key)[0] = sport; + ((uint16_t *)key)[1] = dport; + +skipports: + hash = hashword(key, 3, hashjitter + proto); + if (m != NULL && (m->m_flags & M_FLOWID) == 0) { + m->m_flags |= M_FLOWID; + m->m_pkthdr.flowid = hash; + } + + return (hash); +noop: + *protop = proto; + return (0); +} + +static bitstr_t * +flowtable_mask(struct flowtable *ft) +{ + bitstr_t *mask; + + if (ft->ft_flags & FL_PCPU) + mask = ft->ft_masks[curcpu]; + else + mask = ft->ft_masks[0]; + + return (mask); +} + +static struct flentry ** +flowtable_entry(struct flowtable *ft, uint32_t hash) +{ + struct flentry **fle; + int index = (hash % ft->ft_size); + + if (ft->ft_flags & FL_PCPU) { + KASSERT(&ft->ft_table.pcpu[curcpu][0] != NULL, ("pcpu not set")); + fle = &ft->ft_table.pcpu[curcpu][index]; + } else { + KASSERT(&ft->ft_table.global[0] != NULL, ("global not set")); + fle = &ft->ft_table.global[index]; + } + + return (fle); +} + +static int +flow_stale(struct flowtable *ft, struct flentry *fle) +{ + time_t idle_time; + + if ((fle->f_fhash == 0) + || ((fle->f_rt->rt_flags & RTF_HOST) && + ((fle->f_rt->rt_flags & (RTF_UP)) + != (RTF_UP))) + || (fle->f_rt->rt_ifp == NULL)) + return (1); + + idle_time = time_uptime - fle->f_uptime; + + if ((fle->f_flags & FL_STALE) || + ((fle->f_flags & (TH_SYN|TH_ACK|TH_FIN)) == 0 + && (idle_time > ft->ft_udp_idle)) || + ((fle->f_flags & TH_FIN) + && (idle_time > ft->ft_fin_wait_idle)) || + ((fle->f_flags & (TH_SYN|TH_ACK)) == TH_SYN + && (idle_time > ft->ft_syn_idle)) || + ((fle->f_flags & (TH_SYN|TH_ACK)) == (TH_SYN|TH_ACK) + && (idle_time > ft->ft_tcp_idle)) || + ((fle->f_rt->rt_flags & RTF_UP) == 0 || + (fle->f_rt->rt_ifp == NULL))) + return (1); + + return (0); +} + +static void +flowtable_set_hashkey(struct flentry *fle, uint32_t *key) +{ + uint32_t *hashkey; + int i, nwords; + + if (fle->f_flags & FL_IPV6) { + nwords = 9; + hashkey = ((struct flentry_v4 *)fle)->fl_flow.ipf_key; + } else { + nwords = 3; + hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key; + } + + for (i = 0; i < nwords; i++) + hashkey[i] = key[i]; +} + +static int +flowtable_insert(struct flowtable *ft, uint32_t hash, uint32_t *key, + uint8_t proto, struct route *ro, uint16_t flags) +{ + struct flentry *fle, *fletail, *newfle, **flep; + int depth; + uma_zone_t flezone; + bitstr_t *mask; + + flezone = (flags & FL_IPV6) ? ipv6_zone : ipv4_zone; + newfle = uma_zalloc(flezone, M_NOWAIT | M_ZERO); + if (newfle == NULL) + return (ENOMEM); + + newfle->f_flags |= (flags & FL_IPV6); + + FL_ENTRY_LOCK(ft, hash); + mask = flowtable_mask(ft); + flep = flowtable_entry(ft, hash); + fletail = fle = *flep; + + if (fle == NULL) { + bit_set(mask, FL_ENTRY_INDEX(ft, hash)); + *flep = fle = newfle; + goto skip; + } + + depth = 0; + flowtable_collisions++; + /* + * find end of list and make sure that we were not + * preempted by another thread handling this flow + */ + while (fle != NULL) { + if (fle->f_fhash == hash && !flow_stale(ft, fle)) { + /* + * there was either a hash collision + * or we lost a race to insert + */ + FL_ENTRY_UNLOCK(ft, hash); + uma_zfree((newfle->f_flags & FL_IPV6) ? + ipv6_zone : ipv4_zone, newfle); + return (EEXIST); + } + /* + * re-visit this double condition XXX + */ + if (fletail->f_next != NULL) + fletail = fle->f_next; + + depth++; + fle = fle->f_next; + } + + if (depth > flowtable_max_depth) + flowtable_max_depth = depth; + fletail->f_next = newfle; + fle = newfle; +skip: + flowtable_set_hashkey(fle, key); + + fle->f_proto = proto; + fle->f_rt = ro->ro_rt; + fle->f_lle = ro->ro_lle; + fle->f_fhash = hash; + fle->f_uptime = time_uptime; + FL_ENTRY_UNLOCK(ft, hash); + return (0); +} + +static int +flowtable_key_equal(struct flentry *fle, uint32_t *key) +{ + uint32_t *hashkey; + int i, nwords; + + if (fle->f_flags & FL_IPV6) { + nwords = 9; + hashkey = ((struct flentry_v4 *)fle)->fl_flow.ipf_key; + } else { + nwords = 3; + hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key; + } + + for (i = 0; i < nwords; i++) + if (hashkey[i] != key[i]) + return (0); + + return (1); +} + +int +flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro) +{ + uint32_t key[9], hash; + struct flentry *fle; + uint16_t flags; + uint8_t proto = 0; + int error = 0, fib = 0; + struct rtentry *rt; + struct llentry *lle; + + flags = ft->ft_flags; + ro->ro_rt = NULL; + ro->ro_lle = NULL; + + /* + * The internal hash lookup is the only IPv4 specific bit + * remaining + * + * XXX BZ: to add IPv6 support just add a check for the + * address type in m and ro and an equivalent ipv6 lookup + * function - the rest of the code should automatically + * handle an ipv6 flow (note that m can be NULL in which + * case ro will be set) + */ + hash = ipv4_flow_lookup_hash_internal(m, ro, key, + &flags, &proto); + + /* + * Ports are zero and this isn't a transmit cache + * - thus not a protocol for which we need to keep + * state + * FL_HASH_PORTS => key[0] != 0 for TCP || UDP || SCTP + */ + if (hash == 0 || (key[0] == 0 && (ft->ft_flags & FL_HASH_PORTS))) + return (ENOENT); + + flowtable_lookups++; + FL_ENTRY_LOCK(ft, hash); + if ((fle = FL_ENTRY(ft, hash)) == NULL) { + FL_ENTRY_UNLOCK(ft, hash); + goto uncached; + } +keycheck: + rt = __DEVOLATILE(struct rtentry *, fle->f_rt); + lle = __DEVOLATILE(struct llentry *, fle->f_lle); + if ((rt != NULL) + && fle->f_fhash == hash + && flowtable_key_equal(fle, key) + && (proto == fle->f_proto) + && (rt->rt_flags & RTF_UP) + && (rt->rt_ifp != NULL)) { + flowtable_hits++; + fle->f_uptime = time_uptime; + fle->f_flags |= flags; + ro->ro_rt = rt; + ro->ro_lle = lle; + FL_ENTRY_UNLOCK(ft, hash); + return (0); + } else if (fle->f_next != NULL) { + fle = fle->f_next; + goto keycheck; + } + FL_ENTRY_UNLOCK(ft, hash); + +uncached: + flowtable_misses++; + /* + * This bit of code ends up locking the + * same route 3 times (just like ip_output + ether_output) + * - at lookup + * - in rt_check when called by arpresolve + * - dropping the refcount for the rtentry + * + * This could be consolidated to one if we wrote a variant + * of arpresolve with an rt_check variant that expected to + * receive the route locked + */ + if (m != NULL) + fib = M_GETFIB(m); + + ft->ft_rtalloc(ro, hash, fib); + if (ro->ro_rt == NULL) + error = ENETUNREACH; + else { + struct llentry *lle = NULL; + struct sockaddr *l3addr; + struct rtentry *rt = ro->ro_rt; + struct ifnet *ifp = rt->rt_ifp; + + if (rt->rt_flags & RTF_GATEWAY) + l3addr = rt->rt_gateway; + else + l3addr = &ro->ro_dst; + llentry_update(&lle, LLTABLE(ifp), l3addr, ifp); + ro->ro_lle = lle; + + if (lle == NULL) { + RTFREE(rt); + ro->ro_rt = NULL; + return (ENOENT); + } + error = flowtable_insert(ft, hash, key, proto, + ro, flags); + + if (error) { + RTFREE(rt); + LLE_FREE(lle); + ro->ro_rt = NULL; + ro->ro_lle = NULL; + } + } + + return (error); +} + +/* + * used by the bit_alloc macro + */ +#define calloc(count, size) malloc((count)*(size), M_DEVBUF, M_WAITOK|M_ZERO) + +struct flowtable * +flowtable_alloc(int nentry, int flags) +{ + struct flowtable *ft, *fttail; + int i; + + if (hashjitter == 0) + hashjitter = arc4random(); + + KASSERT(nentry > 0, ("nentry must be > 0, is %d\n", nentry)); + + ft = malloc(sizeof(struct flowtable), + M_RTABLE, M_WAITOK | M_ZERO); + + ft->ft_flags = flags; + ft->ft_size = nentry; +#ifdef RADIX_MPATH + ft->ft_rtalloc = rtalloc_mpath_fib; +#else + ft->ft_rtalloc = in_rtalloc_ign_wrapper; +#endif + if (flags & FL_PCPU) { + ft->ft_lock = flowtable_pcpu_lock; + ft->ft_unlock = flowtable_pcpu_unlock; + + for (i = 0; i <= mp_maxid; i++) { + ft->ft_table.pcpu[i] = + malloc(nentry*sizeof(struct flentry *), + M_RTABLE, M_WAITOK | M_ZERO); + ft->ft_masks[i] = bit_alloc(nentry); + } + } else { + ft->ft_lock_count = 2*(powerof2(mp_maxid + 1) ? (mp_maxid + 1): + (fls(mp_maxid + 1) << 1)); + + ft->ft_lock = flowtable_global_lock; + ft->ft_unlock = flowtable_global_unlock; + ft->ft_table.global = + malloc(nentry*sizeof(struct flentry *), + M_RTABLE, M_WAITOK | M_ZERO); + ft->ft_locks = malloc(ft->ft_lock_count*sizeof(struct mtx), + M_RTABLE, M_WAITOK | M_ZERO); + for (i = 0; i < ft->ft_lock_count; i++) + mtx_init(&ft->ft_locks[i], "flow", NULL, MTX_DEF|MTX_DUPOK); + + ft->ft_masks[0] = bit_alloc(nentry); + } + + /* + * In the local transmit case the table truly is + * just a cache - so everything is eligible for + * replacement after 5s of non-use + */ + if (flags & FL_HASH_PORTS) { + ft->ft_udp_idle = flowtable_udp_expire; + ft->ft_syn_idle = flowtable_syn_expire; + ft->ft_fin_wait_idle = flowtable_fin_wait_expire; + ft->ft_tcp_idle = flowtable_fin_wait_expire; + } else { + ft->ft_udp_idle = ft->ft_fin_wait_idle = + ft->ft_syn_idle = ft->ft_tcp_idle = 30; + + } + /* + * hook in to the cleaner list + */ + if (flow_list_head == NULL) + flow_list_head = ft; + else { + fttail = flow_list_head; + while (fttail->ft_next != NULL) + fttail = fttail->ft_next; + fttail->ft_next = ft; + } + + return (ft); +} + +static void +flowtable_setup(void *arg) +{ + + ipv4_zone = uma_zcreate("ip4flow", sizeof(struct flentry_v4), NULL, + NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); + ipv6_zone = uma_zcreate("ip6flow", sizeof(struct flentry_v6), NULL, + NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); + uma_zone_set_max(ipv4_zone, nmbflows); + uma_zone_set_max(ipv6_zone, nmbflows); +} + +SYSINIT(flowtable_setup, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, flowtable_setup, NULL); + +/* + * The rest of the code is devoted to garbage collection of expired entries. + * It is a new additon made necessary by the switch to dynamically allocating + * flow tables. + * + */ +static void +fle_free(struct flentry *fle) +{ + struct rtentry *rt; + struct llentry *lle; + + rt = __DEVOLATILE(struct rtentry *, fle->f_rt); + lle = __DEVOLATILE(struct llentry *, fle->f_lle); + RTFREE(rt); + LLE_FREE(lle); + uma_zfree((fle->f_flags & FL_IPV6) ? ipv6_zone : ipv4_zone, fle); +} + +/* + * Find the next bit set where lastbit is the last bit index + * that was set, mask is a pointer to a uint8_t that stores + * the current temporary mask because the caller can't clear + * bits in name and the lookup granularity is 1 byte + * + * This could be improved (4x reduction in overhead) for the sparse + * case by replacing bit_ffs with a more efficient function that works + * at the 4-byte granularity and change *mask to a uint32_t + * + */ +static __inline int +bit_fns(bitstr_t *name, int nbits, int lastbit, uint8_t *mask) +{ + bitstr_t *bitstr_start = &name[lastbit/8]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 00:34:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14F381065675; Sun, 19 Apr 2009 00:34:35 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03BDC8FC15; Sun, 19 Apr 2009 00:34:35 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J0YYKi091445; Sun, 19 Apr 2009 00:34:34 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J0YYTG091443; Sun, 19 Apr 2009 00:34:34 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200904190034.n3J0YYTG091443@svn.freebsd.org> From: Alan Cox Date: Sun, 19 Apr 2009 00:34: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: r191256 - 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: Sun, 19 Apr 2009 00:34:35 -0000 Author: alc Date: Sun Apr 19 00:34:34 2009 New Revision: 191256 URL: http://svn.freebsd.org/changeset/base/191256 Log: Allow valid pages to be mapped for read access when they have a non-zero busy count. Only mappings that allow write access should be prevented by a non-zero busy count. (The prohibition on mapping pages for read access when they have a non- zero busy count originated in revision 1.202 of i386/i386/pmap.c when this code was a part of the pmap.) Reviewed by: tegge Modified: head/sys/vm/vm_fault.c head/sys/vm/vm_map.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Apr 19 00:16:04 2009 (r191255) +++ head/sys/vm/vm_fault.c Sun Apr 19 00:34:34 2009 (r191256) @@ -1027,7 +1027,6 @@ vm_fault_prefault(pmap_t pmap, vm_offset break; } if (((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) && - (m->busy == 0) && (m->flags & PG_FICTITIOUS) == 0) { vm_page_lock_queues(); Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Apr 19 00:16:04 2009 (r191255) +++ head/sys/vm/vm_map.c Sun Apr 19 00:34:34 2009 (r191256) @@ -1683,8 +1683,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offse psize = tmpidx; break; } - if ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL && - (p->busy == 0)) { + if ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) { if (p_start == NULL) { start = addr + ptoa(tmpidx); p_start = p; From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 04:24:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49C82106566B; Sun, 19 Apr 2009 04:24:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 393398FC12; Sun, 19 Apr 2009 04:24:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J4OvbK097814; Sun, 19 Apr 2009 04:24:57 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J4Ovpe097813; Sun, 19 Apr 2009 04:24:57 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904190424.n3J4Ovpe097813@svn.freebsd.org> From: Kip Macy Date: Sun, 19 Apr 2009 04:24: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: r191257 - 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: Sun, 19 Apr 2009 04:24:57 -0000 Author: kmacy Date: Sun Apr 19 04:24:56 2009 New Revision: 191257 URL: http://svn.freebsd.org/changeset/base/191257 Log: - put larger flowtable members at the end - fix bug where tail pointer of the free list would not get advanced - clear entry's next pointer when it is added to the freelist to avoid freeing an entry that it still points to Modified: head/sys/net/flowtable.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Sun Apr 19 00:34:34 2009 (r191256) +++ head/sys/net/flowtable.c Sun Apr 19 04:24:56 2009 (r191257) @@ -282,14 +282,12 @@ union flentryp { }; struct flowtable { - union flentryp ft_table; int ft_size; - bitstr_t *ft_masks[MAXCPU]; - struct mtx *ft_locks; int ft_lock_count; uint32_t ft_flags; uint32_t ft_collisions; uint32_t ft_allocated; + uint32_t ft_misses; uint64_t ft_hits; uint32_t ft_udp_idle; @@ -300,8 +298,11 @@ struct flowtable { fl_lock_t *ft_lock; fl_lock_t *ft_unlock; fl_rtalloc_t *ft_rtalloc; + struct mtx *ft_locks; struct flowtable *ft_next; + union flentryp ft_table; + bitstr_t *ft_masks[MAXCPU]; }; static struct proc *flowcleanerproc; @@ -991,10 +992,11 @@ flowtable_free_stale(struct flowtable *f flefreehead = flefreetail = NULL; mask = flowtable_mask(ft); while ((curbit = bit_fns(mask, ft->ft_size, curbit, &mask_tmp)) != -1) { - if (curbit >= ft->ft_size) { - log(LOG_DEBUG, - "warning curbit=%d exceeds ft_size\n", + if (curbit >= ft->ft_size || curbit < -1) { + log(LOG_ALERT, + "warning: bad curbit value %d \n", curbit); + break; } FL_ENTRY_LOCK(ft, curbit); @@ -1002,14 +1004,13 @@ flowtable_free_stale(struct flowtable *f fle = fleprev = *flehead; flowtable_free_checks++; -#ifdef DIAGNOSTICS +#ifdef DIAGNOSTIC if (fle == NULL && curbit > 0) { - log(LOG_DEBUG, - "warning bit=%d set, but no fle found index=%d p=%p index=%d p=%p\n", - curbit, curbit-1, FL_ENTRY(ft, curbit - 1), - curbit+1, FL_ENTRY(ft, curbit + 1)); + log(LOG_ALERT, + "warning bit=%d set, but no fle found\n", + curbit); } -#endif +#endif while (fle != NULL) { if (!flow_stale(ft, fle)) { fleprev = fle; @@ -1037,8 +1038,11 @@ flowtable_free_stale(struct flowtable *f if (flefreehead == NULL) flefreehead = flefreetail = fletmp; - else + else { flefreetail->f_next = fletmp; + flefreetail = fletmp; + } + fletmp->f_next = NULL; } if (*flehead == NULL) bit_clear(mask, curbit); From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 04:39:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4B58106566C; Sun, 19 Apr 2009 04:39:42 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4EFA8FC1B; Sun, 19 Apr 2009 04:39:42 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J4dgYL098200; Sun, 19 Apr 2009 04:39:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J4dgkn098199; Sun, 19 Apr 2009 04:39:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904190439.n3J4dgkn098199@svn.freebsd.org> From: Kip Macy Date: Sun, 19 Apr 2009 04:39: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: r191258 - 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: Sun, 19 Apr 2009 04:39:43 -0000 Author: kmacy Date: Sun Apr 19 04:39:42 2009 New Revision: 191258 URL: http://svn.freebsd.org/changeset/base/191258 Log: update TODO list Modified: head/sys/net/flowtable.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Sun Apr 19 04:24:56 2009 (r191257) +++ head/sys/net/flowtable.c Sun Apr 19 04:39:42 2009 (r191258) @@ -313,8 +313,11 @@ static uma_zone_t ipv6_zone; /* * TODO: - * - Add per flowtable sysctls for statistics and configuring timeouts + * - Make flowtable stats per-cpu, aggregated at sysctl call time, + * to avoid extra cache evictions caused by incrementing a shared + * counter * - add IPv6 support to flow lookup + * - Add per flowtable sysctls for statistics and configuring timeouts * - add saturation counter to rtentry to support per-packet load-balancing * add flag to indicate round-robin flow, add list lookup from head for flows From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 04:44:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31644106566C; Sun, 19 Apr 2009 04:44:06 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 210118FC15; Sun, 19 Apr 2009 04:44:06 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J4i6OM098365; Sun, 19 Apr 2009 04:44:06 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J4i5wF098362; Sun, 19 Apr 2009 04:44:05 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904190444.n3J4i5wF098362@svn.freebsd.org> From: Kip Macy Date: Sun, 19 Apr 2009 04:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191259 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 04:44:06 -0000 Author: kmacy Date: Sun Apr 19 04:44:05 2009 New Revision: 191259 URL: http://svn.freebsd.org/changeset/base/191259 Log: - Allocate a small flowtable in ip_input.c (changeable by tuneable) - Use for accelerating ip_output Modified: head/sys/netinet/ip_input.c head/sys/netinet/ip_output.c head/sys/netinet/vinet.h Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Sun Apr 19 04:39:42 2009 (r191258) +++ head/sys/netinet/ip_input.c Sun Apr 19 04:44:05 2009 (r191259) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -211,6 +212,11 @@ SYSCTL_INT(_net_inet_ip, IPCTL_DEFMTU, m SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, stealth, CTLFLAG_RW, ipstealth, 0, "IP stealth mode, no TTL decrementation on forwarding"); #endif +static int ip_output_flowtable_size = 2048; +TUNABLE_INT("net.inet.ip.output_flowtable_size", &ip_output_flowtable_size); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, output_flowtable_size, + CTLFLAG_RDTUN, ip_output_flowtable_size, 2048, + "number of entries in the per-cpu output flow caches"); /* * ipfw_ether and ipfw_bridge hooks. @@ -221,6 +227,7 @@ ip_dn_io_t *ip_dn_io_ptr = NULL; #ifdef VIMAGE_GLOBALS int fw_one_pass; #endif +struct flowtable *ip_ft; static void ip_freef(struct ipqhead *, struct ipq *); @@ -342,6 +349,8 @@ ip_init(void) ipintrq.ifq_maxlen = ipqmaxlen; mtx_init(&ipintrq.ifq_mtx, "ip_inq", NULL, MTX_DEF); netisr_register(NETISR_IP, ip_input, &ipintrq, 0); + + ip_ft = flowtable_alloc(ip_output_flowtable_size, FL_PCPU); } void Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Sun Apr 19 04:39:42 2009 (r191258) +++ head/sys/netinet/ip_output.c Sun Apr 19 04:44:05 2009 (r191259) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef RADIX_MPATH #include #endif @@ -135,6 +136,7 @@ ip_output(struct mbuf *m, struct mbuf *o int hlen = sizeof (struct ip); int mtu; int len, error = 0; + int nortfree = 0; struct sockaddr_in *dst = NULL; /* keep compiler happy */ struct in_ifaddr *ia = NULL; int isbroadcast, sw_csum; @@ -158,6 +160,10 @@ ip_output(struct mbuf *m, struct mbuf *o m->m_flags |= M_FLOWID; } } + if ((ro == &iproute) && (ro->ro_rt == NULL) && (ro->ro_lle == NULL)) { + if (flowtable_lookup(ip_ft, m, ro) == 0) + nortfree = 1; + } if (opt) { len = 0; @@ -199,7 +205,8 @@ again: if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || dst->sin_family != AF_INET || dst->sin_addr.s_addr != ip->ip_dst.s_addr)) { - RTFREE(ro->ro_rt); + if (!nortfree) + RTFREE(ro->ro_rt); ro->ro_rt = (struct rtentry *)NULL; } #ifdef IPFIREWALL_FORWARD @@ -638,7 +645,7 @@ passout: IPSTAT_INC(ips_fragmented); done: - if (ro == &iproute && ro->ro_rt) { + if (ro == &iproute && ro->ro_rt && !nortfree) { RTFREE(ro->ro_rt); } return (error); Modified: head/sys/netinet/vinet.h ============================================================================== --- head/sys/netinet/vinet.h Sun Apr 19 04:39:42 2009 (r191258) +++ head/sys/netinet/vinet.h Sun Apr 19 04:44:05 2009 (r191259) @@ -72,6 +72,7 @@ struct vnet_inet { int _ip_sendsourcequench; int _ip_do_randomid; int _ip_checkinterface; + int _ip_output_flowtable_size; u_short _ip_id; uma_zone_t _ipq_zone; From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 05:34:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E94FF1065670; Sun, 19 Apr 2009 05:34:07 +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 CDF928FC13; Sun, 19 Apr 2009 05:34:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J5Y7pH099625; Sun, 19 Apr 2009 05:34:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J5Y701099624; Sun, 19 Apr 2009 05:34:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200904190534.n3J5Y701099624@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 19 Apr 2009 05:34: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: r191260 - 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: Sun, 19 Apr 2009 05:34:08 -0000 Author: kib Date: Sun Apr 19 05:34:07 2009 New Revision: 191260 URL: http://svn.freebsd.org/changeset/base/191260 Log: When verifying '..' after VFS_VGET() in ufs_lookup(), do not return error if '..' is still there but changed between lookup and check. Start relookup instead. Rename is supposed to change '..' reference atomically, so transient failures introduced by r191137 are wrong. While rearranging the code to allow lookup restart in ufs_lookup(), remove the comment that only distracts the reader. Noted and reviewed by: tegge Also reported by: pho MFC after: 1 month Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Sun Apr 19 04:44:05 2009 (r191259) +++ head/sys/ufs/ufs/ufs_lookup.c Sun Apr 19 05:34:07 2009 (r191260) @@ -78,7 +78,7 @@ SYSCTL_INT(_debug, OID_AUTO, dircheck, C #define OFSFMT(vp) ((vp)->v_mount->mnt_maxsymlinklen <= 0) static int ufs_lookup_(struct vnode *, struct vnode **, struct componentname *, - ino_t); + ino_t *); /* * Convert a component of a pathname into a pointer to a locked inode. @@ -134,12 +134,12 @@ ufs_lookup(ap) } */ *ap; { - return (ufs_lookup_(ap->a_dvp, ap->a_vpp, ap->a_cnp, 0)); + return (ufs_lookup_(ap->a_dvp, ap->a_vpp, ap->a_cnp, NULL)); } static int ufs_lookup_(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp, - ino_t dd_ino) + ino_t *dd_ino) { struct inode *dp; /* inode for directory being searched */ struct buf *bp; /* a buffer of directory entries */ @@ -163,15 +163,9 @@ ufs_lookup_(struct vnode *vdp, struct vn struct ucred *cred = cnp->cn_cred; int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; - ino_t ino; + ino_t ino, ino1; int ltype; - bp = NULL; - slotoffset = -1; -/* - * XXX there was a soft-update diff about this I couldn't merge. - * I think this was the equiv. - */ if (vpp != NULL) *vpp = NULL; @@ -185,6 +179,12 @@ ufs_lookup_(struct vnode *vdp, struct vn */ vnode_create_vobject(vdp, DIP(dp, i_size), cnp->cn_thread); + bmask = VFSTOUFS(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1; + +restart: + bp = NULL; + slotoffset = -1; + /* * We now have a segment name to search for, and a directory to search. * @@ -202,7 +202,6 @@ ufs_lookup_(struct vnode *vdp, struct vn slotstatus = NONE; slotneeded = DIRECTSIZ(cnp->cn_namelen); } - bmask = VFSTOUFS(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1; #ifdef UFS_DIRHASH /* @@ -487,9 +486,8 @@ found: if ((flags & ISLASTCN) && nameiop == LOOKUP) dp->i_diroff = i_offset &~ (DIRBLKSIZ - 1); - if (dd_ino != 0) { - if (ino != dd_ino) - return (ENOENT); + if (dd_ino != NULL) { + *dd_ino = ino; return (0); } @@ -600,11 +598,15 @@ found: * to the inode we looked up before vdp lock was * dropped. */ - error = ufs_lookup_(pdp, NULL, cnp, ino); + error = ufs_lookup_(pdp, NULL, cnp, &ino1); if (error) { vput(tdp); return (error); } + if (ino1 != ino) { + vput(tdp); + goto restart; + } *vpp = tdp; } else if (dp->i_number == ino) { From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 06:30:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53471106566B; Sun, 19 Apr 2009 06:30:01 +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 3F34B8FC18; Sun, 19 Apr 2009 06:30:01 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J6U1nw001242; Sun, 19 Apr 2009 06:30:01 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J6U14U001240; Sun, 19 Apr 2009 06:30:01 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200904190630.n3J6U14U001240@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 19 Apr 2009 06:30: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: r191261 - in head/sys/powerpc: aim include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 06:30:01 -0000 Author: nwhitehorn Date: Sun Apr 19 06:30:00 2009 New Revision: 191261 URL: http://svn.freebsd.org/changeset/base/191261 Log: Fix a typo in the SRR1 comparison for program exceptions. While here, replace magic numbers with constants to keep this from happening again. Without this fix, some programs would occasionally get SIGTRAP instead of SIGILL on an illegal instruction. This affected Altivec detection in pixman, and possibly other software. Reported by: Andreas Tobler MFC after: 1 week Modified: head/sys/powerpc/aim/trap.c head/sys/powerpc/include/trap_aim.h Modified: head/sys/powerpc/aim/trap.c ============================================================================== --- head/sys/powerpc/aim/trap.c Sun Apr 19 05:34:07 2009 (r191260) +++ head/sys/powerpc/aim/trap.c Sun Apr 19 06:30:00 2009 (r191261) @@ -208,9 +208,8 @@ trap(struct trapframe *frame) break; case EXC_PGM: - /* XXX temporarily */ - /* XXX: Magic Number? */ - if (frame->srr1 & 0x0002000) + /* Identify the trap reason */ + if (frame->srr1 & EXC_PGM_TRAP) sig = SIGTRAP; else sig = SIGILL; Modified: head/sys/powerpc/include/trap_aim.h ============================================================================== --- head/sys/powerpc/include/trap_aim.h Sun Apr 19 05:34:07 2009 (r191260) +++ head/sys/powerpc/include/trap_aim.h Sun Apr 19 06:30:00 2009 (r191261) @@ -103,4 +103,15 @@ #define EXC_ALI_RST(dsisr) ((dsisr >> 5) & 0x1f) /* source or target */ #define EXC_ALI_RA(dsisr) (dsisr & 0x1f) +/* + * SRR1 bits for program exception traps. These identify what caused + * the program exception. See section 6.5.9 of the Power ISA Version + * 2.05. + */ + +#define EXC_PGM_FPENABLED (1UL << 20) +#define EXC_PGM_ILLEGAL (1UL << 19) +#define EXC_PGM_PRIV (1UL << 18) +#define EXC_PGM_TRAP (1UL << 17) + #endif /* _POWERPC_TRAP_H_ */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 06:59:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01708106566B; Sun, 19 Apr 2009 06:59:13 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E41108FC12; Sun, 19 Apr 2009 06:59:12 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J6xCBR001859; Sun, 19 Apr 2009 06:59:12 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J6xCBl001857; Sun, 19 Apr 2009 06:59:12 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904190659.n3J6xCBl001857@svn.freebsd.org> From: Tim Kientzle Date: Sun, 19 Apr 2009 06:59: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: r191262 - head/usr.bin/cpio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 06:59:13 -0000 Author: kientzle Date: Sun Apr 19 06:59:12 2009 New Revision: 191262 URL: http://svn.freebsd.org/changeset/base/191262 Log: When compiled for the release crunches, be a bit more selective about what libarchive features we pull in: * No compression support * Only cpio and ustar writing * Only cpio and tar/pax readers This reduces a statically linked, stripped binary from 900k to 680k and completely eliminates the dependency on libcrypto. Modified: head/usr.bin/cpio/Makefile head/usr.bin/cpio/cpio.c Modified: head/usr.bin/cpio/Makefile ============================================================================== --- head/usr.bin/cpio/Makefile Sun Apr 19 06:30:00 2009 (r191261) +++ head/usr.bin/cpio/Makefile Sun Apr 19 06:59:12 2009 (r191262) @@ -9,6 +9,11 @@ WARNS?= 6 DPADD= ${LIBARCHIVE} ${LIBZ} ${LIBBZ2} CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_STRING}\" CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" +.ifdef RELEASE_CRUNCH +# FreeBSD's installer uses cpio in crunched binaries that are +# statically linked, cannot use -lcrypto, and are size sensitive. +CFLAGS+= -DSMALLER +.endif LDADD+= -larchive -lz -lbz2 -lmd .if ${MK_OPENSSL} != "no" LDADD+= -lcrypto Modified: head/usr.bin/cpio/cpio.c ============================================================================== --- head/usr.bin/cpio/cpio.c Sun Apr 19 06:30:00 2009 (r191261) +++ head/usr.bin/cpio/cpio.c Sun Apr 19 06:59:12 2009 (r191262) @@ -461,24 +461,37 @@ mode_out(struct cpio *cpio) if (cpio->archive == NULL) cpio_errc(1, 0, "Failed to allocate archive object"); switch (cpio->compress) { -#ifdef HAVE_BZLIB_H +#ifndef SMALLER case 'j': case 'y': - archive_write_set_compression_bzip2(cpio->archive); + r = archive_write_set_compression_bzip2(cpio->archive); break; -#endif -#ifdef HAVE_ZLIB_H case 'z': - archive_write_set_compression_gzip(cpio->archive); + r = archive_write_set_compression_gzip(cpio->archive); break; -#endif case 'Z': - archive_write_set_compression_compress(cpio->archive); + r = archive_write_set_compression_compress(cpio->archive); break; - default: - archive_write_set_compression_none(cpio->archive); +#endif + case '\0': + r = archive_write_set_compression_none(cpio->archive); break; + default: + cpio_errc(1, 0, "Unrecognized compression option"); } + if (r != ARCHIVE_OK) + cpio_errc(1, 0, "Unsupported compression format"); +#ifdef SMALLER + if (strcmp(cpio->format, "cpio")) + r = archive_write_set_format_cpio(cpio->archive); + else if (strcmp(cpio->format, "odc")) + r = archive_write_set_format_cpio(cpio->archive); + else if (strcmp(cpio->format, "newc")) + r = archive_write_set_format_cpio(cpio->archive); + else if (strcmp(cpio->format, "ustar")) + r = archive_write_set_format_cpio(cpio->archive); +#else r = archive_write_set_format_by_name(cpio->archive, cpio->format); +#endif if (r != ARCHIVE_OK) cpio_errc(1, 0, archive_error_string(cpio->archive)); archive_write_set_bytes_per_block(cpio->archive, cpio->bytes_per_block); @@ -815,8 +828,13 @@ mode_in(struct cpio *cpio) a = archive_read_new(); if (a == NULL) cpio_errc(1, 0, "Couldn't allocate archive object"); +#ifdef SMALLER + archive_read_support_format_cpio(a); + archive_read_support_format_tar(a); +#else archive_read_support_compression_all(a); archive_read_support_format_all(a); +#endif if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block)) cpio_errc(1, archive_errno(a), @@ -907,8 +925,13 @@ mode_list(struct cpio *cpio) a = archive_read_new(); if (a == NULL) cpio_errc(1, 0, "Couldn't allocate archive object"); +#ifdef SMALLER + archive_read_support_format_cpio(a); + archive_read_support_format_tar(a); +#else archive_read_support_compression_all(a); archive_read_support_format_all(a); +#endif if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block)) cpio_errc(1, archive_errno(a), From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 07:18:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B564A106566B; Sun, 19 Apr 2009 07:18:08 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A45DE8FC14; Sun, 19 Apr 2009 07:18:08 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J7I8Ci002249; Sun, 19 Apr 2009 07:18:08 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J7I8W4002248; Sun, 19 Apr 2009 07:18:08 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200904190718.n3J7I8W4002248@svn.freebsd.org> From: Alan Cox Date: Sun, 19 Apr 2009 07:18: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: r191263 - 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: Sun, 19 Apr 2009 07:18:09 -0000 Author: alc Date: Sun Apr 19 07:18:08 2009 New Revision: 191263 URL: http://svn.freebsd.org/changeset/base/191263 Log: Calling pmap_clear_modify() after calling pmap_remove_write() is pointless. The latter function already clears the modified status from each of the page's mappings. Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sun Apr 19 06:59:12 2009 (r191262) +++ head/sys/vm/vm_pageout.c Sun Apr 19 07:18:08 2009 (r191263) @@ -462,7 +462,6 @@ vm_pageout_flush(vm_page_t *mc, int coun * essentially lose the changes by pretending it * worked. */ - pmap_clear_modify(mt); vm_page_undirty(mt); break; case VM_PAGER_ERROR: From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 08:14:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89598106566C; Sun, 19 Apr 2009 08:14:21 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 773CE8FC14; Sun, 19 Apr 2009 08:14:21 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J8ELrh003327; Sun, 19 Apr 2009 08:14:21 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J8ELqk003326; Sun, 19 Apr 2009 08:14:21 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200904190814.n3J8ELqk003326@svn.freebsd.org> From: Bruce M Simpson Date: Sun, 19 Apr 2009 08:14: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: r191264 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 08:14:21 -0000 Author: bms Date: Sun Apr 19 08:14:21 2009 New Revision: 191264 URL: http://svn.freebsd.org/changeset/base/191264 Log: Now that IFF_NEEDSGIANT has been removed from the network stack, catch up with this in IGMPv3 and remove dead code. This has the side-effect of not being back-portable to RELENG_7 w/o further changes. Modified: head/sys/netinet/igmp.c Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Sun Apr 19 07:18:08 2009 (r191263) +++ head/sys/netinet/igmp.c Sun Apr 19 08:14:21 2009 (r191264) @@ -161,8 +161,8 @@ static int vnet_igmp_idetach(const void * * The permitted lock order is: IN_MULTI_LOCK, IGMP_LOCK, IF_ADDR_LOCK. * Any may be taken independently; if any are held at the same * time, the above lock order must be followed. - * * All output is delegated to the netisr to handle IFF_NEEDSGIANT. - * Most of the time, direct dispatch will be fine. + * * All output is delegated to the netisr. + * Now that Giant has been eliminated, the netisr may be inlined. * * IN_MULTI_LOCK covers in_multi. * * IGMP_LOCK covers igmp_ifinfo and any global variables in this file, * including the output queue. @@ -190,19 +190,12 @@ static int vnet_igmp_idetach(const void * So check for ifma_protospec being NULL before proceeding. */ struct mtx igmp_mtx; -int mpsafe_igmp = 0; -SYSCTL_INT(_debug, OID_AUTO, mpsafe_igmp, CTLFLAG_RDTUN, &mpsafe_igmp, 0, - "Enable SMP-safe IGMPv3"); struct mbuf *m_raopt; /* Router Alert option */ MALLOC_DEFINE(M_IGMP, "igmp", "igmp state"); /* * Global netisr output queue. - * This is only used as a last resort if we cannot directly dispatch. - * As IN_MULTI_LOCK is no longer in the bottom half of IP, we can do - * this, providing mpsafe_igmp is set. If it is not, we take Giant, - * and queueing is forced. */ struct ifqueue igmpoq; @@ -656,32 +649,6 @@ igmp_ifdetach(struct ifnet *ifp) IGMP_UNLOCK(); -#ifdef VIMAGE - /* - * Plug the potential race which may occur when a VIMAGE - * is detached and we are forced to queue pending IGMP output for - * output netisr processing due to !mpsafe_igmp. In this case it - * is possible that igmp_intr() is about to see mbuf chains with - * invalid cached curvnet pointers. - * This is a rare condition, so just blow them all away. - * FUTURE: This may in fact not be needed, because IFF_NEEDSGIANT - * is being removed in 8.x and the netisr may then be eliminated; - * it is needed only if VIMAGE and IFF_NEEDSGIANT need to co-exist - */ - if (!mpsafe_igmp) { - int drops; - - IF_LOCK(&igmpoq); - drops = igmpoq.ifq_len; - _IF_DRAIN(&igmpoq); - IF_UNLOCK(&igmpoq); - if (bootverbose && drops) { - printf("%s: dropped %d pending IGMP output packets\n", - __func__, drops); - } - } -#endif /* VIMAGE */ - CURVNET_RESTORE(); } @@ -1659,9 +1626,6 @@ igmp_fasttimo_vnet(void) !V_state_change_timers_running) return; - if (!mpsafe_igmp) - mtx_lock(&Giant); - IN_MULTI_LOCK(); IGMP_LOCK(); @@ -1754,8 +1718,6 @@ igmp_fasttimo_vnet(void) out_locked: IGMP_UNLOCK(); IN_MULTI_UNLOCK(); - if (!mpsafe_igmp) - mtx_unlock(&Giant); } /* @@ -3580,20 +3542,13 @@ igmp_sysinit(void) CTR1(KTR_IGMPV3, "%s: initializing", __func__); IGMP_LOCK_INIT(); - TUNABLE_INT_FETCH("debug.mpsafeigmp", &mpsafe_igmp); mtx_init(&igmpoq.ifq_mtx, "igmpoq_mtx", NULL, MTX_DEF); IFQ_SET_MAXLEN(&igmpoq, IFQ_MAXLEN); m_raopt = igmp_ra_alloc(); -#if __FreeBSD_version < 800000 - netisr_register(NETISR_IGMP, igmp_intr, &igmpoq, - mpsafe_igmp ? NETISR_MPSAFE : 0); -#else - netisr_register(NETISR_IGMP, igmp_intr, &igmpoq, - mpsafe_igmp ? 0 : NETISR_FORCEQUEUE); -#endif + netisr_register(NETISR_IGMP, igmp_intr, &igmpoq, 0); } static void From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 08:31:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79E8A1065674; Sun, 19 Apr 2009 08:31:55 +0000 (UTC) (envelope-from blackend@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67D038FC12; Sun, 19 Apr 2009 08:31:55 +0000 (UTC) (envelope-from blackend@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J8VttJ003783; Sun, 19 Apr 2009 08:31:55 GMT (envelope-from blackend@svn.freebsd.org) Received: (from blackend@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J8VtfF003782; Sun, 19 Apr 2009 08:31:55 GMT (envelope-from blackend@svn.freebsd.org) Message-Id: <200904190831.n3J8VtfF003782@svn.freebsd.org> From: Marc Fonvieille Date: Sun, 19 Apr 2009 08:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191265 - head/usr.sbin/sysinstall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 08:31:55 -0000 Author: blackend (doc committer) Date: Sun Apr 19 08:31:55 2009 New Revision: 191265 URL: http://svn.freebsd.org/changeset/base/191265 Log: Add docs category. MFC after: 3 days Modified: head/usr.sbin/sysinstall/index.c Modified: head/usr.sbin/sysinstall/index.c ============================================================================== --- head/usr.sbin/sysinstall/index.c Sun Apr 19 08:14:21 2009 (r191264) +++ head/usr.sbin/sysinstall/index.c Sun Apr 19 08:31:55 2009 (r191265) @@ -93,6 +93,7 @@ static char *descrs[] = { "deskutils", "Various Desktop utilities.", "devel", "Software development utilities and libraries.", "dns", "Domain Name Service tools.", + "docs", "Meta-ports for FreeBSD documentation.", "editors", "Editors.", "elisp", "Things related to Emacs Lisp.", "emulators", "Utilities for emulating other operating systems.", From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 09:19:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F250106566B; Sun, 19 Apr 2009 09:19:28 +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 BCC4E8FC16; Sun, 19 Apr 2009 09:19:27 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 6D9BA46B5C; Sun, 19 Apr 2009 05:19:27 -0400 (EDT) Date: Sun, 19 Apr 2009 10:19:27 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Kip Macy In-Reply-To: <200904190444.n3J4i5wF098362@svn.freebsd.org> Message-ID: References: <200904190444.n3J4i5wF098362@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: r191259 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 09:19:28 -0000 On Sun, 19 Apr 2009, Kip Macy wrote: > Author: kmacy > Date: Sun Apr 19 04:44:05 2009 > New Revision: 191259 > URL: http://svn.freebsd.org/changeset/base/191259 > > Log: > - Allocate a small flowtable in ip_input.c (changeable by tuneable) > - Use for accelerating ip_output If you anticipate the flowtable being used with many types, I wonder if the flowtable sysctl to enable/disable it by policy should be on the consumer side, rather than the producer side? That way you could say "use the flowtable for ipv4 and ipv6 but not ipx", which might well be helpful for debugging when adding flowtable support for those protocols. Also, is it the case that when the flowtable is disabled, it isn't allocated, or is the basic table always allocated regardless of policy? Robert N M Watson Computer Laboratory University of Cambridge > > Modified: > head/sys/netinet/ip_input.c > head/sys/netinet/ip_output.c > head/sys/netinet/vinet.h > > Modified: head/sys/netinet/ip_input.c > ============================================================================== > --- head/sys/netinet/ip_input.c Sun Apr 19 04:39:42 2009 (r191258) > +++ head/sys/netinet/ip_input.c Sun Apr 19 04:44:05 2009 (r191259) > @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > > #include > #include > @@ -211,6 +212,11 @@ SYSCTL_INT(_net_inet_ip, IPCTL_DEFMTU, m > SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, stealth, CTLFLAG_RW, > ipstealth, 0, "IP stealth mode, no TTL decrementation on forwarding"); > #endif > +static int ip_output_flowtable_size = 2048; > +TUNABLE_INT("net.inet.ip.output_flowtable_size", &ip_output_flowtable_size); > +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, output_flowtable_size, > + CTLFLAG_RDTUN, ip_output_flowtable_size, 2048, > + "number of entries in the per-cpu output flow caches"); > > /* > * ipfw_ether and ipfw_bridge hooks. > @@ -221,6 +227,7 @@ ip_dn_io_t *ip_dn_io_ptr = NULL; > #ifdef VIMAGE_GLOBALS > int fw_one_pass; > #endif > +struct flowtable *ip_ft; > > static void ip_freef(struct ipqhead *, struct ipq *); > > @@ -342,6 +349,8 @@ ip_init(void) > ipintrq.ifq_maxlen = ipqmaxlen; > mtx_init(&ipintrq.ifq_mtx, "ip_inq", NULL, MTX_DEF); > netisr_register(NETISR_IP, ip_input, &ipintrq, 0); > + > + ip_ft = flowtable_alloc(ip_output_flowtable_size, FL_PCPU); > } > > void > > Modified: head/sys/netinet/ip_output.c > ============================================================================== > --- head/sys/netinet/ip_output.c Sun Apr 19 04:39:42 2009 (r191258) > +++ head/sys/netinet/ip_output.c Sun Apr 19 04:44:05 2009 (r191259) > @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #ifdef RADIX_MPATH > #include > #endif > @@ -135,6 +136,7 @@ ip_output(struct mbuf *m, struct mbuf *o > int hlen = sizeof (struct ip); > int mtu; > int len, error = 0; > + int nortfree = 0; > struct sockaddr_in *dst = NULL; /* keep compiler happy */ > struct in_ifaddr *ia = NULL; > int isbroadcast, sw_csum; > @@ -158,6 +160,10 @@ ip_output(struct mbuf *m, struct mbuf *o > m->m_flags |= M_FLOWID; > } > } > + if ((ro == &iproute) && (ro->ro_rt == NULL) && (ro->ro_lle == NULL)) { > + if (flowtable_lookup(ip_ft, m, ro) == 0) > + nortfree = 1; > + } > > if (opt) { > len = 0; > @@ -199,7 +205,8 @@ again: > if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || > dst->sin_family != AF_INET || > dst->sin_addr.s_addr != ip->ip_dst.s_addr)) { > - RTFREE(ro->ro_rt); > + if (!nortfree) > + RTFREE(ro->ro_rt); > ro->ro_rt = (struct rtentry *)NULL; > } > #ifdef IPFIREWALL_FORWARD > @@ -638,7 +645,7 @@ passout: > IPSTAT_INC(ips_fragmented); > > done: > - if (ro == &iproute && ro->ro_rt) { > + if (ro == &iproute && ro->ro_rt && !nortfree) { > RTFREE(ro->ro_rt); > } > return (error); > > Modified: head/sys/netinet/vinet.h > ============================================================================== > --- head/sys/netinet/vinet.h Sun Apr 19 04:39:42 2009 (r191258) > +++ head/sys/netinet/vinet.h Sun Apr 19 04:44:05 2009 (r191259) > @@ -72,6 +72,7 @@ struct vnet_inet { > int _ip_sendsourcequench; > int _ip_do_randomid; > int _ip_checkinterface; > + int _ip_output_flowtable_size; > u_short _ip_id; > > uma_zone_t _ipq_zone; > From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 09:56:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D18D1065672; Sun, 19 Apr 2009 09:56:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B0468FC16; Sun, 19 Apr 2009 09:56:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3J9uV6S005527; Sun, 19 Apr 2009 09:56:31 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3J9uUbI005526; Sun, 19 Apr 2009 09:56:31 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200904190956.n3J9uUbI005526@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 19 Apr 2009 09:56: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: r191266 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 09:56:31 -0000 Author: trasz Date: Sun Apr 19 09:56:30 2009 New Revision: 191266 URL: http://svn.freebsd.org/changeset/base/191266 Log: When allocating 'struct acl' instances, use malloc(9) instead of uma(9). This struct will get much bigger soon, and we don't want to waste too much memory on UMA caches. Reviewed by: rwatson Modified: head/sys/kern/vfs_acl.c Modified: head/sys/kern/vfs_acl.c ============================================================================== --- head/sys/kern/vfs_acl.c Sun Apr 19 08:31:55 2009 (r191265) +++ head/sys/kern/vfs_acl.c Sun Apr 19 09:56:30 2009 (r191266) @@ -56,9 +56,8 @@ __FBSDID("$FreeBSD$"); #include -#include +static MALLOC_DEFINE(M_ACL, "acl", "Access Control Lists"); -uma_zone_t acl_zone; static int vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type, struct acl *aclp); static int vacl_get_acl(struct thread *td, struct vnode *vp, @@ -430,7 +429,7 @@ acl_alloc(int flags) { struct acl *aclp; - aclp = uma_zalloc(acl_zone, flags); + aclp = malloc(sizeof(*aclp), M_ACL, flags); return (aclp); } @@ -439,16 +438,5 @@ void acl_free(struct acl *aclp) { - uma_zfree(acl_zone, aclp); + free(aclp, M_ACL); } - -/* ARGUSED */ - -static void -aclinit(void *dummy __unused) -{ - - acl_zone = uma_zcreate("ACL UMA zone", sizeof(struct acl), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); -} -SYSINIT(acls, SI_SUB_ACL, SI_ORDER_FIRST, aclinit, NULL); From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 10:44:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 514151065675 for ; Sun, 19 Apr 2009 10:44:50 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 802DD8FC14 for ; Sun, 19 Apr 2009 10:44:49 +0000 (UTC) (envelope-from andre@freebsd.org) Received: (qmail 74703 invoked from network); 19 Apr 2009 10:17:42 -0000 Received: from localhost (HELO [127.0.0.1]) ([127.0.0.1]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 19 Apr 2009 10:17:42 -0000 Message-ID: <49EAFA62.3010000@freebsd.org> Date: Sun, 19 Apr 2009 12:18:10 +0200 From: Andre Oppermann User-Agent: Thunderbird 1.5.0.14 (Windows/20071210) MIME-Version: 1.0 To: Kip Macy References: <200904190444.n3J4i5wF098362@svn.freebsd.org> In-Reply-To: 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 Subject: Re: svn commit: r191259 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 10:44:50 -0000 Robert Watson wrote: > On Sun, 19 Apr 2009, Kip Macy wrote: > >> Author: kmacy >> Date: Sun Apr 19 04:44:05 2009 >> New Revision: 191259 >> URL: http://svn.freebsd.org/changeset/base/191259 >> >> Log: >> - Allocate a small flowtable in ip_input.c (changeable by tuneable) >> - Use for accelerating ip_output > > If you anticipate the flowtable being used with many types, I wonder if > the flowtable sysctl to enable/disable it by policy should be on the > consumer side, rather than the producer side? That way you could say > "use the flowtable for ipv4 and ipv6 but not ipx", which might well be > helpful for debugging when adding flowtable support for those > protocols. Also, is it the case that when the flowtable is disabled, it > isn't allocated, or is the basic table always allocated regardless of > policy? I have another question on the flowtable: What is the pupose of it? All router vendors have learned a long time ago that route caching (aka flow caching) doesn't work out on a router that carries the DFZ (default free zone, currently ~280k prefixes). The overhead of managing the flow table and the high churn rate make it much more expensive than a direct and already very efficient radix trie lookup. Additionally a well connected DFZ router has some 1k prefix updates per second. More information can be found for example at Cisco here: http://www.cisco.com/en/US/tech/tk827/tk831/technologies_white_paper09186a00800a62d9.shtml The same findings are also available from all other major router vendors like Juniper, Foundry, etc. Lets examine the situations: a) internal router with only a few routes; The routing and ARP table are small, lookups are very fast and everything is hot in the CPU caches anyway. b) DFZ router with 280k routes; A small flow table has constant thrashing becoming negative overhead only. A large flow table has a high maintenance overhead, higher lookup times and sill a significant amount of thrashing. The overhead of the flow table is equal or higher than a direct routing table lookup. Concluding that a flow table is never a win but a liability in any realistic setting. Now I don't have benchmark numbers to back up the theory I put forth here. However I want to bring up the rationale for why nobody else is doing it. A statistical analysis easily shows that flow caching has only a few small spots where it may offer some advantage over direct routing table lookups; none of them are where it matter in real work situations. As our kernel currently stands an advantage of the flow table can certainly be demonstrated for a small routing table and a small number of flows. This is due to a very sub-optimal routing table implementation we have. The flow table approach short-cuts a significant number of locking operations (routing table, routing entries, ARP table and possibly some more). On the other hand this caching of flows and pointers to routing entries and ARP entries complicates updates to these tables and potentially makes them very expensive. Additionally is creates a "tangled mess" again complicating future changes and advances in those areas (unless the flow table were simply removed again at that point). I argue that instead of cludging around (the flow table) a sub-optimal part of the network stack (the current incarnation of the routing table) time could be equally spent wiser on fixing the problems in the first place. I've outlined a few approaches a couple of times before on the mailing lists. If the routing table would no longer support direct pointers to entries the locking could be significantly simplified and the ARP table could use rmlocks (read-mostly locks) as it is changed only very infrequently. It's all about the number of locks that have to be aquired per packet/lookup. It also has the benefit of an order of a magnitude less complexity (and hard to debug egde cases, which cannot be under- estimated). -- Andre From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 11:20:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2F7B106566C; Sun, 19 Apr 2009 11:20:57 +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 A56878FC15; Sun, 19 Apr 2009 11:20:57 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JBKvfU007840; Sun, 19 Apr 2009 11:20:57 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JBKvEs007838; Sun, 19 Apr 2009 11:20:57 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904191120.n3JBKvEs007838@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 11:20: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: r191267 - 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, 19 Apr 2009 11:20:59 -0000 Author: rwatson Date: Sun Apr 19 11:20:57 2009 New Revision: 191267 URL: http://svn.freebsd.org/changeset/base/191267 Log: Garbage collect now-unused struct malloc_type fields, bump __FreeBSD_version as kernel modules will need to be rebuilt. These fields existed to support binary compatibility with kernel modules from before the introduction of libmemstat(3) in FreeBSD 6.x, so they are no longer required. Modified: head/sys/sys/malloc.h head/sys/sys/param.h Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Sun Apr 19 09:56:30 2009 (r191266) +++ head/sys/sys/malloc.h Sun Apr 19 11:20:57 2009 (r191267) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1987, 1993 * The Regents of the University of California. - * Copyright (c) 2005 Robert N. M. Watson + * Copyright (c) 2005, 2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -94,35 +94,15 @@ struct malloc_type_internal { }; /* - * ABI-compatible version of the old 'struct malloc_type', only all stats are - * now malloc-managed in malloc-owned memory rather than in caller memory, so - * as to avoid ABI issues. The ks_next pointer is reused as a pointer to the - * internal data handle. + * Public data structure describing a malloc type. Private data is hung off + * of ks_handle to avoid encoding internal malloc(9) data structures in + * modules, which will statically allocate struct malloc_type. */ struct malloc_type { struct malloc_type *ks_next; /* Next in global chain. */ - u_long _ks_memuse; /* No longer used. */ - u_long _ks_size; /* No longer used. */ - u_long _ks_inuse; /* No longer used. */ - uint64_t _ks_calls; /* No longer used. */ - u_long _ks_maxused; /* No longer used. */ u_long ks_magic; /* Detect programmer error. */ const char *ks_shortdesc; /* Printable type name. */ - - /* - * struct malloc_type was terminated with a struct mtx, which is no - * longer required. For ABI reasons, continue to flesh out the full - * size of the old structure, but reuse the _lo_class field for our - * internal data handle. - */ void *ks_handle; /* Priv. data, was lo_class. */ - const char *_lo_name; - const char *_lo_type; - u_int _lo_flags; - void *_lo_list_next; - struct witness *_lo_witness; - uintptr_t _mtx_lock; - u_int _mtx_recurse; }; /* @@ -148,8 +128,7 @@ struct malloc_type_header { #ifdef _KERNEL #define MALLOC_DEFINE(type, shortdesc, longdesc) \ struct malloc_type type[1] = { \ - { NULL, 0, 0, 0, 0, 0, M_MAGIC, shortdesc, NULL, NULL, \ - NULL, 0, NULL, NULL, 0, 0 } \ + { NULL, M_MAGIC, shortdesc, NULL } \ }; \ SYSINIT(type##_init, SI_SUB_KMEM, SI_ORDER_SECOND, malloc_init, \ type); \ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sun Apr 19 09:56:30 2009 (r191266) +++ head/sys/sys/param.h Sun Apr 19 11:20:57 2009 (r191267) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800080 /* Master, propagated to newvers */ +#define __FreeBSD_version 800081 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 12:41:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20584106566C; Sun, 19 Apr 2009 12:41:38 +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 C3A348FC13; Sun, 19 Apr 2009 12:41:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JCfbBD009452; Sun, 19 Apr 2009 12:41:37 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JCfbxB009451; Sun, 19 Apr 2009 12:41:37 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904191241.n3JCfbxB009451@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 12:41: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: r191268 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 12:41:38 -0000 Author: rwatson Date: Sun Apr 19 12:41:37 2009 New Revision: 191268 URL: http://svn.freebsd.org/changeset/base/191268 Log: struct malloc_type has had a 'magic' field statically initialized to M_MAGIC by MALLOC_DEFINE() for a long time; add assertions that malloc_type's passed to malloc(), free(), etc have that magic set. MFC after: 2 weeks Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Sun Apr 19 11:20:57 2009 (r191267) +++ head/sys/kern/kern_malloc.c Sun Apr 19 12:41:37 2009 (r191268) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1987, 1991, 1993 * The Regents of the University of California. - * Copyright (c) 2005-2006 Robert N. M. Watson + * Copyright (c) 2005-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -334,6 +334,7 @@ malloc(unsigned long size, struct malloc #endif #ifdef INVARIANTS + KASSERT(mtp->ks_magic == M_MAGIC, ("malloc: bad malloc type magic")); /* * Check that exactly one of M_WAITOK or M_NOWAIT is specified. */ @@ -419,6 +420,8 @@ free(void *addr, struct malloc_type *mtp uma_slab_t slab; u_long size; + KASSERT(mtp->ks_magic == M_MAGIC, ("free: bad malloc type magic")); + /* free(NULL, ...) does nothing */ if (addr == NULL) return; @@ -480,6 +483,9 @@ realloc(void *addr, unsigned long size, unsigned long alloc; void *newaddr; + KASSERT(mtp->ks_magic == M_MAGIC, + ("realloc: bad malloc type magic")); + /* realloc(NULL, ...) is equivalent to malloc(...) */ if (addr == NULL) return (malloc(size, mtp, flags)); @@ -673,6 +679,9 @@ malloc_init(void *data) KASSERT(cnt.v_page_count != 0, ("malloc_register before vm_init")); mtp = data; + KASSERT(mtp->ks_magic == M_MAGIC, + ("malloc_init: bad malloc type magic")); + mtip = uma_zalloc(mt_zone, M_WAITOK | M_ZERO); mtp->ks_handle = mtip; @@ -694,7 +703,10 @@ malloc_uninit(void *data) int i; mtp = data; + KASSERT(mtp->ks_magic == M_MAGIC, + ("malloc_uninit: bad malloc type magic")); KASSERT(mtp->ks_handle != NULL, ("malloc_deregister: cookie NULL")); + mtx_lock(&malloc_mtx); mtip = mtp->ks_handle; mtp->ks_handle = NULL; From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 13:48:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65D18106564A; Sun, 19 Apr 2009 13:48:43 +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 537AE8FC18; Sun, 19 Apr 2009 13:48:43 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JDmhvt010874; Sun, 19 Apr 2009 13:48:43 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JDmhVH010871; Sun, 19 Apr 2009 13:48:43 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200904191348.n3JDmhVH010871@svn.freebsd.org> From: Dmitry Chagin Date: Sun, 19 Apr 2009 13:48: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: r191269 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 13:48:43 -0000 Author: dchagin Date: Sun Apr 19 13:48:42 2009 New Revision: 191269 URL: http://svn.freebsd.org/changeset/base/191269 Log: Remove support for FUTEX_REQUEUE operation. Glibc does not use this operation since 2.3.3 version (Jun 2004), as it is racy and replaced by FUTEX_CMP_REQUEUE operation. Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when FUTEX_REQUEUE returned EINVAL. Any application directly using FUTEX_REQUEUE without return value checking are definitely broken. Limit quantity of messages per process about unsupported operation. Approved by: kib (mentor) MFC after: 1 month Modified: head/sys/compat/linux/linux_emul.c head/sys/compat/linux/linux_emul.h head/sys/compat/linux/linux_futex.c Modified: head/sys/compat/linux/linux_emul.c ============================================================================== --- head/sys/compat/linux/linux_emul.c Sun Apr 19 12:41:37 2009 (r191268) +++ head/sys/compat/linux/linux_emul.c Sun Apr 19 13:48:42 2009 (r191269) @@ -86,6 +86,7 @@ linux_proc_init(struct thread *td, pid_t em = malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO); em->pid = child; em->pdeath_signal = 0; + em->used_requeue = 0; em->robust_futexes = NULL; if (flags & LINUX_CLONE_THREAD) { /* handled later in the code */ Modified: head/sys/compat/linux/linux_emul.h ============================================================================== --- head/sys/compat/linux/linux_emul.h Sun Apr 19 12:41:37 2009 (r191268) +++ head/sys/compat/linux/linux_emul.h Sun Apr 19 13:48:42 2009 (r191269) @@ -51,6 +51,7 @@ struct linux_emuldata { struct linux_emuldata_shared *shared; int pdeath_signal; /* parent death signal */ + int used_requeue; /* uses deprecated futex op */ struct linux_robust_list_head *robust_futexes; Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Sun Apr 19 12:41:37 2009 (r191268) +++ head/sys/compat/linux/linux_futex.c Sun Apr 19 13:48:42 2009 (r191269) @@ -114,6 +114,7 @@ linux_sys_futex(struct thread *td, struc struct timeval tv = {0, 0}; struct futex *f2; int op_ret; + struct linux_emuldata *em; #ifdef DEBUG if (ldebug(sys_futex)) @@ -262,19 +263,6 @@ linux_sys_futex(struct thread *td, struc FUTEX_SYSTEM_UNLOCK; break; - case LINUX_FUTEX_REQUEUE: - FUTEX_SYSTEM_LOCK; - - f = futex_get(args->uaddr, FUTEX_UNLOCKED); - newf = futex_get(args->uaddr2, FUTEX_UNLOCKED); - td->td_retval[0] = futex_wake(f, args->val, newf, - (int)(unsigned long)args->timeout); - futex_put(f); - futex_put(newf); - - FUTEX_SYSTEM_UNLOCK; - break; - case LINUX_FUTEX_WAKE_OP: FUTEX_SYSTEM_LOCK; #ifdef DEBUG @@ -342,6 +330,23 @@ linux_sys_futex(struct thread *td, struc /* not yet implemented */ return (ENOSYS); + case LINUX_FUTEX_REQUEUE: + + /* + * Glibc does not use this operation since Jun 2004 (2.3.3), + * as it is racy and replaced by FUTEX_CMP_REQUEUE operation. + * Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when + * FUTEX_REQUEUE returned EINVAL. + */ + em = em_find(td->td_proc, EMUL_DONTLOCK); + if (em->used_requeue == 0) { + printf("linux(%s (%d)) sys_futex: " + "unsupported futex_requeue op\n", + td->td_proc->p_comm, td->td_proc->p_pid); + em->used_requeue = 1; + } + return (EINVAL); + default: printf("linux_sys_futex: unknown op %d\n", args->op); From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 14:53:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42CD1106566C; Sun, 19 Apr 2009 14:53:18 +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 2EFD28FC08; Sun, 19 Apr 2009 14:53:18 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JErHQr012201; Sun, 19 Apr 2009 14:53:17 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JErHtq012190; Sun, 19 Apr 2009 14:53:17 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904191453.n3JErHtq012190@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 14:53: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: r191270 - in head/sys: bsm conf security/audit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 14:53:18 -0000 Author: rwatson Date: Sun Apr 19 14:53:17 2009 New Revision: 191270 URL: http://svn.freebsd.org/changeset/base/191270 Log: Merge OpenBSM 1.1 changes to the FreeBSD 8.x kernel: - Add and use mapping of fcntl(2) commands to new BSM constant space. - Adopt (int) rather than (long) arguments to a number of auditon(2) commands, as has happened in Solaris, and add compatibility code to handle the old comments. Note that BSM_PF_IEEE80211 is partially but not fully removed, as the userspace OpenBSM 1.1alpha5 code still depends on it. Once userspace is updated, I'll GCC the kernel constant. MFC after: 2 weeks Sponsored by: Apple, Inc. Obtained from: TrustedBSD Project Portions submitted by: sson Modified: head/sys/bsm/audit.h head/sys/bsm/audit_kevents.h head/sys/bsm/audit_record.h head/sys/conf/files head/sys/security/audit/audit.c head/sys/security/audit/audit_bsm.c head/sys/security/audit/audit_bsm_domain.c head/sys/security/audit/audit_bsm_fcntl.c head/sys/security/audit/audit_bsm_token.c head/sys/security/audit/audit_private.h head/sys/security/audit/audit_syscalls.c Modified: head/sys/bsm/audit.h ============================================================================== --- head/sys/bsm/audit.h Sun Apr 19 13:48:42 2009 (r191269) +++ head/sys/bsm/audit.h Sun Apr 19 14:53:17 2009 (r191270) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,21 +26,15 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit.h#5 + * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit.h#9 * $FreeBSD$ */ -#ifndef _BSM_AUDIT_H +#ifndef _BSM_AUDIT_H #define _BSM_AUDIT_H -#ifdef __APPLE__ -/* Temporary until rdar://problem/6133383 is resolved. */ -#include #include -#include -#include -#include -#endif /* __APPLE__ */ +#include #define AUDIT_RECORD_MAGIC 0x828a0f1b #define MAX_AUDIT_RECORDS 20 @@ -101,20 +95,20 @@ /* * auditon(2) commands. */ -#define A_GETPOLICY 2 -#define A_SETPOLICY 3 +#define A_OLDGETPOLICY 2 +#define A_OLDSETPOLICY 3 #define A_GETKMASK 4 #define A_SETKMASK 5 -#define A_GETQCTRL 6 -#define A_SETQCTRL 7 +#define A_OLDGETQCTRL 6 +#define A_OLDSETQCTRL 7 #define A_GETCWD 8 #define A_GETCAR 9 #define A_GETSTAT 12 #define A_SETSTAT 13 #define A_SETUMASK 14 #define A_SETSMASK 15 -#define A_GETCOND 20 -#define A_SETCOND 21 +#define A_OLDGETCOND 20 +#define A_OLDSETCOND 21 #define A_GETCLASS 22 #define A_SETCLASS 23 #define A_GETPINFO 24 @@ -126,6 +120,12 @@ #define A_SETKAUDIT 30 #define A_SENDTRIGGER 31 #define A_GETSINFO_ADDR 32 +#define A_GETPOLICY 33 +#define A_SETPOLICY 34 +#define A_GETQCTRL 35 +#define A_SETQCTRL 36 +#define A_GETCOND 37 +#define A_SETCOND 38 /* * Audit policy controls. @@ -216,7 +216,6 @@ struct auditpinfo { au_mask_t ap_mask; /* Audit masks. */ au_tid_t ap_termid; /* Terminal ID. */ au_asid_t ap_asid; /* Audit session ID. */ - u_int64_t ap_flags; /* Audit session flags. */ }; typedef struct auditpinfo auditpinfo_t; @@ -226,15 +225,12 @@ struct auditpinfo_addr { au_mask_t ap_mask; /* Audit masks. */ au_tid_addr_t ap_termid; /* Terminal ID. */ au_asid_t ap_asid; /* Audit session ID. */ + u_int64_t ap_flags; /* Audit session flags. */ }; typedef struct auditpinfo_addr auditpinfo_addr_t; struct au_session { auditinfo_addr_t *as_aia_p; /* Ptr to full audit info. */ -#define as_asid as_aia_p->ai_asid -#define as_auid as_aia_p->ai_auid -#define as_termid as_aia_p->ai_termid - au_mask_t as_mask; /* Process Audit Masks. */ }; typedef struct au_session au_session_t; @@ -245,13 +241,22 @@ typedef struct au_session au_sessi typedef struct au_token token_t; /* - * Kernel audit queue control parameters. + * Kernel audit queue control parameters: + * Default: Maximum: + * aq_hiwater: AQ_HIWATER (100) AQ_MAXHIGH (10000) + * aq_lowater: AQ_LOWATER (10) +mach_port_name_t audit_session_self(void); +au_asid_t audit_session_join(mach_port_name_t port); +#endif /* __APPLE_API_PRIVATE */ + #endif /* defined(_KERNEL) || defined(KERNEL) */ __END_DECLS Modified: head/sys/bsm/audit_kevents.h ============================================================================== --- head/sys/bsm/audit_kevents.h Sun Apr 19 13:48:42 2009 (r191269) +++ head/sys/bsm/audit_kevents.h Sun Apr 19 14:53:17 2009 (r191270) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_kevents.h#5 + * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_kevents.h#6 * $FreeBSD$ */ @@ -34,6 +34,12 @@ #define _BSM_AUDIT_KEVENTS_H_ /* + * The reserved event numbers for kernel events are 1...2047 and 43001..44900. + */ +#define AUE_IS_A_KEVENT(e) (((e) > 0 && (e) < 2048) || \ + ((e) > 43000 && (e) < 45000)) + +/* * Values marked as AUE_NULL are not required to be audited as per CAPP. * * Some conflicts exist in the assignment of name to event number mappings @@ -589,6 +595,8 @@ #define AUE_FSGETPATH 43191 /* Darwin. */ #define AUE_PREAD 43192 /* Darwin/FreeBSD. */ #define AUE_PWRITE 43193 /* Darwin/FreeBSD. */ +#define AUE_FSCTL 43194 /* Darwin. */ +#define AUE_FFSCTL 43195 /* Darwin. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the @@ -674,12 +682,10 @@ #define AUE_CSOPS AUE_NULL #define AUE_DUP AUE_NULL #define AUE_FDATASYNC AUE_NULL -#define AUE_FFSCTL AUE_NULL #define AUE_FGETATTRLIST AUE_NULL #define AUE_FGETXATTR AUE_NULL #define AUE_FLISTXATTR AUE_NULL #define AUE_FREMOVEXATTR AUE_NULL -#define AUE_FSCTL AUE_NULL #define AUE_FSETATTRLIST AUE_NULL #define AUE_FSETXATTR AUE_NULL #define AUE_FSTATFS64 AUE_NULL Modified: head/sys/bsm/audit_record.h ============================================================================== --- head/sys/bsm/audit_record.h Sun Apr 19 13:48:42 2009 (r191269) +++ head/sys/bsm/audit_record.h Sun Apr 19 14:53:17 2009 (r191270) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_record.h#9 + * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_record.h#10 * $FreeBSD$ */ @@ -286,10 +286,12 @@ token_t *au_to_zonename(const char *zone */ int au_bsm_to_domain(u_short bsm_domain, int *local_domainp); int au_bsm_to_errno(u_char bsm_error, int *errorp); +int au_bsm_to_fcntl_cmd(u_short bsm_fcntl_cmd, int *local_fcntl_cmdp); int au_bsm_to_socket_type(u_short bsm_socket_type, int *local_socket_typep); u_short au_domain_to_bsm(int local_domain); u_char au_errno_to_bsm(int local_errno); +u_short au_fcntl_cmd_to_bsm(int local_fcntl_command); u_short au_socket_type_to_bsm(int local_socket_type); __END_DECLS Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Apr 19 13:48:42 2009 (r191269) +++ head/sys/conf/files Sun Apr 19 14:53:17 2009 (r191270) @@ -2528,6 +2528,7 @@ security/audit/audit_arg.c optional audi security/audit/audit_bsm.c optional audit security/audit/audit_bsm_domain.c optional audit security/audit/audit_bsm_errno.c optional audit +security/audit/audit_bsm_fcntl.c optional audit security/audit/audit_bsm_klib.c optional audit security/audit/audit_bsm_socket_type.c optional audit security/audit/audit_bsm_token.c optional audit Modified: head/sys/security/audit/audit.c ============================================================================== --- head/sys/security/audit/audit.c Sun Apr 19 13:48:42 2009 (r191269) +++ head/sys/security/audit/audit.c Sun Apr 19 14:53:17 2009 (r191270) @@ -129,8 +129,8 @@ struct mtx audit_mtx; * outstanding in the system. */ struct kaudit_queue audit_q; -size_t audit_q_len; -size_t audit_pre_q_len; +int audit_q_len; +int audit_pre_q_len; /* * Audit queue control settings (minimum free, low/high water marks, etc.) Modified: head/sys/security/audit/audit_bsm.c ============================================================================== --- head/sys/security/audit/audit_bsm.c Sun Apr 19 13:48:42 2009 (r191269) +++ head/sys/security/audit/audit_bsm.c Sun Apr 19 14:53:17 2009 (r191270) @@ -287,13 +287,20 @@ audit_sys_auditon(struct audit_record *a struct au_token *tok; switch (ar->ar_arg_cmd) { + case A_OLDSETPOLICY: + if ((size_t)ar->ar_arg_len == sizeof(int64_t)) { + tok = au_to_arg32(3, "length", ar->ar_arg_len); + kau_write(rec, tok); + tok = au_to_arg64(2, "policy", + ar->ar_arg_auditon.au_policy64); + kau_write(rec, tok); + break; + } + /* FALLTHROUGH */ case A_SETPOLICY: - if (sizeof(ar->ar_arg_auditon.au_flags) > 4) - tok = au_to_arg64(1, "policy", - ar->ar_arg_auditon.au_flags); - else - tok = au_to_arg32(1, "policy", - ar->ar_arg_auditon.au_flags); + tok = au_to_arg32(3, "length", ar->ar_arg_len); + kau_write(rec, tok); + tok = au_to_arg32(1, "policy", ar->ar_arg_auditon.au_policy); kau_write(rec, tok); break; @@ -306,20 +313,42 @@ audit_sys_auditon(struct audit_record *a kau_write(rec, tok); break; + case A_OLDSETQCTRL: + if ((size_t)ar->ar_arg_len == sizeof(au_qctrl64_t)) { + tok = au_to_arg32(3, "length", ar->ar_arg_len); + kau_write(rec, tok); + tok = au_to_arg64(2, "setqctrl:aq_hiwater", + ar->ar_arg_auditon.au_qctrl64.aq64_hiwater); + kau_write(rec, tok); + tok = au_to_arg64(2, "setqctrl:aq_lowater", + ar->ar_arg_auditon.au_qctrl64.aq64_lowater); + kau_write(rec, tok); + tok = au_to_arg64(2, "setqctrl:aq_bufsz", + ar->ar_arg_auditon.au_qctrl64.aq64_bufsz); + kau_write(rec, tok); + tok = au_to_arg64(2, "setqctrl:aq_delay", + ar->ar_arg_auditon.au_qctrl64.aq64_delay); + kau_write(rec, tok); + tok = au_to_arg64(2, "setqctrl:aq_minfree", + ar->ar_arg_auditon.au_qctrl64.aq64_minfree); + kau_write(rec, tok); + break; + } + /* FALLTHROUGH */ case A_SETQCTRL: tok = au_to_arg32(3, "setqctrl:aq_hiwater", ar->ar_arg_auditon.au_qctrl.aq_hiwater); kau_write(rec, tok); - tok = au_to_arg32(3, "setqctrl:aq_lowater", + tok = au_to_arg32(2, "setqctrl:aq_lowater", ar->ar_arg_auditon.au_qctrl.aq_lowater); kau_write(rec, tok); - tok = au_to_arg32(3, "setqctrl:aq_bufsz", + tok = au_to_arg32(2, "setqctrl:aq_bufsz", ar->ar_arg_auditon.au_qctrl.aq_bufsz); kau_write(rec, tok); - tok = au_to_arg32(3, "setqctrl:aq_delay", + tok = au_to_arg32(2, "setqctrl:aq_delay", ar->ar_arg_auditon.au_qctrl.aq_delay); kau_write(rec, tok); - tok = au_to_arg32(3, "setqctrl:aq_minfree", + tok = au_to_arg32(2, "setqctrl:aq_minfree", ar->ar_arg_auditon.au_qctrl.aq_minfree); kau_write(rec, tok); break; @@ -334,34 +363,47 @@ audit_sys_auditon(struct audit_record *a break; case A_SETSMASK: - tok = au_to_arg32(3, "setsmask:as_success", + tok = au_to_arg32(3, "length", ar->ar_arg_len); + kau_write(rec, tok); + tok = au_to_arg32(2, "setsmask:as_success", ar->ar_arg_auditon.au_auinfo.ai_mask.am_success); kau_write(rec, tok); - tok = au_to_arg32(3, "setsmask:as_failure", + tok = au_to_arg32(2, "setsmask:as_failure", ar->ar_arg_auditon.au_auinfo.ai_mask.am_failure); kau_write(rec, tok); break; + case A_OLDSETCOND: + if ((size_t)ar->ar_arg_len == sizeof(int64_t)) { + tok = au_to_arg32(3, "length", ar->ar_arg_len); + kau_write(rec, tok); + tok = au_to_arg64(2, "setcond", + ar->ar_arg_auditon.au_cond64); + kau_write(rec, tok); + break; + } + /* FALLTHROUGH */ case A_SETCOND: - if (sizeof(ar->ar_arg_auditon.au_cond) > 4) - tok = au_to_arg64(3, "setcond", - ar->ar_arg_auditon.au_cond); - else - tok = au_to_arg32(3, "setcond", - ar->ar_arg_auditon.au_cond); + tok = au_to_arg32(3, "length", ar->ar_arg_len); + kau_write(rec, tok); + tok = au_to_arg32(3, "setcond", ar->ar_arg_auditon.au_cond); kau_write(rec, tok); break; case A_SETCLASS: + tok = au_to_arg32(3, "length", ar->ar_arg_len); + kau_write(rec, tok); tok = au_to_arg32(2, "setclass:ec_event", ar->ar_arg_auditon.au_evclass.ec_number); kau_write(rec, tok); - tok = au_to_arg32(3, "setclass:ec_class", + tok = au_to_arg32(2, "setclass:ec_class", ar->ar_arg_auditon.au_evclass.ec_class); kau_write(rec, tok); break; case A_SETPMASK: + tok = au_to_arg32(3, "length", ar->ar_arg_len); + kau_write(rec, tok); tok = au_to_arg32(2, "setpmask:as_success", ar->ar_arg_auditon.au_aupinfo.ap_mask.am_success); kau_write(rec, tok); @@ -371,6 +413,8 @@ audit_sys_auditon(struct audit_record *a break; case A_SETFSIZE: + tok = au_to_arg32(3, "length", ar->ar_arg_len); + kau_write(rec, tok); tok = au_to_arg32(2, "setfsize:filesize", ar->ar_arg_auditon.au_fstat.af_filesz); kau_write(rec, tok); @@ -847,12 +891,13 @@ kaudit_to_bsm(struct kaudit_record *kar, break; case AUE_FCNTL: + if (ARG_IS_VALID(kar, ARG_CMD)) { + tok = au_to_arg32(2, "cmd", + au_fcntl_cmd_to_bsm(ar->ar_arg_cmd)); + kau_write(rec, tok); + } if (ar->ar_arg_cmd == F_GETLK || ar->ar_arg_cmd == F_SETLK || ar->ar_arg_cmd == F_SETLKW) { - if (ARG_IS_VALID(kar, ARG_CMD)) { - tok = au_to_arg32(2, "cmd", ar->ar_arg_cmd); - kau_write(rec, tok); - } FD_VNODE1_TOKENS; } break; Modified: head/sys/security/audit/audit_bsm_domain.c ============================================================================== --- head/sys/security/audit/audit_bsm_domain.c Sun Apr 19 13:48:42 2009 (r191269) +++ head/sys/security/audit/audit_bsm_domain.c Sun Apr 19 14:53:17 2009 (r191270) @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_domain.c#2 + * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_domain.c#3 */ #include @@ -324,13 +324,6 @@ static const struct bsm_domain bsm_domai PF_NO_LOCAL_MAPPING #endif }, - { BSM_PF_IEEE80211, -#ifdef PF_IEEE80211 - PF_IEEE80211 -#else - PF_NO_LOCAL_MAPPING -#endif - }, { BSM_PF_AX25, #ifdef PF_AX25 PF_AX25 Modified: head/sys/security/audit/audit_bsm_fcntl.c ============================================================================== --- head/sys/security/audit/audit_bsm_fcntl.c Sun Apr 19 13:48:42 2009 (r191269) +++ head/sys/security/audit/audit_bsm_fcntl.c Sun Apr 19 14:53:17 2009 (r191270) @@ -27,16 +27,18 @@ * POSSIBILITY OF SUCH DAMAGE. * * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_fcntl.c#2 - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include -#include +#include #include -#include +#include struct bsm_fcntl_cmd { u_short bfc_bsm_fcntl_cmd; Modified: head/sys/security/audit/audit_bsm_token.c ============================================================================== --- head/sys/security/audit/audit_bsm_token.c Sun Apr 19 13:48:42 2009 (r191269) +++ head/sys/security/audit/audit_bsm_token.c Sun Apr 19 14:53:17 2009 (r191270) @@ -30,7 +30,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#90 + * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#91 */ #include @@ -1460,7 +1460,7 @@ au_to_header32_ex(int rec_size, au_event if (gettimeofday(&tm, NULL) == -1) return (NULL); - if (auditon(A_GETKAUDIT, &aia, sizeof(aia)) < 0) { + if (audit_get_kaudit(&aia, sizeof(aia)) != 0) { if (errno != ENOSYS) return (NULL); return (au_to_header32_tm(rec_size, e_type, e_mod, tm)); Modified: head/sys/security/audit/audit_private.h ============================================================================== --- head/sys/security/audit/audit_private.h Sun Apr 19 13:48:42 2009 (r191269) +++ head/sys/security/audit/audit_private.h Sun Apr 19 14:53:17 2009 (r191270) @@ -118,18 +118,34 @@ struct socket_au_info { u_short so_lport; /* Local port. */ }; +/* + * The following is used for A_OLDSETQCTRL and AU_OLDGETQCTRL and a 64-bit + * userland. + */ +struct au_qctrl64 { + u_int64_t aq64_hiwater; + u_int64_t aq64_lowater; + u_int64_t aq64_bufsz; + u_int64_t aq64_delay; + u_int64_t aq64_minfree; +}; +typedef struct au_qctrl64 au_qctrl64_t; + union auditon_udata { char *au_path; - long au_cond; - long au_flags; - long au_policy; + int au_cond; + int au_flags; + int au_policy; int au_trigger; + int64_t au_cond64; + int64_t au_policy64; au_evclass_map_t au_evclass; au_mask_t au_mask; auditinfo_t au_auinfo; auditpinfo_t au_aupinfo; auditpinfo_addr_t au_aupinfo_addr; au_qctrl_t au_qctrl; + au_qctrl64_t au_qctrl64; au_stat_t au_stat; au_fstat_t au_fstat; auditinfo_addr_t au_kau_info; @@ -275,8 +291,8 @@ extern struct mtx audit_mtx; extern struct cv audit_watermark_cv; extern struct cv audit_worker_cv; extern struct kaudit_queue audit_q; -extern size_t audit_q_len; -extern size_t audit_pre_q_len; +extern int audit_q_len; +extern int audit_pre_q_len; extern int audit_in_failure; /* Modified: head/sys/security/audit/audit_syscalls.c ============================================================================== --- head/sys/security/audit/audit_syscalls.c Sun Apr 19 13:48:42 2009 (r191269) +++ head/sys/security/audit/audit_syscalls.c Sun Apr 19 14:53:17 2009 (r191270) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1999-2005 Apple Inc. + * Copyright (c) 1999-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -187,12 +187,15 @@ auditon(struct thread *td, struct audito */ switch (uap->cmd) { case A_SETPOLICY: + case A_OLDSETPOLICY: case A_SETKMASK: case A_SETQCTRL: + case A_OLDSETQCTRL: case A_SETSTAT: case A_SETUMASK: case A_SETSMASK: case A_SETCOND: + case A_OLDSETCOND: case A_SETCLASS: case A_SETPMASK: case A_SETFSIZE: @@ -212,7 +215,22 @@ auditon(struct thread *td, struct audito * XXXAUDIT: Locking? */ switch (uap->cmd) { + case A_OLDGETPOLICY: + if (uap->length == sizeof(udata.au_policy64)) { + if (!audit_fail_stop) + udata.au_policy64 |= AUDIT_CNT; + if (audit_panic_on_write_fail) + udata.au_policy64 |= AUDIT_AHLT; + if (audit_argv) + udata.au_policy64 |= AUDIT_ARGV; + if (audit_arge) + udata.au_policy64 |= AUDIT_ARGE; + break; + } + /* FALLTHROUGH */ case A_GETPOLICY: + if (uap->length != sizeof(udata.au_policy)) + return (EINVAL); if (!audit_fail_stop) udata.au_policy |= AUDIT_CNT; if (audit_panic_on_write_fail) @@ -223,7 +241,23 @@ auditon(struct thread *td, struct audito udata.au_policy |= AUDIT_ARGE; break; + case A_OLDSETPOLICY: + if (uap->length == sizeof(udata.au_policy64)) { + if (udata.au_policy & (~AUDIT_CNT|AUDIT_AHLT| + AUDIT_ARGV|AUDIT_ARGE)) + return (EINVAL); + audit_fail_stop = ((udata.au_policy64 & AUDIT_CNT) == + 0); + audit_panic_on_write_fail = (udata.au_policy64 & + AUDIT_AHLT); + audit_argv = (udata.au_policy64 & AUDIT_ARGV); + audit_arge = (udata.au_policy64 & AUDIT_ARGE); + break; + } + /* FALLTHROUGH */ case A_SETPOLICY: + if (uap->length != sizeof(udata.au_policy)) + return (EINVAL); if (udata.au_policy & ~(AUDIT_CNT|AUDIT_AHLT|AUDIT_ARGV| AUDIT_ARGE)) return (EINVAL); @@ -237,18 +271,60 @@ auditon(struct thread *td, struct audito break; case A_GETKMASK: + if (uap->length != sizeof(udata.au_mask)) + return (EINVAL); udata.au_mask = audit_nae_mask; break; case A_SETKMASK: + if (uap->length != sizeof(udata.au_mask)) + return (EINVAL); audit_nae_mask = udata.au_mask; break; + case A_OLDGETQCTRL: + if (uap->length == sizeof(udata.au_qctrl64)) { + udata.au_qctrl64.aq64_hiwater = + (u_int64_t)audit_qctrl.aq_hiwater; + udata.au_qctrl64.aq64_lowater = + (u_int64_t)audit_qctrl.aq_lowater; + udata.au_qctrl64.aq64_bufsz = + (u_int64_t)audit_qctrl.aq_bufsz; + udata.au_qctrl64.aq64_minfree = + (u_int64_t)audit_qctrl.aq_minfree; + break; + } + /* FALLTHROUGH */ case A_GETQCTRL: + if (uap->length != sizeof(udata.au_qctrl)) + return (EINVAL); udata.au_qctrl = audit_qctrl; break; + case A_OLDSETQCTRL: + if (uap->length == sizeof(udata.au_qctrl64)) { + if ((udata.au_qctrl64.aq64_hiwater > AQ_MAXHIGH) || + (udata.au_qctrl64.aq64_lowater >= + udata.au_qctrl.aq_hiwater) || + (udata.au_qctrl64.aq64_bufsz > AQ_MAXBUFSZ) || + (udata.au_qctrl64.aq64_minfree < 0) || + (udata.au_qctrl64.aq64_minfree > 100)) + return (EINVAL); + audit_qctrl.aq_hiwater = + (int)udata.au_qctrl64.aq64_hiwater; + audit_qctrl.aq_lowater = + (int)udata.au_qctrl64.aq64_lowater; + audit_qctrl.aq_bufsz = + (int)udata.au_qctrl64.aq64_bufsz; + audit_qctrl.aq_minfree = + (int)udata.au_qctrl64.aq64_minfree; + audit_qctrl.aq_delay = -1; /* Not used. */ + break; + } + /* FALLTHROUGH */ case A_SETQCTRL: + if (uap->length != sizeof(udata.au_qctrl)) + return (EINVAL); if ((udata.au_qctrl.aq_hiwater > AQ_MAXHIGH) || (udata.au_qctrl.aq_lowater >= udata.au_qctrl.aq_hiwater) || (udata.au_qctrl.aq_bufsz > AQ_MAXBUFSZ) || @@ -285,14 +361,40 @@ auditon(struct thread *td, struct audito return (ENOSYS); break; + case A_OLDGETCOND: + if (uap->length == sizeof(udata.au_cond64)) { + if (audit_enabled && !audit_suspended) + udata.au_cond64 = AUC_AUDITING; + else + udata.au_cond64 = AUC_NOAUDIT; + break; + } + /* FALLTHROUGH */ case A_GETCOND: + if (uap->length != sizeof(udata.au_cond)) + return (EINVAL); if (audit_enabled && !audit_suspended) udata.au_cond = AUC_AUDITING; else udata.au_cond = AUC_NOAUDIT; break; + case A_OLDSETCOND: + if (uap->length == sizeof(udata.au_cond64)) { + if (udata.au_cond64 == AUC_NOAUDIT) + audit_suspended = 1; + if (udata.au_cond64 == AUC_AUDITING) + audit_suspended = 0; + if (udata.au_cond64 == AUC_DISABLED) { + audit_suspended = 1; + audit_shutdown(NULL, 0); + } + break; + } + /* FALLTHROUGH */ case A_SETCOND: + if (uap->length != sizeof(udata.au_cond)) + return (EINVAL); if (udata.au_cond == AUC_NOAUDIT) audit_suspended = 1; if (udata.au_cond == AUC_AUDITING) @@ -304,16 +406,22 @@ auditon(struct thread *td, struct audito break; case A_GETCLASS: + if (uap->length != sizeof(udata.au_evclass)) + return (EINVAL); udata.au_evclass.ec_class = au_event_class( udata.au_evclass.ec_number); break; case A_SETCLASS: + if (uap->length != sizeof(udata.au_evclass)) + return (EINVAL); au_evclassmap_insert(udata.au_evclass.ec_number, udata.au_evclass.ec_class); break; case A_GETPINFO: + if (uap->length != sizeof(udata.au_aupinfo)) + return (EINVAL); if (udata.au_aupinfo.ap_pid < 1) return (ESRCH); if ((tp = pfind(udata.au_aupinfo.ap_pid)) == NULL) @@ -341,6 +449,8 @@ auditon(struct thread *td, struct audito break; case A_SETPMASK: + if (uap->length != sizeof(udata.au_aupinfo)) + return (EINVAL); if (udata.au_aupinfo.ap_pid < 1) return (ESRCH); newcred = crget(); @@ -365,6 +475,8 @@ auditon(struct thread *td, struct audito break; case A_SETFSIZE: + if (uap->length != sizeof(udata.au_fstat)) + return (EINVAL); if ((udata.au_fstat.af_filesz != 0) && (udata.au_fstat.af_filesz < MIN_AUDIT_FILE_SIZE)) return (EINVAL); @@ -372,11 +484,15 @@ auditon(struct thread *td, struct audito break; case A_GETFSIZE: + if (uap->length != sizeof(udata.au_fstat)) + return (EINVAL); udata.au_fstat.af_filesz = audit_fstat.af_filesz; udata.au_fstat.af_currsz = audit_fstat.af_currsz; break; case A_GETPINFO_ADDR: + if (uap->length != sizeof(udata.au_aupinfo_addr)) + return (EINVAL); if (udata.au_aupinfo_addr.ap_pid < 1) return (ESRCH); if ((tp = pfind(udata.au_aupinfo_addr.ap_pid)) == NULL) @@ -393,10 +509,14 @@ auditon(struct thread *td, struct audito break; case A_GETKAUDIT: + if (uap->length != sizeof(udata.au_kau_info)) + return (EINVAL); audit_get_kinfo(&udata.au_kau_info); break; case A_SETKAUDIT: + if (uap->length != sizeof(udata.au_kau_info)) + return (EINVAL); if (udata.au_kau_info.ai_termid.at_type != AU_IPv4 && udata.au_kau_info.ai_termid.at_type != AU_IPv6) return (EINVAL); @@ -404,6 +524,8 @@ auditon(struct thread *td, struct audito break; case A_SENDTRIGGER: + if (uap->length != sizeof(udata.au_trigger)) + return (EINVAL); if ((udata.au_trigger < AUDIT_TRIGGER_MIN) || (udata.au_trigger > AUDIT_TRIGGER_MAX)) return (EINVAL); @@ -418,12 +540,15 @@ auditon(struct thread *td, struct audito */ switch (uap->cmd) { case A_GETPOLICY: + case A_OLDGETPOLICY: case A_GETKMASK: case A_GETQCTRL: + case A_OLDGETQCTRL: case A_GETCWD: case A_GETCAR: case A_GETSTAT: case A_GETCOND: + case A_OLDGETCOND: case A_GETCLASS: case A_GETPINFO: case A_GETFSIZE: From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 16:17:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DC2B106566B; Sun, 19 Apr 2009 16:17:14 +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 17AAC8FC19; Sun, 19 Apr 2009 16:17:14 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JGHDPp014020; Sun, 19 Apr 2009 16:17:13 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JGHDnO014009; Sun, 19 Apr 2009 16:17:13 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904191617.n3JGHDnO014009@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 16:17:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191273 - in head: contrib/openbsm contrib/openbsm/bin contrib/openbsm/bin/audit contrib/openbsm/bin/auditd contrib/openbsm/bin/auditfilterd contrib/openbsm/bin/auditreduce contrib/open... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 16:17:14 -0000 Author: rwatson Date: Sun Apr 19 16:17:13 2009 New Revision: 191273 URL: http://svn.freebsd.org/changeset/base/191273 Log: Merge OpenBSM 1.1 from OpenBSM vendor branch to head. OpenBSM history for imported revision below for reference. MFC after: 2 weeks Sponsored by: Apple, Inc. Obtained from: TrustedBSD Project OpenBSM 1.1 - Change auditon(2) parameters and data structures to be 32/64-bit architecture independent. Add more information to man page about auditon(2) parameters. - Add wrapper functions for auditon(2) to use legacy commands when the new commands are not supported. - Add default for 'expire-after' in audit_control to expire trail files when the audit directory is more than 10 megabytes ('10M'). - Interface to convert between local and BSM fcntl(2) command values has been added: au_bsm_to_fcntl_cmd(3) and au_fcntl_cmd_to_bsm(3), along with definitions of constants in audit_fcntl.h. - A bug, introduced in OpenBSM 1.1 alpha 4, in which AUT_RETURN32 tokens generated by audit_submit(3) were improperly encoded has been fixed. - Fix example in audit_submit(3) man page. Also, make it clear that we want the audit ID as the argument. - A new audit event class 'aa', for post-login authentication and authorization events, has been added. Added: head/contrib/openbsm/libbsm/au_fcntl_cmd.3 - copied unchanged from r191272, vendor/openbsm/dist/libbsm/au_fcntl_cmd.3 head/contrib/openbsm/libbsm/bsm_fcntl.c - copied unchanged from r191272, vendor/openbsm/dist/libbsm/bsm_fcntl.c head/contrib/openbsm/sys/bsm/audit_fcntl.h - copied unchanged from r191272, vendor/openbsm/dist/sys/bsm/audit_fcntl.h Modified: head/contrib/openbsm/ (props changed) head/contrib/openbsm/CREDITS head/contrib/openbsm/INSTALL head/contrib/openbsm/Makefile.in head/contrib/openbsm/NEWS head/contrib/openbsm/README head/contrib/openbsm/TODO head/contrib/openbsm/VERSION head/contrib/openbsm/aclocal.m4 head/contrib/openbsm/bin/Makefile.in head/contrib/openbsm/bin/audit/Makefile.in head/contrib/openbsm/bin/audit/audit.c head/contrib/openbsm/bin/auditd/Makefile.in head/contrib/openbsm/bin/auditd/auditd.c head/contrib/openbsm/bin/auditd/auditd_darwin.c head/contrib/openbsm/bin/auditd/auditd_fbsd.c head/contrib/openbsm/bin/auditfilterd/Makefile.in head/contrib/openbsm/bin/auditfilterd/auditfilterd.8 head/contrib/openbsm/bin/auditreduce/Makefile.in head/contrib/openbsm/bin/praudit/Makefile.in head/contrib/openbsm/bsm/Makefile.in head/contrib/openbsm/bsm/audit_uevents.h head/contrib/openbsm/bsm/libbsm.h head/contrib/openbsm/config/config.h.in head/contrib/openbsm/config/ltmain.sh head/contrib/openbsm/configure head/contrib/openbsm/configure.ac head/contrib/openbsm/etc/audit_class head/contrib/openbsm/etc/audit_control head/contrib/openbsm/etc/audit_event head/contrib/openbsm/libauditd/Makefile.in head/contrib/openbsm/libauditd/auditd_lib.c head/contrib/openbsm/libbsm/Makefile.am head/contrib/openbsm/libbsm/Makefile.in head/contrib/openbsm/libbsm/au_control.3 head/contrib/openbsm/libbsm/audit_submit.3 head/contrib/openbsm/libbsm/bsm_audit.c head/contrib/openbsm/libbsm/bsm_control.c head/contrib/openbsm/libbsm/bsm_domain.c head/contrib/openbsm/libbsm/bsm_io.c head/contrib/openbsm/libbsm/bsm_notify.c head/contrib/openbsm/libbsm/bsm_token.c head/contrib/openbsm/libbsm/bsm_wrappers.c head/contrib/openbsm/libbsm/libbsm.3 head/contrib/openbsm/man/Makefile.in head/contrib/openbsm/man/auditon.2 head/contrib/openbsm/modules/Makefile.in head/contrib/openbsm/modules/auditfilter_noop/Makefile.in head/contrib/openbsm/sys/Makefile.in head/contrib/openbsm/sys/bsm/Makefile.am head/contrib/openbsm/sys/bsm/Makefile.in head/contrib/openbsm/sys/bsm/audit.h head/contrib/openbsm/sys/bsm/audit_domain.h head/contrib/openbsm/sys/bsm/audit_kevents.h head/contrib/openbsm/sys/bsm/audit_record.h head/contrib/openbsm/test/Makefile.in head/contrib/openbsm/test/bsm/Makefile.in head/contrib/openbsm/tools/Makefile.in head/lib/libbsm/Makefile head/sys/bsm/audit_domain.h Modified: head/contrib/openbsm/CREDITS ============================================================================== --- head/contrib/openbsm/CREDITS Sun Apr 19 15:19:26 2009 (r191272) +++ head/contrib/openbsm/CREDITS Sun Apr 19 16:17:13 2009 (r191273) @@ -28,6 +28,7 @@ the development of OpenBSM: Xin LI Stacey Son Todd Heberlein + Gary Hoo In addition, Coverity, Inc.'s Prevent(tm) static analysis tool and Gimpel Software's FlexeLint tool were used to identify a number of bugs in the Modified: head/contrib/openbsm/INSTALL ============================================================================== --- head/contrib/openbsm/INSTALL Sun Apr 19 15:19:26 2009 (r191272) +++ head/contrib/openbsm/INSTALL Sun Apr 19 16:17:13 2009 (r191273) @@ -2,9 +2,8 @@ OpenBSM Build and Installation Instructi OpenBSM is currently built using autoconf and automake, which should allow for building on a range of operating systems, including FreeBSD, Mac OS X, -and Linux. Depending on the availability of audit facilities in the -underlying operating system, some components that depend on kernel audit -support are built conditionally. Typically, build will be performed using: +and Linux. Some components are built only if appropriate kernel audit +suppport is found. Typical builds will be performed using: ./configure make @@ -15,10 +14,14 @@ force the compile to fail if a warning i CFLAGS="-Wall -Werror" ./configure -To install, use: +To install the library, binaries, and man pages, use: make install +The OpenBSM install will not install files in /etc; these have to be +manually installed or merged. Currently, the locations of these files are +not configurable. + You may wish to specify that the OpenBSM components not be installed in the base system, rather in a specific directory. This may be done using the --prefix argument to configure. If installing to a specific directory, @@ -29,7 +32,3 @@ directory the correct libbsm is used: make make install LD_LIBRARY_PATH=/home/rwatson/openbsm/libbsm ; export LD_LIBRARY_PATH - -You will need to manually propagate openbsm/etc/* into /etc/security on your -system; this is not done automatically so as to avoid disrupting the current -configuration. Currently, the locations of these files is not configurable. Modified: head/contrib/openbsm/Makefile.in ============================================================================== --- head/contrib/openbsm/Makefile.in Sun Apr 19 15:19:26 2009 (r191272) +++ head/contrib/openbsm/Makefile.in Sun Apr 19 16:17:13 2009 (r191273) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,7 @@ @SET_MAKE@ # -# $P4: //depot/projects/trustedbsd/openbsm/Makefile.in#9 $ +# $P4: //depot/projects/trustedbsd/openbsm/Makefile.in#10 $ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ @@ -97,6 +97,7 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -121,6 +122,7 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MIG = @MIG@ MKDIR_P = @MKDIR_P@ +NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -184,6 +186,7 @@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = bsm $(am__append_1) libbsm bin man modules sys @@ -332,8 +335,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -358,8 +361,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCE unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -369,13 +372,12 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -446,6 +448,10 @@ dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) @@ -472,6 +478,8 @@ distcheck: dist GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ @@ -623,8 +631,8 @@ uninstall-am: .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ - dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-generic distclean-hdr distclean-libtool \ + dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \ + distclean distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ Modified: head/contrib/openbsm/NEWS ============================================================================== --- head/contrib/openbsm/NEWS Sun Apr 19 15:19:26 2009 (r191272) +++ head/contrib/openbsm/NEWS Sun Apr 19 16:17:13 2009 (r191273) @@ -1,5 +1,23 @@ OpenBSM Version History +OpenBSM 1.1 + +- Change auditon(2) parameters and data structures to be 32/64-bit architecture + independent. Add more information to man page about auditon(2) parameters. +- Add wrapper functions for auditon(2) to use legacy commands when the new + commands are not supported. +- Add default for 'expire-after' in audit_control to expire trail files when + the audit directory is more than 10 megabytes ('10M'). +- Interface to convert between local and BSM fcntl(2) command values has been + added: au_bsm_to_fcntl_cmd(3) and au_fcntl_cmd_to_bsm(3), along with + definitions of constants in audit_fcntl.h. +- A bug, introduced in OpenBSM 1.1 alpha 4, in which AUT_RETURN32 tokens + generated by audit_submit(3) were improperly encoded has been fixed. +- Fix example in audit_submit(3) man page. Also, make it clear that we want + the audit ID as the argument. +- A new audit event class 'aa', for post-login authentication and + authorization events, has been added. + OpenBSM 1.1 beta 1 - The filesz parameter in audit_control(5) now accepts suffixes: 'B' for @@ -431,4 +449,4 @@ OpenBSM 1.0 alpha 1 to support reloading of kernel event table. - Allow comments in /etc/security configuration files. -$P4: //depot/projects/trustedbsd/openbsm/NEWS#32 $ +$P4: //depot/projects/trustedbsd/openbsm/NEWS#40 $ Modified: head/contrib/openbsm/README ============================================================================== --- head/contrib/openbsm/README Sun Apr 19 15:19:26 2009 (r191272) +++ head/contrib/openbsm/README Sun Apr 19 16:17:13 2009 (r191273) @@ -1,15 +1,22 @@ -OpenBSM 1.1 beta 1 +OpenBSM 1.1 Introduction -OpenBSM provides an open source implementation of Sun's BSM Audit API. -Originally created under contract to Apple Computer by McAfee Research, this -implementation is now maintained by volunteers and the generous contribution -of several organizations. Coupled with a kernel audit implementation, -OpenBSM can be used to maintain system audit streams, and is a foundation for -an Audit-enabled system. Portions of OpenBSM, including include files and -token-building routines, are reusable in a kernel audit implementation, and -may be found in the FreeBSD and Mac OS X kernels. +OpenBSM is an open source implementation of Sun's BSM event auditing file +format and API. Originally created for Apple Computer by McAfee Research, +OpenBSM is now maintained by volunteers and through the generous contribution +of several organizations. + +OpenBSM includes several command line tools, including auditreduce(8) and +praudit(8) for reducing and printing audit trails, as well as the libbsm(3) +library to manage configuration files, generate audit records, and parse and +print audit trils. + +Coupled with a kernel audit implementation, OpenBSM can be used to maintain +system audit streams, and is a foundation for a full audit-enabled system. +Portions of OpenBSM, including include files and token-building routines, are +reusable in a kernel audit implementation, and may be found in the FreeBSD +and Mac OS X kernels. Contents @@ -17,7 +24,7 @@ OpenBSM consists of several directories: bin/ Audit-related command line tools bsm/ Library include files for BSM - compat/ Compatibility code to build on various OS's + compat/ Compatibility code to build on various operating systems etc/ Sample /etc/security configuration files libauditd Common audit management functions for auditd and launchd libbsm/ Implementation of BSM library interfaces and man pages @@ -44,7 +51,8 @@ Please see the file INSTALL for build an The TrustedBSD Project would appreciate the contribution of bug fixes, enhancements, etc, under identically or substantially similar licenses to -those present on the remainder of the OpenBSM source code. +those present on the remainder of the OpenBSM source code. Please see the +file CREDITS to learn more about who has contributed to the project. Location @@ -56,4 +64,4 @@ Information on TrustedBSD may be found o http://www.TrustedBSD.org/ -$P4: //depot/projects/trustedbsd/openbsm/README#35 $ +$P4: //depot/projects/trustedbsd/openbsm/README#36 $ Modified: head/contrib/openbsm/TODO ============================================================================== --- head/contrib/openbsm/TODO Sun Apr 19 15:19:26 2009 (r191272) +++ head/contrib/openbsm/TODO Sun Apr 19 16:17:13 2009 (r191273) @@ -16,11 +16,10 @@ OpenBSM TODO just at the beginning of a record. This will make it easier to use praudit in test suites processing single-token files without header and trailer context. -- Put hostname in trail file name. - Document audit_warn event arguments. - Allow the path /etc/security to be configured at configure-time so that alternative locations can be used. - NLS support for au_strerror(3), which provides error strings for BSM errors not available on the local OS platform. -$P4: //depot/projects/trustedbsd/openbsm/TODO#12 $ +$P4: //depot/projects/trustedbsd/openbsm/TODO#13 $ Modified: head/contrib/openbsm/VERSION ============================================================================== --- head/contrib/openbsm/VERSION Sun Apr 19 15:19:26 2009 (r191272) +++ head/contrib/openbsm/VERSION Sun Apr 19 16:17:13 2009 (r191273) @@ -1 +1 @@ -OPENBSM_1_1_BETA_1 +OPENBSM_1_1 Modified: head/contrib/openbsm/aclocal.m4 ============================================================================== --- head/contrib/openbsm/aclocal.m4 Sun Apr 19 15:19:26 2009 (r191272) +++ head/contrib/openbsm/aclocal.m4 Sun Apr 19 16:17:13 2009 (r191273) @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10 -*- Autoconf -*- +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,14 +11,17 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_if(m4_PACKAGE_VERSION, [2.61],, -[m4_fatal([this file was generated for autoconf 2.61. -You have another version of autoconf. If you want to use that, -you should regenerate the build system entirely.], [63])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.62],, +[m4_warning([this file was generated for autoconf 2.62. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# serial 51 AC_PROG_LIBTOOL +# serial 52 AC_PROG_LIBTOOL # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) @@ -106,7 +109,6 @@ AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl AC_REQUIRE([AC_OBJEXT])dnl AC_REQUIRE([AC_EXEEXT])dnl dnl - AC_LIBTOOL_SYS_MAX_CMD_LEN AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE AC_LIBTOOL_OBJDIR @@ -208,6 +210,8 @@ file_magic*) ;; esac +_LT_REQUIRED_DARWIN_CHECKS + AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) @@ -287,9 +291,80 @@ ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` -$rm conftest* +$rm -r conftest* ])# _LT_LINKER_BOILERPLATE +# _LT_REQUIRED_DARWIN_CHECKS +# -------------------------- +# Check for some things on darwin +AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + echo "int foo(void){return 1;}" > conftest.c + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib ${wl}-single_module conftest.c + if test -f libconftest.dylib; then + lt_cv_apple_cc_single_mod=yes + rm -rf libconftest.dylib* + fi + rm conftest.c + fi]) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + case $host_os in + rhapsody* | darwin1.[[0123]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}" + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil="~$DSYMUTIL \$lib || :" + else + _lt_dsymutil= + fi + ;; + esac +]) # _LT_AC_SYS_LIBPATH_AIX # ---------------------- @@ -614,7 +689,11 @@ sparc*-*solaris*) *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) LD="${LD-ld} -64" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; esac ;; esac @@ -707,7 +786,7 @@ AC_CACHE_CHECK([$1], [$2], $2=yes fi fi - $rm conftest* + $rm -r conftest* LDFLAGS="$save_LDFLAGS" ]) @@ -978,7 +1057,7 @@ else AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], @@ -986,7 +1065,7 @@ else [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) @@ -1303,7 +1382,7 @@ aix3*) soname_spec='${libname}${release}${shared_ext}$major' ;; -aix4* | aix5*) +aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no @@ -1824,6 +1903,13 @@ esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no +AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec], +[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"]) +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec], +[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"]) +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" @@ -2323,7 +2409,7 @@ lt_cv_deplibs_check_method='unknown' # whether `pass_all' will *always* work, you probably want this one. case $host_os in -aix4* | aix5*) +aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; @@ -2759,7 +2845,7 @@ aix3*) fi ;; -aix4* | aix5*) +aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi @@ -2816,6 +2902,7 @@ _LT_AC_TAGVAR(postdep_objects, $1)= _LT_AC_TAGVAR(predeps, $1)= _LT_AC_TAGVAR(postdeps, $1)= _LT_AC_TAGVAR(compiler_lib_search_path, $1)= +_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)= # Source file extension for C++ test sources. ac_ext=cpp @@ -2925,7 +3012,7 @@ case $host_os in # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aix4* | aix5*) + aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. @@ -2938,7 +3025,7 @@ case $host_os in # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) @@ -3084,51 +3171,23 @@ case $host_os in fi ;; darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no + _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + if test "$GXX" = yes ; then output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) @@ -3379,7 +3438,7 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC* | pgcpp*) # Portland Group C++ compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' @@ -3814,7 +3873,8 @@ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP], +[AC_REQUIRE([LT_AC_PROG_SED])dnl dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each @@ -3939,6 +3999,11 @@ fi $rm -f confest.$objext +_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi + # PORTME: override above test on systems where it is broken ifelse([$1],[CXX], [case $host_os in @@ -3995,7 +4060,6 @@ solaris*) ;; esac ]) - case " $_LT_AC_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac @@ -4080,7 +4144,7 @@ aix3*) postinstall_cmds='$RANLIB $lib' fi ;; -aix4* | aix5*) +aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi @@ -4257,6 +4321,7 @@ if test -f "$ltmain"; then _LT_AC_TAGVAR(predeps, $1) \ _LT_AC_TAGVAR(postdeps, $1) \ _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \ _LT_AC_TAGVAR(archive_cmds, $1) \ _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ _LT_AC_TAGVAR(postinstall_cmds, $1) \ @@ -4319,7 +4384,7 @@ ifelse([$1], [], # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: @@ -4556,6 +4621,10 @@ predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) # shared library. postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1) + # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) @@ -4905,7 +4974,7 @@ EOF echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi - rm -f conftest* conftst* + rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then @@ -4962,7 +5031,8 @@ AC_MSG_CHECKING([for $compiler option to # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform @@ -4999,7 +5069,7 @@ AC_MSG_CHECKING([for $compiler option to esac else case $host_os in - aix4* | aix5*) + aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor @@ -5095,7 +5165,7 @@ AC_MSG_CHECKING([for $compiler option to _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC*) + pgCC* | pgcpp*) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' @@ -5246,7 +5316,8 @@ AC_MSG_CHECKING([for $compiler option to # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) @@ -5316,7 +5387,8 @@ AC_MSG_CHECKING([for $compiler option to mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) @@ -5453,7 +5525,7 @@ AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_co # if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1), [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; @@ -5477,7 +5549,7 @@ esac # wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) @@ -5493,7 +5565,7 @@ AC_MSG_CHECKING([whether the $compiler l ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in - aix4* | aix5*) + aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then @@ -5512,6 +5584,7 @@ ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac + _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ],[ runpath_var= _LT_AC_TAGVAR(allow_undefined_flag, $1)= @@ -5542,12 +5615,14 @@ ifelse([$1],[CXX],[ # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. _LT_CC_BASENAME([$compiler]) @@ -5597,7 +5672,7 @@ ifelse([$1],[CXX],[ # See if GNU ld supports shared libraries. case $host_os in - aix3* | aix4* | aix5*) + aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -5816,7 +5891,7 @@ _LT_EOF fi ;; - aix4* | aix5*) + aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. @@ -5836,7 +5911,7 @@ _LT_EOF # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes @@ -5996,11 +6071,10 @@ _LT_EOF _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else case $cc_basename in xlc*) @@ -6581,7 +6655,7 @@ AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ]) -# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -6596,7 +6670,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10], [], +m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -6612,8 +6686,10 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10])dnl -_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -6885,7 +6961,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue @@ -6933,13 +7009,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS] # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 12 +# serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -7044,16 +7120,17 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC], # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. +_am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $1 | $1:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # @@ -7354,7 +7431,7 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- -# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) Modified: head/contrib/openbsm/bin/Makefile.in ============================================================================== --- head/contrib/openbsm/bin/Makefile.in Sun Apr 19 15:19:26 2009 (r191272) +++ head/contrib/openbsm/bin/Makefile.in Sun Apr 19 16:17:13 2009 (r191273) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,7 @@ @SET_MAKE@ # -# $P4: //depot/projects/trustedbsd/openbsm/bin/Makefile.in#10 $ +# $P4: //depot/projects/trustedbsd/openbsm/bin/Makefile.in#11 $ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ @@ -82,6 +82,7 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -106,6 +107,7 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MIG = @MIG@ MKDIR_P = @MKDIR_P@ +NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -169,6 +171,7 @@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = auditfilterd auditreduce praudit $(am__append_1) @@ -286,8 +289,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -312,8 +315,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCE unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -323,13 +326,12 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique Modified: head/contrib/openbsm/bin/audit/Makefile.in ============================================================================== --- head/contrib/openbsm/bin/audit/Makefile.in Sun Apr 19 15:19:26 2009 (r191272) +++ head/contrib/openbsm/bin/audit/Makefile.in Sun Apr 19 16:17:13 2009 (r191273) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,7 @@ @SET_MAKE@ # -# $P4: //depot/projects/trustedbsd/openbsm/bin/audit/Makefile.in#11 $ +# $P4: //depot/projects/trustedbsd/openbsm/bin/audit/Makefile.in#12 $ # VPATH = @srcdir@ @@ -55,7 +55,7 @@ am__audit_SOURCES_DIST = audit.c auditd_ @USE_MACH_IPC_TRUE@ audit.$(OBJEXT) audit_OBJECTS = $(am_audit_OBJECTS) audit_DEPENDENCIES = $(top_builddir)/libbsm/libbsm.la -DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 16:54:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C12F5106564A; Sun, 19 Apr 2009 16:54:33 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 951108FC0C; Sun, 19 Apr 2009 16:54:33 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JGsXt5014880; Sun, 19 Apr 2009 16:54:33 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JGsXUx014879; Sun, 19 Apr 2009 16:54:33 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200904191654.n3JGsXUx014879@svn.freebsd.org> From: Robert Noland Date: Sun, 19 Apr 2009 16:54: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: r191274 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 16:54:34 -0000 Author: rnoland Date: Sun Apr 19 16:54:33 2009 New Revision: 191274 URL: http://svn.freebsd.org/changeset/base/191274 Log: Don't try to setup interrupts for drivers that don't support them. This causes sis and probably a couple of other driver to panic and fail. Tested by: cpghost PR: 133554 MFC after: 3 days Modified: head/sys/dev/drm/drm_drv.c Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Sun Apr 19 16:17:13 2009 (r191273) +++ head/sys/dev/drm/drm_drv.c Sun Apr 19 16:54:33 2009 (r191274) @@ -134,7 +134,7 @@ static struct cdevsw drm_cdevsw = { .d_flags = D_TRACKCLOSE }; -int drm_msi = 1; /* Enable by default. */ +static int drm_msi = 1; /* Enable by default. */ TUNABLE_INT("hw.drm.msi", &drm_msi); static struct drm_msi_blacklist_entry drm_msi_blacklist[] = { @@ -228,28 +228,31 @@ int drm_attach(device_t kdev, drm_pci_id dev->pci_vendor = pci_get_vendor(dev->device); dev->pci_device = pci_get_device(dev->device); - if (drm_msi && - !drm_msi_is_blacklisted(dev->pci_vendor, dev->pci_device)) { - msicount = pci_msi_count(dev->device); - DRM_DEBUG("MSI count = %d\n", msicount); - if (msicount > 1) - msicount = 1; + if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) { + if (drm_msi && + !drm_msi_is_blacklisted(dev->pci_vendor, dev->pci_device)) { + msicount = pci_msi_count(dev->device); + DRM_DEBUG("MSI count = %d\n", msicount); + if (msicount > 1) + msicount = 1; + + if (pci_alloc_msi(dev->device, &msicount) == 0) { + DRM_INFO("MSI enabled %d message(s)\n", + msicount); + dev->msi_enabled = 1; + dev->irqrid = 1; + } + } - if (pci_alloc_msi(dev->device, &msicount) == 0) { - DRM_INFO("MSI enabled %d message(s)\n", msicount); - dev->msi_enabled = 1; - dev->irqrid = 1; + dev->irqr = bus_alloc_resource_any(dev->device, SYS_RES_IRQ, + &dev->irqrid, RF_SHAREABLE); + if (!dev->irqr) { + return ENOENT; } - } - dev->irqr = bus_alloc_resource_any(dev->device, SYS_RES_IRQ, - &dev->irqrid, RF_SHAREABLE); - if (!dev->irqr) { - return ENOENT; + dev->irq = (int) rman_get_start(dev->irqr); } - dev->irq = (int) rman_get_start(dev->irqr); - mtx_init(&dev->dev_lock, "drmdev", NULL, MTX_DEF); mtx_init(&dev->irq_lock, "drmirq", NULL, MTX_DEF); mtx_init(&dev->vbl_lock, "drmvbl", NULL, MTX_DEF); From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 17:13:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBD8D10656B2; Sun, 19 Apr 2009 17:13:38 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.28]) by mx1.freebsd.org (Postfix) with ESMTP id 38ACB8FC19; Sun, 19 Apr 2009 17:13:38 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by yw-out-2324.google.com with SMTP id 5so985002ywh.13 for ; Sun, 19 Apr 2009 10:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=JYlm51MtNnr3upvOo1Yo3bGQWy0y62pELjzzImBnddI=; b=g9xxJuNEtGb7VCJXxPwbB5KfPISNskgJmgmmY8N4rA6j7wBDl73yheVDFa5+fJzram zJzwT/r+YdJBXDVG+u+CEYnJfdQXFmGvvAifp7NjEyvEDleoWICLe4sMtRKvgGoF7YVP RnaoAMIK53CYY9+sE8LVdSLsRtYTi36uJx9Mc= 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=kh+gxbY3jkCL7qKmEbWjNHHn2JVUL719gqtsp+Q+uJLHXPNVCWNxcclbKTzZ6hUvVI 9GCi4Smgoy1kREYfsO4HLmq8vz+yAfeW6S6FXtluJ/6Zc6RRKFhmOgokB2m+BXsykJEI 0qfrMw+C0f0FjGUng8iaKUzqA6e9Z+eLykaY8= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.46.10 with SMTP id t10mr6467216ant.116.1240161217532; Sun, 19 Apr 2009 10:13:37 -0700 (PDT) In-Reply-To: <49EAFA62.3010000@freebsd.org> References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <49EAFA62.3010000@freebsd.org> Date: Sun, 19 Apr 2009 10:13:37 -0700 X-Google-Sender-Auth: 9088775c223f924a Message-ID: <3c1674c90904191013h119d040u1c59772a94dad2f1@mail.gmail.com> From: Kip Macy To: Andre Oppermann 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, Robert Watson Subject: Re: svn commit: r191259 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 17:13:39 -0000 On Sun, Apr 19, 2009 at 3:18 AM, Andre Oppermann wrote: > Robert Watson wrote: >> >> On Sun, 19 Apr 2009, Kip Macy wrote: >> >>> Author: kmacy >>> Date: Sun Apr 19 04:44:05 2009 >>> New Revision: 191259 >>> URL: http://svn.freebsd.org/changeset/base/191259 > I have another question on the flowtable: =A0What is the pupose of it? > All router vendors have learned a long time ago that route caching > (aka flow caching) doesn't work out on a router that carries the DFZ > (default free zone, currently ~280k prefixes). =A0The overhead of managin= g > the flow table and the high churn rate make it much more expensive than > a direct and already very efficient radix trie lookup. Additionally a > well connected DFZ router has some 1k prefix updates per second. =A0More > information can be found for example at Cisco here: > =A0http://www.cisco.com/en/US/tech/tk827/tk831/technologies_white_paper09= 186a00800a62d9.shtml > The same findings are also available from all other major router vendors > like Juniper, Foundry, etc. > > Lets examine the situations: > =A0a) internal router with only a few routes; The routing and ARP table > =A0 =A0are small, lookups are very fast and everything is hot in the CPU > =A0 =A0caches anyway. > =A0b) DFZ router with 280k routes; A small flow table has constant thrash= ing > =A0 =A0becoming negative overhead only. =A0A large flow table has a high > maintenance > =A0 =A0overhead, higher lookup times and sill a significant amount of thr= ashing. > =A0 =A0The overhead of the flow table is equal or higher than a direct ro= uting > =A0 =A0table lookup. > Concluding that a flow table is never a win but a liability in any realis= tic > setting. You're assuming that a Cisco- / Juniper-class workload is representative of where FreeBSD is deployed. I agree that FreeBSD is sub-optimal for large routing environments for a whole host of other reasons. A better question is what are "typical" FreeBSD deployments, and how well would it work there. The flowtable needs to be sized to correspond to the number of flows, its utility rapidly diminishes as the number of collisions per bucket increases. The number of routes isn't the key metric, it is the number of flows active within a 30 second period. On current hardware we probably could not handle more than a couple of million concurrent flows (with a 4 million entry hash table). > Now I don't have benchmark numbers to back up the theory I put forth here= . > However I want to bring up the rationale for why nobody else is doing it. > A statistical analysis easily shows that flow caching has only a few smal= l > spots where it may offer some advantage over direct routing table lookups= ; > none of them are where it matter in real work situations. I can't argue with you, because you have not adequately characterize "real" work situations. I know that it is useful for the commercial environments with which I am familiar. > As our kernel currently stands an advantage of the flow table can certain= ly > be demonstrated for a small routing table and a small number of flows. = =A0This > is due to a very sub-optimal routing table implementation we have. =A0The= flow > table approach short-cuts a significant number of locking operations > (routing > table, routing entries, ARP table and possibly some more). =A0On the othe= r > hand > this caching of flows and pointers to routing entries and ARP entries > complicates > updates to these tables and potentially makes them very expensive. Incorrect. The implementation of the routing and arp tables are unchanged with the inclusion of the flowtable. Any complexity in their implementations is completely decoupled from the flowtable. If their implementations change, the flowtable will follow suit. > =A0Additionally > is creates a "tangled mess" again complicating future changes and advance= s > in > those areas (unless the flow table were simply removed again at that poin= t). The two will remain separate, please do no confuse matters. > I argue that instead of cludging around (the flow table) a sub-optimal pa= rt > of the network stack (the current incarnation of the routing table) time > could > be equally spent wiser on fixing the problems in the first place. =A0I've > outlined > a few approaches a couple of times before on the mailing lists. =A0If the > routing > table would no longer support direct pointers to entries the locking coul= d > be > significantly simplified and the ARP table could use rmlocks (read-mostly > locks) > as it is changed only very infrequently. =A0It's all about the number of = locks > that > have to be aquired per packet/lookup. =A0It also has the benefit of an or= der > of a > magnitude less complexity (and hard to debug egde cases, which cannot be > under- > estimated). In principle the ARP table could use rmlocks now. For the routing table you thing we should copy the rtentry out? I agree that the locked ref counting of rtentrys has ridiculously high overhead and would love to see that go away. The one major concern that I had when looking at doing that was the need to ensure continued liveness of the structures pointed to by the rtentry. -Kip From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 17:18:09 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D9C21065673; Sun, 19 Apr 2009 17:18:09 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id 139DF8FC08; Sun, 19 Apr 2009 17:18:09 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id n3JHI7VR078412; Sun, 19 Apr 2009 12:18:07 -0500 (CDT) (envelope-from scf@FreeBSD.org) Date: Sun, 19 Apr 2009 12:18:07 -0500 (CDT) From: "Sean C. Farley" To: Juli Mallett In-Reply-To: Message-ID: References: <200904170801.n3H81Iho016111@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 X-Spam-Status: No, score=-2.6 required=4.0 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, Kevin Lo , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191197 - 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: Sun, 19 Apr 2009 17:18:09 -0000 On Fri, 17 Apr 2009, Juli Mallett wrote: > On Fri, Apr 17, 2009 at 1:01 AM, Kevin Lo wrote: >> Log: >> Change Taiwan, Province of China to Taiwan, Republic of China >> >> Modified: >> head/share/misc/iso3166 > > Do you have a source for this change? The ISO sites I've checked > don't support it. For example: > > http://www.iso.org/iso/iso-3166-1_decoding_table > > And no obvious recent name change item on the "What's new?" page: > > http://www.iso.org/iso/country_codes/check_what_s_new.htm Unfortunately, it is still referred to as "Province of China" although there is a lawsuit[1] attempting to change it to "Republic of China". Sean 1. http://www.taipeitimes.com/News/taiwan/archives/2008/09/19/2003423640 -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 18:23:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 263E81065674; Sun, 19 Apr 2009 18:23:24 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09A168FC14; Sun, 19 Apr 2009 18:23:24 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JINNMj016809; Sun, 19 Apr 2009 18:23:23 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JINNiv016808; Sun, 19 Apr 2009 18:23:23 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200904191823.n3JINNiv016808@svn.freebsd.org> From: Poul-Henning Kamp Date: Sun, 19 Apr 2009 18:23: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: r191275 - head/tools/tools/nanobsd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 18:23:25 -0000 Author: phk Date: Sun Apr 19 18:23:23 2009 New Revision: 191275 URL: http://svn.freebsd.org/changeset/base/191275 Log: A script for plucking packages and their runtime dependencies for nanobsd images. Added: head/tools/tools/nanobsd/fill_pkg.sh (contents, props changed) Added: head/tools/tools/nanobsd/fill_pkg.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/nanobsd/fill_pkg.sh Sun Apr 19 18:23:23 2009 (r191275) @@ -0,0 +1,96 @@ +#!/bin/sh +# +# Copyright (c) 2009 Poul-Henning Kamp. +# 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$ +# +# Usage: +# $0 PACKAGE_DUMP NANO_PACKAGE_DIR /usr/ports/foo/bar ... +# +# Will symlink the packages listed, including their runtime dependencies, +# from the PACKAGE_DUMP to the NANO_PACKAGE_DIR. +# + +NANO_PKG_DUMP=$1 +shift; +if [ ! -d $NANO_PKG_DUMP ] ; then + echo "$NANO_PKG_DUMP not a directory" 1>&2 + exit 1 +fi + +NANO_PACKAGE_DIR=$1 +shift; + +ports_recurse() ( + of=$1 + shift + for d + do + if [ ! -d $d ] ; then + echo "Missing port $d" 1>&2 + exit 2 + fi + if grep -q "^$d\$" $of ; then + true + else + ( + cd $d + rd=`make -V RUN_DEPENDS` + ld=`make -V LIB_DEPENDS` + + for x in $rd $ld + do + ports_recurse $of `echo $x | + sed 's/^[^:]*:\([^:]*\).*$/\1/'` + done + ) + echo $d >> $of + fi + done +) + +rm -rf $NANO_PACKAGE_DIR +mkdir -p $NANO_PACKAGE_DIR + +PL=$NANO_PACKAGE_DIR/_list +true > $PL +for i +do + ports_recurse `pwd`/$PL $i +done + +for i in `cat $PL` +do + p=`(cd $i && make -V PKGNAME)` + if [ -f $NANO_PKG_DUMP/$p.tbz ] ; then + ln -s $NANO_PKG_DUMP/$p.tbz $NANO_PACKAGE_DIR + else + echo "Package $p misssing in $NANO_PKG_DUMP" 1>&2 + exit 1 + fi +done + +rm -f $PL +exit 0 From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 19:19:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9360310656A7; Sun, 19 Apr 2009 19:19:39 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id A48308FC2E; Sun, 19 Apr 2009 19:19:38 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from wolfram.andreas.nets ([91.190.8.131]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id n3JJ3sfi041004; Sun, 19 Apr 2009 21:03:55 +0200 (CEST) (envelope-from andreast-list@fgznet.ch) Message-ID: <49EB759A.5030008@fgznet.ch> Date: Sun, 19 Apr 2009 21:03:54 +0200 From: Andreas Tobler User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: Nathan Whitehorn References: <200904190630.n3J6U14U001240@svn.freebsd.org> In-Reply-To: <200904190630.n3J6U14U001240@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: r191261 - in head/sys/powerpc: aim include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 19:19:49 -0000 Nathan Whitehorn wrote: > Author: nwhitehorn > Date: Sun Apr 19 06:30:00 2009 > New Revision: 191261 > URL: http://svn.freebsd.org/changeset/base/191261 > > Log: > Fix a typo in the SRR1 comparison for program exceptions. While here, > replace magic numbers with constants to keep this from happening again. > > Without this fix, some programs would occasionally get SIGTRAP instead > of SIGILL on an illegal instruction. This affected Altivec detection > in pixman, and possibly other software. > > Reported by: Andreas Tobler > MFC after: 1 week > Thank you, I rebuilt pixman with the default options and I do not get X11 crashes anymore. Regards, Andreas From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 20:19:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C040C1065709; Sun, 19 Apr 2009 20:19:14 +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 77AE98FC08; Sun, 19 Apr 2009 20:19:14 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JKJEWc019187; Sun, 19 Apr 2009 20:19:14 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JKJDa6019179; Sun, 19 Apr 2009 20:19:13 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192019.n3JKJDa6019179@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 20:19: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: r191276 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 20:19:15 -0000 Author: rwatson Date: Sun Apr 19 20:19:13 2009 New Revision: 191276 URL: http://svn.freebsd.org/changeset/base/191276 Log: For each architecture, define CACHE_LINE_SHIFT and a derived CACHE_LINE_SIZE constant. These constants are intended to over-estimate the cache line size, and be used at compile-time when a run-time tuning alternative isn't appropriate or available. Defaults for all architectures are 64 bytes, except powerpc where it is 128 bytes (used on G5 systems). MFC after: 2 weeks Discussed on: arch@ Modified: head/sys/amd64/include/param.h head/sys/arm/include/param.h head/sys/i386/include/param.h head/sys/ia64/include/param.h head/sys/mips/include/param.h head/sys/powerpc/include/param.h head/sys/sparc64/include/param.h head/sys/sun4v/include/param.h Modified: head/sys/amd64/include/param.h ============================================================================== --- head/sys/amd64/include/param.h Sun Apr 19 18:23:23 2009 (r191275) +++ head/sys/amd64/include/param.h Sun Apr 19 20:19:13 2009 (r191276) @@ -89,6 +89,10 @@ #define ALIGN(p) _ALIGN(p) #define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) +#ifndef CACHE_LINE_SHIFT +#define CACHE_LINE_SHIFT 6 +#endif +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) /* Size of the level 1 page table units */ #define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) Modified: head/sys/arm/include/param.h ============================================================================== --- head/sys/arm/include/param.h Sun Apr 19 18:23:23 2009 (r191275) +++ head/sys/arm/include/param.h Sun Apr 19 20:19:13 2009 (r191276) @@ -81,6 +81,11 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +#ifndef CACHE_LINE_SHIFT +#define CACHE_LINE_SHIFT 6 +#endif +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) + #define PAGE_SHIFT 12 #define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */ #define PAGE_MASK (PAGE_SIZE - 1) Modified: head/sys/i386/include/param.h ============================================================================== --- head/sys/i386/include/param.h Sun Apr 19 18:23:23 2009 (r191275) +++ head/sys/i386/include/param.h Sun Apr 19 20:19:13 2009 (r191276) @@ -74,6 +74,11 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +#ifndef CACHE_LINE_SHIFT +#define CACHE_LINE_SHIFT 6 +#endif +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) + #define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ #define PAGE_SIZE (1< Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36C411065670; Sun, 19 Apr 2009 20:24:09 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id E39628FC15; Sun, 19 Apr 2009 20:24:08 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id B3F0B9CB0EA; Sun, 19 Apr 2009 22:22:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X+vPs0uswFlz; Sun, 19 Apr 2009 22:22:53 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 7B87A9CB10F; Sun, 19 Apr 2009 22:22:53 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n3JKMrEM029699; Sun, 19 Apr 2009 22:22:53 +0200 (CEST) (envelope-from rdivacky) Date: Sun, 19 Apr 2009 22:22:53 +0200 From: Roman Divacky To: Dmitry Chagin Message-ID: <20090419202253.GA28306@freebsd.org> References: <200904191348.n3JDmhVH010871@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200904191348.n3JDmhVH010871@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191269 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 20:24:09 -0000 On Sun, Apr 19, 2009 at 01:48:43PM +0000, Dmitry Chagin wrote: > Author: dchagin > Date: Sun Apr 19 13:48:42 2009 > New Revision: 191269 > URL: http://svn.freebsd.org/changeset/base/191269 > > Log: > Remove support for FUTEX_REQUEUE operation. > Glibc does not use this operation since 2.3.3 version (Jun 2004), > as it is racy and replaced by FUTEX_CMP_REQUEUE operation. > Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when > FUTEX_REQUEUE returned EINVAL. > > Any application directly using FUTEX_REQUEUE without return > value checking are definitely broken. > > Limit quantity of messages per process about unsupported > operation. > > Approved by: kib (mentor) > MFC after: 1 month > > Modified: > head/sys/compat/linux/linux_emul.c > head/sys/compat/linux/linux_emul.h > head/sys/compat/linux/linux_futex.c > > Modified: head/sys/compat/linux/linux_emul.c > ============================================================================== > --- head/sys/compat/linux/linux_emul.c Sun Apr 19 12:41:37 2009 (r191268) > +++ head/sys/compat/linux/linux_emul.c Sun Apr 19 13:48:42 2009 (r191269) > @@ -86,6 +86,7 @@ linux_proc_init(struct thread *td, pid_t > em = malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO); > em->pid = child; > em->pdeath_signal = 0; > + em->used_requeue = 0; > em->robust_futexes = NULL; > if (flags & LINUX_CLONE_THREAD) { > /* handled later in the code */ > > Modified: head/sys/compat/linux/linux_emul.h > ============================================================================== > --- head/sys/compat/linux/linux_emul.h Sun Apr 19 12:41:37 2009 (r191268) > +++ head/sys/compat/linux/linux_emul.h Sun Apr 19 13:48:42 2009 (r191269) > @@ -51,6 +51,7 @@ struct linux_emuldata { > struct linux_emuldata_shared *shared; > > int pdeath_signal; /* parent death signal */ > + int used_requeue; /* uses deprecated futex op */ what is the point of this variable? it's only set and never read From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 20:38:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BAE21065670; Sun, 19 Apr 2009 20:38:40 +0000 (UTC) (envelope-from zec@freebsd.org) Received: from labs4.cc.fer.hr (labs4.cc.fer.hr [161.53.72.24]) by mx1.freebsd.org (Postfix) with ESMTP id 996C48FC24; Sun, 19 Apr 2009 20:38:39 +0000 (UTC) (envelope-from zec@freebsd.org) Received: from sluga.fer.hr (sluga.cc.fer.hr [161.53.72.14]) by labs4.cc.fer.hr (8.14.2/8.14.2) with ESMTP id n3JKMMj1021109; Sun, 19 Apr 2009 22:22:22 +0200 (CEST) Received: from [192.168.200.110] ([161.53.19.79]) by sluga.fer.hr over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Sun, 19 Apr 2009 22:21:59 +0200 From: Marko Zec To: Kip Macy Date: Sun, 19 Apr 2009 22:21:55 +0200 User-Agent: KMail/1.9.10 References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <49EAFA62.3010000@freebsd.org> <3c1674c90904191013h119d040u1c59772a94dad2f1@mail.gmail.com> In-Reply-To: <3c1674c90904191013h119d040u1c59772a94dad2f1@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200904192221.55744.zec@freebsd.org> X-OriginalArrivalTime: 19 Apr 2009 20:21:59.0969 (UTC) FILETIME=[7E5FA910:01C9C12C] X-Scanned-By: MIMEDefang 2.64 on 161.53.72.24 Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann Subject: Re: svn commit: r191259 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 20:38:40 -0000 On Sunday 19 April 2009 19:13:37 Kip Macy wrote: > On Sun, Apr 19, 2009 at 3:18 AM, Andre Oppermann wrot= e: =2E.. > > I have another question on the flowtable: =A0What is the pupose of it? > > All router vendors have learned a long time ago that route caching > > (aka flow caching) doesn't work out on a router that carries the DFZ > > (default free zone, currently ~280k prefixes). =A0The overhead of manag= ing > > the flow table and the high churn rate make it much more expensive than > > a direct and already very efficient radix trie lookup. Additionally a > > well connected DFZ router has some 1k prefix updates per second. =A0More > > information can be found for example at Cisco here: > > =A0http://www.cisco.com/en/US/tech/tk827/tk831/technologies_white_paper= 0918 > >6a00800a62d9.shtml The same findings are also available from all other > > major router vendors like Juniper, Foundry, etc. > > > > Lets examine the situations: > > =A0a) internal router with only a few routes; The routing and ARP table > > =A0 =A0are small, lookups are very fast and everything is hot in the CPU > > =A0 =A0caches anyway. > > =A0b) DFZ router with 280k routes; A small flow table has constant > > thrashing becoming negative overhead only. =A0A large flow table has a = high > > maintenance > > =A0 =A0overhead, higher lookup times and sill a significant amount of > > thrashing. The overhead of the flow table is equal or higher than a > > direct routing table lookup. > > Concluding that a flow table is never a win but a liability in any > > realistic setting. > > You're assuming that a Cisco- / Juniper-class workload is > representative of where FreeBSD is deployed. I agree that FreeBSD is > sub-optimal for large routing environments for a whole host of other > reasons. A better question is what are "typical" FreeBSD deployments, > and how well would it work there. The flowtable needs to be sized to > correspond to the number of flows, its utility rapidly diminishes as > the number of collisions per bucket increases. =2E.. which makes a flow cache a perfect DoS target in any environment, be = it a=20 DFZ or enterprise router or an end host or whatever. Marko > The number of routes=20 > isn't the key metric, it is the number of flows active within a 30 > second period. On current hardware we probably could not handle more > than a couple of million concurrent flows (with a 4 million entry hash > table). From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 20:40:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 499111065688; Sun, 19 Apr 2009 20:40:10 +0000 (UTC) (envelope-from dchagin@dchagin.static.corbina.ru) Received: from contrabass.post.ru (contrabass.post.ru [85.21.78.5]) by mx1.freebsd.org (Postfix) with ESMTP id BA83B8FC15; Sun, 19 Apr 2009 20:40:09 +0000 (UTC) (envelope-from dchagin@dchagin.static.corbina.ru) Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.post.ru (Postfix) with ESMTP id 722B689D0B; Mon, 20 Apr 2009 00:40:07 +0400 (MSD) X-Virus-Scanned: by cgpav Uf39PSi9pFi9oFi9 Received: from [10.208.17.3] (HELO dchagin.static.corbina.ru) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPS id 1747494717; Mon, 20 Apr 2009 00:40:07 +0400 Received: from dchagin.static.corbina.ru (localhost.chd.net [127.0.0.1]) by dchagin.static.corbina.ru (8.14.3/8.14.3) with ESMTP id n3JKe5QR006774; Mon, 20 Apr 2009 00:40:05 +0400 (MSD) (envelope-from dchagin@dchagin.static.corbina.ru) Received: (from dchagin@localhost) by dchagin.static.corbina.ru (8.14.3/8.14.3/Submit) id n3JKe3c6006773; Mon, 20 Apr 2009 00:40:03 +0400 (MSD) (envelope-from dchagin) Date: Mon, 20 Apr 2009 00:40:03 +0400 From: Chagin Dmitry To: Roman Divacky Message-ID: <20090419204002.GA6716@dchagin.static.corbina.ru> References: <200904191348.n3JDmhVH010871@svn.freebsd.org> <20090419202253.GA28306@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline In-Reply-To: <20090419202253.GA28306@freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191269 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 20:40:10 -0000 --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Apr 19, 2009 at 10:22:53PM +0200, Roman Divacky wrote: > On Sun, Apr 19, 2009 at 01:48:43PM +0000, Dmitry Chagin wrote: > > Author: dchagin > > Date: Sun Apr 19 13:48:42 2009 > > New Revision: 191269 > > URL: http://svn.freebsd.org/changeset/base/191269 > >=20 > > Log: > > Remove support for FUTEX_REQUEUE operation. > > Glibc does not use this operation since 2.3.3 version (Jun 2004), > > as it is racy and replaced by FUTEX_CMP_REQUEUE operation. > > Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when > > FUTEX_REQUEUE returned EINVAL. > > =20 > > Any application directly using FUTEX_REQUEUE without return > > value checking are definitely broken. > > =20 > > Limit quantity of messages per process about unsupported > > operation. > > =20 > > Approved by: kib (mentor) > > MFC after: 1 month > >=20 > > Modified: > > head/sys/compat/linux/linux_emul.c > > head/sys/compat/linux/linux_emul.h > > head/sys/compat/linux/linux_futex.c > >=20 > > Modified: head/sys/compat/linux/linux_emul.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/compat/linux/linux_emul.c Sun Apr 19 12:41:37 2009 (r19126= 8) > > +++ head/sys/compat/linux/linux_emul.c Sun Apr 19 13:48:42 2009 (r19126= 9) > > @@ -86,6 +86,7 @@ linux_proc_init(struct thread *td, pid_t > > em =3D malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO); > > em->pid =3D child; > > em->pdeath_signal =3D 0; > > + em->used_requeue =3D 0; > > em->robust_futexes =3D NULL; > > if (flags & LINUX_CLONE_THREAD) { > > /* handled later in the code */ > >=20 > > Modified: head/sys/compat/linux/linux_emul.h > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/compat/linux/linux_emul.h Sun Apr 19 12:41:37 2009 (r19126= 8) > > +++ head/sys/compat/linux/linux_emul.h Sun Apr 19 13:48:42 2009 (r19126= 9) > > @@ -51,6 +51,7 @@ struct linux_emuldata { > > struct linux_emuldata_shared *shared; > > =20 > > int pdeath_signal; /* parent death signal */ > > + int used_requeue; /* uses deprecated futex op */ >=20 > what is the point of this variable? it's only set and never read hi, hmm, it is the counter. it is used, you cut off this piece of a code in the reply. --=20 Have fun! chd --BOKacYhQ+x31HxR3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEARECAAYFAknrjCEACgkQ0t2Tb3OO/O2IIQCfRWaDZsKuJ6fiQHWucTliPTHQ jvoAoJp23sOXWtgIssVgPwErUEYbgKmI =ASMW -----END PGP SIGNATURE----- --BOKacYhQ+x31HxR3-- From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 20:53:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDD8A1065676; Sun, 19 Apr 2009 20:53:47 +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 C31988FC08; Sun, 19 Apr 2009 20:53:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JKrlof019904; Sun, 19 Apr 2009 20:53:47 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JKrl4T019903; Sun, 19 Apr 2009 20:53:47 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200904192053.n3JKrl4T019903@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 19 Apr 2009 20:53: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: r191277 - 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: Sun, 19 Apr 2009 20:53:48 -0000 Author: kib Date: Sun Apr 19 20:53:47 2009 New Revision: 191277 URL: http://svn.freebsd.org/changeset/base/191277 Log: In both pageout oom handler and vm_daemon, acquire the reference to the vmspace of the examined process instead of directly accessing its vmspace, that may change. Also, as an optimization, check for P_INEXEC flag before examining the process. Reported and tested by: pho (previous version) Reviewed by: alc MFC after: 3 week Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sun Apr 19 20:19:13 2009 (r191276) +++ head/sys/vm/vm_pageout.c Sun Apr 19 20:53:47 2009 (r191277) @@ -1183,6 +1183,7 @@ vm_pageout_oom(int shortage) struct proc *p, *bigproc; vm_offset_t size, bigsize; struct thread *td; + struct vmspace *vm; /* * We keep the process bigproc locked once we find it to keep anyone @@ -1203,8 +1204,8 @@ vm_pageout_oom(int shortage) /* * If this is a system or protected process, skip it. */ - if ((p->p_flag & P_SYSTEM) || (p->p_pid == 1) || - (p->p_flag & P_PROTECTED) || + if ((p->p_flag & (P_INEXEC | P_PROTECTED | P_SYSTEM)) || + (p->p_pid == 1) || ((p->p_pid < 48) && (swap_pager_avail != 0))) { PROC_UNLOCK(p); continue; @@ -1232,14 +1233,21 @@ vm_pageout_oom(int shortage) /* * get the process size */ - if (!vm_map_trylock_read(&p->p_vmspace->vm_map)) { + vm = vmspace_acquire_ref(p); + if (vm == NULL) { + PROC_UNLOCK(p); + continue; + } + if (!vm_map_trylock_read(&vm->vm_map)) { + vmspace_free(vm); PROC_UNLOCK(p); continue; } size = vmspace_swap_count(p->p_vmspace); - vm_map_unlock_read(&p->p_vmspace->vm_map); + vm_map_unlock_read(&vm->vm_map); if (shortage == VM_OOM_MEM) - size += vmspace_resident_count(p->p_vmspace); + size += vmspace_resident_count(vm); + vmspace_free(vm); /* * if the this process is bigger than the biggest one * remember it. @@ -1532,6 +1540,7 @@ vm_daemon() struct rlimit rsslim; struct proc *p; struct thread *td; + struct vmspace *vm; int breakout, swapout_flags; while (TRUE) { @@ -1556,7 +1565,7 @@ vm_daemon() * looked at this process, skip it. */ PROC_LOCK(p); - if (p->p_flag & (P_SYSTEM | P_WEXIT)) { + if (p->p_flag & (P_INEXEC | P_SYSTEM | P_WEXIT)) { PROC_UNLOCK(p); continue; } @@ -1594,13 +1603,17 @@ vm_daemon() */ if ((p->p_flag & P_INMEM) == 0) limit = 0; /* XXX */ + vm = vmspace_acquire_ref(p); PROC_UNLOCK(p); + if (vm == NULL) + continue; - size = vmspace_resident_count(p->p_vmspace); + size = vmspace_resident_count(vm); if (limit >= 0 && size >= limit) { vm_pageout_map_deactivate_pages( - &p->p_vmspace->vm_map, limit); + &vm->vm_map, limit); } + vmspace_free(vm); } sx_sunlock(&allproc_lock); } From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 21:05:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91357106564A; Sun, 19 Apr 2009 21:05:56 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.244]) by mx1.freebsd.org (Postfix) with ESMTP id EAB7D8FC08; Sun, 19 Apr 2009 21:05:55 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by an-out-0708.google.com with SMTP id c3so576183ana.13 for ; Sun, 19 Apr 2009 14:05:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=Ftx37twJE8hmhzmL4YrmGrqppPpcUglsC9zdfpLS7fw=; b=CAVSkqesbOIY9AnPTK/+lKqGOst6yhd6fGwSLXirmvCNxM8a99Llhxtz/Fwqe43HwX jyXHLRQomccRaBdRTsS69tDxaXPgifLVBpSwB9DQJfEJFA4/5qaoWLpX0sKnJ2wZ1/Tg hw3ws+jYVTu6SFapE1Rkyj8YNbjT/FnIkoFNY= 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=crFvZWou6mqm+ZpEHMKhEAaCFIMwviAlaGzDS9bTIctJhqy5c8yRlDHPDYM+zgVQiL pi2dw0F77GqiRql8YmJ5GHGIEqKjUuxsJe665HtzLYmYSdsXD6OiEZ4VkGq2JBnlgwfO wcu9/vNzk+iD0OsP1btCMg3BE7P2B+GKxXeZc= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.33.15 with SMTP id g15mr6212495ang.103.1240175155057; Sun, 19 Apr 2009 14:05:55 -0700 (PDT) In-Reply-To: <200904192221.55744.zec@freebsd.org> References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <49EAFA62.3010000@freebsd.org> <3c1674c90904191013h119d040u1c59772a94dad2f1@mail.gmail.com> <200904192221.55744.zec@freebsd.org> Date: Sun, 19 Apr 2009 14:05:55 -0700 X-Google-Sender-Auth: 927d4008075c5819 Message-ID: <3c1674c90904191405v56298134g286ea31ee4680769@mail.gmail.com> From: Kip Macy To: Marko Zec Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann Subject: Re: svn commit: r191259 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 21:05:57 -0000 On Sun, Apr 19, 2009 at 1:21 PM, Marko Zec wrote: > On Sunday 19 April 2009 19:13:37 Kip Macy wrote: >> On Sun, Apr 19, 2009 at 3:18 AM, Andre Oppermann wro= te: > ... >> > I have another question on the flowtable: =A0What is the pupose of it? >> > All router vendors have learned a long time ago that route caching >> > (aka flow caching) doesn't work out on a router that carries the DFZ >> > (default free zone, currently ~280k prefixes). =A0The overhead of mana= ging >> > the flow table and the high churn rate make it much more expensive tha= n >> > a direct and already very efficient radix trie lookup. Additionally a >> > well connected DFZ router has some 1k prefix updates per second. =A0Mo= re >> > information can be found for example at Cisco here: >> > =A0http://www.cisco.com/en/US/tech/tk827/tk831/technologies_white_pape= r0918 >> >6a00800a62d9.shtml The same findings are also available from all other >> > major router vendors like Juniper, Foundry, etc. >> > >> > Lets examine the situations: >> > =A0a) internal router with only a few routes; The routing and ARP tabl= e >> > =A0 =A0are small, lookups are very fast and everything is hot in the C= PU >> > =A0 =A0caches anyway. >> > =A0b) DFZ router with 280k routes; A small flow table has constant >> > thrashing becoming negative overhead only. =A0A large flow table has a= high >> > maintenance >> > =A0 =A0overhead, higher lookup times and sill a significant amount of >> > thrashing. The overhead of the flow table is equal or higher than a >> > direct routing table lookup. >> > Concluding that a flow table is never a win but a liability in any >> > realistic setting. >> >> You're assuming that a Cisco- / Juniper-class workload is >> representative of where FreeBSD is deployed. I agree that FreeBSD is >> sub-optimal for large routing environments for a whole host of other >> reasons. A better question is what are "typical" FreeBSD deployments, >> and how well would it work there. The flowtable needs to be sized to >> correspond to the number of flows, its utility rapidly diminishes as >> the number of collisions per bucket increases. > > ... which makes a flow cache a perfect DoS target in any environment, be = it a > DFZ or enterprise router or an end host or whatever. Uhm, assuming that you don't put a limit on the number of flows allocated - which I do. When you hit the zone limit for flows you simply stop caching new flows. So the added overhead is simply the extra cache misses up to the collision depth for the bucket. Are you two familiar with CAMs? -Kip --=20 All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 21:26:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EE71106568D; Sun, 19 Apr 2009 21:26:37 +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 6C0948FC22; Sun, 19 Apr 2009 21:26:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JLQbNZ020674; Sun, 19 Apr 2009 21:26:37 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JLQbau020665; Sun, 19 Apr 2009 21:26:37 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192126.n3JLQbau020665@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 21:26: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: r191278 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 21:26:38 -0000 Author: rwatson Date: Sun Apr 19 21:26:36 2009 New Revision: 191278 URL: http://svn.freebsd.org/changeset/base/191278 Log: Add description and cautionary note regarding CACHE_LINE_SIZE. MFC after: 2 weeks Suggested by: alc Modified: head/sys/amd64/include/param.h head/sys/arm/include/param.h head/sys/i386/include/param.h head/sys/ia64/include/param.h head/sys/mips/include/param.h head/sys/powerpc/include/param.h head/sys/sparc64/include/param.h head/sys/sun4v/include/param.h Modified: head/sys/amd64/include/param.h ============================================================================== --- head/sys/amd64/include/param.h Sun Apr 19 20:53:47 2009 (r191277) +++ head/sys/amd64/include/param.h Sun Apr 19 21:26:36 2009 (r191278) @@ -89,6 +89,10 @@ #define ALIGN(p) _ALIGN(p) #define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) +/* + * CACHE_LINE_SIZE is the compile-time maximum cache line size for an + * architecture. It should be used with appropriate caution. + */ #ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 6 #endif Modified: head/sys/arm/include/param.h ============================================================================== --- head/sys/arm/include/param.h Sun Apr 19 20:53:47 2009 (r191277) +++ head/sys/arm/include/param.h Sun Apr 19 21:26:36 2009 (r191278) @@ -81,6 +81,10 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * CACHE_LINE_SIZE is the compile-time maximum cache line size for an + * architecture. It should be used with appropriate caution. + */ #ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 6 #endif Modified: head/sys/i386/include/param.h ============================================================================== --- head/sys/i386/include/param.h Sun Apr 19 20:53:47 2009 (r191277) +++ head/sys/i386/include/param.h Sun Apr 19 21:26:36 2009 (r191278) @@ -74,6 +74,10 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * CACHE_LINE_SIZE is the compile-time maximum cache line size for an + * architecture. It should be used with appropriate caution. + */ #ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 6 #endif Modified: head/sys/ia64/include/param.h ============================================================================== --- head/sys/ia64/include/param.h Sun Apr 19 20:53:47 2009 (r191277) +++ head/sys/ia64/include/param.h Sun Apr 19 21:26:36 2009 (r191278) @@ -99,6 +99,10 @@ #define ALIGN(p) _ALIGN(p) #define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) +/* + * CACHE_LINE_SIZE is the compile-time maximum cache line size for an + * architecture. It should be used with appropriate caution. + */ #ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 6 #endif Modified: head/sys/mips/include/param.h ============================================================================== --- head/sys/mips/include/param.h Sun Apr 19 20:53:47 2009 (r191277) +++ head/sys/mips/include/param.h Sun Apr 19 21:26:36 2009 (r191278) @@ -89,6 +89,10 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * CACHE_LINE_SIZE is the compile-time maximum cache line size for an + * architecture. It should be used with appropriate caution. + */ #ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 6 #endif Modified: head/sys/powerpc/include/param.h ============================================================================== --- head/sys/powerpc/include/param.h Sun Apr 19 20:53:47 2009 (r191277) +++ head/sys/powerpc/include/param.h Sun Apr 19 21:26:36 2009 (r191278) @@ -79,6 +79,10 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * CACHE_LINE_SIZE is the compile-time maximum cache line size for an + * architecture. It should be used with appropriate caution. + */ #ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 7 #endif Modified: head/sys/sparc64/include/param.h ============================================================================== --- head/sys/sparc64/include/param.h Sun Apr 19 20:53:47 2009 (r191277) +++ head/sys/sparc64/include/param.h Sun Apr 19 21:26:36 2009 (r191278) @@ -71,6 +71,10 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * CACHE_LINE_SIZE is the compile-time maximum cache line size for an + * architecture. It should be used with appropriate caution. + */ #ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 6 #endif Modified: head/sys/sun4v/include/param.h ============================================================================== --- head/sys/sun4v/include/param.h Sun Apr 19 20:53:47 2009 (r191277) +++ head/sys/sun4v/include/param.h Sun Apr 19 21:26:36 2009 (r191278) @@ -71,6 +71,10 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * CACHE_LINE_SIZE is the compile-time maximum cache line size for an + * architecture. It should be used with appropriate caution. + */ #ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 6 #endif From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 21:36:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 322A5106564A; Sun, 19 Apr 2009 21:36:19 +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 219838FC16; Sun, 19 Apr 2009 21:36:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JLaIDh020908; Sun, 19 Apr 2009 21:36:18 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JLaIgk020907; Sun, 19 Apr 2009 21:36:18 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192136.n3JLaIgk020907@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 21:36: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: r191279 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 21:36:19 -0000 Author: rwatson Date: Sun Apr 19 21:36:18 2009 New Revision: 191279 URL: http://svn.freebsd.org/changeset/base/191279 Log: Lock the interface address list while iterating a network interface's address list when searching for a link-layer address to use during uuid generation. MFC after: 2 weeks Modified: head/sys/kern/kern_uuid.c Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Sun Apr 19 21:26:36 2009 (r191278) +++ head/sys/kern/kern_uuid.c Sun Apr 19 21:36:18 2009 (r191279) @@ -101,16 +101,19 @@ uuid_node(uint16_t *node) IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Walk the address list */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sdl = (struct sockaddr_dl*)ifa->ifa_addr; if (sdl != NULL && sdl->sdl_family == AF_LINK && sdl->sdl_type == IFT_ETHER) { /* Got a MAC address. */ bcopy(LLADDR(sdl), node, UUID_NODE_LEN); + IF_ADDR_UNLOCK(ifp); IFNET_RUNLOCK(); return; } } + IF_ADDR_UNLOCK(ifp); } IFNET_RUNLOCK(); From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 21:37:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC865106566C; Sun, 19 Apr 2009 21:37:45 +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 91CA98FC18; Sun, 19 Apr 2009 21:37:45 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JLbjLI020968; Sun, 19 Apr 2009 21:37:45 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JLbjPQ020967; Sun, 19 Apr 2009 21:37:45 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200904192137.n3JLbjPQ020967@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 19 Apr 2009 21:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191280 - head/sys/modules X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 21:37:46 -0000 Author: nwhitehorn Date: Sun Apr 19 21:37:45 2009 New Revision: 191280 URL: http://svn.freebsd.org/changeset/base/191280 Log: Build sound modules on PowerPC. Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sun Apr 19 21:36:18 2009 (r191279) +++ head/sys/modules/Makefile Sun Apr 19 21:37:45 2009 (r191280) @@ -573,6 +573,7 @@ _an= an _bm= bm _nvram= powermac_nvram _smbfs= smbfs +_sound= sound .endif .if ${MACHINE_ARCH} == "sparc64" From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 22:01:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A00F106564A; Sun, 19 Apr 2009 22:01:38 +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 590F98FC1C; Sun, 19 Apr 2009 22:01:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JM1chU021515; Sun, 19 Apr 2009 22:01:38 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JM1cPU021514; Sun, 19 Apr 2009 22:01:38 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192201.n3JM1cPU021514@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 22:01: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: r191281 - head/sys/netatalk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 22:01:38 -0000 Author: rwatson Date: Sun Apr 19 22:01:38 2009 New Revision: 191281 URL: http://svn.freebsd.org/changeset/base/191281 Log: Lock interface address list lock around ifaddr inserts and deletes in at_control(). This locking is not yet complete but should prevent some classes of race conditions. MFC after: 2 weeks Modified: head/sys/netatalk/at_control.c Modified: head/sys/netatalk/at_control.c ============================================================================== --- head/sys/netatalk/at_control.c Sun Apr 19 21:37:45 2009 (r191280) +++ head/sys/netatalk/at_control.c Sun Apr 19 22:01:38 2009 (r191281) @@ -191,7 +191,6 @@ at_control(struct socket *so, u_long cmd ifa = (struct ifaddr *)aa; IFA_LOCK_INIT(ifa); ifa->ifa_refcnt = 1; - TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); /* * As the at_ifaddr contains the actual sockaddrs, @@ -214,6 +213,9 @@ at_control(struct socket *so, u_long cmd * and link it all together */ aa->aa_ifp = ifp; + IF_ADDR_LOCK(ifp); + TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); + IF_ADDR_UNLOCK(ifp); } else { /* * If we DID find one then we clobber any routes @@ -296,7 +298,9 @@ at_control(struct socket *so, u_long cmd * remove the ifaddr from the interface */ ifa0 = (struct ifaddr *)aa; + IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa0, ifa_link); + IF_ADDR_UNLOCK(ifp); /* * Now remove the at_ifaddr from the parallel structure From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 22:04:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B30441065679; Sun, 19 Apr 2009 22:04:29 +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 A204E8FC1F; Sun, 19 Apr 2009 22:04:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JM4TRt021651; Sun, 19 Apr 2009 22:04:29 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JM4TFY021650; Sun, 19 Apr 2009 22:04:29 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192204.n3JM4TFY021650@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 22:04: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: r191283 - 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: Sun, 19 Apr 2009 22:04:30 -0000 Author: rwatson Date: Sun Apr 19 22:04:29 2009 New Revision: 191283 URL: http://svn.freebsd.org/changeset/base/191283 Log: Lock interface address list when building a reply to NGM_EIFACE_GET_IFADDRS messages in ng_eiface. MFC after: 2 weeks Modified: head/sys/netgraph/ng_eiface.c Modified: head/sys/netgraph/ng_eiface.c ============================================================================== --- head/sys/netgraph/ng_eiface.c Sun Apr 19 22:02:14 2009 (r191282) +++ head/sys/netgraph/ng_eiface.c Sun Apr 19 22:04:29 2009 (r191283) @@ -452,10 +452,12 @@ ng_eiface_rcvmsg(node_p node, item_p ite /* Determine size of response and allocate it */ buflen = 0; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) buflen += SA_SIZE(ifa->ifa_addr); NG_MKRESPONSE(resp, msg, buflen, M_NOWAIT); if (resp == NULL) { + IF_ADDR_UNLOCK(ifp); error = ENOMEM; break; } @@ -474,6 +476,7 @@ ng_eiface_rcvmsg(node_p node, item_p ite ptr += len; buflen -= len; } + IF_ADDR_UNLOCK(ifp); break; } From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 22:05:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C27F510656A6; Sun, 19 Apr 2009 22:05:39 +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 B176B8FC12; Sun, 19 Apr 2009 22:05:39 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JM5dAm021717; Sun, 19 Apr 2009 22:05:39 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JM5dDQ021716; Sun, 19 Apr 2009 22:05:39 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192205.n3JM5dDQ021716@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 22:05: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: r191284 - 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: Sun, 19 Apr 2009 22:05:40 -0000 Author: rwatson Date: Sun Apr 19 22:05:39 2009 New Revision: 191284 URL: http://svn.freebsd.org/changeset/base/191284 Log: Lock the interface address list while building replies to NGM_CISCO_COOKIE messages in ng_iface. MFC after: 2 weeks Modified: head/sys/netgraph/ng_iface.c Modified: head/sys/netgraph/ng_iface.c ============================================================================== --- head/sys/netgraph/ng_iface.c Sun Apr 19 22:04:29 2009 (r191283) +++ head/sys/netgraph/ng_iface.c Sun Apr 19 22:05:39 2009 (r191284) @@ -668,6 +668,7 @@ ng_iface_rcvmsg(node_p node, item_p item struct ifaddr *ifa; /* Return the first configured IP address */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct ng_cisco_ipaddr *ips; @@ -685,6 +686,7 @@ ng_iface_rcvmsg(node_p node, item_p item ifa->ifa_netmask)->sin_addr; break; } + IF_ADDR_UNLOCK(ifp); /* No IP addresses on this interface? */ if (ifa == NULL) From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 22:16:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4F4A106566B; Sun, 19 Apr 2009 22:16:19 +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 C3A3D8FC16; Sun, 19 Apr 2009 22:16:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JMGJr7021987; Sun, 19 Apr 2009 22:16:19 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JMGJAZ021986; Sun, 19 Apr 2009 22:16:19 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192216.n3JMGJAZ021986@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 22:16: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: r191285 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 22:16:20 -0000 Author: rwatson Date: Sun Apr 19 22:16:19 2009 New Revision: 191285 URL: http://svn.freebsd.org/changeset/base/191285 Log: Protect against some writer-writer races in in_control() by acquiring the interface address list lock around interface address list modifications. More to do here. MFC after: 2 weeks Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sun Apr 19 22:05:39 2009 (r191284) +++ head/sys/netinet/in.c Sun Apr 19 22:16:19 2009 (r191285) @@ -330,14 +330,12 @@ in_control(struct socket *so, u_long cmd * Protect from ipintr() traversing address list * while we're modifying it. */ - s = splnet(); ifa = &ia->ia_ifa; IFA_LOCK_INIT(ifa); ifa->ifa_addr = (struct sockaddr *)&ia->ia_addr; ifa->ifa_dstaddr = (struct sockaddr *)&ia->ia_dstaddr; ifa->ifa_netmask = (struct sockaddr *)&ia->ia_sockmask; ifa->ifa_refcnt = 1; - TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); ia->ia_sockmask.sin_len = 8; ia->ia_sockmask.sin_family = AF_INET; @@ -347,6 +345,10 @@ in_control(struct socket *so, u_long cmd } ia->ia_ifp = ifp; + IF_ADDR_LOCK(ifp); + TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); + IF_ADDR_UNLOCK(ifp); + s = splnet(); TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); splx(s); iaIsNew = 1; @@ -512,8 +514,10 @@ in_control(struct socket *so, u_long cmd * Protect from ipintr() traversing address list while we're modifying * it. */ - s = splnet(); + IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); + IF_ADDR_UNLOCK(ifp); + s = splnet(); TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); if (ia->ia_addr.sin_family == AF_INET) { LIST_REMOVE(ia, ia_hash); From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 22:25:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26E7C1065677; Sun, 19 Apr 2009 22:25:10 +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 EF5788FC19; Sun, 19 Apr 2009 22:25:09 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JMP95F022261; Sun, 19 Apr 2009 22:25:09 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JMP9ps022260; Sun, 19 Apr 2009 22:25:09 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192225.n3JMP9ps022260@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 22:25: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: r191286 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 22:25:10 -0000 Author: rwatson Date: Sun Apr 19 22:25:09 2009 New Revision: 191286 URL: http://svn.freebsd.org/changeset/base/191286 Log: Lock interface address lists in in_pcbladdr() when searching for a source address for a connection and there's no route or now interface for the route. MFC after: 2 weeks Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Sun Apr 19 22:16:19 2009 (r191285) +++ head/sys/netinet/in_pcb.c Sun Apr 19 22:25:09 2009 (r191286) @@ -605,6 +605,7 @@ in_pcbladdr(struct inpcb *inp, struct in ifp = ia->ia_ifp; ia = NULL; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; @@ -618,8 +619,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + IF_ADDR_UNLOCK(ifp); goto done; } + IF_ADDR_UNLOCK(ifp); /* 3. As a last resort return the 'default' jail address. */ error = prison_get_ip4(cred, laddr); @@ -636,6 +639,7 @@ in_pcbladdr(struct inpcb *inp, struct in * 3. as a last resort return the 'default' jail address. */ if ((sro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK) == 0) { + struct ifnet *ifp; /* If not jailed, use the default returned. */ if (cred == NULL || !jailed(cred)) { @@ -657,7 +661,9 @@ in_pcbladdr(struct inpcb *inp, struct in * 2. Check if we have any address on the outgoing interface * belonging to this jail. */ - TAILQ_FOREACH(ifa, &sro.ro_rt->rt_ifp->if_addrhead, ifa_link) { + ifp = sro.ro_rt->rt_ifp; + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; if (sa->sa_family != AF_INET) @@ -670,8 +676,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + IF_ADDR_UNLOCK(ifp); goto done; } + IF_ADDR_UNLOCK(ifp); /* 3. As a last resort return the 'default' jail address. */ error = prison_get_ip4(cred, laddr); @@ -718,6 +726,7 @@ in_pcbladdr(struct inpcb *inp, struct in ifp = ia->ia_ifp; ia = NULL; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; @@ -732,8 +741,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + IF_ADDR_UNLOCK(ifp); goto done; } + IF_ADDR_UNLOCK(ifp); } /* 3. As a last resort return the 'default' jail address. */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 22:29:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAC831065670; Sun, 19 Apr 2009 22:29:16 +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 C9A0E8FC14; Sun, 19 Apr 2009 22:29:16 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JMTGV1022366; Sun, 19 Apr 2009 22:29:16 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JMTGWD022365; Sun, 19 Apr 2009 22:29:16 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192229.n3JMTGWD022365@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 22:29: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: r191287 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 22:29:17 -0000 Author: rwatson Date: Sun Apr 19 22:29:16 2009 New Revision: 191287 URL: http://svn.freebsd.org/changeset/base/191287 Log: In divert_packet(), lock the interface address list before iterating over it in search of an address. MFC after: 2 weeks Modified: head/sys/netinet/ip_divert.c Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Sun Apr 19 22:25:09 2009 (r191286) +++ head/sys/netinet/ip_divert.c Sun Apr 19 22:29:16 2009 (r191287) @@ -244,18 +244,22 @@ divert_packet(struct mbuf *m, int incomi divsrc.sin_port = divert_cookie(mtag); /* record matching rule */ if (incoming) { struct ifaddr *ifa; + struct ifnet *ifp; /* Sanity check */ M_ASSERTPKTHDR(m); /* Find IP address for receive interface */ - TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrhead, ifa_link) { + ifp = m->m_pkthdr.rcvif; + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; divsrc.sin_addr = ((struct sockaddr_in *) ifa->ifa_addr)->sin_addr; break; } + IF_ADDR_UNLOCK(ifp); } /* * Record the incoming interface name whenever we have one. From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 22:34:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D00561065670; Sun, 19 Apr 2009 22:34:35 +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 BE7258FC0A; Sun, 19 Apr 2009 22:34:35 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JMYZHT022514; Sun, 19 Apr 2009 22:34:35 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JMYZYa022513; Sun, 19 Apr 2009 22:34:35 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192234.n3JMYZYa022513@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 22:34: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: r191288 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 22:34:36 -0000 Author: rwatson Date: Sun Apr 19 22:34:35 2009 New Revision: 191288 URL: http://svn.freebsd.org/changeset/base/191288 Log: Lock the interface address list when searching for a matching interface by address, or when implementing 'me' rules on IPv6. Prefer the field name if_addrhead to the macro if_addrlist. MFC after: 2 weeks Modified: head/sys/netinet/ip_fw2.c Modified: head/sys/netinet/ip_fw2.c ============================================================================== --- head/sys/netinet/ip_fw2.c Sun Apr 19 22:29:16 2009 (r191287) +++ head/sys/netinet/ip_fw2.c Sun Apr 19 22:34:35 2009 (r191288) @@ -480,14 +480,17 @@ iface_match(struct ifnet *ifp, ipfw_insn } else { struct ifaddr *ia; - /* XXX lock? */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) { if (ia->ifa_addr->sa_family != AF_INET) continue; if (cmd->p.ip.s_addr == ((struct sockaddr_in *) - (ia->ifa_addr))->sin_addr.s_addr) + (ia->ifa_addr))->sin_addr.s_addr) { + IF_ADDR_UNLOCK(ifp); return(1); /* match */ + } } + IF_ADDR_UNLOCK(ifp); } return(0); /* no match, fail ... */ } @@ -589,17 +592,22 @@ search_ip6_addr_net (struct in6_addr * i struct in6_ifaddr *fdm; struct in6_addr copia; - TAILQ_FOREACH(mdc, &V_ifnet, if_link) - TAILQ_FOREACH(mdc2, &mdc->if_addrlist, ifa_list) { + TAILQ_FOREACH(mdc, &V_ifnet, if_link) { + IF_ADDR_LOCK(mdc); + TAILQ_FOREACH(mdc2, &mdc->if_addrhead, ifa_list) { if (mdc2->ifa_addr->sa_family == AF_INET6) { fdm = (struct in6_ifaddr *)mdc2; copia = fdm->ia_addr.sin6_addr; /* need for leaving scope_id in the sock_addr */ in6_clearscope(&copia); - if (IN6_ARE_ADDR_EQUAL(ip6_addr, &copia)) + if (IN6_ARE_ADDR_EQUAL(ip6_addr, &copia)) { + IF_ADDR_UNLOCK(mdc); return 1; + } } } + IF_ADDR_UNLOCK(mdc); + } return 0; } From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 23:02:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35325106566B; Sun, 19 Apr 2009 23:02:51 +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 190AE8FC13; Sun, 19 Apr 2009 23:02:51 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JN2oEm023226; Sun, 19 Apr 2009 23:02:50 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JN2o6Z023217; Sun, 19 Apr 2009 23:02:50 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192302.n3JN2o6Z023217@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 23:02: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: r191291 - in head: lib/libthr/thread libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/ia64 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rtld-... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 23:02:51 -0000 Author: rwatson Date: Sun Apr 19 23:02:50 2009 New Revision: 191291 URL: http://svn.freebsd.org/changeset/base/191291 Log: Now that the kernel defines CACHE_LINE_SIZE in machine/param.h, use that definition in the custom locking code for the run-time linker rather than local definitions. Pointed out by: tinderbox MFC after: 2 weeks Modified: head/lib/libthr/thread/thr_rtld.c head/libexec/rtld-elf/amd64/rtld_machdep.h head/libexec/rtld-elf/arm/rtld_machdep.h head/libexec/rtld-elf/i386/rtld_machdep.h head/libexec/rtld-elf/ia64/rtld_machdep.h head/libexec/rtld-elf/mips/rtld_machdep.h head/libexec/rtld-elf/powerpc/rtld_machdep.h head/libexec/rtld-elf/sparc64/rtld_machdep.h Modified: head/lib/libthr/thread/thr_rtld.c ============================================================================== --- head/lib/libthr/thread/thr_rtld.c Sun Apr 19 22:58:36 2009 (r191290) +++ head/lib/libthr/thread/thr_rtld.c Sun Apr 19 23:02:50 2009 (r191291) @@ -39,8 +39,6 @@ #undef errno extern int errno; -#define CACHE_LINE_SIZE 64 - static int _thr_rtld_clr_flag(int); static void *_thr_rtld_lock_create(void); static void _thr_rtld_lock_destroy(void *); Modified: head/libexec/rtld-elf/amd64/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/amd64/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) +++ head/libexec/rtld-elf/amd64/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) @@ -32,8 +32,6 @@ #include #include -#define CACHE_LINE_SIZE 64 - struct Struct_Obj_Entry; /* Return the address of the .dynamic section in the dynamic linker. */ Modified: head/libexec/rtld-elf/arm/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/arm/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) +++ head/libexec/rtld-elf/arm/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) @@ -32,8 +32,6 @@ #include #include -#define CACHE_LINE_SIZE 32 - struct Struct_Obj_Entry; /* Return the address of the .dynamic section in the dynamic linker. */ Modified: head/libexec/rtld-elf/i386/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/i386/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) +++ head/libexec/rtld-elf/i386/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) @@ -32,8 +32,6 @@ #include #include -#define CACHE_LINE_SIZE 32 - struct Struct_Obj_Entry; /* Return the address of the .dynamic section in the dynamic linker. */ Modified: head/libexec/rtld-elf/ia64/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/ia64/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) +++ head/libexec/rtld-elf/ia64/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) @@ -32,8 +32,6 @@ #include #include -#define CACHE_LINE_SIZE 128 - /* * Macros for cracking ia64 function pointers. */ Modified: head/libexec/rtld-elf/mips/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/mips/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) +++ head/libexec/rtld-elf/mips/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) @@ -32,8 +32,6 @@ #include #include -#define CACHE_LINE_SIZE 32 - struct Struct_Obj_Entry; /* Return the address of the .dynamic section in the dynamic linker. */ Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/powerpc/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) +++ head/libexec/rtld-elf/powerpc/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) @@ -32,8 +32,6 @@ #include #include -#define CACHE_LINE_SIZE 32 - struct Struct_Obj_Entry; /* Return the address of the .dynamic section in the dynamic linker. */ Modified: head/libexec/rtld-elf/sparc64/rtld_machdep.h ============================================================================== --- head/libexec/rtld-elf/sparc64/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) +++ head/libexec/rtld-elf/sparc64/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) @@ -32,8 +32,6 @@ #include #include -#define CACHE_LINE_SIZE 128 - struct Struct_Obj_Entry; /* Return the address of the .dynamic section in the dynamic linker. */ From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 23:03:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E96DA106566C; Sun, 19 Apr 2009 23:03:57 +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 D7CF58FC16; Sun, 19 Apr 2009 23:03:57 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JN3vf0023290; Sun, 19 Apr 2009 23:03:57 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JN3v9w023289; Sun, 19 Apr 2009 23:03:57 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192303.n3JN3v9w023289@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 23:03: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: r191292 - 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: Sun, 19 Apr 2009 23:03:58 -0000 Author: rwatson Date: Sun Apr 19 23:03:57 2009 New Revision: 191292 URL: http://svn.freebsd.org/changeset/base/191292 Log: Explicitly include machine/param.h for CACHE_LINE_SIZE. MFC after: 2 weeks Modified: head/libexec/rtld-elf/rtld_lock.c Modified: head/libexec/rtld-elf/rtld_lock.c ============================================================================== --- head/libexec/rtld-elf/rtld_lock.c Sun Apr 19 23:02:50 2009 (r191291) +++ head/libexec/rtld-elf/rtld_lock.c Sun Apr 19 23:03:57 2009 (r191292) @@ -42,6 +42,8 @@ * using assembly language sequences in "rtld_start.S". */ +#include + #include #include #include From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 23:07:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11A13106567E; Sun, 19 Apr 2009 23:07:30 +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 CB8818FC12; Sun, 19 Apr 2009 23:07:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 889A146B38; Sun, 19 Apr 2009 19:07:29 -0400 (EDT) Date: Mon, 20 Apr 2009 00:07:29 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <200904192302.n3JN2o6Z023217@svn.freebsd.org> Message-ID: References: <200904192302.n3JN2o6Z023217@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: Subject: Re: svn commit: r191291 - in head: lib/libthr/thread libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/ia64 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rtld-... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 23:07:30 -0000 On Sun, 19 Apr 2009, Robert Watson wrote: > Now that the kernel defines CACHE_LINE_SIZE in machine/param.h, use > that definition in the custom locking code for the run-time linker > rather than local definitions. This actually changes the line size used by the rtld code for pre-pthreads locking for several architectures. I think this is an improvement, but if architecture maintainers could comment on that, that would be helpful. Robert N M Watson Computer Laboratory University of Cambridge > > Pointed out by: tinderbox > MFC after: 2 weeks > > Modified: > head/lib/libthr/thread/thr_rtld.c > head/libexec/rtld-elf/amd64/rtld_machdep.h > head/libexec/rtld-elf/arm/rtld_machdep.h > head/libexec/rtld-elf/i386/rtld_machdep.h > head/libexec/rtld-elf/ia64/rtld_machdep.h > head/libexec/rtld-elf/mips/rtld_machdep.h > head/libexec/rtld-elf/powerpc/rtld_machdep.h > head/libexec/rtld-elf/sparc64/rtld_machdep.h > > Modified: head/lib/libthr/thread/thr_rtld.c > ============================================================================== > --- head/lib/libthr/thread/thr_rtld.c Sun Apr 19 22:58:36 2009 (r191290) > +++ head/lib/libthr/thread/thr_rtld.c Sun Apr 19 23:02:50 2009 (r191291) > @@ -39,8 +39,6 @@ > #undef errno > extern int errno; > > -#define CACHE_LINE_SIZE 64 > - > static int _thr_rtld_clr_flag(int); > static void *_thr_rtld_lock_create(void); > static void _thr_rtld_lock_destroy(void *); > > Modified: head/libexec/rtld-elf/amd64/rtld_machdep.h > ============================================================================== > --- head/libexec/rtld-elf/amd64/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) > +++ head/libexec/rtld-elf/amd64/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) > @@ -32,8 +32,6 @@ > #include > #include > > -#define CACHE_LINE_SIZE 64 > - > struct Struct_Obj_Entry; > > /* Return the address of the .dynamic section in the dynamic linker. */ > > Modified: head/libexec/rtld-elf/arm/rtld_machdep.h > ============================================================================== > --- head/libexec/rtld-elf/arm/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) > +++ head/libexec/rtld-elf/arm/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) > @@ -32,8 +32,6 @@ > #include > #include > > -#define CACHE_LINE_SIZE 32 > - > struct Struct_Obj_Entry; > > /* Return the address of the .dynamic section in the dynamic linker. */ > > Modified: head/libexec/rtld-elf/i386/rtld_machdep.h > ============================================================================== > --- head/libexec/rtld-elf/i386/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) > +++ head/libexec/rtld-elf/i386/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) > @@ -32,8 +32,6 @@ > #include > #include > > -#define CACHE_LINE_SIZE 32 > - > struct Struct_Obj_Entry; > > /* Return the address of the .dynamic section in the dynamic linker. */ > > Modified: head/libexec/rtld-elf/ia64/rtld_machdep.h > ============================================================================== > --- head/libexec/rtld-elf/ia64/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) > +++ head/libexec/rtld-elf/ia64/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) > @@ -32,8 +32,6 @@ > #include > #include > > -#define CACHE_LINE_SIZE 128 > - > /* > * Macros for cracking ia64 function pointers. > */ > > Modified: head/libexec/rtld-elf/mips/rtld_machdep.h > ============================================================================== > --- head/libexec/rtld-elf/mips/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) > +++ head/libexec/rtld-elf/mips/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) > @@ -32,8 +32,6 @@ > #include > #include > > -#define CACHE_LINE_SIZE 32 > - > struct Struct_Obj_Entry; > > /* Return the address of the .dynamic section in the dynamic linker. */ > > Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h > ============================================================================== > --- head/libexec/rtld-elf/powerpc/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) > +++ head/libexec/rtld-elf/powerpc/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) > @@ -32,8 +32,6 @@ > #include > #include > > -#define CACHE_LINE_SIZE 32 > - > struct Struct_Obj_Entry; > > /* Return the address of the .dynamic section in the dynamic linker. */ > > Modified: head/libexec/rtld-elf/sparc64/rtld_machdep.h > ============================================================================== > --- head/libexec/rtld-elf/sparc64/rtld_machdep.h Sun Apr 19 22:58:36 2009 (r191290) > +++ head/libexec/rtld-elf/sparc64/rtld_machdep.h Sun Apr 19 23:02:50 2009 (r191291) > @@ -32,8 +32,6 @@ > #include > #include > > -#define CACHE_LINE_SIZE 128 > - > struct Struct_Obj_Entry; > > /* Return the address of the .dynamic section in the dynamic linker. */ > From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 23:28:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDD3B106564A; Sun, 19 Apr 2009 23:28:08 +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 CB3698FC18; Sun, 19 Apr 2009 23:28:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JNS873024016; Sun, 19 Apr 2009 23:28:08 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JNS8A5024015; Sun, 19 Apr 2009 23:28:08 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192328.n3JNS8A5024015@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 23:28: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: r191296 - head/sys/security/audit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 23:28:09 -0000 Author: rwatson Date: Sun Apr 19 23:28:08 2009 New Revision: 191296 URL: http://svn.freebsd.org/changeset/base/191296 Log: Temporarily relax the constraints on argument size checking for A_GETCOND; login(1) isn't quite ready for them yet on 64-bit systems as it continues to use the conventions of the old version of the API. Reported by: stas, Jakub Lach Modified: head/sys/security/audit/audit_syscalls.c Modified: head/sys/security/audit/audit_syscalls.c ============================================================================== --- head/sys/security/audit/audit_syscalls.c Sun Apr 19 23:15:04 2009 (r191295) +++ head/sys/security/audit/audit_syscalls.c Sun Apr 19 23:28:08 2009 (r191296) @@ -216,6 +216,7 @@ auditon(struct thread *td, struct audito */ switch (uap->cmd) { case A_OLDGETPOLICY: + case A_GETPOLICY: if (uap->length == sizeof(udata.au_policy64)) { if (!audit_fail_stop) udata.au_policy64 |= AUDIT_CNT; @@ -227,8 +228,6 @@ auditon(struct thread *td, struct audito udata.au_policy64 |= AUDIT_ARGE; break; } - /* FALLTHROUGH */ - case A_GETPOLICY: if (uap->length != sizeof(udata.au_policy)) return (EINVAL); if (!audit_fail_stop) @@ -242,6 +241,7 @@ auditon(struct thread *td, struct audito break; case A_OLDSETPOLICY: + case A_SETPOLICY: if (uap->length == sizeof(udata.au_policy64)) { if (udata.au_policy & (~AUDIT_CNT|AUDIT_AHLT| AUDIT_ARGV|AUDIT_ARGE)) @@ -254,8 +254,6 @@ auditon(struct thread *td, struct audito audit_arge = (udata.au_policy64 & AUDIT_ARGE); break; } - /* FALLTHROUGH */ - case A_SETPOLICY: if (uap->length != sizeof(udata.au_policy)) return (EINVAL); if (udata.au_policy & ~(AUDIT_CNT|AUDIT_AHLT|AUDIT_ARGV| @@ -283,6 +281,7 @@ auditon(struct thread *td, struct audito break; case A_OLDGETQCTRL: + case A_GETQCTRL: if (uap->length == sizeof(udata.au_qctrl64)) { udata.au_qctrl64.aq64_hiwater = (u_int64_t)audit_qctrl.aq_hiwater; @@ -294,14 +293,13 @@ auditon(struct thread *td, struct audito (u_int64_t)audit_qctrl.aq_minfree; break; } - /* FALLTHROUGH */ - case A_GETQCTRL: if (uap->length != sizeof(udata.au_qctrl)) return (EINVAL); udata.au_qctrl = audit_qctrl; break; case A_OLDSETQCTRL: + case A_SETQCTRL: if (uap->length == sizeof(udata.au_qctrl64)) { if ((udata.au_qctrl64.aq64_hiwater > AQ_MAXHIGH) || (udata.au_qctrl64.aq64_lowater >= @@ -321,8 +319,6 @@ auditon(struct thread *td, struct audito audit_qctrl.aq_delay = -1; /* Not used. */ break; } - /* FALLTHROUGH */ - case A_SETQCTRL: if (uap->length != sizeof(udata.au_qctrl)) return (EINVAL); if ((udata.au_qctrl.aq_hiwater > AQ_MAXHIGH) || @@ -362,6 +358,7 @@ auditon(struct thread *td, struct audito break; case A_OLDGETCOND: + case A_GETCOND: if (uap->length == sizeof(udata.au_cond64)) { if (audit_enabled && !audit_suspended) udata.au_cond64 = AUC_AUDITING; @@ -369,8 +366,6 @@ auditon(struct thread *td, struct audito udata.au_cond64 = AUC_NOAUDIT; break; } - /* FALLTHROUGH */ - case A_GETCOND: if (uap->length != sizeof(udata.au_cond)) return (EINVAL); if (audit_enabled && !audit_suspended) @@ -380,6 +375,7 @@ auditon(struct thread *td, struct audito break; case A_OLDSETCOND: + case A_SETCOND: if (uap->length == sizeof(udata.au_cond64)) { if (udata.au_cond64 == AUC_NOAUDIT) audit_suspended = 1; @@ -391,8 +387,6 @@ auditon(struct thread *td, struct audito } break; } - /* FALLTHROUGH */ - case A_SETCOND: if (uap->length != sizeof(udata.au_cond)) return (EINVAL); if (udata.au_cond == AUC_NOAUDIT) From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 23:31:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04D6B106568B; Sun, 19 Apr 2009 23:31:05 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-ew0-f171.google.com (mail-ew0-f171.google.com [209.85.219.171]) by mx1.freebsd.org (Postfix) with ESMTP id 12D618FC12; Sun, 19 Apr 2009 23:31:03 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by ewy19 with SMTP id 19so1549557ewy.43 for ; Sun, 19 Apr 2009 16:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=mtaIb29TrsX8hmJGEEvOmEmoW+BA5Zx75jhU/LtU1tg=; b=AwXfi4V9NxTN6RzV/bn9HJUKL9NI0P0A8Iu+ZzcYbXQqaSzF9xr0x1w1Ury6gQEGvw 5peFIY3efcdsBf9hmi/aa2SJoMlIvd/1IjfZMWZYs6N11SKDk2utK33N4yaCnV37a6Kb 6gAklhnQnAbismVgNRmN4uOsss3P98FX9CAJ8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=AcfRv2cPlchqO6JTZWtTo353pnKiEiV0QIUl1fVe3eVE4NTfKhVAEtTJ5htJYyn2BR JJkwz8nPXNFK0tFL0yPiMVuVJSBnNl/JCq/0V4gFDVHDkJLJH+bp4kVQ3ybEmafM9e1F SxW+X3GjdHFzquxM95cK3JaBOtLltUxxPDekw= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.210.87.19 with SMTP id k19mr3065835ebb.39.1240183863251; Sun, 19 Apr 2009 16:31:03 -0700 (PDT) In-Reply-To: References: <200904192302.n3JN2o6Z023217@svn.freebsd.org> From: Ivan Voras Date: Mon, 20 Apr 2009 01:30:48 +0200 X-Google-Sender-Auth: 9fc6ea3808b3ccbb Message-ID: <9bbcef730904191630x4e4f2aeci2d6ac769fc1f73f8@mail.gmail.com> To: Robert Watson 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: r191291 - in head: lib/libthr/thread libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/ia64 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rtld-... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 23:31:05 -0000 2009/4/20 Robert Watson : > On Sun, 19 Apr 2009, Robert Watson wrote: > >> =C2=A0Now that the kernel defines CACHE_LINE_SIZE in machine/param.h, us= e >> =C2=A0that definition in the custom locking code for the run-time linker >> =C2=A0rather than local definitions. > > This actually changes the line size used by the rtld code for pre-pthread= s > locking for several architectures. =C2=A0I think this is an improvement, = but if > architecture maintainers could comment on that, that would be helpful. Will there be infrastructure for creating per-CPU structures or is using something like: int mycounter[MAXCPU] __attribute__ ((aligned(CACHE_LINE_SIZE))); considered enough? From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 23:34:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AACB51065672; Sun, 19 Apr 2009 23:34:22 +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 986258FC17; Sun, 19 Apr 2009 23:34:22 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JNYMZY024224; Sun, 19 Apr 2009 23:34:22 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JNYMKN024223; Sun, 19 Apr 2009 23:34:22 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192334.n3JNYMKN024223@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 23:34: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: r191297 - head/usr.bin/login X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 23:34:23 -0000 Author: rwatson Date: Sun Apr 19 23:34:22 2009 New Revision: 191297 URL: http://svn.freebsd.org/changeset/base/191297 Log: Pass int arguments to auditon(2)'s A_GETCOND API rather than long arguments. This change should be MFC'd with OpenBSM 1.1 since they are interdependent. MFC after: 2 weeks Obtained from: TrustedBSD Project Sponsored by: Apple, Inc. Modified: head/usr.bin/login/login_audit.c Modified: head/usr.bin/login/login_audit.c ============================================================================== --- head/usr.bin/login/login_audit.c Sun Apr 19 23:28:08 2009 (r191296) +++ head/usr.bin/login/login_audit.c Sun Apr 19 23:34:22 2009 (r191297) @@ -67,10 +67,10 @@ au_login_success(void) uid_t uid = pwd->pw_uid; gid_t gid = pwd->pw_gid; pid_t pid = getpid(); - long au_cond; + int au_cond; /* If we are not auditing, don't cut an audit record; just return. */ - if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) { + if (auditon(A_GETCOND, &au_cond, sizeof(au_cond)) < 0) { if (errno == ENOSYS) return; errx(1, "login: Could not determine audit condition"); @@ -115,13 +115,13 @@ au_login_fail(const char *errmsg, int na { token_t *tok; int aufd; - long au_cond; + int au_cond; uid_t uid; gid_t gid; pid_t pid = getpid(); /* If we are not auditing, don't cut an audit record; just return. */ - if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) { + if (auditon(A_GETCOND, &au_cond, sizeof(au_cond)) < 0) { if (errno == ENOSYS) return; errx(1, "login: Could not determine audit condition"); @@ -175,10 +175,10 @@ audit_logout(void) uid_t uid = pwd->pw_uid; gid_t gid = pwd->pw_gid; pid_t pid = getpid(); - long au_cond; + int au_cond; /* If we are not auditing, don't cut an audit record; just return. */ - if (auditon(A_GETCOND, &au_cond, sizeof(long)) < 0) { + if (auditon(A_GETCOND, &au_cond, sizeof(int)) < 0) { if (errno == ENOSYS) return; errx(1, "login: Could not determine audit condition"); From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 23:50:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEB55106564A; Sun, 19 Apr 2009 23:50:22 +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 B2B148FC0A; Sun, 19 Apr 2009 23:50:22 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 5798446B23; Sun, 19 Apr 2009 19:50:22 -0400 (EDT) Date: Mon, 20 Apr 2009 00:50:22 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Ivan Voras In-Reply-To: <9bbcef730904191630x4e4f2aeci2d6ac769fc1f73f8@mail.gmail.com> Message-ID: References: <200904192302.n3JN2o6Z023217@svn.freebsd.org> <9bbcef730904191630x4e4f2aeci2d6ac769fc1f73f8@mail.gmail.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="621616949-165048185-1240185022=:71062" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191291 - in head: lib/libthr/thread libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/ia64 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rtld-... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 19 Apr 2009 23:50:23 -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-165048185-1240185022=:71062 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Mon, 20 Apr 2009, Ivan Voras wrote: > 2009/4/20 Robert Watson : >> On Sun, 19 Apr 2009, Robert Watson wrote: >> >>>  Now that the kernel defines CACHE_LINE_SIZE in machine/param.h, use  that >>> definition in the custom locking code for the run-time linker  rather than >>> local definitions. >> >> This actually changes the line size used by the rtld code for pre-pthreads >> locking for several architectures.  I think this is an improvement, but if >> architecture maintainers could comment on that, that would be helpful. > > Will there be infrastructure for creating per-CPU structures or is using > something like: > > int mycounter[MAXCPU] __attribute__ ((aligned(CACHE_LINE_SIZE))); For now, yes, something along these lines. I have a local prototype I'm using that has an API something like this: * // Definitions * struct foostat *foostatp; * void *foostat_psp; * * // Module load * if (pcpustat_alloc(&foostat_psp, "foostat", sizeof(struct foostat), * sizeof(u_long)) != 0) * panic("foostat_init: pcpustat_alloc failed"); * foostatp = pcpustat_getptr(foostat_psp); * * // Use the pointer for a statistic * foostatp[curcpu].fs_counter1++; * * // Retrieve summary statistics and store in a single instance * struct foostat fs; * pcpustat_fetch(foostat_psp, &fs); * * // Reset summary statistics. * pcpustat_reset(foostat_psp); * * // Module unload * pcpustat_free(foostat_psp); * foostatp = foostat_psp = NULL; The problem with the [curcpu] model is that it embeds the assumption that it's a good idea to have per-CPU fields in adjacent cache lines within a page. As the world rocks gently in the direction of NUMA, there's a legitimate question as to whether that's a good assumption to build in. It's a better assumption than the assumption that it's a good idea to use a single stat across all CPUs in a single cache line, of course. Depending on how we feel about the overhead of accessor interfaces, all this can be hidden easily enough. A facility I'd like to have would be an API to allocate memory on all CPUs at once, with the memory on each CPU at a constant offset from a per-CPU base address. That way you could calculate the location of the per-CPU structure using PCPU_GET(dynbase) + foostat_offset without adding an additional indirection. Robert N M Watson Computer Laboratory University of Cambridge --621616949-165048185-1240185022=:71062-- From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 01:19:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF384106566B; Mon, 20 Apr 2009 01:19:59 +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 D25818FC13; Mon, 20 Apr 2009 01:19:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3K1Jx48027104; Mon, 20 Apr 2009 01:19:59 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3K1JxnX027100; Mon, 20 Apr 2009 01:19:59 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904200119.n3K1JxnX027100@svn.freebsd.org> From: Warner Losh Date: Mon, 20 Apr 2009 01:19: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: r191299 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 01:20:00 -0000 Author: imp Date: Mon Apr 20 01:19:59 2009 New Revision: 191299 URL: http://svn.freebsd.org/changeset/base/191299 Log: Cleanup resource allocation code a bit. Store the rids on the resources rather than on the softc. When we allocate resources for PC Card, if we only get 16 ports, try again to get the others. Modified: head/sys/dev/ed/if_ed.c head/sys/dev/ed/if_ed_cbus.c head/sys/dev/ed/if_ed_isa.c head/sys/dev/ed/if_ed_pccard.c head/sys/dev/ed/if_edvar.h Modified: head/sys/dev/ed/if_ed.c ============================================================================== --- head/sys/dev/ed/if_ed.c Sun Apr 19 23:34:52 2009 (r191298) +++ head/sys/dev/ed/if_ed.c Mon Apr 20 01:19:59 2009 (r191299) @@ -164,7 +164,6 @@ ed_alloc_port(device_t dev, int rid, int res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0ul, ~0ul, size, RF_ACTIVE); if (res) { - sc->port_rid = rid; sc->port_res = res; sc->port_used = size; sc->port_bst = rman_get_bustag(res); @@ -186,7 +185,6 @@ ed_alloc_memory(device_t dev, int rid, i res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0ul, ~0ul, size, RF_ACTIVE); if (res) { - sc->mem_rid = rid; sc->mem_res = res; sc->mem_used = size; sc->mem_bst = rman_get_bustag(res); @@ -207,7 +205,6 @@ ed_alloc_irq(device_t dev, int rid, int res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | flags); if (res) { - sc->irq_rid = rid; sc->irq_res = res; return (0); } @@ -222,21 +219,18 @@ ed_release_resources(device_t dev) { struct ed_softc *sc = device_get_softc(dev); - if (sc->port_res) { - bus_release_resource(dev, SYS_RES_IOPORT, - sc->port_rid, sc->port_res); - sc->port_res = 0; - } - if (sc->mem_res) { - bus_release_resource(dev, SYS_RES_MEMORY, - sc->mem_rid, sc->mem_res); - sc->mem_res = 0; - } - if (sc->irq_res) { - bus_release_resource(dev, SYS_RES_IRQ, - sc->irq_rid, sc->irq_res); - sc->irq_res = 0; - } + if (sc->port_res) + bus_free_resource(dev, SYS_RES_IOPORT, sc->port_res); + if (sc->port_res2) + bus_free_resource(dev, SYS_RES_IOPORT, sc->port_res2); + if (sc->mem_res) + bus_free_resource(dev, SYS_RES_MEMORY, sc->mem_res); + if (sc->irq_res) + bus_free_resource(dev, SYS_RES_IRQ, sc->irq_res); + sc->port_res = 0; + sc->port_res2 = 0; + sc->mem_res = 0; + sc->irq_res = 0; if (sc->ifp) if_free(sc->ifp); } Modified: head/sys/dev/ed/if_ed_cbus.c ============================================================================== --- head/sys/dev/ed/if_ed_cbus.c Sun Apr 19 23:34:52 2009 (r191298) +++ head/sys/dev/ed/if_ed_cbus.c Mon Apr 20 01:19:59 2009 (r191299) @@ -233,14 +233,14 @@ ed_cbus_attach(dev) if (sc->port_used > 0) { if (ED_TYPE98(flags) == ED_TYPE98_GENERIC) - ed_alloc_port(dev, sc->port_rid, sc->port_used); + ed_alloc_port(dev, 0, sc->port_used); else - ed98_alloc_port(dev, sc->port_rid); + ed98_alloc_port(dev, 0); } if (sc->mem_used) - ed_alloc_memory(dev, sc->mem_rid, sc->mem_used); + ed_alloc_memory(dev, 0, sc->mem_used); - ed_alloc_irq(dev, sc->irq_rid, 0); + ed_alloc_irq(dev, 0, 0); if (sc->sc_media_ioctl == NULL) ed_gen_ifmedia_init(sc); @@ -541,7 +541,6 @@ ed98_alloc_port(device_t dev, int rid) if (!res) return (ENOENT); - sc->port_rid = rid; sc->port_res = res; sc->port_used = n; sc->port_bst = rman_get_bustag(res); Modified: head/sys/dev/ed/if_ed_isa.c ============================================================================== --- head/sys/dev/ed/if_ed_isa.c Sun Apr 19 23:34:52 2009 (r191298) +++ head/sys/dev/ed/if_ed_isa.c Mon Apr 20 01:19:59 2009 (r191299) @@ -163,11 +163,10 @@ ed_isa_attach(device_t dev) int error; if (sc->port_used > 0) - ed_alloc_port(dev, sc->port_rid, sc->port_used); + ed_alloc_port(dev, 0, sc->port_used); if (sc->mem_used) - ed_alloc_memory(dev, sc->mem_rid, sc->mem_used); - - ed_alloc_irq(dev, sc->irq_rid, 0); + ed_alloc_memory(dev, 0, sc->mem_used); + ed_alloc_irq(dev, 0, 0); if (sc->sc_media_ioctl == NULL) ed_gen_ifmedia_init(sc); Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Sun Apr 19 23:34:52 2009 (r191298) +++ head/sys/dev/ed/if_ed_pccard.c Mon Apr 20 01:19:59 2009 (r191299) @@ -383,10 +383,7 @@ ed_pccard_rom_mac(device_t dev, uint8_t static int ed_pccard_add_modem(device_t dev) { - struct ed_softc *sc = device_get_softc(dev); - - device_printf(dev, "Need to write this code: modem rid is %d\n", - sc->modem_rid); + device_printf(dev, "Need to write this code\n"); return 0; } @@ -439,7 +436,7 @@ ed_pccard_attach(device_t dev) u_char sum; u_char enaddr[ETHER_ADDR_LEN]; const struct ed_product *pp; - int error, i, flags; + int error, i, flags, port_rid, modem_rid; struct ed_softc *sc = device_get_softc(dev); u_long size; static uint16_t *intr_vals[] = {NULL, NULL}; @@ -447,29 +444,42 @@ ed_pccard_attach(device_t dev) sc->dev = dev; if ((pp = (const struct ed_product *) pccard_product_lookup(dev, (const struct pccard_product *) ed_pccard_products, - sizeof(ed_pccard_products[0]), NULL)) == NULL) + sizeof(ed_pccard_products[0]), NULL)) == NULL) { + printf("Can't find\n"); return (ENXIO); - sc->modem_rid = -1; + } + modem_rid = port_rid = -1; if (pp->flags & NE2000DVF_MODEM) { - sc->port_rid = -1; for (i = 0; i < 4; i++) { size = bus_get_resource_count(dev, SYS_RES_IOPORT, i); if (size == ED_NOVELL_IO_PORTS) - sc->port_rid = i; + port_rid = i; else if (size == 8) - sc->modem_rid = i; + modem_rid = i; } - if (sc->port_rid == -1) { + if (port_rid == -1) { device_printf(dev, "Cannot locate my ports!\n"); return (ENXIO); } } else { - sc->port_rid = 0; + port_rid = 0; } /* Allocate the port resource during setup. */ - error = ed_alloc_port(dev, sc->port_rid, ED_NOVELL_IO_PORTS); - if (error) + error = ed_alloc_port(dev, port_rid, ED_NOVELL_IO_PORTS); + if (error) { + printf("alloc_port failed\n"); return (error); + } + if (rman_get_size(sc->port_res) == ED_NOVELL_IO_PORTS / 2) { + port_rid++; + sc->port_res2 = bus_alloc_resource(dev, SYS_RES_IOPORT, + &port_rid, 0ul, ~0ul, 1, RF_ACTIVE); + if (sc->port_res2 == NULL || + rman_get_size(sc->port_res2) != ED_NOVELL_IO_PORTS / 2) { + error = ENXIO; + goto bad; + } + } error = ed_alloc_irq(dev, 0, 0); if (error) goto bad; @@ -489,8 +499,10 @@ ed_pccard_attach(device_t dev) error = ed_pccard_ax88x90(dev, pp); if (error != 0) error = ed_pccard_tc5299j(dev, pp); - if (error != 0) + if (error != 0) { error = ed_probe_Novell_generic(dev, flags); + printf("Novell probe generic %d\n", error); + } if (error != 0 && (pp->flags & NE2000DVF_TOSHIBA)) { flags |= ED_FLAGS_TOSH_ETHER; flags |= ED_FLAGS_PCCARD; @@ -586,7 +598,7 @@ ed_pccard_attach(device_t dev) } else { ed_gen_ifmedia_init(sc); } - if (sc->modem_rid != -1) + if (modem_rid != -1) ed_pccard_add_modem(dev); error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, Modified: head/sys/dev/ed/if_edvar.h ============================================================================== --- head/sys/dev/ed/if_edvar.h Sun Apr 19 23:34:52 2009 (r191298) +++ head/sys/dev/ed/if_edvar.h Mon Apr 20 01:19:59 2009 (r191299) @@ -47,20 +47,17 @@ struct ed_softc { u_char xmit_busy; /* transmitter is busy */ u_char enaddr[6]; - int port_rid; /* resource id for port range */ int port_used; /* nonzero if ports used */ struct resource* port_res; /* resource for port range */ + struct resource* port_res2; /* resource for port range */ bus_space_tag_t port_bst; bus_space_handle_t port_bsh; - int mem_rid; /* resource id for memory range */ int mem_used; /* nonzero if memory used */ struct resource* mem_res; /* resource for memory range */ bus_space_tag_t mem_bst; bus_space_handle_t mem_bsh; - int irq_rid; /* resource id for irq */ struct resource* irq_res; /* resource for irq */ void* irq_handle; /* handle for irq handler */ - int modem_rid; /* resource ID for modem part of device */ int (*sc_media_ioctl)(struct ed_softc *sc, struct ifreq *ifr, u_long command); void (*sc_mediachg)(struct ed_softc *); From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 03:44:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46E76106564A; Mon, 20 Apr 2009 03:44:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33F1D8FC1C; Mon, 20 Apr 2009 03:44:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3K3itaY034386; Mon, 20 Apr 2009 03:44:55 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3K3itZj034385; Mon, 20 Apr 2009 03:44:55 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200904200344.n3K3itZj034385@svn.freebsd.org> From: Alan Cox Date: Mon, 20 Apr 2009 03:44: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: r191300 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 03:44:55 -0000 Author: alc Date: Mon Apr 20 03:44:54 2009 New Revision: 191300 URL: http://svn.freebsd.org/changeset/base/191300 Log: MFamd64/i386 Introduce pmap_try_insert_pv_entry(), a function that conditionally creates a pv entry if the number of entries is below the high water mark for pv entries. Introduce pmap_enter_quick_locked() and use it to reimplement pmap_enter_object(). The old implementation was broken. For example, it could block while holding a mutex lock. Change pmap_enter_quick_locked() to fail rather than wait if it is unable to allocate a page table page. This prevents a race between pmap_enter_object() and the page daemon. Specifically, an inactive page that is a successor to the page that was given to pmap_enter_quick_locked() might become a cache page while pmap_enter_quick_locked() waits and later pmap_enter_object() maps the cache page violating the invariant that cache pages are never mapped. Similarly, change pmap_enter_quick_locked() to call pmap_try_insert_pv_entry() rather than pmap_insert_entry(). Generally speaking, pmap_enter_quick_locked() is used to create speculative mappings. So, it should not try hard to allocate memory if free memory is scarce. Tested by: gonzo Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Mon Apr 20 01:19:59 2009 (r191299) +++ head/sys/mips/mips/pmap.c Mon Apr 20 03:44:54 2009 (r191300) @@ -171,6 +171,8 @@ static PMAP_INLINE void free_pv_entry(pv static pv_entry_t get_pv_entry(pmap_t locked_pmap); static __inline void pmap_changebit(vm_page_t m, int bit, boolean_t setem); +static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, + vm_page_t m, vm_prot_t prot, vm_page_t mpte); static int pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va); static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); @@ -178,6 +180,8 @@ static boolean_t pmap_testbit(vm_page_t static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t mpte, vm_page_t m, boolean_t wired); +static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_page_t mpte, + vm_offset_t va, vm_page_t m); static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags); @@ -1461,6 +1465,32 @@ pmap_insert_entry(pmap_t pmap, vm_offset } /* + * Conditionally create a pv entry. + */ +static boolean_t +pmap_try_insert_pv_entry(pmap_t pmap, vm_page_t mpte, vm_offset_t va, + vm_page_t m) +{ + pv_entry_t pv; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + if (pv_entry_count < pv_entry_high_water && + (pv = uma_zalloc(pvzone, M_NOWAIT)) != NULL) { + pv_entry_count++; + pv->pv_va = va; + pv->pv_pmap = pmap; + pv->pv_ptem = mpte; + pv->pv_wired = FALSE; + TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist); + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); + m->md.pv_list_count++; + return (TRUE); + } else + return (FALSE); +} + +/* * pmap_remove_pte: do the things to unmap a page in a process */ static int @@ -1919,20 +1949,28 @@ validate: * but is *MUCH* faster than pmap_enter... */ - void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) { + + PMAP_LOCK(pmap); + (void)pmap_enter_quick_locked(pmap, va, m, prot, NULL); + PMAP_UNLOCK(pmap); +} + +static vm_page_t +pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, + vm_prot_t prot, vm_page_t mpte) +{ pt_entry_t *pte; vm_offset_t pa; - vm_page_t mpte = NULL; KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0, - ("pmap_enter_quick: managed mapping within the clean submap")); + ("pmap_enter_quick_locked: managed mapping within the clean submap")); mtx_assert(&vm_page_queue_mtx, MA_OWNED); - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); - PMAP_LOCK(pmap); + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + /* * In the case that a page table page is not resident, we are * creating it here. @@ -1948,7 +1986,6 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ if (mpte && (mpte->pindex == ptepindex)) { mpte->wire_count++; } else { - retry: /* * Get the page directory entry */ @@ -1968,19 +2005,10 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ } mpte->wire_count++; } else { - mpte = _pmap_allocpte(pmap, ptepindex, M_NOWAIT); - if (mpte == NULL) { - PMAP_UNLOCK(pmap); - vm_page_busy(m); - vm_page_unlock_queues(); - VM_OBJECT_UNLOCK(m->object); - VM_WAIT; - VM_OBJECT_LOCK(m->object); - vm_page_lock_queues(); - vm_page_wakeup(m); - PMAP_LOCK(pmap); - goto retry; - } + mpte = _pmap_allocpte(pmap, ptepindex, + M_NOWAIT); + if (mpte == NULL) + return (mpte); } } } else { @@ -1989,18 +2017,24 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ pte = pmap_pte(pmap, va); if (pmap_pte_v(pte)) { - if (mpte) - pmap_unwire_pte_hold(pmap, mpte); - PMAP_UNLOCK(pmap); - return; + if (mpte != NULL) { + mpte->wire_count--; + mpte = NULL; + } + return (mpte); } + /* - * Enter on the PV list if part of our managed memory. Note that we - * raise IPL while manipulating pv_table since pmap_enter can be - * called at interrupt time. + * Enter on the PV list if part of our managed memory. */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) - pmap_insert_entry(pmap, va, mpte, m, FALSE); + if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0 && + !pmap_try_insert_pv_entry(pmap, mpte, va, m)) { + if (mpte != NULL) { + pmap_unwire_pte_hold(pmap, mpte); + mpte = NULL; + } + return (mpte); + } /* * Increment counters @@ -2033,9 +2067,7 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ mips_dcache_wbinv_range(va, NBPG); } } - - PMAP_UNLOCK(pmap); - return; + return (mpte); } /* @@ -2114,21 +2146,20 @@ void pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end, vm_page_t m_start, vm_prot_t prot) { - vm_page_t m; + vm_page_t m, mpte; vm_pindex_t diff, psize; + VM_OBJECT_LOCK_ASSERT(m_start->object, MA_OWNED); psize = atop(end - start); + mpte = NULL; m = m_start; + PMAP_LOCK(pmap); while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { - /* FIX ME FIX ME - prot is passed in both the - * the normal spot m, prot but also as the fault_type - * which we don't use. If we ever use it in pmap_enter - * we will have to fix this. - */ - pmap_enter(pmap, start + ptoa(diff), prot, m, prot & - (VM_PROT_READ | VM_PROT_EXECUTE), FALSE); + mpte = pmap_enter_quick_locked(pmap, start + ptoa(diff), m, + prot, mpte); m = TAILQ_NEXT(m, listq); } + PMAP_UNLOCK(pmap); } /* From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 06:44:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09479106566C; Mon, 20 Apr 2009 06:44:35 +0000 (UTC) (envelope-from zec@freebsd.org) Received: from labs4.cc.fer.hr (labs4.cc.fer.hr [161.53.72.24]) by mx1.freebsd.org (Postfix) with ESMTP id 9CEE98FC08; Mon, 20 Apr 2009 06:44:34 +0000 (UTC) (envelope-from zec@freebsd.org) Received: from sluga.fer.hr (sluga.cc.fer.hr [161.53.72.14]) by labs4.cc.fer.hr (8.14.2/8.14.2) with ESMTP id n3K6iiEV025440; Mon, 20 Apr 2009 08:44:51 +0200 (CEST) Received: from [192.168.200.110] ([161.53.19.79]) by sluga.fer.hr over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 20 Apr 2009 08:44:21 +0200 From: Marko Zec To: Kip Macy Date: Mon, 20 Apr 2009 08:44:11 +0200 User-Agent: KMail/1.9.10 References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <200904192221.55744.zec@freebsd.org> <3c1674c90904191405v56298134g286ea31ee4680769@mail.gmail.com> In-Reply-To: <3c1674c90904191405v56298134g286ea31ee4680769@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200904200844.12344.zec@freebsd.org> X-OriginalArrivalTime: 20 Apr 2009 06:44:21.0657 (UTC) FILETIME=[6FC11090:01C9C183] X-Scanned-By: MIMEDefang 2.64 on 161.53.72.24 Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann Subject: Re: svn commit: r191259 - 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, 20 Apr 2009 06:44:35 -0000 On Sunday 19 April 2009 23:05:55 Kip Macy wrote: > On Sun, Apr 19, 2009 at 1:21 PM, Marko Zec wrote: > > On Sunday 19 April 2009 19:13:37 Kip Macy wrote: > >> On Sun, Apr 19, 2009 at 3:18 AM, Andre Oppermann > >> wrote: > > > > ... > > > >> > I have another question on the flowtable: =A0What is the pupose of i= t? > >> > All router vendors have learned a long time ago that route caching > >> > (aka flow caching) doesn't work out on a router that carries the DFZ > >> > (default free zone, currently ~280k prefixes). =A0The overhead of > >> > managing the flow table and the high churn rate make it much more > >> > expensive than a direct and already very efficient radix trie lookup. > >> > Additionally a well connected DFZ router has some 1k prefix updates > >> > per second. =A0More information can be found for example at Cisco he= re: > >> > =A0http://www.cisco.com/en/US/tech/tk827/tk831/technologies_white_pa= per0 > >> >918 6a00800a62d9.shtml The same findings are also available from all > >> > other major router vendors like Juniper, Foundry, etc. > >> > > >> > Lets examine the situations: > >> > =A0a) internal router with only a few routes; The routing and ARP ta= ble > >> > =A0 =A0are small, lookups are very fast and everything is hot in the= CPU > >> > =A0 =A0caches anyway. > >> > =A0b) DFZ router with 280k routes; A small flow table has constant > >> > thrashing becoming negative overhead only. =A0A large flow table has= a > >> > high maintenance > >> > =A0 =A0overhead, higher lookup times and sill a significant amount of > >> > thrashing. The overhead of the flow table is equal or higher than a > >> > direct routing table lookup. > >> > Concluding that a flow table is never a win but a liability in any > >> > realistic setting. > >> > >> You're assuming that a Cisco- / Juniper-class workload is > >> representative of where FreeBSD is deployed. I agree that FreeBSD is > >> sub-optimal for large routing environments for a whole host of other > >> reasons. A better question is what are "typical" FreeBSD deployments, > >> and how well would it work there. The flowtable needs to be sized to > >> correspond to the number of flows, its utility rapidly diminishes as > >> the number of collisions per bucket increases. > > > > ... which makes a flow cache a perfect DoS target in any environment, be > > it a DFZ or enterprise router or an end host or whatever. > > Uhm, assuming that you don't put a limit on the number of flows > allocated - which I do. When you hit the zone limit for flows you > simply stop caching new flows. =2E.. which means you fall back to the ordinary routing lookups, but only a= fter=20 you have wasted cycles to compute a hash and found out that it doesn't matc= h=20 anything in your cache -> in this case I would expect only a degradation in= =20 performance, not an improvement. > So the added overhead is simply the=20 > extra cache misses up to the collision depth for the bucket. Are you > two familiar with CAMs? Not really, but I've heared of anecdotes that Ciscos that were capped at 25= 6K=20 =46IB entries in CAM had to fall back to lookups in software once the size = of=20 DFZ table exceeded the 256K figure - so everybody rushed to get rid=20 of^H^H^H^H upgrade such hardware around 1.5 years ago in anticipation of DF= Z=20 table bloom. =20 But it seems to me that CAM lookups are pretty resilient against DoSing by= =20 throwing malicious synthetic flows on them, whereas flow caches will melt=20 down easily. Marko From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 07:01:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43CAA106564A; Mon, 20 Apr 2009 07:01:28 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.31]) by mx1.freebsd.org (Postfix) with ESMTP id 853D98FC1E; Mon, 20 Apr 2009 07:01:27 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by yw-out-2324.google.com with SMTP id 5so1108916ywh.13 for ; Mon, 20 Apr 2009 00:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=aewVQAM0LquYmHlHWO5I+ZuxJb55WdzVjV0TMWQiLMg=; b=FTgqgqroG+boI3JtTLJUsunH03tH4rHZYTctxxVGYsRTIsoaZnloGhYEyM0PJlqqI9 HJaP6k++C1VLkiweVk768ZU/uty7KZNUi/dFhXhqLTr0+z91p2DxKnld/cKLMSZbKz3g LTIlApPasdzYsZQm9V4Uc4Fv/zojcLdq44mus= 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=G/kngduQncktqyPx4jg7Ypvj3x7T2jPhaV4o4RBFuGJUQyaDfXJHP9925TP5MS7U9j XyMK0+7Dx79orIcHVWSwKSOVoR0wkflNu78BgtlIqLv6HJuWBkkO5MojyJh2nDDi+UqA 8tttaPp7yX1CgpVRU1d6OTNqmZkxKAlpM/4sU= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.46.10 with SMTP id t10mr7403058ant.116.1240210886143; Mon, 20 Apr 2009 00:01:26 -0700 (PDT) In-Reply-To: <200904200844.12344.zec@freebsd.org> References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <200904192221.55744.zec@freebsd.org> <3c1674c90904191405v56298134g286ea31ee4680769@mail.gmail.com> <200904200844.12344.zec@freebsd.org> Date: Mon, 20 Apr 2009 00:01:25 -0700 X-Google-Sender-Auth: e4fd2d51700c3e25 Message-ID: <3c1674c90904200001s1d03c7d8udcd2dd4cf99984fd@mail.gmail.com> From: Kip Macy To: Marko Zec Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann Subject: Re: svn commit: r191259 - 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, 20 Apr 2009 07:01:28 -0000 > ... which means you fall back to the ordinary routing lookups, but only after > you have wasted cycles to compute a hash and found out that it doesn't match > anything in your cache -> in this case I would expect only a degradation in > performance, not an improvement. If your normal operating conditions are DDOS then you have more serious problems. I said that the system would not collapse as you were in fact claiming, not that it would perform optimally. > >> So the added overhead is simply the >> extra cache misses up to the collision depth for the bucket. Are you >> two familiar with CAMs? > > Not really, but I've heared of anecdotes that Ciscos that were capped at 256K > FIB entries in CAM had to fall back to lookups in software once the size of > DFZ table exceeded the 256K figure - so everybody rushed to get rid > of^H^H^H^H upgrade such hardware around 1.5 years ago in anticipation of DFZ > table bloom. If your memory is too small for your routing table you will have a problem. If your flow table is too small you will have a problem. However, on modern hardware, when running FreeBSD, unless every packet you are seeing is coming from a different source you'll be rate limited by the number of kpps your system can handle long before you run out of space to store a collision free flow table. > > But it seems to me that CAM lookups are pretty resilient against DoSing by > throwing malicious synthetic flows on them, whereas flow caches will melt > down easily. Actually a CAM is a hardware implementation of a hash table. It has the same limitations. To claim that routers don't use flow tables because they are handled in hardware is a very strange thing to say. -Kip From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 07:13:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4750E1065674; Mon, 20 Apr 2009 07:13:05 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AEA18FC14; Mon, 20 Apr 2009 07:13:05 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3K7D4W5039287; Mon, 20 Apr 2009 07:13:04 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3K7D4tP039285; Mon, 20 Apr 2009 07:13:04 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200904200713.n3K7D4tP039285@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 20 Apr 2009 07:13:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191301 - in head/sys: dev/re 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, 20 Apr 2009 07:13:05 -0000 Author: yongari Date: Mon Apr 20 07:13:04 2009 New Revision: 191301 URL: http://svn.freebsd.org/changeset/base/191301 Log: For RTL8139C+ controllers, have controller handle padding short checksum offload frames. Software workaround used for broken controllers(RTL8169, RTL8168, RTL8168B) seem to cause watchdog timeouts on RTL8139C+. Introduce a new flag RL_FLAG_AUTOPAD to mark automatic padding feature of controller and set it for RTL8139C+ and controllers that use new descriptor format. This fixes watchdog timeouts seen on RTL8139C+. Reported by: Dimitri Rodis < DimitriR <> integritasystems dot com > Tested by: Dimitri Rodis < DimitriR <> integritasystems dot com > Modified: head/sys/dev/re/if_re.c head/sys/pci/if_rlreg.h Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Mon Apr 20 03:44:54 2009 (r191300) +++ head/sys/dev/re/if_re.c Mon Apr 20 07:13:04 2009 (r191301) @@ -1250,7 +1250,8 @@ re_attach(device_t dev) switch (hw_rev->rl_rev) { case RL_HWREV_8139CPLUS: - sc->rl_flags |= RL_FLAG_NOJUMBO | RL_FLAG_FASTETHER; + sc->rl_flags |= RL_FLAG_NOJUMBO | RL_FLAG_FASTETHER | + RL_FLAG_AUTOPAD; break; case RL_HWREV_8100E: case RL_HWREV_8101E: @@ -1261,7 +1262,7 @@ re_attach(device_t dev) case RL_HWREV_8102EL: sc->rl_flags |= RL_FLAG_NOJUMBO | RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | - RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP; + RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD; break; case RL_HWREV_8168_SPIN1: case RL_HWREV_8168_SPIN2: @@ -1280,7 +1281,8 @@ re_attach(device_t dev) case RL_HWREV_8168CP: case RL_HWREV_8168D: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | - RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP; + RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | + RL_FLAG_AUTOPAD; /* * These controllers support jumbo frame but it seems * that enabling it requires touching additional magic @@ -2250,7 +2252,7 @@ re_encap(struct rl_softc *sc, struct mbu * offload is enabled, we always manually pad short frames out * to the minimum ethernet frame size. */ - if ((sc->rl_flags & RL_FLAG_DESCV2) == 0 && + if ((sc->rl_flags & RL_FLAG_AUTOPAD) == 0 && (*m_head)->m_pkthdr.len < RL_IP4CSUMTX_PADLEN && ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) != 0) { padlen = RL_MIN_FRAMELEN - (*m_head)->m_pkthdr.len; Modified: head/sys/pci/if_rlreg.h ============================================================================== --- head/sys/pci/if_rlreg.h Mon Apr 20 03:44:54 2009 (r191300) +++ head/sys/pci/if_rlreg.h Mon Apr 20 07:13:04 2009 (r191301) @@ -880,6 +880,7 @@ struct rl_softc { int rl_txstart; uint32_t rl_flags; #define RL_FLAG_MSI 0x0001 +#define RL_FLAG_AUTOPAD 0x0002 #define RL_FLAG_PHYWAKE 0x0008 #define RL_FLAG_NOJUMBO 0x0010 #define RL_FLAG_PAR 0x0020 From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 07:30:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBCFF1065670; Mon, 20 Apr 2009 07:30:12 +0000 (UTC) (envelope-from zec@freebsd.org) Received: from labs4.cc.fer.hr (labs4.cc.fer.hr [161.53.72.24]) by mx1.freebsd.org (Postfix) with ESMTP id 54C7A8FC1B; Mon, 20 Apr 2009 07:30:11 +0000 (UTC) (envelope-from zec@freebsd.org) Received: from sluga.fer.hr (sluga.cc.fer.hr [161.53.72.14]) by labs4.cc.fer.hr (8.14.2/8.14.2) with ESMTP id n3K7UUE3025702; Mon, 20 Apr 2009 09:30:30 +0200 (CEST) Received: from [192.168.200.110] ([161.53.19.79]) by sluga.fer.hr over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 20 Apr 2009 09:30:07 +0200 From: Marko Zec To: Kip Macy Date: Mon, 20 Apr 2009 09:29:57 +0200 User-Agent: KMail/1.9.10 References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <200904200844.12344.zec@freebsd.org> <3c1674c90904200001s1d03c7d8udcd2dd4cf99984fd@mail.gmail.com> In-Reply-To: <3c1674c90904200001s1d03c7d8udcd2dd4cf99984fd@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904200929.57914.zec@freebsd.org> X-OriginalArrivalTime: 20 Apr 2009 07:30:08.0124 (UTC) FILETIME=[D4C6ABC0:01C9C189] X-Scanned-By: MIMEDefang 2.64 on 161.53.72.24 Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann Subject: Re: svn commit: r191259 - 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, 20 Apr 2009 07:30:13 -0000 On Monday 20 April 2009 09:01:25 Kip Macy wrote: ... > > But it seems to me that CAM lookups are pretty resilient against DoSing > > by throwing malicious synthetic flows on them, whereas flow caches will > > melt down easily. > > Actually a CAM is a hardware implementation of a hash table. It has > the same limitations. To claim that routers don't use flow tables > because they are handled in hardware is a very strange thing to say. Well I may be missing something, but TCAMs typically used for routing lookups are populated by the router's control plane, i.e. routing protocols, which means that the number of entries in the FIB / TCAM correlates to the size of RIB, i.e. it definitely doesn't grow / shrink dynamically in response to the current flow pattern. And I may not know how CAMs are implemented internally, but I'm not aware of any current vendor who would use (T)CAMs indexed by a flow hash for routing lookups. Wouldn't it be a more common case for a TCAM to hold a FIB table, sorted in a way which lets more specific prefixes having precedence? i.e. FIB TCAM 10.0.1.0/24 -> 00001010 00000000 00000001 XXXXXXXX -> output port X 10.0.0.0/8 -> 00001010 XXXXXXXX XXXXXXXX XXXXXXXX -> output port Y 0.0.0.0/0 -> XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX -> output port Z This definitely doesn't change with flows dynamics IMO. Marko From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 07:44:14 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22C64106566C; Mon, 20 Apr 2009 07:44:14 +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 B25B18FC17; Mon, 20 Apr 2009 07:44:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-120-227.carlnfd1.nsw.optusnet.com.au (c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n3K7i8x4003345 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Apr 2009 17:44:09 +1000 Date: Mon, 20 Apr 2009 17:44:08 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Robert Watson In-Reply-To: <200904192303.n3JN3v9w023289@svn.freebsd.org> Message-ID: <20090420171843.A58020@delplex.bde.org> References: <200904192303.n3JN3v9w023289@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: r191292 - 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: Mon, 20 Apr 2009 07:44:14 -0000 On Sun, 19 Apr 2009, Robert Watson wrote: > Log: > Explicitly include machine/param.h for CACHE_LINE_SIZE. > > MFC after: 2 weeks > > Modified: > head/libexec/rtld-elf/rtld_lock.c It is a style bug (unwarranted chumminess with the implementation) to include (or otherwise refer to) machine/param.h directly in *.c. This is only the 5th instance of this style bug in all of /usr/src. The previous ones are: % ./contrib/tcsh/sh.time.c:# include % ./lib/libc/stdlib/malloc.c:#include % ./sys/kern/subr_pcpu.c: * - The platform sets the value of MAXCPU in . % ./sys/mips/mips/stack_machdep.c:#include Similarly in MI code that is not sys/param.h, except for 1 exception: % ./gnu/lib/libstdc++/config.h:/* Define to 1 if you have the header file. */ % ./contrib/libstdc++/libmath/mathconf.h:# include % ./contrib/binutils/bfd/hosts/decstation.h:/* Hopefully this should include either machine/param.h (Ultrix) or % ./contrib/binutils/bfd/hosts/mipsbsd.h:#include % ./contrib/binutils/bfd/hosts/i386bsd.h:#include % ./contrib/gdb/gdb/config/mips/xm-mips.h:// OBSOLETE #include Contribed code certainly shouldn't know the implementation details. It might have ifdefs for this, with machine/param.h not being an implementation detail on some systems, but the includes in *bsd.h are probably wrong since bsd is not such a system. % ./sys/dev/drm/drmP.h:#include % ./sys/i386/include/xen/xen-os.h:#include Probably just wrong. % ./sys/sys/param.h:#include This is the public interface. % ./sys/sys/socket.h:#include This one is correct. It needs to include specially to get a small subset to avoid namespace pollution in the standard header sys/socket.h. This reason doesn't apply in any other cases. BTW, the #defines of __HAVE_ACPI and __PCI_REROUTE_INTERRUPT are unsorted more than most, at least in i386/include/param.h -- they are unsorted outside of the normal _FOO_H_ include guard. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 07:48:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AB311065670; Mon, 20 Apr 2009 07:48:01 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.245]) by mx1.freebsd.org (Postfix) with ESMTP id C27448FC2B; Mon, 20 Apr 2009 07:48:00 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by an-out-0708.google.com with SMTP id c3so671463ana.13 for ; Mon, 20 Apr 2009 00:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=J5XY5Oew3P11rVXEh6LpqKuINdJeO5xjacRRWaz6+yw=; b=J/LDpqYPEVB9rtZuPdqpT0YXzLn1Bfq7DsE0FYbBURdLFlrxQK2uOqvfAt78S5O1NX 976j0ZyG4Sy3C5vN1u8lzb84Ktg5qyJmWH/l3CV+C7M05HJq+SUiFQPUrpSWr/A/1RGj ScAT3QaMwio5dbkjBnA6MDz0Ta+s5DKnkgy8E= 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=YfEC3E0UhYWEno7vA985y1g20ZUg+JQMV23/vJESgcdkgZ69T369rgixC016bg+rmj 40/mO83AgC+tcExZD9DQhUIEOPcm58av88e1cI41mwzo9uCLAXw/KpmLz7755ahxav/H kz7v3hKNXvlokKCSYYghgvtRH/08vMgOs+pNI= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.92.17 with SMTP id p17mr7051429anb.138.1240213657470; Mon, 20 Apr 2009 00:47:37 -0700 (PDT) In-Reply-To: <200904200929.57914.zec@freebsd.org> References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <200904200844.12344.zec@freebsd.org> <3c1674c90904200001s1d03c7d8udcd2dd4cf99984fd@mail.gmail.com> <200904200929.57914.zec@freebsd.org> Date: Mon, 20 Apr 2009 00:47:37 -0700 X-Google-Sender-Auth: f92fac4977767c09 Message-ID: <3c1674c90904200047s551a93a3wec97607b8212b0d@mail.gmail.com> From: Kip Macy To: Marko Zec Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann Subject: Re: svn commit: r191259 - 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, 20 Apr 2009 07:48:01 -0000 On Mon, Apr 20, 2009 at 12:29 AM, Marko Zec wrote: > On Monday 20 April 2009 09:01:25 Kip Macy wrote: > ... >> > But it seems to me that CAM lookups are pretty resilient against DoSin= g >> > by throwing malicious synthetic flows on them, whereas flow caches wil= l >> > melt down easily. >> >> Actually a CAM is a hardware implementation of a hash table. It has >> the same limitations. To claim that routers don't use flow tables >> because they are handled in hardware is a very strange thing to say. > > Well I may be missing something, but TCAMs typically used for routing loo= kups > are populated by the router's control plane, i.e. routing protocols, whic= h > means that the number of entries in the FIB / TCAM correlates to the size= of > RIB, i.e. it definitely doesn't grow / shrink dynamically in response to = the > current flow pattern. > > And I may not know how CAMs are implemented internally, but I'm not aware= of > any current vendor who would use (T)CAMs indexed by a flow hash for routi= ng > lookups. =A0Wouldn't it be a more common case for a TCAM to hold a FIB ta= ble, > sorted in a way which lets more specific prefixes having precedence? > > i.e. > > FIB =A0 =A0 =A0 =A0 =A0 =A0TCAM > 10.0.1.0/24 -> 00001010 00000000 00000001 XXXXXXXX -> output port X > 10.0.0.0/8 =A0-> 00001010 XXXXXXXX XXXXXXXX XXXXXXXX -> output port Y > 0.0.0.0/0 =A0 -> XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX -> output port Z > > This definitely doesn't change with flows dynamics IMO. I'm not saying they're the same thing. I'm saying conceptually they're equivalent. The main point I'm getting at is that if your working set exceeds the size of your cache (whatever you are caching) your performance will be poor - period. Even after a number optimizations, FreeBSD is not likely to be able to forward more than 500kpps per core in the near future (i.e. 4Mpps on an 8-core). In the somewhat extreme case (from the environments I'm familiar with), you have 1 million unique destination IPs (per core) within a 30 second window - or 1 packet to each destination every other second, a 2 million entry table would require 16MB + ~80MB for the flows themselves (per core). A large amount of memory certainly, but nothing extraordinary when my laptop contains more than twice that. I'm not saying that cases where there is no locality in the destination space or that they aren't important use cases. I'm just saying that they're very much in the minority and those users can either disable the flowtable or 'nooption' it in their config. -Kip From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 07:55:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02870106566B; Mon, 20 Apr 2009 07:55:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id A5EEF8FC13; Mon, 20 Apr 2009 07:55:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 7D88841C72F; Mon, 20 Apr 2009 09:55:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id 8zFKOLpYfIaB; Mon, 20 Apr 2009 09:55:06 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 1FBEA41C712; Mon, 20 Apr 2009 09:55:06 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id AADF844490C; Mon, 20 Apr 2009 07:50:27 +0000 (UTC) Date: Mon, 20 Apr 2009 07:50:27 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: src-committers@freebsd.org In-Reply-To: <200904200929.57914.zec@freebsd.org> Message-ID: <20090420073548.M15361@maildrop.int.zabbadoz.net> References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <200904200844.12344.zec@freebsd.org> <3c1674c90904200001s1d03c7d8udcd2dd4cf99984fd@mail.gmail.com> <200904200929.57914.zec@freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Andre Oppermann , Kip Macy , svn-src-all@freebsd.org, Marko Zec , Robert Watson , svn-src-head@freebsd.org Subject: Re: svn commit: r191259 - 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, 20 Apr 2009 07:55:08 -0000 [snip] People, you are missing a few points here: - if you want to run a DFZ router or do not like flowtables, turn them off. There is a kernel option for that. - if you use it and it doesn't perform but you have a valid setup, tune it. - if you are under a (D)DoS your least problem most likely is a small performance drop from the extra flowtable lookup, but you'll be happy enough if other things do not keel over. - For an average FreeBSD thingy that does forwarding, say a pfsense box, maybe a router in front of a few subnets with a some web/mail/dns/.. servers, maybe a box forwarding packets for some SMB, .. this, may indeed help. -- Bjoern A. Zeeb The greatest risk is not taking one. From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 08:00:12 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC9FF106564A; Mon, 20 Apr 2009 08:00:12 +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 26DA98FC14; Mon, 20 Apr 2009 08:00:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-120-227.carlnfd1.nsw.optusnet.com.au (c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n3K805js016489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Apr 2009 18:00:08 +1000 Date: Mon, 20 Apr 2009 18:00:05 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Robert Watson In-Reply-To: <200904192019.n3JKJDa6019179@svn.freebsd.org> Message-ID: <20090420174802.F58065@delplex.bde.org> References: <200904192019.n3JKJDa6019179@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: r191276 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2009 08:00:13 -0000 On Sun, 19 Apr 2009, Robert Watson wrote: > Log: > For each architecture, define CACHE_LINE_SHIFT and a derived > CACHE_LINE_SIZE constant. These constants are intended to > over-estimate the cache line size, and be used at compile-time > when a run-time tuning alternative isn't appropriate or > available. > > Defaults for all architectures are 64 bytes, except powerpc > where it is 128 bytes (used on G5 systems). > ... > Modified: head/sys/amd64/include/param.h > ============================================================================== > --- head/sys/amd64/include/param.h Sun Apr 19 18:23:23 2009 (r191275) > +++ head/sys/amd64/include/param.h Sun Apr 19 20:19:13 2009 (r191276) > @@ -89,6 +89,10 @@ > #define ALIGN(p) _ALIGN(p) > #define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) > > +#ifndef CACHE_LINE_SHIFT > +#define CACHE_LINE_SHIFT 6 > +#endif > +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) This still has the bogus ifdef. Overriding the definition is difficult to do consistently even in a kernel with no modules, since CACHE_LINE_SIZE is not a kernel option. Overriding the definition makes negative sense since the value is a maximum-maximum (possibly larger than strictly needed) so that it can be constant. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 08:04:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DC73106566B; Mon, 20 Apr 2009 08:04:31 +0000 (UTC) (envelope-from zec@freebsd.org) Received: from labs4.cc.fer.hr (labs4.cc.fer.hr [161.53.72.24]) by mx1.freebsd.org (Postfix) with ESMTP id C98CE8FC14; Mon, 20 Apr 2009 08:04:30 +0000 (UTC) (envelope-from zec@freebsd.org) Received: from sluga.fer.hr (sluga.cc.fer.hr [161.53.72.14]) by labs4.cc.fer.hr (8.14.2/8.14.2) with ESMTP id n3K84j98026053; Mon, 20 Apr 2009 10:04:45 +0200 (CEST) Received: from [192.168.200.110] ([161.53.19.79]) by sluga.fer.hr over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 20 Apr 2009 10:04:23 +0200 From: Marko Zec To: Kip Macy Date: Mon, 20 Apr 2009 10:04:19 +0200 User-Agent: KMail/1.9.10 References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <200904200929.57914.zec@freebsd.org> <3c1674c90904200047s551a93a3wec97607b8212b0d@mail.gmail.com> In-Reply-To: <3c1674c90904200047s551a93a3wec97607b8212b0d@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200904201004.19695.zec@freebsd.org> X-OriginalArrivalTime: 20 Apr 2009 08:04:23.0498 (UTC) FILETIME=[9DDFDAA0:01C9C18E] X-Scanned-By: MIMEDefang 2.64 on 161.53.72.24 Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann Subject: Re: svn commit: r191259 - 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, 20 Apr 2009 08:04:32 -0000 On Monday 20 April 2009 09:47:37 Kip Macy wrote: > On Mon, Apr 20, 2009 at 12:29 AM, Marko Zec wrote: > > On Monday 20 April 2009 09:01:25 Kip Macy wrote: > > ... > > > >> > But it seems to me that CAM lookups are pretty resilient against > >> > DoSing by throwing malicious synthetic flows on them, whereas flow > >> > caches will melt down easily. > >> > >> Actually a CAM is a hardware implementation of a hash table. It has > >> the same limitations. To claim that routers don't use flow tables > >> because they are handled in hardware is a very strange thing to say. > > > > Well I may be missing something, but TCAMs typically used for routing > > lookups are populated by the router's control plane, i.e. routing > > protocols, which means that the number of entries in the FIB / TCAM > > correlates to the size of RIB, i.e. it definitely doesn't grow / shrink > > dynamically in response to the current flow pattern. > > > > And I may not know how CAMs are implemented internally, but I'm not awa= re > > of any current vendor who would use (T)CAMs indexed by a flow hash for > > routing lookups. =A0Wouldn't it be a more common case for a TCAM to hol= d a > > FIB table, sorted in a way which lets more specific prefixes having > > precedence? > > > > i.e. > > > > FIB =A0 =A0 =A0 =A0 =A0 =A0TCAM > > 10.0.1.0/24 -> 00001010 00000000 00000001 XXXXXXXX -> output port X > > 10.0.0.0/8 =A0-> 00001010 XXXXXXXX XXXXXXXX XXXXXXXX -> output port Y > > 0.0.0.0/0 =A0 -> XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX -> output port Z > > > > This definitely doesn't change with flows dynamics IMO. > > I'm not saying they're the same thing. I'm saying conceptually they're > equivalent. > > The main point I'm getting at is that if your working set exceeds the > size of your cache (whatever you are caching) your performance will be > poor - period. Even after a number optimizations, FreeBSD is not > likely to be able to forward more than 500kpps per core in the near > future (i.e. 4Mpps on an 8-core). In the somewhat extreme case (from > the environments I'm familiar with), you have 1 million unique > destination IPs (per core) within a 30 second window - or 1 packet to > each destination every other second, a 2 million entry table would > require 16MB + ~80MB for the flows themselves (per core). A large > amount of memory certainly, but nothing extraordinary when my laptop > contains more than twice that. Hmm, such a scheme raises suspicion that in your particular case very few f= low=20 cache lookups could be serviced from CPU caches. 16MB + 80MB sounds to be i= n=20 range with memory footprint of a DFZ table stored in our normal radix tree = =2D=20 so where's the benefit of the flow cache? Marko > I'm not saying that cases where there is no locality in the > destination space or that they aren't important use cases. I'm just > saying that they're very much in the minority and those users can > either disable the flowtable or 'nooption' it in their config. > > > -Kip From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 09:59:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A454A106566B; Mon, 20 Apr 2009 09:59:08 +0000 (UTC) (envelope-from roberto@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92F538FC13; Mon, 20 Apr 2009 09:59:08 +0000 (UTC) (envelope-from roberto@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3K9x8gI042604; Mon, 20 Apr 2009 09:59:08 GMT (envelope-from roberto@svn.freebsd.org) Received: (from roberto@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3K9x8ln042603; Mon, 20 Apr 2009 09:59:08 GMT (envelope-from roberto@svn.freebsd.org) Message-Id: <200904200959.n3K9x8ln042603@svn.freebsd.org> From: Ollivier Robert Date: Mon, 20 Apr 2009 09:59: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: r191302 - in head/contrib/ntp: . ntpq X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 09:59:09 -0000 Author: roberto Date: Mon Apr 20 09:59:08 2009 New Revision: 191302 URL: http://svn.freebsd.org/changeset/base/191302 Log: Merge r191298 into HEAD. Prevent a buffer overflow in ntpq. Patch taken from the PR database after being committed to the official ntp tree and present in 4.2.4p7-rc2. It will be MFH to the upcoming 7.2 pending re approval. Obtained from: https://support.ntp.org/bugs/show_bug.cgi?id=1144 MFC after: 3 days Security: http://www.securityfocus.com/bid/34481 CVE-2009-0159 Modified: head/contrib/ntp/ (props changed) head/contrib/ntp/ntpq/ntpq.c Modified: head/contrib/ntp/ntpq/ntpq.c ============================================================================== --- head/contrib/ntp/ntpq/ntpq.c Mon Apr 20 07:13:04 2009 (r191301) +++ head/contrib/ntp/ntpq/ntpq.c Mon Apr 20 09:59:08 2009 (r191302) @@ -3185,9 +3185,9 @@ cookedprint( if (!decodeuint(value, &uval)) output_raw = '?'; else { - char b[10]; + char b[12]; - (void) sprintf(b, "%03lo", uval); + (void) snprintf(b, sizeof(b), "%03lo", uval); output(fp, name, b); } break; From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 10:30:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CE77106566B; Mon, 20 Apr 2009 10:30:01 +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 04E398FC14; Mon, 20 Apr 2009 10:30:01 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id B05A346B0C; Mon, 20 Apr 2009 06:30:00 -0400 (EDT) Date: Mon, 20 Apr 2009 11:30:00 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Marko Zec In-Reply-To: <200904200844.12344.zec@freebsd.org> Message-ID: References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <200904192221.55744.zec@freebsd.org> <3c1674c90904191405v56298134g286ea31ee4680769@mail.gmail.com> <200904200844.12344.zec@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, Andre Oppermann , Kip Macy Subject: Re: svn commit: r191259 - 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, 20 Apr 2009 10:30:01 -0000 On Mon, 20 Apr 2009, Marko Zec wrote: >>> ... which makes a flow cache a perfect DoS target in any environment, be >>> it a DFZ or enterprise router or an end host or whatever. >> >> Uhm, assuming that you don't put a limit on the number of flows allocated - >> which I do. When you hit the zone limit for flows you simply stop caching >> new flows. > > ... which means you fall back to the ordinary routing lookups, but only > after you have wasted cycles to compute a hash and found out that it doesn't > match anything in your cache -> in this case I would expect only a > degradation in performance, not an improvement. The most recent example I'm aware of in our tree along those lines was from the 4.x time range, I believe. My memory is a bit hazy, but it goes something like this: in an initial analysis, we believed that the pain associated with a synflood was from connection state and hash lookups of that state. Actually, it turned out that much of it was from the creation of cloned routes for every remote IP address from which we received a SYN, as we would clone the route and cache it very early. Features like the syncache and syncookies were very important for mitigating SYN flood overhead, but in part because avoiding allocating routing-related state was actually just as, if not more, important as the "ordinary" connection state. Many of the concerns brought up in the discussion so far are reasons that I asked Kip to do the following with the flowcache: (1) Make this a kernel option (2) Disable it by default I would also agree with the view that if/when our routing table is more up-to-snuff, we might well want to lose the flowcache again, as arguably a revised routing table implementation, (combined with connection-oriented route/llentry caching) should not require or benefit from a flowcache. However, there's quite a bit of work required to get us there. Happily Kip already has a patch for route/llentry caching, but the historic opacity of the routing code is still hurting us in seeing optimization of the base routing table. Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 10:33:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56CCD106566C; Mon, 20 Apr 2009 10:33:06 +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 2C1DC8FC14; Mon, 20 Apr 2009 10:33:06 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id BC2BC46B1A; Mon, 20 Apr 2009 06:33:05 -0400 (EDT) Date: Mon, 20 Apr 2009 11:33:05 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Kip Macy In-Reply-To: <3c1674c90904200001s1d03c7d8udcd2dd4cf99984fd@mail.gmail.com> Message-ID: References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <200904192221.55744.zec@freebsd.org> <3c1674c90904191405v56298134g286ea31ee4680769@mail.gmail.com> <200904200844.12344.zec@freebsd.org> <3c1674c90904200001s1d03c7d8udcd2dd4cf99984fd@mail.gmail.com> 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, Andre Oppermann , svn-src-all@freebsd.org, src-committers@freebsd.org, Marko Zec Subject: Re: svn commit: r191259 - 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, 20 Apr 2009 10:33:06 -0000 On Mon, 20 Apr 2009, Kip Macy wrote: >> ... which means you fall back to the ordinary routing lookups, but only >> after you have wasted cycles to compute a hash and found out that it >> doesn't match anything in your cache -> in this case I would expect only a >> degradation in performance, not an improvement. > > If your normal operating conditions are DDOS then you have more serious > problems. I said that the system would not collapse as you were in fact > claiming, not that it would perform optimally. I think a useful test case to exercise this would be to look at the performance of a real-world benchmark during a simulated synflood from spoofed source IPs in which you gradually scale up the size of the source IP pool for the synflood, as compared to running without the flowcache. The overhead of all the flowcache misses should, presumably, be quite noticeable once it overflows, as it adds additional locking and lookups (both of which have historically been very noticeable) I think the important question is not whether we can measure the overhead (if we can't then we're not testing right), but whether it leads to a performance collapse that didn't previously exist. Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 10:35:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8F481065686; Mon, 20 Apr 2009 10:35:50 +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 D7C378FC1F; Mon, 20 Apr 2009 10:35:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KAZoeg043702; Mon, 20 Apr 2009 10:35:50 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KAZo8S043701; Mon, 20 Apr 2009 10:35:50 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904201035.n3KAZo8S043701@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 10:35: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: r191303 - 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: Mon, 20 Apr 2009 10:35:51 -0000 Author: rwatson Date: Mon Apr 20 10:35:50 2009 New Revision: 191303 URL: http://svn.freebsd.org/changeset/base/191303 Log: Prefer to for the definition of CACHE_LINE_SIZE. Submitted by: bde MFC after: 2 weeks Modified: head/libexec/rtld-elf/rtld_lock.c Modified: head/libexec/rtld-elf/rtld_lock.c ============================================================================== --- head/libexec/rtld-elf/rtld_lock.c Mon Apr 20 09:59:08 2009 (r191302) +++ head/libexec/rtld-elf/rtld_lock.c Mon Apr 20 10:35:50 2009 (r191303) @@ -42,7 +42,7 @@ * using assembly language sequences in "rtld_start.S". */ -#include +#include #include #include From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 10:37:54 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 765D1106567E; Mon, 20 Apr 2009 10:37:54 +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 4EBE78FC08; Mon, 20 Apr 2009 10:37:54 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id E015846B0C; Mon, 20 Apr 2009 06:37:53 -0400 (EDT) Date: Mon, 20 Apr 2009 11:37:53 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Bruce Evans In-Reply-To: <20090420171843.A58020@delplex.bde.org> Message-ID: References: <200904192303.n3JN3v9w023289@svn.freebsd.org> <20090420171843.A58020@delplex.bde.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: r191292 - 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: Mon, 20 Apr 2009 10:37:55 -0000 On Mon, 20 Apr 2009, Bruce Evans wrote: >> Explicitly include machine/param.h for CACHE_LINE_SIZE. >> >> MFC after: 2 weeks >> >> Modified: >> head/libexec/rtld-elf/rtld_lock.c > > It is a style bug (unwarranted chumminess with the implementation) to > include (or otherwise refer to) machine/param.h directly in *.c. This is > only the 5th instance of this style bug in all of /usr/src. The previous > ones are: I think rtld would count as part of "the implementation" from most perspectives, but I agree, and have made the change :-). Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 10:40:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0B7D106568C; Mon, 20 Apr 2009 10:40:42 +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 8EE3E8FC16; Mon, 20 Apr 2009 10:40:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KAegEu043885; Mon, 20 Apr 2009 10:40:42 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KAeg39043883; Mon, 20 Apr 2009 10:40:42 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904201040.n3KAeg39043883@svn.freebsd.org> From: Ed Schouten Date: Mon, 20 Apr 2009 10:40: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: r191304 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 10:40:43 -0000 Author: ed Date: Mon Apr 20 10:40:42 2009 New Revision: 191304 URL: http://svn.freebsd.org/changeset/base/191304 Log: Get rid of the device index number stored in the sa(4) unit number. The device index number stored in the unit number of sa(4) devices is only used to print debug messages. Get rid of this index number and use devtoname() to just print the entire device name. Modified: head/sys/cam/scsi/scsi_sa.c Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Mon Apr 20 10:35:50 2009 (r191303) +++ head/sys/cam/scsi/scsi_sa.c Mon Apr 20 10:40:42 2009 (r191304) @@ -173,13 +173,9 @@ typedef enum { SA_QUIRK_NO_CPAGE = 0x80 /* Don't use DEVICE COMPRESSION page */ } sa_quirks; -/* units are bits 4-7, 16-21 (1024 units) */ -#define SAUNIT(DEV) \ - (((dev2unit(DEV) & 0xF0) >> 4) | ((dev2unit(DEV) & 0x3f0000) >> 16)) - -#define SAMODE(z) ((dev2unit(z) & 0x3)) -#define SADENSITY(z) (((dev2unit(z) >> 2) & 0x3)) -#define SA_IS_CTRL(z) (dev2unit(z) & (1 << 29)) +#define SAMODE(z) (dev2unit(z) & 0x3) +#define SADENSITY(z) ((dev2unit(z) >> 2) & 0x3) +#define SA_IS_CTRL(z) (dev2unit(z) & (1 << 4)) #define SA_NOT_CTLDEV 0 #define SA_CTLDEV 1 @@ -188,9 +184,8 @@ typedef enum { #define SA_ATYPE_NR 1 #define SA_ATYPE_ER 2 -#define SAMINOR(ctl, unit, mode, access) \ - ((ctl << 29) | ((unit & 0x3f0) << 16) | ((unit & 0xf) << 4) | \ - (mode << 0x2) | (access & 0x3)) +#define SAMINOR(ctl, mode, access) \ + ((ctl << 4) | (mode << 2) | (access & 0x3)) #define SA_NUM_MODES 4 struct sa_devs { @@ -445,11 +440,8 @@ saopen(struct cdev *dev, int flags, int { struct cam_periph *periph; struct sa_softc *softc; - int unit; int error; - unit = SAUNIT(dev); - periph = (struct cam_periph *)dev->si_drv1; if (cam_periph_acquire(periph) != CAM_REQ_CMP) { return (ENXIO); @@ -460,7 +452,7 @@ saopen(struct cdev *dev, int flags, int softc = (struct sa_softc *)periph->softc; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE|CAM_DEBUG_INFO, - ("saopen(%d): dev=0x%x softc=0x%x\n", unit, unit, softc->flags)); + ("saopen(%s): softc=0x%x\n", devtoname(dev), softc->flags)); if (SA_IS_CTRL(dev)) { softc->ctrl_mode = 1; @@ -521,10 +513,9 @@ saclose(struct cdev *dev, int flag, int { struct cam_periph *periph; struct sa_softc *softc; - int unit, mode, error, writing, tmp; + int mode, error, writing, tmp; int closedbits = SA_FLAG_OPEN; - unit = SAUNIT(dev); mode = SAMODE(dev); periph = (struct cam_periph *)dev->si_drv1; if (periph == NULL) @@ -535,7 +526,7 @@ saclose(struct cdev *dev, int flag, int softc = (struct sa_softc *)periph->softc; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE|CAM_DEBUG_INFO, - ("saclose(%d): dev=0x%x softc=0x%x\n", unit, unit, softc->flags)); + ("saclose(%s): softc=0x%x\n", devtoname(dev), softc->flags)); softc->open_rdonly = 0; @@ -1496,26 +1487,26 @@ saregister(struct cam_periph *periph, vo DEVSTAT_TYPE_IF_SCSI, DEVSTAT_PRIORITY_TAPE); softc->devs.ctl_dev = make_dev(&sa_cdevsw, SAMINOR(SA_CTLDEV, - periph->unit_number, 0, SA_ATYPE_R), UID_ROOT, GID_OPERATOR, + 0, SA_ATYPE_R), UID_ROOT, GID_OPERATOR, 0660, "%s%d.ctl", periph->periph_name, periph->unit_number); softc->devs.ctl_dev->si_drv1 = periph; for (i = 0; i < SA_NUM_MODES; i++) { softc->devs.mode_devs[i].r_dev = make_dev(&sa_cdevsw, - SAMINOR(SA_NOT_CTLDEV, periph->unit_number, i, SA_ATYPE_R), + SAMINOR(SA_NOT_CTLDEV, i, SA_ATYPE_R), UID_ROOT, GID_OPERATOR, 0660, "%s%d.%d", periph->periph_name, periph->unit_number, i); softc->devs.mode_devs[i].r_dev->si_drv1 = periph; softc->devs.mode_devs[i].nr_dev = make_dev(&sa_cdevsw, - SAMINOR(SA_NOT_CTLDEV, periph->unit_number, i, SA_ATYPE_NR), + SAMINOR(SA_NOT_CTLDEV, i, SA_ATYPE_NR), UID_ROOT, GID_OPERATOR, 0660, "n%s%d.%d", periph->periph_name, periph->unit_number, i); softc->devs.mode_devs[i].nr_dev->si_drv1 = periph; softc->devs.mode_devs[i].er_dev = make_dev(&sa_cdevsw, - SAMINOR(SA_NOT_CTLDEV, periph->unit_number, i, SA_ATYPE_ER), + SAMINOR(SA_NOT_CTLDEV, i, SA_ATYPE_ER), UID_ROOT, GID_OPERATOR, 0660, "e%s%d.%d", periph->periph_name, periph->unit_number, i); softc->devs.mode_devs[i].er_dev->si_drv1 = periph; From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 11:22:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C07D5106571A; Mon, 20 Apr 2009 11:22:51 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AEAAE8FC1F; Mon, 20 Apr 2009 11:22:51 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KBMp8D044792; Mon, 20 Apr 2009 11:22:51 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KBMpTD044791; Mon, 20 Apr 2009 11:22:51 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200904201122.n3KBMpTD044791@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 20 Apr 2009 11:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191305 - head/usr.sbin/ppp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 11:22:53 -0000 Author: bz Date: Mon Apr 20 11:22:51 2009 New Revision: 191305 URL: http://svn.freebsd.org/changeset/base/191305 Log: Back out r186308: in case of AF_LINK, which the kernel still returns for an RTAX_GATEWAY as an empty sockaddr_dl in the classic tun case. Copying the address into the message payload, but not the RTA_GATEWAY flag results in rt_xaddrs() in the kernel tripping over that and parsing the next attribute set with a flag, i.e. RTA_NETMASK, with the gateway address, resulting in bogus route entry. MFC after: 3 days Modified: head/usr.sbin/ppp/route.c Modified: head/usr.sbin/ppp/route.c ============================================================================== --- head/usr.sbin/ppp/route.c Mon Apr 20 10:40:42 2009 (r191304) +++ head/usr.sbin/ppp/route.c Mon Apr 20 11:22:51 2009 (r191305) @@ -910,10 +910,8 @@ rt_Update(struct bundle *bundle, const s p += memcpy_roundup(p, dst, dst->sa_len); } - if (gw != NULL && (gw->sa_family != AF_LINK)) - rtmes.m_rtm.rtm_addrs |= RTA_GATEWAY; + rtmes.m_rtm.rtm_addrs |= RTA_GATEWAY; p += memcpy_roundup(p, gw, gw->sa_len); - if (mask) { rtmes.m_rtm.rtm_addrs |= RTA_NETMASK; p += memcpy_roundup(p, mask, mask->sa_len); From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 11:51:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 749CF1065689; Mon, 20 Apr 2009 11:51:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63E148FC0A; Mon, 20 Apr 2009 11:51:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KBpZ4H045341; Mon, 20 Apr 2009 11:51:35 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KBpZT7045340; Mon, 20 Apr 2009 11:51:35 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200904201151.n3KBpZT7045340@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 20 Apr 2009 11:51: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: r191306 - head/usr.sbin/ppp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 11:51:36 -0000 Author: bz Date: Mon Apr 20 11:51:35 2009 New Revision: 191306 URL: http://svn.freebsd.org/changeset/base/191306 Log: While we currently still seem to have a gateway address, for future stability, check for gw to be set before adding the flag and the address to the routing message. r186308, backed out in r191305, already tried to do that, and in addition ignore AF_LINK types of gateway addresses to work around a problem that r167797 had introduced on the kernel side always setting RTF_GATEWAY if a gateway address was passed into the kernel. The proper solution for this is still under discussion so I am hesitant to re-add the special AF_LINK treatment for now. MFC after: 3 days Modified: head/usr.sbin/ppp/route.c Modified: head/usr.sbin/ppp/route.c ============================================================================== --- head/usr.sbin/ppp/route.c Mon Apr 20 11:22:51 2009 (r191305) +++ head/usr.sbin/ppp/route.c Mon Apr 20 11:51:35 2009 (r191306) @@ -910,8 +910,11 @@ rt_Update(struct bundle *bundle, const s p += memcpy_roundup(p, dst, dst->sa_len); } - rtmes.m_rtm.rtm_addrs |= RTA_GATEWAY; - p += memcpy_roundup(p, gw, gw->sa_len); + if (gw) { + rtmes.m_rtm.rtm_addrs |= RTA_GATEWAY; + p += memcpy_roundup(p, gw, gw->sa_len); + } + if (mask) { rtmes.m_rtm.rtm_addrs |= RTA_NETMASK; p += memcpy_roundup(p, mask, mask->sa_len); From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 12:40:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 203A810656D2; Mon, 20 Apr 2009 12:40:29 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8C6E8FC13; Mon, 20 Apr 2009 12:40:28 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KCeSEW046332; Mon, 20 Apr 2009 12:40:28 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KCeSAC046331; Mon, 20 Apr 2009 12:40:28 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200904201240.n3KCeSAC046331@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 20 Apr 2009 12:40: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: r191307 - head/sys/powerpc/powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 12:40:29 -0000 Author: raj Date: Mon Apr 20 12:40:28 2009 New Revision: 191307 URL: http://svn.freebsd.org/changeset/base/191307 Log: Provide locking for PowerPC interrupt sources config. Reviewed by: attilio Modified: head/sys/powerpc/powerpc/intr_machdep.c Modified: head/sys/powerpc/powerpc/intr_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/intr_machdep.c Mon Apr 20 11:51:35 2009 (r191306) +++ head/sys/powerpc/powerpc/intr_machdep.c Mon Apr 20 12:40:28 2009 (r191307) @@ -96,6 +96,7 @@ struct powerpc_intr { u_int vector; }; +static struct mtx intr_table_lock; static struct powerpc_intr *powerpc_intrs[INTR_VECTORS]; static u_int nvectors; /* Allocated vectors */ static u_int stray_count; @@ -109,8 +110,17 @@ static u_int ipi_irq; device_t pic; static void +intr_init(void *dummy __unused) +{ + + mtx_init(&intr_table_lock, "intr sources lock", NULL, MTX_DEF); +} +SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL); + +static void intrcnt_setname(const char *name, int index) { + snprintf(intrnames + (MAXCOMLEN + 1) * index, MAXCOMLEN + 1, "%-*s", MAXCOMLEN, name); } @@ -122,11 +132,15 @@ intr_lookup(u_int irq) struct powerpc_intr *i, *iscan; int vector; + mtx_lock(&intr_table_lock); for (vector = 0; vector < nvectors; vector++) { i = powerpc_intrs[vector]; - if (i != NULL && i->irq == irq) + if (i != NULL && i->irq == irq) { + mtx_unlock(&intr_table_lock); return (i); + } } + mtx_unlock(&intr_table_lock); i = malloc(sizeof(*i), M_INTR, M_NOWAIT); if (i == NULL) @@ -139,8 +153,7 @@ intr_lookup(u_int irq) i->irq = irq; i->vector = -1; - /* XXX LOCK */ - + mtx_lock(&intr_table_lock); for (vector = 0; vector < INTR_VECTORS && vector <= nvectors; vector++) { iscan = powerpc_intrs[vector]; @@ -157,8 +170,7 @@ intr_lookup(u_int irq) intrcnt_setname(intrname, i->vector); nvectors++; } - - /* XXX UNLOCK */ + mtx_unlock(&intr_table_lock); if (iscan != NULL || i->vector == -1) { free(i, M_INTR); @@ -263,7 +275,10 @@ powerpc_setup_intr(const char *name, u_i error = intr_event_add_handler(i->event, name, filter, handler, arg, intr_priority(flags), flags, cookiep); + + mtx_lock(&intr_table_lock); intrcnt_setname(i->event->ie_fullname, i->vector); + mtx_unlock(&intr_table_lock); if (!cold && enable) PIC_ENABLE(pic, i->irq, i->vector); From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 12:43:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C50251065674; Mon, 20 Apr 2009 12:43:08 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B44CB8FC1F; Mon, 20 Apr 2009 12:43:08 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KCh8FN046409; Mon, 20 Apr 2009 12:43:08 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KCh8Xj046408; Mon, 20 Apr 2009 12:43:08 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200904201243.n3KCh8Xj046408@svn.freebsd.org> From: Stanislav Sedov Date: Mon, 20 Apr 2009 12:43: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: r191308 - head/sys/dev/sound/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, 20 Apr 2009 12:43:09 -0000 Author: stas Date: Mon Apr 20 12:43:07 2009 New Revision: 191308 URL: http://svn.freebsd.org/changeset/base/191308 Log: - Properly unlock mutex on failure in channel_trigger. Before this the function just returned with the mutex held. MFC after: 1 week Modified: head/sys/dev/sound/pci/envy24.c Modified: head/sys/dev/sound/pci/envy24.c ============================================================================== --- head/sys/dev/sound/pci/envy24.c Mon Apr 20 12:40:28 2009 (r191307) +++ head/sys/dev/sound/pci/envy24.c Mon Apr 20 12:43:07 2009 (r191308) @@ -1766,6 +1766,7 @@ envy24chan_trigger(kobj_t obj, void *dat struct sc_info *sc = ch->parent; u_int32_t ptr; int slot; + int error = 0; #if 0 int i; @@ -1787,8 +1788,10 @@ envy24chan_trigger(kobj_t obj, void *dat sc->caps[0].minspeed = sc->caps[0].maxspeed = sc->speed; sc->caps[1].minspeed = sc->caps[1].maxspeed = sc->speed; } - else if (ch->speed != 0 && ch->speed != sc->speed) - return -1; + else if (ch->speed != 0 && ch->speed != sc->speed) { + error = -1; + goto fail; + } if (ch->speed == 0) ch->channel->speed = sc->speed; /* start or enable channel */ @@ -1818,16 +1821,20 @@ envy24chan_trigger(kobj_t obj, void *dat #if(0) device_printf(sc->dev, "envy24chan_trigger(): emldmawr\n"); #endif - if (ch->run != 1) - return -1; + if (ch->run != 1) { + error = -1; + goto fail; + } ch->emldma(ch); break; case PCMTRIG_EMLDMARD: #if(0) device_printf(sc->dev, "envy24chan_trigger(): emldmard\n"); #endif - if (ch->run != 1) - return -1; + if (ch->run != 1) { + error = -1; + goto fail; + } ch->emldma(ch); break; case PCMTRIG_ABORT: @@ -1859,9 +1866,9 @@ envy24chan_trigger(kobj_t obj, void *dat } break; } +fail: snd_mtxunlock(sc->lock); - - return 0; + return (error); } static int From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 12:44:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81AAC1065678; Mon, 20 Apr 2009 12:44: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 532B68FC12; Mon, 20 Apr 2009 12:44:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id E711146B17; Mon, 20 Apr 2009 08:44:33 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id CEF938A01B; Mon, 20 Apr 2009 08:44:32 -0400 (EDT) From: John Baldwin To: Robert Watson Date: Mon, 20 Apr 2009 08:22:16 -0400 User-Agent: KMail/1.9.7 References: <200904192302.n3JN2o6Z023217@svn.freebsd.org> In-Reply-To: <200904192302.n3JN2o6Z023217@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904200822.17158.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 20 Apr 2009 08:44:32 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=4.2 tests=AWL,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191291 - in head: lib/libthr/thread libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/ia64 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rtld-... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 12:44:34 -0000 On Sunday 19 April 2009 7:02:50 pm Robert Watson wrote: > Author: rwatson > Date: Sun Apr 19 23:02:50 2009 > New Revision: 191291 > URL: http://svn.freebsd.org/changeset/base/191291 > > Log: > Now that the kernel defines CACHE_LINE_SIZE in machine/param.h, use > that definition in the custom locking code for the run-time linker > rather than local definitions. > > Pointed out by: tinderbox > MFC after: 2 weeks Perhaps CACHE_LINE_SIZE for ia64 and sparc64 should be 128 since that is what rtld used? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 12:59:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FD1B10656AE; Mon, 20 Apr 2009 12:59:24 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C7DC8FC15; Mon, 20 Apr 2009 12:59:24 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KCxOXd046746; Mon, 20 Apr 2009 12:59:24 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KCxO9F046738; Mon, 20 Apr 2009 12:59:24 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904201259.n3KCxO9F046738@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 12:59:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191309 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2009 12:59:25 -0000 Author: rwatson Date: Mon Apr 20 12:59:23 2009 New Revision: 191309 URL: http://svn.freebsd.org/changeset/base/191309 Log: Don't conditionally define CACHE_LINE_SHIFT, as we anticipate sizing a fair number of static data structures, making this an unlikely option to try to change without also changing source code. [1] Change default cache line size on ia64, sparc64, and sun4v to 128 bytes, as this was what rtld-elf was already using on those platforms. [2] Suggested by: bde [1], jhb [2] MFC after: 2 weeks Modified: head/sys/amd64/include/param.h head/sys/arm/include/param.h head/sys/i386/include/param.h head/sys/ia64/include/param.h head/sys/mips/include/param.h head/sys/powerpc/include/param.h head/sys/sparc64/include/param.h head/sys/sun4v/include/param.h Modified: head/sys/amd64/include/param.h ============================================================================== --- head/sys/amd64/include/param.h Mon Apr 20 12:43:07 2009 (r191308) +++ head/sys/amd64/include/param.h Mon Apr 20 12:59:23 2009 (r191309) @@ -93,9 +93,7 @@ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ -#ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 6 -#endif #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) /* Size of the level 1 page table units */ Modified: head/sys/arm/include/param.h ============================================================================== --- head/sys/arm/include/param.h Mon Apr 20 12:43:07 2009 (r191308) +++ head/sys/arm/include/param.h Mon Apr 20 12:59:23 2009 (r191309) @@ -85,9 +85,7 @@ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ -#ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 6 -#endif #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #define PAGE_SHIFT 12 Modified: head/sys/i386/include/param.h ============================================================================== --- head/sys/i386/include/param.h Mon Apr 20 12:43:07 2009 (r191308) +++ head/sys/i386/include/param.h Mon Apr 20 12:59:23 2009 (r191309) @@ -78,9 +78,7 @@ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ -#ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 6 -#endif #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ Modified: head/sys/ia64/include/param.h ============================================================================== --- head/sys/ia64/include/param.h Mon Apr 20 12:43:07 2009 (r191308) +++ head/sys/ia64/include/param.h Mon Apr 20 12:59:23 2009 (r191309) @@ -103,9 +103,7 @@ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ -#ifndef CACHE_LINE_SHIFT -#define CACHE_LINE_SHIFT 6 -#endif +#define CACHE_LINE_SHIFT 7 #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #ifndef LOG2_PAGE_SIZE Modified: head/sys/mips/include/param.h ============================================================================== --- head/sys/mips/include/param.h Mon Apr 20 12:43:07 2009 (r191308) +++ head/sys/mips/include/param.h Mon Apr 20 12:59:23 2009 (r191309) @@ -93,9 +93,7 @@ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ -#ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 6 -#endif #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #define NBPG 4096 /* bytes/page */ Modified: head/sys/powerpc/include/param.h ============================================================================== --- head/sys/powerpc/include/param.h Mon Apr 20 12:43:07 2009 (r191308) +++ head/sys/powerpc/include/param.h Mon Apr 20 12:59:23 2009 (r191309) @@ -83,9 +83,7 @@ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ -#ifndef CACHE_LINE_SHIFT #define CACHE_LINE_SHIFT 7 -#endif #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #define PAGE_SHIFT 12 Modified: head/sys/sparc64/include/param.h ============================================================================== --- head/sys/sparc64/include/param.h Mon Apr 20 12:43:07 2009 (r191308) +++ head/sys/sparc64/include/param.h Mon Apr 20 12:59:23 2009 (r191309) @@ -75,9 +75,7 @@ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ -#ifndef CACHE_LINE_SHIFT -#define CACHE_LINE_SHIFT 6 -#endif +#define CACHE_LINE_SHIFT 7 #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #define PAGE_SHIFT_8K 13 Modified: head/sys/sun4v/include/param.h ============================================================================== --- head/sys/sun4v/include/param.h Mon Apr 20 12:43:07 2009 (r191308) +++ head/sys/sun4v/include/param.h Mon Apr 20 12:59:23 2009 (r191309) @@ -75,9 +75,7 @@ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ -#ifndef CACHE_LINE_SHIFT -#define CACHE_LINE_SHIFT 6 -#endif +#define CACHE_LINE_SHIFT 7 #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #define PAGE_SHIFT_8K 13 From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 13:00:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39E801065673; Mon, 20 Apr 2009 13:00: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 1303B8FC22; Mon, 20 Apr 2009 13:00:57 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id AA55D46B17; Mon, 20 Apr 2009 09:00:56 -0400 (EDT) Date: Mon, 20 Apr 2009 14:00:56 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: John Baldwin In-Reply-To: <200904200822.17158.jhb@freebsd.org> Message-ID: References: <200904192302.n3JN2o6Z023217@svn.freebsd.org> <200904200822.17158.jhb@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: r191291 - in head: lib/libthr/thread libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/ia64 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rtld-... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 13:00:57 -0000 On Mon, 20 Apr 2009, John Baldwin wrote: >> Now that the kernel defines CACHE_LINE_SIZE in machine/param.h, use >> that definition in the custom locking code for the run-time linker >> rather than local definitions. > > Perhaps CACHE_LINE_SIZE for ia64 and sparc64 should be 128 since that is > what rtld used? I'm happy with whatever size the platform maintainers would like. I've changed ia64, sparc64, and sun4v kernel CACHE_LINE_SIZE definitions to 128, and powerpc was already 128, but left the others at 64 bytes until such time as we have some useful numbers or informat ionto suggest another choice would be better. All I'm really looking for here is a baseline constant to use, I have no particular vested interest in specific values for the constants. Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 13:15:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E18EE1065675; Mon, 20 Apr 2009 13:15:25 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D0ACC8FC0A; Mon, 20 Apr 2009 13:15:25 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KDFPvf047125; Mon, 20 Apr 2009 13:15:25 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KDFPf5047124; Mon, 20 Apr 2009 13:15:25 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200904201315.n3KDFPf5047124@svn.freebsd.org> From: Stanislav Sedov Date: Mon, 20 Apr 2009 13:15: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: r191310 - head/sys/dev/sound/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, 20 Apr 2009 13:15:26 -0000 Author: stas Date: Mon Apr 20 13:15:25 2009 New Revision: 191310 URL: http://svn.freebsd.org/changeset/base/191310 Log: - Unlock softc mutex on failure. MFC after: 1 week Modified: head/sys/dev/sound/pci/envy24ht.c Modified: head/sys/dev/sound/pci/envy24ht.c ============================================================================== --- head/sys/dev/sound/pci/envy24ht.c Mon Apr 20 12:59:23 2009 (r191309) +++ head/sys/dev/sound/pci/envy24ht.c Mon Apr 20 13:15:25 2009 (r191310) @@ -1677,6 +1677,7 @@ envy24htchan_trigger(kobj_t obj, void *d struct sc_info *sc = ch->parent; u_int32_t ptr; int slot; + int error = 0; #if 0 int i; @@ -1698,8 +1699,10 @@ envy24htchan_trigger(kobj_t obj, void *d sc->caps[0].minspeed = sc->caps[0].maxspeed = sc->speed; sc->caps[1].minspeed = sc->caps[1].maxspeed = sc->speed; } - else if (ch->speed != 0 && ch->speed != sc->speed) - return -1; + else if (ch->speed != 0 && ch->speed != sc->speed) { + error = -1; + goto fail; + } if (ch->speed == 0) ch->channel->speed = sc->speed; /* start or enable channel */ @@ -1729,16 +1732,20 @@ envy24htchan_trigger(kobj_t obj, void *d #if(0) device_printf(sc->dev, "envy24htchan_trigger(): emldmawr\n"); #endif - if (ch->run != 1) - return -1; + if (ch->run != 1) { + error = -1; + goto fail; + } ch->emldma(ch); break; case PCMTRIG_EMLDMARD: #if(0) device_printf(sc->dev, "envy24htchan_trigger(): emldmard\n"); #endif - if (ch->run != 1) - return -1; + if (ch->run != 1) { + error = -1; + goto fail; + } ch->emldma(ch); break; case PCMTRIG_ABORT: @@ -1768,9 +1775,9 @@ envy24htchan_trigger(kobj_t obj, void *d } break; } +fail: snd_mtxunlock(sc->lock); - - return 0; + return (error); } static int From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 13:39:44 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2108A1065687; Mon, 20 Apr 2009 13:39:44 +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 E9A7D8FC1F; Mon, 20 Apr 2009 13:39:43 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 9E01E46B23; Mon, 20 Apr 2009 09:39:43 -0400 (EDT) Date: Mon, 20 Apr 2009 14:39:43 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Bruce Evans In-Reply-To: <20090420174802.F58065@delplex.bde.org> Message-ID: References: <200904192019.n3JKJDa6019179@svn.freebsd.org> <20090420174802.F58065@delplex.bde.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: r191276 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2009 13:39:48 -0000 On Mon, 20 Apr 2009, Bruce Evans wrote: >> +#ifndef CACHE_LINE_SHIFT >> +#define CACHE_LINE_SHIFT 6 >> +#endif >> +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) > > This still has the bogus ifdef. Overriding the definition is difficult to > do consistently even in a kernel with no modules, since CACHE_LINE_SIZE is > not a kernel option. Overriding the definition makes negative sense since > the value is a maximum-maximum (possibly larger than strictly needed) so > that it can be constant. OK, I've made this change. My hope is that most applications don't resort to including sys/param.h and using CACHE_LINE_SIZE -- most will be able to query it at run-time using interfaces we don't yet have (such as sysconf(3) and some appropriate constant). I also hope that most kernel consumers will be able to use a run-time tuned version (which we also don't yet have). Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 13:45:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5A1E1065673; Mon, 20 Apr 2009 13:45:39 +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 A42CA8FC16; Mon, 20 Apr 2009 13:45:39 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KDjdhI047747; Mon, 20 Apr 2009 13:45:39 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KDjdqs047746; Mon, 20 Apr 2009 13:45:39 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904201345.n3KDjdqs047746@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 13:45: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: r191311 - 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, 20 Apr 2009 13:45:40 -0000 Author: rwatson Date: Mon Apr 20 13:45:39 2009 New Revision: 191311 URL: http://svn.freebsd.org/changeset/base/191311 Log: In icmp_reflect(), acquire the inteface address list lock when searching for a source address to use. MFC after: 2 weeks Reviewed by: bz Modified: head/sys/netinet/ip_icmp.c Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Mon Apr 20 13:15:25 2009 (r191310) +++ head/sys/netinet/ip_icmp.c Mon Apr 20 13:45:39 2009 (r191311) @@ -650,7 +650,7 @@ icmp_reflect(struct mbuf *m) INIT_VNET_INET(curvnet); struct ip *ip = mtod(m, struct ip *); struct ifaddr *ifa; - struct ifnet *ifn; + struct ifnet *ifp; struct in_ifaddr *ia; struct in_addr t; struct mbuf *opts = 0; @@ -673,24 +673,32 @@ icmp_reflect(struct mbuf *m) * If the incoming packet was addressed directly to one of our * own addresses, use dst as the src for the reply. */ - LIST_FOREACH(ia, INADDR_HASH(t.s_addr), ia_hash) - if (t.s_addr == IA_SIN(ia)->sin_addr.s_addr) + LIST_FOREACH(ia, INADDR_HASH(t.s_addr), ia_hash) { + if (t.s_addr == IA_SIN(ia)->sin_addr.s_addr) { + t = IA_SIN(ia)->sin_addr; goto match; + } + } /* * If the incoming packet was addressed to one of our broadcast * addresses, use the first non-broadcast address which corresponds * to the incoming interface. */ - if (m->m_pkthdr.rcvif != NULL && - m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) { - TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrhead, ifa_link) { + ifp = m->m_pkthdr.rcvif; + if (ifp != NULL && ifp->if_flags & IFF_BROADCAST) { + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; ia = ifatoia(ifa); if (satosin(&ia->ia_broadaddr)->sin_addr.s_addr == - t.s_addr) + t.s_addr) { + t = IA_SIN(ia)->sin_addr; + IF_ADDR_UNLOCK(ifp); goto match; + } } + IF_ADDR_UNLOCK(ifp); } /* * If the packet was transiting through us, use the address of @@ -698,13 +706,17 @@ icmp_reflect(struct mbuf *m) * doesn't have a suitable IP address, the normal selection * criteria apply. */ - if (V_icmp_rfi && m->m_pkthdr.rcvif != NULL) { - TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrhead, ifa_link) { + if (V_icmp_rfi && ifp != NULL) { + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; ia = ifatoia(ifa); + t = IA_SIN(ia)->sin_addr; + IF_ADDR_UNLOCK(ifp); goto match; } + IF_ADDR_UNLOCK(ifp); } /* * If the incoming packet was not addressed directly to us, use @@ -712,13 +724,17 @@ icmp_reflect(struct mbuf *m) * net.inet.icmp.reply_src (default not set). Otherwise continue * with normal source selection. */ - if (V_reply_src[0] != '\0' && (ifn = ifunit(V_reply_src))) { - TAILQ_FOREACH(ifa, &ifn->if_addrhead, ifa_link) { + if (V_reply_src[0] != '\0' && (ifp = ifunit(V_reply_src))) { + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; ia = ifatoia(ifa); + t = IA_SIN(ia)->sin_addr; + IF_ADDR_UNLOCK(ifp); goto match; } + IF_ADDR_UNLOCK(ifp); } /* * If the packet was transiting through us, use the address of @@ -732,11 +748,11 @@ icmp_reflect(struct mbuf *m) ICMPSTAT_INC(icps_noroute); goto done; } + t = IA_SIN(ia)->sin_addr; match: #ifdef MAC mac_netinet_icmp_replyinplace(m); #endif - t = IA_SIN(ia)->sin_addr; ip->ip_src = t; ip->ip_ttl = V_ip_defttl; From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 13:53:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3E3D106568E; Mon, 20 Apr 2009 13:53:40 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92CBC8FC14; Mon, 20 Apr 2009 13:53:40 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KDreiR047927; Mon, 20 Apr 2009 13:53:40 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KDrekq047926; Mon, 20 Apr 2009 13:53:40 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200904201353.n3KDrekq047926@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 20 Apr 2009 13:53: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: r191312 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2009 13:53:41 -0000 Author: trasz Date: Mon Apr 20 13:53:40 2009 New Revision: 191312 URL: http://svn.freebsd.org/changeset/base/191312 Log: Adjust route(4) manual page to remove rtm_use field, which was removed from the route.h some time ago. Reviewed by: rwatson Modified: head/share/man/man4/route.4 Modified: head/share/man/man4/route.4 ============================================================================== --- head/share/man/man4/route.4 Mon Apr 20 13:45:39 2009 (r191311) +++ head/share/man/man4/route.4 Mon Apr 20 13:53:40 2009 (r191312) @@ -217,7 +217,6 @@ struct rt_msghdr { pid_t rtm_pid; /* identify sender */ int rtm_seq; /* for sender to identify action */ int rtm_errno; /* why failed */ - int rtm_use; /* from rtentry */ u_long rtm_inits; /* which metrics we are initializing */ struct rt_metrics rtm_rmx; /* metrics themselves */ }; From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 14:34:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5B60106564A; Mon, 20 Apr 2009 14:34:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A82C8FC13; Mon, 20 Apr 2009 14:34:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KEYtom048798; Mon, 20 Apr 2009 14:34:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KEYtSP048797; Mon, 20 Apr 2009 14:34:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200904201434.n3KEYtSP048797@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 20 Apr 2009 14:34: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: r191313 - 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, 20 Apr 2009 14:34:56 -0000 Author: kib Date: Mon Apr 20 14:34:55 2009 New Revision: 191313 URL: http://svn.freebsd.org/changeset/base/191313 Log: On the exit of the child process which parent either set SA_NOCLDWAIT or ignored SIGCHLD, unconditionally wake up the parent instead of doing this only when the child is a last child. This brings us in line with other U**xes that support SA_NOCLDWAIT. If the parent called waitpid(childpid), then exit of the child should wake up the parent immediately instead of forcing it to wait for all children to exit. Reported by: Alan Ferrency Submitted by: Jilles Tjoelker PR: 108390 MFC after: 2 weeks Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Apr 20 13:53:40 2009 (r191312) +++ head/sys/kern/kern_exit.c Mon Apr 20 14:34:55 2009 (r191313) @@ -504,13 +504,13 @@ exit1(struct thread *td, int rv) proc_reparent(p, initproc); p->p_sigparent = SIGCHLD; PROC_LOCK(p->p_pptr); + /* - * If this was the last child of our parent, notify - * parent, so in case he was wait(2)ing, he will + * Notify parent, so in case he was wait(2)ing or + * executiing waitpid(2) with our pid, he will * continue. */ - if (LIST_EMPTY(&pp->p_children)) - wakeup(pp); + wakeup(pp); } else mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx); From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 14:35:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE5361065677; Mon, 20 Apr 2009 14:35:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A35F88FC08; Mon, 20 Apr 2009 14:35:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KEZgYP048860; Mon, 20 Apr 2009 14:35:42 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KEZg1A048859; Mon, 20 Apr 2009 14:35:42 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904201435.n3KEZg1A048859@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 14:35: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: r191314 - 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, 20 Apr 2009 14:35:43 -0000 Author: rwatson Date: Mon Apr 20 14:35:42 2009 New Revision: 191314 URL: http://svn.freebsd.org/changeset/base/191314 Log: In ip_input(), cache the received mbuf's network interface in a local variable. Acquire the interface address list lock when iterating over the interface address list searching for a matching received broadcast address. MFC after: 2 weeks Modified: head/sys/netinet/ip_input.c Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Mon Apr 20 14:34:55 2009 (r191313) +++ head/sys/netinet/ip_input.c Mon Apr 20 14:35:42 2009 (r191314) @@ -371,6 +371,7 @@ ip_input(struct mbuf *m) struct ip *ip = NULL; struct in_ifaddr *ia = NULL; struct ifaddr *ifa; + struct ifnet *ifp; int checkif, hlen = 0; u_short sum; int dchg = 0; /* dest changed after fw */ @@ -421,9 +422,10 @@ ip_input(struct mbuf *m) } /* 127/8 must not appear on wire - RFC1122 */ + ifp = m->m_pkthdr.rcvif; if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET || (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) { - if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) { + if ((ifp->if_flags & IFF_LOOPBACK) == 0) { IPSTAT_INC(ips_badaddr); goto bad; } @@ -498,14 +500,14 @@ tooshort: goto passin; odst = ip->ip_dst; - if (pfil_run_hooks(&inet_pfil_hook, &m, m->m_pkthdr.rcvif, - PFIL_IN, NULL) != 0) + if (pfil_run_hooks(&inet_pfil_hook, &m, ifp, PFIL_IN, NULL) != 0) return; if (m == NULL) /* consumed by filter */ return; ip = mtod(m, struct ip *); dchg = (odst.s_addr != ip->ip_dst.s_addr); + ifp = m->m_pkthdr.rcvif; #ifdef IPFIREWALL_FORWARD if (m->m_flags & M_FASTFWD_OURS) { @@ -571,10 +573,9 @@ passin: * checked with carp_iamatch() and carp_forus(). */ checkif = V_ip_checkinterface && (V_ipforwarding == 0) && - m->m_pkthdr.rcvif != NULL && - ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) && + ifp != NULL && ((ifp->if_flags & IFF_LOOPBACK) == 0) && #ifdef DEV_CARP - !m->m_pkthdr.rcvif->if_carp && + !ifp->if_carp && #endif (dchg == 0); @@ -588,7 +589,7 @@ passin: * enabled. */ if (IA_SIN(ia)->sin_addr.s_addr == ip->ip_dst.s_addr && - (!checkif || ia->ia_ifp == m->m_pkthdr.rcvif)) + (!checkif || ia->ia_ifp == ifp)) goto ours; } /* @@ -599,22 +600,29 @@ passin: * be handled via ip_forward() and ether_output() with the loopback * into the stack for SIMPLEX interfaces handled by ether_output(). */ - if (m->m_pkthdr.rcvif != NULL && - m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) { - TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrhead, ifa_link) { + if (ifp != NULL && ifp->if_flags & IFF_BROADCAST) { + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; ia = ifatoia(ifa); if (satosin(&ia->ia_broadaddr)->sin_addr.s_addr == - ip->ip_dst.s_addr) + ip->ip_dst.s_addr) { + IF_ADDR_UNLOCK(ifp); goto ours; - if (ia->ia_netbroadcast.s_addr == ip->ip_dst.s_addr) + } + if (ia->ia_netbroadcast.s_addr == ip->ip_dst.s_addr) { + IF_ADDR_UNLOCK(ifp); goto ours; + } #ifdef BOOTP_COMPAT - if (IA_SIN(ia)->sin_addr.s_addr == INADDR_ANY) + if (IA_SIN(ia)->sin_addr.s_addr == INADDR_ANY) { + IF_ADDR_UNLOCK(ifp); goto ours; + } #endif } + IF_ADDR_UNLOCK(ifp); } /* RFC 3927 2.7: Do not forward datagrams for 169.254.0.0/16. */ if (IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr))) { @@ -632,8 +640,7 @@ passin: * ip_mforward() returns a non-zero value, the packet * must be discarded, else it may be accepted below. */ - if (ip_mforward && - ip_mforward(ip, m->m_pkthdr.rcvif, m, 0) != 0) { + if (ip_mforward && ip_mforward(ip, ifp, m, 0) != 0) { IPSTAT_INC(ips_cantforward); m_freem(m); return; @@ -663,7 +670,7 @@ passin: /* * FAITH(Firewall Aided Internet Translator) */ - if (m->m_pkthdr.rcvif && m->m_pkthdr.rcvif->if_type == IFT_FAITH) { + if (ifp && ifp->if_type == IFT_FAITH) { if (V_ip_keepfaith) { if (ip->ip_p == IPPROTO_TCP || ip->ip_p == IPPROTO_ICMP) goto ours; From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 14:36:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B0C61065672; Mon, 20 Apr 2009 14:36:01 +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 596218FC0C; Mon, 20 Apr 2009 14:36:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KEa11L048906; Mon, 20 Apr 2009 14:36:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KEa1UU048903; Mon, 20 Apr 2009 14:36:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200904201436.n3KEa1UU048903@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 20 Apr 2009 14:36: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: r191315 - 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: Mon, 20 Apr 2009 14:36:01 -0000 Author: kib Date: Mon Apr 20 14:36:01 2009 New Revision: 191315 URL: http://svn.freebsd.org/changeset/base/191315 Log: In ufs_checkpath(), recheck that '..' still points to the inode with the same inode number after VFS_VGET() and relock of the vp. If '..' changed, redo the lookup. To reduce code duplication, move the code to read '..' dirent into the static helper function ufs_dir_dd_ino(). Supply the source inode number as an argument to ufs_checkpath() instead of the source inode itself. The inode is unlocked, thus it might be reclaimed, causing accesses to the freed memory. Use vn_vget_ino() to get the '..' vnode by its inode number, instead of directly code VFS_VGET() and relock, to properly busy the mount point while vp lock is dropped. Noted and reviewed by: tegge Tested by: pho MFC after: 1 month Modified: head/sys/ufs/ufs/ufs_extern.h head/sys/ufs/ufs/ufs_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_extern.h ============================================================================== --- head/sys/ufs/ufs/ufs_extern.h Mon Apr 20 14:35:42 2009 (r191314) +++ head/sys/ufs/ufs/ufs_extern.h Mon Apr 20 14:36:01 2009 (r191315) @@ -58,7 +58,7 @@ int ufs_bmap(struct vop_bmap_args *); int ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *, struct buf *, int *, int *); int ufs_fhtovp(struct mount *, struct ufid *, struct vnode **); -int ufs_checkpath(struct inode *, struct inode *, struct ucred *); +int ufs_checkpath(ino_t, struct inode *, struct ucred *); void ufs_dirbad(struct inode *, doff_t, char *); int ufs_dirbadentry(struct vnode *, struct direct *, int); int ufs_dirempty(struct inode *, ino_t, struct ucred *); Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Mon Apr 20 14:35:42 2009 (r191314) +++ head/sys/ufs/ufs/ufs_lookup.c Mon Apr 20 14:36:01 2009 (r191315) @@ -1237,69 +1237,81 @@ ufs_dirempty(ip, parentino, cred) return (1); } +static int +ufs_dir_dd_ino(struct vnode *vp, struct ucred *cred, ino_t *dd_ino) +{ + struct dirtemplate dirbuf; + int error, namlen; + + if (vp->v_type != VDIR) + return (ENOTDIR); + error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, + sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE, + IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, (int *)0, NULL); + if (error != 0) + return (error); +#if (BYTE_ORDER == LITTLE_ENDIAN) + if (OFSFMT(vp)) + namlen = dirbuf.dotdot_type; + else + namlen = dirbuf.dotdot_namlen; +#else + namlen = dirbuf.dotdot_namlen; +#endif + if (namlen != 2 || dirbuf.dotdot_name[0] != '.' || + dirbuf.dotdot_name[1] != '.') + return (ENOTDIR); + *dd_ino = dirbuf.dotdot_ino; + return (0); +} + /* * Check if source directory is in the path of the target directory. * Target is supplied locked, source is unlocked. * The target is always vput before returning. */ int -ufs_checkpath(source, target, cred) - struct inode *source, *target; - struct ucred *cred; +ufs_checkpath(ino_t source_ino, struct inode *target, struct ucred *cred) { - struct vnode *vp; - int error, namlen; - ino_t rootino; - struct dirtemplate dirbuf; + struct vnode *vp, *vp1; + int error; + ino_t dd_ino; vp = ITOV(target); - if (target->i_number == source->i_number) { + if (target->i_number == source_ino) { error = EEXIST; goto out; } - rootino = ROOTINO; error = 0; - if (target->i_number == rootino) + if (target->i_number == ROOTINO) goto out; for (;;) { - if (vp->v_type != VDIR) { - error = ENOTDIR; - break; - } - error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, - sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE, - IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, (int *)0, - (struct thread *)0); + error = ufs_dir_dd_ino(vp, cred, &dd_ino); if (error != 0) break; -# if (BYTE_ORDER == LITTLE_ENDIAN) - if (OFSFMT(vp)) - namlen = dirbuf.dotdot_type; - else - namlen = dirbuf.dotdot_namlen; -# else - namlen = dirbuf.dotdot_namlen; -# endif - if (namlen != 2 || - dirbuf.dotdot_name[0] != '.' || - dirbuf.dotdot_name[1] != '.') { - error = ENOTDIR; - break; - } - if (dirbuf.dotdot_ino == source->i_number) { + if (dd_ino == source_ino) { error = EINVAL; break; } - if (dirbuf.dotdot_ino == rootino) + if (dd_ino == ROOTINO) break; - vput(vp); - error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, - LK_EXCLUSIVE, &vp); - if (error) { - vp = NULL; + error = vn_vget_ino(vp, dd_ino, LK_EXCLUSIVE, &vp1); + if (error != 0) + break; + /* Recheck that ".." still points to vp1 after relock of vp */ + error = ufs_dir_dd_ino(vp, cred, &dd_ino); + if (error != 0) { + vput(vp1); break; } + /* Redo the check of ".." if directory was reparented */ + if (dd_ino != VTOI(vp1)->i_number) { + vput(vp1); + continue; + } + vput(vp); + vp = vp1; } out: Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Mon Apr 20 14:35:42 2009 (r191314) +++ head/sys/ufs/ufs/ufs_vnops.c Mon Apr 20 14:36:01 2009 (r191315) @@ -1036,6 +1036,7 @@ ufs_rename(ap) struct direct newdir; int doingdirectory = 0, oldparent = 0, newparent = 0; int error = 0, ioflag; + ino_t fvp_ino; #ifdef INVARIANTS if ((tcnp->cn_flags & HASBUF) == 0 || @@ -1146,6 +1147,7 @@ abortit: * call to checkpath(). */ error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread); + fvp_ino = ip->i_number; VOP_UNLOCK(fvp, 0); if (oldparent != dp->i_number) newparent = dp->i_number; @@ -1154,7 +1156,7 @@ abortit: goto bad; if (xp != NULL) vput(tvp); - error = ufs_checkpath(ip, dp, tcnp->cn_cred); + error = ufs_checkpath(fvp_ino, dp, tcnp->cn_cred); if (error) goto out; if ((tcnp->cn_flags & SAVESTART) == 0) From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 14:38:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6AB61065670; Mon, 20 Apr 2009 14:38:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C53628FC0A; Mon, 20 Apr 2009 14:38:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KEcms9048992; Mon, 20 Apr 2009 14:38:48 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KEcmL2048988; Mon, 20 Apr 2009 14:38:48 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200904201438.n3KEcmL2048988@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 20 Apr 2009 14:38: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: r191316 - head/usr.sbin/ppp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 14:38:49 -0000 Author: bz Date: Mon Apr 20 14:38:48 2009 New Revision: 191316 URL: http://svn.freebsd.org/changeset/base/191316 Log: Conditionally add the interface name and address if available so that a ppp running in `receiver' (server) mode can properly update routes, for example to update the MTU. Submitted by: loos.br gmail.com (Luiz Otavio O Souza) PR: bin/130159 PR: kern/125079, kern/122068, bin/126892 MFC after: 3 days Modified: head/usr.sbin/ppp/ipcp.c head/usr.sbin/ppp/ipv6cp.c head/usr.sbin/ppp/route.c head/usr.sbin/ppp/route.h Modified: head/usr.sbin/ppp/ipcp.c ============================================================================== --- head/usr.sbin/ppp/ipcp.c Mon Apr 20 14:36:01 2009 (r191315) +++ head/usr.sbin/ppp/ipcp.c Mon Apr 20 14:38:48 2009 (r191316) @@ -692,7 +692,7 @@ ipcp_SetIPaddress(struct ipcp *ipcp, str if (bundle->ncp.cfg.sendpipe > 0 || bundle->ncp.cfg.recvpipe > 0) { ncprange_getsa(&myrange, &ssgw, &ssmask); ncpaddr_getsa(&hisncpaddr, &ssdst); - rt_Update(bundle, sadst, sagw, samask); + rt_Update(bundle, sadst, sagw, samask, NULL, NULL); } if (Enabled(bundle, OPT_SROUTES)) Modified: head/usr.sbin/ppp/ipv6cp.c ============================================================================== --- head/usr.sbin/ppp/ipv6cp.c Mon Apr 20 14:36:01 2009 (r191315) +++ head/usr.sbin/ppp/ipv6cp.c Mon Apr 20 14:38:48 2009 (r191316) @@ -245,7 +245,7 @@ ipcp_SetIPv6address(struct ipv6cp *ipv6c ncpaddr_getsa(&ipv6cp->hisaddr, &ssdst); else sadst = NULL; - rt_Update(bundle, sadst, sagw, samask); + rt_Update(bundle, sadst, sagw, samask, NULL, NULL); } if (Enabled(bundle, OPT_SROUTES)) Modified: head/usr.sbin/ppp/route.c ============================================================================== --- head/usr.sbin/ppp/route.c Mon Apr 20 14:36:01 2009 (r191315) +++ head/usr.sbin/ppp/route.c Mon Apr 20 14:38:48 2009 (r191316) @@ -532,7 +532,8 @@ route_UpdateMTU(struct bundle *bundle) " mtu %lu\n", rtm->rtm_index, Index2Nam(rtm->rtm_index), ncprange_ntoa(&dst), bundle->iface->mtu); } - rt_Update(bundle, sa[RTAX_DST], sa[RTAX_GATEWAY], sa[RTAX_NETMASK]); + rt_Update(bundle, sa[RTAX_DST], sa[RTAX_GATEWAY], sa[RTAX_NETMASK], + sa[RTAX_IFP], sa[RTAX_IFA]); } } @@ -870,7 +871,8 @@ failed: void rt_Update(struct bundle *bundle, const struct sockaddr *dst, - const struct sockaddr *gw, const struct sockaddr *mask) + const struct sockaddr *gw, const struct sockaddr *mask, + const struct sockaddr *ifp, const struct sockaddr *ifa) { struct ncprange ncpdst; struct rtmsg rtmes; @@ -920,6 +922,13 @@ rt_Update(struct bundle *bundle, const s p += memcpy_roundup(p, mask, mask->sa_len); } + if (ifa && ifp && ifp->sa_family == AF_LINK) { + rtmes.m_rtm.rtm_addrs |= RTA_IFP; + p += memcpy_roundup(p, ifp, ifp->sa_len); + rtmes.m_rtm.rtm_addrs |= RTA_IFA; + p += memcpy_roundup(p, ifa, ifa->sa_len); + } + rtmes.m_rtm.rtm_msglen = p - (char *)&rtmes; wb = ID0write(s, &rtmes, rtmes.m_rtm.rtm_msglen); Modified: head/usr.sbin/ppp/route.h ============================================================================== --- head/usr.sbin/ppp/route.h Mon Apr 20 14:36:01 2009 (r191315) +++ head/usr.sbin/ppp/route.h Mon Apr 20 14:38:48 2009 (r191316) @@ -70,4 +70,5 @@ extern void route_ParseHdr(struct rt_msg extern int rt_Set(struct bundle *, int, const struct ncprange *, const struct ncpaddr *, int, int); extern void rt_Update(struct bundle *, const struct sockaddr *, + const struct sockaddr *, const struct sockaddr *, const struct sockaddr *, const struct sockaddr *); From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 14:41:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 315431065673; Mon, 20 Apr 2009 14:41:24 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 205BF8FC1B; Mon, 20 Apr 2009 14:41:24 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KEfOGn049098; Mon, 20 Apr 2009 14:41:24 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KEfON6049097; Mon, 20 Apr 2009 14:41:24 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904201441.n3KEfON6049097@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 14:41:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191317 - 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, 20 Apr 2009 14:41:24 -0000 Author: rwatson Date: Mon Apr 20 14:41:23 2009 New Revision: 191317 URL: http://svn.freebsd.org/changeset/base/191317 Log: Lock interface address lists before iterating over them in nd6. MFC after: 2 weeks Modified: head/sys/netinet6/icmp6.c Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Mon Apr 20 14:38:48 2009 (r191316) +++ head/sys/netinet6/icmp6.c Mon Apr 20 14:41:23 2009 (r191317) @@ -1688,6 +1688,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st IFNET_RLOCK(); for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { addrsofif = 0; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -1738,6 +1739,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st } addrsofif++; /* count the address */ } + IF_ADDR_UNLOCK(ifp); if (iffound) { *ifpp = ifp; IFNET_RUNLOCK(); @@ -1773,6 +1775,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n again: for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) { + IF_ADDR_LOCK(ifp); for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) { if (ifa->ifa_addr->sa_family != AF_INET6) @@ -1828,6 +1831,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n /* now we can copy the address */ if (resid < sizeof(struct in6_addr) + sizeof(u_int32_t)) { + IF_ADDR_UNLOCK(ifp); /* * We give up much more copy. * Set the truncate flag and return. @@ -1874,6 +1878,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n resid -= (sizeof(struct in6_addr) + sizeof(u_int32_t)); copied += (sizeof(struct in6_addr) + sizeof(u_int32_t)); } + IF_ADDR_UNLOCK(ifp); if (ifp0) /* we need search only on the specified IF */ break; } From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 15:01:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 438E7106566C; Mon, 20 Apr 2009 15:01:46 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F6EC8FC19; Mon, 20 Apr 2009 15:01:46 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KF1kMK049538; Mon, 20 Apr 2009 15:01:46 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KF1kTH049536; Mon, 20 Apr 2009 15:01:46 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200904201501.n3KF1kTH049536@svn.freebsd.org> From: Antoine Brodin Date: Mon, 20 Apr 2009 15:01: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: r191318 - in head: share/man/man4 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: Mon, 20 Apr 2009 15:01:47 -0000 Author: antoine Date: Mon Apr 20 15:01:45 2009 New Revision: 191318 URL: http://svn.freebsd.org/changeset/base/191318 Log: vlan(4) no longer depends on miibus(4). Reviewed by: jhb@ MFC after: 1 month Modified: head/share/man/man4/vlan.4 head/sys/conf/NOTES Modified: head/share/man/man4/vlan.4 ============================================================================== --- head/share/man/man4/vlan.4 Mon Apr 20 14:41:23 2009 (r191317) +++ head/share/man/man4/vlan.4 Mon Apr 20 15:01:45 2009 (r191318) @@ -36,7 +36,6 @@ To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent -.Cd "device miibus" .Cd "device vlan" .Ed .Pp @@ -193,18 +192,7 @@ The MTU setting on .Nm can be corrected manually if used in conjunction with such a parent interface. .Sh SEE ALSO -.Xr kqueue 2 , -.Xr miibus 4 , .Xr ifconfig 8 , .Xr sysctl 8 .Sh BUGS No 802.1Q features except VLAN tagging are implemented. -.Pp -.Dv EVFILT_NETDEV -events on a -.Nm -interface will be sent through -.Xr kqueue 2 -only if the parent interface uses -.Xr miibus 4 -for link state notification. Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Apr 20 14:41:23 2009 (r191317) +++ head/sys/conf/NOTES Mon Apr 20 15:01:45 2009 (r191318) @@ -727,7 +727,7 @@ device loop device ether # The `vlan' device implements the VLAN tagging of Ethernet frames -# according to IEEE 802.1Q. It requires `device miibus'. +# according to IEEE 802.1Q. device vlan # The `wlan' device provides generic code to support 802.11 From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 15:10:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E85FE1065676; Mon, 20 Apr 2009 15:10:03 +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 D7A778FC1A; Mon, 20 Apr 2009 15:10:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KFA3so049726; Mon, 20 Apr 2009 15:10:03 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KFA3pq049725; Mon, 20 Apr 2009 15:10:03 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200904201510.n3KFA3pq049725@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 20 Apr 2009 15:10: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: r191319 - 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, 20 Apr 2009 15:10:04 -0000 Author: kib Date: Mon Apr 20 15:10:03 2009 New Revision: 191319 URL: http://svn.freebsd.org/changeset/base/191319 Log: Fix typo. Noted by: jhb MFC after: 2 weeks Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Apr 20 15:01:45 2009 (r191318) +++ head/sys/kern/kern_exit.c Mon Apr 20 15:10:03 2009 (r191319) @@ -507,7 +507,7 @@ exit1(struct thread *td, int rv) /* * Notify parent, so in case he was wait(2)ing or - * executiing waitpid(2) with our pid, he will + * executing waitpid(2) with our pid, he will * continue. */ wakeup(pp); From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 15:15:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A2E8106564A; Mon, 20 Apr 2009 15:15:25 +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 0E0E08FC08; Mon, 20 Apr 2009 15:15:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KFFOvo049880; Mon, 20 Apr 2009 15:15:24 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KFFOdn049879; Mon, 20 Apr 2009 15:15:24 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904201515.n3KFFOdn049879@svn.freebsd.org> From: Ed Schouten Date: Mon, 20 Apr 2009 15:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191320 - head/sys/dev/mse X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 15:15:25 -0000 Author: ed Date: Mon Apr 20 15:15:24 2009 New Revision: 191320 URL: http://svn.freebsd.org/changeset/base/191320 Log: Make mse(4) use si_drv1, instead of using unit numbers. Discussed with: imp Modified: head/sys/dev/mse/mse.c Modified: head/sys/dev/mse/mse.c ============================================================================== --- head/sys/dev/mse/mse.c Mon Apr 20 15:10:03 2009 (r191319) +++ head/sys/dev/mse/mse.c Mon Apr 20 15:15:24 2009 (r191320) @@ -111,8 +111,7 @@ static struct cdevsw mse_cdevsw = { static void mseintr(void *); static timeout_t msetimeout; -#define MSE_UNIT(dev) (dev2unit(dev) >> 1) -#define MSE_NBLOCKIO(dev) (dev2unit(dev) & 0x1) +#define MSE_NBLOCKIO(dev) dev2unit(dev) #define MSEPRI (PZERO + 3) @@ -143,10 +142,10 @@ mse_common_attach(device_t dev) sc->mode.accelfactor = (flags & MSE_CONFIG_ACCEL) >> 4; callout_handle_init(&sc->sc_callout); - sc->sc_dev = make_dev(&mse_cdevsw, unit << 1, 0, 0, 0600, - "mse%d", unit); - sc->sc_ndev = make_dev(&mse_cdevsw, (unit<<1)+1, 0, 0, 0600, - "nmse%d", unit); + sc->sc_dev = make_dev(&mse_cdevsw, 0, 0, 0, 0600, "mse%d", unit); + sc->sc_dev->si_drv1 = sc; + sc->sc_ndev = make_dev(&mse_cdevsw, 1, 0, 0, 0600, "nmse%d", unit); + sc->sc_ndev->si_drv1 = sc; return 0; } @@ -156,12 +155,9 @@ mse_common_attach(device_t dev) static int mseopen(struct cdev *dev, int flags, int fmt, struct thread *td) { - mse_softc_t *sc; + mse_softc_t *sc = dev->si_drv1; int s; - sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); - if (sc == NULL) - return (ENXIO); if (sc->sc_mousetype == MSE_NONE) return (ENXIO); if (sc->sc_flags & MSESC_OPEN) @@ -192,7 +188,7 @@ mseopen(struct cdev *dev, int flags, int static int mseclose(struct cdev *dev, int flags, int fmt, struct thread *td) { - mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); + mse_softc_t *sc = dev->si_drv1; int s; untimeout(msetimeout, dev, sc->sc_callout); @@ -212,7 +208,7 @@ mseclose(struct cdev *dev, int flags, in static int mseread(struct cdev *dev, struct uio *uio, int ioflag) { - mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); + mse_softc_t *sc = dev->si_drv1; int xfer, s, error; /* @@ -276,7 +272,7 @@ mseread(struct cdev *dev, struct uio *ui static int mseioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { - mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); + mse_softc_t *sc = dev->si_drv1; mousestatus_t status; int err = 0; int s; @@ -388,7 +384,7 @@ mseioctl(struct cdev *dev, u_long cmd, c static int msepoll(struct cdev *dev, int events, struct thread *td) { - mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); + mse_softc_t *sc = dev->si_drv1; int s; int revents = 0; @@ -420,10 +416,10 @@ msetimeout(void *arg) mse_softc_t *sc; dev = (struct cdev *)arg; - sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); + sc = dev->si_drv1; if (sc->sc_watchdog) { if (bootverbose) - printf("mse%d: lost interrupt?\n", MSE_UNIT(dev)); + printf("%s: lost interrupt?\n", devtoname(dev)); mseintr(sc); } sc->sc_watchdog = TRUE; From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 15:19:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EB3D106564A; Mon, 20 Apr 2009 15:19:55 +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 0E3B08FC14; Mon, 20 Apr 2009 15:19:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KFJs8l049993; Mon, 20 Apr 2009 15:19:54 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KFJsk5049992; Mon, 20 Apr 2009 15:19:54 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904201519.n3KFJsk5049992@svn.freebsd.org> From: Warner Losh Date: Mon, 20 Apr 2009 15:19: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: r191321 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 15:19:55 -0000 Author: imp Date: Mon Apr 20 15:19:54 2009 New Revision: 191321 URL: http://svn.freebsd.org/changeset/base/191321 Log: Sometimes we can call ed_detach() before the mtx has been initialized. Avoid it if it hasn't been initialized. Modified: head/sys/dev/ed/if_ed.c Modified: head/sys/dev/ed/if_ed.c ============================================================================== --- head/sys/dev/ed/if_ed.c Mon Apr 20 15:15:24 2009 (r191320) +++ head/sys/dev/ed/if_ed.c Mon Apr 20 15:19:54 2009 (r191321) @@ -373,7 +373,8 @@ ed_detach(device_t dev) struct ed_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->ifp; - ED_ASSERT_UNLOCKED(sc); + if (mtx_initialized(ED_MUTEX(sc))) + ED_ASSERT_UNLOCKED(sc); if (ifp) { ED_LOCK(sc); if (bus_child_present(dev)) @@ -388,7 +389,8 @@ ed_detach(device_t dev) ed_release_resources(dev); if (sc->miibus) device_delete_child(dev, sc->miibus); - ED_LOCK_DESTROY(sc); + if (mtx_initialized(ED_MUTEX(sc))) + ED_LOCK_DESTROY(sc); bus_generic_detach(dev); return (0); } From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 15:32:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4099E1065690; Mon, 20 Apr 2009 15:32:09 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id BA05F8FC17; Mon, 20 Apr 2009 15:32:08 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.3/8.14.3/ALCHEMY.FRANKEN.DE) with ESMTP id n3KFW6SB023751; Mon, 20 Apr 2009 17:32:07 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.3/8.14.3/Submit) id n3KFW6uS023750; Mon, 20 Apr 2009 17:32:06 +0200 (CEST) (envelope-from marius) Date: Mon, 20 Apr 2009 17:32:06 +0200 From: Marius Strobl To: Robert Watson Message-ID: <20090420153205.GB59939@alchemy.franken.de> References: <200904192302.n3JN2o6Z023217@svn.freebsd.org> <200904200822.17158.jhb@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, John Baldwin Subject: Re: svn commit: r191291 - in head: lib/libthr/thread libexec/rtld-elf/amd64 libexec/rtld-elf/arm libexec/rtld-elf/i386 libexec/rtld-elf/ia64 libexec/rtld-elf/mips libexec/rtld-elf/powerpc libexec/rtld-... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 15:32:09 -0000 On Mon, Apr 20, 2009 at 02:00:56PM +0100, Robert Watson wrote: > > On Mon, 20 Apr 2009, John Baldwin wrote: > > >> Now that the kernel defines CACHE_LINE_SIZE in machine/param.h, use > >> that definition in the custom locking code for the run-time linker > >> rather than local definitions. > > > >Perhaps CACHE_LINE_SIZE for ia64 and sparc64 should be 128 since that is > >what rtld used? > > I'm happy with whatever size the platform maintainers would like. I've > changed ia64, sparc64, and sun4v kernel CACHE_LINE_SIZE definitions to 128, > and powerpc was already 128, but left the others at 64 bytes until such > time as we have some useful numbers or informat ionto suggest another > choice would be better. All I'm really looking for here is a baseline > constant to use, I have no particular vested interest in specific values > for the constants. > For sparc64 the cache line size should be ideally determined at runtime using Open Firmware, however I'm not aware of a sun4u CPU having a L1 data- or instruction cache line size greater than 32 bytes though. Some of them have a prefetch cache with a line size of 64 bytes though which besides for the prefetch instructions is used autonomously by the CPU when fetching from the L2 cache (which can have a line size of up to 512 bytes AFAICT). I'm not aware how relevant this is for the intended use of CACHE_LINE_SIZE, but a value of of 64 seems appropriate for sparc64 in order also cover the prefetch cache. Marius From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 15:46:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77BB51065672; Mon, 20 Apr 2009 15:46:46 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.29]) by mx1.freebsd.org (Postfix) with ESMTP id BE8E88FC17; Mon, 20 Apr 2009 15:46:45 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by yx-out-2324.google.com with SMTP id 8so135372yxb.13 for ; Mon, 20 Apr 2009 08:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=u2/eJLTg4H38gk5FZvG2qqE7QRM7GPBTEkjKX/P3l0I=; b=xtATWTng9Mde0nc8Pbftx5nXDQ4rDKTjJMh3V0lCM5mmI5IogOOLABjpaa3tA8RbRC Z3cjCDo6vsT+lmVTcdKx4XcZ+42Ha+7V43qwHsM30dzbUmXMoZY9iGch5YL31PgeBepi oAR9n3Y1Wb3tVfxqKqc5F4PjdQdWnhzimPD/A= 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=BE9+7jm+D+gHO88BE4OELjs8BfXyIiVlRyXQWQIyHLUeeZQkxKKE3EdWPN5GNPZCTd Qnt/INv5pjTzGIEH99NnlfZZwWdnG7MuAe/GiJ67irpiOZI+K6ugr/j0nqi56MA/W9/4 9QtSc+oj58CnUdFT5dMBzq6o8m60ieKJNfbDQ= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.10.15 with SMTP id 15mr7739899anj.107.1240242402463; Mon, 20 Apr 2009 08:46:42 -0700 (PDT) In-Reply-To: <200904201004.19695.zec@freebsd.org> References: <200904190444.n3J4i5wF098362@svn.freebsd.org> <200904200929.57914.zec@freebsd.org> <3c1674c90904200047s551a93a3wec97607b8212b0d@mail.gmail.com> <200904201004.19695.zec@freebsd.org> Date: Mon, 20 Apr 2009 08:46:42 -0700 X-Google-Sender-Auth: 3c6e3ad08341061f Message-ID: <3c1674c90904200846x717b8bd9n518f8144a2e4fdcc@mail.gmail.com> From: Kip Macy To: Marko Zec Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann Subject: Re: svn commit: r191259 - 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, 20 Apr 2009 15:46:46 -0000 > Hmm, such a scheme raises suspicion that in your particular case very few flow > cache lookups could be serviced from CPU caches. 16MB + 80MB sounds to be in > range with memory footprint of a DFZ table stored in our normal radix tree - > so where's the benefit of the flow cache? > Well its a contrived example, you're not going to have any locality in either case. In a more common CDN scenario you don't have more than 20k clients, but FreeBSD could still not be used as an edge router because it could not handle forwarding 20Gbps. -Kip From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 15:47:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43400106566B; Mon, 20 Apr 2009 15:47:07 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26D988FC15; Mon, 20 Apr 2009 15:47:07 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KFl7up050838; Mon, 20 Apr 2009 15:47:07 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KFl6Z6050834; Mon, 20 Apr 2009 15:47:06 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200904201547.n3KFl6Z6050834@svn.freebsd.org> From: Stanislav Sedov Date: Mon, 20 Apr 2009 15:47: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: r191322 - in head/sys: arm/conf 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: Mon, 20 Apr 2009 15:47:07 -0000 Author: stas Date: Mon Apr 20 15:47:06 2009 New Revision: 191322 URL: http://svn.freebsd.org/changeset/base/191322 Log: - Give a warning and start the oscillator if it was not previously runned. - Rename ds1672 -> rtc to follow the other drivers. - Refactor/simplify the code a bit. MFC after: 2 weeks Modified: head/sys/arm/conf/AVILA.hints head/sys/arm/conf/BWCT.hints head/sys/arm/conf/CAMBRIA.hints head/sys/dev/iicbus/ds1672.c Modified: head/sys/arm/conf/AVILA.hints ============================================================================== --- head/sys/arm/conf/AVILA.hints Mon Apr 20 15:19:54 2009 (r191321) +++ head/sys/arm/conf/AVILA.hints Mon Apr 20 15:47:06 2009 (r191322) @@ -44,5 +44,5 @@ hint.ad7418.0.at="iicbus0" hint.ad7418.0.addr=0x50 # Dallas Semiconductor DS1672 RTC -hint.ds1672.0.at="iicbus0" -hint.ds1672.0.addr=0xd0 +hint.rtc.0.at="iicbus0" +hint.rtc.0.addr=0xd0 Modified: head/sys/arm/conf/BWCT.hints ============================================================================== --- head/sys/arm/conf/BWCT.hints Mon Apr 20 15:19:54 2009 (r191321) +++ head/sys/arm/conf/BWCT.hints Mon Apr 20 15:47:06 2009 (r191322) @@ -1,8 +1,8 @@ # $FreeBSD$ # Dallas Semiconductor DS1672 RTC sitting on the I2C bus -hint.ds1672.0.at="iicbus0" -hint.ds1672.0.addr=0xd0 +hint.rtc.0.at="iicbus0" +hint.rtc.0.addr=0xd0 # NAtional Semiconductor LM75 temperature sensor sitting on the I2C bus hint.lm75.0.at="iicbus0" Modified: head/sys/arm/conf/CAMBRIA.hints ============================================================================== --- head/sys/arm/conf/CAMBRIA.hints Mon Apr 20 15:19:54 2009 (r191321) +++ head/sys/arm/conf/CAMBRIA.hints Mon Apr 20 15:47:06 2009 (r191322) @@ -46,8 +46,8 @@ hint.ad7418.0.at="iicbus0" hint.ad7418.0.addr=0x50 # Dallas Semiconductor DS1672 RTC -hint.ds1672.0.at="iicbus0" -hint.ds1672.0.addr=0xd0 +hint.rtc.0.at="iicbus0" +hint.rtc.0.addr=0xd0 # USB is part of the chip hint.ehci.0.at="ixp0" Modified: head/sys/dev/iicbus/ds1672.c ============================================================================== --- head/sys/dev/iicbus/ds1672.c Mon Apr 20 15:19:54 2009 (r191321) +++ head/sys/dev/iicbus/ds1672.c Mon Apr 20 15:47:06 2009 (r191322) @@ -50,8 +50,12 @@ __FBSDID("$FreeBSD$"); #define DS1672_CTRL 4 /* control (1 byte) */ #define DS1672_TRICKLE 5 /* trickle charger (1 byte) */ +#define DS1672_CTRL_EOSC (1 << 7) /* Stop/start flag. */ + #define NANOSEC 1000000000 +#define MAX_IIC_DATA_SIZE 4 + struct ds1672_softc { device_t sc_dev; }; @@ -65,12 +69,64 @@ ds1672_probe(device_t dev) } static int +ds1672_read(device_t dev, uint8_t addr, uint8_t *data, uint8_t size) +{ + struct iic_msg msgs[2] = { + { DS1672_ADDR, IIC_M_WR, 1, &addr }, + { DS1672_ADDR, IIC_M_RD, size, data } + }; + + return (iicbus_transfer(dev, msgs, 2)); +} + +static int +ds1672_write(device_t dev, uint8_t addr, uint8_t *data, uint8_t size) +{ + uint8_t buffer[MAX_IIC_DATA_SIZE + 1]; + struct iic_msg msgs[1] = { + { DS1672_ADDR, IIC_M_WR, size + 1, buffer }, + }; + + if (size > MAX_IIC_DATA_SIZE) + return (ENOMEM); + /* NB: register pointer precedes actual data */ + buffer[0] = addr; + memcpy(buffer + 1, data, size); + return (iicbus_transfer(dev, msgs, 1)); +} + +static int +ds1672_init(device_t dev) +{ + uint8_t ctrl; + int error; + + error = ds1672_read(dev, DS1672_CTRL, &ctrl, 1); + if (error) + return (error); + + /* + * Check if oscialltor is not runned. + */ + if (ctrl & DS1672_CTRL_EOSC) { + device_printf(dev, "RTC oscillator was stopped. Check system" + " time and RTC battery.\n"); + ctrl &= ~DS1672_CTRL_EOSC; /* Start oscillator. */ + error = ds1672_write(dev, DS1672_CTRL, &ctrl, 1); + } + return (error); +} + +static int ds1672_attach(device_t dev) { struct ds1672_softc *sc = device_get_softc(dev); + int error; sc->sc_dev = dev; - + error = ds1672_init(dev); + if (error) + return (error); clock_register(dev, 1000); return (0); } @@ -78,39 +134,30 @@ ds1672_attach(device_t dev) static int ds1672_gettime(device_t dev, struct timespec *ts) { - uint8_t addr[1] = { DS1672_COUNTER }; uint8_t secs[4]; - struct iic_msg msgs[2] = { - { DS1672_ADDR, IIC_M_WR, 1, addr }, - { DS1672_ADDR, IIC_M_RD, 4, secs }, - }; int error; - error = iicbus_transfer(dev, msgs, 2); + error = ds1672_read(dev, DS1672_COUNTER, secs, 4); if (error == 0) { /* counter has seconds since epoch */ ts->tv_sec = (secs[3] << 24) | (secs[2] << 16) | (secs[1] << 8) | (secs[0] << 0); ts->tv_nsec = NANOSEC / 2; } - return error; + return (error); } static int ds1672_settime(device_t dev, struct timespec *ts) { - /* NB: register pointer precedes actual data */ - uint8_t data[5] = { DS1672_COUNTER }; - struct iic_msg msgs[1] = { - { DS1672_ADDR, IIC_M_WR, 5, data }, - }; + uint8_t data[4]; - data[1] = (ts->tv_sec >> 0) & 0xff; - data[2] = (ts->tv_sec >> 8) & 0xff; - data[3] = (ts->tv_sec >> 16) & 0xff; - data[4] = (ts->tv_sec >> 24) & 0xff; + data[0] = (ts->tv_sec >> 0) & 0xff; + data[1] = (ts->tv_sec >> 8) & 0xff; + data[2] = (ts->tv_sec >> 16) & 0xff; + data[3] = (ts->tv_sec >> 24) & 0xff; - return iicbus_transfer(dev, msgs, 1); + return (ds1672_write(dev, DS1672_COUNTER, data, 4)); } static device_method_t ds1672_methods[] = { @@ -124,7 +171,7 @@ static device_method_t ds1672_methods[] }; static driver_t ds1672_driver = { - "ds1672", + "rtc", ds1672_methods, sizeof(struct ds1672_softc), }; From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 16:05:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91769106566C; Mon, 20 Apr 2009 16:05:16 +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 7FDCE8FC16; Mon, 20 Apr 2009 16:05:16 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KG5GK1051236; Mon, 20 Apr 2009 16:05:16 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KG5GD7051235; Mon, 20 Apr 2009 16:05:16 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904201605.n3KG5GD7051235@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 16:05: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: r191323 - 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, 20 Apr 2009 16:05:17 -0000 Author: rwatson Date: Mon Apr 20 16:05:16 2009 New Revision: 191323 URL: http://svn.freebsd.org/changeset/base/191323 Log: Close some but not all writer-writer races when maintaining IPv6 interface address lists by locking the interface address list lock. MFC after: 2 weeks Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Mon Apr 20 15:47:06 2009 (r191322) +++ head/sys/netinet6/in6.c Mon Apr 20 16:05:16 2009 (r191323) @@ -815,7 +815,9 @@ in6_update_ifa(struct ifnet *ifp, struct V_in6_ifaddr = ia; ia->ia_ifa.ifa_refcnt = 1; + IF_ADDR_LOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrlist, &ia->ia_ifa, ifa_list); + IF_ADDR_UNLOCK(ifp); } /* update timestamp */ @@ -1175,7 +1177,9 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st struct in6_ifaddr *oia; int s = splnet(); + IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrlist, &ia->ia_ifa, ifa_list); + IF_ADDR_UNLOCK(ifp); oia = ia; if (oia == (ia = V_in6_ifaddr)) @@ -1410,6 +1414,7 @@ in6_lifaddr_ioctl(struct socket *so, u_l } } + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -1430,6 +1435,7 @@ in6_lifaddr_ioctl(struct socket *so, u_l if (IN6_ARE_ADDR_EQUAL(&candidate, &match)) break; } + IF_ADDR_UNLOCK(ifp); if (!ifa) return EADDRNOTAVAIL; ia = ifa2ia6(ifa); @@ -1507,11 +1513,13 @@ in6_ifinit(struct ifnet *ifp, struct in6 * if this is its first address, * and to validate the address if necessary. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifacount++; } + IF_ADDR_UNLOCK(ifp); ia->ia_addr = *sin6; @@ -1621,6 +1629,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp { struct ifaddr *ifa; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -1631,6 +1640,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp break; } } + IF_ADDR_UNLOCK(ifp); return ((struct in6_ifaddr *)ifa); } @@ -1848,6 +1858,7 @@ in6_ifawithifp(struct ifnet *ifp, struct * If two or more, return one which matches the dst longest. * If none, return one of global addresses assigned other ifs. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -1879,8 +1890,10 @@ in6_ifawithifp(struct ifnet *ifp, struct besta = (struct in6_ifaddr *)ifa; } } - if (besta) + if (besta) { + IF_ADDR_UNLOCK(ifp); return (besta); + } TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) @@ -1897,8 +1910,10 @@ in6_ifawithifp(struct ifnet *ifp, struct continue; } + IF_ADDR_UNLOCK(ifp); return (struct in6_ifaddr *)ifa; } + IF_ADDR_UNLOCK(ifp); /* use the last-resort values, that are, deprecated addresses */ if (dep[0]) @@ -1918,6 +1933,7 @@ in6_if_up(struct ifnet *ifp) struct ifaddr *ifa; struct in6_ifaddr *ia; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -1933,6 +1949,7 @@ in6_if_up(struct ifnet *ifp) arc4random() % (MAX_RTR_SOLICITATION_DELAY * hz)); } } + IF_ADDR_UNLOCK(ifp); /* * special cases, like 6to4, are handled in in6_ifattach From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 16:16:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC31B106566C; Mon, 20 Apr 2009 16:16:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAF7B8FC08; Mon, 20 Apr 2009 16:16:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KGGhFo051483; Mon, 20 Apr 2009 16:16:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KGGh8h051482; Mon, 20 Apr 2009 16:16:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904201616.n3KGGh8h051482@svn.freebsd.org> From: Kip Macy Date: Mon, 20 Apr 2009 16:16: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: r191324 - 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: Mon, 20 Apr 2009 16:16:44 -0000 Author: kmacy Date: Mon Apr 20 16:16:43 2009 New Revision: 191324 URL: http://svn.freebsd.org/changeset/base/191324 Log: simplify code by removing bit_fns and replacing with the use of a temporary mask Modified: head/sys/net/flowtable.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Mon Apr 20 16:05:16 2009 (r191323) +++ head/sys/net/flowtable.c Mon Apr 20 16:16:43 2009 (r191324) @@ -300,9 +300,11 @@ struct flowtable { fl_rtalloc_t *ft_rtalloc; struct mtx *ft_locks; - struct flowtable *ft_next; + union flentryp ft_table; bitstr_t *ft_masks[MAXCPU]; + bitstr_t *ft_tmpmask; + struct flowtable *ft_next; }; static struct proc *flowcleanerproc; @@ -317,6 +319,7 @@ static uma_zone_t ipv6_zone; * to avoid extra cache evictions caused by incrementing a shared * counter * - add IPv6 support to flow lookup + * - add sysctls to resize && flush flow tables * - Add per flowtable sysctls for statistics and configuring timeouts * - add saturation counter to rtentry to support per-packet load-balancing * add flag to indicate round-robin flow, add list lookup from head @@ -872,6 +875,7 @@ flowtable_alloc(int nentry, int flags) ft->ft_masks[0] = bit_alloc(nentry); } + ft->ft_tmpmask = bit_alloc(nentry); /* * In the local transmit case the table truly is @@ -888,6 +892,7 @@ flowtable_alloc(int nentry, int flags) ft->ft_syn_idle = ft->ft_tcp_idle = 30; } + /* * hook in to the cleaner list */ @@ -936,65 +941,24 @@ fle_free(struct flentry *fle) uma_zfree((fle->f_flags & FL_IPV6) ? ipv6_zone : ipv4_zone, fle); } -/* - * Find the next bit set where lastbit is the last bit index - * that was set, mask is a pointer to a uint8_t that stores - * the current temporary mask because the caller can't clear - * bits in name and the lookup granularity is 1 byte - * - * This could be improved (4x reduction in overhead) for the sparse - * case by replacing bit_ffs with a more efficient function that works - * at the 4-byte granularity and change *mask to a uint32_t - * - */ -static __inline int -bit_fns(bitstr_t *name, int nbits, int lastbit, uint8_t *mask) -{ - bitstr_t *bitstr_start = &name[lastbit/8]; - int value = 0; - int bitsleft = nbits - lastbit; - - if (bitsleft <= 0) - return (-1); - /* - * Note that not only is bit_ffs inefficient, - * but it doesn't call the first bit set 1 - */ - if ((lastbit & 0x7) == 0) { - bit_ffs(bitstr_start, bitsleft, &value); - *mask = *bitstr_start; - if (value > 0) - bit_clear(mask, value); - } else { - bit_ffs(mask, 8, &value); - if (value == -1 && bitsleft > 8) { - lastbit = (lastbit & ~0x7) + 8; - bit_ffs((bitstr_start + 1), - ((bitsleft - 1) & ~0x7), &value); - if (value > 0) { - *mask = (bitstr_start + 1)[value/8]; - bit_clear(mask, (value % 8)); - } - } else { - bit_clear(mask, value); - } - } - - return (value > 0) ? (value + lastbit) : (-1); -} - static void flowtable_free_stale(struct flowtable *ft) { int curbit = 0, count; struct flentry *fle, **flehead, *fleprev; struct flentry *flefreehead, *flefreetail, *fletmp; - bitstr_t *mask; - uint8_t mask_tmp; + bitstr_t *mask, *tmpmask; flefreehead = flefreetail = NULL; mask = flowtable_mask(ft); - while ((curbit = bit_fns(mask, ft->ft_size, curbit, &mask_tmp)) != -1) { + tmpmask = ft->ft_tmpmask; + memcpy(tmpmask, mask, ft->ft_size/8); + /* + * XXX Note to self, bit_ffs operates at the byte level + * and thus adds gratuitous overhead + */ + bit_ffs(tmpmask, ft->ft_size, &curbit); + while (curbit != -1) { if (curbit >= ft->ft_size || curbit < -1) { log(LOG_ALERT, "warning: bad curbit value %d \n", @@ -1050,7 +1014,8 @@ flowtable_free_stale(struct flowtable *f if (*flehead == NULL) bit_clear(mask, curbit); FL_ENTRY_UNLOCK(ft, curbit); - curbit++; + bit_clear(tmpmask, curbit); + bit_ffs(tmpmask, ft->ft_size, &curbit); } count = 0; while ((fle = flefreehead) != NULL) { @@ -1074,10 +1039,7 @@ flowtable_cleaner(void) while (1) { ft = flow_list_head; while (ft != NULL) { - if ((ft->ft_flags & FL_PCPU) == 0) { - flowtable_free_stale(ft); - } else { - + if (ft->ft_flags & FL_PCPU) { for (i = 0; i <= mp_maxid; i++) { if (CPU_ABSENT(i)) continue; @@ -1092,6 +1054,8 @@ flowtable_cleaner(void) sched_unbind(curthread); thread_unlock(curthread); } + } else { + flowtable_free_stale(ft); } ft = ft->ft_next; } From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 18:19:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BC18106566C; Mon, 20 Apr 2009 18:19:39 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3C518FC13; Mon, 20 Apr 2009 18:19:38 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KIJcgP054308; Mon, 20 Apr 2009 18:19:38 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KIJcZo054306; Mon, 20 Apr 2009 18:19:38 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200904201819.n3KIJcZo054306@svn.freebsd.org> From: Roman Divacky Date: Mon, 20 Apr 2009 18:19: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: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 18:19:39 -0000 Author: rdivacky Date: Mon Apr 20 18:19:38 2009 New Revision: 191330 URL: http://svn.freebsd.org/changeset/base/191330 Log: Implement highlighting of today in month view of cal/ncal just like gnu cal does. This is currently disabled for year view because of hard coded padding in that case. This will hopefully be fixed soon. Reviewed by: Simon 'corecode' Schubert Approved by: ed Modified: head/usr.bin/ncal/Makefile head/usr.bin/ncal/ncal.c Modified: head/usr.bin/ncal/Makefile ============================================================================== --- head/usr.bin/ncal/Makefile Mon Apr 20 17:39:44 2009 (r191329) +++ head/usr.bin/ncal/Makefile Mon Apr 20 18:19:38 2009 (r191330) @@ -3,7 +3,7 @@ PROG= ncal DPADD= ${LIBCALENDAR} -LDADD= -lcalendar +LDADD= -lcalendar -ltermcap WARNS?= 1 LINKS= ${BINDIR}/ncal ${BINDIR}/cal Modified: head/usr.bin/ncal/ncal.c ============================================================================== --- head/usr.bin/ncal/ncal.c Mon Apr 20 17:39:44 2009 (r191329) +++ head/usr.bin/ncal/ncal.c Mon Apr 20 18:19:38 2009 (r191330) @@ -42,6 +42,8 @@ static const char rcsid[] = #include #include #include +#include +#undef lines /* term.h defines this */ /* Width of one month with backward compatibility */ #define MONTH_WIDTH_B_J 27 @@ -50,7 +52,7 @@ static const char rcsid[] = #define MONTH_WIDTH_J 24 #define MONTH_WIDTH 18 -#define MAX_WIDTH 28 +#define MAX_WIDTH 64 typedef struct date date; @@ -159,6 +161,8 @@ char jdaystr[] = " 1 2 3 4 int flag_weeks; /* user wants number of week */ int nswitch; /* user defined switch date */ int nswitchb; /* switch date for backward compatibility */ +const char *term_r, *term_e; +int today; char *center(char *s, char *t, int w); wchar_t *wcenter(wchar_t *s, wchar_t *t, int w); @@ -199,6 +203,26 @@ main(int argc, char *argv[]) char *cp; /* character pointer */ char *flag_month = NULL; /* requested month as string */ const char *locale; /* locale to get country code */ + char tbuf[1024], cbuf[512], *b; + time_t t; + struct tm *tm1; + + term_e = term_r = NULL; + today = 0; + if (isatty(1) && tgetent(tbuf, getenv("TERM")) == 1) { + date dt; /* handy date */ + + b = cbuf; + term_r = tgetstr("mr", &b); + term_e = tgetstr("me", &b); + t = time(NULL); + tm1 = localtime(&t); + dt.y = tm1->tm_year + 1900; + dt.m = tm1->tm_mon + 1; + dt.d = tm1->tm_mday; + + today = sndaysb(&dt); + } /* * Use locale to determine the country code, @@ -334,12 +358,14 @@ main(int argc, char *argv[]) if (flag_easter) printeaster(y, flag_julian_cal, flag_orthodox); - else if (argc == 1 || flag_hole_year) + else if (argc == 1 || flag_hole_year) { + /* disable the highlight for now */ + today = 0; if (flag_backward) printyearb(y, flag_julian_day); else printyear(y, flag_julian_day); - else + } else if (flag_backward) printmonthb(y, m, flag_julian_day); else @@ -592,7 +618,7 @@ mkmonth(int y, int m, int jd_flag, struc int dw; /* width of numbers */ int first; /* first day of month */ int firstm; /* first day of first week of month */ - int i, j, k; /* just indices */ + int i, j, k, l; /* just indices */ int last; /* the first day of next month */ int jan1 = 0; /* the first day of this year */ char *ds; /* pointer to day strings (daystr or @@ -640,17 +666,38 @@ mkmonth(int y, int m, int jd_flag, struc * column is one day number. print column index: k. */ for (i = 0; i != 7; i++) { - for (j = firstm + i, k = 0; j < last; j += 7, k += dw) + l = 0; + for (j = firstm + i, k = 0; j < last; j += 7, k += dw) { + if (j == today && (term_r != NULL && term_e != NULL)) { + l = strlen(term_r); + if (jd_flag) + dt.d = j - jan1 + 1; + else + sdateb(j, &dt); + /* separator */ + mlines->lines[i][k] = ' '; + /* the actual text */ + memcpy(mlines->lines[i] + k + l, + ds + dt.d * dw, dw); + /* highlight on */ + memcpy(mlines->lines[i] + k + 1, term_r, l); + /* highlight off */ + memcpy(mlines->lines[i] + k + l + dw, term_e, + strlen(term_e)); + l = strlen(term_e) + strlen(term_r); + continue; + } if (j >= first) { if (jd_flag) dt.d = j - jan1 + 1; else sdate(j, &dt); - memcpy(mlines->lines[i] + k, + memcpy(mlines->lines[i] + k + l, ds + dt.d * dw, dw); } else - memcpy(mlines->lines[i] + k, " ", dw); - mlines->lines[i][k] = '\0'; + memcpy(mlines->lines[i] + k + l, " ", dw); + } + mlines->lines[i][k + l] = '\0'; } @@ -676,7 +723,7 @@ mkmonthb(int y, int m, int jd_flag, stru int dw; /* width of numbers */ int first; /* first day of month */ int firsts; /* sunday of first week of month */ - int i, j, k; /* just indices */ + int i, j, k, l; /* just indices */ int jan1 = 0; /* the first day of this year */ int last; /* the first day of next month */ char *ds; /* pointer to day strings (daystr or @@ -737,21 +784,42 @@ mkmonthb(int y, int m, int jd_flag, stru * column is one day number. print column index: k. */ for (i = 0; i != 6; i++) { + l = 0; for (j = firsts + 7 * i, k = 0; j < last && k != dw * 7; - j++, k += dw) + j++, k += dw) { + if (j == today && (term_r != NULL && term_e != NULL)) { + l = strlen(term_r); + if (jd_flag) + dt.d = j - jan1 + 1; + else + sdateb(j, &dt); + /* separator */ + mlines->lines[i][k] = ' '; + /* the actual text */ + memcpy(mlines->lines[i] + k + l, + ds + dt.d * dw, dw); + /* highlight on */ + memcpy(mlines->lines[i] + k + 1, term_r, l); + /* highlight off */ + memcpy(mlines->lines[i] + k + l + dw, term_e, + strlen(term_e)); + l = strlen(term_e) + strlen(term_r); + continue; + } if (j >= first) { if (jd_flag) dt.d = j - jan1 + 1; else sdateb(j, &dt); - memcpy(mlines->lines[i] + k, + memcpy(mlines->lines[i] + k + l, ds + dt.d * dw, dw); } else - memcpy(mlines->lines[i] + k, " ", dw); + memcpy(mlines->lines[i] + k + l, " ", dw); + } if (k == 0) mlines->lines[i][1] = '\0'; else - mlines->lines[i][k] = '\0'; + mlines->lines[i][k + l] = '\0'; } } From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 18:23:42 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCB1C106566B; Mon, 20 Apr 2009 18:23:42 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id AC32C8FC08; Mon, 20 Apr 2009 18:23:42 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id C3A46581DC; Mon, 20 Apr 2009 13:03:41 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id ZGQtcNkT1PuV; Mon, 20 Apr 2009 13:03:41 -0500 (CDT) Received: from wanderer.tachypleus.net (i3-dhcp-172-16-55-200.icecube.wisc.edu [172.16.55.200]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 9E73D581C0; Mon, 20 Apr 2009 13:03:41 -0500 (CDT) Message-ID: <49ECB8FD.1050901@freebsd.org> Date: Mon, 20 Apr 2009 13:03:41 -0500 From: Nathan Whitehorn User-Agent: Thunderbird 2.0.0.21 (X11/20090410) MIME-Version: 1.0 To: Robert Watson References: <200904192019.n3JKJDa6019179@svn.freebsd.org> <20090420174802.F58065@delplex.bde.org> In-Reply-To: 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, Bruce Evans Subject: Re: svn commit: r191276 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2009 18:23:43 -0000 Robert Watson wrote: > > On Mon, 20 Apr 2009, Bruce Evans wrote: > >>> +#ifndef CACHE_LINE_SHIFT >>> +#define CACHE_LINE_SHIFT 6 >>> +#endif >>> +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) >> >> This still has the bogus ifdef. Overriding the definition is >> difficult to do consistently even in a kernel with no modules, since >> CACHE_LINE_SIZE is not a kernel option. Overriding the definition >> makes negative sense since the value is a maximum-maximum (possibly >> larger than strictly needed) so that it can be constant. > > OK, I've made this change. My hope is that most applications don't > resort to including sys/param.h and using CACHE_LINE_SIZE -- most will > be able to query it at run-time using interfaces we don't yet have > (such as sysconf(3) and some appropriate constant). I also hope that > most kernel consumers will be able to use a run-time tuned version > (which we also don't yet have). On PowerPC, we currently define a kernel global cacheline_size (md_var.h) and a sysctl machdep.cacheline_size with this information. This is currently used in various places in the kernel and in the userland RTLD for properly synchronizing the instruction cache. -Nathan From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 20:09:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A7FB106566B; Mon, 20 Apr 2009 20:09:56 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EE818FC12; Mon, 20 Apr 2009 20:09:56 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KK9ut1056989; Mon, 20 Apr 2009 20:09:56 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KK9uQH056988; Mon, 20 Apr 2009 20:09:56 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904202009.n3KK9uQH056988@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 20:09: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: r191335 - 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: Mon, 20 Apr 2009 20:09:57 -0000 Author: rwatson Date: Mon Apr 20 20:09:55 2009 New Revision: 191335 URL: http://svn.freebsd.org/changeset/base/191335 Log: Prefer if_addrhead (FreeBSD) to if_addrlist (BSD compat) naming for the interface address list in if_stf.c. Acquire interface address list locks around address list access. MFC after: 2 months Modified: head/sys/net/if_stf.c Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Mon Apr 20 19:53:26 2009 (r191334) +++ head/sys/net/if_stf.c Mon Apr 20 20:09:55 2009 (r191335) @@ -382,7 +382,8 @@ stf_getsrcifa6(ifp) struct sockaddr_in6 *sin6; struct in_addr in; - TAILQ_FOREACH(ia, &ifp->if_addrlist, ifa_list) { + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_list) { if (ia->ifa_addr->sa_family != AF_INET6) continue; sin6 = (struct sockaddr_in6 *)ia->ifa_addr; @@ -396,8 +397,10 @@ stf_getsrcifa6(ifp) if (ia4 == NULL) continue; + IF_ADDR_UNLOCK(ifp); return (struct in6_ifaddr *)ia; } + IF_ADDR_UNLOCK(ifp); return NULL; } From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 21:05:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88B0E106566B; Mon, 20 Apr 2009 21:05:37 +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 773C18FC1D; Mon, 20 Apr 2009 21:05:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KL5bs2058152; Mon, 20 Apr 2009 21:05:37 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KL5b7D058146; Mon, 20 Apr 2009 21:05:37 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904202105.n3KL5b7D058146@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 21:05: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: r191336 - 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, 20 Apr 2009 21:05:38 -0000 Author: rwatson Date: Mon Apr 20 21:05:37 2009 New Revision: 191336 URL: http://svn.freebsd.org/changeset/base/191336 Log: Use TAILQ_FOREACH() and TAILQ_FOREACH_SAFE() rather than manually accessing queue(9) structure fields for if_addrhead. Prefer FreeBSD field name if_addrhead to compatibility macro if_addrlist. MFC after: 2 weeks Modified: head/sys/netinet6/icmp6.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_var.h head/sys/netinet6/nd6.c head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Mon Apr 20 20:09:55 2009 (r191335) +++ head/sys/netinet6/icmp6.c Mon Apr 20 21:05:37 2009 (r191336) @@ -1689,7 +1689,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { addrsofif = 0; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifa6 = (struct in6_ifaddr *)ifa; @@ -1776,8 +1776,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) { IF_ADDR_LOCK(ifp); - for (ifa = ifp->if_addrlist.tqh_first; ifa; - ifa = ifa->ifa_list.tqe_next) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifa6 = (struct in6_ifaddr *)ifa; Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Mon Apr 20 20:09:55 2009 (r191335) +++ head/sys/netinet6/in6.c Mon Apr 20 21:05:37 2009 (r191336) @@ -816,7 +816,7 @@ in6_update_ifa(struct ifnet *ifp, struct ia->ia_ifa.ifa_refcnt = 1; IF_ADDR_LOCK(ifp); - TAILQ_INSERT_TAIL(&ifp->if_addrlist, &ia->ia_ifa, ifa_list); + TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_list); IF_ADDR_UNLOCK(ifp); } @@ -1178,7 +1178,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st int s = splnet(); IF_ADDR_LOCK(ifp); - TAILQ_REMOVE(&ifp->if_addrlist, &ia->ia_ifa, ifa_list); + TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_list); IF_ADDR_UNLOCK(ifp); oia = ia; @@ -1231,8 +1231,7 @@ in6_purgeif(struct ifnet *ifp) { struct ifaddr *ifa, *nifa; - for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa != NULL; ifa = nifa) { - nifa = TAILQ_NEXT(ifa, ifa_list); + TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_list, nifa) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; in6_purgeaddr(ifa); @@ -1415,7 +1414,7 @@ in6_lifaddr_ioctl(struct socket *so, u_l } IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (!cmp) @@ -1514,7 +1513,7 @@ in6_ifinit(struct ifnet *ifp, struct in6 * and to validate the address if necessary. */ IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifacount++; @@ -1630,7 +1629,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp struct ifaddr *ifa; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (IN6_IS_ADDR_LINKLOCAL(IFA_IN6(ifa))) { @@ -1654,7 +1653,7 @@ in6ifa_ifpwithaddr(struct ifnet *ifp, st { struct ifaddr *ifa; - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (IN6_ARE_ADDR_EQUAL(addr, IFA_IN6(ifa))) @@ -1859,7 +1858,7 @@ in6_ifawithifp(struct ifnet *ifp, struct * If none, return one of global addresses assigned other ifs. */ IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST) @@ -1895,7 +1894,7 @@ in6_ifawithifp(struct ifnet *ifp, struct return (besta); } - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST) @@ -1934,7 +1933,7 @@ in6_if_up(struct ifnet *ifp) struct in6_ifaddr *ia; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ia = (struct in6_ifaddr *)ifa; Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Mon Apr 20 20:09:55 2009 (r191335) +++ head/sys/netinet6/in6_ifattach.c Mon Apr 20 21:05:37 2009 (r191336) @@ -233,9 +233,7 @@ in6_get_hw_ifid(struct ifnet *ifp, struc static u_int8_t allone[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - for (ifa = ifp->if_addrlist.tqh_first; - ifa; - ifa = ifa->ifa_list.tqe_next) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_LINK) continue; sdl = (struct sockaddr_dl *)ifa->ifa_addr; @@ -750,17 +748,14 @@ in6_ifdetach(struct ifnet *ifp) nd6_purge(ifp); /* nuke any of IPv6 addresses we have */ - for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = next) { - next = ifa->ifa_list.tqe_next; + TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_list, next) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; in6_purgeaddr(ifa); } /* undo everything done by in6_ifattach(), just in case */ - for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = next) { - next = ifa->ifa_list.tqe_next; - + TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_list, next) { if (ifa->ifa_addr->sa_family != AF_INET6 || !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) { continue; @@ -788,7 +783,7 @@ in6_ifdetach(struct ifnet *ifp) } /* remove from the linked list */ - TAILQ_REMOVE(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list); + TAILQ_REMOVE(&ifp->if_addrhead, (struct ifaddr *)ia, ifa_list); IFAFREE(&ia->ia_ifa); /* also remove from the IPv6 address chain(itojun&jinmei) */ Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Mon Apr 20 20:09:55 2009 (r191335) +++ head/sys/netinet6/in6_var.h Mon Apr 20 21:05:37 2009 (r191336) @@ -503,7 +503,7 @@ MALLOC_DECLARE(M_IP6MADDR); /* struct in6_ifaddr *ia; */ \ do { \ struct ifaddr *ifa; \ - TAILQ_FOREACH(ifa, &(ifp)->if_addrlist, ifa_list) { \ + TAILQ_FOREACH(ifa, &(ifp)->if_addrhead, ifa_list) { \ if (ifa->ifa_addr->sa_family == AF_INET6) \ break; \ } \ Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon Apr 20 20:09:55 2009 (r191335) +++ head/sys/netinet6/nd6.c Mon Apr 20 21:05:37 2009 (r191336) @@ -727,8 +727,7 @@ regen_tmpaddr(struct in6_ifaddr *ia6) struct in6_ifaddr *public_ifa6 = NULL; ifp = ia6->ia_ifa.ifa_ifp; - for (ifa = ifp->if_addrlist.tqh_first; ifa; - ifa = ifa->ifa_list.tqe_next) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { struct in6_ifaddr *it6; if (ifa->ifa_addr->sa_family != AF_INET6) Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Mon Apr 20 20:09:55 2009 (r191335) +++ head/sys/netinet6/nd6_rtr.c Mon Apr 20 21:05:37 2009 (r191336) @@ -442,7 +442,7 @@ nd6_rtmsg(int cmd, struct rtentry *rt) info.rti_info[RTAX_NETMASK] = rt_mask(rt); if (rt->rt_ifp) { info.rti_info[RTAX_IFP] = - TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr; + TAILQ_FIRST(&rt->rt_ifp->if_addrhead)->ifa_addr; info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; } @@ -1120,7 +1120,7 @@ prelist_update(struct nd_prefixctl *new, * consider autoconfigured addresses while RFC2462 simply said * "address". */ - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { struct in6_ifaddr *ifa6; u_int32_t remaininglifetime; @@ -1592,7 +1592,7 @@ nd6_prefix_onlink(struct nd_prefix *pr) IN6_IFF_NOTREADY | IN6_IFF_ANYCAST); if (ifa == NULL) { /* XXX: freebsd does not have ifa_ifwithaf */ - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family == AF_INET6) break; } From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 21:16:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 701591065670; Mon, 20 Apr 2009 21:16:08 +0000 (UTC) Date: Mon, 20 Apr 2009 21:16:08 +0000 From: Alexey Dokuchaev To: Roman Divacky Message-ID: <20090420211608.GA86704@FreeBSD.org> References: <200904201819.n3KIJcZo054306@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <200904201819.n3KIJcZo054306@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 21:16:08 -0000 On Mon, Apr 20, 2009 at 06:19:38PM +0000, Roman Divacky wrote: > Author: rdivacky > Date: Mon Apr 20 18:19:38 2009 > New Revision: 191330 > URL: http://svn.freebsd.org/changeset/base/191330 > > Log: > Implement highlighting of today in month view of cal/ncal just like > gnu cal does. This is currently disabled for year view because of hard > coded padding in that case. This will hopefully be fixed soon. OK, what if some of us do not want this? Is there command line switch, compile macro, or anything else to retain traditional behavior planned? ./danfe From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 21:17:34 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 366A31065675; Mon, 20 Apr 2009 21:17:34 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id DF77F8FC2A; Mon, 20 Apr 2009 21:17:33 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 7F40F9CB071; Mon, 20 Apr 2009 23:16:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Nv0wbC-T9kCf; Mon, 20 Apr 2009 23:16:07 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id D2C6C9CB312; Mon, 20 Apr 2009 23:16:07 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n3KLG7Il036888; Mon, 20 Apr 2009 23:16:07 +0200 (CEST) (envelope-from rdivacky) Date: Mon, 20 Apr 2009 23:16:07 +0200 From: Roman Divacky To: Alexey Dokuchaev Message-ID: <20090420211607.GA36839@freebsd.org> References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090420211608.GA86704@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090420211608.GA86704@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 21:17:34 -0000 On Mon, Apr 20, 2009 at 09:16:08PM +0000, Alexey Dokuchaev wrote: > On Mon, Apr 20, 2009 at 06:19:38PM +0000, Roman Divacky wrote: > > Author: rdivacky > > Date: Mon Apr 20 18:19:38 2009 > > New Revision: 191330 > > URL: http://svn.freebsd.org/changeset/base/191330 > > > > Log: > > Implement highlighting of today in month view of cal/ncal just like > > gnu cal does. This is currently disabled for year view because of hard > > coded padding in that case. This will hopefully be fixed soon. > > OK, what if some of us do not want this? Is there command line switch, > compile macro, or anything else to retain traditional behavior planned? no.. if you insist I'll add some From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 21:37:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45EE1106564A; Mon, 20 Apr 2009 21:37:47 +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 29BEE8FC12; Mon, 20 Apr 2009 21:37:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KLblQR058824; Mon, 20 Apr 2009 21:37:47 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KLbkkL058820; Mon, 20 Apr 2009 21:37:46 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904202137.n3KLbkkL058820@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 21:37: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: r191337 - 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, 20 Apr 2009 21:37:47 -0000 Author: rwatson Date: Mon Apr 20 21:37:46 2009 New Revision: 191337 URL: http://svn.freebsd.org/changeset/base/191337 Log: Acquire interface address list lock around access to if_addrhead, closing several writer-writer races, and some read-write races. MFC after: 2 weeks Modified: head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Mon Apr 20 21:05:37 2009 (r191336) +++ head/sys/netinet6/in6.c Mon Apr 20 21:37:46 2009 (r191337) @@ -1653,12 +1653,14 @@ in6ifa_ifpwithaddr(struct ifnet *ifp, st { struct ifaddr *ifa; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (IN6_ARE_ADDR_EQUAL(addr, IFA_IN6(ifa))) break; } + IF_ADDR_UNLOCK(ifp); return ((struct in6_ifaddr *)ifa); } Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Mon Apr 20 21:05:37 2009 (r191336) +++ head/sys/netinet6/in6_ifattach.c Mon Apr 20 21:37:46 2009 (r191337) @@ -233,6 +233,7 @@ in6_get_hw_ifid(struct ifnet *ifp, struc static u_int8_t allone[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr->sa_family != AF_LINK) continue; @@ -244,6 +245,7 @@ in6_get_hw_ifid(struct ifnet *ifp, struc goto found; } + IF_ADDR_UNLOCK(ifp); return -1; @@ -267,18 +269,24 @@ found: addrlen = 8; /* look at IEEE802/EUI64 only */ - if (addrlen != 8 && addrlen != 6) + if (addrlen != 8 && addrlen != 6) { + IF_ADDR_UNLOCK(ifp); return -1; + } /* * check for invalid MAC address - on bsdi, we see it a lot * since wildboar configures all-zero MAC on pccard before * card insertion. */ - if (bcmp(addr, allzero, addrlen) == 0) + if (bcmp(addr, allzero, addrlen) == 0) { + IF_ADDR_UNLOCK(ifp); return -1; - if (bcmp(addr, allone, addrlen) == 0) + } + if (bcmp(addr, allone, addrlen) == 0) { + IF_ADDR_UNLOCK(ifp); return -1; + } /* make EUI64 address */ if (addrlen == 8) @@ -296,10 +304,14 @@ found: break; case IFT_ARCNET: - if (addrlen != 1) + if (addrlen != 1) { + IF_ADDR_UNLOCK(ifp); return -1; - if (!addr[0]) + } + if (!addr[0]) { + IF_ADDR_UNLOCK(ifp); return -1; + } bzero(&in6->s6_addr[8], 8); in6->s6_addr[15] = addr[0]; @@ -321,15 +333,19 @@ found: * identifier source (can be renumbered). * we don't do this. */ + IF_ADDR_UNLOCK(ifp); return -1; default: + IF_ADDR_UNLOCK(ifp); return -1; } /* sanity check: g bit must not indicate "group" */ - if (EUI64_GROUP(in6)) + if (EUI64_GROUP(in6)) { + IF_ADDR_UNLOCK(ifp); return -1; + } /* convert EUI64 into IPv6 interface identifier */ EUI64_TO_IFID(in6); @@ -340,9 +356,11 @@ found: */ if ((in6->s6_addr[8] & ~(EUI64_GBIT | EUI64_UBIT)) == 0x00 && bcmp(&in6->s6_addr[9], allzero, 7) == 0) { + IF_ADDR_UNLOCK(ifp); return -1; } + IF_ADDR_UNLOCK(ifp); return 0; } @@ -783,7 +801,9 @@ in6_ifdetach(struct ifnet *ifp) } /* remove from the linked list */ + IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, (struct ifaddr *)ia, ifa_list); + IF_ADDR_UNLOCK(ifp); IFAFREE(&ia->ia_ifa); /* also remove from the IPv6 address chain(itojun&jinmei) */ Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon Apr 20 21:05:37 2009 (r191336) +++ head/sys/netinet6/nd6.c Mon Apr 20 21:37:46 2009 (r191337) @@ -727,6 +727,7 @@ regen_tmpaddr(struct in6_ifaddr *ia6) struct in6_ifaddr *public_ifa6 = NULL; ifp = ia6->ia_ifa.ifa_ifp; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { struct in6_ifaddr *it6; @@ -770,13 +771,16 @@ regen_tmpaddr(struct in6_ifaddr *ia6) int e; if ((e = in6_tmpifadd(public_ifa6, 0, 0)) != 0) { + IF_ADDR_UNLOCK(ifp); log(LOG_NOTICE, "regen_tmpaddr: failed to create a new" " tmp addr,errno=%d\n", e); return (-1); } + IF_ADDR_UNLOCK(ifp); return (0); } + IF_ADDR_UNLOCK(ifp); return (-1); } Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Mon Apr 20 21:05:37 2009 (r191336) +++ head/sys/netinet6/nd6_rtr.c Mon Apr 20 21:37:46 2009 (r191337) @@ -435,14 +435,18 @@ static void nd6_rtmsg(int cmd, struct rtentry *rt) { struct rt_addrinfo info; + struct ifnet *ifp; bzero((caddr_t)&info, sizeof(info)); info.rti_info[RTAX_DST] = rt_key(rt); info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; info.rti_info[RTAX_NETMASK] = rt_mask(rt); - if (rt->rt_ifp) { + ifp = rt->rt_ifp; + if (ifp != NULL) { + IF_ADDR_LOCK(ifp); info.rti_info[RTAX_IFP] = - TAILQ_FIRST(&rt->rt_ifp->if_addrhead)->ifa_addr; + TAILQ_FIRST(&ifp->if_addrhead)->ifa_addr; + IF_ADDR_UNLOCK(ifp); info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; } @@ -1120,6 +1124,7 @@ prelist_update(struct nd_prefixctl *new, * consider autoconfigured addresses while RFC2462 simply said * "address". */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { struct in6_ifaddr *ifa6; u_int32_t remaininglifetime; @@ -1242,6 +1247,7 @@ prelist_update(struct nd_prefixctl *new, ifa6->ia6_lifetime = lt6_tmp; ifa6->ia6_updatetime = time_second; } + IF_ADDR_UNLOCK(ifp); if (ia6_match == NULL && new->ndpr_vltime) { int ifidlen; From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 22:01:39 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2506106566C; Mon, 20 Apr 2009 22:01:39 +0000 (UTC) (envelope-from eischen@vigrid.com) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id 5A2B68FC1A; Mon, 20 Apr 2009 22:01:39 +0000 (UTC) (envelope-from eischen@vigrid.com) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.3/8.14.3/NETPLEX) with ESMTP id n3KLUmqR029348; Mon, 20 Apr 2009 17:30:49 -0400 (EDT) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.0 (mail.netplex.net [204.213.176.10]); Mon, 20 Apr 2009 17:30:49 -0400 (EDT) Date: Mon, 20 Apr 2009 17:30:48 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Alexey Dokuchaev In-Reply-To: <20090420211608.GA86704@FreeBSD.org> Message-ID: References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090420211608.GA86704@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, Roman Divacky , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 20 Apr 2009 22:01:40 -0000 On Mon, 20 Apr 2009, Alexey Dokuchaev wrote: > On Mon, Apr 20, 2009 at 06:19:38PM +0000, Roman Divacky wrote: >> Author: rdivacky >> Date: Mon Apr 20 18:19:38 2009 >> New Revision: 191330 >> URL: http://svn.freebsd.org/changeset/base/191330 >> >> Log: >> Implement highlighting of today in month view of cal/ncal just like >> gnu cal does. This is currently disabled for year view because of hard >> coded padding in that case. This will hopefully be fixed soon. > > OK, what if some of us do not want this? Is there command line switch, > compile macro, or anything else to retain traditional behavior planned? Not terribly concerned over this, but shouldn't any new behavior be enabled by an option and old behavior be retained by default (no options necessary)? -- DE From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 22:40:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A75D1106564A; Mon, 20 Apr 2009 22:40:44 +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 954DE8FC19; Mon, 20 Apr 2009 22:40:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KMeitP060098; Mon, 20 Apr 2009 22:40:44 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KMei4T060096; Mon, 20 Apr 2009 22:40:44 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904202240.n3KMei4T060096@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 22:40: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: r191338 - 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, 20 Apr 2009 22:40:45 -0000 Author: rwatson Date: Mon Apr 20 22:40:44 2009 New Revision: 191338 URL: http://svn.freebsd.org/changeset/base/191338 Log: Prefer actual field names (if_addrhead, ifa_link) to macros aliasing those field names in FreeBSD code. MFC after: 2 weeks Modified: head/sys/netinet/ip_fw2.c head/sys/netinet/ip_fw_nat.c Modified: head/sys/netinet/ip_fw2.c ============================================================================== --- head/sys/netinet/ip_fw2.c Mon Apr 20 21:37:46 2009 (r191337) +++ head/sys/netinet/ip_fw2.c Mon Apr 20 22:40:44 2009 (r191338) @@ -594,7 +594,7 @@ search_ip6_addr_net (struct in6_addr * i TAILQ_FOREACH(mdc, &V_ifnet, if_link) { IF_ADDR_LOCK(mdc); - TAILQ_FOREACH(mdc2, &mdc->if_addrhead, ifa_list) { + TAILQ_FOREACH(mdc2, &mdc->if_addrhead, ifa_link) { if (mdc2->ifa_addr->sa_family == AF_INET6) { fdm = (struct in6_ifaddr *)mdc2; copia = fdm->ia_addr.sin6_addr; Modified: head/sys/netinet/ip_fw_nat.c ============================================================================== --- head/sys/netinet/ip_fw_nat.c Mon Apr 20 21:37:46 2009 (r191337) +++ head/sys/netinet/ip_fw_nat.c Mon Apr 20 22:40:44 2009 (r191338) @@ -93,7 +93,7 @@ ifaddr_change(void *arg __unused, struct /* ...using nic 'ifp->if_xname' as dynamic alias address. */ if (strncmp(ptr->if_name, ifp->if_xname, IF_NAMESIZE) == 0) { IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr == NULL) continue; if (ifa->ifa_addr->sa_family != AF_INET) From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 22:41:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE9AB106564A; Mon, 20 Apr 2009 22:41:19 +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 9CFC88FC1E; Mon, 20 Apr 2009 22:41:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KMfJ9P060146; Mon, 20 Apr 2009 22:41:19 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KMfJp1060145; Mon, 20 Apr 2009 22:41:19 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904202241.n3KMfJp1060145@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 22:41: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: r191339 - 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: Mon, 20 Apr 2009 22:41:20 -0000 Author: rwatson Date: Mon Apr 20 22:41:19 2009 New Revision: 191339 URL: http://svn.freebsd.org/changeset/base/191339 Log: Prefer ifa_link (structure field) to ifa_list (macro alias for it). MFC after: 2 weeks Modified: head/sys/net/if_stf.c Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Mon Apr 20 22:40:44 2009 (r191338) +++ head/sys/net/if_stf.c Mon Apr 20 22:41:19 2009 (r191339) @@ -383,7 +383,7 @@ stf_getsrcifa6(ifp) struct in_addr in; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) { if (ia->ifa_addr->sa_family != AF_INET6) continue; sin6 = (struct sockaddr_in6 *)ia->ifa_addr; From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 22:45:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6916F106566C; Mon, 20 Apr 2009 22:45:22 +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 216088FC0A; Mon, 20 Apr 2009 22:45:22 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KMjM07060276; Mon, 20 Apr 2009 22:45:22 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KMjLY9060270; Mon, 20 Apr 2009 22:45:21 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904202245.n3KMjLY9060270@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 22:45: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: r191340 - 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, 20 Apr 2009 22:45:22 -0000 Author: rwatson Date: Mon Apr 20 22:45:21 2009 New Revision: 191340 URL: http://svn.freebsd.org/changeset/base/191340 Log: Prefer structure fields (ifa_link) to macro aliases for them (ifa_list). MFC after: 2 weeks Modified: head/sys/netinet6/icmp6.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_var.h head/sys/netinet6/nd6.c head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Mon Apr 20 22:41:19 2009 (r191339) +++ head/sys/netinet6/icmp6.c Mon Apr 20 22:45:21 2009 (r191340) @@ -1689,7 +1689,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { addrsofif = 0; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifa6 = (struct in6_ifaddr *)ifa; @@ -1776,7 +1776,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) { IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifa6 = (struct in6_ifaddr *)ifa; Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Mon Apr 20 22:41:19 2009 (r191339) +++ head/sys/netinet6/in6.c Mon Apr 20 22:45:21 2009 (r191340) @@ -816,7 +816,7 @@ in6_update_ifa(struct ifnet *ifp, struct ia->ia_ifa.ifa_refcnt = 1; IF_ADDR_LOCK(ifp); - TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_list); + TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_UNLOCK(ifp); } @@ -1178,7 +1178,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st int s = splnet(); IF_ADDR_LOCK(ifp); - TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_list); + TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_UNLOCK(ifp); oia = ia; @@ -1231,7 +1231,7 @@ in6_purgeif(struct ifnet *ifp) { struct ifaddr *ifa, *nifa; - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_list, nifa) { + TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; in6_purgeaddr(ifa); @@ -1414,7 +1414,7 @@ in6_lifaddr_ioctl(struct socket *so, u_l } IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (!cmp) @@ -1513,7 +1513,7 @@ in6_ifinit(struct ifnet *ifp, struct in6 * and to validate the address if necessary. */ IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifacount++; @@ -1629,7 +1629,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp struct ifaddr *ifa; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (IN6_IS_ADDR_LINKLOCAL(IFA_IN6(ifa))) { @@ -1654,7 +1654,7 @@ in6ifa_ifpwithaddr(struct ifnet *ifp, st struct ifaddr *ifa; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (IN6_ARE_ADDR_EQUAL(addr, IFA_IN6(ifa))) @@ -1860,7 +1860,7 @@ in6_ifawithifp(struct ifnet *ifp, struct * If none, return one of global addresses assigned other ifs. */ IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST) @@ -1896,7 +1896,7 @@ in6_ifawithifp(struct ifnet *ifp, struct return (besta); } - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST) @@ -1935,7 +1935,7 @@ in6_if_up(struct ifnet *ifp) struct in6_ifaddr *ia; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ia = (struct in6_ifaddr *)ifa; Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Mon Apr 20 22:41:19 2009 (r191339) +++ head/sys/netinet6/in6_ifattach.c Mon Apr 20 22:45:21 2009 (r191340) @@ -234,7 +234,7 @@ in6_get_hw_ifid(struct ifnet *ifp, struc { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_LINK) continue; sdl = (struct sockaddr_dl *)ifa->ifa_addr; @@ -766,14 +766,14 @@ in6_ifdetach(struct ifnet *ifp) nd6_purge(ifp); /* nuke any of IPv6 addresses we have */ - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_list, next) { + TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; in6_purgeaddr(ifa); } /* undo everything done by in6_ifattach(), just in case */ - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_list, next) { + TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { if (ifa->ifa_addr->sa_family != AF_INET6 || !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) { continue; @@ -802,7 +802,7 @@ in6_ifdetach(struct ifnet *ifp) /* remove from the linked list */ IF_ADDR_LOCK(ifp); - TAILQ_REMOVE(&ifp->if_addrhead, (struct ifaddr *)ia, ifa_list); + TAILQ_REMOVE(&ifp->if_addrhead, (struct ifaddr *)ia, ifa_link); IF_ADDR_UNLOCK(ifp); IFAFREE(&ia->ia_ifa); Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Mon Apr 20 22:41:19 2009 (r191339) +++ head/sys/netinet6/in6_var.h Mon Apr 20 22:45:21 2009 (r191340) @@ -503,7 +503,7 @@ MALLOC_DECLARE(M_IP6MADDR); /* struct in6_ifaddr *ia; */ \ do { \ struct ifaddr *ifa; \ - TAILQ_FOREACH(ifa, &(ifp)->if_addrhead, ifa_list) { \ + TAILQ_FOREACH(ifa, &(ifp)->if_addrhead, ifa_link) { \ if (ifa->ifa_addr->sa_family == AF_INET6) \ break; \ } \ Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon Apr 20 22:41:19 2009 (r191339) +++ head/sys/netinet6/nd6.c Mon Apr 20 22:45:21 2009 (r191340) @@ -728,7 +728,7 @@ regen_tmpaddr(struct in6_ifaddr *ia6) ifp = ia6->ia_ifa.ifa_ifp; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct in6_ifaddr *it6; if (ifa->ifa_addr->sa_family != AF_INET6) Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Mon Apr 20 22:41:19 2009 (r191339) +++ head/sys/netinet6/nd6_rtr.c Mon Apr 20 22:45:21 2009 (r191340) @@ -1125,7 +1125,7 @@ prelist_update(struct nd_prefixctl *new, * "address". */ IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct in6_ifaddr *ifa6; u_int32_t remaininglifetime; @@ -1598,7 +1598,7 @@ nd6_prefix_onlink(struct nd_prefix *pr) IN6_IFF_NOTREADY | IN6_IFF_ANYCAST); if (ifa == NULL) { /* XXX: freebsd does not have ifa_ifwithaf */ - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET6) break; } From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 22:56:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90C1C1065673; Mon, 20 Apr 2009 22:56:34 +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 7DFA78FC14; Mon, 20 Apr 2009 22:56:34 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KMuYr7060511; Mon, 20 Apr 2009 22:56:34 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KMuYfh060509; Mon, 20 Apr 2009 22:56:34 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904202256.n3KMuYfh060509@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 22:56: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: r191341 - 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, 20 Apr 2009 22:56:35 -0000 Author: rwatson Date: Mon Apr 20 22:56:34 2009 New Revision: 191341 URL: http://svn.freebsd.org/changeset/base/191341 Log: Assert the interface address list lock in IFP_TO_IA6(), as it will iterate the interface address list. Marginally expand IF_ADDR_LOCK() coverage in mld6.c to make sure it's held when IFP_TO_IA6() is called. MFC after: 2 weeks Modified: head/sys/netinet6/in6_var.h head/sys/netinet6/mld6.c Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Mon Apr 20 22:45:21 2009 (r191340) +++ head/sys/netinet6/in6_var.h Mon Apr 20 22:56:34 2009 (r191341) @@ -503,6 +503,7 @@ MALLOC_DECLARE(M_IP6MADDR); /* struct in6_ifaddr *ia; */ \ do { \ struct ifaddr *ifa; \ + IF_ADDR_LOCK_ASSERT(ifp); \ TAILQ_FOREACH(ifa, &(ifp)->if_addrhead, ifa_link) { \ if (ifa->ifa_addr->sa_family == AF_INET6) \ break; \ Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Mon Apr 20 22:45:21 2009 (r191340) +++ head/sys/netinet6/mld6.c Mon Apr 20 22:56:34 2009 (r191341) @@ -360,9 +360,12 @@ mld6_input(struct mbuf *m, int off) */ timer = ntohs(mldh->mld_maxdelay); + IF_ADDR_LOCK(ifp); IFP_TO_IA6(ifp, ia); - if (ia == NULL) + if (ia == NULL) { + IF_ADDR_UNLOCK(ifp); break; + } /* * XXX: System timer resolution is too low to handle Max @@ -374,7 +377,6 @@ mld6_input(struct mbuf *m, int off) if (timer == 0 && mldh->mld_maxdelay) timer = 1; - IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET6) continue; From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 23:23:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04D2A106564A; Mon, 20 Apr 2009 23:23:32 +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 E66FF8FC17; Mon, 20 Apr 2009 23:23:31 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KNNVca061187; Mon, 20 Apr 2009 23:23:31 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KNNVQp061186; Mon, 20 Apr 2009 23:23:31 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904202323.n3KNNVQp061186@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 23:23: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: r191342 - 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: Mon, 20 Apr 2009 23:23:32 -0000 Author: rwatson Date: Mon Apr 20 23:23:31 2009 New Revision: 191342 URL: http://svn.freebsd.org/changeset/base/191342 Log: Acquire address list lock before walking an interface's address list to identify possible jail addresses on it for IPv4 and IPv6. MFC after: 2 weeks Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Mon Apr 20 22:56:34 2009 (r191341) +++ head/sys/net/rtsock.c Mon Apr 20 23:23:31 2009 (r191342) @@ -356,6 +356,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * Try to find an address on the given outgoing interface * that belongs to the jail. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; @@ -367,6 +368,7 @@ rtm_get_jailed(struct rt_addrinfo *info, break; } } + IF_ADDR_UNLOCK(ifp); if (!found) { /* * As a last resort return the 'default' jail address. @@ -394,6 +396,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * Try to find an address on the given outgoing interface * that belongs to the jail. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; @@ -406,6 +409,7 @@ rtm_get_jailed(struct rt_addrinfo *info, break; } } + IF_ADDR_UNLOCK(ifp); if (!found) { /* * As a last resort return the 'default' jail address. From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 23:25:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5537E1065672; Mon, 20 Apr 2009 23:25:38 +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 42E4B8FC13; Mon, 20 Apr 2009 23:25:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3KNPcUQ061269; Mon, 20 Apr 2009 23:25:38 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3KNPcq1061268; Mon, 20 Apr 2009 23:25:38 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904202325.n3KNPcq1061268@svn.freebsd.org> From: Robert Watson Date: Mon, 20 Apr 2009 23:25: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: r191343 - 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: Mon, 20 Apr 2009 23:25:38 -0000 Author: rwatson Date: Mon Apr 20 23:25:38 2009 New Revision: 191343 URL: http://svn.freebsd.org/changeset/base/191343 Log: Acquire interfce address list lock while walking the interface address list during tun device initialization. MFC after: 2 weeks Modified: head/sys/net/if_tun.c Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Mon Apr 20 23:23:31 2009 (r191342) +++ head/sys/net/if_tun.c Mon Apr 20 23:25:38 2009 (r191343) @@ -520,6 +520,7 @@ tuninit(struct ifnet *ifp) getmicrotime(&ifp->if_lastchange); #ifdef INET + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET) { struct sockaddr_in *si; @@ -535,6 +536,7 @@ tuninit(struct ifnet *ifp) mtx_unlock(&tp->tun_mtx); } } + IF_ADDR_UNLOCK(ifp); #endif return (error); } From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 00:34:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE7D7106564A; Tue, 21 Apr 2009 00:34:31 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B4D38FC1B; Tue, 21 Apr 2009 00:34:31 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3L0YVTl062815; Tue, 21 Apr 2009 00:34:31 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3L0YV9i062814; Tue, 21 Apr 2009 00:34:31 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200904210034.n3L0YV9i062814@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 21 Apr 2009 00:34: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: r191344 - head/sys/dev/xl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 00:34:32 -0000 Author: yongari Date: Tue Apr 21 00:34:31 2009 New Revision: 191344 URL: http://svn.freebsd.org/changeset/base/191344 Log: Clear IFF_DRV_OACTIVE flag if one of queued packets was transmitted. Previously it used to clear the flag only when the transmit queue is empty which may slow down Tx performance. While I'm here check whether driver is running and whether we can queue more packets in if_start handler. This fixes occasional watchdog timeouts. Reported by: xer < xernet <> hotmail dot it > Tested by: xer < xernet <> hotmail dot it > Modified: head/sys/dev/xl/if_xl.c Modified: head/sys/dev/xl/if_xl.c ============================================================================== --- head/sys/dev/xl/if_xl.c Mon Apr 20 23:25:38 2009 (r191343) +++ head/sys/dev/xl/if_xl.c Tue Apr 21 00:34:31 2009 (r191344) @@ -2097,13 +2097,13 @@ xl_txeof(struct xl_softc *sc) m_freem(cur_tx->xl_mbuf); cur_tx->xl_mbuf = NULL; ifp->if_opackets++; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; cur_tx->xl_next = sc->xl_cdata.xl_tx_free; sc->xl_cdata.xl_tx_free = cur_tx; } if (sc->xl_cdata.xl_tx_head == NULL) { - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->xl_wdog_timer = 0; sc->xl_cdata.xl_tx_tail = NULL; } else { @@ -2540,6 +2540,9 @@ xl_start_locked(struct ifnet *ifp) XL_LOCK_ASSERT(sc); + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) + return; /* * Check for an available queue slot. If there are none, * punt. @@ -2668,7 +2671,8 @@ xl_start_90xB_locked(struct ifnet *ifp) XL_LOCK_ASSERT(sc); - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) return; idx = sc->xl_cdata.xl_tx_prod; From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 00:42:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D9C61065673; Tue, 21 Apr 2009 00:42:12 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 694218FC18; Tue, 21 Apr 2009 00:42:12 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3L0gCD1063037; Tue, 21 Apr 2009 00:42:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3L0gC8V063036; Tue, 21 Apr 2009 00:42:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200904210042.n3L0gC8V063036@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 21 Apr 2009 00:42: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: r191345 - head/sys/dev/xl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 00:42:12 -0000 Author: yongari Date: Tue Apr 21 00:42:11 2009 New Revision: 191345 URL: http://svn.freebsd.org/changeset/base/191345 Log: To make it easy whether xl(4) missed Tx completion interrupt check number of queued packets in watchdog timeout handler. If there are no queued packets just print a informational message and return without resetting controller. Also fix to invoke correct Tx completion handler as 3C905B needs different handler. Modified: head/sys/dev/xl/if_xl.c Modified: head/sys/dev/xl/if_xl.c ============================================================================== --- head/sys/dev/xl/if_xl.c Tue Apr 21 00:34:31 2009 (r191344) +++ head/sys/dev/xl/if_xl.c Tue Apr 21 00:42:11 2009 (r191345) @@ -3211,12 +3211,31 @@ xl_watchdog(struct xl_softc *sc) { struct ifnet *ifp = sc->xl_ifp; u_int16_t status = 0; + int misintr; XL_LOCK_ASSERT(sc); if (sc->xl_wdog_timer == 0 || --sc->xl_wdog_timer != 0) return (0); + xl_rxeof(sc); + xl_txeoc(sc); + misintr = 0; + if (sc->xl_type == XL_TYPE_905B) { + xl_txeof_90xB(sc); + if (sc->xl_cdata.xl_tx_cnt == 0) + misintr++; + } else { + xl_txeof(sc); + if (sc->xl_cdata.xl_tx_head == NULL) + misintr++; + } + if (misintr != 0) { + device_printf(sc->xl_dev, + "watchdog timeout (missed Tx interrupts) -- recovering\n"); + return (0); + } + ifp->if_oerrors++; XL_SEL_WIN(4); status = CSR_READ_2(sc, XL_W4_MEDIA_STATUS); @@ -3226,9 +3245,6 @@ xl_watchdog(struct xl_softc *sc) device_printf(sc->xl_dev, "no carrier - transceiver cable problem?\n"); - xl_txeoc(sc); - xl_txeof(sc); - xl_rxeof(sc); xl_reset(sc); xl_init_locked(sc); From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 04:47:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C650B1065675 for ; Tue, 21 Apr 2009 04:47:21 +0000 (UTC) (envelope-from qingli@speakeasy.net) Received: from mail8.sea5.speakeasy.net (mail8.sea5.speakeasy.net [69.17.117.10]) by mx1.freebsd.org (Postfix) with ESMTP id A29AC8FC15 for ; Tue, 21 Apr 2009 04:47:21 +0000 (UTC) (envelope-from qingli@speakeasy.net) Received: (qmail 27853 invoked from network); 21 Apr 2009 04:20:40 -0000 Received: from dsl081-051-194.sfo1.dsl.speakeasy.net (HELO qm8nwm5acsx) ([64.81.51.194]) (envelope-sender ) by mail8.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 21 Apr 2009 04:20:40 -0000 From: "Qing Li" To: "'Bjoern A. Zeeb'" , , , Date: Mon, 20 Apr 2009 21:20:38 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <200904201122.n3KBMpTD044791@svn.freebsd.org> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: AcnBqmiVjwCKGDKDSl6u4oLBr+k1oAAjglEg Message-Id: <20090421044721.A29AC8FC15@mx1.freebsd.org> Cc: Subject: RE: svn commit: r191305 - head/usr.sbin/ppp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 04:47:22 -0000 Are you really sure backing this change out is the right thing to do ?? -- Qing > -----Original Message----- > From: owner-src-committers@FreeBSD.org > [mailto:owner-src-committers@FreeBSD.org] On Behalf Of Bjoern A. Zeeb > Sent: Monday, April 20, 2009 4:23 AM > To: src-committers@freebsd.org; svn-src-all@freebsd.org; > svn-src-head@freebsd.org > Subject: svn commit: r191305 - head/usr.sbin/ppp > > Author: bz > Date: Mon Apr 20 11:22:51 2009 > New Revision: 191305 > URL: http://svn.freebsd.org/changeset/base/191305 > > Log: > Back out r186308: > > in case of AF_LINK, which the kernel still returns for an > RTAX_GATEWAY > as an empty sockaddr_dl in the classic tun case. > Copying the address into the message payload, but not the > RTA_GATEWAY > flag results in rt_xaddrs() in the kernel tripping over > that and parsing > the next attribute set with a flag, i.e. RTA_NETMASK, with > the gateway > address, resulting in bogus route entry. > > MFC after: 3 days > > Modified: > head/usr.sbin/ppp/route.c > > Modified: head/usr.sbin/ppp/route.c > ============================================================== > ================ > --- head/usr.sbin/ppp/route.c Mon Apr 20 10:40:42 2009 > (r191304) > +++ head/usr.sbin/ppp/route.c Mon Apr 20 11:22:51 2009 > (r191305) > @@ -910,10 +910,8 @@ rt_Update(struct bundle *bundle, const s > p += memcpy_roundup(p, dst, dst->sa_len); > } > > - if (gw != NULL && (gw->sa_family != AF_LINK)) > - rtmes.m_rtm.rtm_addrs |= RTA_GATEWAY; > + rtmes.m_rtm.rtm_addrs |= RTA_GATEWAY; > p += memcpy_roundup(p, gw, gw->sa_len); > - > if (mask) { > rtmes.m_rtm.rtm_addrs |= RTA_NETMASK; > p += memcpy_roundup(p, mask, mask->sa_len); > > From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 05:06:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44D1B106564A; Tue, 21 Apr 2009 05:06:32 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32AD58FC0A; Tue, 21 Apr 2009 05:06:32 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3L56WFh070380; Tue, 21 Apr 2009 05:06:32 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3L56WCx070379; Tue, 21 Apr 2009 05:06:32 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <200904210506.n3L56WCx070379@svn.freebsd.org> From: Takanori Watanabe Date: Tue, 21 Apr 2009 05:06: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: r191346 - in head/sys/dev/usb: . serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 05:06:32 -0000 Author: takawata Date: Tue Apr 21 05:06:31 2009 New Revision: 191346 URL: http://svn.freebsd.org/changeset/base/191346 Log: Add another FTDI serial converter. Modified: head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Tue Apr 21 00:42:11 2009 (r191345) +++ head/sys/dev/usb/serial/uftdi.c Tue Apr 21 05:06:31 2009 (r191346) @@ -207,6 +207,7 @@ static struct usb2_device_id uftdi_devs[ {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U100AX, UFTDI_TYPE_SIO)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_2232C, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM, UFTDI_TYPE_8U232AM)}, + {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM4, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SEMC_DSS20, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CFA_631, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CFA_632, UFTDI_TYPE_8U232AM)}, Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Apr 21 00:42:11 2009 (r191345) +++ head/sys/dev/usb/usbdevs Tue Apr 21 05:06:31 2009 (r191346) @@ -1287,6 +1287,7 @@ product FSC E5400 0x1009 PrismGT USB 2. /* Future Technology Devices products */ product FTDI SERIAL_8U100AX 0x8372 8U100AX Serial product FTDI SERIAL_8U232AM 0x6001 8U232AM Serial +product FTDI SERIAL_8U232AM4 0x6004 8U232AM Serial product FTDI SERIAL_2232C 0x6010 FT2232C Dual port Serial /* Gude Analog- und Digitalsysteme products also uses FTDI's id: */ product FTDI TACTRIX_OPENPORT_13M 0xcc48 OpenPort 1.3 Mitsubishi From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 07:22:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 414A8106564A; Tue, 21 Apr 2009 07:22:13 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 300298FC19; Tue, 21 Apr 2009 07:22:13 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3L7MDe0075487; Tue, 21 Apr 2009 07:22:13 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3L7MDXL075486; Tue, 21 Apr 2009 07:22:13 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <200904210722.n3L7MDXL075486@svn.freebsd.org> From: Kevin Lo Date: Tue, 21 Apr 2009 07:22: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: r191347 - 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: Tue, 21 Apr 2009 07:22:13 -0000 Author: kevlo Date: Tue Apr 21 07:22:12 2009 New Revision: 191347 URL: http://svn.freebsd.org/changeset/base/191347 Log: Back out my previous change Modified: head/share/misc/iso3166 Modified: head/share/misc/iso3166 ============================================================================== --- head/share/misc/iso3166 Tue Apr 21 05:06:31 2009 (r191346) +++ head/share/misc/iso3166 Tue Apr 21 07:22:12 2009 (r191347) @@ -230,7 +230,7 @@ SZ SWZ 748 Swaziland SE SWE 752 Sweden CH CHE 756 Switzerland SY SYR 760 Syrian Arab Republic -TW TWN 158 Taiwan, Republic of China +TW TWN 158 Taiwan, Province of China TJ TJK 762 Tajikistan TZ TZA 834 Tanzania, United Republic of TH THA 764 Thailand From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 08:03:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05EF91065672; Tue, 21 Apr 2009 08:03:45 +0000 (UTC) (envelope-from emikulic@gmail.com) Received: from ipmail04.adl2.internode.on.net (ipmail04.adl2.internode.on.net [203.16.214.57]) by mx1.freebsd.org (Postfix) with ESMTP id 822398FC1A; Tue, 21 Apr 2009 08:03:43 +0000 (UTC) (envelope-from emikulic@gmail.com) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAGsV7UmWZZrw/2dsb2JhbADCD5Bvg30G X-IronPort-AV: E=Sophos;i="4.40,222,1238941800"; d="scan'208";a="354842600" Received: from ppp154-240.static.internode.on.net ([150.101.154.240]) by ipmail04.adl2.internode.on.net with ESMTP; 21 Apr 2009 17:17:26 +0930 Received: by ppp154-240.static.internode.on.net (Poo-fix, from userid 1001) id BA3225C45; Tue, 21 Apr 2009 17:47:26 +1000 (EST) Date: Tue, 21 Apr 2009 17:47:26 +1000 From: Emil Mikulic To: Alexey Dokuchaev Message-ID: <20090421074726.GB63004@dmr.ath.cx> References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090420211608.GA86704@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090420211608.GA86704@FreeBSD.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, Roman Divacky , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 08:03:45 -0000 On Mon, Apr 20, 2009 at 09:16:08PM +0000, Alexey Dokuchaev wrote: > On Mon, Apr 20, 2009 at 06:19:38PM +0000, Roman Divacky wrote: > > Author: rdivacky > > Date: Mon Apr 20 18:19:38 2009 > > New Revision: 191330 > > URL: http://svn.freebsd.org/changeset/base/191330 > > > > Log: > > Implement highlighting of today in month view of cal/ncal just like > > gnu cal does. This is currently disabled for year view because of hard > > coded padding in that case. This will hopefully be fixed soon. > > OK, what if some of us do not want this? Is there command line switch, > compile macro, or anything else to retain traditional behavior planned? Since it checks isatty(), you could get the previous behaviour with "ncal | cat" plus any scripted use of ncal won't get the highlighting in the output, right? Roman - good work! I really like this functionality, really helps to find today "at a glance." --Emil From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 08:09:11 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6768E106566B; Tue, 21 Apr 2009 08:09:11 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 1E00F8FC1C; Tue, 21 Apr 2009 08:09:10 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id D87EC9CB0EB; Tue, 21 Apr 2009 10:07:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1SoYWHjwX+B9; Tue, 21 Apr 2009 10:07:54 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id A6E1F9CB31F; Tue, 21 Apr 2009 10:07:54 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n3L87svI007657; Tue, 21 Apr 2009 10:07:54 +0200 (CEST) (envelope-from rdivacky) Date: Tue, 21 Apr 2009 10:07:54 +0200 From: Roman Divacky To: Emil Mikulic Message-ID: <20090421080754.GA7567@freebsd.org> References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090420211608.GA86704@FreeBSD.org> <20090421074726.GB63004@dmr.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090421074726.GB63004@dmr.ath.cx> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, Alexey Dokuchaev , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 08:09:11 -0000 On Tue, Apr 21, 2009 at 05:47:26PM +1000, Emil Mikulic wrote: > On Mon, Apr 20, 2009 at 09:16:08PM +0000, Alexey Dokuchaev wrote: > > On Mon, Apr 20, 2009 at 06:19:38PM +0000, Roman Divacky wrote: > > > Author: rdivacky > > > Date: Mon Apr 20 18:19:38 2009 > > > New Revision: 191330 > > > URL: http://svn.freebsd.org/changeset/base/191330 > > > > > > Log: > > > Implement highlighting of today in month view of cal/ncal just like > > > gnu cal does. This is currently disabled for year view because of hard > > > coded padding in that case. This will hopefully be fixed soon. > > > > OK, what if some of us do not want this? Is there command line switch, > > compile macro, or anything else to retain traditional behavior planned? > > Since it checks isatty(), you could get the previous behaviour with > "ncal | cat" plus any scripted use of ncal won't get the highlighting in > the output, right? > > Roman - good work! I really like this functionality, really helps to > find today "at a glance." I am about to commit some more changes, among others introducing "-h" argument for disabling the highlight From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 09:24:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D66C1065670; Tue, 21 Apr 2009 09:24:08 +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 484958FC21; Tue, 21 Apr 2009 09:24:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id E278F46B1A; Tue, 21 Apr 2009 05:24:07 -0400 (EDT) Date: Tue, 21 Apr 2009 10:24:07 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Pyun YongHyeon In-Reply-To: <200904210034.n3L0YV9i062814@svn.freebsd.org> Message-ID: References: <200904210034.n3L0YV9i062814@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: r191344 - head/sys/dev/xl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 09:24:09 -0000 On Tue, 21 Apr 2009, Pyun YongHyeon wrote: > Clear IFF_DRV_OACTIVE flag if one of queued packets was transmitted. > Previously it used to clear the flag only when the transmit queue > is empty which may slow down Tx performance. > While I'm here check whether driver is running and whether we can > queue more packets in if_start handler. This fixes occasional > watchdog timeouts. Historically, IFF_DRV_OACTIVE was present to allow the driver to prevent calls to if_start when the driver was already in the transmit steady state (i.e., interrupt-driven transmit). When the transmit interrupt saw it was out of queued packets and interrupt-driven transmission was ending, it would clear the flag so that future enqueues to the now-empty queue would generate an if_start to trigger interrupt-driven transmission again. With that in mind -- are you sure this is the right change? Shouldn't the descriptor ring be refilled when an interrupt comes in from the device after an appropriate interval? Robert N M Watson Computer Laboratory University of Cambridge > > Reported by: xer < xernet <> hotmail dot it > > Tested by: xer < xernet <> hotmail dot it > > > Modified: > head/sys/dev/xl/if_xl.c > > Modified: head/sys/dev/xl/if_xl.c > ============================================================================== > --- head/sys/dev/xl/if_xl.c Mon Apr 20 23:25:38 2009 (r191343) > +++ head/sys/dev/xl/if_xl.c Tue Apr 21 00:34:31 2009 (r191344) > @@ -2097,13 +2097,13 @@ xl_txeof(struct xl_softc *sc) > m_freem(cur_tx->xl_mbuf); > cur_tx->xl_mbuf = NULL; > ifp->if_opackets++; > + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; > > cur_tx->xl_next = sc->xl_cdata.xl_tx_free; > sc->xl_cdata.xl_tx_free = cur_tx; > } > > if (sc->xl_cdata.xl_tx_head == NULL) { > - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; > sc->xl_wdog_timer = 0; > sc->xl_cdata.xl_tx_tail = NULL; > } else { > @@ -2540,6 +2540,9 @@ xl_start_locked(struct ifnet *ifp) > > XL_LOCK_ASSERT(sc); > > + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != > + IFF_DRV_RUNNING) > + return; > /* > * Check for an available queue slot. If there are none, > * punt. > @@ -2668,7 +2671,8 @@ xl_start_90xB_locked(struct ifnet *ifp) > > XL_LOCK_ASSERT(sc); > > - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) > + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != > + IFF_DRV_RUNNING) > return; > > idx = sc->xl_cdata.xl_tx_prod; > From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 09:43:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2461106564A; Tue, 21 Apr 2009 09:43:51 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0D298FC18; Tue, 21 Apr 2009 09:43:51 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3L9hpoV078252; Tue, 21 Apr 2009 09:43:51 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3L9hp4n078251; Tue, 21 Apr 2009 09:43:51 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200904210943.n3L9hp4n078251@svn.freebsd.org> From: Bruce M Simpson Date: Tue, 21 Apr 2009 09:43:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191348 - 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: Tue, 21 Apr 2009 09:43:52 -0000 Author: bms Date: Tue Apr 21 09:43:51 2009 New Revision: 191348 URL: http://svn.freebsd.org/changeset/base/191348 Log: remove IFF_ASSERTGIANT Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Tue Apr 21 07:22:12 2009 (r191347) +++ head/sys/netinet/in_mcast.c Tue Apr 21 09:43:51 2009 (r191348) @@ -399,9 +399,6 @@ in_getmulti(struct ifnet *ifp, const str struct in_multi *inm; int error; -#if defined(INVARIANTS) && defined(IFF_ASSERTGIANT) - IFF_ASSERTGIANT(ifp); -#endif IN_MULTI_LOCK_ASSERT(); ii = (struct in_ifinfo *)ifp->if_afdata[AF_INET]; @@ -511,11 +508,6 @@ inm_release_locked(struct in_multi *inm) { struct ifmultiaddr *ifma; -#if defined(INVARIANTS) && defined(IFF_ASSERTGIANT) - if (!inm_is_ifp_detached(inm)) - IFF_ASSERTGIANT(ifp); -#endif - IN_MULTI_LOCK_ASSERT(); CTR2(KTR_IGMPV3, "%s: refcount is %d", __func__, inm->inm_refcount); @@ -1220,11 +1212,6 @@ in_leavegroup_locked(struct in_multi *in error = 0; -#if defined(INVARIANTS) && defined(IFF_ASSERTGIANT) - if (!inm_is_ifp_detached(inm)) - IFF_ASSERTGIANT(inm->inm_ifp); -#endif - IN_MULTI_LOCK_ASSERT(); CTR5(KTR_IGMPV3, "%s: leave inm %p, %s/%s, imf %p", __func__, From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 10:11:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59CAE1065672; Tue, 21 Apr 2009 10:11:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id CB9518FC13; Tue, 21 Apr 2009 10:11:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n3LABfYH025598 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 21 Apr 2009 20:11:43 +1000 Date: Tue, 21 Apr 2009 20:11:41 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Robert Watson In-Reply-To: Message-ID: <20090421200012.I3341@besplex.bde.org> References: <200904192019.n3JKJDa6019179@svn.freebsd.org> <20090420174802.F58065@delplex.bde.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, Bruce Evans Subject: Re: svn commit: r191276 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2009 10:11:46 -0000 On Mon, 20 Apr 2009, Robert Watson wrote: > On Mon, 20 Apr 2009, Bruce Evans wrote: > >>> +#ifndef CACHE_LINE_SHIFT >>> +#define CACHE_LINE_SHIFT 6 >>> +#endif >>> +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) >> >> This still has the bogus ifdef. Overriding the definition is difficult to >> do consistently even in a kernel with no modules, since CACHE_LINE_SIZE is >> not a kernel option. Overriding the definition makes negative sense since >> the value is a maximum-maximum (possibly larger than strictly needed) so >> that it can be constant. > > OK, I've made this change. Thanks. > My hope is that most applications don't resort to > including sys/param.h and using CACHE_LINE_SIZE -- most will be able to query > it at run-time using interfaces we don't yet have (such as sysconf(3) and > some appropriate constant). I also hope that most kernel consumers will be > able to use a run-time tuned version (which we also don't yet have). You could make (have made) it __CACHE_LINE_SIZE to inhibit use. Bruce From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 10:45:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4173B106566C; Tue, 21 Apr 2009 10:45:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id 6E7228FC18; Tue, 21 Apr 2009 10:45:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 0C38641C69F; Tue, 21 Apr 2009 12:45:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id MWJ6zycVh+EF; Tue, 21 Apr 2009 12:45:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 5E76D41C6A7; Tue, 21 Apr 2009 12:45:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id B55A74448E6; Tue, 21 Apr 2009 10:40:25 +0000 (UTC) Date: Tue, 21 Apr 2009 10:40:25 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Qing Li In-Reply-To: <20090421044721.7573C8FC13@mx1.freebsd.org> Message-ID: <20090421080014.N15361@maildrop.int.zabbadoz.net> References: <20090421044721.7573C8FC13@mx1.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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: r191305 - head/usr.sbin/ppp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 10:45:08 -0000 On Mon, 20 Apr 2009, Qing Li wrote: Hi, > Are you really sure backing this change out is the right thing to do ?? yes, I am. 1) if you do not set RTA_GATEWAY but still copy the adress, your kernel FIB possibly ends up with an incorrect address for the next field, like RTA_NETMASK, RTA_IFP, ..) for example. See sys/net/rtsock.c:rt_xaddrs() 2) I had this sample around for a few days now as I have been lerning more rtsock.c stuff with the help of Kip and finding bugs (ignore those for a moment): dopt# ifconfig tun2 create inet 192.0.2.100 192.0.2.101 up dopt# ifconfig tun2 tun2: flags=8051 metric 0 mtu 1500 inet6 fe80::2e0:81ff:fe31:db8c%tun2 prefixlen 64 scopeid 0x8 inet 192.0.2.100 --> 192.0.2.101 netmask 0xffffff00 dopt# netstat -rn | grep tun2 192.0.2.101 link#8 UH 0 0 tun2 fe80::%tun2/64 link#8 U tun2 ff01:8::/32 fe80::2e0:81ff:fe31:db8c%tun2 U tun2 ff02::%tun2/32 fe80::2e0:81ff:fe31:db8c%tun2 U tun2 So querying the FIB for the IPv4 (ignoring the v6 for the moment for simplicity) route (with something handcrafted) I get back: rtm_msglen 252 rtm_version 5 rtm_type RTM_GET rtm_index 8 rtm_flags =5 rtm_addrs =b3 rtm_pid 0 rtm_seq 0 rtm_errno 0 rtm_fmask =0<> rtm_inits =0<> rt_metrics rtm_rmx: rmx_locks 0 rmx_mtu 1500 rmx_hopcount 0 rmx_expire 0 rmx_recvpipe 0 rmx_sendpipe 0 rmx_ssthresh 0 rmx_rtt 0 rmx_rttvar 0 rmx_pksent 0 rmx_filler { 0, 0, 0, 0 } addresses: 16 (inet) 192.0.2.101 =1 vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 54 (link) =2 0000 36 12 08 00 17 00 00 00 00 00 00 00 00 00 00 00 |6...............| 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0030 00 00 00 00 00 00 |...... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 56 (link) tun2 =10 0000 38 12 08 00 17 04 00 00 74 75 6e 32 00 00 00 00 |8.......tun2....| 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0030 00 00 00 00 00 00 00 00 |........ | 16 (inet) 192.0.2.100 =20 (RTA_BRD) =80 As you can see, we do get an RTA_GATEWAY from the kernel with AF_LINK. Decoding the sockaddr_dl: .sdl_len = 0x36 (54) .sdl_family = 0x12 (18, AF_LINK) .sdl_index = 8 .sdl_type = 0x17 (23, IFT_PPP) .sdl_nlen = 0 .sdl_alen = 0 .sdl_slen = 0 .sdl_data = { 0, .. } So we are clearly getting back an AF_LINK from the kernel and ought to be able to just stick it back in there as is. 3) To show you that it still works as expected: : netstat -Wanrf inet | egrep '(^Dest|tun2)' Destination Gateway Flags Refs Use Mtu Netif Expire 192.0.2.101 link#8 UH 0 0 1500 tun2 : route change 192.0.2.101 -mtu 1300 change host 192.0.2.101 : netstat -Wanrf inet | egrep '(^Dest|tun2)' Destination Gateway Flags Refs Use Mtu Netif Expire 192.0.2.101 link#8 UH 0 0 1300 tun2 and: : route change 192.0.2.101 -link -mtu 1400 change host 192.0.2.101 : netstat -Wanrf inet | egrep '(^Dest|tun2)' Destination Gateway Flags Refs Use Mtu Netif Expire 192.0.2.101 link#8 UH 0 0 1400 tun2 both work (note, even with -link I _think_ route does not pass down the sockaddr_dl) so that's a bit confusing or rather a bug in route(8) as we'll see later. But : route change 192.0.2.101 192.0.2.100 -mtu 1500 change host 192.0.2.101: gateway 192.0.2.100 : netstat -Wanrf inet | egrep '(^Dest|tun2)' Destination Gateway Flags Refs Use Mtu Netif Expire 192.0.2.101 192.0.2.100 UGH 0 0 1500 tun2 that changed the gateway address, which is correct, but also set RTF_GATEWAY, which is not as 192.0.2.101 is directly connected on the PtP interface. The same would happen if passing down the sockaddr_dl, just that the gateway address would stay link#8. 4) RTA_GATEWAY != RTF_GATEWAY The RTF_GATEWAY cannot be set from userspace for an RTM_CHANGE. Even if given it would be filtered out because of RTF_FMASK. So what your commit message in r186308 was saying and trying to work around the RTF_GATEWAY problem by not setting RTA_GATEWAY this only broke rt_xaddrs() parsing (see 1)) . The fact that after an RTM_CHANGE with an RTA_GATEWAY set, RTF_GATEWAY appears, comes from the change in r167797 (ignore the ordering change, only the rt->rt_flags |= RTF_GATEWAY; there is relevant). Which is under discussion as my follow-up commit said: -------------------- r186308, backed out in r191305, already tried to do that, and in addition ignore AF_LINK types of gateway addresses to work around a problem that r167797 had introduced on the kernel side always setting RTF_GATEWAY if a gateway address was passed into the kernel. The proper solution for this is still under discussion so I am hesitant to re-add the special AF_LINK treatment for now. -------------------- One possible solution I had been theoretically pondering first would have been: Index: sys/net/rtsock.c =================================================================== --- sys/net/rtsock.c (revision 190341) +++ sys/net/rtsock.c (working copy) @@ -673,25 +673,27 @@ route_output(struct mbuf *m, struct sock if (info.rti_info[RTAX_GATEWAY] != NULL) { RT_UNLOCK(rt); RADIX_NODE_HEAD_LOCK(rnh); RT_LOCK(rt); error = rt_setgate(rt, rt_key(rt), info.rti_info[RTAX_GATEWAY]); RADIX_NODE_HEAD_UNLOCK(rnh); if (error != 0) { RT_UNLOCK(rt); senderr(error); } - rt->rt_flags |= RTF_GATEWAY; + if (info.rti_info[RTAX_GATEWAY]->sa_family != + AF_LINK) + rt->rt_flags |= RTF_GATEWAY; } if (info.rti_ifa != NULL && info.rti_ifa != rt->rt_ifa) { IFAREF(info.rti_ifa); rt->rt_ifa = info.rti_ifa; rt->rt_ifp = info.rti_ifp; } /* Allow some flags to be toggled on change. */ if (rtm->rtm_fmask & RTF_FMASK) rt->rt_flags = (rt->rt_flags & ~rtm->rtm_fmask) | (rtm->rtm_flags & rtm->rtm_fmask); But I am almost pretty sure that would not be right in all cases either. Our routing sockets are currently a bit .. uhm .. fragile so a small change to fix one thing can break other stuff easily. If we do not want any AF_LINK addresses to be set in RTM_CHANGE as RTA_GATEWAY anymore, we should first make sure that we cannot add them in first place and thus the kernel would not report those back. But I am pretty sure this will simply break all interfaces. Also it would not easily be possible to fix the example from 3) anymore. BTW neither: : route change 192.0.2.101 -mtu 1500 change host 192.0.2.101 : netstat -Wanrf inet | egrep '(^Dest|tun2)' Destination Gateway Flags Refs Use Mtu Netif Expire 192.0.2.101 192.0.2.100 UGH 0 0 1500 tun2 nor: : route change 192.0.2.101 -link -mtu 1500 change host 192.0.2.101 : netstat -Wanrf inet | egrep '(^Dest|tun2)' Destination Gateway Flags Refs Use Mtu Netif Expire 192.0.2.101 192.0.2.100 UGH 0 0 1500 tun2 does make it a link#%d again. Say what you want, this is a route(8) bug as a handcrafted update does: : netstat -Wanrf inet | egrep '(^Dest|tun2)' Destination Gateway Flags Refs Use Mtu Netif Expire 192.0.2.101 192.0.2.100 UGH 0 0 1500 tun2 : sudo ./a.out : netstat -Wanrf inet | egrep '(^Dest|tun2)' Destination Gateway Flags Refs Use Mtu Netif Expire 192.0.2.101 link#8 UGH 0 0 1500 tun2 what it is supposed to do. The only thing left is the RTM_GATEWAY that the kernel set, unfortunately, which is NOT the fault of ppp. So the question is, can we somehow clear it? The answer to that is "no". >> -----Original Message----- >> From: owner-src-committers@FreeBSD.org >> [mailto:owner-src-committers@FreeBSD.org] On Behalf Of Bjoern A. Zeeb >> Sent: Monday, April 20, 2009 4:23 AM >> To: src-committers@freebsd.org; svn-src-all@freebsd.org; >> svn-src-head@freebsd.org >> Subject: svn commit: r191305 - head/usr.sbin/ppp >> >> Author: bz >> Date: Mon Apr 20 11:22:51 2009 >> New Revision: 191305 >> URL: http://svn.freebsd.org/changeset/base/191305 >> >> Log: >> Back out r186308: >> >> in case of AF_LINK, which the kernel still returns for an >> RTAX_GATEWAY >> as an empty sockaddr_dl in the classic tun case. >> Copying the address into the message payload, but not the >> RTA_GATEWAY >> flag results in rt_xaddrs() in the kernel tripping over >> that and parsing >> the next attribute set with a flag, i.e. RTA_NETMASK, with >> the gateway >> address, resulting in bogus route entry. >> >> MFC after: 3 days >> >> Modified: >> head/usr.sbin/ppp/route.c >> >> Modified: head/usr.sbin/ppp/route.c >> ============================================================== >> ================ >> --- head/usr.sbin/ppp/route.c Mon Apr 20 10:40:42 2009 >> (r191304) >> +++ head/usr.sbin/ppp/route.c Mon Apr 20 11:22:51 2009 >> (r191305) >> @@ -910,10 +910,8 @@ rt_Update(struct bundle *bundle, const s >> p += memcpy_roundup(p, dst, dst->sa_len); >> } >> >> - if (gw != NULL && (gw->sa_family != AF_LINK)) >> - rtmes.m_rtm.rtm_addrs |= RTA_GATEWAY; >> + rtmes.m_rtm.rtm_addrs |= RTA_GATEWAY; >> p += memcpy_roundup(p, gw, gw->sa_len); >> - >> if (mask) { >> rtmes.m_rtm.rtm_addrs |= RTA_NETMASK; >> p += memcpy_roundup(p, mask, mask->sa_len); >> >> > > -- Bjoern A. Zeeb The greatest risk is not taking one. From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 10:51:11 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 132321065674; Tue, 21 Apr 2009 10:51:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail11.syd.optusnet.com.au (mail11.syd.optusnet.com.au [211.29.132.192]) by mx1.freebsd.org (Postfix) with ESMTP id A03908FC16; Tue, 21 Apr 2009 10:51:10 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227]) by mail11.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n3LAp71H007956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 21 Apr 2009 20:51:08 +1000 Date: Tue, 21 Apr 2009 20:51:07 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Robert Watson In-Reply-To: Message-ID: <20090421201148.V3341@besplex.bde.org> References: <200904210034.n3L0YV9i062814@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, Pyun YongHyeon Subject: Re: svn commit: r191344 - head/sys/dev/xl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 10:51:11 -0000 On Tue, 21 Apr 2009, Robert Watson wrote: > On Tue, 21 Apr 2009, Pyun YongHyeon wrote: > >> Clear IFF_DRV_OACTIVE flag if one of queued packets was transmitted. >> Previously it used to clear the flag only when the transmit queue >> is empty which may slow down Tx performance. >> While I'm here check whether driver is running and whether we can >> queue more packets in if_start handler. This fixes occasional >> watchdog timeouts. > > Historically, IFF_DRV_OACTIVE was present to allow the driver to prevent > calls to if_start when the driver was already in the transmit steady state > (i.e., interrupt-driven transmit). When the transmit interrupt saw it was > out of queued packets and interrupt-driven transmission was ending, it would > clear the flag so that future enqueues to the now-empty queue would generate > an if_start to trigger interrupt-driven transmission again. With that in > mind -- are you sure this is the right change? Shouldn't the descriptor ring > be refilled when an interrupt comes in from the device after an appropriate > interval? Yes. It was mostly or entirely broken drivers that didn't try to refill the tx ring _as soon as possible_ after a tx interrupt arrives. The tx interrupt should not arrive until the ring reaches a low watermark, which implies both that the ring should be refilled as soon as possible and that there is plenty of space in it so that attempts to refill it will not be completely wasted. The lowest-end hardware and/or drivers that have inadequate watermark handling are probably the ones that are harmed most by not refilling ASAP, since they probably have a tiny tx ring which gives tinier effective low watermark so the tx is more likely to run dry if you don't refill it ASAP. Another point here is that calling if_start() from the interrupt handler is fairly efficient. rxeof() routines could be smarter and only clear IFF_DRV_OACTIVE when the low watermark has been reached. I tried this in a couple of drivers and found it to be a waste of time, because for the hardware wasn't completely-lowest-end so the low watermark was reached in the usual case. The broken drivers here are ones that are dumber and only clear IFF_DRV_OACTIVE when their nonsense idea of a low watermark (0) is reached. Bruce From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 12:47:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98B48106567D; Tue, 21 Apr 2009 12:47:09 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C9F78FC21; Tue, 21 Apr 2009 12:47:09 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3LCl9F4099874; Tue, 21 Apr 2009 12:47:09 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3LCl9vK099871; Tue, 21 Apr 2009 12:47:09 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200904211247.n3LCl9vK099871@svn.freebsd.org> From: Bruce M Simpson Date: Tue, 21 Apr 2009 12:47: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: r191356 - in head: sys/netinet usr.bin/netstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 12:47:10 -0000 Author: bms Date: Tue Apr 21 12:47:09 2009 New Revision: 191356 URL: http://svn.freebsd.org/changeset/base/191356 Log: Bracket struct mfc and struct rtdetq with #ifdef _KERNEL. Match the bracketing in netstat. Since the cleanup of MROUTING, ports have broken because they expect to include without including . Fix breakage at source. The real fix, of course, is to fix the MROUTING APIs by blowing them away and replacing them with something else... Modified: head/sys/netinet/ip_mroute.h head/usr.bin/netstat/mroute.c Modified: head/sys/netinet/ip_mroute.h ============================================================================== --- head/sys/netinet/ip_mroute.h Tue Apr 21 11:44:40 2009 (r191355) +++ head/sys/netinet/ip_mroute.h Tue Apr 21 12:47:09 2009 (r191356) @@ -52,7 +52,6 @@ * bandwidth metering and signaling. */ - /* * Multicast Routing set/getsockopt commands. */ @@ -85,6 +84,7 @@ typedef u_short vifi_t; /* type of a vi #define VIFM_COPY(mfrom, mto) ((mto) = (mfrom)) #define VIFM_SAME(m1, m2) ((m1) == (m2)) +struct mfc; /* * Argument structure for MRT_ADD_VIF. @@ -265,6 +265,7 @@ struct vif { struct route v_route; /* cached route */ }; +#ifdef _KERNEL /* * The kernel's multicast forwarding cache entry structure */ @@ -285,6 +286,7 @@ struct mfc { u_long mfc_nstall; /* # of packets awaiting mfc */ TAILQ_HEAD(, rtdetq) mfc_stall; /* q of packets awaiting mfc */ }; +#endif /* _KERNEL */ /* * Struct used to communicate from kernel to multicast router @@ -304,6 +306,7 @@ struct igmpmsg { struct in_addr im_src, im_dst; }; +#ifdef _KERNEL /* * Argument structure used for pkt info. while upcall is made */ @@ -314,6 +317,7 @@ struct rtdetq { vifi_t xmt_vif; /* Saved copy of imo_multicast_vif */ }; #define MAX_UPQ 4 /* max. no of pkts in upcall Q */ +#endif /* _KERNEL */ /* * Structure for measuring the bandwidth and sending an upcall if the Modified: head/usr.bin/netstat/mroute.c ============================================================================== --- head/usr.bin/netstat/mroute.c Tue Apr 21 11:44:40 2009 (r191355) +++ head/usr.bin/netstat/mroute.c Tue Apr 21 12:47:09 2009 (r191356) @@ -59,7 +59,10 @@ __FBSDID("$FreeBSD$"); #include #include #include + +#define _KERNEL 1 #include +#undef _KERNEL #include #include From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 15:28:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECCEE106564A; Tue, 21 Apr 2009 15:28:14 +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 95F718FC08; Tue, 21 Apr 2009 15:28:14 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n3LFO2Nl047669; Tue, 21 Apr 2009 09:24:02 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 21 Apr 2009 09:25:05 -0600 (MDT) Message-Id: <20090421.092505.-1186699961.imp@bsdimp.com> To: stas@freebsd.org From: "M. Warner Losh" In-Reply-To: <200904201547.n3KFl6Z6050834@svn.freebsd.org> References: <200904201547.n3KFl6Z6050834@svn.freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191322 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 15:28:15 -0000 In message: <200904201547.n3KFl6Z6050834@svn.freebsd.org> Stanislav Sedov writes: : Author: stas : Date: Mon Apr 20 15:47:06 2009 : New Revision: 191322 : URL: http://svn.freebsd.org/changeset/base/191322 : : Log: : - Give a warning and start the oscillator if it was not previously : runned. : - Rename ds1672 -> rtc to follow the other drivers. This is a bad change. Please back it out. There are multiple different kinds of rtc clocks that can live on i2c. Warner : MFC after: 2 weeks : : Modified: : head/sys/arm/conf/AVILA.hints : head/sys/arm/conf/BWCT.hints : head/sys/arm/conf/CAMBRIA.hints : head/sys/dev/iicbus/ds1672.c : : Modified: head/sys/arm/conf/AVILA.hints : ============================================================================== : --- head/sys/arm/conf/AVILA.hints Mon Apr 20 15:19:54 2009 (r191321) : +++ head/sys/arm/conf/AVILA.hints Mon Apr 20 15:47:06 2009 (r191322) : @@ -44,5 +44,5 @@ hint.ad7418.0.at="iicbus0" : hint.ad7418.0.addr=0x50 : : # Dallas Semiconductor DS1672 RTC : -hint.ds1672.0.at="iicbus0" : -hint.ds1672.0.addr=0xd0 : +hint.rtc.0.at="iicbus0" : +hint.rtc.0.addr=0xd0 : : Modified: head/sys/arm/conf/BWCT.hints : ============================================================================== : --- head/sys/arm/conf/BWCT.hints Mon Apr 20 15:19:54 2009 (r191321) : +++ head/sys/arm/conf/BWCT.hints Mon Apr 20 15:47:06 2009 (r191322) : @@ -1,8 +1,8 @@ : # $FreeBSD$ : : # Dallas Semiconductor DS1672 RTC sitting on the I2C bus : -hint.ds1672.0.at="iicbus0" : -hint.ds1672.0.addr=0xd0 : +hint.rtc.0.at="iicbus0" : +hint.rtc.0.addr=0xd0 : : # NAtional Semiconductor LM75 temperature sensor sitting on the I2C bus : hint.lm75.0.at="iicbus0" : : Modified: head/sys/arm/conf/CAMBRIA.hints : ============================================================================== : --- head/sys/arm/conf/CAMBRIA.hints Mon Apr 20 15:19:54 2009 (r191321) : +++ head/sys/arm/conf/CAMBRIA.hints Mon Apr 20 15:47:06 2009 (r191322) : @@ -46,8 +46,8 @@ hint.ad7418.0.at="iicbus0" : hint.ad7418.0.addr=0x50 : : # Dallas Semiconductor DS1672 RTC : -hint.ds1672.0.at="iicbus0" : -hint.ds1672.0.addr=0xd0 : +hint.rtc.0.at="iicbus0" : +hint.rtc.0.addr=0xd0 : : # USB is part of the chip : hint.ehci.0.at="ixp0" : : Modified: head/sys/dev/iicbus/ds1672.c : ============================================================================== : --- head/sys/dev/iicbus/ds1672.c Mon Apr 20 15:19:54 2009 (r191321) : +++ head/sys/dev/iicbus/ds1672.c Mon Apr 20 15:47:06 2009 (r191322) : @@ -50,8 +50,12 @@ __FBSDID("$FreeBSD$"); : #define DS1672_CTRL 4 /* control (1 byte) */ : #define DS1672_TRICKLE 5 /* trickle charger (1 byte) */ : : +#define DS1672_CTRL_EOSC (1 << 7) /* Stop/start flag. */ : + : #define NANOSEC 1000000000 : : +#define MAX_IIC_DATA_SIZE 4 : + : struct ds1672_softc { : device_t sc_dev; : }; : @@ -65,12 +69,64 @@ ds1672_probe(device_t dev) : } : : static int : +ds1672_read(device_t dev, uint8_t addr, uint8_t *data, uint8_t size) : +{ : + struct iic_msg msgs[2] = { : + { DS1672_ADDR, IIC_M_WR, 1, &addr }, : + { DS1672_ADDR, IIC_M_RD, size, data } : + }; : + : + return (iicbus_transfer(dev, msgs, 2)); : +} : + : +static int : +ds1672_write(device_t dev, uint8_t addr, uint8_t *data, uint8_t size) : +{ : + uint8_t buffer[MAX_IIC_DATA_SIZE + 1]; : + struct iic_msg msgs[1] = { : + { DS1672_ADDR, IIC_M_WR, size + 1, buffer }, : + }; : + : + if (size > MAX_IIC_DATA_SIZE) : + return (ENOMEM); : + /* NB: register pointer precedes actual data */ : + buffer[0] = addr; : + memcpy(buffer + 1, data, size); : + return (iicbus_transfer(dev, msgs, 1)); : +} : + : +static int : +ds1672_init(device_t dev) : +{ : + uint8_t ctrl; : + int error; : + : + error = ds1672_read(dev, DS1672_CTRL, &ctrl, 1); : + if (error) : + return (error); : + : + /* : + * Check if oscialltor is not runned. : + */ : + if (ctrl & DS1672_CTRL_EOSC) { : + device_printf(dev, "RTC oscillator was stopped. Check system" : + " time and RTC battery.\n"); : + ctrl &= ~DS1672_CTRL_EOSC; /* Start oscillator. */ : + error = ds1672_write(dev, DS1672_CTRL, &ctrl, 1); : + } : + return (error); : +} : + : +static int : ds1672_attach(device_t dev) : { : struct ds1672_softc *sc = device_get_softc(dev); : + int error; : : sc->sc_dev = dev; : - : + error = ds1672_init(dev); : + if (error) : + return (error); : clock_register(dev, 1000); : return (0); : } : @@ -78,39 +134,30 @@ ds1672_attach(device_t dev) : static int : ds1672_gettime(device_t dev, struct timespec *ts) : { : - uint8_t addr[1] = { DS1672_COUNTER }; : uint8_t secs[4]; : - struct iic_msg msgs[2] = { : - { DS1672_ADDR, IIC_M_WR, 1, addr }, : - { DS1672_ADDR, IIC_M_RD, 4, secs }, : - }; : int error; : : - error = iicbus_transfer(dev, msgs, 2); : + error = ds1672_read(dev, DS1672_COUNTER, secs, 4); : if (error == 0) { : /* counter has seconds since epoch */ : ts->tv_sec = (secs[3] << 24) | (secs[2] << 16) : | (secs[1] << 8) | (secs[0] << 0); : ts->tv_nsec = NANOSEC / 2; : } : - return error; : + return (error); : } : : static int : ds1672_settime(device_t dev, struct timespec *ts) : { : - /* NB: register pointer precedes actual data */ : - uint8_t data[5] = { DS1672_COUNTER }; : - struct iic_msg msgs[1] = { : - { DS1672_ADDR, IIC_M_WR, 5, data }, : - }; : + uint8_t data[4]; : : - data[1] = (ts->tv_sec >> 0) & 0xff; : - data[2] = (ts->tv_sec >> 8) & 0xff; : - data[3] = (ts->tv_sec >> 16) & 0xff; : - data[4] = (ts->tv_sec >> 24) & 0xff; : + data[0] = (ts->tv_sec >> 0) & 0xff; : + data[1] = (ts->tv_sec >> 8) & 0xff; : + data[2] = (ts->tv_sec >> 16) & 0xff; : + data[3] = (ts->tv_sec >> 24) & 0xff; : : - return iicbus_transfer(dev, msgs, 1); : + return (ds1672_write(dev, DS1672_COUNTER, data, 4)); : } : : static device_method_t ds1672_methods[] = { : @@ -124,7 +171,7 @@ static device_method_t ds1672_methods[] : }; : : static driver_t ds1672_driver = { : - "ds1672", : + "rtc", : ds1672_methods, : sizeof(struct ds1672_softc), : }; : From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 17:04:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0D2E106568A; Tue, 21 Apr 2009 17:04:01 +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 A51398FC1C; Tue, 21 Apr 2009 17:04:01 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3LH41Wp016573; Tue, 21 Apr 2009 17:04:01 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3LH41DN016572; Tue, 21 Apr 2009 17:04:01 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200904211704.n3LH41DN016572@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 21 Apr 2009 17:04: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: r191362 - head/sys/powerpc/booke X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 17:04:02 -0000 Author: marcel Date: Tue Apr 21 17:04:01 2009 New Revision: 191362 URL: http://svn.freebsd.org/changeset/base/191362 Log: o Properly set ksym_start & ksym_end when options DDB is set. Include opt_ddb.h for that. Now you can actually boot with -d and set breakpoints using function names. o Make sure to include opt_msgbuf.h. o Carve out the first 1MB of physical memory. The MPC85xx has DMA problems with addresses below 1MB. Ideally busdma knows how to avoid allocating below 1MB for MPC85xx, but that requires a bit more work. For now, ignore the 1MB of DRAM. Modified: head/sys/powerpc/booke/machdep.c Modified: head/sys/powerpc/booke/machdep.c ============================================================================== --- head/sys/powerpc/booke/machdep.c Tue Apr 21 16:58:46 2009 (r191361) +++ head/sys/powerpc/booke/machdep.c Tue Apr 21 17:04:01 2009 (r191362) @@ -82,7 +82,9 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" +#include "opt_ddb.h" #include "opt_kstack_pages.h" +#include "opt_msgbuf.h" #include #include @@ -137,6 +139,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef DDB +extern vm_offset_t ksym_start, ksym_end; +#endif + #ifdef DEBUG #define debugf(fmt, args...) printf(fmt, ##args) #else @@ -355,6 +361,10 @@ e500_init(u_int32_t startkernel, u_int32 boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); end = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); +#ifdef DDB + ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); + ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); +#endif } } else { /* @@ -376,8 +386,14 @@ e500_init(u_int32_t startkernel, u_int32 for (i = 0; i < bootinfo->bi_mem_reg_no; i++, mr++) { if (i == MEM_REGIONS) break; - availmem_regions[i].mr_start = mr->mem_base; - availmem_regions[i].mr_size = mr->mem_size; + if (mr->mem_base < 1048576) { + availmem_regions[i].mr_start = 1048576; + availmem_regions[i].mr_size = mr->mem_size - + (1048576 - mr->mem_base); + } else { + availmem_regions[i].mr_start = mr->mem_base; + availmem_regions[i].mr_size = mr->mem_size; + } } availmem_regions_sz = i; From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 17:08:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6459A1065674; Tue, 21 Apr 2009 17:08:02 +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 536098FC20; Tue, 21 Apr 2009 17:08:02 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3LH821t016686; Tue, 21 Apr 2009 17:08:02 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3LH824f016685; Tue, 21 Apr 2009 17:08:02 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200904211708.n3LH824f016685@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 21 Apr 2009 17:08: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: r191363 - head/sys/powerpc/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2009 17:08:03 -0000 Author: marcel Date: Tue Apr 21 17:08:02 2009 New Revision: 191363 URL: http://svn.freebsd.org/changeset/base/191363 Log: Lower VM_MAX_KERNEL_ADDRESS to 0xf8000000. We actually have devices below CCSRBAR_VA, which overlap with KVA if that's out limit. Modified: head/sys/powerpc/include/vmparam.h Modified: head/sys/powerpc/include/vmparam.h ============================================================================== --- head/sys/powerpc/include/vmparam.h Tue Apr 21 17:04:01 2009 (r191362) +++ head/sys/powerpc/include/vmparam.h Tue Apr 21 17:08:02 2009 (r191363) @@ -124,7 +124,7 @@ #define KERNBASE 0xc0000000 /* start of kernel virtual */ #define VM_MIN_KERNEL_ADDRESS KERNBASE -#define VM_MAX_KERNEL_ADDRESS CCSRBAR_VA +#define VM_MAX_KERNEL_ADDRESS 0xf8000000 #endif /* AIM/E500 */ From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 17:44:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2CDD1065688; Tue, 21 Apr 2009 17:44:46 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0FFE8FC28; Tue, 21 Apr 2009 17:44:46 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3LHikIa017385; Tue, 21 Apr 2009 17:44:46 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3LHikUF017384; Tue, 21 Apr 2009 17:44:46 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200904211744.n3LHikUF017384@svn.freebsd.org> From: Roman Divacky Date: Tue, 21 Apr 2009 17:44: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: r191364 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 17:44:47 -0000 Author: rdivacky Date: Tue Apr 21 17:44:46 2009 New Revision: 191364 URL: http://svn.freebsd.org/changeset/base/191364 Log: Couple of changes based on feedback o Change mr/me to so/se [1]. o Introduce a -h option to disable highlighting. [2] o Spell STDOUT_FILENO as such and pass NULL to tgetent() to handle the case of unset TERM. [3] Suggested by: naddy mips.inka.de (Christian Weisgerber) [1] Requested by: danfe, deischen [2] Suggested by: jmallett [3] Approved by: ed (mentor) Modified: head/usr.bin/ncal/ncal.c Modified: head/usr.bin/ncal/ncal.c ============================================================================== --- head/usr.bin/ncal/ncal.c Tue Apr 21 17:08:02 2009 (r191363) +++ head/usr.bin/ncal/ncal.c Tue Apr 21 17:44:46 2009 (r191364) @@ -209,12 +209,12 @@ main(int argc, char *argv[]) term_e = term_r = NULL; today = 0; - if (isatty(1) && tgetent(tbuf, getenv("TERM")) == 1) { + if (isatty(STDOUT_FILENO) && tgetent(tbuf, NULL) == 1) { date dt; /* handy date */ b = cbuf; - term_r = tgetstr("mr", &b); - term_e = tgetstr("me", &b); + term_r = tgetstr("so", &b); + term_e = tgetstr("se", &b); t = time(NULL); tm1 = localtime(&t); dt.y = tm1->tm_year + 1900; @@ -263,7 +263,7 @@ main(int argc, char *argv[]) if (flag_backward) nswitchb = ndaysj(&ukswitch); - while ((ch = getopt(argc, argv, "Jejm:ops:wy")) != -1) + while ((ch = getopt(argc, argv, "Jehjm:ops:wy")) != -1) switch (ch) { case 'J': if (flag_backward) @@ -271,6 +271,9 @@ main(int argc, char *argv[]) nswitch = ndaysj(&never); flag_julian_cal = 1; break; + case 'h': + term_r = term_e = NULL; + break; case 'e': if (flag_backward) usage(); From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 17:59:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD7B9106566C for ; Tue, 21 Apr 2009 17:59:48 +0000 (UTC) (envelope-from stas@SpringDaemons.com) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id 5ED0D8FC1B for ; Tue, 21 Apr 2009 17:59:48 +0000 (UTC) (envelope-from stas@SpringDaemons.com) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id 5D4548FC52 for ; Tue, 21 Apr 2009 21:59:47 +0400 (MSD) Received: from sputnik.SpringDaemons.com (unknown [77.232.3.143]) by mx0.deglitch.com (Postfix) with ESMTPA id 7B5F28FC18; Tue, 21 Apr 2009 21:59:43 +0400 (MSD) Received: by sputnik.SpringDaemons.com (Postfix, from userid 1024) id EEDACB86F; Tue, 21 Apr 2009 22:01:44 +0400 (MSD) Date: Tue, 21 Apr 2009 22:01:38 +0400 From: Stanislav Sedov To: "M. Warner Losh" Message-Id: <20090421220138.f6e7b4d4.stas@FreeBSD.org> In-Reply-To: <20090421.092505.-1186699961.imp@bsdimp.com> References: <200904201547.n3KFl6Z6050834@svn.freebsd.org> <20090421.092505.-1186699961.imp@bsdimp.com> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprin: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Tue Apr 21 21:59:47 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 49ee0993967001275275125 Cc: stas@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191322 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 17:59:48 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 21 Apr 2009 09:25:05 -0600 (MDT) "M. Warner Losh" mentioned: > In message: <200904201547.n3KFl6Z6050834@svn.freebsd.org> > Stanislav Sedov writes: > : Author: stas > : Date: Mon Apr 20 15:47:06 2009 > : New Revision: 191322 > : URL: http://svn.freebsd.org/changeset/base/191322 > : > : Log: > : - Give a warning and start the oscillator if it was not previously > : runned. > : - Rename ds1672 -> rtc to follow the other drivers. > > This is a bad change. Please back it out. There are multiple > different kinds of rtc clocks that can live on i2c. > Why do you want to? We already have ds133x under the same name. In case if there're multiple clocks in the same systems the first one will have the name of rtc0, the second - rtc1 and so on. Before the names of devices were ds16720, ds16721, which I looks ugly. - -- Stanislav Sedov ST4096-RIPE -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAknuCggACgkQK/VZk+smlYHkOgCdF+J6pfLTJZal8ll0tJyq1GHW dIEAn3ggk76n9Jn8rNwplDnsb9HeZwd9 =bfLr -----END PGP SIGNATURE----- !DSPAM:49ee0993967001275275125! From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 18:00:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52D981065672; Tue, 21 Apr 2009 18:00:57 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from semihalf.com (semihalf.com [206.130.101.55]) by mx1.freebsd.org (Postfix) with ESMTP id 1A3178FC15; Tue, 21 Apr 2009 18:00:56 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from mail.semihalf.com (mail.semihalf.com [83.15.139.206]) by semihalf.com (8.13.1/8.13.1) with ESMTP id n3LI0tgS001721; Tue, 21 Apr 2009 12:00:56 -0600 Message-Id: <2610CF8A-83E5-4CDF-9704-CC1BC1897F7C@semihalf.com> From: Rafal Jaworowski To: Marcel Moolenaar In-Reply-To: <200904211704.n3LH41DN016572@svn.freebsd.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Tue, 21 Apr 2009 20:00:54 +0200 References: <200904211704.n3LH41DN016572@svn.freebsd.org> X-Mailer: Apple Mail (2.930.3) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191362 - head/sys/powerpc/booke X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 18:00:57 -0000 On 2009-04-21, at 19:04, Marcel Moolenaar wrote: > Author: marcel > Date: Tue Apr 21 17:04:01 2009 > New Revision: 191362 > URL: http://svn.freebsd.org/changeset/base/191362 > > Log: > o Properly set ksym_start & ksym_end when options DDB is set. > Include opt_ddb.h for that. Now you can actually boot with > -d and set breakpoints using function names. > o Make sure to include opt_msgbuf.h. > o Carve out the first 1MB of physical memory. The MPC85xx has > DMA problems with addresses below 1MB. Ideally busdma knows > how to avoid allocating below 1MB for MPC85xx, but that > requires a bit more work. For now, ignore the 1MB of DRAM. Could you elaborate a bit on the last item? What is the faulty scenario, is this a known h/w defect documented somewhere? Rafal From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 18:21:21 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC7FA106566C; Tue, 21 Apr 2009 18:21:21 +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 7718F8FC2B; Tue, 21 Apr 2009 18:21:21 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n3LIH2Ao050196; Tue, 21 Apr 2009 12:17:02 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 21 Apr 2009 12:18:05 -0600 (MDT) Message-Id: <20090421.121805.-1954387331.imp@bsdimp.com> To: stas@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090421220138.f6e7b4d4.stas@FreeBSD.org> References: <200904201547.n3KFl6Z6050834@svn.freebsd.org> <20090421.092505.-1186699961.imp@bsdimp.com> <20090421220138.f6e7b4d4.stas@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191322 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 18:21:22 -0000 In message: <20090421220138.f6e7b4d4.stas@FreeBSD.org> Stanislav Sedov writes: : -----BEGIN PGP SIGNED MESSAGE----- : Hash: SHA1 : : On Tue, 21 Apr 2009 09:25:05 -0600 (MDT) : "M. Warner Losh" mentioned: : : > In message: <200904201547.n3KFl6Z6050834@svn.freebsd.org> : > Stanislav Sedov writes: : > : Author: stas : > : Date: Mon Apr 20 15:47:06 2009 : > : New Revision: 191322 : > : URL: http://svn.freebsd.org/changeset/base/191322 : > : : > : Log: : > : - Give a warning and start the oscillator if it was not previously : > : runned. : > : - Rename ds1672 -> rtc to follow the other drivers. : > : > This is a bad change. Please back it out. There are multiple : > different kinds of rtc clocks that can live on i2c. : > : : Why do you want to? We already have ds133x under the same name. In case : if there're multiple clocks in the same systems the first one will : have the name of rtc0, the second - rtc1 and so on. Because you'll want to support a range of boards that might have multiple different kinds of rtc i2c clocks. Calling them all i2c won't work because you can't probe the i2c bus in any meaningful way. the ds133x one, if it is named rtc, is wrong too. : Before the names of devices were ds16720, ds16721, which I looks : ugly. That's not a good enough reason to change it. That's a cosmetic issue that is much less important than the functional issue I raised above. Warner From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 18:33:15 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76B341065678 for ; Tue, 21 Apr 2009 18:33:15 +0000 (UTC) (envelope-from stas@SpringDaemons.com) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id 265618FC15 for ; Tue, 21 Apr 2009 18:33:15 +0000 (UTC) (envelope-from stas@SpringDaemons.com) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id E36EF8FC51 for ; Tue, 21 Apr 2009 22:33:13 +0400 (MSD) Received: from sputnik.SpringDaemons.com (unknown [77.232.3.143]) by mx0.deglitch.com (Postfix) with ESMTPA id A7C6D8FC18; Tue, 21 Apr 2009 22:33:10 +0400 (MSD) Received: by sputnik.SpringDaemons.com (Postfix, from userid 1024) id DFE3DB86F; Tue, 21 Apr 2009 22:35:11 +0400 (MSD) Date: Tue, 21 Apr 2009 22:35:02 +0400 From: Stanislav Sedov To: "M. Warner Losh" Message-Id: <20090421223502.507f0dcf.stas@FreeBSD.org> In-Reply-To: <20090421.121805.-1954387331.imp@bsdimp.com> References: <200904201547.n3KFl6Z6050834@svn.freebsd.org> <20090421.092505.-1186699961.imp@bsdimp.com> <20090421220138.f6e7b4d4.stas@FreeBSD.org> <20090421.121805.-1954387331.imp@bsdimp.com> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprin: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Innocent X-DSPAM-Processed: Tue Apr 21 22:33:13 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 49ee1169967003529232671 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191322 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 18:33:15 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 21 Apr 2009 12:18:05 -0600 (MDT) "M. Warner Losh" mentioned: > In message: <20090421220138.f6e7b4d4.stas@FreeBSD.org> > Stanislav Sedov writes: > : -----BEGIN PGP SIGNED MESSAGE----- > : Hash: SHA1 > : > : On Tue, 21 Apr 2009 09:25:05 -0600 (MDT) > : "M. Warner Losh" mentioned: > : > : > In message: <200904201547.n3KFl6Z6050834@svn.freebsd.org> > : > Stanislav Sedov writes: > : > : Author: stas > : > : Date: Mon Apr 20 15:47:06 2009 > : > : New Revision: 191322 > : > : URL: http://svn.freebsd.org/changeset/base/191322 > : > : > : > : Log: > : > : - Give a warning and start the oscillator if it was not previously > : > : runned. > : > : - Rename ds1672 -> rtc to follow the other drivers. > : > > : > This is a bad change. Please back it out. There are multiple > : > different kinds of rtc clocks that can live on i2c. > : > > : > : Why do you want to? We already have ds133x under the same name. In case > : if there're multiple clocks in the same systems the first one will > : have the name of rtc0, the second - rtc1 and so on. > > Because you'll want to support a range of boards that might have > multiple different kinds of rtc i2c clocks. Calling them all i2c > won't work because you can't probe the i2c bus in any meaningful way. > the ds133x one, if it is named rtc, is wrong too. > I still don't fully see your point. If you have two different RTCs sitting on I2C bus they either have a different address, or they're attached to different rtc busses. So you can configure them in a usual way via hints. - -- Stanislav Sedov ST4096-RIPE -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAknuEd8ACgkQK/VZk+smlYFawgCfVqD23hi9nqvdoGyqKg+disD+ +y4An02Tur7zhoOz48w+9DQy7riTltu2 =+afe -----END PGP SIGNATURE----- !DSPAM:49ee1169967003529232671! From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 18:38:16 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C645E106566C; Tue, 21 Apr 2009 18:38:16 +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 630F48FC13; Tue, 21 Apr 2009 18:38:16 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n3LIbi2P050450; Tue, 21 Apr 2009 12:37:44 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 21 Apr 2009 12:38:47 -0600 (MDT) Message-Id: <20090421.123847.70203894.imp@bsdimp.com> To: stas@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090421223502.507f0dcf.stas@FreeBSD.org> References: <20090421220138.f6e7b4d4.stas@FreeBSD.org> <20090421.121805.-1954387331.imp@bsdimp.com> <20090421223502.507f0dcf.stas@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191322 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 18:38:17 -0000 In message: <20090421223502.507f0dcf.stas@FreeBSD.org> Stanislav Sedov writes: : -----BEGIN PGP SIGNED MESSAGE----- : Hash: SHA1 : : On Tue, 21 Apr 2009 12:18:05 -0600 (MDT) : "M. Warner Losh" mentioned: : : > In message: <20090421220138.f6e7b4d4.stas@FreeBSD.org> : > Stanislav Sedov writes: : > : -----BEGIN PGP SIGNED MESSAGE----- : > : Hash: SHA1 : > : : > : On Tue, 21 Apr 2009 09:25:05 -0600 (MDT) : > : "M. Warner Losh" mentioned: : > : : > : > In message: <200904201547.n3KFl6Z6050834@svn.freebsd.org> : > : > Stanislav Sedov writes: : > : > : Author: stas : > : > : Date: Mon Apr 20 15:47:06 2009 : > : > : New Revision: 191322 : > : > : URL: http://svn.freebsd.org/changeset/base/191322 : > : > : : > : > : Log: : > : > : - Give a warning and start the oscillator if it was not previously : > : > : runned. : > : > : - Rename ds1672 -> rtc to follow the other drivers. : > : > : > : > This is a bad change. Please back it out. There are multiple : > : > different kinds of rtc clocks that can live on i2c. : > : > : > : : > : Why do you want to? We already have ds133x under the same name. In case : > : if there're multiple clocks in the same systems the first one will : > : have the name of rtc0, the second - rtc1 and so on. : > : > Because you'll want to support a range of boards that might have : > multiple different kinds of rtc i2c clocks. Calling them all i2c : > won't work because you can't probe the i2c bus in any meaningful way. : > the ds133x one, if it is named rtc, is wrong too. : > : : I still don't fully see your point. If you have two different RTCs : sitting on I2C bus they either have a different address, or they're : attached to different rtc busses. So you can configure them in a : usual way via hints. You don't see my point, that's right. Consider one kernel. Two different boards. Different RTC chips on each of these boards. Hints loaded from the boot loader. Now, on one board the ds1672 is used, on the other a ds163x is used. How does the right driver get attached in that case? Warner From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 18:51:22 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C574E10656BC; Tue, 21 Apr 2009 18:51:22 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 80ECB8FC0A; Tue, 21 Apr 2009 18:51:22 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n3LIsawB018764; Tue, 21 Apr 2009 14:54:36 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n3LIsa7W018763; Tue, 21 Apr 2009 14:54:36 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Tue, 21 Apr 2009 14:54:36 -0400 From: David Schultz To: Roman Divacky Message-ID: <20090421185436.GA18628@zim.MIT.EDU> Mail-Followup-To: Roman Divacky , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200904201819.n3KIJcZo054306@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200904201819.n3KIJcZo054306@svn.freebsd.org> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 18:51:23 -0000 On Mon, Apr 20, 2009, Roman Divacky wrote: > Author: rdivacky > Date: Mon Apr 20 18:19:38 2009 > New Revision: 191330 > URL: http://svn.freebsd.org/changeset/base/191330 > > Log: > Implement highlighting of today in month view of cal/ncal just like > gnu cal does. This is currently disabled for year view because of hard > coded padding in that case. This will hopefully be fixed soon. As I recall, ncal relies on the length of each line it formats to take care of alignment issues in various places. Are you sure that adding control characters doesn't break that? Also, before this change, ncal was already full of convoluted buffer handling, arbitrary buffer sizes, and little to no bounds checking. This commit adds more magic numbers and fragile buffer handling code, and generally makes an already hairy program even less scrutable. This isn't your fault, but it would be nice if we could make ncal better before it gets much worse. For instance, you might use snprintf() or asprintf() instead of an extra half dozen calls to memcpy() with various offsets. From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 18:52:09 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C7291065677 for ; Tue, 21 Apr 2009 18:52:09 +0000 (UTC) (envelope-from stas@SpringDaemons.com) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id CAB0F8FC08 for ; Tue, 21 Apr 2009 18:52:08 +0000 (UTC) (envelope-from stas@SpringDaemons.com) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id 924808FC51 for ; Tue, 21 Apr 2009 22:52:07 +0400 (MSD) Received: from sputnik.SpringDaemons.com (unknown [77.232.3.143]) by mx0.deglitch.com (Postfix) with ESMTPA id 18A3F8FC18; Tue, 21 Apr 2009 22:52:05 +0400 (MSD) Received: by sputnik.SpringDaemons.com (Postfix, from userid 1024) id 59F50B86F; Tue, 21 Apr 2009 22:54:05 +0400 (MSD) Date: Tue, 21 Apr 2009 22:54:04 +0400 From: Stanislav Sedov To: "M. Warner Losh" Message-Id: <20090421225404.5c83c32c.stas@FreeBSD.org> In-Reply-To: <20090421.123847.70203894.imp@bsdimp.com> References: <20090421220138.f6e7b4d4.stas@FreeBSD.org> <20090421.121805.-1954387331.imp@bsdimp.com> <20090421223502.507f0dcf.stas@FreeBSD.org> <20090421.123847.70203894.imp@bsdimp.com> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprin: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Innocent X-DSPAM-Processed: Tue Apr 21 22:52:07 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 49ee15d7967005292219314 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191322 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 18:52:10 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 21 Apr 2009 12:38:47 -0600 (MDT) "M. Warner Losh" mentioned: > In message: <20090421223502.507f0dcf.stas@FreeBSD.org> > Stanislav Sedov writes: > : -----BEGIN PGP SIGNED MESSAGE----- > : Hash: SHA1 > : > : On Tue, 21 Apr 2009 12:18:05 -0600 (MDT) > : "M. Warner Losh" mentioned: > : > : > In message: <20090421220138.f6e7b4d4.stas@FreeBSD.org> > : > Stanislav Sedov writes: > : > : -----BEGIN PGP SIGNED MESSAGE----- > : > : Hash: SHA1 > : > : > : > : On Tue, 21 Apr 2009 09:25:05 -0600 (MDT) > : > : "M. Warner Losh" mentioned: > : > : > : > : > In message: <200904201547.n3KFl6Z6050834@svn.freebsd.org> > : > : > Stanislav Sedov writes: > : > : > : Author: stas > : > : > : Date: Mon Apr 20 15:47:06 2009 > : > : > : New Revision: 191322 > : > : > : URL: http://svn.freebsd.org/changeset/base/191322 > : > : > : > : > : > : Log: > : > : > : - Give a warning and start the oscillator if it was not previously > : > : > : runned. > : > : > : - Rename ds1672 -> rtc to follow the other drivers. > : > : > > : > : > This is a bad change. Please back it out. There are multiple > : > : > different kinds of rtc clocks that can live on i2c. > : > : > > : > : > : > : Why do you want to? We already have ds133x under the same name. In case > : > : if there're multiple clocks in the same systems the first one will > : > : have the name of rtc0, the second - rtc1 and so on. > : > > : > Because you'll want to support a range of boards that might have > : > multiple different kinds of rtc i2c clocks. Calling them all i2c > : > won't work because you can't probe the i2c bus in any meaningful way. > : > the ds133x one, if it is named rtc, is wrong too. > : > > : > : I still don't fully see your point. If you have two different RTCs > : sitting on I2C bus they either have a different address, or they're > : attached to different rtc busses. So you can configure them in a > : usual way via hints. > > You don't see my point, that's right. > > Consider one kernel. Two different boards. Different RTC chips on > each of these boards. Hints loaded from the boot loader. Now, on one > board the ds1672 is used, on the other a ds163x is used. How does the > right driver get attached in that case? > Ah, you're right. I'll revert that change in both drivers. Thanks for clearing this out. - -- Stanislav Sedov ST4096-RIPE -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAknuFk0ACgkQK/VZk+smlYFqWACdEalM/70f8cI7YiSugRFVDrgd oAoAn3Jm5PzpGMj8QfcXZonnNsbEHWhu =ilyh -----END PGP SIGNATURE----- !DSPAM:49ee15d7967005292219314! From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 18:57:47 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D36D2106566C; Tue, 21 Apr 2009 18:57:47 +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 72DD48FC1E; Tue, 21 Apr 2009 18:57:47 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n3LItLFm050758; Tue, 21 Apr 2009 12:55:21 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 21 Apr 2009 12:56:24 -0600 (MDT) Message-Id: <20090421.125624.2069178902.imp@bsdimp.com> To: stas@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090421225404.5c83c32c.stas@FreeBSD.org> References: <20090421223502.507f0dcf.stas@FreeBSD.org> <20090421.123847.70203894.imp@bsdimp.com> <20090421225404.5c83c32c.stas@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191322 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 18:57:48 -0000 In message: <20090421225404.5c83c32c.stas@FreeBSD.org> Stanislav Sedov writes: : -----BEGIN PGP SIGNED MESSAGE----- : Hash: SHA1 : : On Tue, 21 Apr 2009 12:38:47 -0600 (MDT) : "M. Warner Losh" mentioned: : : > In message: <20090421223502.507f0dcf.stas@FreeBSD.org> : > Stanislav Sedov writes: : > : -----BEGIN PGP SIGNED MESSAGE----- : > : Hash: SHA1 : > : : > : On Tue, 21 Apr 2009 12:18:05 -0600 (MDT) : > : "M. Warner Losh" mentioned: : > : : > : > In message: <20090421220138.f6e7b4d4.stas@FreeBSD.org> : > : > Stanislav Sedov writes: : > : > : -----BEGIN PGP SIGNED MESSAGE----- : > : > : Hash: SHA1 : > : > : : > : > : On Tue, 21 Apr 2009 09:25:05 -0600 (MDT) : > : > : "M. Warner Losh" mentioned: : > : > : : > : > : > In message: <200904201547.n3KFl6Z6050834@svn.freebsd.org> : > : > : > Stanislav Sedov writes: : > : > : > : Author: stas : > : > : > : Date: Mon Apr 20 15:47:06 2009 : > : > : > : New Revision: 191322 : > : > : > : URL: http://svn.freebsd.org/changeset/base/191322 : > : > : > : : > : > : > : Log: : > : > : > : - Give a warning and start the oscillator if it was not previously : > : > : > : runned. : > : > : > : - Rename ds1672 -> rtc to follow the other drivers. : > : > : > : > : > : > This is a bad change. Please back it out. There are multiple : > : > : > different kinds of rtc clocks that can live on i2c. : > : > : > : > : > : : > : > : Why do you want to? We already have ds133x under the same name. In case : > : > : if there're multiple clocks in the same systems the first one will : > : > : have the name of rtc0, the second - rtc1 and so on. : > : > : > : > Because you'll want to support a range of boards that might have : > : > multiple different kinds of rtc i2c clocks. Calling them all i2c : > : > won't work because you can't probe the i2c bus in any meaningful way. : > : > the ds133x one, if it is named rtc, is wrong too. : > : > : > : : > : I still don't fully see your point. If you have two different RTCs : > : sitting on I2C bus they either have a different address, or they're : > : attached to different rtc busses. So you can configure them in a : > : usual way via hints. : > : > You don't see my point, that's right. : > : > Consider one kernel. Two different boards. Different RTC chips on : > each of these boards. Hints loaded from the boot loader. Now, on one : > board the ds1672 is used, on the other a ds163x is used. How does the : > right driver get attached in that case? : > : : Ah, you're right. : I'll revert that change in both drivers. : Thanks for clearing this out. Sure, no worries. There may be other ways to solve the cosmetic issue, and I'm open to that... Warner From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 18:58:48 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BE391065670; Tue, 21 Apr 2009 18:58:48 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from semihalf.com (semihalf.com [206.130.101.55]) by mx1.freebsd.org (Postfix) with ESMTP id 1A7058FC20; Tue, 21 Apr 2009 18:58:47 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from mail.semihalf.com (mail.semihalf.com [83.15.139.206]) by semihalf.com (8.13.1/8.13.1) with ESMTP id n3LIwjNB000804; Tue, 21 Apr 2009 12:58:46 -0600 Message-Id: From: Rafal Jaworowski To: "M.Warner Losh" In-Reply-To: <20090421.123847.70203894.imp@bsdimp.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Tue, 21 Apr 2009 20:58:42 +0200 References: <20090421220138.f6e7b4d4.stas@FreeBSD.org> <20090421.121805.-1954387331.imp@bsdimp.com> <20090421223502.507f0dcf.stas@FreeBSD.org> <20090421.123847.70203894.imp@bsdimp.com> X-Mailer: Apple Mail (2.930.3) Cc: stas@FreeBSD.org, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191322 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 18:58:48 -0000 On 2009-04-21, at 20:38, M. Warner Losh wrote: > In message: <20090421223502.507f0dcf.stas@FreeBSD.org> > Stanislav Sedov writes: > : -----BEGIN PGP SIGNED MESSAGE----- > : Hash: SHA1 > : > : On Tue, 21 Apr 2009 12:18:05 -0600 (MDT) > : "M. Warner Losh" mentioned: > : > : > In message: <20090421220138.f6e7b4d4.stas@FreeBSD.org> > : > Stanislav Sedov writes: > : > : -----BEGIN PGP SIGNED MESSAGE----- > : > : Hash: SHA1 > : > : > : > : On Tue, 21 Apr 2009 09:25:05 -0600 (MDT) > : > : "M. Warner Losh" mentioned: > : > : > : > : > In message: <200904201547.n3KFl6Z6050834@svn.freebsd.org> > : > : > Stanislav Sedov writes: > : > : > : Author: stas > : > : > : Date: Mon Apr 20 15:47:06 2009 > : > : > : New Revision: 191322 > : > : > : URL: http://svn.freebsd.org/changeset/base/191322 > : > : > : > : > : > : Log: > : > : > : - Give a warning and start the oscillator if it was not > previously > : > : > : runned. > : > : > : - Rename ds1672 -> rtc to follow the other drivers. > : > : > > : > : > This is a bad change. Please back it out. There are multiple > : > : > different kinds of rtc clocks that can live on i2c. > : > : > > : > : > : > : Why do you want to? We already have ds133x under the same > name. In case > : > : if there're multiple clocks in the same systems the first one > will > : > : have the name of rtc0, the second - rtc1 and so on. > : > > : > Because you'll want to support a range of boards that might have > : > multiple different kinds of rtc i2c clocks. Calling them all i2c > : > won't work because you can't probe the i2c bus in any meaningful > way. > : > the ds133x one, if it is named rtc, is wrong too. > : > > : > : I still don't fully see your point. If you have two different RTCs > : sitting on I2C bus they either have a different address, or they're > : attached to different rtc busses. So you can configure them in a > : usual way via hints. > > You don't see my point, that's right. > > Consider one kernel. Two different boards. Different RTC chips on > each of these boards. Hints loaded from the boot loader. Now, on one > board the ds1672 is used, on the other a ds163x is used. How does the > right driver get attached in that case? If these boards are different, they are supposed to have different dedicated hints; doesn't this solve your concerns? Rafal From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 19:06:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA6971065672; Tue, 21 Apr 2009 19:06:47 +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 A80FA8FC15; Tue, 21 Apr 2009 19:06:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3LJ6ljA019221; Tue, 21 Apr 2009 19:06:47 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3LJ6l16019220; Tue, 21 Apr 2009 19:06:47 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904211906.n3LJ6l16019220@svn.freebsd.org> From: Robert Watson Date: Tue, 21 Apr 2009 19:06: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: r191365 - 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, 21 Apr 2009 19:06:48 -0000 Author: rwatson Date: Tue Apr 21 19:06:47 2009 New Revision: 191365 URL: http://svn.freebsd.org/changeset/base/191365 Log: Acquire the interface address list lock over some iterations over if_addrhead. This closes some reader-writer races associated with the address list. MFC after: 2 weeks Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Apr 21 17:44:46 2009 (r191364) +++ head/sys/net/if.c Tue Apr 21 19:06:47 2009 (r191365) @@ -1249,19 +1249,26 @@ ifa_ifwithaddr(struct sockaddr *addr) struct ifaddr *ifa; IFNET_RLOCK(); - TAILQ_FOREACH(ifp, &V_ifnet, if_link) + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; - if (sa_equal(addr, ifa->ifa_addr)) + if (sa_equal(addr, ifa->ifa_addr)) { + IF_ADDR_UNLOCK(ifp); goto done; + } /* IP6 doesn't have broadcast */ if ((ifp->if_flags & IFF_BROADCAST) && ifa->ifa_broadaddr && ifa->ifa_broadaddr->sa_len != 0 && - sa_equal(ifa->ifa_broadaddr, addr)) + sa_equal(ifa->ifa_broadaddr, addr)) { + IF_ADDR_UNLOCK(ifp); goto done; + } } + IF_ADDR_UNLOCK(ifp); + } ifa = NULL; done: IFNET_RUNLOCK(); @@ -1280,16 +1287,21 @@ ifa_ifwithbroadaddr(struct sockaddr *add struct ifaddr *ifa; IFNET_RLOCK(); - TAILQ_FOREACH(ifp, &V_ifnet, if_link) + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if ((ifp->if_flags & IFF_BROADCAST) && ifa->ifa_broadaddr && ifa->ifa_broadaddr->sa_len != 0 && - sa_equal(ifa->ifa_broadaddr, addr)) + sa_equal(ifa->ifa_broadaddr, addr)) { + IF_ADDR_UNLOCK(ifp); goto done; + } } + IF_ADDR_UNLOCK(ifp); + } ifa = NULL; done: IFNET_RUNLOCK(); @@ -1311,13 +1323,17 @@ ifa_ifwithdstaddr(struct sockaddr *addr) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if ((ifp->if_flags & IFF_POINTOPOINT) == 0) continue; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (ifa->ifa_dstaddr != NULL && - sa_equal(addr, ifa->ifa_dstaddr)) + sa_equal(addr, ifa->ifa_dstaddr)) { + IF_ADDR_UNLOCK(ifp); goto done; + } } + IF_ADDR_UNLOCK(ifp); } ifa = NULL; done: @@ -1355,6 +1371,7 @@ ifa_ifwithnet(struct sockaddr *addr) */ IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { char *cp, *cp2, *cp3; @@ -1370,16 +1387,20 @@ next: continue; * netmask for the remote end. */ if (ifa->ifa_dstaddr != NULL && - sa_equal(addr, ifa->ifa_dstaddr)) + sa_equal(addr, ifa->ifa_dstaddr)) { + IF_ADDR_UNLOCK(ifp); goto done; + } } else { /* * if we have a special address handler, * then use it instead of the generic one. */ if (ifa->ifa_claim_addr) { - if ((*ifa->ifa_claim_addr)(ifa, addr)) + if ((*ifa->ifa_claim_addr)(ifa, addr)) { + IF_ADDR_UNLOCK(ifp); goto done; + } continue; } @@ -1413,6 +1434,7 @@ next: continue; ifa_maybe = ifa; } } + IF_ADDR_UNLOCK(ifp); } ifa = ifa_maybe; done: @@ -1435,6 +1457,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, if (af >= AF_MAX) return (0); + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != af) continue; @@ -1464,6 +1487,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, } ifa = ifa_maybe; done: + IF_ADDR_UNLOCK(ifp); return (ifa); } @@ -2326,6 +2350,7 @@ again: } addrs = 0; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa = ifa->ifa_addr; @@ -2357,6 +2382,7 @@ again: if (!sbuf_overflowed(sb)) valid_len = sbuf_len(sb); } + IF_ADDR_UNLOCK(ifp); if (addrs == 0) { bzero((caddr_t)&ifr.ifr_addr, sizeof(ifr.ifr_addr)); sbuf_bcat(sb, &ifr, sizeof(ifr)); From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 19:08:18 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A87601065679; Tue, 21 Apr 2009 19:08:18 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 608488FC30; Tue, 21 Apr 2009 19:08:18 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 67FD29CB0F0; Tue, 21 Apr 2009 21:07:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mxs+duO08fTc; Tue, 21 Apr 2009 21:06:51 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id A2C309CB110; Tue, 21 Apr 2009 21:06:51 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n3LJ6p15002852; Tue, 21 Apr 2009 21:06:51 +0200 (CEST) (envelope-from rdivacky) Date: Tue, 21 Apr 2009 21:06:51 +0200 From: Roman Divacky To: src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Message-ID: <20090421190651.GA2505@freebsd.org> References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090421185436.GA18628@zim.MIT.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090421185436.GA18628@zim.MIT.EDU> User-Agent: Mutt/1.4.2.3i Cc: Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 19:08:19 -0000 On Tue, Apr 21, 2009 at 02:54:36PM -0400, David Schultz wrote: > On Mon, Apr 20, 2009, Roman Divacky wrote: > > Author: rdivacky > > Date: Mon Apr 20 18:19:38 2009 > > New Revision: 191330 > > URL: http://svn.freebsd.org/changeset/base/191330 > > > > Log: > > Implement highlighting of today in month view of cal/ncal just like > > gnu cal does. This is currently disabled for year view because of hard > > coded padding in that case. This will hopefully be fixed soon. > > As I recall, ncal relies on the length of each line it formats to > take care of alignment issues in various places. Are you sure that > adding control characters doesn't break that? yes, thats why the year printing is disabled (because the highlighting didnt work there) > Also, before this change, ncal was already full of convoluted > buffer handling, arbitrary buffer sizes, and little to no bounds > checking. This commit adds more magic numbers and fragile buffer > handling code, and generally makes an already hairy program even > less scrutable. This isn't your fault, but it would be nice if we > could make ncal better before it gets much worse. For instance, > you might use snprintf() or asprintf() instead of an extra half > dozen calls to memcpy() with various offsets. yes, thats true. do you want me to revert this? I am perfectly fine with having locally modified cal that supports this highlighting and not share this with world at all. From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 19:14:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D873A106566B; Tue, 21 Apr 2009 19:14:13 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C69008FC13; Tue, 21 Apr 2009 19:14:13 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3LJEDvK019390; Tue, 21 Apr 2009 19:14:13 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3LJEDTx019389; Tue, 21 Apr 2009 19:14:13 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200904211914.n3LJEDTx019389@svn.freebsd.org> From: Maksim Yevmenkin Date: Tue, 21 Apr 2009 19:14: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: r191366 - 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, 21 Apr 2009 19:14:14 -0000 Author: emax Date: Tue Apr 21 19:14:13 2009 New Revision: 191366 URL: http://svn.freebsd.org/changeset/base/191366 Log: Fix sbappendrecord_locked(). The main problem is that sbappendrecord_locked() relies on sbcompress() to set sb_mbtail. This will not happen if sbappendrecord_locked() is called with mbuf chain made of exactly one mbuf (i.e. m0->m_next == NULL). In this case sbcompress() will be called with m == NULL and will do nothing. I'm not entirely sure if m == NULL is a valid argument for sbcompress(), and, it rather pointless to call it like that, but keep calling it so it can do SBLASTMBUFCHK(). The problem is triggered by the SOCKBUF_DEBUG kernel option that enables SBLASTRECORDCHK() and SBLASTMBUFCHK() checks. PR: kern/126742 Investigated by: pluknet < pluknet -at- gmail -dot- com > No response from: freebsd-current@, freebsd-bluetooth@ MFC after: 3 days Modified: head/sys/kern/uipc_sockbuf.c Modified: head/sys/kern/uipc_sockbuf.c ============================================================================== --- head/sys/kern/uipc_sockbuf.c Tue Apr 21 19:06:47 2009 (r191365) +++ head/sys/kern/uipc_sockbuf.c Tue Apr 21 19:14:13 2009 (r191366) @@ -577,10 +577,6 @@ sbappendrecord_locked(struct sockbuf *sb if (m0 == 0) return; - m = sb->sb_mb; - if (m) - while (m->m_nextpkt) - m = m->m_nextpkt; /* * Put the first mbuf on the queue. Note this permits zero length * records. @@ -588,16 +584,14 @@ sbappendrecord_locked(struct sockbuf *sb sballoc(sb, m0); SBLASTRECORDCHK(sb); SBLINKRECORD(sb, m0); - if (m) - m->m_nextpkt = m0; - else - sb->sb_mb = m0; + sb->sb_mbtail = m0; m = m0->m_next; m0->m_next = 0; if (m && (m0->m_flags & M_EOR)) { m0->m_flags &= ~M_EOR; m->m_flags |= M_EOR; } + /* always call sbcompress() so it can do SBLASTMBUFCHK() */ sbcompress(sb, m, m0); } From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 19:29:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BBC11065673; Tue, 21 Apr 2009 19:29:54 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout019.mac.com (asmtpout019.mac.com [17.148.16.94]) by mx1.freebsd.org (Postfix) with ESMTP id 829CB8FC12; Tue, 21 Apr 2009 19:29:53 +0000 (UTC) (envelope-from xcllnt@mac.com) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Received: from macbook-pro.jnpr.net ([66.129.224.36]) by asmtp019.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KIG00FZNU5SN370@asmtp019.mac.com>; Tue, 21 Apr 2009 12:29:53 -0700 (PDT) Message-id: <93F1ADEF-9B5D-4855-AB35-91E9687A3512@mac.com> From: Marcel Moolenaar To: Rafal Jaworowski In-reply-to: <2610CF8A-83E5-4CDF-9704-CC1BC1897F7C@semihalf.com> Date: Tue, 21 Apr 2009 12:28:31 -0700 References: <200904211704.n3LH41DN016572@svn.freebsd.org> <2610CF8A-83E5-4CDF-9704-CC1BC1897F7C@semihalf.com> X-Mailer: Apple Mail (2.930.3) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org Subject: Re: svn commit: r191362 - head/sys/powerpc/booke X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 19:29:55 -0000 On Apr 21, 2009, at 11:00 AM, Rafal Jaworowski wrote: > On 2009-04-21, at 19:04, Marcel Moolenaar wrote: > >> o Carve out the first 1MB of physical memory. The MPC85xx has >> DMA problems with addresses below 1MB. Ideally busdma knows >> how to avoid allocating below 1MB for MPC85xx, but that >> requires a bit more work. For now, ignore the 1MB of DRAM. > > Could you elaborate a bit on the last item? What is the faulty > scenario, is this a known h/w defect documented somewhere? Not documented and no indication of a failure from PCI/PCI-X or PCI Express host controllers, nor the device doing the DMA and also not from the coherency engine on the MPC85xx. The only noticeable behaviour is a lack of data transfer by virtue of having unchanged memory after DMA write completion. Observed with MPC8544 PCI, MPC8544 PCI Express and MPC8548 PCI Express. FYI, -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 19:38:48 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E8F6106566B; Tue, 21 Apr 2009 19:38:48 +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 3B3AD8FC13; Tue, 21 Apr 2009 19:38:48 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n3LJaXJ8051512; Tue, 21 Apr 2009 13:36:33 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 21 Apr 2009 13:37:36 -0600 (MDT) Message-Id: <20090421.133736.1374096586.imp@bsdimp.com> To: raj@semihalf.com From: "M. Warner Losh" In-Reply-To: References: <20090421223502.507f0dcf.stas@FreeBSD.org> <20090421.123847.70203894.imp@bsdimp.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: stas@FreeBSD.org, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191322 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 19:38:49 -0000 In message: Rafal Jaworowski writes: : : On 2009-04-21, at 20:38, M. Warner Losh wrote: : : > In message: <20090421223502.507f0dcf.stas@FreeBSD.org> : > Stanislav Sedov writes: : > : -----BEGIN PGP SIGNED MESSAGE----- : > : Hash: SHA1 : > : : > : On Tue, 21 Apr 2009 12:18:05 -0600 (MDT) : > : "M. Warner Losh" mentioned: : > : : > : > In message: <20090421220138.f6e7b4d4.stas@FreeBSD.org> : > : > Stanislav Sedov writes: : > : > : -----BEGIN PGP SIGNED MESSAGE----- : > : > : Hash: SHA1 : > : > : : > : > : On Tue, 21 Apr 2009 09:25:05 -0600 (MDT) : > : > : "M. Warner Losh" mentioned: : > : > : : > : > : > In message: <200904201547.n3KFl6Z6050834@svn.freebsd.org> : > : > : > Stanislav Sedov writes: : > : > : > : Author: stas : > : > : > : Date: Mon Apr 20 15:47:06 2009 : > : > : > : New Revision: 191322 : > : > : > : URL: http://svn.freebsd.org/changeset/base/191322 : > : > : > : : > : > : > : Log: : > : > : > : - Give a warning and start the oscillator if it was not : > previously : > : > : > : runned. : > : > : > : - Rename ds1672 -> rtc to follow the other drivers. : > : > : > : > : > : > This is a bad change. Please back it out. There are multiple : > : > : > different kinds of rtc clocks that can live on i2c. : > : > : > : > : > : : > : > : Why do you want to? We already have ds133x under the same : > name. In case : > : > : if there're multiple clocks in the same systems the first one : > will : > : > : have the name of rtc0, the second - rtc1 and so on. : > : > : > : > Because you'll want to support a range of boards that might have : > : > multiple different kinds of rtc i2c clocks. Calling them all i2c : > : > won't work because you can't probe the i2c bus in any meaningful : > way. : > : > the ds133x one, if it is named rtc, is wrong too. : > : > : > : : > : I still don't fully see your point. If you have two different RTCs : > : sitting on I2C bus they either have a different address, or they're : > : attached to different rtc busses. So you can configure them in a : > : usual way via hints. : > : > You don't see my point, that's right. : > : > Consider one kernel. Two different boards. Different RTC chips on : > each of these boards. Hints loaded from the boot loader. Now, on one : > board the ds1672 is used, on the other a ds163x is used. How does the : > right driver get attached in that case? : : If these boards are different, they are supposed to have different : dedicated hints; doesn't this solve your concerns? I don't think so. If there's two drivers named "rtc" which one gets attached? Warner From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 19:43:08 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D56AE106564A; Tue, 21 Apr 2009 19:43:08 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 904678FC14; Tue, 21 Apr 2009 19:43:08 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n3LJkM8j019253; Tue, 21 Apr 2009 15:46:22 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n3LJkMXF019252; Tue, 21 Apr 2009 15:46:22 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Tue, 21 Apr 2009 15:46:22 -0400 From: David Schultz To: Roman Divacky Message-ID: <20090421194622.GA19215@zim.MIT.EDU> Mail-Followup-To: Roman Divacky , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090421185436.GA18628@zim.MIT.EDU> <20090421190651.GA2505@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090421190651.GA2505@freebsd.org> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 19:43:09 -0000 On Tue, Apr 21, 2009, Roman Divacky wrote: > > Also, before this change, ncal was already full of convoluted > > buffer handling, arbitrary buffer sizes, and little to no bounds > > checking. This commit adds more magic numbers and fragile buffer > > handling code, and generally makes an already hairy program even > > less scrutable. This isn't your fault, but it would be nice if we > > could make ncal better before it gets much worse. For instance, > > you might use snprintf() or asprintf() instead of an extra half > > dozen calls to memcpy() with various offsets. > > yes, thats true. do you want me to revert this? I am perfectly fine > with having locally modified cal that supports this highlighting > and not share this with world at all. I don't care (although some other people on this thread seem to); I'm just encouraging you to clean things up a little before making the code even less maintainable. From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 19:49:09 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FD08106566B; Tue, 21 Apr 2009 19:49:09 +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 688C08FC25; Tue, 21 Apr 2009 19:49:09 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 241C146B06; Tue, 21 Apr 2009 15:49:09 -0400 (EDT) Date: Tue, 21 Apr 2009 20:49:09 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: David Schultz In-Reply-To: <20090421194622.GA19215@zim.MIT.EDU> Message-ID: References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090421185436.GA18628@zim.MIT.EDU> <20090421190651.GA2505@freebsd.org> <20090421194622.GA19215@zim.MIT.EDU> 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, Roman Divacky , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 19:49:10 -0000 On Tue, 21 Apr 2009, David Schultz wrote: > On Tue, Apr 21, 2009, Roman Divacky wrote: >>> Also, before this change, ncal was already full of convoluted buffer >>> handling, arbitrary buffer sizes, and little to no bounds checking. This >>> commit adds more magic numbers and fragile buffer handling code, and >>> generally makes an already hairy program even less scrutable. This isn't >>> your fault, but it would be nice if we could make ncal better before it >>> gets much worse. For instance, you might use snprintf() or asprintf() >>> instead of an extra half dozen calls to memcpy() with various offsets. >> >> yes, thats true. do you want me to revert this? I am perfectly fine with >> having locally modified cal that supports this highlighting and not share >> this with world at all. > > I don't care (although some other people on this thread seem to); I'm just > encouraging you to clean things up a little before making the code even less > maintainable. The usual moral seems to apply: people who make cosmetic changes should expect cosmetic criticisms. If they aren't happy to receive the criticism, they had best refrain from the changes. Likewise modifying style(9), making gratuitous style changes, re-spelling computer science non-words in comments, etc. Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 19:52:20 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: by hub.freebsd.org (Postfix, from userid 1033) id 9C9EF1065672; Tue, 21 Apr 2009 19:52:20 +0000 (UTC) Date: Tue, 21 Apr 2009 19:52:20 +0000 From: Alexey Dokuchaev To: Roman Divacky Message-ID: <20090421195220.GA81212@FreeBSD.org> References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090421185436.GA18628@zim.MIT.EDU> <20090421190651.GA2505@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20090421190651.GA2505@freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 19:52:21 -0000 On Tue, Apr 21, 2009 at 09:06:51PM +0200, Roman Divacky wrote: > On Tue, Apr 21, 2009 at 02:54:36PM -0400, David Schultz wrote: > > Also, before this change, ncal was already full of convoluted > > buffer handling, arbitrary buffer sizes, and little to no bounds > > checking. This commit adds more magic numbers and fragile buffer > > handling code, and generally makes an already hairy program even > > less scrutable. This isn't your fault, but it would be nice if we > > could make ncal better before it gets much worse. For instance, > > you might use snprintf() or asprintf() instead of an extra half > > dozen calls to memcpy() with various offsets. > > yes, thats true. do you want me to revert this? I am perfectly fine > with having locally modified cal that supports this highlighting > and not share this with world at all. As a matter of fact, it might be good idea. Since the code is already in repo, it can be revised later and committed again in its refined form. ./danfe From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 20:24:39 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CED8106566B; Tue, 21 Apr 2009 20:24:39 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 39BA98FC0C; Tue, 21 Apr 2009 20:24:39 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n3LKRswQ019497; Tue, 21 Apr 2009 16:27:54 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n3LKRsM6019496; Tue, 21 Apr 2009 16:27:54 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Tue, 21 Apr 2009 16:27:54 -0400 From: David Schultz To: Robert Watson Message-ID: <20090421202754.GA19417@zim.MIT.EDU> Mail-Followup-To: Robert Watson , Roman Divacky , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090421185436.GA18628@zim.MIT.EDU> <20090421190651.GA2505@freebsd.org> <20090421194622.GA19215@zim.MIT.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: svn-src-head@FreeBSD.ORG, Roman Divacky , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 20:24:40 -0000 On Tue, Apr 21, 2009, Robert Watson wrote: > On Tue, 21 Apr 2009, David Schultz wrote: > > >On Tue, Apr 21, 2009, Roman Divacky wrote: > >>>Also, before this change, ncal was already full of convoluted buffer > >>>handling, arbitrary buffer sizes, and little to no bounds checking. This > >>>commit adds more magic numbers and fragile buffer handling code, and > >>>generally makes an already hairy program even less scrutable. This isn't > >>>your fault, but it would be nice if we could make ncal better before it > >>>gets much worse. For instance, you might use snprintf() or asprintf() > >>>instead of an extra half dozen calls to memcpy() with various offsets. > >> > >>yes, thats true. do you want me to revert this? I am perfectly fine with > >>having locally modified cal that supports this highlighting and not share > >>this with world at all. > > > >I don't care (although some other people on this thread seem to); I'm just > >encouraging you to clean things up a little before making the code even > >less maintainable. > > The usual moral seems to apply: people who make cosmetic changes should > expect cosmetic criticisms. If they aren't happy to receive the criticism, > they had best refrain from the changes. Likewise modifying style(9), > making gratuitous style changes, re-spelling computer science non-words in > comments, etc. My criticism is somewhat more than cosmetic. When I fixed the multibyte handling in ncal, I fixed several buffer overflows in the process. The recent cosmetic change adds 68 lines of code, several of which look like the following: + memcpy(mlines->lines[i] + k + l + dw, term_e, + strlen(term_e)); To even understand this, you have to figure out what i, k, l, and dw refer to, and good luck trying to convince yourself that the call doesn't overflow lines[]. (Roman's argument appears to be, ``We'll just increase the buffer size from 28 to 64 and assume that's enough,'' which is probably correct but a tad sloppy.) On the other hand, I don't mean to blame Roman or insist that he fix it. When I last touched ncal, I didn't have enough time to fix all of these things either. In fact, I only converted about half of it to support multibyte month names and so forth, and strictly speaking it should use wide character output routines exclusively. From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 20:32:34 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E21BD1065697; Tue, 21 Apr 2009 20:32:34 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 6BF798FC18; Tue, 21 Apr 2009 20:32:33 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 6ED9A9CB0A7; Tue, 21 Apr 2009 22:31:18 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g5Cv5KaOP61B; Tue, 21 Apr 2009 22:31:06 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 7A2D79CB112; Tue, 21 Apr 2009 22:31:06 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n3LKV6cV014293; Tue, 21 Apr 2009 22:31:06 +0200 (CEST) (envelope-from rdivacky) Date: Tue, 21 Apr 2009 22:31:06 +0200 From: Roman Divacky To: Robert Watson , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Message-ID: <20090421203106.GA13661@freebsd.org> References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090421185436.GA18628@zim.MIT.EDU> <20090421190651.GA2505@freebsd.org> <20090421194622.GA19215@zim.MIT.EDU> <20090421202754.GA19417@zim.MIT.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090421202754.GA19417@zim.MIT.EDU> User-Agent: Mutt/1.4.2.3i Cc: Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 21 Apr 2009 20:32:35 -0000 On Tue, Apr 21, 2009 at 04:27:54PM -0400, David Schultz wrote: > On Tue, Apr 21, 2009, Robert Watson wrote: > > On Tue, 21 Apr 2009, David Schultz wrote: > > > > >On Tue, Apr 21, 2009, Roman Divacky wrote: > > >>>Also, before this change, ncal was already full of convoluted buffer > > >>>handling, arbitrary buffer sizes, and little to no bounds checking. This > > >>>commit adds more magic numbers and fragile buffer handling code, and > > >>>generally makes an already hairy program even less scrutable. This isn't > > >>>your fault, but it would be nice if we could make ncal better before it > > >>>gets much worse. For instance, you might use snprintf() or asprintf() > > >>>instead of an extra half dozen calls to memcpy() with various offsets. > > >> > > >>yes, thats true. do you want me to revert this? I am perfectly fine with > > >>having locally modified cal that supports this highlighting and not share > > >>this with world at all. > > > > > >I don't care (although some other people on this thread seem to); I'm just > > >encouraging you to clean things up a little before making the code even > > >less maintainable. > > > > The usual moral seems to apply: people who make cosmetic changes should > > expect cosmetic criticisms. If they aren't happy to receive the criticism, > > they had best refrain from the changes. Likewise modifying style(9), > > making gratuitous style changes, re-spelling computer science non-words in > > comments, etc. > > My criticism is somewhat more than cosmetic. When I fixed the > multibyte handling in ncal, I fixed several buffer overflows in > the process. The recent cosmetic change adds 68 lines of code, > several of which look like the following: there were complains about your change being incorrect which you ignored. (iirc you ignored mails from Christoph Mallon and I had to forward it to you) > + memcpy(mlines->lines[i] + k + l + dw, term_e, > + strlen(term_e)); > > To even understand this, you have to figure out what i, k, l, and > dw refer to, and good luck trying to convince yourself that the > call doesn't overflow lines[]. (Roman's argument appears to be, > ``We'll just increase the buffer size from 28 to 64 and assume > that's enough,'' which is probably correct but a tad sloppy.) yes, it's fragile, ugly and bad.... the whole code of cal should be rewritten but frankly... program for displaying calendar is not worth the time of anyone but undergrad doing his homework > On the other hand, I don't mean to blame Roman or insist that he > fix it. When I last touched ncal, I didn't have enough time to fix > all of these things either. In fact, I only converted about half > of it to support multibyte month names and so forth, and strictly > speaking it should use wide character output routines exclusively. feel free to work on it, or anyone else. I wanted to see what day is today when I am filling in my job reports. I got this and I dont care anymore about cal... roman From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 20:56:35 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20BDE1065687 for ; Tue, 21 Apr 2009 20:56:35 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id C3EAE8FC1D for ; Tue, 21 Apr 2009 20:56:34 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id D3F688FC51 for ; Wed, 22 Apr 2009 00:56:33 +0400 (MSD) Received: from orion.SpringDaemons.com (unknown [77.232.3.143]) by mx0.deglitch.com (Postfix) with ESMTPA id 2846C8FC18; Wed, 22 Apr 2009 00:56:31 +0400 (MSD) Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id 4F7B039827; Wed, 22 Apr 2009 00:56:35 +0400 (MSD) Date: Wed, 22 Apr 2009 00:56:35 +0400 From: Stanislav Sedov To: "M. Warner Losh" Message-Id: <20090422005635.6cd247dc.stas@FreeBSD.org> In-Reply-To: <20090421.125624.2069178902.imp@bsdimp.com> References: <20090421223502.507f0dcf.stas@FreeBSD.org> <20090421.123847.70203894.imp@bsdimp.com> <20090421225404.5c83c32c.stas@FreeBSD.org> <20090421.125624.2069178902.imp@bsdimp.com> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Innocent X-DSPAM-Processed: Wed Apr 22 00:56:33 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 49ee3301967006302285686 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191322 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 20:56:35 -0000 On Tue, 21 Apr 2009 12:56:24 -0600 (MDT) "M. Warner Losh" mentioned: > > Sure, no worries. There may be other ways to solve the cosmetic > issue, and I'm open to that... > What about ds1672_rtc and ds133x_rtc respectively? -- Stanislav Sedov ST4096-RIPE !DSPAM:49ee3301967006302285686! From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 21:45:47 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02D311065674; Tue, 21 Apr 2009 21:45:47 +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 9BD0F8FC18; Tue, 21 Apr 2009 21:45:46 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n3LLffjs053077; Tue, 21 Apr 2009 15:41:41 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 21 Apr 2009 15:42:44 -0600 (MDT) Message-Id: <20090421.154244.372566414.imp@bsdimp.com> To: stas@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090422005635.6cd247dc.stas@FreeBSD.org> References: <20090421225404.5c83c32c.stas@FreeBSD.org> <20090421.125624.2069178902.imp@bsdimp.com> <20090422005635.6cd247dc.stas@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191322 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 21:45:47 -0000 In message: <20090422005635.6cd247dc.stas@FreeBSD.org> Stanislav Sedov writes: : On Tue, 21 Apr 2009 12:56:24 -0600 (MDT) : "M. Warner Losh" mentioned: : : > : > Sure, no worries. There may be other ways to solve the cosmetic : > issue, and I'm open to that... : > : : What about ds1672_rtc and ds133x_rtc respectively? Works for me. Warner From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 22:43:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7FD8106564A; Tue, 21 Apr 2009 22:43:32 +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 CAC3E8FC1A; Tue, 21 Apr 2009 22:43:32 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3LMhWDs027011; Tue, 21 Apr 2009 22:43:32 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3LMhW48027008; Tue, 21 Apr 2009 22:43:32 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904212243.n3LMhW48027008@svn.freebsd.org> From: Robert Watson Date: Tue, 21 Apr 2009 22:43: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: r191367 - 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, 21 Apr 2009 22:43:33 -0000 Author: rwatson Date: Tue Apr 21 22:43:32 2009 New Revision: 191367 URL: http://svn.freebsd.org/changeset/base/191367 Log: Start to address a number of races relating to use of ifnet pointers after the corresponding interface has been destroyed: (1) Add an ifnet refcount, ifp->if_refcount. Initialize it to 1 in if_alloc(), and modify if_free_type() to decrement and check the refcount. (2) Add new if_ref() and if_rele() interfaces to allow kernel code walking global interface lists to release IFNET_[RW]LOCK() yet keep the ifnet stable. Currently, if_rele() is a no-op wrapper around if_free(), but this may change in the future. (3) Add new ifnet field, if_alloctype, which caches the type passed to if_alloc(), but unlike if_type, won't be changed by drivers. This allows asynchronous free's of the interface after the driver has released it to still use the right type. Use that instead of the type passed to if_free_type(), but assert that they are the same (might have to rethink this if that doesn't work out). (4) Add a new ifnet_byindex_ref(), which looks up an interface by index and returns a reference rather than a pointer to it. (5) Fix if_alloc() to fully initialize the if_addr_mtx before hooking up the ifnet to global lists. (6) Modify sysctls in if_mib.c to use ifnet_byindex_ref() and release the ifnet when done. When this change is MFC'd, it will need to replace if_ispare fields rather than adding new fields in order to avoid breaking the binary interface. Once this change is MFC'd, if_free_type() should be removed, as its 'type' argument is now optional. This refcount is not appropriate for counting mbuf pkthdr references, and also not for counting entry into the device driver via ifnet function pointers. An rmlock may be appropriate for the latter. Rather, this is about ensuring data structure stability when reaching an ifnet via global ifnet lists and tables followed by copy in or out of userspace. MFC after: 3 weeks Reported by: mdtancsa Reviewed by: brooks Modified: head/sys/net/if.c head/sys/net/if_mib.c head/sys/net/if_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Apr 21 19:14:13 2009 (r191366) +++ head/sys/net/if.c Tue Apr 21 22:43:32 2009 (r191367) @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -204,19 +205,35 @@ static struct ifnet * ifnet_byindex_locked(u_short idx) { INIT_VNET_NET(curvnet); + + if (idx > V_if_index) + return (NULL); + return (V_ifindex_table[idx].ife_ifnet); +} + +struct ifnet * +ifnet_byindex(u_short idx) +{ struct ifnet *ifp; - ifp = V_ifindex_table[idx].ife_ifnet; + IFNET_RLOCK(); + ifp = ifnet_byindex_locked(idx); + IFNET_RUNLOCK(); return (ifp); } struct ifnet * -ifnet_byindex(u_short idx) +ifnet_byindex_ref(u_short idx) { struct ifnet *ifp; IFNET_RLOCK(); ifp = ifnet_byindex_locked(idx); + if (ifp == NULL) { + IFNET_RUNLOCK(); + return (NULL); + } + if_ref(ifp); IFNET_RUNLOCK(); return (ifp); } @@ -490,6 +507,7 @@ if_alloc(u_char type) if_grow(); ifp->if_type = type; + ifp->if_alloctype = type; if (if_com_alloc[type] != NULL) { ifp->if_l2com = if_com_alloc[type](type, ifp); @@ -498,11 +516,12 @@ if_alloc(u_char type) return (NULL); } } + + IF_ADDR_LOCK_INIT(ifp); + refcount_init(&ifp->if_refcount, 1); /* Index reference. */ IFNET_WLOCK(); ifnet_setbyindex(ifp->if_index, ifp); IFNET_WUNLOCK(); - IF_ADDR_LOCK_INIT(ifp); - return (ifp); } @@ -516,7 +535,7 @@ void if_free(struct ifnet *ifp) { - if_free_type(ifp, ifp->if_type); + if_free_type(ifp, ifp->if_alloctype); } /* @@ -529,28 +548,50 @@ if_free_type(struct ifnet *ifp, u_char t { INIT_VNET_NET(curvnet); /* ifp->if_vnet can be NULL here ! */ - if (ifp != ifnet_byindex(ifp->if_index)) { - if_printf(ifp, "%s: value was not if_alloced, skipping\n", - __func__); + /* + * Some drivers modify if_type, so we can't rely on it being the + * same in free as it was in alloc. Now that we have if_alloctype, + * we should just use that, but drivers expect to pass a type. + */ + KASSERT(ifp->if_alloctype == type, + ("if_free_type: type (%d) != alloctype (%d)", type, + ifp->if_alloctype)); + + if (!refcount_release(&ifp->if_refcount)) return; - } IFNET_WLOCK(); + KASSERT(ifp == ifnet_byindex_locked(ifp->if_index), + ("%s: freeing unallocated ifnet", ifp->if_xname)); ifnet_setbyindex(ifp->if_index, NULL); - - /* XXX: should be locked with if_findindex() */ while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL) V_if_index--; IFNET_WUNLOCK(); - if (if_com_free[type] != NULL) - if_com_free[type](ifp->if_l2com, type); + if (if_com_free[ifp->if_alloctype] != NULL) + if_com_free[ifp->if_alloctype](ifp->if_l2com, + ifp->if_alloctype); IF_ADDR_LOCK_DESTROY(ifp); free(ifp, M_IFNET); } void +if_ref(struct ifnet *ifp) +{ + + /* We don't assert the ifnet list lock here, but arguably should. */ + refcount_acquire(&ifp->if_refcount); +} + +void +if_rele(struct ifnet *ifp) +{ + + if_free(ifp); +} + +void ifq_attach(struct ifaltq *ifq, struct ifnet *ifp) { Modified: head/sys/net/if_mib.c ============================================================================== --- head/sys/net/if_mib.c Tue Apr 21 19:14:13 2009 (r191366) +++ head/sys/net/if_mib.c Tue Apr 21 22:43:32 2009 (r191367) @@ -88,16 +88,16 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XX if (namelen != 2) return EINVAL; - - if (name[0] <= 0 || name[0] > V_if_index || - ifnet_byindex(name[0]) == NULL) - return ENOENT; - - ifp = ifnet_byindex(name[0]); + if (name[0] <= 0) + return (ENOENT); + ifp = ifnet_byindex_ref(name[0]); + if (ifp == NULL) + return (ENOENT); switch(name[1]) { default: - return ENOENT; + error = ENOENT; + goto out; case IFDATA_GENERAL: bzero(&ifmd, sizeof(ifmd)); @@ -114,11 +114,11 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XX error = SYSCTL_OUT(req, &ifmd, sizeof ifmd); if (error || !req->newptr) - return error; + goto out; error = SYSCTL_IN(req, &ifmd, sizeof ifmd); if (error) - return error; + goto out; #define DONTCOPY(fld) ifmd.ifmd_data.ifi_##fld = ifp->if_data.ifi_##fld DONTCOPY(type); @@ -139,18 +139,20 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XX case IFDATA_LINKSPECIFIC: error = SYSCTL_OUT(req, ifp->if_linkmib, ifp->if_linkmiblen); if (error || !req->newptr) - return error; + goto out; error = SYSCTL_IN(req, ifp->if_linkmib, ifp->if_linkmiblen); if (error) - return error; + goto out; break; case IFDATA_DRIVERNAME: /* 20 is enough for 64bit ints */ dlen = strlen(ifp->if_dname) + 20 + 1; - if ((dbuf = malloc(dlen, M_TEMP, M_NOWAIT)) == NULL) - return (ENOMEM); + if ((dbuf = malloc(dlen, M_TEMP, M_NOWAIT)) == NULL) { + error = ENOMEM; + goto out; + } if (ifp->if_dunit == IF_DUNIT_NONE) strcpy(dbuf, ifp->if_dname); else @@ -160,9 +162,11 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XX if (error == 0 && req->newptr != NULL) error = EPERM; free(dbuf, M_TEMP); - return (error); + goto out; } - return 0; +out: + if_rele(ifp); + return error; } SYSCTL_NODE(_net_link_generic, IFMIB_IFDATA, ifdata, CTLFLAG_RW, Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Tue Apr 21 19:14:13 2009 (r191366) +++ head/sys/net/if_var.h Tue Apr 21 22:43:32 2009 (r191367) @@ -121,6 +121,7 @@ struct ifnet { char if_xname[IFNAMSIZ]; /* external name (name + unit) */ const char *if_dname; /* driver name */ int if_dunit; /* unit or IF_DUNIT_NONE */ + u_int if_refcount; /* reference count */ struct ifaddrhead if_addrhead; /* linked list of addresses per if */ /* * if_addrhead is the list of all addresses associated to @@ -190,12 +191,14 @@ struct ifnet { /* protected by if_addr_mtx */ void *if_pf_kif; void *if_lagg; /* lagg glue */ + u_char if_alloctype; /* if_type at time of allocation */ /* * Spare fields are added so that we can modify sensitive data * structures without changing the kernel binary interface, and must * be used with care where binary compatibility is required. */ + char if_cspare[3]; void *if_pspare[8]; int if_ispare[4]; }; @@ -721,7 +724,13 @@ struct ifindex_entry { struct cdev *ife_dev; }; +/* + * Look up an ifnet given its index; the _ref variant also acquires a + * reference that must be freed using if_rele(). It is almost always a bug + * to call ifnet_byindex() instead if ifnet_byindex_ref(). + */ struct ifnet *ifnet_byindex(u_short idx); +struct ifnet *ifnet_byindex_ref(u_short idx); /* * Given the index, ifaddr_byindex() returns the one and only @@ -758,6 +767,8 @@ void if_initname(struct ifnet *, const c void if_link_state_change(struct ifnet *, int); int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); void if_qflush(struct ifnet *); +void if_ref(struct ifnet *); +void if_rele(struct ifnet *); int if_setlladdr(struct ifnet *, const u_char *, int); void if_up(struct ifnet *); /*void ifinit(void);*/ /* declared in systm.h for main() */ From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 22:47:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33F23106568A; Tue, 21 Apr 2009 22:47:35 +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 221E68FC16; Tue, 21 Apr 2009 22:47:35 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3LMlZV9027348; Tue, 21 Apr 2009 22:47:35 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3LMlZhb027347; Tue, 21 Apr 2009 22:47:35 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904212247.n3LMlZhb027347@svn.freebsd.org> From: Robert Watson Date: Tue, 21 Apr 2009 22:47: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: r191368 - 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: Tue, 21 Apr 2009 22:47:35 -0000 Author: rwatson Date: Tue Apr 21 22:47:34 2009 New Revision: 191368 URL: http://svn.freebsd.org/changeset/base/191368 Log: Bump __FreeBSD_version to 800082 to reflect the addition of if_refcount, if_ref(), and if_rele(). MFC after: 3 weeks Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Apr 21 22:43:32 2009 (r191367) +++ head/sys/sys/param.h Tue Apr 21 22:47:34 2009 (r191368) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800081 /* Master, propagated to newvers */ +#define __FreeBSD_version 800082 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-head@FreeBSD.ORG Tue Apr 21 22:48:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07AB5106564A; Tue, 21 Apr 2009 22:48:13 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEFFD8FC1D; Tue, 21 Apr 2009 22:48:12 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3LMmCaJ027437; Tue, 21 Apr 2009 22:48:12 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3LMmCbu027432; Tue, 21 Apr 2009 22:48:12 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200904212248.n3LMmCbu027432@svn.freebsd.org> From: Stanislav Sedov Date: Tue, 21 Apr 2009 22:48: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: r191369 - in head/sys: arm/conf 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: Tue, 21 Apr 2009 22:48:13 -0000 Author: stas Date: Tue Apr 21 22:48:12 2009 New Revision: 191369 URL: http://svn.freebsd.org/changeset/base/191369 Log: - Rename ds1672 and ds133x devices to "ds1672_rtc" and "ds133x_rtc" respectivly. This will allow one to have a kernel with both devices present and use it for multiple boards with different types of RTC sitting on a bus. Discussed with: imp Modified: head/sys/arm/conf/AVILA.hints head/sys/arm/conf/BWCT.hints head/sys/arm/conf/CAMBRIA.hints head/sys/dev/iicbus/ds133x.c head/sys/dev/iicbus/ds1672.c Modified: head/sys/arm/conf/AVILA.hints ============================================================================== --- head/sys/arm/conf/AVILA.hints Tue Apr 21 22:47:34 2009 (r191368) +++ head/sys/arm/conf/AVILA.hints Tue Apr 21 22:48:12 2009 (r191369) @@ -44,5 +44,5 @@ hint.ad7418.0.at="iicbus0" hint.ad7418.0.addr=0x50 # Dallas Semiconductor DS1672 RTC -hint.rtc.0.at="iicbus0" -hint.rtc.0.addr=0xd0 +hint.ds1672_rtc.0.at="iicbus0" +hint.ds1672_rtc.0.addr=0xd0 Modified: head/sys/arm/conf/BWCT.hints ============================================================================== --- head/sys/arm/conf/BWCT.hints Tue Apr 21 22:47:34 2009 (r191368) +++ head/sys/arm/conf/BWCT.hints Tue Apr 21 22:48:12 2009 (r191369) @@ -1,8 +1,8 @@ # $FreeBSD$ # Dallas Semiconductor DS1672 RTC sitting on the I2C bus -hint.rtc.0.at="iicbus0" -hint.rtc.0.addr=0xd0 +hint.ds1672_rtc.0.at="iicbus0" +hint.ds1672_rtc.0.addr=0xd0 # NAtional Semiconductor LM75 temperature sensor sitting on the I2C bus hint.lm75.0.at="iicbus0" Modified: head/sys/arm/conf/CAMBRIA.hints ============================================================================== --- head/sys/arm/conf/CAMBRIA.hints Tue Apr 21 22:47:34 2009 (r191368) +++ head/sys/arm/conf/CAMBRIA.hints Tue Apr 21 22:48:12 2009 (r191369) @@ -46,8 +46,8 @@ hint.ad7418.0.at="iicbus0" hint.ad7418.0.addr=0x50 # Dallas Semiconductor DS1672 RTC -hint.rtc.0.at="iicbus0" -hint.rtc.0.addr=0xd0 +hint.ds1672_rtc.0.at="iicbus0" +hint.ds1672_rtc.0.addr=0xd0 # USB is part of the chip hint.ehci.0.at="ixp0" Modified: head/sys/dev/iicbus/ds133x.c ============================================================================== --- head/sys/dev/iicbus/ds133x.c Tue Apr 21 22:47:34 2009 (r191368) +++ head/sys/dev/iicbus/ds133x.c Tue Apr 21 22:48:12 2009 (r191369) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" #include "clock_if.h" -#define DS133X_DEVNAME "rtc" +#define DS133X_DEVNAME "ds133x_rtc" #define DS133X_ADDR 0xd0 /* slave address */ #define DS133X_DATE_REG 0x0 Modified: head/sys/dev/iicbus/ds1672.c ============================================================================== --- head/sys/dev/iicbus/ds1672.c Tue Apr 21 22:47:34 2009 (r191368) +++ head/sys/dev/iicbus/ds1672.c Tue Apr 21 22:48:12 2009 (r191369) @@ -171,7 +171,7 @@ static device_method_t ds1672_methods[] }; static driver_t ds1672_driver = { - "rtc", + "ds1672_rtc", ds1672_methods, sizeof(struct ds1672_softc), }; From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 00:06:04 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCA4E106566B; Wed, 22 Apr 2009 00:06:04 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from raven.bwct.de (raven.bwct.de [85.159.14.73]) by mx1.freebsd.org (Postfix) with ESMTP id 286848FC19; Wed, 22 Apr 2009 00:06:03 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from cicely5.cicely.de ([10.1.1.7]) by raven.bwct.de (8.13.4/8.13.4) with ESMTP id n3LNpMX5059073 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 22 Apr 2009 01:51:22 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (cicely7.cicely.de [10.1.1.9]) by cicely5.cicely.de (8.14.2/8.14.2) with ESMTP id n3LNpBvb049554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 22 Apr 2009 01:51:11 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (localhost [127.0.0.1]) by cicely7.cicely.de (8.14.2/8.14.2) with ESMTP id n3LNpBAh033273; Wed, 22 Apr 2009 01:51:11 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.14.2/8.14.2/Submit) id n3LNpAle033272; Wed, 22 Apr 2009 01:51:10 +0200 (CEST) (envelope-from ticso) Date: Wed, 22 Apr 2009 01:51:10 +0200 From: Bernd Walter To: Rafal Jaworowski Message-ID: <20090421235110.GI31402@cicely7.cicely.de> References: <20090421220138.f6e7b4d4.stas@FreeBSD.org> <20090421.121805.-1954387331.imp@bsdimp.com> <20090421223502.507f0dcf.stas@FreeBSD.org> <20090421.123847.70203894.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD cicely7.cicely.de 7.0-STABLE i386 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED=-1.8, AWL=0.002, BAYES_00=-2.599 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on spamd.cicely.de Cc: stas@FreeBSD.org, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "M.Warner Losh" Subject: Re: svn commit: r191322 - in head/sys: arm/conf dev/iicbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ticso@cicely.de List-Id: 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, 22 Apr 2009 00:06:05 -0000 On Tue, Apr 21, 2009 at 08:58:42PM +0200, Rafal Jaworowski wrote: > On 2009-04-21, at 20:38, M. Warner Losh wrote: > >In message: <20090421223502.507f0dcf.stas@FreeBSD.org> > > > >Consider one kernel. Two different boards. Different RTC chips on > >each of these boards. Hints loaded from the boot loader. Now, on one > >board the ds1672 is used, on the other a ds163x is used. How does the > >right driver get attached in that case? > > If these boards are different, they are supposed to have different > dedicated hints; doesn't this solve your concerns? For the same reason we have hint.ed.0 hint.le.0 ... And not just hint.eth.0 Each driver needs its own private hints. You can have a kernel compiled with multiple rtc to support a board family and just tune the hint for a specific board. This is embedded stuff, people might want to use board X and add another rtc. e.g. the BWCT board has a DS1672, but also an iic header. For whatever reason someone might want another rtc and simply adds one to the iic header. Say that this person has multiple boards in use - some with the special rtc and the others not. You can as easily add a DS1672 to a normal PC if the onboard rtc isn't sufficient for your need. -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm. From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 01:25:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D5501065673; Wed, 22 Apr 2009 01:25:04 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.232]) by mx1.freebsd.org (Postfix) with ESMTP id BF4B48FC0A; Wed, 22 Apr 2009 01:25:03 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: by rv-out-0506.google.com with SMTP id k40so1309258rvb.43 for ; Tue, 21 Apr 2009 18:25:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=y/IMSkxk5Kiapl4vaa/TdydbuWC1LgmYczyybzjy+WQ=; b=QfWb2SxETRz/Y9Jvi2q56JUU+CAMRiJkqbqWDanEldXcU6dq21BXh16lqdgcm5O/Fh LmTVgqI6Lh5qlCF6SxvG1Q9jyvLETezMvcRr+5PV2fjfJwD+d9FaMneFAEEzWnD6VPto WttfBY3ZlmbYxLiWps+H/hjWc/lFDC11hbiR8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=jtQscjL2NDHbnJiP/nlvoVcTxbJcmjvlm0JOO1r2lLEarI/0m7kgNvpBP8X+aCnZyu 5k/kwzjq2q9my2zvMSDWOrIZCL+pTpXpuAfO3tSGsTvlC2JJ5iIY4SvnUP7D70BZdBip xne9BS32v1QuScaUc1VEcBcID7123rUBTIY7A= Received: by 10.141.122.1 with SMTP id z1mr3076241rvm.210.1240361721087; Tue, 21 Apr 2009 17:55:21 -0700 (PDT) Received: from michelle.cdnetworks.co.kr ([114.111.62.249]) by mx.google.com with ESMTPS id k41sm8177634rvb.46.2009.04.21.17.55.18 (version=SSLv3 cipher=RC4-MD5); Tue, 21 Apr 2009 17:55:19 -0700 (PDT) Received: by michelle.cdnetworks.co.kr (sSMTP sendmail emulation); Wed, 22 Apr 2009 09:59:12 +0900 From: Pyun YongHyeon Date: Wed, 22 Apr 2009 09:59:12 +0900 To: Robert Watson Message-ID: <20090422005912.GG93322@michelle.cdnetworks.co.kr> References: <200904210034.n3L0YV9i062814@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, Pyun YongHyeon Subject: Re: svn commit: r191344 - head/sys/dev/xl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: 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, 22 Apr 2009 01:25:04 -0000 On Tue, Apr 21, 2009 at 10:24:07AM +0100, Robert Watson wrote: > > On Tue, 21 Apr 2009, Pyun YongHyeon wrote: > > > Clear IFF_DRV_OACTIVE flag if one of queued packets was transmitted. > > Previously it used to clear the flag only when the transmit queue > > is empty which may slow down Tx performance. > > While I'm here check whether driver is running and whether we can > > queue more packets in if_start handler. This fixes occasional > > watchdog timeouts. > > Historically, IFF_DRV_OACTIVE was present to allow the driver to prevent > calls to if_start when the driver was already in the transmit steady state > (i.e., interrupt-driven transmit). When the transmit interrupt saw it was > out of queued packets and interrupt-driven transmission was ending, it > would clear the flag so that future enqueues to the now-empty queue would > generate an if_start to trigger interrupt-driven transmission again. With > that in mind -- are you sure this is the right change? Shouldn't the Yes. > descriptor ring be refilled when an interrupt comes in from the device > after an appropriate interval? > Since interrupt handler knows that hardware can queue more packets if it reclaimed transmitted frames, clearing IFF_DRV_OACTIVE would make if_start called again. It's also possible this may be waste of time due to lack of free Tx descriptors when sending a highly fragmented frame but most cases it will refill Tx descriptor full. Keeping Tx queue full seems to be one of key factor to get best performance from the hardware. The Tx descriptor counter for xl(4) is 256 which I think somewhat large value for fast-ethernet controllers. I didn't benchmark performance differences after the change but 128 would be enough after my change. From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 06:03:23 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF3271065675; Wed, 22 Apr 2009 06:03:23 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id B9C6B8FC19; Wed, 22 Apr 2009 06:03:23 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n3M66h7m022242; Wed, 22 Apr 2009 02:06:43 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n3M66h6A022241; Wed, 22 Apr 2009 02:06:43 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Wed, 22 Apr 2009 02:06:43 -0400 From: David Schultz To: Roman Divacky Message-ID: <20090422060643.GA22109@zim.MIT.EDU> Mail-Followup-To: Roman Divacky , Robert Watson , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090421185436.GA18628@zim.MIT.EDU> <20090421190651.GA2505@freebsd.org> <20090421194622.GA19215@zim.MIT.EDU> <20090421202754.GA19417@zim.MIT.EDU> <20090421203106.GA13661@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090421203106.GA13661@freebsd.org> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Robert Watson Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 06:03:24 -0000 On Tue, Apr 21, 2009, Roman Divacky wrote: > > On the other hand, I don't mean to blame Roman or insist that he > > fix it. When I last touched ncal, I didn't have enough time to fix > > all of these things either. In fact, I only converted about half > > of it to support multibyte month names and so forth, and strictly > > speaking it should use wide character output routines exclusively. > > feel free to work on it, or anyone else. I wanted to see what day is > today when I am filling in my job reports. I got this and I dont care > anymore about cal... Things in our tree get into this sort of state because over the years, a dozen different people decide to add "one more feature" and don't care enough to do a good job. I'm not suggesting that you rewrite it from scratch, but when you've got 4 indices i, j, k, and l, one of which isn't even an index even though it is documented as such, and a bunch of inscrutable code that has been cut and paste in at least two places, it seems like it's time to step back and ask if there's a simpler way to do things. For instance, it seems like the following would accomplish what you intended in 1/3 as many lines of new code. (FWIW, I don't have time to mess around with this either; I hacked this together in 5 minutes and haven't tested it much.) Index: ncal.c =================================================================== --- ncal.c (revision 191369) +++ ncal.c (working copy) @@ -207,7 +207,7 @@ time_t t; struct tm *tm1; - term_e = term_r = NULL; + term_e = term_r = ""; today = 0; if (isatty(STDOUT_FILENO) && tgetent(tbuf, NULL) == 1) { date dt; /* handy date */ @@ -272,7 +272,7 @@ flag_julian_cal = 1; break; case 'h': - term_r = term_e = NULL; + term_r = term_e = ""; break; case 'e': if (flag_backward) @@ -621,7 +621,7 @@ int dw; /* width of numbers */ int first; /* first day of month */ int firstm; /* first day of first week of month */ - int i, j, k, l; /* just indices */ + int i, j, k; /* just indices */ int last; /* the first day of next month */ int jan1 = 0; /* the first day of this year */ char *ds; /* pointer to day strings (daystr or @@ -666,42 +666,24 @@ /* * Fill the lines with day of month or day of year (julian day) * line index: i, each line is one weekday. column index: j, each - * column is one day number. print column index: k. + * column is one day number. */ for (i = 0; i != 7; i++) { - l = 0; - for (j = firstm + i, k = 0; j < last; j += 7, k += dw) { - if (j == today && (term_r != NULL && term_e != NULL)) { - l = strlen(term_r); - if (jd_flag) - dt.d = j - jan1 + 1; - else - sdateb(j, &dt); - /* separator */ - mlines->lines[i][k] = ' '; - /* the actual text */ - memcpy(mlines->lines[i] + k + l, - ds + dt.d * dw, dw); - /* highlight on */ - memcpy(mlines->lines[i] + k + 1, term_r, l); - /* highlight off */ - memcpy(mlines->lines[i] + k + l + dw, term_e, - strlen(term_e)); - l = strlen(term_e) + strlen(term_r); - continue; - } + mlines->lines[i][0] = '\0'; + for (j = firstm + i; j < last; j += 7) { if (j >= first) { if (jd_flag) dt.d = j - jan1 + 1; else - sdate(j, &dt); - memcpy(mlines->lines[i] + k + l, - ds + dt.d * dw, dw); + sdateb(j, &dt); + if (j == today) + strcat(mlines->lines[i], term_r); + strncat(mlines->lines[i], ds + dt.d * dw, dw); + if (j == today) + strcat(mlines->lines[i], term_e); } else - memcpy(mlines->lines[i] + k + l, " ", dw); + strncat(mlines->lines[i], " ", dw); } - mlines->lines[i][k + l] = '\0'; - } /* fill the weeknumbers */ @@ -726,7 +708,7 @@ int dw; /* width of numbers */ int first; /* first day of month */ int firsts; /* sunday of first week of month */ - int i, j, k, l; /* just indices */ + int i, j, k; /* just indices */ int jan1 = 0; /* the first day of this year */ int last; /* the first day of next month */ char *ds; /* pointer to day strings (daystr or @@ -787,42 +769,21 @@ * column is one day number. print column index: k. */ for (i = 0; i != 6; i++) { - l = 0; - for (j = firsts + 7 * i, k = 0; j < last && k != dw * 7; - j++, k += dw) { - if (j == today && (term_r != NULL && term_e != NULL)) { - l = strlen(term_r); - if (jd_flag) - dt.d = j - jan1 + 1; - else - sdateb(j, &dt); - /* separator */ - mlines->lines[i][k] = ' '; - /* the actual text */ - memcpy(mlines->lines[i] + k + l, - ds + dt.d * dw, dw); - /* highlight on */ - memcpy(mlines->lines[i] + k + 1, term_r, l); - /* highlight off */ - memcpy(mlines->lines[i] + k + l + dw, term_e, - strlen(term_e)); - l = strlen(term_e) + strlen(term_r); - continue; - } + mlines->lines[i][0] = '\0'; + for (j = firsts + 7 * i, k = 0; j < last && k != 7; j++, k++) { if (j >= first) { if (jd_flag) dt.d = j - jan1 + 1; else sdateb(j, &dt); - memcpy(mlines->lines[i] + k + l, - ds + dt.d * dw, dw); + if (j == today) + strcat(mlines->lines[i], term_r); + strncat(mlines->lines[i], ds + dt.d * dw, dw); + if (j == today) + strcat(mlines->lines[i], term_e); } else - memcpy(mlines->lines[i] + k + l, " ", dw); + strncat(mlines->lines[i], " ", dw); } - if (k == 0) - mlines->lines[i][1] = '\0'; - else - mlines->lines[i][k + l] = '\0'; } } From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 06:26:33 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD365106566B; Wed, 22 Apr 2009 06:26:33 +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 79CB98FC1E; Wed, 22 Apr 2009 06:26:33 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n3M6Pdn0073911; Wed, 22 Apr 2009 00:25:39 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 22 Apr 2009 00:26:43 -0600 (MDT) Message-Id: <20090422.002643.639875625.imp@bsdimp.com> To: stas@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <200904212248.n3LMmCbu027432@svn.freebsd.org> References: <200904212248.n3LMmCbu027432@svn.freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191369 - in head/sys: arm/conf 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, 22 Apr 2009 06:26:34 -0000 In message: <200904212248.n3LMmCbu027432@svn.freebsd.org> Stanislav Sedov writes: : Author: stas : Date: Tue Apr 21 22:48:12 2009 : New Revision: 191369 : URL: http://svn.freebsd.org/changeset/base/191369 : : Log: : - Rename ds1672 and ds133x devices to "ds1672_rtc" and "ds133x_rtc" : respectivly. This will allow one to have a kernel with both devices : present and use it for multiple boards with different types of RTC : sitting on a bus. : : Discussed with: imp Hey thanks Stas! Now things are better than before both functionally and cosmetically! Good idea on the names... Warner : Modified: : head/sys/arm/conf/AVILA.hints : head/sys/arm/conf/BWCT.hints : head/sys/arm/conf/CAMBRIA.hints : head/sys/dev/iicbus/ds133x.c : head/sys/dev/iicbus/ds1672.c : : Modified: head/sys/arm/conf/AVILA.hints : ============================================================================== : --- head/sys/arm/conf/AVILA.hints Tue Apr 21 22:47:34 2009 (r191368) : +++ head/sys/arm/conf/AVILA.hints Tue Apr 21 22:48:12 2009 (r191369) : @@ -44,5 +44,5 @@ hint.ad7418.0.at="iicbus0" : hint.ad7418.0.addr=0x50 : : # Dallas Semiconductor DS1672 RTC : -hint.rtc.0.at="iicbus0" : -hint.rtc.0.addr=0xd0 : +hint.ds1672_rtc.0.at="iicbus0" : +hint.ds1672_rtc.0.addr=0xd0 : : Modified: head/sys/arm/conf/BWCT.hints : ============================================================================== : --- head/sys/arm/conf/BWCT.hints Tue Apr 21 22:47:34 2009 (r191368) : +++ head/sys/arm/conf/BWCT.hints Tue Apr 21 22:48:12 2009 (r191369) : @@ -1,8 +1,8 @@ : # $FreeBSD$ : : # Dallas Semiconductor DS1672 RTC sitting on the I2C bus : -hint.rtc.0.at="iicbus0" : -hint.rtc.0.addr=0xd0 : +hint.ds1672_rtc.0.at="iicbus0" : +hint.ds1672_rtc.0.addr=0xd0 : : # NAtional Semiconductor LM75 temperature sensor sitting on the I2C bus : hint.lm75.0.at="iicbus0" : : Modified: head/sys/arm/conf/CAMBRIA.hints : ============================================================================== : --- head/sys/arm/conf/CAMBRIA.hints Tue Apr 21 22:47:34 2009 (r191368) : +++ head/sys/arm/conf/CAMBRIA.hints Tue Apr 21 22:48:12 2009 (r191369) : @@ -46,8 +46,8 @@ hint.ad7418.0.at="iicbus0" : hint.ad7418.0.addr=0x50 : : # Dallas Semiconductor DS1672 RTC : -hint.rtc.0.at="iicbus0" : -hint.rtc.0.addr=0xd0 : +hint.ds1672_rtc.0.at="iicbus0" : +hint.ds1672_rtc.0.addr=0xd0 : : # USB is part of the chip : hint.ehci.0.at="ixp0" : : Modified: head/sys/dev/iicbus/ds133x.c : ============================================================================== : --- head/sys/dev/iicbus/ds133x.c Tue Apr 21 22:47:34 2009 (r191368) : +++ head/sys/dev/iicbus/ds133x.c Tue Apr 21 22:48:12 2009 (r191369) : @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); : #include "iicbus_if.h" : #include "clock_if.h" : : -#define DS133X_DEVNAME "rtc" : +#define DS133X_DEVNAME "ds133x_rtc" : : #define DS133X_ADDR 0xd0 /* slave address */ : #define DS133X_DATE_REG 0x0 : : Modified: head/sys/dev/iicbus/ds1672.c : ============================================================================== : --- head/sys/dev/iicbus/ds1672.c Tue Apr 21 22:47:34 2009 (r191368) : +++ head/sys/dev/iicbus/ds1672.c Tue Apr 21 22:48:12 2009 (r191369) : @@ -171,7 +171,7 @@ static device_method_t ds1672_methods[] : }; : : static driver_t ds1672_driver = { : - "rtc", : + "ds1672_rtc", : ds1672_methods, : sizeof(struct ds1672_softc), : }; : From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 06:30:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 071AC1065677; Wed, 22 Apr 2009 06:30:25 +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 E76088FC15; Wed, 22 Apr 2009 06:30:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3M6UO67045998; Wed, 22 Apr 2009 06:30:24 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3M6UOYv045997; Wed, 22 Apr 2009 06:30:24 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904220630.n3M6UOYv045997@svn.freebsd.org> From: Warner Losh Date: Wed, 22 Apr 2009 06:30:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191370 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 06:30:25 -0000 Author: imp Date: Wed Apr 22 06:30:24 2009 New Revision: 191370 URL: http://svn.freebsd.org/changeset/base/191370 Log: Turns out the code improvements I did for the TC5299J support were anti-improvements and broke support for this part. Revert the part of the improvement at fault. Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Tue Apr 21 22:48:12 2009 (r191369) +++ head/sys/dev/ed/if_ed_pccard.c Wed Apr 22 06:30:24 2009 (r191370) @@ -106,6 +106,8 @@ #include "miibus_if.h" #include "pccarddevs.h" +#define bootverbose 1 + /* * NE-2000 based PC Cards have a number of ways to get the MAC address. * Some cards encode this as a FUNCE. Others have this in the ROMs the @@ -238,6 +240,149 @@ static const struct ed_product { }; /* + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab), + PCMCIA_DEVICE_MANF_CARD(0x0213, 0x2452), + + PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4), + PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), + PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), + PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), + PCMCIA_PFC_DEVICE_PROD_ID12(0, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58), + PCMCIA_PFC_DEVICE_PROD_ID12(0, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), + PCMCIA_PFC_DEVICE_PROD_ID12(0, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f), + PCMCIA_MFC_DEVICE_PROD_ID123(0, "APEX DATA", "MULTICARD", "ETHERNET-MODEM", 0x11c2da09, 0x7289dc5d, 0xaad95e1f), + PCMCIA_MFC_DEVICE_PROD_ID2(0, "FAX/Modem/Ethernet Combo Card ", 0x1ed59302), + PCMCIA_DEVICE_PROD_ID12("2408LAN", "Ethernet", 0x352fff7f, 0x00b2e941), + PCMCIA_DEVICE_PROD_ID1234("Socket", "CF 10/100 Ethernet Card", "Revision B", "05/11/06", 0xb38bcc2e, 0x4de88352, 0xeaca6c8d, 0x7e57c22e), + PCMCIA_DEVICE_PROD_ID123("Cardwell", "PCMCIA", "ETHERNET", 0x9533672e, 0x281f1c5d, 0x3ff7175b), + PCMCIA_DEVICE_PROD_ID123("CNet ", "CN30BC", "ETHERNET", 0x9fe55d3d, 0x85601198, 0x3ff7175b), + PCMCIA_DEVICE_PROD_ID123("Digital", "Ethernet", "Adapter", 0x9999ab35, 0x00b2e941, 0x4b0d829e), + PCMCIA_DEVICE_PROD_ID123("Edimax Technology Inc.", "PCMCIA", "Ethernet Card", 0x738a0019, 0x281f1c5d, 0x5e9d92c0), + PCMCIA_DEVICE_PROD_ID123("EFA ", "EFA207", "ETHERNET", 0x3d294be4, 0xeb9aab6c, 0x3ff7175b), + PCMCIA_DEVICE_PROD_ID123("I-O DATA", "PCLA", "ETHERNET", 0x1d55d7ec, 0xe4c64d34, 0x3ff7175b), + PCMCIA_DEVICE_PROD_ID123("IO DATA", "PCLATE", "ETHERNET", 0x547e66dc, 0x6b260753, 0x3ff7175b), + PCMCIA_DEVICE_PROD_ID123("KingMax Technology Inc.", "EN10-T2", "PCMCIA Ethernet Card", 0x932b7189, 0x699e4436, 0x6f6652e0), + PCMCIA_DEVICE_PROD_ID123("PCMCIA", "PCMCIA-ETHERNET-CARD", "UE2216", 0x281f1c5d, 0xd4cd2f20, 0xb87add82), + PCMCIA_DEVICE_PROD_ID123("PCMCIA", "PCMCIA-ETHERNET-CARD", "UE2620", 0x281f1c5d, 0xd4cd2f20, 0x7d3d83a8), + PCMCIA_DEVICE_PROD_ID1("2412LAN", 0x67f236ab), + PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68), + PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997), + PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8), + PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96), + PCMCIA_DEVICE_PROD_ID12("AmbiCom", "AMB8010", 0x5070a7f9, 0x82f96e96), + PCMCIA_DEVICE_PROD_ID12("AmbiCom", "AMB8610", 0x5070a7f9, 0x86741224), + PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8002", 0x93b15570, 0x75ec3efb), + PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8002T", 0x93b15570, 0x461c5247), + PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8010", 0x93b15570, 0x82f96e96), + PCMCIA_DEVICE_PROD_ID12("AnyCom", "ECO Ethernet", 0x578ba6e7, 0x0a9888c1), + PCMCIA_DEVICE_PROD_ID12("AnyCom", "ECO Ethernet 10/100", 0x578ba6e7, 0x939fedbd), + PCMCIA_DEVICE_PROD_ID12("AROWANA", "PCMCIA Ethernet LAN Card", 0x313adbc8, 0x08d9f190), + PCMCIA_DEVICE_PROD_ID12("ASANTE", "FriendlyNet PC Card", 0x3a7ade0f, 0x41c64504), + PCMCIA_DEVICE_PROD_ID12("Billionton", "LNT-10TB", 0x552ab682, 0xeeb1ba6a), + PCMCIA_DEVICE_PROD_ID12("CF", "10Base-Ethernet", 0x44ebf863, 0x93ae4d79), + PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "BASEline PCMCIA 10 MBit Ethernetadapter", 0xfa2e424d, 0xe9190d8a), + PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "FASTline PCMCIA 10/100 Fast-Ethernet", 0xfa2e424d, 0x3953d9b9), + PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), + PCMCIA_DEVICE_PROD_ID12("Corega,K.K.", "Ethernet LAN Card", 0x110d26d9, 0x9fd2f0a2), + PCMCIA_DEVICE_PROD_ID12("corega,K.K.", "Ethernet LAN Card", 0x9791a90e, 0x9fd2f0a2), + PCMCIA_DEVICE_PROD_ID12("CouplerlessPCMCIA", "100BASE", 0xee5af0ad, 0x7c2add04), + PCMCIA_DEVICE_PROD_ID12("CyQ've", "ELA-110E 10/100M LAN Card", 0x77008979, 0xfd184814), + PCMCIA_DEVICE_PROD_ID12("DataTrek.", "NetCard ", 0x5cd66d9d, 0x84697ce0), + PCMCIA_DEVICE_PROD_ID12("Dayna Communications, Inc.", "CommuniCard E", 0x0c629325, 0xb4e7dbaf), + PCMCIA_DEVICE_PROD_ID12("Digicom", "Palladio LAN 10/100", 0x697403d8, 0xe160b995), + PCMCIA_DEVICE_PROD_ID12("Digicom", "Palladio LAN 10/100 Dongless", 0x697403d8, 0xa6d3b233), + PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9), + PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84), + PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9), + PCMCIA_DEVICE_PROD_ID12("Dynalink", "L10BC", 0x55632fd5, 0xdc65f2b1), + PCMCIA_DEVICE_PROD_ID12("DYNALINK", "L10BC", 0x6a26d1cf, 0xdc65f2b1), + PCMCIA_DEVICE_PROD_ID12("E-CARD", "E-CARD", 0x6701da11, 0x6701da11), + PCMCIA_DEVICE_PROD_ID12("EIGER Labs Inc.", "Ethernet 10BaseT card", 0x53c864c6, 0xedd059f6), + PCMCIA_DEVICE_PROD_ID12("EIGER Labs Inc.", "Ethernet Combo card", 0x53c864c6, 0x929c486c), + PCMCIA_DEVICE_PROD_ID12("Ethernet", "Adapter", 0x00b2e941, 0x4b0d829e), + PCMCIA_DEVICE_PROD_ID12("Ethernet Adapter", "E2000 PCMCIA Ethernet", 0x96767301, 0x71fbbc61), + PCMCIA_DEVICE_PROD_ID12("Ethernet PCMCIA adapter", "EP-210", 0x8dd86181, 0xf2b52517), + PCMCIA_DEVICE_PROD_ID12("Fast Ethernet", "Adapter", 0xb4be14e3, 0x4b0d829e), + PCMCIA_DEVICE_PROD_ID12("Grey Cell", "GCS2000", 0x2a151fac, 0xf00555cb), + PCMCIA_DEVICE_PROD_ID12("Grey Cell", "GCS2220", 0x2a151fac, 0xc1b7e327), + PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947), + PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941), + PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6), + PCMCIA_DEVICE_PROD_ID12("IC-CARD+", "IC-CARD+", 0x93693494, 0x93693494), + PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), + PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), + PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), + PCMCIA_DEVICE_PROD_ID12("KCI", "PE520 PCMCIA Ethernet Adapter", 0xa89b87d3, 0x1eb88e64), + PCMCIA_DEVICE_PROD_ID12("KINGMAX", "EN10T2T", 0x7bcb459a, 0xa5c81fa5), + PCMCIA_DEVICE_PROD_ID12("Kingston", "KNE-PC2", 0x1128e633, 0xce2a89b3), + PCMCIA_DEVICE_PROD_ID12("Kingston Technology Corp.", "EtheRx PC Card Ethernet Adapter", 0x313c7be3, 0x0afb54a2), + PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-10/100CD", 0x1b7827b2, 0xcda71d1c), + PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDF", 0x1b7827b2, 0xfec71e40), + PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDL/T", 0x1b7827b2, 0x79fba4f7), + PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDS", 0x1b7827b2, 0x931afaab), + PCMCIA_DEVICE_PROD_ID12("LEMEL", "LM-N89TX PRO", 0xbbefb52f, 0xd2897a97), + PCMCIA_DEVICE_PROD_ID12("Linksys", "Combo PCMCIA EthernetCard (EC2T)", 0x0733cc81, 0x32ee8c78), + PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d), + PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389), + PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9), + PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline + 10/100 Network PC Card (PCM100H1)", 0x733cc81, 0x7a3e5c3a), + PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737), + PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TE", 0x88fcdeda, 0x0e714bee), + PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922), + PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN10TE", 0x88fcdeda, 0xc1e2521c), + PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0), + PCMCIA_DEVICE_PROD_ID12("MACNICA", "ME1-JEIDA", 0x20841b68, 0xaf8a3578), + PCMCIA_DEVICE_PROD_ID12("Macsense", "MPC-10", 0xd830297f, 0xd265c307), + PCMCIA_DEVICE_PROD_ID12("Matsushita Electric Industrial Co.,LTD.", "CF-VEL211", 0x44445376, 0x8ded41d4), + PCMCIA_DEVICE_PROD_ID12("MAXTECH", "PCN2000", 0x78d64bc0, 0xca0ca4b8), + PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC2-T", 0x481e0094, 0xa2eb0cf3), + PCMCIA_DEVICE_PROD_ID12("Microcom C.E.", "Travel Card LAN 10/100", 0x4b91cec7, 0xe70220d6), + PCMCIA_DEVICE_PROD_ID12("Microdyne", "NE4200", 0x2e6da59b, 0x0478e472), + PCMCIA_DEVICE_PROD_ID12("MIDORI ELEC.", "LT-PCMT", 0x648d55c1, 0xbde526c7), + PCMCIA_DEVICE_PROD_ID12("National Semiconductor", "InfoMover 4100", 0x36e1191f, 0x60c229b9), + PCMCIA_DEVICE_PROD_ID12("National Semiconductor", "InfoMover NE4100", 0x36e1191f, 0xa6617ec8), + PCMCIA_DEVICE_PROD_ID12("Network Everywhere", "Fast Ethernet 10/100 PC Card", 0x820a67b6, 0x31ed1a5f), + PCMCIA_DEVICE_PROD_ID12("NextCom K.K.", "Next Hawk", 0xaedaec74, 0xad050ef1), + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "10/100Mbps Ethernet Card", 0x281f1c5d, 0x6e41773b), + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "ETHERNET", 0x281f1c5d, 0x3ff7175b), + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet 10BaseT Card", 0x281f1c5d, 0x4de2f6c8), + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet Card", 0x281f1c5d, 0x5e9d92c0), + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet Combo card", 0x281f1c5d, 0x929c486c), + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "ETHERNET V1.0", 0x281f1c5d, 0x4d8817c8), + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FastEthernet", 0x281f1c5d, 0xfe871eeb), + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast-Ethernet", 0x281f1c5d, 0x45f1f3b4), + PCMCIA_DEVICE_PROD_ID12("PCMCIA LAN", "Ethernet", 0x7500e246, 0x00b2e941), + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "LNT-10TN", 0x281f1c5d, 0xe707f641), + PCMCIA_DEVICE_PROD_ID12("PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "UE2212", 0x281f1c5d, 0xbf17199b), + PCMCIA_DEVICE_PROD_ID12("PCMCIA", " Ethernet NE2000 Compatible", 0x281f1c5d, 0x42d5d7e1), + PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10baseT 3.3V", 0xebf91155, 0x30074c80), + PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10BaseT 3.3V", 0xebf91155, 0x7f5a4f50), + PCMCIA_DEVICE_PROD_ID12("Psion Dacom", "Gold Card Ethernet", 0xf5f025c2, 0x3a30e110), + PCMCIA_DEVICE_PROD_ID12("=RELIA==", "Ethernet", 0xcdd0644a, 0x00b2e941), + PCMCIA_DEVICE_PROD_ID12("RP", "1625B Ethernet NE2000 Compatible", 0xe3e66e22, 0xb96150df), + PCMCIA_DEVICE_PROD_ID12("RPTI", "EP400 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4a7e2ae0), + PCMCIA_DEVICE_PROD_ID12("RPTI", "EP401 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4bcbd7fd), + PCMCIA_DEVICE_PROD_ID12("RPTI LTD.", "EP400", 0xc53ac515, 0x81e39388), + PCMCIA_DEVICE_PROD_ID12("SCM", "Ethernet Combo card", 0xbdc3b102, 0x929c486c), + PCMCIA_DEVICE_PROD_ID12("Seiko Epson Corp.", "Ethernet", 0x09928730, 0x00b2e941), + PCMCIA_DEVICE_PROD_ID12("SMC", "EZCard-10-PCMCIA", 0xc4f8b18b, 0xfb21d265), + PCMCIA_DEVICE_PROD_ID12("Telecom Device K.K.", "SuperSocket RE450T", 0x466b05f0, 0x8b74bc4f), + PCMCIA_DEVICE_PROD_ID12("Telecom Device K.K.", "SuperSocket RE550T", 0x466b05f0, 0x33c8db2a), + PCMCIA_DEVICE_PROD_ID13("Hypertec", "EP401", 0x8787bec7, 0xf6e4a31e), + PCMCIA_DEVICE_PROD_ID13("KingMax Technology Inc.", "Ethernet Card", 0x932b7189, 0x5e9d92c0), + PCMCIA_DEVICE_PROD_ID13("LONGSHINE", "EP401", 0xf866b0b0, 0xf6e4a31e), + PCMCIA_DEVICE_PROD_ID1("CyQ've 10 Base-T LAN CARD", 0x94faf360), + PCMCIA_DEVICE_PROD_ID1("EP-210 PCMCIA LAN CARD.", 0x8850b4de), + PCMCIA_DEVICE_PROD_ID1("ETHER-C16", 0x06a8514f), + PCMCIA_DEVICE_PROD_ID1("NE2000 Compatible", 0x75b8ad5a), + PCMCIA_DEVICE_PROD_ID2("EN-6200P2", 0xa996d078), + + + PCMCIA_PFC_DEVICE_PROD_ID12(0, "MICRO RESEARCH", "COMBO-L/M-336", 0xb2ced065, 0x3ced0555), + */ + +/* * PC Card (PCMCIA) specific code. */ static int ed_pccard_probe(device_t); @@ -984,11 +1129,16 @@ ed_pccard_tc5299j(device_t dev, const st if (bootverbose) device_printf(dev, "Checking Tc5299j\n"); + error = ed_probe_Novell_generic(dev, device_get_flags(dev)); + if (bootverbose) + device_printf(dev, "probe novel returns %d\n", error); + if (error != 0) + return (error); + /* - * Check to see if we have a MII PHY ID at any of the first 32 - * locations. All TC5299J devices have MII and a PHY, so we use - * this to weed out chips that would otherwise make it through - * the tests we have after this point. + * Check to see if we have a MII PHY ID at any address. All TC5299J + * devices have MII and a PHY, so we use this to weed out chips that + * would otherwise make it through the tests we have after this point. */ sc->mii_readbits = ed_pccard_tc5299j_mii_readbits; sc->mii_writebits = ed_pccard_tc5299j_mii_writebits; @@ -1002,16 +1152,7 @@ ed_pccard_tc5299j(device_t dev, const st sc->mii_writebits = 0; return (ENXIO); } - ts = "TC5299J"; - error = ed_probe_Novell_generic(dev, device_get_flags(dev)); - if (bootverbose) - device_printf(dev, "probe novel returns %d\n", error); - if (error != 0) { - sc->mii_readbits = 0; - sc->mii_writebits = 0; - return (error); - } if (ed_pccard_rom_mac(dev, sc->enaddr) == 0) { sc->mii_readbits = 0; sc->mii_writebits = 0; From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 06:33:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90C8C1065673; Wed, 22 Apr 2009 06:33:27 +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 689E98FC20; Wed, 22 Apr 2009 06:33:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3M6XRpN046096; Wed, 22 Apr 2009 06:33:27 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3M6XRmZ046095; Wed, 22 Apr 2009 06:33:27 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904220633.n3M6XRmZ046095@svn.freebsd.org> From: Warner Losh Date: Wed, 22 Apr 2009 06:33: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: r191371 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 06:33:28 -0000 Author: imp Date: Wed Apr 22 06:33:26 2009 New Revision: 191371 URL: http://svn.freebsd.org/changeset/base/191371 Log: Kill stray bootverbose debug tool. Submitted by: juli@ Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Wed Apr 22 06:30:24 2009 (r191370) +++ head/sys/dev/ed/if_ed_pccard.c Wed Apr 22 06:33:26 2009 (r191371) @@ -106,8 +106,6 @@ #include "miibus_if.h" #include "pccarddevs.h" -#define bootverbose 1 - /* * NE-2000 based PC Cards have a number of ways to get the MAC address. * Some cards encode this as a FUNCE. Others have this in the ROMs the From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 07:06:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E64A1065670; Wed, 22 Apr 2009 07:06:01 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id A2B7B8FC43; Wed, 22 Apr 2009 07:06:00 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (pD9E2D53A.dip.t-dialin.net [217.226.213.58]) by redbull.bpaserver.net (Postfix) with ESMTP id 9C86A2E168; Wed, 22 Apr 2009 09:05:50 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 62A4E16C22; Wed, 22 Apr 2009 09:05:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1240383947; bh=sFhZ0IcJSWmwXT+d5U7pEW2WOnVkzVEIv I47kxEkT90=; h=Message-ID:Date:From:To:Cc:Subject:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=lyrwaNDmqV87kyOIBvKWtjTgDJJ2E8i+GSNg+gNNf98tGoQbkgDeP4GCBuKoQuM9/ 8TVXXN8dujHMTk6YHRlpgiXMeAgQosLoo/F1TQrqt6UfEtKwkR5k13nqewukvANnZqt BnGWcNS5N1GyzjphQRg2Eu6tvIpYU7qP3+fLL0o79Q+5eD1SKR/3LXAtxlGyVnTm+3o q3k5KXk4edRnSlol20DYFuFxZ1Jj8IRHTu/xdpZGxts0Pz759vTqE6BqdFC/MKfG8Bw if+wg8ZRnj8eR4qsxF9QpKPIaAFrLA2a1d+qfIU9AjWt1PkIGkW5ox/tObXTz2mkGGD 8eBpdxS1A== Received: (from www@localhost) by webmail.leidinger.net (8.14.3/8.13.8/Submit) id n3M75ksA006215; Wed, 22 Apr 2009 09:05:47 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Wed, 22 Apr 2009 09:05:46 +0200 Message-ID: <20090422090546.110752s7m6p5ao84@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Wed, 22 Apr 2009 09:05:46 +0200 From: Alexander Leidinger To: "M. Warner Losh" References: <200904212248.n3LMmCbu027432@svn.freebsd.org> <20090422.002643.639875625.imp@bsdimp.com> In-Reply-To: <20090422.002643.639875625.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.3) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 9C86A2E168.26293 X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-14.823, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, RDNS_DYNAMIC 0.10, TW_SV 0.08) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: stas@FreeBSD.org, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191369 - in head/sys: arm/conf 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, 22 Apr 2009 07:06:01 -0000 Quoting "M. Warner Losh" (from Wed, 22 Apr 2009 =20 00:26:43 -0600 (MDT)): > In message: <200904212248.n3LMmCbu027432@svn.freebsd.org> > Stanislav Sedov writes: > : Author: stas > : Date: Tue Apr 21 22:48:12 2009 > : New Revision: 191369 > : URL: http://svn.freebsd.org/changeset/base/191369 > : > : Log: > : - Rename ds1672 and ds133x devices to "ds1672_rtc" and "ds133x_rtc" > : respectivly. This will allow one to have a kernel with both devices > : present and use it for multiple boards with different types of RTC > : sitting on a bus. > : > : Discussed with:=09imp > > Hey thanks Stas! Now things are better than before both functionally > and cosmetically! Good idea on the names... Are those the first devices with an underscore in the name now? If =20 yes, do we want this? Bye, Alexander. --=20 Are we THERE yet? My MIND is a SUBMARINE!! http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID =3D B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID =3D 72077137 From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 07:20:47 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDB11106566B; Wed, 22 Apr 2009 07:20:47 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 723188FC25; Wed, 22 Apr 2009 07:20:46 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 64C829CB079; Wed, 22 Apr 2009 09:19:30 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ls-Kpeja+E-F; Wed, 22 Apr 2009 09:19:18 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 95DAE9CB213; Wed, 22 Apr 2009 09:19:18 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n3M7JICG089247; Wed, 22 Apr 2009 09:19:18 +0200 (CEST) (envelope-from rdivacky) Date: Wed, 22 Apr 2009 09:19:18 +0200 From: Roman Divacky To: Robert Watson , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Message-ID: <20090422071918.GA88935@freebsd.org> References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090421185436.GA18628@zim.MIT.EDU> <20090421190651.GA2505@freebsd.org> <20090421194622.GA19215@zim.MIT.EDU> <20090421202754.GA19417@zim.MIT.EDU> <20090421203106.GA13661@freebsd.org> <20090422060643.GA22109@zim.MIT.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090422060643.GA22109@zim.MIT.EDU> User-Agent: Mutt/1.4.2.3i Cc: Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 07:20:48 -0000 I like your idea about using strcat() things but it wont help here because the problem is with the overal design. in detail - the short patch highlights " XY" instead of just "XY" where some sort of hackery is needed... the pointer magic there is for exactly this purpose.. I'll see if I can improve anything but I doubt that.... From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 08:56:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDE6D1065673; Wed, 22 Apr 2009 08:56:00 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out2.smtp.messagingengine.com (out2.smtp.messagingengine.com [66.111.4.26]) by mx1.freebsd.org (Postfix) with ESMTP id AF50D8FC21; Wed, 22 Apr 2009 08:56:00 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 9F18D31DFC1; Wed, 22 Apr 2009 04:55:59 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Wed, 22 Apr 2009 04:55:59 -0400 X-Sasl-enc: Bayzld7vndKSsmz363Evri6G3XfztZYnIRiM8zJmLvJ1 1240390559 Received: from [192.168.123.18] (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id D6C60289B5; Wed, 22 Apr 2009 04:55:58 -0400 (EDT) Message-ID: <49EEDB9C.8080409@incunabulum.net> Date: Wed, 22 Apr 2009 09:55:56 +0100 From: Bruce Simpson User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Robert Watson References: <200904212243.n3LMhW48027008@svn.freebsd.org> In-Reply-To: <200904212243.n3LMhW48027008@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: r191367 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2009 08:56:01 -0000 Robert Watson wrote: > ... > Log: > Start to address a number of races relating to use of ifnet pointers > after the corresponding interface has been destroyed: > > (1) Add an ifnet refcount, ifp->if_refcount. Initialize it to 1 in > if_alloc(), and modify if_free_type() to decrement and check the > refcount. > > (2) Add new if_ref() and if_rele() interfaces to allow kernel code > walking global interface lists to release IFNET_[RW]LOCK() yet > keep the ifnet stable. Currently, if_rele() is a no-op wrapper > around if_free(), but this may change in the future. > Thanks. I'll try to digest this badly needed work, but might not get around to updating SSM to use it straight away. As you probably saw from doco, it's something which SSM bangs right into, inpcbs after all last longer than ifnets. I do have a JKH task or three that I could mentor, though, and one of those would be for an intermediate INPCB-to-multicast-group map. I suspect the more serious commercial TCP/IP implementations have got that for scalability, and HEAD is the place to do it. As more apps begin to use multicast in seriousness, it's worth looking at. cheers BMS From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 09:33:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AF68106564A; Wed, 22 Apr 2009 09:33:20 +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 65F3E8FC0A; Wed, 22 Apr 2009 09:33:20 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 0A54946B5C; Wed, 22 Apr 2009 05:33:20 -0400 (EDT) Date: Wed, 22 Apr 2009 10:33:19 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Bruce Simpson In-Reply-To: <49EEDB9C.8080409@incunabulum.net> Message-ID: References: <200904212243.n3LMhW48027008@svn.freebsd.org> <49EEDB9C.8080409@incunabulum.net> 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: r191367 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2009 09:33:21 -0000 On Wed, 22 Apr 2009, Bruce Simpson wrote: >> Start to address a number of races relating to use of ifnet pointers >> after the corresponding interface has been destroyed: >> (1) Add an ifnet refcount, ifp->if_refcount. Initialize it to 1 in >> if_alloc(), and modify if_free_type() to decrement and check the >> refcount. >> (2) Add new if_ref() and if_rele() interfaces to allow kernel code >> walking global interface lists to release IFNET_[RW]LOCK() yet >> keep the ifnet stable. Currently, if_rele() is a no-op wrapper >> around if_free(), but this may change in the future. > > Thanks. I'll try to digest this badly needed work, but might not get around > to updating SSM to use it straight away. As you probably saw from doco, it's > something which SSM bangs right into, inpcbs after all last longer than > ifnets. There are a few parts to our general problem with ifnets going away: (1) Our general ifnet life cycle is poorly defined, so intermediate states may be visible that shouldn't be (for example, if_detach is a bit chaotic, and we've now stretched out the gap between if_detach and if_free using a refcount). We probably need an IFF_DEAD flag to better handle this case, so that once an ifnet is marked as free but still dying due to outstanding references, it can'e bt looked up. Brooks and I have plans to try to hash some of this out at the BSDCan devsummit. (2) Some consumers of ifnets need to be taught to acquire refcounts on the ifnet to prevent it going away during certain operations -- mainly a class of things similar to the one I just fixed relating to user requests that perform operations that you can't hold IFNET_RLOCK() over. (3) Some consumers of ifnets need to be taught to register the ifnet removal event and properly detach themselves. For example, DUMMYNET is a well-known component that likes to hold onto mbufs for a long time, increasing the chances of the "oh, my ifnet is gone" race. Rather than trying to refcount from each mbuf, which would add excessive overhead, I think the answer is to modify these consumers to detect ifnet removal and GC all the mbufs that refer to it. For example, DUMMYNET should probably walk all its queues and m_freem() packets refering to the dying ifnet. I'm not familiar with the workings of SSM, but my feeling is that it probably needs to take the (3) approach rather than (2) -- rather than preventing the ifnet from going away until a socket closes, it should detect that the ifnet is going away and take appropriate remedial action. Possibly it should detect when a similarly configured ifnet re-appears and consider attaching to that, but it will most likely be a different instance of struct ifnet, and there are semantic considerations. Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 09:41:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C13ED10656AC; Wed, 22 Apr 2009 09:41:23 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out2.smtp.messagingengine.com (out2.smtp.messagingengine.com [66.111.4.26]) by mx1.freebsd.org (Postfix) with ESMTP id 911FD8FC23; Wed, 22 Apr 2009 09:41:23 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id B42553202CA; Wed, 22 Apr 2009 05:41:22 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 22 Apr 2009 05:41:22 -0400 X-Sasl-enc: yHNUVmj/d+w5TON1iMRS96Xu8xo60VxX+KlQ7JvzIbYP 1240393282 Received: from [192.168.123.18] (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 0ACDB20AFB; Wed, 22 Apr 2009 05:41:21 -0400 (EDT) Message-ID: <49EEE63F.2060706@incunabulum.net> Date: Wed, 22 Apr 2009 10:41:19 +0100 From: Bruce Simpson User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Robert Watson References: <200904212243.n3LMhW48027008@svn.freebsd.org> <49EEDB9C.8080409@incunabulum.net> In-Reply-To: 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 Subject: Re: svn commit: r191367 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2009 09:41:24 -0000 Robert Watson wrote: > ... > (3) Some consumers of ifnets need to be taught to register the ifnet > removal > event and properly detach themselves. For example, DUMMYNET is a > well-known component that likes to hold onto mbufs for a long time, > increasing the chances of the "oh, my ifnet is gone" race. Rather > than > trying to refcount from each mbuf, which would add excessive > overhead, I > think the answer is to modify these consumers to detect ifnet > removal and > GC all the mbufs that refer to it. For example, DUMMYNET should > probably > walk all its queues and m_freem() packets refering to the dying > ifnet. > > I'm not familiar with the workings of SSM, but my feeling is that it > probably needs to take the (3) approach rather than (2) -- rather than > preventing the ifnet from going away until a socket closes, it should > detect that the ifnet is going away and take appropriate remedial > action. Possibly it should detect when a similarly configured ifnet > re-appears and consider attaching to that, but it will most likely be > a different instance of struct ifnet, and there are semantic > considerations. SSM isn't high traffic -- it actually reduces the chattiness of IGMP by implementing per-interface output queues and state change report merges. Same for MLDv2 in IPv6. Timeliness and stability are what counts, it's control plane, not data plane. At the moment it mostly does (3) by doing an ifindex lookup in the netisr dispatch callback before calling ip_output(). Of course if ip_output() were to look before it leapt, the book keeping involved would go away. I have to stash the vimage context and ifindex in the queued mbuf packet headers to implement this. Now that Giant is nuked, the netisr could be eliminated and the ifnet rlock taken as it is before dispatching an entire chain. I only implemented a netisr to allow the code to be back-ported, however I don't care about back-porting any more -- it's too much effort and the time/funding budget doesn't justify that amount of work. cheers BMS From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 12:44:35 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED06F1065676; Wed, 22 Apr 2009 12:44:35 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id A26C58FC40; Wed, 22 Apr 2009 12:44:35 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n3MClwY5024013; Wed, 22 Apr 2009 08:47:58 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n3MClwbJ024012; Wed, 22 Apr 2009 08:47:58 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Wed, 22 Apr 2009 08:47:58 -0400 From: David Schultz To: Roman Divacky Message-ID: <20090422124757.GA23877@zim.MIT.EDU> Mail-Followup-To: Roman Divacky , Robert Watson , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090421185436.GA18628@zim.MIT.EDU> <20090421190651.GA2505@freebsd.org> <20090421194622.GA19215@zim.MIT.EDU> <20090421202754.GA19417@zim.MIT.EDU> <20090421203106.GA13661@freebsd.org> <20090422060643.GA22109@zim.MIT.EDU> <20090422071918.GA88935@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090422071918.GA88935@freebsd.org> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Robert Watson Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 12:44:37 -0000 On Wed, Apr 22, 2009, Roman Divacky wrote: > > I like your idea about using strcat() things but it wont > help here because the problem is with the overal design. > in detail - the short patch highlights " XY" instead of > just "XY" where some sort of hackery is needed... the pointer > magic there is for exactly this purpose.. > > I'll see if I can improve anything but I doubt that.... Aah, that explains the mysterious `+ 1' (which doesn't work for single-digit dates, does it?) It's probably easier just to get rid of the daystr / jdaystr hack and do something like `sprintf(..., "%s%d%s", term_r, dt.d, term_e)'. The amount of left padding needed before the term_r should be `(jd_flag ? 4 : 3) - snprintf(NULL, 0, "%d", dt.d)'. It's not a high priority in any case. From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 12:52:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D45E1065672; Wed, 22 Apr 2009 12:52:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 017DB8FC12; Wed, 22 Apr 2009 12:52:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MCqCj7055863; Wed, 22 Apr 2009 12:52:12 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MCqCZF055862; Wed, 22 Apr 2009 12:52:12 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200904221252.n3MCqCZF055862@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 22 Apr 2009 12:52: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: r191374 - 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: Wed, 22 Apr 2009 12:52:13 -0000 Author: trasz Date: Wed Apr 22 12:52:12 2009 New Revision: 191374 URL: http://svn.freebsd.org/changeset/base/191374 Log: Turns out rtm_use does still exist, just under different name - for a long time (since 6.1) it was #defined as rtm_fmask. Update manual page. While here, sync some constants with what's in route.h. Modified: head/share/man/man4/route.4 Modified: head/share/man/man4/route.4 ============================================================================== --- head/share/man/man4/route.4 Wed Apr 22 08:37:02 2009 (r191373) +++ head/share/man/man4/route.4 Wed Apr 22 12:52:12 2009 (r191374) @@ -196,6 +196,8 @@ Messages include: #define RTM_REDIRECT 0x6 /* Told to use different route */ #define RTM_MISS 0x7 /* Lookup failed on this address */ #define RTM_LOCK 0x8 /* fix specified metrics */ +#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ +#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ #define RTM_RESOLVE 0xb /* request to resolve dst to LL addr - unused */ #define RTM_NEWADDR 0xc /* address being added to iface */ #define RTM_DELADDR 0xd /* address being removed from iface */ @@ -203,6 +205,7 @@ Messages include: #define RTM_NEWMADDR 0xf /* mcast group membership being added to if */ #define RTM_DELMADDR 0x10 /* mcast group membership being deleted */ #define RTM_IFANNOUNCE 0x11 /* iface arrival/departure */ +#define RTM_IEEE80211 0x12 /* IEEE80211 wireless event */ .Ed .Pp A message header consists of one of the following: @@ -217,6 +220,7 @@ struct rt_msghdr { pid_t rtm_pid; /* identify sender */ int rtm_seq; /* for sender to identify action */ int rtm_errno; /* why failed */ + int rtm_fmask; /* bitmask used in RTM_CHANGE message */ u_long rtm_inits; /* which metrics we are initializing */ struct rt_metrics rtm_rmx; /* metrics themselves */ }; @@ -300,6 +304,7 @@ Specifiers for metric values in rmx_lock #define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ #define RTV_RTT 0x40 /* init or lock _rtt */ #define RTV_RTTVAR 0x80 /* init or lock _rttvar */ +#define RTV_WEIGHT 0x100 /* init or lock _weight */ .Ed .Pp Specifiers for which addresses are present in the messages are: From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 13:11:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 300DC106564A; Wed, 22 Apr 2009 13:11:39 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 05DB98FC1C; Wed, 22 Apr 2009 13:11:39 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MDBcqJ056327; Wed, 22 Apr 2009 13:11:38 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MDBcvn056325; Wed, 22 Apr 2009 13:11:38 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200904221311.n3MDBcvn056325@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 22 Apr 2009 13:11: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: r191375 - in head/sys/powerpc: booke include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2009 13:11:39 -0000 Author: raj Date: Wed Apr 22 13:11:38 2009 New Revision: 191375 URL: http://svn.freebsd.org/changeset/base/191375 Log: Centralize setting HID0/1 for E500. Rename HID defines which are specific to E500 rather than shared within Book-E family. Obtained from: Freescale, Semihalf Modified: head/sys/powerpc/booke/locore.S head/sys/powerpc/include/hid.h Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Wed Apr 22 12:52:12 2009 (r191374) +++ head/sys/powerpc/booke/locore.S Wed Apr 22 13:11:38 2009 (r191375) @@ -29,6 +29,7 @@ #include "assym.s" #include +#include #include #include #include @@ -103,6 +104,15 @@ __start: mtmsr %r3 isync + lis %r3, HID0_E500_DEFAULT_SET@h + ori %r3, %r3, HID0_E500_DEFAULT_SET@l + mtspr SPR_HID0, %r3 + isync + lis %r3, HID1_E500_DEFAULT_SET@h + ori %r3, %r3, HID1_E500_DEFAULT_SET@l + mtspr SPR_HID1, %r3 + isync + /* Invalidate all entries in TLB0 */ li %r3, 0 bl tlb_inval_all Modified: head/sys/powerpc/include/hid.h ============================================================================== --- head/sys/powerpc/include/hid.h Wed Apr 22 12:52:12 2009 (r191374) +++ head/sys/powerpc/include/hid.h Wed Apr 22 13:11:38 2009 (r191375) @@ -32,7 +32,7 @@ /* Hardware Implementation Dependent registers for the PowerPC */ -#define HID0_EMCP 0x80000000 /* Enable MCP */ +#define HID0_EMCP 0x80000000 /* Enable machine check pin */ #define HID0_DBP 0x40000000 /* Disable 60x bus parity generation */ #define HID0_EBA 0x20000000 /* Enable 60x bus address parity checking */ #define HID0_EBD 0x10000000 /* Enable 60x bus data parity checking */ @@ -73,9 +73,9 @@ #define HID0_AIM_TBEN 0x04000000 /* Time base enable (7450) */ -#define HID0_BOOKE_TBEN 0x00004000 /* Time Base and decr. enable */ -#define HID0_BOOKE_SEL_TBCLK 0x00002000 /* Select Time Base clock */ -#define HID0_BOOKE_MAS7UPDEN 0x00000080 /* Enable MAS7 update (e500v2) */ +#define HID0_E500_TBEN 0x00004000 /* Time Base and decr. enable */ +#define HID0_E500_SEL_TBCLK 0x00002000 /* Select Time Base clock */ +#define HID0_E500_MAS7UPDEN 0x00000080 /* Enable MAS7 update (e500v2) */ #define HID0_BITMASK \ "\20" \ @@ -147,6 +147,13 @@ * 7457: XBSEN = Extended BAT Block Size Enable */ +#define HID1_E500_ABE 0x00001000 /* Address broadcast enable */ +#define HID1_E500_ASTME 0x00002000 /* Address bus streaming mode enable */ +#define HID1_E500_RFXE 0x00020000 /* Read fault exception enable */ + +#define HID0_E500_DEFAULT_SET (HID0_EMCP | HID0_E500_TBEN) +#define HID1_E500_DEFAULT_SET (HID1_E500_ABE | HID1_E500_ASTME) + #define HID5_970_DCBZ_SIZE_HI 0x01000000 /* dcbz does a 32-byte store */ #endif /* _POWERPC_HID_H_ */ From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 13:13:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C166106568A; Wed, 22 Apr 2009 13:13:35 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AEAE8FC21; Wed, 22 Apr 2009 13:13:35 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MDDZ6V056397; Wed, 22 Apr 2009 13:13:35 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MDDZRL056395; Wed, 22 Apr 2009 13:13:35 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200904221313.n3MDDZRL056395@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 22 Apr 2009 13:13: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: r191376 - head/sys/powerpc/booke X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 13:13:35 -0000 Author: raj Date: Wed Apr 22 13:13:34 2009 New Revision: 191376 URL: http://svn.freebsd.org/changeset/base/191376 Log: Provide cpu_throw() for Book-E. Adjust cpu_switch() towards ULE support. Obtained from: Freescale, Semihalf Modified: head/sys/powerpc/booke/swtch.S head/sys/powerpc/booke/vm_machdep.c Modified: head/sys/powerpc/booke/swtch.S ============================================================================== --- head/sys/powerpc/booke/swtch.S Wed Apr 22 13:11:38 2009 (r191375) +++ head/sys/powerpc/booke/swtch.S Wed Apr 22 13:13:34 2009 (r191376) @@ -69,11 +69,20 @@ #include /* - * void cpu_switch(struct thread *old, struct thread *new) + * void cpu_throw(struct thread *old, struct thread *new) + */ +ENTRY(cpu_throw) + mr %r15, %r4 + b cpu_switchin + +/* + * void cpu_switch(struct thread *old, struct thread *new, struct mutex *mtx);) * * Switch to a new thread saving the current state in the old thread. */ ENTRY(cpu_switch) + stw %r5, TD_LOCK(%r3) + lwz %r5, TD_PCB(%r3) /* Get the old thread's PCB ptr */ mr %r12, %r2 @@ -98,6 +107,7 @@ ENTRY(cpu_switch) bl pmap_deactivate /* Deactivate the current pmap */ +cpu_switchin: mr %r3, %r15 /* Get new thread ptr */ bl pmap_activate /* Activate the new address space */ Modified: head/sys/powerpc/booke/vm_machdep.c ============================================================================== --- head/sys/powerpc/booke/vm_machdep.c Wed Apr 22 13:11:38 2009 (r191375) +++ head/sys/powerpc/booke/vm_machdep.c Wed Apr 22 13:13:34 2009 (r191376) @@ -248,15 +248,6 @@ cpu_exit(struct thread *td) } -/* Temporary helper */ -void -cpu_throw(struct thread *old, struct thread *new) -{ - - cpu_switch(old, new, NULL); - panic("cpu_throw() didn't"); -} - /* * Allocate a pool of sf_bufs (sendfile(2) or "super-fast" if you prefer. :-)) */ From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 13:18:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90E2C1065676; Wed, 22 Apr 2009 13:18:04 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FB7F8FC15; Wed, 22 Apr 2009 13:18:04 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MDI4PX056550; Wed, 22 Apr 2009 13:18:04 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MDI4xb056549; Wed, 22 Apr 2009 13:18:04 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200904221318.n3MDI4xb056549@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 22 Apr 2009 13:18:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191378 - head/sys/powerpc/booke X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 13:18:05 -0000 Author: raj Date: Wed Apr 22 13:18:04 2009 New Revision: 191378 URL: http://svn.freebsd.org/changeset/base/191378 Log: Minor style consistency fix. Modified: head/sys/powerpc/booke/swtch.S Modified: head/sys/powerpc/booke/swtch.S ============================================================================== --- head/sys/powerpc/booke/swtch.S Wed Apr 22 13:17:47 2009 (r191377) +++ head/sys/powerpc/booke/swtch.S Wed Apr 22 13:18:04 2009 (r191378) @@ -138,10 +138,10 @@ cpu_switchin: * Update pcb, saving current processor state */ ENTRY(savectx) - mr %r12,%r2 - stmw %r12,PCB_CONTEXT(%r3) /* Save the non-volatile GP regs */ + mr %r12, %r2 + stmw %r12, PCB_CONTEXT(%r3) /* Save the non-volatile GP regs */ mfcr %r4 /* Save the condition register */ - stw %r4,PCB_CONTEXT(%r3) + stw %r4, PCB_CONTEXT(%r3) blr /* @@ -149,11 +149,11 @@ ENTRY(savectx) * Set up the return from cpu_fork() */ ENTRY(fork_trampoline) - lwz %r3,CF_FUNC(%r1) - lwz %r4,CF_ARG0(%r1) - lwz %r5,CF_ARG1(%r1) + lwz %r3, CF_FUNC(%r1) + lwz %r4, CF_ARG0(%r1) + lwz %r5, CF_ARG1(%r1) bl fork_exit - addi %r1,%r1,CF_SIZE-FSP /* Allow 8 bytes in front of + addi %r1, %r1, CF_SIZE-FSP /* Allow 8 bytes in front of trapframe to simulate FRAME_SETUP does when allocating space for a frame pointer/saved LR */ From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 13:30:25 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 187EA1065670; Wed, 22 Apr 2009 13:30:25 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id BFE658FC1B; Wed, 22 Apr 2009 13:30:23 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 31F1C9CB0DD; Wed, 22 Apr 2009 15:29:07 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YZBCDjNVKAz1; Wed, 22 Apr 2009 15:29:01 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id BBF629CB1F3; Wed, 22 Apr 2009 15:29:01 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n3MDT13f001861; Wed, 22 Apr 2009 15:29:01 +0200 (CEST) (envelope-from rdivacky) Date: Wed, 22 Apr 2009 15:29:01 +0200 From: Roman Divacky To: Robert Watson , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Message-ID: <20090422132901.GA1599@freebsd.org> References: <200904201819.n3KIJcZo054306@svn.freebsd.org> <20090421185436.GA18628@zim.MIT.EDU> <20090421190651.GA2505@freebsd.org> <20090421194622.GA19215@zim.MIT.EDU> <20090421202754.GA19417@zim.MIT.EDU> <20090421203106.GA13661@freebsd.org> <20090422060643.GA22109@zim.MIT.EDU> <20090422071918.GA88935@freebsd.org> <20090422124757.GA23877@zim.MIT.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090422124757.GA23877@zim.MIT.EDU> User-Agent: Mutt/1.4.2.3i Cc: Subject: Re: svn commit: r191330 - head/usr.bin/ncal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 13:30:25 -0000 On Wed, Apr 22, 2009 at 08:47:58AM -0400, David Schultz wrote: > On Wed, Apr 22, 2009, Roman Divacky wrote: > > > > I like your idea about using strcat() things but it wont > > help here because the problem is with the overal design. > > in detail - the short patch highlights " XY" instead of > > just "XY" where some sort of hackery is needed... the pointer > > magic there is for exactly this purpose.. > > > > I'll see if I can improve anything but I doubt that.... > > Aah, that explains the mysterious `+ 1' (which doesn't work for > single-digit dates, does it?) It's probably easier just to get > rid of the daystr / jdaystr hack and do something like > `sprintf(..., "%s%d%s", term_r, dt.d, term_e)'. The amount of > left padding needed before the term_r should be > `(jd_flag ? 4 : 3) - snprintf(NULL, 0, "%d", dt.d)'. It's not a > high priority in any case. yes, as I said. it should be completely rewritten. is there anyone interested in rewriting it? I certainly am not... From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 13:31:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA8EC106564A; Wed, 22 Apr 2009 13:31:52 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF3768FC21; Wed, 22 Apr 2009 13:31:52 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MDVqAH056867; Wed, 22 Apr 2009 13:31:52 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MDVqQp056866; Wed, 22 Apr 2009 13:31:52 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200904221331.n3MDVqQp056866@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 22 Apr 2009 13:31: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: r191380 - head/sys/powerpc/powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 13:31:53 -0000 Author: raj Date: Wed Apr 22 13:31:52 2009 New Revision: 191380 URL: http://svn.freebsd.org/changeset/base/191380 Log: Eliminate redundant setting of HID0_EMCP. Modified: head/sys/powerpc/powerpc/cpu.c Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Wed Apr 22 13:18:13 2009 (r191379) +++ head/sys/powerpc/powerpc/cpu.c Wed Apr 22 13:31:52 2009 (r191380) @@ -231,7 +231,6 @@ cpu_setup(u_int cpuid) case FSL_E500v1: case FSL_E500v2: - hid0 |= HID0_EMCP; break; } From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 14:07:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1601B106566B; Wed, 22 Apr 2009 14:07:15 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 008508FC17; Wed, 22 Apr 2009 14:07:15 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3ME7ECa058283; Wed, 22 Apr 2009 14:07:14 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3ME7EVr058280; Wed, 22 Apr 2009 14:07:14 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200904221407.n3ME7EVr058280@svn.freebsd.org> From: Colin Percival Date: Wed, 22 Apr 2009 14:07: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: r191381 - head/crypto/openssl/crypto/asn1 releng/6.3 releng/6.3/crypto/openssl/crypto/asn1 releng/6.3/lib/libc/db/btree releng/6.3/lib/libc/db/hash releng/6.3/lib/libc/db/mpool releng/6... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 14:07:15 -0000 Author: cperciva Date: Wed Apr 22 14:07:14 2009 New Revision: 191381 URL: http://svn.freebsd.org/changeset/base/191381 Log: Don't leak information via uninitialized space in db(3) records. [09:07] Sanity-check string lengths in order to stop OpenSSL crashing when printing corrupt BMPString or UniversalString objects. [09:08] Security: FreeBSD-SA-09:07.libc Security: FreeBSD-SA-09:08.openssl Security: CVE-2009-0590 Approved by: re (kensmith) Approved by: so (cperciva) Modified: head/crypto/openssl/crypto/asn1/asn1.h head/crypto/openssl/crypto/asn1/asn1_err.c head/crypto/openssl/crypto/asn1/tasn_dec.c Changes in other areas also in this revision: Modified: releng/6.3/UPDATING releng/6.3/crypto/openssl/crypto/asn1/asn1.h releng/6.3/crypto/openssl/crypto/asn1/asn1_err.c releng/6.3/crypto/openssl/crypto/asn1/tasn_dec.c releng/6.3/lib/libc/db/btree/bt_split.c releng/6.3/lib/libc/db/hash/hash_buf.c releng/6.3/lib/libc/db/mpool/mpool.c releng/6.3/sys/conf/newvers.sh releng/6.4/UPDATING releng/6.4/crypto/openssl/crypto/asn1/asn1.h releng/6.4/crypto/openssl/crypto/asn1/asn1_err.c releng/6.4/crypto/openssl/crypto/asn1/tasn_dec.c releng/6.4/lib/libc/db/btree/bt_split.c releng/6.4/lib/libc/db/hash/hash_buf.c releng/6.4/lib/libc/db/mpool/mpool.c releng/6.4/sys/conf/newvers.sh releng/7.0/UPDATING releng/7.0/crypto/openssl/crypto/asn1/asn1.h releng/7.0/crypto/openssl/crypto/asn1/asn1_err.c releng/7.0/crypto/openssl/crypto/asn1/tasn_dec.c releng/7.0/lib/libc/db/btree/bt_split.c releng/7.0/lib/libc/db/hash/hash_buf.c releng/7.0/lib/libc/db/mpool/mpool.c releng/7.0/sys/conf/newvers.sh releng/7.1/UPDATING releng/7.1/crypto/openssl/crypto/asn1/asn1.h releng/7.1/crypto/openssl/crypto/asn1/asn1_err.c releng/7.1/crypto/openssl/crypto/asn1/tasn_dec.c releng/7.1/lib/libc/db/btree/bt_split.c releng/7.1/lib/libc/db/hash/hash_buf.c releng/7.1/lib/libc/db/mpool/mpool.c releng/7.1/sys/conf/newvers.sh releng/7.2/UPDATING releng/7.2/crypto/openssl/crypto/asn1/asn1.h releng/7.2/crypto/openssl/crypto/asn1/asn1_err.c releng/7.2/crypto/openssl/crypto/asn1/tasn_dec.c stable/6/crypto/openssl/crypto/asn1/asn1.h stable/6/crypto/openssl/crypto/asn1/asn1_err.c stable/6/crypto/openssl/crypto/asn1/tasn_dec.c stable/7/crypto/openssl/crypto/asn1/asn1.h stable/7/crypto/openssl/crypto/asn1/asn1_err.c stable/7/crypto/openssl/crypto/asn1/tasn_dec.c Modified: head/crypto/openssl/crypto/asn1/asn1.h ============================================================================== --- head/crypto/openssl/crypto/asn1/asn1.h Wed Apr 22 13:31:52 2009 (r191380) +++ head/crypto/openssl/crypto/asn1/asn1.h Wed Apr 22 14:07:14 2009 (r191381) @@ -1134,6 +1134,7 @@ void ERR_load_ASN1_strings(void); #define ASN1_R_BAD_OBJECT_HEADER 102 #define ASN1_R_BAD_PASSWORD_READ 103 #define ASN1_R_BAD_TAG 104 +#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 210 #define ASN1_R_BN_LIB 105 #define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 #define ASN1_R_BUFFER_TOO_SMALL 107 @@ -1213,6 +1214,7 @@ void ERR_load_ASN1_strings(void); #define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157 #define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158 #define ASN1_R_UNEXPECTED_EOC 159 +#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 211 #define ASN1_R_UNKNOWN_FORMAT 160 #define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 #define ASN1_R_UNKNOWN_OBJECT_TYPE 162 Modified: head/crypto/openssl/crypto/asn1/asn1_err.c ============================================================================== --- head/crypto/openssl/crypto/asn1/asn1_err.c Wed Apr 22 13:31:52 2009 (r191380) +++ head/crypto/openssl/crypto/asn1/asn1_err.c Wed Apr 22 14:07:14 2009 (r191381) @@ -188,6 +188,7 @@ static ERR_STRING_DATA ASN1_str_reasons[ {ERR_REASON(ASN1_R_BAD_OBJECT_HEADER) ,"bad object header"}, {ERR_REASON(ASN1_R_BAD_PASSWORD_READ) ,"bad password read"}, {ERR_REASON(ASN1_R_BAD_TAG) ,"bad tag"}, +{ERR_REASON(ASN1_R_BMPSTRING_IS_WRONG_LENGTH),"bmpstring is wrong length"}, {ERR_REASON(ASN1_R_BN_LIB) ,"bn lib"}, {ERR_REASON(ASN1_R_BOOLEAN_IS_WRONG_LENGTH),"boolean is wrong length"}, {ERR_REASON(ASN1_R_BUFFER_TOO_SMALL) ,"buffer too small"}, @@ -267,6 +268,7 @@ static ERR_STRING_DATA ASN1_str_reasons[ {ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_KEY),"unable to decode rsa key"}, {ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY),"unable to decode rsa private key"}, {ERR_REASON(ASN1_R_UNEXPECTED_EOC) ,"unexpected eoc"}, +{ERR_REASON(ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH),"universalstring is wrong length"}, {ERR_REASON(ASN1_R_UNKNOWN_FORMAT) ,"unknown format"}, {ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message digest algorithm"}, {ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) ,"unknown object type"}, Modified: head/crypto/openssl/crypto/asn1/tasn_dec.c ============================================================================== --- head/crypto/openssl/crypto/asn1/tasn_dec.c Wed Apr 22 13:31:52 2009 (r191380) +++ head/crypto/openssl/crypto/asn1/tasn_dec.c Wed Apr 22 14:07:14 2009 (r191381) @@ -1012,6 +1012,18 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const case V_ASN1_SET: case V_ASN1_SEQUENCE: default: + if (utype == V_ASN1_BMPSTRING && (len & 1)) + { + ASN1err(ASN1_F_ASN1_EX_C2I, + ASN1_R_BMPSTRING_IS_WRONG_LENGTH); + goto err; + } + if (utype == V_ASN1_UNIVERSALSTRING && (len & 3)) + { + ASN1err(ASN1_F_ASN1_EX_C2I, + ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH); + goto err; + } /* All based on ASN1_STRING and handled the same */ if (!*pval) { From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 15:01:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83BF910656C2; Wed, 22 Apr 2009 15:01:09 +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 6670C8FC24; Wed, 22 Apr 2009 15:01:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MF19EY059585; Wed, 22 Apr 2009 15:01:09 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MF19nd059584; Wed, 22 Apr 2009 15:01:09 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904221501.n3MF19nd059584@svn.freebsd.org> From: Warner Losh Date: Wed, 22 Apr 2009 15:01: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: r191384 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 15:01:11 -0000 Author: imp Date: Wed Apr 22 15:01:08 2009 New Revision: 191384 URL: http://svn.freebsd.org/changeset/base/191384 Log: These were a placeholder and don't belong here. Remove them. Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Wed Apr 22 14:20:21 2009 (r191383) +++ head/sys/dev/ed/if_ed_pccard.c Wed Apr 22 15:01:08 2009 (r191384) @@ -1,3 +1,4 @@ + /*- * Copyright (c) 2005, M. Warner Losh * Copyright (c) 1995, David Greenman @@ -238,149 +239,6 @@ static const struct ed_product { }; /* - PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab), - PCMCIA_DEVICE_MANF_CARD(0x0213, 0x2452), - - PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4), - PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), - PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), - PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), - PCMCIA_PFC_DEVICE_PROD_ID12(0, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58), - PCMCIA_PFC_DEVICE_PROD_ID12(0, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), - PCMCIA_PFC_DEVICE_PROD_ID12(0, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f), - PCMCIA_MFC_DEVICE_PROD_ID123(0, "APEX DATA", "MULTICARD", "ETHERNET-MODEM", 0x11c2da09, 0x7289dc5d, 0xaad95e1f), - PCMCIA_MFC_DEVICE_PROD_ID2(0, "FAX/Modem/Ethernet Combo Card ", 0x1ed59302), - PCMCIA_DEVICE_PROD_ID12("2408LAN", "Ethernet", 0x352fff7f, 0x00b2e941), - PCMCIA_DEVICE_PROD_ID1234("Socket", "CF 10/100 Ethernet Card", "Revision B", "05/11/06", 0xb38bcc2e, 0x4de88352, 0xeaca6c8d, 0x7e57c22e), - PCMCIA_DEVICE_PROD_ID123("Cardwell", "PCMCIA", "ETHERNET", 0x9533672e, 0x281f1c5d, 0x3ff7175b), - PCMCIA_DEVICE_PROD_ID123("CNet ", "CN30BC", "ETHERNET", 0x9fe55d3d, 0x85601198, 0x3ff7175b), - PCMCIA_DEVICE_PROD_ID123("Digital", "Ethernet", "Adapter", 0x9999ab35, 0x00b2e941, 0x4b0d829e), - PCMCIA_DEVICE_PROD_ID123("Edimax Technology Inc.", "PCMCIA", "Ethernet Card", 0x738a0019, 0x281f1c5d, 0x5e9d92c0), - PCMCIA_DEVICE_PROD_ID123("EFA ", "EFA207", "ETHERNET", 0x3d294be4, 0xeb9aab6c, 0x3ff7175b), - PCMCIA_DEVICE_PROD_ID123("I-O DATA", "PCLA", "ETHERNET", 0x1d55d7ec, 0xe4c64d34, 0x3ff7175b), - PCMCIA_DEVICE_PROD_ID123("IO DATA", "PCLATE", "ETHERNET", 0x547e66dc, 0x6b260753, 0x3ff7175b), - PCMCIA_DEVICE_PROD_ID123("KingMax Technology Inc.", "EN10-T2", "PCMCIA Ethernet Card", 0x932b7189, 0x699e4436, 0x6f6652e0), - PCMCIA_DEVICE_PROD_ID123("PCMCIA", "PCMCIA-ETHERNET-CARD", "UE2216", 0x281f1c5d, 0xd4cd2f20, 0xb87add82), - PCMCIA_DEVICE_PROD_ID123("PCMCIA", "PCMCIA-ETHERNET-CARD", "UE2620", 0x281f1c5d, 0xd4cd2f20, 0x7d3d83a8), - PCMCIA_DEVICE_PROD_ID1("2412LAN", 0x67f236ab), - PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68), - PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997), - PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8), - PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96), - PCMCIA_DEVICE_PROD_ID12("AmbiCom", "AMB8010", 0x5070a7f9, 0x82f96e96), - PCMCIA_DEVICE_PROD_ID12("AmbiCom", "AMB8610", 0x5070a7f9, 0x86741224), - PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8002", 0x93b15570, 0x75ec3efb), - PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8002T", 0x93b15570, 0x461c5247), - PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8010", 0x93b15570, 0x82f96e96), - PCMCIA_DEVICE_PROD_ID12("AnyCom", "ECO Ethernet", 0x578ba6e7, 0x0a9888c1), - PCMCIA_DEVICE_PROD_ID12("AnyCom", "ECO Ethernet 10/100", 0x578ba6e7, 0x939fedbd), - PCMCIA_DEVICE_PROD_ID12("AROWANA", "PCMCIA Ethernet LAN Card", 0x313adbc8, 0x08d9f190), - PCMCIA_DEVICE_PROD_ID12("ASANTE", "FriendlyNet PC Card", 0x3a7ade0f, 0x41c64504), - PCMCIA_DEVICE_PROD_ID12("Billionton", "LNT-10TB", 0x552ab682, 0xeeb1ba6a), - PCMCIA_DEVICE_PROD_ID12("CF", "10Base-Ethernet", 0x44ebf863, 0x93ae4d79), - PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "BASEline PCMCIA 10 MBit Ethernetadapter", 0xfa2e424d, 0xe9190d8a), - PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "FASTline PCMCIA 10/100 Fast-Ethernet", 0xfa2e424d, 0x3953d9b9), - PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), - PCMCIA_DEVICE_PROD_ID12("Corega,K.K.", "Ethernet LAN Card", 0x110d26d9, 0x9fd2f0a2), - PCMCIA_DEVICE_PROD_ID12("corega,K.K.", "Ethernet LAN Card", 0x9791a90e, 0x9fd2f0a2), - PCMCIA_DEVICE_PROD_ID12("CouplerlessPCMCIA", "100BASE", 0xee5af0ad, 0x7c2add04), - PCMCIA_DEVICE_PROD_ID12("CyQ've", "ELA-110E 10/100M LAN Card", 0x77008979, 0xfd184814), - PCMCIA_DEVICE_PROD_ID12("DataTrek.", "NetCard ", 0x5cd66d9d, 0x84697ce0), - PCMCIA_DEVICE_PROD_ID12("Dayna Communications, Inc.", "CommuniCard E", 0x0c629325, 0xb4e7dbaf), - PCMCIA_DEVICE_PROD_ID12("Digicom", "Palladio LAN 10/100", 0x697403d8, 0xe160b995), - PCMCIA_DEVICE_PROD_ID12("Digicom", "Palladio LAN 10/100 Dongless", 0x697403d8, 0xa6d3b233), - PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9), - PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84), - PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9), - PCMCIA_DEVICE_PROD_ID12("Dynalink", "L10BC", 0x55632fd5, 0xdc65f2b1), - PCMCIA_DEVICE_PROD_ID12("DYNALINK", "L10BC", 0x6a26d1cf, 0xdc65f2b1), - PCMCIA_DEVICE_PROD_ID12("E-CARD", "E-CARD", 0x6701da11, 0x6701da11), - PCMCIA_DEVICE_PROD_ID12("EIGER Labs Inc.", "Ethernet 10BaseT card", 0x53c864c6, 0xedd059f6), - PCMCIA_DEVICE_PROD_ID12("EIGER Labs Inc.", "Ethernet Combo card", 0x53c864c6, 0x929c486c), - PCMCIA_DEVICE_PROD_ID12("Ethernet", "Adapter", 0x00b2e941, 0x4b0d829e), - PCMCIA_DEVICE_PROD_ID12("Ethernet Adapter", "E2000 PCMCIA Ethernet", 0x96767301, 0x71fbbc61), - PCMCIA_DEVICE_PROD_ID12("Ethernet PCMCIA adapter", "EP-210", 0x8dd86181, 0xf2b52517), - PCMCIA_DEVICE_PROD_ID12("Fast Ethernet", "Adapter", 0xb4be14e3, 0x4b0d829e), - PCMCIA_DEVICE_PROD_ID12("Grey Cell", "GCS2000", 0x2a151fac, 0xf00555cb), - PCMCIA_DEVICE_PROD_ID12("Grey Cell", "GCS2220", 0x2a151fac, 0xc1b7e327), - PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947), - PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941), - PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6), - PCMCIA_DEVICE_PROD_ID12("IC-CARD+", "IC-CARD+", 0x93693494, 0x93693494), - PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), - PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), - PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), - PCMCIA_DEVICE_PROD_ID12("KCI", "PE520 PCMCIA Ethernet Adapter", 0xa89b87d3, 0x1eb88e64), - PCMCIA_DEVICE_PROD_ID12("KINGMAX", "EN10T2T", 0x7bcb459a, 0xa5c81fa5), - PCMCIA_DEVICE_PROD_ID12("Kingston", "KNE-PC2", 0x1128e633, 0xce2a89b3), - PCMCIA_DEVICE_PROD_ID12("Kingston Technology Corp.", "EtheRx PC Card Ethernet Adapter", 0x313c7be3, 0x0afb54a2), - PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-10/100CD", 0x1b7827b2, 0xcda71d1c), - PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDF", 0x1b7827b2, 0xfec71e40), - PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDL/T", 0x1b7827b2, 0x79fba4f7), - PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDS", 0x1b7827b2, 0x931afaab), - PCMCIA_DEVICE_PROD_ID12("LEMEL", "LM-N89TX PRO", 0xbbefb52f, 0xd2897a97), - PCMCIA_DEVICE_PROD_ID12("Linksys", "Combo PCMCIA EthernetCard (EC2T)", 0x0733cc81, 0x32ee8c78), - PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d), - PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389), - PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9), - PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline + 10/100 Network PC Card (PCM100H1)", 0x733cc81, 0x7a3e5c3a), - PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737), - PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TE", 0x88fcdeda, 0x0e714bee), - PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922), - PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN10TE", 0x88fcdeda, 0xc1e2521c), - PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0), - PCMCIA_DEVICE_PROD_ID12("MACNICA", "ME1-JEIDA", 0x20841b68, 0xaf8a3578), - PCMCIA_DEVICE_PROD_ID12("Macsense", "MPC-10", 0xd830297f, 0xd265c307), - PCMCIA_DEVICE_PROD_ID12("Matsushita Electric Industrial Co.,LTD.", "CF-VEL211", 0x44445376, 0x8ded41d4), - PCMCIA_DEVICE_PROD_ID12("MAXTECH", "PCN2000", 0x78d64bc0, 0xca0ca4b8), - PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC2-T", 0x481e0094, 0xa2eb0cf3), - PCMCIA_DEVICE_PROD_ID12("Microcom C.E.", "Travel Card LAN 10/100", 0x4b91cec7, 0xe70220d6), - PCMCIA_DEVICE_PROD_ID12("Microdyne", "NE4200", 0x2e6da59b, 0x0478e472), - PCMCIA_DEVICE_PROD_ID12("MIDORI ELEC.", "LT-PCMT", 0x648d55c1, 0xbde526c7), - PCMCIA_DEVICE_PROD_ID12("National Semiconductor", "InfoMover 4100", 0x36e1191f, 0x60c229b9), - PCMCIA_DEVICE_PROD_ID12("National Semiconductor", "InfoMover NE4100", 0x36e1191f, 0xa6617ec8), - PCMCIA_DEVICE_PROD_ID12("Network Everywhere", "Fast Ethernet 10/100 PC Card", 0x820a67b6, 0x31ed1a5f), - PCMCIA_DEVICE_PROD_ID12("NextCom K.K.", "Next Hawk", 0xaedaec74, 0xad050ef1), - PCMCIA_DEVICE_PROD_ID12("PCMCIA", "10/100Mbps Ethernet Card", 0x281f1c5d, 0x6e41773b), - PCMCIA_DEVICE_PROD_ID12("PCMCIA", "ETHERNET", 0x281f1c5d, 0x3ff7175b), - PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet 10BaseT Card", 0x281f1c5d, 0x4de2f6c8), - PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet Card", 0x281f1c5d, 0x5e9d92c0), - PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet Combo card", 0x281f1c5d, 0x929c486c), - PCMCIA_DEVICE_PROD_ID12("PCMCIA", "ETHERNET V1.0", 0x281f1c5d, 0x4d8817c8), - PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FastEthernet", 0x281f1c5d, 0xfe871eeb), - PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast-Ethernet", 0x281f1c5d, 0x45f1f3b4), - PCMCIA_DEVICE_PROD_ID12("PCMCIA LAN", "Ethernet", 0x7500e246, 0x00b2e941), - PCMCIA_DEVICE_PROD_ID12("PCMCIA", "LNT-10TN", 0x281f1c5d, 0xe707f641), - PCMCIA_DEVICE_PROD_ID12("PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), - PCMCIA_DEVICE_PROD_ID12("PCMCIA", "UE2212", 0x281f1c5d, 0xbf17199b), - PCMCIA_DEVICE_PROD_ID12("PCMCIA", " Ethernet NE2000 Compatible", 0x281f1c5d, 0x42d5d7e1), - PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10baseT 3.3V", 0xebf91155, 0x30074c80), - PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10BaseT 3.3V", 0xebf91155, 0x7f5a4f50), - PCMCIA_DEVICE_PROD_ID12("Psion Dacom", "Gold Card Ethernet", 0xf5f025c2, 0x3a30e110), - PCMCIA_DEVICE_PROD_ID12("=RELIA==", "Ethernet", 0xcdd0644a, 0x00b2e941), - PCMCIA_DEVICE_PROD_ID12("RP", "1625B Ethernet NE2000 Compatible", 0xe3e66e22, 0xb96150df), - PCMCIA_DEVICE_PROD_ID12("RPTI", "EP400 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4a7e2ae0), - PCMCIA_DEVICE_PROD_ID12("RPTI", "EP401 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4bcbd7fd), - PCMCIA_DEVICE_PROD_ID12("RPTI LTD.", "EP400", 0xc53ac515, 0x81e39388), - PCMCIA_DEVICE_PROD_ID12("SCM", "Ethernet Combo card", 0xbdc3b102, 0x929c486c), - PCMCIA_DEVICE_PROD_ID12("Seiko Epson Corp.", "Ethernet", 0x09928730, 0x00b2e941), - PCMCIA_DEVICE_PROD_ID12("SMC", "EZCard-10-PCMCIA", 0xc4f8b18b, 0xfb21d265), - PCMCIA_DEVICE_PROD_ID12("Telecom Device K.K.", "SuperSocket RE450T", 0x466b05f0, 0x8b74bc4f), - PCMCIA_DEVICE_PROD_ID12("Telecom Device K.K.", "SuperSocket RE550T", 0x466b05f0, 0x33c8db2a), - PCMCIA_DEVICE_PROD_ID13("Hypertec", "EP401", 0x8787bec7, 0xf6e4a31e), - PCMCIA_DEVICE_PROD_ID13("KingMax Technology Inc.", "Ethernet Card", 0x932b7189, 0x5e9d92c0), - PCMCIA_DEVICE_PROD_ID13("LONGSHINE", "EP401", 0xf866b0b0, 0xf6e4a31e), - PCMCIA_DEVICE_PROD_ID1("CyQ've 10 Base-T LAN CARD", 0x94faf360), - PCMCIA_DEVICE_PROD_ID1("EP-210 PCMCIA LAN CARD.", 0x8850b4de), - PCMCIA_DEVICE_PROD_ID1("ETHER-C16", 0x06a8514f), - PCMCIA_DEVICE_PROD_ID1("NE2000 Compatible", 0x75b8ad5a), - PCMCIA_DEVICE_PROD_ID2("EN-6200P2", 0xa996d078), - - - PCMCIA_PFC_DEVICE_PROD_ID12(0, "MICRO RESEARCH", "COMBO-L/M-336", 0xb2ced065, 0x3ced0555), - */ - -/* * PC Card (PCMCIA) specific code. */ static int ed_pccard_probe(device_t); From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 15:11:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F359106564A; Wed, 22 Apr 2009 15:11:27 +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 4E77A8FC20; Wed, 22 Apr 2009 15:11:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MFBRWA059818; Wed, 22 Apr 2009 15:11:27 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MFBRrI059817; Wed, 22 Apr 2009 15:11:27 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904221511.n3MFBRrI059817@svn.freebsd.org> From: Warner Losh Date: Wed, 22 Apr 2009 15:11: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: r191385 - 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: Wed, 22 Apr 2009 15:11:27 -0000 Author: imp Date: Wed Apr 22 15:11:27 2009 New Revision: 191385 URL: http://svn.freebsd.org/changeset/base/191385 Log: Add AmbiCom AMB8002, AMB8010 (2 variants) and AMB8610. These were inferred from data in the linux driver. Modified: head/sys/dev/pccard/pccarddevs Modified: head/sys/dev/pccard/pccarddevs ============================================================================== --- head/sys/dev/pccard/pccarddevs Wed Apr 22 15:01:08 2009 (r191384) +++ head/sys/dev/pccard/pccarddevs Wed Apr 22 15:11:27 2009 (r191385) @@ -699,7 +699,11 @@ product ACCTON EN2212 { "ACCTON", "EN22 product ACCTON EN2216 { "ACCTON", "EN2216-PCMCIA-ETHERNET", "EN2216R01", NULL } Accton EN2216 product ADDTRON AWP100 { "Addtron", "AWP-100&spWireless&spPCMCIA", "Version&sp01.02", NULL } product ALLIEDTELESIS WR211PCM { "Allied&spTelesis&spK.K.", "WR211PCM", NULL, NULL } Allied Telesis WR211PCM +product AMBICOM AMB8002 { "AmbiCom&spInc", "AMB8002", NULL, NULL } AmbiCom AMB8002 product AMBICOM AMB8002T { "AmbiCom&spInc", "AMB8002T", NULL, NULL } AmbiCom AMB8002T +product AMBICOM AMB8010 { "AmbiCom&spInc", "AMB8010", NULL, NULL } AmbiCom AMB8010 +product AMBICOM AMB8010_ALT { "AmbiCom", "AMB8010", NULL, NULL } AmbiCom AMB8010 +product AMBICOM AMB8610 { "AmbiCom", "AMB8610", NULL, NULL } AmbiCom AMB8010 product AMD AM79C930 { "AMD", "Am79C930", NULL, NULL } AMD Am79C930 product ARGOSY SP320 { "PCMCIA", "RS-COM 2P", NULL, NULL } ARGOSY SP320 Dual port serial PCMCIA product BILLIONTON CFLT10N { "CF", "10Base-Ethernet", "1.0", NULL } Billionton CFLT10N From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 15:13:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4173310656B4; Wed, 22 Apr 2009 15:13:21 +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 2F2D88FC46; Wed, 22 Apr 2009 15:13:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MFDLRX059893; Wed, 22 Apr 2009 15:13:21 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MFDLvC059892; Wed, 22 Apr 2009 15:13:21 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904221513.n3MFDLvC059892@svn.freebsd.org> From: Warner Losh Date: Wed, 22 Apr 2009 15:13: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: r191386 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 15:13:23 -0000 Author: imp Date: Wed Apr 22 15:13:20 2009 New Revision: 191386 URL: http://svn.freebsd.org/changeset/base/191386 Log: Add a few more models of AMBICOM cards from data from linux driver and pccard.conf. Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Wed Apr 22 15:11:27 2009 (r191385) +++ head/sys/dev/ed/if_ed_pccard.c Wed Apr 22 15:13:20 2009 (r191386) @@ -138,7 +138,11 @@ static const struct ed_product { { PCMCIA_CARD(ACCTON, EN2212), 0}, { PCMCIA_CARD(ACCTON, EN2216), 0}, { PCMCIA_CARD(ALLIEDTELESIS, LA_PCM), 0}, + { PCMCIA_CARD(AMBICOM, AMB8002), 0}, { PCMCIA_CARD(AMBICOM, AMB8002T), 0}, + { PCMCIA_CARD(AMBICOM, AMB8010), 0}, + { PCMCIA_CARD(AMBICOM, AMB8010_ALT), 0}, + { PCMCIA_CARD(AMBICOM, AMB8610), 0}, { PCMCIA_CARD(BILLIONTON, CFLT10N), 0}, { PCMCIA_CARD(BILLIONTON, LNA100B), NE2000DVF_AX88X90}, { PCMCIA_CARD(BILLIONTON, LNT10TN), 0}, From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 15:25:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADD9F1065670; Wed, 22 Apr 2009 15:25:00 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B3E58FC1A; Wed, 22 Apr 2009 15:25:00 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MFP0XH060151; Wed, 22 Apr 2009 15:25:00 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MFP0Om060149; Wed, 22 Apr 2009 15:25:00 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200904221525.n3MFP0Om060149@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 22 Apr 2009 15:25: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: r191387 - head/share/man/man4/man4.powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 15:25:01 -0000 Author: raj Date: Wed Apr 22 15:25:00 2009 New Revision: 191387 URL: http://svn.freebsd.org/changeset/base/191387 Log: Provide manual page for the tsec(4) device driver. Obtained from: Semihalf Added: head/share/man/man4/man4.powerpc/tsec.4 (contents, props changed) Modified: head/share/man/man4/man4.powerpc/Makefile Modified: head/share/man/man4/man4.powerpc/Makefile ============================================================================== --- head/share/man/man4/man4.powerpc/Makefile Wed Apr 22 15:13:20 2009 (r191386) +++ head/share/man/man4/man4.powerpc/Makefile Wed Apr 22 15:25:00 2009 (r191387) @@ -4,7 +4,8 @@ MAN= bm.4 \ pmu.4 \ powermac_nvram.4 \ snd_ai2s.4 \ - snd_davbus.4 + snd_davbus.4 \ + tsec.4 MANSUBDIR=/powerpc Added: head/share/man/man4/man4.powerpc/tsec.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/man4.powerpc/tsec.4 Wed Apr 22 15:25:00 2009 (r191387) @@ -0,0 +1,156 @@ +.\" +.\" Copyright (c) 2009 Semihalf, Rafal Jaworowski +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 22, 2009 +.Dt TSEC 4 +.Os +.Sh NAME +.Nm tsec +.Nd "Freescale Three-Speed Ethernet Controller device driver" +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device tsec" +.Cd "device miibus" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the gigabit Ethernet controller integrated in +some of the Freescale system-on-chip devices. +.Pp +The +.Nm +driver supports the following media types: +.Pp +.Bl -tag -width xxxxxxxxxxxxxxxxxxxx +.It autoselect +Enable autoselection of the media type and options +.It 10baseT/UTP +Set 10Mbps operation +.It 100baseTX +Set 100Mbps operation +.It 1000baseT +Set 1000baseT operation +.El +.Pp +The +.Nm +driver supports the following media options: +.Pp +.Bl -tag -width xxxxxxxxxxxxxxxxxxxx +.It full-duplex +Set full duplex operation +.El +.Pp +The +.Nm +driver supports polled operation when the system is configured with +DEVICE_POLLING kernel option, see +.Xr polling 4 +for more details. +.Pp +The +.Nm +driver supports reception and transmission of extended frames +for +.Xr vlan 4 . +This capability of +.Nm +can be controlled by means of the +.Cm vlanmtu +parameter +to +.Xr ifconfig 8 . +.Pp +The +.Nm +driver supports interrupts coalescing (IC) so that raising a transmit/receive +frame interrupt is delayed, if possible, until a threshold-defined period of +time has elapsed, or a threshold-defined frame counter has been reached +(whichever occurs first). The following sysctls regulate this behaviour: +.Bl -tag -width indent +.It Va dev.tsec.X.int_coal.rx_time +.It Va dev.tsec.X.int_coal.rx_count +.It Va dev.tsec.X.int_coal.tx_time +.It Va dev.tsec.X.int_coal.tx_count +.Pp +Value of 0 for either time or count disables IC on the given path. Time value +1-65535 corresponds to a real time period and is expressed in units equivalent +to 64 ticks of the TSEC clock. Count 1-255 represents the number of frames +(note that value of 1 is equivalent to IC disabled). User provided values +larger than supported will be trimmed to the maximum supported. More details +are available in the reference manual of the device. +.El +.Sh HARDWARE +Gigabit Ethernet controllers built into the following Freescale +system-on-chip devices are known to work with the +.Nm +driver: +.Pp +.Bl -bullet -compact +.It +MPC8349 +.It +MPC8533, MPC8541, MPC8555 +.El +.Pp +The enhanced version of the controller (eTSEC), integrated in the following +devices, is also supported by this driver: +.Pp +.Bl -bullet -compact +.It +MPC8548, MPC8572 +.El +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr miibus 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr polling 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 8.0 . +.Sh AUTHORS +.An -nosplit +The base version of +.Nm +device driver was written by +.An Piotr Kruszynski. +It has been extended with polling and interrupt coalescing support by +.An Rafal Jaworowski. +It has been further enhanced with multicast, h/w checksum calculation and vlan +support by +.An Piotr Ziecik . +This manual page was written by +.An Rafal Jaworowski . From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 15:50:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1BB4106564A; Wed, 22 Apr 2009 15:50:03 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AEFE78FC1D; Wed, 22 Apr 2009 15:50:03 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MFo3Y5060770; Wed, 22 Apr 2009 15:50:03 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MFo3tp060766; Wed, 22 Apr 2009 15:50:03 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200904221550.n3MFo3tp060766@svn.freebsd.org> From: Maksim Yevmenkin Date: Wed, 22 Apr 2009 15:50: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: r191388 - head/lib/libbluetooth X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 15:50:04 -0000 Author: emax Date: Wed Apr 22 15:50:03 2009 New Revision: 191388 URL: http://svn.freebsd.org/changeset/base/191388 Log: Implement low-level Bluetooth HCI API. This should make it easier to make Linux BlueZ libhci port. Reviewed by: Iain Hibbert < plunky -at- rya-online -dot- net > of NetBSD MFC after: 1 week Inspired by: Linux BlueZ Inspired by: NetBSD Modified: head/lib/libbluetooth/Makefile head/lib/libbluetooth/bluetooth.3 head/lib/libbluetooth/bluetooth.h head/lib/libbluetooth/hci.c Modified: head/lib/libbluetooth/Makefile ============================================================================== --- head/lib/libbluetooth/Makefile Wed Apr 22 15:25:00 2009 (r191387) +++ head/lib/libbluetooth/Makefile Wed Apr 22 15:50:03 2009 (r191388) @@ -33,6 +33,19 @@ MLINKS+= bluetooth.3 bt_devname.3 MLINKS+= bluetooth.3 bt_devinfo.3 MLINKS+= bluetooth.3 bt_devenum.3 +MLINKS+= bluetooth.3 bt_devopen.3 +MLINKS+= bluetooth.3 bt_devclose.3 +MLINKS+= bluetooth.3 bt_devsend.3 +MLINKS+= bluetooth.3 bt_devreq.3 +MLINKS+= bluetooth.3 bt_devfilter.3 +MLINKS+= bluetooth.3 bt_devfilter_pkt_set.3 +MLINKS+= bluetooth.3 bt_devfilter_pkt_clr.3 +MLINKS+= bluetooth.3 bt_devfilter_pkt_tst.3 +MLINKS+= bluetooth.3 bt_devfilter_evt_set.3 +MLINKS+= bluetooth.3 bt_devfilter_evt_clr.3 +MLINKS+= bluetooth.3 bt_devfilter_evt_tst.3 +MLINKS+= bluetooth.3 bt_devinquiry.3 + MLINKS+= bluetooth.3 bdaddr_same.3 MLINKS+= bluetooth.3 bdaddr_any.3 MLINKS+= bluetooth.3 bdaddr_copy.3 Modified: head/lib/libbluetooth/bluetooth.3 ============================================================================== --- head/lib/libbluetooth/bluetooth.3 Wed Apr 22 15:25:00 2009 (r191387) +++ head/lib/libbluetooth/bluetooth.3 Wed Apr 22 15:50:03 2009 (r191388) @@ -25,7 +25,7 @@ .\" $Id: bluetooth.3,v 1.5 2003/05/20 23:04:30 max Exp $ .\" $FreeBSD$ .\" -.Dd February 13, 2009 +.Dd April 9, 2009 .Dt BLUETOOTH 3 .Os .Sh NAME @@ -41,6 +41,23 @@ .Nm bt_endprotoent , .Nm bt_aton , .Nm bt_ntoa , +.Nm bt_devaddr , +.Nm bt_devname , +.Nm bt_devinfo , +.Nm bt_devenum , +.Nm bt_devopen , +.Nm bt_devclose , +.Nm bt_devsend , +.Nm bt_devrecv , +.Nm bt_devreq , +.Nm bt_devfilter , +.Nm bt_devfilter_pkt_set , +.Nm bt_devfilter_pkt_clr , +.Nm bt_devfilter_pkt_tst , +.Nm bt_devfilter_evt_set , +.Nm bt_devfilter_evt_clr , +.Nm bt_devfilter_evt_tst , +.Nm bt_devinquiry , .Nm bdaddr_same , .Nm bdaddr_any , .Nm bdaddr_copy @@ -84,6 +101,32 @@ .Ft int .Fn bt_devenum "bt_devenum_cb_t *cb" "void *arg" .Ft int +.Fn bt_devopen "char const *devname" +.Ft int +.Fn bt_devclose "int s" +.Ft int +.Fn bt_devsend "int s" "uint16_t opcode" "void *param" "size_t plen" +.Ft ssize_t +.Fn bt_devrecv "int s" "void *buf" "size_t size" "time_t to" +.Ft int +.Fn bt_devreq "int s" "struct bt_devreq *r" "time_t to" +.Ft int +.Fn bt_devfilter "int s" "struct bt_devfilter const *new" "struct bt_devfilter *old" +.Ft void +.Fn bt_devfilter_pkt_set "struct bt_devfilter *filter" "uint8_t type" +.Ft void +.Fn bt_devfilter_pkt_clt "struct bt_devfilter *filter" "uint8_t type" +.Ft int +.Fn bt_devfilter_pkt_tst "struct bt_devfilter const *filter" "uint8_t type" +.Ft void +.Fn bt_devfilter_evt_set "struct bt_devfilter *filter" "uint8_t event" +.Ft void +.Fn bt_devfilter_evt_clt "struct bt_devfilter *filter" "uint8_t event" +.Ft int +.Fn bt_devfilter_evt_tst "struct bt_devfilter const *filter" "uint8_t event" +.Ft int +.Fn bt_devinquiry "char const *devname" "time_t length" "int num_rsp" "struct bt_devinquiry **ii" +.Ft int .Fn bdaddr_same "const bdaddr_t *a" "const bdaddr_t *b" .Ft int .Fn bdaddr_any "const bdaddr_t *a" @@ -311,6 +354,240 @@ The function returns number of successfu or -1 if an error occurred. .Pp The +.Fn bt_devopen +function opens a Bluetooth device with the given +.Fa devname +and returns a connected and bound +.Dv HCI +socket handle. +The function returns -1 if an error has occurred. +.Pp +The +.Fn bt_devclose +closes the passed +.Dv HCI +socket handle +.Fa s , +previously obtained with +.Xr bt_devopen 3 . +.Pp +The +.Fn bt_devsend +function sends a Bluetooth +.Dv HCI +command with the given +.Fa opcode +to the provided socket +.Fa s , +previously obtained with +.Xr bt_devopen 3 . +The +.Fa opcode +parameter is exppected to be in the host byte order. +The +.Fa param +and +.Fa plen +parameters specify command parameters. +The +.Fn bt_devsend +function does not modify the +.Dv HCI +filter on the provided socket +.Fa s . +The function returns 0 on success, +or -1 if an error occurred. +.Pp +The +.Fn bt_devrecv +function receives one Bluetooth +.Dv HCI +packet from the socket +.Fa s , +previously obtained with +.Xr bt_devopen 3 . +The packet is placed into the provided buffer +.Fa buf +of size +.Fa size . +The +.Fa to +parameter specifies receive timeout in seconds. +Infinite timeout can be specified by passing negative value in the +.Fa to +parameter. +The +.Fn bt_devrecv +function does not modify the +.Dv HCI +filter on the provided socket +.Fa s . +The function returns total number of bytes recevied, +or -1 if an error occurred. +.Pp +The +.Fn bt_devreq +function makes a Bluetooth +.Dv HCI +request to the socket +.Fa s , +previously obtained with +.Xr bt_devopen 3 . +The function will send the specified command and will wait for the specified +event, +or timeout +.Fa to +seconds to occur. +The +.Vt bt_devreq +structure is defined as follows +.Bd -literal -offset indent +struct bt_devreq +{ + uint16_t opcode; + uint8_t event; + void *cparam; + size_t clen; + void *rparam; + size_t rlen; +}; +.Ed +.Pp +The +.Fa opcode +field specifies the command and is expected to be in the host byte order. +The +.Fa cparam +and +.Fa clen +fields specify command parameters data and command parameters data size +respectively. +The +.Fa event +field specifies which Bluetooth +.Dv HCI +event ID the function should wait for, otherwise it should be set to zero. +The +.Dv HCI +Command Complete and Command Status events are enabled by default. +The +.Fa rparam +and +.Fa rlen +parameters specify buffer and buffer size respectively where return +parameters should be placed. +The +.Fn bt_devreq +function temporarily modifies filter on the provided +.Dv HCI +socket +.Fa s . +The function returns 0 on success, or -1 if an error occurred. +.Pp +The +.Fn bt_devfilter +controls the local +.Dv HCI +filter associated with the socket +.Fa s , +previously obtained with +.Xr bt_devopen 3 . +Filtering can be done on packet types, i.e. +.Dv ACL , +.Dv SCO or +.Dv HCI , +command and event packets, and, in addition, on +.Dv HCI +event IDs. +Before applying the +.Fa new +filter (if provided) the function will try to obtain the current filter +from the socket +.Fa s +and place it into the +.Fa old +parameter (if provided). +The function returns 0 on success, or -1 if an error occurred. +.Pp +The +.Fn bt_devfilter_pkt_set , +.Fn bt_devfilter_pkt_clr +and +.Fn bt_devfilter_pkt_tst +functions can be used to modify and test the +.Dv HCI +filter +.Fa filter . +The +.Fa type +parameter specifies +.Dv HCI +packet type. +.Pp +The +.Fn bt_devfilter_evt_set , +.Fn bt_devfilter_evt_clr +and +.Fn bt_devfilter_evt_tst +functions can be used to modify and test the +.Dv HCI +event filter +.Fa filter . +The +.Fa event +parameter specifies +.Dv HCI +event ID. +.Pp +The +.Fn bt_devinquiry +function performs Bluetooth inquiry. +The +.Fa devname +parameter specifies which local Bluetooth device should perform an inquiry. +If not secified, i.e. +.Dv NULL , +then first available device will be used. +The +.Fa length +parameters specifies the total length of an inquiry in seconds. +If not specified, i.e. 0, default value will be used. +The +.Fa num_rsp +parameter specifies the number of responses that can be received before +the inquiry is halted. +If not specified, i.e. 0, default value will be used. +The +.Fa ii +parameter specifies where to place inquiry results. +On success, the function will return total number of inquiry results, +will allocate, +using +.Xr calloc 3 , +buffer to store all the inquiry results and +will return pointer to the allocated buffer in the +.Fa ii +parameter. +It is up to the caller of the function to dispose of the buffer using +.Xr free 3 +call. +The function returns -1 if an error has occurred. +The +.Vt bt_devinquiry +structure is defined as follows +.Bd -literal -offset indent +struct bt_devinquiry { + bdaddr_t bdaddr; + uint8_t pscan_rep_mode; + uint8_t pscan_period_mode; + uint8_t dev_class[3]; + uint16_t clock_offset; + int8_t rssi; + uint8_t data[240]; +}; +.Ed +.Pp +The .Fn bdaddr_same , .Fn bdaddr_any and @@ -444,6 +721,6 @@ will be bound and connected to the Bluet .Sh AUTHORS .An Maksim Yevmenkin Aq m_evmenkin@yahoo.com .Sh BUGS -These functions use static data storage; +Some of those functions use static data storage; if the data is needed for future use, it should be copied before any subsequent calls overwrite it. Modified: head/lib/libbluetooth/bluetooth.h ============================================================================== --- head/lib/libbluetooth/bluetooth.h Wed Apr 22 15:25:00 2009 (r191387) +++ head/lib/libbluetooth/bluetooth.h Wed Apr 22 15:50:03 2009 (r191388) @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,7 @@ #include #include #include +#include __BEGIN_DECLS @@ -129,8 +131,48 @@ struct bt_devinfo uint8_t _padding[20]; /* leave space for future additions */ }; +struct bt_devreq +{ + uint16_t opcode; + uint8_t event; + void *cparam; + size_t clen; + void *rparam; + size_t rlen; +}; + +struct bt_devfilter { + bitstr_t bit_decl(packet_mask, 8); + bitstr_t bit_decl(event_mask, 256); +}; + +struct bt_devinquiry { + bdaddr_t bdaddr; + uint8_t pscan_rep_mode; + uint8_t pscan_period_mode; + uint8_t dev_class[3]; + uint16_t clock_offset; + int8_t rssi; + uint8_t data[240]; +}; + typedef int (bt_devenum_cb_t)(int, struct bt_devinfo const *, void *); +int bt_devopen (char const *devname); +int bt_devclose(int s); +int bt_devsend (int s, uint16_t opcode, void *param, size_t plen); +ssize_t bt_devrecv (int s, void *buf, size_t size, time_t to); +int bt_devreq (int s, struct bt_devreq *r, time_t to); +int bt_devfilter(int s, struct bt_devfilter const *new, + struct bt_devfilter *old); +void bt_devfilter_pkt_set(struct bt_devfilter *filter, uint8_t type); +void bt_devfilter_pkt_clr(struct bt_devfilter *filter, uint8_t type); +int bt_devfilter_pkt_tst(struct bt_devfilter const *filter, uint8_t type); +void bt_devfilter_evt_set(struct bt_devfilter *filter, uint8_t event); +void bt_devfilter_evt_clr(struct bt_devfilter *filter, uint8_t event); +int bt_devfilter_evt_tst(struct bt_devfilter const *filter, uint8_t event); +int bt_devinquiry(char const *devname, time_t length, int num_rsp, + struct bt_devinquiry **ii); int bt_devinfo (struct bt_devinfo *di); int bt_devenum (bt_devenum_cb_t *cb, void *arg); Modified: head/lib/libbluetooth/hci.c ============================================================================== --- head/lib/libbluetooth/hci.c Wed Apr 22 15:25:00 2009 (r191387) +++ head/lib/libbluetooth/hci.c Wed Apr 22 15:50:03 2009 (r191388) @@ -30,15 +30,505 @@ * $FreeBSD$ */ +#include #include +#include #include #include #include #include +#undef MIN +#define MIN(a, b) (((a) < (b))? (a) : (b)) + +static int bt_devany_cb(int s, struct bt_devinfo const *di, void *xdevname); static char * bt_dev2node (char const *devname, char *nodename, int nnlen); int +bt_devopen(char const *devname) +{ + struct sockaddr_hci ha; + bdaddr_t ba; + int s; + + if (devname == NULL) { + errno = EINVAL; + return (-1); + } + + memset(&ha, 0, sizeof(ha)); + ha.hci_len = sizeof(ha); + ha.hci_family = AF_BLUETOOTH; + + if (bt_aton(devname, &ba)) { + if (!bt_devname(ha.hci_node, &ba)) + return (-1); + } else if (bt_dev2node(devname, ha.hci_node, + sizeof(ha.hci_node)) == NULL) { + errno = ENXIO; + return (-1); + } + + s = socket(PF_BLUETOOTH, SOCK_RAW, BLUETOOTH_PROTO_HCI); + if (s < 0) + return (-1); + + if (bind(s, (struct sockaddr *) &ha, sizeof(ha)) < 0 || + connect(s, (struct sockaddr *) &ha, sizeof(ha)) < 0) { + close(s); + return (-1); + } + + return (s); +} + +int +bt_devclose(int s) +{ + return (close(s)); +} + +int +bt_devsend(int s, uint16_t opcode, void *param, size_t plen) +{ + ng_hci_cmd_pkt_t h; + struct iovec iv[2]; + int ivn; + + if ((plen == 0 && param != NULL) || + (plen > 0 && param == NULL) || + plen > UINT8_MAX) { + errno = EINVAL; + return (-1); + } + + iv[0].iov_base = &h; + iv[0].iov_len = sizeof(h); + ivn = 1; + + h.type = NG_HCI_CMD_PKT; + h.opcode = htole16(opcode); + if (plen > 0) { + h.length = plen; + + iv[1].iov_base = param; + iv[1].iov_len = plen; + ivn = 2; + } else + h.length = 0; + + while (writev(s, iv, ivn) < 0) { + if (errno == EAGAIN || errno == EINTR) + continue; + + return (-1); + } + + return (0); +} + +ssize_t +bt_devrecv(int s, void *buf, size_t size, time_t to) +{ + ssize_t n; + + if (buf == NULL || size == 0) { + errno = EINVAL; + return (-1); + } + + if (to >= 0) { + fd_set rfd; + struct timeval tv; + + FD_ZERO(&rfd); + FD_SET(s, &rfd); + + tv.tv_sec = to; + tv.tv_usec = 0; + + while ((n = select(s + 1, &rfd, NULL, NULL, &tv)) < 0) { + if (errno == EAGAIN || errno == EINTR) + continue; + + return (-1); + } + + if (n == 0) { + errno = ETIMEDOUT; + return (-1); + } + + assert(FD_ISSET(s, &rfd)); + } + + while ((n = read(s, buf, size)) < 0) { + if (errno == EAGAIN || errno == EINTR) + continue; + + return (-1); + } + + switch (*((uint8_t *) buf)) { + case NG_HCI_CMD_PKT: { + ng_hci_cmd_pkt_t *h = (ng_hci_cmd_pkt_t *) buf; + + if (n >= sizeof(*h) && n == (sizeof(*h) + h->length)) + return (n); + } break; + + case NG_HCI_ACL_DATA_PKT: { + ng_hci_acldata_pkt_t *h = (ng_hci_acldata_pkt_t *) buf; + + if (n >= sizeof(*h) && n == (sizeof(*h) + le16toh(h->length))) + return (n); + } break; + + case NG_HCI_SCO_DATA_PKT: { + ng_hci_scodata_pkt_t *h = (ng_hci_scodata_pkt_t *) buf; + + if (n >= sizeof(*h) && n == (sizeof(*h) + h->length)) + return (n); + } break; + + case NG_HCI_EVENT_PKT: { + ng_hci_event_pkt_t *h = (ng_hci_event_pkt_t *) buf; + + if (n >= sizeof(*h) && n == (sizeof(*h) + h->length)) + return (n); + } break; + } + + errno = EIO; + return (-1); +} + +int +bt_devreq(int s, struct bt_devreq *r, time_t to) +{ + uint8_t buf[320]; /* more than enough */ + ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) buf; + ng_hci_command_compl_ep *cc = (ng_hci_command_compl_ep *)(e+1); + ng_hci_command_status_ep *cs = (ng_hci_command_status_ep*)(e+1); + struct bt_devfilter old, new; + time_t t_end; + uint16_t opcode; + ssize_t n; + int error; + + if (s < 0 || r == NULL || to < 0) { + errno = EINVAL; + return (-1); + } + + if ((r->rlen == 0 && r->rparam != NULL) || + (r->rlen > 0 && r->rparam == NULL)) { + errno = EINVAL; + return (-1); + } + + memset(&new, 0, sizeof(new)); + bt_devfilter_pkt_set(&new, NG_HCI_EVENT_PKT); + bt_devfilter_evt_set(&new, NG_HCI_EVENT_COMMAND_COMPL); + bt_devfilter_evt_set(&new, NG_HCI_EVENT_COMMAND_STATUS); + if (r->event != 0) + bt_devfilter_evt_set(&new, r->event); + + if (bt_devfilter(s, &new, &old) < 0) + return (-1); + + error = 0; + + n = bt_devsend(s, r->opcode, r->cparam, r->clen); + if (n < 0) { + error = errno; + goto out; + } + + opcode = htole16(r->opcode); + t_end = time(NULL) + to; + + do { + to = t_end - time(NULL); + if (to < 0) + to = 0; + + n = bt_devrecv(s, buf, sizeof(buf), to); + if (n < 0) { + error = errno; + goto out; + } + + if (e->type != NG_HCI_EVENT_PKT) { + error = EIO; + goto out; + } + + n -= sizeof(*e); + + switch (e->event) { + case NG_HCI_EVENT_COMMAND_COMPL: + if (cc->opcode == opcode) { + n -= sizeof(*cc); + + if (r->rlen >= n) { + r->rlen = n; + memcpy(r->rparam, cc + 1, r->rlen); + } + + goto out; + } + break; + + case NG_HCI_EVENT_COMMAND_STATUS: + if (cs->opcode == opcode) { + if (r->event != NG_HCI_EVENT_COMMAND_STATUS) { + if (cs->status != 0) { + error = EIO; + goto out; + } + } else { + if (r->rlen >= n) { + r->rlen = n; + memcpy(r->rparam, cs, r->rlen); + } + + goto out; + } + } + break; + + default: + if (e->event == r->event) { + if (r->rlen >= n) { + r->rlen = n; + memcpy(r->rparam, e + 1, r->rlen); + } + + goto out; + } + break; + } + } while (to > 0); + + error = ETIMEDOUT; +out: + bt_devfilter(s, &old, NULL); + + if (error != 0) { + errno = error; + return (-1); + } + + return (0); +} + +int +bt_devfilter(int s, struct bt_devfilter const *new, struct bt_devfilter *old) +{ + struct ng_btsocket_hci_raw_filter f; + socklen_t len; + + if (new == NULL && old == NULL) { + errno = EINVAL; + return (-1); + } + + if (old != NULL) { + len = sizeof(f); + if (getsockopt(s, SOL_HCI_RAW, SO_HCI_RAW_FILTER, &f, &len) < 0) + return (-1); + + memset(old, 0, sizeof(*old)); + memcpy(old->packet_mask, &f.packet_mask, + MIN(sizeof(old->packet_mask), sizeof(f.packet_mask))); + memcpy(old->event_mask, &f.event_mask, + MIN(sizeof(old->event_mask), sizeof(f.packet_mask))); + } + + if (new != NULL) { + memset(&f, 0, sizeof(f)); + memcpy(&f.packet_mask, new->packet_mask, + MIN(sizeof(f.packet_mask), sizeof(new->event_mask))); + memcpy(&f.event_mask, new->event_mask, + MIN(sizeof(f.event_mask), sizeof(new->event_mask))); + + len = sizeof(f); + if (setsockopt(s, SOL_HCI_RAW, SO_HCI_RAW_FILTER, &f, len) < 0) + return (-1); + } + + return (0); +} + +void +bt_devfilter_pkt_set(struct bt_devfilter *filter, uint8_t type) +{ + bit_set(filter->packet_mask, type - 1); +} + +void +bt_devfilter_pkt_clr(struct bt_devfilter *filter, uint8_t type) +{ + bit_clear(filter->packet_mask, type - 1); +} + +int +bt_devfilter_pkt_tst(struct bt_devfilter const *filter, uint8_t type) +{ + return (bit_test(filter->packet_mask, type - 1)); +} + +void +bt_devfilter_evt_set(struct bt_devfilter *filter, uint8_t event) +{ + bit_set(filter->event_mask, event - 1); +} + +void +bt_devfilter_evt_clr(struct bt_devfilter *filter, uint8_t event) +{ + bit_clear(filter->event_mask, event - 1); +} + +int +bt_devfilter_evt_tst(struct bt_devfilter const *filter, uint8_t event) +{ + return (bit_test(filter->event_mask, event - 1)); +} + +int +bt_devinquiry(char const *devname, time_t length, int num_rsp, + struct bt_devinquiry **ii) +{ + uint8_t buf[320]; + char _devname[HCI_DEVNAME_SIZE]; + struct bt_devfilter f; + ng_hci_inquiry_cp *cp = (ng_hci_inquiry_cp *) buf; + ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) buf; + ng_hci_inquiry_result_ep *ep = (ng_hci_inquiry_result_ep *)(e+1); + ng_hci_inquiry_response *ir; + struct bt_devinquiry *i; + int s, n; + time_t to; + + if (ii == NULL) { + errno = EINVAL; + return (-1); + } + + if (devname == NULL) { + memset(_devname, 0, sizeof(_devname)); + devname = _devname; + + n = bt_devenum(bt_devany_cb, _devname); + if (n <= 0) { + if (n == 0) + *ii = NULL; + + return (n); + } + } + + s = bt_devopen(devname); + if (s < 0) + return (-1); + + if (bt_devfilter(s, NULL, &f) < 0) { + bt_devclose(s); + return (-1); + } + + bt_devfilter_evt_set(&f, NG_HCI_EVENT_INQUIRY_COMPL); + bt_devfilter_evt_set(&f, NG_HCI_EVENT_INQUIRY_RESULT); + + if (bt_devfilter(s, &f, NULL) < 0) { + bt_devclose(s); + return (-1); + } + + /* Always use GIAC LAP */ + cp->lap[0] = 0x33; + cp->lap[1] = 0x8b; + cp->lap[2] = 0x9e; + + /* Calculate inquire length in 1.28 second units */ + to = (time_t) ((double) length / 1.28); + if (to <= 0) + cp->inquiry_length = 4; /* 5.12 seconds */ + else if (to > 254) + cp->inquiry_length = 255; /* 326.40 seconds */ + else + cp->inquiry_length = to + 1; + + to = (time_t)((double) cp->inquiry_length * 1.28) + 1; + + if (num_rsp <= 0 || num_rsp > 255) + num_rsp = 8; + cp->num_responses = (uint8_t) num_rsp; + + i = *ii = calloc(num_rsp, sizeof(struct bt_devinquiry)); + if (i == NULL) { + bt_devclose(s); + errno = ENOMEM; + return (-1); + } + + if (bt_devsend(s, + NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL, NG_HCI_OCF_INQUIRY), + cp, sizeof(*cp)) < 0) { + free(i); + bt_devclose(s); + return (-1); + } + +wait_for_more: + + n = bt_devrecv(s, buf, sizeof(buf), to); + if (n < 0) { + free(i); + bt_devclose(s); + return (-1); + } + + if (n < sizeof(ng_hci_event_pkt_t)) { + free(i); + bt_devclose(s); + errno = EIO; + return (-1); + } + + switch (e->event) { + case NG_HCI_EVENT_INQUIRY_COMPL: + break; + + case NG_HCI_EVENT_INQUIRY_RESULT: + ir = (ng_hci_inquiry_response *)(ep + 1); + + for (n = 0; n < MIN(ep->num_responses, num_rsp); n ++) { + bdaddr_copy(&i->bdaddr, &ir->bdaddr); + i->pscan_rep_mode = ir->page_scan_rep_mode; + i->pscan_period_mode = ir->page_scan_period_mode; + memcpy(i->dev_class, ir->uclass, sizeof(i->dev_class)); + i->clock_offset = le16toh(ir->clock_offset); + + ir ++; + i ++; + num_rsp --; + } + /* FALLTHROUGH */ + + default: + goto wait_for_more; + /* NOT REACHED */ + } + + bt_devclose(s); + + return (i - *ii); +} + +int bt_devinfo(struct bt_devinfo *di) { union { @@ -53,6 +543,7 @@ bt_devinfo(struct bt_devinfo *di) struct ng_btsocket_hci_raw_node_debug r8; } rp; struct sockaddr_hci ha; + socklen_t halen; int s, rval; if (di == NULL) { @@ -60,27 +551,14 @@ bt_devinfo(struct bt_devinfo *di) return (-1); } - memset(&ha, 0, sizeof(ha)); - ha.hci_len = sizeof(ha); - ha.hci_family = AF_BLUETOOTH; - - if (bt_aton(di->devname, &rp.r1.bdaddr)) { - if (!bt_devname(ha.hci_node, &rp.r1.bdaddr)) - return (-1); - } else if (bt_dev2node(di->devname, ha.hci_node, - sizeof(ha.hci_node)) == NULL) { - errno = ENXIO; - return (-1); - } - - s = socket(PF_BLUETOOTH, SOCK_RAW, BLUETOOTH_PROTO_HCI); + s = bt_devopen(di->devname); if (s < 0) return (-1); rval = -1; - if (bind(s, (struct sockaddr *) &ha, sizeof(ha)) < 0 || - connect(s, (struct sockaddr *) &ha, sizeof(ha)) < 0) + halen = sizeof(ha); + if (getsockname(s, (struct sockaddr *) &ha, &halen) < 0) goto bad; strlcpy(di->devname, ha.hci_node, sizeof(di->devname)); @@ -138,7 +616,7 @@ bt_devinfo(struct bt_devinfo *di) rval = 0; bad: - close(s); + bt_devclose(s); return (rval); } @@ -205,6 +683,13 @@ bt_devenum(bt_devenum_cb_t cb, void *arg return (count); } +static int +bt_devany_cb(int s, struct bt_devinfo const *di, void *xdevname) +{ + strlcpy((char *) xdevname, di->devname, HCI_DEVNAME_SIZE); + return (1); +} + static char * bt_dev2node(char const *devname, char *nodename, int nnlen) { From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 15:54:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83D9D1065672; Wed, 22 Apr 2009 15:54:28 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7267A8FC26; Wed, 22 Apr 2009 15:54:28 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MFsSkA060886; Wed, 22 Apr 2009 15:54:28 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MFsRpA060884; Wed, 22 Apr 2009 15:54:27 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200904221554.n3MFsRpA060884@svn.freebsd.org> From: Maksim Yevmenkin Date: Wed, 22 Apr 2009 15:54: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: r191389 - in 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: Wed, 22 Apr 2009 15:54:29 -0000 Author: emax Date: Wed Apr 22 15:54:27 2009 New Revision: 191389 URL: http://svn.freebsd.org/changeset/base/191389 Log: Bump __FreeBSD_version. Add UPDATING entry about low-level Bluetooth HCI API. Modified: head/UPDATING head/sys/sys/param.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Apr 22 15:50:03 2009 (r191388) +++ head/UPDATING Wed Apr 22 15:54:27 2009 (r191389) @@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090422 + Implement low-level Bluetooth HCI API. + Bump __FreeBSD_version to 800083. + 20090415: Anticipate overflowing inp_flags - add inp_flags2. This changes most offsets in inpcb, so checking v4 connection Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Apr 22 15:50:03 2009 (r191388) +++ head/sys/sys/param.h Wed Apr 22 15:54:27 2009 (r191389) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800082 /* Master, propagated to newvers */ +#define __FreeBSD_version 800083 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 15:56:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DC6A1065670; Wed, 22 Apr 2009 15:56:01 +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 171D78FC19; Wed, 22 Apr 2009 15:56:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MFu0IS060972; Wed, 22 Apr 2009 15:56:00 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MFu00M060971; Wed, 22 Apr 2009 15:56:00 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904221556.n3MFu00M060971@svn.freebsd.org> From: Warner Losh Date: Wed, 22 Apr 2009 15:56: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: r191390 - 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: Wed, 22 Apr 2009 15:56:02 -0000 Author: imp Date: Wed Apr 22 15:56:00 2009 New Revision: 191390 URL: http://svn.freebsd.org/changeset/base/191390 Log: Add Billionton LNT-10TB variant Modified: head/sys/dev/pccard/pccarddevs Modified: head/sys/dev/pccard/pccarddevs ============================================================================== --- head/sys/dev/pccard/pccarddevs Wed Apr 22 15:54:27 2009 (r191389) +++ head/sys/dev/pccard/pccarddevs Wed Apr 22 15:56:00 2009 (r191390) @@ -708,6 +708,7 @@ product AMD AM79C930 { "AMD", "Am79C930 product ARGOSY SP320 { "PCMCIA", "RS-COM 2P", NULL, NULL } ARGOSY SP320 Dual port serial PCMCIA product BILLIONTON CFLT10N { "CF", "10Base-Ethernet", "1.0", NULL } Billionton CFLT10N product BILLIONTON LNA100B { "Billionton", "LNA-100B", NULL, NULL } Billionton LNA-100B +product BILLIONTON LNT10TB { "PCMCIA", "LNT-10TB", NULL, NULL } Billionton LNT-10TB product BILLIONTON LNT10TN { "PCMCIA", "LNT-10TN", NULL, NULL } Billionton LNT-10TN product CNET NE2000 { "CNet", "CN40BC&spEthernet", "D", "NE2000" } CNet CN40BC NE2000 Compatible product COREGA ETHER_PCC_T { "corega&spK.K.", "corega&spEther&spPCC-T", NULL, NULL } Corega Ether PCC-T From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 15:57:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0E321065689; Wed, 22 Apr 2009 15:57:23 +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 BC1178FC14; Wed, 22 Apr 2009 15:57:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MFvMVP061032; Wed, 22 Apr 2009 15:57:22 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MFvMo3061031; Wed, 22 Apr 2009 15:57:22 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904221557.n3MFvMo3061031@svn.freebsd.org> From: Warner Losh Date: Wed, 22 Apr 2009 15: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: r191391 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 15:57:30 -0000 Author: imp Date: Wed Apr 22 15:57:22 2009 New Revision: 191391 URL: http://svn.freebsd.org/changeset/base/191391 Log: Add Billionton LNT10TB Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Wed Apr 22 15:56:00 2009 (r191390) +++ head/sys/dev/ed/if_ed_pccard.c Wed Apr 22 15:57:22 2009 (r191391) @@ -145,6 +145,7 @@ static const struct ed_product { { PCMCIA_CARD(AMBICOM, AMB8610), 0}, { PCMCIA_CARD(BILLIONTON, CFLT10N), 0}, { PCMCIA_CARD(BILLIONTON, LNA100B), NE2000DVF_AX88X90}, + { PCMCIA_CARD(BILLIONTON, LNT10TB), 0}, { PCMCIA_CARD(BILLIONTON, LNT10TN), 0}, { PCMCIA_CARD(BROMAX, AXNET), NE2000DVF_AX88X90}, { PCMCIA_CARD(BROMAX, IPORT), 0}, From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 16:06:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91415106564A; Wed, 22 Apr 2009 16:06:46 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F8AF8FC15; Wed, 22 Apr 2009 16:06:46 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MG6k04061277; Wed, 22 Apr 2009 16:06:46 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MG6kJt061276; Wed, 22 Apr 2009 16:06:46 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200904221606.n3MG6kJt061276@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 22 Apr 2009 16:06: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: r191392 - head/usr.sbin/sysinstall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 16:06:47 -0000 Author: nwhitehorn Date: Wed Apr 22 16:06:46 2009 New Revision: 191392 URL: http://svn.freebsd.org/changeset/base/191392 Log: Add bm(4) to the built-in ethernet devices list. Modified: head/usr.sbin/sysinstall/devices.c Modified: head/usr.sbin/sysinstall/devices.c ============================================================================== --- head/usr.sbin/sysinstall/devices.c Wed Apr 22 15:57:22 2009 (r191391) +++ head/usr.sbin/sysinstall/devices.c Wed Apr 22 16:06:46 2009 (r191392) @@ -99,6 +99,7 @@ static struct _devname { NETWORK("bce", "Broadcom NetXtreme II Gigabit Ethernet card"), NETWORK("bfe", "Broadcom BCM440x PCI Ethernet card"), NETWORK("bge", "Broadcom BCM570x PCI Gigabit Ethernet card"), + NETWORK("bm", "Apple BMAC Built-in Ethernet"), NETWORK("cue", "CATC USB Ethernet adapter"), NETWORK("cxgb", "Chelsio T3 10Gb Ethernet card"), NETWORK("fpa", "DEC DEFPA PCI FDDI card"), From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 16:50:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A834106564A; Wed, 22 Apr 2009 16:50:45 +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 195A58FC14; Wed, 22 Apr 2009 16:50:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MGoinb062183; Wed, 22 Apr 2009 16:50:45 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MGoiM2062182; Wed, 22 Apr 2009 16:50:44 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904221650.n3MGoiM2062182@svn.freebsd.org> From: Warner Losh Date: Wed, 22 Apr 2009 16:50: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: r191393 - 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: Wed, 22 Apr 2009 16:50:45 -0000 Author: imp Date: Wed Apr 22 16:50:44 2009 New Revision: 191393 URL: http://svn.freebsd.org/changeset/base/191393 Log: A couple of older Melco cards that missed the transition to newcard Modified: head/sys/dev/pccard/pccarddevs Modified: head/sys/dev/pccard/pccarddevs ============================================================================== --- head/sys/dev/pccard/pccarddevs Wed Apr 22 16:06:46 2009 (r191392) +++ head/sys/dev/pccard/pccarddevs Wed Apr 22 16:50:44 2009 (r191393) @@ -757,6 +757,7 @@ product LANTECH FASTNETTX { "ASIX", "AX8 product LINKSYS ECARD_2 { "LINKSYS", "E-CARD", NULL, NULL } Linksys E-Card product MACNICA MPS100 { "MACNICA", "MIRACLE&spSCSI", "mPS100", "D.0" } Macnica Miracle SCSI mPS100 product MEGAHERTZ XJ2288 { "MEGAHERTZ", "MODEM&spXJ2288", NULL, NULL } Megahertz XJ2288 Modem +product MELCO2 LPC2_T { "MELCO", "LPC2-T", NULL, NULL } Melco LPC2-T product MELCO2 LPC2_TX { "MELCO", "LPC2-TX", NULL, NULL } Melco LPC2-TX product MICRORESEARCH MR10TPC { "MICRO-RESEARCH-MR10TPC", "Ethernet", NULL, NULL } Micro Research MR10TPC product MITSUBISHI B8895 { "MITSUBISHI&spELECTRIC&spCORPORATION", "B8895", NULL, NULL } Mitsubishi Electronics Corporation B8895 From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 16:51:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C1E51065672; Wed, 22 Apr 2009 16:51:02 +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 EF26E8FC2D; Wed, 22 Apr 2009 16:51:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MGp17j062225; Wed, 22 Apr 2009 16:51:01 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MGp1sP062224; Wed, 22 Apr 2009 16:51:01 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904221651.n3MGp1sP062224@svn.freebsd.org> From: Warner Losh Date: Wed, 22 Apr 2009 16:51: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: r191394 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 16:51:02 -0000 Author: imp Date: Wed Apr 22 16:51:01 2009 New Revision: 191394 URL: http://svn.freebsd.org/changeset/base/191394 Log: A couple of older Melco cards that missed the transition to newcard Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Wed Apr 22 16:50:44 2009 (r191393) +++ head/sys/dev/ed/if_ed_pccard.c Wed Apr 22 16:51:01 2009 (r191394) @@ -1,4 +1,3 @@ - /*- * Copyright (c) 2005, M. Warner Losh * Copyright (c) 1995, David Greenman @@ -200,6 +199,8 @@ static const struct ed_product { { PCMCIA_CARD(MAGICRAM, ETHER), 0}, { PCMCIA_CARD(MELCO, LPC3_CLX), NE2000DVF_AX88X90}, { PCMCIA_CARD(MELCO, LPC3_TX), NE2000DVF_AX88X90}, + { PCMCIA_CARD(MELCO2, LPC2_T), 0}, + { PCMCIA_CARD(MELCO2, LPC2_TX), 0}, { PCMCIA_CARD(MITSUBISHI, B8895), NE2000DVF_ANYFUNC}, /* NG */ { PCMCIA_CARD(MICRORESEARCH, MR10TPC), 0}, { PCMCIA_CARD(NDC, ND5100_E), 0}, From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 17:07:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEB0A106564A; Wed, 22 Apr 2009 17:07:53 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D29A38FC0A; Wed, 22 Apr 2009 17:07:53 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MH7rcQ062564; Wed, 22 Apr 2009 17:07:53 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MH7rBh062560; Wed, 22 Apr 2009 17:07:53 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904221707.n3MH7rBh062560@svn.freebsd.org> From: Andrew Thompson Date: Wed, 22 Apr 2009 17:07: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: r191395 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 17:07:54 -0000 Author: thompsa Date: Wed Apr 22 17:07:53 2009 New Revision: 191395 URL: http://svn.freebsd.org/changeset/base/191395 Log: MFp4 //depot/projects/usb@160413 Use direct reference to parent high-speed HUB instead of indirect, due to pointer clearing race at detach of parent USB HUB. Reported by: kientzle Submitted by: Hans Petter Selasky PR: usb/133545 Modified: head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Wed Apr 22 16:51:01 2009 (r191394) +++ head/sys/dev/usb/controller/ehci.c Wed Apr 22 17:07:53 2009 (r191395) @@ -3651,8 +3651,8 @@ ehci_pipe_init(struct usb2_device *udev, if ((udev->speed != USB_SPEED_HIGH) && ((udev->hs_hub_addr == 0) || (udev->hs_port_no == 0) || - (udev->bus->devices[udev->hs_hub_addr] == NULL) || - (udev->bus->devices[udev->hs_hub_addr]->hub == NULL))) { + (udev->parent_hs_hub == NULL) || + (udev->parent_hs_hub->hub == NULL))) { /* We need a transaction translator */ goto done; } Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Wed Apr 22 16:51:01 2009 (r191394) +++ head/sys/dev/usb/usb_device.c Wed Apr 22 17:07:53 2009 (r191395) @@ -1490,6 +1490,7 @@ usb2_alloc_device(device_t parent_dev, s while (hub) { if (hub->speed == USB_SPEED_HIGH) { udev->hs_hub_addr = hub->address; + udev->parent_hs_hub = hub; udev->hs_port_no = adev->port_no; break; } Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Wed Apr 22 16:51:01 2009 (r191394) +++ head/sys/dev/usb/usb_device.h Wed Apr 22 17:07:53 2009 (r191395) @@ -121,6 +121,7 @@ struct usb2_device { struct usb2_bus *bus; /* our USB BUS */ device_t parent_dev; /* parent device */ struct usb2_device *parent_hub; + struct usb2_device *parent_hs_hub; /* high-speed parent HUB */ struct usb2_config_descriptor *cdesc; /* full config descr */ struct usb2_hub *hub; /* only if this is a hub */ #if USB_HAVE_COMPAT_LINUX Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Wed Apr 22 16:51:01 2009 (r191394) +++ head/sys/dev/usb/usb_hub.c Wed Apr 22 17:07:53 2009 (r191395) @@ -1117,7 +1117,7 @@ usb2_intr_schedule_adjust(struct usb2_de * access. */ - hub = bus->devices[udev->hs_hub_addr]->hub; + hub = udev->parent_hs_hub->hub; if (slot >= USB_HS_MICRO_FRAMES_MAX) { slot = usb2_intr_find_best_slot(hub->uframe_usage, USB_FS_ISOC_UFRAME_MAX, 6); @@ -1232,7 +1232,7 @@ usb2_fs_isoc_schedule_isoc_time_expand(s isoc_time = usb2_isoc_time_expand(udev->bus, isoc_time); - hs_hub = udev->bus->devices[udev->hs_hub_addr]->hub; + hs_hub = udev->parent_hs_hub->hub; if (hs_hub != NULL) { From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 17:07:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 693B7106566B; Wed, 22 Apr 2009 17:07:56 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55CED8FC17; Wed, 22 Apr 2009 17:07:56 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MH7ub5062603; Wed, 22 Apr 2009 17:07:56 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MH7urT062602; Wed, 22 Apr 2009 17:07:56 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904221707.n3MH7urT062602@svn.freebsd.org> From: Andrew Thompson Date: Wed, 22 Apr 2009 17:07: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: r191396 - 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: Wed, 22 Apr 2009 17:07:56 -0000 Author: thompsa Date: Wed Apr 22 17:07:56 2009 New Revision: 191396 URL: http://svn.freebsd.org/changeset/base/191396 Log: MFp4 //depot/projects/usb@160485 Fix a bug in the USB power daemon code where connection of multiple HUBs in series would result in incorrect device suspend. Reported by: Nicolas xxx@wanadoo.fr Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Wed Apr 22 17:07:53 2009 (r191395) +++ head/sys/dev/usb/usb_hub.c Wed Apr 22 17:07:56 2009 (r191396) @@ -1786,12 +1786,10 @@ usb2_dev_resume_peer(struct usb2_device static void usb2_dev_suspend_peer(struct usb2_device *udev) { - struct usb2_device *hub; struct usb2_device *child; int err; uint8_t x; uint8_t nports; - uint8_t suspend_parent; repeat: /* be NULL safe */ @@ -1808,16 +1806,15 @@ repeat: DPRINTF("udev=%p\n", udev); - /* check if all devices on the parent hub are suspended */ - hub = udev->parent_hub; - if (hub != NULL) { - nports = hub->hub->nports; - suspend_parent = 1; + /* check if the current device is a HUB */ + if (udev->hub != NULL) { + nports = udev->hub->nports; + /* check if all devices on the HUB are suspended */ for (x = 0; x != nports; x++) { - child = usb2_bus_port_get_device(hub->bus, - hub->hub->ports + x); + child = usb2_bus_port_get_device(udev->bus, + udev->hub->ports + x); if (child == NULL) continue; @@ -1825,16 +1822,9 @@ repeat: if (child->pwr_save.suspended) continue; - if (child == udev) - continue; - - /* another device on the HUB is not suspended */ - suspend_parent = 0; - - break; + DPRINTFN(1, "Port %u is busy on the HUB!\n", x + 1); + return; } - } else { - suspend_parent = 0; } sx_xlock(udev->default_sx + 1); @@ -1877,11 +1867,9 @@ repeat: DPRINTFN(0, "Suspending port failed\n"); return; } - if (suspend_parent) { - udev = udev->parent_hub; - goto repeat; - } - return; + + udev = udev->parent_hub; + goto repeat; } /*------------------------------------------------------------------------* From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 17:07:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A29510656D3; Wed, 22 Apr 2009 17:07:59 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 635E08FC1C; Wed, 22 Apr 2009 17:07:59 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MH7xxi062643; Wed, 22 Apr 2009 17:07:59 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MH7xag062642; Wed, 22 Apr 2009 17:07:59 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904221707.n3MH7xag062642@svn.freebsd.org> From: Andrew Thompson Date: Wed, 22 Apr 2009 17:07: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: r191397 - 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: Wed, 22 Apr 2009 17:08:01 -0000 Author: thompsa Date: Wed Apr 22 17:07:59 2009 New Revision: 191397 URL: http://svn.freebsd.org/changeset/base/191397 Log: MFp4 //depot/projects/usb@160614 Fix errornous printout. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Wed Apr 22 17:07:56 2009 (r191396) +++ head/sys/dev/usb/usb_device.c Wed Apr 22 17:07:59 2009 (r191397) @@ -1111,7 +1111,8 @@ usb2_probe_and_attach_sub(struct usb2_de if (udev->flags.suspended) { err = DEVICE_SUSPEND(iface->subdev); - device_printf(iface->subdev, "Suspend failed\n"); + if (err) + device_printf(iface->subdev, "Suspend failed\n"); } return (0); /* success */ } else { From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 17:08:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 696FC10657AF; Wed, 22 Apr 2009 17:08:05 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB2838FC0C; Wed, 22 Apr 2009 17:08:04 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MH84Tn062684; Wed, 22 Apr 2009 17:08:04 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MH847w062683; Wed, 22 Apr 2009 17:08:04 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904221708.n3MH847w062683@svn.freebsd.org> From: Andrew Thompson Date: Wed, 22 Apr 2009 17:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191398 - 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: Wed, 22 Apr 2009 17:08:09 -0000 Author: thompsa Date: Wed Apr 22 17:08:04 2009 New Revision: 191398 URL: http://svn.freebsd.org/changeset/base/191398 Log: MFp4 //depot/projects/usb@160655 Fix possible issue with clear-stall and set-config happening at the same time. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Wed Apr 22 17:07:59 2009 (r191397) +++ head/sys/dev/usb/usb_device.c Wed Apr 22 17:08:04 2009 (r191398) @@ -724,22 +724,33 @@ usb2_config_parse(struct usb2_device *ud goto done; } } - udev->pipes_max = ep_max; - udev->pipes = NULL; - if (udev->pipes_max != 0) { - udev->pipes = malloc(sizeof(*pipe) * udev->pipes_max, + if (ep_max != 0) { + udev->pipes = malloc(sizeof(*pipe) * ep_max, M_USB, M_WAITOK | M_ZERO); if (udev->pipes == NULL) { err = USB_ERR_NOMEM; goto done; } + } else { + udev->pipes = NULL; } + USB_BUS_LOCK(udev->bus); + udev->pipes_max = ep_max; + /* reset any ongoing clear-stall */ + udev->pipe_curr = NULL; + USB_BUS_UNLOCK(udev->bus); } done: if (err) { if (cmd == USB_CFG_ALLOC) { cleanup: + USB_BUS_LOCK(udev->bus); + udev->pipes_max = 0; + /* reset any ongoing clear-stall */ + udev->pipe_curr = NULL; + USB_BUS_UNLOCK(udev->bus); + /* cleanup */ if (udev->ifaces != NULL) free(udev->ifaces, M_USB); @@ -749,7 +760,6 @@ cleanup: udev->ifaces = NULL; udev->pipes = NULL; udev->ifaces_max = 0; - udev->pipes_max = 0; } } return (err); From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 17:08:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFFA510657DF; Wed, 22 Apr 2009 17:08:07 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 813118FC20; Wed, 22 Apr 2009 17:08:07 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MH87gD062724; Wed, 22 Apr 2009 17:08:07 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MH87Ua062721; Wed, 22 Apr 2009 17:08:07 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904221708.n3MH87Ua062721@svn.freebsd.org> From: Andrew Thompson Date: Wed, 22 Apr 2009 17:08: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: r191399 - head/sys/dev/usb/controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 17:08:11 -0000 Author: thompsa Date: Wed Apr 22 17:08:07 2009 New Revision: 191399 URL: http://svn.freebsd.org/changeset/base/191399 Log: MFp4 //depot/projects/usb@160678 Remove unused field. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/at91dci.h head/sys/dev/usb/controller/atmegadci.h head/sys/dev/usb/controller/uss820dci.h Modified: head/sys/dev/usb/controller/at91dci.h ============================================================================== --- head/sys/dev/usb/controller/at91dci.h Wed Apr 22 17:08:04 2009 (r191398) +++ head/sys/dev/usb/controller/at91dci.h Wed Apr 22 17:08:07 2009 (r191399) @@ -203,7 +203,6 @@ struct at91dci_flags { struct at91dci_softc { struct usb2_bus sc_bus; union at91dci_hub_temp sc_hub_temp; - LIST_HEAD(, usb2_xfer) sc_interrupt_list_head; struct usb2_device *sc_devices[AT91_MAX_DEVICES]; struct resource *sc_io_res; Modified: head/sys/dev/usb/controller/atmegadci.h ============================================================================== --- head/sys/dev/usb/controller/atmegadci.h Wed Apr 22 17:08:04 2009 (r191398) +++ head/sys/dev/usb/controller/atmegadci.h Wed Apr 22 17:08:07 2009 (r191399) @@ -236,7 +236,6 @@ struct atmegadci_flags { struct atmegadci_softc { struct usb2_bus sc_bus; union atmegadci_hub_temp sc_hub_temp; - LIST_HEAD(, usb2_xfer) sc_interrupt_list_head; /* must be set by by the bus interface layer */ atmegadci_clocks_t *sc_clocks_on; Modified: head/sys/dev/usb/controller/uss820dci.h ============================================================================== --- head/sys/dev/usb/controller/uss820dci.h Wed Apr 22 17:08:04 2009 (r191398) +++ head/sys/dev/usb/controller/uss820dci.h Wed Apr 22 17:08:07 2009 (r191399) @@ -344,7 +344,6 @@ struct uss820_flags { struct uss820dci_softc { struct usb2_bus sc_bus; union uss820_hub_temp sc_hub_temp; - LIST_HEAD(, usb2_xfer) sc_interrupt_list_head; struct usb2_device *sc_devices[USS820_MAX_DEVICES]; struct resource *sc_io_res; From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 17:08:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98FCA10658C7; Wed, 22 Apr 2009 17:08:10 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 854AA8FC19; Wed, 22 Apr 2009 17:08:10 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MH8A1W062765; Wed, 22 Apr 2009 17:08:10 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MH8AaN062762; Wed, 22 Apr 2009 17:08:10 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904221708.n3MH8AaN062762@svn.freebsd.org> From: Andrew Thompson Date: Wed, 22 Apr 2009 17:08: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: r191400 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 17:08:13 -0000 Author: thompsa Date: Wed Apr 22 17:08:10 2009 New Revision: 191400 URL: http://svn.freebsd.org/changeset/base/191400 Log: MFp4 //depot/projects/usb@160706 Resolve possible device side mode deadlock by creating another thread. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_transfer.c Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Wed Apr 22 17:08:07 2009 (r191399) +++ head/sys/dev/usb/controller/usb_controller.c Wed Apr 22 17:08:10 2009 (r191400) @@ -169,6 +169,10 @@ usb2_detach(device_t dev) usb2_proc_free(&bus->explore_proc); + /* Get rid of control transfer process */ + + usb2_proc_free(&bus->control_xfer_proc); + return (0); } @@ -412,6 +416,10 @@ usb2_attach_sub(device_t dev, struct usb &bus->bus_mtx, pname, USB_PRI_MED)) { printf("WARNING: Creation of USB explore " "process failed.\n"); + } else if (usb2_proc_create(&bus->control_xfer_proc, + &bus->bus_mtx, pname, USB_PRI_MED)) { + printf("WARNING: Creation of USB control transfer " + "process failed.\n"); } else { /* Get final attach going */ USB_BUS_LOCK(bus); Modified: head/sys/dev/usb/usb_bus.h ============================================================================== --- head/sys/dev/usb/usb_bus.h Wed Apr 22 17:08:07 2009 (r191399) +++ head/sys/dev/usb/usb_bus.h Wed Apr 22 17:08:10 2009 (r191400) @@ -62,7 +62,6 @@ struct usb2_sw_transfer { struct usb2_bus { struct usb2_bus_stat stats_err; struct usb2_bus_stat stats_ok; - struct usb2_process explore_proc; struct usb2_sw_transfer roothub_req; struct root_hold_token *bus_roothold; /* @@ -72,6 +71,13 @@ struct usb2_bus { */ struct usb2_process giant_callback_proc; struct usb2_process non_giant_callback_proc; + + /* Explore process */ + struct usb2_process explore_proc; + + /* Control request process */ + struct usb2_process control_xfer_proc; + struct usb2_bus_msg explore_msg[2]; struct usb2_bus_msg detach_msg[2]; struct usb2_bus_msg attach_msg[2]; Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Wed Apr 22 17:08:07 2009 (r191399) +++ head/sys/dev/usb/usb_transfer.c Wed Apr 22 17:08:10 2009 (r191400) @@ -822,7 +822,16 @@ usb2_transfer_setup(struct usb2_device * info->done_m[1].hdr.pm_callback = &usb2_callback_proc; info->done_m[1].xroot = info; - if (xfer_mtx == &Giant) + /* + * In device side mode control endpoint + * requests need to run from a separate + * context, else there is a chance of + * deadlock! + */ + if (setup_start == usb2_control_ep_cfg) + info->done_p = + &udev->bus->control_xfer_proc; + else if (xfer_mtx == &Giant) info->done_p = &udev->bus->giant_callback_proc; else From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 17:08:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20353106591A; Wed, 22 Apr 2009 17:08:13 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 846DF8FC17; Wed, 22 Apr 2009 17:08:13 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MH8DMm062803; Wed, 22 Apr 2009 17:08:13 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MH8D68062802; Wed, 22 Apr 2009 17:08:13 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904221708.n3MH8D68062802@svn.freebsd.org> From: Andrew Thompson Date: Wed, 22 Apr 2009 17:08: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: r191401 - head/sys/dev/usb/controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 17:08:14 -0000 Author: thompsa Date: Wed Apr 22 17:08:13 2009 New Revision: 191401 URL: http://svn.freebsd.org/changeset/base/191401 Log: MFp4 //depot/projects/usb@160708 Need to check Read/Write allowed before writing any data for non-control transfers. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/atmegadci.c Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Wed Apr 22 17:08:10 2009 (r191400) +++ head/sys/dev/usb/controller/atmegadci.c Wed Apr 22 17:08:13 2009 (r191401) @@ -103,7 +103,6 @@ static const struct usb2_hw_ep_profile .max_in_frame_size = 64, .max_out_frame_size = 64, .is_simplex = 1, - .support_multi_buffer = 1, .support_bulk = 1, .support_interrupt = 1, .support_isochronous = 1, @@ -451,11 +450,13 @@ repeat: td->error = 1; return (0); /* complete */ } - if (!(temp & (ATMEGA_UEINTX_FIFOCON | - ATMEGA_UEINTX_TXINI))) { - /* cannot write any data */ + + temp = ATMEGA_READ_1(sc, ATMEGA_UESTA0X); + if (temp & 3) { + /* cannot write any data - a bank is busy */ goto not_complete; } + count = td->max_packet_size; if (td->remainder < count) { /* we have a short packet */ @@ -529,9 +530,9 @@ atmegadci_data_tx_sync(struct atmegadci_ * The control endpoint has only got one bank, so if that bank * is free the packet has been transferred! */ - if (!(temp & (ATMEGA_UEINTX_FIFOCON | - ATMEGA_UEINTX_TXINI))) { - /* cannot write any data */ + temp = ATMEGA_READ_1(sc, ATMEGA_UESTA0X); + if (temp & 3) { + /* cannot write any data - a bank is busy */ goto not_complete; } if (sc->sc_dv_addr != 0xFF) { @@ -1166,7 +1167,7 @@ atmegadci_clear_stall_sub(struct atmegad ATMEGA_WRITE_1(sc, ATMEGA_UECFG0X, temp); ATMEGA_WRITE_1(sc, ATMEGA_UECFG1X, ATMEGA_UECFG1X_ALLOC | - ATMEGA_UECFG1X_EPBK1 | + ATMEGA_UECFG1X_EPBK0 | /* one bank */ ATMEGA_UECFG1X_EPSIZE(3)); temp = ATMEGA_READ_1(sc, ATMEGA_UESTA0X); From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 17:08:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E9421065679; Wed, 22 Apr 2009 17:08:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0959F8FC24; Wed, 22 Apr 2009 17:08:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MH8GRK062847; Wed, 22 Apr 2009 17:08:16 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MH8GgP062840; Wed, 22 Apr 2009 17:08:16 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904221708.n3MH8GgP062840@svn.freebsd.org> From: Andrew Thompson Date: Wed, 22 Apr 2009 17:08: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: r191402 - in head/sys/dev/usb: . controller template X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 17:08:18 -0000 Author: thompsa Date: Wed Apr 22 17:08:16 2009 New Revision: 191402 URL: http://svn.freebsd.org/changeset/base/191402 Log: MFp4 //depot/projects/usb@160930 Change the roothub exec functions to take the usb request and data pointers directly rather than placing them on the parent bus struct. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/at91dci.c head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ehci.h head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/ohci.h head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/controller/uhci.h head/sys/dev/usb/controller/uss820dci.c head/sys/dev/usb/template/usb_template.c head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_controller.h head/sys/dev/usb/usb_core.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_dynamic.c head/sys/dev/usb/usb_dynamic.h head/sys/dev/usb/usb_handle_request.c head/sys/dev/usb/usb_request.c head/sys/dev/usb/usb_request.h Modified: head/sys/dev/usb/controller/at91dci.c ============================================================================== --- head/sys/dev/usb/controller/at91dci.c Wed Apr 22 17:08:13 2009 (r191401) +++ head/sys/dev/usb/controller/at91dci.c Wed Apr 22 17:08:16 2009 (r191402) @@ -1744,28 +1744,32 @@ USB_MAKE_STRING_DESC(STRING_LANG, at91dc USB_MAKE_STRING_DESC(STRING_VENDOR, at91dci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, at91dci_product); -static void -at91dci_roothub_exec(struct usb2_bus *bus) +static usb2_error_t +at91dci_roothub_exec(struct usb2_device *udev, + struct usb2_device_request *req, const void **pptr, uint16_t *plength) { - struct at91dci_softc *sc = AT9100_DCI_BUS2SC(bus); - struct usb2_sw_transfer *std = &sc->sc_bus.roothub_req; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(udev->bus); + const void *ptr; + uint16_t len; uint16_t value; uint16_t index; + usb2_error_t err; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); /* buffer reset */ - std->ptr = USB_ADD_BYTES(&sc->sc_hub_temp, 0); - std->len = 0; + ptr = (const void *)&sc->sc_hub_temp; + len = 0; + err = 0; - value = UGETW(std->req.wValue); - index = UGETW(std->req.wIndex); + value = UGETW(req->wValue); + index = UGETW(req->wIndex); /* demultiplex the control request */ - switch (std->req.bmRequestType) { + switch (req->bmRequestType) { case UT_READ_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_DESCRIPTOR: goto tr_handle_get_descriptor; case UR_GET_CONFIG: @@ -1778,7 +1782,7 @@ at91dci_roothub_exec(struct usb2_bus *bu break; case UT_WRITE_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_SET_ADDRESS: goto tr_handle_set_address; case UR_SET_CONFIG: @@ -1794,9 +1798,9 @@ at91dci_roothub_exec(struct usb2_bus *bu break; case UT_WRITE_ENDPOINT: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_CLEAR_FEATURE: - switch (UGETW(std->req.wValue)) { + switch (UGETW(req->wValue)) { case UF_ENDPOINT_HALT: goto tr_handle_clear_halt; case UF_DEVICE_REMOTE_WAKEUP: @@ -1806,7 +1810,7 @@ at91dci_roothub_exec(struct usb2_bus *bu } break; case UR_SET_FEATURE: - switch (UGETW(std->req.wValue)) { + switch (UGETW(req->wValue)) { case UF_ENDPOINT_HALT: goto tr_handle_set_halt; case UF_DEVICE_REMOTE_WAKEUP: @@ -1823,7 +1827,7 @@ at91dci_roothub_exec(struct usb2_bus *bu break; case UT_READ_ENDPOINT: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_STATUS: goto tr_handle_get_ep_status; default: @@ -1832,7 +1836,7 @@ at91dci_roothub_exec(struct usb2_bus *bu break; case UT_WRITE_INTERFACE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_SET_INTERFACE: goto tr_handle_set_interface; case UR_CLEAR_FEATURE: @@ -1844,7 +1848,7 @@ at91dci_roothub_exec(struct usb2_bus *bu break; case UT_READ_INTERFACE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_INTERFACE: goto tr_handle_get_interface; case UR_GET_STATUS: @@ -1865,7 +1869,7 @@ at91dci_roothub_exec(struct usb2_bus *bu break; case UT_WRITE_CLASS_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_CLEAR_FEATURE: goto tr_valid; case UR_SET_DESCRIPTOR: @@ -1877,7 +1881,7 @@ at91dci_roothub_exec(struct usb2_bus *bu break; case UT_WRITE_CLASS_OTHER: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_CLEAR_FEATURE: goto tr_handle_clear_port_feature; case UR_SET_FEATURE: @@ -1893,7 +1897,7 @@ at91dci_roothub_exec(struct usb2_bus *bu break; case UT_READ_CLASS_OTHER: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_TT_STATE: goto tr_handle_get_tt_state; case UR_GET_STATUS: @@ -1904,7 +1908,7 @@ at91dci_roothub_exec(struct usb2_bus *bu break; case UT_READ_CLASS_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_DESCRIPTOR: goto tr_handle_get_class_descriptor; case UR_GET_STATUS: @@ -1925,31 +1929,31 @@ tr_handle_get_descriptor: if (value & 0xff) { goto tr_stalled; } - std->len = sizeof(at91dci_devd); - std->ptr = USB_ADD_BYTES(&at91dci_devd, 0); + len = sizeof(at91dci_devd); + ptr = (const void *)&at91dci_devd; goto tr_valid; case UDESC_CONFIG: if (value & 0xff) { goto tr_stalled; } - std->len = sizeof(at91dci_confd); - std->ptr = USB_ADD_BYTES(&at91dci_confd, 0); + len = sizeof(at91dci_confd); + ptr = (const void *)&at91dci_confd; goto tr_valid; case UDESC_STRING: switch (value & 0xff) { case 0: /* Language table */ - std->len = sizeof(at91dci_langtab); - std->ptr = USB_ADD_BYTES(&at91dci_langtab, 0); + len = sizeof(at91dci_langtab); + ptr = (const void *)&at91dci_langtab; goto tr_valid; case 1: /* Vendor */ - std->len = sizeof(at91dci_vendor); - std->ptr = USB_ADD_BYTES(&at91dci_vendor, 0); + len = sizeof(at91dci_vendor); + ptr = (const void *)&at91dci_vendor; goto tr_valid; case 2: /* Product */ - std->len = sizeof(at91dci_product); - std->ptr = USB_ADD_BYTES(&at91dci_product, 0); + len = sizeof(at91dci_product); + ptr = (const void *)&at91dci_product; goto tr_valid; default: break; @@ -1961,12 +1965,12 @@ tr_handle_get_descriptor: goto tr_stalled; tr_handle_get_config: - std->len = 1; + len = 1; sc->sc_hub_temp.wValue[0] = sc->sc_conf; goto tr_valid; tr_handle_get_status: - std->len = 2; + len = 2; USETW(sc->sc_hub_temp.wValue, UDS_SELF_POWERED); goto tr_valid; @@ -1985,7 +1989,7 @@ tr_handle_set_config: goto tr_valid; tr_handle_get_interface: - std->len = 1; + len = 1; sc->sc_hub_temp.wValue[0] = 0; goto tr_valid; @@ -1993,7 +1997,7 @@ tr_handle_get_tt_state: tr_handle_get_class_status: tr_handle_get_iface_status: tr_handle_get_ep_status: - std->len = 2; + len = 2; USETW(sc->sc_hub_temp.wValue, 0); goto tr_valid; @@ -2038,7 +2042,7 @@ tr_handle_clear_port_feature: sc->sc_flags.change_suspend = 0; break; default: - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } goto tr_valid; @@ -2063,7 +2067,7 @@ tr_handle_set_port_feature: sc->sc_flags.port_powered = 1; break; default: - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } goto tr_valid; @@ -2117,22 +2121,24 @@ tr_handle_get_port_status: value |= UPS_C_SUSPEND; } USETW(sc->sc_hub_temp.ps.wPortChange, value); - std->len = sizeof(sc->sc_hub_temp.ps); + len = sizeof(sc->sc_hub_temp.ps); goto tr_valid; tr_handle_get_class_descriptor: if (value & 0xFF) { goto tr_stalled; } - std->ptr = USB_ADD_BYTES(&at91dci_hubd, 0); - std->len = sizeof(at91dci_hubd); + ptr = (const void *)&at91dci_hubd; + len = sizeof(at91dci_hubd); goto tr_valid; tr_stalled: - std->err = USB_ERR_STALLED; + err = USB_ERR_STALLED; tr_valid: done: - return; + *plength = len; + *pptr = ptr; + return (err); } static void Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Wed Apr 22 17:08:13 2009 (r191401) +++ head/sys/dev/usb/controller/atmegadci.c Wed Apr 22 17:08:16 2009 (r191402) @@ -1551,29 +1551,33 @@ USB_MAKE_STRING_DESC(STRING_LANG, atmega USB_MAKE_STRING_DESC(STRING_VENDOR, atmegadci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, atmegadci_product); -static void -atmegadci_roothub_exec(struct usb2_bus *bus) +static usb2_error_t +atmegadci_roothub_exec(struct usb2_device *udev, + struct usb2_device_request *req, const void **pptr, uint16_t *plength) { - struct atmegadci_softc *sc = ATMEGA_BUS2SC(bus); - struct usb2_sw_transfer *std = &sc->sc_bus.roothub_req; + struct atmegadci_softc *sc = ATMEGA_BUS2SC(udev->bus); + const void *ptr; + uint16_t len; uint16_t value; uint16_t index; uint8_t temp; + usb2_error_t err; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); /* buffer reset */ - std->ptr = USB_ADD_BYTES(&sc->sc_hub_temp, 0); - std->len = 0; + ptr = (const void *)&sc->sc_hub_temp; + len = 0; + err = 0; - value = UGETW(std->req.wValue); - index = UGETW(std->req.wIndex); + value = UGETW(req->wValue); + index = UGETW(req->wIndex); /* demultiplex the control request */ - switch (std->req.bmRequestType) { + switch (req->bmRequestType) { case UT_READ_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_DESCRIPTOR: goto tr_handle_get_descriptor; case UR_GET_CONFIG: @@ -1586,7 +1590,7 @@ atmegadci_roothub_exec(struct usb2_bus * break; case UT_WRITE_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_SET_ADDRESS: goto tr_handle_set_address; case UR_SET_CONFIG: @@ -1602,9 +1606,9 @@ atmegadci_roothub_exec(struct usb2_bus * break; case UT_WRITE_ENDPOINT: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_CLEAR_FEATURE: - switch (UGETW(std->req.wValue)) { + switch (UGETW(req->wValue)) { case UF_ENDPOINT_HALT: goto tr_handle_clear_halt; case UF_DEVICE_REMOTE_WAKEUP: @@ -1614,7 +1618,7 @@ atmegadci_roothub_exec(struct usb2_bus * } break; case UR_SET_FEATURE: - switch (UGETW(std->req.wValue)) { + switch (UGETW(req->wValue)) { case UF_ENDPOINT_HALT: goto tr_handle_set_halt; case UF_DEVICE_REMOTE_WAKEUP: @@ -1631,7 +1635,7 @@ atmegadci_roothub_exec(struct usb2_bus * break; case UT_READ_ENDPOINT: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_STATUS: goto tr_handle_get_ep_status; default: @@ -1640,7 +1644,7 @@ atmegadci_roothub_exec(struct usb2_bus * break; case UT_WRITE_INTERFACE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_SET_INTERFACE: goto tr_handle_set_interface; case UR_CLEAR_FEATURE: @@ -1652,7 +1656,7 @@ atmegadci_roothub_exec(struct usb2_bus * break; case UT_READ_INTERFACE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_INTERFACE: goto tr_handle_get_interface; case UR_GET_STATUS: @@ -1673,7 +1677,7 @@ atmegadci_roothub_exec(struct usb2_bus * break; case UT_WRITE_CLASS_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_CLEAR_FEATURE: goto tr_valid; case UR_SET_DESCRIPTOR: @@ -1685,7 +1689,7 @@ atmegadci_roothub_exec(struct usb2_bus * break; case UT_WRITE_CLASS_OTHER: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_CLEAR_FEATURE: goto tr_handle_clear_port_feature; case UR_SET_FEATURE: @@ -1701,7 +1705,7 @@ atmegadci_roothub_exec(struct usb2_bus * break; case UT_READ_CLASS_OTHER: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_TT_STATE: goto tr_handle_get_tt_state; case UR_GET_STATUS: @@ -1712,7 +1716,7 @@ atmegadci_roothub_exec(struct usb2_bus * break; case UT_READ_CLASS_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_DESCRIPTOR: goto tr_handle_get_class_descriptor; case UR_GET_STATUS: @@ -1733,31 +1737,31 @@ tr_handle_get_descriptor: if (value & 0xff) { goto tr_stalled; } - std->len = sizeof(atmegadci_devd); - std->ptr = USB_ADD_BYTES(&atmegadci_devd, 0); + len = sizeof(atmegadci_devd); + ptr = (const void *)&atmegadci_devd; goto tr_valid; case UDESC_CONFIG: if (value & 0xff) { goto tr_stalled; } - std->len = sizeof(atmegadci_confd); - std->ptr = USB_ADD_BYTES(&atmegadci_confd, 0); + len = sizeof(atmegadci_confd); + ptr = (const void *)&atmegadci_confd; goto tr_valid; case UDESC_STRING: switch (value & 0xff) { case 0: /* Language table */ - std->len = sizeof(atmegadci_langtab); - std->ptr = USB_ADD_BYTES(&atmegadci_langtab, 0); + len = sizeof(atmegadci_langtab); + ptr = (const void *)&atmegadci_langtab; goto tr_valid; case 1: /* Vendor */ - std->len = sizeof(atmegadci_vendor); - std->ptr = USB_ADD_BYTES(&atmegadci_vendor, 0); + len = sizeof(atmegadci_vendor); + ptr = (const void *)&atmegadci_vendor; goto tr_valid; case 2: /* Product */ - std->len = sizeof(atmegadci_product); - std->ptr = USB_ADD_BYTES(&atmegadci_product, 0); + len = sizeof(atmegadci_product); + ptr = (const void *)&atmegadci_product; goto tr_valid; default: break; @@ -1769,12 +1773,12 @@ tr_handle_get_descriptor: goto tr_stalled; tr_handle_get_config: - std->len = 1; + len = 1; sc->sc_hub_temp.wValue[0] = sc->sc_conf; goto tr_valid; tr_handle_get_status: - std->len = 2; + len = 2; USETW(sc->sc_hub_temp.wValue, UDS_SELF_POWERED); goto tr_valid; @@ -1793,7 +1797,7 @@ tr_handle_set_config: goto tr_valid; tr_handle_get_interface: - std->len = 1; + len = 1; sc->sc_hub_temp.wValue[0] = 0; goto tr_valid; @@ -1801,7 +1805,7 @@ tr_handle_get_tt_state: tr_handle_get_class_status: tr_handle_get_iface_status: tr_handle_get_ep_status: - std->len = 2; + len = 2; USETW(sc->sc_hub_temp.wValue, 0); goto tr_valid; @@ -1877,7 +1881,7 @@ tr_handle_clear_port_feature: sc->sc_flags.change_suspend = 0; break; default: - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } goto tr_valid; @@ -1902,7 +1906,7 @@ tr_handle_set_port_feature: sc->sc_flags.port_powered = 1; break; default: - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } goto tr_valid; @@ -1950,22 +1954,24 @@ tr_handle_get_port_status: value |= UPS_C_SUSPEND; } USETW(sc->sc_hub_temp.ps.wPortChange, value); - std->len = sizeof(sc->sc_hub_temp.ps); + len = sizeof(sc->sc_hub_temp.ps); goto tr_valid; tr_handle_get_class_descriptor: if (value & 0xFF) { goto tr_stalled; } - std->ptr = USB_ADD_BYTES(&atmegadci_hubd, 0); - std->len = sizeof(atmegadci_hubd); + ptr = (const void *)&atmegadci_hubd; + len = sizeof(atmegadci_hubd); goto tr_valid; tr_stalled: - std->err = USB_ERR_STALLED; + err = USB_ERR_STALLED; tr_valid: done: - return; + *plength = len; + *pptr = ptr; + return (err); } static void Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Wed Apr 22 17:08:13 2009 (r191401) +++ head/sys/dev/usb/controller/ehci.c Wed Apr 22 17:08:16 2009 (r191402) @@ -2987,35 +2987,39 @@ ehci_disown(ehci_softc_t *sc, uint16_t i EOWRITE4(sc, port, v | EHCI_PS_PO); } -static void -ehci_roothub_exec(struct usb2_bus *bus) +static usb2_error_t +ehci_roothub_exec(struct usb2_device *udev, + struct usb2_device_request *req, const void **pptr, uint16_t *plength) { - ehci_softc_t *sc = EHCI_BUS2SC(bus); - struct usb2_sw_transfer *std = &sc->sc_bus.roothub_req; - char *ptr; + ehci_softc_t *sc = EHCI_BUS2SC(udev->bus); + const char *str_ptr; + const void *ptr; uint32_t port; uint32_t v; + uint16_t len; uint16_t i; uint16_t value; uint16_t index; uint8_t l; + usb2_error_t err; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); /* buffer reset */ - std->ptr = sc->sc_hub_desc.temp; - std->len = 0; + ptr = (const void *)&sc->sc_hub_desc; + len = 0; + err = 0; - value = UGETW(std->req.wValue); - index = UGETW(std->req.wIndex); + value = UGETW(req->wValue); + index = UGETW(req->wIndex); DPRINTFN(3, "type=0x%02x request=0x%02x wLen=0x%04x " "wValue=0x%04x wIndex=0x%04x\n", - std->req.bmRequestType, std->req.bRequest, - UGETW(std->req.wLength), value, index); + req->bmRequestType, req->bRequest, + UGETW(req->wLength), value, index); #define C(x,y) ((x) | ((y) << 8)) - switch (C(std->req.bRequest, std->req.bmRequestType)) { + switch (C(req->bRequest, req->bmRequestType)) { case C(UR_CLEAR_FEATURE, UT_WRITE_DEVICE): case C(UR_CLEAR_FEATURE, UT_WRITE_INTERFACE): case C(UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT): @@ -3025,18 +3029,18 @@ ehci_roothub_exec(struct usb2_bus *bus) */ break; case C(UR_GET_CONFIG, UT_READ_DEVICE): - std->len = 1; + len = 1; sc->sc_hub_desc.temp[0] = sc->sc_conf; break; case C(UR_GET_DESCRIPTOR, UT_READ_DEVICE): switch (value >> 8) { case UDESC_DEVICE: if ((value & 0xff) != 0) { - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } - std->len = sizeof(ehci_devd); - sc->sc_hub_desc.devd = ehci_devd; + len = sizeof(ehci_devd); + ptr = (const void *)&ehci_devd; break; /* * We can't really operate at another speed, @@ -3045,74 +3049,74 @@ ehci_roothub_exec(struct usb2_bus *bus) */ case UDESC_DEVICE_QUALIFIER: if ((value & 0xff) != 0) { - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } - std->len = sizeof(ehci_odevd); - sc->sc_hub_desc.odevd = ehci_odevd; + len = sizeof(ehci_odevd); + ptr = (const void *)&ehci_odevd; break; case UDESC_CONFIG: if ((value & 0xff) != 0) { - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } - std->len = sizeof(ehci_confd); - std->ptr = USB_ADD_BYTES(&ehci_confd, 0); + len = sizeof(ehci_confd); + ptr = (const void *)&ehci_confd; break; case UDESC_STRING: switch (value & 0xff) { case 0: /* Language table */ - ptr = "\001"; + str_ptr = "\001"; break; case 1: /* Vendor */ - ptr = sc->sc_vendor; + str_ptr = sc->sc_vendor; break; case 2: /* Product */ - ptr = "EHCI root HUB"; + str_ptr = "EHCI root HUB"; break; default: - ptr = ""; + str_ptr = ""; break; } - std->len = usb2_make_str_desc - (sc->sc_hub_desc.temp, + len = usb2_make_str_desc( + sc->sc_hub_desc.temp, sizeof(sc->sc_hub_desc.temp), - ptr); + str_ptr); break; default: - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } break; case C(UR_GET_INTERFACE, UT_READ_INTERFACE): - std->len = 1; + len = 1; sc->sc_hub_desc.temp[0] = 0; break; case C(UR_GET_STATUS, UT_READ_DEVICE): - std->len = 2; + len = 2; USETW(sc->sc_hub_desc.stat.wStatus, UDS_SELF_POWERED); break; case C(UR_GET_STATUS, UT_READ_INTERFACE): case C(UR_GET_STATUS, UT_READ_ENDPOINT): - std->len = 2; + len = 2; USETW(sc->sc_hub_desc.stat.wStatus, 0); break; case C(UR_SET_ADDRESS, UT_WRITE_DEVICE): if (value >= EHCI_MAX_DEVICES) { - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } sc->sc_addr = value; break; case C(UR_SET_CONFIG, UT_WRITE_DEVICE): if ((value != 0) && (value != 1)) { - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } sc->sc_conf = value; @@ -3122,7 +3126,7 @@ ehci_roothub_exec(struct usb2_bus *bus) case C(UR_SET_FEATURE, UT_WRITE_DEVICE): case C(UR_SET_FEATURE, UT_WRITE_INTERFACE): case C(UR_SET_FEATURE, UT_WRITE_ENDPOINT): - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; case C(UR_SET_INTERFACE, UT_WRITE_INTERFACE): break; @@ -3136,7 +3140,7 @@ ehci_roothub_exec(struct usb2_bus *bus) if ((index < 1) || (index > sc->sc_noport)) { - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } port = EHCI_PORTSC(index); @@ -3191,13 +3195,13 @@ ehci_roothub_exec(struct usb2_bus *bus) sc->sc_isreset = 0; break; default: - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } break; case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE): if ((value & 0xff) != 0) { - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } v = EOREAD4(sc, EHCI_HCSPARAMS); @@ -3216,10 +3220,10 @@ ehci_roothub_exec(struct usb2_bus *bus) } sc->sc_hub_desc.hubd.bDescLength = 8 + ((sc->sc_noport + 7) / 8); - std->len = sc->sc_hub_desc.hubd.bDescLength; + len = sc->sc_hub_desc.hubd.bDescLength; break; case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE): - std->len = 16; + len = 16; bzero(sc->sc_hub_desc.temp, 16); break; case C(UR_GET_STATUS, UT_READ_CLASS_OTHER): @@ -3227,7 +3231,7 @@ ehci_roothub_exec(struct usb2_bus *bus) index); if ((index < 1) || (index > sc->sc_noport)) { - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } v = EOREAD4(sc, EHCI_PORTSC(index)); @@ -3267,17 +3271,17 @@ ehci_roothub_exec(struct usb2_bus *bus) if (sc->sc_isreset) i |= UPS_C_PORT_RESET; USETW(sc->sc_hub_desc.ps.wPortChange, i); - std->len = sizeof(sc->sc_hub_desc.ps); + len = sizeof(sc->sc_hub_desc.ps); break; case C(UR_SET_DESCRIPTOR, UT_WRITE_CLASS_DEVICE): - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; case C(UR_SET_FEATURE, UT_WRITE_CLASS_DEVICE): break; case C(UR_SET_FEATURE, UT_WRITE_CLASS_OTHER): if ((index < 1) || (index > sc->sc_noport)) { - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } port = EHCI_PORTSC(index); @@ -3328,7 +3332,7 @@ ehci_roothub_exec(struct usb2_bus *bus) if (v & EHCI_PS_PR) { device_printf(sc->sc_bus.bdev, "port reset timeout\n"); - std->err = USB_ERR_TIMEOUT; + err = USB_ERR_TIMEOUT; goto done; } if (!(v & EHCI_PS_PE) && @@ -3357,7 +3361,7 @@ ehci_roothub_exec(struct usb2_bus *bus) break; default: - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } break; @@ -3367,11 +3371,13 @@ ehci_roothub_exec(struct usb2_bus *bus) case C(UR_STOP_TT, UT_WRITE_CLASS_OTHER): break; default: - std->err = USB_ERR_IOERROR; + err = USB_ERR_IOERROR; goto done; } done: - return; + *plength = len; + *pptr = ptr; + return (err); } static void Modified: head/sys/dev/usb/controller/ehci.h ============================================================================== --- head/sys/dev/usb/controller/ehci.h Wed Apr 22 17:08:13 2009 (r191401) +++ head/sys/dev/usb/controller/ehci.h Wed Apr 22 17:08:16 2009 (r191402) @@ -446,8 +446,6 @@ struct ehci_config_desc { union ehci_hub_desc { struct usb2_status stat; struct usb2_port_status ps; - struct usb2_device_descriptor devd; - struct usb2_device_qualifier odevd; struct usb2_hub_descriptor hubd; uint8_t temp[128]; }; Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Wed Apr 22 17:08:13 2009 (r191401) +++ head/sys/dev/usb/controller/musb_otg.c Wed Apr 22 17:08:16 2009 (r191402) @@ -2152,28 +2152,32 @@ USB_MAKE_STRING_DESC(STRING_LANG, musbot USB_MAKE_STRING_DESC(STRING_VENDOR, musbotg_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, musbotg_product); -static void -musbotg_roothub_exec(struct usb2_bus *bus) +static usb2_error_t +musbotg_roothub_exec(struct usb2_device *udev, + struct usb2_device_request *req, const void **pptr, uint16_t *plength) { - struct musbotg_softc *sc = MUSBOTG_BUS2SC(bus); - struct usb2_sw_transfer *std = &sc->sc_bus.roothub_req; + struct musbotg_softc *sc = MUSBOTG_BUS2SC(udev->bus); + const void *ptr; + uint16_t len; uint16_t value; uint16_t index; + usb2_error_t err; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); /* buffer reset */ - std->ptr = USB_ADD_BYTES(&sc->sc_hub_temp, 0); - std->len = 0; + ptr = (const void *)&sc->sc_hub_temp; + len = 0; + err = 0; - value = UGETW(std->req.wValue); - index = UGETW(std->req.wIndex); + value = UGETW(req->wValue); + index = UGETW(req->wIndex); /* demultiplex the control request */ - switch (std->req.bmRequestType) { + switch (req->bmRequestType) { case UT_READ_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_DESCRIPTOR: goto tr_handle_get_descriptor; case UR_GET_CONFIG: @@ -2186,7 +2190,7 @@ musbotg_roothub_exec(struct usb2_bus *bu break; case UT_WRITE_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_SET_ADDRESS: goto tr_handle_set_address; case UR_SET_CONFIG: @@ -2202,9 +2206,9 @@ musbotg_roothub_exec(struct usb2_bus *bu break; case UT_WRITE_ENDPOINT: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_CLEAR_FEATURE: - switch (UGETW(std->req.wValue)) { + switch (UGETW(req->wValue)) { case UF_ENDPOINT_HALT: goto tr_handle_clear_halt; case UF_DEVICE_REMOTE_WAKEUP: @@ -2214,7 +2218,7 @@ musbotg_roothub_exec(struct usb2_bus *bu } break; case UR_SET_FEATURE: - switch (UGETW(std->req.wValue)) { + switch (UGETW(req->wValue)) { case UF_ENDPOINT_HALT: goto tr_handle_set_halt; case UF_DEVICE_REMOTE_WAKEUP: @@ -2231,7 +2235,7 @@ musbotg_roothub_exec(struct usb2_bus *bu break; case UT_READ_ENDPOINT: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_STATUS: goto tr_handle_get_ep_status; default: @@ -2240,7 +2244,7 @@ musbotg_roothub_exec(struct usb2_bus *bu break; case UT_WRITE_INTERFACE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_SET_INTERFACE: goto tr_handle_set_interface; case UR_CLEAR_FEATURE: @@ -2252,7 +2256,7 @@ musbotg_roothub_exec(struct usb2_bus *bu break; case UT_READ_INTERFACE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_INTERFACE: goto tr_handle_get_interface; case UR_GET_STATUS: @@ -2273,7 +2277,7 @@ musbotg_roothub_exec(struct usb2_bus *bu break; case UT_WRITE_CLASS_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_CLEAR_FEATURE: goto tr_valid; case UR_SET_DESCRIPTOR: @@ -2285,7 +2289,7 @@ musbotg_roothub_exec(struct usb2_bus *bu break; case UT_WRITE_CLASS_OTHER: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_CLEAR_FEATURE: goto tr_handle_clear_port_feature; case UR_SET_FEATURE: @@ -2301,7 +2305,7 @@ musbotg_roothub_exec(struct usb2_bus *bu break; case UT_READ_CLASS_OTHER: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_TT_STATE: goto tr_handle_get_tt_state; case UR_GET_STATUS: @@ -2312,7 +2316,7 @@ musbotg_roothub_exec(struct usb2_bus *bu break; case UT_READ_CLASS_DEVICE: - switch (std->req.bRequest) { + switch (req->bRequest) { case UR_GET_DESCRIPTOR: goto tr_handle_get_class_descriptor; case UR_GET_STATUS: @@ -2333,31 +2337,31 @@ tr_handle_get_descriptor: if (value & 0xff) { goto tr_stalled; } - std->len = sizeof(musbotg_devd); - std->ptr = USB_ADD_BYTES(&musbotg_devd, 0); + len = sizeof(musbotg_devd); + ptr = (const void *)&musbotg_devd; goto tr_valid; case UDESC_CONFIG: if (value & 0xff) { goto tr_stalled; } - std->len = sizeof(musbotg_confd); - std->ptr = USB_ADD_BYTES(&musbotg_confd, 0); + len = sizeof(musbotg_confd); + ptr = (const void *)&musbotg_confd; goto tr_valid; case UDESC_STRING: switch (value & 0xff) { case 0: /* Language table */ - std->len = sizeof(musbotg_langtab); - std->ptr = USB_ADD_BYTES(&musbotg_langtab, 0); + len = sizeof(musbotg_langtab); + ptr = (const void *)&musbotg_langtab; goto tr_valid; case 1: /* Vendor */ - std->len = sizeof(musbotg_vendor); - std->ptr = USB_ADD_BYTES(&musbotg_vendor, 0); + len = sizeof(musbotg_vendor); + ptr = (const void *)&musbotg_vendor; goto tr_valid; case 2: /* Product */ - std->len = sizeof(musbotg_product); - std->ptr = USB_ADD_BYTES(&musbotg_product, 0); + len = sizeof(musbotg_product); + ptr = (const void *)&musbotg_product; goto tr_valid; default: break; @@ -2369,12 +2373,12 @@ tr_handle_get_descriptor: goto tr_stalled; tr_handle_get_config: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 19:27:45 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4535F106566C for ; Wed, 22 Apr 2009 19:27:45 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id E841E8FC19 for ; Wed, 22 Apr 2009 19:27:44 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id C625D8FC51 for ; Wed, 22 Apr 2009 23:15:15 +0400 (MSD) Received: from orion.SpringDaemons.com (unknown [77.232.3.143]) by mx0.deglitch.com (Postfix) with ESMTPA id 24EF58FC18; Wed, 22 Apr 2009 23:15:11 +0400 (MSD) Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id BF0C139827; Wed, 22 Apr 2009 23:15:11 +0400 (MSD) Date: Wed, 22 Apr 2009 23:15:11 +0400 From: Stanislav Sedov To: Alexander Leidinger Message-Id: <20090422231511.ca92fb9f.stas@FreeBSD.org> In-Reply-To: <20090422090546.110752s7m6p5ao84@webmail.leidinger.net> References: <200904212248.n3LMmCbu027432@svn.freebsd.org> <20090422.002643.639875625.imp@bsdimp.com> <20090422090546.110752s7m6p5ao84@webmail.leidinger.net> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Innocent X-DSPAM-Processed: Wed Apr 22 23:15:15 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 49ef6cc3967001882464521 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "M. Warner Losh" Subject: Re: svn commit: r191369 - in head/sys: arm/conf 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, 22 Apr 2009 19:27:45 -0000 On Wed, 22 Apr 2009 09:05:46 +0200 Alexander Leidinger mentioned: > Quoting "M. Warner Losh" (from Wed, 22 Apr 2009 > 00:26:43 -0600 (MDT)): > > > In message: <200904212248.n3LMmCbu027432@svn.freebsd.org> > > Stanislav Sedov writes: > > : Author: stas > > : Date: Tue Apr 21 22:48:12 2009 > > : New Revision: 191369 > > : URL: http://svn.freebsd.org/changeset/base/191369 > > : > > : Log: > > : - Rename ds1672 and ds133x devices to "ds1672_rtc" and "ds133x_rtc" > > : respectivly. This will allow one to have a kernel with both devices > > : present and use it for multiple boards with different types of RTC > > : sitting on a bus. > > : > > : Discussed with: imp > > > > Hey thanks Stas! Now things are better than before both functionally > > and cosmetically! Good idea on the names... > > > Are those the first devices with an underscore in the name now? If > yes, do we want this? > > I had the same concerns too, but was not able to come up with anything better. BTW, I think those devices were the first that ended with a digit. -- Stanislav Sedov ST4096-RIPE !DSPAM:49ef6cc3967001882464521! From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 19:32:28 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 951841065674; Wed, 22 Apr 2009 19:32:28 +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 085BF8FC2F; Wed, 22 Apr 2009 19:32:27 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n3MJUgcp016783; Wed, 22 Apr 2009 13:30:43 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 22 Apr 2009 13:31:47 -0600 (MDT) Message-Id: <20090422.133147.-1890035357.imp@bsdimp.com> To: stas@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20090422231511.ca92fb9f.stas@FreeBSD.org> References: <20090422.002643.639875625.imp@bsdimp.com> <20090422090546.110752s7m6p5ao84@webmail.leidinger.net> <20090422231511.ca92fb9f.stas@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, Alexander@Leidinger.net, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191369 - in head/sys: arm/conf 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, 22 Apr 2009 19:32:29 -0000 In message: <20090422231511.ca92fb9f.stas@FreeBSD.org> Stanislav Sedov writes: : On Wed, 22 Apr 2009 09:05:46 +0200 : Alexander Leidinger mentioned: : : > Quoting "M. Warner Losh" (from Wed, 22 Apr 2009 : > 00:26:43 -0600 (MDT)): : > : > > In message: <200904212248.n3LMmCbu027432@svn.freebsd.org> : > > Stanislav Sedov writes: : > > : Author: stas : > > : Date: Tue Apr 21 22:48:12 2009 : > > : New Revision: 191369 : > > : URL: http://svn.freebsd.org/changeset/base/191369 : > > : : > > : Log: : > > : - Rename ds1672 and ds133x devices to "ds1672_rtc" and "ds133x_rtc" : > > : respectivly. This will allow one to have a kernel with both devices : > > : present and use it for multiple boards with different types of RTC : > > : sitting on a bus. : > > : : > > : Discussed with: imp : > > : > > Hey thanks Stas! Now things are better than before both functionally : > > and cosmetically! Good idea on the names... : > : > : > Are those the first devices with an underscore in the name now? If : > yes, do we want this? : > : > : : I had the same concerns too, but was not able to come up with anything : better. BTW, I think those devices were the first that ended with a : digit. No. They weren't. There are sound devices that end in digits: # snd_ad1816: Analog Devices AD1816 ISA PnP/non-PnP. # snd_als4000: Avance Logic ALS4000 PCI. # snd_cs4281: Crystal Semiconductor CS4281 PCI. # snd_ds1: Yamaha DS-1 PCI. # snd_emu10k1: Creative EMU10K1 PCI and EMU10K2 (Audigy) PCI. # snd_envy24: VIA Envy24 and compatible, needs snd_spicds. # snd_fm801: Forte Media FM801 PCI. # snd_maestro3: ESS Technology Maestro-3/Allegro PCI. # snd_sb16: Creative SoundBlaster16, to be used in # snd_sb8: Creative SoundBlaster (pre-16), to be used in # snd_via8233: VIA VT8233x PCI. # snd_via82c686: VIA VT82C686A PCI. but since they all live on an enumerated bus, they all share the name "pcm". There are also these: device tnt4882 Nat Ins PCI GPIB card (which does have the digit in the name: static driver_t pci_gpib_driver = { "tnt4882", tnt4882_methods, sizeof(struct tnt_softc) }; ) and the following which are just config options: #device ath_ar5210 # AR5210 chips #device ath_ar5211 # AR5211 chips #device ath_ar5212 # AR5212 chips #device ath_rf2413 #device ath_rf2417 #device ath_rf2425 #device ath_rf5111 #device ath_rf5112 #device ath_rf5413 #device ath_ar5416 # AR5416 chips Interestingly, drm avoids this by: device drm # DRM core module required by DRM drivers device i915drm # Intel i830 through i915 device mach64drm # ATI Rage Pro, Rage Mobility P/M, Rage XL device mgadrm # AGP Matrox G200, G400, G450, G550 device r128drm # ATI Rage 128 I've also been at companies (well one) that have device names that end in digits. Warner From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 20:49:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57A2B106568C; Wed, 22 Apr 2009 20:49:54 +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 45A4C8FC1B; Wed, 22 Apr 2009 20:49:54 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MKnsdh067217; Wed, 22 Apr 2009 20:49:54 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MKnsLQ067216; Wed, 22 Apr 2009 20:49:54 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200904222049.n3MKnsLQ067216@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 22 Apr 2009 20:49: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: r191403 - 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, 22 Apr 2009 20:49:54 -0000 Author: bz Date: Wed Apr 22 20:49:54 2009 New Revision: 191403 URL: http://svn.freebsd.org/changeset/base/191403 Log: Correct a comment: the function name given had never existed in any (relevant) version of this file orany of my patches. MFC after: 1 month Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Wed Apr 22 17:08:16 2009 (r191402) +++ head/sys/kern/kern_cpuset.c Wed Apr 22 20:49:54 2009 (r191403) @@ -716,7 +716,8 @@ cpuset_thread0(void) * Create a cpuset, which would be cpuset_create() but * mark the new 'set' as root. * - * We are not going to reparent the td to it. Use cpuset_reparentproc() for that. + * We are not going to reparent the td to it. Use cpuset_setproc_update_set() + * for that. * * In case of no error, returns the set in *setp locked with a reference. */ From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 21:23:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0B08106566B for ; Wed, 22 Apr 2009 21:23:10 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id 42B398FC1F for ; Wed, 22 Apr 2009 21:23:10 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from DSPAM-Daemon (localhost [127.0.0.1]) by mx0.deglitch.com (Postfix) with SMTP id 4CCAF8FC51 for ; Thu, 23 Apr 2009 01:23:09 +0400 (MSD) Received: from orion.SpringDaemons.com (unknown [77.232.3.143]) by mx0.deglitch.com (Postfix) with ESMTPA id 91C428FC18; Thu, 23 Apr 2009 01:23:06 +0400 (MSD) Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id 1AD2639827; Thu, 23 Apr 2009 01:23:06 +0400 (MSD) Date: Thu, 23 Apr 2009 01:23:06 +0400 From: Stanislav Sedov To: Ed Schouten Message-Id: <20090423012306.01a2e5e4.stas@FreeBSD.org> In-Reply-To: <200904141402.n3EE2hwB007748@svn.freebsd.org> References: <200904141402.n3EE2hwB007748@svn.freebsd.org> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Thu Apr 23 01:23:09 2009 X-DSPAM-Confidence: 0.9899 X-DSPAM-Improbability: 1 in 9809 chance of being spam X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 49ef8abd967007051094092 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191060 - in head/sys/dev: twa twe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 21:23:11 -0000 On Tue, 14 Apr 2009 14:02:43 +0000 (UTC) Ed Schouten mentioned: > Author: ed > Date: Tue Apr 14 14:02:43 2009 > New Revision: 191060 > URL: http://svn.freebsd.org/changeset/base/191060 > > Log: > Use si_drv1 instead of dev2unit() in twe(4) and twa(4) > > Reviewed by: scottl > > Modified: > head/sys/dev/twa/tw_osl_freebsd.c > head/sys/dev/twe/twe_freebsd.c > > Modified: head/sys/dev/twa/tw_osl_freebsd.c > ============================================================================== > --- head/sys/dev/twa/tw_osl_freebsd.c Tue Apr 14 13:43:09 2009 (r191059) > +++ head/sys/dev/twa/tw_osl_freebsd.c Tue Apr 14 14:02:43 2009 (r191060) > @@ -88,8 +88,7 @@ static devclass_t twa_devclass; > static TW_INT32 > twa_open(struct cdev *dev, TW_INT32 flags, TW_INT32 fmt, d_thread_t *proc) > { > - TW_INT32 unit = dev2unit(dev); > - struct twa_softc *sc = devclass_get_softc(twa_devclass, unit); > + struct twa_softc *sc = (struct twa_softc *)(dev->si_drv1); > > tw_osli_dbg_dprintf(5, sc, "entered"); > sc->state |= TW_OSLI_CTLR_STATE_OPEN; > @@ -114,8 +113,7 @@ twa_open(struct cdev *dev, TW_INT32 flag > static TW_INT32 > twa_close(struct cdev *dev, TW_INT32 flags, TW_INT32 fmt, d_thread_t *proc) > { > - TW_INT32 unit = dev2unit(dev); > - struct twa_softc *sc = devclass_get_softc(twa_devclass, unit); > + struct twa_softc *sc = (struct twa_softc *)(dev->si_drv1); > > tw_osli_dbg_dprintf(5, sc, "entered"); > sc->state &= ~TW_OSLI_CTLR_STATE_OPEN; > > Modified: head/sys/dev/twe/twe_freebsd.c > ============================================================================== > --- head/sys/dev/twe/twe_freebsd.c Tue Apr 14 13:43:09 2009 (r191059) > +++ head/sys/dev/twe/twe_freebsd.c Tue Apr 14 14:02:43 2009 (r191060) > @@ -81,8 +81,7 @@ static struct cdevsw twe_cdevsw = { > static int > twe_open(struct cdev *dev, int flags, int fmt, d_thread_t *td) > { > - int unit = dev2unit(dev); > - struct twe_softc *sc = devclass_get_softc(twe_devclass, unit); > + struct twe_softc *sc = (struct twe_softc *)dev->si_drv1; > > sc->twe_state |= TWE_STATE_OPEN; > return(0); > @@ -94,8 +93,7 @@ twe_open(struct cdev *dev, int flags, in > static int > twe_close(struct cdev *dev, int flags, int fmt, d_thread_t *td) > { > - int unit = dev2unit(dev); > - struct twe_softc *sc = devclass_get_softc(twe_devclass, unit); > + struct twe_softc *sc = (struct twe_softc *)dev->si_drv1; ^^^^^^^^^ Any reason to have two tabs here? -- Stanislav Sedov ST4096-RIPE !DSPAM:49ef8abd967007051094092! From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 21:40:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AC471065670; Wed, 22 Apr 2009 21:40:37 +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 5E9638FC14; Wed, 22 Apr 2009 21:40:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MLebl7068262; Wed, 22 Apr 2009 21:40:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MLebn3068260; Wed, 22 Apr 2009 21:40:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200904222140.n3MLebn3068260@svn.freebsd.org> From: John Baldwin Date: Wed, 22 Apr 2009 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: r191405 - 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: Wed, 22 Apr 2009 21:40:37 -0000 Author: jhb Date: Wed Apr 22 21:40:37 2009 New Revision: 191405 URL: http://svn.freebsd.org/changeset/base/191405 Log: Adjust the way we number CPUs on x86 so that we attempt to "group" all logical CPUs in a package. We do this by numbering the non-boot CPUs by starting with the first CPU whose APIC ID is after the boot CPU and wrapping back around to APIC ID 0 if needed rather than always starting at APIC ID 0. While here, adjust the cpu_mp_announce() routine to list CPUs based on the mapping established by assign_cpu_ids() rather than making assumptions about the algorithm assign_cpu_ids() uses. MFC after: 1 month 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 Wed Apr 22 20:58:23 2009 (r191404) +++ head/sys/amd64/amd64/mp_machdep.c Wed Apr 22 21:40:37 2009 (r191405) @@ -354,8 +354,6 @@ cpu_mp_start(void) } else KASSERT(boot_cpu_id == PCPU_GET(apic_id), ("BSP's APIC ID doesn't match boot_cpu_id")); - cpu_apic_ids[0] = boot_cpu_id; - apic_cpuids[boot_cpu_id] = 0; /* Setup the initial logical CPUs info. */ logical_cpus = logical_cpus_mask = 0; @@ -418,28 +416,30 @@ cpu_mp_start(void) void cpu_mp_announce(void) { - int i, x; const char *hyperthread; + int i; - /* List CPUs */ + /* List active CPUs first. */ printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id); - for (i = 1, x = 0; x <= MAX_APIC_ID; x++) { - if (!cpu_info[x].cpu_present || cpu_info[x].cpu_bsp) + for (i = 1; i < mp_ncpus; i++) { + if (cpu_info[cpu_apic_ids[i]].cpu_hyperthread) + hyperthread = "/HT"; + else + hyperthread = ""; + printf(" cpu%d (AP%s): APIC ID: %2d\n", i, hyperthread, + cpu_apic_ids[i]); + } + + /* List disabled CPUs last. */ + for (i = 0; i <= MAX_APIC_ID; i++) { + if (!cpu_info[i].cpu_present || !cpu_info[i].cpu_disabled) continue; - if (cpu_info[x].cpu_hyperthread) { + if (cpu_info[i].cpu_hyperthread) hyperthread = "/HT"; - } else { + else hyperthread = ""; - } - if (cpu_info[x].cpu_disabled) - printf(" cpu (AP%s): APIC ID: %2d (disabled)\n", - hyperthread, x); - else { - KASSERT(i < mp_ncpus, - ("mp_ncpus and actual cpus are out of whack")); - printf(" cpu%d (AP%s): APIC ID: %2d\n", i++, - hyperthread, x); - } + printf(" cpu (AP%s): APIC ID: %2d (disabled)\n", hyperthread, + i); } } @@ -693,11 +693,19 @@ assign_cpu_ids(void) /* * Assign CPU IDs to local APIC IDs and disable any CPUs - * beyond MAXCPU. CPU 0 has already been assigned to the BSP, - * so we only have to assign IDs for APs. + * beyond MAXCPU. CPU 0 is always assigned to the BSP. + * + * To minimize confusion for userland, we attempt to number + * CPUs such that all threads and cores in a package are + * grouped together. For now we assume that the BSP is always + * the first thread in a package and just start adding APs + * starting with the BSP's APIC ID. */ mp_ncpus = 1; - for (i = 0; i <= MAX_APIC_ID; i++) { + cpu_apic_ids[0] = boot_cpu_id; + apic_cpuids[boot_cpu_id] = 0; + for (i = boot_cpu_id + 1; i != boot_cpu_id; + i == MAX_APIC_ID ? i = 0 : i++) { if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp || cpu_info[i].cpu_disabled) continue; Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Wed Apr 22 20:58:23 2009 (r191404) +++ head/sys/i386/i386/mp_machdep.c Wed Apr 22 21:40:37 2009 (r191405) @@ -398,8 +398,6 @@ cpu_mp_start(void) } else KASSERT(boot_cpu_id == PCPU_GET(apic_id), ("BSP's APIC ID doesn't match boot_cpu_id")); - cpu_apic_ids[0] = boot_cpu_id; - apic_cpuids[boot_cpu_id] = 0; /* Setup the initial logical CPUs info. */ logical_cpus = logical_cpus_mask = 0; @@ -462,28 +460,30 @@ cpu_mp_start(void) void cpu_mp_announce(void) { - int i, x; const char *hyperthread; + int i; - /* List CPUs */ + /* List active CPUs first. */ printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id); - for (i = 1, x = 0; x <= MAX_APIC_ID; x++) { - if (!cpu_info[x].cpu_present || cpu_info[x].cpu_bsp) + for (i = 1; i < mp_ncpus; i++) { + if (cpu_info[cpu_apic_ids[i]].cpu_hyperthread) + hyperthread = "/HT"; + else + hyperthread = ""; + printf(" cpu%d (AP%s): APIC ID: %2d\n", i, hyperthread, + cpu_apic_ids[i]); + } + + /* List disabled CPUs last. */ + for (i = 0; i <= MAX_APIC_ID; i++) { + if (!cpu_info[i].cpu_present || !cpu_info[i].cpu_disabled) continue; - if (cpu_info[x].cpu_hyperthread) { + if (cpu_info[i].cpu_hyperthread) hyperthread = "/HT"; - } else { + else hyperthread = ""; - } - if (cpu_info[x].cpu_disabled) - printf(" cpu (AP%s): APIC ID: %2d (disabled)\n", - hyperthread, x); - else { - KASSERT(i < mp_ncpus, - ("mp_ncpus and actual cpus are out of whack")); - printf(" cpu%d (AP%s): APIC ID: %2d\n", i++, - hyperthread, x); - } + printf(" cpu (AP%s): APIC ID: %2d (disabled)\n", hyperthread, + i); } } @@ -722,11 +722,19 @@ assign_cpu_ids(void) /* * Assign CPU IDs to local APIC IDs and disable any CPUs - * beyond MAXCPU. CPU 0 has already been assigned to the BSP, - * so we only have to assign IDs for APs. + * beyond MAXCPU. CPU 0 is always assigned to the BSP. + * + * To minimize confusion for userland, we attempt to number + * CPUs such that all threads and cores in a package are + * grouped together. For now we assume that the BSP is always + * the first thread in a package and just start adding APs + * starting with the BSP's APIC ID. */ mp_ncpus = 1; - for (i = 0; i <= MAX_APIC_ID; i++) { + cpu_apic_ids[0] = boot_cpu_id; + apic_cpuids[boot_cpu_id] = 0; + for (i = boot_cpu_id + 1; i != boot_cpu_id; + i == MAX_APIC_ID ? i = 0 : i++) { if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp || cpu_info[i].cpu_disabled) continue; From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 21:59:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D64391065672; Wed, 22 Apr 2009 21:59:27 +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 A90E18FC21; Wed, 22 Apr 2009 21:59:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 4A1CB46B06; Wed, 22 Apr 2009 17:59:27 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 18C768A01A; Wed, 22 Apr 2009 17:59:26 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Date: Wed, 22 Apr 2009 17:59:04 -0400 User-Agent: KMail/1.9.7 References: <200904222140.n3MLebn3068260@svn.freebsd.org> In-Reply-To: <200904222140.n3MLebn3068260@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904221759.04446.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 22 Apr 2009 17:59:26 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=4.2 tests=AWL,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r191405 - 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: Wed, 22 Apr 2009 21:59:28 -0000 On Wednesday 22 April 2009 5:40:37 pm John Baldwin wrote: > Author: jhb > Date: Wed Apr 22 21:40:37 2009 > New Revision: 191405 > URL: http://svn.freebsd.org/changeset/base/191405 > > Log: > Adjust the way we number CPUs on x86 so that we attempt to "group" all > logical CPUs in a package. We do this by numbering the non-boot CPUs > by starting with the first CPU whose APIC ID is after the boot CPU and > wrapping back around to APIC ID 0 if needed rather than always starting > at APIC ID 0. While here, adjust the cpu_mp_announce() routine to list > CPUs based on the mapping established by assign_cpu_ids() rather than > making assumptions about the algorithm assign_cpu_ids() uses. An example is probably in order for this to make sense. Suppose you have a system with two quad-core CPUs. Package 0 has CPUs numbered 0, 1, 2, and 3. Package 1 has CPUs numbered 4, 5, 6, and 7. With the old code, if package 0 won the election to be the boot processor, then CPU 0 would be the BSP and the logical IDs would match the APIC IDs. However, if package 1 won the election during POST, then CPU 0 would be APIC ID 4 on package 0 followed by CPU 1 being APIC ID 0, CPU 2 being APIC ID 1, etc. Thus, when CPU 0 was the boot CPU you had a nice grouping where CPUs 0-3 were a single package and CPUs 4-7 were another package. However, when CPU 4 was the boot CPU, CPUs 0 and 5-7 where one package, and CPUs 1-4 where the second package. The effect of this patch is to change the case when CPU 4 is the boot CPU such that CPUs 0-3 are now all from CPU 4's package (APIC IDs 4-7), and CPUs 4-7 are from the other package (APIC IDs 0-3). What this means, in turn, is that in both cases you now always have CPUs 0-3 as one package and CPUs 4-7 as another package regardless of which CPU wins the boot-time election. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 22:21:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC6681065673; Wed, 22 Apr 2009 22:21:45 +0000 (UTC) (envelope-from ceri@submonkey.net) Received: from scuttle.submonkey.net (scuttle.submonkey.net [208.111.43.184]) by mx1.freebsd.org (Postfix) with ESMTP id C98A48FC1F; Wed, 22 Apr 2009 22:21:45 +0000 (UTC) (envelope-from ceri@submonkey.net) Received: from cpc1-cdif1-0-0-cust63.cdif.cable.ntl.com ([81.104.164.64] helo=shrike.submonkey.net) by scuttle.submonkey.net with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1LwkX5-0004lx-5c; Wed, 22 Apr 2009 22:03:07 +0000 Received: from ceri by shrike.submonkey.net with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1LwkX3-000M1V-1X; Wed, 22 Apr 2009 23:03:05 +0100 Date: Wed, 22 Apr 2009 23:03:04 +0100 From: Ceri Davies To: John Baldwin Message-ID: <20090422220304.GB54875@submonkey.net> References: <200904222140.n3MLebn3068260@svn.freebsd.org> <200904221759.04446.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="G4iJoqBmSsgzjUCe" Content-Disposition: inline In-Reply-To: <200904221759.04446.jhb@freebsd.org> X-PGP: finger ceri@FreeBSD.org User-Agent: Mutt/1.5.18 (2008-05-17) Sender: Ceri Davies Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191405 - 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: Wed, 22 Apr 2009 22:21:46 -0000 --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 22, 2009 at 05:59:04PM -0400, John Baldwin wrote: > On Wednesday 22 April 2009 5:40:37 pm John Baldwin wrote: > > Author: jhb > > Date: Wed Apr 22 21:40:37 2009 > > New Revision: 191405 > > URL: http://svn.freebsd.org/changeset/base/191405 > >=20 > > Log: > > Adjust the way we number CPUs on x86 so that we attempt to "group" all > > logical CPUs in a package. We do this by numbering the non-boot CPUs > > by starting with the first CPU whose APIC ID is after the boot CPU and > > wrapping back around to APIC ID 0 if needed rather than always starti= ng > > at APIC ID 0. While here, adjust the cpu_mp_announce() routine to li= st > > CPUs based on the mapping established by assign_cpu_ids() rather than > > making assumptions about the algorithm assign_cpu_ids() uses. >=20 > An example is probably in order for this to make sense. Suppose you have= a=20 > system with two quad-core CPUs. Package 0 has CPUs numbered 0, 1, 2, and= 3. =20 > Package 1 has CPUs numbered 4, 5, 6, and 7. With the old code, if packag= e 0=20 > won the election to be the boot processor, then CPU 0 would be the BSP an= d=20 > the logical IDs would match the APIC IDs. However, if package 1 won the= =20 > election during POST, then CPU 0 would be APIC ID 4 on package 0 followed= by=20 > CPU 1 being APIC ID 0, CPU 2 being APIC ID 1, etc. Thus, when CPU 0 was = the=20 > boot CPU you had a nice grouping where CPUs 0-3 were a single package and= =20 > CPUs 4-7 were another package. However, when CPU 4 was the boot CPU, CPU= s 0=20 > and 5-7 where one package, and CPUs 1-4 where the second package. The ef= fect=20 > of this patch is to change the case when CPU 4 is the boot CPU such that = CPUs=20 > 0-3 are now all from CPU 4's package (APIC IDs 4-7), and CPUs 4-7 are fro= m=20 > the other package (APIC IDs 0-3). What this means, in turn, is that in b= oth=20 > cases you now always have CPUs 0-3 as one package and CPUs 4-7 as another= =20 > package regardless of which CPU wins the boot-time election. What if I have HT turned on? Do they bunch up with the "real" CPU IDs or all together at the end? Ceri --=20 That must be wonderful! I don't understand it at all. -- Moliere --G4iJoqBmSsgzjUCe Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFJ75QYocfcwTS3JF8RAj4hAKC6hCKSn53TlPljqDR/w/PAPxRyxACdE7g8 woYCJRMhkvG1mVEJ2tMfF7Q= =YGP1 -----END PGP SIGNATURE----- --G4iJoqBmSsgzjUCe-- From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 22:30:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0FBE1065673; Wed, 22 Apr 2009 22:30:29 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.24]) by mx1.freebsd.org (Postfix) with ESMTP id 080108FC20; Wed, 22 Apr 2009 22:30:28 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by ey-out-2122.google.com with SMTP id 9so59751eyd.7 for ; Wed, 22 Apr 2009 15:30:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=Xb91rhtGCcJtVRDJjlLNrO/Ho7S+6t7+NTjDAtzFpGI=; b=YBBL+L1jS/HIeCnJODlQGK2ByOejmH5P/5IjJM39Obq/zY0o6y/PBVN1d7NqweqGad zra9yycpOgmxu4LCQiVt9zGclG9N9IZ09OQ8FXZikdHXIbpPWA951QAxWvK97gk1oyyN wHLjUdbBOtSDO5Mgelyi4GINCL4Ni8S7lP0xQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=old4MVCjyDY0rFGVhi8jzvRBiPFnvDvBAD4sN3Szws9Mu+jj/pu50/owzF8efV1L9p 2DHjRk8N/jH82w+SQ/3EmSlQrq/DoSW7VU8OOC5e78dg3Ua7hdWlZDSdTPhQNT8ttqhP +pEgBfFp/pmlkXM4V8gbBWjmk5MN2EQCNwUCM= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.210.42.20 with SMTP id p20mr6835629ebp.30.1240439427871; Wed, 22 Apr 2009 15:30:27 -0700 (PDT) In-Reply-To: <200904221759.04446.jhb@freebsd.org> References: <200904222140.n3MLebn3068260@svn.freebsd.org> <200904221759.04446.jhb@freebsd.org> From: Ivan Voras Date: Thu, 23 Apr 2009 00:30:12 +0200 X-Google-Sender-Auth: e294c6569860a676 Message-ID: <9bbcef730904221530u786464d3v2dc05b0bb2f1218a@mail.gmail.com> 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: r191405 - 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: Wed, 22 Apr 2009 22:30:30 -0000 2009/4/22 John Baldwin : > On Wednesday 22 April 2009 5:40:37 pm John Baldwin wrote: >> Author: jhb >> Date: Wed Apr 22 21:40:37 2009 >> New Revision: 191405 >> URL: http://svn.freebsd.org/changeset/base/191405 >> >> Log: >> =C2=A0 Adjust the way we number CPUs on x86 so that we attempt to "group= " all >> =C2=A0 logical CPUs in a package. =C2=A0We do this by numbering the non-= boot CPUs >> =C2=A0 by starting with the first CPU whose APIC ID is after the boot CP= U and >> =C2=A0 wrapping back around to APIC ID 0 if needed rather than always st= arting >> =C2=A0 at APIC ID 0. =C2=A0While here, adjust the cpu_mp_announce() rout= ine to list >> =C2=A0 CPUs based on the mapping established by assign_cpu_ids() rather = than >> =C2=A0 making assumptions about the algorithm assign_cpu_ids() uses. > > An example is probably in order for this to make sense. =C2=A0Suppose you= have a > system with two quad-core CPUs. =C2=A0Package 0 has CPUs numbered 0, 1, 2= , and 3. > Package 1 has CPUs numbered 4, 5, 6, and 7. =C2=A0With the old code, if p= ackage 0 > won the election to be the boot processor, then CPU 0 would be the BSP an= d > the logical IDs would match the APIC IDs. =C2=A0However, if package 1 won= the > election during POST, then CPU 0 would be APIC ID 4 on package 0 followed= by > CPU 1 being APIC ID 0, CPU 2 being APIC ID 1, etc. =C2=A0Thus, when CPU 0= was the > boot CPU you had a nice grouping where CPUs 0-3 were a single package and > CPUs 4-7 were another package. =C2=A0However, when CPU 4 was the boot CPU= , CPUs 0 > and 5-7 where one package, and CPUs 1-4 where the second package. =C2=A0T= he effect > of this patch is to change the case when CPU 4 is the boot CPU such that = CPUs > 0-3 are now all from CPU 4's package (APIC IDs 4-7), and CPUs 4-7 are fro= m > the other package (APIC IDs 0-3). =C2=A0What this means, in turn, is that= in both > cases you now always have CPUs 0-3 as one package and CPUs 4-7 as another > package regardless of which CPU wins the boot-time election. I like that the new numbering is more elegant, but this is orthogonal to ULE topology detection, right? From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 23:02:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3901106567F; Wed, 22 Apr 2009 23:02:11 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 904908FC08; Wed, 22 Apr 2009 23:02:11 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 704191CCCC; Thu, 23 Apr 2009 01:02:10 +0200 (CEST) Date: Thu, 23 Apr 2009 01:02:10 +0200 From: Ed Schouten To: Stanislav Sedov Message-ID: <20090422230210.GJ58540@hoeg.nl> References: <200904141402.n3EE2hwB007748@svn.freebsd.org> <20090423012306.01a2e5e4.stas@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="a7XSrSxqzVsaECgU" Content-Disposition: inline In-Reply-To: <20090423012306.01a2e5e4.stas@FreeBSD.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191060 - in head/sys/dev: twa twe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 23:02:12 -0000 --a7XSrSxqzVsaECgU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Stanislav Sedov wrote: > Any reason to have two tabs here? Yes. I think the ioctl() function in the same file also used this line, so I just literally copy/pasted it into open()/close(). --=20 Ed Schouten WWW: http://80386.nl/ --a7XSrSxqzVsaECgU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAknvofIACgkQ52SDGA2eCwU8KgCcCcgoZsY9L+L0pEzSFu0FnqrX z+gAnA51EFOjw04Eob0Lvr08EUjeVCqc =tSgI -----END PGP SIGNATURE----- --a7XSrSxqzVsaECgU-- From owner-svn-src-head@FreeBSD.ORG Wed Apr 22 23:54:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 879FA106566C; Wed, 22 Apr 2009 23:54:41 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 74E618FC14; Wed, 22 Apr 2009 23:54:41 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MNsfhG070893; Wed, 22 Apr 2009 23:54:41 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MNsfbd070888; Wed, 22 Apr 2009 23:54:41 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200904222354.n3MNsfbd070888@svn.freebsd.org> From: Stanislav Sedov Date: Wed, 22 Apr 2009 23:54: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: r191408 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 22 Apr 2009 23:54:42 -0000 Author: stas Date: Wed Apr 22 23:54:41 2009 New Revision: 191408 URL: http://svn.freebsd.org/changeset/base/191408 Log: - Add the driver for AT91RM9200 CompactFlash controller. The driver operates in the common memory mode and use polling mode to control the status of operations as I don't have any board with interrupt line routed yet. I'll add the GPIO interrupt driven mode as soon as I get one. Added: head/sys/arm/at91/at91_cfata.c (contents, props changed) Modified: head/sys/arm/at91/at91.c head/sys/arm/at91/at91_machdep.c head/sys/arm/at91/at91rm92reg.h head/sys/arm/at91/files.at91 Modified: head/sys/arm/at91/at91.c ============================================================================== --- head/sys/arm/at91/at91.c Wed Apr 22 23:38:57 2009 (r191407) +++ head/sys/arm/at91/at91.c Wed Apr 22 23:54:41 2009 (r191408) @@ -418,6 +418,11 @@ struct cpu_devs at91rm9200_devs[] = AT91RM92_OHCI_BASE, AT91RM92_OHCI_SIZE, AT91RM92_IRQ_UHP }, + { + "at91_cfata", 0, + AT91RM92_CF_BASE, AT91RM92_CF_SIZE, + -1 + }, { 0, 0, 0, 0, 0 } }; @@ -507,6 +512,9 @@ at91_attach(device_t dev) if (rman_manage_region(&sc->sc_mem_rman, AT91RM92_OHCI_BASE, AT91RM92_OHCI_BASE + AT91RM92_OHCI_SIZE - 1) != 0) panic("at91_attach: failed to set up ohci memory"); + if (rman_manage_region(&sc->sc_mem_rman, AT91RM92_CF_BASE, + AT91RM92_CF_BASE + AT91RM92_CF_SIZE - 1) != 0) + panic("at91_attach: failed to set up CompactFlash ATA memory"); for (i = 0; i < 32; i++) { bus_space_write_4(sc->sc_st, sc->sc_sys_sh, IC_SVR + Added: head/sys/arm/at91/at91_cfata.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/at91/at91_cfata.c Wed Apr 22 23:54:41 2009 (r191408) @@ -0,0 +1,281 @@ +/*- + * Copyright (c) 2008 Deglitch Networks, Stanislav Sedov + * 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. + * + * Driver for the AT91RM9200 CompactFlash controller operating in a + * common memory mode. Interrupts are driven by polling. The driver + * implements an ATA bridge and attached ATA channel driver on top + * of it. + * NOTE WELL: this driver uses polling mode. To achive an acceptable + * operating speed you will probably want to use HZ=2000 in kernel + * config. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +struct at91_cfata_softc { + device_t dev; + struct resource *mem_res; + struct resource irq; + void (*isr_cb)(void *); + void *isr_arg; + struct callout tick; +}; + +static int at91_cfata_detach(device_t dev); +static void at91_cfata_callout(void *arg); + +static int +at91_cfata_probe(device_t dev) +{ + + device_set_desc_copy(dev, "AT91RM9200 CompactFlash controller"); + return (0); +} + +static int +at91_cfata_attach(device_t dev) +{ + struct at91_cfata_softc *sc; + int rid, error; + + sc = device_get_softc(dev); + sc->dev = dev; + rid = 0; + error = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem_res == NULL) + return (ENOMEM); + + /* XXX: init CF controller? */ + + callout_init(&sc->tick, 1); /* Callout to poll the device. */ + device_add_child(dev, "ata", devclass_find_free_unit(ata_devclass, 0)); + bus_generic_attach(dev); + return (0); +} + +static int +at91_cfata_detach(device_t dev) +{ + struct at91_cfata_softc *sc; + + sc = device_get_softc(dev); + bus_generic_detach(sc->dev); + if (sc->mem_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->mem_res), sc->mem_res); + sc->mem_res = NULL; + } + return (0); +} + +static struct resource * +ata_at91_alloc_resource(device_t dev, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + struct at91_cfata_softc *sc = device_get_softc(dev); + + KASSERT(type == SYS_RES_IRQ && *rid == ATA_IRQ_RID, + ("[at91_cfata, %d]: illegal resource request (type %u rid %u)", + __LINE__, type, *rid)); + return (&sc->irq); +} + +static int +ata_at91_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + + KASSERT(type == SYS_RES_IRQ && *rid == ATA_IRQ_RID, + ("[at91_cfata, %d]: illegal resource request (type %u rid %u)", + __LINE__, type, *rid)); + return (0); +} + + +static int +ata_at91_setup_intr(device_t dev, device_t child, struct resource *irq, + int flags, driver_filter_t *filt, + driver_intr_t *function, void *argument, void **cookiep) +{ + struct at91_cfata_softc *sc = device_get_softc(dev); + + KASSERT(sc->isr_cb == NULL, + ("[at91_cfata, %d]: overwriting the old handler", __LINE__)); + sc->isr_cb = function; + sc->isr_arg = argument; + *cookiep = sc; + callout_reset(&sc->tick, 1, at91_cfata_callout, sc); + return (0); +} + +static int +ata_at91_teardown_intr(device_t dev, device_t child, struct resource *irq, + void *cookie) +{ + struct at91_cfata_softc *sc = device_get_softc(dev); + + sc->isr_cb = NULL; + sc->isr_arg = NULL; + return (0); +} + +static void +at91_cfata_callout(void *arg) +{ + struct at91_cfata_softc *sc; + + sc = (struct at91_cfata_softc *)arg; + if (sc->isr_cb != NULL) + sc->isr_cb(sc->isr_arg); + callout_reset(&sc->tick, 1, at91_cfata_callout, sc); +} + +static int +at91_channel_probe(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + ch->unit = 0; + ch->flags |= ATA_USE_16BIT | ATA_NO_SLAVE; + device_set_desc_copy(dev, "ATA channel 0"); + + return (ata_probe(dev)); +} + +static int +at91_channel_attach(device_t dev) +{ + struct at91_cfata_softc *sc = device_get_softc(device_get_parent(dev)); + struct ata_channel *ch = device_get_softc(dev); + int i; + + for (i = 0; i < ATA_MAX_RES; i++) + ch->r_io[i].res = sc->mem_res; + + /* + * CF+ Specification. + * 6.1.3 Memory Mapped Addressing. + */ + ch->r_io[ATA_DATA].offset = 0x00; + ch->r_io[ATA_FEATURE].offset = 0x01; + ch->r_io[ATA_COUNT].offset = 0x02; + ch->r_io[ATA_SECTOR].offset = 0x03; + ch->r_io[ATA_CYL_LSB].offset = 0x04; + ch->r_io[ATA_CYL_MSB].offset = 0x05; + ch->r_io[ATA_DRIVE].offset = 0x06; + ch->r_io[ATA_COMMAND].offset = 0x07; + ch->r_io[ATA_ERROR].offset = 0x01; + ch->r_io[ATA_IREASON].offset = 0x02; + ch->r_io[ATA_STATUS].offset = 0x07; + ch->r_io[ATA_ALTSTAT].offset = 0x0e; + ch->r_io[ATA_CONTROL].offset = 0x0e; + + /* Should point at the base of registers. */ + ch->r_io[ATA_IDX_ADDR].offset = 0x0; + + ata_generic_hw(dev); + return (ata_attach(dev)); +} + +static device_method_t at91_cfata_methods[] = { + /* Device interface. */ + DEVMETHOD(device_probe, at91_cfata_probe), + DEVMETHOD(device_attach, at91_cfata_attach), + DEVMETHOD(device_detach, at91_cfata_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* ATA bus methods. */ + DEVMETHOD(bus_alloc_resource, ata_at91_alloc_resource), + DEVMETHOD(bus_release_resource, ata_at91_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, + bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, ata_at91_setup_intr), + DEVMETHOD(bus_teardown_intr, ata_at91_teardown_intr), + + { 0, 0 } +}; + +devclass_t at91_cfata_devclass; + +static driver_t at91_cfata_driver = { + "at91_cfata", + at91_cfata_methods, + sizeof(struct at91_cfata_softc), +}; + +DRIVER_MODULE(at91_cfata, atmelarm, at91_cfata_driver, at91_cfata_devclass, 0, + 0); +MODULE_VERSION(at91_cfata, 1); +MODULE_DEPEND(at91_cfata, ata, 1, 1, 1); + +/* + * ATA channel driver. + */ +static device_method_t at91_channel_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, at91_channel_probe), + DEVMETHOD(device_attach, at91_channel_attach), + DEVMETHOD(device_detach, ata_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, ata_suspend), + DEVMETHOD(device_resume, ata_resume), + + { 0, 0 } +}; + +driver_t at91_channel_driver = { + "ata", + at91_channel_methods, + sizeof(struct ata_channel), +}; + +DRIVER_MODULE(ata, at91_cfata, at91_channel_driver, ata_devclass, 0, 0); Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Wed Apr 22 23:38:57 2009 (r191407) +++ head/sys/arm/at91/at91_machdep.c Wed Apr 22 23:54:41 2009 (r191408) @@ -179,6 +179,14 @@ static const struct pmap_devmap at91rm92 PTE_NOCACHE, }, { + /* CompactFlash controller. */ + AT91RM92_CF_BASE, + AT91RM92_CF_PA_BASE, + AT91RM92_CF_SIZE, + VM_PROT_READ|VM_PROT_WRITE, + PTE_NOCACHE, + }, + { 0, 0, 0, Modified: head/sys/arm/at91/at91rm92reg.h ============================================================================== --- head/sys/arm/at91/at91rm92reg.h Wed Apr 22 23:38:57 2009 (r191407) +++ head/sys/arm/at91/at91rm92reg.h Wed Apr 22 23:54:41 2009 (r191408) @@ -341,6 +341,10 @@ #define AT91RM92_OHCI_PA_BASE 0x00300000 #define AT91RM92_OHCI_SIZE 0x00100000 +#define AT91RM92_CF_BASE 0xdfd00000 +#define AT91RM92_CF_PA_BASE 0x51400000 +#define AT91RM92_CF_SIZE 0x00100000 + #ifndef AT91C_MASTER_CLOCK #define AT91C_MASTER_CLOCK 60000000 #endif Modified: head/sys/arm/at91/files.at91 ============================================================================== --- head/sys/arm/at91/files.at91 Wed Apr 22 23:38:57 2009 (r191407) +++ head/sys/arm/at91/files.at91 Wed Apr 22 23:54:41 2009 (r191408) @@ -3,6 +3,7 @@ arm/arm/cpufunc_asm_arm9.S standard arm/arm/irq_dispatch.S standard arm/at91/at91_machdep.c standard arm/at91/at91.c standard +arm/at91/at91_cfata.c optional at91_cfata arm/at91/at91_st.c standard arm/at91/at91_mci.c optional at91_mci arm/at91/at91_pio.c standard From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 00:00:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC856106566C; Thu, 23 Apr 2009 00:00:57 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB2998FC15; Thu, 23 Apr 2009 00:00:57 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3N00vPT071127; Thu, 23 Apr 2009 00:00:57 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3N00vVK071126; Thu, 23 Apr 2009 00:00:57 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200904230000.n3N00vVK071126@svn.freebsd.org> From: Stanislav Sedov Date: Thu, 23 Apr 2009 00:00: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: r191410 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 23 Apr 2009 00:00:58 -0000 Author: stas Date: Thu Apr 23 00:00:57 2009 New Revision: 191410 URL: http://svn.freebsd.org/changeset/base/191410 Log: - Whitespace nitpicking. Modified: head/sys/arm/at91/at91_cfata.c Modified: head/sys/arm/at91/at91_cfata.c ============================================================================== --- head/sys/arm/at91/at91_cfata.c Wed Apr 22 23:56:18 2009 (r191409) +++ head/sys/arm/at91/at91_cfata.c Thu Apr 23 00:00:57 2009 (r191410) @@ -57,9 +57,9 @@ __FBSDID("$FreeBSD$"); #include struct at91_cfata_softc { - device_t dev; - struct resource *mem_res; - struct resource irq; + device_t dev; + struct resource *mem_res; + struct resource irq; void (*isr_cb)(void *); void *isr_arg; struct callout tick; @@ -156,7 +156,7 @@ ata_at91_setup_intr(device_t dev, device static int ata_at91_teardown_intr(device_t dev, device_t child, struct resource *irq, - void *cookie) + void *cookie) { struct at91_cfata_softc *sc = device_get_softc(dev); @@ -182,10 +182,10 @@ at91_channel_probe(device_t dev) struct ata_channel *ch = device_get_softc(dev); ch->unit = 0; - ch->flags |= ATA_USE_16BIT | ATA_NO_SLAVE; - device_set_desc_copy(dev, "ATA channel 0"); + ch->flags |= ATA_USE_16BIT | ATA_NO_SLAVE; + device_set_desc_copy(dev, "ATA channel 0"); - return (ata_probe(dev)); + return (ata_probe(dev)); } static int From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 04:46:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id E0CE31065674; Thu, 23 Apr 2009 04:46:29 +0000 (UTC) Date: Thu, 23 Apr 2009 04:46:29 +0000 From: Alexey Dokuchaev To: Ed Schouten Message-ID: <20090423044629.GA53692@FreeBSD.org> References: <200904141402.n3EE2hwB007748@svn.freebsd.org> <20090423012306.01a2e5e4.stas@FreeBSD.org> <20090422230210.GJ58540@hoeg.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20090422230210.GJ58540@hoeg.nl> User-Agent: Mutt/1.4.2.1i Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191060 - in head/sys/dev: twa twe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 23 Apr 2009 04:46:30 -0000 On Thu, Apr 23, 2009 at 01:02:10AM +0200, Ed Schouten wrote: > * Stanislav Sedov wrote: > > Any reason to have two tabs here? > > Yes. I think the ioctl() function in the same file also used this line, > so I just literally copy/pasted it into open()/close(). But it looks like style bug which is supposed to get fixed, not duplicated. I am wrong? ./danfe From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 07:11:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03EDD1065670; Thu, 23 Apr 2009 07:11:39 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 9ABD38FC15; Thu, 23 Apr 2009 07:11:38 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (pD9E2D4A2.dip.t-dialin.net [217.226.212.162]) by redbull.bpaserver.net (Postfix) with ESMTP id 490522E05E; Thu, 23 Apr 2009 09:11:31 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 2B54620D26F; Thu, 23 Apr 2009 09:11:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1240470684; bh=izrpJTozyzCvSijNvIgR9KuSaa9HBCAmt PwCGOoqGaQ=; h=Message-ID:Date:From:To:Cc:Subject:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=c+pM3T4RFKGVdib/YVrmypgn70jpHI3MNQD/7wQunnIaUlw1LSs5SJCODc+qjXNob KQje9s3VI3w4nEKwbAdo5vFXclMcyPloVoMss5vTEsLbJQTV/Zdsel6/oOqZ2/XHtFp +ukJsSpe16ElaYLuWnJICpirtS8NkLiowiu8LLdRtPbQ+juHUkYAm0CdrtfoeQ9td2Y nHZaUsb0FlrHta2TVU/PhUOPasiZuFqR2YjHWCFZ9fFAHSjNBx0qvXTqT86A5XjyX94 mSEos4sKTD1eMLiGAoeWJc3Fbl9oIebdJV/s/PWRPd3IjdYFgSyaq7+SEmKVwZlLjx7 o6TtgBF5g== Received: (from www@localhost) by webmail.leidinger.net (8.14.3/8.13.8/Submit) id n3N7BL9F007832; Thu, 23 Apr 2009 09:11:21 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Thu, 23 Apr 2009 09:11:20 +0200 Message-ID: <20090423091120.18706t1ks38zgfgo@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Thu, 23 Apr 2009 09:11:20 +0200 From: Alexander Leidinger To: "M. Warner Losh" References: <20090422.002643.639875625.imp@bsdimp.com> <20090422090546.110752s7m6p5ao84@webmail.leidinger.net> <20090422231511.ca92fb9f.stas@FreeBSD.org> <20090422.133147.-1890035357.imp@bsdimp.com> In-Reply-To: <20090422.133147.-1890035357.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.3) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 490522E05E.9A552 X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-11.927, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, IMPRONONCABLE_2 1.50, MIME_QP_LONG_LINE 1.40, RDNS_DYNAMIC 0.10, TW_SV 0.08) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: stas@FreeBSD.org, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191369 - in head/sys: arm/conf 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: Thu, 23 Apr 2009 07:11:39 -0000 Quoting "M. Warner Losh" (from Wed, 22 Apr 2009 =20 13:31:47 -0600 (MDT)): > In message: <20090422231511.ca92fb9f.stas@FreeBSD.org> > Stanislav Sedov writes: > : On Wed, 22 Apr 2009 09:05:46 +0200 > : Alexander Leidinger mentioned: > : > : > Quoting "M. Warner Losh" (from Wed, 22 Apr 2009 > : > 00:26:43 -0600 (MDT)): > : > > : > > In message: <200904212248.n3LMmCbu027432@svn.freebsd.org> > : > > Stanislav Sedov writes: > : > > : Author: stas > : > > : Date: Tue Apr 21 22:48:12 2009 > : > > : New Revision: 191369 > : > > : URL: http://svn.freebsd.org/changeset/base/191369 > : > > : > : > > : Log: > : > > : - Rename ds1672 and ds133x devices to "ds1672_rtc" and "ds133x_r= tc" > : > > : respectivly. This will allow one to have a kernel with =20 > both devices > : > > : present and use it for multiple boards with different =20 > types of RTC > : > > : sitting on a bus. > : > > : > : > > : Discussed with:=09imp > : > > > : > > Hey thanks Stas! Now things are better than before both functionall= y > : > > and cosmetically! Good idea on the names... > : > > : > > : > Are those the first devices with an underscore in the name now? If > : > yes, do we want this? > : > > : > > : > : I had the same concerns too, but was not able to come up with anything > : better. BTW, I think those devices were the first that ended with a > : digit. ds1672rtc? Just if it pleases you or we do not want underscores in =20 device names which are visible to the outside. > No. They weren't. There are sound devices that end in digits: > > # snd_ad1816:=09=09Analog Devices AD1816 ISA PnP/non-PnP. > # snd_als4000:=09=09Avance Logic ALS4000 PCI. > # snd_cs4281:=09=09Crystal Semiconductor CS4281 PCI. > # snd_ds1:=09=09Yamaha DS-1 PCI. > # snd_emu10k1:=09=09Creative EMU10K1 PCI and EMU10K2 (Audigy) PCI. > # snd_envy24:=09=09VIA Envy24 and compatible, needs snd_spicds. > # snd_fm801:=09=09Forte Media FM801 PCI. > # snd_maestro3:=09=09ESS Technology Maestro-3/Allegro PCI. > # snd_sb16:=09=09Creative SoundBlaster16, to be used in > # snd_sb8:=09=09Creative SoundBlaster (pre-16), to be used in > # snd_via8233:=09=09VIA VT8233x PCI. > # snd_via82c686:=09VIA VT82C686A PCI. > > but since they all live on an enumerated bus, they all share the name > "pcm". And because of this they don't count as being with underscores... Bye, Alexander. --=20 You will inherit some money or a small piece of land. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID =3D B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID =3D 72077137 From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 07:16:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2D851065673; Thu, 23 Apr 2009 07:16:45 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 5E88C8FC1A; Thu, 23 Apr 2009 07:16:45 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 4B8651CDEE; Thu, 23 Apr 2009 09:16:43 +0200 (CEST) Date: Thu, 23 Apr 2009 09:16:43 +0200 From: Ed Schouten To: Alexey Dokuchaev Message-ID: <20090423071642.GK58540@hoeg.nl> References: <200904141402.n3EE2hwB007748@svn.freebsd.org> <20090423012306.01a2e5e4.stas@FreeBSD.org> <20090422230210.GJ58540@hoeg.nl> <20090423044629.GA53692@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VSaCG/zfRnOiPJtU" Content-Disposition: inline In-Reply-To: <20090423044629.GA53692@FreeBSD.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191060 - in head/sys/dev: twa twe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 23 Apr 2009 07:16:46 -0000 --VSaCG/zfRnOiPJtU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Alexey Dokuchaev wrote: > But it looks like style bug which is supposed to get fixed, not > duplicated. I am wrong? Well, at least I didn't make it less consistent by using a different amount of tabs. It's not like I introduced any style(9) bugs, mainly because the code doesn't comply with style(9) at all. I guess if style(9) is that important, someone should spend some time restyling the entire driver.=20 --=20 Ed Schouten WWW: http://80386.nl/ --VSaCG/zfRnOiPJtU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAknwFdoACgkQ52SDGA2eCwWj4wCfWLDKvLTfXlyrGuykB2OgZ3xg BEAAn3Q1CtNDLRYIAbbKpgFh4P48biQg =TlZ6 -----END PGP SIGNATURE----- --VSaCG/zfRnOiPJtU-- From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 08:37:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FA16106566B; Thu, 23 Apr 2009 08:37:57 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AF698FC1B; Thu, 23 Apr 2009 08:37:57 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3N8bv8m081015; Thu, 23 Apr 2009 08:37:57 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3N8buD1081005; Thu, 23 Apr 2009 08:37:56 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200904230837.n3N8buD1081005@svn.freebsd.org> From: Christian Brueffer Date: Thu, 23 Apr 2009 08:37: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: r191414 - in head: lib/libc/string lib/libc/sys sbin/savecore share/man/man4 share/man/man4/man4.i386 share/man/man4/man4.powerpc usr.sbin/cpucontrol usr.sbin/crashinfo usr.sbin/setfib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 23 Apr 2009 08:37:58 -0000 Author: brueffer Date: Thu Apr 23 08:37:56 2009 New Revision: 191414 URL: http://svn.freebsd.org/changeset/base/191414 Log: Correct the information about when the respective functionality first appeared in FreeBSD. PR: 133785 Submitted by: Ulrich Spoerlein MFC after: 3 days Modified: head/lib/libc/string/memchr.3 head/lib/libc/sys/setfib.2 head/sbin/savecore/savecore.8 head/share/man/man4/cpuctl.4 head/share/man/man4/man4.i386/glxsb.4 head/share/man/man4/man4.powerpc/bm.4 head/share/man/man4/u3g.4 head/usr.sbin/cpucontrol/cpucontrol.8 head/usr.sbin/crashinfo/crashinfo.8 head/usr.sbin/setfib/setfib.1 Modified: head/lib/libc/string/memchr.3 ============================================================================== --- head/lib/libc/string/memchr.3 Thu Apr 23 08:11:48 2009 (r191413) +++ head/lib/libc/string/memchr.3 Thu Apr 23 08:37:56 2009 (r191414) @@ -100,6 +100,6 @@ The .Fn memrchr function first appeared in GNU libc 2.1.91, this implementation first appeared in -.Fx 8.0 , +.Fx 6.4 , coming from .Ox 4.3 . Modified: head/lib/libc/sys/setfib.2 ============================================================================== --- head/lib/libc/sys/setfib.2 Thu Apr 23 08:11:48 2009 (r191413) +++ head/lib/libc/sys/setfib.2 Thu Apr 23 08:37:56 2009 (r191414) @@ -81,4 +81,4 @@ have been added to many other The .Fn setfib function appeared in -.Fx 8.0 . +.Fx 7.1 . Modified: head/sbin/savecore/savecore.8 ============================================================================== --- head/sbin/savecore/savecore.8 Thu Apr 23 08:11:48 2009 (r191413) +++ head/sbin/savecore/savecore.8 Thu Apr 23 08:37:56 2009 (r191414) @@ -154,6 +154,6 @@ utility appeared in .Bx 4.1 . .Pp Support for kernel textdumps appeared in -.Fx 8.0 . +.Fx 7.1 . .Sh BUGS The minfree code does not consider the effect of compression or sparse files. Modified: head/share/man/man4/cpuctl.4 ============================================================================== --- head/share/man/man4/cpuctl.4 Thu Apr 23 08:11:48 2009 (r191413) +++ head/share/man/man4/cpuctl.4 Thu Apr 23 08:37:56 2009 (r191414) @@ -142,7 +142,7 @@ The firmware image address points outsid The .Nm driver first appeared in -.Fx 8.0 . +.Fx 7.2 . .Sh BUGS Yes, probably, report if any. .Sh AUTHORS Modified: head/share/man/man4/man4.i386/glxsb.4 ============================================================================== --- head/share/man/man4/man4.i386/glxsb.4 Thu Apr 23 08:11:48 2009 (r191413) +++ head/share/man/man4/man4.i386/glxsb.4 Thu Apr 23 08:37:56 2009 (r191414) @@ -82,7 +82,7 @@ device driver first appeared in The .Nm device driver was imported into -.Fx 8.0 . +.Fx 7.1 . .Sh AUTHORS .An -nosplit The Modified: head/share/man/man4/man4.powerpc/bm.4 ============================================================================== --- head/share/man/man4/man4.powerpc/bm.4 Thu Apr 23 08:11:48 2009 (r191413) +++ head/share/man/man4/man4.powerpc/bm.4 Thu Apr 23 08:37:56 2009 (r191414) @@ -76,7 +76,7 @@ Apple BMAC+ Onboard Ethernet The .Nm device driver appeared in -.Fx 8.0 . +.Fx 7.1 . .Sh AUTHORS .An -nosplit The Modified: head/share/man/man4/u3g.4 ============================================================================== --- head/share/man/man4/u3g.4 Thu Apr 23 08:11:48 2009 (r191413) +++ head/share/man/man4/u3g.4 Thu Apr 23 08:37:56 2009 (r191414) @@ -109,7 +109,7 @@ and replug the device. The .Nm driver appeared in -.Fx 8.0 , +.Fx 7.2 , is based on the .Xr uark 4 driver, and written by Modified: head/usr.sbin/cpucontrol/cpucontrol.8 ============================================================================== --- head/usr.sbin/cpucontrol/cpucontrol.8 Thu Apr 23 08:11:48 2009 (r191413) +++ head/usr.sbin/cpucontrol/cpucontrol.8 Thu Apr 23 08:37:56 2009 (r191414) @@ -113,7 +113,7 @@ use the following command: The .Nm utility first appeared in -.Fx 8.0 . +.Fx 7.2 . .Sh BUGS Yes, probably, report if any. .Sh AUTHORS Modified: head/usr.sbin/crashinfo/crashinfo.8 ============================================================================== --- head/usr.sbin/crashinfo/crashinfo.8 Thu Apr 23 08:11:48 2009 (r191413) +++ head/usr.sbin/crashinfo/crashinfo.8 Thu Apr 23 08:37:56 2009 (r191414) @@ -106,4 +106,4 @@ Specify an explicit kernel file. The .Nm utility appeared in -.Fx 8.0 . +.Fx 6.4 . Modified: head/usr.sbin/setfib/setfib.1 ============================================================================== --- head/usr.sbin/setfib/setfib.1 Thu Apr 23 08:11:48 2009 (r191413) +++ head/usr.sbin/setfib/setfib.1 Thu Apr 23 08:37:56 2009 (r191414) @@ -94,4 +94,4 @@ have an equivalent function. The .Nm utility appeared in -.Fx 8.0 . +.Fx 7.1 . From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 09:11:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1AB7106566B; Thu, 23 Apr 2009 09:11:37 +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 B0B8E8FC1B; Thu, 23 Apr 2009 09:11:37 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3N9BbqA081682; Thu, 23 Apr 2009 09:11:37 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3N9BbMR081681; Thu, 23 Apr 2009 09:11:37 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904230911.n3N9BbMR081681@svn.freebsd.org> From: Ed Schouten Date: Thu, 23 Apr 2009 09:11: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: r191415 - head/sbin/pflogd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 23 Apr 2009 09:11:38 -0000 Author: ed Date: Thu Apr 23 09:11:37 2009 New Revision: 191415 URL: http://svn.freebsd.org/changeset/base/191415 Log: Let pflogd's Makefile just use WARNS instead of changing CFLAGS. This change allows me to disable -Werror by using NO_WERROR. Right now I can't build pflogd using Clang, because Clang generates more warnings when passing -Wall. Modified: head/sbin/pflogd/Makefile Modified: head/sbin/pflogd/Makefile ============================================================================== --- head/sbin/pflogd/Makefile Thu Apr 23 08:37:56 2009 (r191414) +++ head/sbin/pflogd/Makefile Thu Apr 23 09:11:37 2009 (r191415) @@ -6,8 +6,9 @@ PROG= pflogd SRCS= pflogd.c pidfile.c privsep.c privsep_fdpass.c MAN= pflogd.8 -CFLAGS+=-Wall -Werror -Wmissing-prototypes -Wshadow LDADD= -lpcap -lutil DPADD= ${LIBPCAP} ${LIBUTIL} +WARNS?= 2 + .include From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 09:32:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E039D1065678; Thu, 23 Apr 2009 09:32:30 +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 CDCFF8FC21; Thu, 23 Apr 2009 09:32:30 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3N9WUjq082067; Thu, 23 Apr 2009 09:32:30 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3N9WU5f082065; Thu, 23 Apr 2009 09:32:30 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904230932.n3N9WU5f082065@svn.freebsd.org> From: Robert Watson Date: Thu, 23 Apr 2009 09:32: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: r191416 - 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: Thu, 23 Apr 2009 09:32:31 -0000 Author: rwatson Date: Thu Apr 23 09:32:30 2009 New Revision: 191416 URL: http://svn.freebsd.org/changeset/base/191416 Log: Add a new interface flag, IFF_DYING, which is set when a device driver calls if_free(), and remains set if the refcount is elevated. IF_DYING skips the bit in the if_flags bitmask previously used by IFF_NEEDSGIANT, so that an MFC can be done without changing which bit is used, as IFF_NEEDSGIANT is still present in 7.x. ifnet_byindex_ref() checks for IFF_DYING and returns NULL if it is set, preventing new references from by acquired by index, preventing monitoring sysctls from seeing it. Other lookup mechanisms currently do not check IFF_DYING, but may need to in the future. MFC after: 3 weeks Modified: head/sys/net/if.c head/sys/net/if.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Apr 23 09:11:37 2009 (r191415) +++ head/sys/net/if.c Thu Apr 23 09:32:30 2009 (r191416) @@ -229,7 +229,7 @@ ifnet_byindex_ref(u_short idx) IFNET_RLOCK(); ifp = ifnet_byindex_locked(idx); - if (ifp == NULL) { + if (ifp == NULL || (ifp->if_flags & IFF_DYING)) { IFNET_RUNLOCK(); return (NULL); } @@ -526,56 +526,72 @@ if_alloc(u_char type) } /* - * Free the struct ifnet, the associated index, and the layer 2 common - * structure if needed. All the work is done in if_free_type(). - * - * Do not add code to this function! Add it to if_free_type(). + * Do the actual work of freeing a struct ifnet, associated index, and layer + * 2 common structure. This call is made when the last reference to an + * interface is released. */ -void -if_free(struct ifnet *ifp) +static void +if_free_internal(struct ifnet *ifp) { - if_free_type(ifp, ifp->if_alloctype); + KASSERT((ifp->if_flags & IFF_DYING), + ("if_free_internal: interface not dying")); + + IFNET_WLOCK(); + KASSERT(ifp == ifnet_byindex_locked(ifp->if_index), + ("%s: freeing unallocated ifnet", ifp->if_xname)); + + ifnet_setbyindex(ifp->if_index, NULL); + while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL) + V_if_index--; + IFNET_WUNLOCK(); + + if (if_com_free[ifp->if_alloctype] != NULL) + if_com_free[ifp->if_alloctype](ifp->if_l2com, + ifp->if_alloctype); + + IF_ADDR_LOCK_DESTROY(ifp); + free(ifp, M_IFNET); } /* - * Do the actual work of freeing a struct ifnet, associated index, and - * layer 2 common structure. This version should only be called by - * intefaces that switch their type after calling if_alloc(). + * This version should only be called by intefaces that switch their type + * after calling if_alloc(). if_free_type() will go away again now that we + * have if_alloctype to cache the original allocation type. For now, assert + * that they match, since we require that in practice. */ void if_free_type(struct ifnet *ifp, u_char type) { INIT_VNET_NET(curvnet); /* ifp->if_vnet can be NULL here ! */ - /* - * Some drivers modify if_type, so we can't rely on it being the - * same in free as it was in alloc. Now that we have if_alloctype, - * we should just use that, but drivers expect to pass a type. - */ KASSERT(ifp->if_alloctype == type, ("if_free_type: type (%d) != alloctype (%d)", type, ifp->if_alloctype)); + ifp->if_flags |= IFF_DYING; /* XXX: Locking */ if (!refcount_release(&ifp->if_refcount)) return; + if_free_internal(ifp); +} - IFNET_WLOCK(); - KASSERT(ifp == ifnet_byindex_locked(ifp->if_index), - ("%s: freeing unallocated ifnet", ifp->if_xname)); - ifnet_setbyindex(ifp->if_index, NULL); - while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL) - V_if_index--; - IFNET_WUNLOCK(); - - if (if_com_free[ifp->if_alloctype] != NULL) - if_com_free[ifp->if_alloctype](ifp->if_l2com, - ifp->if_alloctype); +/* + * This is the normal version of if_free(), used by device drivers to free a + * detached network interface. The contents of if_free_type() will move into + * here when if_free_type() goes away. + */ +void +if_free(struct ifnet *ifp) +{ - IF_ADDR_LOCK_DESTROY(ifp); - free(ifp, M_IFNET); + if_free_type(ifp, ifp->if_alloctype); } +/* + * Interfaces to keep an ifnet type-stable despite the possibility of the + * driver calling if_free(). If there are additional references, we defer + * freeing the underlying data structure. + */ void if_ref(struct ifnet *ifp) { @@ -588,7 +604,9 @@ void if_rele(struct ifnet *ifp) { - if_free(ifp); + if (!refcount_release(&ifp->if_refcount)) + return; + if_free_internal(ifp); } void Modified: head/sys/net/if.h ============================================================================== --- head/sys/net/if.h Thu Apr 23 09:11:37 2009 (r191415) +++ head/sys/net/if.h Thu Apr 23 09:32:30 2009 (r191416) @@ -149,6 +149,7 @@ struct if_data { #define IFF_PPROMISC 0x20000 /* (n) user-requested promisc mode */ #define IFF_MONITOR 0x40000 /* (n) user-requested monitor mode */ #define IFF_STATICARP 0x80000 /* (n) static ARP */ +#define IFF_DYING 0x200000 /* (n) interface is winding down */ /* * Old names for driver flags so that user space tools can continue to use @@ -162,7 +163,8 @@ struct if_data { /* flags set internally only: */ #define IFF_CANTCHANGE \ (IFF_BROADCAST|IFF_POINTOPOINT|IFF_DRV_RUNNING|IFF_DRV_OACTIVE|\ - IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART|IFF_PROMISC) + IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART|IFF_PROMISC|\ + IFF_DYING) /* * Values for if_link_state. From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 10:59:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A87B1065670; Thu, 23 Apr 2009 10:59:40 +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 889398FC08; Thu, 23 Apr 2009 10:59:40 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NAxeOC085325; Thu, 23 Apr 2009 10:59:40 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NAxe4f085324; Thu, 23 Apr 2009 10:59:40 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904231059.n3NAxe4f085324@svn.freebsd.org> From: Robert Watson Date: Thu, 23 Apr 2009 10:59: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: r191417 - 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: Thu, 23 Apr 2009 10:59:41 -0000 Author: rwatson Date: Thu Apr 23 10:59:40 2009 New Revision: 191417 URL: http://svn.freebsd.org/changeset/base/191417 Log: Move portions of data structure initialization from if_attach() to if_alloc(), and portions of data structure destruction from if_detach() to if_free(). These changes leave more of the struct ifnet in a safe-to-access condition between alloc and attach, and between detach and free, and focus on attach/detach as stack usage events rather than data structure initialization. Affected fields include the linkstate task queue, if_afdata lock, address lists, kqueue state, and MAC labels. ifq_attach() ifq_detach() are not moved as ifq_attach() may use a queue length set by the device driver between if_alloc() and if_attach(). MFC after: 3 weeks Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Apr 23 09:32:30 2009 (r191416) +++ head/sys/net/if.c Thu Apr 23 10:59:40 2009 (r191417) @@ -478,7 +478,7 @@ if_check(void *dummy __unused) * common structure will also be allocated if an allocation routine is * registered for the passed type. */ -struct ifnet* +struct ifnet * if_alloc(u_char type) { INIT_VNET_NET(curvnet); @@ -518,6 +518,18 @@ if_alloc(u_char type) } IF_ADDR_LOCK_INIT(ifp); + TASK_INIT(&ifp->if_linktask, 0, do_link_state_change, ifp); + IF_AFDATA_LOCK_INIT(ifp); + ifp->if_afdata_initialized = 0; + TAILQ_INIT(&ifp->if_addrhead); + TAILQ_INIT(&ifp->if_prefixhead); + TAILQ_INIT(&ifp->if_multiaddrs); + TAILQ_INIT(&ifp->if_groups); + knlist_init(&ifp->if_klist, NULL, NULL, NULL, NULL); +#ifdef MAC + mac_ifnet_init(ifp); +#endif + refcount_init(&ifp->if_refcount, 1); /* Index reference. */ IFNET_WLOCK(); ifnet_setbyindex(ifp->if_index, ifp); @@ -550,6 +562,13 @@ if_free_internal(struct ifnet *ifp) if_com_free[ifp->if_alloctype](ifp->if_l2com, ifp->if_alloctype); +#ifdef MAC + mac_ifnet_destroy(ifp); +#endif /* MAC */ + KNOTE_UNLOCKED(&ifp->if_klist, NOTE_EXIT); + knlist_clear(&ifp->if_klist, 0); + knlist_destroy(&ifp->if_klist); + IF_AFDATA_DESTROY(ifp); IF_ADDR_LOCK_DESTROY(ifp); free(ifp, M_IFNET); } @@ -638,8 +657,6 @@ ifq_detach(struct ifaltq *ifq) * XXX: * - The decision to return void and thus require this function to * succeed is questionable. - * - We do more initialization here then is probably a good idea. - * Some of this should probably move to if_alloc(). * - We should probably do more sanity checking. For instance we don't * do anything to insure if_xname is unique or non-empty. */ @@ -656,32 +673,21 @@ if_attach(struct ifnet *ifp) panic ("%s: BUG: if_attach called without if_alloc'd input()\n", ifp->if_xname); - TASK_INIT(&ifp->if_linktask, 0, do_link_state_change, ifp); - IF_AFDATA_LOCK_INIT(ifp); - ifp->if_afdata_initialized = 0; - - TAILQ_INIT(&ifp->if_addrhead); - TAILQ_INIT(&ifp->if_prefixhead); - TAILQ_INIT(&ifp->if_multiaddrs); - TAILQ_INIT(&ifp->if_groups); - if_addgroup(ifp, IFG_ALL); - knlist_init(&ifp->if_klist, NULL, NULL, NULL, NULL); getmicrotime(&ifp->if_lastchange); ifp->if_data.ifi_epoch = time_uptime; ifp->if_data.ifi_datalen = sizeof(struct if_data); + KASSERT((ifp->if_transmit == NULL && ifp->if_qflush == NULL) || (ifp->if_transmit != NULL && ifp->if_qflush != NULL), ("transmit and qflush must both either be set or both be NULL")); - if (ifp->if_transmit == NULL) { ifp->if_transmit = if_transmit; ifp->if_qflush = if_qflush; } #ifdef MAC - mac_ifnet_init(ifp); mac_ifnet_create(ifp); #endif @@ -729,7 +735,6 @@ if_attach(struct ifnet *ifp) TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link); ifp->if_broadcastaddr = NULL; /* reliably crash if used uninitialized */ - IFNET_WLOCK(); TAILQ_INSERT_TAIL(&V_ifnet, ifp, if_link); IFNET_WUNLOCK(); @@ -967,15 +972,7 @@ if_detach(struct ifnet *ifp) ifp->if_afdata[dp->dom_family]); } IF_AFDATA_UNLOCK(ifp); - -#ifdef MAC - mac_ifnet_destroy(ifp); -#endif /* MAC */ - KNOTE_UNLOCKED(&ifp->if_klist, NOTE_EXIT); - knlist_clear(&ifp->if_klist, 0); - knlist_destroy(&ifp->if_klist); ifq_detach(&ifp->if_snd); - IF_AFDATA_DESTROY(ifp); splx(s); } From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 11:51:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 799DA106566C; Thu, 23 Apr 2009 11:51:53 +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 672358FC1B; Thu, 23 Apr 2009 11:51:53 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NBpr4K086270; Thu, 23 Apr 2009 11:51:53 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NBprBx086266; Thu, 23 Apr 2009 11:51:53 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904231151.n3NBprBx086266@svn.freebsd.org> From: Robert Watson Date: Thu, 23 Apr 2009 11:51: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: r191418 - in head/sys: conf 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: Thu, 23 Apr 2009 11:51:54 -0000 Author: rwatson Date: Thu Apr 23 11:51:53 2009 New Revision: 191418 URL: http://svn.freebsd.org/changeset/base/191418 Log: During if_detach(), invoke if_dead() to set the ifnet's function pointers to "dead" implementations that no-op rather than invoking the device driver. This would generally be unexpected and possibly quite badly handled by most device drivers after if_detach() has completed. Reviewed by: bms MFC after: 3 weeks Added: head/sys/net/if_dead.c (contents, props changed) Modified: head/sys/conf/files head/sys/net/if.c head/sys/net/if_var.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Apr 23 10:59:40 2009 (r191417) +++ head/sys/conf/files Thu Apr 23 11:51:53 2009 (r191418) @@ -2152,6 +2152,7 @@ net/if_arcsubr.c optional arcnet net/if_atmsubr.c optional atm net/if_bridge.c optional bridge | if_bridge net/if_clone.c standard +net/if_dead.c standard net/if_disc.c optional disc net/if_edsc.c optional edsc net/if_ef.c optional ef Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Apr 23 10:59:40 2009 (r191417) +++ head/sys/net/if.c Thu Apr 23 11:51:53 2009 (r191418) @@ -929,6 +929,11 @@ if_detach(struct ifnet *ifp) if_purgemaddrs(ifp); /* + * Prevent further calls into the device driver via ifnet. + */ + if_dead(ifp); + + /* * Remove link ifaddr pointer and maybe decrement if_index. * Clean up all addresses. */ Added: head/sys/net/if_dead.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net/if_dead.c Thu Apr 23 11:51:53 2009 (r191418) @@ -0,0 +1,114 @@ +/*- + * Copyright (c) 2009 Robert N. M. Watson + * 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. + */ + +/* + * When an interface has been detached but not yet freed, we set the various + * ifnet function pointers to "ifdead" versions. This prevents unexpected + * calls from the network stack into the device driver after if_detach() has + * returned. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include + +static int +ifdead_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa, + struct route *ro) +{ + + m_freem(m); + return (ENXIO); +} + +static void +ifdead_input(struct ifnet *ifp, struct mbuf *m) +{ + + m_freem(m); +} + +static void +ifdead_start(struct ifnet *ifp) +{ + +} + +static int +ifdead_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + + return (ENXIO); +} + +static void +ifdead_watchdog(struct ifnet *ifp) +{ + +} + +static int +ifdead_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa, + struct sockaddr *sa) +{ + + *llsa = NULL; + return (ENXIO); +} + +static void +ifdead_qflush(struct ifnet *ifp) +{ + +} + +static int +ifdead_transmit(struct ifnet *ifp, struct mbuf *m) +{ + + m_freem(m); + return (ENXIO); +} + +void +if_dead(struct ifnet *ifp) +{ + + ifp->if_output = ifdead_output; + ifp->if_input = ifdead_input; + ifp->if_start = ifdead_start; + ifp->if_ioctl = ifdead_ioctl; + ifp->if_watchdog = ifdead_watchdog; + ifp->if_resolvemulti = ifdead_resolvemulti; + ifp->if_qflush = ifdead_qflush; + ifp->if_transmit = ifdead_transmit; +} Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Thu Apr 23 10:59:40 2009 (r191417) +++ head/sys/net/if_var.h Thu Apr 23 11:51:53 2009 (r191418) @@ -753,6 +753,7 @@ int if_addmulti(struct ifnet *, struct s int if_allmulti(struct ifnet *, int); struct ifnet* if_alloc(u_char); void if_attach(struct ifnet *); +void if_dead(struct ifnet *); int if_delmulti(struct ifnet *, struct sockaddr *); void if_delmulti_ifma(struct ifmultiaddr *); void if_detach(struct ifnet *); From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 11:55:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4CF9106564A; Thu, 23 Apr 2009 11:55:53 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 977D28FC08; Thu, 23 Apr 2009 11:55:53 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 3B32C46B2D; Thu, 23 Apr 2009 07:55:53 -0400 (EDT) Date: Thu, 23 Apr 2009 12:55:53 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: John Baldwin In-Reply-To: <200904222140.n3MLebn3068260@svn.freebsd.org> Message-ID: References: <200904222140.n3MLebn3068260@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: r191405 - 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: Thu, 23 Apr 2009 11:55:55 -0000 On Wed, 22 Apr 2009, John Baldwin wrote: > Adjust the way we number CPUs on x86 so that we attempt to "group" all > logical CPUs in a package. We do this by numbering the non-boot CPUs > by starting with the first CPU whose APIC ID is after the boot CPU and > wrapping back around to APIC ID 0 if needed rather than always starting > at APIC ID 0. While here, adjust the cpu_mp_announce() routine to list > CPUs based on the mapping established by assign_cpu_ids() rather than > making assumptions about the algorithm assign_cpu_ids() uses. Something we'd like to be able to do in the fairly near future is assign work from one thread/core to another thread/core that is cache-wise "close" to the current one. For example, if we take a cacheline miss on an mbuf head and the first line of a packet's data on one CPU, and want to hand it off to another CPU for further processing, trying to send it somewhere where it's already quite close, cache-wise, might well be beneficial. Likewise, sending it to another thread or core that is cache-wise close on the lock protecting the queue used to pass it between CPUs, would also be nice. Do you have any ideas about ways to usefully represent and manage concepts like "pick a close CPU" or "the set of CPUs that are close"? For example, if I have available a flow identifier, hashing to one of a set of available CPUs is easy, but what would you suggest as an efficient representation to hash from a set of close available CPUs rather than the entire pool? Robert N M Watson Computer Laboratory University of Cambridge > > MFC after: 1 month > > 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 Wed Apr 22 20:58:23 2009 (r191404) > +++ head/sys/amd64/amd64/mp_machdep.c Wed Apr 22 21:40:37 2009 (r191405) > @@ -354,8 +354,6 @@ cpu_mp_start(void) > } else > KASSERT(boot_cpu_id == PCPU_GET(apic_id), > ("BSP's APIC ID doesn't match boot_cpu_id")); > - cpu_apic_ids[0] = boot_cpu_id; > - apic_cpuids[boot_cpu_id] = 0; > > /* Setup the initial logical CPUs info. */ > logical_cpus = logical_cpus_mask = 0; > @@ -418,28 +416,30 @@ cpu_mp_start(void) > void > cpu_mp_announce(void) > { > - int i, x; > const char *hyperthread; > + int i; > > - /* List CPUs */ > + /* List active CPUs first. */ > printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id); > - for (i = 1, x = 0; x <= MAX_APIC_ID; x++) { > - if (!cpu_info[x].cpu_present || cpu_info[x].cpu_bsp) > + for (i = 1; i < mp_ncpus; i++) { > + if (cpu_info[cpu_apic_ids[i]].cpu_hyperthread) > + hyperthread = "/HT"; > + else > + hyperthread = ""; > + printf(" cpu%d (AP%s): APIC ID: %2d\n", i, hyperthread, > + cpu_apic_ids[i]); > + } > + > + /* List disabled CPUs last. */ > + for (i = 0; i <= MAX_APIC_ID; i++) { > + if (!cpu_info[i].cpu_present || !cpu_info[i].cpu_disabled) > continue; > - if (cpu_info[x].cpu_hyperthread) { > + if (cpu_info[i].cpu_hyperthread) > hyperthread = "/HT"; > - } else { > + else > hyperthread = ""; > - } > - if (cpu_info[x].cpu_disabled) > - printf(" cpu (AP%s): APIC ID: %2d (disabled)\n", > - hyperthread, x); > - else { > - KASSERT(i < mp_ncpus, > - ("mp_ncpus and actual cpus are out of whack")); > - printf(" cpu%d (AP%s): APIC ID: %2d\n", i++, > - hyperthread, x); > - } > + printf(" cpu (AP%s): APIC ID: %2d (disabled)\n", hyperthread, > + i); > } > } > > @@ -693,11 +693,19 @@ assign_cpu_ids(void) > > /* > * Assign CPU IDs to local APIC IDs and disable any CPUs > - * beyond MAXCPU. CPU 0 has already been assigned to the BSP, > - * so we only have to assign IDs for APs. > + * beyond MAXCPU. CPU 0 is always assigned to the BSP. > + * > + * To minimize confusion for userland, we attempt to number > + * CPUs such that all threads and cores in a package are > + * grouped together. For now we assume that the BSP is always > + * the first thread in a package and just start adding APs > + * starting with the BSP's APIC ID. > */ > mp_ncpus = 1; > - for (i = 0; i <= MAX_APIC_ID; i++) { > + cpu_apic_ids[0] = boot_cpu_id; > + apic_cpuids[boot_cpu_id] = 0; > + for (i = boot_cpu_id + 1; i != boot_cpu_id; > + i == MAX_APIC_ID ? i = 0 : i++) { > if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp || > cpu_info[i].cpu_disabled) > continue; > > Modified: head/sys/i386/i386/mp_machdep.c > ============================================================================== > --- head/sys/i386/i386/mp_machdep.c Wed Apr 22 20:58:23 2009 (r191404) > +++ head/sys/i386/i386/mp_machdep.c Wed Apr 22 21:40:37 2009 (r191405) > @@ -398,8 +398,6 @@ cpu_mp_start(void) > } else > KASSERT(boot_cpu_id == PCPU_GET(apic_id), > ("BSP's APIC ID doesn't match boot_cpu_id")); > - cpu_apic_ids[0] = boot_cpu_id; > - apic_cpuids[boot_cpu_id] = 0; > > /* Setup the initial logical CPUs info. */ > logical_cpus = logical_cpus_mask = 0; > @@ -462,28 +460,30 @@ cpu_mp_start(void) > void > cpu_mp_announce(void) > { > - int i, x; > const char *hyperthread; > + int i; > > - /* List CPUs */ > + /* List active CPUs first. */ > printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id); > - for (i = 1, x = 0; x <= MAX_APIC_ID; x++) { > - if (!cpu_info[x].cpu_present || cpu_info[x].cpu_bsp) > + for (i = 1; i < mp_ncpus; i++) { > + if (cpu_info[cpu_apic_ids[i]].cpu_hyperthread) > + hyperthread = "/HT"; > + else > + hyperthread = ""; > + printf(" cpu%d (AP%s): APIC ID: %2d\n", i, hyperthread, > + cpu_apic_ids[i]); > + } > + > + /* List disabled CPUs last. */ > + for (i = 0; i <= MAX_APIC_ID; i++) { > + if (!cpu_info[i].cpu_present || !cpu_info[i].cpu_disabled) > continue; > - if (cpu_info[x].cpu_hyperthread) { > + if (cpu_info[i].cpu_hyperthread) > hyperthread = "/HT"; > - } else { > + else > hyperthread = ""; > - } > - if (cpu_info[x].cpu_disabled) > - printf(" cpu (AP%s): APIC ID: %2d (disabled)\n", > - hyperthread, x); > - else { > - KASSERT(i < mp_ncpus, > - ("mp_ncpus and actual cpus are out of whack")); > - printf(" cpu%d (AP%s): APIC ID: %2d\n", i++, > - hyperthread, x); > - } > + printf(" cpu (AP%s): APIC ID: %2d (disabled)\n", hyperthread, > + i); > } > } > > @@ -722,11 +722,19 @@ assign_cpu_ids(void) > > /* > * Assign CPU IDs to local APIC IDs and disable any CPUs > - * beyond MAXCPU. CPU 0 has already been assigned to the BSP, > - * so we only have to assign IDs for APs. > + * beyond MAXCPU. CPU 0 is always assigned to the BSP. > + * > + * To minimize confusion for userland, we attempt to number > + * CPUs such that all threads and cores in a package are > + * grouped together. For now we assume that the BSP is always > + * the first thread in a package and just start adding APs > + * starting with the BSP's APIC ID. > */ > mp_ncpus = 1; > - for (i = 0; i <= MAX_APIC_ID; i++) { > + cpu_apic_ids[0] = boot_cpu_id; > + apic_cpuids[boot_cpu_id] = 0; > + for (i = boot_cpu_id + 1; i != boot_cpu_id; > + i == MAX_APIC_ID ? i = 0 : i++) { > if (!cpu_info[i].cpu_present || cpu_info[i].cpu_bsp || > cpu_info[i].cpu_disabled) > continue; > From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 12:01:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38ED81065677; Thu, 23 Apr 2009 12:01:56 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-ew0-f171.google.com (mail-ew0-f171.google.com [209.85.219.171]) by mx1.freebsd.org (Postfix) with ESMTP id 1B3508FC13; Thu, 23 Apr 2009 12:01:54 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by ewy19 with SMTP id 19so444570ewy.43 for ; Thu, 23 Apr 2009 05:01:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=43dD+I2OuQFc5+TxVXPDL7mKxIUKeLndXUevStf/uP4=; b=ntWqehuLLPWarxyXBpk1yVOn6GZMSicKrRwvNTG+4CiKKHBPufTVnHMK+lCJ9ZVY4O 9OTfKSXKZAyU510ozjJgsWZ9smDVkNR5F5sFpBzHU81h2F8QnEIKyOrna8N7tNXZ3lgs hXj59m1B1SoSv4IrApuOu0QsYQ8xiilNlvuwE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=f6WyxS2rL927YhvXGOjUQaaim0KBG9xow8Mm7ETEb7uL55iypQVc7d6u8QI9mxPLQG ssm6ZJIl2Znc8Lz0EDV8ApBIPr04PPNuxOBHRJ+0GRzD86J7FUk1ErKbjeIlPV3Vn+AF 5WIubx5WulVzIgroJPZvPUFHypLeUDzi4mhXA= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.210.43.11 with SMTP id q11mr7496510ebq.54.1240488114111; Thu, 23 Apr 2009 05:01:54 -0700 (PDT) In-Reply-To: References: <200904222140.n3MLebn3068260@svn.freebsd.org> From: Ivan Voras Date: Thu, 23 Apr 2009 14:01:39 +0200 X-Google-Sender-Auth: dea242447255531f Message-ID: <9bbcef730904230501k26197958tb78d88958bd20654@mail.gmail.com> To: Robert Watson 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, John Baldwin Subject: Re: svn commit: r191405 - 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: Thu, 23 Apr 2009 12:01:57 -0000 2009/4/23 Robert Watson : > Do you have any ideas about ways to usefully represent and manage concept= s > like "pick a close CPU" or "the set of CPUs that are close"? =C2=A0For ex= ample, > if I have available a flow identifier, hashing to one of a set of availab= le > CPUs is easy, but what would you suggest as an efficient representation t= o > hash from a set of close available CPUs rather than the entire pool? Excuse me if I'm missing the point but isn't this already done by ULE and for almost the same reasons? Shouldn't the scheduler (or its topology infrastructure if it's separated from the scheduler) be the best place to do it? From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 12:29:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CEDD1065670; Thu, 23 Apr 2009 12:29:54 +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 2364B8FC1A; Thu, 23 Apr 2009 12:29:54 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id B728446B1A; Thu, 23 Apr 2009 08:29:53 -0400 (EDT) Date: Thu, 23 Apr 2009 13:29:53 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Ivan Voras In-Reply-To: <9bbcef730904230501k26197958tb78d88958bd20654@mail.gmail.com> Message-ID: References: <200904222140.n3MLebn3068260@svn.freebsd.org> <9bbcef730904230501k26197958tb78d88958bd20654@mail.gmail.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="621616949-1317614271-1240489793=:54334" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r191405 - 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: Thu, 23 Apr 2009 12:29:54 -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-1317614271-1240489793=:54334 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Thu, 23 Apr 2009, Ivan Voras wrote: > 2009/4/23 Robert Watson : > >> Do you have any ideas about ways to usefully represent and manage concepts >> like "pick a close CPU" or "the set of CPUs that are close"?  For example, >> if I have available a flow identifier, hashing to one of a set of available >> CPUs is easy, but what would you suggest as an efficient representation to >> hash from a set of close available CPUs rather than the entire pool? > > Excuse me if I'm missing the point but isn't this already done by ULE and > for almost the same reasons? Shouldn't the scheduler (or its topology > infrastructure if it's separated from the scheduler) be the best place to do > it? Yes, the scheduler will presumably provide the abstractions we're interested in in order to implement this sort of policy. However, the scheduler's notion of "strictly ordered events" is represented by a thread, and threads scale to several thousand per machine. The network stack's notion of "strictly ordered events" is represented by a flow, and we need to be able to handle millions of those at once. The mapping between flows and threads is something the network stack is best suited to do, since it will be passing around and ordering the work, but with the help of appropriate abstractions from the scheduler so that it knows how many and which threads exist to do the work, and so that it can use scheduler-provided metrics, such as CPU topology, to make reasonable choices about placement of work when there's flexibility in the ordering. Robert N M Watson Computer Laboratory University of Cambridge --621616949-1317614271-1240489793=:54334-- From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 13:08:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 750BF1065672; Thu, 23 Apr 2009 13:08:48 +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 48EC98FC1D; Thu, 23 Apr 2009 13:08:48 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3ND8mmY088011; Thu, 23 Apr 2009 13:08:48 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3ND8mpl088009; Thu, 23 Apr 2009 13:08:48 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904231308.n3ND8mpl088009@svn.freebsd.org> From: Robert Watson Date: Thu, 23 Apr 2009 13:08: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: r191423 - 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: Thu, 23 Apr 2009 13:08:48 -0000 Author: rwatson Date: Thu Apr 23 13:08:47 2009 New Revision: 191423 URL: http://svn.freebsd.org/changeset/base/191423 Log: Add ifunit_ref(), a version of ifunit(), that returns not just an interface pointer, but also a reference to it. Modify ifioctl() to use ifunit_ref(), holding the reference until all ioctls, etc, have completed. This closes a class of reader-writer races in which interfaces could be removed during long-running ioctls, leading to crashes. Many other consumers of ifunit() should now use ifunit_ref() to avoid similar races. MFC after: 3 weeks Modified: head/sys/net/if.c head/sys/net/if_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Apr 23 12:09:49 2009 (r191422) +++ head/sys/net/if.c Thu Apr 23 13:08:47 2009 (r191423) @@ -1788,10 +1788,27 @@ if_slowtimo(void *arg) } /* - * Map interface name to - * interface structure pointer. + * Map interface name to interface structure pointer, with or without + * returning a reference. */ struct ifnet * +ifunit_ref(const char *name) +{ + INIT_VNET_NET(curvnet); + struct ifnet *ifp; + + IFNET_RLOCK(); + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { + if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0) + break; + } + if (ifp != NULL) + if_ref(ifp); + IFNET_RUNLOCK(); + return (ifp); +} + +struct ifnet * ifunit(const char *name) { INIT_VNET_NET(curvnet); @@ -2167,17 +2184,21 @@ ifioctl(struct socket *so, u_long cmd, c return (if_getgroupmembers((struct ifgroupreq *)data)); } - ifp = ifunit(ifr->ifr_name); - if (ifp == 0) + ifp = ifunit_ref(ifr->ifr_name); + if (ifp == NULL) return (ENXIO); error = ifhwioctl(cmd, ifp, data, td); - if (error != ENOIOCTL) + if (error != ENOIOCTL) { + if_rele(ifp); return (error); + } oif_flags = ifp->if_flags; - if (so->so_proto == 0) + if (so->so_proto == NULL) { + if_rele(ifp); return (EOPNOTSUPP); + } #ifndef COMPAT_43 error = ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, data, @@ -2250,6 +2271,7 @@ ifioctl(struct socket *so, u_long cmd, c } #endif } + if_rele(ifp); return (error); } Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Thu Apr 23 12:09:49 2009 (r191422) +++ head/sys/net/if_var.h Thu Apr 23 13:08:47 2009 (r191423) @@ -776,6 +776,7 @@ void if_up(struct ifnet *); int ifioctl(struct socket *, u_long, caddr_t, struct thread *); int ifpromisc(struct ifnet *, int); struct ifnet *ifunit(const char *); +struct ifnet *ifunit_ref(const char *); void ifq_attach(struct ifaltq *, struct ifnet *ifp); void ifq_detach(struct ifaltq *); From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 13:08:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E3921065741; Thu, 23 Apr 2009 13:08:55 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-ew0-f171.google.com (mail-ew0-f171.google.com [209.85.219.171]) by mx1.freebsd.org (Postfix) with ESMTP id 4DDAC8FC20; Thu, 23 Apr 2009 13:08:53 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by ewy19 with SMTP id 19so475834ewy.43 for ; Thu, 23 Apr 2009 06:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=60F8+0E6Ea2jyKrbSVeRqUiz2D6QmBMoNBmXEhZcJ6E=; b=oKFU5YWz7ugnFu0cNdfcOjB4bG+8C9K9ZChm4VdiNXiBnAFgiVBEcXO5oJEBIAQ8a8 dVZbMu8nKpsM7v8sRbbm9U2SPaEXQnLB5RGspFtBDyChN9z3LUGazAItrLUHh/t2HYQk pVSZSnudmIBkGaQZwvu5LzVPQIhy5mHhsL0yg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=jxJiqJLYfG+oZtFnTfKftojkpNjiclBJOv4JfC5WWAiUpDiIORSQ3Venmo2tSTJ5xy 1HcQFgRiWbtk4hpxeZ6ptqlVkZKckiAebl6+8fGmfFns6O6S83yFSWEZQ7V3xxFwtJHu twsfXJzNWDytWc6nO1bZ+/zlHXwTSlhxu5pEA= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.210.19.7 with SMTP id 7mr972444ebs.90.1240492133239; Thu, 23 Apr 2009 06:08:53 -0700 (PDT) In-Reply-To: References: <200904222140.n3MLebn3068260@svn.freebsd.org> <9bbcef730904230501k26197958tb78d88958bd20654@mail.gmail.com> From: Ivan Voras Date: Thu, 23 Apr 2009 15:08:38 +0200 X-Google-Sender-Auth: 449d32fba838d4e8 Message-ID: <9bbcef730904230608t7c91629erda244dbd38e617a8@mail.gmail.com> To: Robert Watson 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: r191405 - 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: Thu, 23 Apr 2009 13:08:56 -0000 2009/4/23 Robert Watson : > > On Thu, 23 Apr 2009, Ivan Voras wrote: > >> 2009/4/23 Robert Watson : >> >>> Do you have any ideas about ways to usefully represent and manage >>> concepts like "pick a close CPU" or "the set of CPUs that are close"? = =C2=A0For >>> example, if I have available a flow identifier, hashing to one of a set= of >>> available CPUs is easy, but what would you suggest as an efficient >>> representation to hash from a set of close available CPUs rather than t= he >>> entire pool? >> >> Excuse me if I'm missing the point but isn't this already done by ULE an= d >> for almost the same reasons? Shouldn't the scheduler (or its topology >> infrastructure if it's separated from the scheduler) be the best place t= o do >> it? > > Yes, the scheduler will presumably provide the abstractions we're interes= ted > in in order to implement this sort of policy. =C2=A0However, the schedule= r's > notion of "strictly ordered events" is represented by a thread, and threa= ds > scale to several thousand per machine. =C2=A0The network stack's notion o= f > "strictly ordered events" is represented by a flow, and we need to be abl= e > to handle millions of those at once. =C2=A0The mapping between flows and = threads > is something the network stack is best suited to do, since it will be > passing around and ordering the work, but with the help of appropriate > abstractions from the scheduler so that it knows how many and which threa= ds > exist to do the work, and so that it can use scheduler-provided metrics, > such as CPU topology, to make reasonable choices about placement of work > when there's flexibility in the ordering. Thanks, it's much clearer now! From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 14:54:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B513106566B; Thu, 23 Apr 2009 14:54:46 +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 98D4C8FC15; Thu, 23 Apr 2009 14:54:45 +0000 (UTC) (envelope-from imp@BSDIMP.COM) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n3NEmNK5039103; Thu, 23 Apr 2009 08:48:23 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 23 Apr 2009 08:49:20 -0600 (MDT) Message-Id: <20090423.084920.-365726763.imp@bsdimp.com> To: Alexander@leidinger.net From: "M. Warner Losh" In-Reply-To: <20090423091120.18706t1ks38zgfgo@webmail.leidinger.net> References: <20090422231511.ca92fb9f.stas@FreeBSD.org> <20090422.133147.-1890035357.imp@bsdimp.com> <20090423091120.18706t1ks38zgfgo@webmail.leidinger.net> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: stas@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191369 - in head/sys: arm/conf 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: Thu, 23 Apr 2009 14:54:46 -0000 In message: <20090423091120.18706t1ks38zgfgo@webmail.leidinger.net> Alexander Leidinger writes: : Quoting "M. Warner Losh" (from Wed, 22 Apr 2009 : 13:31:47 -0600 (MDT)): : : > In message: <20090422231511.ca92fb9f.stas@FreeBSD.org> : > Stanislav Sedov writes: : > : On Wed, 22 Apr 2009 09:05:46 +0200 : > : Alexander Leidinger mentioned: : > : : > : > Quoting "M. Warner Losh" (from Wed, 22 Apr 2009 : > : > 00:26:43 -0600 (MDT)): : > : > : > : > > In message: <200904212248.n3LMmCbu027432@svn.freebsd.org> : > : > > Stanislav Sedov writes: : > : > > : Author: stas : > : > > : Date: Tue Apr 21 22:48:12 2009 : > : > > : New Revision: 191369 : > : > > : URL: http://svn.freebsd.org/changeset/base/191369 : > : > > : : > : > > : Log: : > : > > : - Rename ds1672 and ds133x devices to "ds1672_rtc" and "ds133x_rtc" : > : > > : respectivly. This will allow one to have a kernel with : > both devices : > : > > : present and use it for multiple boards with different : > types of RTC : > : > > : sitting on a bus. : > : > > : : > : > > : Discussed with: imp : > : > > : > : > > Hey thanks Stas! Now things are better than before both functionally : > : > > and cosmetically! Good idea on the names... : > : > : > : > : > : > Are those the first devices with an underscore in the name now? If : > : > yes, do we want this? : > : > : > : > : > : : > : I had the same concerns too, but was not able to come up with anything : > : better. BTW, I think those devices were the first that ended with a : > : digit. : : ds1672rtc? Just if it pleases you or we do not want underscores in : device names which are visible to the outside. There's no rule against understores right now. : > No. They weren't. There are sound devices that end in digits: : > : > # snd_ad1816: Analog Devices AD1816 ISA PnP/non-PnP. : > # snd_als4000: Avance Logic ALS4000 PCI. : > # snd_cs4281: Crystal Semiconductor CS4281 PCI. : > # snd_ds1: Yamaha DS-1 PCI. : > # snd_emu10k1: Creative EMU10K1 PCI and EMU10K2 (Audigy) PCI. : > # snd_envy24: VIA Envy24 and compatible, needs snd_spicds. : > # snd_fm801: Forte Media FM801 PCI. : > # snd_maestro3: ESS Technology Maestro-3/Allegro PCI. : > # snd_sb16: Creative SoundBlaster16, to be used in : > # snd_sb8: Creative SoundBlaster (pre-16), to be used in : > # snd_via8233: VIA VT8233x PCI. : > # snd_via82c686: VIA VT82C686A PCI. : > : > but since they all live on an enumerated bus, they all share the name : > "pcm". : : And because of this they don't count as being with underscores... Why not? Warner From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 15:56:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD6EC1065670; Thu, 23 Apr 2009 15:56:01 +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 CBFD08FC32; Thu, 23 Apr 2009 15:56:01 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NFu12l091273; Thu, 23 Apr 2009 15:56:01 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NFu1Mm091272; Thu, 23 Apr 2009 15:56:01 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904231556.n3NFu1Mm091272@svn.freebsd.org> From: Robert Watson Date: Thu, 23 Apr 2009 15:56: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: r191424 - 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: Thu, 23 Apr 2009 15:56:02 -0000 Author: rwatson Date: Thu Apr 23 15:56:01 2009 New Revision: 191424 URL: http://svn.freebsd.org/changeset/base/191424 Log: As with ifnet_byindex_ref(), don't return IFF_DYING interfaces from ifunit_ref(). ifunit() continues to return them. MFC after: 3 weeks Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Apr 23 13:08:47 2009 (r191423) +++ head/sys/net/if.c Thu Apr 23 15:56:01 2009 (r191424) @@ -1799,7 +1799,8 @@ ifunit_ref(const char *name) IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0) + if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0 && + !(ifp->if_flags & IFF_DYING)) break; } if (ifp != NULL) From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 17:41:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83CBE1065670; Thu, 23 Apr 2009 17:41:54 +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 726BB8FC1F; Thu, 23 Apr 2009 17:41:54 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NHfsjK095057; Thu, 23 Apr 2009 17:41:54 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NHfsPx095056; Thu, 23 Apr 2009 17:41:54 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200904231741.n3NHfsPx095056@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 23 Apr 2009 17:41: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: r191433 - 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: Thu, 23 Apr 2009 17:41:54 -0000 Author: bz Date: Thu Apr 23 17:41:54 2009 New Revision: 191433 URL: http://svn.freebsd.org/changeset/base/191433 Log: Compare protosw pointer with NULL. MFC after: 1 month Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Thu Apr 23 17:36:08 2009 (r191432) +++ head/sys/netinet6/ip6_input.c Thu Apr 23 17:41:54 2009 (r191433) @@ -269,7 +269,7 @@ ip6_init(void) panic("sizeof(protosw) != sizeof(ip6protosw)"); #endif pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); - if (pr == 0) + if (pr == NULL) panic("ip6_init"); /* Initialize the entire ip6_protox[] array to IPPROTO_RAW. */ From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 19:29:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19B57106566B; Thu, 23 Apr 2009 19:29:46 +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 086CD8FC0A; Thu, 23 Apr 2009 19:29:46 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NJTjpj097388; Thu, 23 Apr 2009 19:29:45 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NJTj2s097387; Thu, 23 Apr 2009 19:29:45 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904231929.n3NJTj2s097387@svn.freebsd.org> From: Robert Watson Date: Thu, 23 Apr 2009 19:29:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191437 - head/sys/dev/nve X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 23 Apr 2009 19:29:46 -0000 Author: rwatson Date: Thu Apr 23 19:29:45 2009 New Revision: 191437 URL: http://svn.freebsd.org/changeset/base/191437 Log: Two ifnet misuse fixes for if_nve: (1) Don't manually configure if_output(), ether_ifattach() will do that for us as part of link-layer setup. (2) Call if_detach() before stopping nve in order to prevent calls into the device driver after the driver has started shutting down. Reviewed by: jhb MFC after: 2 weeks Modified: head/sys/dev/nve/if_nve.c Modified: head/sys/dev/nve/if_nve.c ============================================================================== --- head/sys/dev/nve/if_nve.c Thu Apr 23 18:46:03 2009 (r191436) +++ head/sys/dev/nve/if_nve.c Thu Apr 23 19:29:45 2009 (r191437) @@ -539,7 +539,6 @@ nve_attach(device_t dev) if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = nve_ioctl; - ifp->if_output = ether_output; ifp->if_start = nve_ifstart; ifp->if_watchdog = nve_watchdog; ifp->if_timer = 0; @@ -585,11 +584,11 @@ nve_detach(device_t dev) ifp = sc->ifp; if (device_is_attached(dev)) { + ether_ifdetach(ifp); NVE_LOCK(sc); nve_stop(sc); NVE_UNLOCK(sc); callout_drain(&sc->stat_callout); - ether_ifdetach(ifp); } if (sc->miibus) From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 20:05:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 839231065772; Thu, 23 Apr 2009 20:05:20 +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 54D748FC0C; Thu, 23 Apr 2009 20:05:20 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 0ACEF46B51; Thu, 23 Apr 2009 16:05:20 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id E6A078A01A; Thu, 23 Apr 2009 16:05:18 -0400 (EDT) From: John Baldwin To: Ceri Davies Date: Thu, 23 Apr 2009 09:55:44 -0400 User-Agent: KMail/1.9.7 References: <200904222140.n3MLebn3068260@svn.freebsd.org> <200904221759.04446.jhb@freebsd.org> <20090422220304.GB54875@submonkey.net> In-Reply-To: <20090422220304.GB54875@submonkey.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904230955.44669.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 23 Apr 2009 16:05:18 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=1.1 required=4.2 tests=AWL,DATE_IN_PAST_06_12, RDNS_NONE autolearn=no version=3.2.5 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191405 - 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: Thu, 23 Apr 2009 20:05:21 -0000 On Wednesday 22 April 2009 6:03:04 pm Ceri Davies wrote: > On Wed, Apr 22, 2009 at 05:59:04PM -0400, John Baldwin wrote: > > On Wednesday 22 April 2009 5:40:37 pm John Baldwin wrote: > > > Author: jhb > > > Date: Wed Apr 22 21:40:37 2009 > > > New Revision: 191405 > > > URL: http://svn.freebsd.org/changeset/base/191405 > > > > > > Log: > > > Adjust the way we number CPUs on x86 so that we attempt to "group" all > > > logical CPUs in a package. We do this by numbering the non-boot CPUs > > > by starting with the first CPU whose APIC ID is after the boot CPU and > > > wrapping back around to APIC ID 0 if needed rather than always starting > > > at APIC ID 0. While here, adjust the cpu_mp_announce() routine to list > > > CPUs based on the mapping established by assign_cpu_ids() rather than > > > making assumptions about the algorithm assign_cpu_ids() uses. > > > > An example is probably in order for this to make sense. Suppose you have a > > system with two quad-core CPUs. Package 0 has CPUs numbered 0, 1, 2, and 3. > > Package 1 has CPUs numbered 4, 5, 6, and 7. With the old code, if package 0 > > won the election to be the boot processor, then CPU 0 would be the BSP and > > the logical IDs would match the APIC IDs. However, if package 1 won the > > election during POST, then CPU 0 would be APIC ID 4 on package 0 followed by > > CPU 1 being APIC ID 0, CPU 2 being APIC ID 1, etc. Thus, when CPU 0 was the > > boot CPU you had a nice grouping where CPUs 0-3 were a single package and > > CPUs 4-7 were another package. However, when CPU 4 was the boot CPU, CPUs 0 > > and 5-7 where one package, and CPUs 1-4 where the second package. The effect > > of this patch is to change the case when CPU 4 is the boot CPU such that CPUs > > 0-3 are now all from CPU 4's package (APIC IDs 4-7), and CPUs 4-7 are from > > the other package (APIC IDs 0-3). What this means, in turn, is that in both > > cases you now always have CPUs 0-3 as one package and CPUs 4-7 as another > > package regardless of which CPU wins the boot-time election. > > What if I have HT turned on? Do they bunch up with the "real" CPU IDs > or all together at the end? They will be bunched up as they were previously when CPU 0 was the BSP. For Intel at least (and I think AMD is the same), a given package consumes one contiguous range of physical APIC IDs. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 20:05:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 241551065773; Thu, 23 Apr 2009 20:05:22 +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 E8C548FC13; Thu, 23 Apr 2009 20:05:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 4870546B5B; Thu, 23 Apr 2009 16:05:21 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id E9D0B8A01B; Thu, 23 Apr 2009 16:05:19 -0400 (EDT) From: John Baldwin To: Ivan Voras Date: Thu, 23 Apr 2009 09:55:59 -0400 User-Agent: KMail/1.9.7 References: <200904222140.n3MLebn3068260@svn.freebsd.org> <200904221759.04446.jhb@freebsd.org> <9bbcef730904221530u786464d3v2dc05b0bb2f1218a@mail.gmail.com> In-Reply-To: <9bbcef730904221530u786464d3v2dc05b0bb2f1218a@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200904230955.59850.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 23 Apr 2009 16:05:20 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=1.1 required=4.2 tests=AWL,DATE_IN_PAST_06_12, RDNS_NONE autolearn=no version=3.2.5 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191405 - 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: Thu, 23 Apr 2009 20:05:22 -0000 On Wednesday 22 April 2009 6:30:12 pm Ivan Voras wrote: > 2009/4/22 John Baldwin : > > On Wednesday 22 April 2009 5:40:37 pm John Baldwin wrote: > >> Author: jhb > >> Date: Wed Apr 22 21:40:37 2009 > >> New Revision: 191405 > >> URL: http://svn.freebsd.org/changeset/base/191405 > >> > >> Log: > >> =C2=A0 Adjust the way we number CPUs on x86 so that we attempt to "gro= up" all > >> =C2=A0 logical CPUs in a package. =C2=A0We do this by numbering the no= n-boot CPUs > >> =C2=A0 by starting with the first CPU whose APIC ID is after the boot = CPU and > >> =C2=A0 wrapping back around to APIC ID 0 if needed rather than always = starting > >> =C2=A0 at APIC ID 0. =C2=A0While here, adjust the cpu_mp_announce() ro= utine to list > >> =C2=A0 CPUs based on the mapping established by assign_cpu_ids() rathe= r than > >> =C2=A0 making assumptions about the algorithm assign_cpu_ids() uses. > > > > An example is probably in order for this to make sense. =C2=A0Suppose y= ou have a > > system with two quad-core CPUs. =C2=A0Package 0 has CPUs numbered 0, 1,= 2, and 3. > > Package 1 has CPUs numbered 4, 5, 6, and 7. =C2=A0With the old code, if= package 0 > > won the election to be the boot processor, then CPU 0 would be the BSP = and > > the logical IDs would match the APIC IDs. =C2=A0However, if package 1 w= on the > > election during POST, then CPU 0 would be APIC ID 4 on package 0 follow= ed by > > CPU 1 being APIC ID 0, CPU 2 being APIC ID 1, etc. =C2=A0Thus, when CPU= 0 was the > > boot CPU you had a nice grouping where CPUs 0-3 were a single package a= nd > > CPUs 4-7 were another package. =C2=A0However, when CPU 4 was the boot C= PU, CPUs 0 > > and 5-7 where one package, and CPUs 1-4 where the second package. =C2= =A0The effect > > of this patch is to change the case when CPU 4 is the boot CPU such tha= t CPUs > > 0-3 are now all from CPU 4's package (APIC IDs 4-7), and CPUs 4-7 are f= rom > > the other package (APIC IDs 0-3). =C2=A0What this means, in turn, is th= at in both > > cases you now always have CPUs 0-3 as one package and CPUs 4-7 as anoth= er > > package regardless of which CPU wins the boot-time election. >=20 > I like that the new numbering is more elegant, but this is orthogonal > to ULE topology detection, right? Yes. =2D-=20 John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 20:05:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3D1A1065778; Thu, 23 Apr 2009 20:05:22 +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 845E38FC14; Thu, 23 Apr 2009 20:05:22 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 397A346B3B; Thu, 23 Apr 2009 16:05:22 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id E29838A01C; Thu, 23 Apr 2009 16:05:20 -0400 (EDT) From: John Baldwin To: Robert Watson Date: Thu, 23 Apr 2009 09:59:39 -0400 User-Agent: KMail/1.9.7 References: <200904222140.n3MLebn3068260@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904230959.39423.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 23 Apr 2009 16:05:20 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=1.1 required=4.2 tests=AWL,DATE_IN_PAST_06_12, RDNS_NONE autolearn=no version=3.2.5 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191405 - 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: Thu, 23 Apr 2009 20:05:23 -0000 On Thursday 23 April 2009 7:55:53 am Robert Watson wrote: > On Wed, 22 Apr 2009, John Baldwin wrote: > > > Adjust the way we number CPUs on x86 so that we attempt to "group" all > > logical CPUs in a package. We do this by numbering the non-boot CPUs > > by starting with the first CPU whose APIC ID is after the boot CPU and > > wrapping back around to APIC ID 0 if needed rather than always starting > > at APIC ID 0. While here, adjust the cpu_mp_announce() routine to list > > CPUs based on the mapping established by assign_cpu_ids() rather than > > making assumptions about the algorithm assign_cpu_ids() uses. > > Something we'd like to be able to do in the fairly near future is assign work > from one thread/core to another thread/core that is cache-wise "close" to the > current one. For example, if we take a cacheline miss on an mbuf head and the > first line of a packet's data on one CPU, and want to hand it off to another > CPU for further processing, trying to send it somewhere where it's already > quite close, cache-wise, might well be beneficial. Likewise, sending it to > another thread or core that is cache-wise close on the lock protecting the > queue used to pass it between CPUs, would also be nice. > > Do you have any ideas about ways to usefully represent and manage concepts > like "pick a close CPU" or "the set of CPUs that are close"? For example, if > I have available a flow identifier, hashing to one of a set of available CPUs > is easy, but what would you suggest as an efficient representation to hash > from a set of close available CPUs rather than the entire pool? In theory, this is the job of the topology stuff that is available for the scheduler to use to make similar decisions. The purpose of this patch is to make it easier for system administrators who are using /usr/bin/cpuset to tie tasks to specific cores at more of a macro level by providing a more consistent layout of CPU IDs. Presumably this would matter less if cpuset was topology-aware such that you could specify a set by tuples rather than CPU IDs to identify CPUs. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 20:24:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48173106566B; Thu, 23 Apr 2009 20:24:20 +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 3605B8FC14; Thu, 23 Apr 2009 20:24:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NKOJqM098456; Thu, 23 Apr 2009 20:24:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NKOJ0g098453; Thu, 23 Apr 2009 20:24:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200904232024.n3NKOJ0g098453@svn.freebsd.org> From: John Baldwin Date: Thu, 23 Apr 2009 20:24: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: r191438 - in head/sys: amd64/amd64 arm/arm 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: Thu, 23 Apr 2009 20:24:20 -0000 Author: jhb Date: Thu Apr 23 20:24:19 2009 New Revision: 191438 URL: http://svn.freebsd.org/changeset/base/191438 Log: Reduce the number of bounce zones (and thus the number of bounce pages used in some cases): - Ignore DMA tag boundaries when allocating bounce pages. The boundaries don't determine whether or not parts of a DMA request bounce. Instead, they are just used to carve up segments. - Allow tags with sub-page alignment to share bounce pages since bounce pages are always page aligned. Reviewed by: scottl (amd64) MFC after: 1 month Modified: head/sys/amd64/amd64/busdma_machdep.c head/sys/arm/arm/busdma_machdep.c head/sys/i386/i386/busdma_machdep.c Modified: head/sys/amd64/amd64/busdma_machdep.c ============================================================================== --- head/sys/amd64/amd64/busdma_machdep.c Thu Apr 23 19:29:45 2009 (r191437) +++ head/sys/amd64/amd64/busdma_machdep.c Thu Apr 23 20:24:19 2009 (r191438) @@ -95,7 +95,6 @@ struct bounce_zone { int total_deferred; int map_count; bus_size_t alignment; - bus_size_t boundary; bus_addr_t lowaddr; char zoneid[8]; char lowaddrid[20]; @@ -978,7 +977,6 @@ alloc_bounce_zone(bus_dma_tag_t dmat) /* Check to see if we already have a suitable zone */ STAILQ_FOREACH(bz, &bounce_zone_list, links) { if ((dmat->alignment <= bz->alignment) - && (dmat->boundary <= bz->boundary) && (dmat->lowaddr >= bz->lowaddr)) { dmat->bounce_zone = bz; return (0); @@ -994,8 +992,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat) bz->reserved_bpages = 0; bz->active_bpages = 0; bz->lowaddr = dmat->lowaddr; - bz->alignment = dmat->alignment; - bz->boundary = dmat->boundary; + bz->alignment = MAX(dmat->alignment, PAGE_SIZE); bz->map_count = 0; snprintf(bz->zoneid, 8, "zone%d", busdma_zonecount); busdma_zonecount++; @@ -1042,9 +1039,6 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_INT(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), - SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "boundary", CTLFLAG_RD, &bz->boundary, 0, ""); return (0); } @@ -1069,7 +1063,7 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u M_NOWAIT, 0ul, bz->lowaddr, PAGE_SIZE, - bz->boundary); + 0); if (bpage->vaddr == 0) { free(bpage, M_DEVBUF); break; Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Thu Apr 23 19:29:45 2009 (r191437) +++ head/sys/arm/arm/busdma_machdep.c Thu Apr 23 20:24:19 2009 (r191438) @@ -114,7 +114,6 @@ struct bounce_zone { int total_deferred; int map_count; bus_size_t alignment; - bus_size_t boundary; bus_addr_t lowaddr; char zoneid[8]; char lowaddrid[20]; @@ -689,10 +688,10 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm vendaddr = (vm_offset_t)buf + buflen; while (vaddr < vendaddr) { - if (pmap != NULL) - paddr = pmap_extract(pmap, vaddr); - else + if (__predict_true(pmap == pmap_kernel())) paddr = pmap_kextract(vaddr); + else + paddr = pmap_extract(pmap, vaddr); if (((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) && run_filter(dmat, paddr) != 0) map->pagesneeded++; @@ -1267,7 +1266,6 @@ alloc_bounce_zone(bus_dma_tag_t dmat) /* Check to see if we already have a suitable zone */ STAILQ_FOREACH(bz, &bounce_zone_list, links) { if ((dmat->alignment <= bz->alignment) - && (dmat->boundary <= bz->boundary) && (dmat->lowaddr >= bz->lowaddr)) { dmat->bounce_zone = bz; return (0); @@ -1283,8 +1281,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat) bz->reserved_bpages = 0; bz->active_bpages = 0; bz->lowaddr = dmat->lowaddr; - bz->alignment = dmat->alignment; - bz->boundary = dmat->boundary; + bz->alignment = MAX(dmat->alignment, PAGE_SIZE); bz->map_count = 0; snprintf(bz->zoneid, 8, "zone%d", busdma_zonecount); busdma_zonecount++; @@ -1331,9 +1328,6 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_INT(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), - SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "boundary", CTLFLAG_RD, &bz->boundary, 0, ""); return (0); } @@ -1358,7 +1352,7 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u M_NOWAIT, 0ul, bz->lowaddr, PAGE_SIZE, - bz->boundary); + 0); if (bpage->vaddr == 0) { free(bpage, M_DEVBUF); break; Modified: head/sys/i386/i386/busdma_machdep.c ============================================================================== --- head/sys/i386/i386/busdma_machdep.c Thu Apr 23 19:29:45 2009 (r191437) +++ head/sys/i386/i386/busdma_machdep.c Thu Apr 23 20:24:19 2009 (r191438) @@ -100,7 +100,6 @@ struct bounce_zone { int total_deferred; int map_count; bus_size_t alignment; - bus_size_t boundary; bus_addr_t lowaddr; char zoneid[8]; char lowaddrid[20]; @@ -996,7 +995,6 @@ alloc_bounce_zone(bus_dma_tag_t dmat) /* Check to see if we already have a suitable zone */ STAILQ_FOREACH(bz, &bounce_zone_list, links) { if ((dmat->alignment <= bz->alignment) - && (dmat->boundary <= bz->boundary) && (dmat->lowaddr >= bz->lowaddr)) { dmat->bounce_zone = bz; return (0); @@ -1012,8 +1010,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat) bz->reserved_bpages = 0; bz->active_bpages = 0; bz->lowaddr = dmat->lowaddr; - bz->alignment = dmat->alignment; - bz->boundary = dmat->boundary; + bz->alignment = MAX(dmat->alignment, PAGE_SIZE); bz->map_count = 0; snprintf(bz->zoneid, 8, "zone%d", busdma_zonecount); busdma_zonecount++; @@ -1060,9 +1057,6 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_INT(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), - SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "boundary", CTLFLAG_RD, &bz->boundary, 0, ""); return (0); } @@ -1087,7 +1081,7 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u M_NOWAIT, 0ul, bz->lowaddr, PAGE_SIZE, - bz->boundary); + 0); if (bpage->vaddr == 0) { free(bpage, M_DEVBUF); break; From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 21:09:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82CF8106566C; Thu, 23 Apr 2009 21:09:47 +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 575C68FC16; Thu, 23 Apr 2009 21:09:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NL9lLx099405; Thu, 23 Apr 2009 21:09:47 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NL9lQ8099404; Thu, 23 Apr 2009 21:09:47 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200904232109.n3NL9lQ8099404@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 23 Apr 2009 21:09: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: r191439 - 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: Thu, 23 Apr 2009 21:09:48 -0000 Author: kib Date: Thu Apr 23 21:09:47 2009 New Revision: 191439 URL: http://svn.freebsd.org/changeset/base/191439 Log: Do not call vm_page_lookup() from the ddb routine, namely from "show vmopag" implementation. The vm_page_lookup() code modifies splay tree of the object pages, and asserts that object lock is taken. First issue could cause kernel data corruption, and second one instantly panics the INVARIANTS-enabled kernel. Take the advantage of the fact that object->memq is ordered by page index, and iterate over memq to calculate the runs. While there, make the code slightly more style-compliant by moving variables declarations to the right place. Discussed with: jhb, alc Reviewed by: alc MFC after: 2 weeks Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Thu Apr 23 20:24:19 2009 (r191438) +++ head/sys/vm/vm_object.c Thu Apr 23 21:09:47 2009 (r191439) @@ -2196,16 +2196,13 @@ vm_object_print( DB_SHOW_COMMAND(vmopag, vm_object_print_pages) { vm_object_t object; - int nl = 0; - int c; + vm_pindex_t fidx; + vm_paddr_t pa; + vm_page_t m, prev_m; + int rcount, nl, c; + nl = 0; TAILQ_FOREACH(object, &vm_object_list, object_list) { - vm_pindex_t idx, fidx; - vm_pindex_t osize; - vm_paddr_t pa = -1; - int rcount; - vm_page_t m; - db_printf("new object: %p\n", (void *)object); if (nl > 18) { c = cngetc(); @@ -2216,12 +2213,12 @@ DB_SHOW_COMMAND(vmopag, vm_object_print_ nl++; rcount = 0; fidx = 0; - osize = object->size; - if (osize > 128) - osize = 128; - for (idx = 0; idx < osize; idx++) { - m = vm_page_lookup(object, idx); - if (m == NULL) { + pa = -1; + TAILQ_FOREACH(m, &object->memq, listq) { + if (m->pindex > 128) + break; + if ((prev_m = TAILQ_PREV(m, pglist, listq)) != NULL && + prev_m->pindex + 1 != m->pindex) { if (rcount) { db_printf(" index(%ld)run(%d)pa(0x%lx)\n", (long)fidx, rcount, (long)pa); @@ -2234,10 +2231,7 @@ DB_SHOW_COMMAND(vmopag, vm_object_print_ nl++; rcount = 0; } - continue; - } - - + } if (rcount && (VM_PAGE_TO_PHYS(m) == pa + rcount * PAGE_SIZE)) { ++rcount; @@ -2254,7 +2248,7 @@ DB_SHOW_COMMAND(vmopag, vm_object_print_ } nl++; } - fidx = idx; + fidx = m->pindex; pa = VM_PAGE_TO_PHYS(m); rcount = 1; } From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 21:19:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 883B3106564A; Thu, 23 Apr 2009 21:19:35 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7741A8FC15; Thu, 23 Apr 2009 21:19:35 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NLJZ3s099624; Thu, 23 Apr 2009 21:19:35 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NLJZd0099623; Thu, 23 Apr 2009 21:19:35 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904232119.n3NLJZd0099623@svn.freebsd.org> From: Kip Macy Date: Thu, 23 Apr 2009 21:19: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: r191440 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 23 Apr 2009 21:19:35 -0000 Author: kmacy Date: Thu Apr 23 21:19:35 2009 New Revision: 191440 URL: http://svn.freebsd.org/changeset/base/191440 Log: Make sure the ALTQ case is handle correctly by using drbr_dequeue Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Apr 23 21:09:47 2009 (r191439) +++ head/sys/dev/e1000/if_em.c Thu Apr 23 21:19:35 2009 (r191440) @@ -1076,7 +1076,7 @@ em_start_locked(struct ifnet *ifp) while ((adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD) && (!ADAPTER_RING_EMPTY(adapter))) { - m_head = buf_ring_dequeue_sc(adapter->br); + m_head = drbr_dequeue(adapter->br); if (m_head == NULL) break; /* From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 21:23:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95CB2106566B; Thu, 23 Apr 2009 21:23:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84C648FC0A; Thu, 23 Apr 2009 21:23:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NLNJT0099744; Thu, 23 Apr 2009 21:23:19 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NLNJ1P099743; Thu, 23 Apr 2009 21:23:19 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904232123.n3NLNJ1P099743@svn.freebsd.org> From: Kip Macy Date: Thu, 23 Apr 2009 21:23: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: r191441 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 23 Apr 2009 21:23:20 -0000 Author: kmacy Date: Thu Apr 23 21:23:19 2009 New Revision: 191441 URL: http://svn.freebsd.org/changeset/base/191441 Log: fix panic when using msix Pointed out by Nate Whitehorn Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Apr 23 21:19:35 2009 (r191440) +++ head/sys/dev/e1000/if_em.c Thu Apr 23 21:23:19 2009 (r191441) @@ -2986,6 +2986,11 @@ em_allocate_msix(struct adapter *adapter */ TASK_INIT(&adapter->rx_task, 0, em_handle_rx, adapter); TASK_INIT(&adapter->tx_task, 0, em_handle_tx, adapter); + /* + * Handle compatibility for msi case for deferral due to + * trylock failure + */ + TASK_INIT(&adapter->rxtx_task, 0, em_handle_tx, adapter); TASK_INIT(&adapter->link_task, 0, em_handle_link, adapter); adapter->tq = taskqueue_create_fast("em_taskq", M_NOWAIT, taskqueue_thread_enqueue, &adapter->tq); From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 21:27:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 985F6106568E; Thu, 23 Apr 2009 21:27:06 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8711F8FC1B; Thu, 23 Apr 2009 21:27:06 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NLR6ka099845; Thu, 23 Apr 2009 21:27:06 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NLR6Mw099844; Thu, 23 Apr 2009 21:27:06 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904232127.n3NLR6Mw099844@svn.freebsd.org> From: Kip Macy Date: Thu, 23 Apr 2009 21:27: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: r191442 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 23 Apr 2009 21:27:07 -0000 Author: kmacy Date: Thu Apr 23 21:27:06 2009 New Revision: 191442 URL: http://svn.freebsd.org/changeset/base/191442 Log: fix typo Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Apr 23 21:23:19 2009 (r191441) +++ head/sys/dev/e1000/if_em.c Thu Apr 23 21:27:06 2009 (r191442) @@ -1076,7 +1076,7 @@ em_start_locked(struct ifnet *ifp) while ((adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD) && (!ADAPTER_RING_EMPTY(adapter))) { - m_head = drbr_dequeue(adapter->br); + m_head = drbr_dequeue(ifp, adapter->br); if (m_head == NULL) break; /* From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 21:41:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65A94106567A; Thu, 23 Apr 2009 21:41:37 +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 536288FC22; Thu, 23 Apr 2009 21:41:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NLfbGT000247; Thu, 23 Apr 2009 21:41:37 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NLfbLv000246; Thu, 23 Apr 2009 21:41:37 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904232141.n3NLfbLv000246@svn.freebsd.org> From: Robert Watson Date: Thu, 23 Apr 2009 21:41: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: r191443 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Apr 2009 21:41:38 -0000 Author: rwatson Date: Thu Apr 23 21:41:37 2009 New Revision: 191443 URL: http://svn.freebsd.org/changeset/base/191443 Log: Reorganize in_control() so that invariants are more obvious, and so that it is easier to lock: - Handle the unsupported ioctl case at the beginning of in_control(), handing off to ifp->if_ioctl, rather than looking up interfaces and addresses unnecessarily in this case. - Make it an invariant that ifp is always non-NULL when running in_control()-implemented ioctls, simplifying the code structure. MFC after: 3 weeks Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Thu Apr 23 21:27:06 2009 (r191442) +++ head/sys/netinet/in.c Thu Apr 23 21:41:37 2009 (r191443) @@ -202,7 +202,8 @@ in_len2mask(struct in_addr *mask, int le /* * Generic internet control operations (ioctl's). - * Ifp is 0 if not an interface-specific ioctl. + * + * ifp is NULL if not an interface-specific ioctl. */ /* ARGSUSED */ int @@ -227,7 +228,23 @@ in_control(struct socket *so, u_long cmd iaIsNew = 0; allhosts_addr.s_addr = htonl(INADDR_ALLHOSTS_GROUP); + /* + * Filter out ioctls we implement directly; forward the rest on to + * in_lifaddr_ioctl() and ifp->if_ioctl(). + */ switch (cmd) { + case SIOCAIFADDR: + case SIOCDIFADDR: + case SIOCGIFADDR: + case SIOCGIFBRDADDR: + case SIOCGIFDSTADDR: + case SIOCGIFNETMASK: + case SIOCSIFADDR: + case SIOCSIFBRDADDR: + case SIOCSIFDSTADDR: + case SIOCSIFNETMASK: + break; + case SIOCALIFADDR: if (td != NULL) { error = priv_check(td, PRIV_NET_ADDIFADDR); @@ -252,46 +269,51 @@ in_control(struct socket *so, u_long cmd if (ifp == NULL) return (EINVAL); return in_lifaddr_ioctl(so, cmd, data, ifp, td); + + default: + if (ifp == NULL || ifp->if_ioctl == NULL) + return (EOPNOTSUPP); + return ((*ifp->if_ioctl)(ifp, cmd, data)); } + if (ifp == NULL) + return (EADDRNOTAVAIL); + /* * Find address for this interface, if it exists. * - * If an alias address was specified, find that one instead of - * the first one on the interface, if possible. + * If an alias address was specified, find that one instead of the + * first one on the interface, if possible. */ - if (ifp != NULL) { - dst = ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr; - LIST_FOREACH(iap, INADDR_HASH(dst.s_addr), ia_hash) - if (iap->ia_ifp == ifp && - iap->ia_addr.sin_addr.s_addr == dst.s_addr) { - if (td == NULL || prison_check_ip4( - td->td_ucred, &dst) == 0) - ia = iap; + dst = ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr; + LIST_FOREACH(iap, INADDR_HASH(dst.s_addr), ia_hash) { + if (iap->ia_ifp == ifp && + iap->ia_addr.sin_addr.s_addr == dst.s_addr) { + if (td == NULL || prison_check_ip4(td->td_ucred, + &dst) == 0) + ia = iap; + break; + } + } + if (ia == NULL) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + iap = ifatoia(ifa); + if (iap->ia_addr.sin_family == AF_INET) { + if (td != NULL && + prison_check_ip4(td->td_ucred, + &iap->ia_addr.sin_addr) != 0) + continue; + ia = iap; break; } - if (ia == NULL) - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - iap = ifatoia(ifa); - if (iap->ia_addr.sin_family == AF_INET) { - if (td != NULL && - prison_check_ip4(td->td_ucred, - &iap->ia_addr.sin_addr) != 0) - continue; - ia = iap; - break; - } - } - if (ia == NULL) - iaIsFirst = 1; + } } + if (ia == NULL) + iaIsFirst = 1; switch (cmd) { - case SIOCAIFADDR: case SIOCDIFADDR: - if (ifp == NULL) - return (EADDRNOTAVAIL); if (ifra->ifra_addr.sin_family == AF_INET) { for (oia = ia; ia; ia = TAILQ_NEXT(ia, ia_link)) { if (ia->ia_ifp == ifp && @@ -319,8 +341,6 @@ in_control(struct socket *so, u_long cmd return (error); } - if (ifp == NULL) - return (EADDRNOTAVAIL); if (ia == NULL) { ia = (struct in_ifaddr *) malloc(sizeof *ia, M_IFADDR, M_WAITOK | M_ZERO); @@ -505,9 +525,7 @@ in_control(struct socket *so, u_long cmd break; default: - if (ifp == NULL || ifp->if_ioctl == NULL) - return (EOPNOTSUPP); - return ((*ifp->if_ioctl)(ifp, cmd, data)); + panic("in_control: unsupported ioctl"); } /* From owner-svn-src-head@FreeBSD.ORG Thu Apr 23 22:08:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFB031065672; Thu, 23 Apr 2009 22:08:44 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE8E08FC08; Thu, 23 Apr 2009 22:08:44 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3NM8ibm000802; Thu, 23 Apr 2009 22:08:44 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3NM8iWF000801; Thu, 23 Apr 2009 22:08:44 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200904232208.n3NM8iWF000801@svn.freebsd.org> From: Rui Paulo Date: Thu, 23 Apr 2009 22:08: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: r191444 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Apr 2009 22:08:45 -0000 Author: rpaulo Date: Thu Apr 23 22:08:44 2009 New Revision: 191444 URL: http://svn.freebsd.org/changeset/base/191444 Log: Remove spurious 'or'. Modified: head/sys/net80211/ieee80211_sta.c Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Thu Apr 23 21:41:37 2009 (r191443) +++ head/sys/net80211/ieee80211_sta.c Thu Apr 23 22:08:44 2009 (r191444) @@ -1148,7 +1148,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, * We process beacon/probe response frames: * o when scanning, or * o station mode when associated (to collect state - * updates such as 802.11g slot time), or + * updates such as 802.11g slot time) * Frames otherwise received are discarded. */ if (!((ic->ic_flags & IEEE80211_F_SCAN) || ni->ni_associd)) { From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 02:53:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A62721065673; Fri, 24 Apr 2009 02:53:38 +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 897CE8FC23; Fri, 24 Apr 2009 02:53:38 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3O2rcOc006027; Fri, 24 Apr 2009 02:53:38 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3O2rcbo006026; Fri, 24 Apr 2009 02:53:38 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200904240253.n3O2rcbo006026@svn.freebsd.org> From: Marcel Moolenaar Date: Fri, 24 Apr 2009 02:53: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: r191445 - head/sys/powerpc/booke X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 24 Apr 2009 02:53:39 -0000 Author: marcel Date: Fri Apr 24 02:53:38 2009 New Revision: 191445 URL: http://svn.freebsd.org/changeset/base/191445 Log: Remove PTE_ISFAKE. While here remove code between "#if 0" and "#endif". Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Thu Apr 23 22:08:44 2009 (r191444) +++ head/sys/powerpc/booke/pmap.c Fri Apr 24 02:53:38 2009 (r191445) @@ -757,27 +757,21 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_of if (pte == NULL || !PTE_ISVALID(pte)) return (0); - /* Get vm_page_t for mapped pte. */ - m = PHYS_TO_VM_PAGE(PTE_PA(pte)); - if (PTE_ISWIRED(pte)) pmap->pm_stats.wired_count--; - if (!PTE_ISFAKE(pte)) { - /* Handle managed entry. */ - if (PTE_ISMANAGED(pte)) { + /* Handle managed entry. */ + if (PTE_ISMANAGED(pte)) { + /* Get vm_page_t for mapped pte. */ + m = PHYS_TO_VM_PAGE(PTE_PA(pte)); - /* Handle modified pages. */ - if (PTE_ISMODIFIED(pte)) - vm_page_dirty(m); + if (PTE_ISMODIFIED(pte)) + vm_page_dirty(m); - /* Referenced pages. */ - if (PTE_ISREFERENCED(pte)) - vm_page_flag_set(m, PG_REFERENCED); + if (PTE_ISREFERENCED(pte)) + vm_page_flag_set(m, PG_REFERENCED); - /* Remove pv_entry from pv_list. */ - pv_remove(pmap, va, m); - } + pv_remove(pmap, va, m); } mtx_lock_spin(&tlbivax_mutex); @@ -847,8 +841,6 @@ pte_enter(mmu_t mmu, pmap_t pmap, vm_pag /* Create and insert pv entry. */ pv_insert(pmap, va, m); } - } else { - flags |= PTE_FAKE; } pmap->pm_stats.resident_count++; @@ -1297,23 +1289,7 @@ mmu_booke_kenter(mmu_t mmu, vm_offset_t KASSERT(((va >= VM_MIN_KERNEL_ADDRESS) && (va <= VM_MAX_KERNEL_ADDRESS)), ("mmu_booke_kenter: invalid va")); -#if 0 - /* assume IO mapping, set I, G bits */ - flags = (PTE_G | PTE_I | PTE_FAKE); - - /* if mapping is within system memory, do not set I, G bits */ - for (i = 0; i < totalmem_regions_sz; i++) { - if ((pa >= totalmem_regions[i].mr_start) && - (pa < (totalmem_regions[i].mr_start + - totalmem_regions[i].mr_size))) { - flags &= ~(PTE_I | PTE_G | PTE_FAKE); - break; - } - } -#else flags = 0; -#endif - flags |= (PTE_SR | PTE_SW | PTE_SX | PTE_WIRED | PTE_VALID); flags |= PTE_M; @@ -1431,14 +1407,6 @@ mmu_booke_release(mmu_t mmu, pmap_t pmap PMAP_LOCK_DESTROY(pmap); } -#if 0 -/* Not needed, kernel page tables are statically allocated. */ -void -mmu_booke_growkernel(vm_offset_t maxkvaddr) -{ -} -#endif - /* * Insert the given physical page at the specified virtual address in the * target physical map with the protection requested. If specified the page @@ -2031,18 +1999,6 @@ mmu_booke_copy_page(mmu_t mmu, vm_page_t mtx_unlock(©_page_mutex); } -#if 0 -/* - * Remove all pages from specified address space, this aids process exit - * speeds. This is much faster than mmu_booke_remove in the case of running - * down an entire address space. Only works for the current pmap. - */ -void -mmu_booke_remove_pages(pmap_t pmap) -{ -} -#endif - /* * mmu_booke_zero_page_idle zeros the specified hardware page by mapping it * into virtual memory and using bzero to clear its contents. This is intended From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 02:55:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C3B91065670; Fri, 24 Apr 2009 02:55:21 +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 0A5588FC1B; Fri, 24 Apr 2009 02:55:21 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3O2tKmD006111; Fri, 24 Apr 2009 02:55:20 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3O2tKE5006110; Fri, 24 Apr 2009 02:55:20 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200904240255.n3O2tKE5006110@svn.freebsd.org> From: Marcel Moolenaar Date: Fri, 24 Apr 2009 02:55: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: r191446 - head/sys/powerpc/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Apr 2009 02:55:21 -0000 Author: marcel Date: Fri Apr 24 02:55:20 2009 New Revision: 191446 URL: http://svn.freebsd.org/changeset/base/191446 Log: Remove PTE_FAKE and PTE_ISFAKE(). Modified: head/sys/powerpc/include/pte.h Modified: head/sys/powerpc/include/pte.h ============================================================================== --- head/sys/powerpc/include/pte.h Fri Apr 24 02:53:38 2009 (r191445) +++ head/sys/powerpc/include/pte.h Fri Apr 24 02:55:20 2009 (r191446) @@ -243,7 +243,6 @@ typedef struct pte pte_t; #define PTE_MODIFIED 0x40000000 /* Modified */ #define PTE_WIRED 0x20000000 /* Wired */ #define PTE_MANAGED 0x10000000 /* Managed */ -#define PTE_FAKE 0x08000000 /* Ficticious */ #define PTE_REFERENCED 0x04000000 /* Referenced */ /* Macro argument must of pte_t type. */ @@ -251,7 +250,6 @@ typedef struct pte pte_t; #define PTE_ISVALID(pte) ((pte)->flags & PTE_VALID) #define PTE_ISWIRED(pte) ((pte)->flags & PTE_WIRED) #define PTE_ISMANAGED(pte) ((pte)->flags & PTE_MANAGED) -#define PTE_ISFAKE(pte) ((pte)->flags & PTE_FAKE) #define PTE_ISMODIFIED(pte) ((pte)->flags & PTE_MODIFIED) #define PTE_ISREFERENCED(pte) ((pte)->flags & PTE_REFERENCED) From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 03:06:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9329C1065672; Fri, 24 Apr 2009 03:06:32 +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 803448FC15; Fri, 24 Apr 2009 03:06:32 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3O36W6X006468; Fri, 24 Apr 2009 03:06:32 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3O36WRk006467; Fri, 24 Apr 2009 03:06:32 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200904240306.n3O36WRk006467@svn.freebsd.org> From: Marcel Moolenaar Date: Fri, 24 Apr 2009 03:06: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: r191447 - head/sys/powerpc/powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 24 Apr 2009 03:06:33 -0000 Author: marcel Date: Fri Apr 24 03:06:32 2009 New Revision: 191447 URL: http://svn.freebsd.org/changeset/base/191447 Log: Reimplement bs_be_rs_{1|2|4} and bs_le_rs_{1|2|4} by not calling the inline functions in and do not add synchronization. Implement bs_gen_barrier() as eieio and sync. Modified: head/sys/powerpc/powerpc/bus_machdep.c Modified: head/sys/powerpc/powerpc/bus_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/bus_machdep.c Fri Apr 24 02:55:20 2009 (r191446) +++ head/sys/powerpc/powerpc/bus_machdep.c Fri Apr 24 03:06:32 2009 (r191447) @@ -39,9 +39,13 @@ #include __FBSDID("$FreeBSD$"); +#define KTR_BE_IO 0 +#define KTR_LE_IO 0 + #include #include #include +#include #include #include @@ -141,7 +145,7 @@ static void bs_gen_barrier(bus_space_handle_t bsh __unused, bus_size_t ofs __unused, bus_size_t size __unused, int flags __unused) { - __asm __volatile("" : : : "memory"); + __asm __volatile("eieio; sync" : : : "memory"); } /* @@ -150,19 +154,37 @@ bs_gen_barrier(bus_space_handle_t bsh __ static uint8_t bs_be_rs_1(bus_space_handle_t bsh, bus_size_t ofs) { - return (in8(__ppc_ba(bsh, ofs))); + volatile uint8_t *addr; + uint8_t res; + + addr = __ppc_ba(bsh, ofs); + res = *addr; + CTR4(KTR_BE_IO, "%s(bsh=%#x, ofs=%#x) = %#x", __func__, bsh, ofs, res); + return (res); } static uint16_t bs_be_rs_2(bus_space_handle_t bsh, bus_size_t ofs) { - return (in16(__ppc_ba(bsh, ofs))); + volatile uint16_t *addr; + uint16_t res; + + addr = __ppc_ba(bsh, ofs); + res = *addr; + CTR4(KTR_BE_IO, "%s(bsh=%#x, ofs=%#x) = %#x", __func__, bsh, ofs, res); + return (res); } static uint32_t bs_be_rs_4(bus_space_handle_t bsh, bus_size_t ofs) { - return (in32(__ppc_ba(bsh, ofs))); + volatile uint32_t *addr; + uint32_t res; + + addr = __ppc_ba(bsh, ofs); + res = *addr; + CTR4(KTR_BE_IO, "%s(bsh=%#x, ofs=%#x) = %#x", __func__, bsh, ofs, res); + return (res); } static uint64_t @@ -234,19 +256,31 @@ bs_be_rr_8(bus_space_handle_t bsh, bus_s static void bs_be_ws_1(bus_space_handle_t bsh, bus_size_t ofs, uint8_t val) { - out8(__ppc_ba(bsh, ofs), val); + volatile uint8_t *addr; + + addr = __ppc_ba(bsh, ofs); + *addr = val; + CTR4(KTR_BE_IO, "%s(bsh=%#x, ofs=%#x, val=%#x)", __func__, bsh, ofs, val); } static void bs_be_ws_2(bus_space_handle_t bsh, bus_size_t ofs, uint16_t val) { - out16(__ppc_ba(bsh, ofs), val); + volatile uint16_t *addr; + + addr = __ppc_ba(bsh, ofs); + *addr = val; + CTR4(KTR_BE_IO, "%s(bsh=%#x, ofs=%#x, val=%#x)", __func__, bsh, ofs, val); } static void bs_be_ws_4(bus_space_handle_t bsh, bus_size_t ofs, uint32_t val) { - out32(__ppc_ba(bsh, ofs), val); + volatile uint32_t *addr; + + addr = __ppc_ba(bsh, ofs); + *addr = val; + CTR4(KTR_BE_IO, "%s(bsh=%#x, ofs=%#x, val=%#x)", __func__, bsh, ofs, val); } static void @@ -401,19 +435,37 @@ bs_be_sr_8(bus_space_handle_t bsh, bus_s static uint8_t bs_le_rs_1(bus_space_handle_t bsh, bus_size_t ofs) { - return (in8(__ppc_ba(bsh, ofs))); + volatile uint8_t *addr; + uint8_t res; + + addr = __ppc_ba(bsh, ofs); + res = *addr; + CTR4(KTR_LE_IO, "%s(bsh=%#x, ofs=%#x) = %#x", __func__, bsh, ofs, res); + return (res); } static uint16_t bs_le_rs_2(bus_space_handle_t bsh, bus_size_t ofs) { - return (in16rb(__ppc_ba(bsh, ofs))); + volatile uint16_t *addr; + uint16_t res; + + addr = __ppc_ba(bsh, ofs); + __asm __volatile("lhbrx %0, 0, %1" : "=r"(res) : "r"(addr)); + CTR4(KTR_LE_IO, "%s(bsh=%#x, ofs=%#x) = %#x", __func__, bsh, ofs, res); + return (res); } static uint32_t bs_le_rs_4(bus_space_handle_t bsh, bus_size_t ofs) { - return (in32rb(__ppc_ba(bsh, ofs))); + volatile uint32_t *addr; + uint32_t res; + + addr = __ppc_ba(bsh, ofs); + __asm __volatile("lwbrx %0, 0, %1" : "=r"(res) : "r"(addr)); + CTR4(KTR_LE_IO, "%s(bsh=%#x, ofs=%#x) = %#x", __func__, bsh, ofs, res); + return (res); } static uint64_t @@ -485,19 +537,31 @@ bs_le_rr_8(bus_space_handle_t bsh, bus_s static void bs_le_ws_1(bus_space_handle_t bsh, bus_size_t ofs, uint8_t val) { - out8(__ppc_ba(bsh, ofs), val); + volatile uint8_t *addr; + + addr = __ppc_ba(bsh, ofs); + *addr = val; + CTR4(KTR_LE_IO, "%s(bsh=%#x, ofs=%#x, val=%#x)", __func__, bsh, ofs, val); } static void bs_le_ws_2(bus_space_handle_t bsh, bus_size_t ofs, uint16_t val) { - out16rb(__ppc_ba(bsh, ofs), val); + volatile uint16_t *addr; + + addr = __ppc_ba(bsh, ofs); + __asm __volatile("sthbrx %0, 0, %1" :: "r"(val), "r"(addr)); + CTR4(KTR_LE_IO, "%s(bsh=%#x, ofs=%#x, val=%#x)", __func__, bsh, ofs, val); } static void bs_le_ws_4(bus_space_handle_t bsh, bus_size_t ofs, uint32_t val) { - out32rb(__ppc_ba(bsh, ofs), val); + volatile uint32_t *addr; + + addr = __ppc_ba(bsh, ofs); + __asm __volatile("stwbrx %0, 0, %1" :: "r"(val), "r"(addr)); + CTR4(KTR_LE_IO, "%s(bsh=%#x, ofs=%#x, val=%#x)", __func__, bsh, ofs, val); } static void From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 03:43:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06519106566B; Fri, 24 Apr 2009 03:43:21 +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 E8A228FC0A; Fri, 24 Apr 2009 03:43:20 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3O3hKwx007334; Fri, 24 Apr 2009 03:43:20 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3O3hKne007333; Fri, 24 Apr 2009 03:43:20 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200904240343.n3O3hKne007333@svn.freebsd.org> From: Marcel Moolenaar Date: Fri, 24 Apr 2009 03:43: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: r191449 - head/sys/ia64/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 24 Apr 2009 03:43:21 -0000 Author: marcel Date: Fri Apr 24 03:43:20 2009 New Revision: 191449 URL: http://svn.freebsd.org/changeset/base/191449 Log: Remove isa_irq_pending(). It's not used. Modified: head/sys/ia64/isa/isa.c Modified: head/sys/ia64/isa/isa.c ============================================================================== --- head/sys/ia64/isa/isa.c Fri Apr 24 03:38:51 2009 (r191448) +++ head/sys/ia64/isa/isa.c Fri Apr 24 03:43:20 2009 (r191449) @@ -73,17 +73,6 @@ isa_init(device_t dev) { } -intrmask_t -isa_irq_pending(void) -{ - u_char irr1; - u_char irr2; - - irr1 = inb(IO_ICU1); - irr2 = inb(IO_ICU2); - return ((irr2 << 8) | irr1); -} - /* * This implementation simply passes the request up to the parent * bus, which in our case is the special i386 nexus, substituting any From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 03:51:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58657106566B; Fri, 24 Apr 2009 03:51: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 43D9F8FC15; Fri, 24 Apr 2009 03:51:12 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3O3pCIG007568; Fri, 24 Apr 2009 03:51:12 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3O3pBgs007559; Fri, 24 Apr 2009 03:51:11 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200904240351.n3O3pBgs007559@svn.freebsd.org> From: Marcel Moolenaar Date: Fri, 24 Apr 2009 03:51: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: r191450 - in head/sys: conf powerpc/conf powerpc/include powerpc/mpc85xx powerpc/powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 24 Apr 2009 03:51:12 -0000 Author: marcel Date: Fri Apr 24 03:51:11 2009 New Revision: 191450 URL: http://svn.freebsd.org/changeset/base/191450 Log: Add suppport for ISA and ISA interrupts to make the ATA controller in the VIA southbridge functional in the CDS (Configurable Development System) for MPC85XX. The embedded USB controllers look operational but the interrupt steering is still wrong. Added: head/sys/powerpc/mpc85xx/atpic.c (contents, props changed) head/sys/powerpc/mpc85xx/isa.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/conf/MPC85XX head/sys/powerpc/include/intr_machdep.h head/sys/powerpc/mpc85xx/ocpbus.c head/sys/powerpc/mpc85xx/pci_ocp.c head/sys/powerpc/powerpc/autoconf.c head/sys/powerpc/powerpc/intr_machdep.c Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Fri Apr 24 03:43:20 2009 (r191449) +++ head/sys/conf/files.powerpc Fri Apr 24 03:51:11 2009 (r191450) @@ -103,6 +103,8 @@ powerpc/fpu/fpu_implode.c optional fpu_e powerpc/fpu/fpu_mul.c optional fpu_emu powerpc/fpu/fpu_sqrt.c optional fpu_emu powerpc/fpu/fpu_subr.c optional fpu_emu +powerpc/mpc85xx/atpic.c optional mpc85xx isa +powerpc/mpc85xx/isa.c optional mpc85xx isa powerpc/mpc85xx/lbc.c optional mpc85xx powerpc/mpc85xx/mpc85xx.c optional mpc85xx powerpc/mpc85xx/nexus.c optional mpc85xx Modified: head/sys/powerpc/conf/MPC85XX ============================================================================== --- head/sys/powerpc/conf/MPC85XX Fri Apr 24 03:43:20 2009 (r191449) +++ head/sys/powerpc/conf/MPC85XX Fri Apr 24 03:51:11 2009 (r191450) @@ -57,6 +57,7 @@ device da device em device ether device fxp +device isa device loop device md device miibus Modified: head/sys/powerpc/include/intr_machdep.h ============================================================================== --- head/sys/powerpc/include/intr_machdep.h Fri Apr 24 03:43:20 2009 (r191449) +++ head/sys/powerpc/include/intr_machdep.h Fri Apr 24 03:51:11 2009 (r191450) @@ -31,12 +31,14 @@ #define INTR_VECTORS 256 extern device_t pic; +extern device_t pic8259; struct trapframe; driver_filter_t powerpc_ipi_handler; void powerpc_register_pic(device_t, u_int); +void powerpc_register_8259(device_t); void powerpc_dispatch_intr(u_int, struct trapframe *); int powerpc_enable_intr(void); Added: head/sys/powerpc/mpc85xx/atpic.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/mpc85xx/atpic.c Fri Apr 24 03:51:11 2009 (r191450) @@ -0,0 +1,330 @@ +/*- + * Copyright (c) 2009 Marcel Moolenaar + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include "pic_if.h" + +#define ATPIC_MASTER 0 +#define ATPIC_SLAVE 1 + +struct atpic_softc { + device_t sc_dev; + + /* I/O port resources for master & slave. */ + struct resource *sc_res[2]; + int sc_rid[2]; + + /* Our "routing" interrupt */ + struct resource *sc_ires; + void *sc_icookie; + int sc_irid; + + int sc_vector[16]; + uint8_t sc_mask[2]; +}; + +static int atpic_isa_attach(device_t); +static void atpic_isa_identify(driver_t *, device_t); +static int atpic_isa_probe(device_t); + +static void atpic_config(device_t, u_int, enum intr_trigger, + enum intr_polarity); +static void atpic_dispatch(device_t, struct trapframe *); +static void atpic_enable(device_t, u_int, u_int); +static void atpic_eoi(device_t, u_int); +static void atpic_ipi(device_t, u_int); +static void atpic_mask(device_t, u_int); +static void atpic_unmask(device_t, u_int); + +static device_method_t atpic_isa_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, atpic_isa_identify), + DEVMETHOD(device_probe, atpic_isa_probe), + DEVMETHOD(device_attach, atpic_isa_attach), + + /* PIC interface */ + DEVMETHOD(pic_config, atpic_config), + DEVMETHOD(pic_dispatch, atpic_dispatch), + DEVMETHOD(pic_enable, atpic_enable), + DEVMETHOD(pic_eoi, atpic_eoi), + DEVMETHOD(pic_ipi, atpic_ipi), + DEVMETHOD(pic_mask, atpic_mask), + DEVMETHOD(pic_unmask, atpic_unmask), + + { 0, 0 }, +}; + +static driver_t atpic_isa_driver = { + "atpic", + atpic_isa_methods, + sizeof(struct atpic_softc) +}; + +static devclass_t atpic_devclass; + +DRIVER_MODULE(atpic, isa, atpic_isa_driver, atpic_devclass, 0, 0); + +static struct isa_pnp_id atpic_ids[] = { + { 0x0000d041 /* PNP0000 */, "AT interrupt controller" }, + { 0 } +}; + +static __inline uint8_t +atpic_read(struct atpic_softc *sc, int icu, int ofs) +{ + uint8_t val; + + val = bus_read_1(sc->sc_res[icu], ofs); + return (val); +} + +static __inline void +atpic_write(struct atpic_softc *sc, int icu, int ofs, uint8_t val) +{ + + bus_write_1(sc->sc_res[icu], ofs, val); + bus_barrier(sc->sc_res[icu], ofs, 2 - ofs, + BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE); +} + +static void +atpic_intr(void *arg) +{ + + atpic_dispatch(pic8259, arg); +} + +static void +atpic_isa_identify(driver_t *drv, device_t parent) +{ + device_t child; + + child = BUS_ADD_CHILD(parent, ISA_ORDER_SENSITIVE, drv->name, -1); + device_set_driver(child, drv); + isa_set_logicalid(child, atpic_ids[0].ip_id); + isa_set_vendorid(child, atpic_ids[0].ip_id); + + bus_set_resource(child, SYS_RES_IOPORT, ATPIC_MASTER, IO_ICU1, 2); + bus_set_resource(child, SYS_RES_IOPORT, ATPIC_SLAVE, IO_ICU2, 2); + + /* ISA interrupts are routed through external interrupt 0. */ + bus_set_resource(child, SYS_RES_IRQ, 0, PIC_IRQ_EXT(0), 1); +} + +static int +atpic_isa_probe(device_t dev) +{ + int res; + + res = ISA_PNP_PROBE(device_get_parent(dev), dev, atpic_ids); + if (res > 0) + return (res); + + device_set_desc(dev, "PC/AT compatible PIC"); + return (res); +} + +static void +atpic_init(struct atpic_softc *sc, int icu) +{ + + sc->sc_mask[icu] = 0xff - ((icu == ATPIC_MASTER) ? 4 : 0); + + atpic_write(sc, icu, 0, ICW1_RESET | ICW1_IC4); + atpic_write(sc, icu, 1, (icu == ATPIC_SLAVE) ? 8 : 0); + atpic_write(sc, icu, 1, (icu == ATPIC_SLAVE) ? 2 : 4); + atpic_write(sc, icu, 1, ICW4_8086); + atpic_write(sc, icu, 1, sc->sc_mask[icu]); + atpic_write(sc, icu, 0, OCW3_SEL | OCW3_RR); +} + +static int +atpic_isa_attach(device_t dev) +{ + struct atpic_softc *sc; + int error; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + error = ENXIO; + + sc->sc_rid[ATPIC_MASTER] = 0; + sc->sc_res[ATPIC_MASTER] = bus_alloc_resource_any(dev, SYS_RES_IOPORT, + &sc->sc_rid[ATPIC_MASTER], RF_ACTIVE); + if (sc->sc_res[ATPIC_MASTER] == NULL) + goto fail; + + sc->sc_rid[ATPIC_SLAVE] = 1; + sc->sc_res[ATPIC_SLAVE] = bus_alloc_resource_any(dev, SYS_RES_IOPORT, + &sc->sc_rid[ATPIC_SLAVE], RF_ACTIVE); + if (sc->sc_res[ATPIC_SLAVE] == NULL) + goto fail; + + sc->sc_irid = 0; + sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irid, + RF_ACTIVE); + if (sc->sc_ires == NULL) + goto fail; + + error = bus_setup_intr(dev, sc->sc_ires, INTR_TYPE_MISC | INTR_FAST, + NULL, atpic_intr, NULL, &sc->sc_icookie); + if (error) + goto fail; + + atpic_init(sc, ATPIC_SLAVE); + atpic_init(sc, ATPIC_MASTER); + + powerpc_register_8259(dev); + return (0); + + fail: + if (sc->sc_ires != NULL) + bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irid, + sc->sc_ires); + if (sc->sc_res[ATPIC_SLAVE] != NULL) + bus_release_resource(dev, SYS_RES_IOPORT, + sc->sc_rid[ATPIC_SLAVE], sc->sc_res[ATPIC_SLAVE]); + if (sc->sc_res[ATPIC_MASTER] != NULL) + bus_release_resource(dev, SYS_RES_IOPORT, + sc->sc_rid[ATPIC_MASTER], sc->sc_res[ATPIC_MASTER]); + return (error); +} + + +/* + * PIC interface. + */ + +static void +atpic_config(device_t dev, u_int irq, enum intr_trigger trig, + enum intr_polarity pol) +{ +} + +static void +atpic_dispatch(device_t dev, struct trapframe *tf) +{ + struct atpic_softc *sc; + uint8_t irq; + + sc = device_get_softc(dev); + atpic_write(sc, ATPIC_MASTER, 0, OCW3_SEL | OCW3_P); + irq = atpic_read(sc, ATPIC_MASTER, 0); + atpic_write(sc, ATPIC_MASTER, 0, OCW3_SEL | OCW3_RR); + if ((irq & 0x80) == 0) + return; + + if (irq == 0x82) { + atpic_write(sc, ATPIC_SLAVE, 0, OCW3_SEL | OCW3_P); + irq = atpic_read(sc, ATPIC_SLAVE, 0) + 8; + atpic_write(sc, ATPIC_SLAVE, 0, OCW3_SEL | OCW3_RR); + if ((irq & 0x80) == 0) + return; + } + + powerpc_dispatch_intr(sc->sc_vector[irq & 0x0f], tf); +} + +static void +atpic_enable(device_t dev, u_int irq, u_int vector) +{ + struct atpic_softc *sc; + + sc = device_get_softc(dev); + sc->sc_vector[irq] = vector; + atpic_unmask(dev, irq); +} + +static void +atpic_eoi(device_t dev, u_int irq) +{ + struct atpic_softc *sc; + + sc = device_get_softc(dev); + if (irq > 7) + atpic_write(sc, ATPIC_SLAVE, 0, OCW2_EOI); + atpic_write(sc, ATPIC_MASTER, 0, OCW2_EOI); +} + +static void +atpic_ipi(device_t dev, u_int cpu) +{ + /* No SMP support. */ +} + +static void +atpic_mask(device_t dev, u_int irq) +{ + struct atpic_softc *sc; + + sc = device_get_softc(dev); + if (irq > 7) { + sc->sc_mask[ATPIC_SLAVE] |= 1 << (irq - 8); + atpic_write(sc, ATPIC_SLAVE, 1, sc->sc_mask[ATPIC_SLAVE]); + atpic_write(sc, ATPIC_SLAVE, 0, OCW2_EOI); + } else { + sc->sc_mask[ATPIC_MASTER] |= 1 << irq; + atpic_write(sc, ATPIC_MASTER, 1, sc->sc_mask[ATPIC_MASTER]); + } + atpic_write(sc, ATPIC_MASTER, 0, OCW2_EOI); +} + +static void +atpic_unmask(device_t dev, u_int irq) +{ + struct atpic_softc *sc; + + sc = device_get_softc(dev); + if (irq > 7) { + sc->sc_mask[ATPIC_SLAVE] &= ~(1 << (irq - 8)); + atpic_write(sc, ATPIC_SLAVE, 1, sc->sc_mask[ATPIC_SLAVE]); + } else { + sc->sc_mask[ATPIC_MASTER] &= ~(1 << irq); + atpic_write(sc, ATPIC_MASTER, 1, sc->sc_mask[ATPIC_MASTER]); + } +} Added: head/sys/powerpc/mpc85xx/isa.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/mpc85xx/isa.c Fri Apr 24 03:51:11 2009 (r191450) @@ -0,0 +1,100 @@ +/*- + * Copyright (c) 2009 Marcel Moolenaar + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +void +isa_init(device_t dev) +{ +} + +struct resource * +isa_alloc_resource(device_t bus, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + struct isa_device* idev = DEVTOISA(child); + struct resource_list *rl = &idev->id_resources; + int isdefault, passthrough, rids; + + isdefault = (start == 0UL && end == ~0UL) ? 1 : 0; + passthrough = (device_get_parent(child) != bus) ? 1 : 0; + + if (!passthrough && !isdefault && + resource_list_find(rl, type, *rid) == NULL) { + switch (type) { + case SYS_RES_IOPORT: rids = ISA_PNP_NPORT; break; + case SYS_RES_IRQ: rids = ISA_PNP_NIRQ; break; + case SYS_RES_MEMORY: rids = ISA_PNP_NMEM; break; + default: rids = 0; break; + } + if (*rid < 0 || *rid >= rids) + return (NULL); + + resource_list_add(rl, type, *rid, start, end, count); + } + + return (resource_list_alloc(rl, bus, child, type, rid, start, end, + count, flags)); +} + +int +isa_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + struct isa_device* idev = DEVTOISA(child); + struct resource_list *rl = &idev->id_resources; + + return (resource_list_release(rl, bus, child, type, rid, r)); +} + +int +isa_setup_intr(device_t bus, device_t child, struct resource *r, int flags, + driver_filter_t filter, void (*ihand)(void *), void *arg, void **cookiep) +{ + + return (BUS_SETUP_INTR(device_get_parent(bus), child, r, flags, + filter, ihand, arg, cookiep)); +} + +int +isa_teardown_intr(device_t bus, device_t child, struct resource *r, + void *cookie) +{ + + return (BUS_TEARDOWN_INTR(device_get_parent(bus), child, r, cookie)); +} Modified: head/sys/powerpc/mpc85xx/ocpbus.c ============================================================================== --- head/sys/powerpc/mpc85xx/ocpbus.c Fri Apr 24 03:43:20 2009 (r191449) +++ head/sys/powerpc/mpc85xx/ocpbus.c Fri Apr 24 03:51:11 2009 (r191450) @@ -159,15 +159,15 @@ ocpbus_write_law(int trgt, int type, u_l case SYS_RES_IOPORT: switch (trgt) { case OCP85XX_TGTIF_PCI0: - addr = 0xff000000; + addr = 0xfee00000; size = 0x00010000; break; case OCP85XX_TGTIF_PCI1: - addr = 0xff010000; + addr = 0xfee10000; size = 0x00010000; break; case OCP85XX_TGTIF_PCI2: - addr = 0xff020000; + addr = 0xfee20000; size = 0x00010000; break; default: @@ -266,7 +266,7 @@ ocpbus_attach(device_t dev) ccsr_read4(OCP85XX_PORDEVSR), ccsr_read4(OCP85XX_PORDEVSR2)); - for (i = 0; i < 4; i++) + for (i = PIC_IRQ_START; i < PIC_IRQ_START + 4; i++) powerpc_config_intr(i, INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW); return (bus_generic_attach(dev)); @@ -424,15 +424,8 @@ ocpbus_alloc_resource(device_t dev, devi return (NULL); } - /* - * ISA interrupts (IRQ 0-15) are remapped by the - * PCI driver. Make sure this happened. - */ - if (start < PIC_IRQ_START) - return (NULL); - - rv = rman_reserve_resource(&sc->sc_irq, start - PIC_IRQ_START, - start - PIC_IRQ_START + count - 1, count, flags, child); + rv = rman_reserve_resource(&sc->sc_irq, start, + start + count - 1, count, flags, child); if (rv == NULL) return (NULL); break; @@ -598,7 +591,5 @@ ocpbus_config_intr(device_t dev, int irq enum intr_polarity pol) { - if (irq < PIC_IRQ_START) - return (EINVAL); - return (powerpc_config_intr(irq - PIC_IRQ_START, trig, pol)); + return (powerpc_config_intr(irq, trig, pol)); } Modified: head/sys/powerpc/mpc85xx/pci_ocp.c ============================================================================== --- head/sys/powerpc/mpc85xx/pci_ocp.c Fri Apr 24 03:43:20 2009 (r191449) +++ head/sys/powerpc/mpc85xx/pci_ocp.c Fri Apr 24 03:51:11 2009 (r191450) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -75,6 +76,8 @@ __FBSDID("$FreeBSD$"); #define REG_PIWBEAR(n) (0x0e0c - 0x20 * (n)) #define REG_PIWAR(n) (0x0e10 - 0x20 * (n)) +#define DEVFN(b, s, f) ((b << 16) | (s << 8) | f) + struct pci_ocp_softc { device_t sc_dev; @@ -92,6 +95,10 @@ struct pci_ocp_softc { int sc_busnr; int sc_pcie:1; + + /* Devices that need special attention. */ + int sc_devfn_tundra; + int sc_devfn_via_ide; }; static int pci_ocp_attach(device_t); @@ -262,9 +269,15 @@ pci_ocp_read_config(device_t dev, u_int u_int reg, int bytes) { struct pci_ocp_softc *sc = device_get_softc(dev); + u_int devfn; if (bus == sc->sc_busnr && !sc->sc_pcie && slot < 10) return (~0); + devfn = DEVFN(bus, slot, func); + if (devfn == sc->sc_devfn_tundra) + return (~0); + if (devfn == sc->sc_devfn_via_ide && reg == PCIR_INTPIN) + return (1); return (pci_ocp_cfgread(sc, bus, slot, func, reg, bytes)); } @@ -372,6 +385,22 @@ out: return (error); } +static void +pci_ocp_init_via(struct pci_ocp_softc *sc, uint16_t device, int bus, + int slot, int fn) +{ + + if (device == 0x0686) { + pci_ocp_write_config(sc->sc_dev, bus, slot, fn, 0x52, 0x34, 1); + pci_ocp_write_config(sc->sc_dev, bus, slot, fn, 0x77, 0x00, 1); + pci_ocp_write_config(sc->sc_dev, bus, slot, fn, 0x83, 0x98, 1); + pci_ocp_write_config(sc->sc_dev, bus, slot, fn, 0x85, 0x03, 1); + } else if (device == 0x0571) { + sc->sc_devfn_via_ide = DEVFN(bus, slot, fn); + pci_ocp_write_config(sc->sc_dev, bus, slot, fn, 0x40, 0x0b, 1); + } +} + static int pci_ocp_init_bar(struct pci_ocp_softc *sc, int bus, int slot, int func, int barno) @@ -381,6 +410,20 @@ pci_ocp_init_bar(struct pci_ocp_softc *s int reg, width; reg = PCIR_BAR(barno); + + if (DEVFN(bus, slot, func) == sc->sc_devfn_via_ide) { + switch (barno) { + case 0: addr = 0x1f0; break; + case 1: addr = 0x3f4; break; + case 2: addr = 0x170; break; + case 3: addr = 0x374; break; + case 4: addr = 0xcc0; break; + default: return (1); + } + pci_ocp_write_config(sc->sc_dev, bus, slot, func, reg, addr, 4); + return (1); + } + pci_ocp_write_config(sc->sc_dev, bus, slot, func, reg, ~0, 4); size = pci_ocp_read_config(sc->sc_dev, bus, slot, func, reg, 4); if (size == 0) @@ -421,17 +464,23 @@ static u_int pci_ocp_route_int(struct pci_ocp_softc *sc, u_int bus, u_int slot, u_int func, u_int intpin) { - u_int intline; + u_int devfn, intline; - /* - * Default interrupt routing. - */ - if (intpin != 0) { - intline = intpin - 1; - intline += (bus != sc->sc_busnr) ? slot : 0; - intline = PIC_IRQ_EXT(intline & 3); - } else - intline = 0xff; + devfn = DEVFN(bus, slot, func); + if (devfn == sc->sc_devfn_via_ide) + intline = 14; + else if (devfn == sc->sc_devfn_via_ide + 1) + intline = 10; + else if (devfn == sc->sc_devfn_via_ide + 2) + intline = 10; + else { + if (intpin != 0) { + intline = intpin - 1; + intline += (bus != sc->sc_busnr) ? slot : 0; + intline = PIC_IRQ_EXT(intline & 3); + } else + intline = 0xff; + } if (bootverbose) printf("PCI %u:%u:%u:%u: intpin %u: intline=%u\n", @@ -448,7 +497,7 @@ pci_ocp_init(struct pci_ocp_softc *sc, i int func, maxfunc; int bar, maxbar; uint16_t vendor, device; - uint8_t cr8, command, hdrtype, class, subclass; + uint8_t command, hdrtype, class, subclass; uint8_t intline, intpin; secbus = bus; @@ -463,46 +512,25 @@ pci_ocp_init(struct pci_ocp_softc *sc, i if (func == 0 && (hdrtype & PCIM_MFDEV)) maxfunc = PCI_FUNCMAX; - command = pci_ocp_read_config(sc->sc_dev, bus, slot, - func, PCIR_COMMAND, 1); - command &= ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN); - pci_ocp_write_config(sc->sc_dev, bus, slot, func, - PCIR_COMMAND, command, 1); - vendor = pci_ocp_read_config(sc->sc_dev, bus, slot, func, PCIR_VENDOR, 2); device = pci_ocp_read_config(sc->sc_dev, bus, slot, func, PCIR_DEVICE, 2); - /* - * Make sure the ATA controller on the VIA82C686 - * South bridge is enabled. - */ - if (vendor == 0x1106 && device == 0x0686) { - /* Enable the ATA controller. */ - cr8 = pci_ocp_read_config(sc->sc_dev, bus, - slot, func, 0x48, 1); - if (cr8 & 2) { - device_printf(sc->sc_dev, - "enabling ATA controller\n"); - pci_ocp_write_config(sc->sc_dev, bus, - slot, func, 0x48, cr8 & ~2, 1); - } - } - if (vendor == 0x1106 && device == 0x0571) { - pci_ocp_write_config(sc->sc_dev, bus, slot, - func, 0xc4, 0x00, 1); - /* Set legacy mode. */ - pci_ocp_write_config(sc->sc_dev, bus, slot, - func, 0x40, 0x08, 1); - pci_ocp_write_config(sc->sc_dev, bus, slot, - func, PCIR_PROGIF, 0x00, 1); - pci_ocp_write_config(sc->sc_dev, bus, slot, - func, 0x42, 0x09, 1); - pci_ocp_write_config(sc->sc_dev, bus, slot, - func, 0x40, 0x0b, 1); + if (vendor == 0x1957 && device == 0x3fff) { + sc->sc_devfn_tundra = DEVFN(bus, slot, func); + continue; } + command = pci_ocp_read_config(sc->sc_dev, bus, slot, + func, PCIR_COMMAND, 1); + command &= ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN); + pci_ocp_write_config(sc->sc_dev, bus, slot, func, + PCIR_COMMAND, command, 1); + + if (vendor == 0x1106) + pci_ocp_init_via(sc, device, bus, slot, func); + /* Program the base address registers. */ maxbar = (hdrtype & PCIM_HDRTYPE) ? 1 : 6; bar = 0; @@ -518,8 +546,7 @@ pci_ocp_init(struct pci_ocp_softc *sc, i pci_ocp_write_config(sc->sc_dev, bus, slot, func, PCIR_INTLINE, intline, 1); - command |= PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN | - PCIM_CMD_PORTEN; + command |= PCIM_CMD_MEMEN | PCIM_CMD_PORTEN; pci_ocp_write_config(sc->sc_dev, bus, slot, func, PCIR_COMMAND, command, 1); @@ -723,6 +750,9 @@ pci_ocp_attach(device_t dev) pci_ocp_inbound(sc, 2, -1, 0, 0, 0); pci_ocp_inbound(sc, 3, OCP85XX_TGTIF_RAM1, 0, 2U*1024U*1024U*1024U, 0); + sc->sc_devfn_tundra = -1; + sc->sc_devfn_via_ide = -1; + maxslot = (sc->sc_pcie) ? 1 : 31; pci_ocp_init(sc, sc->sc_busnr, maxslot); @@ -749,12 +779,9 @@ pci_ocp_alloc_resource(device_t dev, dev va = sc->sc_iomem_va; break; case SYS_RES_IRQ: - /* ISA interrupts are routed to IRQ 0 on the PIC. */ if (start < PIC_IRQ_START) { device_printf(dev, "%s requested ISA interrupt %lu\n", device_get_nameunit(child), start); - /* XXX */ - start = PIC_IRQ_EXT(0); } return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, type, rid, start, end, count, flags)); Modified: head/sys/powerpc/powerpc/autoconf.c ============================================================================== --- head/sys/powerpc/powerpc/autoconf.c Fri Apr 24 03:43:20 2009 (r191449) +++ head/sys/powerpc/powerpc/autoconf.c Fri Apr 24 03:51:11 2009 (r191450) @@ -24,6 +24,8 @@ * SUCH DAMAGE. */ +#include "opt_isa.h" + #include __FBSDID("$FreeBSD$"); @@ -35,6 +37,12 @@ __FBSDID("$FreeBSD$"); #include +#ifdef DEV_ISA +extern void isa_probe_children(device_t dev); + +device_t isa_bus_device; +#endif + static device_t nexusdev; static void configure_first(void *); @@ -62,6 +70,10 @@ configure(void *dummy) { root_bus_configure(); +#ifdef DEV_ISA + if (isa_bus_device) + isa_probe_children(isa_bus_device); +#endif } static void Modified: head/sys/powerpc/powerpc/intr_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/intr_machdep.c Fri Apr 24 03:43:20 2009 (r191449) +++ head/sys/powerpc/powerpc/intr_machdep.c Fri Apr 24 03:51:11 2009 (r191450) @@ -60,6 +60,8 @@ * $FreeBSD$ */ +#include "opt_platform.h" + #include #include #include @@ -83,6 +85,14 @@ #include "pic_if.h" +#ifdef MPC85XX +#define ISA_IRQ_COUNT 16 +#endif + +#ifndef ISA_IRQ_COUNT +#define ISA_IRQ_COUNT 0 +#endif + #define MAX_STRAY_LOG 5 MALLOC_DEFINE(M_INTR, "intr", "interrupt handler data"); @@ -90,10 +100,12 @@ MALLOC_DEFINE(M_INTR, "intr", "interrupt struct powerpc_intr { struct intr_event *event; long *cntp; - enum intr_trigger trig; - enum intr_polarity pol; u_int irq; + device_t pic; + u_int intline; u_int vector; + enum intr_trigger trig; + enum intr_polarity pol; }; static struct mtx intr_table_lock; @@ -108,6 +120,7 @@ static void *ipi_cookie; static u_int ipi_irq; device_t pic; +device_t pic8259; static void intr_init(void *dummy __unused) @@ -180,28 +193,50 @@ intr_lookup(u_int irq) return (i); } +static int +powerpc_map_irq(struct powerpc_intr *i) +{ + +#if ISA_IRQ_COUNT > 0 + if (i->irq < ISA_IRQ_COUNT) { + if (pic8259 == NULL) { + i->pic = pic; + i->intline = 0; + return (ENXIO); + } + i->pic = pic8259; + i->intline = i->irq; + return (0); + } +#endif + + i->pic = pic; + i->intline = i->irq - ISA_IRQ_COUNT; + return (0); +} + static void powerpc_intr_eoi(void *arg) { - u_int irq = (uintptr_t)arg; + struct powerpc_intr *i = arg; - PIC_EOI(pic, irq); + PIC_EOI(i->pic, i->intline); } static void powerpc_intr_mask(void *arg) { - u_int irq = (uintptr_t)arg; + struct powerpc_intr *i = arg; - PIC_MASK(pic, irq); + PIC_MASK(i->pic, i->intline); } static void powerpc_intr_unmask(void *arg) { - u_int irq = (uintptr_t)arg; + struct powerpc_intr *i = arg; - PIC_UNMASK(pic, irq); + PIC_UNMASK(i->pic, i->intline); } void @@ -209,17 +244,21 @@ powerpc_register_pic(device_t dev, u_int { pic = dev; - ipi_irq = ipi; + ipi_irq = ipi + ISA_IRQ_COUNT; +} + +void +powerpc_register_8259(device_t dev) +{ + + pic8259 = dev; } int powerpc_enable_intr(void) { struct powerpc_intr *i; -#ifdef SMP - int error; -#endif - int vector; + int error, vector; if (pic == NULL) panic("no PIC detected\n"); @@ -239,12 +278,16 @@ powerpc_enable_intr(void) if (i == NULL) continue; + error = powerpc_map_irq(i); + if (error) + continue; + if (i->trig != INTR_TRIGGER_CONFORM || i->pol != INTR_POLARITY_CONFORM) - PIC_CONFIG(pic, i->irq, i->trig, i->pol); + PIC_CONFIG(i->pic, i->intline, i->trig, i->pol); if (i->event != NULL) - PIC_ENABLE(pic, i->irq, vector); + PIC_ENABLE(i->pic, i->intline, vector); } return (0); @@ -262,7 +305,7 @@ powerpc_setup_intr(const char *name, u_i return (ENOMEM); if (i->event == NULL) { - error = intr_event_create(&i->event, (void *)irq, 0, irq, + error = intr_event_create(&i->event, (void *)i, 0, irq, powerpc_intr_mask, powerpc_intr_unmask, powerpc_intr_eoi, NULL, "irq%u:", irq); if (error) @@ -280,9 +323,11 @@ powerpc_setup_intr(const char *name, u_i intrcnt_setname(i->event->ie_fullname, i->vector); mtx_unlock(&intr_table_lock); - if (!cold && enable) - PIC_ENABLE(pic, i->irq, i->vector); - + if (!cold) { + error = powerpc_map_irq(i); + if (!error && enable) + PIC_ENABLE(i->pic, i->intline, i->vector); + } return (error); } @@ -298,9 +343,6 @@ powerpc_config_intr(int irq, enum intr_t { struct powerpc_intr *i; - if (trig == INTR_TRIGGER_CONFORM && pol == INTR_POLARITY_CONFORM) - return (0); - i = intr_lookup(irq); if (i == NULL) return (ENOMEM); @@ -309,7 +351,7 @@ powerpc_config_intr(int irq, enum intr_t i->pol = pol; if (!cold) - PIC_CONFIG(pic, irq, trig, pol); + PIC_CONFIG(i->pic, i->intline, trig, pol); return (0); } @@ -344,5 +386,5 @@ stray: } } if (i != NULL) - PIC_MASK(pic, i->irq); + PIC_MASK(i->pic, i->intline); } From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 06:10:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F4F11065673; Fri, 24 Apr 2009 06:10:36 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id F316E8FC1B; Fri, 24 Apr 2009 06:10:35 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (pD9E2D584.dip.t-dialin.net [217.226.213.132]) by redbull.bpaserver.net (Postfix) with ESMTP id E64292E0E2; Fri, 24 Apr 2009 08:10:29 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 9976E5F90E; Fri, 24 Apr 2009 08:10:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1240553425; bh=BbP1GkrBQojxH+vxCIBNvOwhQeGMa5epv pBtl31n0nI=; h=Message-ID:Date:From:To:Cc:Subject:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=1EbaDDqTq09QUyHh2lU6JvVUaowKYpWlmhcmh9xz+IDgR2OuCoqWdnqLVloLqyBmW Taob6XJw+uiCzuLdX7VuuPYpDxVn4y3RZUKwypSAfTw7N/4szBqv8IiI7Cm4XnZWTfR oQp/eN1Dt9ft9GSwLY6wgkrvwMAZ81K9YaXHFKm7YneWgLIxBRvf03Ikk05u32PJXSa EhUXNmHkV3Og8soXB+RVhIbhuomiifZN+q6rUH/e1pS5HiHLP1mvNR062mpUPxqhkrW M7BFC4nZWvQSxg7M1FuK+bXPMsLZTEhLIjMpS8VcRyERzc2uFzaAGauMtYxytqF2n1y EURALpesg== Received: (from www@localhost) by webmail.leidinger.net (8.14.3/8.13.8/Submit) id n3O6AOnV070386; Fri, 24 Apr 2009 08:10:24 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Fri, 24 Apr 2009 08:10:24 +0200 Message-ID: <20090424081024.111742c8wxixpji8@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Fri, 24 Apr 2009 08:10:24 +0200 From: Alexander Leidinger To: "M. Warner Losh" References: <20090422231511.ca92fb9f.stas@FreeBSD.org> <20090422.133147.-1890035357.imp@bsdimp.com> <20090423091120.18706t1ks38zgfgo@webmail.leidinger.net> <20090423.084920.-365726763.imp@bsdimp.com> In-Reply-To: <20090423.084920.-365726763.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.3) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: E64292E0E2.7E6BE X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-11.85, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, IMPRONONCABLE_2 1.50, MIME_QP_LONG_LINE 1.40, RDNS_DYNAMIC 0.10, TW_SN 0.08, TW_SV 0.08) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: stas@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191369 - in head/sys: arm/conf dev/iicbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Apr 2009 06:10:36 -0000 Quoting "M. Warner Losh" (from Thu, 23 Apr 2009 =20 08:49:20 -0600 (MDT)): > In message: <20090423091120.18706t1ks38zgfgo@webmail.leidinger.net> > Alexander Leidinger writes: > : Quoting "M. Warner Losh" (from Wed, 22 Apr 2009 > : 13:31:47 -0600 (MDT)): > : > : > In message: <20090422231511.ca92fb9f.stas@FreeBSD.org> > : > Stanislav Sedov writes: > : > : On Wed, 22 Apr 2009 09:05:46 +0200 > : > : Alexander Leidinger mentioned: > : > : > : > : > Quoting "M. Warner Losh" (from Wed, 22 Apr 2009 > : > : > 00:26:43 -0600 (MDT)): > : > : > > : > : > > In message: <200904212248.n3LMmCbu027432@svn.freebsd.org> > : > : > > Stanislav Sedov writes: > : > : > > : Author: stas > : > : > > : Date: Tue Apr 21 22:48:12 2009 > : > : > > : New Revision: 191369 > : > : > > : URL: http://svn.freebsd.org/changeset/base/191369 > : > : > > : > : > : > > : Log: > : > : > > : - Rename ds1672 and ds133x devices to "ds1672_rtc" and =20 > "ds133x_rtc" > : > : > > : respectivly. This will allow one to have a kernel with > : > both devices > : > : > > : present and use it for multiple boards with different > : > types of RTC > : > : > > : sitting on a bus. > : > : > > : > : > : > > : Discussed with:=09imp > : > : > > > : > : > > Hey thanks Stas! Now things are better than before both =20 > functionally > : > : > > and cosmetically! Good idea on the names... > : > : > > : > : > > : > : > Are those the first devices with an underscore in the name now? If > : > : > yes, do we want this? > : > : > > : > : > > : > : > : > : I had the same concerns too, but was not able to come up with anythi= ng > : > : better. BTW, I think those devices were the first that ended with a > : > : digit. > : > : ds1672rtc? Just if it pleases you or we do not want underscores in > : device names which are visible to the outside. > > There's no rule against understores right now. Doesn't matter. Are there some automated things out there which depend =20 upon the fact that there are no underscores? Are device names used =20 somewhere in variable names with underscores which are used as =20 seperators? Personally I don't know. Do we care about this? I don't, I =20 have no such device, but maybe someone of you cares about this. > : > No. They weren't. There are sound devices that end in digits: > : > > : > # snd_ad1816:=09=09Analog Devices AD1816 ISA PnP/non-PnP. > : > # snd_als4000:=09=09Avance Logic ALS4000 PCI. > : > # snd_cs4281:=09=09Crystal Semiconductor CS4281 PCI. > : > # snd_ds1:=09=09Yamaha DS-1 PCI. > : > # snd_emu10k1:=09=09Creative EMU10K1 PCI and EMU10K2 (Audigy) PCI. > : > # snd_envy24:=09=09VIA Envy24 and compatible, needs snd_spicds. > : > # snd_fm801:=09=09Forte Media FM801 PCI. > : > # snd_maestro3:=09=09ESS Technology Maestro-3/Allegro PCI. > : > # snd_sb16:=09=09Creative SoundBlaster16, to be used in > : > # snd_sb8:=09=09Creative SoundBlaster (pre-16), to be used in > : > # snd_via8233:=09=09VIA VT8233x PCI. > : > # snd_via82c686:=09VIA VT82C686A PCI. > : > > : > but since they all live on an enumerated bus, they all share the name > : > "pcm". > : > : And because of this they don't count as being with underscores... > > Why not? Short: POLA + history Long: The official name is pcm everywhere where it is displayed. Just =20 "recently" (in the last years) the underscored names appeared =20 officially (besides the file names for the modules) when the kld for =20 the pcm device started to appear in /dev/sndstat, but even there the =20 device is pcm and the underscored name is some additional info only =20 available when loaded as a module. Any use of this is completely =20 specific to /dev/sndstat parsing and in this part of sndstat there =20 where underscores since the beginning. Bye, Alexander. --=20 Adult, n.: =09One old enough to know better. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID =3D B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID =3D 72077137 From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 06:44:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9C761065670; Fri, 24 Apr 2009 06:44:58 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C88AD8FC13; Fri, 24 Apr 2009 06:44:58 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3O6iwPl010819; Fri, 24 Apr 2009 06:44:58 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3O6iw8h010818; Fri, 24 Apr 2009 06:44:58 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200904240644.n3O6iw8h010818@svn.freebsd.org> From: Maxim Konovalov Date: Fri, 24 Apr 2009 06:44:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191454 - 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: Fri, 24 Apr 2009 06:44:59 -0000 Author: maxim Date: Fri Apr 24 06:44:58 2009 New Revision: 191454 URL: http://svn.freebsd.org/changeset/base/191454 Log: o Correct geli(8) command line. PR: docs/133961 Submitted by: Aldis Berjoza MFC after: 1 week Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Fri Apr 24 05:28:44 2009 (r191453) +++ head/share/man/man5/rc.conf.5 Fri Apr 24 06:44:58 2009 (r191454) @@ -1503,7 +1503,7 @@ Options passed to the .Xr geli 8 utility when encrypted GEOM providers for swap partitions are created. The default is -.Dq Li "-a aes -l 256 -s 4096 -d" . +.Dq Li "-e aes -l 256 -s 4096 -d" . .It Va root_rw_mount .Pq Vt bool Set to From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 08:57:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64A541065672; Fri, 24 Apr 2009 08:57:54 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5353D8FC14; Fri, 24 Apr 2009 08:57:54 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3O8vsbg013389; Fri, 24 Apr 2009 08:57:54 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3O8vsm8013388; Fri, 24 Apr 2009 08:57:54 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200904240857.n3O8vsm8013388@svn.freebsd.org> From: Rafal Jaworowski Date: Fri, 24 Apr 2009 08:57: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: r191455 - head/sys/powerpc/aim X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Apr 2009 08:57:54 -0000 Author: raj Date: Fri Apr 24 08:57:54 2009 New Revision: 191455 URL: http://svn.freebsd.org/changeset/base/191455 Log: Zero PCB during early AIM PowerPC init. When memory is not zero'ed by firmware, uninitialized PCB can have bogus contents, which appear as a saved onfault condition, Altivec context to restore etc. and lead to corruption/crashes. This commit fixes such issues. Submitted by: Michal Mazur arg ! semihalf dot com Tested by: Andreas Tobler andreast-list ! fgznet dot ch Modified: head/sys/powerpc/aim/machdep.c Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Fri Apr 24 06:44:58 2009 (r191454) +++ head/sys/powerpc/aim/machdep.c Fri Apr 24 08:57:54 2009 (r191455) @@ -505,6 +505,7 @@ powerpc_init(u_int startkernel, u_int en thread0.td_pcb = (struct pcb *) ((thread0.td_kstack + thread0.td_kstack_pages * PAGE_SIZE - sizeof(struct pcb)) & ~15); + bzero((void *)thread0.td_pcb, sizeof(struct pcb)); pc->pc_curpcb = thread0.td_pcb; /* Initialise the message buffer. */ From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 09:54:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92ACF106566C; Fri, 24 Apr 2009 09:54:46 +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 66FE28FC0C; Fri, 24 Apr 2009 09:54:46 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3O9skpu014518; Fri, 24 Apr 2009 09:54:46 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3O9skr7014517; Fri, 24 Apr 2009 09:54:46 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904240954.n3O9skr7014517@svn.freebsd.org> From: Robert Watson Date: Fri, 24 Apr 2009 09:54: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: r191456 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Apr 2009 09:54:47 -0000 Author: rwatson Date: Fri Apr 24 09:54:46 2009 New Revision: 191456 URL: http://svn.freebsd.org/changeset/base/191456 Log: Relocate permissions checking code in in_control() to before the body of the implementation of ioctls. This makes the mapping of ioctls to specific privileges more explicit, and also simplifies the implementation by reducing the use of FALLTHROUGH handling in switch. While this is not intended to be a functional change, it does mean that certain privilege checks are now performed earlier, so EPERM might be returned in preference to EADDRNOTAVAIL for management ioctls that could have failed for both reasons. MFC after: 3 weeks Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Fri Apr 24 08:57:54 2009 (r191455) +++ head/sys/netinet/in.c Fri Apr 24 09:54:46 2009 (r191456) @@ -280,6 +280,31 @@ in_control(struct socket *so, u_long cmd return (EADDRNOTAVAIL); /* + * Security checks before we get involved in any work. + */ + switch (cmd) { + case SIOCAIFADDR: + case SIOCSIFADDR: + case SIOCSIFBRDADDR: + case SIOCSIFNETMASK: + case SIOCSIFDSTADDR: + if (td != NULL) { + error = priv_check(td, PRIV_NET_ADDIFADDR); + if (error) + return (error); + } + break; + + case SIOCDIFADDR: + if (td != NULL) { + error = priv_check(td, PRIV_NET_DELIFADDR); + if (error) + return (error); + } + break; + } + + /* * Find address for this interface, if it exists. * * If an alias address was specified, find that one instead of the @@ -334,13 +359,6 @@ in_control(struct socket *so, u_long cmd case SIOCSIFADDR: case SIOCSIFNETMASK: case SIOCSIFDSTADDR: - if (td != NULL) { - error = priv_check(td, (cmd == SIOCDIFADDR) ? - PRIV_NET_DELIFADDR : PRIV_NET_ADDIFADDR); - if (error) - return (error); - } - if (ia == NULL) { ia = (struct in_ifaddr *) malloc(sizeof *ia, M_IFADDR, M_WAITOK | M_ZERO); @@ -376,13 +394,6 @@ in_control(struct socket *so, u_long cmd break; case SIOCSIFBRDADDR: - if (td != NULL) { - error = priv_check(td, PRIV_NET_ADDIFADDR); - if (error) - return (error); - } - /* FALLTHROUGH */ - case SIOCGIFADDR: case SIOCGIFNETMASK: case SIOCGIFDSTADDR: From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 09:58:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2BF31065678; Fri, 24 Apr 2009 09:58:50 +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 D196B8FC17; Fri, 24 Apr 2009 09:58:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3O9wocQ014645; Fri, 24 Apr 2009 09:58:50 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3O9woau014644; Fri, 24 Apr 2009 09:58:50 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904240958.n3O9woau014644@svn.freebsd.org> From: Robert Watson Date: Fri, 24 Apr 2009 09:58: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: r191457 - 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: Fri, 24 Apr 2009 09:58:51 -0000 Author: rwatson Date: Fri Apr 24 09:58:50 2009 New Revision: 191457 URL: http://svn.freebsd.org/changeset/base/191457 Log: Add UPDATING note about change to struct malloc_type -- following several reports of panics, remind readers that rebuilding kernel modules between kernel upgrades in HEAD is a good idea. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Apr 24 09:54:46 2009 (r191456) +++ head/UPDATING Fri Apr 24 09:58:50 2009 (r191457) @@ -22,10 +22,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) -20090422 +20090422: Implement low-level Bluetooth HCI API. Bump __FreeBSD_version to 800083. +20090419: + The layout of struct malloc_type, used by modules to register new + memory allocation types, has changed. Most modules will need to + be rebuilt or panics may be experienced. + Bump __FreeBSD_version to 800081. + 20090415: Anticipate overflowing inp_flags - add inp_flags2. This changes most offsets in inpcb, so checking v4 connection From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 11:34:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 795C5106566B; Fri, 24 Apr 2009 11:34:59 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 686088FC16; Fri, 24 Apr 2009 11:34:59 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3OBYxZo021281; Fri, 24 Apr 2009 11:34:59 GMT (envelope-from garga@svn.freebsd.org) Received: (from garga@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3OBYxMV021280; Fri, 24 Apr 2009 11:34:59 GMT (envelope-from garga@svn.freebsd.org) Message-Id: <200904241134.n3OBYxMV021280@svn.freebsd.org> From: Renato Botelho Date: Fri, 24 Apr 2009 11:34: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: r191464 - 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: Fri, 24 Apr 2009 11:34:59 -0000 Author: garga (ports committer) Date: Fri Apr 24 11:34:59 2009 New Revision: 191464 URL: http://svn.freebsd.org/changeset/base/191464 Log: - Add a single line separating two 20090415 entries Approved by: brueffer Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Apr 24 11:23:21 2009 (r191463) +++ head/UPDATING Fri Apr 24 11:34:59 2009 (r191464) @@ -49,6 +49,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. of routes, sticky and nostick flags to alter the behavior of stateful load balancing. Bump __FreeBSD_version to 800078. + 20090408: Do not use Giant for kbdmux(4) locking. This is wrong and apparently causing more problems than it solves. This will From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 11:38:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3D9A106564A; Fri, 24 Apr 2009 11:38:32 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from semihalf.com (semihalf.com [206.130.101.55]) by mx1.freebsd.org (Postfix) with ESMTP id 8A7258FC23; Fri, 24 Apr 2009 11:38:32 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from mail.semihalf.com (mail.semihalf.com [83.15.139.206]) by semihalf.com (8.13.1/8.13.1) with ESMTP id n3OBcVo9023354; Fri, 24 Apr 2009 05:38:31 -0600 Message-Id: <36F35E1F-A15B-46BC-85CE-1EB216EA568F@semihalf.com> From: Rafal Jaworowski To: Marcel Moolenaar In-Reply-To: <200904240351.n3O3pBgs007559@svn.freebsd.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Fri, 24 Apr 2009 13:38:28 +0200 References: <200904240351.n3O3pBgs007559@svn.freebsd.org> X-Mailer: Apple Mail (2.930.3) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191450 - in head/sys: conf powerpc/conf powerpc/include powerpc/mpc85xx powerpc/powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 24 Apr 2009 11:38:33 -0000 On 2009-04-24, at 05:51, Marcel Moolenaar wrote: > Author: marcel > Date: Fri Apr 24 03:51:11 2009 > New Revision: 191450 > URL: http://svn.freebsd.org/changeset/base/191450 > > Log: > Add suppport for ISA and ISA interrupts to make the ATA > controller in the VIA southbridge functional in the CDS > (Configurable Development System) for MPC85XX. > The embedded USB controllers look operational but the > interrupt steering is still wrong. Hi Marcel, Great to see this. What is still missing around interrupts here, is it only USB-related? Does ATA controller within the VIA bridge work already? Rafal From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 15:27:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A12F1065672; Fri, 24 Apr 2009 15:27:23 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout016.mac.com (asmtpout016.mac.com [17.148.16.91]) by mx1.freebsd.org (Postfix) with ESMTP id 1EDE48FC1F; Fri, 24 Apr 2009 15:27:22 +0000 (UTC) (envelope-from xcllnt@mac.com) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Received: from MacBook-Pro.lan.xcllnt.net (mail.xcllnt.net [75.101.29.67]) by asmtp016.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KIM007IS2XK9T90@asmtp016.mac.com>; Fri, 24 Apr 2009 08:27:22 -0700 (PDT) Message-id: <8C9395FE-A750-4FE7-8A19-0433AF7B8197@mac.com> From: Marcel Moolenaar To: Rafal Jaworowski In-reply-to: <36F35E1F-A15B-46BC-85CE-1EB216EA568F@semihalf.com> Date: Fri, 24 Apr 2009 08:27:20 -0700 References: <200904240351.n3O3pBgs007559@svn.freebsd.org> <36F35E1F-A15B-46BC-85CE-1EB216EA568F@semihalf.com> X-Mailer: Apple Mail (2.930.3) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191450 - in head/sys: conf powerpc/conf powerpc/include powerpc/mpc85xx powerpc/powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 24 Apr 2009 15:27:24 -0000 On Apr 24, 2009, at 4:38 AM, Rafal Jaworowski wrote: > > On 2009-04-24, at 05:51, Marcel Moolenaar wrote: > >> Author: marcel >> Date: Fri Apr 24 03:51:11 2009 >> New Revision: 191450 >> URL: http://svn.freebsd.org/changeset/base/191450 >> >> Log: >> Add suppport for ISA and ISA interrupts to make the ATA >> controller in the VIA southbridge functional in the CDS >> (Configurable Development System) for MPC85XX. >> The embedded USB controllers look operational but the >> interrupt steering is still wrong. > > Hi Marcel, > Great to see this. What is still missing around interrupts here, is > it only USB-related? Does ATA controller within the VIA bridge work > already? Yes, the ATA works fine, interrupts and all. The register interface of the USB controller works, but no interrupts are happening. With some wrong IRQ programming I got interrupt storms, ended up calling the USB interrupt handler all the time and *that* resulted in a working USB stack :-) In short: once we find out what's happening to the (internal) interrupt steering of the VIA southbridge, we should have USB as well. I still assume we can get it to work... The embedded I/O devices (COM1, LPT, etc) are not working yet. I get all 0xff when reading from the well-known I/O ports. I don't know if that's ever going to work, because I presume it needs a lot of configuration on the VIA. -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 15:38:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B956106568B; Fri, 24 Apr 2009 15:38:14 +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 100F58FC21; Fri, 24 Apr 2009 15:38:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3OFcDvn025950; Fri, 24 Apr 2009 15:38:13 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3OFcDRD025949; Fri, 24 Apr 2009 15:38:13 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200904241538.n3OFcDRD025949@svn.freebsd.org> From: Xin LI Date: Fri, 24 Apr 2009 15:38: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: r191467 - 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: Fri, 24 Apr 2009 15:38:14 -0000 Author: delphij Date: Fri Apr 24 15:38:13 2009 New Revision: 191467 URL: http://svn.freebsd.org/changeset/base/191467 Log: Some minor formatting changes to make new text match old style. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Apr 24 14:22:09 2009 (r191466) +++ head/UPDATING Fri Apr 24 15:38:13 2009 (r191467) @@ -33,19 +33,20 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. Bump __FreeBSD_version to 800081. 20090415: - Anticipate overflowing inp_flags - add inp_flags2. + Anticipate overflowing inp_flags - add inp_flags2. This changes most offsets in inpcb, so checking v4 connection - state will require a world rebuild. + state will require a world rebuild. Bump __FreeBSD_version to 800080. + 20090415: Add an llentry to struct route and struct route_in6. Modules - embedding a struct route will need to be recompiled. + embedding a struct route will need to be recompiled. Bump __FreeBSD_version to 800079. 20090414: The size of rt_metrics_lite and by extension rtentry has changed. Networking administration apps will need to be recompiled. - The route command now supports show as an alias for get, weighting + The route command now supports show as an alias for get, weighting of routes, sticky and nostick flags to alter the behavior of stateful load balancing. Bump __FreeBSD_version to 800078. @@ -69,7 +70,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. GEOM_PART has become the default partition slicer for storage devices, replacing GEOM_MBR, GEOM_BSD, GEOM_PC98 and GEOM_GPT slicers. It introduces some changes: - + MSDOS/EBR: the devices created from MSDOS extended partition entries (EBR) can be named differently than with GEOM_MBR and are now symlinks to devices with offset-based names. fstabs may need to be modified. @@ -78,7 +79,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. cases but it points to problems in file system misalignment with disk geometry. The "c" partition is now implicit, covers the whole top-level drive and cannot be (mis)used by users. - + General: Kernel dumps are now not allowed to be written to devices whose partition types indicate they are meant to be used for file systems (or, in case of MSDOS partitions, as something else than From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 17:27:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A14A51065676; Fri, 24 Apr 2009 17:27:46 +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 8FBA38FC1A; Fri, 24 Apr 2009 17:27:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3OHRktp027965; Fri, 24 Apr 2009 17:27:46 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3OHRk9t027964; Fri, 24 Apr 2009 17:27:46 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904241727.n3OHRk9t027964@svn.freebsd.org> From: Warner Losh Date: Fri, 24 Apr 2009 17:27: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: r191468 - 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: Fri, 24 Apr 2009 17:27:47 -0000 Author: imp Date: Fri Apr 24 17:27:45 2009 New Revision: 191468 URL: http://svn.freebsd.org/changeset/base/191468 Log: Another PC Card that needs the CIS strings for the Surecom EP-427X, which really is just a rebadged OEM card... Plus a tiny whitespace nit. Modified: head/sys/dev/pccard/pccarddevs Modified: head/sys/dev/pccard/pccarddevs ============================================================================== --- head/sys/dev/pccard/pccarddevs Fri Apr 24 15:38:13 2009 (r191467) +++ head/sys/dev/pccard/pccarddevs Fri Apr 24 17:27:45 2009 (r191468) @@ -772,6 +772,7 @@ product NTT_ME WLAN { "NTT-ME", "11Mbps product OEM2 CDROM1 { "PCMCIA", "CD-ROM", NULL, NULL } Generic PCMCIA CD-ROM product OEM2 IDE { "PCMCIA", "IDE&spCARD", NULL, NULL } Generic PCMCIA IDE CARD product OEM2 ETHERNET { "PCMCIA", "Ethernet", NULL, NULL } NE2000 PC Card +product OEM2 100BASE { "PCMCIA", "100BASE", NULL, NULL } NE2000 PC Card product OEM2 FAST_ETHERNET { "PCMCIA", "FAST&spETHERNET&spCARD", NULL, NULL } NE2000 PC Card product OEM2 NE2000 { "NE2000&spCompatible&spPC&spCard", "PCMCIA", NULL, NULL } Generic NE2000 PC Card product PHISON CF_CARD { "PHISON", "CF&spCard", NULL, NULL } Generic CF or SD/MMC/SmartMedia Reader From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 17:28:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3B68106566B; Fri, 24 Apr 2009 17:28:12 +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 D2E3E8FC19; Fri, 24 Apr 2009 17:28:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3OHSCL9028010; Fri, 24 Apr 2009 17:28:12 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3OHSCNU028009; Fri, 24 Apr 2009 17:28:12 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904241728.n3OHSCNU028009@svn.freebsd.org> From: Warner Losh Date: Fri, 24 Apr 2009 17: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: r191469 - head/sys/dev/ed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 24 Apr 2009 17:28:13 -0000 Author: imp Date: Fri Apr 24 17:28:12 2009 New Revision: 191469 URL: http://svn.freebsd.org/changeset/base/191469 Log: Add Surecom EP-427X. Modified: head/sys/dev/ed/if_ed_pccard.c Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Fri Apr 24 17:27:45 2009 (r191468) +++ head/sys/dev/ed/if_ed_pccard.c Fri Apr 24 17:28:12 2009 (r191469) @@ -210,8 +210,9 @@ static const struct ed_product { { PCMCIA_CARD(NEXTCOM, NEXTHAWK), 0}, { PCMCIA_CARD(NEWMEDIA, LANSURFER), NE2000DVF_ANYFUNC}, { PCMCIA_CARD(NEWMEDIA, LIVEWIRE), 0}, + { PCMCIA_CARD(OEM2, 100BASE), NE2000DVF_AX88X90}, { PCMCIA_CARD(OEM2, ETHERNET), 0}, - { PCMCIA_CARD(OEM2, FAST_ETHERNET), NE2000DVF_AX88X90 }, + { PCMCIA_CARD(OEM2, FAST_ETHERNET), NE2000DVF_AX88X90}, { PCMCIA_CARD(OEM2, NE2000), 0}, { PCMCIA_CARD(PLANET, SMARTCOM2000), 0 }, { PCMCIA_CARD(PREMAX, PE200), 0}, From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 21:48:34 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41B1C10656B3; Fri, 24 Apr 2009 21:48:34 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from smtp.timeweb.ru (smtp.timeweb.ru [217.170.79.85]) by mx1.freebsd.org (Postfix) with ESMTP id E720C8FC1C; Fri, 24 Apr 2009 21:48:33 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1LxTG4-0000HH-F6; Sat, 25 Apr 2009 01:48:32 +0400 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id E8F98682A; Sat, 25 Apr 2009 01:49:05 +0400 (MSD) Received: by hades.panopticon (Postfix, from userid 1000) id C1C53108841; Sat, 25 Apr 2009 01:47:53 +0400 (MSD) Date: Sat, 25 Apr 2009 01:47:53 +0400 From: Dmitry Marakasov To: Brooks Davis Message-ID: <20090424214753.GA42835@hades.panopticon> References: <200903191248.n2JCm0Rd061331@svn.freebsd.org> <20090409131253.GB7795@hades.panopticon> <20090409153805.GB83847@lor.one-eyed-alien.net> <20090409155138.GD7795@hades.panopticon> <20090409161549.GC83847@lor.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20090409161549.GC83847@lor.one-eyed-alien.net> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Dag-Erling Smorgrav Subject: Re: svn commit: r190031 - 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: Fri, 24 Apr 2009 21:48:35 -0000 * Brooks Davis (brooks@FreeBSD.org) wrote: So, any comments on this? Should I submit the PR? -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 22:05:19 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6FDE106566B; Fri, 24 Apr 2009 22:05:19 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id 869628FC19; Fri, 24 Apr 2009 22:05:19 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.3/8.14.3) with ESMTP id n3OM3wQ1001376; Fri, 24 Apr 2009 17:03:58 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.3/8.14.3/Submit) id n3OM3vGU001369; Fri, 24 Apr 2009 17:03:57 -0500 (CDT) (envelope-from brooks) Date: Fri, 24 Apr 2009 17:03:57 -0500 From: Brooks Davis To: Dmitry Marakasov Message-ID: <20090424220357.GA1251@lor.one-eyed-alien.net> References: <200903191248.n2JCm0Rd061331@svn.freebsd.org> <20090409131253.GB7795@hades.panopticon> <20090409153805.GB83847@lor.one-eyed-alien.net> <20090409155138.GD7795@hades.panopticon> <20090409161549.GC83847@lor.one-eyed-alien.net> <20090424214753.GA42835@hades.panopticon> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jRHKVT23PllUwdXP" Content-Disposition: inline In-Reply-To: <20090424214753.GA42835@hades.panopticon> User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Fri, 24 Apr 2009 17:03:58 -0500 (CDT) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Brooks Davis , Dag-Erling Smorgrav , src-committers@FreeBSD.org Subject: Re: svn commit: r190031 - 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: Fri, 24 Apr 2009 22:05:20 -0000 --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 25, 2009 at 01:47:53AM +0400, Dmitry Marakasov wrote: > * Brooks Davis (brooks@FreeBSD.org) wrote: >=20 > So, any comments on this? Should I submit the PR? Please do submit a pr. I think we should actually change the link check for a check if there are dhcp interfaces marked up and add a press-any key to skip option for laptop users on the plane. The carrier check is bogus because negotiation can take quite a while with some devices as in your case. People who don't want to wait should probably set the delay to 0. -- Brooks --jRHKVT23PllUwdXP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFJ8jdNXY6L6fI4GtQRAqcGAKDC4txyIxLUTzIUPvcG5PUe/zFNawCgyI6T eqD+gn22uv4AgfZXPMOnnQU= =DCf0 -----END PGP SIGNATURE----- --jRHKVT23PllUwdXP-- From owner-svn-src-head@FreeBSD.ORG Fri Apr 24 22:11:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 116661065672; Fri, 24 Apr 2009 22:11:54 +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 F350A8FC0A; Fri, 24 Apr 2009 22:11:53 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3OMBrhl033455; Fri, 24 Apr 2009 22:11:53 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3OMBrWP033454; Fri, 24 Apr 2009 22:11:53 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904242211.n3OMBrWP033454@svn.freebsd.org> From: Robert Watson Date: Fri, 24 Apr 2009 22:11: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: r191476 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Apr 2009 22:11:54 -0000 Author: rwatson Date: Fri Apr 24 22:11:53 2009 New Revision: 191476 URL: http://svn.freebsd.org/changeset/base/191476 Log: In in_purgemaddrs(), remove the inm being freed from the address list before freeing it, rather than vice version, to avoid potential use after free. Reviewed by: bms Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Fri Apr 24 19:05:22 2009 (r191475) +++ head/sys/netinet/in.c Fri Apr 24 22:11:53 2009 (r191476) @@ -1079,8 +1079,8 @@ in_purgemaddrs(struct ifnet *ifp) IF_ADDR_UNLOCK(ifp); LIST_FOREACH_SAFE(inm, &purgeinms, inm_link, tinm) { - inm_release_locked(inm); LIST_REMOVE(inm, inm_link); + inm_release_locked(inm); } igmp_ifdetach(ifp); From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 00:04:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECE9C1065670; Sat, 25 Apr 2009 00:04:36 +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 C166B8FC0C; Sat, 25 Apr 2009 00:04:36 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3P04aOq035550; Sat, 25 Apr 2009 00:04:36 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3P04aI3035549; Sat, 25 Apr 2009 00:04:36 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904250004.n3P04aI3035549@svn.freebsd.org> From: Ed Schouten Date: Sat, 25 Apr 2009 00:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191477 - head/usr.sbin/xntpd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 25 Apr 2009 00:04:37 -0000 Author: ed Date: Sat Apr 25 00:04:36 2009 New Revision: 191477 URL: http://svn.freebsd.org/changeset/base/191477 Log: Remove ghost xntpd directory. Deleted: head/usr.sbin/xntpd/ From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 02:59:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E52601065674; Sat, 25 Apr 2009 02:59:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA4E68FC1B; Sat, 25 Apr 2009 02:59:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3P2x6hx039584; Sat, 25 Apr 2009 02:59:06 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3P2x60g039582; Sat, 25 Apr 2009 02:59:06 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200904250259.n3P2x60g039582@svn.freebsd.org> From: Alan Cox Date: Sat, 25 Apr 2009 02:59: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: r191478 - 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, 25 Apr 2009 02:59:07 -0000 Author: alc Date: Sat Apr 25 02:59:06 2009 New Revision: 191478 URL: http://svn.freebsd.org/changeset/base/191478 Log: Eliminate unnecessary calls to pmap_clear_modify(). Specifically, calling pmap_clear_modify() on a page is pointless if that page is not mapped or it is only mapped for read access. Instead, assert that the page is not mapped or not mapped for write access as appropriate. Eliminate unnecessary clearing of a page's dirty mask. Instead, assert that the page's dirty mask is clear. Modified: head/sys/vm/swap_pager.c head/sys/vm/vnode_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sat Apr 25 00:04:36 2009 (r191477) +++ head/sys/vm/swap_pager.c Sat Apr 25 02:59:06 2009 (r191478) @@ -1407,10 +1407,6 @@ swp_pager_async_iodone(struct buf *bp) } } else if (bp->b_iocmd == BIO_READ) { /* - * For read success, clear dirty bits. Nobody should - * have this page mapped but don't take any chances, - * make sure the pmap modify bits are also cleared. - * * NOTE: for reads, m->dirty will probably be * overridden by the original caller of getpages so * we cannot set them in order to free the underlying @@ -1427,9 +1423,11 @@ swp_pager_async_iodone(struct buf *bp) * vm_page_wakeup(). We do not set reqpage's * valid bits here, it is up to the caller. */ - pmap_clear_modify(m); + KASSERT(!pmap_page_is_mapped(m), + ("swp_pager_async_iodone: page %p is mapped", m)); m->valid = VM_PAGE_BITS_ALL; - vm_page_undirty(m); + KASSERT(m->dirty == 0, + ("swp_pager_async_iodone: page %p is dirty", m)); /* * We have to wake specifically requested pages @@ -1447,11 +1445,13 @@ swp_pager_async_iodone(struct buf *bp) } } else { /* - * For write success, clear the modify and dirty + * For write success, clear the dirty * status, then finish the I/O ( which decrements the * busy count and possibly wakes waiter's up ). */ - pmap_clear_modify(m); + KASSERT((m->flags & PG_WRITEABLE) == 0, + ("swp_pager_async_iodone: page %p is not write" + " protected", m)); vm_page_undirty(m); vm_page_io_finish(m); if (vm_page_count_severe()) Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Sat Apr 25 00:04:36 2009 (r191477) +++ head/sys/vm/vnode_pager.c Sat Apr 25 02:59:06 2009 (r191478) @@ -944,8 +944,12 @@ vnode_pager_generic_getpages(vp, m, byte * Read filled up entire page. */ mt->valid = VM_PAGE_BITS_ALL; - vm_page_undirty(mt); /* should be an assert? XXX */ - pmap_clear_modify(mt); + KASSERT(mt->dirty == 0, + ("vnode_pager_generic_getpages: page %p is dirty", + mt)); + KASSERT(!pmap_page_is_mapped(mt), + ("vnode_pager_generic_getpages: page %p is mapped", + mt)); } else { /* * Read did not fill up entire page. Since this From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 10:05:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0ACB106564A; Sat, 25 Apr 2009 10:05:55 +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 85AB48FC14; Sat, 25 Apr 2009 10:05:55 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3PA5t6K048495; Sat, 25 Apr 2009 10:05:55 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3PA5t3M048493; Sat, 25 Apr 2009 10:05:55 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904251005.n3PA5t3M048493@svn.freebsd.org> From: Ed Schouten Date: Sat, 25 Apr 2009 10:05: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: r191484 - in head: share/man/man4 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: Sat, 25 Apr 2009 10:05:56 -0000 Author: ed Date: Sat Apr 25 10:05:55 2009 New Revision: 191484 URL: http://svn.freebsd.org/changeset/base/191484 Log: Turn MAXPTSDEVS into a sysctl tunable. This allows users to increase the maximum amount of pseudo-terminals without changing any source code. Users must increase UT_LINESIZE before attempting to increase kern.pts_maxdev. Modified: head/share/man/man4/pts.4 head/sys/kern/tty_pts.c Modified: head/share/man/man4/pts.4 ============================================================================== --- head/share/man/man4/pts.4 Sat Apr 25 06:20:34 2009 (r191483) +++ head/share/man/man4/pts.4 Sat Apr 25 10:05:55 2009 (r191484) @@ -156,6 +156,26 @@ though .It Pa /dev/pts/[num] Pseudo-terminal slave devices. .El +.Sh SYSCTL VARIABLES +The following +.Xr sysctl 8 +variables can be used to modify or monitor +.Nm +behavior. +.Bl -tag -width indent +.It Va kern.pts_maxdev +Highest pseudo-terminal unit number to be allocated. +Because +.Xr utmp 5 +is restricted to an 8-byte line name size, +.Nm +will not create any pseudo-terminals with a unit number above 999 by +default. +After increasing +.Dv UT_LINESIZE , +this variable can be changed to allow more than 1000 pseudo-terminals to +be allocated simultaneously. +.El .Sh DIAGNOSTICS None. .Sh SEE ALSO Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sat Apr 25 06:20:34 2009 (r191483) +++ head/sys/kern/tty_pts.c Sat Apr 25 10:05:55 2009 (r191484) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -58,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -66,8 +68,16 @@ __FBSDID("$FreeBSD$"); #include +/* + * Our utmp(5) format is limited to 8-byte TTY line names. This means + * we can at most allocate 1000 pseudo-terminals ("pts/999"). Allow + * users to increase this number, assuming they have manually increased + * UT_LINESIZE. + */ static struct unrhdr *pts_pool; -#define MAXPTSDEVS 999 +static unsigned int pts_maxdev = 999; +SYSCTL_UINT(_kern, OID_AUTO, pts_maxdev, CTLFLAG_RW, &pts_maxdev, 0, + "Maximum amount of pts(4) pseudo-terminals"); static MALLOC_DEFINE(M_PTS, "pts", "pseudo tty device"); @@ -716,6 +726,11 @@ pts_alloc(int fflags, struct thread *td, chgptscnt(uid, -1, 0); return (EAGAIN); } + if (unit > pts_maxdev) { + free_unr(pts_pool, unit); + chgptscnt(uid, -1, 0); + return (EAGAIN); + } /* Allocate TTY and softc. */ psc = malloc(sizeof(struct pts_softc), M_PTS, M_WAITOK|M_ZERO); @@ -829,7 +844,7 @@ static void pts_init(void *unused) { - pts_pool = new_unrhdr(0, MAXPTSDEVS, NULL); + pts_pool = new_unrhdr(0, INT_MAX, NULL); #if defined(PTS_COMPAT) || defined(PTS_LINUX) make_dev(&ptmx_cdevsw, 0, UID_ROOT, GID_WHEEL, 0666, "ptmx"); #endif /* PTS_COMPAT || PTS_LINUX */ From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 14:13:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A89551065679 for ; Sat, 25 Apr 2009 14:13:28 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id E7BDD8FC28 for ; Sat, 25 Apr 2009 14:13:27 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 25 Apr 2009 14:13:22 -0000 Received: from p54A3C908.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.201.8] by mail.gmx.net (mp061) with SMTP; 25 Apr 2009 16:13:22 +0200 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX1/XICMSyV3XaPFDqiSMXTN4j7l3W0MusfdlyBFE+C pAIaZFOE4MzKUX Message-ID: <49F31A81.8020909@gmx.de> Date: Sat, 25 Apr 2009 16:13:21 +0200 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.21 (X11/20090412) MIME-Version: 1.0 To: Tim Kientzle References: <200904170100.n3H10BQX099580@svn.freebsd.org> In-Reply-To: <200904170100.n3H10BQX099580@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.53 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191177 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 25 Apr 2009 14:13:29 -0000 Tim Kientzle schrieb: > Author: kientzle > Date: Fri Apr 17 01:00:11 2009 > New Revision: 191177 > URL: http://svn.freebsd.org/changeset/base/191177 > > Log: > Don't match an empty file on a read error. > > Modified: > head/lib/libarchive/archive_read_support_format_empty.c > > Modified: head/lib/libarchive/archive_read_support_format_empty.c > ============================================================================== > --- head/lib/libarchive/archive_read_support_format_empty.c Fri Apr 17 00:59:34 2009 (r191176) > +++ head/lib/libarchive/archive_read_support_format_empty.c Fri Apr 17 01:00:11 2009 (r191177) > @@ -59,14 +59,13 @@ archive_read_support_format_empty(struct > static int > archive_read_format_empty_bid(struct archive_read *a) > { > + const void *h; > ssize_t avail; > > - (void)__archive_read_ahead(a, 1, &avail); > - /* Bid 1 if we successfully read exactly zero bytes. */ > - if (avail == 0) > - return (1); > - /* Otherwise, we don't bid on this. */ > - return (-1); > + h = __archive_read_ahead(a, 1, &avail); > + if (avail != 0) > + return (-1); > + return (1); > } > > static int The added variable "h" is write-only - should it get tested after the call? Christoph From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 19:13:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DF6E106566C; Sat, 25 Apr 2009 19:13:58 +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 386A18FC19; Sat, 25 Apr 2009 19:13:58 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id E6D9646B2C; Sat, 25 Apr 2009 15:13:57 -0400 (EDT) Date: Sat, 25 Apr 2009 20:13:57 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Bruce Simpson In-Reply-To: <49EEE63F.2060706@incunabulum.net> Message-ID: References: <200904212243.n3LMhW48027008@svn.freebsd.org> <49EEDB9C.8080409@incunabulum.net> <49EEE63F.2060706@incunabulum.net> 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: r191367 - 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: Sat, 25 Apr 2009 19:13:58 -0000 On Wed, 22 Apr 2009, Bruce Simpson wrote: >> I'm not familiar with the workings of SSM, but my feeling is that it >> probably needs to take the (3) approach rather than (2) -- rather than >> preventing the ifnet from going away until a socket closes, it should >> detect that the ifnet is going away and take appropriate remedial action. >> Possibly it should detect when a similarly configured ifnet re-appears and >> consider attaching to that, but it will most likely be a different instance >> of struct ifnet, and there are semantic considerations. > > SSM isn't high traffic -- it actually reduces the chattiness of IGMP by > implementing per-interface output queues and state change report merges. > Same for MLDv2 in IPv6. Timeliness and stability are what counts, it's > control plane, not data plane. At the moment it mostly does (3) by doing an > ifindex lookup in the netisr dispatch callback before calling ip_output(). > > Of course if ip_output() were to look before it leapt, the book keeping > involved would go away. I have to stash the vimage context and ifindex in > the queued mbuf packet headers to implement this. > > Now that Giant is nuked, the netisr could be eliminated and the ifnet rlock > taken as it is before dispatching an entire chain. I only implemented a > netisr to allow the code to be back-ported, however I don't care about > back-porting any more -- it's too much effort and the time/funding budget > doesn't justify that amount of work. Have you thought about registering a callback with the ifnet_departure_event event handler to handle interfaces disappearing? Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 19:14:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7B81106567C; Sat, 25 Apr 2009 19:14:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C65958FC2B; Sat, 25 Apr 2009 19:14:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3PJEMYm060654; Sat, 25 Apr 2009 19:14:22 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3PJEMhI060653; Sat, 25 Apr 2009 19:14:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200904251914.n3PJEMhI060653@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 25 Apr 2009 19: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: r191490 - head/contrib/ipfilter/ipsend X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 25 Apr 2009 19:14:23 -0000 Author: bz Date: Sat Apr 25 19:14:22 2009 New Revision: 191490 URL: http://svn.freebsd.org/changeset/base/191490 Log: Remove udp and tcp includes not needed here. Tripped over by: a compile of an upcoming change MFC after: 1 month Modified: head/contrib/ipfilter/ipsend/sbpf.c Modified: head/contrib/ipfilter/ipsend/sbpf.c ============================================================================== --- head/contrib/ipfilter/ipsend/sbpf.c Sat Apr 25 13:52:47 2009 (r191489) +++ head/contrib/ipfilter/ipsend/sbpf.c Sat Apr 25 19:14:22 2009 (r191490) @@ -28,9 +28,6 @@ #include #include #include -#include -#include -#include #include #include From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 20:31:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0197A1065670; Sat, 25 Apr 2009 20:31:48 +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 E39C08FC14; Sat, 25 Apr 2009 20:31:47 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3PKVlFC062081; Sat, 25 Apr 2009 20:31:47 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3PKVlmM062080; Sat, 25 Apr 2009 20:31:47 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200904252031.n3PKVlmM062080@svn.freebsd.org> From: Marius Strobl Date: Sat, 25 Apr 2009 20:31: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: r191491 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 25 Apr 2009 20:31:48 -0000 Author: marius Date: Sat Apr 25 20:31:47 2009 New Revision: 191491 URL: http://svn.freebsd.org/changeset/base/191491 Log: Sync the sparc64 hardware notes with reality, mainly regarding support of sun4u-machines based on USIII and beyond in 7.2-RELEASE. Reviewed by: blackend MFC after: 3 days Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Apr 25 19:14:22 2009 (r191490) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Apr 25 20:31:47 2009 (r191491) @@ -331,10 +331,13 @@ SMP is supported on all systems with more than 1 processor. - In general, &os;/&arch.sparc64; systems must use serial - consoles. While it is possible to boot or install a system - using the OpenFirmware console, the console device is not - usable. + When using the GENERIC kernel, + &os;/&arch.sparc64; systems not equipped with a framebuffer + supported by the &man.creator.4; (&sun; Creator, &sun; Creator3D + and &sun; Elite3D) or &man.machfb.4; (&sun; PGX and &sun; PGX64 + as well as the ATI Mach64 chips found onboard in for example + &sun.blade; 100, &sun.blade; 150, &sun.ultra; 5 and &sun.ultra; 10) + driver must use the serial console. If you have a system that is not listed here, it may not have been tested with &os; &release.current;. We encourage @@ -353,6 +356,10 @@ + &sun.enterprise; 100 + + + &sun.enterprise; 220R @@ -409,6 +416,14 @@ + &sparcengine; Ultra AX1105 + + + + &sparcengine; Ultra AXe + + + &sparcengine; Ultra AXi @@ -447,11 +462,17 @@ &sun.ultra; 80 + + + &sun.ultra; 450 + The following systems are partially supported by &os;. In - particular the onboard SCSI controller in sbus systems is not - supported. + particular the fibre channel controllers in SBus-based systems are not + supported. However, it's possible to use these with a SCSI controller + supported by the &man.esp.4 driver (&sun; ESP SCSI, &sun; FAS Fast-SCSI + and &sun; FAS366 Fast-Wide SCSI controllers). @@ -463,15 +484,54 @@ - The following systems are not supported by &os;. This may - be due to lack of processor support (&ultrasparc; III), due to - a quirk in the system design that makes &os; unstable, or due - to lack of support for sufficient onboard devices to make &os; - generally useful. + Starting with 7.2-RELEASE, &arch.sparc64; systems based on + &ultrasparc; III and beyond are also supported by &os, which includes + the following known working systems: + + + + &sun.blade; 1000 + + + + &sun.blade; 1500 + + + + &sun.blade; 2000 + + + + &sun.fire; 280R + + + + &sun.fire; V210 + + + + &sun.fire; V440 (except for the on-board NICs) + + + + &sun.fire; V880 + + + + &netra; 20/&netra; T4 + + + + The following &ultrasparc; IIIi systems are not tested but + believed to be also supported by &os. - All systems containing &ultrasparc; III processor(s). + &sun.fire; V125 + + + + &sun.fire; V240 @@ -1618,9 +1678,6 @@ [&arch.pc98;] Power Management Controller of NEC PC-98 Note (pmc driver) - - [&arch.sparc64;] OpenFirmware console (ofwcons - driver) From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 20:36:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EA4B1065672; Sat, 25 Apr 2009 20:36:51 +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 2D2D38FC14; Sat, 25 Apr 2009 20:36:51 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3PKapvZ062245; Sat, 25 Apr 2009 20:36:51 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3PKapxd062244; Sat, 25 Apr 2009 20:36:51 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200904252036.n3PKapxd062244@svn.freebsd.org> From: Marius Strobl Date: Sat, 25 Apr 2009 20:36:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191492 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 25 Apr 2009 20:36:51 -0000 Author: marius Date: Sat Apr 25 20:36:50 2009 New Revision: 191492 URL: http://svn.freebsd.org/changeset/base/191492 Log: s/it's/it is/ Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Apr 25 20:31:47 2009 (r191491) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Apr 25 20:36:50 2009 (r191492) @@ -470,7 +470,7 @@ The following systems are partially supported by &os;. In particular the fibre channel controllers in SBus-based systems are not - supported. However, it's possible to use these with a SCSI controller + supported. However, it is possible to use these with a SCSI controller supported by the &man.esp.4 driver (&sun; ESP SCSI, &sun; FAS Fast-SCSI and &sun; FAS366 Fast-Wide SCSI controllers). From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 21:07:47 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88624106564A; Sat, 25 Apr 2009 21:07:47 +0000 (UTC) (envelope-from marc@blackend.org) Received: from abigail.blackend.org (ns0.blackend.org [82.227.222.164]) by mx1.freebsd.org (Postfix) with ESMTP id F04D98FC1F; Sat, 25 Apr 2009 21:07:46 +0000 (UTC) (envelope-from marc@blackend.org) Received: from gothic.blackend.org (gothic.blackend.org [192.168.1.203]) by abigail.blackend.org (8.13.4/8.13.3) with ESMTP id n3PKtqIX039983; Sat, 25 Apr 2009 22:55:52 +0200 (CEST) (envelope-from marc@abigail.blackend.org) Received: from gothic.blackend.org (localhost [127.0.0.1]) by gothic.blackend.org (8.14.3/8.14.1) with ESMTP id n3PKtqt0001469; Sat, 25 Apr 2009 22:55:52 +0200 (CEST) (envelope-from marc@gothic.blackend.org) Received: (from marc@localhost) by gothic.blackend.org (8.14.3/8.14.3/Submit) id n3PKtqSB001468; Sat, 25 Apr 2009 22:55:52 +0200 (CEST) (envelope-from marc) Date: Sat, 25 Apr 2009 22:55:51 +0200 From: Marc Fonvieille To: Marius Strobl Message-ID: <20090425205551.GA1047@gothic.blackend.org> References: <200904252031.n3PKVlmM062080@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200904252031.n3PKVlmM062080@svn.freebsd.org> X-Useless-Header: blackend.org X-Operating-System: FreeBSD 7.2-PRERELEASE User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191491 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 25 Apr 2009 21:07:48 -0000 On Sat, Apr 25, 2009 at 08:31:47PM +0000, Marius Strobl wrote: > Author: marius > Date: Sat Apr 25 20:31:47 2009 > New Revision: 191491 > URL: http://svn.freebsd.org/changeset/base/191491 > > Log: > Sync the sparc64 hardware notes with reality, mainly regarding support > of sun4u-machines based on USIII and beyond in 7.2-RELEASE. > > Reviewed by: blackend > MFC after: 3 days re@ would like to have relnotes for 7.2-R ready as soon as possible, so don't wait for 3 days, just merge these changes to both stable/7 and releng/7.2 Thanks, -- Marc From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 21:10:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B7EA1065672; Sat, 25 Apr 2009 21:10:07 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38DE18FC1F; Sat, 25 Apr 2009 21:10:07 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3PLA7ws063075; Sat, 25 Apr 2009 21:10:07 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3PLA6EK063064; Sat, 25 Apr 2009 21:10:06 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904252110.n3PLA6EK063064@svn.freebsd.org> From: Andrew Thompson Date: Sat, 25 Apr 2009 21:10: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: r191494 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 25 Apr 2009 21:10:07 -0000 Author: thompsa Date: Sat Apr 25 21:10:06 2009 New Revision: 191494 URL: http://svn.freebsd.org/changeset/base/191494 Log: Track the usb device state as its powered on, addressed and configured. This helps to avoid touching the device when it is not going to respond and would otherwise timeout. Implement the suspend tracking as a udev state too. Modified: head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/usb_core.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.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_revision.h head/sys/dev/usb/usb_transfer.c Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Sat Apr 25 20:42:21 2009 (r191493) +++ head/sys/dev/usb/controller/ehci.c Sat Apr 25 21:10:06 2009 (r191494) @@ -1964,7 +1964,7 @@ ehci_setup_standard_chain(struct usb2_xf usb2_pc_cpu_flush(qh->page_cache); - if (xfer->xroot->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->state != USB_STATE_SUSPENDED) { EHCI_APPEND_QH(qh, *qh_last); } } Modified: head/sys/dev/usb/controller/ohci.c ============================================================================== --- head/sys/dev/usb/controller/ohci.c Sat Apr 25 20:42:21 2009 (r191493) +++ head/sys/dev/usb/controller/ohci.c Sat Apr 25 21:10:06 2009 (r191494) @@ -1020,7 +1020,7 @@ ohci_check_transfer_sub(struct usb2_xfer * writing the BLF and CLF bits: */ - if (xfer->xroot->udev->pwr_save.suspended) { + if (xfer->xroot->udev->state == USB_STATE_SUSPENDED) { /* nothing to do */ } else if (xfer->pipe->methods == &ohci_device_bulk_methods) { ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus); @@ -1589,7 +1589,7 @@ ohci_setup_standard_chain(struct usb2_xf ed->ed_headp = td->td_self; - if (xfer->xroot->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->state != USB_STATE_SUSPENDED) { /* the append function will flush the endpoint descriptor */ OHCI_APPEND_QH(ed, *ed_last); Modified: head/sys/dev/usb/controller/uhci.c ============================================================================== --- head/sys/dev/usb/controller/uhci.c Sat Apr 25 20:42:21 2009 (r191493) +++ head/sys/dev/usb/controller/uhci.c Sat Apr 25 21:10:06 2009 (r191494) @@ -1921,7 +1921,7 @@ uhci_device_bulk_start(struct usb2_xfer qh->e_next = td; qh->qh_e_next = td->td_self; - if (xfer->xroot->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->state != USB_STATE_SUSPENDED) { UHCI_APPEND_QH(qh, sc->sc_bulk_p_last); uhci_add_loop(sc); xfer->flags_int.bandwidth_reclaimed = 1; @@ -1982,7 +1982,7 @@ uhci_device_ctrl_start(struct usb2_xfer * NOTE: some devices choke on bandwidth- reclamation for control * transfers */ - if (xfer->xroot->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->state != USB_STATE_SUSPENDED) { if (xfer->xroot->udev->speed == USB_SPEED_LOW) { UHCI_APPEND_QH(qh, sc->sc_ls_ctl_p_last); } else { @@ -2071,7 +2071,7 @@ uhci_device_intr_start(struct usb2_xfer qh->e_next = td; qh->qh_e_next = td->td_self; - if (xfer->xroot->udev->pwr_save.suspended == 0) { + if (xfer->xroot->udev->state != USB_STATE_SUSPENDED) { /* enter QHs into the controller data structures */ UHCI_APPEND_QH(qh, sc->sc_intr_p_last[xfer->qh_pos]); Modified: head/sys/dev/usb/usb_core.h ============================================================================== --- head/sys/dev/usb/usb_core.h Sat Apr 25 20:42:21 2009 (r191493) +++ head/sys/dev/usb/usb_core.h Sat Apr 25 21:10:06 2009 (r191494) @@ -552,5 +552,6 @@ void usb2_set_parent_iface(struct usb2_d uint8_t usb2_get_bus_index(struct usb2_device *udev); uint8_t usb2_get_device_index(struct usb2_device *udev); void usb2_set_power_mode(struct usb2_device *udev, uint8_t power_mode); +int usb2_device_attached(struct usb2_device *udev); #endif /* _USB2_CORE_H_ */ Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sat Apr 25 20:42:21 2009 (r191493) +++ head/sys/dev/usb/usb_device.c Sat Apr 25 21:10:06 2009 (r191494) @@ -457,6 +457,8 @@ usb2_set_config_index(struct usb2_device * the current config number and index. */ err = usb2_req_set_config(udev, NULL, USB_UNCONFIG_NO); + if (udev->state == USB_STATE_CONFIGURED) + usb2_set_device_state(udev, USB_STATE_ADDRESSED); goto done; } /* get the full config descriptor */ @@ -524,6 +526,7 @@ usb2_set_config_index(struct usb2_device udev->power = power; udev->curr_config_no = cdp->bConfigurationValue; udev->curr_config_index = index; + usb2_set_device_state(udev, USB_STATE_CONFIGURED); /* Set the actual configuration value. */ err = usb2_req_set_config(udev, NULL, cdp->bConfigurationValue); @@ -980,7 +983,7 @@ usb2_detach_device_sub(struct usb2_devic udev->port_no, udev->address); if (device_is_attached(dev)) { - if (udev->flags.suspended) { + if (udev->state == USB_STATE_SUSPENDED) { err = DEVICE_RESUME(dev); if (err) { device_printf(dev, "Resume failed!\n"); @@ -1120,7 +1123,7 @@ usb2_probe_and_attach_sub(struct usb2_de uaa->temp_dev = NULL; device_set_ivars(iface->subdev, NULL); - if (udev->flags.suspended) { + if (udev->state == USB_STATE_SUSPENDED) { err = DEVICE_SUSPEND(iface->subdev); if (err) device_printf(iface->subdev, "Suspend failed\n"); @@ -1341,12 +1344,12 @@ usb2_suspend_resume(struct usb2_device * USB_BUS_LOCK(udev->bus); /* filter the suspend events */ - if (udev->flags.suspended == do_suspend) { + if ((udev->state == USB_STATE_SUSPENDED && do_suspend) || + (udev->state != USB_STATE_SUSPENDED && !do_suspend)) { USB_BUS_UNLOCK(udev->bus); /* nothing to do */ return (0); } - udev->flags.suspended = do_suspend; USB_BUS_UNLOCK(udev->bus); /* do the suspend or resume */ @@ -1471,6 +1474,7 @@ usb2_alloc_device(device_t parent_dev, s udev->bus = bus; udev->address = USB_START_ADDR; /* default value */ udev->plugtime = (usb2_ticks_t)ticks; + usb2_set_device_state(udev, USB_STATE_POWERED); /* * We need to force the power mode to "on" because there are plenty * of USB devices out there that do not work very well with @@ -1572,6 +1576,7 @@ usb2_alloc_device(device_t parent_dev, s goto done; } } + usb2_set_device_state(udev, USB_STATE_ADDRESSED); /* * Get the first 8 bytes of the device descriptor ! @@ -1927,7 +1932,8 @@ usb2_free_device(struct usb2_device *ude DPRINTFN(4, "udev=%p port=%d\n", udev, udev->port_no); - bus = udev->bus;; + bus = udev->bus; + usb2_set_device_state(udev, USB_STATE_DETACHED); #if USB_HAVE_UGEN usb2_notify_addq("-", udev); @@ -2438,3 +2444,28 @@ usb2_peer_can_wakeup(struct usb2_device } return (0); /* not supported */ } + +void +usb2_set_device_state(struct usb2_device *udev, enum usb_dev_state state) +{ + static const char* statestr[USB_STATE_MAX] = { + [USB_STATE_DETACHED] = "DETACHED", + [USB_STATE_ATTACHED] = "ATTACHED", + [USB_STATE_POWERED] = "POWERED", + [USB_STATE_ADDRESSED] = "ADDRESSED", + [USB_STATE_CONFIGURED] = "CONFIGURED", + [USB_STATE_SUSPENDED] = "SUSPENDED" + }; + + KASSERT(state < USB_STATE_MAX, ("invalid udev state")); + + DPRINTF("udev %p state %s -> %s\n", udev, + statestr[udev->state], statestr[state]); + udev->state = state; +} + +int +usb2_device_attached(struct usb2_device *udev) +{ + return (udev->state > USB_STATE_DETACHED); +} Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Sat Apr 25 20:42:21 2009 (r191493) +++ head/sys/dev/usb/usb_device.h Sat Apr 25 21:10:06 2009 (r191494) @@ -85,7 +85,6 @@ struct usb2_interface { struct usb2_device_flags { uint8_t usb2_mode:1; /* USB mode (see USB_MODE_XXX) */ uint8_t self_powered:1; /* set if USB device is self powered */ - uint8_t suspended:1; /* set if USB device is suspended */ uint8_t no_strings:1; /* set if USB device does not support * strings */ uint8_t remote_wakeup:1; /* set if remote wakeup is enabled */ @@ -101,7 +100,6 @@ struct usb2_power_save { usb2_size_t type_refs[4]; /* transfer reference count */ usb2_size_t read_refs; /* data read references */ usb2_size_t write_refs; /* data write references */ - uint8_t suspended; /* set if USB device is suspended */ }; /* @@ -139,6 +137,7 @@ struct usb2_device { #endif usb2_ticks_t plugtime; /* copy of "ticks" */ + enum usb_dev_state state; uint16_t refcount; #define USB_DEV_REF_MAX 0xffff @@ -205,5 +204,7 @@ void *usb2_find_descriptor(struct usb2_d void usb_linux_free_device(struct usb_device *dev); uint8_t usb2_peer_can_wakeup(struct usb2_device *udev); struct usb2_pipe *usb2_pipe_foreach(struct usb2_device *udev, struct usb2_pipe *pipe); +void usb2_set_device_state(struct usb2_device *udev, + enum usb_dev_state state); #endif /* _USB2_DEVICE_H_ */ Modified: head/sys/dev/usb/usb_generic.c ============================================================================== --- head/sys/dev/usb/usb_generic.c Sat Apr 25 20:42:21 2009 (r191493) +++ head/sys/dev/usb/usb_generic.c Sat Apr 25 21:10:06 2009 (r191494) @@ -823,7 +823,7 @@ usb2_gen_fill_deviceinfo(struct usb2_fif di->udi_speed = udev->speed; di->udi_mode = udev->flags.usb2_mode; di->udi_power_mode = udev->power_mode; - if (udev->flags.suspended) { + if (udev->state == USB_STATE_SUSPENDED) { di->udi_suspended = 1; } else { di->udi_suspended = 0; Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Sat Apr 25 20:42:21 2009 (r191493) +++ head/sys/dev/usb/usb_hub.c Sat Apr 25 21:10:06 2009 (r191494) @@ -544,7 +544,7 @@ uhub_explore(struct usb2_device *udev) if (udev->depth > USB_HUB_MAX_DEPTH) { return (USB_ERR_TOO_DEEP); } - if (udev->pwr_save.suspended) { + if (udev->state == USB_STATE_SUSPENDED) { /* need to wait until the child signals resume */ DPRINTF("Device is suspended!\n"); return (0); @@ -1518,7 +1518,7 @@ usb2_transfer_power_ref(struct usb2_xfer udev->pwr_save.write_refs += val; } - if (udev->pwr_save.suspended) + if (udev->state == USB_STATE_SUSPENDED) needs_explore = (udev->pwr_save.write_refs != 0) || ((udev->pwr_save.read_refs != 0) && @@ -1600,7 +1600,7 @@ usb2_bus_powerd(struct usb2_bus *bus) (rem_wakeup == 0))) { /* check if we are suspended */ - if (udev->pwr_save.suspended != 0) { + if (udev->state == USB_STATE_SUSPENDED) { USB_BUS_UNLOCK(bus); usb2_dev_resume_peer(udev); USB_BUS_LOCK(bus); @@ -1608,7 +1608,7 @@ usb2_bus_powerd(struct usb2_bus *bus) } else if (temp >= limit) { /* check if we are not suspended */ - if (udev->pwr_save.suspended == 0) { + if (udev->state != USB_STATE_SUSPENDED) { USB_BUS_UNLOCK(bus); usb2_dev_suspend_peer(udev); USB_BUS_LOCK(bus); @@ -1647,7 +1647,7 @@ usb2_bus_powerd(struct usb2_bus *bus) if (temp < mintime) mintime = temp; - if (udev->pwr_save.suspended == 0) { + if (udev->state != USB_STATE_SUSPENDED) { type_refs[0] += udev->pwr_save.type_refs[0]; type_refs[1] += udev->pwr_save.type_refs[1]; type_refs[2] += udev->pwr_save.type_refs[2]; @@ -1697,7 +1697,7 @@ usb2_dev_resume_peer(struct usb2_device return; /* check if already resumed */ - if (udev->pwr_save.suspended == 0) + if (udev->state != USB_STATE_SUSPENDED) return; /* we need a parent HUB to do resume */ @@ -1737,7 +1737,7 @@ usb2_dev_resume_peer(struct usb2_device } USB_BUS_LOCK(bus); /* set that this device is now resumed */ - udev->pwr_save.suspended = 0; + usb2_set_device_state(udev, USB_STATE_CONFIGURED); #if USB_HAVE_POWERD /* make sure that we don't go into suspend right away */ udev->pwr_save.last_xfer_time = ticks; @@ -1797,7 +1797,7 @@ repeat: return; /* check if already suspended */ - if (udev->pwr_save.suspended) + if (udev->state == USB_STATE_SUSPENDED) return; /* we need a parent HUB to do suspend */ @@ -1819,7 +1819,7 @@ repeat: if (child == NULL) continue; - if (child->pwr_save.suspended) + if (child->state == USB_STATE_SUSPENDED) continue; DPRINTFN(1, "Port %u is busy on the HUB!\n", x + 1); @@ -1846,7 +1846,7 @@ repeat: * Set that this device is suspended. This variable must be set * before calling USB controller suspend callbacks. */ - udev->pwr_save.suspended = 1; + usb2_set_device_state(udev, USB_STATE_SUSPENDED); USB_BUS_UNLOCK(udev->bus); if (udev->bus->methods->device_suspend != NULL) { Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Sat Apr 25 20:42:21 2009 (r191493) +++ head/sys/dev/usb/usb_request.c Sat Apr 25 21:10:06 2009 (r191494) @@ -271,6 +271,12 @@ usb2_do_request_flags(struct usb2_device req->wIndex[1], req->wIndex[0], req->wLength[1], req->wLength[0]); + /* Check if the device is still alive */ + if (udev->state < USB_STATE_POWERED) { + DPRINTF("usb device has gone\n"); + return (USB_ERR_NOT_CONFIGURED); + } + /* * Set "actlen" to a known value in case the caller does not * check the return value: Modified: head/sys/dev/usb/usb_revision.h ============================================================================== --- head/sys/dev/usb/usb_revision.h Sat Apr 25 20:42:21 2009 (r191493) +++ head/sys/dev/usb/usb_revision.h Sat Apr 25 21:10:06 2009 (r191494) @@ -62,4 +62,16 @@ enum { USB_MODE_MAX }; +/* + * The "USB_MODE" macro defines all the supported device states. + */ +enum usb_dev_state { + USB_STATE_DETACHED, + USB_STATE_ATTACHED, + USB_STATE_POWERED, + USB_STATE_ADDRESSED, + USB_STATE_CONFIGURED, + USB_STATE_SUSPENDED, + USB_STATE_MAX, +}; #endif /* _USB2_REVISION_H_ */ Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Sat Apr 25 20:42:21 2009 (r191493) +++ head/sys/dev/usb/usb_transfer.c Sat Apr 25 21:10:06 2009 (r191494) @@ -1365,24 +1365,37 @@ error: void usb2_start_hardware(struct usb2_xfer *xfer) { + struct usb2_xfer_root *info; + struct usb2_bus *bus; usb2_frcount_t x; + info = xfer->xroot; + bus = info->bus; + DPRINTF("xfer=%p, pipe=%p, nframes=%d, dir=%s\n", xfer, xfer->pipe, xfer->nframes, USB_GET_DATA_ISREAD(xfer) ? "read" : "write"); + /* Check if the device is still alive */ + if (info->udev->state < USB_STATE_POWERED) { + USB_BUS_LOCK(bus); + usb2_transfer_done(xfer, USB_ERR_NOT_CONFIGURED); + USB_BUS_UNLOCK(bus); + return; + } + #if USB_DEBUG if (USB_DEBUG_VAR > 0) { - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); usb2_dump_pipe(xfer->pipe); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); } #endif USB_XFER_LOCK_ASSERT(xfer, MA_OWNED); - USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_NOTOWNED); + USB_BUS_LOCK_ASSERT(bus, MA_NOTOWNED); /* Only open the USB transfer once! */ if (!xfer->flags_int.open) { @@ -1390,9 +1403,9 @@ usb2_start_hardware(struct usb2_xfer *xf DPRINTF("open\n"); - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); (xfer->pipe->methods->open) (xfer); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); } /* set "transferring" flag */ xfer->flags_int.transferring = 1; @@ -1406,9 +1419,9 @@ usb2_start_hardware(struct usb2_xfer *xf * frequently the "done_q": */ if (xfer->wait_queue) { - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); usb2_transfer_dequeue(xfer); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); } /* clear "did_dma_delay" flag */ xfer->flags_int.did_dma_delay = 0; @@ -1441,16 +1454,16 @@ usb2_start_hardware(struct usb2_xfer *xf */ DPRINTF("xfer=%p nframes=0: stall " "or clear stall!\n", xfer); - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); xfer->flags_int.can_cancel_immed = 1; /* start the transfer */ usb2_command_wrapper(&xfer->pipe->pipe_q, xfer); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); return; } - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); usb2_transfer_done(xfer, USB_ERR_INVAL); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); return; } /* compute total transfer length */ @@ -1459,9 +1472,9 @@ usb2_start_hardware(struct usb2_xfer *xf xfer->sumlen += xfer->frlengths[x]; if (xfer->sumlen < xfer->frlengths[x]) { /* length wrapped around */ - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); usb2_transfer_done(xfer, USB_ERR_INVAL); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); return; } } @@ -1476,9 +1489,9 @@ usb2_start_hardware(struct usb2_xfer *xf if (xfer->flags_int.control_xfr) { if (usb2_start_hardware_sub(xfer)) { - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); usb2_transfer_done(xfer, USB_ERR_STALLED); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); return; } } From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 21:25:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E71BA106566C; Sat, 25 Apr 2009 21:25:52 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB40C8FC1B; Sat, 25 Apr 2009 21:25:52 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3PLPqpd063560; Sat, 25 Apr 2009 21:25:52 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3PLPqvZ063558; Sat, 25 Apr 2009 21:25:52 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904252125.n3PLPqvZ063558@svn.freebsd.org> From: Andrew Thompson Date: Sat, 25 Apr 2009 21:25:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191498 - 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: Sat, 25 Apr 2009 21:25:53 -0000 Author: thompsa Date: Sat Apr 25 21:25:52 2009 New Revision: 191498 URL: http://svn.freebsd.org/changeset/base/191498 Log: Make the state string descriptions public. Modified: head/sys/dev/usb/usb_core.h head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_core.h ============================================================================== --- head/sys/dev/usb/usb_core.h Sat Apr 25 21:16:06 2009 (r191497) +++ head/sys/dev/usb/usb_core.h Sat Apr 25 21:25:52 2009 (r191498) @@ -515,6 +515,7 @@ typedef struct malloc_type *usb2_malloc_ /* prototypes */ const char *usb2_errstr(usb2_error_t error); +const char *usb2_statestr(enum usb_dev_state state); struct usb2_config_descriptor *usb2_get_config_descriptor( struct usb2_device *udev); struct usb2_device_descriptor *usb2_get_device_descriptor( Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sat Apr 25 21:16:06 2009 (r191497) +++ head/sys/dev/usb/usb_device.c Sat Apr 25 21:25:52 2009 (r191498) @@ -90,6 +90,22 @@ int usb2_template = 0; SYSCTL_INT(_hw_usb2, OID_AUTO, template, CTLFLAG_RW, &usb2_template, 0, "Selected USB device side template"); +static const char* statestr[USB_STATE_MAX] = { + [USB_STATE_DETACHED] = "DETACHED", + [USB_STATE_ATTACHED] = "ATTACHED", + [USB_STATE_POWERED] = "POWERED", + [USB_STATE_ADDRESSED] = "ADDRESSED", + [USB_STATE_CONFIGURED] = "CONFIGURED", + [USB_STATE_SUSPENDED] = "SUSPENDED" +}; + +const char * +usb2_statestr(enum usb_dev_state state) +{ + KASSERT(state < USB_STATE_MAX, ("invalid udev state")); + + return (statestr[state]); +} /*------------------------------------------------------------------------* * usb2_get_pipe_by_addr @@ -2448,19 +2464,11 @@ usb2_peer_can_wakeup(struct usb2_device void usb2_set_device_state(struct usb2_device *udev, enum usb_dev_state state) { - static const char* statestr[USB_STATE_MAX] = { - [USB_STATE_DETACHED] = "DETACHED", - [USB_STATE_ATTACHED] = "ATTACHED", - [USB_STATE_POWERED] = "POWERED", - [USB_STATE_ADDRESSED] = "ADDRESSED", - [USB_STATE_CONFIGURED] = "CONFIGURED", - [USB_STATE_SUSPENDED] = "SUSPENDED" - }; KASSERT(state < USB_STATE_MAX, ("invalid udev state")); DPRINTF("udev %p state %s -> %s\n", udev, - statestr[udev->state], statestr[state]); + usb2_statestr(udev->state), usb2_statestr(state)); udev->state = state; } From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 21:48:48 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFA27106564A; Sat, 25 Apr 2009 21:48:48 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 604608FC08; Sat, 25 Apr 2009 21:48:48 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.3/8.14.3/ALCHEMY.FRANKEN.DE) with ESMTP id n3PLmkrj048099; Sat, 25 Apr 2009 23:48:47 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.3/8.14.3/Submit) id n3PLmkEt048098; Sat, 25 Apr 2009 23:48:46 +0200 (CEST) (envelope-from marius) Date: Sat, 25 Apr 2009 23:48:46 +0200 From: Marius Strobl To: Marc Fonvieille Message-ID: <20090425214846.GJ50221@alchemy.franken.de> References: <200904252031.n3PKVlmM062080@svn.freebsd.org> <20090425205551.GA1047@gothic.blackend.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090425205551.GA1047@gothic.blackend.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r191491 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 25 Apr 2009 21:48:49 -0000 On Sat, Apr 25, 2009 at 10:55:51PM +0200, Marc Fonvieille wrote: > On Sat, Apr 25, 2009 at 08:31:47PM +0000, Marius Strobl wrote: > > Author: marius > > Date: Sat Apr 25 20:31:47 2009 > > New Revision: 191491 > > URL: http://svn.freebsd.org/changeset/base/191491 > > > > Log: > > Sync the sparc64 hardware notes with reality, mainly regarding support > > of sun4u-machines based on USIII and beyond in 7.2-RELEASE. > > > > Reviewed by: blackend > > MFC after: 3 days > > re@ would like to have relnotes for 7.2-R ready as soon as possible, so > don't wait for 3 days, just merge these changes to both stable/7 and > releng/7.2 > There are tons of unmerged formatting and whitespace differences causing conflicts; I'll see what I can do. Marius From owner-svn-src-head@FreeBSD.ORG Sat Apr 25 23:02:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1813D1065678; Sat, 25 Apr 2009 23:02:58 +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 05D378FC16; Sat, 25 Apr 2009 23:02:58 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3PN2vcF065729; Sat, 25 Apr 2009 23:02:57 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3PN2vcG065728; Sat, 25 Apr 2009 23:02:57 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904252302.n3PN2vcG065728@svn.freebsd.org> From: Robert Watson Date: Sat, 25 Apr 2009 23:02: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: r191500 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Apr 2009 23:02:58 -0000 Author: rwatson Date: Sat Apr 25 23:02:57 2009 New Revision: 191500 URL: http://svn.freebsd.org/changeset/base/191500 Log: Expand coverage of IF_ADDR_LOCK() in in_control() from point of initial lookup of 'ia' from if_addrhead through most use. Note that we currently have to drop it prematurely in some cases due to calls out to the routing and interface code while using 'ia', but this closes many races. Annotate several potential races that persist after this change. Move to using M_NOWAIT for allocating new interface addresses due to lock(s) being held. MFC after: 3 weeks Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sat Apr 25 21:32:48 2009 (r191499) +++ head/sys/netinet/in.c Sat Apr 25 23:02:57 2009 (r191500) @@ -320,6 +320,7 @@ in_control(struct socket *so, u_long cmd break; } } + IF_ADDR_LOCK(ifp); if (ia == NULL) { TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { iap = ifatoia(ifa); @@ -336,6 +337,7 @@ in_control(struct socket *so, u_long cmd if (ia == NULL) iaIsFirst = 1; + error = 0; switch (cmd) { case SIOCAIFADDR: case SIOCDIFADDR: @@ -350,24 +352,27 @@ in_control(struct socket *so, u_long cmd && (cmd == SIOCAIFADDR) && (ifra->ifra_dstaddr.sin_addr.s_addr == INADDR_ANY)) { - return (EDESTADDRREQ); + error = EDESTADDRREQ; + goto out_unlock; } } - if (cmd == SIOCDIFADDR && ia == NULL) - return (EADDRNOTAVAIL); + if (cmd == SIOCDIFADDR && ia == NULL) { + error = EADDRNOTAVAIL; + goto out_unlock; + } /* FALLTHROUGH */ case SIOCSIFADDR: case SIOCSIFNETMASK: case SIOCSIFDSTADDR: if (ia == NULL) { ia = (struct in_ifaddr *) - malloc(sizeof *ia, M_IFADDR, M_WAITOK | M_ZERO); - if (ia == NULL) - return (ENOBUFS); - /* - * Protect from ipintr() traversing address list - * while we're modifying it. - */ + malloc(sizeof *ia, M_IFADDR, M_NOWAIT | + M_ZERO); + if (ia == NULL) { + error = ENOBUFS; + goto out_unlock; + } + ifa = &ia->ia_ifa; IFA_LOCK_INIT(ifa); ifa->ifa_addr = (struct sockaddr *)&ia->ia_addr; @@ -383,9 +388,7 @@ in_control(struct socket *so, u_long cmd } ia->ia_ifp = ifp; - IF_ADDR_LOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); s = splnet(); TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); splx(s); @@ -398,37 +401,60 @@ in_control(struct socket *so, u_long cmd case SIOCGIFNETMASK: case SIOCGIFDSTADDR: case SIOCGIFBRDADDR: - if (ia == NULL) - return (EADDRNOTAVAIL); + if (ia == NULL) { + error = EADDRNOTAVAIL; + goto out_unlock; + } break; } - switch (cmd) { + /* + * Most paths in this switch return directly or via out_unlock. Only + * paths that remove the address break in order to hit common removal + * code. + * + * XXXRW: We enter the switch with IF_ADDR_LOCK() held, but leave + * without it. This is a bug. + */ + IF_ADDR_LOCK_ASSERT(ifp); + switch (cmd) { case SIOCGIFADDR: *((struct sockaddr_in *)&ifr->ifr_addr) = ia->ia_addr; - return (0); + goto out_unlock; case SIOCGIFBRDADDR: - if ((ifp->if_flags & IFF_BROADCAST) == 0) - return (EINVAL); + if ((ifp->if_flags & IFF_BROADCAST) == 0) { + error = EINVAL; + goto out_unlock; + } *((struct sockaddr_in *)&ifr->ifr_dstaddr) = ia->ia_broadaddr; - return (0); + goto out_unlock; case SIOCGIFDSTADDR: - if ((ifp->if_flags & IFF_POINTOPOINT) == 0) - return (EINVAL); + if ((ifp->if_flags & IFF_POINTOPOINT) == 0) { + error = EINVAL; + goto out_unlock; + } *((struct sockaddr_in *)&ifr->ifr_dstaddr) = ia->ia_dstaddr; - return (0); + goto out_unlock; case SIOCGIFNETMASK: *((struct sockaddr_in *)&ifr->ifr_addr) = ia->ia_sockmask; - return (0); + goto out_unlock; case SIOCSIFDSTADDR: - if ((ifp->if_flags & IFF_POINTOPOINT) == 0) - return (EINVAL); + if ((ifp->if_flags & IFF_POINTOPOINT) == 0) { + error = EINVAL; + goto out_unlock; + } oldaddr = ia->ia_dstaddr; ia->ia_dstaddr = *(struct sockaddr_in *)&ifr->ifr_dstaddr; + IF_ADDR_UNLOCK(ifp); + + /* + * XXXRW: Locks dropped for if_ioctl and rtinit, but ia is + * still being used. + */ if (ifp->if_ioctl != NULL) { error = (*ifp->if_ioctl)(ifp, SIOCSIFDSTADDR, (caddr_t)ia); @@ -447,12 +473,20 @@ in_control(struct socket *so, u_long cmd return (0); case SIOCSIFBRDADDR: - if ((ifp->if_flags & IFF_BROADCAST) == 0) - return (EINVAL); + if ((ifp->if_flags & IFF_BROADCAST) == 0) { + error = EINVAL; + goto out_unlock; + } ia->ia_broadaddr = *(struct sockaddr_in *)&ifr->ifr_broadaddr; - return (0); + goto out_unlock; case SIOCSIFADDR: + IF_ADDR_UNLOCK(ifp); + + /* + * XXXRW: Locks dropped for in_ifinit and in_joingroup, but ia + * is still being used. + */ error = in_ifinit(ifp, ia, (struct sockaddr_in *) &ifr->ifr_addr, 1); if (error != 0 && iaIsNew) @@ -471,7 +505,7 @@ in_control(struct socket *so, u_long cmd case SIOCSIFNETMASK: ia->ia_sockmask.sin_addr = ifra->ifra_addr.sin_addr; ia->ia_subnetmask = ntohl(ia->ia_sockmask.sin_addr.s_addr); - return (0); + goto out_unlock; case SIOCAIFADDR: maskIsNew = 0; @@ -485,6 +519,12 @@ in_control(struct socket *so, u_long cmd ia->ia_addr.sin_addr.s_addr) hostIsNew = 0; } + IF_ADDR_UNLOCK(ifp); + + /* + * XXXRW: Locks dropped for in_ifscrub and in_ifinit, but ia + * is still being used. + */ if (ifra->ifra_mask.sin_len) { in_ifscrub(ifp, ia); ia->ia_sockmask = ifra->ifra_mask; @@ -520,10 +560,16 @@ in_control(struct socket *so, u_long cmd return (error); case SIOCDIFADDR: + IF_ADDR_UNLOCK(ifp); + /* + * XXXRW: Locks dropped for in_ifscrub and in_ifadown, but ia + * is still being used. + * * in_ifscrub kills the interface route. */ in_ifscrub(ifp, ia); + /* * in_ifadown gets rid of all the rest of * the routes. This is not quite the right @@ -540,8 +586,8 @@ in_control(struct socket *so, u_long cmd } /* - * Protect from ipintr() traversing address list while we're modifying - * it. + * XXXRW: In a more ideal world, we would still be holding + * IF_ADDR_LOCK here. */ IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); @@ -572,6 +618,10 @@ in_control(struct socket *so, u_long cmd splx(s); return (error); + +out_unlock: + IF_ADDR_UNLOCK(ifp); + return (error); } /*