svn commit: r351592 - head/usr.bin/w
Author: karels Date: Thu Aug 29 02:44:18 2019 New Revision: 351592 URL: https://svnweb.freebsd.org/changeset/base/351592 Log: Fix address annotation in xml output from w The libxo xml feature of adding an annotation with the "original" address from the utmpx file if it is different than the final "from" field was broken by r351379. This was pointed out by the gcc error that save_p might be used uninitialized. Save the original address as needed in each entry, don't just use the last one from the previous loop. Reviewed by: marcel@ MFC after:1 week Differential Revision:https://reviews.freebsd.org/D21390 Modified: head/usr.bin/w/w.c Modified: head/usr.bin/w/w.c == --- head/usr.bin/w/w.c Wed Aug 28 23:40:57 2019(r351591) +++ head/usr.bin/w/w.c Thu Aug 29 02:44:18 2019(r351592) @@ -118,6 +118,7 @@ static struct entry { char*args; /* arg list of interesting process */ struct kinfo_proc *dkp;/* debug option proc list */ char*from; /* "from": name or addr */ + char*save_from; /* original "from": name or addr */ } *ep, *ehead = NULL, **nextp = #definedebugproc(p) *(&((struct kinfo_proc *)p)->ki_udata) @@ -209,7 +210,6 @@ main(int argc, char *argv[]) if (*argv) sel_users = argv; - save_p = NULL; setutxent(); for (nusers = 0; (utmp = getutxent()) != NULL;) { struct addrinfo hints, *res; @@ -312,6 +312,8 @@ main(int argc, char *argv[]) ep->from = strdup(p); if ((i = strlen(p)) > fromwidth) fromwidth = i; + if (save_p != p) + ep->save_from = strdup(save_p); } endutxent(); @@ -451,8 +453,8 @@ main(int argc, char *argv[]) strncmp(ep->utmp.ut_line, "cua", 3) ? ep->utmp.ut_line : ep->utmp.ut_line + 3) : "-"); - if (save_p && save_p != p) - xo_attr("address", "%s", save_p); + if (ep->save_from) + xo_attr("address", "%s", ep->save_from); xo_emit("{:from/%-*.*s/%@**@s} ", fromwidth, fromwidth, ep->from); t = ep->utmp.ut_tv.tv_sec; ___ 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: r351591 - in head/sys/amd64/vmm: . amd
Author: jhb Date: Wed Aug 28 23:40:57 2019 New Revision: 351591 URL: https://svnweb.freebsd.org/changeset/base/351591 Log: Use get_pcpu() to fetch the current CPU's pcpu pointer. This avoids encoding knowledge about how pcpu objects are allocated and is also a few instructions shorter. MFC after:2 weeks Modified: head/sys/amd64/vmm/amd/svm.c head/sys/amd64/vmm/vmm_host.h Modified: head/sys/amd64/vmm/amd/svm.c == --- head/sys/amd64/vmm/amd/svm.cWed Aug 28 23:31:58 2019 (r351590) +++ head/sys/amd64/vmm/amd/svm.cWed Aug 28 23:40:57 2019 (r351591) @@ -102,9 +102,6 @@ SYSCTL_INT(_hw_vmm_svm, OID_AUTO, vmcb_clean, CTLFLAG_ static MALLOC_DEFINE(M_SVM, "svm", "svm"); static MALLOC_DEFINE(M_SVM_VLAPIC, "svm-vlapic", "svm-vlapic"); -/* Per-CPU context area. */ -extern struct pcpu __pcpu[]; - static uint32_t svm_feature = ~0U; /* AMD SVM features. */ SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, features, CTLFLAG_RDTUN, _feature, 0, "SVM features advertised by CPUID.800AH:EDX"); @@ -2054,7 +2051,7 @@ svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t /* Launch Virtual Machine. */ VCPU_CTR1(vm, vcpu, "Resume execution at %#lx", state->rip); svm_dr_enter_guest(gctx); - svm_launch(vmcb_pa, gctx, &__pcpu[curcpu]); + svm_launch(vmcb_pa, gctx, get_pcpu()); svm_dr_leave_guest(gctx); CPU_CLR_ATOMIC(curcpu, >pm_active); Modified: head/sys/amd64/vmm/vmm_host.h == --- head/sys/amd64/vmm/vmm_host.h Wed Aug 28 23:31:58 2019 (r351590) +++ head/sys/amd64/vmm/vmm_host.h Wed Aug 28 23:40:57 2019 (r351591) @@ -72,14 +72,11 @@ vmm_get_host_gdtrbase(void) return ((uint64_t)[NGDT * curcpu]); } -struct pcpu; -extern struct pcpu __pcpu[]; - static __inline uint64_t vmm_get_host_gsbase(void) { - return ((uint64_t)&__pcpu[curcpu]); + return ((uint64_t)get_pcpu()); } #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"
svn commit: r351590 - head/sys/dev/cxgbe/tom
Author: np Date: Wed Aug 28 23:31:58 2019 New Revision: 351590 URL: https://svnweb.freebsd.org/changeset/base/351590 Log: cxgbe/t4_tom: Use the correct value of sndbuf in AIO Tx. This should have been part of r351540. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c == --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Aug 28 22:04:04 2019 (r351589) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Aug 28 23:31:58 2019 (r351590) @@ -2023,7 +2023,6 @@ alloc_aiotx_mbuf(struct kaiocb *job, int len) static void t4_aiotx_process_job(struct toepcb *toep, struct socket *so, struct kaiocb *job) { - struct adapter *sc; struct sockbuf *sb; struct file *fp; struct inpcb *inp; @@ -2032,7 +2031,6 @@ t4_aiotx_process_job(struct toepcb *toep, struct socke int error, len; bool moretocome, sendmore; - sc = td_adapter(toep->td); sb = >so_snd; SOCKBUF_UNLOCK(sb); fp = job->fd_file; @@ -2104,8 +2102,8 @@ sendanother: moretocome = false; } else moretocome = true; - if (len > sc->tt.sndbuf) { - len = sc->tt.sndbuf; + if (len > toep->params.sndbuf) { + len = toep->params.sndbuf; sendmore = true; } else sendmore = false; ___ 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: r351589 - head/sys/dev/ahci
Author: mav Date: Wed Aug 28 22:04:04 2019 New Revision: 351589 URL: https://svnweb.freebsd.org/changeset/base/351589 Log: Fix AHCI Enclosure Management, broken by r351356. ivars value of -1 was used to distinguish EM device, and r351356 left some wrong checks for it. Give EM device separate flag there instead. Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h Modified: head/sys/dev/ahci/ahci.c == --- head/sys/dev/ahci/ahci.cWed Aug 28 21:13:28 2019(r351588) +++ head/sys/dev/ahci/ahci.cWed Aug 28 22:04:04 2019(r351589) @@ -362,7 +362,7 @@ ahci_attach(device_t dev) if (child == NULL) device_printf(dev, "failed to add enclosure device\n"); else - device_set_ivars(child, (void *)(intptr_t)-1); + device_set_ivars(child, (void *)(intptr_t)AHCI_EM_UNIT); } bus_generic_attach(dev); return (0); @@ -562,23 +562,25 @@ ahci_alloc_resource(device_t dev, device_t child, int struct resource *res; rman_res_t st; int offset, size, unit; - bool is_remapped; + bool is_em, is_remapped; unit = (intptr_t)device_get_ivars(child); + is_em = is_remapped = false; if (unit & AHCI_REMAPPED_UNIT) { - unit &= ~AHCI_REMAPPED_UNIT; + unit &= AHCI_UNIT; unit -= ctlr->channels; is_remapped = true; - } else - is_remapped = false; + } else if (unit & AHCI_EM_UNIT) { + unit &= AHCI_UNIT; + is_em = true; + } res = NULL; switch (type) { case SYS_RES_MEMORY: if (is_remapped) { offset = ctlr->remap_offset + unit * ctlr->remap_size; size = ctlr->remap_size; - } - else if (unit >= 0) { + } else if (!is_em) { offset = AHCI_OFFSET + (unit << 7); size = 128; } else if (*rid == 0) { @@ -639,7 +641,7 @@ ahci_setup_intr(device_t dev, device_t child, struct r void *argument, void **cookiep) { struct ahci_controller *ctlr = device_get_softc(dev); - int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; + int unit = (intptr_t)device_get_ivars(child) & AHCI_UNIT; if (filter != NULL) { printf("ahci.c: we cannot use a filter here\n"); @@ -655,7 +657,7 @@ ahci_teardown_intr(device_t dev, device_t child, struc void *cookie) { struct ahci_controller *ctlr = device_get_softc(dev); - int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; + int unit = (intptr_t)device_get_ivars(child) & AHCI_UNIT; ctlr->interrupt[unit].function = NULL; ctlr->interrupt[unit].argument = NULL; @@ -665,12 +667,13 @@ ahci_teardown_intr(device_t dev, device_t child, struc int ahci_print_child(device_t dev, device_t child) { - int retval, channel; + intptr_t ivars; + int retval; retval = bus_print_child_header(dev, child); - channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; - if (channel >= 0) - retval += printf(" at channel %d", channel); + ivars = (intptr_t)device_get_ivars(child); + if ((ivars & AHCI_EM_UNIT) == 0) + retval += printf(" at channel %d", (int)ivars & AHCI_UNIT); retval += bus_print_child_footer(dev, child); return (retval); } @@ -679,11 +682,11 @@ int ahci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen) { - int channel; + intptr_t ivars; - channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; - if (channel >= 0) - snprintf(buf, buflen, "channel=%d", channel); + ivars = (intptr_t)device_get_ivars(child); + if ((ivars & AHCI_EM_UNIT) == 0) + snprintf(buf, buflen, "channel=%d", (int)ivars & AHCI_UNIT); return (0); } Modified: head/sys/dev/ahci/ahci.h == --- head/sys/dev/ahci/ahci.hWed Aug 28 21:13:28 2019(r351588) +++ head/sys/dev/ahci/ahci.hWed Aug 28 22:04:04 2019(r351589) @@ -319,9 +319,10 @@ /* Total main work area. */ #define AHCI_WORK_SIZE (AHCI_CT_OFFSET + AHCI_CT_SIZE * ch->numslots) - -/* NVMe remapped device */ -#define AHCI_REMAPPED_UNIT (1 << 31) +/* ivars value fields */ +#define AHCI_REMAPPED_UNIT (1 << 31) /* NVMe remapped device. */ +#define AHCI_EM_UNIT (1 << 30) /* Enclosure Mgmt device. */ +#define AHCI_UNIT 0xff/* Channel number. */ struct ahci_dma_prd { u_int64_t dba;
Re: svn commit: r350544 - head/usr.bin/bzip2recover
On Wed, Aug 28, 2019 at 10:54:13PM +0200, Antoine Brodin wrote: > On Sat, Aug 3, 2019 at 12:10 AM Mark Johnston wrote: > > > > Author: markj > > Date: Fri Aug 2 22:09:56 2019 > > New Revision: 350544 > > URL: https://svnweb.freebsd.org/changeset/base/350544 > > > > Log: > > Add bzip2recover.1. > > > > MFC after:3 days > > Sponsored by: The FreeBSD Foundation > > > > Modified: > > head/usr.bin/bzip2recover/Makefile > > Hi, > > It seems that this breaks parrallel installworld. > > Cheers, > > Antoine This should be fixed by r351587, thanks. ___ 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: r351587 - in head/usr.bin: bzip2 bzip2recover
Author: markj Date: Wed Aug 28 21:01:51 2019 New Revision: 351587 URL: https://svnweb.freebsd.org/changeset/base/351587 Log: Install all bzip2.1 MLINKs from the same place. Reported by: antoine MFC after:3 days Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/bzip2/Makefile head/usr.bin/bzip2recover/Makefile Modified: head/usr.bin/bzip2/Makefile == --- head/usr.bin/bzip2/Makefile Wed Aug 28 20:58:24 2019(r351586) +++ head/usr.bin/bzip2/Makefile Wed Aug 28 21:01:51 2019(r351587) @@ -12,7 +12,9 @@ LIBADD= bz2 LINKS= ${BINDIR}/bzip2 ${BINDIR}/bunzip2 LINKS+=${BINDIR}/bzip2 ${BINDIR}/bzcat -MLINKS= bzip2.1 bunzip2.1 bzip2.1 bzcat.1 +MLINKS=bzip2.1 bunzip2.1 \ + bzip2.1 bzcat.1 \ + bzip2.1 bzip2recover.1 REFFILES= sample1.ref sample2.ref sample3.ref DREFFILES= sample1.bz2 sample2.bz2 sample3.bz2 Modified: head/usr.bin/bzip2recover/Makefile == --- head/usr.bin/bzip2recover/Makefile Wed Aug 28 20:58:24 2019 (r351586) +++ head/usr.bin/bzip2recover/Makefile Wed Aug 28 21:01:51 2019 (r351587) @@ -6,8 +6,6 @@ BZ2DIR= ${SRCTOP}/contrib/bzip2 PROG= bzip2recover MAN= -MLINKS+=bzip2.1 bzip2recover.1 - NO_WMISSING_VARIABLE_DECLARATIONS= .include ___ 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: r350544 - head/usr.bin/bzip2recover
On Sat, Aug 3, 2019 at 12:10 AM Mark Johnston wrote: > > Author: markj > Date: Fri Aug 2 22:09:56 2019 > New Revision: 350544 > URL: https://svnweb.freebsd.org/changeset/base/350544 > > Log: > Add bzip2recover.1. > > MFC after:3 days > Sponsored by: The FreeBSD Foundation > > Modified: > head/usr.bin/bzip2recover/Makefile Hi, It seems that this breaks parrallel installworld. Cheers, Antoine ___ 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: r351584 - in head/sys: fs/nullfs fs/unionfs kern sys
On 8/28/19, Mateusz Guzik wrote: > Author: mjg > Date: Wed Aug 28 20:34:24 2019 > New Revision: 351584 > URL: https://svnweb.freebsd.org/changeset/base/351584 > > Log: > vfs: add VOP_NEED_INACTIVE > > vnode usecount drops to 0 all the time (e.g. for directories during path > lookup). > When that happens the kernel would always lock the exclusive lock for the > vnode > in order to call vinactive(). This blocks other threads who want to use > the vnode > for looukp. > > vinactive is very rarely needed and can be tested for without the vnode > lock held. > > This patch gives filesytems an opportunity to do it, sample total wait > time for > tmpfs over 500 minutes of poudriere -j 104: > > before: 557563641706 (lockmgr:tmpfs) > after: 46309603301 (lockmgr:tmpfs) > > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D21371 > Reviewed by: kib Tested by: pho > Modified: > head/sys/fs/nullfs/null_vnops.c > head/sys/fs/unionfs/union_vnops.c > head/sys/kern/vfs_default.c > head/sys/kern/vfs_subr.c > head/sys/kern/vnode_if.src > head/sys/sys/vnode.h > > Modified: head/sys/fs/nullfs/null_vnops.c > == > --- head/sys/fs/nullfs/null_vnops.c Wed Aug 28 20:23:49 2019 > (r351583) > +++ head/sys/fs/nullfs/null_vnops.c Wed Aug 28 20:34:24 2019 > (r351584) > @@ -907,6 +907,7 @@ struct vop_vector null_vnodeops = { > .vop_getattr = null_getattr, > .vop_getwritemount =null_getwritemount, > .vop_inactive = null_inactive, > + .vop_need_inactive =vop_stdneed_inactive, > .vop_islocked = vop_stdislocked, > .vop_lock1 =null_lock, > .vop_lookup = null_lookup, > > Modified: head/sys/fs/unionfs/union_vnops.c > == > --- head/sys/fs/unionfs/union_vnops.c Wed Aug 28 20:23:49 2019 > (r351583) > +++ head/sys/fs/unionfs/union_vnops.c Wed Aug 28 20:34:24 2019 > (r351584) > @@ -2523,6 +2523,7 @@ struct vop_vector unionfs_vnodeops = { > .vop_getextattr = unionfs_getextattr, > .vop_getwritemount =unionfs_getwritemount, > .vop_inactive = unionfs_inactive, > + .vop_need_inactive =vop_stdneed_inactive, > .vop_islocked = unionfs_islocked, > .vop_ioctl =unionfs_ioctl, > .vop_link = unionfs_link, > > Modified: head/sys/kern/vfs_default.c > == > --- head/sys/kern/vfs_default.c Wed Aug 28 20:23:49 2019 > (r351583) > +++ head/sys/kern/vfs_default.c Wed Aug 28 20:34:24 2019 > (r351584) > @@ -120,6 +120,7 @@ struct vop_vector default_vnodeops = { > .vop_getpages_async = vop_stdgetpages_async, > .vop_getwritemount =vop_stdgetwritemount, > .vop_inactive = VOP_NULL, > + .vop_need_inactive =vop_stdneed_inactive, > .vop_ioctl =vop_stdioctl, > .vop_kqfilter = vop_stdkqfilter, > .vop_islocked = vop_stdislocked, > @@ -1155,6 +1156,13 @@ vop_stdadd_writecount(struct vop_add_writecount_args > * > } > VI_UNLOCK(vp); > return (error); > +} > + > +int > +vop_stdneed_inactive(struct vop_need_inactive_args *ap) > +{ > + > + return (1); > } > > static int > > Modified: head/sys/kern/vfs_subr.c > == > --- head/sys/kern/vfs_subr.c Wed Aug 28 20:23:49 2019(r351583) > +++ head/sys/kern/vfs_subr.c Wed Aug 28 20:34:24 2019(r351584) > @@ -2891,6 +2891,21 @@ vputx(struct vnode *vp, int func) > CTR2(KTR_VFS, "%s: return vnode %p to the freelist", __func__, vp); > > /* > + * Check if the fs wants to perform inactive processing. Note we > + * may be only holding the interlock, in which case it is possible > + * someone else called vgone on the vnode and ->v_data is now NULL. > + * Since vgone performs inactive on its own there is nothing to do > + * here but to drop our hold count. > + */ > + if (__predict_false(vp->v_iflag & VI_DOOMED) || > + VOP_NEED_INACTIVE(vp) == 0) { > + if (func == VPUTX_VPUT) > + VOP_UNLOCK(vp, 0); > + vdropl(vp); > + return; > + } > + > + /* >* We must call VOP_INACTIVE with the node locked. Mark >* as VI_DOINGINACT to avoid recursion. >*/ > @@ -4353,6 +4368,7 @@ static struct vop_vector sync_vnodeops = { > .vop_close =sync_close, /* close */ > .vop_fsync =sync_fsync, /* fsync */ > .vop_inactive = sync_inactive, /* inactive */ > + .vop_need_inactive = vop_stdneed_inactive, /* need_inactive */ >
svn commit: r351585 - head/sys/fs/tmpfs
Author: mjg Date: Wed Aug 28 20:35:23 2019 New Revision: 351585 URL: https://svnweb.freebsd.org/changeset/base/351585 Log: tmpfs: use VOP_NEED_INACTIVE Reviewed by: kib Tested by:pho Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D21371 Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c == --- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Aug 28 20:34:24 2019 (r351584) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Aug 28 20:35:23 2019 (r351585) @@ -1283,6 +1283,27 @@ tmpfs_inactive(struct vop_inactive_args *v) return (0); } +static int +tmpfs_need_inactive(struct vop_need_inactive_args *ap) +{ + struct vnode *vp; + struct tmpfs_node *node; + struct vm_object *obj; + + vp = ap->a_vp; + node = VP_TO_TMPFS_NODE(vp); + if (node->tn_links == 0) + goto need; + if (vp->v_type == VREG) { + obj = vp->v_object; + if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) + goto need; + } + return (0); +need: + return (1); +} + int tmpfs_reclaim(struct vop_reclaim_args *v) { @@ -1584,6 +1605,7 @@ struct vop_vector tmpfs_vnodeop_entries = { .vop_readdir = tmpfs_readdir, .vop_readlink = tmpfs_readlink, .vop_inactive = tmpfs_inactive, + .vop_need_inactive =tmpfs_need_inactive, .vop_reclaim = tmpfs_reclaim, .vop_print =tmpfs_print, .vop_pathconf = tmpfs_pathconf, ___ 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: r351584 - in head/sys: fs/nullfs fs/unionfs kern sys
Author: mjg Date: Wed Aug 28 20:34:24 2019 New Revision: 351584 URL: https://svnweb.freebsd.org/changeset/base/351584 Log: vfs: add VOP_NEED_INACTIVE vnode usecount drops to 0 all the time (e.g. for directories during path lookup). When that happens the kernel would always lock the exclusive lock for the vnode in order to call vinactive(). This blocks other threads who want to use the vnode for looukp. vinactive is very rarely needed and can be tested for without the vnode lock held. This patch gives filesytems an opportunity to do it, sample total wait time for tmpfs over 500 minutes of poudriere -j 104: before: 557563641706 (lockmgr:tmpfs) after: 46309603301 (lockmgr:tmpfs) Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D21371 Modified: head/sys/fs/nullfs/null_vnops.c head/sys/fs/unionfs/union_vnops.c head/sys/kern/vfs_default.c head/sys/kern/vfs_subr.c head/sys/kern/vnode_if.src head/sys/sys/vnode.h Modified: head/sys/fs/nullfs/null_vnops.c == --- head/sys/fs/nullfs/null_vnops.c Wed Aug 28 20:23:49 2019 (r351583) +++ head/sys/fs/nullfs/null_vnops.c Wed Aug 28 20:34:24 2019 (r351584) @@ -907,6 +907,7 @@ struct vop_vector null_vnodeops = { .vop_getattr = null_getattr, .vop_getwritemount =null_getwritemount, .vop_inactive = null_inactive, + .vop_need_inactive =vop_stdneed_inactive, .vop_islocked = vop_stdislocked, .vop_lock1 =null_lock, .vop_lookup = null_lookup, Modified: head/sys/fs/unionfs/union_vnops.c == --- head/sys/fs/unionfs/union_vnops.c Wed Aug 28 20:23:49 2019 (r351583) +++ head/sys/fs/unionfs/union_vnops.c Wed Aug 28 20:34:24 2019 (r351584) @@ -2523,6 +2523,7 @@ struct vop_vector unionfs_vnodeops = { .vop_getextattr = unionfs_getextattr, .vop_getwritemount =unionfs_getwritemount, .vop_inactive = unionfs_inactive, + .vop_need_inactive =vop_stdneed_inactive, .vop_islocked = unionfs_islocked, .vop_ioctl =unionfs_ioctl, .vop_link = unionfs_link, Modified: head/sys/kern/vfs_default.c == --- head/sys/kern/vfs_default.c Wed Aug 28 20:23:49 2019(r351583) +++ head/sys/kern/vfs_default.c Wed Aug 28 20:34:24 2019(r351584) @@ -120,6 +120,7 @@ struct vop_vector default_vnodeops = { .vop_getpages_async = vop_stdgetpages_async, .vop_getwritemount =vop_stdgetwritemount, .vop_inactive = VOP_NULL, + .vop_need_inactive =vop_stdneed_inactive, .vop_ioctl =vop_stdioctl, .vop_kqfilter = vop_stdkqfilter, .vop_islocked = vop_stdislocked, @@ -1155,6 +1156,13 @@ vop_stdadd_writecount(struct vop_add_writecount_args * } VI_UNLOCK(vp); return (error); +} + +int +vop_stdneed_inactive(struct vop_need_inactive_args *ap) +{ + + return (1); } static int Modified: head/sys/kern/vfs_subr.c == --- head/sys/kern/vfs_subr.cWed Aug 28 20:23:49 2019(r351583) +++ head/sys/kern/vfs_subr.cWed Aug 28 20:34:24 2019(r351584) @@ -2891,6 +2891,21 @@ vputx(struct vnode *vp, int func) CTR2(KTR_VFS, "%s: return vnode %p to the freelist", __func__, vp); /* +* Check if the fs wants to perform inactive processing. Note we +* may be only holding the interlock, in which case it is possible +* someone else called vgone on the vnode and ->v_data is now NULL. +* Since vgone performs inactive on its own there is nothing to do +* here but to drop our hold count. +*/ + if (__predict_false(vp->v_iflag & VI_DOOMED) || + VOP_NEED_INACTIVE(vp) == 0) { + if (func == VPUTX_VPUT) + VOP_UNLOCK(vp, 0); + vdropl(vp); + return; + } + + /* * We must call VOP_INACTIVE with the node locked. Mark * as VI_DOINGINACT to avoid recursion. */ @@ -4353,6 +4368,7 @@ static struct vop_vector sync_vnodeops = { .vop_close =sync_close, /* close */ .vop_fsync =sync_fsync, /* fsync */ .vop_inactive = sync_inactive, /* inactive */ + .vop_need_inactive = vop_stdneed_inactive, /* need_inactive */ .vop_reclaim = sync_reclaim, /* reclaim */ .vop_lock1 =vop_stdlock,/* lock */ .vop_unlock = vop_stdunlock, /* unlock */ @@ -4514,6 +4530,20 @@ sync_reclaim(struct
svn commit: r351577 - head/sys/amd64/amd64
Author: mjg Date: Wed Aug 28 19:40:57 2019 New Revision: 351577 URL: https://svnweb.freebsd.org/changeset/base/351577 Log: amd64: clean up cpu_switch.S - LK macro (conditional on SMP for the lock prefix) is unused - SETLK unnecessarily performs xchg. obtained value is never used and the implicit lock prefix adds avoidable cost. Barrier provided by it does not appear to be of any use. - the lock waited for is almost never blocked, yet the loop starts with a pause. Move it out of the common case. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D19563 Modified: head/sys/amd64/amd64/cpu_switch.S Modified: head/sys/amd64/amd64/cpu_switch.S == --- head/sys/amd64/amd64/cpu_switch.S Wed Aug 28 19:28:27 2019 (r351576) +++ head/sys/amd64/amd64/cpu_switch.S Wed Aug 28 19:40:57 2019 (r351577) @@ -45,18 +45,6 @@ .text -#ifdef SMP -#define LK lock ; -#else -#define LK -#endif - -#if defined(SCHED_ULE) && defined(SMP) -#defineSETLK xchgq -#else -#defineSETLK movq -#endif - /* * cpu_throw() * @@ -150,17 +138,15 @@ ctx_switch_xsave: movq%rdx,%r15 movq%rsi,%rdi callq pmap_activate_sw - SETLK %r15,TD_LOCK(%r13) /* Release the old thread */ + movq%r15,TD_LOCK(%r13) /* Release the old thread */ sw1: movqTD_PCB(%r12),%r8 #if defined(SCHED_ULE) && defined(SMP) - /* Wait for the new thread to become unblocked */ movq$blocked_lock, %rdx -1: movqTD_LOCK(%r12),%rcx cmpq%rcx, %rdx - pause - je 1b + je sw1wait +sw1cont: #endif /* * At this point, we've switched address spaces and are ready @@ -496,3 +482,14 @@ ENTRY(resumectx) xorl%eax,%eax ret END(resumectx) + +/* Wait for the new thread to become unblocked */ +#if defined(SCHED_ULE) && defined(SMP) +sw1wait: +1: + pause + movqTD_LOCK(%r12),%rcx + cmpq%rcx, %rdx + je 1b + jmp sw1cont +#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"
svn commit: r351576 - head/sys/vm
Author: mjg Date: Wed Aug 28 19:28:27 2019 New Revision: 351576 URL: https://svnweb.freebsd.org/changeset/base/351576 Log: vm: only lock tmpfs vnode shared in vm_object_deallocate Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D21455 Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c == --- head/sys/vm/vm_object.c Wed Aug 28 18:01:54 2019(r351575) +++ head/sys/vm/vm_object.c Wed Aug 28 19:28:27 2019(r351576) @@ -536,7 +536,7 @@ vm_object_deallocate(vm_object_t object) vp = object->un_pager.swp.swp_tmpfs; vhold(vp); VM_OBJECT_WUNLOCK(object); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); VM_OBJECT_WLOCK(object); if (object->type == OBJT_DEAD || object->ref_count != 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: r351575 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern
Author: markj Date: Wed Aug 28 18:01:54 2019 New Revision: 351575 URL: https://svnweb.freebsd.org/changeset/base/351575 Log: Avoid direct accesses of the vm_page wire_count field. No functional change intended. Sponsored by: Netflix Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/kern/vfs_bio.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Aug 28 17:39:46 2019(r351574) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Aug 28 18:01:54 2019(r351575) @@ -593,7 +593,7 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t *uio) vm_page_sunbusy(pp); vm_page_lock(pp); if (error) { - if (pp->wire_count == 0 && pp->valid == 0 && + if (!vm_page_wired(pp) && pp->valid == 0 && !vm_page_busied(pp)) vm_page_free(pp); } else { Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Wed Aug 28 17:39:46 2019(r351574) +++ head/sys/kern/vfs_bio.c Wed Aug 28 18:01:54 2019(r351575) @@ -4881,10 +4881,9 @@ vm_hold_free_pages(struct buf *bp, int newbsize) for (index = newnpages; index < bp->b_npages; index++) { p = bp->b_pages[index]; bp->b_pages[index] = NULL; - p->wire_count--; + vm_page_unwire_noq(p); vm_page_free(p); } - vm_wire_sub(bp->b_npages - newnpages); bp->b_npages = newnpages; } ___ 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: r351574 - head/cddl/contrib/opensolaris/lib/libzfs/common
Author: mav Date: Wed Aug 28 17:39:46 2019 New Revision: 351574 URL: https://svnweb.freebsd.org/changeset/base/351574 Log: MFV/ZoL: Fix wrong assertion in libzfs diff error handling In compare(), all error cases set the error code to EPIPE, so when an error is set, the correct assertion to make is that the error is EPIPE, not EINVAL. Reviewed-by: Richard Elling Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #8743 zfsonlinux/zfs@9dc41a769df164875d974c2431b2453e70e16c41 Submitted by: Ryan Moeller MFC after:1 week Sponsored by: iXsystems, Inc. Differential Revision:https://reviews.freebsd.org/D20118 Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c == --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c Wed Aug 28 17:01:28 2019(r351573) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c Wed Aug 28 17:39:46 2019(r351574) @@ -472,7 +472,7 @@ differ(void *arg) if (err) return ((void *)-1); if (di->zerr) { - ASSERT(di->zerr == EINVAL); + ASSERT(di->zerr == EPIPE); (void) snprintf(di->errbuf, sizeof (di->errbuf), dgettext(TEXT_DOMAIN, "Internal error: bad data from diff IOCTL")); ___ 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: r351573 - head/lib/libfetch
Author: markj Date: Wed Aug 28 17:01:28 2019 New Revision: 351573 URL: https://svnweb.freebsd.org/changeset/base/351573 Log: Document fetchReqHTTP(). Submitted by: Farhan Khan Reviewed by: 0mp MFC after:1 week Differential Revision:https://reviews.freebsd.org/D18788 Modified: head/lib/libfetch/Makefile head/lib/libfetch/fetch.3 head/lib/libfetch/http.c Modified: head/lib/libfetch/Makefile == --- head/lib/libfetch/Makefile Wed Aug 28 16:18:23 2019(r351572) +++ head/lib/libfetch/Makefile Wed Aug 28 17:01:28 2019(r351573) @@ -68,6 +68,7 @@ MLINKS+= fetch.3 fetchPutFTP.3 MLINKS+= fetch.3 fetchPutFile.3 MLINKS+= fetch.3 fetchPutHTTP.3 MLINKS+= fetch.3 fetchPutURL.3 +MLINKS+= fetch.3 fetchReqHTTP.3 MLINKS+= fetch.3 fetchStat.3 MLINKS+= fetch.3 fetchStatFTP.3 MLINKS+= fetch.3 fetchStatFile.3 Modified: head/lib/libfetch/fetch.3 == --- head/lib/libfetch/fetch.3 Wed Aug 28 16:18:23 2019(r351572) +++ head/lib/libfetch/fetch.3 Wed Aug 28 17:01:28 2019(r351573) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2016 +.Dd August 28, 2019 .Dt FETCH 3 .Os .Sh NAME @@ -53,6 +53,7 @@ .Nm fetchPutHTTP , .Nm fetchStatHTTP , .Nm fetchListHTTP , +.Nm fetchReqHTTP , .Nm fetchXGetFTP , .Nm fetchGetFTP , .Nm fetchPutFTP , @@ -112,6 +113,8 @@ .Ft struct url_ent * .Fn fetchListHTTP "struct url *u" "const char *flags" .Ft FILE * +.Fn fetchReqHTTP "struct url *u" "const char *method" "const char *flags" "const char *content_type" "const char *body" +.Ft FILE * .Fn fetchXGetFTP "struct url *u" "struct url_stat *us" "const char *flags" .Ft FILE * .Fn fetchGetFTP "struct url *u" "const char *flags" @@ -355,9 +358,10 @@ and password "anonymous@". .Sh HTTP SCHEME The .Fn fetchXGetHTTP , -.Fn fetchGetHTTP -and +.Fn fetchGetHTTP , .Fn fetchPutHTTP +and +.Fn fetchReqHTTP functions implement the HTTP/1.1 protocol. With a little luck, there is even a chance that they comply with RFC2616 and RFC2617. @@ -386,6 +390,18 @@ will send a conditional .Li If-Modified-Since HTTP header to only fetch the content if it is newer than .Va ims_time . +.Pp +The function +.Fn fetchReqHTTP +can be used to make requests with an arbitrary HTTP verb, +including POST, DELETE, CONNECT, OPTIONS, TRACE or PATCH. +This can be done by setting the argument +.Fa method +to the intended verb, such as +.Ql POST , +and +.Fa body +to the content. .Pp Since there seems to be no good way of implementing the HTTP PUT method in a manner consistent with the rest of the Modified: head/lib/libfetch/http.c == --- head/lib/libfetch/http.cWed Aug 28 16:18:23 2019(r351572) +++ head/lib/libfetch/http.cWed Aug 28 17:01:28 2019(r351573) @@ -2093,6 +2093,9 @@ fetchListHTTP(struct url *url __unused, const char *fl return (NULL); } +/* + * Arbitrary HTTP verb and content requests + */ FILE * fetchReqHTTP(struct url *URL, const char *method, const char *flags, const char *content_type, const char *body) ___ 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: r351572 - in head/sys: ddb kern sys
Author: mjg Date: Wed Aug 28 16:18:23 2019 New Revision: 351572 URL: https://svnweb.freebsd.org/changeset/base/351572 Log: proc: eliminate the zombproc list It is not needed by anything in the kernel and it slightly drives up contention on both proctree and allproc locks. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D21447 Modified: head/sys/ddb/db_ps.c head/sys/ddb/db_thread.c head/sys/kern/kern_exit.c head/sys/kern/kern_proc.c head/sys/kern/kern_racct.c head/sys/sys/proc.h Modified: head/sys/ddb/db_ps.c == --- head/sys/ddb/db_ps.cWed Aug 28 16:16:35 2019(r351571) +++ head/sys/ddb/db_ps.cWed Aug 28 16:18:23 2019(r351572) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); static voiddumpthread(volatile struct proc *p, volatile struct thread *td, int all); +static voiddb_ps_proc(struct proc *p); static int ps_mode; /* @@ -105,146 +106,157 @@ dump_args(volatile struct proc *p) void db_ps(db_expr_t addr, bool hasaddr, db_expr_t count, char *modif) { - volatile struct proc *p, *pp; - volatile struct thread *td; - struct ucred *cred; - struct pgrp *pgrp; - char state[9]; - int np, rflag, sflag, dflag, lflag, wflag; + struct proc *p; + int i, j; ps_mode = modif[0] == 'a' ? PRINT_ARGS : PRINT_NONE; - np = nprocs; - if (!LIST_EMPTY()) - p = LIST_FIRST(); - else - p = - #ifdef __LP64__ db_printf(" pid ppid pgrp uid state wmesg wchan cmd\n"); #else db_printf(" pid ppid pgrp uid state wmesg wchan cmd\n"); #endif - while (--np >= 0 && !db_pager_quit) { - if (p == NULL) { - db_printf("oops, ran out of processes early!\n"); - break; + + if (!LIST_EMPTY()) + p = LIST_FIRST(); + else + p = + for (; p != NULL && !db_pager_quit; p = LIST_NEXT(p, p_list)) + db_ps_proc(p); + + /* +* Do zombies. +*/ + for (i = 0; i < pidhashlock + 1 && !db_pager_quit; i++) { + for (j = i; j <= pidhash && !db_pager_quit; j += pidhashlock + 1) { + LIST_FOREACH(p, [j], p_hash) { + if (p->p_state == PRS_ZOMBIE) + db_ps_proc(p); + } } - pp = p->p_pptr; - if (pp == NULL) - pp = p; + } +} - cred = p->p_ucred; - pgrp = p->p_pgrp; - db_printf("%5d %5d %5d %5d ", p->p_pid, pp->p_pid, - pgrp != NULL ? pgrp->pg_id : 0, - cred != NULL ? cred->cr_ruid : 0); +static void +db_ps_proc(struct proc *p) +{ + volatile struct proc *pp; + volatile struct thread *td; + struct ucred *cred; + struct pgrp *pgrp; + char state[9]; + int rflag, sflag, dflag, lflag, wflag; - /* Determine our primary process state. */ - switch (p->p_state) { - case PRS_NORMAL: - if (P_SHOULDSTOP(p)) - state[0] = 'T'; - else { - /* -* One of D, L, R, S, W. For a -* multithreaded process we will use -* the state of the thread with the -* highest precedence. The -* precendence order from high to low -* is R, L, D, S, W. If no thread is -* in a sane state we use '?' for our -* primary state. -*/ - rflag = sflag = dflag = lflag = wflag = 0; - FOREACH_THREAD_IN_PROC(p, td) { - if (td->td_state == TDS_RUNNING || - td->td_state == TDS_RUNQ || - td->td_state == TDS_CAN_RUN) - rflag++; - if (TD_ON_LOCK(td)) - lflag++; - if (TD_IS_SLEEPING(td)) { - if (!(td->td_flags & TDF_SINTR)) - dflag++; - else - sflag++; - } -
svn commit: r351569 - in head/sys: kern vm
Author: markj Date: Wed Aug 28 16:08:06 2019 New Revision: 351569 URL: https://svnweb.freebsd.org/changeset/base/351569 Log: Wire pages in vm_page_grab() when appropriate. uiomove_object_page() and exec_map_first_page() would previously wire a page after having grabbed it. Ask vm_page_grab() to perform the wiring instead: this removes some redundant code, and is cheaper in the case where the requested page is not resident since the page allocator can be asked to initialize the page as wired, whereas a separate vm_page_wire() call requires the page lock. In vm_imgact_hold_page(), use vm_page_unwire_noq() instead of vm_page_unwire(PQ_NONE). The latter ensures that the page is dequeued before returning, but this is unnecessary since vm_page_free() will trigger a batched dequeue of the page. Reviewed by: alc, kib Tested by:pho (part of a larger patch) MFC after:1 week Sponsored by: Netflix Differential Revision:https://reviews.freebsd.org/D21440 Modified: head/sys/kern/kern_exec.c head/sys/kern/uipc_shm.c head/sys/vm/vm_glue.c Modified: head/sys/kern/kern_exec.c == --- head/sys/kern/kern_exec.c Wed Aug 28 08:09:10 2019(r351568) +++ head/sys/kern/kern_exec.c Wed Aug 28 16:08:06 2019(r351569) @@ -972,11 +972,13 @@ exec_map_first_page(struct image_params *imgp) #if VM_NRESERVLEVEL > 0 vm_object_color(object, 0); #endif - ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); + ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + VM_ALLOC_WIRED); if (ma[0]->valid != VM_PAGE_BITS_ALL) { vm_page_xbusy(ma[0]); if (!vm_pager_has_page(object, 0, NULL, )) { vm_page_lock(ma[0]); + vm_page_unwire_noq(ma[0]); vm_page_free(ma[0]); vm_page_unlock(ma[0]); VM_OBJECT_WUNLOCK(object); @@ -1004,6 +1006,8 @@ exec_map_first_page(struct image_params *imgp) if (rv != VM_PAGER_OK) { for (i = 0; i < initial_pagein; i++) { vm_page_lock(ma[i]); + if (i == 0) + vm_page_unwire_noq(ma[i]); vm_page_free(ma[i]); vm_page_unlock(ma[i]); } @@ -1014,9 +1018,6 @@ exec_map_first_page(struct image_params *imgp) for (i = 1; i < initial_pagein; i++) vm_page_readahead_finish(ma[i]); } - vm_page_lock(ma[0]); - vm_page_wire(ma[0]); - vm_page_unlock(ma[0]); VM_OBJECT_WUNLOCK(object); imgp->firstpage = sf_buf_alloc(ma[0], 0); Modified: head/sys/kern/uipc_shm.c == --- head/sys/kern/uipc_shm.cWed Aug 28 08:09:10 2019(r351568) +++ head/sys/kern/uipc_shm.cWed Aug 28 16:08:06 2019(r351569) @@ -188,7 +188,8 @@ uiomove_object_page(vm_object_t obj, size_t len, struc * lock to page out tobj's pages because tobj is a OBJT_SWAP * type object. */ - m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); + m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + VM_ALLOC_WIRED); if (m->valid != VM_PAGE_BITS_ALL) { vm_page_xbusy(m); if (vm_pager_has_page(obj, idx, NULL, NULL)) { @@ -198,6 +199,7 @@ uiomove_object_page(vm_object_t obj, size_t len, struc "uiomove_object: vm_obj %p idx %jd valid %x pager error %d\n", obj, idx, m->valid, rv); vm_page_lock(m); + vm_page_unwire_noq(m); vm_page_free(m); vm_page_unlock(m); VM_OBJECT_WUNLOCK(obj); @@ -207,9 +209,6 @@ uiomove_object_page(vm_object_t obj, size_t len, struc vm_page_zero_invalid(m, TRUE); vm_page_xunbusy(m); } - vm_page_lock(m); - vm_page_wire(m); - vm_page_unlock(m); VM_OBJECT_WUNLOCK(obj); error = uiomove_fromphys(, offset, tlen, uio); if (uio->uio_rw == UIO_WRITE && error == 0) { Modified: head/sys/vm/vm_glue.c == --- head/sys/vm/vm_glue.c Wed Aug 28 08:09:10 2019(r351568) +++ head/sys/vm/vm_glue.c Wed Aug 28 16:08:06 2019(r351569) @@ -230,7 +230,7 @@ vm_imgact_hold_page(vm_object_t object, vm_ooffset_t o rv = vm_pager_get_pages(object, , 1, NULL, NULL); if (rv != VM_PAGER_OK) {