svn commit: r334275 - head/lib/libc/string
Author: araujo Date: Mon May 28 05:01:42 2018 New Revision: 334275 URL: https://svnweb.freebsd.org/changeset/base/334275 Log: Update strsep(3) EXAMPLE section regards the usage of assert(3). As many people has pointed out, using assert(3) shall be not the best approach to verify if strdup(3) has allocated memory to string. Reviewed by: imp MFC after:4 weeks. Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D15594 Modified: head/lib/libc/string/strsep.3 Modified: head/lib/libc/string/strsep.3 == --- head/lib/libc/string/strsep.3 Mon May 28 04:38:10 2018 (r334274) +++ head/lib/libc/string/strsep.3 Mon May 28 05:01:42 2018 (r334275) @@ -31,7 +31,7 @@ .\"@(#)strsep.38.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd December 5, 2008 +.Dd May 28, 2018 .Dt STRSEP 3 .Os .Sh NAME @@ -86,12 +86,12 @@ to parse a string, and prints each token in separate l char *token, *string, *tofree; tofree = string = strdup("abc,def,ghi"); -assert(string != NULL); +if (string != NULL) + while ((token = strsep(, ",")) != NULL) + printf("%s\en", token); -while ((token = strsep(, ",")) != NULL) - printf("%s\en", token); - free(tofree); +free(string); .Ed .Pp The following uses ___ 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: r334274 - head/sys/vm
Author: alc Date: Mon May 28 04:38:10 2018 New Revision: 334274 URL: https://svnweb.freebsd.org/changeset/base/334274 Log: Eliminate duplicate assertions. We assert at the start of vm_fault_hold() that the map entry is wired if the caller passes the flag VM_FAULT_WIRE. Eliminate the same assertion, but spelled differently, at the end of vm_fault_hold() and vm_fault_populate(). Repeat the assertion only if the map is unlocked and the map lookup must be repeated. Reviewed by: kib MFC after:10 days Differential Revision:https://reviews.freebsd.org/D15582 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c == --- head/sys/vm/vm_fault.c Mon May 28 03:14:36 2018(r334273) +++ head/sys/vm/vm_fault.c Mon May 28 04:38:10 2018(r334274) @@ -482,10 +482,9 @@ vm_fault_populate(struct faultstate *fs, vm_prot_t pro m_mtx = NULL; for (i = 0; i < npages; i++) { vm_page_change_lock([i], _mtx); - if ((fault_flags & VM_FAULT_WIRE) != 0) { - KASSERT(wired, ("VM_FAULT_WIRE && !wired")); + if ((fault_flags & VM_FAULT_WIRE) != 0) vm_page_wire([i]); - } else + else vm_page_activate([i]); if (m_hold != NULL && m[i].pindex == fs->first_pindex) { *m_hold = [i]; @@ -1247,6 +1246,10 @@ readrest: unlock_and_deallocate(); goto RetryFault; } + + /* Reassert because wired may have changed. */ + KASSERT(wired || (fault_flags & VM_FAULT_WIRE) == 0, + ("!wired && VM_FAULT_WIRE")); } } @@ -1290,10 +1293,9 @@ readrest: * If the page is not wired down, then put it where the pageout daemon * can find it. */ - if ((fault_flags & VM_FAULT_WIRE) != 0) { - KASSERT(wired, ("VM_FAULT_WIRE && !wired")); + if ((fault_flags & VM_FAULT_WIRE) != 0) vm_page_wire(fs.m); - } else + else vm_page_activate(fs.m); if (m_hold != NULL) { *m_hold = fs.m; ___ 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: Deorbiting i386
On 05/28/18 06:15, Maxim Sobolev wrote: be surprised how many software is technically compiling and all that, but has some weird runtime issues with either byte order or unaligned memory accesses. Every single processor migration allows you to get rid of: 1) The software that is technically... 2) The proprietary software that would not compile 3) The processors that must support the binary compatibility with outdated software. Yes, it's painful and expensive to replace all these program but you have no other way except either keep the source and recompile when needed or use Win.. Pardon my French, I should not write such words here. ___ 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: r334273 - head/sys/cam/nvme
Author: vangyzen Date: Mon May 28 03:14:36 2018 New Revision: 334273 URL: https://svnweb.freebsd.org/changeset/base/334273 Log: cam nvme: fix array overrun Fix a classic array overrun where the index could be one past the end. Reported by: Coverity CID: 1356596 MFC after:3 days Sponsored by: Dell EMC Modified: head/sys/cam/nvme/nvme_all.c Modified: head/sys/cam/nvme/nvme_all.c == --- head/sys/cam/nvme/nvme_all.cMon May 28 03:09:09 2018 (r334272) +++ head/sys/cam/nvme/nvme_all.cMon May 28 03:14:36 2018 (r334273) @@ -120,7 +120,7 @@ nvme_op_string(const struct nvme_command *cmd) uint8_t opc; opc = (cmd->opc_fuse >> NVME_CMD_OPC_SHIFT) & NVME_CMD_OPC_MASK; - if (opc > nitems(nvme_opc2str)) + if (opc >= nitems(nvme_opc2str)) return "UNKNOWN"; return nvme_opc2str[opc]; ___ 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: r334272 - head/usr.sbin/bhyve
Author: vangyzen Date: Mon May 28 03:09:09 2018 New Revision: 334272 URL: https://svnweb.freebsd.org/changeset/base/334272 Log: bhyve: guarantee NUL termination Use strlcpy to guarantee NUL termination of the path to a virtio console socket. Reported by: Coverity CID: 1362874 Sponsored by: Dell EMC Modified: head/usr.sbin/bhyve/pci_virtio_console.c Modified: head/usr.sbin/bhyve/pci_virtio_console.c == --- head/usr.sbin/bhyve/pci_virtio_console.cMon May 28 03:05:01 2018 (r334271) +++ head/usr.sbin/bhyve/pci_virtio_console.cMon May 28 03:09:09 2018 (r334272) @@ -306,7 +306,7 @@ pci_vtcon_sock_add(struct pci_vtcon_softc *sc, const c sun.sun_family = AF_UNIX; sun.sun_len = sizeof(struct sockaddr_un); strcpy(pathcopy, path); - strncpy(sun.sun_path, basename(pathcopy), sizeof(sun.sun_path)); + strlcpy(sun.sun_path, basename(pathcopy), sizeof(sun.sun_path)); free(pathcopy); if (bindat(fd, s, (struct sockaddr *), sun.sun_len) < 0) { ___ 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: r334271 - head/usr.sbin/bhyve
Author: vangyzen Date: Mon May 28 03:05:01 2018 New Revision: 334271 URL: https://svnweb.freebsd.org/changeset/base/334271 Log: bhyve: fix small memory leak in virtio console Reported by: Coverity CID: 1363284 Sponsored by: Dell EMC Modified: head/usr.sbin/bhyve/pci_virtio_console.c Modified: head/usr.sbin/bhyve/pci_virtio_console.c == --- head/usr.sbin/bhyve/pci_virtio_console.cMon May 28 02:40:06 2018 (r334270) +++ head/usr.sbin/bhyve/pci_virtio_console.cMon May 28 03:05:01 2018 (r334271) @@ -651,7 +651,7 @@ pci_vtcon_init(struct vmctx *ctx, struct pci_devinst * while ((opt = strsep(, ",")) != NULL) { portname = strsep(, "="); - portpath = strdup(opt); + portpath = opt; /* create port */ if (pci_vtcon_sock_add(sc, portname, portpath) < 0) { ___ 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: r334270 - head/usr.bin/logger
Author: vangyzen Date: Mon May 28 02:40:06 2018 New Revision: 334270 URL: https://svnweb.freebsd.org/changeset/base/334270 Log: logger: fix memory leak and use-after-free This one call to getaddrinfo() did not adhere to the common idiom of storing the result into a second res0 variable, which is later freed. Reported by: Coverity CID: 1368069 1368071 Sponsored by: Dell EMC Modified: head/usr.bin/logger/logger.c Modified: head/usr.bin/logger/logger.c == --- head/usr.bin/logger/logger.cMon May 28 02:34:38 2018 (r334269) +++ head/usr.bin/logger/logger.cMon May 28 02:40:06 2018 (r334270) @@ -298,7 +298,7 @@ socksetup(const char *src, const char *dst, const char error = getaddrinfo(dst, svcname, , ); if (error == EAI_SERVICE) { warnx("%s/udp: unknown service", svcname); - error = getaddrinfo(dst, "514", , ); + error = getaddrinfo(dst, "514", , ); } if (error) errx(1, "%s: %s", gai_strerror(error), 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: r334269 - head/sys/dev/drm
Author: vangyzen Date: Mon May 28 02:34:38 2018 New Revision: 334269 URL: https://svnweb.freebsd.org/changeset/base/334269 Log: drm: fix memory leak on error path Reported by: Coverity CID: 1368753 MFC after:3 days Sponsored by: Dell EMC Modified: head/sys/dev/drm/drm_ioctl.c Modified: head/sys/dev/drm/drm_ioctl.c == --- head/sys/dev/drm/drm_ioctl.cMon May 28 02:31:49 2018 (r334268) +++ head/sys/dev/drm/drm_ioctl.cMon May 28 02:34:38 2018 (r334269) @@ -105,6 +105,7 @@ int drm_setunique(struct drm_device *dev, void *data, DRM_LOCK(); if (dev->unique_len || dev->unique) { DRM_UNLOCK(); + free(busid, DRM_MEM_DRIVER); return EBUSY; } ___ 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: r334268 - head/lib/libc/gen
Author: vangyzen Date: Mon May 28 02:31:49 2018 New Revision: 334268 URL: https://svnweb.freebsd.org/changeset/base/334268 Log: fts_stat: fix buffer overrun on error path Reported by: Coverity CID: 1375582 MFC after:1 week Sponsored by: Dell EMC Modified: head/lib/libc/gen/fts-compat.c Modified: head/lib/libc/gen/fts-compat.c == --- head/lib/libc/gen/fts-compat.c Mon May 28 02:10:35 2018 (r334267) +++ head/lib/libc/gen/fts-compat.c Mon May 28 02:31:49 2018 (r334268) @@ -934,7 +934,7 @@ fts_stat(FTS *sp, FTSENT *p, int follow) } } else if (freebsd11_lstat(p->fts_accpath, sbp)) { p->fts_errno = errno; -err: memset(sbp, 0, sizeof(struct stat)); +err: memset(sbp, 0, sizeof(*sbp)); return (FTS_NS); } ___ 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: Deorbiting i386
P.S.. Another interesting thing to consider is that original Intel patents on i386 are going to expire sooner or later. Give it some time and we might see completely open source i386 IPs one day, free for anyone to grab and use. By today's standards i386 is rather trivial platform with many independent commercial implementations already done by compact well focused teams (cyrix, transmeta etc). -Max On Sun, May 27, 2018, 3:15 PM Maxim Sobolevwrote: > Well, strip extra 32 bits, use slower memory and busses (extra decoding > logic etc). Voila, you suddenly have platform that can run 99% of code in > wild today with just few hundred mW of power. Try that with arm32, you > would be surprised how many software is technically compiling and all that, > but has some weird runtime issues with either byte order or unaligned > memory accesses. Not even mention performance issues due to the lack of > hand-crafted JITs. > > Throwing away all that wealth is like shooting yourself in a foot...with a > bazooka. > > -Max > > On Sat, May 26, 2018, 12:58 AM David Chisnall > wrote: > >> On 26 May 2018, at 00:41, Maxim Sobolev wrote: >> > >> > If you've seen any of the atom bay trail systems in action you may >> understand what I mean. You get full blown x64 system with four cores and >> it takes only 2W of power. >> >> Which is pretty much my point - if you want a low-power x86 system for >> embedded use, it’s going to be x86-64, not x86-32 (though hopefully you’re >> using a 32-bit ABI with it). >> >> David >> >> ___ 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: Deorbiting i386
Well, strip extra 32 bits, use slower memory and busses (extra decoding logic etc). Voila, you suddenly have platform that can run 99% of code in wild today with just few hundred mW of power. Try that with arm32, you would be surprised how many software is technically compiling and all that, but has some weird runtime issues with either byte order or unaligned memory accesses. Not even mention performance issues due to the lack of hand-crafted JITs. Throwing away all that wealth is like shooting yourself in a foot...with a bazooka. -Max On Sat, May 26, 2018, 12:58 AM David Chisnallwrote: > On 26 May 2018, at 00:41, Maxim Sobolev wrote: > > > > If you've seen any of the atom bay trail systems in action you may > understand what I mean. You get full blown x64 system with four cores and > it takes only 2W of power. > > Which is pretty much my point - if you want a low-power x86 system for > embedded use, it’s going to be x86-64, not x86-32 (though hopefully you’re > using a 32-bit ABI with it). > > David > > ___ 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: r334267 - head/lib/libprocstat
Author: vangyzen Date: Mon May 28 02:10:35 2018 New Revision: 334267 URL: https://svnweb.freebsd.org/changeset/base/334267 Log: libprocstat: fix memory leak Free the rlimits array on the happy path in procstat_getrlimit_core(). Reported by: Coverity CID: 1373328 Sponsored by: Dell EMC Modified: head/lib/libprocstat/libprocstat.c Modified: head/lib/libprocstat/libprocstat.c == --- head/lib/libprocstat/libprocstat.c Mon May 28 01:59:48 2018 (r334266) +++ head/lib/libprocstat/libprocstat.c Mon May 28 02:10:35 2018 (r334267) @@ -2192,6 +2192,7 @@ procstat_getrlimit_core(struct procstat_core *core, in return (-1); } *rlimit = rlimits[which]; + free(rlimits); return (0); } ___ 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: r334266 - head/sys/powerpc/powernv
Author: jhibbits Date: Mon May 28 01:59:48 2018 New Revision: 334266 URL: https://svnweb.freebsd.org/changeset/base/334266 Log: Make ALT_BREAK_TO_DEBUGGER work with OPAL console Match other consoles by using the higher level cngetc() in the interrupt handler, so that kdb_alt_break() can check for console break. Modified: head/sys/powerpc/powernv/opal_console.c Modified: head/sys/powerpc/powernv/opal_console.c == --- head/sys/powerpc/powernv/opal_console.c Mon May 28 01:58:49 2018 (r334265) +++ head/sys/powerpc/powernv/opal_console.c Mon May 28 01:59:48 2018 (r334266) @@ -475,11 +475,10 @@ uart_opal_intr(void *v) { struct uart_opal_softc *sc = v; struct tty *tp = sc->tp; - unsigned char c; - int len; + int c; tty_lock(tp); - while ((len = uart_opal_get(sc, , 1)) > 0) + while ((c = uart_opal_cngetc(NULL)) > 0) ttydisc_rint(tp, c, 0); ttydisc_rint_done(tp); tty_unlock(tp); ___ 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: r334265 - head/usr.sbin/tcpdrop
Author: vangyzen Date: Mon May 28 01:58:49 2018 New Revision: 334265 URL: https://svnweb.freebsd.org/changeset/base/334265 Log: tcpdrop: ensure NUL termination of a string strncpy did not guarantee NUL termination of the "stack" string. Use strlcpy instead. While I'm here, avoid unnecessary memset and strnlen calls. Reported by: Coverity CID: 1381035 Sponsored by: Dell EMC Modified: head/usr.sbin/tcpdrop/tcpdrop.c Modified: head/usr.sbin/tcpdrop/tcpdrop.c == --- head/usr.sbin/tcpdrop/tcpdrop.c Mon May 28 00:19:08 2018 (r334264) +++ head/usr.sbin/tcpdrop/tcpdrop.c Mon May 28 01:58:49 2018 (r334265) @@ -73,7 +73,7 @@ main(int argc, char *argv[]) dropall = false; dropallstack = false; - memset(stack, 0, TCP_FUNCTION_NAME_LEN_MAX); + stack[0] = '\0'; state = -1; while ((ch = getopt(argc, argv, "alS:s:")) != -1) { @@ -86,7 +86,7 @@ main(int argc, char *argv[]) break; case 'S': dropallstack = true; - strncpy(stack, optarg, TCP_FUNCTION_NAME_LEN_MAX); + strlcpy(stack, optarg, sizeof(stack)); break; case 's': dropallstack = true; @@ -260,7 +260,7 @@ tcpdropall(const char *stack, int state) continue; /* If requested, skip sockets not having the requested stack. */ - if (strnlen(stack, TCP_FUNCTION_NAME_LEN_MAX) > 0 && + if (stack[0] != '\0' && strncmp(xtp->xt_stack, stack, TCP_FUNCTION_NAME_LEN_MAX)) 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: r334264 - head/sys/powerpc/booke
Author: jhibbits Date: Mon May 28 00:19:08 2018 New Revision: 334264 URL: https://svnweb.freebsd.org/changeset/base/334264 Log: Print the full-width pointer values in hex. PRI0ptrX is used to print a zero-padded hex value of the architecture's bitness, so on 64-bit architectures it'll print the full 64 bit address. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c == --- head/sys/powerpc/booke/pmap.c Sun May 27 23:52:41 2018 (r334263) +++ head/sys/powerpc/booke/pmap.c Mon May 28 00:19:08 2018 (r334264) @@ -1824,9 +1824,9 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o virtual_avail += PAGE_SIZE; copy_page_dst_va = virtual_avail; virtual_avail += PAGE_SIZE; - debugf("zero_page_va = 0x%08x\n", zero_page_va); - debugf("copy_page_src_va = 0x%08x\n", copy_page_src_va); - debugf("copy_page_dst_va = 0x%08x\n", copy_page_dst_va); + debugf("zero_page_va = 0x%"PRI0ptrX"\n", zero_page_va); + debugf("copy_page_src_va = 0x"PRI0ptrX"\n", copy_page_src_va); + debugf("copy_page_dst_va = 0x"PRI0ptrX"\n", copy_page_dst_va); /* Initialize page zero/copy mutexes. */ mtx_init(_page_mutex, "mmu_booke_zero_page", NULL, MTX_DEF); @@ -1835,15 +1835,15 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o /* Allocate KVA space for ptbl bufs. */ ptbl_buf_pool_vabase = virtual_avail; virtual_avail += PTBL_BUFS * PTBL_PAGES * PAGE_SIZE; - debugf("ptbl_buf_pool_vabase = 0x%08x end = 0x%08x\n", + debugf("ptbl_buf_pool_vabase = 0x"PRI0ptrX" end = 0x"PRI0ptrX"\n", ptbl_buf_pool_vabase, virtual_avail); /* Calculate corresponding physical addresses for the kernel region. */ phys_kernelend = kernload + kernsize; debugf("kernel image and allocated data:\n"); debugf(" kernload= 0x%09llx\n", (uint64_t)kernload); - debugf(" kernstart = 0x%08x\n", kernstart); - debugf(" kernsize= 0x%08x\n", kernsize); + debugf(" kernstart = 0x"PRI0ptrX"\n", kernstart); + debugf(" kernsize= 0x"PRI0ptrX"\n", kernsize); if (sizeof(phys_avail) / sizeof(phys_avail[0]) < availmem_regions_sz) panic("mmu_booke_bootstrap: phys_avail too small"); @@ -2263,7 +2263,7 @@ mmu_booke_kremove(mmu_t mmu, vm_offset_t va) { pte_t *pte; - CTR2(KTR_PMAP,"%s: s (va = 0x%08x)\n", __func__, va); + CTR2(KTR_PMAP,"%s: s (va = 0x"PRI0ptrX")\n", __func__, va); KASSERT(((va >= VM_MIN_KERNEL_ADDRESS) && (va <= VM_MAX_KERNEL_ADDRESS)), @@ -2720,7 +2720,7 @@ mmu_booke_activate(mmu_t mmu, struct thread *td) pmap = >td_proc->p_vmspace->vm_pmap; - CTR5(KTR_PMAP, "%s: s (td = %p, proc = '%s', id = %d, pmap = 0x%08x)", + CTR5(KTR_PMAP, "%s: s (td = %p, proc = '%s', id = %d, pmap = 0x"PRI0ptrX")", __func__, td, td->td_proc->p_comm, td->td_proc->p_pid, pmap); KASSERT((pmap != kernel_pmap), ("mmu_booke_activate: kernel_pmap!")); @@ -2756,7 +2756,7 @@ mmu_booke_deactivate(mmu_t mmu, struct thread *td) pmap = >td_proc->p_vmspace->vm_pmap; - CTR5(KTR_PMAP, "%s: td=%p, proc = '%s', id = %d, pmap = 0x%08x", + CTR5(KTR_PMAP, "%s: td=%p, proc = '%s', id = %d, pmap = 0x"PRI0ptrX, __func__, td, td->td_proc->p_comm, td->td_proc->p_pid, pmap); td->td_pcb->pcb_cpu.booke.dbcr0 = mfspr(SPR_DBCR0); ___ 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: r334262 - head/cddl/usr.sbin/dwatch
Author: dteske Date: Sun May 27 22:32:45 2018 New Revision: 334262 URL: https://svnweb.freebsd.org/changeset/base/334262 Log: dwatch(1): Eliminate ANSI dimming in developer mode "Developer mode" (passing of "-dev" options), which enables debugging features on compilation error, used to dim lines unrelated to error. That proved distracting and feedback from testers also confirmed that simply highlighting the line the compiler complains about is enough. Sponsored by: Smule, Inc. Modified: head/cddl/usr.sbin/dwatch/dwatch Modified: head/cddl/usr.sbin/dwatch/dwatch == --- head/cddl/usr.sbin/dwatch/dwatchSun May 27 22:27:47 2018 (r334261) +++ head/cddl/usr.sbin/dwatch/dwatchSun May 27 22:32:45 2018 (r334262) @@ -1057,10 +1057,6 @@ PSARGS_ACTION=$( cat <&9 ) slen = length(sprintf("%u", start)) elen = length(sprintf("%u", end)) N = elen > slen ? elen : slen - for (i = start; i <= end; i++) { - ti[i] = "\033[2m" - te[i] = "\033[22m" - } ti[line] = "\033[31m" te[line] = "\033[39m" fmt = "%s%*u %s%s\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"
svn commit: r334261 - head/cddl/usr.sbin/dwatch
Author: dteske Date: Sun May 27 22:27:47 2018 New Revision: 334261 URL: https://svnweb.freebsd.org/changeset/base/334261 Log: dwatch(1): Guard against error when given -t "*..." dwatch allows you to customnize the predicate (condition) for when information is displayed. The DTrace syntax for this is: probe[, ...] /predicate/ { [actions] } But if predicate is something like "*args[1]!=NULL" to test that the first pointer in an array is non-NULL, the syntax produced is: probe[, ...] /*arg1!=NULL/ { [actions] } The issue being that "/*" is the beginning of a comment and thus the following error is emitted: dtrace: failed to compile script /dev/stdin: line 535: /* encountered inside a comment This patch adds whitespace around the argument given to -t, producing: probe[, ...] / *arg1!=NULL / { [actions] } Sponsored by: Smule, Inc. Modified: head/cddl/usr.sbin/dwatch/dwatch Modified: head/cddl/usr.sbin/dwatch/dwatch == --- head/cddl/usr.sbin/dwatch/dwatchSun May 27 20:36:43 2018 (r334260) +++ head/cddl/usr.sbin/dwatch/dwatchSun May 27 22:27:47 2018 (r334261) @@ -47,7 +47,7 @@ DTRACE_PRAGMA=" GLOBALS -VERSION='$Version: 1.2 $' # -V +VERSION='$Version: 1.3 $' # -V pgm="${0##*/}" # Program basename @@ -1353,7 +1353,7 @@ $ACTIONS } /*/ -$PROBE${EVENT_TEST:+ /$EVENT_TEST/} /* probe ID $ID */ +$PROBE${EVENT_TEST:+ / $EVENT_TEST /} /* probe ID $ID */ {${TRACE:+ printf("<$ID>"); } ___ 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: r334260 - head/sys/powerpc/powerpc
Author: jhibbits Date: Sun May 27 20:36:43 2018 New Revision: 334260 URL: https://svnweb.freebsd.org/changeset/base/334260 Log: Match style of the other prototypes, and don't name the argument. Modified: head/sys/powerpc/powerpc/cpu.c Modified: head/sys/powerpc/powerpc/cpu.c == --- head/sys/powerpc/powerpc/cpu.c Sun May 27 20:24:24 2018 (r334259) +++ head/sys/powerpc/powerpc/cpu.c Sun May 27 20:36:43 2018 (r334260) @@ -91,7 +91,7 @@ static void cpu_idle_60x(sbintime_t); static voidcpu_idle_booke(sbintime_t); #if defined(__powerpc64__) && defined(AIM) static voidcpu_idle_powerx(sbintime_t); -static voidcpu_idle_power9(sbintime_t sbt); +static voidcpu_idle_power9(sbintime_t); #endif struct cputab { ___ 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: r334257 - head/share/man/man4
> On May 27, 2018, at 12:44 PM, Cy Schubertwrote: > > In message <201805271843.w4rihfxq066...@repo.freebsd.org>, Devin Teske > writes: >> Author: dteske >> Date: Sun May 27 18:43:14 2018 >> New Revision: 334257 >> URL: https://svnweb.freebsd.org/changeset/base/334257 >> >> Log: >> Add manual page for the sctp DTrace provider. >> >> Sponsored by: Smule, Inc. >> >> Added: >> head/share/man/man4/dtrace_sctp.4 (contents, props changed) >> Modified: >> head/share/man/man4/Makefile > > Thanks. > > You're very welcome. Just doing my part to improve things as I can. -- Cheers, Devin ___ 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: r334259 - in head/sys/powerpc: include powerpc
Author: jhibbits Date: Sun May 27 20:24:24 2018 New Revision: 334259 URL: https://svnweb.freebsd.org/changeset/base/334259 Log: Stop idle threads on power9 in the idle task until an interrupt. This reduces the CPU cycle wastage on power9, which is SMT4. Any idle thread that's spinning is simply starving working threads on the same core of valuable resources. This can be reduced further by taking more advantage of the PSSCR supported states, as well as permitting state loss, as is currently done for power8. The currently implemented stop state is the lowest latency, which may still consume resources. Modified: head/sys/powerpc/include/spr.h head/sys/powerpc/powerpc/cpu.c Modified: head/sys/powerpc/include/spr.h == --- head/sys/powerpc/include/spr.h Sun May 27 19:27:34 2018 (r334258) +++ head/sys/powerpc/include/spr.h Sun May 27 20:24:24 2018 (r334259) @@ -383,6 +383,7 @@ #defineSPR_MD_CAM 0x338 /* ..8 IMMU CAM entry read */ #defineSPR_MD_RAM0 0x339 /* ..8 IMMU RAM entry read reg 0 */ #defineSPR_MD_RAM1 0x33a /* ..8 IMMU RAM entry read reg 1 */ +#defineSPR_PSSCR 0x357 /* Processor Stop Status and Control Register (ISA 3.0) */ #defineSPR_UMMCR2 0x3a0 /* .6. User Monitor Mode Control Register 2 */ #defineSPR_UMMCR0 0x3a8 /* .6. User Monitor Mode Control Register 0 */ #defineSPR_USIA0x3ab /* .6. User Sampled Instruction Address */ Modified: head/sys/powerpc/powerpc/cpu.c == --- head/sys/powerpc/powerpc/cpu.c Sun May 27 19:27:34 2018 (r334258) +++ head/sys/powerpc/powerpc/cpu.c Sun May 27 20:24:24 2018 (r334259) @@ -91,6 +91,7 @@ static void cpu_idle_60x(sbintime_t); static voidcpu_idle_booke(sbintime_t); #if defined(__powerpc64__) && defined(AIM) static voidcpu_idle_powerx(sbintime_t); +static voidcpu_idle_power9(sbintime_t sbt); #endif struct cputab { @@ -181,7 +182,7 @@ static const struct cputab models[] = { PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HTM | PPC_FEATURE2_DSCR | PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO | PPC_FEATURE2_ARCH_3_00 | PPC_FEATURE2_HAS_IEEE128 | - PPC_FEATURE2_DARN, NULL }, + PPC_FEATURE2_DARN, cpu_powerx_setup }, { "Motorola PowerPC 7400", MPC7400,REVFMT_MAJMIN, PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Motorola PowerPC 7410", MPC7410,REVFMT_MAJMIN, @@ -660,7 +661,12 @@ cpu_powerx_setup(int cpuid, uint16_t vers) switch (vers) { case IBMPOWER8: case IBMPOWER8E: + cpu_idle_hook = cpu_idle_powerx; + mtspr(SPR_LPCR, mfspr(SPR_LPCR) | LPCR_PECE_WAKESET); + isync(); + break; case IBMPOWER9: + cpu_idle_hook = cpu_idle_power9; mtspr(SPR_LPCR, mfspr(SPR_LPCR) | LPCR_PECE_WAKESET); isync(); break; @@ -668,7 +674,6 @@ cpu_powerx_setup(int cpuid, uint16_t vers) return; } - cpu_idle_hook = cpu_idle_powerx; #endif } @@ -797,6 +802,27 @@ cpu_idle_powerx(sbintime_t sbt) enter_idle_powerx(); spinlock_exit(); +} + +static void +cpu_idle_power9(sbintime_t sbt) +{ + register_t msr; + + msr = mfmsr(); + + /* Suspend external interrupts until stop instruction completes. */ + mtmsr(msr & ~PSL_EE); + /* Set the stop state to lowest latency, wake up to next instruction */ + mtspr(SPR_PSSCR, 0); + /* "stop" instruction (PowerISA 3.0) */ + __asm __volatile (".long 0x4c0002e4"); + /* +* Re-enable external interrupts to capture the interrupt that caused +* the wake up. +*/ + mtmsr(msr); + } #endif ___ 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: r334257 - head/share/man/man4
In message <201805271843.w4rihfxq066...@repo.freebsd.org>, Devin Teske writes: > Author: dteske > Date: Sun May 27 18:43:14 2018 > New Revision: 334257 > URL: https://svnweb.freebsd.org/changeset/base/334257 > > Log: > Add manual page for the sctp DTrace provider. > > Sponsored by: Smule, Inc. > > Added: > head/share/man/man4/dtrace_sctp.4 (contents, props changed) > Modified: > head/share/man/man4/Makefile Thanks. -- Cheers, Cy SchubertFreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ 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: r334258 - head/share/man/man4
Author: dteske Date: Sun May 27 19:27:34 2018 New Revision: 334258 URL: https://svnweb.freebsd.org/changeset/base/334258 Log: Remove "All rights reserved" from dtrace_sctp(4) comments Copied from dtrace_tcp(4) Reviewed by: rgrimes Sponsored by: Smule, Inc. Modified: head/share/man/man4/dtrace_sctp.4 Modified: head/share/man/man4/dtrace_sctp.4 == --- head/share/man/man4/dtrace_sctp.4 Sun May 27 18:43:14 2018 (r334257) +++ head/share/man/man4/dtrace_sctp.4 Sun May 27 19:27:34 2018 (r334258) @@ -1,5 +1,4 @@ .\" Copyright (c) 2018 Devin Teske-.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions ___ 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: r334257 - head/share/man/man4
Author: dteske Date: Sun May 27 18:43:14 2018 New Revision: 334257 URL: https://svnweb.freebsd.org/changeset/base/334257 Log: Add manual page for the sctp DTrace provider. Sponsored by: Smule, Inc. Added: head/share/man/man4/dtrace_sctp.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileSun May 27 17:49:27 2018 (r334256) +++ head/share/man/man4/MakefileSun May 27 18:43:14 2018 (r334257) @@ -910,6 +910,7 @@ _dtrace_provs= dtrace_io.4 \ dtrace_lockstat.4 \ dtrace_proc.4 \ dtrace_sched.4 \ + dtrace_sctp.4 \ dtrace_tcp.4 \ dtrace_udp.4 .endif Added: head/share/man/man4/dtrace_sctp.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/dtrace_sctp.4 Sun May 27 18:43:14 2018 (r334257) @@ -0,0 +1,131 @@ +.\" Copyright (c) 2018 Devin Teske+.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 22, 2018 +.Dt DTRACE_SCTP 4 +.Os +.Sh NAME +.Nm dtrace_sctp +.Nd a DTrace provider for tracing events related to the +.Xr sctp 4 +protocol +.Sh SYNOPSIS +.Fn sctp:cwnd::init uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::ack uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::rttvar uint64_t uint64_t uint64_t uint64_t uint64_t +.Fn sctp:cwnd::rttstep uint64_t uint64_t uint64_t uint64_t uint64_t +.Fn sctp:cwnd::fr uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::to uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::bl uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::ecn uint32_t uint32_t uintptr_t int int +.Fn sctp:cwnd::pd uint32_t uint32_t uintptr_t int int +.Fn sctp:rwnd:assoc:val uint32_t uint32_t int int +.Fn sctp:flightsize:net:val uint32_t uint32_t uintptr_t int int +.Fn sctp:flightsize:assoc:val uint32_t uint32_t int int +.Sh DESCRIPTION +The DTrace +.Nm sctp +provider allows users to trace events in the +.Xr sctp 4 +protocol implementation. +This provider is similar to the +.Xr dtrace_ip 4 +and +.Xr dtrace_udp 4 +providers, +but additionally contains probes corresponding to protocol events at a level +higher than packet reception and transmission. +.Pp +The +.Fn sctp:cwnd:: +probes track changes in the congestion window on a netp. +The +.Fn sctp:rwnd:: +probes track changes in the receiver window for an assoc. +The +.Fn sctp:flightsize:net:val +probe tracks changes in the flight size on a net or assoc and the +.Fn sctp:flightsize:assoc:val +probe provides the total flight version. +.Pp +The arguments of all +.Nm sctp +probes except for +.Fn sctp:cwnd::rtt* +and +.Fn sctp::assoc:val +are the Vtag for this end, +the port number of the local side, +the pointer to +.Dv struct sctp_nets *changing , +the old value of the cwnd, +and the new value of the cwnd. +.Pp +The arguments of +.Fn sctp:::val +are similar to the above except the fourth argument is the up/down amount. +.Pp +The +.Fn sctp:cwnd::rtt* +probe arguments are a bitmap of +.Dv Vtag << 32 | localport << 16 | remoteport , +a bitmap of +.Dv obw | nbw , +a bitmap of +.Dv bwrtt | newrtt , +.Dv flight , +and a bitmap of +.Dv (cwnd << 32) | point << 16 | retval(0/1) . +.Pp +The +.Fn sctp:cwnd::init +probe fires when a remotely-initiated active SCTP open succeeds. +At this point the new connection is in the ESTABLISHED state, and the probe +arguments expose the headers associated with the
svn commit: r334256 - head/usr.sbin/pmcstat
Author: mmacy Date: Sun May 27 17:49:27 2018 New Revision: 334256 URL: https://svnweb.freebsd.org/changeset/base/334256 Log: pmcstat: suppress uninitialized warning of event Modified: head/usr.sbin/pmcstat/pmcstat.c Modified: head/usr.sbin/pmcstat/pmcstat.c == --- head/usr.sbin/pmcstat/pmcstat.c Sun May 27 12:06:03 2018 (r334255) +++ head/usr.sbin/pmcstat/pmcstat.c Sun May 27 17:49:27 2018 (r334256) @@ -487,6 +487,7 @@ main(int argc, char **argv) bzero(_start, sizeof(ds_start)); bzero(_end, sizeof(ds_end)); ev = NULL; + event = NULL; CPU_ZERO(); /* Default to using the running system kernel. */ ___ 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: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat
On 05/27, Kirill Ponomarev wrote: > > Breaks kernel build with "nooption IPSEC": > > > > ld: error: undefined symbol: vnet_entry_ipsec4stat > > >>> referenced by key.c:933 (/usr/src/sys/netipsec/key.c:933) > > >>> key.o:(key_allocsp) > > > > ld: error: undefined symbol: vnet_entry_ipsec4stat > > >>> referenced by key.c:939 (/usr/src/sys/netipsec/key.c:939) > > >>> key.o:(key_allocsp) > > Breaks kernel with "options IPSEC" as well, please back out. Sorry, it's with "nooption IPSEC" on my side as well. signature.asc Description: PGP signature
Re: svn commit: r334054 - in head: sys/kern sys/netipsec tools/tools/crypto usr.bin/netstat
On 05/25, Jan Beich wrote: > Fabien Thomaswrites: > > > + IPSECSTAT_INC(ips_spdcache_hits); > > + > > + SPDCACHE_UNLOCK(hashv); > > + goto out; > > + } > > + > > + IPSECSTAT_INC(ips_spdcache_misses); > > Breaks kernel build with "nooption IPSEC": > > ld: error: undefined symbol: vnet_entry_ipsec4stat > >>> referenced by key.c:933 (/usr/src/sys/netipsec/key.c:933) > >>> key.o:(key_allocsp) > > ld: error: undefined symbol: vnet_entry_ipsec4stat > >>> referenced by key.c:939 (/usr/src/sys/netipsec/key.c:939) > >>> key.o:(key_allocsp) Breaks kernel with "options IPSEC" as well, please back out. signature.asc Description: PGP signature
svn commit: r334254 - head/etc/rc.d
Author: trasz Date: Sun May 27 10:48:21 2018 New Revision: 334254 URL: https://svnweb.freebsd.org/changeset/base/334254 Log: Make the cfumass rc script support USB template 10. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/etc/rc.d/cfumass Modified: head/etc/rc.d/cfumass == --- head/etc/rc.d/cfumass Sun May 27 06:47:09 2018(r334253) +++ head/etc/rc.d/cfumass Sun May 27 10:48:21 2018(r334254) @@ -45,7 +45,7 @@ remove_luns() cfumass_start() { - local err _files _template + local err _files _template _new_template if [ ! -d "${cfumass_dir}" ]; then warn "${cfumass_dir} does not exist" @@ -90,36 +90,59 @@ cfumass_start() fi fi + # Set the template number based on the current one. _template=`sysctl -n hw.usb.template` - if [ "${_template}" -lt 0 ]; then - sysctl hw.usb.template=0 > /dev/null + case "${_template}" in + -1) + _new_template="0" + ;; + 8) + _new_template="10" + ;; + *) + warn "hw.usb.template sysctl set to neither -1 nor 8; not changing" + _new_template="" + ;; + esac + + if [ -n "${_new_template}" ]; then + sysctl hw.usb.template="${_new_template}" > /dev/null err=$? if [ "${err}" -ne 0 ]; then - warn "unable to set hw.usb.template sysctl" + warn "unable to set hw.usb.template sysctl to ${_new_template}" return "${err}" fi - else - # Otherwise don't touch the sysctl - we could lock the user - # out of the machine otherwise. - warn "hw.usb.template sysctl set to neither -1 nor 0" fi } cfumass_stop() { - local err _template + local err _template _new_template + remove_luns + _template=`sysctl -n hw.usb.template` - if [ "${_template}" -eq 0 ]; then - sysctl hw.usb.template=-1 > /dev/null + case "${_template}" in + 0) + _new_template="-1" + ;; + 10) + _new_template="8" + ;; + *) + warn "hw.usb.template sysctl set to neither 0 nor 10; not changing" + _new_template="" + ;; + esac + + if [ -n "${_new_template}" ]; then + sysctl hw.usb.template="${_new_template}" > /dev/null err=$? if [ "${err}" -ne 0 ]; then - warn "unable to set hw.usb.template sysctl" + warn "unable to set hw.usb.template sysctl to ${_new_template}" return "${err}" fi fi - - remove_luns } load_rc_config $name ___ 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: r334253 - head/sys/netinet
Author: mmacy Date: Sun May 27 06:47:09 2018 New Revision: 334253 URL: https://svnweb.freebsd.org/changeset/base/334253 Log: in_pcbladdr: remove debug code that snuck in with ifa epoch conversion r334118 Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c == --- head/sys/netinet/in_pcb.c Sat May 26 23:02:15 2018(r334252) +++ head/sys/netinet/in_pcb.c Sun May 27 06:47:09 2018(r334253) @@ -839,7 +839,6 @@ in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, } if (ia == NULL) { - printf("ifa_ifwithnet failed\n"); error = ENETUNREACH; goto done; } ___ 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: r334221 - head/etc
On Fri, May 25, 2018 at 07:36:26PM +, Mark Felder wrote: > New Revision: 334221 > URL: https://svnweb.freebsd.org/changeset/base/334221 > > Log: > rc.subr: Support loading environmental variables from a file > > + if [ -n "$_env_file" ] && [ -r "${_env_file}" ]; then Style bug: "$_env_file" vs. "${_env_file}". Also, isn't the -n check redundant? > + set -a > + . $_env_file Shouldn't it be quoted here as well (. "$_env_file")? ./danfe ___ 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"