Re: svn commit: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys
On Wed, Nov 04, 2020 at 09:18:52PM +, Mateusz Guzik wrote: > New Revision: 367343 > URL: https://svnweb.freebsd.org/changeset/base/367343 > > Log: > zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros > > They are expected to fail only in corner cases. > > Modified: > head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h > head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Since my earlier email was ignored, I'd take this chance to ask again: why Linux-specific bits present in the head and had to be updated like in this commit? They shouldn't have made past the vendor branch, no? ./danfe ___ 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: r367362 - in head/sys: compat/linprocfs fs/pseudofs
Author: cem Date: Thu Nov 5 06:48:51 2020 New Revision: 367362 URL: https://svnweb.freebsd.org/changeset/base/367362 Log: Add sbuf streaming mode to pseudofs(9), use in linprocfs(5) Add a pseudofs node flag 'PFS_AUTODRAIN', which automatically emits sbuf contents to the caller when the sbuf buffer fills. This is only permissible if the corresponding PFS node fill function can sleep whenever it appends to the sbuf. linprocfs' /proc/self/maps node happens to meet this requirement. Streaming out the file as it is composed avoids truncating the output and also avoids preallocating a very large buffer. Reviewed by: markj; earlier version: emaste, kib, trasz Differential Revision:https://reviews.freebsd.org/D27047 Modified: head/sys/compat/linprocfs/linprocfs.c head/sys/fs/pseudofs/pseudofs.h head/sys/fs/pseudofs/pseudofs_vnops.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Thu Nov 5 04:19:48 2020 (r367361) +++ head/sys/compat/linprocfs/linprocfs.c Thu Nov 5 06:48:51 2020 (r367362) @@ -1252,10 +1252,6 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) *name ? " " : " ", name ); - if (error == -1) { - linux_msg(td, "cannot fill /proc/self/maps; " - "consider bumping PFS_MAXBUFSIZ"); - } if (freename) free(freename, M_TEMP); vm_map_lock_read(map); @@ -1890,7 +1886,7 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_link(dir, "exe", &procfs_doprocfile, NULL, &procfs_notsystem, NULL, 0); pfs_create_file(dir, "maps", &linprocfs_doprocmaps, - NULL, NULL, NULL, PFS_RD); + NULL, NULL, NULL, PFS_RD | PFS_AUTODRAIN); pfs_create_file(dir, "mem", &linprocfs_doprocmem, procfs_attr_rw, &procfs_candebug, NULL, PFS_RDWR | PFS_RAW); pfs_create_file(dir, "mounts", &linprocfs_domtab, Modified: head/sys/fs/pseudofs/pseudofs.h == --- head/sys/fs/pseudofs/pseudofs.h Thu Nov 5 04:19:48 2020 (r367361) +++ head/sys/fs/pseudofs/pseudofs.h Thu Nov 5 06:48:51 2020 (r367362) @@ -78,6 +78,7 @@ typedef enum { #define PFS_RAW(PFS_RAWRD|PFS_RAWWR) #define PFS_PROCDEP0x0010 /* process-dependent */ #define PFS_NOWAIT 0x0020 /* allow malloc to fail */ +#define PFS_AUTODRAIN 0x0040 /* sbuf_print can sleep to drain */ /* * Data structures Modified: head/sys/fs/pseudofs/pseudofs_vnops.c == --- head/sys/fs/pseudofs/pseudofs_vnops.c Thu Nov 5 04:19:48 2020 (r367361) +++ head/sys/fs/pseudofs/pseudofs_vnops.c Thu Nov 5 06:48:51 2020 (r367362) @@ -623,6 +623,50 @@ pfs_open(struct vop_open_args *va) PFS_RETURN (0); } +struct sbuf_seek_helper { + off_t skip_bytes; + struct uio *uio; +}; + +static int +pfs_sbuf_uio_drain(void *arg, const char *data, int len) +{ + struct sbuf_seek_helper *ssh; + struct uio *uio; + int error, skipped; + + ssh = arg; + uio = ssh->uio; + skipped = 0; + + /* Need to discard first uio_offset bytes. */ + if (ssh->skip_bytes > 0) { + if (ssh->skip_bytes >= len) { + ssh->skip_bytes -= len; + return (len); + } + + data += ssh->skip_bytes; + len -= ssh->skip_bytes; + skipped = ssh->skip_bytes; + ssh->skip_bytes = 0; + } + + error = uiomove(__DECONST(void *, data), len, uio); + if (error != 0) + return (-error); + + /* +* The fill function has more to emit, but the reader is finished. +* This is similar to the truncated read case for non-draining PFS +* sbufs, and should be handled appropriately in fill-routines. +*/ + if (uio->uio_resid == 0) + return (-ENOBUFS); + + return (skipped + len); +} + /* * Read from a file */ @@ -636,7 +680,8 @@ pfs_read(struct vop_read_args *va) struct proc *proc; struct sbuf *sb = NULL; int error, locked; - off_t buflen; + off_t buflen, buflim; + struct sbuf_seek_helper ssh; PFS_TRACE(("%s", pn->pn_name)); pfs_assert_not_owned(pn); @@ -678,16 +723,30 @@ pfs_read(struct vop_read_args *va) error = EINVAL; goto ret; } - buflen = uio->uio_offset + uio->uio_resid; - if (buflen > PFS_MAXBUFSIZ) - buflen = PFS_MAXBUFSIZ; + buflen = uio->uio_offset + uio->uio_resid + 1; + if (pn->p
svn commit: r367361 - head/sys/kern
Author: kevans Date: Thu Nov 5 04:19:48 2020 New Revision: 367361 URL: https://svnweb.freebsd.org/changeset/base/367361 Log: imgact_binmisc: fix up some minor nits - Removed a bunch of redundant headers - Don't explicitly initialize to 0 - The !error check prior to setting imgp->interpreter_name is redundant, all error paths should and do return or go to 'done'. We have larger problems otherwise. Modified: head/sys/kern/imgact_binmisc.c Modified: head/sys/kern/imgact_binmisc.c == --- head/sys/kern/imgact_binmisc.c Thu Nov 5 03:25:23 2020 (r367360) +++ head/sys/kern/imgact_binmisc.c Thu Nov 5 04:19:48 2020 (r367361) @@ -29,17 +29,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include #include #include #include #include -#include #include #include #include +#include #include #include @@ -97,7 +94,7 @@ MALLOC_DEFINE(M_BINMISC, KMOD_NAME, "misc binary image static SLIST_HEAD(, imgact_binmisc_entry) interpreter_list = SLIST_HEAD_INITIALIZER(interpreter_list); -static int interp_list_entry_count = 0; +static int interp_list_entry_count; static struct sx interp_list_sx; @@ -703,8 +700,7 @@ imgact_binmisc_exec(struct image_params *imgp) *d = '\0'; sx_sunlock(&interp_list_sx); - if (!error) - imgp->interpreter_name = imgp->args->begin_argv; + imgp->interpreter_name = imgp->args->begin_argv; done: if (sname) ___ 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: r367360 - head/sys/contrib/openzfs/module/zfs
Author: mjg Date: Thu Nov 5 03:25:23 2020 New Revision: 367360 URL: https://svnweb.freebsd.org/changeset/base/367360 Log: zfs: lz4: add optional kmem_alloc support lz4 port from illumos to Linux added a 16KB per-CPU cache to accommodate for the missing 16KB malloc. FreeBSD supports this size, making the extra cache harmful as it can't share buckets. Modified: head/sys/contrib/openzfs/module/zfs/lz4.c Modified: head/sys/contrib/openzfs/module/zfs/lz4.c == --- head/sys/contrib/openzfs/module/zfs/lz4.c Thu Nov 5 02:57:40 2020 (r367359) +++ head/sys/contrib/openzfs/module/zfs/lz4.c Thu Nov 5 03:25:23 2020 (r367360) @@ -44,7 +44,8 @@ static int LZ4_compressCtx(void *ctx, const char *sour static int LZ4_compress64kCtx(void *ctx, const char *source, char *dest, int isize, int osize); -static kmem_cache_t *lz4_cache; +static void *lz4_alloc(int flags); +static void lz4_free(void *ctx); /*ARGSUSED*/ size_t @@ -838,8 +839,7 @@ real_LZ4_compress(const char *source, char *dest, int void *ctx; int result; - ASSERT(lz4_cache != NULL); - ctx = kmem_cache_alloc(lz4_cache, KM_SLEEP); + ctx = lz4_alloc(KM_SLEEP); /* * out of kernel memory, gently fall through - this will disable @@ -855,7 +855,7 @@ real_LZ4_compress(const char *source, char *dest, int else result = LZ4_compressCtx(ctx, source, dest, isize, osize); - kmem_cache_free(lz4_cache, ctx); + lz4_free(ctx); return (result); } @@ -1014,6 +1014,23 @@ LZ4_uncompress_unknownOutputSize(const char *source, c return (-1); } +#ifdef __FreeBSD__ +/* + * FreeBSD has 4, 8 and 16 KB malloc zones which can be used here. + * Should struct refTables get resized this may need to be revisited, hence + * compiler-time asserts. + */ +_Static_assert(sizeof(struct refTables) <= 16384, +"refTables too big for malloc"); +_Static_assert((sizeof(struct refTables) % 4096) == 0, +"refTables not a multiple of page size"); +#else +#define ZFS_LZ4_USE_CACHE +#endif + +#ifdef ZFS_LZ4_USE_CACHE +static kmem_cache_t *lz4_cache; + void lz4_init(void) { @@ -1029,3 +1046,39 @@ lz4_fini(void) lz4_cache = NULL; } } + +static void * +lz4_alloc(int flags) +{ + ASSERT(lz4_cache != NULL); + return (kmem_cache_alloc(lz4_cache, flags)); +} + +static void +lz4_free(void *ctx) +{ + kmem_cache_free(lz4_cache, ctx); +} +#else +void +lz4_init(void) +{ +} + +void +lz4_fini(void) +{ +} + +static void * +lz4_alloc(int flags) +{ + return (kmem_alloc(sizeof (struct refTables), flags)); +} + +static void +lz4_free(void *ctx) +{ + kmem_free(ctx, sizeof (struct refTables)); +} +#endif ___ 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: r367359 - stable/12/sys/dev/pci
Author: mav Date: Thu Nov 5 02:57:40 2020 New Revision: 367359 URL: https://svnweb.freebsd.org/changeset/base/367359 Log: MFC r364038: Enable hw.pci.enable_aspm tunable by default. While effects on power saving is only a guess, effects on hot-plug are clearly visible. Lets try to enable it and see what happen. Modified: stable/12/sys/dev/pci/pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/pci/pci.c == --- stable/12/sys/dev/pci/pci.c Thu Nov 5 02:12:33 2020(r367358) +++ stable/12/sys/dev/pci/pci.c Thu Nov 5 02:57:40 2020(r367359) @@ -411,7 +411,7 @@ static int pci_enable_ari = 1; SYSCTL_INT(_hw_pci, OID_AUTO, enable_ari, CTLFLAG_RDTUN, &pci_enable_ari, 0, "Enable support for PCIe Alternative RID Interpretation"); -int pci_enable_aspm; +int pci_enable_aspm = 1; SYSCTL_INT(_hw_pci, OID_AUTO, enable_aspm, CTLFLAG_RDTUN, &pci_enable_aspm, 0, "Enable support for PCIe Active State Power Management"); ___ 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: r367358 - head/sys/kern
Author: mjg Date: Thu Nov 5 02:12:33 2020 New Revision: 367358 URL: https://svnweb.freebsd.org/changeset/base/367358 Log: fd: make all f_count uses go through refcount_* Modified: head/sys/kern/kern_descrip.c head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/kern_descrip.c == --- head/sys/kern/kern_descrip.cThu Nov 5 02:12:08 2020 (r367357) +++ head/sys/kern/kern_descrip.cThu Nov 5 02:12:33 2020 (r367358) @@ -2863,7 +2863,7 @@ fget_unlocked_seq(struct filedesc *fdp, int fd, cap_ri * This re-read is not any more racy than using the * return value from fcmpset. */ - if (fp->f_count != 0) + if (refcount_load(&fp->f_count) != 0) return (EBADF); /* * Force a reload. Other thread could reallocate the @@ -3833,7 +3833,7 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS) xf.xf_data = (uintptr_t)fp->f_data; xf.xf_vnode = (uintptr_t)fp->f_vnode; xf.xf_type = (uintptr_t)fp->f_type; - xf.xf_count = fp->f_count; + xf.xf_count = refcount_load(&fp->f_count); xf.xf_msgcount = 0; xf.xf_offset = foffset_get(fp); xf.xf_flag = fp->f_flag; @@ -3916,7 +3916,7 @@ export_file_to_kinfo(struct file *fp, int fd, cap_righ else cap_rights_init_zero(&kif->kf_cap_rights); kif->kf_fd = fd; - kif->kf_ref_count = fp->f_count; + kif->kf_ref_count = refcount_load(&fp->f_count); kif->kf_offset = foffset_get(fp); /* @@ -4446,7 +4446,7 @@ db_print_file(struct file *fp, int header) p = file_to_first_proc(fp); db_printf("%*p %6s %*p %08x %04x %5d %6d %*p %5d %s\n", XPTRWIDTH, fp, file_type_to_name(fp->f_type), XPTRWIDTH, fp->f_data, - fp->f_flag, 0, fp->f_count, 0, XPTRWIDTH, fp->f_vnode, + fp->f_flag, 0, refcount_load(&fp->f_count), 0, XPTRWIDTH, fp->f_vnode, p != NULL ? p->p_pid : -1, p != NULL ? p->p_comm : "-"); #undef XPTRWIDTH Modified: head/sys/kern/uipc_usrreq.c == --- head/sys/kern/uipc_usrreq.c Thu Nov 5 02:12:08 2020(r367357) +++ head/sys/kern/uipc_usrreq.c Thu Nov 5 02:12:33 2020(r367358) @@ -2651,7 +2651,7 @@ unp_gc(__unused void *arg, int pending) * NULL. */ if (f != NULL && unp->unp_msgcount != 0 && - f->f_count == unp->unp_msgcount) { + refcount_load(&f->f_count) == unp->unp_msgcount) { LIST_INSERT_HEAD(&unp_deadhead, unp, unp_dead); unp->unp_gcflag |= UNPGC_DEAD; unp->unp_gcrefs = unp->unp_msgcount; @@ -2714,7 +2714,7 @@ unp_gc(__unused void *arg, int pending) unp->unp_gcflag &= ~UNPGC_DEAD; f = unp->unp_file; if (unp->unp_msgcount == 0 || f == NULL || - f->f_count != unp->unp_msgcount || + refcount_load(&f->f_count) != unp->unp_msgcount || !fhold(f)) continue; unref[total++] = f; ___ 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: r367357 - head/sys/kern
Author: mjg Date: Thu Nov 5 02:12:08 2020 New Revision: 367357 URL: https://svnweb.freebsd.org/changeset/base/367357 Log: fd: hide _fdrop 0 count check behind INVARIANTS While here use refcount_load and make sure to report the tested value. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c == --- head/sys/kern/kern_descrip.cThu Nov 5 00:52:52 2020 (r367356) +++ head/sys/kern/kern_descrip.cThu Nov 5 02:12:08 2020 (r367357) @@ -3219,9 +3219,13 @@ int __noinline _fdrop(struct file *fp, struct thread *td) { int error; +#ifdef INVARIANTS + int count; - if (fp->f_count != 0) - panic("fdrop: count %d", fp->f_count); + count = refcount_load(&fp->f_count); + if (count != 0) + panic("fdrop: fp %p count %d", fp, count); +#endif error = fo_close(fp, td); atomic_subtract_int(&openfiles, 1); crfree(fp->f_cred); ___ 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: r367356 - head/sys/riscv/riscv
Author: mhorne Date: Thu Nov 5 00:52:52 2020 New Revision: 367356 URL: https://svnweb.freebsd.org/changeset/base/367356 Log: riscv: set kernel_pmap hart mask more precisely In pmap_bootstrap(), we fill kernel_pmap->pm_active since it is invariably active on all harts. However, this marks it as active even for harts that don't exist in the system, which can cause issue when the mask is passed to the SBI firmware via sbi_remote_sfence_vma(). Specifically, the SBI spec allows SBI_ERR_INVALID_PARAM to be returned when an invalid hart is set in the mask. The latest version of OpenSBI does not have this issue, but v0.6 does, and this is triggering a recently added KASSERT in CI. Switch to only setting bits in pm_active for harts that enter the system. Reported by: Jenkins Reviewed by: markj Differential Revision:https://reviews.freebsd.org/D27080 Modified: head/sys/riscv/riscv/mp_machdep.c head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/mp_machdep.c == --- head/sys/riscv/riscv/mp_machdep.c Wed Nov 4 23:29:27 2020 (r367355) +++ head/sys/riscv/riscv/mp_machdep.c Thu Nov 5 00:52:52 2020 (r367356) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -265,6 +266,9 @@ init_secondary(uint64_t hart) /* Enable external (PLIC) interrupts */ csr_set(sie, SIE_SEIE); + + /* Activate this hart in the kernel pmap. */ + CPU_SET_ATOMIC(hart, &kernel_pmap->pm_active); /* Activate process 0's pmap. */ pmap_activate_boot(vmspace_pmap(proc0.p_vmspace)); Modified: head/sys/riscv/riscv/pmap.c == --- head/sys/riscv/riscv/pmap.c Wed Nov 4 23:29:27 2020(r367355) +++ head/sys/riscv/riscv/pmap.c Thu Nov 5 00:52:52 2020(r367356) @@ -573,7 +573,12 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart, rw_init(&pvh_global_lock, "pmap pv global"); - CPU_FILL(&kernel_pmap->pm_active); + /* +* Set the current CPU as active in the kernel pmap. Secondary cores +* will add themselves later in init_secondary(). The SBI firmware +* may rely on this mask being precise, so CPU_FILL() is not used. +*/ + CPU_SET(PCPU_GET(hart), &kernel_pmap->pm_active); /* Assume the address we were loaded to is a valid physical address. */ min_pa = max_pa = kernstart; ___ 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: r367355 - head/sys/mips/mips
Author: jhibbits Date: Wed Nov 4 23:29:27 2020 New Revision: 367355 URL: https://svnweb.freebsd.org/changeset/base/367355 Log: Fix UMA alignment for COP2 context structure. UMA alignment needs specified as (power-of-2) - 1, not power-of-2. Discussed with: gonzo MFC after:3 days Modified: head/sys/mips/mips/octeon_cop2.c Modified: head/sys/mips/mips/octeon_cop2.c == --- head/sys/mips/mips/octeon_cop2.cWed Nov 4 23:26:15 2020 (r367354) +++ head/sys/mips/mips/octeon_cop2.cWed Nov 4 23:29:27 2020 (r367355) @@ -46,7 +46,7 @@ octeon_cop2_init(void* dummy) printf("Create COP2 context zone\n"); ctxzone = uma_zcreate("COP2 context", sizeof(struct octeon_cop2_state), - NULL, NULL, NULL, NULL, 8, 0); + NULL, NULL, NULL, NULL, UMA_ALIGN_LONG, 0); } struct octeon_cop2_state * ___ 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: r367354 - head
Author: jmg Date: Wed Nov 4 23:26:15 2020 New Revision: 367354 URL: https://svnweb.freebsd.org/changeset/base/367354 Log: fix the docs, this was always wrong... In some cases, DISTDIR is set automatically by tools via /etc/make.conf, so remind people (me) where to find where it's set.. It would be nice for someone to document what DISTDIR is better than: where the file for a distribution gets installed Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Wed Nov 4 23:17:41 2020(r367353) +++ head/Makefile.inc1 Wed Nov 4 23:26:15 2020(r367354) @@ -25,7 +25,8 @@ # LOCAL_XTOOL_DIRS="list of dirs" to add additional dirs to the # cross-tools target # METALOG="path to metadata log" to write permission and ownership -# when NO_ROOT is set. (default: ${DESTDIR}/METALOG) +# when NO_ROOT is set. (default: ${DESTDIR}/${DISTDIR}/METALOG, +# check /etc/make.conf for DISTDIR) # TARGET="machine" to crossbuild world for a different machine type # TARGET_ARCH= may be required when a TARGET supports multiple endians # BUILDENV_SHELL= shell to launch for the buildenv target (def:${SHELL}) ___ 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: r367353 - head/sys/kern
Author: mjg Date: Wed Nov 4 23:17:41 2020 New Revision: 367353 URL: https://svnweb.freebsd.org/changeset/base/367353 Log: pipe: whitespace nit in previous Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c == --- head/sys/kern/sys_pipe.cWed Nov 4 23:11:54 2020(r367352) +++ head/sys/kern/sys_pipe.cWed Nov 4 23:17:41 2020(r367353) @@ -1468,7 +1468,7 @@ pipe_poll(struct file *fp, int events, struct ucred *a rpipe->pipe_state |= PIPE_SEL; } - if ((fp->f_flag & FWRITE)!= 0) { + if ((fp->f_flag & FWRITE) != 0) { selrecord(td, &wpipe->pipe_sel); if (SEL_WAITING(&wpipe->pipe_sel)) wpipe->pipe_state |= PIPE_SEL; ___ 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: r367352 - head/sys/kern
Author: mjg Date: Wed Nov 4 23:11:54 2020 New Revision: 367352 URL: https://svnweb.freebsd.org/changeset/base/367352 Log: pipe: fix POLLHUP handling if no events were specified Linux allows polling without any events specified and it happens to be the case in FreeBSD as well. POLLHUP has to be delivered regardless of the event mask and this works fine if the condition is already present. However, if it is missing, selrecord is only called if the eventmask has relevant bits set. This in particular leads to a conditon where pipe_poll can return 0 events and neglect to selrecord, while kern_poll takes it as an indication it has to go to sleep, but then there is nobody to wake it up. While the problem seems systemic to *_poll handlers the least we can do is fix it up for pipes. Reported by: Jeremie Galarneau Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D27094 Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c == --- head/sys/kern/sys_pipe.cWed Nov 4 22:41:54 2020(r367351) +++ head/sys/kern/sys_pipe.cWed Nov 4 23:11:54 2020(r367352) @@ -1458,13 +1458,17 @@ pipe_poll(struct file *fp, int events, struct ucred *a } if (revents == 0) { - if (fp->f_flag & FREAD && events & (POLLIN | POLLRDNORM)) { + /* +* Add ourselves regardless of eventmask as we have to return +* POLLHUP even if it was not asked for. +*/ + if ((fp->f_flag & FREAD) != 0) { selrecord(td, &rpipe->pipe_sel); if (SEL_WAITING(&rpipe->pipe_sel)) rpipe->pipe_state |= PIPE_SEL; } - if (fp->f_flag & FWRITE && events & (POLLOUT | POLLWRNORM)) { + if ((fp->f_flag & FWRITE)!= 0) { selrecord(td, &wpipe->pipe_sel); if (SEL_WAITING(&wpipe->pipe_sel)) wpipe->pipe_state |= PIPE_SEL; ___ 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: r367351 - head/tests/sys/opencrypto
Author: jkim Date: Wed Nov 4 22:41:54 2020 New Revision: 367351 URL: https://svnweb.freebsd.org/changeset/base/367351 Log: Make the tests work without COMPAT_FREEBSD12 in kernel. sysctl 'kern.cryptodevallowsoft' was renamed to 'kern.crypto.allow_soft' in r359374 and the prevous one is only available in kernel built with "options COMPAT_FREEBSD12". Modified: head/tests/sys/opencrypto/blake2_test.c head/tests/sys/opencrypto/poly1305_test.c head/tests/sys/opencrypto/runtests.sh Modified: head/tests/sys/opencrypto/blake2_test.c == --- head/tests/sys/opencrypto/blake2_test.c Wed Nov 4 22:29:01 2020 (r367350) +++ head/tests/sys/opencrypto/blake2_test.c Wed Nov 4 22:41:54 2020 (r367351) @@ -185,14 +185,14 @@ test_blake2s_vectors(const char *devname, const char * ATF_TC_WITHOUT_HEAD(blake2b_vectors); ATF_TC_BODY(blake2b_vectors, tc) { - ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + ATF_REQUIRE_SYSCTL_INT("kern.crypto.allow_soft", 1); test_blake2b_vectors("cryptosoft0", "nexus/cryptosoft"); } ATF_TC_WITHOUT_HEAD(blake2s_vectors); ATF_TC_BODY(blake2s_vectors, tc) { - ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + ATF_REQUIRE_SYSCTL_INT("kern.crypto.allow_soft", 1); test_blake2s_vectors("cryptosoft0", "nexus/cryptosoft"); } @@ -200,14 +200,14 @@ ATF_TC_BODY(blake2s_vectors, tc) ATF_TC_WITHOUT_HEAD(blake2b_vectors_x86); ATF_TC_BODY(blake2b_vectors_x86, tc) { - ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + ATF_REQUIRE_SYSCTL_INT("kern.crypto.allow_soft", 1); test_blake2b_vectors("blaketwo0", "nexus/blake2"); } ATF_TC_WITHOUT_HEAD(blake2s_vectors_x86); ATF_TC_BODY(blake2s_vectors_x86, tc) { - ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + ATF_REQUIRE_SYSCTL_INT("kern.crypto.allow_soft", 1); test_blake2s_vectors("blaketwo0", "nexus/blake2"); } #endif Modified: head/tests/sys/opencrypto/poly1305_test.c == --- head/tests/sys/opencrypto/poly1305_test.c Wed Nov 4 22:29:01 2020 (r367350) +++ head/tests/sys/opencrypto/poly1305_test.c Wed Nov 4 22:41:54 2020 (r367351) @@ -390,7 +390,7 @@ test_rfc7539_poly1305_vectors(int crid, const char *mo ATF_TC_WITHOUT_HEAD(poly1305_vectors); ATF_TC_BODY(poly1305_vectors, tc) { - ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + ATF_REQUIRE_SYSCTL_INT("kern.crypto.allow_soft", 1); test_rfc7539_poly1305_vectors(CRYPTO_FLAG_SOFTWARE, "nexus/cryptosoft"); } Modified: head/tests/sys/opencrypto/runtests.sh == --- head/tests/sys/opencrypto/runtests.sh Wed Nov 4 22:29:01 2020 (r367350) +++ head/tests/sys/opencrypto/runtests.sh Wed Nov 4 22:41:54 2020 (r367351) @@ -83,7 +83,7 @@ for required_module in $cpu_module cryptodev; do fi done -cdas_sysctl=kern.cryptodevallowsoft +cdas_sysctl=kern.crypto.allow_soft if ! oldcdas=$(sysctl -e $cdas_sysctl); then echo "1..0 # SKIP: could not resolve sysctl: $cdas_sysctl" exit 0 ___ 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: r367350 - in head/usr.bin/calendar: . tests
Author: se Date: Wed Nov 4 22:29:01 2020 New Revision: 367350 URL: https://svnweb.freebsd.org/changeset/base/367350 Log: Add regression tests for conditions and comments Fix one case where #else was not corerctly processed and simplify the conditions logic. Fix parsing of day and month names in the locale specified in the calendar file. The previous version would expect those names to match the locale of the user. Mention that comments are now correctly processed and that // is supported in addition to /* ... */. MFC after:3 days Added: head/usr.bin/calendar/tests/calendar.comment (contents, props changed) head/usr.bin/calendar/tests/calendar.cond (contents, props changed) head/usr.bin/calendar/tests/comment.sh (contents, props changed) head/usr.bin/calendar/tests/comment_test.sh (contents, props changed) head/usr.bin/calendar/tests/cond.sh (contents, props changed) head/usr.bin/calendar/tests/cond_test.sh (contents, props changed) head/usr.bin/calendar/tests/regress.comment.out (contents, props changed) head/usr.bin/calendar/tests/regress.cond.out (contents, props changed) Modified: head/usr.bin/calendar/calendar.1 head/usr.bin/calendar/calendar.h head/usr.bin/calendar/dates.c head/usr.bin/calendar/events.c head/usr.bin/calendar/io.c head/usr.bin/calendar/tests/Makefile Directory Properties: head/usr.bin/calendar/tests/regress.a1.out (props changed) head/usr.bin/calendar/tests/regress.a2.out (props changed) head/usr.bin/calendar/tests/regress.a3.out (props changed) head/usr.bin/calendar/tests/regress.a4.out (props changed) head/usr.bin/calendar/tests/regress.a5.out (props changed) head/usr.bin/calendar/tests/regress.b1.out (props changed) head/usr.bin/calendar/tests/regress.b2.out (props changed) head/usr.bin/calendar/tests/regress.b3.out (props changed) head/usr.bin/calendar/tests/regress.b4.out (props changed) head/usr.bin/calendar/tests/regress.b5.out (props changed) head/usr.bin/calendar/tests/regress.s1.out (props changed) head/usr.bin/calendar/tests/regress.s2.out (props changed) head/usr.bin/calendar/tests/regress.s3.out (props changed) head/usr.bin/calendar/tests/regress.s4.out (props changed) head/usr.bin/calendar/tests/regress.s5.out (props changed) head/usr.bin/calendar/tests/regress.w0-1.out (props changed) head/usr.bin/calendar/tests/regress.w0-2.out (props changed) head/usr.bin/calendar/tests/regress.w0-3.out (props changed) head/usr.bin/calendar/tests/regress.w0-4.out (props changed) head/usr.bin/calendar/tests/regress.w0-5.out (props changed) head/usr.bin/calendar/tests/regress.w0-6.out (props changed) head/usr.bin/calendar/tests/regress.w0-7.out (props changed) head/usr.bin/calendar/tests/regress.wn-1.out (props changed) head/usr.bin/calendar/tests/regress.wn-2.out (props changed) head/usr.bin/calendar/tests/regress.wn-3.out (props changed) head/usr.bin/calendar/tests/regress.wn-4.out (props changed) head/usr.bin/calendar/tests/regress.wn-5.out (props changed) head/usr.bin/calendar/tests/regress.wn-6.out (props changed) head/usr.bin/calendar/tests/regress.wn-7.out (props changed) Modified: head/usr.bin/calendar/calendar.1 == --- head/usr.bin/calendar/calendar.1Wed Nov 4 21:52:10 2020 (r367349) +++ head/usr.bin/calendar/calendar.1Wed Nov 4 22:29:01 2020 (r367350) @@ -28,7 +28,7 @@ .\" @(#)calendar.1 8.1 (Berkeley) 6/29/93 .\" $FreeBSD$ .\" -.Dd October 28, 2020 +.Dd November 4, 2020 .Dt CALENDAR 1 .Os .Sh NAME @@ -218,12 +218,14 @@ If the shared file is not referenced by a full pathnam searches in the current (or home) directory first, and then in the directory .Pa /usr/share/calendar . -Empty lines and lines protected by the C commenting syntax +Empty lines and text protected by the C commenting syntax .Pq Li /* ... */ +or +.Pq Li // are ignored. .Pp Some possible calendar entries ( characters highlighted by -\fB\et\fR sequence) +\fB\et\fR sequence): .Bd -unfilled -offset indent LANG=C Easter=Ostern Modified: head/usr.bin/calendar/calendar.h == --- head/usr.bin/calendar/calendar.hWed Nov 4 21:52:10 2020 (r367349) +++ head/usr.bin/calendar/calendar.hWed Nov 4 22:29:01 2020 (r367350) @@ -122,7 +122,7 @@ extern int year1, year2; * - Use event_continue() to add more text to the last added event * - Use event_print_all() to display them in time chronological order */ -struct event *event_add(int, int, int, char *, int, char *, char *); +struct event *event_add(int, int, int, int, char *, char *); void event_continue(struct event *events, char *txt); void event_print_all(FILE *fp); struct event { @@ -189,7 +189,7 @@ int remember_yd(int y, int d, int *rm, int *rd);
Re: svn commit: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys
This doesn't answer all of your questions but one important thing to point out is that Mateusz is in communication with the OpenZFS and iX folks to coordinate these changes and avoid expected merge conflicts. The idealized workflow is that a change goes into OZFS first, but as long as folks are in agreement that can be expedited. Once src is on git, it is expected this type of cherry-pick in both directions will be easier to formally define. Regards, Kevin On Wed, Nov 4, 2020 at 2:36 PM Andriy Gapon wrote: > > On 04/11/2020 23:33, Mateusz Guzik wrote: > > Well, should you check OpenZFS github you will find I post pull > > request there as well. So whatever conflicts arise for people merging > > stuff back are to be just whacked in favor in what's in upstream. > > I certainly would, but how would I know that I should? > Any cross-reference would be of help both now and for the future code history > archaeology. > > > On 11/4/20, Andriy Gapon wrote: > >> On 04/11/2020 23:18, Mateusz Guzik wrote: > >>> Author: mjg > >>> Date: Wed Nov 4 21:18:51 2020 > >>> New Revision: 367343 > >>> URL: https://svnweb.freebsd.org/changeset/base/367343 > >>> > >>> Log: > >>> zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros > >>> > >>> They are expected to fail only in corner cases. > >>> > >>> Modified: > >>> head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h > >>> head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h > >> > >> Picking a random commit of many, is this how we do ZFS/OpenZFS changes now? > >> Can I do the same? > >> Who will be resolving any merge conflicts resulting from my changes? > >> > >> -- > >> Andriy Gapon > >> > > > > > > > -- > Andriy Gapon > ___ > svn-src-h...@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org" ___ svn-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: r367349 - head/sys/dev/atkbdc
Author: wulf Date: Wed Nov 4 21:52:10 2020 New Revision: 367349 URL: https://svnweb.freebsd.org/changeset/base/367349 Log: atkbdc(4): Add quirk for "System76 lemur Pro" laptops. Currently atkbdc(4) assumes all coreboot BIOSes belonging to Chromebooks and unconditionally sets a number of quirks to workaround known issues. Exclude "System76" laptops from this set as they appeared to be a traditional hardware ("lemur Pro" is a rebranded Clevo chassis) with coreboot firmware on board. KBDC_QUIRK_KEEP_ACTIVATED quirk activated for Chromebook platform makes keyboard on this devices inoperable. "Purism Librem" laptops may require the same exclusion too. PR: 250711 Reported by: nick.l...@gmail.com MFC after:2 weeks Modified: head/sys/dev/atkbdc/atkbdc.c Modified: head/sys/dev/atkbdc/atkbdc.c == --- head/sys/dev/atkbdc/atkbdc.cWed Nov 4 21:39:04 2020 (r367348) +++ head/sys/dev/atkbdc/atkbdc.cWed Nov 4 21:52:10 2020 (r367349) @@ -113,6 +113,7 @@ struct atkbdc_quirks { }; static struct atkbdc_quirks quirks[] = { +{"coreboot", "System76", NULL, 0}, {"coreboot", NULL, NULL, KBDC_QUIRK_KEEP_ACTIVATED | KBDC_QUIRK_IGNORE_PROBE_RESULT | KBDC_QUIRK_RESET_AFTER_PROBE | KBDC_QUIRK_SETLEDS_ON_INIT}, ___ 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: r367348 - head/sys/compat/linux
Author: trasz Date: Wed Nov 4 21:39:04 2020 New Revision: 367348 URL: https://svnweb.freebsd.org/changeset/base/367348 Log: Unbreak buildworld after r367339. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_errno.h Modified: head/sys/compat/linux/linux_errno.h == --- head/sys/compat/linux/linux_errno.h Wed Nov 4 21:23:25 2020 (r367347) +++ head/sys/compat/linux/linux_errno.h Wed Nov 4 21:39:04 2020 (r367348) @@ -180,8 +180,6 @@ #defineLINUX_ERFKILL 132 #defineLINUX_EHWPOISON 133 -#ifdef _KERNEL #defineLINUX_ELAST LINUX_EHWPOISON -#endif #endif /* _LINUX_ERRNO_H_ */ ___ 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: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys
On 04/11/2020 23:33, Mateusz Guzik wrote: > Well, should you check OpenZFS github you will find I post pull > request there as well. So whatever conflicts arise for people merging > stuff back are to be just whacked in favor in what's in upstream. I certainly would, but how would I know that I should? Any cross-reference would be of help both now and for the future code history archaeology. > On 11/4/20, Andriy Gapon wrote: >> On 04/11/2020 23:18, Mateusz Guzik wrote: >>> Author: mjg >>> Date: Wed Nov 4 21:18:51 2020 >>> New Revision: 367343 >>> URL: https://svnweb.freebsd.org/changeset/base/367343 >>> >>> Log: >>> zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros >>> >>> They are expected to fail only in corner cases. >>> >>> Modified: >>> head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h >>> head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h >> >> Picking a random commit of many, is this how we do ZFS/OpenZFS changes now? >> Can I do the same? >> Who will be resolving any merge conflicts resulting from my changes? >> >> -- >> Andriy Gapon >> > > -- Andriy Gapon ___ 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: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys
Well, should you check OpenZFS github you will find I post pull request there as well. So whatever conflicts arise for people merging stuff back are to be just whacked in favor in what's in upstream. On 11/4/20, Andriy Gapon wrote: > On 04/11/2020 23:18, Mateusz Guzik wrote: >> Author: mjg >> Date: Wed Nov 4 21:18:51 2020 >> New Revision: 367343 >> URL: https://svnweb.freebsd.org/changeset/base/367343 >> >> Log: >> zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros >> >> They are expected to fail only in corner cases. >> >> Modified: >> head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h >> head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h > > Picking a random commit of many, is this how we do ZFS/OpenZFS changes now? > Can I do the same? > Who will be resolving any merge conflicts resulting from my changes? > > -- > Andriy Gapon > -- Mateusz Guzik ___ 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: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys
On 04/11/2020 23:18, Mateusz Guzik wrote: > Author: mjg > Date: Wed Nov 4 21:18:51 2020 > New Revision: 367343 > URL: https://svnweb.freebsd.org/changeset/base/367343 > > Log: > zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros > > They are expected to fail only in corner cases. > > Modified: > head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h > head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Picking a random commit of many, is this how we do ZFS/OpenZFS changes now? Can I do the same? Who will be resolving any merge conflicts resulting from my changes? -- Andriy Gapon ___ 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: r367347 - head/sys/sys
Author: mjg Date: Wed Nov 4 21:23:25 2020 New Revision: 367347 URL: https://svnweb.freebsd.org/changeset/base/367347 Log: Bump __FreeBSD_version after rms changes Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hWed Nov 4 21:22:41 2020(r367346) +++ head/sys/sys/param.hWed Nov 4 21:23:25 2020(r367347) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300124 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300125 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ 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: r367346 - head/sys/contrib/openzfs/include/os/freebsd/zfs/sys
Author: mjg Date: Wed Nov 4 21:22:41 2020 New Revision: 367346 URL: https://svnweb.freebsd.org/changeset/base/367346 Log: zfs: use rms lock for teardown handling This deserializes otherwise non-contending operations. The previous scheme of using 17 locks hashed by curthread runs into conflicts very quickly. Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h == --- head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:19:54 2020(r367345) +++ head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:22:41 2020(r367346) @@ -28,6 +28,10 @@ #define_SYS_FS_ZFS_VFSOPS_H #if __FreeBSD_version >= 1300109 +#defineTEARDOWN_RMS +#endif + +#if __FreeBSD_version >= 1300109 #defineTEARDOWN_INACTIVE_RMS #endif @@ -46,7 +50,11 @@ extern "C" { #endif +#ifdef TEARDOWN_RMS +typedef struct rmslock zfs_teardown_lock_t; +#else #definezfs_teardown_lock_t rrmlock_t +#endif #ifdef TEARDOWN_INACTIVE_RMS typedef struct rmslock zfs_teardown_inactive_lock_t; @@ -114,7 +122,41 @@ struct zfsvfs { struct task z_unlinked_drain_task; }; +#ifdef TEARDOWN_RMS #defineZFS_TEARDOWN_INIT(zfsvfs) \ + rms_init(&(zfsvfs)->z_teardown_lock, "zfs teardown") + +#defineZFS_TEARDOWN_DESTROY(zfsvfs)\ + rms_destroy(&(zfsvfs)->z_teardown_lock) + +#defineZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \ + rms_try_rlock(&(zfsvfs)->z_teardown_lock) + +#defineZFS_TEARDOWN_ENTER_READ(zfsvfs, tag)\ + rms_rlock(&(zfsvfs)->z_teardown_lock); + +#defineZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \ + rms_runlock(&(zfsvfs)->z_teardown_lock) + +#defineZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \ + rms_wlock(&(zfsvfs)->z_teardown_lock) + +#defineZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \ + rms_wunlock(&(zfsvfs)->z_teardown_lock) + +#defineZFS_TEARDOWN_EXIT(zfsvfs, tag) \ + rms_unlock(&(zfsvfs)->z_teardown_lock) + +#defineZFS_TEARDOWN_READ_HELD(zfsvfs) \ + rms_rowned(&(zfsvfs)->z_teardown_lock) + +#defineZFS_TEARDOWN_WRITE_HELD(zfsvfs) \ + rms_wowned(&(zfsvfs)->z_teardown_lock) + +#defineZFS_TEARDOWN_HELD(zfsvfs) \ + rms_owned_any(&(zfsvfs)->z_teardown_lock) +#else +#defineZFS_TEARDOWN_INIT(zfsvfs) \ rrm_init(&(zfsvfs)->z_teardown_lock, B_FALSE) #defineZFS_TEARDOWN_DESTROY(zfsvfs)\ @@ -146,6 +188,7 @@ struct zfsvfs { #defineZFS_TEARDOWN_HELD(zfsvfs) \ RRM_LOCK_HELD(&(zfsvfs)->z_teardown_lock) +#endif #ifdef TEARDOWN_INACTIVE_RMS #defineZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \ ___ 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: r367345 - in head/sys/contrib/openzfs: include/os/freebsd/zfs/sys include/os/linux/zfs/sys module/os/freebsd/zfs module/os/linux/zfs module/zfs
Author: mjg Date: Wed Nov 4 21:19:54 2020 New Revision: 367345 URL: https://svnweb.freebsd.org/changeset/base/367345 Log: zfs: macroify teardown handling Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.c head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c head/sys/contrib/openzfs/module/os/linux/zfs/zfs_vfsops.c head/sys/contrib/openzfs/module/zfs/zfs_ioctl.c Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h == --- head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:19:25 2020(r367344) +++ head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:19:54 2020(r367345) @@ -46,10 +46,12 @@ extern "C" { #endif +#definezfs_teardown_lock_t rrmlock_t + #ifdef TEARDOWN_INACTIVE_RMS -typedef struct rmslock zfs_teardown_lock_t; +typedef struct rmslock zfs_teardown_inactive_lock_t; #else -#definezfs_teardown_lock_t krwlock_t +#definezfs_teardown_inactive_lock_t krwlock_t #endif typedef struct zfsvfs zfsvfs_t; @@ -80,8 +82,8 @@ struct zfsvfs { int z_norm; /* normalization flags */ boolean_t z_atime;/* enable atimes mount option */ boolean_t z_unmounted;/* unmounted */ - rrmlock_t z_teardown_lock; - zfs_teardown_lock_t z_teardown_inactive_lock; + zfs_teardown_lock_t z_teardown_lock; + zfs_teardown_inactive_lock_t z_teardown_inactive_lock; list_t z_all_znodes; /* all vnodes in the fs */ uint64_tz_nr_znodes;/* number of znodes in the fs */ kmutex_tz_znodes_lock; /* lock for z_all_znodes */ @@ -111,6 +113,39 @@ struct zfsvfs { kmutex_tz_hold_mtx[ZFS_OBJ_MTX_SZ]; /* znode hold locks */ struct task z_unlinked_drain_task; }; + +#defineZFS_TEARDOWN_INIT(zfsvfs) \ + rrm_init(&(zfsvfs)->z_teardown_lock, B_FALSE) + +#defineZFS_TEARDOWN_DESTROY(zfsvfs)\ + rrm_destroy(&(zfsvfs)->z_teardown_lock) + +#defineZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \ + rw_tryenter(&(zfsvfs)->z_teardown_lock, RW_READER) + +#defineZFS_TEARDOWN_ENTER_READ(zfsvfs, tag)\ + rrm_enter_read(&(zfsvfs)->z_teardown_lock, tag); + +#defineZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#defineZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \ + rrm_enter(&(zfsvfs)->z_teardown_lock, RW_WRITER, tag) + +#defineZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#defineZFS_TEARDOWN_EXIT(zfsvfs, tag) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#defineZFS_TEARDOWN_READ_HELD(zfsvfs) \ + RRM_READ_HELD(&(zfsvfs)->z_teardown_lock) + +#defineZFS_TEARDOWN_WRITE_HELD(zfsvfs) \ + RRM_WRITE_HELD(&(zfsvfs)->z_teardown_lock) + +#defineZFS_TEARDOWN_HELD(zfsvfs) \ + RRM_LOCK_HELD(&(zfsvfs)->z_teardown_lock) #ifdef TEARDOWN_INACTIVE_RMS #defineZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \ Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h == --- head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:19:25 2020(r367344) +++ head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:19:54 2020(r367345) @@ -118,15 +118,15 @@ extern minor_t zfsdev_minor_alloc(void); /* Called on entry to each ZFS vnode and vfs operation */ #defineZFS_ENTER(zfsvfs) \ { \ - rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ + ZFS_TEARDOWN_ENTER_READ((zfsvfs), FTAG); \ if (__predict_false((zfsvfs)->z_unmounted)) { \ - ZFS_EXIT(zfsvfs); \ + ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \ return (EIO); \ } \ } /* Must be called before exiting the vop */ -#defineZFS_EXIT(zfsvfs) rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG) +#defineZFS_EXIT(zfsvfs) ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG) /* Verifies the znode is valid */ #defineZFS_VERIFY_ZP(zp) \ Modified: head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h == --- head/sys/contrib/openzfs/include/os/li
svn commit: r367344 - in head/sys/contrib/openzfs: include/os/freebsd/zfs/sys module/os/freebsd/zfs
Author: mjg Date: Wed Nov 4 21:19:25 2020 New Revision: 367344 URL: https://svnweb.freebsd.org/changeset/base/367344 Log: zfs: rename teardown inactive macros to mimick rrm convention Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h == --- head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:18:51 2020(r367343) +++ head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:19:25 2020(r367344) @@ -113,52 +113,52 @@ struct zfsvfs { }; #ifdef TEARDOWN_INACTIVE_RMS -#defineZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \ rms_init(&(zfsvfs)->z_teardown_inactive_lock, "zfs teardown inactive") -#defineZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs) \ rms_destroy(&(zfsvfs)->z_teardown_inactive_lock) -#defineZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs)\ rms_try_rlock(&(zfsvfs)->z_teardown_inactive_lock) -#defineZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs)\ rms_rlock(&(zfsvfs)->z_teardown_inactive_lock) -#defineZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs) \ rms_runlock(&(zfsvfs)->z_teardown_inactive_lock) -#defineZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs) \ rms_wlock(&(zfsvfs)->z_teardown_inactive_lock) -#defineZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs)\ rms_wunlock(&(zfsvfs)->z_teardown_inactive_lock) -#defineZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs)\ rms_wowned(&(zfsvfs)->z_teardown_inactive_lock) #else -#defineZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \ rw_init(&(zfsvfs)->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL) -#defineZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs) \ rw_destroy(&(zfsvfs)->z_teardown_inactive_lock) -#defineZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs)\ rw_tryenter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER) -#defineZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs)\ rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER) -#defineZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs) \ rw_exit(&(zfsvfs)->z_teardown_inactive_lock) -#defineZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs) \ rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_WRITER) -#defineZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs)\ rw_exit(&(zfsvfs)->z_teardown_inactive_lock) -#defineZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \ +#defineZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs)\ RW_WRITE_HELD(&(zfsvfs)->z_teardown_inactive_lock) #endif Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c == --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c Wed Nov 4 21:18:51 2020(r367343) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c Wed Nov 4 21:19:25 2020(r367344) @@ -990,7 +990,7 @@ zfsvfs_create_impl(zfsvfs_t **zfvp, zfsvfs_t *zfsvfs, #else rrm_init(&zfsvfs->z_teardown_lock, B_FALSE); #endif - ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs); rw_init(&zfsvfs->z_fuid_lock, NULL, RW_DEFAULT, NULL); for (int i = 0; i != ZFS_OBJ_MTX_SZ; i++) mutex_init(&zfsvfs->z_hold_mtx[i], NULL, MUTEX_DEFAULT, NULL); @@ -1130,7 +1130,7 @@ zfsvfs_free(zfsvfs_t *zfsvfs) ASSERT(zfsvfs->z_nr_znodes == 0); list_destroy(&zfsvfs->z_all_znodes); rrm_destroy(&zfsvfs->z_teardown_lock); - ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs); rw_destro
svn commit: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys
Author: mjg Date: Wed Nov 4 21:18:51 2020 New Revision: 367343 URL: https://svnweb.freebsd.org/changeset/base/367343 Log: zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros They are expected to fail only in corner cases. Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h == --- head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:18:27 2020(r367342) +++ head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:18:51 2020(r367343) @@ -119,7 +119,7 @@ extern minor_t zfsdev_minor_alloc(void); #defineZFS_ENTER(zfsvfs) \ { \ rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ - if ((zfsvfs)->z_unmounted) { \ + if (__predict_false((zfsvfs)->z_unmounted)) { \ ZFS_EXIT(zfsvfs); \ return (EIO); \ } \ @@ -130,7 +130,7 @@ extern minor_t zfsdev_minor_alloc(void); /* Verifies the znode is valid */ #defineZFS_VERIFY_ZP(zp) \ - if ((zp)->z_sa_hdl == NULL) { \ + if (__predict_false((zp)->z_sa_hdl == NULL)) { \ ZFS_EXIT((zp)->z_zfsvfs); \ return (EIO); \ } \ Modified: head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h == --- head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:18:27 2020(r367342) +++ head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:18:51 2020(r367343) @@ -76,7 +76,7 @@ extern "C" { #defineZFS_ENTER_ERROR(zfsvfs, error) \ do { \ rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ - if ((zfsvfs)->z_unmounted) {\ + if (unlikely((zfsvfs)->z_unmounted)) { \ ZFS_EXIT(zfsvfs); \ return (error); \ } \ @@ -95,7 +95,7 @@ do { \ /* Verifies the znode is valid. */ #defineZFS_VERIFY_ZP_ERROR(zp, error) \ do { \ - if ((zp)->z_sa_hdl == NULL) { \ + if (unlikely((zp)->z_sa_hdl == NULL)) { \ ZFS_EXIT(ZTOZSB(zp)); \ 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: r367342 - head/sys/contrib/openzfs/module/os/freebsd/zfs
Author: mjg Date: Wed Nov 4 21:18:27 2020 New Revision: 367342 URL: https://svnweb.freebsd.org/changeset/base/367342 Log: zfs: even up assert Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.c Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.c == --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.cWed Nov 4 21:18:08 2020(r367341) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.cWed Nov 4 21:18:27 2020(r367342) @@ -206,10 +206,11 @@ zfs_dd_lookup(znode_t *dzp, znode_t **zpp) uint64_t parent; int error; +#ifdef ZFS_DEBUG if (zfsvfs->z_replay == B_FALSE) ASSERT_VOP_LOCKED(ZTOV(dzp), __func__); ASSERT(RRM_READ_HELD(&zfsvfs->z_teardown_lock)); - +#endif if (dzp->z_unlinked) return (ENOENT); ___ 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: r367341 - in head/sys: kern sys
Author: mjg Date: Wed Nov 4 21:18:08 2020 New Revision: 367341 URL: https://svnweb.freebsd.org/changeset/base/367341 Log: rms: fixup concurrent writer handling and add more features Previously the code had one wait channel for all pending writers. This could result in a buggy scenario where after a writer switches the lock mode form readers to writers goes off CPU, another writer queues itself and then the last reader wakes up the latter instead of the former. Use a separate channel. While here add features to reliably detect whether curthread has the lock write-owned. This will be used by ZFS. Modified: head/sys/kern/kern_rmlock.c head/sys/sys/_rmlock.h head/sys/sys/rmlock.h Modified: head/sys/kern/kern_rmlock.c == --- head/sys/kern/kern_rmlock.c Wed Nov 4 20:15:14 2020(r367340) +++ head/sys/kern/kern_rmlock.c Wed Nov 4 21:18:08 2020(r367341) @@ -878,10 +878,15 @@ db_show_rm(const struct lock_object *lock) * problem at some point. The easiest way to lessen it is to provide a bitmap. */ +#defineRMS_NOOWNER ((void *)0x1) +#defineRMS_TRANSIENT ((void *)0x2) +#defineRMS_FLAGMASK0xf + void rms_init(struct rmslock *rms, const char *name) { + rms->owner = RMS_NOOWNER; rms->writers = 0; rms->readers = 0; mtx_init(&rms->mtx, name, NULL, MTX_DEF | MTX_NEW); @@ -922,6 +927,7 @@ rms_rlock(struct rmslock *rms) { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); + MPASS(atomic_load_ptr(&rms->owner) != curthread); critical_enter(); zpcpu_set_protected(rms->readers_influx, 1); @@ -941,6 +947,8 @@ int rms_try_rlock(struct rmslock *rms) { + MPASS(atomic_load_ptr(&rms->owner) != curthread); + critical_enter(); zpcpu_set_protected(rms->readers_influx, 1); __compiler_membar(); @@ -1054,23 +1062,33 @@ rms_wlock(struct rmslock *rms) { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); + MPASS(atomic_load_ptr(&rms->owner) != curthread); mtx_lock(&rms->mtx); rms->writers++; if (rms->writers > 1) { - msleep(&rms->writers, &rms->mtx, (PUSER - 1) | PDROP, + msleep(&rms->owner, &rms->mtx, (PUSER - 1), mtx_name(&rms->mtx), 0); MPASS(rms->readers == 0); - return; + KASSERT(rms->owner == RMS_TRANSIENT, + ("%s: unexpected owner value %p\n", __func__, + rms->owner)); + goto out_grab; } + KASSERT(rms->owner == RMS_NOOWNER, + ("%s: unexpected owner value %p\n", __func__, rms->owner)); + rms_wlock_switch(rms); - if (rms->readers > 0) - msleep(&rms->writers, &rms->mtx, (PUSER - 1) | PDROP, + if (rms->readers > 0) { + msleep(&rms->writers, &rms->mtx, (PUSER - 1), mtx_name(&rms->mtx), 0); - else - mtx_unlock(&rms->mtx); + } + +out_grab: + rms->owner = curthread; + mtx_unlock(&rms->mtx); MPASS(rms->readers == 0); } @@ -1079,12 +1097,27 @@ rms_wunlock(struct rmslock *rms) { mtx_lock(&rms->mtx); + KASSERT(rms->owner == curthread, + ("%s: unexpected owner value %p\n", __func__, rms->owner)); MPASS(rms->writers >= 1); MPASS(rms->readers == 0); rms->writers--; - if (rms->writers > 0) - wakeup_one(&rms->writers); - else + if (rms->writers > 0) { + wakeup_one(&rms->owner); + rms->owner = RMS_TRANSIENT; + } else { wakeup(&rms->readers); + rms->owner = RMS_NOOWNER; + } mtx_unlock(&rms->mtx); +} + +void +rms_unlock(struct rmslock *rms) +{ + + if (rms_wowned(rms)) + rms_wunlock(rms); + else + rms_runlock(rms); } Modified: head/sys/sys/_rmlock.h == --- head/sys/sys/_rmlock.h Wed Nov 4 20:15:14 2020(r367340) +++ head/sys/sys/_rmlock.h Wed Nov 4 21:18:08 2020(r367341) @@ -72,6 +72,7 @@ struct rm_priotracker { struct rmslock { struct mtx mtx; + struct thread *owner; int writers; int readers; int *readers_pcpu; Modified: head/sys/sys/rmlock.h == --- head/sys/sys/rmlock.h Wed Nov 4 20:15:14 2020(r367340) +++ head/sys/sys/rmlock.h Wed Nov 4 21:18:08 2020(r367341) @@ -140,16 +140,33 @@ int rms_try_rlock(struct rmslock *rms); void rms_runlock(struct rmslock *rms); void rms_wlock(struct rmslock *rms); void rms_wunlock(struct rmslock *rms); +void rms_unlock(struct rmslock *rms); +
svn commit: r367340 - head/sys/modules/dtb/rockchip
Author: manu Date: Wed Nov 4 20:15:14 2020 New Revision: 367340 URL: https://svnweb.freebsd.org/changeset/base/367340 Log: dtb/rockchip: Add rockpi-4 to the build We boot on this board to add the dtb to the build. Requested by: Daniel Engberg Modified: head/sys/modules/dtb/rockchip/Makefile Modified: head/sys/modules/dtb/rockchip/Makefile == --- head/sys/modules/dtb/rockchip/Makefile Wed Nov 4 19:54:18 2020 (r367339) +++ head/sys/modules/dtb/rockchip/Makefile Wed Nov 4 20:15:14 2020 (r367340) @@ -4,6 +4,7 @@ DTS=\ rockchip/rk3399-khadas-edge-captain.dts \ rockchip/rk3399-khadas-edge.dts \ rockchip/rk3399-khadas-edge-v.dts \ + rockchip/rk3399-rock-pi-4.dts \ rockchip/rk3328-rock64.dts \ rockchip/rk3399-firefly.dts \ rockchip/rk3399-rockpro64.dts ___ 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: r367339 - head/sys/compat/linux
Author: trasz Date: Wed Nov 4 19:54:18 2020 New Revision: 367339 URL: https://svnweb.freebsd.org/changeset/base/367339 Log: Add linux_to_bsd_errtbl[], mapping Linux errnos to their BSD counterparts. This will be used by fuse(4). Reviewed by: asomers MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26974 Modified: head/sys/compat/linux/linux_errno.c head/sys/compat/linux/linux_errno.h head/sys/compat/linux/linux_errno.inc Modified: head/sys/compat/linux/linux_errno.c == --- head/sys/compat/linux/linux_errno.c Wed Nov 4 18:23:59 2020 (r367338) +++ head/sys/compat/linux/linux_errno.c Wed Nov 4 19:54:18 2020 (r367339) @@ -31,5 +31,11 @@ linux_check_errtbl(void) KASSERT(linux_errtbl[i] != 0, ("%s: linux_errtbl[%d] == 0", __func__, i)); } + + for (i = 1; i < nitems(linux_to_bsd_errtbl); i++) { + KASSERT(linux_to_bsd_errtbl[i] != 0, + ("%s: linux_to_bsd_errtbl[%d] == 0", __func__, i)); + } + } #endif Modified: head/sys/compat/linux/linux_errno.h == --- head/sys/compat/linux/linux_errno.h Wed Nov 4 18:23:59 2020 (r367338) +++ head/sys/compat/linux/linux_errno.h Wed Nov 4 19:54:18 2020 (r367339) @@ -180,4 +180,8 @@ #defineLINUX_ERFKILL 132 #defineLINUX_EHWPOISON 133 +#ifdef _KERNEL +#defineLINUX_ELAST LINUX_EHWPOISON +#endif + #endif /* _LINUX_ERRNO_H_ */ Modified: head/sys/compat/linux/linux_errno.inc == --- head/sys/compat/linux/linux_errno.inc Wed Nov 4 18:23:59 2020 (r367338) +++ head/sys/compat/linux/linux_errno.inc Wed Nov 4 19:54:18 2020 (r367339) @@ -160,3 +160,170 @@ static const int linux_errtbl[ELAST + 1] = { _Static_assert(ELAST == 97, "missing errno entries in linux_errtbl"); + +static const int linux_to_bsd_errtbl[LINUX_ELAST + 1] = { + /* [0, 9] */ + [0] = 0, + [LINUX_EPERM] = EPERM, + [LINUX_ENOENT] = ENOENT, + [LINUX_ESRCH] = ESRCH, + [LINUX_EINTR] = EINTR, + [LINUX_EIO] = EIO, + [LINUX_ENXIO] = ENXIO, + [LINUX_E2BIG] = E2BIG, + [LINUX_ENOEXEC] = ENOENT, + [LINUX_EBADF] = EBADF, + + /* [10, 19] */ + [LINUX_ECHILD] = ECHILD, + [LINUX_EAGAIN] = EAGAIN, + [LINUX_ENOMEM] = ENOMEM, + [LINUX_EACCES] = EACCES, + [LINUX_EFAULT] = EFAULT, + [LINUX_ENOTBLK] = ENOTBLK, + [LINUX_EBUSY] = EBUSY, + [LINUX_EEXIST] = EEXIST, + [LINUX_EXDEV] = EXDEV, + [LINUX_ENODEV] = ENODEV, + + /* [20, 29] */ + [LINUX_ENOTDIR] = ENOTDIR, + [LINUX_EISDIR] = EISDIR, + [LINUX_EINVAL] = EINVAL, + [LINUX_ENFILE] = ENFILE, + [LINUX_EMFILE] = EMFILE, + [LINUX_ENOTTY] = ENOTTY, + [LINUX_ETXTBSY] = ETXTBSY, + [LINUX_EFBIG] = EFBIG, + [LINUX_ENOSPC] = ENOSPC, + [LINUX_ESPIPE] = ESPIPE, + + /* [30, 39] */ + [LINUX_EROFS] = EROFS, + [LINUX_EMLINK] = EMLINK, + [LINUX_EPIPE] = EPIPE, + [LINUX_EDOM] = EDOM, + [LINUX_ERANGE] = ERANGE, + [LINUX_EDEADLK] = EDEADLK, + [LINUX_ENAMETOOLONG] = ENAMETOOLONG, + [LINUX_ENOLCK] = ENOLCK, + [LINUX_ENOSYS] = ENOSYS, + [LINUX_ENOTEMPTY] = ENOTEMPTY, + + /* [40, 49] */ + [LINUX_ELOOP] = ELOOP, + [41] = EINVAL, + [LINUX_ENOMSG] = ENOMSG, + [LINUX_EIDRM] = EIDRM, + [LINUX_ECHRNG] = EINVAL,/* XXX */ + [LINUX_EL2NSYNC] = EINVAL, /* XXX */ + [LINUX_EL3HLT] = EINVAL,/* XXX */ + [LINUX_EL3RST] = EINVAL,/* XXX */ + [LINUX_ELNRNG] = EINVAL,/* XXX */ + [LINUX_EUNATCH] = EINVAL, /* XXX */ + + /* [50, 59] */ + [LINUX_ENOCSI] = EINVAL,/* XXX */ + [LINUX_EL2HLT] = EINVAL,/* XXX */ + [LINUX_EBADE] = EINVAL, /* XXX */ + [LINUX_EBADR] = EINVAL, /* XXX */ + [LINUX_EXFULL] = EINVAL,/* XXX */ + [LINUX_ENOANO] = EINVAL,/* XXX */ + [LINUX_EBADRQC] = EINVAL, /* XXX */ + [LINUX_EBADSLT] = EINVAL, /* XXX */ + [58] = EINVAL, + [LINUX_EBFONT] = EINVAL,/* XXX */ + + /* [60, 69] */ + [LINUX_ENOSTR] = EINVAL,/* XXX */ + [LINUX_ENODATA] = ENOATTR, /* XXX */ + [LINUX_ENOTIME] = EINVAL, /* XXX */ + [LINUX_ENOSR] = EINVAL, /* XXX */ + [LINUX_ENONET] = EINVAL,/* XXX */ + [LINUX_ENOPKG] = EINVAL,/* XXX */ + [LINUX_EREMOTE] = EREMOTE, + [LINUX_ENOLINK] = ENOLINK, + [LINUX_EADV] = EINVAL, /* XXX */ +
Re: svn commit: r367280 - head/lib/libc/gen
On Mon, Nov 02, 2020 at 11:51:12PM +0100, Stefan Esser wrote: > Am 02.11.20 um 23:10 schrieb Konstantin Belousov: > > On Mon, Nov 02, 2020 at 10:49:07PM +0100, Emmanuel Vadot wrote: > > > I think that the first question we want to ask is : Do we want to > > > support LOCALBASE being different than /usr/local > > > I honestly don't see any advantages of making it !=/usr/local/ and > > > before we start putting a lot of new/useless(for I guess 99% of our > > > user base) in the tree we should here why people are using /usr/pkg or > > > whatever weird location. > > > If they have some good argument, then we should proceed further. > > > > I would be delighted to be able to install _and use_ two independent > > set of packages from the same base system install. Without recursing > > to jails, X forwarding, etc. > > I understand the use case, and I agree this may be appropriate for > a development system. > > But on a production system I'd never want to have a non-constant and > not generally applied LOCALBASE, at least not on a system that gives > a CLI to unprivileged users. Those could build their own copy of the > LOCALBASE tree (e.g. sym-linking all sub-trees that are to be kept > unmodified, replacing config files that policies that restrict the > user). So how this makes attitude to the feature different ? For me, dev machine is my production box because what I do is development. And for user that need to run an old binary-only 32bit app which requires X libs, for instance, it also would be a production. > > And if LOCALBASE is not compiled into binaries but somehow obtained > at run-time, there are a number of attacks I can imagine (e.g. by > LD_PRELOAD replace the sysctl() call in libc by your own version). If somebody can LD_PRELOAD their into your process, it makes no sense to talk about 'security'. > > > In fact I would like to use /usr/local and e.g /usr/local-i386 on amd64 > > machine. I am fine with me building both of them in my instance of > > poudriere. > > This is a use-case for architecture dependent path definitions (which > I have used some 30 years ago on HP-UX which supported 68k and HP-PA > on a single file system that way). Such a feature has been discussed > in FreeBSD multiple times over the decades ... Ok, let replace /usr/local-i386 by /usr/local-11.4, if you so inclined. ___ 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: r367280 - head/lib/libc/gen
On Wed, Nov 04, 2020 at 11:04:37AM -0800, Rodney W. Grimes wrote: > Picking a late message in this thread to reply to > > [ Charset windows-1252 unsupported, converting... ] > > >>>I think that the first question we want to ask is : Do we want to > > >>> support LOCALBASE being different than /usr/local > > >> > > >> The big majority of users will keep the default value, and I do not > > >> see a good reason for a change, except if there is a large installed > > >> base that traditionally uses another prefix (I have seen /vol/local > > >> and /opt, but also OS and architecture-specific prefixes, for example). > > > > > > I'd still like to see some arguments for such installs. > > > > There are no reasons, if you have a narrow scope where FreeBSD should > > get installed. If it only on individual desktop users' system, they > > are best served with LOCALBASE immutably fixed to /usr/local. > > > > But there are other kinds of user and I have already given examples. > > Companies that have tooling that traditionally used some other prefix > > will not rewrite all their tools if we tell them that only /usr/local > > is supported, for example. > > > > I do not have to justify the existence of such use cases, and I'm happy > > with /usr/local on all my systems. But I do know that such use cases > > do exist and I have worked in environments where they were relevant. > > > > For 25 years PREFIX has been rigidly a part of the ports infustructure, > why is it that the BASE system has been allowed to de-evolve from this > concept as documented and REQUIRED by: > > https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/porting-prefix.html > > > I again assert at one time the base system was clean of this, > it has regressed and needs to be fixed. That fix should restore > the independence of PREFIX. If 30k ported pieces of software can > do it why can't the base system do it? > > Those ports do not require a recompile, why should the base system? I am just reacting on that phrase, you do really think the ports do not require a rebuild to be able to relocate from a PREFIX to another? this is a myth! ports support being built with another prefix than localbase but that is all it supports. There has been a flase claim for years that relocating work, but beside the tools proposing the feature it never worked, or to be fait only on some very specific port. But it is just an impossible goal to achieve otherwise as for example all the path which gets hardcoded at build time depending on the prefix will end up in the binary looking for resources in a hardcoded prefix at runtime and so fail if you relocate the package, for example its datadir. Best regards, Bapt signature.asc Description: PGP signature
Re: svn commit: r367280 - head/lib/libc/gen
Picking a late message in this thread to reply to [ Charset windows-1252 unsupported, converting... ] > >>>I think that the first question we want to ask is : Do we want to > >>> support LOCALBASE being different than /usr/local > >> > >> The big majority of users will keep the default value, and I do not > >> see a good reason for a change, except if there is a large installed > >> base that traditionally uses another prefix (I have seen /vol/local > >> and /opt, but also OS and architecture-specific prefixes, for example). > > > > I'd still like to see some arguments for such installs. > > There are no reasons, if you have a narrow scope where FreeBSD should > get installed. If it only on individual desktop users' system, they > are best served with LOCALBASE immutably fixed to /usr/local. > > But there are other kinds of user and I have already given examples. > Companies that have tooling that traditionally used some other prefix > will not rewrite all their tools if we tell them that only /usr/local > is supported, for example. > > I do not have to justify the existence of such use cases, and I'm happy > with /usr/local on all my systems. But I do know that such use cases > do exist and I have worked in environments where they were relevant. > For 25 years PREFIX has been rigidly a part of the ports infustructure, why is it that the BASE system has been allowed to de-evolve from this concept as documented and REQUIRED by: https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/porting-prefix.html I again assert at one time the base system was clean of this, it has regressed and needs to be fixed. That fix should restore the independence of PREFIX. If 30k ported pieces of software can do it why can't the base system do it? Those ports do not require a recompile, why should the base system? > >>>I honestly don't see any advantages of making it !=/usr/local/ and > >>> before we start putting a lot of new/useless(for I guess 99% of our > >>> user base) in the tree we should here why people are using /usr/pkg or > >>> whatever weird location. > >> > >> No, why should we [assess] (assuming that word is to be implied in > >> your sentence) why people want to be able to easily use a different > >> prefix? That would be a waste of time, IMHO. > >> > >> I know that there are legitimate reasons to want a different prefix, > >> and we had requests to make it easier to support it. > > > > What are thoses ? > > Please check the mail-lists since I did not save those messages. > > >> We have literal uses of /usr/local in a lot of files in the FreeBSD > >> base system (more than 1700) and this is not going to change. > >> > >> But it was easy to replace a number of such literal pathes in base > >> system binaries, and we can make it easier for those that need a > >> different prefix to get it consistently used. > >> > >>>If they have some good argument, then we should proceed further. > >> > >> You do not have to participate in this effort > > > > I do have to participate, it's a common project. > > But it does not affect you if you do not use it. > > > Also since I also participate in pkg(8) and in ports/Mk lua/blah stuff > > there might be some stuff to do there so yes I need to participate. > > Ports should already support PREFIX and LOCALBASE other than /usr/local. > > And the pkg program even supports the LOCALBASE environment variable. > > All we try to do is go away from multiple inconsistent methods and > mechanisms and make it easier for installations that do have a need > for a different LOCALBASE to get in consistently applied to all parts > of the system. (They have to go through the tree and apply local > patches to program sources or config files, currently, but will then > have the same result with much more effort spent by each of them.) > > > And since you never really started a conversation on a ml (that I know > > of) my only mean to start this participation is answering a commit > > email. > > There has been a lengthy discussion in the thread about moving the > calendar data files out of the base system. > > And there is review D26942, which was announced on the -current list > and which you seem to have missed. Also relevant are D27009, D27014, > and D27022, which have been mentioned in commits as far they have > already been committed, but have not been widely announced. You can > easily > > >> - there are so many > >> other areas to work on (and I know you are very active in one). > > > > Only one ? Damn, I should work more then. > > The most recent breakage you caused for me was the backlight kernel > option that has been introduced without any discussion I'm aware of. > > Yes, I know about your involvement in getting support for modern GPUs > into FreeBSD and appreciate it. > > >> But please do not ask those that have started to reduce the use of > >> literal /usr/local in the base system to justify this work. > > > > Ser
svn commit: r367338 - head/sys/dev/usb/controller
Author: manu Date: Wed Nov 4 18:23:59 2020 New Revision: 367338 URL: https://svnweb.freebsd.org/changeset/base/367338 Log: Plug minor memory leak in dwc3 USB2/USB3 controller. OF_getprop_alloc called earlier requires corresponding OF_prop_free to release allocated memory. Submitted by: kjo...@gmail.com Differential Revision:https://reviews.freebsd.org/D27085 Modified: head/sys/dev/usb/controller/dwc3.c Modified: head/sys/dev/usb/controller/dwc3.c == --- head/sys/dev/usb/controller/dwc3.c Wed Nov 4 17:51:09 2020 (r367337) +++ head/sys/dev/usb/controller/dwc3.c Wed Nov 4 18:23:59 2020 (r367338) @@ -235,6 +235,7 @@ snps_dwc3_configure_phy(struct snps_dwc3_softc *sc) DWC3_GUSB2PHYCFG0_USBTRDTIM(DWC3_GUSB2PHYCFG0_USBTRDTIM_8BITS); } DWC3_WRITE(sc, DWC3_GUSB2PHYCFG0, reg); + OF_prop_free(phy_type); } static 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"
Re: svn commit: r367304 - in head: share/man/man5 share/mk tools/build/options usr.bin usr.bin/clang usr.bin/clang/llvm-cxxfilt
On Wed, 4 Nov 2020 at 12:40, Dimitry Andric wrote: > > I think this guidance originates from the world of embedded systems, > where storage size is a more limiting factor than on recent desktop or > server class machines. On my desktops I won't care too much whether an > executable is 1M or 100MB, but on a small SD card things add up very > quickly! Indeed, although even there the lowest-capacity SD card available in the market keeps growing. Most of the tool chain is irrelevant for embedded systems and the size makes little difference, but there are some tool chain components that may be of interest. We don't expect Clang on a constrained target, but might want find size, or strings. ___ 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: r367337 - head/contrib/libcxxrt
Author: dim Date: Wed Nov 4 17:51:09 2020 New Revision: 367337 URL: https://svnweb.freebsd.org/changeset/base/367337 Log: Make vector-related functions in libcxxrt's demangler static Follow-up to r367323 by re-adding static to a number of the functions copied from elftc's libelftc_vstr.c. This was requested by upstream. PR: 250702 MFC after:3 days Modified: head/contrib/libcxxrt/libelftc_dem_gnu3.c Modified: head/contrib/libcxxrt/libelftc_dem_gnu3.c == --- head/contrib/libcxxrt/libelftc_dem_gnu3.c Wed Nov 4 17:22:12 2020 (r367336) +++ head/contrib/libcxxrt/libelftc_dem_gnu3.c Wed Nov 4 17:51:09 2020 (r367337) @@ -153,7 +153,7 @@ get_strlen_sum(const struct vector_str *v) /** * @brief Deallocate resource in vector_str. */ -void +static void vector_str_dest(struct vector_str *v) { size_t i; @@ -174,7 +174,7 @@ vector_str_dest(struct vector_str *v) * @param l Length of the string. * @return -1 at failed, 0 at not found, 1 at found. */ -int +static int vector_str_find(const struct vector_str *v, const char *o, size_t l) { size_t i; @@ -197,7 +197,7 @@ vector_str_find(const struct vector_str *v, const char * @param l Length of the string. * @return NULL at failed or NUL terminated new allocated string. */ -char * +static char * vector_str_get_flat(const struct vector_str *v, size_t *l) { ssize_t elem_pos, elem_size, rtn_size; @@ -263,7 +263,7 @@ vector_str_grow(struct vector_str *v) * @brief Initialize vector_str. * @return false at failed, true at success. */ -bool +static bool vector_str_init(struct vector_str *v) { @@ -287,7 +287,7 @@ vector_str_init(struct vector_str *v) * @brief Remove last element in vector_str. * @return false at failed, true at success. */ -bool +static bool vector_str_pop(struct vector_str *v) { @@ -309,7 +309,7 @@ vector_str_pop(struct vector_str *v) * @brief Push back string to vector. * @return false at failed, true at success. */ -bool +static bool vector_str_push(struct vector_str *v, const char *str, size_t len) { @@ -333,7 +333,7 @@ vector_str_push(struct vector_str *v, const char *str, * @brief Push front org vector to det vector. * @return false at failed, true at success. */ -bool +static bool vector_str_push_vector_head(struct vector_str *dst, struct vector_str *org) { size_t i, j, tmp_cap; @@ -373,7 +373,7 @@ vector_str_push_vector_head(struct vector_str *dst, st * @brief Push org vector to the tail of det vector. * @return false at failed, true at success. */ -bool +static bool vector_str_push_vector(struct vector_str *dst, struct vector_str *org) { size_t i, j, tmp_cap; @@ -416,7 +416,7 @@ vector_str_push_vector(struct vector_str *dst, struct * If r_len is not NULL, string length will be returned. * @return NULL at failed or NUL terminated new allocated string. */ -char * +static char * vector_str_substr(const struct vector_str *v, size_t begin, size_t end, size_t *r_len) { ___ 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: r367304 - in head: share/man/man5 share/mk tools/build/options usr.bin usr.bin/clang usr.bin/clang/llvm-cxxfilt
On 4 Nov 2020, at 17:38, Shawn Webb wrote: > > On Wed, Nov 04, 2020 at 11:26:51AM -0500, Ed Maste wrote: >> On Tue, 3 Nov 2020 at 14:57, Dimitry Andric wrote: >>> >>> Author: dim >>> Date: Tue Nov 3 19:57:28 2020 >>> New Revision: 367304 >>> URL: https://svnweb.freebsd.org/changeset/base/367304 >>> >>> Log: >>> Add WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt >> >> A previous argument against the LLVM versions of binutils replacements >> is that they were excessively large, but this does not look like a >> substantial problem here. LLVM's cxxfilt is indeed many times the size >> of ELF Tool Chain's, but still small enough that for a tool chain >> component it's not a concern, in my opinion. >> >> ELF Tool Chain: >> $ size obj/c++filt >> text databss dec hex filename >> 66966 1008 8400 76374 0x12a56 obj/c++filt >> >> LLVM: >> $ size obj/llvm-cxxfilt >>text databss dec hex filename >> 378138 1756 9165 389059 0x5efc3 obj/llvm-cxxfilt >> >> A remaining issue is that both nm and addr2line can also demangle C++ >> symbols. > > This brings a question: is there any guidance as to what FreeBSD > considers "too large of a component" for a toolchain component (or any > other various components, like src.git/stand)? I think this guidance originates from the world of embedded systems, where storage size is a more limiting factor than on recent desktop or server class machines. On my desktops I won't care too much whether an executable is 1M or 100MB, but on a small SD card things add up very quickly! That said, llvm-related tools such as llvm-ar or llvm-cxxfilt are pretty big, mainly because all of them are written in C++ with a lot of templates, and we link the llvm and clang .a files statically into them. It would save some space to stuff all those library files into a shared library, and link the tools against that, but the disadvantage is that it will take a *lot* of memory and CPU time to link that (huge) shared library. I experimented a little with that in the past, and it's very difficult to make it work on 32-bit systems. -Dimitry signature.asc Description: Message signed with OpenPGP
svn commit: r367336 - stable/12/sys/geom/eli
Author: jhb Date: Wed Nov 4 17:22:12 2020 New Revision: 367336 URL: https://svnweb.freebsd.org/changeset/base/367336 Log: MFC 359263: Use the newer EINTEGRITY error when authentication fails. GELI used to fail with EINVAL when a read request spanned a disk sector whose contents did not match the sector's authentication tag. The recently-added EINTEGRITY more closely matches to the error in this case. Modified: stable/12/sys/geom/eli/g_eli_integrity.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/geom/eli/g_eli_integrity.c == --- stable/12/sys/geom/eli/g_eli_integrity.cWed Nov 4 16:42:20 2020 (r367335) +++ stable/12/sys/geom/eli/g_eli_integrity.cWed Nov 4 17:22:12 2020 (r367336) @@ -231,7 +231,7 @@ g_eli_auth_read_done(struct cryptop *crp) bp->bio_driver2 = NULL; if (bp->bio_error != 0) { if (bp->bio_error == -1) - bp->bio_error = EINVAL; + bp->bio_error = EINTEGRITY; else { G_ELI_LOGREQ(0, bp, "Crypto READ request failed (error=%d).", ___ 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: r367335 - in head/sys/amd64: amd64 include
Author: markj Date: Wed Nov 4 16:42:20 2020 New Revision: 367335 URL: https://svnweb.freebsd.org/changeset/base/367335 Log: amd64: Make it easier to configure exception stack sizes The amd64 kernel handles certain types of exceptions on a dedicated stack. Currently the sizes of these stacks are all hard-coded to PAGE_SIZE, but for at least NMI handling it can be useful to use larger stacks. Add constants to intr_machdep.h to make this easier to tweak. No functional change intended. Reviewed by: kib MFC after:1 week Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D27076 Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/pmap.c head/sys/amd64/include/intr_machdep.h Modified: head/sys/amd64/amd64/machdep.c == --- head/sys/amd64/amd64/machdep.c Wed Nov 4 16:30:56 2020 (r367334) +++ head/sys/amd64/amd64/machdep.c Wed Nov 4 16:42:20 2020 (r367335) @@ -670,10 +670,10 @@ cpu_setregs(void) static struct gate_descriptor idt0[NIDT]; struct gate_descriptor *idt = &idt0[0];/* interrupt descriptor table */ -static char dblfault_stack[PAGE_SIZE] __aligned(16); -static char mce0_stack[PAGE_SIZE] __aligned(16); -static char nmi0_stack[PAGE_SIZE] __aligned(16); -static char dbg0_stack[PAGE_SIZE] __aligned(16); +static char dblfault_stack[DBLFAULT_STACK_SIZE] __aligned(16); +static char mce0_stack[MCE_STACK_SIZE] __aligned(16); +static char nmi0_stack[NMI_STACK_SIZE] __aligned(16); +static char dbg0_stack[DBG_STACK_SIZE] __aligned(16); CTASSERT(sizeof(struct nmi_pcpu) == 16); /* Modified: head/sys/amd64/amd64/mp_machdep.c == --- head/sys/amd64/amd64/mp_machdep.c Wed Nov 4 16:30:56 2020 (r367334) +++ head/sys/amd64/amd64/mp_machdep.c Wed Nov 4 16:42:20 2020 (r367335) @@ -305,22 +305,22 @@ init_secondary(void) pc->pc_common_tss.tss_rsp0 = 0; /* The doublefault stack runs on IST1. */ - np = ((struct nmi_pcpu *)&doublefault_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&doublefault_stack[DBLFAULT_STACK_SIZE]) - 1; np->np_pcpu = (register_t)pc; pc->pc_common_tss.tss_ist1 = (long)np; /* The NMI stack runs on IST2. */ - np = ((struct nmi_pcpu *) &nmi_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&nmi_stack[NMI_STACK_SIZE]) - 1; np->np_pcpu = (register_t)pc; pc->pc_common_tss.tss_ist2 = (long)np; /* The MC# stack runs on IST3. */ - np = ((struct nmi_pcpu *) &mce_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&mce_stack[MCE_STACK_SIZE]) - 1; np->np_pcpu = (register_t)pc; pc->pc_common_tss.tss_ist3 = (long)np; /* The DB# stack runs on IST4. */ - np = ((struct nmi_pcpu *) &dbg_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&dbg_stack[DBG_STACK_SIZE]) - 1; np->np_pcpu = (register_t)pc; pc->pc_common_tss.tss_ist4 = (long)np; @@ -481,13 +481,14 @@ native_start_all_aps(void) /* allocate and set up an idle stack data page */ bootstacks[cpu] = (void *)kmem_malloc(kstack_pages * PAGE_SIZE, M_WAITOK | M_ZERO); - doublefault_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | - M_ZERO); - mce_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); + doublefault_stack = (char *)kmem_malloc(DBLFAULT_STACK_SIZE, + M_WAITOK | M_ZERO); + mce_stack = (char *)kmem_malloc(MCE_STACK_SIZE, + M_WAITOK | M_ZERO); nmi_stack = (char *)kmem_malloc_domainset( - DOMAINSET_PREF(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + DOMAINSET_PREF(domain), NMI_STACK_SIZE, M_WAITOK | M_ZERO); dbg_stack = (char *)kmem_malloc_domainset( - DOMAINSET_PREF(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + DOMAINSET_PREF(domain), DBG_STACK_SIZE, M_WAITOK | M_ZERO); dpcpu = (void *)kmem_malloc_domainset(DOMAINSET_PREF(domain), DPCPU_SIZE, M_WAITOK | M_ZERO); Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Wed Nov 4 16:30:56 2020(r367334) +++ head/sys/amd64/amd64/pmap.c Wed Nov 4 16:42:20 2020(r367335) @@ -157,6 +157,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -10481,17 +10482,17 @@ pmap_pti_init(void) CPU_FOREACH(i) { /* Doublefault stack IST 1 */ va = __pcpu[i].pc_common_tss.tss_ist1 + sizeof(struct nmi_pcpu); - pma
Re: svn commit: r367304 - in head: share/man/man5 share/mk tools/build/options usr.bin usr.bin/clang usr.bin/clang/llvm-cxxfilt
On Wed, Nov 04, 2020 at 11:26:51AM -0500, Ed Maste wrote: > On Tue, 3 Nov 2020 at 14:57, Dimitry Andric wrote: > > > > Author: dim > > Date: Tue Nov 3 19:57:28 2020 > > New Revision: 367304 > > URL: https://svnweb.freebsd.org/changeset/base/367304 > > > > Log: > > Add WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt > > A previous argument against the LLVM versions of binutils replacements > is that they were excessively large, but this does not look like a > substantial problem here. LLVM's cxxfilt is indeed many times the size > of ELF Tool Chain's, but still small enough that for a tool chain > component it's not a concern, in my opinion. > > ELF Tool Chain: > $ size obj/c++filt >text databss dec hex filename > 66966 1008 8400 76374 0x12a56 obj/c++filt > > LLVM: > $ size obj/llvm-cxxfilt > text databss dec hex filename > 378138 1756 9165 389059 0x5efc3 obj/llvm-cxxfilt > > A remaining issue is that both nm and addr2line can also demangle C++ symbols. This brings a question: is there any guidance as to what FreeBSD considers "too large of a component" for a toolchain component (or any other various components, like src.git/stand)? I ask mostly out of curiousity. Thanks, -- Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc signature.asc Description: PGP signature
svn commit: r367334 - in head/sys: dev/cxgbe/tom kern vm
Author: markj Date: Wed Nov 4 16:30:56 2020 New Revision: 367334 URL: https://svnweb.freebsd.org/changeset/base/367334 Log: vmspace: Convert to refcount(9) This is mostly mechanical except for vmspace_exit(). There, use the new refcount_release_if_last() to avoid switching to vmspace0 unless other processes are sharing the vmspace. In that case, upon switching to vmspace0 we can unconditionally release the reference. Remove the volatile qualifier from vm_refcnt now that accesses are protected using refcount(9) KPIs. Reviewed by: alc, kib, mmel MFC after:1 month Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D27057 Modified: head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/kern/init_main.c head/sys/kern/kern_exec.c head/sys/kern/vfs_aio.c head/sys/vm/vm_glue.c head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/dev/cxgbe/tom/t4_ddp.c == --- head/sys/dev/cxgbe/tom/t4_ddp.c Wed Nov 4 16:30:30 2020 (r367333) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Wed Nov 4 16:30:56 2020 (r367334) @@ -1347,7 +1347,7 @@ hold_aio(struct toepcb *toep, struct kaiocb *job, stru ps->offset = pgoff; ps->len = job->uaiocb.aio_nbytes; - atomic_add_int(&vm->vm_refcnt, 1); + refcount_acquire(&vm->vm_refcnt); ps->vm = vm; ps->start = start; Modified: head/sys/kern/init_main.c == --- head/sys/kern/init_main.c Wed Nov 4 16:30:30 2020(r367333) +++ head/sys/kern/init_main.c Wed Nov 4 16:30:56 2020(r367334) @@ -591,7 +591,7 @@ proc0_init(void *dummy __unused) /* Allocate a prototype map so we have something to fork. */ p->p_vmspace = &vmspace0; - vmspace0.vm_refcnt = 1; + refcount_init(&vmspace0.vm_refcnt, 1); pmap_pinit0(vmspace_pmap(&vmspace0)); /* Modified: head/sys/kern/kern_exec.c == --- head/sys/kern/kern_exec.c Wed Nov 4 16:30:30 2020(r367333) +++ head/sys/kern/kern_exec.c Wed Nov 4 16:30:56 2020(r367334) @@ -1060,7 +1060,8 @@ exec_new_vmspace(struct image_params *imgp, struct sys sv_minuser = sv->sv_minuser; else sv_minuser = MAX(sv->sv_minuser, PAGE_SIZE); - if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv_minuser && + if (refcount_load(&vmspace->vm_refcnt) == 1 && + vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser && cpu_exec_vmspace_reuse(p, map)) { shmexit(vmspace); Modified: head/sys/kern/vfs_aio.c == --- head/sys/kern/vfs_aio.c Wed Nov 4 16:30:30 2020(r367333) +++ head/sys/kern/vfs_aio.c Wed Nov 4 16:30:56 2020(r367334) @@ -1159,8 +1159,9 @@ aio_daemon(void *_id) KASSERT(p->p_vmspace == myvm, ("AIOD: bad vmspace for exiting daemon")); - KASSERT(myvm->vm_refcnt > 1, - ("AIOD: bad vm refcnt for exiting daemon: %d", myvm->vm_refcnt)); + KASSERT(refcount_load(&myvm->vm_refcnt) > 1, + ("AIOD: bad vm refcnt for exiting daemon: %d", + refcount_load(&myvm->vm_refcnt))); kproc_exit(0); } Modified: head/sys/vm/vm_glue.c == --- head/sys/vm/vm_glue.c Wed Nov 4 16:30:30 2020(r367333) +++ head/sys/vm/vm_glue.c Wed Nov 4 16:30:56 2020(r367334) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -549,7 +550,7 @@ vm_forkproc(struct thread *td, struct proc *p2, struct * COW locally. */ if ((flags & RFMEM) == 0) { - if (p1->p_vmspace->vm_refcnt > 1) { + if (refcount_load(&p1->p_vmspace->vm_refcnt) > 1) { error = vmspace_unshare(p1); if (error) return (error); @@ -561,7 +562,7 @@ vm_forkproc(struct thread *td, struct proc *p2, struct if (flags & RFMEM) { p2->p_vmspace = p1->p_vmspace; - atomic_add_int(&p1->p_vmspace->vm_refcnt, 1); + refcount_acquire(&p1->p_vmspace->vm_refcnt); } dset = td2->td_domain.dr_policy; while (vm_page_count_severe_set(&dset->ds_mask)) { Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cWed Nov 4 16:30:30 2020(r367333) +++ head/sys/vm/vm_map.cWed Nov 4 16:30:56 2020(r367334) @@ -25
svn commit: r367333 - in head: share/man/man9 sys/sys
Author: markj Date: Wed Nov 4 16:30:30 2020 New Revision: 367333 URL: https://svnweb.freebsd.org/changeset/base/367333 Log: refcount(9): Add refcount_release_if_last() and refcount_load() The former is intended for use in vmspace_exit(). The latter is to encourage use of explicit loads rather than relying on the volatile qualifier. This works better with kernel sanitizers, which can intercept atomic(9) calls, and makes tricky lockless code easier to read by not forcing the reader to remember which variables are declared volatile. Reviewed by: kib, mjg, mmel MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D27056 Modified: head/share/man/man9/refcount.9 head/sys/sys/refcount.h Modified: head/share/man/man9/refcount.9 == --- head/share/man/man9/refcount.9 Wed Nov 4 15:44:59 2020 (r367332) +++ head/share/man/man9/refcount.9 Wed Nov 4 16:30:30 2020 (r367333) @@ -32,7 +32,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2019 +.Dd November 2, 2020 .Dt REFCOUNT 9 .Os .Sh NAME @@ -46,6 +46,8 @@ .In sys/refcount.h .Ft void .Fn refcount_init "volatile u_int *count" "u_int value" +.Ft u_int +.Fn refcount_load "volatile u_int *count" .Ft void .Fn refcount_acquire "volatile u_int *count" .Ft bool @@ -55,6 +57,8 @@ .Ft bool .Fn refcount_release "volatile u_int *count" .Ft bool +.Fn refcount_release_if_last "volatile u_int *count" +.Ft bool .Fn refcount_release_if_not_last "volatile u_int *count" .Sh DESCRIPTION The @@ -75,6 +79,16 @@ function is used to set the initial value of the count It is normally used when creating a reference-counted object. .Pp The +.Fn refcount_load +function returns a snapshot of the counter value. +This value may immediately become out-of-date in the absence of external +synchronization. +.Fn refcount_load +should be used instead of relying on the properties of the +.Vt volatile +qualifier. +.Pp +The .Fn refcount_acquire function is used to acquire a new reference. The caller is responsible for ensuring that it holds a valid reference @@ -119,16 +133,33 @@ the last reference; otherwise, it returns false. .Pp The +.Fn refcount_release_if_last +and .Fn refcount_release_if_not_last -is a variant of +functions are variants of .Fn refcount_release -which only drops the reference when it is not the last reference. -In other words, the function returns +which only drop the reference when it is or is not the last reference, +respectively. +In other words, +.Fn refcount_release_if_last +returns .Dv true when .Fa *count +is equal to one, in which case it is decremented to zero. +Otherwise, +.Fa *count +is not modified and the function returns +.Dv false . +Similarly, +.Fn refcount_release_if_not_last +returns +.Dv true +when +.Fa *count is greater than one, in which case -.Fa *count is decremented. +.Fa *count +is decremented. Otherwise, if .Fa *count is equal to one, the reference is not released and the function returns Modified: head/sys/sys/refcount.h == --- head/sys/sys/refcount.h Wed Nov 4 15:44:59 2020(r367332) +++ head/sys/sys/refcount.h Wed Nov 4 16:30:30 2020(r367333) @@ -67,6 +67,12 @@ refcount_init(volatile u_int *count, u_int value) } static __inline u_int +refcount_load(volatile u_int *count) +{ + return (atomic_load_int(count)); +} + +static __inline u_int refcount_acquire(volatile u_int *count) { u_int old; @@ -168,32 +174,50 @@ refcount_release(volatile u_int *count) return (refcount_releasen(count, 1)); } +#define_refcount_release_if_cond(cond, name) \ +static __inline __result_use_check bool \ +_refcount_release_if_##name(volatile u_int *count, u_int n)\ +{ \ + u_int old; \ + \ + KASSERT(n > 0, ("%s: zero increment", __func__)); \ + old = atomic_load_int(count); \ + for (;;) { \ + if (!(cond))\ + return (false); \ + if (__predict_false(REFCOUNT_SATURATED(old))) \ + return (false); \ + if (atomic_fcmpset_rel_int(count, &old, old - 1)) \ + return (true); \ + } \ +} +_refcount_release_if_cond(old >
Re: svn commit: r367304 - in head: share/man/man5 share/mk tools/build/options usr.bin usr.bin/clang usr.bin/clang/llvm-cxxfilt
On Tue, 3 Nov 2020 at 14:57, Dimitry Andric wrote: > > Author: dim > Date: Tue Nov 3 19:57:28 2020 > New Revision: 367304 > URL: https://svnweb.freebsd.org/changeset/base/367304 > > Log: > Add WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt A previous argument against the LLVM versions of binutils replacements is that they were excessively large, but this does not look like a substantial problem here. LLVM's cxxfilt is indeed many times the size of ELF Tool Chain's, but still small enough that for a tool chain component it's not a concern, in my opinion. ELF Tool Chain: $ size obj/c++filt text databss dec hex filename 66966 1008 8400 76374 0x12a56 obj/c++filt LLVM: $ size obj/llvm-cxxfilt text databss dec hex filename 378138 1756 9165 389059 0x5efc3 obj/llvm-cxxfilt A remaining issue is that both nm and addr2line can also demangle C++ symbols. ___ 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: r367332 - head/usr.sbin/pmcstat
Author: 0mp (doc,ports committer) Date: Wed Nov 4 15:44:59 2020 New Revision: 367332 URL: https://svnweb.freebsd.org/changeset/base/367332 Log: pmcstat: Fix a typo in the usage message Reviewed by: emaste Approved by: emaste Differential Revision:https://reviews.freebsd.org/D26082 Modified: head/usr.sbin/pmcstat/pmcstat.c Modified: head/usr.sbin/pmcstat/pmcstat.c == --- head/usr.sbin/pmcstat/pmcstat.c Wed Nov 4 14:31:52 2020 (r367331) +++ head/usr.sbin/pmcstat/pmcstat.c Wed Nov 4 15:44:59 2020 (r367332) @@ -374,7 +374,7 @@ pmcstat_show_usage(void) "\t -R file\t read events from \"file\"\n" "\t -S spec\t allocate a system-wide sampling PMC\n" "\t -T\t\t start in top mode\n" - "\t -U \t\n merged user kernel stack capture\n" + "\t -U \t\t merged user kernel stack capture\n" "\t -W\t\t (toggle) show counts per context switch\n" "\t -a file\t print sampled PCs and callgraph to \"file\"\n" "\t -c cpu-list\t set cpus for subsequent system-wide PMCs\n" ___ 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: r367321 - head/sys/amd64/linux
On Wed, 4 Nov 2020 at 07:10, Kristof Provost wrote: > > > And why you just abandoned the differential [1]? > > > Probably because it timed out. The review had been pending since August. > Arguably the differential link should have been included as well, but > it’s hardly important in this case. I don’t think we have explicit > policies about this. We probably should. Yes, it's still worth including the phab URL so that it closes automatically and so that others can see how long it was open for. I take no issue with the change itself. ___ 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: r367331 - head/usr.sbin/jls
Author: arichardson Date: Wed Nov 4 14:31:52 2020 New Revision: 367331 URL: https://svnweb.freebsd.org/changeset/base/367331 Log: Fix bad libbxo format strings in jls The existing format string for the empty case was trying to read varargs values that weren't passed to xo_emit. This appears to work on x86 (since the next argument is probably a pointer an empty string), but for CHERI we can bound variadic arguments and detect a read past the end. While touching these lines also use the libxo 'a' modifier to avoid having to construct the libxo format string using asprintf. Found by: CHERI Reviewed By: allanjude Differential Revision: https://reviews.freebsd.org/D26885 Modified: head/usr.sbin/jls/jls.c Modified: head/usr.sbin/jls/jls.c == --- head/usr.sbin/jls/jls.c Wed Nov 4 14:13:29 2020(r367330) +++ head/usr.sbin/jls/jls.c Wed Nov 4 14:31:52 2020(r367331) @@ -505,17 +505,13 @@ quoted_print(int pflags, char *name, char *value) { int qc; char *p = value; - char *param_name_value; /* An empty string needs quoting. */ if (!*p) { - asprintf(¶m_name_value, "{k:%s}{d:%s/\"\"}", name, name); - xo_emit(param_name_value); - free(param_name_value); + xo_emit("{ea:/%s}{da:/\"\"}", name, value, name); return; } - asprintf(¶m_name_value, "{:%s/%%s}", name); /* * The value will be surrounded by quotes if it contains spaces * or quotes. @@ -528,9 +524,7 @@ quoted_print(int pflags, char *name, char *value) if (qc && pflags & PRINT_QUOTED) xo_emit("{P:/%c}", qc); - xo_emit(param_name_value, value); - - free(param_name_value); + xo_emit("{a:/%s}", name, value); if (qc && pflags & PRINT_QUOTED) xo_emit("{P:/%c}", qc); ___ 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: r367321 - head/sys/amd64/linux
Hi! On 11/4/20 1:09 PM, Kristof Provost wrote: On 4 Nov 2020, at 11:45, Gordon Bergling wrote: Shouldn't such a commit be approved by someone? The committer’s guide seems clear that doc committers may fix comments: https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/committer.types.html doc committers may commit documentation changes to src files, such as man pages, READMEs, fortune databases, calendar files, and comment fixes without approval from a src committer, subject to the normal care and tending of commits. Arguably minor spelling fixes are not worth confusing the blame output for, but this seems well within the established rules. +1 BTW, I've another similar patch pending (this time for pmcstat) if some src committer could take a look: https://reviews.freebsd.org/D26082. And why you just abandoned the differential [1]? Probably because it timed out. The review had been pending since August. Arguably the differential link should have been included as well, but it’s hardly important in this case. I don’t think we have explicit policies about this. We probably should. I forgot to link to the review on Phabricator. I didn't follow up with an email as it didn't seem important enough to show up in everyone's mailbox. Cheers! Mateusz ___ 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: r367330 - stable/12/sbin/nvmecontrol
Author: mav Date: Wed Nov 4 14:13:29 2020 New Revision: 367330 URL: https://svnweb.freebsd.org/changeset/base/367330 Log: MFC r367112: Use proper variable for device path. It seems *-passthru commands were broken from the day one, since the device path is fetched into opt.dev variable and not left in argv[optind]. The other three wrong argv[optind] instances are just in error messages. Modified: stable/12/sbin/nvmecontrol/ns.c stable/12/sbin/nvmecontrol/passthru.c stable/12/sbin/nvmecontrol/reset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/nvmecontrol/ns.c == --- stable/12/sbin/nvmecontrol/ns.c Wed Nov 4 14:12:29 2020 (r367329) +++ stable/12/sbin/nvmecontrol/ns.c Wed Nov 4 14:13:29 2020 (r367330) @@ -605,7 +605,7 @@ nscreate(const struct cmd *f, int argc, char *argv[]) pt.len = sizeof(struct nvme_namespace_data); pt.is_read = 0; /* passthrough writes data to ctrlr */ if ((result = ioctl(fd, NVME_PASSTHROUGH_CMD, &pt)) < 0) - errx(1, "ioctl request to %s failed: %d", argv[optind], result); + errx(1, "ioctl request to %s failed: %d", create_opt.dev, result); if (nvme_completion_is_error(&pt.cpl)) { errx(1, "namespace creation failed: %s", @@ -822,7 +822,7 @@ nsdetach(const struct cmd *f, int argc, char *argv[]) pt.len = sizeof(clist); if ((result = ioctl(fd, NVME_PASSTHROUGH_CMD, &pt)) < 0) - errx(1, "ioctl request to %s failed: %d", argv[optind], result); + errx(1, "ioctl request to %s failed: %d", detach_opt.dev, result); if (nvme_completion_is_error(&pt.cpl)) { errx(1, "namespace detach failed: %s", Modified: stable/12/sbin/nvmecontrol/passthru.c == --- stable/12/sbin/nvmecontrol/passthru.c Wed Nov 4 14:12:29 2020 (r367329) +++ stable/12/sbin/nvmecontrol/passthru.c Wed Nov 4 14:13:29 2020 (r367330) @@ -164,7 +164,7 @@ passthru(const struct cmd *f, int argc, char *argv[]) if (arg_parse(argc, argv, f)) return; - open_dev(argv[optind], &fd, 1, 1); + open_dev(opt.dev, &fd, 1, 1); if (opt.read && opt.write) errx(1, "need exactly one of --read or --write"); Modified: stable/12/sbin/nvmecontrol/reset.c == --- stable/12/sbin/nvmecontrol/reset.c Wed Nov 4 14:12:29 2020 (r367329) +++ stable/12/sbin/nvmecontrol/reset.c Wed Nov 4 14:13:29 2020 (r367330) @@ -70,7 +70,7 @@ reset(const struct cmd *f, int argc, char *argv[]) free(path); if (ioctl(fd, NVME_RESET_CONTROLLER) < 0) - err(1, "reset request to %s failed", argv[optind]); + err(1, "reset request to %s failed", opt.dev); exit(0); } ___ 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: r367329 - stable/12/sys/dev/nvme
Author: mav Date: Wed Nov 4 14:12:29 2020 New Revision: 367329 URL: https://svnweb.freebsd.org/changeset/base/367329 Log: MFC r367109, r367113: Print NVMe controller capabilities in verbose dmesg. Those values are not reported in controller identification, while sometimes interesting for development and debugging. Modified: stable/12/sys/dev/nvme/nvme.h stable/12/sys/dev/nvme/nvme_ctrlr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/nvme/nvme.h == --- stable/12/sys/dev/nvme/nvme.h Wed Nov 4 13:43:34 2020 (r367328) +++ stable/12/sys/dev/nvme/nvme.h Wed Nov 4 14:12:29 2020 (r367329) @@ -84,6 +84,8 @@ #define NVME_CAP_HI_REG_DSTRD_MASK (0xF) #define NVME_CAP_HI_REG_NSSRS_SHIFT(4) #define NVME_CAP_HI_REG_NSSRS_MASK (0x1) +#define NVME_CAP_HI_REG_CSS_SHIFT (5) +#define NVME_CAP_HI_REG_CSS_MASK (0xff) #define NVME_CAP_HI_REG_CSS_NVM_SHIFT (5) #define NVME_CAP_HI_REG_CSS_NVM_MASK (0x1) #define NVME_CAP_HI_REG_BPS_SHIFT (13) @@ -98,12 +100,22 @@ #define NVME_CAP_HI_REG_CMBS_MASK (0x1) #define NVME_CAP_HI_DSTRD(x) \ (((x) >> NVME_CAP_HI_REG_DSTRD_SHIFT) & NVME_CAP_HI_REG_DSTRD_MASK) +#define NVME_CAP_HI_NSSRS(x) \ + (((x) >> NVME_CAP_HI_REG_NSSRS_SHIFT) & NVME_CAP_HI_REG_NSSRS_MASK) +#define NVME_CAP_HI_CSS(x) \ + (((x) >> NVME_CAP_HI_REG_CSS_SHIFT) & NVME_CAP_HI_REG_CSS_MASK) #define NVME_CAP_HI_CSS_NVM(x) \ (((x) >> NVME_CAP_HI_REG_CSS_NVM_SHIFT) & NVME_CAP_HI_REG_CSS_NVM_MASK) +#define NVME_CAP_HI_BPS(x) \ + (((x) >> NVME_CAP_HI_REG_BPS_SHIFT) & NVME_CAP_HI_REG_BPS_MASK) #define NVME_CAP_HI_MPSMIN(x) \ (((x) >> NVME_CAP_HI_REG_MPSMIN_SHIFT) & NVME_CAP_HI_REG_MPSMIN_MASK) #define NVME_CAP_HI_MPSMAX(x) \ (((x) >> NVME_CAP_HI_REG_MPSMAX_SHIFT) & NVME_CAP_HI_REG_MPSMAX_MASK) +#define NVME_CAP_HI_PMRS(x) \ + (((x) >> NVME_CAP_HI_REG_PMRS_SHIFT) & NVME_CAP_HI_REG_PMRS_MASK) +#define NVME_CAP_HI_CMBS(x) \ + (((x) >> NVME_CAP_HI_REG_CMBS_SHIFT) & NVME_CAP_HI_REG_CMBS_MASK) #define NVME_CC_REG_EN_SHIFT (0) #define NVME_CC_REG_EN_MASK(0x1) Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c == --- stable/12/sys/dev/nvme/nvme_ctrlr.c Wed Nov 4 13:43:34 2020 (r367328) +++ stable/12/sys/dev/nvme/nvme_ctrlr.c Wed Nov 4 14:12:29 2020 (r367329) @@ -1329,7 +1329,7 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de struct make_dev_argsmd_args; uint32_tcap_lo; uint32_tcap_hi; - uint32_tto; + uint32_tto, vs; uint8_t mpsmin; int status, timeout_period; @@ -1339,14 +1339,41 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de if (bus_get_domain(dev, &ctrlr->domain) != 0) ctrlr->domain = 0; + cap_lo = nvme_mmio_read_4(ctrlr, cap_lo); + if (bootverbose) { + device_printf(dev, "CapLo: 0x%08x: MQES %u%s%s%s%s, TO %u\n", + cap_lo, NVME_CAP_LO_MQES(cap_lo), + NVME_CAP_LO_CQR(cap_lo) ? ", CQR" : "", + NVME_CAP_LO_AMS(cap_lo) ? ", AMS" : "", + (NVME_CAP_LO_AMS(cap_lo) & 0x1) ? " WRRwUPC" : "", + (NVME_CAP_LO_AMS(cap_lo) & 0x2) ? " VS" : "", + NVME_CAP_LO_TO(cap_lo)); + } cap_hi = nvme_mmio_read_4(ctrlr, cap_hi); + if (bootverbose) { + device_printf(dev, "CapHi: 0x%08x: DSTRD %u%s, CSS %x%s, " + "MPSMIN %u, MPSMAX %u %s%s\n", cap_hi, + NVME_CAP_HI_DSTRD(cap_hi), + NVME_CAP_HI_NSSRS(cap_lo) ? ", NSSRS" : "", + NVME_CAP_HI_CSS(cap_hi), + NVME_CAP_HI_BPS(cap_lo) ? ", BPS" : "", + NVME_CAP_HI_MPSMIN(cap_hi), + NVME_CAP_HI_MPSMAX(cap_hi), + NVME_CAP_HI_PMRS(cap_lo) ? ", PMRS" : "", + NVME_CAP_HI_CMBS(cap_lo) ? ", CMBS" : ""); + } + if (bootverbose) { + vs = nvme_mmio_read_4(ctrlr, vs); + device_printf(dev, "Version: 0x%08x: %d.%d\n", vs, + NVME_MAJOR(vs), NVME_MINOR(vs)); + } + ctrlr->dstrd = NVME_CAP_HI_DSTRD(cap_hi) + 2; mpsmin = NVME_CAP_HI_MPSMIN(cap_hi); ctrlr->min_page_size = 1 << (12 + mpsmin); /* Get ready timeout value from controller, in units of 500ms. */ - cap_lo = nvme_mmio_read_4(ctrlr, cap_lo); to = NVME_CAP_LO_TO(cap_lo) + 1; ctrlr->ready_timeout_in_ms = to * 500; _
svn commit: r367328 - head/share/man/man4
Author: manu Date: Wed Nov 4 13:43:34 2020 New Revision: 367328 URL: https://svnweb.freebsd.org/changeset/base/367328 Log: acpi_video(4): mention that acpi_video should be loaded after any drm driver When not adhering to this order, brightness sysctl's do not show up on some laptop. Submitted by: driesm.michi...@gmail.com Reviewed by: uqs Differential Revision:https://reviews.freebsd.org/D26073 Modified: head/share/man/man4/acpi_video.4 Modified: head/share/man/man4/acpi_video.4 == --- head/share/man/man4/acpi_video.4Wed Nov 4 12:11:50 2020 (r367327) +++ head/share/man/man4/acpi_video.4Wed Nov 4 13:43:34 2020 (r367328) @@ -63,6 +63,15 @@ Preset brightness level to be used in economy mode. Defaults for these variables can be set in .Xr sysctl.conf 5 , which is parsed at boot-time. +.Sh COMPATIBILITY +In order for +.Nm +to attach correctly, +.Nm +should be loaded after any of the DRM kernel modules. +This can be achieved by setting the correct order in +.Xr rc.conf 5 +using the kld_list directive. .Sh SEE ALSO .Xr acpi 4 , .Xr loader.conf 5 , ___ 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: r367327 - head/sys/arm64/arm64
Author: bz Date: Wed Nov 4 12:11:50 2020 New Revision: 367327 URL: https://svnweb.freebsd.org/changeset/base/367327 Log: arm64: implement bs_sr_ Implement the bs_sr_ generic functions based on the generic mips implementation calling the generic bs_w_ functions in a loop. ral(4) (rt2860.c) panics in RAL_SET_REGION_4() because bs_sr_4() is NULL. It seems ral(4) and ti(4) might be the only consumers of these functions I could find quickly so keeping them in C rather than asm. Reported by: Steve Wheeler (https://redmine.pfsense.org/issues/11021) Reviewed by: mmel MFC after:3 days Modified: head/sys/arm64/arm64/bus_machdep.c Modified: head/sys/arm64/arm64/bus_machdep.c == --- head/sys/arm64/arm64/bus_machdep.c Wed Nov 4 12:07:33 2020 (r367326) +++ head/sys/arm64/arm64/bus_machdep.c Wed Nov 4 12:11:50 2020 (r367327) @@ -128,6 +128,50 @@ generic_bs_subregion(void *t, bus_space_handle_t bsh, return (0); } +/* + * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described + * by tag/handle starting at `offset'. + */ +static void +generic_bs_sr_1(void *t, bus_space_handle_t bsh, +bus_size_t offset, uint8_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr++) + generic_bs_w_1(t, bsh, addr, value); +} + +static void +generic_bs_sr_2(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint16_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr += 2) + generic_bs_w_2(t, bsh, addr, value); +} + +static void +generic_bs_sr_4(void *t, bus_space_handle_t bsh, +bus_size_t offset, uint32_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr += 4) + generic_bs_w_4(t, bsh, addr, value); +} + +static void +generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset, +uint64_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr += 8) + generic_bs_w_8(t, bsh, addr, value); +} + struct bus_space memmap_bus = { /* cookie */ .bs_cookie = NULL, @@ -187,10 +231,10 @@ struct bus_space memmap_bus = { .bs_sm_8 = NULL, /* set region */ - .bs_sr_1 = NULL, - .bs_sr_2 = NULL, - .bs_sr_4 = NULL, - .bs_sr_8 = NULL, + .bs_sr_1 = generic_bs_sr_1, + .bs_sr_2 = generic_bs_sr_2, + .bs_sr_4 = generic_bs_sr_4, + .bs_sr_8 = generic_bs_sr_8, /* copy */ .bs_c_1 = 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"
Re: svn commit: r367321 - head/sys/amd64/linux
On 4 Nov 2020, at 11:45, Gordon Bergling wrote: Shouldn't such a commit be approved by someone? The committer’s guide seems clear that doc committers may fix comments: https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/committer.types.html doc committers may commit documentation changes to src files, such as man pages, READMEs, fortune databases, calendar files, and comment fixes without approval from a src committer, subject to the normal care and tending of commits. Arguably minor spelling fixes are not worth confusing the blame output for, but this seems well within the established rules. And why you just abandoned the differential [1]? Probably because it timed out. The review had been pending since August. Arguably the differential link should have been included as well, but it’s hardly important in this case. I don’t think we have explicit policies about this. We probably should. Best regards, Kristof ___ 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: r367326 - head/sys/net80211
Author: bz Date: Wed Nov 4 12:07:33 2020 New Revision: 367326 URL: https://svnweb.freebsd.org/changeset/base/367326 Log: net80211: fix a typo Correct a typo referring to the wrong flags in a comment. No functional changes. MFC after:3 days Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") Modified: head/sys/net80211/_ieee80211.h Modified: head/sys/net80211/_ieee80211.h == --- head/sys/net80211/_ieee80211.h Wed Nov 4 11:48:08 2020 (r367325) +++ head/sys/net80211/_ieee80211.h Wed Nov 4 12:07:33 2020 (r367326) @@ -619,7 +619,7 @@ struct ieee80211_rx_stats { } evm; /* 32 bits */ - uint8_t c_phytype; /* PHY type, FW flags above */ + uint8_t c_phytype; /* PHY type, FP flags above */ uint8_t c_vhtnss; /* VHT - number of spatial streams */ uint8_t c_pad2[2]; }; ___ 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: r367325 - head/sys/arm64/include
Author: andrew Date: Wed Nov 4 11:48:08 2020 New Revision: 367325 URL: https://svnweb.freebsd.org/changeset/base/367325 Log: Add the pmap.h changes missed in r367320 Reported by: bz Sponsored by: Innovate UK Modified: head/sys/arm64/include/pmap.h Modified: head/sys/arm64/include/pmap.h == --- head/sys/arm64/include/pmap.h Wed Nov 4 11:23:19 2020 (r367324) +++ head/sys/arm64/include/pmap.h Wed Nov 4 11:48:08 2020 (r367325) @@ -85,6 +85,7 @@ enum pmap_stage { struct pmap { struct mtx pm_mtx; struct pmap_statistics pm_stats; /* pmap statistics */ + uint64_tpm_ttbr; vm_paddr_t pm_l0_paddr; pd_entry_t *pm_l0; TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ @@ -92,6 +93,7 @@ struct pmap { longpm_cookie; /* encodes the pmap's ASID */ struct asid_set *pm_asid_set; /* The ASID/VMID set to use */ enum pmap_stage pm_stage; + int pm_levels; }; typedef struct pmap *pmap_t; @@ -170,7 +172,7 @@ voidpmap_kremove(vm_offset_t); void pmap_kremove_device(vm_offset_t, vm_size_t); void *pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma); bool pmap_page_is_mapped(vm_page_t m); -intpmap_pinit_stage(pmap_t, enum pmap_stage); +intpmap_pinit_stage(pmap_t, enum pmap_stage, int); bool pmap_ps_enabled(pmap_t pmap); uint64_t pmap_to_ttbr0(pmap_t pmap); ___ 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: r367324 - in head/share: man/man5 mk
Author: dim Date: Wed Nov 4 11:23:19 2020 New Revision: 367324 URL: https://svnweb.freebsd.org/changeset/base/367324 Log: Turn on WITH_LLVM_CXXFILT by default LLVM's demangler supports more modern C++ constructs such as lambdas and unnamed types, and is actively maintained. The command line tool is usable as a drop-in replacement for GNU c++filt, or elftoolchain's cxxfilt. The latter is still available by using WITHOUT_LLVM_CXXFILT, if needed. PR: 250702 MFC after:2 weeks Modified: head/share/man/man5/src.conf.5 head/share/mk/src.opts.mk Modified: head/share/man/man5/src.conf.5 == --- head/share/man/man5/src.conf.5 Wed Nov 4 11:13:36 2020 (r367323) +++ head/share/man/man5/src.conf.5 Wed Nov 4 11:23:19 2020 (r367324) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd November 3, 2020 +.Dd November 4, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -919,8 +919,8 @@ Set to disable debugging assertions in LLVM. Set to not build the .Xr llvm-cov 1 tool. -.It Va WITH_LLVM_CXXFILT -Install LLVM's llvm-cxxfilt as c++filt, instead of ELF Tool Chain's cxxfilt. +.It Va WITHOUT_LLVM_CXXFILT +Install ELF Tool Chain's cxxfilt as c++filt, instead of LLVM's llvm-cxxfilt. .It Va WITHOUT_LLVM_TARGET_AARCH64 Set to not build LLVM target support for AArch64. The Modified: head/share/mk/src.opts.mk == --- head/share/mk/src.opts.mk Wed Nov 4 11:13:36 2020(r367323) +++ head/share/mk/src.opts.mk Wed Nov 4 11:23:19 2020(r367324) @@ -135,6 +135,7 @@ __DEFAULT_YES_OPTIONS = \ LLD_IS_LD \ LLVM_ASSERTIONS \ LLVM_COV \ +LLVM_CXXFILT \ LLVM_TARGET_ALL \ LOADER_GELI \ LOADER_LUA \ @@ -210,7 +211,6 @@ __DEFAULT_NO_OPTIONS = \ GNU_GREP_COMPAT \ HESIOD \ LIBSOFT \ -LLVM_CXXFILT \ LOADER_FIREWIRE \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ ___ 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: r367323 - head/contrib/libcxxrt
Author: dim Date: Wed Nov 4 11:13:36 2020 New Revision: 367323 URL: https://svnweb.freebsd.org/changeset/base/367323 Log: Update libcxxrt's private copy of elftoolchain demangler This updates the private copy of libelftc_dem_gnu3.c in libcxxrt with the most recent version from upstream r3877. Similar to r367322, this fixes a number of possible assertions, and allows it to correctly demangle several names that it could not handle before. PR: 250702 MFC after:3 days Modified: head/contrib/libcxxrt/libelftc_dem_gnu3.c Modified: head/contrib/libcxxrt/libelftc_dem_gnu3.c == --- head/contrib/libcxxrt/libelftc_dem_gnu3.c Wed Nov 4 11:02:05 2020 (r367322) +++ head/contrib/libcxxrt/libelftc_dem_gnu3.c Wed Nov 4 11:13:36 2020 (r367323) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2007, 2008 Hyogeol Lee + * Copyright (c) 2007 Hyogeol Lee + * Copyright (c) 2015-2017 Kai Wang * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,12 +55,17 @@ struct vector_str { }; #define BUFFER_GROWFACTOR 1.618 -#define VECTOR_DEF_CAPACITY8 +#define BUFFER_GROW(x) (((x)+0.5)*BUFFER_GROWFACTOR) + +#defineELFTC_FAILURE 0 #defineELFTC_ISDIGIT(C)(isdigit((C) & 0xFF)) +#defineELFTC_SUCCESS 1 +#define VECTOR_DEF_CAPACITY8 + enum type_qualifier { TYPE_PTR, TYPE_REF, TYPE_CMX, TYPE_IMG, TYPE_EXT, TYPE_RST, TYPE_VAT, - TYPE_CST, TYPE_VEC + TYPE_CST, TYPE_VEC, TYPE_RREF }; struct vector_type_qualifier { @@ -73,35 +79,57 @@ enum read_cmd { READ_TYPE, READ_FUNC, READ_PTRMEM }; +struct read_cmd_item { + enum read_cmd cmd; + void *data; +}; + struct vector_read_cmd { size_t size, capacity; - enum read_cmd *r_container; + struct read_cmd_item *r_container; }; +enum push_qualifier { + PUSH_ALL_QUALIFIER, + PUSH_CV_QUALIFIER, + PUSH_NON_CV_QUALIFIER, +}; + struct cpp_demangle_data { struct vector_stroutput;/* output string vector */ - struct vector_stroutput_tmp; struct vector_strsubst; /* substitution string vector */ struct vector_strtmpl; struct vector_strclass_type; + struct vector_str *cur_output;/* ptr to current output vec */ struct vector_read_cmd cmd; - bool paren; /* parenthesis opened */ - bool pfirst;/* first element of parameter */ bool mem_rst; /* restrict member function */ bool mem_vat; /* volatile member function */ bool mem_cst; /* const member function */ + bool mem_ref; /* lvalue-ref member func */ + bool mem_rref; /* rvalue-ref member func */ + bool is_tmpl; /* template args */ + bool is_functype; /* function type */ + bool ref_qualifier; /* ref qualifier */ + enum type_qualifier ref_qualifier_type; /* ref qualifier type */ + enum push_qualifier push_qualifier; /* which qualifiers to push */ int func_type; const char *cur; /* current mangled name ptr */ const char *last_sname;/* last source name */ - int push_head; }; +struct type_delimit { + bool paren; + bool firstp; +}; + #defineCPP_DEMANGLE_TRY_LIMIT 128 #defineFLOAT_SPRINTF_TRY_LIMIT 5 #defineFLOAT_QUADRUPLE_BYTES 16 #defineFLOAT_EXTENED_BYTES 10 #define SIMPLE_HASH(x,y) (64 * x + y) +#define DEM_PUSH_STR(d,s) cpp_demangle_push_str((d), (s), strlen((s))) +#define VEC_PUSH_STR(d,s) vector_str_push((d), (s), strlen((s))) static size_t get_strlen_sum(const struct vector_str *v); static boolvector_str_grow(struct vector_str *v); @@ -125,7 +153,7 @@ get_strlen_sum(const struct vector_str *v) /** * @brief Deallocate resource in vector_str. */ -static void +void vector_str_dest(struct vector_str *v) { size_t i; @@ -146,7 +174,7 @@ vector_str_dest(struct vector_str *v) * @param l Length of the string. * @return -1 at failed, 0 at not found, 1 at found. */ -static int +int vector_str_find(const struct vector_str *v, const char *o, size_t l) { size_t i; @@ -169,7 +197,7 @@ vector_str_find(const struct vector_str *v, const char * @param l Length of the string. * @return NULL at failed or NUL terminated new allocated string. */ -static char * +char * vector_str_get_flat(const struct vector_str *v, size_t *l) { ssize_t elem_pos, elem_size, rtn_
svn commit: r367322 - head/contrib/elftoolchain/libelftc
Author: dim Date: Wed Nov 4 11:02:05 2020 New Revision: 367322 URL: https://svnweb.freebsd.org/changeset/base/367322 Log: Merge elftoolchain r3877 (by jkoshy): Incorporate fixes from Dimitry Andric: - Use a BUFFER_GROW() macro to avoid rounding errors in capacity calculations. - Fix a bug introduced in [r3531]. - Fix handling of nested template parameters. Ticket: #581 This should fix a number of assertions on elftoolchain's cxxfilt, and allow it to correctly demangle several names that it could not handle before. Obtained from:https://sourceforge.net/p/elftoolchain/code/3877/ PR: 250702 MFC after:3 days Modified: head/contrib/elftoolchain/libelftc/_libelftc.h head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c head/contrib/elftoolchain/libelftc/libelftc_vstr.c Modified: head/contrib/elftoolchain/libelftc/_libelftc.h == --- head/contrib/elftoolchain/libelftc/_libelftc.h Wed Nov 4 10:38:25 2020(r367321) +++ head/contrib/elftoolchain/libelftc/_libelftc.h Wed Nov 4 11:02:05 2020(r367322) @@ -56,6 +56,7 @@ struct vector_str { }; #define BUFFER_GROWFACTOR 1.618 +#define BUFFER_GROW(x) (((x)+0.5)*BUFFER_GROWFACTOR) #defineELFTC_FAILURE 0 #defineELFTC_ISDIGIT(C)(isdigit((C) & 0xFF)) Modified: head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c == --- head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Wed Nov 4 10:38:25 2020(r367321) +++ head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Wed Nov 4 11:02:05 2020(r367322) @@ -2135,10 +2135,10 @@ cpp_demangle_read_sname(struct cpp_demangle_data *ddat if (err == 0) return (0); - assert(ddata->output.size > 0); + assert(ddata->cur_output->size > 0); if (vector_read_cmd_find(&ddata->cmd, READ_TMPL) == NULL) ddata->last_sname = - ddata->output.container[ddata->output.size - 1]; + ddata->cur_output->container[ddata->output.size - 1]; ddata->cur += len; @@ -2421,7 +2421,7 @@ cpp_demangle_read_tmpl_args(struct cpp_demangle_data * return (0); limit = 0; - v = &ddata->output; + v = ddata->cur_output; for (;;) { idx = v->size; if (!cpp_demangle_read_tmpl_arg(ddata)) @@ -3909,7 +3909,7 @@ vector_read_cmd_push(struct vector_read_cmd *v, enum r return (0); if (v->size == v->capacity) { - tmp_cap = v->capacity * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(v->capacity); if ((tmp_r_ctn = malloc(sizeof(*tmp_r_ctn) * tmp_cap)) == NULL) return (0); for (i = 0; i < v->size; ++i) @@ -3974,7 +3974,7 @@ vector_type_qualifier_push(struct vector_type_qualifie return (0); if (v->size == v->capacity) { - tmp_cap = v->capacity * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(v->capacity); if ((tmp_ctn = malloc(sizeof(enum type_qualifier) * tmp_cap)) == NULL) return (0); Modified: head/contrib/elftoolchain/libelftc/libelftc_vstr.c == --- head/contrib/elftoolchain/libelftc/libelftc_vstr.c Wed Nov 4 10:38:25 2020(r367321) +++ head/contrib/elftoolchain/libelftc/libelftc_vstr.c Wed Nov 4 11:02:05 2020(r367322) @@ -152,7 +152,7 @@ vector_str_grow(struct vector_str *v) assert(v->capacity > 0); - tmp_cap = v->capacity * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(v->capacity); assert(tmp_cap > v->capacity); @@ -253,7 +253,7 @@ vector_str_push_vector_head(struct vector_str *dst, st if (dst == NULL || org == NULL) return (false); - tmp_cap = (dst->size + org->size) * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(dst->size + org->size); if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL) return (false); @@ -293,7 +293,7 @@ vector_str_push_vector(struct vector_str *dst, struct if (dst == NULL || org == NULL) return (false); - tmp_cap = (dst->size + org->size) * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(dst->size + org->size); if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL) return (false); ___ 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: r367321 - head/sys/amd64/linux
Shouldn't such a commit be approved by someone? And why you just abandoned the differential [1]? [1] https://reviews.freebsd.org/D25934 --Gordon On Wed, Nov 04, 2020 at 10:38:25AM +, Mateusz Piotrowski wrote: > Author: 0mp (doc,ports committer) > Date: Wed Nov 4 10:38:25 2020 > New Revision: 367321 > URL: https://svnweb.freebsd.org/changeset/base/367321 > > Log: > Fix a typo > > Modified: > head/sys/amd64/linux/linux_machdep.c > > Modified: head/sys/amd64/linux/linux_machdep.c > == > --- head/sys/amd64/linux/linux_machdep.c Wed Nov 4 10:21:30 2020 > (r367320) > +++ head/sys/amd64/linux/linux_machdep.c Wed Nov 4 10:38:25 2020 > (r367321) > @@ -126,7 +126,7 @@ linux_set_upcall_kse(struct thread *td, register_t sta > > /* >* The newly created Linux thread returns > - * to the user space by the same path that a parent do. > + * to the user space by the same path that a parent does. >*/ > td->td_frame->tf_rax = 0; > return (0); > ___ > svn-src-h...@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org" -- ___ svn-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: r367321 - head/sys/amd64/linux
Author: 0mp (doc,ports committer) Date: Wed Nov 4 10:38:25 2020 New Revision: 367321 URL: https://svnweb.freebsd.org/changeset/base/367321 Log: Fix a typo Modified: head/sys/amd64/linux/linux_machdep.c Modified: head/sys/amd64/linux/linux_machdep.c == --- head/sys/amd64/linux/linux_machdep.cWed Nov 4 10:21:30 2020 (r367320) +++ head/sys/amd64/linux/linux_machdep.cWed Nov 4 10:38:25 2020 (r367321) @@ -126,7 +126,7 @@ linux_set_upcall_kse(struct thread *td, register_t sta /* * The newly created Linux thread returns -* to the user space by the same path that a parent do. +* to the user space by the same path that a parent does. */ td->td_frame->tf_rax = 0; return (0); ___ 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: r367320 - head/sys/arm64/arm64
Author: andrew Date: Wed Nov 4 10:21:30 2020 New Revision: 367320 URL: https://svnweb.freebsd.org/changeset/base/367320 Log: Allow the creation of 3 level page tables on arm64 The stage 2 arm64 page tables may need to start at a lower level. This is because we may only be able to map a limited IPA range and trying to use a full 4 levels will cause the CPU to fault in an unrecoverable way. To simplify the code we still allocate the full 4 levels, however level 0 will only ever be used to find the level 1 table used as the base. Handle this by creating a dummy entry in the level 0 table to point to the level 1 table. Sponsored by: Innovate UK Differential Revision:https://reviews.freebsd.org/D26066 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Wed Nov 4 07:54:07 2020(r367319) +++ head/sys/arm64/arm64/pmap.c Wed Nov 4 10:21:30 2020(r367320) @@ -970,6 +970,8 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ kernel_pmap->pm_l0_paddr = l0pt - kern_delta; kernel_pmap->pm_cookie = COOKIE_FROM(-1, INT_MIN); kernel_pmap->pm_stage = PM_STAGE1; + kernel_pmap->pm_levels = 4; + kernel_pmap->pm_ttbr = kernel_pmap->pm_l0_paddr; kernel_pmap->pm_asid_set = &asids; /* Assume the address we were loaded to is a valid physical address */ @@ -1714,33 +1716,37 @@ pmap_pinit0(pmap_t pmap) pmap->pm_root.rt_root = 0; pmap->pm_cookie = COOKIE_FROM(ASID_RESERVED_FOR_PID_0, INT_MIN); pmap->pm_stage = PM_STAGE1; + pmap->pm_levels = 4; + pmap->pm_ttbr = pmap->pm_l0_paddr; pmap->pm_asid_set = &asids; PCPU_SET(curpmap, pmap); } int -pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage) +pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage, int levels) { - vm_page_t l0pt; + vm_page_t m; /* * allocate the l0 page */ - while ((l0pt = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | + while ((m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) vm_wait(NULL); - pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(l0pt); + pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(m); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); - if ((l0pt->flags & PG_ZERO) == 0) + if ((m->flags & PG_ZERO) == 0) pagezero(pmap->pm_l0); pmap->pm_root.rt_root = 0; bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); pmap->pm_cookie = COOKIE_FROM(-1, INT_MAX); + MPASS(levels == 3 || levels == 4); + pmap->pm_levels = levels; pmap->pm_stage = stage; switch (stage) { case PM_STAGE1: @@ -1757,6 +1763,18 @@ pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage) /* XXX Temporarily disable deferred ASID allocation. */ pmap_alloc_asid(pmap); + /* +* Allocate the level 1 entry to use as the root. This will increase +* the refcount on the level 1 page so it won't be removed until +* pmap_release() is called. +*/ + if (pmap->pm_levels == 3) { + PMAP_LOCK(pmap); + m = _pmap_alloc_l3(pmap, NUL2E + NUL1E, NULL); + PMAP_UNLOCK(pmap); + } + pmap->pm_ttbr = VM_PAGE_TO_PHYS(m); + return (1); } @@ -1764,7 +1782,7 @@ int pmap_pinit(pmap_t pmap) { - return (pmap_pinit_stage(pmap, PM_STAGE1)); + return (pmap_pinit_stage(pmap, PM_STAGE1, 4)); } /* @@ -2017,10 +2035,29 @@ retry: void pmap_release(pmap_t pmap) { + boolean_t rv; + struct spglist free; struct asid_set *set; vm_page_t m; int asid; + if (pmap->pm_levels != 4) { + PMAP_ASSERT_STAGE2(pmap); + KASSERT(pmap->pm_stats.resident_count == 1, + ("pmap_release: pmap resident count %ld != 0", + pmap->pm_stats.resident_count)); + KASSERT((pmap->pm_l0[0] & ATTR_DESCR_VALID) == ATTR_DESCR_VALID, + ("pmap_release: Invalid l0 entry: %lx", pmap->pm_l0[0])); + + SLIST_INIT(&free); + m = PHYS_TO_VM_PAGE(pmap->pm_ttbr); + PMAP_LOCK(pmap); + rv = pmap_unwire_l3(pmap, 0, m, &free); + PMAP_UNLOCK(pmap); + MPASS(rv == TRUE); + vm_page_free_pages_toq(&free, true); + } + KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); @@ -6514,7 +6551,7 @@ pmap_to_ttbr0(pmap_t pmap) { return (ASID_TO_OPERAND(COOKIE_TO_ASID(pmap->pm_cookie)) | - pmap->pm_l0_paddr); + pmap->pm_ttbr); } static bool _