svn commit: r363510 - head/sys/dev/extres/clk
Author: mmel Date: Sat Jul 25 06:32:23 2020 New Revision: 363510 URL: https://svnweb.freebsd.org/changeset/base/363510 Log: Revert r363123. As Emanuel poited me the Linux processes these clock assignments in forward order, not in reversed. I misread the original code. Tha problem with wrong order for assigned clocks found in tegra (and some imx) DT should be reanalyzed and solved by different way. MFC with: r363123 Reported by; manu Modified: head/sys/dev/extres/clk/clk.c Modified: head/sys/dev/extres/clk/clk.c == --- head/sys/dev/extres/clk/clk.c Sat Jul 25 04:13:38 2020 (r363509) +++ head/sys/dev/extres/clk/clk.c Sat Jul 25 06:32:23 2020 (r363510) @@ -1407,7 +1407,7 @@ clk_set_assigned(device_t dev, phandle_t node) if (ofw_bus_parse_xref_list_get_length(node, "assigned-clock-parents", "#clock-cells", &nparents) != 0) nparents = -1; - for (i = nclocks - 1; i >= 0; i--) { + for (i = 0; i < nclocks; i++) { /* First get the clock we are supposed to modify */ rv = clk_get_by_ofw_index_prop(dev, 0, "assigned-clocks", i, &clk); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363509 - svnadmin/conf
Author: kevans Date: Sat Jul 25 04:13:38 2020 New Revision: 363509 URL: https://svnweb.freebsd.org/changeset/base/363509 Log: Welcome Rob Wing as a src committer. Rob's done some excellent work with libbe/bectl, along with assorted other improvements in userland. As they say, no good deed goes unpunished. Mentors: kevans, allanjude Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access == --- svnadmin/conf/accessSat Jul 25 02:55:33 2020(r363508) +++ svnadmin/conf/accessSat Jul 25 04:13:38 2020(r363509) @@ -164,6 +164,7 @@ pluknet pstef ram ray +rew rgrimes rlibby rmacklem Modified: svnadmin/conf/mentors == --- svnadmin/conf/mentors Sat Jul 25 02:55:33 2020(r363508) +++ svnadmin/conf/mentors Sat Jul 25 04:13:38 2020(r363509) @@ -21,6 +21,7 @@ kadesai ken Co-mentor: scottl, ambrisko mjoras rstone nick philip Co-mentor: kp ramken Co-mentor: mav +rewkevans Co-mentor: allanjude rschefftuexen Co-mentor: rgrimes scottphscottl Co-mentor: emaste, jhb thjjtl Co-mentor: bz ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r362063 - head/sys/dev/e1000
Please merge this change to stable/12 branch until a proper fix is done. --- Yoshihiro Takahashi In article <202006111559.05bfxnsa070...@repo.freebsd.org> Eric Joyner writes: > Author: erj > Date: Thu Jun 11 15:59:49 2020 > New Revision: 362063 > URL: https://svnweb.freebsd.org/changeset/base/362063 > > Log: > em(4): Always reinit interface when adding/removing VLAN > > This partially reverts r361053 since there have been reports > by users that this breaks some functionality for em(4) > devices; it seems at first glance that some sort of interface > restart is required for those cards. > > This isn't a proper fix; this unbreaks those users until a proper > fix is found for their issues. > > PR: 240818 > Reported by:Marek Zarychta > MFC after: 3 days > > Modified: > head/sys/dev/e1000/if_em.c > > Modified: head/sys/dev/e1000/if_em.c > == > --- head/sys/dev/e1000/if_em.cThu Jun 11 15:17:13 2020 > (r362062) > +++ head/sys/dev/e1000/if_em.cThu Jun 11 15:59:49 2020 > (r362063) > @@ -4059,7 +4059,6 @@ em_if_needs_restart(if_ctx_t ctx __unused, enum iflib_ > { > switch (event) { > case IFLIB_RESTART_VLAN_CONFIG: > - return (false); > default: > return (true); > } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363506 - in stable/12/sys: fs/devfs kern
Author: mjg Date: Sat Jul 25 00:37:34 2020 New Revision: 363506 URL: https://svnweb.freebsd.org/changeset/base/363506 Log: MFC r355228: devfs: introduce a per-dev lock to protect ->si_devsw Modified: stable/12/sys/fs/devfs/devfs_devs.c stable/12/sys/fs/devfs/devfs_int.h stable/12/sys/kern/kern_conf.c stable/12/sys/kern/subr_witness.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/devfs/devfs_devs.c == --- stable/12/sys/fs/devfs/devfs_devs.c Sat Jul 25 00:24:11 2020 (r363505) +++ stable/12/sys/fs/devfs/devfs_devs.c Sat Jul 25 00:37:34 2020 (r363506) @@ -138,6 +138,8 @@ devfs_alloc(int flags) if (cdp == NULL) return (NULL); + mtx_init(&cdp->cdp_threadlock, "devthrd", NULL, MTX_DEF); + cdp->cdp_dirents = &cdp->cdp_dirent0; cdev = &cdp->cdp_c; @@ -180,6 +182,7 @@ devfs_free(struct cdev *cdev) devfs_free_cdp_inode(cdp->cdp_inode); if (cdp->cdp_maxdirent > 0) free(cdp->cdp_dirents, M_DEVFS2); + mtx_destroy(&cdp->cdp_threadlock); free(cdp, M_CDEVP); } Modified: stable/12/sys/fs/devfs/devfs_int.h == --- stable/12/sys/fs/devfs/devfs_int.h Sat Jul 25 00:24:11 2020 (r363505) +++ stable/12/sys/fs/devfs/devfs_int.h Sat Jul 25 00:37:34 2020 (r363506) @@ -70,6 +70,8 @@ struct cdev_priv { void*cdp_dtr_cb_arg; LIST_HEAD(, cdev_privdata) cdp_fdpriv; + + struct mtx cdp_threadlock; }; #definecdev2priv(c)__containerof(c, struct cdev_priv, cdp_c) Modified: stable/12/sys/kern/kern_conf.c == --- stable/12/sys/kern/kern_conf.c Sat Jul 25 00:24:11 2020 (r363505) +++ stable/12/sys/kern/kern_conf.c Sat Jul 25 00:37:34 2020 (r363506) @@ -186,16 +186,16 @@ dev_refthread(struct cdev *dev, int *ref) *ref = 0; return (dev->si_devsw); } - dev_lock(); + cdp = cdev2priv(dev); + mtx_lock(&cdp->cdp_threadlock); csw = dev->si_devsw; if (csw != NULL) { - cdp = cdev2priv(dev); if ((cdp->cdp_flags & CDP_SCHED_DTR) == 0) atomic_add_long(&dev->si_threadcount, 1); else csw = NULL; } - dev_unlock(); + mtx_unlock(&cdp->cdp_threadlock); *ref = 1; return (csw); } @@ -222,19 +222,21 @@ devvn_refthread(struct vnode *vp, struct cdev **devp, } csw = NULL; - dev_lock(); + VI_LOCK(vp); dev = vp->v_rdev; if (dev == NULL) { - dev_unlock(); + VI_UNLOCK(vp); return (NULL); } cdp = cdev2priv(dev); + mtx_lock(&cdp->cdp_threadlock); if ((cdp->cdp_flags & CDP_SCHED_DTR) == 0) { csw = dev->si_devsw; if (csw != NULL) atomic_add_long(&dev->si_threadcount, 1); } - dev_unlock(); + mtx_unlock(&cdp->cdp_threadlock); + VI_UNLOCK(vp); if (csw != NULL) { *devp = dev; *ref = 1; @@ -1132,20 +1134,26 @@ destroy_devl(struct cdev *dev) dev->si_flags &= ~SI_CLONELIST; } + mtx_lock(&cdp->cdp_threadlock); csw = dev->si_devsw; dev->si_devsw = NULL; /* already NULL for SI_ALIAS */ while (csw != NULL && csw->d_purge != NULL && dev->si_threadcount) { csw->d_purge(dev); + mtx_unlock(&cdp->cdp_threadlock); msleep(csw, &devmtx, PRIBIO, "devprg", hz/10); + mtx_lock(&cdp->cdp_threadlock); if (dev->si_threadcount) printf("Still %lu threads in %s\n", dev->si_threadcount, devtoname(dev)); } while (dev->si_threadcount != 0) { /* Use unique dummy wait ident */ + mtx_unlock(&cdp->cdp_threadlock); msleep(&csw, &devmtx, PRIBIO, "devdrn", hz / 10); + mtx_lock(&cdp->cdp_threadlock); } + mtx_unlock(&cdp->cdp_threadlock); dev_unlock(); if ((cdp->cdp_flags & CDP_UNREF_DTR) == 0) { /* avoid out of order notify events */ Modified: stable/12/sys/kern/subr_witness.c == --- stable/12/sys/kern/subr_witness.c Sat Jul 25 00:24:11 2020 (r363505) +++ stable/12/sys/kern/subr_witness.c Sat Jul 25 00:37:34 2020 (r363506) @@ -602,6 +602,7 @@ static struct witness_order_list_entry order_lists[] = { "vm map (system)", &lock_class_mtx_sleep }, { "vnode interlock
svn commit: r363505 - in stable/12: lib/libc/amd64/string sys/amd64/amd64
Author: mjg Date: Sat Jul 25 00:24:11 2020 New Revision: 363505 URL: https://svnweb.freebsd.org/changeset/base/363505 Log: MFC r357208,r357309,r357239,r357310 amd64: revamp memcmp amd64: speed up failing case for memcmp amd64: sync up libc memcmp with the kernel version (r357208) amd64: sync up libc memcmp with the kernel version (r357309) Modified: stable/12/lib/libc/amd64/string/memcmp.S stable/12/sys/amd64/amd64/support.S Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/amd64/string/memcmp.S == --- stable/12/lib/libc/amd64/string/memcmp.SSat Jul 25 00:03:23 2020 (r363504) +++ stable/12/lib/libc/amd64/string/memcmp.SSat Jul 25 00:24:11 2020 (r363505) @@ -31,91 +31,176 @@ #include __FBSDID("$FreeBSD$"); +#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ + ENTRY(memcmp) - cmpq$16,%rdx - jae 5f -1: - testq %rdx,%rdx - je 3f - xorl%ecx,%ecx -2: - movzbl (%rdi,%rcx,1),%eax - movzbl (%rsi,%rcx,1),%r8d - cmpb%r8b,%al - jne 4f - addq$1,%rcx - cmpq%rcx,%rdx - jz 3f - movzbl (%rdi,%rcx,1),%eax - movzbl (%rsi,%rcx,1),%r8d - cmpb%r8b,%al - jne 4f - addq$1,%rcx - cmpq%rcx,%rdx - jz 3f - movzbl (%rdi,%rcx,1),%eax - movzbl (%rsi,%rcx,1),%r8d - cmpb%r8b,%al - jne 4f - addq$1,%rcx - cmpq%rcx,%rdx - jz 3f - movzbl (%rdi,%rcx,1),%eax - movzbl (%rsi,%rcx,1),%r8d - cmpb%r8b,%al - jne 4f - addq$1,%rcx - cmpq%rcx,%rdx - jne 2b -3: xorl%eax,%eax +10: + cmpq$16,%rdx + ja 101632f + +100816: + cmpb$8,%dl + jl 100408f + movq(%rdi),%r8 + movq(%rsi),%r9 + cmpq%r8,%r9 + jne 80f + movq-8(%rdi,%rdx),%r8 + movq-8(%rsi,%rdx),%r9 + cmpq%r8,%r9 + jne 10081608f ret -4: +100408: + cmpb$4,%dl + jl 100204f + movl(%rdi),%r8d + movl(%rsi),%r9d + cmpl%r8d,%r9d + jne 80f + movl-4(%rdi,%rdx),%r8d + movl-4(%rsi,%rdx),%r9d + cmpl%r8d,%r9d + jne 10040804f + ret +100204: + cmpb$2,%dl + jl 11f + movzwl (%rdi),%r8d + movzwl (%rsi),%r9d + cmpl%r8d,%r9d + jne 1f + movzwl -2(%rdi,%rdx),%r8d + movzwl -2(%rsi,%rdx),%r9d + cmpl%r8d,%r9d + jne 1f + ret +11: + cmpb$1,%dl + jl 10f + movzbl (%rdi),%eax + movzbl (%rsi),%r8d subl%r8d,%eax +10: ret -5: +ALIGN_TEXT +101632: cmpq$32,%rdx - jae 7f -6: - /* -* 8 bytes -*/ + ja 103200f movq(%rdi),%r8 movq(%rsi),%r9 cmpq%r8,%r9 - jne 1b - leaq8(%rdi),%rdi - leaq8(%rsi),%rsi - subq$8,%rdx - cmpq$8,%rdx - jae 6b - jl 1b - jmp 3b -7: - /* -* 32 bytes -*/ - movq(%rsi),%r8 + jne 80f + movq8(%rdi),%r8 movq8(%rsi),%r9 - subq(%rdi),%r8 - subq8(%rdi),%r9 - or %r8,%r9 - jnz 1b + cmpq%r8,%r9 + jne 10163208f + movq-16(%rdi,%rdx),%r8 + movq-16(%rsi,%rdx),%r9 + cmpq%r8,%r9 + jne 10163216f + movq-8(%rdi,%rdx),%r8 + movq-8(%rsi,%rdx),%r9 + cmpq%r8,%r9 + jne 10163224f + ret +ALIGN_TEXT +103200: + movq(%rdi),%r8 + movq8(%rdi),%r9 + subq(%rsi),%r8 + subq8(%rsi),%r9 + orq %r8,%r9 + jnz 1032f - movq16(%rsi),%r8 - movq24(%rsi),%r9 - subq16(%rdi),%r8 - subq24(%rdi),%r9 - or %r8,%r9 - jnz 1b + movq16(%rdi),%r8 + movq24(%rdi),%r9 + subq16(%rsi),%r8 + subq24(%rsi),%r9 + orq %r8,%r9 + jnz 10320016f leaq32(%rdi),%rdi leaq32(%rsi),%rsi subq$32,%rdx cmpq$32,%rdx - jae 7b - jnz 1b - jmp 3b + jae 103200b + cmpb$0,%dl + jne 10b + ret + +/* + * Mismatch was found. + * + * Before we compute it we narrow down the range (16 -> 8 -> 4 bytes). + */ +ALIGN_TEXT +10320016: + leaq16(%rdi),%rdi + leaq16(%rsi),%rsi +1032: + movq(%rdi),%r8 + movq(%rsi),%r9 + cmpq%r8,%r9 + jne 80f + leaq8(%rdi),%rdi + leaq8(
svn commit: r363504 - stable/12/sys/kern
Author: mjg Date: Sat Jul 25 00:03:23 2020 New Revision: 363504 URL: https://svnweb.freebsd.org/changeset/base/363504 Log: MFC r363297: Short-circuit tdfind when looking for the calling thread. Modified: stable/12/sys/kern/kern_thread.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_thread.c == --- stable/12/sys/kern/kern_thread.cSat Jul 25 00:01:57 2020 (r363503) +++ stable/12/sys/kern/kern_thread.cSat Jul 25 00:03:23 2020 (r363504) @@ -1260,6 +1260,14 @@ tdfind(lwpid_t tid, pid_t pid) struct thread *td; int run = 0; + td = curthread; + if (td->td_tid == tid) { + if (pid != -1 && td->td_proc->p_pid != pid) + return (NULL); + PROC_LOCK(td->td_proc); + return (td); + } + rw_rlock(&tidhash_lock); LIST_FOREACH(td, TIDHASH(tid), td_hash) { if (td->td_tid == tid) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363503 - stable/12/sys/kern
Author: mjg Date: Sat Jul 25 00:01:57 2020 New Revision: 363503 URL: https://svnweb.freebsd.org/changeset/base/363503 Log: MFC r347503,r347505,r347510,r352177,r352178,r352183,r352612,r352617, r352631,r352810,r352811,r352812,r352813,r354893,r355124,r355125, r356880,r356883,r356915 cache: push sdt probes in cache_zap_locked to code doing the work cache: bump numcache on entry, while here fix lnumcache type cache: fix a brainfart in r347505 cache: assorted cleanups cache: change the formula for calculating lock array sizes cache: avoid excessive relocking on entry removal during lookup cache: jump in negative success instead of positive cache: count evictions of negatve entries cache: tidy up handling of negative entries cache: stop recalculating upper limit each time a new entry is added cache: make negative list shrinking a little bit concurrent cache: stop requeuing negative entries on the hot list cache: decrease ncnegfactor to 5 cache: minor stat cleanup cache: fix numcache accounting on entry cache: stop reusing .. entries on enter cache: convert numcachehv to counter(9) on 64-bit platforms cache: counter_u64_add_protected -> counter_u64_add cache: make numcachehv use counter(9) on all archs Modified: stable/12/sys/kern/vfs_cache.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_cache.c == --- stable/12/sys/kern/vfs_cache.c Fri Jul 24 23:51:08 2020 (r363502) +++ stable/12/sys/kern/vfs_cache.c Sat Jul 25 00:01:57 2020 (r363503) @@ -91,10 +91,10 @@ SDT_PROBE_DEFINE1(vfs, namecache, purge_negative, done SDT_PROBE_DEFINE1(vfs, namecache, purgevfs, done, "struct mount *"); SDT_PROBE_DEFINE3(vfs, namecache, zap, done, "struct vnode *", "char *", "struct vnode *"); -SDT_PROBE_DEFINE3(vfs, namecache, zap_negative, done, "struct vnode *", -"char *", "int"); -SDT_PROBE_DEFINE3(vfs, namecache, shrink_negative, done, "struct vnode *", -"char *", "int"); +SDT_PROBE_DEFINE2(vfs, namecache, zap_negative, done, "struct vnode *", +"char *"); +SDT_PROBE_DEFINE2(vfs, namecache, shrink_negative, done, "struct vnode *", +"char *"); /* * This structure describes the elements in the cache of recent @@ -108,7 +108,6 @@ struct namecache { struct vnode *nc_dvp; /* vnode of parent of name */ union { struct vnode *nu_vp; /* vnode the name refers to */ - u_int nu_neghits; /* negative entry hits */ } n_un; u_char nc_flag;/* flag bits */ u_char nc_nlen;/* length of name */ @@ -131,7 +130,6 @@ struct namecache_ts { }; #definenc_vp n_un.nu_vp -#definenc_neghits n_un.nu_neghits /* * Flags in namecache.nc_flag @@ -201,31 +199,22 @@ static __read_mostly LIST_HEAD(nchashhead, namecache) static u_long __read_mostlynchash; /* size of hash table */ SYSCTL_ULONG(_debug, OID_AUTO, nchash, CTLFLAG_RD, &nchash, 0, "Size of namecache hash table"); -static u_long __read_mostlyncnegfactor = 12; /* ratio of negative entries */ +static u_long __read_mostlyncnegfactor = 5; /* ratio of negative entries */ SYSCTL_ULONG(_vfs, OID_AUTO, ncnegfactor, CTLFLAG_RW, &ncnegfactor, 0, "Ratio of negative namecache entries"); static u_long __exclusive_cache_line numneg; /* number of negative entries allocated */ -SYSCTL_ULONG(_debug, OID_AUTO, numneg, CTLFLAG_RD, &numneg, 0, -"Number of negative entries in namecache"); static u_long __exclusive_cache_line numcache;/* number of cache entries allocated */ -SYSCTL_ULONG(_debug, OID_AUTO, numcache, CTLFLAG_RD, &numcache, 0, -"Number of namecache entries"); -static u_long __exclusive_cache_line numcachehv;/* number of cache entries with vnodes held */ -SYSCTL_ULONG(_debug, OID_AUTO, numcachehv, CTLFLAG_RD, &numcachehv, 0, -"Number of namecache entries with vnodes held"); -u_int __read_mostlyncsizefactor = 2; +u_int ncsizefactor = 2; SYSCTL_UINT(_vfs, OID_AUTO, ncsizefactor, CTLFLAG_RW, &ncsizefactor, 0, "Size factor for namecache"); static u_int __read_mostly ncpurgeminvnodes; SYSCTL_UINT(_vfs, OID_AUTO, ncpurgeminvnodes, CTLFLAG_RW, &ncpurgeminvnodes, 0, "Number of vnodes below which purgevfs ignores the request"); -static u_int __read_mostly ncneghitsrequeue = 8; -SYSCTL_UINT(_vfs, OID_AUTO, ncneghitsrequeue, CTLFLAG_RW, &ncneghitsrequeue, 0, -"Number of hits to requeue a negative entry in the LRU list"); +static u_int __read_mostly ncsize; /* the size as computed on creation or resizing */ struct nchstatsnchstats; /* cache effectiveness statistics */ -static struct mtx ncneg_shrink_lock; +static struct mtx __exclusive
svn commit: r363501 - in stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys
Author: mjg Date: Fri Jul 24 23:45:42 2020 New Revision: 363501 URL: https://svnweb.freebsd.org/changeset/base/363501 Log: MFC r357282: zfs: fix spurious lock contention during path lookup Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h == --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h Fri Jul 24 23:44:35 2020(r363500) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h Fri Jul 24 23:45:42 2020(r363501) @@ -214,7 +214,10 @@ void zfs_oldace_byteswap(ace_t *, int); void zfs_ace_byteswap(void *, size_t, boolean_t); extern boolean_t zfs_has_access(struct znode *zp, cred_t *cr); extern int zfs_zaccess(struct znode *, int, int, boolean_t, cred_t *); +#ifdef illumos int zfs_fastaccesschk_execute(struct znode *, cred_t *); +#endif +int zfs_freebsd_fastaccesschk_execute(struct vnode *, cred_t *); extern int zfs_zaccess_rwx(struct znode *, mode_t, int, cred_t *); extern int zfs_zaccess_unix(struct znode *, mode_t, cred_t *); extern int zfs_acl_access(struct znode *, int, cred_t *); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c == --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Jul 24 23:44:35 2020(r363500) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Jul 24 23:45:42 2020(r363501) @@ -2299,7 +2299,41 @@ zfs_zaccess_append(znode_t *zp, uint32_t *working_mode check_privs, B_FALSE, cr)); } +/* + * Check if VEXEC is allowed. + * + * This routine is based on zfs_fastaccesschk_execute which has slowpath + * calling zfs_zaccess. This would be incorrect on FreeBSD (see + * zfs_freebsd_access for the difference). Thus this variant let's the + * caller handle the slowpath (if necessary). + * + * We only check for ZFS_NO_EXECS_DENIED and fail early. This routine can + * be extended to cover more cases, but the flag covers the majority. + */ int +zfs_freebsd_fastaccesschk_execute(struct vnode *vp, cred_t *cr) +{ + boolean_t is_attr; + znode_t *zdp = VTOZ(vp); + + ASSERT_VOP_LOCKED(vp, __func__); + + if (zdp->z_pflags & ZFS_AV_QUARANTINED) + return (1); + + is_attr = ((zdp->z_pflags & ZFS_XATTR) && + (ZTOV(zdp)->v_type == VDIR)); + if (is_attr) + return (1); + + if (zdp->z_pflags & ZFS_NO_EXECS_DENIED) + return (0); + + return (1); +} + +#ifdef illumos +int zfs_fastaccesschk_execute(znode_t *zdp, cred_t *cr) { boolean_t owner = B_FALSE; @@ -2365,6 +2399,7 @@ slow: ZFS_EXIT(zdp->z_zfsvfs); return (error); } +#endif /* * Determine whether Access should be granted/denied. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c == --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Jul 24 23:44:35 2020(r363500) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Jul 24 23:45:42 2020(r363501) @@ -4915,6 +4915,11 @@ zfs_freebsd_access(ap) accmode_t accmode; int error = 0; + if (ap->a_accmode == VEXEC) { + if (zfs_freebsd_fastaccesschk_execute(ap->a_vp, ap->a_cred) == 0) + return (0); + } + /* * ZFS itself only knowns about VREAD, VWRITE, VEXEC and VAPPEND, */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363500 - stable/12/sys/amd64/amd64
Author: mjg Date: Fri Jul 24 23:44:35 2020 New Revision: 363500 URL: https://svnweb.freebsd.org/changeset/base/363500 Log: MFC r352874: amd64 pmap: batch chunk removal in pmap_remove_pages Modified: stable/12/sys/amd64/amd64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c == --- stable/12/sys/amd64/amd64/pmap.cFri Jul 24 23:17:09 2020 (r363499) +++ stable/12/sys/amd64/amd64/pmap.cFri Jul 24 23:44:35 2020 (r363500) @@ -,7 +,10 @@ static caddr_t crashdumpmap; #defineMAPDEV_SETATTR 0x0002 /* Modify existing attrs. */ #defineMAPDEV_ASSERTVALID 0x0004 /* Assert mapping validity. */ +TAILQ_HEAD(pv_chunklist, pv_chunk); + static voidfree_pv_chunk(struct pv_chunk *pc); +static voidfree_pv_chunk_batch(struct pv_chunklist *batch); static voidfree_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t pmap, struct rwlock **lockp); static int popcnt_pc_map_pq(uint64_t *map); @@ -4313,13 +4316,10 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv) } static void -free_pv_chunk(struct pv_chunk *pc) +free_pv_chunk_dequeued(struct pv_chunk *pc) { vm_page_t m; - mtx_lock(&pv_chunks_mutex); - TAILQ_REMOVE(&pv_chunks, pc, pc_lru); - mtx_unlock(&pv_chunks_mutex); PV_STAT(atomic_subtract_int(&pv_entry_spare, _NPCPV)); PV_STAT(atomic_subtract_int(&pc_chunk_count, 1)); PV_STAT(atomic_add_int(&pc_chunk_frees, 1)); @@ -4330,6 +4330,35 @@ free_pv_chunk(struct pv_chunk *pc) vm_page_free(m); } +static void +free_pv_chunk(struct pv_chunk *pc) +{ + + mtx_lock(&pv_chunks_mutex); + TAILQ_REMOVE(&pv_chunks, pc, pc_lru); + mtx_unlock(&pv_chunks_mutex); + free_pv_chunk_dequeued(pc); +} + +static void +free_pv_chunk_batch(struct pv_chunklist *batch) +{ + struct pv_chunk *pc, *npc; + + if (TAILQ_EMPTY(batch)) + return; + + mtx_lock(&pv_chunks_mutex); + TAILQ_FOREACH(pc, batch, pc_list) { + TAILQ_REMOVE(&pv_chunks, pc, pc_lru); + } + mtx_unlock(&pv_chunks_mutex); + + TAILQ_FOREACH_SAFE(pc, batch, pc_list, npc) { + free_pv_chunk_dequeued(pc); + } +} + /* * Returns a new PV entry, allocating a new PV chunk from the system when * needed. If this PV chunk allocation fails and a PV list lock pointer was @@ -6946,6 +6975,7 @@ pmap_remove_pages(pmap_t pmap) pt_entry_t *pte, tpte; pt_entry_t PG_M, PG_RW, PG_V; struct spglist free; + struct pv_chunklist free_chunks; vm_page_t m, mpte, mt; pv_entry_t pv; struct md_page *pvh; @@ -6981,6 +7011,7 @@ pmap_remove_pages(pmap_t pmap) PG_V = pmap_valid_bit(pmap); PG_RW = pmap_rw_bit(pmap); + TAILQ_INIT(&free_chunks); SLIST_INIT(&free); PMAP_LOCK(pmap); TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) { @@ -7108,13 +7139,14 @@ pmap_remove_pages(pmap_t pmap) PV_STAT(atomic_subtract_long(&pv_entry_count, freed)); if (allfree) { TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - free_pv_chunk(pc); + TAILQ_INSERT_TAIL(&free_chunks, pc, pc_list); } } if (lock != NULL) rw_wunlock(lock); pmap_invalidate_all(pmap); pmap_pkru_deassign_all(pmap); + free_pv_chunk_batch(&free_chunks); PMAP_UNLOCK(pmap); vm_page_free_pages_toq(&free, true); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363499 - in head/sys/fs: nfs nfsclient
Author: rmacklem Date: Fri Jul 24 23:17:09 2020 New Revision: 363499 URL: https://svnweb.freebsd.org/changeset/base/363499 Log: Add support for ext_pgs mbufs to nfsm_uiombuflist() and nfsm_split(). This patch uses a slightly different algorithm for nfsm_uiombuflist() for the non-ext_pgs case, where a variable called "mcp" is maintained, pointing to the current location that mbuf data can be filled into. This avoids use of mtod(mp, char *) + mp->m_len to calculate the location, since this does not work for ext_pgs mbufs and I think it makes the algorithm more readable. This change should not result in semantic changes for the non-ext_pgs case. The patch also deletes come unneeded code. It also adds support for anonymous page ext_pgs mbufs to nfsm_split(). This is another in the series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. At this time for this case, use of ext_pgs mbufs cannot be enabled, since ktls_encrypt() replaces the unencrypted data with encrypted data in place. Until such time as this can be enabled, there should be no semantic change. Also, note that this code is only used by the NFS client for a mirrored pNFS server. Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsclient/nfs_clcomsubs.c head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfs/nfs_var.h == --- head/sys/fs/nfs/nfs_var.h Fri Jul 24 23:15:42 2020(r363498) +++ head/sys/fs/nfs/nfs_var.h Fri Jul 24 23:17:09 2020(r363499) @@ -365,7 +365,7 @@ struct mbuf *nfsm_add_ext_pgs(struct mbuf *, int, int /* nfs_clcomsubs.c */ void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int); -struct mbuf *nfsm_uiombuflist(struct uio *, int, struct mbuf **, char **); +struct mbuf *nfsm_uiombuflist(struct uio *, int, u_int); nfsuint64 *nfscl_getcookie(struct nfsnode *, off_t off, int); u_int8_t *nfscl_getmyip(struct nfsmount *, struct in6_addr *, int *); int nfsm_getfh(struct nfsrv_descript *, struct nfsfh **); Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c == --- head/sys/fs/nfsclient/nfs_clcomsubs.c Fri Jul 24 23:15:42 2020 (r363498) +++ head/sys/fs/nfsclient/nfs_clcomsubs.c Fri Jul 24 23:17:09 2020 (r363499) @@ -160,26 +160,33 @@ nfsm_uiombuf(struct nfsrv_descript *nd, struct uio *ui * NOTE: can ony handle iovcnt == 1 */ struct mbuf * -nfsm_uiombuflist(struct uio *uiop, int siz, struct mbuf **mbp, char **cpp) +nfsm_uiombuflist(struct uio *uiop, int siz, u_int maxext) { char *uiocp; struct mbuf *mp, *mp2, *firstmp; - int i, left, mlen, rem, xfer; + int extpg, extpgsiz = 0, i, left, mlen, rem, xfer; int uiosiz, clflg; char *mcp, *tcp; KASSERT(uiop->uio_iovcnt == 1, ("nfsm_uiotombuf: iovcnt != 1")); - if (siz > ncl_mbuf_mlen)/* or should it >= MCLBYTES ?? */ - clflg = 1; - else - clflg = 0; - if (clflg != 0) - NFSMCLGET(mp, M_WAITOK); - else - NFSMGET(mp); + if (maxext > 0) { + mp = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK); + mcp = (char *)(void *)PHYS_TO_DMAP(mp->m_epg_pa[0]); + extpg = 0; + extpgsiz = PAGE_SIZE; + } else { + if (siz > ncl_mbuf_mlen) /* or should it >= MCLBYTES ?? */ + clflg = 1; + else + clflg = 0; + if (clflg != 0) + NFSMCLGET(mp, M_WAITOK); + else + NFSMGET(mp); + mcp = mtod(mp, char *); + } mp->m_len = 0; - mcp = mtod(mp, char *); firstmp = mp2 = mp; rem = NFSM_RNDUP(siz) - siz; while (siz > 0) { @@ -189,17 +196,28 @@ nfsm_uiombuflist(struct uio *uiop, int siz, struct mbu left = siz; uiosiz = left; while (left > 0) { - mlen = M_TRAILINGSPACE(mp); - if (mlen == 0) { - if (clflg) - NFSMCLGET(mp, M_WAITOK); - else - NFSMGET(mp); - mp->m_len = 0; - mcp = mtod(mp, char *); - mp2->m_next = mp; - mp2 = mp; + if (maxext > 0) + mlen = extpgsiz; + else mlen = M_TRAILINGSPACE(mp); +
svn commit: r363498 - in head/sys/dev/cxgbe: common cudbg
Author: np Date: Fri Jul 24 23:15:42 2020 New Revision: 363498 URL: https://svnweb.freebsd.org/changeset/base/363498 Log: cxgbe(4): Some updates to the common code. Obtained from:Chelsio Communications MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/common/t4_hw.h head/sys/dev/cxgbe/cudbg/cudbg_lib.c Modified: head/sys/dev/cxgbe/common/common.h == --- head/sys/dev/cxgbe/common/common.h Fri Jul 24 21:14:59 2020 (r363497) +++ head/sys/dev/cxgbe/common/common.h Fri Jul 24 23:15:42 2020 (r363498) @@ -299,6 +299,7 @@ struct chip_params { u16 vfcount; u32 sge_fl_db; u16 mps_tcam_size; + u16 rss_nentries; }; /* VF-only parameters. */ @@ -377,6 +378,7 @@ struct adapter_params { unsigned int hash_filter:1; unsigned int filter2_wr_support:1; unsigned int port_caps32:1; + unsigned int smac_add_support:1; unsigned int ofldq_wr_cred; unsigned int eo_wr_cred; @@ -783,8 +785,27 @@ int t4_set_rxmode(struct adapter *adap, unsigned int m int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, unsigned int viid, bool free, unsigned int naddr, const u8 **addr, u16 *idx, u64 *hash, bool sleep_ok); +int t4_free_mac_filt(struct adapter *adap, unsigned int mbox, + unsigned int viid, unsigned int naddr, + const u8 **addr, bool sleep_ok); +int t4_free_encap_mac_filt(struct adapter *adap, unsigned int viid, + int idx, bool sleep_ok); +int t4_free_raw_mac_filt(struct adapter *adap, unsigned int viid, +const u8 *addr, const u8 *mask, unsigned int idx, +u8 lookup_type, u8 port_id, bool sleep_ok); +int t4_alloc_raw_mac_filt(struct adapter *adap, unsigned int viid, + const u8 *addr, const u8 *mask, unsigned int idx, + u8 lookup_type, u8 port_id, bool sleep_ok); +int t4_alloc_encap_mac_filt(struct adapter *adap, unsigned int viid, + const u8 *addr, const u8 *mask, unsigned int vni, + unsigned int vni_mask, u8 dip_hit, u8 lookup_type, + bool sleep_ok); int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, int idx, const u8 *addr, bool persist, uint16_t *smt_idx); +int t4_del_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, + const u8 *addr, bool smac); +int t4_add_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, + int idx, const u8 *addr, bool persist, u8 *smt_idx, bool smac); int t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid, bool ucast, u64 vec, bool sleep_ok); int t4_enable_vi_params(struct adapter *adap, unsigned int mbox, @@ -797,6 +818,10 @@ int t4_mdio_rd(struct adapter *adap, unsigned int mbox unsigned int mmd, unsigned int reg, unsigned int *valp); int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, unsigned int mmd, unsigned int reg, unsigned int val); +int t4_i2c_io(struct adapter *adap, unsigned int mbox, + int port, unsigned int devid, + unsigned int offset, unsigned int len, + u8 *buf, bool write); int t4_i2c_rd(struct adapter *adap, unsigned int mbox, int port, unsigned int devid, unsigned int offset, unsigned int len, @@ -821,7 +846,7 @@ int t4_sge_ctxt_rd(struct adapter *adap, unsigned int enum ctxt_type ctype, u32 *data); int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type ctype, u32 *data); -int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox); +int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox, int ctxt_type); const char *t4_link_down_rc_str(unsigned char link_down_rc); int t4_update_port_info(struct port_info *pi); int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl); @@ -854,6 +879,10 @@ void t4_tp_tm_pio_read(struct adapter *adap, u32 *buff u32 start_index, bool sleep_ok); void t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs, u32 start_index, bool sleep_ok); +int t4_configure_ringbb(struct adapter *adap); +int t4_configure_add_smac(struct adapter *adap); +int t4_set_vlan_acl(struct adapter *adap, unsigned int mbox, unsigned int vf, + u16 vlan); static inline int t4vf_query_params(struct adapter *adapter, unsigned int nparams, const u32 *params, Modified: head/sys/dev/cxgbe/common/t4_hw.c ==
Re: svn commit: r363497 - head/sbin/camcontrol
Thanks, this will become very handy when working on IO infrastructure. --Gordon On Fri, Jul 24, 2020 at 09:14:59PM +, Ilya Bakulin wrote: > Author: kibab > Date: Fri Jul 24 21:14:59 2020 > New Revision: 363497 > URL: https://svnweb.freebsd.org/changeset/base/363497 > > Log: > Make it possible to get/set MMC frequency from camcontrol > > Enhance camcontrol(8) so that it's possible to manually set frequency for > SD/MMC cards. > While here, display more information about the current controller, such as > supported operating modes and VCCQ voltages, as well as current VCCQ > voltage. > > Reviewed by:manu > Approved by:imp (mentor) > Differential Revision: https://reviews.freebsd.org/D25795 > > Modified: > head/sbin/camcontrol/camcontrol.c > > Modified: head/sbin/camcontrol/camcontrol.c > == > --- head/sbin/camcontrol/camcontrol.c Fri Jul 24 20:54:07 2020 > (r363496) > +++ head/sbin/camcontrol/camcontrol.c Fri Jul 24 21:14:59 2020 > (r363497) > @@ -190,7 +190,7 @@ static struct camcontrol_opts option_table[] = { > {"rescan", CAM_CMD_RESCAN, CAM_ARG_NONE, NULL}, > {"reset", CAM_CMD_RESET, CAM_ARG_NONE, NULL}, > {"cmd", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, > - {"mmcsdcmd", CAM_CMD_MMCSD_CMD, CAM_ARG_NONE, "c:a:f:Wb:l:41S:I"}, > + {"mmcsdcmd", CAM_CMD_MMCSD_CMD, CAM_ARG_NONE, "c:a:F:f:Wb:l:41S:I"}, > {"command", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, > {"smpcmd", CAM_CMD_SMP_CMD, CAM_ARG_NONE, "r:R:"}, > {"smprg", CAM_CMD_SMP_RG, CAM_ARG_NONE, smprg_opts}, > @@ -7833,10 +7833,12 @@ mmcsdcmd(struct cam_device *device, int argc, char **a > int retval; > int is_write = 0; > int is_bw_4 = 0, is_bw_1 = 0; > + int is_frequency = 0; > int is_highspeed = 0, is_stdspeed = 0; > int is_info_request = 0; > int flags = 0; > uint8_t mmc_data_byte = 0; > + uint32_t mmc_frequency = 0; > > /* For IO_RW_EXTENDED command */ > uint8_t *mmc_data = NULL; > @@ -7873,6 +7875,10 @@ mmcsdcmd(struct cam_device *device, int argc, char **a > case 'I': > is_info_request = 1; > break; > + case 'F': > + is_frequency = 1; > + mmc_frequency = strtol(optarg, NULL, 0); > + break; > case 'c': > mmc_opcode = strtol(optarg, NULL, 0); > if (mmc_opcode < 0) { > @@ -7978,6 +7984,23 @@ mmcsdcmd(struct cam_device *device, int argc, char **a > return (retval); > } > > + if (is_frequency) { > + struct ccb_trans_settings_mmc *cts; > + ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; > + ccb->ccb_h.flags = 0; > + cts = &ccb->cts.proto_specific.mmc; > + cts->ios.clock = mmc_frequency; > + cts->ios_valid = MMC_CLK; > + if (((retval = cam_send_ccb(device, ccb)) < 0) > + || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { > + warn("Error sending command"); > + } else { > + printf("Parameters set OK\n"); > + } > + cam_freeccb(ccb); > + return (retval); > + } > + > // Switch bus speed instead of sending IO command > if (is_stdspeed || is_highspeed) { > struct ccb_trans_settings_mmc *cts; > @@ -8011,13 +8034,48 @@ mmcsdcmd(struct cam_device *device, int argc, char **a > printf("Host OCR: 0x%x\n", cts->host_ocr); > printf("Min frequency: %u KHz\n", cts->host_f_min / 1000); > printf("Max frequency: %u MHz\n", cts->host_f_max / 100); > - printf("Supported bus width: "); > + printf("Supported bus width:\n"); > if (cts->host_caps & MMC_CAP_4_BIT_DATA) > printf(" 4 bit\n"); > if (cts->host_caps & MMC_CAP_8_BIT_DATA) > printf(" 8 bit\n"); > - printf("\nCurrent settings:\n"); > - printf("Bus width: "); > + > + printf("Supported operating modes:\n"); > + if (cts->host_caps & MMC_CAP_HSPEED) > + printf(" Can do High Speed transfers\n"); > + if (cts->host_caps & MMC_CAP_UHS_SDR12) > + printf(" Can do UHS SDR12\n"); > + if (cts->host_caps & MMC_CAP_UHS_SDR25) > + printf(" Can do UHS SDR25\n"); > + if (cts->host_caps & MMC_CAP_UHS_SDR50) > + printf(" Can do UHS SDR50\n"); > + if (cts->host_caps & MMC_CAP_UHS_SDR104) > + printf(" Can do UHS SDR104\n"); > + if (cts->host_caps & MMC_CAP_UHS_DDR50) > + printf(" Can do UHS D
svn commit: r363497 - head/sbin/camcontrol
Author: kibab Date: Fri Jul 24 21:14:59 2020 New Revision: 363497 URL: https://svnweb.freebsd.org/changeset/base/363497 Log: Make it possible to get/set MMC frequency from camcontrol Enhance camcontrol(8) so that it's possible to manually set frequency for SD/MMC cards. While here, display more information about the current controller, such as supported operating modes and VCCQ voltages, as well as current VCCQ voltage. Reviewed by: manu Approved by: imp (mentor) Differential Revision:https://reviews.freebsd.org/D25795 Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c == --- head/sbin/camcontrol/camcontrol.c Fri Jul 24 20:54:07 2020 (r363496) +++ head/sbin/camcontrol/camcontrol.c Fri Jul 24 21:14:59 2020 (r363497) @@ -190,7 +190,7 @@ static struct camcontrol_opts option_table[] = { {"rescan", CAM_CMD_RESCAN, CAM_ARG_NONE, NULL}, {"reset", CAM_CMD_RESET, CAM_ARG_NONE, NULL}, {"cmd", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, - {"mmcsdcmd", CAM_CMD_MMCSD_CMD, CAM_ARG_NONE, "c:a:f:Wb:l:41S:I"}, + {"mmcsdcmd", CAM_CMD_MMCSD_CMD, CAM_ARG_NONE, "c:a:F:f:Wb:l:41S:I"}, {"command", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, {"smpcmd", CAM_CMD_SMP_CMD, CAM_ARG_NONE, "r:R:"}, {"smprg", CAM_CMD_SMP_RG, CAM_ARG_NONE, smprg_opts}, @@ -7833,10 +7833,12 @@ mmcsdcmd(struct cam_device *device, int argc, char **a int retval; int is_write = 0; int is_bw_4 = 0, is_bw_1 = 0; + int is_frequency = 0; int is_highspeed = 0, is_stdspeed = 0; int is_info_request = 0; int flags = 0; uint8_t mmc_data_byte = 0; + uint32_t mmc_frequency = 0; /* For IO_RW_EXTENDED command */ uint8_t *mmc_data = NULL; @@ -7873,6 +7875,10 @@ mmcsdcmd(struct cam_device *device, int argc, char **a case 'I': is_info_request = 1; break; + case 'F': + is_frequency = 1; + mmc_frequency = strtol(optarg, NULL, 0); + break; case 'c': mmc_opcode = strtol(optarg, NULL, 0); if (mmc_opcode < 0) { @@ -7978,6 +7984,23 @@ mmcsdcmd(struct cam_device *device, int argc, char **a return (retval); } + if (is_frequency) { + struct ccb_trans_settings_mmc *cts; + ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; + ccb->ccb_h.flags = 0; + cts = &ccb->cts.proto_specific.mmc; + cts->ios.clock = mmc_frequency; + cts->ios_valid = MMC_CLK; + if (((retval = cam_send_ccb(device, ccb)) < 0) + || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { + warn("Error sending command"); + } else { + printf("Parameters set OK\n"); + } + cam_freeccb(ccb); + return (retval); + } + // Switch bus speed instead of sending IO command if (is_stdspeed || is_highspeed) { struct ccb_trans_settings_mmc *cts; @@ -8011,13 +8034,48 @@ mmcsdcmd(struct cam_device *device, int argc, char **a printf("Host OCR: 0x%x\n", cts->host_ocr); printf("Min frequency: %u KHz\n", cts->host_f_min / 1000); printf("Max frequency: %u MHz\n", cts->host_f_max / 100); - printf("Supported bus width: "); + printf("Supported bus width:\n"); if (cts->host_caps & MMC_CAP_4_BIT_DATA) printf(" 4 bit\n"); if (cts->host_caps & MMC_CAP_8_BIT_DATA) printf(" 8 bit\n"); - printf("\nCurrent settings:\n"); - printf("Bus width: "); + + printf("Supported operating modes:\n"); + if (cts->host_caps & MMC_CAP_HSPEED) + printf(" Can do High Speed transfers\n"); + if (cts->host_caps & MMC_CAP_UHS_SDR12) + printf(" Can do UHS SDR12\n"); + if (cts->host_caps & MMC_CAP_UHS_SDR25) + printf(" Can do UHS SDR25\n"); + if (cts->host_caps & MMC_CAP_UHS_SDR50) + printf(" Can do UHS SDR50\n"); + if (cts->host_caps & MMC_CAP_UHS_SDR104) + printf(" Can do UHS SDR104\n"); + if (cts->host_caps & MMC_CAP_UHS_DDR50) + printf(" Can do UHS DDR50\n"); + if (cts->host_caps & MMC_CAP_MMC_DDR52_120) + printf(" Can do eMMC DDR52 at 1.2V\n"); + if (cts->host_caps & MMC_CAP_MMC_DDR52_180) + printf
Re: svn commit: r363489 - head/sys/dev/mmc/host
On 24 Jul 2020, at 19:52, Emmanuel Vadot wrote: > Author: manu > Date: Fri Jul 24 19:52:52 2020 > New Revision: 363489 > URL: https://svnweb.freebsd.org/changeset/base/363489 > > Log: > dwmmc: Add MMCCAM part > > Add support for MMCCAM for dwmmc > > Submitted by: kibab > Tested On: Rock64, RockPro64 And nanopc-t4. Thank you both for all the work!!! ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363496 - in stable/11: . contrib/llvm-project contrib/llvm-project/clang/include/clang/AST contrib/llvm-project/clang/include/clang/Basic contrib/llvm-project/clang/include/clang/Drive...
Author: dim Date: Fri Jul 24 20:54:07 2020 New Revision: 363496 URL: https://svnweb.freebsd.org/changeset/base/363496 Log: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp 10.0.1 final (aka llvmorg-10.0.1-0-gef32c611aa2). MFC r360702: Merge commit 4ca2cad94 from llvm git (by Justin Hibbits): [PowerPC] Add clang -msvr4-struct-return for 32-bit ELF Summary: Change the default ABI to be compatible with GCC. For 32-bit ELF targets other than Linux, Clang now returns small structs in registers r3/r4. This affects FreeBSD, NetBSD, OpenBSD. There is no change for 32-bit Linux, where Clang continues to return all structs in memory. Add clang options -maix-struct-return (to return structs in memory) and -msvr4-struct-return (to return structs in registers) to be compatible with gcc. These options are only for PPC32; reject them on PPC64 and other targets. The options are like -fpcc-struct-return and -freg-struct-return for X86_32, and use similar code. To actually return a struct in registers, coerce it to an integer of the same size. LLVM may optimize the code to remove unnecessary accesses to memory, and will return i32 in r3 or i64 in r3:r4. Fixes PR#40736 Patch by George Koehler! Reviewed By: jhibbits, nemanjai Differential Revision: https://reviews.llvm.org/D73290 Requested by: jhibbits MFC r361410: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp llvmorg-10.0.1-rc1-0-gf79cd71e145 (aka 10.0.1 rc1). MFC r362235 (by kp): llvm: Default to -mno-relax on RISC-V Compiling on a RISC-V system fails with 'relocation R_RISCV_ALIGN requires unimplemented linker relaxation; recompile with -mno-relax'. Our default linker (ld.lld) doesn't support relaxation, so default to no-relax so we don't generate object files the linker can't handle. Reviewed by: mhorne Sponsored by: Axiado Differential Revision:https://reviews.freebsd.org/D25210 MFC r362445: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp llvmorg-10.0.0-97-g6f71678ecd2 (not quite 10.0.1 rc2, as more fixes are still pending). MFC r362587 (by cem): Add WITH_CLANG_FORMAT option clang-format is enabled conditional on either WITH_CLANG_EXTRAS or WITH_CLANG_FORMAT. Some sources in libclang are build conditional on either rule, and obviously the clang-format binary itself depends on the rule. clang-format could still use a manual page. Reviewed by: emaste Differential Revision:https://reviews.freebsd.org/D25427 MFC r362609: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp llvmorg-10.0.0-129-gd24d5c8e308. Getting closer to 10.0.1-rc2. MFC r362679: Regenerate ReStructuredText based manpages for llvm-project tools: * bugpoint.1 * clang.1 * llc.1 * lldb.1 * lli.1 * llvm-ar.1 * llvm-as.1 * llvm-bcanalyzer.1 * llvm-cov.1 * llvm-diff.1 * llvm-dis.1 * llvm-dwarfdump.1 * llvm-extract.1 * llvm-link.1 * llvm-mca.1 * llvm-nm.1 * llvm-pdbutil.1 * llvm-profdata.1 * llvm-symbolizer.1 * llvm-tblgen.1 * opt.1 Add newly generated manpages for: * llvm-addr2line.1 (this is an alias of llvm-symbolizer) * llvm-cxxfilt.1 * llvm-objcopy.1 * llvm-ranlib.1 (this is an alias of llvm-ar) Note that llvm-objdump.1 is an exception, as upstream has both a plain .1 file, and a .rst variant. These will have to be reconciled upstream first. MFC r362680: Follow-up to r362679, add more entries to OptionalObsoleteFiles.inc MFC r362719: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp llvmorg-10.0.1-rc2-0-g77d76b71d7d. Also add a few more llvm utilities under WITH_CLANG_EXTRAS: * llvm-dwp, a utility for merging DWARF 5 Split DWARF .dwo files into .dwp (DWARF package files) * llvm-size, a size(1) replacement * llvm-strings, a strings(1) replacement MFC r362733: Remove older llvm-ranlib.1 entry from ObsoleteFiles.inc, as it has gotten its own manpage now, and should be no longer be removed by "make delete-old". MFC r362734: Fix llvm-strings.1 not installing, this was a copy/paste error. MFC r363401: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp 10.0.1 final (aka llvmorg-10.0.1-0-gef32c611aa2). There were no changes since rc2, except in the upstream regression tests, which we do not ship. Relnotes: yes Added: stable/11/contrib/llvm-project/compiler-rt/lib/builtins/riscv/int_mul_impl.inc - copied unchanged from r362719, head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/int_mul_impl.inc stable/11/contrib/llvm-project/compiler-rt/lib/builtins/riscv/muldi3.S - copied unchanged from r362719, head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/mul
svn commit: r363495 - in head/sys/x86: include x86
Author: mav Date: Fri Jul 24 20:52:09 2020 New Revision: 363495 URL: https://svnweb.freebsd.org/changeset/base/363495 Log: Introduce ipi_self_from_nmi(). It allows safe IPI sending to current CPU from NMI context. Unlike other ipi_*() functions this waits for delivery to leave LAPIC in a state safe for interrupted code. MFC after:2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/x86/include/x86_smp.h head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/include/x86_smp.h == --- head/sys/x86/include/x86_smp.h Fri Jul 24 20:48:06 2020 (r363494) +++ head/sys/x86/include/x86_smp.h Fri Jul 24 20:52:09 2020 (r363495) @@ -97,6 +97,7 @@ void ipi_bitmap_handler(struct trapframe frame); void ipi_cpu(int cpu, u_int ipi); intipi_nmi_handler(void); void ipi_selected(cpuset_t cpus, u_int ipi); +void ipi_self_from_nmi(u_int vector); void set_interrupt_apic_ids(void); void smp_cache_flush(smp_invl_cb_t curcpu_cb); void smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, struct pmap *pmap, Modified: head/sys/x86/x86/mp_x86.c == --- head/sys/x86/x86/mp_x86.c Fri Jul 24 20:48:06 2020(r363494) +++ head/sys/x86/x86/mp_x86.c Fri Jul 24 20:52:09 2020(r363495) @@ -1398,6 +1398,21 @@ ipi_all_but_self(u_int ipi) lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS); } +void +ipi_self_from_nmi(u_int vector) +{ + + lapic_ipi_vectored(vector, APIC_IPI_DEST_SELF); + + /* Wait for IPI to finish. */ + if (!lapic_ipi_wait(5)) { + if (KERNEL_PANICKED()) + return; + else + panic("APIC: IPI is stuck"); + } +} + int ipi_nmi_handler(void) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363494 - in stable/12: . contrib/llvm-project contrib/llvm-project/clang/include/clang/AST contrib/llvm-project/clang/include/clang/Basic contrib/llvm-project/clang/include/clang/Drive...
Author: dim Date: Fri Jul 24 20:48:06 2020 New Revision: 363494 URL: https://svnweb.freebsd.org/changeset/base/363494 Log: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp 10.0.1 final (aka llvmorg-10.0.1-0-gef32c611aa2). MFC r359582 (by emaste): lldb: use lua as the default script language In the FreeBSD base system we do not have Python support in lldb, but will have Lua support. Make Lua the default. This needs to be made into a configure-time option; that is being discussed upstream and will appear in a future lldb import. For now carry this change as a tiny patch to our copy of lldb. MFC r359599 (by emaste): lldb: add rule to generate LLDBWrapLua.cpp Building lldb's lua/python bindings requires swig, but we do not want to include it in the FreeBSD base system (as a build tool) because it has non-trivial dependencies. As a workaround, add a make rule to generate LLDBWrapLua.cpp, and we will commit the generated file. Requires the swig30 package. Reviewed by: brooks Discussed with: dim Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D24265 MFC r359600 (by emaste): lldb: commit generated LLDBWrapLua.cpp MFC r359606 (by emaste): lldb: build and enable lua script bindings Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D24266 MFC r360697: In r358396 I merged llvm upstream commit 2e24219d3, which fixed "error: unsupported relocation on symbol" when assembling arm 'adr' pseudo instructions. However, the upstream commit did not take big-endian arm into account. Applying the same changes to the big-endian handling is straightforward, thanks to Andrew Turner and Peter Smith for the hint. This will also be submitted upstream. MFC r360702: Merge commit 4ca2cad94 from llvm git (by Justin Hibbits): [PowerPC] Add clang -msvr4-struct-return for 32-bit ELF Summary: Change the default ABI to be compatible with GCC. For 32-bit ELF targets other than Linux, Clang now returns small structs in registers r3/r4. This affects FreeBSD, NetBSD, OpenBSD. There is no change for 32-bit Linux, where Clang continues to return all structs in memory. Add clang options -maix-struct-return (to return structs in memory) and -msvr4-struct-return (to return structs in registers) to be compatible with gcc. These options are only for PPC32; reject them on PPC64 and other targets. The options are like -fpcc-struct-return and -freg-struct-return for X86_32, and use similar code. To actually return a struct in registers, coerce it to an integer of the same size. LLVM may optimize the code to remove unnecessary accesses to memory, and will return i32 in r3 or i64 in r3:r4. Fixes PR#40736 Patch by George Koehler! Reviewed By: jhibbits, nemanjai Differential Revision: https://reviews.llvm.org/D73290 Requested by: jhibbits MFC r361410: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp llvmorg-10.0.1-rc1-0-gf79cd71e145 (aka 10.0.1 rc1). MFC r362235 (by kp): llvm: Default to -mno-relax on RISC-V Compiling on a RISC-V system fails with 'relocation R_RISCV_ALIGN requires unimplemented linker relaxation; recompile with -mno-relax'. Our default linker (ld.lld) doesn't support relaxation, so default to no-relax so we don't generate object files the linker can't handle. Reviewed by: mhorne Sponsored by: Axiado Differential Revision:https://reviews.freebsd.org/D25210 MFC r362445: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp llvmorg-10.0.0-97-g6f71678ecd2 (not quite 10.0.1 rc2, as more fixes are still pending). MFC r362587 (by cem): Add WITH_CLANG_FORMAT option clang-format is enabled conditional on either WITH_CLANG_EXTRAS or WITH_CLANG_FORMAT. Some sources in libclang are build conditional on either rule, and obviously the clang-format binary itself depends on the rule. clang-format could still use a manual page. Reviewed by: emaste Differential Revision:https://reviews.freebsd.org/D25427 MFC r362609: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp llvmorg-10.0.0-129-gd24d5c8e308. Getting closer to 10.0.1-rc2. MFC r362679: Regenerate ReStructuredText based manpages for llvm-project tools: * bugpoint.1 * clang.1 * llc.1 * lldb.1 * lli.1 * llvm-ar.1 * llvm-as.1 * llvm-bcanalyzer.1 * llvm-cov.1 * llvm-diff.1 * llvm-dis.1 * llvm-dwarfdump.1 * llvm-extract.1 * llvm-link.1 * llvm-mca.1 * llvm-nm.1 * llvm-pdbutil.1 * llvm-profdata.1 * llvm-symbolizer.1 * llvm-tblgen.1 * opt.1 Add newly generated manpages for: * llvm-addr2line.1 (this is an alias of llv
svn commit: r363493 - in head/sys/x86: include x86
Author: mav Date: Fri Jul 24 20:44:50 2020 New Revision: 363493 URL: https://svnweb.freebsd.org/changeset/base/363493 Log: Use APIC_IPI_DEST_OTHERS for bitmapped IPIs too. It should save bunch of LAPIC register accesses. MFC after:2 weeks Modified: head/sys/x86/include/x86_smp.h head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/include/x86_smp.h == --- head/sys/x86/include/x86_smp.h Fri Jul 24 20:10:27 2020 (r363492) +++ head/sys/x86/include/x86_smp.h Fri Jul 24 20:44:50 2020 (r363493) @@ -107,6 +107,5 @@ voidsmp_masked_invltlb(cpuset_t mask, struct pmap *pm smp_invl_cb_t curcpu_cb); void mem_range_AP_init(void); void topo_probe(void); -void ipi_send_cpu(int cpu, u_int ipi); #endif Modified: head/sys/x86/x86/mp_x86.c == --- head/sys/x86/x86/mp_x86.c Fri Jul 24 20:10:27 2020(r363492) +++ head/sys/x86/x86/mp_x86.c Fri Jul 24 20:44:50 2020(r363493) @@ -1233,32 +1233,39 @@ ipi_startup(int apic_id, int vector) DELAY(200); /* wait ~200uS */ } +static bool +ipi_bitmap_set(int cpu, u_int ipi) +{ + u_int bitmap, old, new; + u_int *cpu_bitmap; + + bitmap = 1 << ipi; + cpu_bitmap = &cpuid_to_pcpu[cpu]->pc_ipi_bitmap; + old = *cpu_bitmap; + for (;;) { + if ((old & bitmap) != 0) + break; + new = old | bitmap; + if (atomic_fcmpset_int(cpu_bitmap, &old, new)) + break; + } + return (old != 0); +} + /* * Send an IPI to specified CPU handling the bitmap logic. */ -void +static void ipi_send_cpu(int cpu, u_int ipi) { - u_int bitmap, old, new; - u_int *cpu_bitmap; KASSERT((u_int)cpu < MAXCPU && cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu)); if (IPI_IS_BITMAPED(ipi)) { - bitmap = 1 << ipi; - ipi = IPI_BITMAP_VECTOR; - cpu_bitmap = &cpuid_to_pcpu[cpu]->pc_ipi_bitmap; - old = *cpu_bitmap; - for (;;) { - if ((old & bitmap) == bitmap) - break; - new = old | bitmap; - if (atomic_fcmpset_int(cpu_bitmap, &old, new)) - break; - } - if (old) + if (ipi_bitmap_set(cpu, ipi)) return; + ipi = IPI_BITMAP_VECTOR; } lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); } @@ -1366,23 +1373,28 @@ void ipi_all_but_self(u_int ipi) { cpuset_t other_cpus; + int cpu, c; - other_cpus = all_cpus; - CPU_CLR(PCPU_GET(cpuid), &other_cpus); - if (IPI_IS_BITMAPED(ipi)) { - ipi_selected(other_cpus, ipi); - return; - } - /* * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit * of help in order to understand what is the source. * Set the mask of receiving CPUs for this purpose. */ - if (ipi == IPI_STOP_HARD) + if (ipi == IPI_STOP_HARD) { + other_cpus = all_cpus; + CPU_CLR(PCPU_GET(cpuid), &other_cpus); CPU_OR_ATOMIC(&ipi_stop_nmi_pending, &other_cpus); + } CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); + if (IPI_IS_BITMAPED(ipi)) { + cpu = PCPU_GET(cpuid); + CPU_FOREACH(c) { + if (c != cpu) + ipi_bitmap_set(c, ipi); + } + ipi = IPI_BITMAP_VECTOR; + } lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363492 - stable/12/sys/net
Author: kp Date: Fri Jul 24 20:10:27 2020 New Revision: 363492 URL: https://svnweb.freebsd.org/changeset/base/363492 Log: bridge: Enter epoch for bridge_transmit() Just like the change done for bridge_input()/bridge_output() in r363430 we must enter epoch ourselves, because its coverage is not as wide as in head. This is a direct commit to stable/12. PR: 248046 Modified: stable/12/sys/net/if_bridge.c Modified: stable/12/sys/net/if_bridge.c == --- stable/12/sys/net/if_bridge.c Fri Jul 24 20:09:52 2020 (r363491) +++ stable/12/sys/net/if_bridge.c Fri Jul 24 20:10:27 2020 (r363492) @@ -2189,11 +2189,14 @@ sendunicast: static int bridge_transmit(struct ifnet *ifp, struct mbuf *m) { + struct epoch_tracker et; struct bridge_softc *sc; struct ether_header *eh; struct ifnet *dst_if; int error = 0; + NET_EPOCH_ENTER_ET(et); + sc = ifp->if_softc; ETHER_BPF_MTAP(ifp, m); @@ -2205,6 +2208,8 @@ bridge_transmit(struct ifnet *ifp, struct mbuf *m) error = bridge_enqueue(sc, dst_if, m); } else bridge_broadcast(sc, ifp, m, 0); + + NET_EPOCH_EXIT_ET(et); return (error); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363491 - stable/12/sys/net
Author: kp Date: Fri Jul 24 20:09:52 2020 New Revision: 363491 URL: https://svnweb.freebsd.org/changeset/base/363491 Log: bridge: Fix mismerges from r360345 In r362650 we merged r360345. This required manual changes due to the differences in EPOCH macros between head and stable/12, and was done imperfectly. This is a direct commit to stable/12. PR: 248046 Modified: stable/12/sys/net/if_bridge.c Modified: stable/12/sys/net/if_bridge.c == --- stable/12/sys/net/if_bridge.c Fri Jul 24 19:54:15 2020 (r363490) +++ stable/12/sys/net/if_bridge.c Fri Jul 24 20:09:52 2020 (r363491) @@ -189,41 +189,14 @@ extern void nd6_setmtu(struct ifnet *); */ #define BRIDGE_LOCK_INIT(_sc) do {\ mtx_init(&(_sc)->sc_mtx, "if_bridge", NULL, MTX_DEF); \ - cv_init(&(_sc)->sc_cv, "if_bridge_cv"); \ } while (0) #define BRIDGE_LOCK_DESTROY(_sc) do {\ mtx_destroy(&(_sc)->sc_mtx);\ - cv_destroy(&(_sc)->sc_cv); \ } while (0) #define BRIDGE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define BRIDGE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define BRIDGE_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->sc_mtx, MA_OWNED) #define BRIDGE_UNLOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED) -#defineBRIDGE_LOCK2REF(_sc, _err) do {\ - mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \ - if ((_sc)->sc_iflist_xcnt > 0) \ - (_err) = EBUSY; \ - else\ - (_sc)->sc_iflist_ref++; \ - mtx_unlock(&(_sc)->sc_mtx); \ -} while (0) -#defineBRIDGE_UNREF(_sc) do { \ - mtx_lock(&(_sc)->sc_mtx); \ - (_sc)->sc_iflist_ref--; \ - if (((_sc)->sc_iflist_xcnt > 0) && ((_sc)->sc_iflist_ref == 0)) \ - cv_broadcast(&(_sc)->sc_cv);\ - mtx_unlock(&(_sc)->sc_mtx); \ -} while (0) -#defineBRIDGE_XLOCK(_sc) do {\ - mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \ - (_sc)->sc_iflist_xcnt++;\ - while ((_sc)->sc_iflist_ref > 0)\ - cv_wait(&(_sc)->sc_cv, &(_sc)->sc_mtx); \ -} while (0) -#defineBRIDGE_XDROP(_sc) do {\ - mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \ - (_sc)->sc_iflist_xcnt--;\ -} while (0) /* * Bridge interface list entry. @@ -265,13 +238,10 @@ struct bridge_softc { struct ifnet*sc_ifp;/* make this an interface */ LIST_ENTRY(bridge_softc) sc_list; struct mtx sc_mtx; - struct cv sc_cv; uint32_tsc_brtmax; /* max # of addresses */ uint32_tsc_brtcnt; /* cur. # of addresses */ uint32_tsc_brttimeout; /* rt timeout in seconds */ struct callout sc_brcallout; /* bridge callout */ - uint32_tsc_iflist_ref; /* refcount for sc_iflist */ - uint32_tsc_iflist_xcnt; /* refcount for sc_iflist */ CK_LIST_HEAD(, bridge_iflist) sc_iflist;/* member interface list */ CK_LIST_HEAD(, bridge_rtnode) *sc_rthash; /* our forwarding table */ CK_LIST_HEAD(, bridge_rtnode) sc_rtlist;/* list version of above */ @@ -790,7 +760,9 @@ bridge_clone_destroy(struct ifnet *ifp) { struct bridge_softc *sc = ifp->if_softc; struct bridge_iflist *bif; + struct epoch_tracker et; + NET_EPOCH_ENTER_ET(et); BRIDGE_LOCK(sc); bridge_stop(ifp, 1); @@ -815,6 +787,8 @@ bridge_clone_destroy(struct ifnet *ifp) BRIDGE_LIST_UNLOCK(); bstp_detach(&sc->sc_stp); + NET_EPOCH_EXIT_ET(et); + ether_ifdetach(ifp); if_free(ifp); @@ -994,7 +968,6 @@ bridge_mutecaps(struct bridge_softc *sc) mask &= bif->bif_savedcaps; } - BRIDGE_XLOCK(sc); CK_LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { enabled = bif->bif_ifp->if_capenable; enabled &= ~BRIDGE_IFCAPS_STRIP; @@ -1005,8 +978,6 @@ bridge_mutecaps(struct bridge_softc *sc) bridge_set_ifcap(sc, bif, enabled); BRIDGE_LOCK(sc); } - BRIDGE_XDROP(sc); - } static void @@ -1107,9 +1078,7 @@ bridge_delete_member(struct bridge_softc *sc, struct b bstp_disable(&bif->bif_stp); ifs->if_bridge = NULL; - BRIDGE_XLOCK(sc); CK_LIST_REMOVE(bif, bif_next); - BRIDGE_XDROP(sc);
svn commit: r363490 - head/sys/x86/x86
Author: mav Date: Fri Jul 24 19:54:15 2020 New Revision: 363490 URL: https://svnweb.freebsd.org/changeset/base/363490 Log: Make lapic_ipi_vectored(APIC_IPI_DEST_SELF) NMI safe. Sending IPI to self or all CPUs does not require write into upper part of the ICR, prone to races. Previously the code disabled interrupts, but it was not enough for NMIs. Instead of that when possible write only lower part of the register, or use special SELF IPI register in x2APIC mode. This also removes ICR reads used to preserve reserved bits on write. It was there from the beginning, but I failed to find explanation why, neither I see Linux doing it. Specification even tells that ICR content may be lost in deep C-states, so if hardware does not bother to preserve it, why should we? MFC after:2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c == --- head/sys/x86/x86/local_apic.c Fri Jul 24 19:52:52 2020 (r363489) +++ head/sys/x86/x86/local_apic.c Fri Jul 24 19:54:15 2020 (r363490) @@ -254,22 +254,6 @@ lapic_write32_nofence(enum LAPIC_REGISTERS reg, uint32 #ifdef SMP static uint64_t -lapic_read_icr(void) -{ - uint64_t v; - uint32_t vhi, vlo; - - if (x2apic_mode) { - v = rdmsr(MSR_APIC_000 + LAPIC_ICR_LO); - } else { - vhi = lapic_read32(LAPIC_ICR_HI); - vlo = lapic_read32(LAPIC_ICR_LO); - v = ((uint64_t)vhi << 32) | vlo; - } - return (v); -} - -static uint64_t lapic_read_icr_lo(void) { @@ -279,6 +263,7 @@ lapic_read_icr_lo(void) static void lapic_write_icr(uint32_t vhi, uint32_t vlo) { + register_t saveintr; uint64_t v; if (x2apic_mode) { @@ -286,10 +271,32 @@ lapic_write_icr(uint32_t vhi, uint32_t vlo) mfence(); wrmsr(MSR_APIC_000 + LAPIC_ICR_LO, v); } else { + saveintr = intr_disable(); lapic_write32(LAPIC_ICR_HI, vhi); lapic_write32(LAPIC_ICR_LO, vlo); + intr_restore(saveintr); } } + +static void +lapic_write_icr_lo(uint32_t vlo) +{ + + if (x2apic_mode) { + mfence(); + wrmsr(MSR_APIC_000 + LAPIC_ICR_LO, vlo); + } else { + lapic_write32(LAPIC_ICR_LO, vlo); + } +} + +static void +lapic_write_self_ipi(uint32_t vector) +{ + + KASSERT(x2apic_mode, ("SELF IPI write in xAPIC mode")); + wrmsr(MSR_APIC_000 + LAPIC_SELF_IPI, vector); +} #endif /* SMP */ static void @@ -1991,9 +1998,7 @@ native_lapic_ipi_wait(int delay) static void native_lapic_ipi_raw(register_t icrlo, u_int dest) { - uint64_t icr; - uint32_t vhi, vlo; - register_t saveintr; + uint32_t icrhi; /* XXX: Need more sanity checking of icrlo? */ KASSERT(x2apic_mode || lapic_map != NULL, @@ -2004,35 +2009,15 @@ native_lapic_ipi_raw(register_t icrlo, u_int dest) KASSERT((icrlo & APIC_ICRLO_RESV_MASK) == 0, ("%s: reserved bits set in ICR LO register", __func__)); - /* Set destination in ICR HI register if it is being used. */ - if (!x2apic_mode) { - saveintr = intr_disable(); - icr = lapic_read_icr(); - } - if ((icrlo & APIC_DEST_MASK) == APIC_DEST_DESTFLD) { - if (x2apic_mode) { - vhi = dest; - } else { - vhi = icr >> 32; - vhi &= ~APIC_ID_MASK; - vhi |= dest << APIC_ID_SHIFT; - } + if (x2apic_mode) + icrhi = dest; + else + icrhi = dest << APIC_ID_SHIFT; + lapic_write_icr(icrhi, icrlo); } else { - vhi = 0; + lapic_write_icr_lo(icrlo); } - - /* Program the contents of the IPI and dispatch it. */ - if (x2apic_mode) { - vlo = icrlo; - } else { - vlo = icr; - vlo &= APIC_ICRLO_RESV_MASK; - vlo |= icrlo; - } - lapic_write_icr(vhi, vlo); - if (!x2apic_mode) - intr_restore(saveintr); } #defineBEFORE_SPIN 5 @@ -2048,33 +2033,38 @@ native_lapic_ipi_vectored(u_int vector, int dest) KASSERT((vector & ~APIC_VECTOR_MASK) == 0, ("%s: invalid vector %d", __func__, vector)); - icrlo = APIC_DESTMODE_PHY | APIC_TRIGMOD_EDGE | APIC_LEVEL_ASSERT; - - /* -* NMI IPIs are just fake vectors used to send a NMI. Use special rules -* regarding NMIs if passed, otherwise specify the vector. -*/ - if (vector >= IPI_NMI_FIRST) - icrlo |= APIC_DELMODE_NMI; - else - icrlo |= vector | APIC_DELMODE_FI
svn commit: r363489 - head/sys/dev/mmc/host
Author: manu Date: Fri Jul 24 19:52:52 2020 New Revision: 363489 URL: https://svnweb.freebsd.org/changeset/base/363489 Log: dwmmc: Add MMCCAM part Add support for MMCCAM for dwmmc Submitted by: kibab Tested On:Rock64, RockPro64 Modified: head/sys/dev/mmc/host/dwmmc.c head/sys/dev/mmc/host/dwmmc_var.h Modified: head/sys/dev/mmc/host/dwmmc.c == --- head/sys/dev/mmc/host/dwmmc.c Fri Jul 24 18:44:50 2020 (r363488) +++ head/sys/dev/mmc/host/dwmmc.c Fri Jul 24 19:52:52 2020 (r363489) @@ -68,9 +68,23 @@ __FBSDID("$FreeBSD$"); #include #include +#include "opt_mmccam.h" + +#ifdef MMCCAM +#include +#include +#include +#include +#include +#endif + #include "mmcbr_if.h" +#ifdef DEBUG +#define dprintf(fmt, args...) printf(fmt, ##args) +#else #define dprintf(x, arg...) +#endif #defineREAD4(_sc, _reg) \ bus_read_4((_sc)->res[0], _reg) @@ -129,6 +143,14 @@ static int dma_stop(struct dwmmc_softc *); static void pio_read(struct dwmmc_softc *, struct mmc_command *); static void pio_write(struct dwmmc_softc *, struct mmc_command *); static void dwmmc_handle_card_present(struct dwmmc_softc *sc, bool is_present); +static int dwmmc_switch_vccq(device_t, device_t); +#ifdef MMCCAM +static void dwmmc_cam_action(struct cam_sim *, union ccb *); +static void dwmmc_cam_poll(struct cam_sim *); +static int dwmmc_cam_settran_settings(struct dwmmc_softc *, union ccb *); +static int dwmmc_cam_request(struct dwmmc_softc *, union ccb *); +static void dwmmc_cam_handle_mmcio(struct cam_sim *, union ccb *); +#endif static struct resource_spec dwmmc_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, @@ -286,8 +308,18 @@ static void dwmmc_cmd_done(struct dwmmc_softc *sc) { struct mmc_command *cmd; +#ifdef MMCCAM + union ccb *ccb; +#endif +#ifdef MMCCAM + ccb = sc->ccb; + if (ccb == NULL) + return; + cmd = &ccb->mmcio.cmd; +#else cmd = sc->curcmd; +#endif if (cmd == NULL) return; @@ -432,6 +464,9 @@ dwmmc_card_task(void *arg, int pending __unused) { struct dwmmc_softc *sc = arg; +#ifdef MMCCAM + mmccam_start_discovery(sc->sim); +#else DWMMC_LOCK(sc); if (READ4(sc, SDMMC_CDETECT) == 0) { @@ -459,6 +494,7 @@ dwmmc_card_task(void *arg, int pending __unused) } else DWMMC_UNLOCK(sc); } +#endif /* MMCCAM */ } static int @@ -721,12 +757,40 @@ dwmmc_attach(device_t dev) TIMEOUT_TASK_INIT(taskqueue_swi_giant, &sc->card_delayed_task, 0, dwmmc_card_task, sc); +#ifdef MMCCAM + sc->ccb = NULL; + if ((sc->devq = cam_simq_alloc(1)) == NULL) { + goto fail; + } + + mtx_init(&sc->sim_mtx, "dwmmcsim", NULL, MTX_DEF); + sc->sim = cam_sim_alloc_dev(dwmmc_cam_action, dwmmc_cam_poll, + "dw_mmc_sim", sc, dev, + &sc->sim_mtx, 1, 1, sc->devq); + + if (sc->sim == NULL) { +cam_simq_free(sc->devq); +device_printf(dev, "cannot allocate CAM SIM\n"); +goto fail; +} + + mtx_lock(&sc->sim_mtx); +if (xpt_bus_register(sc->sim, sc->dev, 0) != 0) { +device_printf(sc->dev, "cannot register SCSI pass-through bus\n"); +cam_sim_free(sc->sim, FALSE); +cam_simq_free(sc->devq); +mtx_unlock(&sc->sim_mtx); +goto fail; +} + +fail: +mtx_unlock(&sc->sim_mtx); +#endif /* * Schedule a card detection as we won't get an interrupt * if the card is inserted when we attach */ dwmmc_card_task(sc, 0); - return (0); } @@ -1041,15 +1105,17 @@ dwmmc_start_cmd(struct dwmmc_softc *sc, struct mmc_com uint32_t blksz; uint32_t cmdr; + dprintf("%s\n", __func__); sc->curcmd = cmd; data = cmd->data; if ((sc->hwtype & HWTYPE_MASK) == HWTYPE_ROCKCHIP) dwmmc_setup_bus(sc, sc->host.ios.clock); +#ifndef MMCCAM /* XXX Upper layers don't always set this */ cmd->mrq = sc->req; - +#endif /* Begin setting up command register. */ cmdr = cmd->opcode; @@ -1119,11 +1185,23 @@ dwmmc_start_cmd(struct dwmmc_softc *sc, struct mmc_com static void dwmmc_next_operation(struct dwmmc_softc *sc) { + struct mmc_command *cmd; + dprintf("%s\n", __func__); +#ifdef MMCCAM + union ccb *ccb; + + ccb = sc->ccb; + if (ccb == NULL) + return; + cmd = &ccb->mmcio.cmd; +#else struct mmc_request *req; req = sc->req; if (req == NULL) return; + cmd = req->cmd; +#endif sc->acd_rcvd = 0; sc->dto_rcvd = 0; @@ -1140,17 +1218,26 @@ dwmmc_next_operation(struct dwmmc_softc *sc)
svn commit: r363488 - head/sys/arm/allwinner
Author: manu Date: Fri Jul 24 18:44:50 2020 New Revision: 363488 URL: https://svnweb.freebsd.org/changeset/base/363488 Log: mmccam: aw_mmc: Only print the new ios value under bootverbose Modified: head/sys/arm/allwinner/aw_mmc.c Modified: head/sys/arm/allwinner/aw_mmc.c == --- head/sys/arm/allwinner/aw_mmc.c Fri Jul 24 18:43:46 2020 (r363487) +++ head/sys/arm/allwinner/aw_mmc.c Fri Jul 24 18:44:50 2020 (r363488) @@ -300,31 +300,38 @@ aw_mmc_cam_settran_settings(struct aw_mmc_softc *sc, u /* Update only requested fields */ if (cts->ios_valid & MMC_CLK) { ios->clock = new_ios->clock; - device_printf(sc->aw_dev, "Clock => %d\n", ios->clock); + if (bootverbose) + device_printf(sc->aw_dev, "Clock => %d\n", ios->clock); } if (cts->ios_valid & MMC_VDD) { ios->vdd = new_ios->vdd; - device_printf(sc->aw_dev, "VDD => %d\n", ios->vdd); + if (bootverbose) + device_printf(sc->aw_dev, "VDD => %d\n", ios->vdd); } if (cts->ios_valid & MMC_CS) { ios->chip_select = new_ios->chip_select; - device_printf(sc->aw_dev, "CS => %d\n", ios->chip_select); + if (bootverbose) + device_printf(sc->aw_dev, "CS => %d\n", ios->chip_select); } if (cts->ios_valid & MMC_BW) { ios->bus_width = new_ios->bus_width; - device_printf(sc->aw_dev, "Bus width => %d\n", ios->bus_width); + if (bootverbose) + device_printf(sc->aw_dev, "Bus width => %d\n", ios->bus_width); } if (cts->ios_valid & MMC_PM) { ios->power_mode = new_ios->power_mode; - device_printf(sc->aw_dev, "Power mode => %d\n", ios->power_mode); + if (bootverbose) + device_printf(sc->aw_dev, "Power mode => %d\n", ios->power_mode); } if (cts->ios_valid & MMC_BT) { ios->timing = new_ios->timing; - device_printf(sc->aw_dev, "Timing => %d\n", ios->timing); + if (bootverbose) + device_printf(sc->aw_dev, "Timing => %d\n", ios->timing); } if (cts->ios_valid & MMC_BM) { ios->bus_mode = new_ios->bus_mode; - device_printf(sc->aw_dev, "Bus mode => %d\n", ios->bus_mode); + if (bootverbose) + device_printf(sc->aw_dev, "Bus mode => %d\n", ios->bus_mode); } return (aw_mmc_update_ios(sc->aw_dev, NULL)); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363487 - head/sys/cam/mmc
Author: manu Date: Fri Jul 24 18:43:46 2020 New Revision: 363487 URL: https://svnweb.freebsd.org/changeset/base/363487 Log: mmccam: Make non bootverbose more readable Remove some debug printfs. Convert some to CAM_DEBUG Only print some when bootverbose is set. Modified: head/sys/cam/mmc/mmc_xpt.c Modified: head/sys/cam/mmc/mmc_xpt.c == --- head/sys/cam/mmc/mmc_xpt.c Fri Jul 24 18:19:25 2020(r363486) +++ head/sys/cam/mmc/mmc_xpt.c Fri Jul 24 18:43:46 2020(r363487) @@ -179,7 +179,6 @@ mmc_alloc_device(struct cam_eb *bus, struct cam_et *ta { struct cam_ed *device; - printf("mmc_alloc_device()\n"); device = xpt_alloc_device(bus, target, lun_id); if (device == NULL) return (NULL); @@ -282,7 +281,8 @@ mmc_scan_lun(struct cam_periph *periph, struct cam_pat xpt_done(request_ccb); } } else { - xpt_print(path, " Set up the mmcprobe device...\n"); + if (bootverbose) + xpt_print(path, " Set up the mmcprobe device...\n"); status = cam_periph_alloc(mmcprobe_register, NULL, mmcprobe_cleanup, @@ -829,7 +829,6 @@ mmcprobe_done(struct cam_periph *periph, union ccb *do /* FALLTHROUGH */ case PROBE_IDENTIFY: { - printf("Starting completion of PROBE_RESET\n"); CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("done with PROBE_RESET\n")); mmcio = &done_ccb->mmcio; err = mmcio->cmd.error; @@ -1149,7 +1148,7 @@ mmcprobe_done(struct cam_periph *periph, union ccb *do xpt_schedule(periph, priority); /* Drop freeze taken due to CAM_DEV_QFREEZE flag set. */ int frozen = cam_release_devq(path, 0, 0, 0, FALSE); -printf("mmc_probedone: remaining freezecnt %d\n", frozen); +CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("mmc_probedone: remaining freezecnt %d\n", frozen)); if (softc->action == PROBE_DONE) { /* Notify the system that the device is found! */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363486 - in stable/12: sys/geom/eli tests/sys/geom/class/eli
Author: asomers Date: Fri Jul 24 18:19:25 2020 New Revision: 363486 URL: https://svnweb.freebsd.org/changeset/base/363486 Log: MFC r363014: geli: enable direct dispatch geli does all of its crypto operations in a separate thread pool, so g_eli_start, g_eli_read_done, and g_eli_write_done don't actually do very much work. Enabling direct dispatch eliminates the g_up/g_down bottlenecks, doubling IOPs on my system. This change does not affect the thread pool. Reviewed by: markj Sponsored by: Axcient Differential Revision:https://reviews.freebsd.org/D25587 Added: stable/12/tests/sys/geom/class/eli/reentrancy_test.sh - copied unchanged from r363014, head/tests/sys/geom/class/eli/reentrancy_test.sh Modified: stable/12/sys/geom/eli/g_eli.c stable/12/tests/sys/geom/class/eli/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/geom/eli/g_eli.c == --- stable/12/sys/geom/eli/g_eli.c Fri Jul 24 17:56:17 2020 (r363485) +++ stable/12/sys/geom/eli/g_eli.c Fri Jul 24 18:19:25 2020 (r363486) @@ -642,6 +642,7 @@ g_eli_read_metadata(struct g_class *mp, struct g_provi gp->orphan = g_eli_orphan_spoil_assert; gp->spoiled = g_eli_orphan_spoil_assert; cp = g_new_consumer(gp); + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); if (error != 0) goto end; @@ -778,6 +779,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, pp = NULL; cp = g_new_consumer(gp); + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, bpp); if (error != 0) { if (req != NULL) { @@ -865,6 +867,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, * Create decrypted provider. */ pp = g_new_providerf(gp, "%s%s", bpp->name, G_ELI_SUFFIX); + pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE; pp->mediasize = sc->sc_mediasize; pp->sectorsize = sc->sc_sectorsize; Modified: stable/12/tests/sys/geom/class/eli/Makefile == --- stable/12/tests/sys/geom/class/eli/Makefile Fri Jul 24 17:56:17 2020 (r363485) +++ stable/12/tests/sys/geom/class/eli/Makefile Fri Jul 24 18:19:25 2020 (r363486) @@ -16,6 +16,7 @@ ATF_TESTS_SH+=integrity_test ATF_TESTS_SH+= kill_test ATF_TESTS_SH+= misc_test ATF_TESTS_SH+= onetime_test +ATF_TESTS_SH+= reentrancy_test ATF_TESTS_SH+= resize_test ATF_TESTS_SH+= setkey_test Copied: stable/12/tests/sys/geom/class/eli/reentrancy_test.sh (from r363014, head/tests/sys/geom/class/eli/reentrancy_test.sh) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tests/sys/geom/class/eli/reentrancy_test.sh Fri Jul 24 18:19:25 2020(r363486, copy of r363014, head/tests/sys/geom/class/eli/reentrancy_test.sh) @@ -0,0 +1,69 @@ +# $FreeBSD$ + +# Test various operations for geli-on-geli providers, to ensure that geli is +# reentrant. + +. $(atf_get_srcdir)/conf.sh + +init_test() +{ + cipher=$1 + aalgo=$2 + secsize=$3 + ealgo=${cipher%%:*} + keylen=${cipher##*:} + + atf_check dd if=/dev/random of=testdata bs=$secsize count=1 status=none + atf_check dd if=/dev/random of=keyfile bs=$secsize count=16 status=none + + # Create the lower geli device + atf_check -s exit:0 -e ignore \ + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \ + -s $secsize ${md} + atf_check geli attach -p -k keyfile ${md} + # Create the upper geli device + atf_check -s exit:0 -e ignore \ + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \ + -s $secsize ${md}.eli + atf_check geli attach -p -k keyfile ${md}.eli + echo ${md} > layered_md_device + + # Ensure we can read and write. + atf_check dd if=testdata of=/dev/${md}.eli.eli bs=$secsize count=1 \ + status=none + atf_check dd if=/dev/${md}.eli.eli of=cmpdata bs=$secsize count=1 \ + status=none + atf_check cmp -s testdata cmpdata + + geli detach ${md}.eli 2>/dev/null +} + +atf_test_case init cleanup +init_head() +{ + atf_set "descr" "Initialize a geli provider on top of another" + atf_set "require.user" "root" + atf_set "timeout" 600 +} +init_body() +{ + sectors=2 + geli_test_setup + + for_each_geli_config init_test +} +init_cleanup() +{ + if [ -f layered_md_device ]; then + while read provider; do + [ -c /dev/${md}.eli.eli ] && \ + geli detach $md.eli.eli 2>/dev/null +
svn commit: r363485 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: asomers Date: Fri Jul 24 17:56:17 2020 New Revision: 363485 URL: https://svnweb.freebsd.org/changeset/base/363485 Log: MFC r362891: Fix page fault in zfsctl_snapdir_getattr Must acquire the z_teardown_lock before accessing the zfsvfs_t object. I can't reproduce this panic on demand, but this looks like the correct solution. PR: 247668 Reviewed by: avg Sponsored by: Axcient Differential Revision:https://reviews.freebsd.org/D25543 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c == --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jul 24 17:45:06 2020(r363484) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jul 24 17:56:17 2020(r363485) @@ -1118,12 +1118,13 @@ zfsctl_snapdir_getattr(ap) vnode_t *vp = ap->a_vp; vattr_t *vap = ap->a_vap; zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data; - dsl_dataset_t *ds = dmu_objset_ds(zfsvfs->z_os); + dsl_dataset_t *ds; sfs_node_t *node = vp->v_data; uint64_t snap_count; int err; ZFS_ENTER(zfsvfs); + ds = dmu_objset_ds(zfsvfs->z_os); zfsctl_common_getattr(vp, vap); vap->va_ctime = dmu_objset_snap_cmtime(zfsvfs->z_os); vap->va_mtime = vap->va_ctime; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363484 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: asomers Date: Fri Jul 24 17:45:06 2020 New Revision: 363484 URL: https://svnweb.freebsd.org/changeset/base/363484 Log: MFC r362891: Fix page fault in zfsctl_snapdir_getattr Must acquire the z_teardown_lock before accessing the zfsvfs_t object. I can't reproduce this panic on demand, but this looks like the correct solution. PR: 247668 Reviewed by: avg Sponsored by: Axcient Differential Revision:https://reviews.freebsd.org/D25543 Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c == --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jul 24 17:34:44 2020(r363483) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jul 24 17:45:06 2020(r363484) @@ -1120,12 +1120,13 @@ zfsctl_snapdir_getattr(ap) vnode_t *vp = ap->a_vp; vattr_t *vap = ap->a_vap; zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data; - dsl_dataset_t *ds = dmu_objset_ds(zfsvfs->z_os); + dsl_dataset_t *ds; sfs_node_t *node = vp->v_data; uint64_t snap_count; int err; ZFS_ENTER(zfsvfs); + ds = dmu_objset_ds(zfsvfs->z_os); zfsctl_common_getattr(vp, vap); vap->va_ctime = dmu_objset_snap_cmtime(zfsvfs->z_os); vap->va_mtime = vap->va_ctime; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363483 - head/sys/kern
Author: cem Date: Fri Jul 24 17:34:44 2020 New Revision: 363483 URL: https://svnweb.freebsd.org/changeset/base/363483 Log: Use gbincore_unlocked for unprotected incore() Reviewed by: markj Sponsored by: Isilon Differential Revision:https://reviews.freebsd.org/D25790 Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Fri Jul 24 17:34:04 2020(r363482) +++ head/sys/kern/vfs_bio.c Fri Jul 24 17:34:44 2020(r363483) @@ -3576,12 +3576,7 @@ flushbufqueues(struct vnode *lvp, struct bufdomain *bd struct buf * incore(struct bufobj *bo, daddr_t blkno) { - struct buf *bp; - - BO_RLOCK(bo); - bp = gbincore(bo, blkno); - BO_RUNLOCK(bo); - return (bp); + return (gbincore_unlocked(bo, blkno)); } /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363482 - in head/sys: kern sys
Author: cem Date: Fri Jul 24 17:34:04 2020 New Revision: 363482 URL: https://svnweb.freebsd.org/changeset/base/363482 Log: Add unlocked/SMR fast path to getblk() Convert the bufobj tries to an SMR zone/PCTRIE and add a gbincore_unlocked() API wrapping this functionality. Use it for a fast path in getblkx(), falling back to locked lookup if we raced a thread changing the buf's identity. Reported by: Attilio Reviewed by: kib, markj Testing: pho (in progress) Sponsored by: Isilon Differential Revision:https://reviews.freebsd.org/D25782 Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_subr.c head/sys/sys/buf.h Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Fri Jul 24 17:32:10 2020(r363481) +++ head/sys/kern/vfs_bio.c Fri Jul 24 17:34:04 2020(r363482) @@ -3849,7 +3849,7 @@ getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkn struct buf *bp; struct bufobj *bo; daddr_t d_blkno; - int bsize, error, maxsize, vmio; + int bsize, error, maxsize, vmio, lockflags; off_t offset; CTR3(KTR_BUF, "getblk(%p, %ld, %d)", vp, (long)blkno, size); @@ -3864,11 +3864,33 @@ getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkn bo = &vp->v_bufobj; d_blkno = dblkno; + + /* Attempt lockless lookup first. */ + bp = gbincore_unlocked(bo, blkno); + if (bp == NULL) + goto newbuf_unlocked; + + lockflags = LK_EXCLUSIVE | LK_SLEEPFAIL | + ((flags & GB_LOCK_NOWAIT) ? LK_NOWAIT : 0); + + error = BUF_TIMELOCK(bp, lockflags, NULL, "getblku", slpflag, + slptimeo); + if (error == EINTR || error == ERESTART) + return (error); + else if (error != 0) + goto loop; + + /* Verify buf identify has not changed since lookup. */ + if (bp->b_bufobj == bo && bp->b_lblkno == blkno) + goto foundbuf_fastpath; + + /* It changed, fallback to locked lookup. */ + BUF_UNLOCK_RAW(bp); + loop: BO_RLOCK(bo); bp = gbincore(bo, blkno); if (bp != NULL) { - int lockflags; /* * Buffer is in-core. If the buffer is not busy nor managed, * it must be on a queue. @@ -3890,8 +3912,10 @@ loop: /* We timed out or were interrupted. */ else if (error != 0) return (error); + +foundbuf_fastpath: /* If recursed, assume caller knows the rules. */ - else if (BUF_LOCKRECURSED(bp)) + if (BUF_LOCKRECURSED(bp)) goto end; /* @@ -3989,6 +4013,7 @@ loop: * buffer is also considered valid (not marked B_INVAL). */ BO_RUNLOCK(bo); +newbuf_unlocked: /* * If the user does not want us to create the buffer, bail out * here. Modified: head/sys/kern/vfs_subr.c == --- head/sys/kern/vfs_subr.cFri Jul 24 17:32:10 2020(r363481) +++ head/sys/kern/vfs_subr.cFri Jul 24 17:34:04 2020(r363482) @@ -234,6 +234,7 @@ static struct mtx __exclusive_cache_line vnode_list_mt struct nfs_public nfs_pub; static uma_zone_t buf_trie_zone; +static smr_t buf_trie_smr; /* Zone for allocation of new vnodes - used exclusively by getnewvnode() */ static uma_zone_t vnode_zone; @@ -491,17 +492,16 @@ static int vnsz2log; static void * buf_trie_alloc(struct pctrie *ptree) { - - return uma_zalloc(buf_trie_zone, M_NOWAIT); + return (uma_zalloc_smr(buf_trie_zone, M_NOWAIT)); } static void buf_trie_free(struct pctrie *ptree, void *node) { - - uma_zfree(buf_trie_zone, node); + uma_zfree_smr(buf_trie_zone, node); } -PCTRIE_DEFINE(BUF, buf, b_lblkno, buf_trie_alloc, buf_trie_free); +PCTRIE_DEFINE_SMR(BUF, buf, b_lblkno, buf_trie_alloc, buf_trie_free, +buf_trie_smr); /* * Initialize the vnode management data structures. @@ -675,7 +675,8 @@ vntblinit(void *dummy __unused) */ buf_trie_zone = uma_zcreate("BUF TRIE", pctrie_node_size(), NULL, NULL, pctrie_zone_init, NULL, UMA_ALIGN_PTR, - UMA_ZONE_NOFREE); + UMA_ZONE_NOFREE | UMA_ZONE_SMR); + buf_trie_smr = uma_zone_get_smr(buf_trie_zone); uma_prealloc(buf_trie_zone, nbuf); vnodes_created = counter_u64_alloc(M_WAITOK); @@ -2330,7 +2331,25 @@ gbincore(struct bufobj *bo, daddr_t lblkno) bp = BUF_PCTRIE_LOOKUP(&bo->bo_clean.bv_root, lblkno); if (bp != NULL) return (bp); - return BUF_PCTRIE_LOOKUP(&bo->bo_dirty.bv_root, lblkno); + return (BUF_PCTRIE_LOOKUP(&bo->bo_dirty.bv_root, lblkno)); +} + +/* + * Look up a buf using the buffe
svn commit: r363481 - in head/sys: kern sys
Author: cem Date: Fri Jul 24 17:32:10 2020 New Revision: 363481 URL: https://svnweb.freebsd.org/changeset/base/363481 Log: Use SMR to provide safe unlocked lookup for pctries from SMR zones Adapt r358130, for the almost identical vm_radix, to the pctrie subsystem. Like that change, the tree is kept correct for readers with store barriers and careful ordering. Existing locks serialize writers. Add a PCTRIE_DEFINE_SMR() wrapper that takes an additional smr_t parameter and instantiates a FOO_PCTRIE_LOOKUP_UNLOCKED() function, in addition to the usual definitions created by PCTRIE_DEFINE(). Interface consumers will be introduced in later commits. As future work, it might be nice to add vm_radix algorithms missing from generic pctrie to the pctrie interface, and then adapt vm_radix to use pctrie. Reported by: Attilio Reviewed by: markj Sponsored by: Isilon Differential Revision:https://reviews.freebsd.org/D25781 Modified: head/sys/kern/subr_pctrie.c head/sys/sys/pctrie.h Modified: head/sys/kern/subr_pctrie.c == --- head/sys/kern/subr_pctrie.c Fri Jul 24 17:28:24 2020(r363480) +++ head/sys/kern/subr_pctrie.c Fri Jul 24 17:32:10 2020(r363481) @@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* smr.h depends on struct thread. */ +#include +#include #ifdef DDB #include @@ -72,18 +75,27 @@ __FBSDID("$FreeBSD$"); #definePCTRIE_UNITLEVEL(lev) \ ((uint64_t)1 << ((lev) * PCTRIE_WIDTH)) +struct pctrie_node; +typedef SMR_POINTER(struct pctrie_node *) smr_pctnode_t; + struct pctrie_node { - uint64_t pn_owner; /* Owner of record. */ - uint16_t pn_count; /* Valid children. */ - uint16_t pn_clev; /* Current level. */ - void*pn_child[PCTRIE_COUNT];/* Child nodes. */ + uint64_tpn_owner; /* Owner of record. */ + uint16_tpn_count; /* Valid children. */ + uint8_t pn_clev;/* Current level. */ + int8_t pn_last;/* Zero last ptr. */ + smr_pctnode_t pn_child[PCTRIE_COUNT]; /* Child nodes. */ }; +enum pctrie_access { PCTRIE_SMR, PCTRIE_LOCKED, PCTRIE_UNSERIALIZED }; + +static __inline void pctrie_node_store(smr_pctnode_t *p, void *val, +enum pctrie_access access); + /* * Allocate a node. Pre-allocation should ensure that the request * will always be satisfied. */ -static __inline struct pctrie_node * +static struct pctrie_node * pctrie_node_get(struct pctrie *ptree, pctrie_alloc_t allocfn, uint64_t owner, uint16_t count, uint16_t clevel) { @@ -92,10 +104,20 @@ pctrie_node_get(struct pctrie *ptree, pctrie_alloc_t a node = allocfn(ptree); if (node == NULL) return (NULL); + + /* +* We want to clear the last child pointer after the final section +* has exited so lookup can not return false negatives. It is done +* here because it will be cache-cold in the dtor callback. +*/ + if (node->pn_last != 0) { + pctrie_node_store(&node->pn_child[node->pn_last - 1], NULL, + PCTRIE_UNSERIALIZED); + node->pn_last = 0; + } node->pn_owner = owner; node->pn_count = count; node->pn_clev = clevel; - return (node); } @@ -104,7 +126,7 @@ pctrie_node_get(struct pctrie *ptree, pctrie_alloc_t a */ static __inline void pctrie_node_put(struct pctrie *ptree, struct pctrie_node *node, -pctrie_free_t freefn) +pctrie_free_t freefn, int8_t last) { #ifdef INVARIANTS int slot; @@ -112,10 +134,14 @@ pctrie_node_put(struct pctrie *ptree, struct pctrie_no KASSERT(node->pn_count == 0, ("pctrie_node_put: node %p has %d children", node, node->pn_count)); - for (slot = 0; slot < PCTRIE_COUNT; slot++) - KASSERT(node->pn_child[slot] == NULL, - ("pctrie_node_put: node %p has a child", node)); + for (slot = 0; slot < PCTRIE_COUNT; slot++) { + if (slot == last) + continue; + KASSERT(smr_unserialized_load(&node->pn_child[slot], true) == + NULL, ("pctrie_node_put: node %p has a child", node)); + } #endif + node->pn_last = last + 1; freefn(ptree, node); } @@ -144,23 +170,58 @@ pctrie_trimkey(uint64_t index, uint16_t level) } /* - * Get the root node for a tree. + * Fetch a node pointer from a slot. */ static __inline struct pctrie_node * -pctrie_getroot(struct pctrie *ptree) +pctrie_node_load(smr_pctnode_t *p, smr_t smr, enum pctrie_access access) { + swi
svn commit: r363480 - head/sys/kern
Author: mjg Date: Fri Jul 24 17:28:24 2020 New Revision: 363480 URL: https://svnweb.freebsd.org/changeset/base/363480 Log: lockmgr: add missing 'continue' to account for spuriously failed fcmpset PR: 248245 Reported by: gbe Noted by: markj Fixes by: r363415 ("lockmgr: add adaptive spinning") Modified: head/sys/kern/kern_lock.c Modified: head/sys/kern/kern_lock.c == --- head/sys/kern/kern_lock.c Fri Jul 24 17:11:14 2020(r363479) +++ head/sys/kern/kern_lock.c Fri Jul 24 17:28:24 2020(r363480) @@ -836,6 +836,7 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struc if (x == LK_UNLOCKED) { if (atomic_fcmpset_acq_ptr(&lk->lk_lock, &x, tid)) break; + continue; } if ((flags & (LK_ADAPTIVE | LK_INTERLOCK)) == LK_ADAPTIVE) { if (lockmgr_xlock_adaptive(&lda, lk, &x)) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363479 - head/sys/cam/mmc
Author: manu Date: Fri Jul 24 17:11:14 2020 New Revision: 363479 URL: https://svnweb.freebsd.org/changeset/base/363479 Log: mmccam: Add some aliases for non-mmccam to mmccam transition A new tunable is present, kern.cam.sdda.mmcsd_compat to enable this feature or not (default is enabled) Modified: head/sys/cam/mmc/mmc_da.c Modified: head/sys/cam/mmc/mmc_da.c == --- head/sys/cam/mmc/mmc_da.c Fri Jul 24 16:58:13 2020(r363478) +++ head/sys/cam/mmc/mmc_da.c Fri Jul 24 17:11:14 2020(r363479) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -186,6 +187,13 @@ static void sdda_init_switch_part(struct cam_periph *p static int mmc_select_card(struct cam_periph *periph, union ccb *ccb, uint32_t rca); static inline uint32_t mmc_get_sector_size(struct cam_periph *periph) {return MMC_SECTOR_SIZE;} +static SYSCTL_NODE(_kern_cam, OID_AUTO, sdda, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, +"CAM Direct Access Disk driver"); + +static int sdda_mmcsd_compat = 1; +SYSCTL_INT(_kern_cam_sdda, OID_AUTO, mmcsd_compat, CTLFLAG_RDTUN, +&sdda_mmcsd_compat, 1, "Enable creation of mmcsd aliases."); + /* TODO: actually issue GET_TRAN_SETTINGS to get R/O status */ static inline bool sdda_get_read_only(struct cam_periph *periph, union ccb *start_ccb) { @@ -1604,6 +1612,9 @@ sdda_add_part(struct cam_periph *periph, u_int type, c part->disk->d_stripesize = 0; part->disk->d_fwsectors = 0; part->disk->d_fwheads = 0; + + if (sdda_mmcsd_compat) + disk_add_alias(part->disk, "mmcsd"); /* * Acquire a reference to the periph before we register with GEOM. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363478 - head/usr.sbin/rwhod
Author: jmallett Date: Fri Jul 24 16:58:13 2020 New Revision: 363478 URL: https://svnweb.freebsd.org/changeset/base/363478 Log: Remove reference to nlist(3) missed in SCCS revision 5.26 by mckusick when converting rwhod(8) to using kern.boottime ather than extracting the boot time from kernel memory directly. Reviewed by: imp Modified: head/usr.sbin/rwhod/rwhod.8 Modified: head/usr.sbin/rwhod/rwhod.8 == --- head/usr.sbin/rwhod/rwhod.8 Fri Jul 24 16:44:35 2020(r363477) +++ head/usr.sbin/rwhod/rwhod.8 Fri Jul 24 16:58:13 2020(r363478) @@ -215,15 +215,6 @@ format described above. .Pp Status messages are generated approximately once every 3 minutes. -The -.Nm -utility performs an -.Xr nlist 3 -on -.Pa /boot/kernel/kernel -every 30 minutes to guard against -the possibility that this file is not the system -image currently operating. .Sh SEE ALSO .Xr ruptime 1 , .Xr rwho 1 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363477 - stable/12/share/man/man4
Author: gbe (doc committer) Date: Fri Jul 24 16:44:35 2020 New Revision: 363477 URL: https://svnweb.freebsd.org/changeset/base/363477 Log: MFC r363287: iwm(4): Document limitations of the driver PR: 247874 Submitted by: Charles Ross Reviewed by: brueffer, markj Approved by: brueffer Differential Revision:https://reviews.freebsd.org/D25666 Modified: stable/12/share/man/man4/iwm.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/iwm.4 == --- stable/12/share/man/man4/iwm.4 Fri Jul 24 16:41:15 2020 (r363476) +++ stable/12/share/man/man4/iwm.4 Fri Jul 24 16:44:35 2020 (r363477) @@ -105,6 +105,12 @@ For more information on configuring this device, see This driver requires the firmware built with the .Nm iwmfw module to work. +.Pp +Currently, +.Nm +only supports 802.11b and 802.11g modes. +It will not associate to access points that are configured to operate only +in 802.11n or 802.11ac modes. .Sh EXAMPLES Join an existing BSS network (i.e., connect to an access point): .Bd -literal -offset indent ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363476 - stable/12/sbin/mount_nfs
Author: gbe (doc committer) Date: Fri Jul 24 16:41:15 2020 New Revision: 363476 URL: https://svnweb.freebsd.org/changeset/base/363476 Log: MFC r363288: mount_nfs(8): document alternate form of the gssname option PR: 238506 Submitted by: Greg Veldman Reviewed by: 0mp, bcr (mentor) Approved by: bcr (mentor) Differential Revision:https://reviews.freebsd.org/D25667 Modified: stable/12/sbin/mount_nfs/mount_nfs.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/mount_nfs/mount_nfs.8 == --- stable/12/sbin/mount_nfs/mount_nfs.8Fri Jul 24 15:04:34 2020 (r363475) +++ stable/12/sbin/mount_nfs/mount_nfs.8Fri Jul 24 16:41:15 2020 (r363476) @@ -157,7 +157,16 @@ should be specified without instance or domain and is .Dq "host" , .Dq "nfs" or -.Dq "root" . +.Dq "root" , +although the form +.Sm off +.Aq Ar service +@ +.Aq Ar fqdn +.Sm on +can also be used if the local system's +.Xr gethostname 3 +value does not match the host-based principal in the keytab. .It Cm hard Same as not specifying .Cm soft . ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363475 - head/share/man/man8
Author: 0mp (doc,ports committer) Date: Fri Jul 24 15:04:34 2020 New Revision: 363475 URL: https://svnweb.freebsd.org/changeset/base/363475 Log: Fix grammar issues and typos Reported by: ian MFC after:1 week Modified: head/share/man/man8/rc.subr.8 Modified: head/share/man/man8/rc.subr.8 == --- head/share/man/man8/rc.subr.8 Fri Jul 24 14:51:28 2020 (r363474) +++ head/share/man/man8/rc.subr.8 Fri Jul 24 15:04:34 2020 (r363475) @@ -239,9 +239,9 @@ argument is the .Xr basename 1 component of the path to the script located at .Pa /etc/rc.d -(scripts stored in other locations like +(scripts stored in other locations such as .Pa /usr/local/etc/rc.d -cannot be contolled with +cannot be controlled with .Ic force_depend currently). If the script fails for any reason it will output a warning ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363474 - stable/12/contrib/netcat
Author: markj Date: Fri Jul 24 14:51:28 2020 New Revision: 363474 URL: https://svnweb.freebsd.org/changeset/base/363474 Log: MFC r363084: Add a --sctp flag to nc. Modified: stable/12/contrib/netcat/nc.1 stable/12/contrib/netcat/netcat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/netcat/nc.1 == --- stable/12/contrib/netcat/nc.1 Fri Jul 24 14:17:37 2020 (r363473) +++ stable/12/contrib/netcat/nc.1 Fri Jul 24 14:51:28 2020 (r363474) @@ -41,6 +41,7 @@ .Op Fl I Ar length .Op Fl i Ar interval .Op Fl -no-tcpopt +.Op Fl -sctp .Op Fl O Ar length .Op Fl P Ar proxy_username .Op Fl p Ar source_port @@ -181,6 +182,8 @@ hostnames or ports. Disables the use of TCP options on the socket, by setting the boolean TCP_NOOPT socket option. +.It Fl -sctp +Use SCTP instead of the default option of TCP. .It Fl O Ar length Specifies the size of the TCP send buffer. .It Fl P Ar proxy_username Modified: stable/12/contrib/netcat/netcat.c == --- stable/12/contrib/netcat/netcat.c Fri Jul 24 14:17:37 2020 (r363473) +++ stable/12/contrib/netcat/netcat.c Fri Jul 24 14:51:28 2020 (r363474) @@ -88,6 +88,7 @@ int lflag; /* Bind to local port */ intNflag; /* shutdown() network socket */ intnflag; /* Don't do name look up */ intFreeBSD_Oflag; /* Do not use TCP options */ +intFreeBSD_sctp; /* Use SCTP */ char *Pflag; /* Proxy username */ char *pflag; /* Localport flag */ intrflag; /* Random ports flag */ @@ -153,6 +154,7 @@ main(int argc, char *argv[]) char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE]; struct option longopts[] = { { "no-tcpopt", no_argument,&FreeBSD_Oflag, 1 }, + { "sctp", no_argument,&FreeBSD_sctp, 1 }, { NULL, 0, NULL, 0 } }; @@ -310,6 +312,9 @@ main(int argc, char *argv[]) if (Tflag < 0 || Tflag > 255 || errstr || errno) errx(1, "illegal tos value %s", optarg); break; + case 0: + /* Long option. */ + break; default: usage(1); } @@ -340,6 +345,12 @@ main(int argc, char *argv[]) errx(1, "cannot use -z and -l"); if (!lflag && kflag) errx(1, "must use -l with -k"); + if (FreeBSD_sctp) { + if (uflag) + errx(1, "cannot use -u and --sctp"); + if (family == AF_UNIX) + errx(1, "cannot use -U and --sctp"); + } /* Get name of temporary socket for unix datagram client */ if ((family == AF_UNIX) && uflag && !lflag) { @@ -359,7 +370,8 @@ main(int argc, char *argv[]) memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = family; hints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; - hints.ai_protocol = uflag ? IPPROTO_UDP : IPPROTO_TCP; + hints.ai_protocol = uflag ? IPPROTO_UDP : + FreeBSD_sctp ? IPPROTO_SCTP : IPPROTO_TCP; if (nflag) hints.ai_flags |= AI_NUMERICHOST; } @@ -368,6 +380,9 @@ main(int argc, char *argv[]) if (uflag) errx(1, "no proxy support for UDP mode"); + if (FreeBSD_sctp) + errx(1, "no proxy support for SCTP mode"); + if (lflag) errx(1, "no proxy support for listen"); @@ -1330,6 +1345,7 @@ help(void) \t-NShutdown the network socket after EOF on stdin\n\ \t-nSuppress name/port resolutions\n\ \t--no-tcpopt Disable TCP options\n\ + \t--sctp\t SCTP mode\n\ \t-O length TCP send buffer length\n\ \t-P proxyuser\tUsername for proxy authentication\n\ \t-p port\t Specify local port for remote connects\n\ @@ -1348,7 +1364,7 @@ help(void) \t-zZero-I/O mode [used for scanning]\n\ Port numbers can be individual or ranges: lo-hi [inclusive]\n"); #ifdef IPSEC - fprintf(stderr, "See ipsec_set_policy(3) for -e argument format\n"); + fprintf(stderr, "\tSee ipsec_set_policy(3) for -e argument format\n"); #endif exit(1); } @@ -1388,6 +1404,7 @@ usage(int ret) #else "usage: nc [-46DdFhklNnrStUuvz] [-I length] [-i interval] [-O length]\n" #endi
Re: svn commit: r363473 - head/share/man/man8
On Fri, 2020-07-24 at 14:17 +, Mateusz Piotrowski wrote: > Author: 0mp (doc,ports committer) > Date: Fri Jul 24 14:17:37 2020 > New Revision: 363473 > URL: https://svnweb.freebsd.org/changeset/base/363473 > > [...] > @@ -237,8 +237,13 @@ The > .Ar name > argument is the > .Xr basename 1 > -component of the path to the script, usually > -.Pa /etc/rc.d/name . > +component of the path to the script located at > +.Pa /etc/rc.d > +(scripts stored in other locations like grammar: "like" should be "such as" > +.Pa /usr/local/etc/rc.d > +cannot be contolled with typo: controlled -- Ian ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363473 - head/share/man/man8
Author: 0mp (doc,ports committer) Date: Fri Jul 24 14:17:37 2020 New Revision: 363473 URL: https://svnweb.freebsd.org/changeset/base/363473 Log: Document that force_depend() supports only /etc/rc.d scripts Currently, force_depend() from rc.subr(8) does not support depending on scripts outside of /etc/rc.d (like /usr/local/etc/rc.d). The /etc/rc.d path is hard-coded into force_depend(). MFC after:1 week Modified: head/share/man/man8/rc.subr.8 Modified: head/share/man/man8/rc.subr.8 == --- head/share/man/man8/rc.subr.8 Fri Jul 24 13:23:32 2020 (r363472) +++ head/share/man/man8/rc.subr.8 Fri Jul 24 14:17:37 2020 (r363473) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 5, 2019 +.Dd July 24, 2020 .Dt RC.SUBR 8 .Os .Sh NAME @@ -237,8 +237,13 @@ The .Ar name argument is the .Xr basename 1 -component of the path to the script, usually -.Pa /etc/rc.d/name . +component of the path to the script located at +.Pa /etc/rc.d +(scripts stored in other locations like +.Pa /usr/local/etc/rc.d +cannot be contolled with +.Ic force_depend +currently). If the script fails for any reason it will output a warning and return with a return value of 1. If it was successful ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363472 - head/sys/vm
Author: mjg Date: Fri Jul 24 13:23:32 2020 New Revision: 363472 URL: https://svnweb.freebsd.org/changeset/base/363472 Log: vm: fix swap reservation leak and clean up surrounding code The code did not subtract from the global counter if per-uid reservation failed. Cleanup highlights: - load overcommit once - move per-uid manipulation to dedicated routines - don't fetch wire count if requested size is below the limit - convert return type from int to bool - ifdef the routines with _KERNEL to keep vm.h compilable by userspace Reviewed by: kib (previous version) Differential Revision:https://reviews.freebsd.org/D25787 Modified: head/sys/vm/swap_pager.c head/sys/vm/vm.h Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cFri Jul 24 08:40:04 2020(r363471) +++ head/sys/vm/swap_pager.cFri Jul 24 13:23:32 2020(r363472) @@ -202,101 +202,141 @@ sysctl_page_shift(SYSCTL_HANDLER_ARGS) return (sysctl_handle_64(oidp, &newval, 0, req)); } -int +static bool +swap_reserve_by_cred_rlimit(u_long pincr, struct ucred *cred, int oc) +{ + struct uidinfo *uip; + u_long prev; + + uip = cred->cr_ruidinfo; + + prev = atomic_fetchadd_long(&uip->ui_vmsize, pincr); + if ((oc & SWAP_RESERVE_RLIMIT_ON) != 0 && + prev + pincr > lim_cur(curthread, RLIMIT_SWAP) && + priv_check(curthread, PRIV_VM_SWAP_NORLIMIT) != 0) { + prev = atomic_fetchadd_long(&uip->ui_vmsize, -pincr); + KASSERT(prev >= pincr, ("negative vmsize for uid = %d\n", uip->ui_uid)); + return (false); + } + return (true); +} + +static void +swap_release_by_cred_rlimit(u_long pdecr, struct ucred *cred) +{ + struct uidinfo *uip; +#ifdef INVARIANTS + u_long prev; +#endif + + uip = cred->cr_ruidinfo; + +#ifdef INVARIANTS + prev = atomic_fetchadd_long(&uip->ui_vmsize, -pdecr); + KASSERT(prev >= pdecr, ("negative vmsize for uid = %d\n", uip->ui_uid)); +#else + atomic_subtract_long(&uip->ui_vmsize, pdecr); +#endif +} + +static void +swap_reserve_force_rlimit(u_long pincr, struct ucred *cred) +{ + struct uidinfo *uip; + + uip = cred->cr_ruidinfo; + atomic_add_long(&uip->ui_vmsize, pincr); +} + +bool swap_reserve(vm_ooffset_t incr) { return (swap_reserve_by_cred(incr, curthread->td_ucred)); } -int +bool swap_reserve_by_cred(vm_ooffset_t incr, struct ucred *cred) { u_long r, s, prev, pincr; - int res, error; +#ifdef RACCT + int error; +#endif + int oc; static int curfail; static struct timeval lastfail; - struct uidinfo *uip; - uip = cred->cr_ruidinfo; - KASSERT((incr & PAGE_MASK) == 0, ("%s: incr: %ju & PAGE_MASK", __func__, (uintmax_t)incr)); #ifdef RACCT - if (racct_enable) { + if (RACCT_ENABLED()) { PROC_LOCK(curproc); error = racct_add(curproc, RACCT_SWAP, incr); PROC_UNLOCK(curproc); if (error != 0) - return (0); + return (false); } #endif pincr = atop(incr); - res = 0; prev = atomic_fetchadd_long(&swap_reserved, pincr); r = prev + pincr; - if (overcommit & SWAP_RESERVE_ALLOW_NONWIRED) { - s = vm_cnt.v_page_count - vm_cnt.v_free_reserved - + s = swap_total; + oc = atomic_load_int(&overcommit); + if (r > s && (oc & SWAP_RESERVE_ALLOW_NONWIRED) != 0) { + s += vm_cnt.v_page_count - vm_cnt.v_free_reserved - vm_wire_count(); - } else - s = 0; - s += swap_total; - if ((overcommit & SWAP_RESERVE_FORCE_ON) == 0 || r <= s || - (error = priv_check(curthread, PRIV_VM_SWAP_NOQUOTA)) == 0) { - res = 1; - } else { + } + if ((oc & SWAP_RESERVE_FORCE_ON) != 0 && r > s && + priv_check(curthread, PRIV_VM_SWAP_NOQUOTA) != 0) { prev = atomic_fetchadd_long(&swap_reserved, -pincr); - if (prev < pincr) - panic("swap_reserved < incr on overcommit fail"); + KASSERT(prev >= pincr, ("swap_reserved < incr on overcommit fail")); + goto out_error; } - if (res) { - prev = atomic_fetchadd_long(&uip->ui_vmsize, pincr); - if ((overcommit & SWAP_RESERVE_RLIMIT_ON) != 0 && - prev + pincr > lim_cur(curthread, RLIMIT_SWAP) && - priv_check(curthread, PRIV_VM_SWAP_NORLIMIT)) { - res = 0; - prev = atomic_fetchadd_long(&uip->ui_vmsize, -pincr); - if (prev < pincr) - panic("uip->ui_vmsize < incr on overcommit fail"); - } + +
svn commit: r363471 - in head/sys: amd64/conf arm64/conf i386/conf powerpc/conf riscv/conf
Author: arichardson Date: Fri Jul 24 08:40:04 2020 New Revision: 363471 URL: https://svnweb.freebsd.org/changeset/base/363471 Log: Include TMPFS in all the GENERIC kernel configs Being able to use tmpfs without kernel modules is very useful when building small MFS_ROOT kernels without a real file system. Including TMPFS also matches arm/GENERIC and the MIPS std.MALTA configs. Compiling TMPFS only adds 4 .c files so this should not make much of a difference to NO_MODULES build times (as we do for our minimal RISC-V images). Reviewed By: br (earlier version for riscv), brooks, emaste Differential Revision: https://reviews.freebsd.org/D25317 Modified: head/sys/amd64/conf/GENERIC head/sys/arm64/conf/GENERIC head/sys/i386/conf/GENERIC head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 head/sys/riscv/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC == --- head/sys/amd64/conf/GENERIC Fri Jul 24 02:19:00 2020(r363470) +++ head/sys/amd64/conf/GENERIC Fri Jul 24 08:40:04 2020(r363471) @@ -51,6 +51,7 @@ options MSDOSFS # MSDOS Filesystem optionsCD9660 # ISO 9660 Filesystem optionsPROCFS # Process filesystem (requires PSEUDOFS) optionsPSEUDOFS# Pseudo-filesystem framework +optionsTMPFS # Efficient memory filesystem optionsGEOM_RAID # Soft RAID functionality. optionsGEOM_LABEL # Provides labelization optionsEFIRT # EFI Runtime Services support Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Fri Jul 24 02:19:00 2020(r363470) +++ head/sys/arm64/conf/GENERIC Fri Jul 24 08:40:04 2020(r363471) @@ -50,6 +50,7 @@ options MSDOSFS # MSDOS Filesystem optionsCD9660 # ISO 9660 Filesystem optionsPROCFS # Process filesystem (requires PSEUDOFS) optionsPSEUDOFS# Pseudo-filesystem framework +optionsTMPFS # Efficient memory filesystem optionsGEOM_RAID # Soft RAID functionality. optionsGEOM_LABEL # Provides labelization optionsCOMPAT_FREEBSD32# Compatible with FreeBSD/arm Modified: head/sys/i386/conf/GENERIC == --- head/sys/i386/conf/GENERIC Fri Jul 24 02:19:00 2020(r363470) +++ head/sys/i386/conf/GENERIC Fri Jul 24 08:40:04 2020(r363471) @@ -50,6 +50,7 @@ options MSDOSFS # MSDOS Filesystem optionsCD9660 # ISO 9660 Filesystem optionsPROCFS # Process filesystem (requires PSEUDOFS) optionsPSEUDOFS# Pseudo-filesystem framework +optionsTMPFS # Efficient memory filesystem optionsGEOM_RAID # Soft RAID functionality. optionsGEOM_LABEL # Provides labelization optionsCOMPAT_FREEBSD4 # Compatible with FreeBSD4 Modified: head/sys/powerpc/conf/GENERIC == --- head/sys/powerpc/conf/GENERIC Fri Jul 24 02:19:00 2020 (r363470) +++ head/sys/powerpc/conf/GENERIC Fri Jul 24 08:40:04 2020 (r363471) @@ -57,6 +57,7 @@ options MSDOSFS #MSDOS Filesystem optionsCD9660 #ISO 9660 Filesystem optionsPROCFS #Process filesystem (requires PSEUDOFS) optionsPSEUDOFS#Pseudo-filesystem framework +optionsTMPFS #Efficient memory filesystem optionsGEOM_PART_APM #Apple Partition Maps. optionsGEOM_PART_GPT #GUID Partition Tables. optionsGEOM_LABEL #Provides labelization Modified: head/sys/powerpc/conf/GENERIC64 == --- head/sys/powerpc/conf/GENERIC64 Fri Jul 24 02:19:00 2020 (r363470) +++ head/sys/powerpc/conf/GENERIC64 Fri Jul 24 08:40:04 2020 (r363471) @@ -62,6 +62,7 @@ options MSDOSFS #MSDOS Filesystem optionsCD9660 #ISO 9660 Filesystem optionsPROCFS #Process filesystem (requires PSEUDOFS) optionsPSEUDOFS#Pseudo-filesystem framework +optionsTMPFS #Efficient memory filesystem optionsGEOM_PART_APM #Apple Partition Maps. optionsGEOM_PART_GPT #GUID Partition Tables. optionsGEOM_LABEL #Provides labelizat