svn commit: r293403 - head/libexec/rtld-elf
Author: emaste Date: Fri Jan 8 00:56:41 2016 New Revision: 293403 URL: https://svnweb.freebsd.org/changeset/base/293403 Log: Revert r293201, r293202 (rtld: populate DT_DEBUG iff DYNAMIC segment is writable) It turns out MIPS binaries may have other oddities that can trigger a fault at startup. PR: 206017 Reported by: ray Modified: head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h Modified: head/libexec/rtld-elf/rtld.c == --- head/libexec/rtld-elf/rtld.cFri Jan 8 00:46:28 2016 (r293402) +++ head/libexec/rtld-elf/rtld.cFri Jan 8 00:56:41 2016 (r293403) @@ -1144,13 +1144,13 @@ digest_dynamic1(Obj_Entry *obj, int earl * is mapped read-only. DT_MIPS_RLD_MAP is used instead. */ +#ifndef __mips__ case DT_DEBUG: - if (!obj->writable_dynamic) - break; if (!early) dbg("Filling in DT_DEBUG entry"); ((Elf_Dyn*)dynp)->d_un.d_ptr = (Elf_Addr) _debug; break; +#endif case DT_FLAGS: if (dynp->d_un.d_val & DF_ORIGIN) @@ -1331,8 +1331,6 @@ digest_phdr(const Elf_Phdr *phdr, int ph break; case PT_DYNAMIC: - if (ph->p_flags & PROT_WRITE) - obj->writable_dynamic = true; obj->dynamic = (const Elf_Dyn *)(ph->p_vaddr + obj->relocbase); break; Modified: head/libexec/rtld-elf/rtld.h == --- head/libexec/rtld-elf/rtld.hFri Jan 8 00:46:28 2016 (r293402) +++ head/libexec/rtld-elf/rtld.hFri Jan 8 00:56:41 2016 (r293403) @@ -264,7 +264,6 @@ typedef struct Struct_Obj_Entry { bool valid_hash_sysv : 1; /* A valid System V hash hash tag is available */ bool valid_hash_gnu : 1; /* A valid GNU hash tag is available */ bool dlopened : 1; /* dlopen()-ed (vs. load statically) */ -bool writable_dynamic : 1; /* PT_DYNAMIC is writable */ struct link_map linkmap; /* For GDB and dlinfo() */ Objlist dldags;/* Object belongs to these dlopened DAGs (%) */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293405 - head/sys/kern
Author: glebius Date: Fri Jan 8 01:16:03 2016 New Revision: 293405 URL: https://svnweb.freebsd.org/changeset/base/293405 Log: For SOCK_STREAM socket use sbappendstream() instead of sbappend(). Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c == --- head/sys/kern/uipc_usrreq.c Fri Jan 8 01:12:27 2016(r293404) +++ head/sys/kern/uipc_usrreq.c Fri Jan 8 01:16:03 2016(r293405) @@ -981,7 +981,7 @@ uipc_send(struct socket *so, int flags, control)) control = NULL; } else - sbappend_locked(>so_rcv, m); + sbappendstream_locked(>so_rcv, m, flags); break; case SOCK_SEQPACKET: { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293392 - head/bin/sh
Author: jilles Date: Thu Jan 7 23:13:20 2016 New Revision: 293392 URL: https://svnweb.freebsd.org/changeset/base/293392 Log: sh: Reduce size of options table. Modified: head/bin/sh/expand.c head/bin/sh/options.c head/bin/sh/options.h head/bin/sh/var.c Modified: head/bin/sh/expand.c == --- head/bin/sh/expand.cThu Jan 7 23:10:44 2016(r293391) +++ head/bin/sh/expand.cThu Jan 7 23:13:20 2016(r293392) @@ -951,8 +951,8 @@ varvalue(const char *name, int quoted, i case '-': p = buf; for (i = 0 ; i < NSHORTOPTS ; i++) { - if (optlist[i].val) - *p++ = optlist[i].letter; + if (optval[i]) + *p++ = optletter[i]; } *p = '\0'; strtodest(buf, flag, subtype, quoted, dst); Modified: head/bin/sh/options.c == --- head/bin/sh/options.c Thu Jan 7 23:10:44 2016(r293391) +++ head/bin/sh/options.c Thu Jan 7 23:13:20 2016(r293392) @@ -91,7 +91,7 @@ procargs(int argc, char **argv) if (argc > 0) argptr++; for (i = 0; i < NOPTS; i++) - optlist[i].val = 2; + optval[i] = 2; privileged = (getuid() != geteuid() || getgid() != getegid()); options(1); if (*argptr == NULL && minusc == NULL) @@ -104,8 +104,8 @@ procargs(int argc, char **argv) if (mflag == 2) mflag = iflag; for (i = 0; i < NOPTS; i++) - if (optlist[i].val == 2) - optlist[i].val = 0; + if (optval[i] == 2) + optval[i] = 0; arg0 = argv[0]; if (sflag == 0 && minusc == NULL) { scriptname = *argptr++; @@ -250,26 +250,29 @@ static void minus_o(char *name, int val) { int i; + const unsigned char *on; + size_t len; if (name == NULL) { if (val) { /* "Pretty" output. */ out1str("Current option settings\n"); - for (i = 0; i < NOPTS; i++) - out1fmt("%-16s%s\n", optlist[i].name, - optlist[i].val ? "on" : "off"); + for (i = 0, on = optname; i < NOPTS; i++, on += *on + 1) + out1fmt("%-16.*s%s\n", *on, on + 1, + optval[i] ? "on" : "off"); } else { /* Output suitable for re-input to shell. */ - for (i = 0; i < NOPTS; i++) - out1fmt("%s %co %s%s", + for (i = 0, on = optname; i < NOPTS; i++, on += *on + 1) + out1fmt("%s %co %.*s%s", i % 6 == 0 ? "set" : "", - optlist[i].val ? '-' : '+', - optlist[i].name, + optval[i] ? '-' : '+', + *on, on + 1, i % 6 == 5 || i == NOPTS - 1 ? "\n" : ""); } } else { - for (i = 0; i < NOPTS; i++) - if (equal(name, optlist[i].name)) { + len = strlen(name); + for (i = 0, on = optname; i < NOPTS; i++, on += *on + 1) + if (*on == len && memcmp(on + 1, name, len) == 0) { setoptionbyindex(i, val); return; } @@ -281,18 +284,18 @@ minus_o(char *name, int val) static void setoptionbyindex(int idx, int val) { - if (optlist[idx].letter == 'p' && !val && privileged) { + if (optletter[idx] == 'p' && !val && privileged) { if (setgid(getgid()) == -1) error("setgid"); if (setuid(getuid()) == -1) error("setuid"); } - optlist[idx].val = val; + optval[idx] = val; if (val) { /* #%$ hack for ksh semantics */ - if (optlist[idx].letter == 'V') + if (optletter[idx] == 'V') Eflag = 0; - else if (optlist[idx].letter == 'E') + else if (optletter[idx] == 'E') Vflag = 0; } } @@ -303,7 +306,7 @@ setoption(int flag, int val) int i; for (i = 0; i < NSHORTOPTS; i++) - if (optlist[i].letter == flag) { + if (optletter[i] == flag) { setoptionbyindex(i, val); return; } Modified: head/bin/sh/options.h
svn commit: r293398 - head/tools/tools/nanobsd/embedded
Author: imp Date: Fri Jan 8 00:05:28 2016 New Revision: 293398 URL: https://svnweb.freebsd.org/changeset/base/293398 Log: Setup /pkg as a spot for pkg to operate. This is for testing purposes only. You need to remount / rw and export TMPDIR=/pkg/tmp. pkg will then work. It's slow though: 15 minutes to pkg install git on an RPi 2 with a decently fast SD card. Since this is for testing, we set DEFAULT_ALWAYS_YES and ASSUME_ALWAYS_YES to YES. Modified: head/tools/tools/nanobsd/embedded/common Modified: head/tools/tools/nanobsd/embedded/common == --- head/tools/tools/nanobsd/embedded/commonFri Jan 8 00:05:20 2016 (r293397) +++ head/tools/tools/nanobsd/embedded/commonFri Jan 8 00:05:28 2016 (r293398) @@ -449,6 +449,28 @@ typical_embedded ( ) ( ) customize_cmd typical_embedded +fix_pkg ( ) ( + chdir ${NANO_WORLDDIR} + mkdir -p pkg + mkdir -p pkg/db + mkdir -p pkg/cache + mkdir -p pkg/tmp# Needed for pkg bootstrap + mkdir -p usr/local/etc # Will get moved to local/etc + ( + echo 'PKG_DBDIR = "/pkg/db"' + echo 'PKG_CACHEDIR = "/pkg/cache"' + echo 'DEFAULT_ALWAYS_YES = "yes"' + echo 'ASSUME_ALWAYS_YES = "yes"' + ) >> usr/local/etc/pkg.conf + [ -z ${NANO_NOPRIV_BUILD} ] || ( + echo "./pkg type=dir uname=root gname=wheel mode=0755" + echo "./pkg/cache type=dir uname=root gname=wheel mode=0755" + echo "./pkg/db type=dir uname=root gname=wheel mode=0755" + echo "./pkg/tmp type=dir uname=root gname=wheel mode=0755" + ) >> ${NANO_METALOG} +) +customize_cmd fix_pkg + save_build ( ) ( VERSION_FILE=${NANO_WORLDDIR}/etc/version if [ "${SVNREVISION}" = "${REVISION}" ]; then ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293399 - head/tools/tools/nanobsd
Author: imp Date: Fri Jan 8 00:05:47 2016 New Revision: 293399 URL: https://svnweb.freebsd.org/changeset/base/293399 Log: Make sure that the /set directive gets put at the top of the file, instead of in sort order. Slash sorts after period. Modified: head/tools/tools/nanobsd/defaults.sh (contents, props changed) Modified: head/tools/tools/nanobsd/defaults.sh == --- head/tools/tools/nanobsd/defaults.shFri Jan 8 00:05:28 2016 (r293398) +++ head/tools/tools/nanobsd/defaults.shFri Jan 8 00:05:47 2016 (r293399) @@ -500,10 +500,9 @@ fixup_before_diskimage ( ) ( if [ -n "${NANO_METALOG}" ]; then pprint 2 "Fixing metalog" cp ${NANO_METALOG} ${NANO_METALOG}.pre - (echo "/set uname=${NANO_DEF_UNAME} gname=${NANO_DEF_GNAME}" && - cat ${NANO_METALOG}.pre) | \ - ${NANO_TOOLS}/mtree-dedup.awk | \ - sed -e 's/ size=[0-9][0-9]*//' | sort > ${NANO_METALOG} + echo "/set uname=${NANO_DEF_UNAME} gname=${NANO_DEF_GNAME}" > ${NANO_METALOG} + cat ${NANO_METALOG}.pre | ${NANO_TOOLS}/mtree-dedup.awk | \ + sed -e 's/ size=[0-9][0-9]*//' | sort >> ${NANO_METALOG} fi ) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293390 - in head: share/man/man4 sys/dev/ioat
Author: cem Date: Thu Jan 7 23:02:15 2016 New Revision: 293390 URL: https://svnweb.freebsd.org/changeset/base/293390 Log: ioat(4): Add ioat_acquire_reserve() KPI ioat_acquire_reserve() is an extended version of ioat_acquire(). It allows users to reserve space in the channel for some number of descriptors. If this succeeds, it guarantees that at least submission of N valid descriptors will succeed. Sponsored by: EMC / Isilon Storage Division Modified: head/share/man/man4/ioat.4 head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat.h Modified: head/share/man/man4/ioat.4 == --- head/share/man/man4/ioat.4 Thu Jan 7 22:59:09 2016(r293389) +++ head/share/man/man4/ioat.4 Thu Jan 7 23:02:15 2016(r293390) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 5, 2016 +.Dd January 7, 2016 .Dt IOAT 4 .Os .Sh NAME @@ -73,6 +73,8 @@ In .Fn ioat_get_max_coalesce_period "bus_dmaengine_t dmaengine" .Ft void .Fn ioat_acquire "bus_dmaengine_t dmaengine" +.Ft int +.Fn ioat_acquire_reserve "bus_dmaengine_t dmaengine" "uint32_t n" "int mflags" .Ft void .Fn ioat_release "bus_dmaengine_t dmaengine" .Ft struct bus_dmadesc * @@ -178,6 +180,14 @@ When the user wants to offload a copy, t the .Ar bus_dmaengine_t object for exclusive access to enqueue operations on that channel. +Optionally, the user can reserve space by using +.Fn ioat_acquire_reserve +instead. +If +.Fn ioat_acquire_reserve +succeeds, there is guaranteed to be room for +.Fa N +new operations in the internal ring buffer. Then, they will submit one or more operations using .Fn ioat_blockfill , .Fn ioat_copy , Modified: head/sys/dev/ioat/ioat.c == --- head/sys/dev/ioat/ioat.cThu Jan 7 22:59:09 2016(r293389) +++ head/sys/dev/ioat/ioat.cThu Jan 7 23:02:15 2016(r293390) @@ -789,6 +789,21 @@ ioat_acquire(bus_dmaengine_t dmaengine) CTR0(KTR_IOAT, __func__); } +int +ioat_acquire_reserve(bus_dmaengine_t dmaengine, unsigned n, int mflags) +{ + struct ioat_softc *ioat; + int error; + + ioat = to_ioat_softc(dmaengine); + ioat_acquire(dmaengine); + + error = ioat_reserve_space(ioat, n, mflags); + if (error != 0) + ioat_release(dmaengine); + return (error); +} + void ioat_release(bus_dmaengine_t dmaengine) { Modified: head/sys/dev/ioat/ioat.h == --- head/sys/dev/ioat/ioat.hThu Jan 7 22:59:09 2016(r293389) +++ head/sys/dev/ioat/ioat.hThu Jan 7 23:02:15 2016(r293390) @@ -96,13 +96,26 @@ uint16_t ioat_get_max_coalesce_period(bu /* * Acquire must be called before issuing an operation to perform. Release is - * called after. Multiple operations can be issued within the context of one + * called after. Multiple operations can be issued within the context of one * acquire and release */ void ioat_acquire(bus_dmaengine_t dmaengine); void ioat_release(bus_dmaengine_t dmaengine); /* + * Acquire_reserve can be called to ensure there is room for N descriptors. If + * it succeeds, the next N valid operations will successfully enqueue. + * + * It may fail with: + * - ENXIO if the channel is in an errored state, or the driver is being + * unloaded + * - EAGAIN if mflags included M_NOWAIT + * + * On failure, the caller does not hold the dmaengine. + */ +int ioat_acquire_reserve(bus_dmaengine_t dmaengine, unsigned n, int mflags); + +/* * Issue a blockfill operation. The 64-bit pattern 'fillpattern' is written to * 'len' physically contiguous bytes at 'dst'. * ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293313 - head/sys/netinet/tcp_stacks
Author: jtl Date: Thu Jan 7 11:54:20 2016 New Revision: 293313 URL: https://svnweb.freebsd.org/changeset/base/293313 Log: Apply the changes from r293284 to one additional file. Discussed with: glebius Modified: head/sys/netinet/tcp_stacks/fastpath.c Modified: head/sys/netinet/tcp_stacks/fastpath.c == --- head/sys/netinet/tcp_stacks/fastpath.c Thu Jan 7 10:39:13 2016 (r293312) +++ head/sys/netinet/tcp_stacks/fastpath.c Thu Jan 7 11:54:20 2016 (r293313) @@ -158,13 +158,11 @@ static voidtcp_do_segment_fastack(stru * the ack that opens up a 0-sized window. * - LRO wasn't used for this segment. We make sure by checking that the * segment size is not larger than the MSS. - * - Delayed acks are enabled or this is a half-synchronized T/TCP - * connection. */ #define DELAY_ACK(tp, tlen)\ ((!tcp_timer_active(tp, TT_DELACK) && \ (tp->t_flags & TF_RXWIN0SENT) == 0) && \ - (tlen <= tp->t_maxopd) && \ + (tlen <= tp->t_maxseg) && \ (V_tcp_delack_enabled || (tp->t_flags & TF_NEEDSYN))) /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293309 - in head/sys/dev: cxgb/ulp/iw_cxgb cxgb/ulp/tom cxgbe/iw_cxgbe cxgbe/tom
Author: melifaro Date: Thu Jan 7 08:07:17 2016 New Revision: 293309 URL: https://svnweb.freebsd.org/changeset/base/293309 Log: Convert cxgb/cxgbe to the new routing API. Discussed with: np Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c head/sys/dev/cxgb/ulp/tom/cxgb_listen.c head/sys/dev/cxgbe/iw_cxgbe/cm.c head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c == --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c Thu Jan 7 08:06:43 2016 (r293308) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c Thu Jan 7 08:07:17 2016 (r293309) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -264,20 +265,14 @@ void __free_ep(struct iwch_ep_common *ep free(epc, M_DEVBUF); } -static struct rtentry * +static int find_route(__be32 local_ip, __be32 peer_ip, __be16 local_port, -__be16 peer_port, u8 tos) +__be16 peer_port, u8 tos, struct nhop4_extended *pnh4) { -struct route iproute; -struct sockaddr_in *dst = (struct sockaddr_in *)_dst; - -bzero(, sizeof iproute); - dst->sin_family = AF_INET; - dst->sin_len = sizeof *dst; -dst->sin_addr.s_addr = peer_ip; - -rtalloc(); - return iproute.ro_rt; + struct in_addr addr; + + addr.s_addr = peer_ip; + return (fib4_lookup_nh_ext(RT_DEFAULT_FIB, addr, NHR_REF, 0, pnh4)); } static void @@ -1293,7 +1288,7 @@ iwch_connect(struct iw_cm_id *cm_id, str int err = 0; struct iwch_dev *h = to_iwch_dev(cm_id->device); struct iwch_ep *ep; - struct rtentry *rt; + struct nhop4_extended nh4; struct toedev *tdev; if (is_loopback_dst(cm_id)) { @@ -1329,28 +1324,28 @@ iwch_connect(struct iw_cm_id *cm_id, str goto fail2; /* find a route */ - rt = find_route(cm_id->local_addr.sin_addr.s_addr, + err = find_route(cm_id->local_addr.sin_addr.s_addr, cm_id->remote_addr.sin_addr.s_addr, cm_id->local_addr.sin_port, - cm_id->remote_addr.sin_port, IPTOS_LOWDELAY); - if (!rt) { + cm_id->remote_addr.sin_port, IPTOS_LOWDELAY, ); + if (err) { printf("%s - cannot find route.\n", __FUNCTION__); err = EHOSTUNREACH; goto fail2; } - if (!(rt->rt_ifp->if_flags & IFCAP_TOE)) { + if (!(nh4.nh_ifp->if_flags & IFCAP_TOE)) { printf("%s - interface not TOE capable.\n", __FUNCTION__); - RTFREE(rt); + fib4_free_nh_ext(RT_DEFAULT_FIB, ); goto fail2; } - tdev = TOEDEV(rt->rt_ifp); + tdev = TOEDEV(nh4.nh_ifp); if (tdev == NULL) { printf("%s - No toedev for interface.\n", __FUNCTION__); - RTFREE(rt); + fib4_free_nh_ext(RT_DEFAULT_FIB, ); goto fail2; } - RTFREE(rt); + fib4_free_nh_ext(RT_DEFAULT_FIB, ); state_set(>com, CONNECTING); ep->com.local_addr = cm_id->local_addr; Modified: head/sys/dev/cxgb/ulp/tom/cxgb_listen.c == --- head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Thu Jan 7 08:06:43 2016 (r293308) +++ head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Thu Jan 7 08:07:17 2016 (r293309) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -480,8 +481,8 @@ do_pass_accept_req(struct sge_qset *qs, unsigned int tid = GET_TID(req); struct listen_ctx *lctx = lookup_stid(>tid_maps, stid); struct l2t_entry *e = NULL; + struct nhop4_basic nh4; struct sockaddr_in nam; - struct rtentry *rt; struct inpcb *inp; struct socket *so; struct port_info *pi; @@ -525,18 +526,12 @@ do_pass_accept_req(struct sge_qset *qs, nam.sin_len = sizeof(nam); nam.sin_family = AF_INET; nam.sin_addr = inc.inc_faddr; - rt = rtalloc1((struct sockaddr *), 0, 0); - if (rt == NULL) + if (fib4_lookup_nh_basic(RT_DEFAULT_FIB, nam.sin_addr, 0, 0, ) != 0) REJECT_PASS_ACCEPT(); else { - struct sockaddr *nexthop; - - RT_UNLOCK(rt); - nexthop = rt->rt_flags & RTF_GATEWAY ? rt->rt_gateway : - (struct sockaddr *) - if (rt->rt_ifp == ifp) - e = t3_l2t_get(pi, rt->rt_ifp, nexthop); - RTFREE(rt); + nam.sin_addr = nh4.nh_addr; + if (nh4.nh_ifp == ifp) + e = t3_l2t_get(pi, ifp, (struct sockaddr *)); if (e == NULL)
svn commit: r293310 - head/sys/ofed/include/rdma
Author: hselasky Date: Thu Jan 7 09:40:19 2016 New Revision: 293310 URL: https://svnweb.freebsd.org/changeset/base/293310 Log: Remove unused file. Deleted: head/sys/ofed/include/rdma/Kbuild ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293311 - head/sys/netpfil/pf
Author: melifaro Date: Thu Jan 7 10:20:03 2016 New Revision: 293311 URL: https://svnweb.freebsd.org/changeset/base/293311 Log: Convert pf(4) to the new routing API. Differential Revision:https://reviews.freebsd.org/D4763 Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c == --- head/sys/netpfil/pf/pf.cThu Jan 7 09:40:19 2016(r293310) +++ head/sys/netpfil/pf/pf.cThu Jan 7 10:20:03 2016(r293311) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -94,6 +95,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #endif /* INET6 */ #include @@ -2985,49 +2988,35 @@ static u_int16_t pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t offer) { #ifdef INET - struct sockaddr_in *dst; - struct route ro; + struct nhop4_basic nh4; #endif /* INET */ #ifdef INET6 - struct sockaddr_in6 *dst6; - struct route_in6 ro6; + struct nhop6_basic nh6; + struct in6_addr dst6; + uint32_tscopeid; #endif /* INET6 */ - struct rtentry *rt = NULL; int hlen = 0; - u_int16_tmss = V_tcp_mssdflt; + uint16_t mss = 0; switch (af) { #ifdef INET case AF_INET: hlen = sizeof(struct ip); - bzero(, sizeof(ro)); - dst = (struct sockaddr_in *)_dst; - dst->sin_family = AF_INET; - dst->sin_len = sizeof(*dst); - dst->sin_addr = addr->v4; - in_rtalloc_ign(, 0, rtableid); - rt = ro.ro_rt; + if (fib4_lookup_nh_basic(rtableid, addr->v4, 0, 0, ) == 0) + mss = nh4.nh_mtu - hlen - sizeof(struct tcphdr); break; #endif /* INET */ #ifdef INET6 case AF_INET6: hlen = sizeof(struct ip6_hdr); - bzero(, sizeof(ro6)); - dst6 = (struct sockaddr_in6 *)_dst; - dst6->sin6_family = AF_INET6; - dst6->sin6_len = sizeof(*dst6); - dst6->sin6_addr = addr->v6; - in6_rtalloc_ign(, 0, rtableid); - rt = ro6.ro_rt; + in6_splitscope(>v6, , ); + if (fib6_lookup_nh_basic(rtableid, , scopeid, 0,0,)==0) + mss = nh6.nh_mtu - hlen - sizeof(struct tcphdr); break; #endif /* INET6 */ } - if (rt && rt->rt_ifp) { - mss = rt->rt_ifp->if_mtu - hlen - sizeof(struct tcphdr); - mss = max(V_tcp_mssdflt, mss); - RTFREE(rt); - } + mss = max(V_tcp_mssdflt, mss); mss = min(mss, offer); mss = max(mss, 64); /* sanity - at least max opt space */ return (mss); @@ -5194,13 +5183,12 @@ pf_pull_hdr(struct mbuf *m, int off, voi return (p); } -int -pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, +#ifdef RADIX_MPATH +static int +pf_routable_oldmpath(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, int rtableid) { -#ifdef RADIX_MPATH struct radix_node_head *rnh; -#endif struct sockaddr_in *dst; int ret = 1; int check_mpath; @@ -5215,12 +5203,10 @@ pf_routable(struct pf_addr *addr, sa_fam struct ifnet*ifp; check_mpath = 0; -#ifdef RADIX_MPATH /* XXX: stick to table 0 for now */ rnh = rt_tables_get_rnh(0, af); if (rnh != NULL && rn_mpath_capable(rnh)) check_mpath = 1; -#endif bzero(, sizeof(ro)); switch (af) { case AF_INET: @@ -5283,9 +5269,7 @@ pf_routable(struct pf_addr *addr, sa_fam if (kif->pfik_ifp == ifp) ret = 1; -#ifdef RADIX_MPATH rn = rn_mpath_next(rn); -#endif } while (check_mpath == 1 && rn != NULL && ret == 0); } else ret = 0; @@ -5294,6 +5278,72 @@ out: RTFREE(ro.ro_rt); return (ret); } +#endif + +int +pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, +int rtableid) +{ +#ifdef INET + struct nhop4_basic nh4; +#endif +#ifdef INET6 + struct nhop6_basic nh6; +#endif + struct ifnet*ifp; +#ifdef RADIX_MPATH + struct radix_node_head *rnh; + + /* XXX: stick to table 0 for now */ + rnh = rt_tables_get_rnh(0, af); + if (rnh != NULL && rn_mpath_capable(rnh)) + return (pf_routable_oldmpath(addr, af, kif, rtableid)); +#endif + /* +* Skip check for addresses with embedded interface scope, +* as they would
Re: svn commit: r293284 - in head/sys: dev/cxgb/ulp/tom dev/cxgbe/tom netinet
On Wed, 6 Jan 2016 18:20:50 -0800 NGie Cooperwrote: > On Wed, Jan 6, 2016 at 4:14 PM, Gleb Smirnoff > wrote: > > Author: glebius > > Date: Thu Jan 7 00:14:42 2016 > > New Revision: 293284 > > URL: https://svnweb.freebsd.org/changeset/base/293284 > > > > Log: > > Historically we have two fields in tcpcb to describe sender MSS: > > t_maxopd, and t_maxseg. This dualism emerged with T/TCP, but was > > not properly cleaned up after T/TCP removal. After all permutations > > over the years the result is that t_maxopd stores a minimum of peer > > offered MSS and MTU reduced by minimum protocol header. And > > t_maxseg stores (t_maxopd - TCPOLEN_TSTAMP_APPA) if timestamps are > > in action, or is equal to t_maxopd otherwise. That's a very rough > > estimate of MSS reduced by options length. Throughout the code it > > was used in places, where preciseness was not important, like cwnd > > or ssthresh calculations. > > > > With this change: > > > > - t_maxopd goes away. > > - t_maxseg now stores MSS not adjusted by options. > > - new function tcp_maxseg() is provided, that calculates MSS > > reduced by options length. The functions gives a better estimate, > > since it takes into account SACK state as well. > > > > Reviewed by: jtl > > Differential Revision:https://reviews.freebsd.org/D3593 > > This broke the build. > > From https://jenkins.freebsd.org/job/FreeBSD_HEAD_i386/2053/ : > > /usr/src/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:481:6: > error: no member named 't_maxopd' in 'struct tcpcb' > --- all_subdir_sound --- > --- all_subdir_sb8 --- > ===> sound/driver/sb8 (all) > --- all_subdir_tcp/fastpath --- > if (DELAY_ACK(tp, tlen)) { > ^ ~~ > /usr/src/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:167:19: > note: expanded from macro 'DELAY_ACK' > (tlen <= tp->t_maxopd) > && \ ^ > /usr/src/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:606:8: > error: no member named 't_maxopd' in 'struct tcpcb' > if (DELAY_ACK(tp, tlen) && tlen != 0) > ^ ~~ > /usr/src/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:167:19: > note: expanded from macro 'DELAY_ACK' > (tlen <= tp->t_maxopd) > && \ ^ > --- all_subdir_sound --- > --- all_subdir_sb16 --- > ctfconvert -L VERSION -g sb16.o > --- all_subdir_tcp/fastpath --- > /usr/src/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:1545:8: > error: no member named 't_maxopd' in 'struct tcpcb' > if (DELAY_ACK(tp, tlen)) > ^ ~~ > /usr/src/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:167:19: > note: expanded from macro 'DELAY_ACK' > (tlen <= tp->t_maxopd) > && \ ^ > 3 errors generated. > *** [fastpath.o] Error code 1 amd64 also ... --- dragon_saver.o --- /usr/local/libexec/ccache/world/cc -target x86_64-unknown-freebsd11.0 --sysroot=/media/da0s1/obj/usr/src/tmp -B/media/da0s1/obj/usr/src/tmp/usr/bin -O2 -pipe -march=native -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include /media/da0s1/obj/usr/src/sys/mk11/opt_global.h -I. -I/usr/src/sys -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/media/da0s1/obj/usr/src/sys/mk11 -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-v alue -fvectorize -fslp-vectorize -fblocks -fcolor-diagnostics -mno-aes -mno-avx -std=iso9899:1999 -c /usr/src/sys/modules/syscons/dragon/../../../dev/syscons/dragon/dragon_saver.c -o dragon_saver.o --- all_subdir_tcp/fastpath --- /usr/src/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:481:6: error: no member named 't_maxopd' in 'struct tcpcb' if (DELAY_ACK(tp, tlen)) { ^ ~~ /usr/src/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:167:19: note: expanded from macro 'DELAY_ACK' (tlen <= tp->t_maxopd) && \ ^ /usr/src/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:606:8: error: no member named 't_maxopd' in 'struct tcpcb' if (DELAY_ACK(tp, tlen) && tlen != 0) ^ ~~
svn commit: r293322 - head/sys/dev/nvd
Author: jimharris Date: Thu Jan 7 15:59:51 2016 New Revision: 293322 URL: https://svnweb.freebsd.org/changeset/base/293322 Log: nvd: break out submission logic into separate function This enables a future patch using this same logic to submit I/O directly bypassing the taskqueue. MFC after:3 days Sponsored by: Intel Modified: head/sys/dev/nvd/nvd.c Modified: head/sys/dev/nvd/nvd.c == --- head/sys/dev/nvd/nvd.c Thu Jan 7 15:58:44 2016(r293321) +++ head/sys/dev/nvd/nvd.c Thu Jan 7 15:59:51 2016(r293322) @@ -47,6 +47,8 @@ struct nvd_disk; static disk_ioctl_t nvd_ioctl; static disk_strategy_t nvd_strategy; +static void nvd_done(void *arg, const struct nvme_completion *cpl); + static void *nvd_new_disk(struct nvme_namespace *ns, void *ctrlr); static void destroy_geom_disk(struct nvd_disk *ndisk); @@ -148,6 +150,26 @@ nvd_unload() nvme_unregister_consumer(consumer_handle); } +static int +nvd_bio_submit(struct nvd_disk *ndisk, struct bio *bp) +{ + int err; + + bp->bio_driver1 = NULL; + atomic_add_int(>cur_depth, 1); + err = nvme_ns_bio_process(ndisk->ns, bp, nvd_done); + if (err) { + atomic_add_int(>cur_depth, -1); + bp->bio_error = err; + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; + biodone(bp); + return (-1); + } + + return (0); +} + static void nvd_strategy(struct bio *bp) { @@ -195,7 +217,6 @@ nvd_bioq_process(void *arg, int pending) { struct nvd_disk *ndisk = arg; struct bio *bp; - int err; for (;;) { mtx_lock(>bioqlock); @@ -204,17 +225,7 @@ nvd_bioq_process(void *arg, int pending) if (bp == NULL) break; - bp->bio_driver1 = NULL; - atomic_add_int(>cur_depth, 1); - - err = nvme_ns_bio_process(ndisk->ns, bp, nvd_done); - - if (err) { - atomic_add_int(>cur_depth, -1); - bp->bio_error = err; - bp->bio_flags |= BIO_ERROR; - bp->bio_resid = bp->bio_bcount; - biodone(bp); + if (nvd_bio_submit(ndisk, bp) != 0) { continue; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293321 - head/sys/dev/nvd
Author: jimharris Date: Thu Jan 7 15:58:44 2016 New Revision: 293321 URL: https://svnweb.freebsd.org/changeset/base/293321 Log: nvd: skip BIO_ORDERED logic when bio fails submission This ensures the bio flags are not read after biodone(). The ordering will still be enforced, after the bio is submitted successfully. MFC after:3 days Sponsored by: Intel Modified: head/sys/dev/nvd/nvd.c Modified: head/sys/dev/nvd/nvd.c == --- head/sys/dev/nvd/nvd.c Thu Jan 7 15:57:17 2016(r293320) +++ head/sys/dev/nvd/nvd.c Thu Jan 7 15:58:44 2016(r293321) @@ -215,6 +215,7 @@ nvd_bioq_process(void *arg, int pending) bp->bio_flags |= BIO_ERROR; bp->bio_resid = bp->bio_bcount; biodone(bp); + continue; } #ifdef BIO_ORDERED ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293324 - head/sys/dev/nvme
Author: jimharris Date: Thu Jan 7 16:08:04 2016 New Revision: 293324 URL: https://svnweb.freebsd.org/changeset/base/293324 Log: nvme: simplify some of the nested ifs in interrupt setup code This prepares for some follow-up commits which do more work in this area. MFC after:3 days Sponsored by: Intel Modified: head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme_ctrlr.c == --- head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:06:23 2016 (r293323) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:08:04 2016 (r293324) @@ -999,7 +999,9 @@ nvme_ctrlr_construct(struct nvme_control if (pci_msix_count(dev) < 2) { ctrlr->msix_enabled = 0; goto intx; - } else if (pci_msix_count(dev) < num_vectors_requested) { + } + + if (pci_msix_count(dev) < num_vectors_requested) { ctrlr->per_cpu_io_queues = FALSE; ctrlr->num_io_queues = 1; num_vectors_requested = 2; /* one for admin, one for I/O */ @@ -1009,26 +1011,28 @@ nvme_ctrlr_construct(struct nvme_control if (pci_alloc_msix(dev, _vectors_allocated) != 0) { ctrlr->msix_enabled = 0; goto intx; - } else if (num_vectors_allocated < num_vectors_requested) { + } + + if (num_vectors_allocated < num_vectors_requested) { if (num_vectors_allocated < 2) { pci_release_msi(dev); ctrlr->msix_enabled = 0; goto intx; - } else { - ctrlr->per_cpu_io_queues = FALSE; - ctrlr->num_io_queues = 1; - /* -* Release whatever vectors were allocated, and just -* reallocate the two needed for the admin and single -* I/O qpair. -*/ - num_vectors_allocated = 2; - pci_release_msi(dev); - if (pci_alloc_msix(dev, _vectors_allocated) != 0) - panic("could not reallocate any vectors\n"); - if (num_vectors_allocated != 2) - panic("could not reallocate 2 vectors\n"); } + + ctrlr->per_cpu_io_queues = FALSE; + ctrlr->num_io_queues = 1; + /* +* Release whatever vectors were allocated, and just +* reallocate the two needed for the admin and single +* I/O qpair. +*/ + num_vectors_allocated = 2; + pci_release_msi(dev); + if (pci_alloc_msix(dev, _vectors_allocated) != 0) + panic("could not reallocate any vectors\n"); + if (num_vectors_allocated != 2) + panic("could not reallocate 2 vectors\n"); } /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r293227 - head/etc
On 2016-01-06 01:40, Bruce Evans wrote: On Tue, 5 Jan 2016, Allan Jude wrote: On 2016-01-05 22:16, Devin Teske wrote: This e-mail is extremely hard to parse and I think you are mistaken. The -f flag is more than just a counter to a possible -i Try to rm a file that has schg You will get a prompt without -i Adding -f will abate the prompt to attempt override of schg flag. I forgot about the permissions check. Normally root has permission to write anything, but some file flags change this. The schg flag is handled bogusly: rm prompts without -f, but schg prevents removal if you answer 'y'. The uchg flag is handled better. rm has special undocumented code to handle it, mainly so that rm -rf blows it away. Without -f, rm prompts but the the special code removes uchg so that removal is possible. The permissions check only applies to the file. Removal doesn't depend on the file's permissions. It only depends on the file's flags and the directory's permissions and flags. rm agrees with its man page and doesn't prompt if the file is writable but the directory is unwritable. The directory permissions don't stop root either, but immutable directories do. Since there is no prompt, -f has no effect on anyone in this case. There are more conditions in rm that lead to a prompt than simply those conditions involving -i and adding -f abates them all. It isn't clear what these are. POSIX only says that there is a prompt without -i for files which don't have write permission (to themselves). FreeBSD's man page should say more about how this extended for file flags, but actually says nothing for file flags and is less clear than POSIX for ordinary permissions. I think this is kind of a poor UI design of rm(1) honestly. It seems like what we need is a 'never be interactive' flag, that won't surpress the error message about the schg'd file, or read-only file system, but won't try to prompt for it. Although adding a new flag to rm(1) at this point probably doesn't make sense. It already has this flag, namely -f. This is what I started out to say. -f never suppresses errors except ENOENT for a non-existent file. What it suppresses is prompts. Since the uchg hack involves a prompt, -f also changes the semantics for removing user-immutable files. The file flags hack includes uappnd together with uchg, but not the newfangled uunlnk. That has only been available for annoying sysadmins since 1997. Apparently its name is to confusing for it to be used. Bruce In most of the cases involved in the firstboot script, the cause of the prompt is that the file system is mounted readonly. So Warner's solution of mounting the filesystem rw, doing the rm, then reverting it to readonly would seem to work, although I wonder if there is a case where the file system was NOT readonly at the start of the script, and ends up read only at the end. -- Allan Jude ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293325 - head/sys/dev/nvme
Author: jimharris Date: Thu Jan 7 16:09:56 2016 New Revision: 293325 URL: https://svnweb.freebsd.org/changeset/base/293325 Log: nvme: remove per_cpu_io_queues from struct nvme_controller Instead just use num_io_queues to make this determination. This prepares for some future changes enabling use of multiple queues when we do not have enough queues or MSI-X vectors for one queue per CPU. MFC after:3 days Sponsored by: Intel Modified: head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme_ctrlr.c == --- head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:08:04 2016 (r293324) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:09:56 2016 (r293325) @@ -160,7 +160,7 @@ nvme_ctrlr_construct_io_qpairs(struct nv num_trackers, ctrlr); - if (ctrlr->per_cpu_io_queues) + if (ctrlr->num_io_queues > 1) bus_bind_intr(ctrlr->dev, qpair->res, i); } @@ -402,7 +402,6 @@ nvme_ctrlr_set_num_qpairs(struct nvme_co nvme_io_qpair_destroy(>ioq[i]); ctrlr->num_io_queues = 1; - ctrlr->per_cpu_io_queues = 0; } return (0); @@ -779,7 +778,6 @@ nvme_ctrlr_configure_intx(struct nvme_co { ctrlr->num_io_queues = 1; - ctrlr->per_cpu_io_queues = 0; ctrlr->rid = 0; ctrlr->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, >rid, RF_SHAREABLE | RF_ACTIVE); @@ -969,9 +967,8 @@ nvme_ctrlr_construct(struct nvme_control per_cpu_io_queues = 1; TUNABLE_INT_FETCH("hw.nvme.per_cpu_io_queues", _cpu_io_queues); - ctrlr->per_cpu_io_queues = per_cpu_io_queues ? TRUE : FALSE; - if (ctrlr->per_cpu_io_queues) + if (per_cpu_io_queues) ctrlr->num_io_queues = mp_ncpus; else ctrlr->num_io_queues = 1; @@ -1002,7 +999,6 @@ nvme_ctrlr_construct(struct nvme_control } if (pci_msix_count(dev) < num_vectors_requested) { - ctrlr->per_cpu_io_queues = FALSE; ctrlr->num_io_queues = 1; num_vectors_requested = 2; /* one for admin, one for I/O */ } @@ -1020,7 +1016,6 @@ nvme_ctrlr_construct(struct nvme_control goto intx; } - ctrlr->per_cpu_io_queues = FALSE; ctrlr->num_io_queues = 1; /* * Release whatever vectors were allocated, and just @@ -1192,7 +1187,7 @@ nvme_ctrlr_submit_io_request(struct nvme { struct nvme_qpair *qpair; - if (ctrlr->per_cpu_io_queues) + if (ctrlr->num_io_queues > 1) qpair = >ioq[curcpu]; else qpair = >ioq[0]; Modified: head/sys/dev/nvme/nvme_private.h == --- head/sys/dev/nvme/nvme_private.hThu Jan 7 16:08:04 2016 (r293324) +++ head/sys/dev/nvme/nvme_private.hThu Jan 7 16:09:56 2016 (r293325) @@ -265,7 +265,6 @@ struct nvme_controller { uint32_tenable_aborts; uint32_tnum_io_queues; - boolean_t per_cpu_io_queues; /* Fields for tracking progress during controller initialization. */ struct intr_config_hook config_hook; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293328 - head/sys/dev/nvme
Author: jimharris Date: Thu Jan 7 16:18:32 2016 New Revision: 293328 URL: https://svnweb.freebsd.org/changeset/base/293328 Log: nvme: do not revert o single I/O queue when per-CPU queues not possible Previously nvme(4) would revert to a signle I/O queue if it could not allocate enought interrupt vectors or NVMe submission/completion queues to have one I/O queue per core. This patch determines how to utilize a smaller number of available interrupt vectors, and assigns (as closely as possible) an equal number of cores to each associated I/O queue. MFC after:3 days Sponsored by: Intel Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme.c == --- head/sys/dev/nvme/nvme.cThu Jan 7 16:12:42 2016(r293327) +++ head/sys/dev/nvme/nvme.cThu Jan 7 16:18:32 2016(r293328) @@ -270,8 +270,6 @@ nvme_attach(device_t dev) return (status); } - nvme_sysctl_initialize_ctrlr(ctrlr); - pci_enable_busmaster(dev); ctrlr->config_hook.ich_func = nvme_ctrlr_start_config_hook; Modified: head/sys/dev/nvme/nvme_ctrlr.c == --- head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:12:42 2016 (r293327) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:18:32 2016 (r293328) @@ -42,6 +42,12 @@ __FBSDID("$FreeBSD$"); #include "nvme_private.h" +/* + * Used for calculating number of CPUs to assign to each core and number of I/O + * queues to allocate per controller. + */ +#define NVME_CEILING(num, div) num) - 1) / (div)) + 1) + static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr, struct nvme_async_event_request *aer); static void nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr); @@ -141,6 +147,13 @@ nvme_ctrlr_construct_io_qpairs(struct nv */ num_trackers = min(num_trackers, (num_entries-1)); + /* +* This was calculated previously when setting up interrupts, but +* a controller could theoretically support fewer I/O queues than +* MSI-X vectors. So calculate again here just to be safe. +*/ + ctrlr->num_cpus_per_ioq = NVME_CEILING(mp_ncpus, ctrlr->num_io_queues); + ctrlr->ioq = malloc(ctrlr->num_io_queues * sizeof(struct nvme_qpair), M_NVME, M_ZERO | M_WAITOK); @@ -161,8 +174,13 @@ nvme_ctrlr_construct_io_qpairs(struct nv num_trackers, ctrlr); + /* +* Do not bother binding interrupts if we only have one I/O +* interrupt thread for this controller. +*/ if (ctrlr->num_io_queues > 1) - bus_bind_intr(ctrlr->dev, qpair->res, i); + bus_bind_intr(ctrlr->dev, qpair->res, + i * ctrlr->num_cpus_per_ioq); } return (0); @@ -307,8 +325,15 @@ nvme_ctrlr_hw_reset(struct nvme_controll int i; nvme_admin_qpair_disable(>adminq); - for (i = 0; i < ctrlr->num_io_queues; i++) - nvme_io_qpair_disable(>ioq[i]); + /* +* I/O queues are not allocated before the initial HW +* reset, so do not try to disable them. Use is_initialized +* to determine if this is the initial HW reset. +*/ + if (ctrlr->is_initialized) { + for (i = 0; i < ctrlr->num_io_queues; i++) + nvme_io_qpair_disable(>ioq[i]); + } DELAY(100*1000); @@ -364,7 +389,7 @@ static int nvme_ctrlr_set_num_qpairs(struct nvme_controller *ctrlr) { struct nvme_completion_poll_status status; - int cq_allocated, i, sq_allocated; + int cq_allocated, sq_allocated; status.done = FALSE; nvme_ctrlr_cmd_set_num_queues(ctrlr, ctrlr->num_io_queues, @@ -385,25 +410,12 @@ nvme_ctrlr_set_num_qpairs(struct nvme_co cq_allocated = (status.cpl.cdw0 >> 16) + 1; /* -* Check that the controller was able to allocate the number of -* queues we requested. If not, revert to one IO queue pair. +* Controller may allocate more queues than we requested, +* so use the minimum of the number requested and what was +* actually allocated. */ - if (sq_allocated < ctrlr->num_io_queues || - cq_allocated < ctrlr->num_io_queues) { - - /* -* Destroy extra IO queue pairs that were created at -* controller construction time but are no longer -* needed. This will only happen when a
Re: svn commit: r293328 - head/sys/dev/nvme
-Original Message- From:on behalf of Jim Harris Date: 2016-01-07, Thursday at 08:18 To: , , Subject: svn commit: r293328 - head/sys/dev/nvme >Author: jimharris >Date: Thu Jan 7 16:18:32 2016 >New Revision: 293328 >URL: https://svnweb.freebsd.org/changeset/base/293328 > >... > >Modified: head/sys/dev/nvme/nvme_ctrlr.c >== >--- head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:12:42 2016 >(r293327) >+++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:18:32 2016 >(r293328) >@@ -42,6 +42,12 @@ __FBSDID("$FreeBSD$"); > > #include "nvme_private.h" > >+/* >+ * Used for calculating number of CPUs to assign to each core and number of >I/O >+ * queues to allocate per controller. >+ */ >+#define NVME_CEILING(num, div)num) - 1) / (div)) + 1) >+ > >... I'm surprised that this isn't in , along with roundup()/rounddown()/etc. Finding the ceiling like this is probably pretty common, so shouldn't it be added to the common header so everyone can use it? -Ravi (rpokala@) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293332 - head/sys/dev/e1000
Author: sbruno Date: Thu Jan 7 16:48:47 2016 New Revision: 293332 URL: https://svnweb.freebsd.org/changeset/base/293332 Log: Disable the reuse of checksum offload context descriptors in the case of multiple queues in em(4). Document errata in the code. MFC after:2 weeks Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D3995 Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Thu Jan 7 16:42:48 2016(r293331) +++ head/sys/dev/e1000/if_em.c Thu Jan 7 16:48:47 2016(r293332) @@ -3735,29 +3735,38 @@ em_transmit_checksum_setup(struct tx_rin offload |= CSUM_TCP; tucss = hdr_len; tucso = hdr_len + offsetof(struct tcphdr, th_sum); - /* -* Setting up new checksum offload context for every frames -* takes a lot of processing time for hardware. This also -* reduces performance a lot for small sized frames so avoid -* it if driver can use previously configured checksum -* offload context. -*/ - if (txr->last_hw_offload == offload) { - if (offload & CSUM_IP) { - if (txr->last_hw_ipcss == ipcss && - txr->last_hw_ipcso == ipcso && - txr->last_hw_tucss == tucss && - txr->last_hw_tucso == tucso) - return; - } else { - if (txr->last_hw_tucss == tucss && - txr->last_hw_tucso == tucso) - return; - } - } - txr->last_hw_offload = offload; - txr->last_hw_tucss = tucss; - txr->last_hw_tucso = tucso; + /* +* The 82574L can only remember the *last* context used +* regardless of queue that it was use for. We cannot reuse +* contexts on this hardware platform and must generate a new +* context every time. 82574L hardware spec, section 7.2.6, +* second note. +*/ + if (adapter->num_queues < 2) { + /* + * Setting up new checksum offload context for every + * frames takes a lot of processing time for hardware. + * This also reduces performance a lot for small sized + * frames so avoid it if driver can use previously + * configured checksum offload context. + */ + if (txr->last_hw_offload == offload) { + if (offload & CSUM_IP) { + if (txr->last_hw_ipcss == ipcss && + txr->last_hw_ipcso == ipcso && + txr->last_hw_tucss == tucss && + txr->last_hw_tucso == tucso) + return; + } else { + if (txr->last_hw_tucss == tucss && + txr->last_hw_tucso == tucso) + return; + } + } + txr->last_hw_offload = offload; + txr->last_hw_tucss = tucss; + txr->last_hw_tucso = tucso; + } /* * Start offset for payload checksum calculation. * End offset for payload checksum calculation. @@ -3773,29 +3782,38 @@ em_transmit_checksum_setup(struct tx_rin *txd_upper |= E1000_TXD_POPTS_TXSM << 8; tucss = hdr_len; tucso = hdr_len + offsetof(struct udphdr, uh_sum); - /* -* Setting up new checksum offload context for every frames -* takes a lot of processing time for hardware. This also -* reduces performance a lot for small sized frames so avoid -* it if driver can use previously configured checksum -* offload context. -*/ - if (txr->last_hw_offload == offload) { - if (offload & CSUM_IP) { - if (txr->last_hw_ipcss == ipcss && - txr->last_hw_ipcso == ipcso && - txr->last_hw_tucss == tucss && - txr->last_hw_tucso == tucso) -
Re: svn commit: r293328 - head/sys/dev/nvme
On Thu, 7 Jan 2016, Jim Harris wrote: On Thu, Jan 7, 2016 at 9:27 AM, Ravi Pokalawrote: ... + * Used for calculating number of CPUs to assign to each core and number of I/O + * queues to allocate per controller. + */ +#define NVME_CEILING(num, div)num) - 1) / (div)) + 1) + ... I'm surprised that this isn't in , along with roundup()/rounddown()/etc. Finding the ceiling like this is probably pretty common, so shouldn't it be added to the common header so everyone can use it? Good catch. howmany() does exactly this, just expressed differently. I'll switch over to that. Thanks! howmany() doesn't do exactly this. It has diferent bugs / range of applicability, I see about 10. Subtracting 1 instead of adding more than 1 gives overflow in different cases. Even the simple and not unreasonable case num = 0 gives overflow in NVME_CEILING() if div happens to be unsigned and not 1: NVME_CEILING(0, 2U) = UINTMAX / 2 + 1 = 0x8000 with 32-bit ints. Getting to 10 different bugs requires considering unreasonable cases with negative div or num, and nonsense cases with div = 0, and reasonable but unsupported cases with floating point args. C's broken division for negative integer values makes the details large. NVME_CEILING() is closer to supporting negative values than howmany() -- the magic 1 that it adds is to adjust for division of non-negative values rounding down. For division of negative values, the adjustment should be by -1 or 0, depending on the C bug and on whether you want to round negative results towards 0 or minus infinity. Howmany() is undocumented so its bugs are harder to see than in your own macro. Another one is that it is an unsafe macro with the name of a safe function-like API. This naming convention is more important for undocumented APIs. NVME_CEILING() follows it in reverse. Subtracting 1 instead of adding (div) - 1 is less robust but avoids multiple evaluation of div. Bruce ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293414 - in head/sys/boot: i386/loader userboot/userboot
Author: allanjude Date: Fri Jan 8 05:09:55 2016 New Revision: 293414 URL: https://svnweb.freebsd.org/changeset/base/293414 Log: Add support for ZFS Boot Environments to userboot (for bhyve and others) While here, also fix a possible null pointer Reported by: lattera MFC after:3 days Sponsored by: ScaleEngine Inc. Modified: head/sys/boot/i386/loader/main.c head/sys/boot/userboot/userboot/main.c Modified: head/sys/boot/i386/loader/main.c == --- head/sys/boot/i386/loader/main.cFri Jan 8 03:45:28 2016 (r293413) +++ head/sys/boot/i386/loader/main.cFri Jan 8 05:09:55 2016 (r293414) @@ -321,7 +321,8 @@ init_zfs_bootenv(char *currdev) currdev++; /* Remove the last element (current bootenv) */ beroot = strrchr(currdev, '/'); - beroot[0] = '\0'; + if (beroot != NULL) + beroot[0] = '\0'; beroot = currdev; Modified: head/sys/boot/userboot/userboot/main.c == --- head/sys/boot/userboot/userboot/main.c Fri Jan 8 03:45:28 2016 (r293413) +++ head/sys/boot/userboot/userboot/main.c Fri Jan 8 05:09:55 2016 (r293414) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); static void userboot_zfs_probe(void); static int userboot_zfs_found; +static void init_zfs_bootenv(char *currdev); #endif #defineUSERBOOT_VERSIONUSERBOOT_VERSION_3 @@ -190,6 +191,10 @@ extract_currdev(void) dev.d_unit = 0; } +#if defined(USERBOOT_ZFS_SUPPORT) + init_zfs_bootenv(zfs_fmtdev()); +#endif + env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(), userboot_setcurrdev, env_nounset); env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(), @@ -198,6 +203,29 @@ extract_currdev(void) #if defined(USERBOOT_ZFS_SUPPORT) static void +init_zfs_bootenv(char *currdev) +{ + char *beroot; + + /* Remove the trailing : */ + currdev[strlen(currdev) - 1] = '\0'; + setenv("zfs_be_active", currdev, 1); + /* Do not overwrite if already set */ + setenv("vfs.root.mountfrom", currdev, 0); + /* Forward past zfs: */ + currdev = strchr(currdev, ':'); + currdev++; + /* Remove the last element (current bootenv) */ + beroot = strrchr(currdev, '/'); + if (beroot != NULL) + beroot[0] = '\0'; + + beroot = currdev; + + setenv("zfs_be_root", beroot, 1); +} + +static void userboot_zfs_probe(void) { char devname[32]; @@ -237,6 +265,33 @@ command_lszfs(int argc, char *argv[]) } return (CMD_OK); } + +COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments", + command_reloadbe); + +static int +command_reloadbe(int argc, char *argv[]) +{ + int err; + + if (argc > 2) { + command_errmsg = "wrong number of arguments"; + return (CMD_ERROR); + } + + if (argc == 2) { + err = zfs_bootenv(argv[1]); + } else { + err = zfs_bootenv(getenv("zfs_be_root")); + } + + if (err != 0) { + command_errmsg = strerror(err); + return (CMD_ERROR); + } + + return (CMD_OK); +} #endif /* USERBOOT_ZFS_SUPPORT */ COMMAND_SET(quit, "quit", "exit the loader", command_quit); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r293328 - head/sys/dev/nvme
On Thu, Jan 7, 2016 at 9:27 AM, Ravi Pokalawrote: > -Original Message- > > > From: on behalf of Jim Harris > > Date: 2016-01-07, Thursday at 08:18 > To: , , < > svn-src-head@freebsd.org> > Subject: svn commit: r293328 - head/sys/dev/nvme > > >Author: jimharris > >Date: Thu Jan 7 16:18:32 2016 > >New Revision: 293328 > >URL: https://svnweb.freebsd.org/changeset/base/293328 > > > >... > > > >Modified: head/sys/dev/nvme/nvme_ctrlr.c > > >== > >--- head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:12:42 2016 > (r293327) > >+++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:18:32 2016 > (r293328) > >@@ -42,6 +42,12 @@ __FBSDID("$FreeBSD$"); > > > > #include "nvme_private.h" > > > >+/* > >+ * Used for calculating number of CPUs to assign to each core and number > of I/O > >+ * queues to allocate per controller. > >+ */ > >+#define NVME_CEILING(num, div)num) - 1) / (div)) + 1) > >+ > > > >... > > I'm surprised that this isn't in , along with > roundup()/rounddown()/etc. Finding the ceiling like this is probably pretty > common, so shouldn't it be added to the common header so everyone can use > it? > Good catch. howmany() does exactly this, just expressed differently. I'll switch over to that. Thanks! -Jim > > -Ravi (rpokala@) > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293350 - in head/sys/cam: ctl scsi
Author: kib Date: Thu Jan 7 20:22:55 2016 New Revision: 293350 URL: https://svnweb.freebsd.org/changeset/base/293350 Log: Convert sys/cam to use make_dev_s(). Reviewed by: hps, jhb Sponsored by: The FreeBSD Foundation MFC after:3 weeks Differential revision:https://reviews.freebsd.org/D4746 Modified: head/sys/cam/ctl/ctl.c head/sys/cam/scsi/scsi_ch.c head/sys/cam/scsi/scsi_enc.c head/sys/cam/scsi/scsi_pass.c head/sys/cam/scsi/scsi_pt.c head/sys/cam/scsi/scsi_sa.c head/sys/cam/scsi/scsi_sg.c Modified: head/sys/cam/ctl/ctl.c == --- head/sys/cam/ctl/ctl.c Thu Jan 7 20:15:09 2016(r293349) +++ head/sys/cam/ctl/ctl.c Thu Jan 7 20:22:55 2016(r293350) @@ -1778,6 +1778,7 @@ ctl_ha_role_sysctl(SYSCTL_HANDLER_ARGS) static int ctl_init(void) { + struct make_dev_args args; struct ctl_softc *softc; void *other_pool; int i, error; @@ -1785,9 +1786,17 @@ ctl_init(void) softc = control_softc = malloc(sizeof(*control_softc), M_DEVBUF, M_WAITOK | M_ZERO); - softc->dev = make_dev(_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0600, - "cam/ctl"); - softc->dev->si_drv1 = softc; + make_dev_args_init(); + args.mda_devsw = _cdevsw; + args.mda_uid = UID_ROOT; + args.mda_gid = GID_OPERATOR; + args.mda_mode = 0600; + args.mda_si_drv1 = softc; + error = make_dev_s(, >dev, "cam/ctl"); + if (error != 0) { + free(control_softc, M_DEVBUF); + return (error); + } sysctl_ctx_init(>sysctl_ctx); softc->sysctl_tree = SYSCTL_ADD_NODE(>sysctl_ctx, Modified: head/sys/cam/scsi/scsi_ch.c == --- head/sys/cam/scsi/scsi_ch.c Thu Jan 7 20:15:09 2016(r293349) +++ head/sys/cam/scsi/scsi_ch.c Thu Jan 7 20:22:55 2016(r293350) @@ -372,6 +372,8 @@ chregister(struct cam_periph *periph, vo struct ch_softc *softc; struct ccb_getdev *cgd; struct ccb_pathinq cpi; + struct make_dev_args args; + int error; cgd = (struct ccb_getdev *)arg; if (cgd == NULL) { @@ -431,11 +433,20 @@ chregister(struct cam_periph *periph, vo /* Register the device */ - softc->dev = make_dev(_cdevsw, periph->unit_number, UID_ROOT, - GID_OPERATOR, 0600, "%s%d", periph->periph_name, - periph->unit_number); + make_dev_args_init(); + args.mda_devsw = _cdevsw; + args.mda_unit = periph->unit_number; + args.mda_uid = UID_ROOT; + args.mda_gid = GID_OPERATOR; + args.mda_mode = 0600; + args.mda_si_drv1 = periph; + error = make_dev_s(, >dev, "%s%d", periph->periph_name, + periph->unit_number); cam_periph_lock(periph); - softc->dev->si_drv1 = periph; + if (error != 0) { + cam_periph_release_locked(periph); + return (CAM_REQ_CMP_ERR); + } /* * Add an async callback so that we get @@ -507,8 +518,6 @@ chclose(struct cdev *dev, int flag, int struct mtx *mtx; periph = (struct cam_periph *)dev->si_drv1; - if (periph == NULL) - return(ENXIO); mtx = cam_periph_mtx(periph); mtx_lock(mtx); @@ -754,9 +763,6 @@ chioctl(struct cdev *dev, u_long cmd, ca int error; periph = (struct cam_periph *)dev->si_drv1; - if (periph == NULL) - return(ENXIO); - cam_periph_lock(periph); CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering chioctl\n")); Modified: head/sys/cam/scsi/scsi_enc.c == --- head/sys/cam/scsi/scsi_enc.cThu Jan 7 20:15:09 2016 (r293349) +++ head/sys/cam/scsi/scsi_enc.cThu Jan 7 20:22:55 2016 (r293350) @@ -264,10 +264,6 @@ enc_open(struct cdev *dev, int flags, in int error = 0; periph = (struct cam_periph *)dev->si_drv1; - if (periph == NULL) { - return (ENXIO); - } - if (cam_periph_acquire(periph) != CAM_REQ_CMP) return (ENXIO); @@ -302,8 +298,6 @@ enc_close(struct cdev *dev, int flag, in struct mtx *mtx; periph = (struct cam_periph *)dev->si_drv1; - if (periph == NULL) - return (ENXIO); mtx = cam_periph_mtx(periph); mtx_lock(mtx); @@ -364,9 +358,6 @@ enc_ioctl(struct cdev *dev, u_long cmd, addr = NULL; periph = (struct cam_periph *)dev->si_drv1; - if (periph == NULL) - return (ENXIO); - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering encioctl\n")); cam_periph_lock(periph); @@ -905,6 +896,7 @@
Re: svn commit: r293328 - head/sys/dev/nvme
I believe it's spelled "howmany()." On Thu, Jan 7, 2016 at 8:27 AM, Ravi Pokalawrote: > -Original Message- > > > From: on behalf of Jim Harris > > Date: 2016-01-07, Thursday at 08:18 > To: , , > > Subject: svn commit: r293328 - head/sys/dev/nvme > >>Author: jimharris >>Date: Thu Jan 7 16:18:32 2016 >>New Revision: 293328 >>URL: https://svnweb.freebsd.org/changeset/base/293328 >> >>... >> >>Modified: head/sys/dev/nvme/nvme_ctrlr.c >>== >>--- head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:12:42 2016 >>(r293327) >>+++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:18:32 2016 >>(r293328) >>@@ -42,6 +42,12 @@ __FBSDID("$FreeBSD$"); >> >> #include "nvme_private.h" >> >>+/* >>+ * Used for calculating number of CPUs to assign to each core and number of >>I/O >>+ * queues to allocate per controller. >>+ */ >>+#define NVME_CEILING(num, div)num) - 1) / (div)) + 1) >>+ >> >>... > > I'm surprised that this isn't in , along with > roundup()/rounddown()/etc. Finding the ceiling like this is probably pretty > common, so shouldn't it be added to the common header so everyone can use it? > > -Ravi (rpokala@) > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293352 - in head: share/man/man4 sys/dev/nvme
Author: jimharris Date: Thu Jan 7 20:32:04 2016 New Revision: 293352 URL: https://svnweb.freebsd.org/changeset/base/293352 Log: nvme: add hw.nvme.min_cpus_per_ioq tunable Due to FreeBSD system-wide limits on number of MSI-X vectors (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199321), it may be desirable to allocate fewer than the maximum number of vectors for an NVMe device, in order to save vectors for other devices (usually Ethernet) that can take better advantage of them and may be probed after NVMe. This tunable is expressed in terms of minimum number of CPUs per I/O queue instead of max number of queues per controller, to allow for a more even distribution of CPUs per queue. This avoids cases where some number of CPUs have a dedicated queue, but other CPUs need to share queues. Ideally the PR referenced above will eventually be fixed and the mechanism implemented here becomes obsolete anyways. While here, fix a bug in the CPUs per I/O queue calculation to properly account for the admin queue's MSI-X vector. Reviewed by: gallatin MFC after:3 days Sponsored by: Intel Modified: head/share/man/man4/nvme.4 head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_sysctl.c Modified: head/share/man/man4/nvme.4 == --- head/share/man/man4/nvme.4 Thu Jan 7 20:24:30 2016(r293351) +++ head/share/man/man4/nvme.4 Thu Jan 7 20:32:04 2016(r293352) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2012-2014 Intel Corporation +.\" Copyright (c) 2012-2016 Intel Corporation .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2014 +.Dd January 7, 2016 .Dt NVME 4 .Os .Sh NAME @@ -89,7 +89,10 @@ not 0, and this driver follows that conv By default, .Nm will create an I/O queue pair for each CPU, provided enough MSI-X vectors -can be allocated. +and NVMe queue pairs can be allocated. If not enough vectors or queue +pairs are available, nvme(4) will use a smaller number of queue pairs and +assign multiple CPUs per queue pair. +.Pp To force a single I/O queue pair shared by all CPUs, set the following tunable value in .Xr loader.conf 5 : @@ -97,6 +100,13 @@ tunable value in hw.nvme.per_cpu_io_queues=0 .Ed .Pp +To assign more than one CPU per I/O queue pair, thereby reducing the number +of MSI-X vectors consumed by the device, set the following tunable value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.nvme.min_cpus_per_ioq=X +.Ed +.Pp To force legacy interrupts for all .Nm driver instances, set the following tunable value in @@ -109,6 +119,8 @@ Note that use of INTx implies disabling .Sh SYSCTL VARIABLES The following controller-level sysctls are currently implemented: .Bl -tag -width indent +.It Va dev.nvme.0.num_cpus_per_ioq +(R) Number of CPUs associated with each I/O queue pair. .It Va dev.nvme.0.int_coal_time (R/W) Interrupt coalescing timer period in microseconds. Set to 0 to disable. Modified: head/sys/dev/nvme/nvme_ctrlr.c == --- head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 20:24:30 2016 (r293351) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 20:32:04 2016 (r293352) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2012-2015 Intel Corporation + * Copyright (C) 2012-2016 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -978,13 +978,27 @@ nvme_ctrlr_setup_interrupts(struct nvme_ { device_tdev; int per_cpu_io_queues; + int min_cpus_per_ioq; int num_vectors_requested, num_vectors_allocated; int num_vectors_available; dev = ctrlr->dev; + min_cpus_per_ioq = 1; + TUNABLE_INT_FETCH("hw.nvme.min_cpus_per_ioq", _cpus_per_ioq); + + if (min_cpus_per_ioq < 1) { + min_cpus_per_ioq = 1; + } else if (min_cpus_per_ioq > mp_ncpus) { + min_cpus_per_ioq = mp_ncpus; + } + per_cpu_io_queues = 1; TUNABLE_INT_FETCH("hw.nvme.per_cpu_io_queues", _cpu_io_queues); + if (per_cpu_io_queues == 0) { + min_cpus_per_ioq = mp_ncpus; + } + ctrlr->force_intx = 0; TUNABLE_INT_FETCH("hw.nvme.force_intx", >force_intx); @@ -1010,10 +1024,12 @@ nvme_ctrlr_setup_interrupts(struct nvme_ return; } - if (per_cpu_io_queues) - ctrlr->num_cpus_per_ioq = NVME_CEILING(mp_ncpus, num_vectors_available + 1); - else - ctrlr->num_cpus_per_ioq = mp_ncpus; + /* +* Do not use all vectors for I/O queues - one must be saved for the +* admin queue. +*/ + ctrlr->num_cpus_per_ioq = max(min_cpus_per_ioq, +
svn commit: r293354 - head/sys/dev/nvme
Author: jimharris Date: Thu Jan 7 20:35:26 2016 New Revision: 293354 URL: https://svnweb.freebsd.org/changeset/base/293354 Log: nvme: replace NVME_CEILING macro with howmany() Suggested by: rpokala MFC after:3 days Modified: head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme_ctrlr.c == --- head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 20:34:06 2016 (r293353) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 20:35:26 2016 (r293354) @@ -42,12 +42,6 @@ __FBSDID("$FreeBSD$"); #include "nvme_private.h" -/* - * Used for calculating number of CPUs to assign to each core and number of I/O - * queues to allocate per controller. - */ -#define NVME_CEILING(num, div) num) - 1) / (div)) + 1) - static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr, struct nvme_async_event_request *aer); static void nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr); @@ -152,7 +146,7 @@ nvme_ctrlr_construct_io_qpairs(struct nv * a controller could theoretically support fewer I/O queues than * MSI-X vectors. So calculate again here just to be safe. */ - ctrlr->num_cpus_per_ioq = NVME_CEILING(mp_ncpus, ctrlr->num_io_queues); + ctrlr->num_cpus_per_ioq = howmany(mp_ncpus, ctrlr->num_io_queues); ctrlr->ioq = malloc(ctrlr->num_io_queues * sizeof(struct nvme_qpair), M_NVME, M_ZERO | M_WAITOK); @@ -1029,9 +1023,9 @@ nvme_ctrlr_setup_interrupts(struct nvme_ * admin queue. */ ctrlr->num_cpus_per_ioq = max(min_cpus_per_ioq, - NVME_CEILING(mp_ncpus, num_vectors_available - 1)); + howmany(mp_ncpus, num_vectors_available - 1)); - ctrlr->num_io_queues = NVME_CEILING(mp_ncpus, ctrlr->num_cpus_per_ioq); + ctrlr->num_io_queues = howmany(mp_ncpus, ctrlr->num_cpus_per_ioq); num_vectors_requested = ctrlr->num_io_queues + 1; num_vectors_allocated = num_vectors_requested; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293357 - head/tools/build/mk
Author: garga (ports committer) Date: Thu Jan 7 20:37:18 2016 New Revision: 293357 URL: https://svnweb.freebsd.org/changeset/base/293357 Log: Obsolete inetd related files when WITHOUT_INETD is set Reviewed by: bapt Approved by: gnn MFC after:1 week Sponsored by: Rubiconn Communications (Netgate) Differential Revision:https://reviews.freebsd.org/D4742 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc == --- head/tools/build/mk/OptionalObsoleteFiles.inc Thu Jan 7 20:37:07 2016(r293356) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Thu Jan 7 20:37:18 2016(r293357) @@ -2834,6 +2834,13 @@ OLD_FILES+=usr/share/man/man8/traceroute OLD_FILES+=rescue/ping6 .endif +.if ${MK_INETD} == no +OLD_FILES+=etc/rc.d/inetd +OLD_FILES+=usr/sbin/inetd +OLD_FILES+=usr/share/man/man5/inetd.conf.5.gz +OLD_FILES+=usr/share/man/man8/inetd.8.gz +.endif + .if ${MK_IPFILTER} == no OLD_FILES+=etc/periodic/security/510.ipfdenied OLD_FILES+=etc/periodic/security/610.ipf6denied ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293359 - in head/bin/sh: . tests/builtins
Author: jilles Date: Thu Jan 7 20:48:24 2016 New Revision: 293359 URL: https://svnweb.freebsd.org/changeset/base/293359 Log: sh: Ensure OPTIND=1 in subshell without forking does not affect outer env. Command substitutions containing a single simple command and here-document expansion are performed in a subshell environment, but may not fork. Any modified state of the shell environment should be restored afterward. The state that OPTIND=1 had been done was not saved and restored here. Note that the other parts of shellparam need not be saved and restored, since they are not modified in these situations (a fork is done before such modifications). Added: head/bin/sh/tests/builtins/getopts10.0 (contents, props changed) Modified: head/bin/sh/eval.c head/bin/sh/tests/builtins/Makefile Modified: head/bin/sh/eval.c == --- head/bin/sh/eval.c Thu Jan 7 20:43:45 2016(r293358) +++ head/bin/sh/eval.c Thu Jan 7 20:48:24 2016(r293359) @@ -496,10 +496,12 @@ exphere(union node *redir, struct arglis struct jmploc *savehandler; struct localvar *savelocalvars; int need_longjmp = 0; + unsigned char saveoptreset; redir->nhere.expdoc = ""; savelocalvars = localvars; localvars = NULL; + saveoptreset = shellparam.reset; forcelocal++; savehandler = handler; if (setjmp(jmploc.loc)) @@ -514,6 +516,7 @@ exphere(union node *redir, struct arglis forcelocal--; poplocalvars(); localvars = savelocalvars; + shellparam.reset = saveoptreset; if (need_longjmp) longjmp(handler->loc, 1); INTON; @@ -647,6 +650,7 @@ evalbackcmd(union node *n, struct backcm struct jmploc jmploc; struct jmploc *savehandler; struct localvar *savelocalvars; + unsigned char saveoptreset; result->fd = -1; result->buf = NULL; @@ -661,6 +665,7 @@ evalbackcmd(union node *n, struct backcm if (is_valid_fast_cmdsubst(n)) { savelocalvars = localvars; localvars = NULL; + saveoptreset = shellparam.reset; forcelocal++; savehandler = handler; if (setjmp(jmploc.loc)) { @@ -671,6 +676,7 @@ evalbackcmd(union node *n, struct backcm forcelocal--; poplocalvars(); localvars = savelocalvars; + shellparam.reset = saveoptreset; longjmp(handler->loc, 1); } } else { @@ -681,6 +687,7 @@ evalbackcmd(union node *n, struct backcm forcelocal--; poplocalvars(); localvars = savelocalvars; + shellparam.reset = saveoptreset; } else { if (pipe(pip) < 0) error("Pipe call failed: %s", strerror(errno)); Modified: head/bin/sh/tests/builtins/Makefile == --- head/bin/sh/tests/builtins/Makefile Thu Jan 7 20:43:45 2016 (r293358) +++ head/bin/sh/tests/builtins/Makefile Thu Jan 7 20:48:24 2016 (r293359) @@ -95,6 +95,7 @@ FILES+= getopts6.0 FILES+=getopts7.0 FILES+=getopts8.0 getopts8.0.stdout FILES+=getopts9.0 getopts9.0.stdout +FILES+=getopts10.0 FILES+=hash1.0 hash1.0.stdout FILES+=hash2.0 hash2.0.stdout FILES+=hash3.0 hash3.0.stdout Added: head/bin/sh/tests/builtins/getopts10.0 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/builtins/getopts10.0 Thu Jan 7 20:48:24 2016 (r293359) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +set -- -x arg +opt=not +getopts x opt +r1=$? OPTIND1=$OPTIND opt1=$opt +: $(: $((OPTIND = 1))) +getopts x opt +r2=$? OPTIND2=$OPTIND +[ "$r1" = 0 ] && [ "$OPTIND1" = 2 ] && [ "$opt1" = x ] && [ "$r2" != 0 ] && + [ "$OPTIND2" = 2 ] ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293320 - head/sys/dev/nvd
Author: jimharris Date: Thu Jan 7 15:57:17 2016 New Revision: 293320 URL: https://svnweb.freebsd.org/changeset/base/293320 Log: nvd: do not wait for previous bios before submitting ordered bio Still wait until all in-flight bios (including the ordered bio) complete before processing more bios from the queue. MFC after:3 days Sponsored by: Intel Modified: head/sys/dev/nvd/nvd.c Modified: head/sys/dev/nvd/nvd.c == --- head/sys/dev/nvd/nvd.c Thu Jan 7 15:55:41 2016(r293319) +++ head/sys/dev/nvd/nvd.c Thu Jan 7 15:57:17 2016(r293320) @@ -204,19 +204,6 @@ nvd_bioq_process(void *arg, int pending) if (bp == NULL) break; -#ifdef BIO_ORDERED - /* -* BIO_ORDERED flag dictates that all outstanding bios -* must be completed before processing the bio with -* BIO_ORDERED flag set. -*/ - if (bp->bio_flags & BIO_ORDERED) { - while (ndisk->cur_depth > 0) { - pause("nvd flush", 1); - } - } -#endif - bp->bio_driver1 = NULL; atomic_add_int(>cur_depth, 1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293327 - head/sys/dev/nvme
Author: jimharris Date: Thu Jan 7 16:12:42 2016 New Revision: 293327 URL: https://svnweb.freebsd.org/changeset/base/293327 Log: nvme: break out interrupt setup code into a separate function MFC after:3 days Sponsored by: Intel Modified: head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme_ctrlr.c == --- head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:11:31 2016 (r293326) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jan 7 16:12:42 2016 (r293327) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr, struct nvme_async_event_request *aer); +static void nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr); static int nvme_ctrlr_allocate_bar(struct nvme_controller *ctrlr) @@ -777,6 +778,7 @@ static int nvme_ctrlr_configure_intx(struct nvme_controller *ctrlr) { + ctrlr->msix_enabled = 0; ctrlr->num_io_queues = 1; ctrlr->rid = 0; ctrlr->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, @@ -924,80 +926,35 @@ static struct cdevsw nvme_ctrlr_cdevsw = .d_ioctl = nvme_ctrlr_ioctl }; -int -nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) +static void +nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr) { - union cap_lo_register cap_lo; - union cap_hi_register cap_hi; - int per_cpu_io_queues; - int num_vectors_requested, num_vectors_allocated; - int status, timeout_period; - - ctrlr->dev = dev; - - mtx_init(>lock, "nvme ctrlr lock", NULL, MTX_DEF); - - status = nvme_ctrlr_allocate_bar(ctrlr); - - if (status != 0) - return (status); - - /* -* Software emulators may set the doorbell stride to something -* other than zero, but this driver is not set up to handle that. -*/ - cap_hi.raw = nvme_mmio_read_4(ctrlr, cap_hi); - if (cap_hi.bits.dstrd != 0) - return (ENXIO); - - ctrlr->min_page_size = 1 << (12 + cap_hi.bits.mpsmin); - - /* Get ready timeout value from controller, in units of 500ms. */ - cap_lo.raw = nvme_mmio_read_4(ctrlr, cap_lo); - ctrlr->ready_timeout_in_ms = cap_lo.bits.to * 500; - - timeout_period = NVME_DEFAULT_TIMEOUT_PERIOD; - TUNABLE_INT_FETCH("hw.nvme.timeout_period", _period); - timeout_period = min(timeout_period, NVME_MAX_TIMEOUT_PERIOD); - timeout_period = max(timeout_period, NVME_MIN_TIMEOUT_PERIOD); - ctrlr->timeout_period = timeout_period; - - nvme_retry_count = NVME_DEFAULT_RETRY_COUNT; - TUNABLE_INT_FETCH("hw.nvme.retry_count", _retry_count); + device_tdev; + int per_cpu_io_queues; + int num_vectors_requested, num_vectors_allocated; + dev = ctrlr->dev; per_cpu_io_queues = 1; TUNABLE_INT_FETCH("hw.nvme.per_cpu_io_queues", _cpu_io_queues); - if (per_cpu_io_queues) - ctrlr->num_io_queues = mp_ncpus; - else - ctrlr->num_io_queues = 1; - ctrlr->force_intx = 0; TUNABLE_INT_FETCH("hw.nvme.force_intx", >force_intx); - ctrlr->enable_aborts = 0; - TUNABLE_INT_FETCH("hw.nvme.enable_aborts", >enable_aborts); + if (ctrlr->force_intx || pci_msix_count(dev) < 2) { + nvme_ctrlr_configure_intx(ctrlr); + return; + } ctrlr->msix_enabled = 1; - if (ctrlr->force_intx) { - ctrlr->msix_enabled = 0; - goto intx; - } + if (per_cpu_io_queues) + ctrlr->num_io_queues = mp_ncpus; + else + ctrlr->num_io_queues = 1; /* One vector per IO queue, plus one vector for admin queue. */ num_vectors_requested = ctrlr->num_io_queues + 1; - /* -* If we cannot even allocate 2 vectors (one for admin, one for -* I/O), then revert to INTx. -*/ - if (pci_msix_count(dev) < 2) { - ctrlr->msix_enabled = 0; - goto intx; - } - if (pci_msix_count(dev) < num_vectors_requested) { ctrlr->num_io_queues = 1; num_vectors_requested = 2; /* one for admin, one for I/O */ @@ -1005,15 +962,15 @@ nvme_ctrlr_construct(struct nvme_control num_vectors_allocated = num_vectors_requested; if (pci_alloc_msix(dev, _vectors_allocated) != 0) { - ctrlr->msix_enabled = 0; - goto intx; + nvme_ctrlr_configure_intx(ctrlr); + return; } if (num_vectors_allocated < num_vectors_requested) { if (num_vectors_allocated < 2) { pci_release_msi(dev); -
svn commit: r293346 - in head: share/man/man9 sys/kern sys/sys
Author: kib Date: Thu Jan 7 20:08:02 2016 New Revision: 293346 URL: https://svnweb.freebsd.org/changeset/base/293346 Log: Provide yet another KPI for cdev creation, make_dev_s(9). Immediate problem fixed by the new KPI is the long-standing race between device creation and assignments to cdev->si_drv1 and cdev->si_drv2, which allows the window where cdevsw methods might be called with si_drv1,2 fields not yet set. Devices typically checked for NULL and returned spurious errors to usermode, and often left some methods unchecked. The new function interface is designed to be extensible, which should allow to add more features to make_dev_s(9) without inventing yet another name for function to create devices, while maintaining KPI and even KBI backward-compatibility. Reviewed by: hps, jhb Sponsored by: The FreeBSD Foundation MFC after:3 weeks Differential revision:https://reviews.freebsd.org/D4746 Modified: head/share/man/man9/Makefile head/share/man/man9/make_dev.9 head/sys/kern/kern_conf.c head/sys/sys/conf.h Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileThu Jan 7 19:58:23 2016 (r293345) +++ head/share/man/man9/MakefileThu Jan 7 20:08:02 2016 (r293346) @@ -1013,7 +1013,8 @@ MLINKS+=make_dev.9 destroy_dev.9 \ make_dev.9 make_dev_alias_p.9 \ make_dev.9 make_dev_cred.9 \ make_dev.9 make_dev_credf.9 \ - make_dev.9 make_dev_p.9 + make_dev.9 make_dev_p.9 \ + make_dev.9 make_dev_s.9 MLINKS+=malloc.9 free.9 \ malloc.9 MALLOC_DECLARE.9 \ malloc.9 MALLOC_DEFINE.9 \ Modified: head/share/man/man9/make_dev.9 == --- head/share/man/man9/make_dev.9 Thu Jan 7 19:58:23 2016 (r293345) +++ head/share/man/man9/make_dev.9 Thu Jan 7 20:08:02 2016 (r293346) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Dec 22, 2012 +.Dd Jan 3, 2016 .Dt MAKE_DEV 9 .Os .Sh NAME @@ -32,6 +32,7 @@ .Nm make_dev_cred , .Nm make_dev_credf , .Nm make_dev_p , +.Nm make_dev_s , .Nm make_dev_alias , .Nm make_dev_alias_p , .Nm destroy_dev , @@ -45,16 +46,10 @@ and DEVFS registration for devices .Sh SYNOPSIS .In sys/param.h .In sys/conf.h -.Ft struct cdev * -.Fn make_dev "struct cdevsw *cdevsw" "int unit" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... -.Ft struct cdev * -.Fn make_dev_cred "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... -.Ft struct cdev * -.Fn make_dev_credf "int flags" "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... +.Ft void +.Fn make_dev_args_init "struct make_dev_args *args" .Ft int -.Fn make_dev_p "int flags" "struct cdev **cdev" "struct cdevsw *devsw" "struct ucred *cr" "uid_t uid" "gid_t gid" "int mode" "const char *fmt" ... -.Ft struct cdev * -.Fn make_dev_alias "struct cdev *pdev" "const char *fmt" ... +.Fn make_dev_s "struct make_dev_args *args" "struct cdev **cdev" "const char *fmt" ... .Ft int .Fn make_dev_alias_p "int flags" "struct cdev **cdev" "struct cdev *pdev" "const char *fmt" ... .Ft void @@ -67,12 +62,26 @@ and DEVFS registration for devices .Fn destroy_dev_drain "struct cdevsw *csw" .Ft void .Fn dev_depends "struct cdev *pdev" "struct cdev *cdev" +.Pp +LEGACY INTERFACES +.Ft struct cdev * +.Fn make_dev "struct cdevsw *cdevsw" "int unit" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... +.Ft struct cdev * +.Fn make_dev_cred "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... +.Ft struct cdev * +.Fn make_dev_credf "int flags" "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... +.Ft int +.Fn make_dev_p "int flags" "struct cdev **cdev" "struct cdevsw *devsw" "struct ucred *cr" "uid_t uid" "gid_t gid" "int mode" "const char *fmt" ... +.Ft struct cdev * +.Fn make_dev_alias "struct cdev *pdev" "const char *fmt" ... .Sh DESCRIPTION The -.Fn make_dev_credf +.Fn make_dev_s function creates a .Fa cdev -structure for a new device. +structure for a new device, which is returned into the +.Fa cdev +argument. It also notifies .Xr devfs 5 of the presence of the new device, that causes corresponding nodes @@ -80,10 +89,34 @@ to be created. Besides this, a .Xr devctl 4 notification is sent. -The device will be owned by -.Va uid , +The function takes the structure +.Va struct make_dev_args args , +which specifies the parameters for the device creation: +.Pp +.Bd -literal -offset indent -compact +struct make_dev_args { + size_t mda_size; + int mda_flags; + struct cdevsw *mda_devsw; + struct ucred*mda_cr; + uid_t
svn commit: r293361 - head/sys/sys
Author: bdrewery Date: Thu Jan 7 20:52:35 2016 New Revision: 293361 URL: https://svnweb.freebsd.org/changeset/base/293361 Log: Allow libnv to be built externally using GCC. GCC does not define _VA_LIST_DECLARED. It defines _VA_LIST_ and others. This was causing the prototype to not be defined and leading to an error later due to using nvlist_add_stringv(3) without a prototype in nvlist_add_stringf(3). This uses the same check as other va_list prototypes in the original change in r279438. Modified: head/sys/sys/nv.h Modified: head/sys/sys/nv.h == --- head/sys/sys/nv.h Thu Jan 7 20:50:03 2016(r293360) +++ head/sys/sys/nv.h Thu Jan 7 20:52:35 2016(r293361) @@ -146,7 +146,7 @@ void nvlist_add_bool(nvlist_t *nvl, cons void nvlist_add_number(nvlist_t *nvl, const char *name, uint64_t value); void nvlist_add_string(nvlist_t *nvl, const char *name, const char *value); void nvlist_add_stringf(nvlist_t *nvl, const char *name, const char *valuefmt, ...) __printflike(3, 4); -#ifdef _VA_LIST_DECLARED +#if !defined(_KERNEL) || defined(_VA_LIST_DECLARED) void nvlist_add_stringv(nvlist_t *nvl, const char *name, const char *valuefmt, va_list valueap) __printflike(3, 0); #endif void nvlist_add_nvlist(nvlist_t *nvl, const char *name, const nvlist_t *value); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293340 - head/lib/libdpv
Author: dteske Date: Thu Jan 7 18:50:02 2016 New Revision: 293340 URL: https://svnweb.freebsd.org/changeset/base/293340 Log: Increase maximum buffer size for `-x cmd' value MFC after:3 days X-MFC-to: stable/10 Modified: head/lib/libdpv/util.h Modified: head/lib/libdpv/util.h == --- head/lib/libdpv/util.h Thu Jan 7 18:41:03 2016(r293339) +++ head/lib/libdpv/util.h Thu Jan 7 18:50:02 2016(r293340) @@ -41,7 +41,7 @@ #define PATH_SHELL "/bin/sh" #endif -#define CMDBUFMAX 4096 +#define CMDBUFMAX 65536 __BEGIN_DECLS intshell_spawn_pipecmd(const char *_cmd, const char *_label, pid_t *_pid); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r286234 - head/sys/boot/common
On Mon, Aug 3, 2015 at 6:27 PM, Edward Tomasz Napieralawrote: > Author: trasz > Date: Mon Aug 3 16:27:36 2015 > New Revision: 286234 > URL: https://svnweb.freebsd.org/changeset/base/286234 > > Log: > Fix a problem which made loader(8) load non-kld files twice. > > For example, without this patch, the following three lines > in /boot/loader.conf would result in /boot/root.img being preloaded > twice, and two md(4) devices - md0 and md1 - being created. > > initmd_load="YES" > initmd_type="md_image" > initmd_name="/boot/root.img" > > Reviewed by: marcel@ > MFC after:1 month Do you still plan to MFC this commit to 10-STABLE / 10.3? > Sponsored by: The FreeBSD Foundation > Differential Revision:https://reviews.freebsd.org/D3204 > > Modified: > head/sys/boot/common/module.c > > Modified: head/sys/boot/common/module.c > == > --- head/sys/boot/common/module.c Mon Aug 3 14:58:46 2015 > (r286233) > +++ head/sys/boot/common/module.c Mon Aug 3 16:27:36 2015 > (r286234) > @@ -102,6 +102,7 @@ COMMAND_SET(load, "load", "load a kernel > static int > command_load(int argc, char *argv[]) > { > +struct preloaded_file *fp; > char *typestr; > intdofile, dokld, ch, error; > > @@ -139,6 +140,13 @@ command_load(int argc, char *argv[]) > command_errmsg = "invalid load type"; > return(CMD_ERROR); > } > + > + fp = file_findfile(argv[1], typestr); > + if (fp) { > + sprintf(command_errbuf, "warning: file '%s' already loaded", > argv[1]); > + return (CMD_ERROR); > + } > + > return (file_loadraw(argv[1], typestr, 1) ? CMD_OK : CMD_ERROR); > } > /* > ___ > 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-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293339 - in head/sys/dev: bwi if_ndis iwi malo otus ral rtwn usb/wlan
Author: avos Date: Thu Jan 7 18:41:03 2016 New Revision: 293339 URL: https://svnweb.freebsd.org/changeset/base/293339 Log: net80211 drivers: fix ieee80211_init_channels() usage Fix out-of-bounds read (all) / write (11n capable) for drivers that are using ieee80211_init_channels() to initialize channel list. Tested with: * RTL8188EU, STA mode. * RTL8188CUS, STA mode. * WUSB54GC, HOSTAP mode. Approved by: adrian (mentor) MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D4818 Modified: head/sys/dev/bwi/if_bwi.c head/sys/dev/if_ndis/if_ndis.c head/sys/dev/iwi/if_iwi.c head/sys/dev/malo/if_malo.c head/sys/dev/otus/if_otus.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/ral/rt2860.c head/sys/dev/rtwn/if_rtwn.c head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_urtwn.c head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/bwi/if_bwi.c == --- head/sys/dev/bwi/if_bwi.c Thu Jan 7 18:34:56 2016(r293338) +++ head/sys/dev/bwi/if_bwi.c Thu Jan 7 18:41:03 2016(r293339) @@ -356,8 +356,8 @@ bwi_attach(struct bwi_softc *sc) device_t dev = sc->sc_dev; struct bwi_mac *mac; struct bwi_phy *phy; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; int i, error; - uint8_t bands; BWI_LOCK_INIT(sc); @@ -453,15 +453,15 @@ bwi_attach(struct bwi_softc *sc) /* * Setup ratesets, phytype, channels and get MAC address */ - bands = 0; + memset(bands, 0, sizeof(bands)); if (phy->phy_mode == IEEE80211_MODE_11B || phy->phy_mode == IEEE80211_MODE_11G) { - setbit(, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11B); if (phy->phy_mode == IEEE80211_MODE_11B) { ic->ic_phytype = IEEE80211_T_DS; } else { ic->ic_phytype = IEEE80211_T_OFDM; - setbit(, IEEE80211_MODE_11G); + setbit(bands, IEEE80211_MODE_11G); } bwi_get_eaddr(sc, BWI_SPROM_11BG_EADDR, ic->ic_macaddr); @@ -475,7 +475,7 @@ bwi_attach(struct bwi_softc *sc) } } else if (phy->phy_mode == IEEE80211_MODE_11A) { /* TODO:11A */ - setbit(, IEEE80211_MODE_11A); + setbit(bands, IEEE80211_MODE_11A); error = ENXIO; goto fail; } else { @@ -487,7 +487,7 @@ bwi_attach(struct bwi_softc *sc) BWI_SPROM_CARD_INFO_LOCALE); DPRINTF(sc, BWI_DBG_ATTACH, "locale: %d\n", sc->sc_locale); /* XXX use locale */ - ieee80211_init_channels(ic, NULL, ); + ieee80211_init_channels(ic, NULL, bands); ic->ic_softc = sc; ic->ic_name = device_get_nameunit(dev); Modified: head/sys/dev/if_ndis/if_ndis.c == --- head/sys/dev/if_ndis/if_ndis.c Thu Jan 7 18:34:56 2016 (r293338) +++ head/sys/dev/if_ndis/if_ndis.c Thu Jan 7 18:41:03 2016 (r293339) @@ -724,8 +724,8 @@ ndis_80211attach(struct ndis_softc *sc) ndis_80211_rates_ex rates; struct ndis_80211_nettype_list *ntl; uint32_targ; - int mode, i, r, len; - uint8_t bands = 0; + int mode, i, r, len, nonettypes = 1; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)] = { 0 }; callout_init(>ndis_scan_callout, 1); @@ -751,8 +751,9 @@ ndis_80211attach(struct ndis_softc *sc) for (i = 0; i < ntl->ntl_items; i++) { mode = ndis_nettype_mode(ntl->ntl_type[i]); if (mode) { + nonettypes = 0; setbit(ic->ic_modecaps, mode); - setbit(, mode); + setbit(bands, mode); } else device_printf(sc->ndis_dev, "Unknown nettype %d\n", ntl->ntl_type[i]); @@ -760,9 +761,9 @@ ndis_80211attach(struct ndis_softc *sc) free(ntl, M_DEVBUF); nonettypes: /* Default to 11b channels if the card did not supply any */ - if (bands == 0) { + if (nonettypes) { setbit(ic->ic_modecaps, IEEE80211_MODE_11B); - setbit(, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11B); } len = sizeof(rates); bzero((char *), len); @@ -859,7 +860,7 @@ nonettypes: #undef INCRATE #undef TESTSETRATE -
svn commit: r293370 - head/sys/fs/ext2fs
Author: pfg Date: Thu Jan 7 21:43:43 2016 New Revision: 293370 URL: https://svnweb.freebsd.org/changeset/base/293370 Log: ext2fs: reading mmaped file in Ext4 causes panic Always call brelse(path.ep_bp), fixing reading EXT4 files using mmap(). Patch by Damjan Jovanovic. PR: 205938 MFC after:1 week Modified: head/sys/fs/ext2fs/ext2_bmap.c Modified: head/sys/fs/ext2fs/ext2_bmap.c == --- head/sys/fs/ext2fs/ext2_bmap.c Thu Jan 7 21:16:44 2016 (r293369) +++ head/sys/fs/ext2fs/ext2_bmap.c Thu Jan 7 21:43:43 2016 (r293370) @@ -96,6 +96,7 @@ ext4_bmapext(struct vnode *vp, int32_t b struct ext4_extent *ep; struct ext4_extent_path path = { .ep_bp = NULL }; daddr_t lbn; + int ret = 0; ip = VTOI(vp); fs = ip->i_e2fs; @@ -113,15 +114,21 @@ ext4_bmapext(struct vnode *vp, int32_t b ext4_ext_find_extent(fs, ip, lbn, ); ep = path.ep_ext; if (ep == NULL) - return (EIO); + ret = EIO; + else { + *bnp = fsbtodb(fs, lbn - ep->e_blk + + (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32)); - *bnp = fsbtodb(fs, lbn - ep->e_blk + - (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32)); + if (*bnp == 0) + *bnp = -1; + } - if (*bnp == 0) - *bnp = -1; + if (path.ep_bp != NULL) { + brelse(path.ep_bp); + path.ep_bp = NULL; + } - return (0); + return (ret); } /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293371 - head/bin/sh/tests/builtins
Author: jilles Date: Thu Jan 7 21:46:07 2016 New Revision: 293371 URL: https://svnweb.freebsd.org/changeset/base/293371 Log: sh: Add a test for 'cd -'. Redirect 'cd -' output to /dev/null since POSIX requires it to write the new directory name even if not interactive, but we currently only write it if interactive. Added: head/bin/sh/tests/builtins/cd9.0 (contents, props changed) head/bin/sh/tests/builtins/cd9.0.stdout (contents, props changed) Modified: head/bin/sh/tests/builtins/Makefile Modified: head/bin/sh/tests/builtins/Makefile == --- head/bin/sh/tests/builtins/Makefile Thu Jan 7 21:43:43 2016 (r293370) +++ head/bin/sh/tests/builtins/Makefile Thu Jan 7 21:46:07 2016 (r293371) @@ -48,6 +48,7 @@ FILES+= cd5.0 FILES+=cd6.0 FILES+=cd7.0 FILES+=cd8.0 +FILES+=cd9.0 cd9.0.stdout FILES+=command1.0 FILES+=command2.0 FILES+=command3.0 Added: head/bin/sh/tests/builtins/cd9.0 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/builtins/cd9.0Thu Jan 7 21:46:07 2016 (r293371) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +cd /dev +cd /bin +cd - >/dev/null +pwd +cd - >/dev/null +pwd Added: head/bin/sh/tests/builtins/cd9.0.stdout == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/builtins/cd9.0.stdout Thu Jan 7 21:46:07 2016 (r293371) @@ -0,0 +1,2 @@ +/dev +/bin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293379 - head/lib/libdpv
Author: dteske Date: Thu Jan 7 22:13:17 2016 New Revision: 293379 URL: https://svnweb.freebsd.org/changeset/base/293379 Log: Bump copyright (forgotten part of r293340) MFC after:3 days X-MFC-to: stable/10 X-MFC-with: r293340 Modified: head/lib/libdpv/util.h Modified: head/lib/libdpv/util.h == --- head/lib/libdpv/util.h Thu Jan 7 22:13:16 2016(r293378) +++ head/lib/libdpv/util.h Thu Jan 7 22:13:17 2016(r293379) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Devin Teske+ * Copyright (c) 2013-2016 Devin Teske * All rights reserved. * * Redistribution and use in source and binary forms, with or without ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r293369 - head/sys/dev/ismt
Author: jimharris Date: Thu Jan 7 21:16:44 2016 New Revision: 293369 URL: https://svnweb.freebsd.org/changeset/base/293369 Log: ismt: fix ISMT_DESC_ADDR_RW macro Submitted by: Masanobu SAITOHMFC after:3 days Modified: head/sys/dev/ismt/ismt.c Modified: head/sys/dev/ismt/ismt.c == --- head/sys/dev/ismt/ismt.cThu Jan 7 21:02:29 2016(r293368) +++ head/sys/dev/ismt/ismt.cThu Jan 7 21:16:44 2016(r293369) @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$"); #define ISMT_DESC_LPR 0x80/* Large Packet Received */ /* Macros */ -#define ISMT_DESC_ADDR_RW(addr, is_read) ((addr) | (is_read)) +#define ISMT_DESC_ADDR_RW(addr, is_read) ((addr << 1) | (is_read)) /* iSMT General Register address offsets (SMBBAR + ) */ #define ISMT_GR_GCTRL 0x000 /* General Control */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"