Re: svn commit: r265472 - head/bin/dd
On Wed, 7 May 2014, Alan Somers wrote: On Tue, May 6, 2014 at 9:47 PM, Bruce Evans b...@optusnet.com.au wrote: On Tue, 6 May 2014, Alan Somers wrote: This is about some minor details that I didn't reply to for later followups. + if (clock_gettime(CLOCK_MONOTONIC_PRECISE, tv)) + err(EX_OSERR, clock_gettime); + if (clock_getres(CLOCK_MONOTONIC_PRECISE, tv_res)) + err(EX_OSERR, clock_getres); clock_getres() is almost useless, and is useless here. It is broken as designed, since the precision may be less than 1 nanosecond but 1 nanosecond is the smallest positive representable value, but that is not a problem here since clock_gettime() also can't distinguish differences smaller than 1 nanosecond. Since it's reporting the clock resolution and not precision, and since clock_gettime() only reports with 1ns resolution, I don't think it's a problem for clock_getres to report with 1ns resolution too. I got most of the backwardness backwards. The syscall is clock_getres(), not clock_getprec(), and the variable name matches this. But what it returns is the precision. The resolution is just that of a timespec (1 nanosecond). No API is needed to report this. APIs are needed to report: - the precision. The API is misnamed clock_getres() - the granularity. This is the minimum time between successive measurements. It can be determined by actually doing some measurements. - the accuracy. No API is available For clocks based on timecounters, we use time timecounter clock period rounded up to nanoseconds for the precision. With a TSC, this is always 1 nanosecond above 1GHz. dd needs more like the granularity than the precision, but it doesn't really matter since the runtime must be much larger than the granularity for the statistics to be accurate, and usually is. The fixup is now only reachable in 3 cases that can't happen: - when the monotonic time goes backwards due to a kernel bug - when the monotonic time doesn't increase, so that the difference is 0. Oops, this can happen for timecounters with very low precision. You don't need to know the precision to check for this. On my Xeon E5504 systems, I can see adjacent calls to clock_gettime return equal values when using one of the _FAST clocks. It can't be proven that this case will never happen with any other clock either, so the program needs to handle it. Hrmph. This is either from the design error of the existence of the _FAST clocks, or from the design error of the existence of TSC-low. First, the _FAST clocks are only supposed to have a resolution of 1/hz. clock_getres() is quite broken here. It returns the timecounter precision for the _FAST clocks too. Also, if it returned 1/hz, then it would be inconsistent with the libc implementation of clock_gettime(). The latter gives gives the timecounter precision. TSC-low intentionally destroys the hardware TSC precision by right shifting, due to FUD and to handle a minor problem above 4GHz. The shift used to be excessive in most cases. On freefall it used to be about 7, so the precision of ~1/2.67 nsec was reduced to ~48 nsec. This was easy to see in tests programs for such things. Now the shift is just 1. Since 11 is less than 2.67, the loss of precision from the shift is less than the loss of precision from converting from bintimes to timespecs. The shift is still a pessimization. sysctl has a read-only tunable kern.timecounter.tsc_shift. Use of this seems to be quite broken. The shift count is determined dynamically, and the tunable barely effects this. The active shift count is not written back to the tunable, so you can't see what it is easy. However, the shift count is now always 1 except in exceptional cases. The tunable defaults to 1. This is for CPU speeds between 2GHz and 4GHz to implement the support for the FUD at these speeds. Above 4GHz, the shift is increased to 2 without changing the tunable. Above 8GHz, the shift is increased to 3. That can't happen yet, but you can tune higher to get a higher shift count at lower speeds. You can also tune to 0 to avoid the shift up to 4GHz. The shift together with some fencing pessimizations that are not even done in the kernel version (only libc) is due to FUD. rdtsc is not a serializing instruction, so its direct use may give surprising results. I think it is serialized with respect to itself on the same CPU. It is obviously not serialized with respect to other instructions on the same CPU. So it doesn't work properly in code like rdtsc; save results; v++; rdtsc; compare results even with quite a bit more than v++ between the rdtsc's. Normally there is much more than v++ between rdtsc's so code like this works well in practice. When the rdtsc's are on separate CPUs, it is just a bug to depend on their order unless there are synchronization instructions for more than the rdtsc's. The old kernel code is sloppy about such things. It tries to do everything without
Re: svn commit: r265472 - head/bin/dd
On Wed, 7 May 2014, Alan Somers wrote: On Tue, May 6, 2014 at 9:47 PM, Bruce Evans b...@optusnet.com.au wrote: On Tue, 6 May 2014, Alan Somers wrote: This is about some minor details that I didn't reply to for later followups. + if (clock_gettime(CLOCK_MONOTONIC_PRECISE, tv)) + err(EX_OSERR, clock_gettime); + if (clock_getres(CLOCK_MONOTONIC_PRECISE, tv_res)) + err(EX_OSERR, clock_getres); clock_getres() is almost useless, and is useless here. It is broken as designed, since the precision may be less than 1 nanosecond but 1 nanosecond is the smallest positive representable value, but that is not a problem here since clock_gettime() also can't distinguish differences smaller than 1 nanosecond. Since it's reporting the clock resolution and not precision, and since clock_gettime() only reports with 1ns resolution, I don't think it's a problem for clock_getres to report with 1ns resolution too. I got most of the backwardness backwards. The syscall is clock_getres(), not clock_getprec(), and the variable name matches this. But what it returns is the precision. The resolution is just that of a timespec (1 nanosecond). No API is needed to report this. APIs are needed to report: - the precision. The API is misnamed clock_getres() - the granularity. This is the minimum time between successive measurements. It can be determined by actually doing some measurements. - the accuracy. No API is available For clocks based on timecounters, we use time timecounter clock period rounded up to nanoseconds for the precision. With a TSC, this is always 1 nanosecond above 1GHz. dd needs more like the granularity than the precision, but it doesn't really matter since the runtime must be much larger than the granularity for the statistics to be accurate, and usually is. The fixup is now only reachable in 3 cases that can't happen: - when the monotonic time goes backwards due to a kernel bug - when the monotonic time doesn't increase, so that the difference is 0. Oops, this can happen for timecounters with very low precision. You don't need to know the precision to check for this. On my Xeon E5504 systems, I can see adjacent calls to clock_gettime return equal values when using one of the _FAST clocks. It can't be proven that this case will never happen with any other clock either, so the program needs to handle it. Hrmph. This is either from the design error of the existence of the _FAST clocks, or from the design error of the existence of TSC-low. First, the _FAST clocks are only supposed to have a resolution of 1/hz. clock_getres() is quite broken here. It returns the timecounter precision for the _FAST clocks too. Also, if it returned 1/hz, then it would be inconsistent with the libc implementation of clock_gettime(). The latter gives gives the timecounter precision. TSC-low intentionally destroys the hardware TSC precision by right shifting, due to FUD and to handle a minor problem above 4GHz. The shift used to be excessive in most cases. On freefall it used to be about 7, so the precision of ~1/2.67 nsec was reduced to ~48 nsec. This was easy to see in tests programs for such things. Now the shift is just 1. Since 11 is less than 2.67, the loss of precision from the shift is less than the loss of precision from converting from bintimes to timespecs. The shift is still a pessimization. sysctl has a read-only tunable kern.timecounter.tsc_shift. Use of this seems to be quite broken. The shift count is determined dynamically, and the tunable barely effects this. The active shift count is not written back to the tunable, so you can't see what it is easy. However, the shift count is now always 1 except in exceptional cases. The tunable defaults to 1. This is for CPU speeds between 2GHz and 4GHz to implement the support for the FUD at these speeds. Above 4GHz, the shift is increased to 2 without changing the tunable. Above 8GHz, the shift is increased to 3. That can't happen yet, but you can tune higher to get a higher shift count at lower speeds. You can also tune to 0 to avoid the shift up to 4GHz. The shift together with some fencing pessimizations that are not even done in the kernel version (only libc) is due to FUD. rdtsc is not a serializing instruction, so its direct use may give surprising results. I think it is serialized with respect to itself on the same CPU. It is obviously not serialized with respect to other instructions on the same CPU. So it doesn't work properly in code like rdtsc; save results; v++; rdtsc; compare results even with quite a bit more than v++ between the rdtsc's. Normally there is much more than v++ between rdtsc's so code like this works well in practice. When the rdtsc's are on separate CPUs, it is just a bug to depend on their order unless there are synchronization instructions for more than the rdtsc's. The old kernel code is sloppy about such things. It tries to do everything without
svn commit: r265666 - in head: sbin/route sys/net
Author: melifaro Date: Thu May 8 11:56:06 2014 New Revision: 265666 URL: http://svnweb.freebsd.org/changeset/base/265666 Log: Fix incorrect netmasks being passed via rtsock. Since radix has been ignoring sa_family in passed sockaddrs, no one ever has bothered filling valid sa_family in netmasks. Additionally, radix adjusts sa_len field in every netmask not to compare zero bytes at all. This leads us to rt_mask with sa_family of AF_UNSPEC (-1) and arbitrary sa_len field (0 for default route, for example). However, rtsock have been passing that rt_mask intact for ages, requiring all rtsock consumers to make ther own local hacks. We even have unfixed on in base: do `route -n monitor` in one window and issue `route -n get addr` for some directly-connected address. You will probably see the following: got message of size 304 on Thu May 8 15:06:06 2014 RTM_GET: Report Metrics: len 304, pid: 30493, seq 1, errno 0, flags:UP,DONE,PINNED locks: inits: sockaddrs: DST,GATEWAY,NETMASK,IFP,IFA 10.0.0.0 link#1 (255) ff em0:8.0.27.c5.29.d4 10.0.0.92 _^^ after the change: got message of size 312 on Thu May 8 15:44:07 2014 RTM_GET: Report Metrics: len 312, pid: 2895, seq 1, errno 0, flags:UP,DONE,PINNED locks: inits: sockaddrs: DST,GATEWAY,NETMASK,IFP,IFA 10.0.0.0 link#1 255.255.255.0 em0:8.0.27.c5.29.d4 10.0.0.92 _^^ Sponsored by: Yandex LLC MFC after:1 month Modified: head/sbin/route/route.c head/sys/net/rtsock.c Modified: head/sbin/route/route.c == --- head/sbin/route/route.c Thu May 8 08:37:32 2014(r265665) +++ head/sbin/route/route.c Thu May 8 11:56:06 2014(r265666) @@ -1727,8 +1727,6 @@ print_getmsg(struct rt_msghdr *rtm, int (sp[RTAX_IFP]-sa_family != AF_LINK || ((struct sockaddr_dl *)(void *)sp[RTAX_IFP])-sdl_nlen == 0)) sp[RTAX_IFP] = NULL; - if (sp[RTAX_DST] sp[RTAX_NETMASK]) - sp[RTAX_NETMASK]-sa_family = sp[RTAX_DST]-sa_family; /* XXX */ if (sp[RTAX_DST]) (void)printf(destination: %s\n, routename(sp[RTAX_DST])); if (sp[RTAX_NETMASK]) Modified: head/sys/net/rtsock.c == --- head/sys/net/rtsock.c Thu May 8 08:37:32 2014(r265665) +++ head/sys/net/rtsock.c Thu May 8 11:56:06 2014(r265666) @@ -162,6 +162,8 @@ static int sysctl_ifmalist(int af, struc static int route_output(struct mbuf *m, struct socket *so); static voidrt_getmetrics(const struct rtentry *rt, struct rt_metrics *out); static voidrt_dispatch(struct mbuf *, sa_family_t); +static struct sockaddr *rtsock_fix_netmask(struct sockaddr *dst, + struct sockaddr *smask, struct sockaddr_storage *dmask); static struct netisr_handler rtsock_nh = { .nh_name = rtsock, @@ -520,8 +522,8 @@ route_output(struct mbuf *m, struct sock struct rtentry *rt = NULL; struct radix_node_head *rnh; struct rt_addrinfo info; -#ifdef INET6 struct sockaddr_storage ss; +#ifdef INET6 struct sockaddr_in6 *sin6; int i, rti_need_deembed = 0; #endif @@ -784,7 +786,8 @@ report: } info.rti_info[RTAX_DST] = rt_key(rt); info.rti_info[RTAX_GATEWAY] = rt-rt_gateway; - info.rti_info[RTAX_NETMASK] = rt_mask(rt); + info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask(rt_key(rt), + rt_mask(rt), ss); info.rti_info[RTAX_GENMASK] = 0; if (rtm-rtm_addrs (RTA_IFP | RTA_IFA)) { ifp = rt-rt_ifp; @@ -967,6 +970,25 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, str } /* + * Fill in @dmask with valid netmask leaving original @smask + * intact. Mostly used with radix netmasks. + */ +static struct sockaddr * +rtsock_fix_netmask(struct sockaddr *dst, struct sockaddr *smask, +struct sockaddr_storage *dmask) +{ + if (dst == NULL || smask == NULL) + return (NULL); + + memset(dmask, 0, dst-sa_len); + memcpy(dmask, smask, smask-sa_len); + dmask-ss_len = dst-sa_len; + dmask-ss_family = dst-sa_family; + + return ((struct sockaddr *)dmask); +} + +/* * Used by the routing socket. */ static struct mbuf * @@ -1247,6 +1269,7 @@ rtsock_addrmsg(int cmd, struct ifaddr *i struct mbuf *m; struct ifa_msghdr *ifam; struct ifnet *ifp = ifa-ifa_ifp; + struct sockaddr_storage ss; if (V_route_cb.any_count == 0) return (0); @@ -1256,7 +1279,8 @@ rtsock_addrmsg(int cmd, struct ifaddr *i bzero((caddr_t)info, sizeof(info)); info.rti_info[RTAX_IFA] = sa = ifa-ifa_addr; info.rti_info[RTAX_IFP] =
svn commit: r265680 - head/sys/dev/vt/hw/fb
Author: ray Date: Thu May 8 13:38:29 2014 New Revision: 265680 URL: http://svnweb.freebsd.org/changeset/base/265680 Log: No need to assign fields required and checked on probe. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/hw/fb/vt_early_fb.c Modified: head/sys/dev/vt/hw/fb/vt_early_fb.c == --- head/sys/dev/vt/hw/fb/vt_early_fb.c Thu May 8 13:31:01 2014 (r265679) +++ head/sys/dev/vt/hw/fb/vt_early_fb.c Thu May 8 13:38:29 2014 (r265680) @@ -291,13 +291,6 @@ vt_efb_init(struct vt_device *vd) /* Get pixel storage size. */ info-fb_bpp = info-fb_stride / info-fb_width * 8; - /* -* Early FB driver work with static window buffer 80x25, so reduce -* size to 640x480. -*/ - info-fb_width = VT_FB_DEFAULT_WIDTH; - info-fb_height = VT_FB_DEFAULT_HEIGHT; - #ifdef FDT vt_efb_initialize(info, node); #else ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265681 - head/sys/dev/vt
Author: ray Date: Thu May 8 13:46:36 2014 New Revision: 265681 URL: http://svnweb.freebsd.org/changeset/base/265681 Log: Fix scrollback. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt_buf.c head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_buf.c == --- head/sys/dev/vt/vt_buf.cThu May 8 13:38:29 2014(r265680) +++ head/sys/dev/vt/vt_buf.cThu May 8 13:46:36 2014(r265681) @@ -448,8 +448,9 @@ vtbuf_grow(struct vt_buf *vb, const term history_size = MAX(history_size, p-tp_row); - if (history_size vb-vb_history_size || p-tp_col - vb-vb_scr_size.tp_col) { + /* If new screen/history size bigger or buffer is VBF_STATIC. */ + if ((history_size vb-vb_history_size) || (p-tp_col + vb-vb_scr_size.tp_col) || (vb-vb_flags VBF_STATIC)) { /* Allocate new buffer. */ bufsize = history_size * p-tp_col * sizeof(term_char_t); new = malloc(bufsize, M_VTBUF, M_WAITOK | M_ZERO); Modified: head/sys/dev/vt/vt_core.c == --- head/sys/dev/vt/vt_core.c Thu May 8 13:38:29 2014(r265680) +++ head/sys/dev/vt/vt_core.c Thu May 8 13:46:36 2014(r265681) @@ -2016,6 +2016,10 @@ vt_upgrade(struct vt_device *vd) /* Start timer when everything ready. */ callout_reset(vd-vd_timer, hz / VT_TIMERFREQ, vt_timer, vd); VT_UNLOCK(vd); + + /* Refill settings with new sizes. */ + vt_resize(vd); + } static void @@ -2090,9 +2094,6 @@ vt_allocate(struct vt_driver *drv, void vt_upgrade(vd); - /* Refill settings with new sizes. */ - vt_resize(vd); - #ifdef DEV_SPLASH if (vd-vd_flags VDF_SPLASH) vtterm_splash(vd); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265682 - head/sys/net
Author: melifaro Date: Thu May 8 13:54:57 2014 New Revision: 265682 URL: http://svnweb.freebsd.org/changeset/base/265682 Log: Rename rt_msg1() to more handy rtsock_msg_mbuf(). (Just for history purposes: rt_msg2() was renamed to rtsock_msg_buffer() in r265019). Sponsored by: Yandex LLC MFC after:1 month Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c == --- head/sys/net/rtsock.c Thu May 8 13:46:36 2014(r265681) +++ head/sys/net/rtsock.c Thu May 8 13:54:57 2014(r265682) @@ -151,7 +151,7 @@ struct walkarg { }; static voidrts_input(struct mbuf *m); -static struct mbuf *rt_msg1(int type, struct rt_addrinfo *rtinfo); +static struct mbuf *rtsock_msg_mbuf(int type, struct rt_addrinfo *rtinfo); static int rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, struct walkarg *w, int *plen); static int rt_xaddrs(caddr_t cp, caddr_t cplim, @@ -989,10 +989,14 @@ rtsock_fix_netmask(struct sockaddr *dst, } /* - * Used by the routing socket. + * Writes information related to @rtinfo object to newly-allocated mbuf. + * Assumes MCLBYTES is enough to construct any message. + * Used for OS notifications of vaious events (if/ifa announces,etc) + * + * Returns allocated mbuf or NULL on failure. */ static struct mbuf * -rt_msg1(int type, struct rt_addrinfo *rtinfo) +rtsock_msg_mbuf(int type, struct rt_addrinfo *rtinfo) { struct rt_msghdr *rtm; struct mbuf *m; @@ -1204,7 +1208,7 @@ rt_missmsg_fib(int type, struct rt_addri if (V_route_cb.any_count == 0) return; - m = rt_msg1(type, rtinfo); + m = rtsock_msg_mbuf(type, rtinfo); if (m == NULL) return; @@ -1243,7 +1247,7 @@ rt_ifmsg(struct ifnet *ifp) if (V_route_cb.any_count == 0) return; bzero((caddr_t)info, sizeof(info)); - m = rt_msg1(RTM_IFINFO, info); + m = rtsock_msg_mbuf(RTM_IFINFO, info); if (m == NULL) return; ifm = mtod(m, struct if_msghdr *); @@ -1282,7 +1286,7 @@ rtsock_addrmsg(int cmd, struct ifaddr *i info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask( info.rti_info[RTAX_IFP], ifa-ifa_netmask, ss); info.rti_info[RTAX_BRD] = ifa-ifa_dstaddr; - if ((m = rt_msg1(ncmd, info)) == NULL) + if ((m = rtsock_msg_mbuf(ncmd, info)) == NULL) return (ENOBUFS); ifam = mtod(m, struct ifa_msghdr *); ifam-ifam_index = ifp-if_index; @@ -1328,7 +1332,7 @@ rtsock_routemsg(int cmd, struct ifnet *i info.rti_info[RTAX_DST] = sa = rt_key(rt); info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask(sa, rt_mask(rt), ss); info.rti_info[RTAX_GATEWAY] = rt-rt_gateway; - if ((m = rt_msg1(cmd, info)) == NULL) + if ((m = rtsock_msg_mbuf(cmd, info)) == NULL) return (ENOBUFS); rtm = mtod(m, struct rt_msghdr *); rtm-rtm_index = ifp-if_index; @@ -1370,7 +1374,7 @@ rt_newmaddrmsg(int cmd, struct ifmultiad * (similarly to how ARP entries, e.g., are presented). */ info.rti_info[RTAX_GATEWAY] = ifma-ifma_lladdr; - m = rt_msg1(cmd, info); + m = rtsock_msg_mbuf(cmd, info); if (m == NULL) return; ifmam = mtod(m, struct ifma_msghdr *); @@ -1391,7 +1395,7 @@ rt_makeifannouncemsg(struct ifnet *ifp, if (V_route_cb.any_count == 0) return NULL; bzero((caddr_t)info, sizeof(*info)); - m = rt_msg1(type, info); + m = rtsock_msg_mbuf(type, info); if (m != NULL) { ifan = mtod(m, struct if_announcemsghdr *); ifan-ifan_index = ifp-if_index; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r265472 - head/bin/dd
On Wed, May 7, 2014 at 9:39 PM, Bruce Evans b...@optusnet.com.au wrote: On Wed, 7 May 2014, Jilles Tjoelker wrote: On Wed, May 07, 2014 at 12:10:31PM -0600, Alan Somers wrote: On Tue, May 6, 2014 at 9:47 PM, Bruce Evans b...@optusnet.com.au wrote: On Tue, 6 May 2014, Alan Somers wrote: ... The solution is to use clock_gettime(2) with CLOCK_MONOTONIC_PRECISE as the clock_id. That clock advances steadily, regardless of changes to the system clock. ... +#include sysexits.h Use of sysexits.h is a style bug. It is not used in BSD or KNF code like dd used to be. sysexits.h is recommended by the err(3) man page. Is that recommendation meant to apply selectively, or is it obsolete, or is some sort of edit war being waged by man page authors? Bug in the err(3) man page. Sort of an edit war. Just 2 FreeBSD committers liked sysexits and used it in their code and added a recommendation to use it in some man pages. But it has negative advantages, and normal BSD programs don't use it. It has been edited in and out of style(9). The recommendation for sysexits.h was incompletely removed, yes. It is still in err(3), and sysexits(3) still justifies itself by pointing to partly-removed words in style(9). err(3) is the last place that should recommend using sysexits. err() gives a nice way of encouraging text descriptions for all exits. With text descriptions, there is almost no need for cryptic numeric exit codes. Only sets of programs that communicate a little status in the exit code should use sysexits (or perhaps their own exit codes, or certain standard exit codes like 126 or 127 for xargs and some other utilities). Some of the uses of the standard exit codes are even. I don't know of any utility except possibly sendmail that documents that it uses sysexits enough for its exit codes to be useful for more than a binary success/fail decision. Certainly not dd after these changes. If its use of sysexits were documented, then the documentation would say dd uses sysexits to report 3 errors that can't happen; otherwise, it uses the normal 2-state exit codes (there is a macro for them. It expands to the concise but grammatically challenged exits 0 on success, and 0 if an error occurs. Here 0 standardises the usual sloppiness of not distinguishing codes between 1 and 127). sysexits(3) now says: % DESCRIPTION % According to style(9), it is not a good practice to call exit(3) with % arbitrary values to indicate a failure condition when ending a program. % Instead, the pre-defined exit codes from sysexits should be used, so the % caller of the process can get a rough estimation about the failure class % without looking up the source code. but style(9) now says: % Exits should be 0 on success, or 1 on failure. % % exit(0);/* % * Avoid obvious comments such as % * Exit 0 on success. % */ % } The latter is not what I asked for either. In previous discussion of this, I think we agreed to at least mention EXIT_SUCCESS and EXIT_FAILURE, and possibly deprecate sysexits. This is a weakened version of the 4.4BSD style rules, which say: % /* %* Exits should be 0 on success, and 1 on failure. Don't denote %* all the possible exit points, using the integers 1 through 300. %*/ % exit(0);/* Avoid obvious comments such as Exit 0 on success. */ The main point of this is to disallow cryptic undocumented exit statuses. Recommending sysexits almost reverses this. It gives cryptic undocumented error statuses that are not even easy to decrypt for programs. Programs can look up sysexits, but without documentation there is no guarantee that the encoding is according to sysexits. Actually documenting use of sysexits would make it even more painful to use. [snip] - st.start = tv.tv_sec + tv.tv_usec * 1e-6; + if (clock_gettime(CLOCK_MONOTONIC_PRECISE, tv)) + err(EX_OSERR, clock_gettime); [snip] + st.start = tv.tv_sec + tv.tv_nsec * 1.0e-9; } The floating point addition starts losing precision after 8388608 seconds (slightly more than 97 days, a plausible uptime for a server). It is better to subtract the timespecs to avoid this issue. No, it is better to use floating point for results that only need to be approximate. Especially when the inputs are approximate and the final approximation doesn't need to be very accurate. Floating point is good for all timespec and timeval calculations, except in the kernel where it is unavailable. timespecs and timevals are mostly used for timeouts, and the kernel isn't very careful about exact timeouts. Short timeouts have inherent large inaccuracy due to interrupt granularity and latency. Long timeouts can be relatively more accurate, but only if the
svn commit: r265686 - head
Author: imp Date: Thu May 8 15:58:34 2014 New Revision: 265686 URL: http://svnweb.freebsd.org/changeset/base/265686 Log: Add usr/share/mk/src.opts.mk to obsolete files. It never should have been installed in the first place, and it must be removed ASAP or weird build errors may start happening in the future if this file is ever taken from the installed system. Add note to UPDATING. Modified: head/ObsoleteFiles.inc head/UPDATING Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Thu May 8 15:33:52 2014(r265685) +++ head/ObsoleteFiles.inc Thu May 8 15:58:34 2014(r265686) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20140505: Bogusly installing src.opts.mk +OLD_FILES+=usr/share/mk/src.opts.mk # 20140505: Reject PR kern/187551 OLD_DIRS+=usr/tests/sbin/ifconfig OLD_FILES+=usr/tests/sbin/ifconfig/Kyuafile Modified: head/UPDATING == --- head/UPDATING Thu May 8 15:33:52 2014(r265685) +++ head/UPDATING Thu May 8 15:58:34 2014(r265686) @@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run ln -s 'abort:false,junk:false' /etc/malloc.conf.) +20140508: + We bogusly installed src.opts.mk in /usr/share/mk. This file should + be removed to avoid issues in the future (and has been added to + ObsoleteFiles.inc). + 20140505: /etc/src.conf now affects only builds of the FreeBSD src tree. In the past, it affected all builds that used the bsd.*.mk files. The old ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265689 - in head/cddl: compat/opensolaris/include compat/opensolaris/misc lib/libzfs
Author: mav Date: Thu May 8 16:59:36 2014 New Revision: 265689 URL: http://svnweb.freebsd.org/changeset/base/265689 Log: Import adapted OpenSolaris' thread pool API implementation. The thread pool is used by libzfs to implement parallel disk scanning. Without this change our dummy wrapper made `zpool import ZZZ` command to scan all disks sequentially from the single thread when searching for pools. This change makes it use two threads per CPU, same as in OpenSolaris. On system with 200 HDDs this change reduces ZFS pool import time from 35 to 22 seconds. Added: head/cddl/compat/opensolaris/misc/thread_pool.c (contents, props changed) head/cddl/compat/opensolaris/misc/thread_pool_impl.h (contents, props changed) Modified: head/cddl/compat/opensolaris/include/thread_pool.h head/cddl/lib/libzfs/Makefile Modified: head/cddl/compat/opensolaris/include/thread_pool.h == --- head/cddl/compat/opensolaris/include/thread_pool.h Thu May 8 16:26:36 2014(r265688) +++ head/cddl/compat/opensolaris/include/thread_pool.h Thu May 8 16:59:36 2014(r265689) @@ -1,39 +1,78 @@ -/*- - * Copyright (c) 2010 Pawel Jakub Dawidek p...@freebsd.org - * All rights reserved. +/* + * CDDL HEADER START * - * 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. + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the License). + * You may not use this file except in compliance with the License. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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. + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets [] replaced with your own identifying + * information: Portions Copyright [] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* * $FreeBSD$ */ -#ifndef _OPENSOLARIS_THREAD_POOL_H_ -#define _OPENSOLARIS_THREAD_POOL_H_ +#ifndef_THREAD_POOL_H_ +#define_THREAD_POOL_H_ + +#pragma ident %Z%%M% %I% %E% SMI + +#include sys/types.h +#include thread.h +#include pthread.h + +#ifdef __cplusplus +extern C { +#endif + +typedefstruct tpool tpool_t; /* opaque thread pool descriptor */ + +#if defined(__STDC__) + +extern tpool_t *tpool_create(uint_t min_threads, uint_t max_threads, + uint_t linger, pthread_attr_t *attr); +extern int tpool_dispatch(tpool_t *tpool, + void (*func)(void *), void *arg); +extern voidtpool_destroy(tpool_t *tpool); +extern voidtpool_abandon(tpool_t *tpool); +extern voidtpool_wait(tpool_t *tpool); +extern voidtpool_suspend(tpool_t *tpool); +extern int tpool_suspended(tpool_t *tpool); +extern voidtpool_resume(tpool_t *tpool); +extern int tpool_member(tpool_t *tpool); + +#else /* Non ANSI */ + +extern tpool_t *tpool_create(); +extern int tpool_dispatch(); +extern voidtpool_destroy(); +extern voidtpool_abandon(); +extern voidtpool_wait(); +extern voidtpool_suspend(); +extern int tpool_suspended(); +extern voidtpool_resume(); +extern int tpool_member(); -typedef int tpool_t; +#endif /* __STDC__ */ -#definetpool_create(a, b, c, d)(0) -#definetpool_dispatch(pool, func, arg)
svn commit: r265690 - head/sys/arm/xilinx
Author: ian Date: Thu May 8 17:20:45 2014 New Revision: 265690 URL: http://svnweb.freebsd.org/changeset/base/265690 Log: Use edge-triggered interrupts rather than polling loops to avoid missing transitions of the INIT_B line. Also, release the mutex during uiomove(). Submitted by: Thomas Skibo thomassk...@sbcglobal.net Modified: head/sys/arm/xilinx/zy7_devcfg.c Modified: head/sys/arm/xilinx/zy7_devcfg.c == --- head/sys/arm/xilinx/zy7_devcfg.cThu May 8 16:59:36 2014 (r265689) +++ head/sys/arm/xilinx/zy7_devcfg.cThu May 8 17:20:45 2014 (r265690) @@ -267,24 +267,35 @@ zy7_devcfg_reset_pl(struct zy7_devcfg_so devcfg_ctl = RD4(sc, ZY7_DEVCFG_CTRL); + /* Clear sticky bits and set up INIT signal positive edge interrupt. */ + WR4(sc, ZY7_DEVCFG_INT_STATUS, ZY7_DEVCFG_INT_ALL); + WR4(sc, ZY7_DEVCFG_INT_MASK, ~ZY7_DEVCFG_INT_PCFG_INIT_PE); + /* Deassert PROG_B (active low). */ devcfg_ctl |= ZY7_DEVCFG_CTRL_PCFG_PROG_B; WR4(sc, ZY7_DEVCFG_CTRL, devcfg_ctl); - /* Wait for INIT_B deasserted (active low). */ - tries = 0; - while ((RD4(sc, ZY7_DEVCFG_STATUS) - ZY7_DEVCFG_STATUS_PCFG_INIT) == 0) { - if (++tries = 100) - return (EIO); - DELAY(5); + /* +* Wait for INIT to assert. If it is already asserted, we may not get +* an edge interrupt so cancel it and continue. +*/ + if ((RD4(sc, ZY7_DEVCFG_STATUS) +ZY7_DEVCFG_STATUS_PCFG_INIT) != 0) { + /* Already asserted. Cancel interrupt. */ + WR4(sc, ZY7_DEVCFG_INT_MASK, ~0); + } + else { + /* Wait for positive edge interrupt. */ + err = mtx_sleep(sc, sc-sc_mtx, PCATCH, zy7i1, hz); + if (err != 0) + return (err); } - - /* Reassert PROG_B. */ + + /* Reassert PROG_B (active low). */ devcfg_ctl = ~ZY7_DEVCFG_CTRL_PCFG_PROG_B; WR4(sc, ZY7_DEVCFG_CTRL, devcfg_ctl); - /* Wait for INIT_B asserted. */ + /* Wait for INIT deasserted. This happens almost instantly. */ tries = 0; while ((RD4(sc, ZY7_DEVCFG_STATUS) ZY7_DEVCFG_STATUS_PCFG_INIT) != 0) { @@ -293,7 +304,7 @@ zy7_devcfg_reset_pl(struct zy7_devcfg_so DELAY(5); } - /* Clear sticky bits and set up INIT_B positive edge interrupt. */ + /* Clear sticky bits and set up INIT positive edge interrupt. */ WR4(sc, ZY7_DEVCFG_INT_STATUS, ZY7_DEVCFG_INT_ALL); WR4(sc, ZY7_DEVCFG_INT_MASK, ~ZY7_DEVCFG_INT_PCFG_INIT_PE); @@ -301,11 +312,11 @@ zy7_devcfg_reset_pl(struct zy7_devcfg_so devcfg_ctl |= ZY7_DEVCFG_CTRL_PCFG_PROG_B; WR4(sc, ZY7_DEVCFG_CTRL, devcfg_ctl); - /* Wait for INIT_B deasserted indicating FPGA internal initialization -* is complete. This takes much longer than the previous waits for -* INIT_B transition (on the order of 700us). + /* +* Wait for INIT asserted indicating FPGA internal initialization +* is complete. */ - err = mtx_sleep(sc, sc-sc_mtx, PCATCH, zy7in, hz); + err = mtx_sleep(sc, sc-sc_mtx, PCATCH, zy7i2, hz); if (err != 0) return (err); @@ -404,7 +415,9 @@ zy7_devcfg_write(struct cdev *dev, struc /* uiomove the data from user buffer to our dma map. */ segsz = MIN(PAGE_SIZE, uio-uio_resid); + DEVCFG_SC_UNLOCK(sc); err = uiomove(dma_mem, segsz, uio); + DEVCFG_SC_LOCK(sc); if (err != 0) break; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265691 - head/sys/netinet
Author: tuexen Date: Thu May 8 17:27:46 2014 New Revision: 265691 URL: http://svnweb.freebsd.org/changeset/base/265691 Log: For some UDP packets (for example with 200 byte payload) and IP options, the IP header and the UDP header are not in the same mbuf. Add code to in_delayed_cksum() to deal with this case. MFC after: 3 days Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c == --- head/sys/netinet/ip_output.cThu May 8 17:20:45 2014 (r265690) +++ head/sys/netinet/ip_output.cThu May 8 17:27:46 2014 (r265691) @@ -887,15 +887,23 @@ in_delayed_cksum(struct mbuf *m) csum = 0x; offset += m-m_pkthdr.csum_data;/* checksum offset */ + /* find the mbuf in the chain where the checksum starts*/ + while ((m != NULL) (offset = m-m_len)) { + offset -= m-m_len; + m = m-m_next; + } + if (m == NULL) { + /* This should not happen. */ + printf(in_delayed_cksum(): checksum outside mbuf chain.\n); + return; + } if (offset + sizeof(u_short) m-m_len) { - printf(delayed m_pullup, m-len: %d off: %d p: %d\n, - m-m_len, offset, ip-ip_p); /* * XXX -* this shouldn't happen, but if it does, the -* correct behavior may be to insert the checksum -* in the appropriate next mbuf in the chain. +* This should not happen, but if it does, it might make more +* sense to fix the caller than to add code to split it here. */ + printf(in_delayed_cksum(): checksum split between mbufs.\n); return; } *(u_short *)(m-m_data + offset) = csum; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r265472 - head/bin/dd
On Thu, 8 May 2014, Alan Somers wrote: On Wed, May 7, 2014 at 9:39 PM, Bruce Evans b...@optusnet.com.au wrote: On Wed, 7 May 2014, Jilles Tjoelker wrote: On Wed, May 07, 2014 at 12:10:31PM -0600, Alan Somers wrote: On Tue, May 6, 2014 at 9:47 PM, Bruce Evans b...@optusnet.com.au wrote: On Tue, 6 May 2014, Alan Somers wrote: [snip] + st.start = tv.tv_sec + tv.tv_nsec * 1.0e-9; } The floating point addition starts losing precision after 8388608 seconds (slightly more than 97 days, a plausible uptime for a server). It is better to subtract the timespecs to avoid this issue. No, it is better to use floating point for results that only need to be approximate. Especially when the inputs are approximate and the final approximation doesn't need to be very accurate. Floating point is good for all timespec and timeval calculations, except in the kernel where it is unavailable. timespecs and timevals are mostly used for timeouts, and the kernel isn't very careful about exact timeouts. Short timeouts have inherent large inaccuracy due to interrupt granularity and latency. Long timeouts can be relatively more accurate, but only if the kernel is careful about them. It is only careful in some places. No, Jilles is right. The problem isn't that dd uses doubles; it's that dd converts longs to doubles _before_ subtracting the values. That causes rounding if the tv_sec values are large. If the implementation of CLOCK_MONOTONIC ever changed to measure time since the Epoch, or something similar, then the rounding error would be extremely significant. Better to subtract the timespecs, then convert to double. Nowhere near a problem. Conversion from long to double is exact up to 2**53 seconds or 285 megayears. So it works for seconds since the POSIX Epoch although not for seconds since the big bang. It would be a problem for floats. Actually, I didn't notice the fragile conversion order. With microseconds, the precision of a double is sufficient for 272 years, so that calculation is probably acceptable. Actually 285 years. A measly 0.285 years in nanoseconds before exactness is lost. The subtraction problem also affects tv_nsec, but is not very serious since it wouldn't hurt to ignore the nanoseconds part of a runtime of 0.285 years. We are 54 years from the Epoch now. That is a bit more than 0.285, so we lose a significant part of the nanoseconds precision. But we get microseconds precision for 285 years since the Epoch. About 5 times that now. ... Bugs in the boot time can be fixed more easily than by micro-adjusting the monotonic clock. Just keep the initial boot time (except adjust it when it was initially local instead of UTC) and frob the real time using a different variable. Export both variables so that applications can compensate for the frobbing at the cost of some complexity. E.g., in uptime(1): clock_gettime(CLOCK_UPTIME, ts); /* * Actually, do the compensations in the kernel for CLOCK_UPTIME. * It doesn't need to be monotonic. But suppose it is the same * as the unfixed CLOCK_MONOTONIC and compensate here. * * Also fix the bogus variable name 'tp'. */ sysctl_mumble(boottime); sysctl_mumble(frobbed_boottime); uptime = ts.tv_sec +- (boottime.tv_sec - frobbed_boottime.tv_sec); Note that the compensation may go backwards, so this method doesn't work in general for monotonic times. However, it can be used if the compensation is non-negative or relatively small negative. dd could use this method. It already has to fix up for zero times and still has parts of the old method that fixes up for negative times. Note that the compensation may be very large across a suspension. You might start dd, SIGSTOP it, suspend the system and restart everything a day later. The compensation would be about 1 day. The average from this wouldn't be very useful, but it would be the same as if dd was stopped for a day but the system was not suspended. Wouldn't it be simpler just for the kernel to adjust CLOCK_MONOTONIC to add suspension time? That works for forward jumps like ones for suspension. BTW, I do a similar adjustment for suspension that is actually sitting in ddb. I only step the real time. My accuracy is better than 10 ppm. Good enough for an ntp server. The stepping is done in rtcintr() on seconds rollover interrupts 3 seconds after ddb has exited and remained inactive, occurding to measurements made every 64 seconds rollover interrupt (the delay is to prevent adjustments while single stepping). Nothing much notices this stepping, but for monotonic time you have to do something about scheduled timeouts. Strictly, stepping the monotonic clock forward by a lot should cause many timeouts to expire. This is the correct behaviour, but it won't happen automatially, and it would cause thundering herds. Cron should have similar scheduling problems after the realtime clock
svn commit: r265694 - in head/sys/arm: arm mv/armadaxp
Author: ian Date: Thu May 8 18:36:42 2014 New Revision: 265694 URL: http://svnweb.freebsd.org/changeset/base/265694 Log: Move the mptramp code which is specific to the Marvell ArmadaXP SoC out of the common locore.S file and into the mv/armadaxp directory. Added: head/sys/arm/mv/armadaxp/mptramp.S (contents, props changed) Modified: head/sys/arm/arm/locore.S head/sys/arm/mv/armadaxp/files.armadaxp Modified: head/sys/arm/arm/locore.S == --- head/sys/arm/arm/locore.S Thu May 8 18:09:32 2014(r265693) +++ head/sys/arm/arm/locore.S Thu May 8 18:36:42 2014(r265694) @@ -349,52 +349,9 @@ pagetable: .word _C_LABEL(cpufuncs) #if defined(SMP) -Lsramaddr: - .word 0x0080 - -#if 0 -#defineAP_DEBUG(tmp) \ - mrc p15, 0, r1, c0, c0, 5; \ - ldr r0, Lsramaddr; \ - add r0, r1, lsl #2; \ - mov r1, tmp;\ - str r1, [r0], #0x; -#else -#define AP_DEBUG(tmp) -#endif - - -ASENTRY_NP(mptramp) - mov r0, #0 - mcr p15, 0, r0, c7, c7, 0 - - AP_DEBUG(#1) - - mrs r3, cpsr - bic r3, r3, #(PSR_MODE) - orr r3, r3, #(PSR_SVC32_MODE) -msrcpsr_fsxc, r3 - - mrc p15, 0, r0, c0, c0, 5 - and r0, #0x0f /* Get CPU ID */ - - /* Read boot address for CPU */ - mov r1, #0x100 - mul r2, r0, r1 - ldr r1, Lpmureg - add r0, r2, r1 - ldr r1, [r0], #0x00 - - mov pc, r1 - -Lpmureg: -.word 0xd0022124 -END(mptramp) ASENTRY_NP(mpentry) - AP_DEBUG(#2) - /* Make sure interrupts are disabled. */ mrs r7, cpsr orr r7, r7, #(I32_bit|F32_bit) @@ -417,8 +374,6 @@ ASENTRY_NP(mpentry) nop nop - AP_DEBUG(#3) - Ltag: ldr r0, Lstartup_pagetable_secondary bic r0, r0, #0xf000 @@ -435,8 +390,6 @@ Ltag: mcr p15, 0, r0, c13, c0, 1 /* Set ASID to 0 */ #endif - AP_DEBUG(#4) - /* Set the Domain Access register. Very important! */ mov r0, #((DOMAIN_CLIENT (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT) mcr p15, 0, r0, c3, c0, 0 Modified: head/sys/arm/mv/armadaxp/files.armadaxp == --- head/sys/arm/mv/armadaxp/files.armadaxp Thu May 8 18:09:32 2014 (r265693) +++ head/sys/arm/mv/armadaxp/files.armadaxp Thu May 8 18:36:42 2014 (r265694) @@ -4,3 +4,5 @@ arm/mv/armadaxp/armadaxp.c standard arm/mv/mpic.c standard arm/mv/rtc.c standard arm/mv/armadaxp/armadaxp_mp.c optional smp +arm/mv/armadaxp/mptramp.S optional smp + Added: head/sys/arm/mv/armadaxp/mptramp.S == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/armadaxp/mptramp.S Thu May 8 18:36:42 2014 (r265694) @@ -0,0 +1,56 @@ +/*- + * Copyright 2011 Semihalf + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include machine/asm.h +#include machine/armreg.h + +__FBSDID($FreeBSD$); + +ASENTRY_NP(mptramp) + mov r0, #0 + mcr p15, 0, r0, c7, c7, 0 + + mrs r3, cpsr + bic r3, r3, #(PSR_MODE) + orr r3, r3, #(PSR_SVC32_MODE) +msrcpsr_fsxc, r3 + + mrc p15, 0, r0, c0, c0, 5 + and r0, #0x0f /* Get CPU ID */ + + /* Read boot address for CPU */ +
svn commit: r265698 - head/bin/dd
Author: asomers Date: Thu May 8 19:10:04 2014 New Revision: 265698 URL: http://svnweb.freebsd.org/changeset/base/265698 Log: Incorporate feedback from bde and jilles regarding r265472 to dd(1). * Don't use sysexits.h. Just exit 1 on error and 0 otherwise. * Don't sacrifice precision by converting the output of clock_gettime() to a double and then comparing the results. Instead, subtract the values of the two clock_gettime() calls, then convert to double. * Don't use CLOCK_MONOTONIC_PRECISE. It's an unportable synonym for CLOCK_MONOTONIC. * Use more appropriate names for some local variables. * In the summary message, round elapsed time to the nearest microsecond. Reported by: bde, jilles MFC after:3 days X-MFC-With: 265472 Modified: head/bin/dd/dd.c head/bin/dd/dd.h head/bin/dd/misc.c Modified: head/bin/dd/dd.c == --- head/bin/dd/dd.cThu May 8 19:08:07 2014(r265697) +++ head/bin/dd/dd.cThu May 8 19:10:04 2014(r265698) @@ -61,7 +61,6 @@ __FBSDID($FreeBSD$); #include stdio.h #include stdlib.h #include string.h -#include sysexits.h #include time.h #include unistd.h @@ -126,7 +125,6 @@ static void setup(void) { u_int cnt; - struct timespec tv; if (in.name == NULL) { in.name = stdin; @@ -245,9 +243,8 @@ setup(void) ctab = casetab; } - if (clock_gettime(CLOCK_MONOTONIC_PRECISE, tv)) - err(EX_OSERR, clock_gettime); - st.start = tv.tv_sec + tv.tv_nsec * 1.0e-9; + if (clock_gettime(CLOCK_MONOTONIC, st.start)) + err(1, clock_gettime); } static void Modified: head/bin/dd/dd.h == --- head/bin/dd/dd.hThu May 8 19:08:07 2014(r265697) +++ head/bin/dd/dd.hThu May 8 19:10:04 2014(r265698) @@ -64,7 +64,7 @@ typedef struct { uintmax_t trunc; /* # of truncated records */ uintmax_t swab; /* # of odd-length swab blocks */ uintmax_t bytes; /* # of bytes written */ - double start; /* start time of dd */ + struct timespec start; /* start time of dd */ } STAT; /* Flags (in ddflags). */ Modified: head/bin/dd/misc.c == --- head/bin/dd/misc.c Thu May 8 19:08:07 2014(r265697) +++ head/bin/dd/misc.c Thu May 8 19:10:04 2014(r265698) @@ -48,7 +48,6 @@ __FBSDID($FreeBSD$); #include stdio.h #include stdlib.h #include string.h -#include sysexits.h #include time.h #include unistd.h @@ -58,18 +57,19 @@ __FBSDID($FreeBSD$); void summary(void) { - struct timespec tv, tv_res; + struct timespec end, ts_res; double secs, res; if (ddflags C_NOINFO) return; - if (clock_gettime(CLOCK_MONOTONIC_PRECISE, tv)) - err(EX_OSERR, clock_gettime); - if (clock_getres(CLOCK_MONOTONIC_PRECISE, tv_res)) - err(EX_OSERR, clock_getres); - secs = tv.tv_sec + tv.tv_nsec * 1.0e-9 - st.start; - res = tv_res.tv_sec + tv_res.tv_nsec * 1.0e-9; + if (clock_gettime(CLOCK_MONOTONIC, end)) + err(1, clock_gettime); + if (clock_getres(CLOCK_MONOTONIC, ts_res)) + err(1, clock_getres); + secs = (end.tv_sec - st.start.tv_sec) + \ + (end.tv_nsec - st.start.tv_nsec) * 1e-9; + res = ts_res.tv_sec + ts_res.tv_nsec * 1e-9; if (secs res) secs = res; (void)fprintf(stderr, @@ -83,7 +83,7 @@ summary(void) st.trunc, (st.trunc == 1) ? block : blocks); if (!(ddflags C_NOXFER)) { (void)fprintf(stderr, - %ju bytes transferred in %.9f secs (%.0f bytes/sec)\n, + %ju bytes transferred in %.6f secs (%.0f bytes/sec)\n, st.bytes, secs, st.bytes / secs); } need_summary = 0; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265703 - in head: share/man/man4 sys/dev/bce sys/dev/bxe sys/modules/bce
Author: davidcs Date: Thu May 8 19:40:37 2014 New Revision: 265703 URL: http://svnweb.freebsd.org/changeset/base/265703 Log: Modify Copyright information and other strings to reflect Qlogic Corporation's purchase of Broadcom's NetXtreme business. Added clean option to Makefile Submitted by:David C Somayajulu (davi...@freebsd.org) QLogic Corporation MFC after:5 days Modified: head/share/man/man4/bce.4 head/share/man/man4/bxe.4 head/sys/dev/bce/if_bce.c head/sys/dev/bce/if_bcefw.h head/sys/dev/bce/if_bcereg.h head/sys/dev/bxe/bxe.c head/sys/modules/bce/Makefile Modified: head/share/man/man4/bce.4 == --- head/share/man/man4/bce.4 Thu May 8 19:35:29 2014(r265702) +++ head/share/man/man4/bce.4 Thu May 8 19:40:37 2014(r265703) @@ -1,5 +1,4 @@ -.\ Copyright (c) 2006 Broadcom Corporation -.\ David Christensen davi...@broadcom.com. All rights reserved. +.\ Copyright (c) 2006-2014 QLogic Corporation .\ .\ Redistribution and use in source and binary forms, with or without .\ modification, are permitted provided that the following conditions @@ -10,9 +9,6 @@ .\ 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. -.\ 3. Neither the name of Broadcom Corporation nor the name of its contributors -.\may be used to endorse or promote products derived from this software -.\without specific prior written consent. .\ .\ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS' .\ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -33,7 +29,7 @@ .Os .Sh NAME .Nm bce -.Nd Broadcom NetXtreme II (BCM5706/5708/5709/5716) PCI/PCIe Gigabit Ethernet adapter driver +.Nd QLogic NetXtreme II (BCM5706/5708/5709/5716) PCI/PCIe Gigabit Ethernet adapter driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -52,7 +48,7 @@ if_bce_load=YES .Sh DESCRIPTION The .Nm -driver supports Broadcom's NetXtreme II product family, including the +driver supports QLogic's NetXtreme II product family, including the BCM5706, BCM5708, BCM5709 and BCM5716 Ethernet controllers. .Pp The NetXtreme II product family is composed of various Converged NIC (or CNIC) @@ -141,25 +137,25 @@ For more information on configuring this .Sh HARDWARE The .Nm -driver provides support for various NICs based on the Broadcom NetXtreme II +driver provides support for various NICs based on the QLogic NetXtreme II family of Gigabit Ethernet controllers, including the following: .Pp .Bl -bullet -compact .It -Broadcom NetXtreme II BCM5706 1000Base-SX +QLogic NetXtreme II BCM5706 1000Base-SX .It -Broadcom NetXtreme II BCM5706 1000Base-T +QLogic NetXtreme II BCM5706 1000Base-T .It -Broadcom NetXtreme II BCM5708 1000Base-SX +QLogic NetXtreme II BCM5708 1000Base-SX .It -Broadcom NetXtreme II BCM5708 1000Base-T +QLogic NetXtreme II BCM5708 1000Base-T .It -Broadcom NetXtreme II BCM5709 1000Base-SX +QLogic NetXtreme II BCM5709 1000Base-SX .It -Broadcom NetXtreme II BCM5709 1000Base-T +QLogic NetXtreme II BCM5709 1000Base-T .It -Broadcom NetXtreme II BCM5716 1000Base-T +QLogic NetXtreme II BCM5716 1000Base-T .It Dell PowerEdge 1950 integrated BCM5708 NIC .It @@ -411,9 +407,11 @@ A controller hardware failure has occurr If the problem continues replace the controller. .El .Sh SUPPORT -For general information and support, -go to the Broadcom NIC Open Source Developer Resource Site: -.Pa http://www.broadcom.com/support/ethernet_nic/open_source.php . +For support questions please contact your QLogic approved reseller or +QLogic Technical Support at +.Pa http://support.qlogic.com , +or by E-mail at +.Aq supp...@qlogic.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , Modified: head/share/man/man4/bxe.4 == --- head/share/man/man4/bxe.4 Thu May 8 19:35:29 2014(r265702) +++ head/share/man/man4/bxe.4 Thu May 8 19:40:37 2014(r265703) @@ -1,4 +1,4 @@ -.\ Copyright (c) 2013 Broadcom Corporation. All rights reserved. +.\ Copyright (c) 2014 Qlogic Corporation. All rights reserved. .\ .\ Redistribution and use in source and binary forms, with or without .\ modification, are permitted provided that the following conditions @@ -9,9 +9,6 @@ .\ 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. -.\ 3. Neither the name of Broadcom Corporation nor the name of its contributors -.\may be used to endorse or promote products derived from this software -.\without specific prior written consent. .\ .\ THIS SOFTWARE IS
svn commit: r265705 - head/sys/arm/arm
Author: ian Date: Thu May 8 20:02:38 2014 New Revision: 265705 URL: http://svnweb.freebsd.org/changeset/base/265705 Log: Consolitate all the AP core startup stuff under a single #ifdef SMP block. Remove some other ifdefs that came in with a copy/paste that mean basically if this processor supports multicore stuff, because if you're starting up an AP core... it does. Modified: head/sys/arm/arm/locore.S Modified: head/sys/arm/arm/locore.S == --- head/sys/arm/arm/locore.S Thu May 8 19:45:31 2014(r265704) +++ head/sys/arm/arm/locore.S Thu May 8 20:02:38 2014(r265705) @@ -308,11 +308,6 @@ Lreal_start: Lend: .word _edata -#ifdef SMP -Lstartup_pagetable_secondary: - .word temp_pagetable -#endif - .Lstart: .word _edata .word _ebss @@ -320,10 +315,6 @@ Lstartup_pagetable_secondary: .Lvirt_done: .word virt_done -#if defined(SMP) -.Lmpvirt_done: - .word mpvirt_done -#endif .Lmainreturned: .asciz main() returned @@ -350,6 +341,11 @@ pagetable: #if defined(SMP) +.Lmpvirt_done: + .word mpvirt_done +Lstartup_pagetable_secondary: + .word temp_pagetable + ASENTRY_NP(mpentry) /* Make sure interrupts are disabled. */ @@ -379,26 +375,20 @@ Ltag: bic r0, r0, #0xf000 orr r0, r0, #PHYSADDR ldr r0, [r0] -#if defined(SMP) orr r0, r0, #2 /* Set TTB shared memory flag */ -#endif mcr p15, 0, r0, c2, c0, 0 /* Set TTB */ mcr p15, 0, r0, c8, c7, 0 /* Flush TLB */ -#if defined(CPU_ARM1136) || defined(CPU_ARM1176) || defined(CPU_MV_PJ4B) || defined(CPU_CORTEXA) || defined(CPU_KRAIT) mov r0, #0 mcr p15, 0, r0, c13, c0, 1 /* Set ASID to 0 */ -#endif /* Set the Domain Access register. Very important! */ mov r0, #((DOMAIN_CLIENT (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT) mcr p15, 0, r0, c3, c0, 0 /* Enable MMU */ mrc p15, 0, r0, c1, c0, 0 -#if defined(CPU_ARM1136) || defined(CPU_ARM1176) || defined(CPU_MV_PJ4B) || defined(CPU_CORTEXA) || defined(CPU_KRAIT) orr r0, r0, #CPU_CONTROL_V6_EXTPAGE orr r0, r0, #CPU_CONTROL_AF_ENABLE -#endif orr r0, r0, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE) mcr p15, 0, r0, c1, c0, 0 nop @@ -426,7 +416,7 @@ mpvirt_done: /* NOTREACHED */ .Lmpreturned: - .asciz main() returned + .asciz init_secondary() returned .align 0 END(mpentry) #endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265706 - head/usr.bin/printf
Author: pfg Date: Thu May 8 20:20:59 2014 New Revision: 265706 URL: http://svnweb.freebsd.org/changeset/base/265706 Log: Fix the incorrect handling of %b and \c in printf(1) This is required for POSIX compliance. Obtained from:Garrett D'Amore (Illumos) MFC after:4 days Modified: head/usr.bin/printf/printf.c Modified: head/usr.bin/printf/printf.c == --- head/usr.bin/printf/printf.cThu May 8 20:02:38 2014 (r265705) +++ head/usr.bin/printf/printf.cThu May 8 20:20:59 2014 (r265706) @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) { size_t len; - int chopped, end, rval; + int end, rval; char *format, *fmt, *start; #ifndef SHELL int ch; @@ -151,7 +151,7 @@ main(int argc, char *argv[]) * up the format string. */ fmt = format = *argv; - chopped = escape(fmt, 1, len); /* backslash interpretation */ + escape(fmt, 1, len); /* backslash interpretation */ rval = end = 0; gargv = ++argv; @@ -195,7 +195,7 @@ main(int argc, char *argv[]) return (1); } fwrite(start, 1, fmt - start, stdout); - if (chopped || !*gargv) { + if (!*gargv) { #ifdef SHELL INTON; #endif @@ -241,8 +241,8 @@ printf_doformat(char *fmt, int *rval) maxargv = gargv; fmt += l + 1; - /* save format argument */ - fargv = gargv; + /* save format argument */ + fargv = gargv; } else { fargv = NULL; } @@ -352,7 +352,7 @@ printf_doformat(char *fmt, int *rval) /* save the current arg offset, and set to the format arg */ if (fargv != NULL) { - gargv = fargv; + gargv = fargv; } convch = *fmt; @@ -371,12 +371,10 @@ printf_doformat(char *fmt, int *rval) return (NULL); } getout = escape(p, 0, len); - *(fmt - 1) = 's'; - PF(start, p); - *(fmt - 1) = 'b'; + fputs(p, stdout); free(p); if (getout) - return (fmt); + exit(*rval); break; } case 'c': { @@ -488,9 +486,13 @@ escape(char *fmt, int percent, size_t *l *store = '\b'; break; case 'c': - *store = '\0'; - *len = store - save; - return (1); + if (!percent) { + *store = '\0'; + *len = store - save; + return (1); + } + *store = 'c'; + break; case 'f': /* form-feed */ *store = '\f'; break; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r265691 - head/sys/netinet
On Thu, May 08, 2014 at 05:27:46PM +, Michael Tuexen wrote: M Author: tuexen M Date: Thu May 8 17:27:46 2014 M New Revision: 265691 M URL: http://svnweb.freebsd.org/changeset/base/265691 M M Log: M For some UDP packets (for example with 200 byte payload) and IP options, M the IP header and the UDP header are not in the same mbuf. M Add code to in_delayed_cksum() to deal with this case. M M MFC after: 3 days M M Modified: M head/sys/netinet/ip_output.c M M Modified: head/sys/netinet/ip_output.c M == M --- head/sys/netinet/ip_output.c Thu May 8 17:20:45 2014 (r265690) M +++ head/sys/netinet/ip_output.c Thu May 8 17:27:46 2014 (r265691) M @@ -887,15 +887,23 @@ in_delayed_cksum(struct mbuf *m) M csum = 0x; M offset += m-m_pkthdr.csum_data;/* checksum offset */ M M +/* find the mbuf in the chain where the checksum starts*/ M +while ((m != NULL) (offset = m-m_len)) { M +offset -= m-m_len; M +m = m-m_next; M +} M +if (m == NULL) { M +/* This should not happen. */ M +printf(in_delayed_cksum(): checksum outside mbuf chain.\n); M +return; M +} M if (offset + sizeof(u_short) m-m_len) { M -printf(delayed m_pullup, m-len: %d off: %d p: %d\n, M -m-m_len, offset, ip-ip_p); M /* M * XXX M - * this shouldn't happen, but if it does, the M - * correct behavior may be to insert the checksum M - * in the appropriate next mbuf in the chain. M + * This should not happen, but if it does, it might make more M + * sense to fix the caller than to add code to split it here. M */ M +printf(in_delayed_cksum(): checksum split between mbufs.\n); M return; M } M *(u_short *)(m-m_data + offset) = csum; If this should not happen really means that we do not expect this issue at all, assuming we are coding correctly, then all these comments and printfs should be converted to KASSERTs. If this should not happen means 'such packets shouldn't arrrive from network, then we need to remove printfs, because having a remotely triggerable printf(9) is a DDoS vulnerability. -- Totus tuus, Glebius. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265709 - in head/sys/dev: mpr mps
Author: ken Date: Thu May 8 20:28:22 2014 New Revision: 265709 URL: http://svnweb.freebsd.org/changeset/base/265709 Log: Fix TLR (Transport Layer Retry) support in the mps(4) and mpr(4) drivers. TLR is necessary for reliable communication with SAS tape drives. This was broken by change 246713 in the mps(4) driver. It changed the cm_data field for SCSI I/O requests to point to the CCB instead of the data buffer. So, instead, look at the CCB's data pointer to determine whether or not we're talking to a tape drive. Also, take the residual into account to make sure that we don't go off the end of the request. MFC after:3 days Sponsored by: Spectra Logic Corporation Modified: head/sys/dev/mpr/mpr_sas.c head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mpr/mpr_sas.c == --- head/sys/dev/mpr/mpr_sas.c Thu May 8 20:27:06 2014(r265708) +++ head/sys/dev/mpr/mpr_sas.c Thu May 8 20:28:22 2014(r265709) @@ -2355,8 +2355,9 @@ mprsas_scsiio_complete(struct mpr_softc (csio-cdb_io.cdb_bytes[1] SI_EVPD) (csio-cdb_io.cdb_bytes[2] == SVPD_SUPPORTED_PAGE_LIST) ((csio-ccb_h.flags CAM_DATA_MASK) == CAM_DATA_VADDR) - (csio-data_ptr != NULL) (((uint8_t *)cm-cm_data)[0] == - T_SEQUENTIAL) (sc-control_TLR) + (csio-data_ptr != NULL) + ((csio-data_ptr[0] 0x1f) == T_SEQUENTIAL) + (sc-control_TLR) (sc-mapping_table[csio-ccb_h.target_id].device_info MPI2_SAS_DEVICE_INFO_SSP_TARGET)) { vpd_list = (struct scsi_vpd_supported_page_list *) @@ -2367,6 +2368,7 @@ mprsas_scsiio_complete(struct mpr_softc TLR_on = (u8)MPI2_SCSIIO_CONTROL_TLR_ON; alloc_len = ((u16)csio-cdb_io.cdb_bytes[3] 8) + csio-cdb_io.cdb_bytes[4]; + alloc_len -= csio-resid; for (i = 0; i MIN(vpd_list-length, alloc_len); i++) { if (vpd_list-list[i] == 0x90) { *TLR_bits = TLR_on; Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Thu May 8 20:27:06 2014(r265708) +++ head/sys/dev/mps/mps_sas.c Thu May 8 20:28:22 2014(r265709) @@ -2316,8 +2316,9 @@ mpssas_scsiio_complete(struct mps_softc (csio-cdb_io.cdb_bytes[1] SI_EVPD) (csio-cdb_io.cdb_bytes[2] == SVPD_SUPPORTED_PAGE_LIST) ((csio-ccb_h.flags CAM_DATA_MASK) == CAM_DATA_VADDR) - (csio-data_ptr != NULL) (((uint8_t *)cm-cm_data)[0] == - T_SEQUENTIAL) (sc-control_TLR) + (csio-data_ptr != NULL) + ((csio-data_ptr[0] 0x1f) == T_SEQUENTIAL) + (sc-control_TLR) (sc-mapping_table[csio-ccb_h.target_id].device_info MPI2_SAS_DEVICE_INFO_SSP_TARGET)) { vpd_list = (struct scsi_vpd_supported_page_list *) @@ -2328,6 +2329,7 @@ mpssas_scsiio_complete(struct mps_softc TLR_on = (u8)MPI2_SCSIIO_CONTROL_TLR_ON; alloc_len = ((u16)csio-cdb_io.cdb_bytes[3] 8) + csio-cdb_io.cdb_bytes[4]; + alloc_len -= csio-resid; for (i = 0; i MIN(vpd_list-length, alloc_len); i++) { if (vpd_list-list[i] == 0x90) { *TLR_bits = TLR_on; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265712 - head/sys/dev/mpr
Author: ken Date: Thu May 8 20:46:46 2014 New Revision: 265712 URL: http://svnweb.freebsd.org/changeset/base/265712 Log: Add #ifdefs in the mpr(4) driver so that versions of stable/9 that have implemented the PIM_NOSCAN rescan functionality will have it enabled. This is a no-op for head. Reviewed by: slm Sponsored by: Spectra Logic Corporation MFC after:3 days Modified: head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mpr_sas_lsi.c Modified: head/sys/dev/mpr/mpr_sas.c == --- head/sys/dev/mpr/mpr_sas.c Thu May 8 20:41:39 2014(r265711) +++ head/sys/dev/mpr/mpr_sas.c Thu May 8 20:46:46 2014(r265712) @@ -183,7 +183,8 @@ mprsas_startup_increment(struct mprsas_s /* just starting, freeze the simq */ mpr_dprint(sassc-sc, MPR_INIT, %s freezing simq\n, __func__); -#if __FreeBSD_version = 139 +#if (__FreeBSD_version = 139) || \ +((__FreeBSD_version 100) (__FreeBSD_version = 902502)) xpt_hold_boot(); #endif xpt_freeze_simq(sassc-sim, 1); @@ -217,7 +218,8 @@ mprsas_startup_decrement(struct mprsas_s %s releasing simq\n, __func__); sassc-flags = ~MPRSAS_IN_STARTUP; xpt_release_simq(sassc-sim, 1); -#if __FreeBSD_version = 139 +#if (__FreeBSD_version = 139) || \ +((__FreeBSD_version 100) (__FreeBSD_version = 902502)) xpt_release_boot(); #else mprsas_rescan_target(sassc-sc, NULL); @@ -974,7 +976,8 @@ mprsas_action(struct cam_sim *sim, union cpi-version_num = 1; cpi-hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16; cpi-target_sprt = 0; -#if __FreeBSD_version = 139 +#if (__FreeBSD_version = 139) || \ +((__FreeBSD_version 100) (__FreeBSD_version = 902502)) cpi-hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED | PIM_NOSCAN; #else cpi-hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED; Modified: head/sys/dev/mpr/mpr_sas_lsi.c == --- head/sys/dev/mpr/mpr_sas_lsi.c Thu May 8 20:41:39 2014 (r265711) +++ head/sys/dev/mpr/mpr_sas_lsi.c Thu May 8 20:46:46 2014 (r265712) @@ -801,7 +801,8 @@ mprsas_add_device(struct mpr_softc *sc, and connector name (%4s)\n, targ-encl_level, targ-connector_name); } -#if __FreeBSD_version 139 +#if ((__FreeBSD_version = 100) (__FreeBSD_version 139)) || \ +(__FreeBSD_version 902502) if ((sassc-flags MPRSAS_IN_STARTUP) == 0) #endif mprsas_rescan_target(sc, targ); @@ -992,7 +993,8 @@ mprsas_volume_add(struct mpr_softc *sc, free(lun, M_MPR); } SLIST_INIT(targ-luns); -#if __FreeBSD_version 139 +#if ((__FreeBSD_version = 100) (__FreeBSD_version 139)) || \ +(__FreeBSD_version 902502) if ((sassc-flags MPRSAS_IN_STARTUP) == 0) #endif mprsas_rescan_target(sc, targ); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265713 - head/sys/netinet
Author: tuexen Date: Thu May 8 20:47:54 2014 New Revision: 265713 URL: http://svnweb.freebsd.org/changeset/base/265713 Log: Use KASSERTs as suggested by glebius@ MFC after: 3 days X-MFC with: 265691 Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c == --- head/sys/netinet/ip_output.cThu May 8 20:46:46 2014 (r265712) +++ head/sys/netinet/ip_output.cThu May 8 20:47:54 2014 (r265713) @@ -892,20 +892,8 @@ in_delayed_cksum(struct mbuf *m) offset -= m-m_len; m = m-m_next; } - if (m == NULL) { - /* This should not happen. */ - printf(in_delayed_cksum(): checksum outside mbuf chain.\n); - return; - } - if (offset + sizeof(u_short) m-m_len) { - /* -* XXX -* This should not happen, but if it does, it might make more -* sense to fix the caller than to add code to split it here. -*/ - printf(in_delayed_cksum(): checksum split between mbufs.\n); - return; - } + KASSERT(m != NULL, (in_delayed_cksum: checksum outside mbuf chain.)); + KASSERT(offset + sizeof(u_short) = m-m_len, (in_delayed_cksum: checksum split between mbufs.)); *(u_short *)(m-m_data + offset) = csum; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r265691 - head/sys/netinet
On 08 May 2014, at 22:23, Gleb Smirnoff gleb...@freebsd.org wrote: On Thu, May 08, 2014 at 05:27:46PM +, Michael Tuexen wrote: M Author: tuexen M Date: Thu May 8 17:27:46 2014 M New Revision: 265691 M URL: http://svnweb.freebsd.org/changeset/base/265691 M M Log: M For some UDP packets (for example with 200 byte payload) and IP options, M the IP header and the UDP header are not in the same mbuf. M Add code to in_delayed_cksum() to deal with this case. M M MFC after: 3 days M M Modified: M head/sys/netinet/ip_output.c M M Modified: head/sys/netinet/ip_output.c M == M --- head/sys/netinet/ip_output.c Thu May 8 17:20:45 2014 (r265690) M +++ head/sys/netinet/ip_output.c Thu May 8 17:27:46 2014 (r265691) M @@ -887,15 +887,23 @@ in_delayed_cksum(struct mbuf *m) Mcsum = 0x; Moffset += m-m_pkthdr.csum_data;/* checksum offset */ M M + /* find the mbuf in the chain where the checksum starts*/ M + while ((m != NULL) (offset = m-m_len)) { M + offset -= m-m_len; M + m = m-m_next; M + } M + if (m == NULL) { M + /* This should not happen. */ M + printf(in_delayed_cksum(): checksum outside mbuf chain.\n); M + return; M + } Mif (offset + sizeof(u_short) m-m_len) { M - printf(delayed m_pullup, m-len: %d off: %d p: %d\n, M - m-m_len, offset, ip-ip_p); M/* M * XXX M - * this shouldn't happen, but if it does, the M - * correct behavior may be to insert the checksum M - * in the appropriate next mbuf in the chain. M + * This should not happen, but if it does, it might make more M + * sense to fix the caller than to add code to split it here. M */ M + printf(in_delayed_cksum(): checksum split between mbufs.\n); Mreturn; M} M*(u_short *)(m-m_data + offset) = csum; If this should not happen really means that we do not expect this issue at all, assuming we are coding correctly, then all these comments and printfs should be converted to KASSERTs. I tried to keep the style of the code... However, if the first one occurs, we are setting up a packet and have it too short to contain the checksum. This would really be bug in our code... So a KASSERT is fine. A KASSERT for the second case is also fine. The only difference between the above and the KASSERT version is that in case of problems the above just sends packets with wrong checksums and the KASSERT version will panic (when compiled with INVARIANTS) or panic (in case of m == NULL) or corrupt a byte. However, I also prefer the KASSERT version, it will help to get the code right... So I committed a change in http://svnweb.freebsd.org/changeset/base/265713 Thanks for your suggestion! Best regards Michael If this should not happen means 'such packets shouldn't arrrive from network, then we need to remove printfs, because having a remotely triggerable printf(9) is a DDoS vulnerability. -- Totus tuus, Glebius. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r265691 - head/sys/netinet
On Thu, May 08, 2014 at 10:50:28PM +0200, Michael Tuexen wrote: M If this should not happen really means that we do not expect this issue M at all, assuming we are coding correctly, then all these comments and printfs M should be converted to KASSERTs. M I tried to keep the style of the code... M However, if the first one occurs, we are setting up a packet and have it too M short to contain the checksum. This would really be bug in our code... So a KASSERT is fine. M A KASSERT for the second case is also fine. M The only difference between the above and the KASSERT version is that M in case of problems the above just sends packets with wrong checksums M and the KASSERT version will panic (when compiled with INVARIANTS) or M panic (in case of m == NULL) or corrupt a byte. However, I also prefer M the KASSERT version, it will help to get the code right... M So I committed a change in M http://svnweb.freebsd.org/changeset/base/265713 M M Thanks for your suggestion! Thanks a lot, Michael! -- Totus tuus, Glebius. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265716 - head/share/man/man4
Author: brueffer Date: Thu May 8 21:02:23 2014 New Revision: 265716 URL: http://svnweb.freebsd.org/changeset/base/265716 Log: Fix two more typos. Submitted by: Trond Endrestol Modified: head/share/man/man4/mrsas.4 Modified: head/share/man/man4/mrsas.4 == --- head/share/man/man4/mrsas.4 Thu May 8 20:57:13 2014(r265715) +++ head/share/man/man4/mrsas.4 Thu May 8 21:02:23 2014(r265716) @@ -34,7 +34,7 @@ .\ .\ $FreeBSD$ .\ -.Dd May 7, 2014 +.Dd May 8, 2014 .Dt MRSAS 4 .Os .Sh NAME @@ -122,7 +122,7 @@ The .Nm driver supports the following hardware: .Pp -[ Thunderbolt 6Gbp/s MR controller ] +[ Thunderbolt 6Gb/s MR controller ] .Bl -bullet -compact .It LSI MegaRAID SAS 9265 @@ -146,7 +146,7 @@ DELL PERC H810 DELL PERC H710/P .El .Pp -[ Invader/Fury 12Gpb/s MR controller ] +[ Invader/Fury 12Gb/s MR controller ] .Bl -bullet -compact .It LSI MegaRAID SAS 9380 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265719 - head/sys/dev/vt
Author: ray Date: Thu May 8 22:52:05 2014 New Revision: 265719 URL: http://svnweb.freebsd.org/changeset/base/265719 Log: Hide debug messages under VT_DEBUG. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt.h head/sys/dev/vt/vt_consolectl.c head/sys/dev/vt/vt_sysmouse.c Modified: head/sys/dev/vt/vt.h == --- head/sys/dev/vt/vt.hThu May 8 21:12:39 2014(r265718) +++ head/sys/dev/vt/vt.hThu May 8 22:52:05 2014(r265719) @@ -78,7 +78,13 @@ one 'device sc' or 'device vt' #endif /* defined(SC_TWOBUTTON_MOUSE) || defined(VT_TWOBUTTON_MOUSE) */ #defineSC_DRIVER_NAME vt +#ifdef VT_DEBUG #defineDPRINTF(_l, ...)if (vt_debug (_l)) printf( __VA_ARGS__ ) +#define VT_CONSOLECTL_DEBUG +#define VT_SYSMOUSE_DEBUG +#else +#defineDPRINTF(_l, ...)do {} while (0) +#endif #defineISSIGVALID(sig) ((sig) 0 (sig) NSIG) #defineVT_SYSCTL_INT(_name, _default, _descr) \ Modified: head/sys/dev/vt/vt_consolectl.c == --- head/sys/dev/vt/vt_consolectl.c Thu May 8 21:12:39 2014 (r265718) +++ head/sys/dev/vt/vt_consolectl.c Thu May 8 22:52:05 2014 (r265719) @@ -61,8 +61,10 @@ consolectl_ioctl(struct cdev *dev, u_lon return (0); } default: +#ifdef VT_CONSOLECTL_DEBUG printf(consolectl: unknown ioctl: %c:%lx\n, (char)IOCGROUP(cmd), IOCBASECMD(cmd)); +#endif return (ENOIOCTL); } } Modified: head/sys/dev/vt/vt_sysmouse.c == --- head/sys/dev/vt/vt_sysmouse.c Thu May 8 21:12:39 2014 (r265718) +++ head/sys/dev/vt/vt_sysmouse.c Thu May 8 22:52:05 2014 (r265719) @@ -376,8 +376,10 @@ sysmouse_ioctl(struct cdev *dev, u_long case MOUSE_MOUSECHAR: return (0); default: +#ifdef VT_SYSMOUSE_DEBUG printf(sysmouse: unknown ioctl: %c:%lx\n, (char)IOCGROUP(cmd), IOCBASECMD(cmd)); +#endif return (ENOIOCTL); } } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r265472 - head/bin/dd
On Wed, 7 May 2014, Alan Somers wrote: [snip] Even if nanosecond resolution isn't useful, monotonicity is. Nobody should be using a nonmonotonic clock just to measure durations. I started an audit of all of FreeBSD to look for other programs that use gettimeofday to measure durations. I haven't finished, but I've already found a lot, including xz, ping, hastd, fetch, systat, powerd, and others. I don't have time to fix them, though. Would you be interested, or do you know anyone else who would? From your list, hastd seems to be the most dangerous point to me. Adding trociny@ as one of the most active hastd-related committers so the issue would not be lost in the areas... -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: ma...@freebsd.org ] *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- ma...@rinet.ru *** ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r265472 - head/bin/dd
On Thu, May 8, 2014 at 4:55 PM, Dmitry Morozovsky ma...@rinet.ru wrote: On Wed, 7 May 2014, Alan Somers wrote: [snip] Even if nanosecond resolution isn't useful, monotonicity is. Nobody should be using a nonmonotonic clock just to measure durations. I started an audit of all of FreeBSD to look for other programs that use gettimeofday to measure durations. I haven't finished, but I've already found a lot, including xz, ping, hastd, fetch, systat, powerd, and others. I don't have time to fix them, though. Would you be interested, or do you know anyone else who would? From your list, hastd seems to be the most dangerous point to me. Adding trociny@ as one of the most active hastd-related committers so the issue would not be lost in the areas... In hastd's case, the problematic comparison is only used to print debugging info. It happens twice, in primary.c lines 1978 and 2039. -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: ma...@freebsd.org ] *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- ma...@rinet.ru *** ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265732 - head/gnu/usr.bin/groff/tmac
Author: gjb Date: Fri May 9 04:14:37 2014 New Revision: 265732 URL: http://svnweb.freebsd.org/changeset/base/265732 Log: Add 9.3 to mdoc.local. Sponsored by: The FreeBSD Foundation Modified: head/gnu/usr.bin/groff/tmac/mdoc.local Modified: head/gnu/usr.bin/groff/tmac/mdoc.local == --- head/gnu/usr.bin/groff/tmac/mdoc.local Fri May 9 04:08:40 2014 (r265731) +++ head/gnu/usr.bin/groff/tmac/mdoc.local Fri May 9 04:14:37 2014 (r265732) @@ -58,6 +58,7 @@ .ds doc-operating-system-FreeBSD-8.48.4 .ds doc-operating-system-FreeBSD-9.19.1 .ds doc-operating-system-FreeBSD-9.29.2 +.ds doc-operating-system-FreeBSD-9.39.3 .ds doc-operating-system-FreeBSD-10.0 10.0 .ds doc-operating-system-FreeBSD-10.1 10.1 .ds doc-operating-system-FreeBSD-11.0 11.0 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265738 - head/share/mk
Author: imp Date: Fri May 9 04:49:48 2014 New Revision: 265738 URL: http://svnweb.freebsd.org/changeset/base/265738 Log: We have to include bsd.opts.mk (included in bsd.own.mk) after /etc/src.conf so that options set there will affect the options defined in bsd.opts.mk. Fix a few comments while I'm here. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk == --- head/share/mk/src.opts.mk Fri May 9 04:49:43 2014(r265737) +++ head/share/mk/src.opts.mk Fri May 9 04:49:48 2014(r265738) @@ -30,17 +30,15 @@ .if !target(__src.opts.mk__) __src.opts.mk__: -# Compat -- needed still? -.include bsd.own.mk - -# Allow user to configure things, but in the future this will move -# elsehwere... - +# Allow user to configure things that only effect src tree builds. SRCCONF?= /etc/src.conf .if exists(${SRCCONF}) || ${SRCCONF} != /etc/src.conf .include ${SRCCONF} .endif +# Must be included after src.conf +.include bsd.own.mk + # # Define MK_* variables (which are either yes or no) for users # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265737 - head/share/mk
Author: imp Date: Fri May 9 04:49:43 2014 New Revision: 265737 URL: http://svnweb.freebsd.org/changeset/base/265737 Log: Spell always the more traditional way. Modified: head/share/mk/bsd.mkopt.mk Modified: head/share/mk/bsd.mkopt.mk == --- head/share/mk/bsd.mkopt.mk Fri May 9 04:25:17 2014(r265736) +++ head/share/mk/bsd.mkopt.mk Fri May 9 04:49:43 2014(r265737) @@ -42,7 +42,7 @@ MK_${var}:= yes # .for var in ${__DEFAULT_NO_OPTIONS} .if !defined(MK_${var}) -.if defined(WITH_${var}) !defined(WITHOUT_${var}) # WITHOUT aways wins +.if defined(WITH_${var}) !defined(WITHOUT_${var}) # WITHOUT always wins MK_${var}:=yes .else MK_${var}:=no ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r265739 - in head/sys/arm: conf rockchip
Author: ganbold Date: Fri May 9 05:39:57 2014 New Revision: 265739 URL: http://svnweb.freebsd.org/changeset/base/265739 Log: Add the codes for enabling CPU cores of Rockchip RK3188 SoC. Enable SMP for Radxa Rock board. Approved by: stas (mentor) Added: head/sys/arm/rockchip/rk30xx_mp.c (contents, props changed) Modified: head/sys/arm/conf/RADXA head/sys/arm/rockchip/files.rk30xx head/sys/arm/rockchip/rk30xx_machdep.c Modified: head/sys/arm/conf/RADXA == --- head/sys/arm/conf/RADXA Fri May 9 04:49:48 2014(r265738) +++ head/sys/arm/conf/RADXA Fri May 9 05:39:57 2014(r265739) @@ -121,3 +121,4 @@ options FDT optionsFDT_DTB_STATIC makeoptionsFDT_DTS_FILE=rk3188-radxa.dts +optionsSMP # Enable multiple cores Modified: head/sys/arm/rockchip/files.rk30xx == --- head/sys/arm/rockchip/files.rk30xx Fri May 9 04:49:48 2014 (r265738) +++ head/sys/arm/rockchip/files.rk30xx Fri May 9 05:39:57 2014 (r265739) @@ -19,3 +19,4 @@ arm/rockchip/rk30xx_grf.c standard arm/rockchip/rk30xx_wdog.c standard arm/rockchip/rk30xx_gpio.c optionalgpio dev/usb/controller/dwc_otg_fdt.c optionaldwcotg +arm/rockchip/rk30xx_mp.c optionalsmp Modified: head/sys/arm/rockchip/rk30xx_machdep.c == --- head/sys/arm/rockchip/rk30xx_machdep.c Fri May 9 04:49:48 2014 (r265738) +++ head/sys/arm/rockchip/rk30xx_machdep.c Fri May 9 05:39:57 2014 (r265739) @@ -85,6 +85,7 @@ int initarm_devmap_init(void) { + arm_devmap_add_entry(0x1000, 0x0020); arm_devmap_add_entry(0x2000, 0x0010); return (0); Added: head/sys/arm/rockchip/rk30xx_mp.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/rockchip/rk30xx_mp.c Fri May 9 05:39:57 2014 (r265739) @@ -0,0 +1,192 @@ +/*- + * Copyright (c) 2014 Ganbold Tsagaankhuu ganb...@freebsd.org + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include sys/cdefs.h +__FBSDID($FreeBSD$); +#include sys/param.h +#include sys/systm.h +#include sys/bus.h +#include sys/kernel.h +#include sys/lock.h +#include sys/mutex.h +#include sys/smp.h + +#include machine/smp.h +#include machine/fdt.h +#include machine/intr.h + +#defineSCU_PHYSBASE0x1013c000 +#defineSCU_SIZE0x100 + +#defineSCU_CONTROL_REG 0x00 +#defineSCU_CONTROL_ENABLE (1 0) +#defineSCU_STANDBY_EN (1 5) +#defineSCU_CONFIG_REG 0x04 +#defineSCU_CONFIG_REG_NCPU_MASK0x03 +#defineSCU_CPUPOWER_REG0x08 +#defineSCU_INV_TAGS_REG0x0c + +#defineSCU_FILTER_START_REG0x10 +#defineSCU_FILTER_END_REG 0x14 +#defineSCU_SECURE_ACCESS_REG 0x18 +#defineSCU_NONSECURE_ACCESS_REG0x1c + +#defineIMEM_PHYSBASE 0x1008 +#defineIMEM_SIZE 0x20 + +#definePMU_PHYSBASE0x20004000 +#definePMU_SIZE0x100 +#definePMU_PWRDN_CON 0x08 +#definePMU_PWRDN_SCU (1 4) + +extern char*mpentry_addr; +static