Re: CVS commit: src/sys
On 12.01.2020 23:03, Andrew Doran wrote: > Module Name: src > Committed By: ad > Date: Sun Jan 12 22:03:23 UTC 2020 > > Modified Files: > src/sys/kern: kern_exec.c kern_runq.c > src/sys/sys: lwp.h sched.h > > Log Message: > A final set of scheduler tweaks: > Great work! While there, could we garbage collect unused defines from sys/param.h? I'm thinking in particular about: /* * Historic priority levels. These are meaningless and remain only * for source compatibility. Do not use in new code. */ #define PSWP0 #define PVM 4 #define PINOD 8 #define PRIBIO 16 #define PVFS20 #define PZERO 22 #define PSOCK 24 #define PWAIT 32 #define PLOCK 36 #define PPAUSE 40 #define PUSER 50 #define MAXPRI 127 These symbols from time to time conflict with external loadable kernel modules. My immediate offender is VirtualBox and PVM symbol name conflict. signature.asc Description: OpenPGP digital signature
CVS commit: src/sys/arch/x68k/stand
Module Name:src Committed By: isaki Date: Mon Jan 13 03:34:05 UTC 2020 Modified Files: src/sys/arch/x68k/stand/boot_ufs: boot.S src/sys/arch/x68k/stand/boot_ustar: boot_ustar.S src/sys/arch/x68k/stand/xxboot: boot.S Log Message: Typo in comment. s/LABELLOFFSET/LABELOFFSET/ To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/x68k/stand/boot_ufs/boot.S cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x68k/stand/boot_ustar/boot_ustar.S cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x68k/stand/xxboot/boot.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x68k/stand/boot_ufs/boot.S diff -u src/sys/arch/x68k/stand/boot_ufs/boot.S:1.10 src/sys/arch/x68k/stand/boot_ufs/boot.S:1.11 --- src/sys/arch/x68k/stand/boot_ufs/boot.S:1.10 Thu Nov 1 14:33:31 2012 +++ src/sys/arch/x68k/stand/boot_ufs/boot.S Mon Jan 13 03:34:05 2020 @@ -2,7 +2,7 @@ | author: chapuni(webmas...@chapuni.com) | ITOH Yasufumi | -| $NetBSD: boot.S,v 1.10 2012/11/01 14:33:31 isaki Exp $ +| $NetBSD: boot.S,v 1.11 2020/01/13 03:34:05 isaki Exp $ #include #include "iocscall.h" @@ -42,7 +42,7 @@ ASENTRY_NOPROFILE(entry0) bra _ASM_LABEL(entry) | Disklabel= 404bytes -| Since LABELLOFFSET in is 0x40, +| Since LABELOFFSET in is 0x40, | entry must be after 0x01d4 (0x000f01d4) nop disklabel: Index: src/sys/arch/x68k/stand/boot_ustar/boot_ustar.S diff -u src/sys/arch/x68k/stand/boot_ustar/boot_ustar.S:1.8 src/sys/arch/x68k/stand/boot_ustar/boot_ustar.S:1.9 --- src/sys/arch/x68k/stand/boot_ustar/boot_ustar.S:1.8 Sat Jun 25 04:08:57 2016 +++ src/sys/arch/x68k/stand/boot_ustar/boot_ustar.S Mon Jan 13 03:34:05 2020 @@ -3,7 +3,7 @@ | ITOH Yasufumi | mino...@netbsd.org | -| $NetBSD: boot_ustar.S,v 1.8 2016/06/25 04:08:57 isaki Exp $ +| $NetBSD: boot_ustar.S,v 1.9 2020/01/13 03:34:05 isaki Exp $ | supports floppy only @@ -44,7 +44,7 @@ ASENTRY_NOPROFILE(entry0) bra _ASM_LABEL(entry) | Disklabel= 404bytes -| Since LABELLOFFSET in is 0x40, +| Since LABELOFFSET in is 0x40, | entry must be after 0x01d4 (0x21d4) nop GLOBAL(disklabel) Index: src/sys/arch/x68k/stand/xxboot/boot.S diff -u src/sys/arch/x68k/stand/xxboot/boot.S:1.3 src/sys/arch/x68k/stand/xxboot/boot.S:1.4 --- src/sys/arch/x68k/stand/xxboot/boot.S:1.3 Sat Nov 17 15:53:21 2012 +++ src/sys/arch/x68k/stand/xxboot/boot.S Mon Jan 13 03:34:05 2020 @@ -2,7 +2,7 @@ | author: chapuni(webmas...@chapuni.com) | ITOH Yasufumi | -| $NetBSD: boot.S,v 1.3 2012/11/17 15:53:21 tsutsui Exp $ +| $NetBSD: boot.S,v 1.4 2020/01/13 03:34:05 isaki Exp $ #include #include "iocscall.h" @@ -44,7 +44,7 @@ ASENTRY_NOPROFILE(entry0) bra _ASM_LABEL(entry) | Disklabel= 404bytes -| Since LABELLOFFSET in is 0x40, +| Since LABELOFFSET in is 0x40, | entry must be after 0x01d4 (0x000f01d4) nop disklabel:
CVS commit: src/sys/arch/x68k/stand
Module Name:src Committed By: isaki Date: Mon Jan 13 03:34:05 UTC 2020 Modified Files: src/sys/arch/x68k/stand/boot_ufs: boot.S src/sys/arch/x68k/stand/boot_ustar: boot_ustar.S src/sys/arch/x68k/stand/xxboot: boot.S Log Message: Typo in comment. s/LABELLOFFSET/LABELOFFSET/ To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/x68k/stand/boot_ufs/boot.S cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x68k/stand/boot_ustar/boot_ustar.S cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x68k/stand/xxboot/boot.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: mrg Date: Mon Jan 13 02:18:13 UTC 2020 Modified Files: src/sys/kern: subr_cpu.c Log Message: more diag for cpu topology debug kernels: - print the slow/fast status of each cpu - if cpu topology is bogus, print info about the two CPUs that appear to have the same info. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/kern/subr_cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_cpu.c diff -u src/sys/kern/subr_cpu.c:1.9 src/sys/kern/subr_cpu.c:1.10 --- src/sys/kern/subr_cpu.c:1.9 Mon Jan 13 00:20:26 2020 +++ src/sys/kern/subr_cpu.c Mon Jan 13 02:18:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_cpu.c,v 1.9 2020/01/13 00:20:26 ad Exp $ */ +/* $NetBSD: subr_cpu.c,v 1.10 2020/01/13 02:18:13 mrg Exp $ */ /*- * Copyright (c) 2007, 2008, 2009, 2010, 2012, 2019, 2020 @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.9 2020/01/13 00:20:26 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.10 2020/01/13 02:18:13 mrg Exp $"); #include #include @@ -192,7 +192,11 @@ cpu_topology_dump(void) enum cpu_rel rel; int i; + CTASSERT(__arraycount(names) >= __arraycount(ci->ci_sibling)); + for (CPU_INFO_FOREACH(cii, ci)) { + if (cpu_topology_haveslow) + printf("%s ", ci->ci_is_slow ? "slow" : "fast"); for (rel = 0; rel < __arraycount(ci->ci_sibling); rel++) { printf("%s has %d %s siblings:", cpu_name(ci), ci->ci_nsibling[rel], names[rel]); @@ -277,6 +281,14 @@ cpu_topology_init(void) ci2->ci_core_id == ci->ci_core_id && ci2->ci_smt_id == ci->ci_smt_id && ci2 != ci) { +#ifdef DEBUG +printf("cpu%u %p pkg %u core %u smt %u same as " + "cpu%u %p pkg %u core %u smt %u\n", + cpu_index(ci), ci, ci->ci_package_id, + ci->ci_core_id, ci->ci_smt_id, + cpu_index(ci2), ci2, ci2->ci_package_id, + ci2->ci_core_id, ci2->ci_smt_id); +#endif printf("cpu_topology_init: info bogus, " "faking it\n"); cpu_topology_fake();
CVS commit: src/sys/kern
Module Name:src Committed By: mrg Date: Mon Jan 13 02:18:13 UTC 2020 Modified Files: src/sys/kern: subr_cpu.c Log Message: more diag for cpu topology debug kernels: - print the slow/fast status of each cpu - if cpu topology is bogus, print info about the two CPUs that appear to have the same info. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/kern/subr_cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: ad Date: Mon Jan 13 00:26:52 UTC 2020 Modified Files: src/sys/arch/amd64/include: proc.h src/sys/arch/i386/include: proc.h Log Message: Remove now unused mdlwp fields md_gc_pmap and md_gc_ptp. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/amd64/include/proc.h cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/include/proc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/include/proc.h diff -u src/sys/arch/amd64/include/proc.h:1.23 src/sys/arch/amd64/include/proc.h:1.24 --- src/sys/arch/amd64/include/proc.h:1.23 Sat Oct 12 06:31:03 2019 +++ src/sys/arch/amd64/include/proc.h Mon Jan 13 00:26:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.23 2019/10/12 06:31:03 maxv Exp $ */ +/* $NetBSD: proc.h,v 1.24 2020/01/13 00:26:52 ad Exp $ */ /* * Copyright (c) 1991 Regents of the University of California. @@ -47,8 +47,6 @@ struct vm_page; struct mdlwp { struct trapframe *md_regs; /* registers on current frame */ - struct pmap *md_gc_pmap; /* pmap being garbage collected */ - struct vm_page *md_gc_ptp; /* pages from pmap g/c */ int md_flags; /* machine-dependent flags */ volatile int md_astpending; }; Index: src/sys/arch/i386/include/proc.h diff -u src/sys/arch/i386/include/proc.h:1.46 src/sys/arch/i386/include/proc.h:1.47 --- src/sys/arch/i386/include/proc.h:1.46 Sat Oct 12 06:31:03 2019 +++ src/sys/arch/i386/include/proc.h Mon Jan 13 00:26:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.46 2019/10/12 06:31:03 maxv Exp $ */ +/* $NetBSD: proc.h,v 1.47 2020/01/13 00:26:52 ad Exp $ */ /* * Copyright (c) 1991 Regents of the University of California. @@ -49,8 +49,6 @@ struct mdlwp { struct trapframe *md_regs; /* registers on current frame */ int md_flags; /* machine-dependent flags */ volatile int md_astpending; /* AST pending for this process */ - struct pmap *md_gc_pmap; /* pmap being garbage collected */ - struct vm_page *md_gc_ptp; /* pages from pmap g/c */ }; /* md_flags */
CVS commit: src/sys/arch
Module Name:src Committed By: ad Date: Mon Jan 13 00:26:52 UTC 2020 Modified Files: src/sys/arch/amd64/include: proc.h src/sys/arch/i386/include: proc.h Log Message: Remove now unused mdlwp fields md_gc_pmap and md_gc_ptp. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/amd64/include/proc.h cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/include/proc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Mon Jan 13 00:20:27 UTC 2020 Modified Files: src/sys/kern: subr_cpu.c Log Message: Fix a loltastic typo. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/kern/subr_cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_cpu.c diff -u src/sys/kern/subr_cpu.c:1.8 src/sys/kern/subr_cpu.c:1.9 --- src/sys/kern/subr_cpu.c:1.8 Sun Jan 12 13:29:24 2020 +++ src/sys/kern/subr_cpu.c Mon Jan 13 00:20:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_cpu.c,v 1.8 2020/01/12 13:29:24 ad Exp $ */ +/* $NetBSD: subr_cpu.c,v 1.9 2020/01/13 00:20:26 ad Exp $ */ /*- * Copyright (c) 2007, 2008, 2009, 2010, 2012, 2019, 2020 @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.8 2020/01/12 13:29:24 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.9 2020/01/13 00:20:26 ad Exp $"); #include #include @@ -376,7 +376,7 @@ cpu_topology_init(void) if (cpu_topology_haveslow) { /* - * For assymmetric systems where some CPUs are slower than + * For asymmetric systems where some CPUs are slower than * others, mark first class CPUs for the scheduler. This * conflicts with SMT right now so whinge if observed. */
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Mon Jan 13 00:20:27 UTC 2020 Modified Files: src/sys/kern: subr_cpu.c Log Message: Fix a loltastic typo. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/kern/subr_cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: chs Date: Mon Jan 13 00:19:43 UTC 2020 Modified Files: src/sys/dev/acpi: acpi_pci_link.c Log Message: apply FreeBSD revs r214848 and r214849: r214849 | jkim | 2010-11-05 13:24:26 -0700 (Fri, 05 Nov 2010) | 2 lines Add a forgotten change from the previous commit. r214848 | jkim | 2010-11-05 12:50:09 -0700 (Fri, 05 Nov 2010) | 13 lines Fix a use-after-free bug for extended IRQ resource[1]. When _PRS buffer is copied as a template for _SRS, a string pointer for descriptor name is also copied and it becomes stale as soon as it gets de-allocated[2]. Now _CRS is used as a template for _SRS as ACPI specification suggests if it is usable. The template from _PRS is still utilized but only when _CRS is not available or broken. To avoid use-after-free the problem in this case, however, only mandatory fields are copied, optional data is removed, and structure length is adjusted accordingly. Reported by:hps[1] Analyzed by:avg[2] Tested by: hps This also fixes reading past the end of a structure as detected by KASAN. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/dev/acpi/acpi_pci_link.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_pci_link.c diff -u src/sys/dev/acpi/acpi_pci_link.c:1.24 src/sys/dev/acpi/acpi_pci_link.c:1.25 --- src/sys/dev/acpi/acpi_pci_link.c:1.24 Fri Dec 6 07:27:06 2019 +++ src/sys/dev/acpi/acpi_pci_link.c Mon Jan 13 00:19:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_pci_link.c,v 1.24 2019/12/06 07:27:06 maxv Exp $ */ +/* $NetBSD: acpi_pci_link.c,v 1.25 2020/01/13 00:19:43 chs Exp $ */ /*- * Copyright (c) 2002 Mitsuru IWASAKI @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.24 2019/12/06 07:27:06 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.25 2020/01/13 00:19:43 chs Exp $"); #include #include @@ -255,6 +255,7 @@ link_add_crs(ACPI_RESOURCE *res, void *c static ACPI_STATUS link_add_prs(ACPI_RESOURCE *res, void *context) { + ACPI_RESOURCE *tmp; struct link_res_request *req; struct link *link; uint8_t *irqs = NULL; @@ -301,32 +302,28 @@ link_add_prs(ACPI_RESOURCE *res, void *c req->res_index++; /* - * Stash a copy of the resource for later use when - * doing _SRS. - * - * Note that in theory res->Length may exceed the size - * of ACPI_RESOURCE, due to variable length lists in - * subtypes. However, all uses of l_prs_template only - * rely on lists lengths of zero or one, for which - * sizeof(ACPI_RESOURCE) is sufficient space anyway. - * We cannot read longer than Length bytes, in case we - * read off the end of mapped memory. So we read - * whichever length is shortest, Length or - * sizeof(ACPI_RESOURCE). + * Stash a copy of the resource for later use when doing + * _SRS. */ - KASSERT(res->Length >= ACPI_RS_SIZE_MIN); + tmp = >l_prs_template; + if (is_ext_irq) { + memcpy(tmp, res, ACPI_RS_SIZE(tmp->Data.ExtendedIrq)); - memset(>l_prs_template, 0, sizeof(link->l_prs_template)); - memcpy(>l_prs_template, res, - MIN(res->Length, sizeof(link->l_prs_template))); + /* + * XXX acpi_AppendBufferResource() cannot handle + * optional data. + */ + memset(>Data.ExtendedIrq.ResourceSource, 0, + sizeof(tmp->Data.ExtendedIrq.ResourceSource)); + tmp->Length = ACPI_RS_SIZE(tmp->Data.ExtendedIrq); - if (is_ext_irq) { link->l_num_irqs = res->Data.ExtendedIrq.InterruptCount; link->l_trig = res->Data.ExtendedIrq.Triggering; link->l_pol = res->Data.ExtendedIrq.Polarity; ext_irqs = res->Data.ExtendedIrq.Interrupts; } else { + memcpy(tmp, res, ACPI_RS_SIZE(tmp->Data.Irq)); link->l_num_irqs = res->Data.Irq.InterruptCount; link->l_trig = res->Data.Irq.Triggering; link->l_pol = res->Data.Irq.Polarity; @@ -737,17 +734,16 @@ acpi_pci_link_add_reference(void *v, int static ACPI_STATUS acpi_pci_link_srs_from_crs(struct acpi_pci_link_softc *sc, ACPI_BUFFER *srsbuf) { - ACPI_RESOURCE *resource, *end, newres, *resptr; - ACPI_BUFFER crsbuf; + ACPI_RESOURCE *end, *res; ACPI_STATUS status; struct link *link; int i, in_dpf; /* Fetch the _CRS. */ - crsbuf.Pointer = NULL; - crsbuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = AcpiGetCurrentResources(sc->pl_handle, ); - if (ACPI_SUCCESS(status) && crsbuf.Pointer == NULL) + srsbuf->Pointer = NULL; + srsbuf->Length = ACPI_ALLOCATE_BUFFER; + status = AcpiGetCurrentResources(sc->pl_handle, srsbuf); + if (ACPI_SUCCESS(status) && srsbuf->Pointer == NULL) status = AE_NO_MEMORY; if (ACPI_FAILURE(status)) { aprint_verbose("%s: Unable to fetch current resources: %s\n", @@ -756,14 +752,13 @@ acpi_pci_link_srs_from_crs(struct acpi_p } /* Fill in IRQ resources via link structures. */ - srsbuf->Pointer = NULL;
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: chs Date: Mon Jan 13 00:19:43 UTC 2020 Modified Files: src/sys/dev/acpi: acpi_pci_link.c Log Message: apply FreeBSD revs r214848 and r214849: r214849 | jkim | 2010-11-05 13:24:26 -0700 (Fri, 05 Nov 2010) | 2 lines Add a forgotten change from the previous commit. r214848 | jkim | 2010-11-05 12:50:09 -0700 (Fri, 05 Nov 2010) | 13 lines Fix a use-after-free bug for extended IRQ resource[1]. When _PRS buffer is copied as a template for _SRS, a string pointer for descriptor name is also copied and it becomes stale as soon as it gets de-allocated[2]. Now _CRS is used as a template for _SRS as ACPI specification suggests if it is usable. The template from _PRS is still utilized but only when _CRS is not available or broken. To avoid use-after-free the problem in this case, however, only mandatory fields are copied, optional data is removed, and structure length is adjusted accordingly. Reported by:hps[1] Analyzed by:avg[2] Tested by: hps This also fixes reading past the end of a structure as detected by KASAN. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/dev/acpi/acpi_pci_link.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Mon Jan 13 00:09:28 UTC 2020 Modified Files: src/sys/dev/i2c: gttwsi_core.c Log Message: Improve diagnostic messages: - Pass an additional argument to gttwsi_wait() to indicate what's going on, and report that, along with the error code from cv_timedwait(), if a timeout occurs. - In gttwsi_send_stop(), if we don't get the expected NRS status, report which status we *did* get when a timeout occurs. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/i2c/gttwsi_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Mon Jan 13 00:09:28 UTC 2020 Modified Files: src/sys/dev/i2c: gttwsi_core.c Log Message: Improve diagnostic messages: - Pass an additional argument to gttwsi_wait() to indicate what's going on, and report that, along with the error code from cv_timedwait(), if a timeout occurs. - In gttwsi_send_stop(), if we don't get the expected NRS status, report which status we *did* get when a timeout occurs. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/i2c/gttwsi_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/i2c/gttwsi_core.c diff -u src/sys/dev/i2c/gttwsi_core.c:1.12 src/sys/dev/i2c/gttwsi_core.c:1.13 --- src/sys/dev/i2c/gttwsi_core.c:1.12 Sun Jan 12 17:48:42 2020 +++ src/sys/dev/i2c/gttwsi_core.c Mon Jan 13 00:09:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsi_core.c,v 1.12 2020/01/12 17:48:42 thorpej Exp $ */ +/* $NetBSD: gttwsi_core.c,v 1.13 2020/01/13 00:09:28 thorpej Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. * All rights reserved. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gttwsi_core.c,v 1.12 2020/01/12 17:48:42 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gttwsi_core.c,v 1.13 2020/01/13 00:09:28 thorpej Exp $"); #include "locators.h" #include @@ -90,7 +90,7 @@ static int gttwsi_read_byte(void *v, uin static int gttwsi_write_byte(void *v, uint8_t val, int flags); static int gttwsi_wait(struct gttwsi_softc *, uint32_t, uint32_t, - uint32_t, int); + uint32_t, int, const char *); uint32_t gttwsi_read_4(struct gttwsi_softc *sc, uint32_t reg) @@ -195,7 +195,7 @@ gttwsi_send_start(void *v, int flags) else expect = STAT_SCT; sc->sc_started = true; - return gttwsi_wait(sc, CONTROL_START, expect, 0, flags); + return gttwsi_wait(sc, CONTROL_START, expect, 0, flags, "send-start"); } static int @@ -203,7 +203,7 @@ gttwsi_send_stop(void *v, int flags) { struct gttwsi_softc *sc = v; int retry = TWSI_RETRY_COUNT; - uint32_t control; + uint32_t control, status; sc->sc_started = false; @@ -213,14 +213,15 @@ gttwsi_send_stop(void *v, int flags) control |= CONTROL_IFLG; gttwsi_write_4(sc, TWSI_CONTROL, control); while (retry > 0) { - if (gttwsi_read_4(sc, TWSI_STATUS) == STAT_NRS) + if ((status = gttwsi_read_4(sc, TWSI_STATUS)) == STAT_NRS) return 0; retry--; DELAY(TWSI_STAT_DELAY); } - aprint_error_dev(sc->sc_dev, "send STOP failed\n"); - return -1; + aprint_error_dev(sc->sc_dev, "send STOP failed, status=0x%02x\n", + status); + return EWOULDBLOCK; } static int @@ -254,7 +255,7 @@ gttwsi_initiate_xfer(void *v, i2c_addr_t */ data |= 0xf0 | ((addr & 0x300) >> 7); gttwsi_write_4(sc, TWSI_DATA, data); - error = gttwsi_wait(sc, 0, expect, alt, flags); + error = gttwsi_wait(sc, 0, expect, alt, flags, "send-addr-10"); if (error) return error; /* @@ -273,7 +274,7 @@ gttwsi_initiate_xfer(void *v, i2c_addr_t data |= (addr << 1); gttwsi_write_4(sc, TWSI_DATA, data); - return gttwsi_wait(sc, 0, expect, alt, flags); + return gttwsi_wait(sc, 0, expect, alt, flags, "send-addr"); } static int @@ -282,10 +283,13 @@ gttwsi_read_byte(void *v, uint8_t *valp, struct gttwsi_softc *sc = v; int error; - if (flags & I2C_F_LAST) - error = gttwsi_wait(sc, 0, STAT_MRRD_ANT, 0, flags); - else - error = gttwsi_wait(sc, CONTROL_ACK, STAT_MRRD_AT, 0, flags); + if (flags & I2C_F_LAST) { + error = gttwsi_wait(sc, 0, STAT_MRRD_ANT, 0, flags, +"read-last-byte"); + } else { + error = gttwsi_wait(sc, CONTROL_ACK, STAT_MRRD_AT, 0, flags, +"read-byte"); + } if (!error) *valp = gttwsi_read_4(sc, TWSI_DATA); if ((flags & (I2C_F_LAST | I2C_F_STOP)) == (I2C_F_LAST | I2C_F_STOP)) @@ -300,7 +304,7 @@ gttwsi_write_byte(void *v, uint8_t val, int error; gttwsi_write_4(sc, TWSI_DATA, val); - error = gttwsi_wait(sc, 0, STAT_MTDB_AR, 0, flags); + error = gttwsi_wait(sc, 0, STAT_MTDB_AR, 0, flags, "write-byte"); if (flags & I2C_F_STOP) gttwsi_send_stop(sc, flags); return error; @@ -308,7 +312,7 @@ gttwsi_write_byte(void *v, uint8_t val, static int gttwsi_wait(struct gttwsi_softc *sc, uint32_t control, uint32_t expect, - uint32_t alt, int flags) + uint32_t alt, int flags, const char *what) { uint32_t status; int timo, error = 0; @@ -328,8 +332,9 @@ gttwsi_wait(struct gttwsi_softc *sc, uin break; if (!(flags & I2C_F_POLL)) { error = cv_timedwait(>sc_cv, >sc_mtx, hz); - if (error) + if (error) { break; + } } else { DELAY(TWSI_RETRY_DELAY); if (timo++ > 100) /* 1sec */ @@ -337,9 +342,19 @@ gttwsi_wait(struct gttwsi_softc *sc, uin } } if ((control & CONTROL_IFLG) == 0) { + /* + * error is set by the cv_timedwait() call above in the + * non-polled case. + */ + if (flags & I2C_F_POLL) { + error = EWOULDBLOCK; + } else
CVS commit: src/sys/dev/pci
Module Name:src Committed By: sevan Date: Sun Jan 12 23:22:12 UTC 2020 Modified Files: src/sys/dev/pci: if_rge.c if_rgereg.h Log Message: Start to switch from OpenBSD timeout(9) API to callout(9) and workqueue(9) Replace functions with NetBSD counterparts. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/if_rge.c src/sys/dev/pci/if_rgereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: sevan Date: Sun Jan 12 23:22:12 UTC 2020 Modified Files: src/sys/dev/pci: if_rge.c if_rgereg.h Log Message: Start to switch from OpenBSD timeout(9) API to callout(9) and workqueue(9) Replace functions with NetBSD counterparts. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/if_rge.c src/sys/dev/pci/if_rgereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_rge.c diff -u src/sys/dev/pci/if_rge.c:1.2 src/sys/dev/pci/if_rge.c:1.3 --- src/sys/dev/pci/if_rge.c:1.2 Sat Jan 11 21:05:45 2020 +++ src/sys/dev/pci/if_rge.c Sun Jan 12 23:22:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_rge.c,v 1.2 2020/01/11 21:05:45 sevan Exp $ */ +/* $NetBSD: if_rge.c,v 1.3 2020/01/12 23:22:12 sevan Exp $ */ /* $OpenBSD: if_rge.c,v 1.2 2020/01/02 09:00:45 kevlo Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.2 2020/01/11 21:05:45 sevan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.3 2020/01/12 23:22:12 sevan Exp $"); /* #include "bpfilter.h" Sevan */ /* #include "vlan.h" Sevan */ @@ -34,6 +34,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1 #include #include #include +#include +#include #include @@ -69,6 +71,12 @@ struct mbuf_list { struct mbuf *ml_tail; u_int ml_len; }; +#ifdef NET_MPSAFE +#define RGE_MPSAFE 1 +#define CALLOUT_FLAGS CALLOUT_MPSAFE +#else +#define CALLOUT_FLAGS 0 +#endif #endif static int rge_match(device_t, cfdata_t, void *); @@ -113,7 +121,7 @@ void rge_write_phy(struct rge_softc *, void rge_write_phy_ocp(struct rge_softc *, uint16_t, uint16_t); uint16_t rge_read_phy_ocp(struct rge_softc *, uint16_t); int rge_get_link_status(struct rge_softc *); -void rge_txstart(void *); +void rge_txstart(struct work *, void *); void rge_tick(void *); void rge_link_state(struct rge_softc *); @@ -284,8 +292,9 @@ rge_attach(device_t parent, device_t sel ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; #endif - timeout_set(>sc_timeout, rge_tick, sc); - task_set(>sc_task, rge_txstart, sc); + callout_init(>sc_timeout, CALLOUT_FLAGS); + callout_setfunc(>sc_timeout, rge_tick, sc); + rge_txstart(>sc_task, sc); /* Initialize ifmedia structures. */ ifmedia_init(>sc_media, IFM_IMASK, rge_ifmedia_upd, @@ -521,9 +530,8 @@ rge_ioctl(struct ifnet *ifp, u_long cmd, } void -rge_start(struct ifnet *ifq) +rge_start(struct ifnet *ifp) { - struct ifnet *ifp = ifq->ifq_if; struct rge_softc *sc = ifp->if_softc; struct mbuf *m; int free, idx, used; @@ -546,11 +554,11 @@ rge_start(struct ifnet *ifq) for (;;) { if (RGE_TX_NSEGS >= free + 2) { - ifq_set_oactive(>if_snd); + SET(ifp->if_flags, IFF_OACTIVE); break; } - m = ifq_dequeue(ifq); + IFQ_DEQUEUE(>if_snd, m); if (m == NULL) break; @@ -763,9 +771,9 @@ rge_init(struct ifnet *ifp) rge_setup_intr(sc, RGE_IMTYPE_SIM); ifp->if_flags |= IFF_RUNNING; - ifq_clr_oactive(>if_snd); + CLR(ifp->if_flags, IFF_OACTIVE); - timeout_add_sec(>sc_timeout, 1); + callout_schedule(>sc_timeout, 1); return (0); } @@ -2004,7 +2012,7 @@ rge_get_link_status(struct rge_softc *sc } void -rge_txstart(void *arg) +rge_txstart(struct work *wk, void *arg) { struct rge_softc *sc = arg; Index: src/sys/dev/pci/if_rgereg.h diff -u src/sys/dev/pci/if_rgereg.h:1.2 src/sys/dev/pci/if_rgereg.h:1.3 --- src/sys/dev/pci/if_rgereg.h:1.2 Sat Jan 11 21:05:45 2020 +++ src/sys/dev/pci/if_rgereg.h Sun Jan 12 23:22:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_rgereg.h,v 1.2 2020/01/11 21:05:45 sevan Exp $ */ +/* $NetBSD: if_rgereg.h,v 1.3 2020/01/12 23:22:12 sevan Exp $ */ /* $OpenBSD: if_rgereg.h,v 1.1 2019/11/18 03:03:37 kevlo Exp $ */ /* @@ -291,7 +291,7 @@ struct rge_softc { struct rge_list_data rge_ldata; -/* struct task sc_task; Sevan */ + struct work sc_task; callout_t sc_timeout; /* tick timeout */
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Jan 12 22:03:23 UTC 2020 Modified Files: src/sys/kern: kern_exec.c kern_runq.c src/sys/sys: lwp.h sched.h Log Message: A final set of scheduler tweaks: - Try hard to keep vfork() parent and child on the same CPU until execve(), failing that on the same core, but in all other cases scatter new LWPs among the different CPU packages, round robin, to try and get the best out of the available cache and bus bandwidth. - Remove attempts at balancing. Replace with a rate-limited skim of other CPU's run queues in sched_idle(), starting in the current package and moving outwards. Add a sysctl tunable to change the interval. - Make the cacheht_time tuneable take a milliseconds value. - It's possible to configure things such that there's no CPU allowed to run an LWP. Defeat this by always having a default: Reported-by: syzbot+46968944dd9359ab9...@syzkaller.appspotmail.com Reported-by: syzbot+7f750a4cc230d1e83...@syzkaller.appspotmail.com Reported-by: syzbot+88d7675158f5cb468...@syzkaller.appspotmail.com Reported-by: syzbot+d409c2338150e9a8a...@syzkaller.appspotmail.com Reported-by: syzbot+e152dc5bff188f673...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.487 -r1.488 src/sys/kern/kern_exec.c cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_runq.c cvs rdiff -u -r1.195 -r1.196 src/sys/sys/lwp.h cvs rdiff -u -r1.86 -r1.87 src/sys/sys/sched.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_exec.c diff -u src/sys/kern/kern_exec.c:1.487 src/sys/kern/kern_exec.c:1.488 --- src/sys/kern/kern_exec.c:1.487 Sun Jan 12 18:30:58 2020 +++ src/sys/kern/kern_exec.c Sun Jan 12 22:03:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.487 2020/01/12 18:30:58 ad Exp $ */ +/* $NetBSD: kern_exec.c,v 1.488 2020/01/12 22:03:22 ad Exp $ */ /*- * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.487 2020/01/12 18:30:58 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.488 2020/01/12 22:03:22 ad Exp $"); #include "opt_exec.h" #include "opt_execfmt.h" @@ -1175,6 +1175,7 @@ execve_runproc(struct lwp *l, struct exe struct exec_package * const epp = >ed_pack; int error = 0; struct proc *p; + struct vmspace *vm; /* * In case of a posix_spawn operation, the child doing the exec @@ -1209,6 +1210,10 @@ execve_runproc(struct lwp *l, struct exe * Do whatever is necessary to prepare the address space * for remapping. Note that this might replace the current * vmspace with another! + * + * vfork(): do not touch any user space data in the new child + * until we have awoken the parent below, or it will defeat + * lazy pmap switching (on x86). */ if (is_spawn) uvmspace_spawn(l, epp->ep_vm_minaddr, @@ -1218,9 +1223,8 @@ execve_runproc(struct lwp *l, struct exe uvmspace_exec(l, epp->ep_vm_minaddr, epp->ep_vm_maxaddr, epp->ep_flags & EXEC_TOPDOWN_VM); - - struct vmspace *vm; vm = p->p_vmspace; + vm->vm_taddr = (void *)epp->ep_taddr; vm->vm_tsize = btoc(epp->ep_tsize); vm->vm_daddr = (void*)epp->ep_daddr; @@ -1232,19 +1236,6 @@ execve_runproc(struct lwp *l, struct exe pax_aslr_init_vm(l, vm, epp); - /* Now map address space. */ - error = execve_dovmcmds(l, data); - if (error != 0) - goto exec_abort; - - pathexec(p, epp->ep_resolvedname); - - char * const newstack = STACK_GROW(vm->vm_minsaddr, epp->ep_ssize); - - error = copyoutargs(data, l, newstack); - if (error != 0) - goto exec_abort; - cwdexec(p); fd_closeexec(); /* handle close on exec */ @@ -1259,6 +1250,17 @@ execve_runproc(struct lwp *l, struct exe p->p_flag |= PK_EXEC; mutex_exit(p->p_lock); + error = credexec(l, >ed_attr); + if (error) + goto exec_abort; + +#if defined(__HAVE_RAS) + /* + * Remove all RASs from the address space. + */ + ras_purgeall(); +#endif + /* * Stop profiling. */ @@ -1271,32 +1273,46 @@ execve_runproc(struct lwp *l, struct exe /* * It's OK to test PL_PPWAIT unlocked here, as other LWPs have * exited and exec()/exit() are the only places it will be cleared. + * + * Once the parent has been awoken, curlwp may teleport to a new CPU + * in sched_vforkexec(), and it's then OK to start messing with user + * data. See comment above. */ if ((p->p_lflag & PL_PPWAIT) != 0) { + bool samecpu; lwp_t *lp; mutex_enter(proc_lock); lp = p->p_vforklwp; p->p_vforklwp = NULL; - l->l_lwpctl = NULL; /* was on loan from blocked parent */ + cv_broadcast(>l_waitcv); + + /* Clear flags after cv_broadcast() (scheduler needs them). */ p->p_lflag &= ~PL_PPWAIT; lp->l_vforkwaiting = false; - cv_broadcast(>l_waitcv); + /* If parent is still on same CPU, teleport curlwp elsewhere. */ + samecpu = (lp->l_cpu == curlwp->l_cpu);
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Jan 12 22:03:23 UTC 2020 Modified Files: src/sys/kern: kern_exec.c kern_runq.c src/sys/sys: lwp.h sched.h Log Message: A final set of scheduler tweaks: - Try hard to keep vfork() parent and child on the same CPU until execve(), failing that on the same core, but in all other cases scatter new LWPs among the different CPU packages, round robin, to try and get the best out of the available cache and bus bandwidth. - Remove attempts at balancing. Replace with a rate-limited skim of other CPU's run queues in sched_idle(), starting in the current package and moving outwards. Add a sysctl tunable to change the interval. - Make the cacheht_time tuneable take a milliseconds value. - It's possible to configure things such that there's no CPU allowed to run an LWP. Defeat this by always having a default: Reported-by: syzbot+46968944dd9359ab9...@syzkaller.appspotmail.com Reported-by: syzbot+7f750a4cc230d1e83...@syzkaller.appspotmail.com Reported-by: syzbot+88d7675158f5cb468...@syzkaller.appspotmail.com Reported-by: syzbot+d409c2338150e9a8a...@syzkaller.appspotmail.com Reported-by: syzbot+e152dc5bff188f673...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.487 -r1.488 src/sys/kern/kern_exec.c cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_runq.c cvs rdiff -u -r1.195 -r1.196 src/sys/sys/lwp.h cvs rdiff -u -r1.86 -r1.87 src/sys/sys/sched.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: riastradh Date: Sun Jan 12 21:52:36 UTC 2020 Modified Files: src/sys/arch/arm/sunxi: sun8i_crypto.c src/sys/arch/evbarm/conf: GENERIC64 Log Message: Enable sun8icrypto in GENERIC64. But set its entropy estimate to zero until we have a better idea of how it works. Can't really hurt this way unless sun8icrypto is maliciously dependent on all other inputs to the entropy pool, which seems unlikely. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sun8i_crypto.c cvs rdiff -u -r1.130 -r1.131 src/sys/arch/evbarm/conf/GENERIC64 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: riastradh Date: Sun Jan 12 21:52:36 UTC 2020 Modified Files: src/sys/arch/arm/sunxi: sun8i_crypto.c src/sys/arch/evbarm/conf: GENERIC64 Log Message: Enable sun8icrypto in GENERIC64. But set its entropy estimate to zero until we have a better idea of how it works. Can't really hurt this way unless sun8icrypto is maliciously dependent on all other inputs to the entropy pool, which seems unlikely. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sun8i_crypto.c cvs rdiff -u -r1.130 -r1.131 src/sys/arch/evbarm/conf/GENERIC64 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/sunxi/sun8i_crypto.c diff -u src/sys/arch/arm/sunxi/sun8i_crypto.c:1.9 src/sys/arch/arm/sunxi/sun8i_crypto.c:1.10 --- src/sys/arch/arm/sunxi/sun8i_crypto.c:1.9 Wed Dec 18 02:26:48 2019 +++ src/sys/arch/arm/sunxi/sun8i_crypto.c Sun Jan 12 21:52:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: sun8i_crypto.c,v 1.9 2019/12/18 02:26:48 riastradh Exp $ */ +/* $NetBSD: sun8i_crypto.c,v 1.10 2020/01/12 21:52:36 riastradh Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.9 2019/12/18 02:26:48 riastradh Exp $"); +__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.10 2020/01/12 21:52:36 riastradh Exp $"); #include #include @@ -971,6 +971,12 @@ sun8i_crypto_rng_done(struct sun8i_crypt entropybits = 0; } + /* + * Actually we don't believe in any of the entropy until this + * device has had more scrutiny. + */ + entropybits = 0; + /* Success! Enter and erase the data. */ rnd_add_data(>cr_rndsource, buf, SUN8I_CRYPTO_RNGBYTES, entropybits); Index: src/sys/arch/evbarm/conf/GENERIC64 diff -u src/sys/arch/evbarm/conf/GENERIC64:1.130 src/sys/arch/evbarm/conf/GENERIC64:1.131 --- src/sys/arch/evbarm/conf/GENERIC64:1.130 Sat Jan 4 14:18:28 2020 +++ src/sys/arch/evbarm/conf/GENERIC64 Sun Jan 12 21:52:36 2020 @@ -1,5 +1,5 @@ # -# $NetBSD: GENERIC64,v 1.130 2020/01/04 14:18:28 skrll Exp $ +# $NetBSD: GENERIC64,v 1.131 2020/01/12 21:52:36 riastradh Exp $ # # GENERIC ARM (aarch64) kernel # @@ -393,7 +393,7 @@ amdccp* at fdt? # AMD Cryptograhic Co amdccp* at acpi? bcmrng* at fdt? # Broadcom BCM283x RNG mesonrng* at fdt? # Amlogic Meson RNG -#sun8icrypto* at fdt? # Allwinner Crypto Engine +sun8icrypto* at fdt? # Allwinner Crypto Engine # RTC plrtc* at fdt? # ARM PrimeCell RTC
CVS commit: src/tools/pkg_install/lib
Module Name:src Committed By: christos Date: Sun Jan 12 21:49:39 UTC 2020 Added Files: src/tools/pkg_install/lib: Makefile Log Message: add Makefile To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tools/pkg_install/lib/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tools/pkg_install/lib
Module Name:src Committed By: christos Date: Sun Jan 12 21:49:39 UTC 2020 Added Files: src/tools/pkg_install/lib: Makefile Log Message: add Makefile To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tools/pkg_install/lib/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/tools/pkg_install/lib/Makefile diff -u /dev/null src/tools/pkg_install/lib/Makefile:1.1 --- /dev/null Sun Jan 12 16:49:39 2020 +++ src/tools/pkg_install/lib/Makefile Sun Jan 12 16:49:39 2020 @@ -0,0 +1,10 @@ +# $NetBSD: Makefile,v 1.1 2020/01/12 21:49:39 christos Exp $ +.include + +HOSTLIB= ${LIB} + +HOST_CPPFLAGS+= ${CPPFLAGS} +HOST_SRCS+= ${SRCS} + +.include "${NETBSDSRCDIR}/external/bsd/pkg_install/lib/Makefile" +.include "${.CURDIR}/../Makefile.inc"
CVS commit: src/sys/sys
Module Name:src Committed By: ad Date: Sun Jan 12 21:40:45 UTC 2020 Modified Files: src/sys/sys: lwp.h types.h Log Message: Make pri_t a short and get back some more space in struct lwp. To generate a diff of this commit: cvs rdiff -u -r1.194 -r1.195 src/sys/sys/lwp.h cvs rdiff -u -r1.102 -r1.103 src/sys/sys/types.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/sys
Module Name:src Committed By: ad Date: Sun Jan 12 21:40:45 UTC 2020 Modified Files: src/sys/sys: lwp.h types.h Log Message: Make pri_t a short and get back some more space in struct lwp. To generate a diff of this commit: cvs rdiff -u -r1.194 -r1.195 src/sys/sys/lwp.h cvs rdiff -u -r1.102 -r1.103 src/sys/sys/types.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/lwp.h diff -u src/sys/sys/lwp.h:1.194 src/sys/sys/lwp.h:1.195 --- src/sys/sys/lwp.h:1.194 Sun Jan 12 18:37:10 2020 +++ src/sys/sys/lwp.h Sun Jan 12 21:40:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lwp.h,v 1.194 2020/01/12 18:37:10 ad Exp $ */ +/* $NetBSD: lwp.h,v 1.195 2020/01/12 21:40:44 ad Exp $ */ /* * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010, 2019 @@ -103,7 +103,7 @@ struct lwp { int l_biglocks; /* l: biglock count before sleep */ short l_stat; /* l: overall LWP status */ short l_class; /* l: scheduling class */ - int l_kpriority; /* !: has kernel priority boost */ + short l_kpriority; /* !: has kernel priority boost */ pri_t l_kpribase; /* !: kernel priority base level */ pri_t l_priority; /* l: scheduler priority */ pri_t l_inheritedprio;/* l: inherited priority */ Index: src/sys/sys/types.h diff -u src/sys/sys/types.h:1.102 src/sys/sys/types.h:1.103 --- src/sys/sys/types.h:1.102 Tue Nov 6 16:26:44 2018 +++ src/sys/sys/types.h Sun Jan 12 21:40:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ */ +/* $NetBSD: types.h,v 1.103 2020/01/12 21:40:44 ad Exp $ */ /*- * Copyright (c) 1982, 1986, 1991, 1993, 1994 @@ -317,7 +317,7 @@ typedef _BSD_USECONDS_T_ useconds_t; typedef struct kauth_cred *kauth_cred_t; -typedef int pri_t; +typedef short pri_t; #endif
CVS commit: src/sys/sys
Module Name:src Committed By: ad Date: Sun Jan 12 21:37:15 UTC 2020 Modified Files: src/sys/sys: param.h Log Message: NetBSD 9.99.37 - struct cpu_info & struct lwp changed. To generate a diff of this commit: cvs rdiff -u -r1.639 -r1.640 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.639 src/sys/sys/param.h:1.640 --- src/sys/sys/param.h:1.639 Sun Jan 12 13:37:26 2020 +++ src/sys/sys/param.h Sun Jan 12 21:37:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.639 2020/01/12 13:37:26 ad Exp $ */ +/* $NetBSD: param.h,v 1.640 2020/01/12 21:37:15 ad Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 999003600 /* NetBSD 9.99.36 */ +#define __NetBSD_Version__ 999003700 /* NetBSD 9.99.37 */ #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \ (m) * 100) + (p) * 100) <= __NetBSD_Version__)
CVS commit: src/sys/sys
Module Name:src Committed By: ad Date: Sun Jan 12 21:37:15 UTC 2020 Modified Files: src/sys/sys: param.h Log Message: NetBSD 9.99.37 - struct cpu_info & struct lwp changed. To generate a diff of this commit: cvs rdiff -u -r1.639 -r1.640 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/pkg_install
Module Name:src Committed By: christos Date: Sun Jan 12 21:31:04 UTC 2020 Modified Files: src/external/bsd/pkg_install/dist/admin: check.c main.c src/external/bsd/pkg_install/dist/create: pl.c src/external/bsd/pkg_install/lib: config.h Log Message: Handle HAVE_NBTOOL_CONFIG_H To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pkg_install/dist/admin/check.c cvs rdiff -u -r1.4 -r1.5 src/external/bsd/pkg_install/dist/admin/main.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pkg_install/dist/create/pl.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pkg_install/lib/config.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/pkg_install
Module Name:src Committed By: christos Date: Sun Jan 12 21:31:04 UTC 2020 Modified Files: src/external/bsd/pkg_install/dist/admin: check.c main.c src/external/bsd/pkg_install/dist/create: pl.c src/external/bsd/pkg_install/lib: config.h Log Message: Handle HAVE_NBTOOL_CONFIG_H To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pkg_install/dist/admin/check.c cvs rdiff -u -r1.4 -r1.5 src/external/bsd/pkg_install/dist/admin/main.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pkg_install/dist/create/pl.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pkg_install/lib/config.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/pkg_install/dist/admin/check.c diff -u src/external/bsd/pkg_install/dist/admin/check.c:1.2 src/external/bsd/pkg_install/dist/admin/check.c:1.3 --- src/external/bsd/pkg_install/dist/admin/check.c:1.2 Thu Apr 20 09:18:23 2017 +++ src/external/bsd/pkg_install/dist/admin/check.c Sun Jan 12 16:31:03 2020 @@ -1,5 +1,8 @@ -/* $NetBSD: check.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ +/* $NetBSD: check.c,v 1.3 2020/01/12 21:31:03 christos Exp $ */ +#ifdef HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#else #if HAVE_CONFIG_H #include "config.h" #endif @@ -7,7 +10,8 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: check.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); +#endif +__RCSID("$NetBSD: check.c,v 1.3 2020/01/12 21:31:03 christos Exp $"); /*- * Copyright (c) 1999-2008 The NetBSD Foundation, Inc. Index: src/external/bsd/pkg_install/dist/admin/main.c diff -u src/external/bsd/pkg_install/dist/admin/main.c:1.4 src/external/bsd/pkg_install/dist/admin/main.c:1.5 --- src/external/bsd/pkg_install/dist/admin/main.c:1.4 Sun Oct 13 17:56:14 2019 +++ src/external/bsd/pkg_install/dist/admin/main.c Sun Jan 12 16:31:03 2020 @@ -1,5 +1,8 @@ -/* $NetBSD: main.c,v 1.4 2019/10/13 21:56:14 joerg Exp $ */ +/* $NetBSD: main.c,v 1.5 2020/01/12 21:31:03 christos Exp $ */ +#ifdef HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#else #if HAVE_CONFIG_H #include "config.h" #endif @@ -7,7 +10,8 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: main.c,v 1.4 2019/10/13 21:56:14 joerg Exp $"); +#endif +__RCSID("$NetBSD: main.c,v 1.5 2020/01/12 21:31:03 christos Exp $"); /*- * Copyright (c) 1999-2019 The NetBSD Foundation, Inc. Index: src/external/bsd/pkg_install/dist/create/pl.c diff -u src/external/bsd/pkg_install/dist/create/pl.c:1.2 src/external/bsd/pkg_install/dist/create/pl.c:1.3 --- src/external/bsd/pkg_install/dist/create/pl.c:1.2 Thu Apr 20 09:18:23 2017 +++ src/external/bsd/pkg_install/dist/create/pl.c Sun Jan 12 16:31:03 2020 @@ -1,5 +1,8 @@ -/* $NetBSD: pl.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */ +/* $NetBSD: pl.c,v 1.3 2020/01/12 21:31:03 christos Exp $ */ +#ifdef HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#else #if HAVE_CONFIG_H #include "config.h" #endif @@ -7,7 +10,8 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: pl.c,v 1.2 2017/04/20 13:18:23 joerg Exp $"); +#endif +__RCSID("$NetBSD: pl.c,v 1.3 2020/01/12 21:31:03 christos Exp $"); /* * FreeBSD install - a package for the installation and maintainance Index: src/external/bsd/pkg_install/lib/config.h diff -u src/external/bsd/pkg_install/lib/config.h:1.2 src/external/bsd/pkg_install/lib/config.h:1.3 --- src/external/bsd/pkg_install/lib/config.h:1.2 Fri Apr 23 16:56:01 2010 +++ src/external/bsd/pkg_install/lib/config.h Sun Jan 12 16:31:03 2020 @@ -115,6 +115,7 @@ /* Defined when to retain only the numeric OS version */ /* #undef NUMERIC_VERSION_ONLY */ +#ifndef HAVE_NBTOOL_CONFIG_H /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "jo...@netbsd.org" @@ -132,6 +133,7 @@ /* Define to the version of this package. */ #define PACKAGE_VERSION "20090911" +#endif /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4
CVS commit: src/tools/pkg_install
Module Name:src Committed By: christos Date: Sun Jan 12 21:27:45 UTC 2020 Modified Files: src/tools/pkg_install: Makefile Makefile.inc src/tools/pkg_install/pkg_add: Makefile src/tools/pkg_install/pkg_admin: Makefile src/tools/pkg_install/pkg_create: Makefile src/tools/pkg_install/pkg_delete: Makefile src/tools/pkg_install/pkg_info: Makefile Log Message: make this compile. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/Makefile \ src/tools/pkg_install/Makefile.inc cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/pkg_add/Makefile cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/pkg_admin/Makefile cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/pkg_create/Makefile cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/pkg_delete/Makefile cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/pkg_info/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/pkg_install/Makefile diff -u src/tools/pkg_install/Makefile:1.1 src/tools/pkg_install/Makefile:1.2 --- src/tools/pkg_install/Makefile:1.1 Tue Dec 1 04:01:45 2009 +++ src/tools/pkg_install/Makefile Sun Jan 12 16:27:43 2020 @@ -1,6 +1,5 @@ -# $NetBSD: Makefile,v 1.1 2009/12/01 09:01:45 uebayasi Exp $ +# $NetBSD: Makefile,v 1.2 2020/01/12 21:27:43 christos Exp $ -SUBDIR= lib .WAIT pkg_add pkg_create pkg_delete pkg_info -# XXX pkg_admin +SUBDIR= lib .WAIT pkg_add pkg_admin pkg_create pkg_delete pkg_info .include Index: src/tools/pkg_install/Makefile.inc diff -u src/tools/pkg_install/Makefile.inc:1.1 src/tools/pkg_install/Makefile.inc:1.2 --- src/tools/pkg_install/Makefile.inc:1.1 Tue Dec 1 04:01:45 2009 +++ src/tools/pkg_install/Makefile.inc Sun Jan 12 16:27:43 2020 @@ -1,3 +1,8 @@ -HOST_LDFLAGS:= -L../lib -linstall +# $NetBSD: Makefile.inc,v 1.2 2020/01/12 21:27:43 christos Exp $ + +.include "${NETBSDSRCDIR}/external/bsd/pkg_install/Makefile.inc" + +INSTALL_OBJDIR!= cd ${NETBSDSRCDIR}/tools/pkg_install/lib && ${PRINTOBJDIR} +LDFLAGS+=-L${INSTALL_OBJDIR} +LDADD+=-linstall -.include "${NETBSDSRCDIR}/external/bsd/pkg_install/sbin/Makefile.inc" Index: src/tools/pkg_install/pkg_add/Makefile diff -u src/tools/pkg_install/pkg_add/Makefile:1.1 src/tools/pkg_install/pkg_add/Makefile:1.2 --- src/tools/pkg_install/pkg_add/Makefile:1.1 Tue Dec 1 04:01:46 2009 +++ src/tools/pkg_install/pkg_add/Makefile Sun Jan 12 16:27:44 2020 @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.1 2009/12/01 09:01:46 uebayasi Exp $ +# $NetBSD: Makefile,v 1.2 2020/01/12 21:27:44 christos Exp $ + +.include HOSTPROGNAME= ${_TOOL_PREFIX}pkg_add -HOST_SRCDIR= external/bsd/pkg_install/sbin/pkg_add +HOST_SRCDIR= ../external/bsd/pkg_install/sbin/pkg_add .include "${.CURDIR}/../Makefile.inc" - .include "${.CURDIR}/../../Makefile.host" Index: src/tools/pkg_install/pkg_admin/Makefile diff -u src/tools/pkg_install/pkg_admin/Makefile:1.1 src/tools/pkg_install/pkg_admin/Makefile:1.2 --- src/tools/pkg_install/pkg_admin/Makefile:1.1 Tue Dec 1 04:01:46 2009 +++ src/tools/pkg_install/pkg_admin/Makefile Sun Jan 12 16:27:44 2020 @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.1 2009/12/01 09:01:46 uebayasi Exp $ +# $NetBSD: Makefile,v 1.2 2020/01/12 21:27:44 christos Exp $ + +.include HOSTPROGNAME= ${_TOOL_PREFIX}pkg_admin -HOST_SRCDIR= external/bsd/pkg_install/sbin/pkg_admin +HOST_SRCDIR= ../external/bsd/pkg_install/sbin/pkg_admin .include "${.CURDIR}/../Makefile.inc" - .include "${.CURDIR}/../../Makefile.host" Index: src/tools/pkg_install/pkg_create/Makefile diff -u src/tools/pkg_install/pkg_create/Makefile:1.1 src/tools/pkg_install/pkg_create/Makefile:1.2 --- src/tools/pkg_install/pkg_create/Makefile:1.1 Tue Dec 1 04:01:46 2009 +++ src/tools/pkg_install/pkg_create/Makefile Sun Jan 12 16:27:44 2020 @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.1 2009/12/01 09:01:46 uebayasi Exp $ +# $NetBSD: Makefile,v 1.2 2020/01/12 21:27:44 christos Exp $ + +.include HOSTPROGNAME= ${_TOOL_PREFIX}pkg_create -HOST_SRCDIR= external/bsd/pkg_install/sbin/pkg_create +HOST_SRCDIR= ../external/bsd/pkg_install/sbin/pkg_create .include "${.CURDIR}/../Makefile.inc" - .include "${.CURDIR}/../../Makefile.host" Index: src/tools/pkg_install/pkg_delete/Makefile diff -u src/tools/pkg_install/pkg_delete/Makefile:1.1 src/tools/pkg_install/pkg_delete/Makefile:1.2 --- src/tools/pkg_install/pkg_delete/Makefile:1.1 Tue Dec 1 04:01:46 2009 +++ src/tools/pkg_install/pkg_delete/Makefile Sun Jan 12 16:27:45 2020 @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.1 2009/12/01 09:01:46 uebayasi Exp $ +# $NetBSD: Makefile,v 1.2 2020/01/12 21:27:45 christos Exp $ + +.include HOSTPROGNAME= ${_TOOL_PREFIX}pkg_delete -HOST_SRCDIR= external/bsd/pkg_install/sbin/pkg_delete +HOST_SRCDIR= ../external/bsd/pkg_install/sbin/pkg_delete .include "${.CURDIR}/../Makefile.inc" - .include "${.CURDIR}/../../Makefile.host" Index: src/tools/pkg_install/pkg_info/Makefile
CVS commit: src/tools/pkg_install
Module Name:src Committed By: christos Date: Sun Jan 12 21:27:45 UTC 2020 Modified Files: src/tools/pkg_install: Makefile Makefile.inc src/tools/pkg_install/pkg_add: Makefile src/tools/pkg_install/pkg_admin: Makefile src/tools/pkg_install/pkg_create: Makefile src/tools/pkg_install/pkg_delete: Makefile src/tools/pkg_install/pkg_info: Makefile Log Message: make this compile. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/Makefile \ src/tools/pkg_install/Makefile.inc cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/pkg_add/Makefile cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/pkg_admin/Makefile cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/pkg_create/Makefile cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/pkg_delete/Makefile cvs rdiff -u -r1.1 -r1.2 src/tools/pkg_install/pkg_info/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man9
Module Name:src Committed By: sevan Date: Sun Jan 12 20:49:21 UTC 2020 Modified Files: src/share/man/man9: callout.9 Log Message: Update callout_halt() to match src/sys/sys/callout.h To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/share/man/man9/callout.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/callout.9 diff -u src/share/man/man9/callout.9:1.28 src/share/man/man9/callout.9:1.29 --- src/share/man/man9/callout.9:1.28 Thu Nov 20 15:43:52 2014 +++ src/share/man/man9/callout.9 Sun Jan 12 20:49:21 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: callout.9,v 1.28 2014/11/20 15:43:52 ozaki-r Exp $ +.\" $NetBSD: callout.9,v 1.29 2020/01/12 20:49:21 sevan Exp $ .\" .\" Copyright (c) 2000, 2003, 2009 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 21, 2014 +.Dd January 12, 2020 .Dt CALLOUT 9 .Os .Sh NAME @@ -59,7 +59,7 @@ .Ft bool .Fn "callout_stop" "callout_t *c" .Ft bool -.Fn "callout_halt" "callout_t *c" "kmutex_t *interlock" +.Fn "callout_halt" "callout_t *c" "void *interlock" .Ft bool .Fn "callout_pending" "callout_t *c" .Ft bool
CVS commit: src/share/man/man9
Module Name:src Committed By: sevan Date: Sun Jan 12 20:49:21 UTC 2020 Modified Files: src/share/man/man9: callout.9 Log Message: Update callout_halt() to match src/sys/sys/callout.h To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/share/man/man9/callout.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/include/arm32
Module Name:src Committed By: christos Date: Sun Jan 12 20:06:52 UTC 2020 Modified Files: src/sys/arch/arm/include/arm32: pmap.h Log Message: fix -Wsign-compare because module tests trigger it. To generate a diff of this commit: cvs rdiff -u -r1.157 -r1.158 src/sys/arch/arm/include/arm32/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/include/arm32/pmap.h diff -u src/sys/arch/arm/include/arm32/pmap.h:1.157 src/sys/arch/arm/include/arm32/pmap.h:1.158 --- src/sys/arch/arm/include/arm32/pmap.h:1.157 Tue Dec 10 13:02:14 2019 +++ src/sys/arch/arm/include/arm32/pmap.h Sun Jan 12 15:06:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.157 2019/12/10 18:02:14 ad Exp $ */ +/* $NetBSD: pmap.h,v 1.158 2020/01/12 20:06:52 christos Exp $ */ /* * Copyright (c) 2002, 2003 Wasabi Systems, Inc. @@ -564,13 +564,13 @@ l1pte_set(pt_entry_t *pdep, pt_entry_t p *pdep = pde; if (l1pte_page_p(pde)) { KASSERTMSGuintptr_t)pdep / sizeof(pde)) & (PAGE_SIZE / L2_T_SIZE - 1)) == 0, "%p", pdep); - for (size_t k = 1; k < PAGE_SIZE / L2_T_SIZE; k++) { + for (int k = 1; k < PAGE_SIZE / L2_T_SIZE; k++) { pde += L2_T_SIZE; pdep[k] = pde; } } else if (l1pte_supersection_p(pde)) { KASSERTMSGuintptr_t)pdep / sizeof(pde)) & (L1_SS_SIZE / L1_S_SIZE - 1)) == 0, "%p", pdep); - for (size_t k = 1; k < L1_SS_SIZE / L1_S_SIZE; k++) { + for (int k = 1; k < L1_SS_SIZE / L1_S_SIZE; k++) { pdep[k] = pde; } } @@ -589,12 +589,12 @@ l2pte_set(pt_entry_t *ptep, pt_entry_t p { if (l1pte_lpage_p(pte)) { KASSERTMSGuintptr_t)ptep / sizeof(pte)) & (L2_L_SIZE / L2_S_SIZE - 1)) == 0, "%p", ptep); - for (size_t k = 0; k < L2_L_SIZE / L2_S_SIZE; k++) { + for (int k = 0; k < L2_L_SIZE / L2_S_SIZE; k++) { *ptep++ = pte; } } else { KASSERTMSGuintptr_t)ptep / sizeof(pte)) & (PAGE_SIZE / L2_S_SIZE - 1)) == 0, "%p", ptep); - for (size_t k = 0; k < PAGE_SIZE / L2_S_SIZE; k++) { + for (int k = 0; k < PAGE_SIZE / L2_S_SIZE; k++) { KASSERTMSG(*ptep == opte, "%#x [*%p] != %#x", *ptep, ptep, opte); *ptep++ = pte; pte += L2_S_SIZE; @@ -609,7 +609,7 @@ l2pte_reset(pt_entry_t *ptep) { KASSERTMSGuintptr_t)ptep / sizeof(*ptep)) & (PAGE_SIZE / L2_S_SIZE - 1)) == 0, "%p", ptep); *ptep = 0; - for (vsize_t k = 1; k < PAGE_SIZE / L2_S_SIZE; k++) { + for (int k = 1; k < PAGE_SIZE / L2_S_SIZE; k++) { ptep[k] = 0; } }
CVS commit: src/sys/arch/arm/include/arm32
Module Name:src Committed By: christos Date: Sun Jan 12 20:06:52 UTC 2020 Modified Files: src/sys/arch/arm/include/arm32: pmap.h Log Message: fix -Wsign-compare because module tests trigger it. To generate a diff of this commit: cvs rdiff -u -r1.157 -r1.158 src/sys/arch/arm/include/arm32/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/gen
Module Name:src Committed By: para Date: Sun Jan 12 20:00:41 UTC 2020 Modified Files: src/common/lib/libc/gen: radixtree.c Log Message: initialize radix_tree_node_cache with PR_LARGECACHE this increases the cache groups from 15 to 63 items in order to reduce traffic between pool cache layers this is the same as for other highly frequented pool caches as the pvpool and anonpool To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/common/lib/libc/gen/radixtree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/gen/radixtree.c diff -u src/common/lib/libc/gen/radixtree.c:1.20 src/common/lib/libc/gen/radixtree.c:1.21 --- src/common/lib/libc/gen/radixtree.c:1.20 Thu Dec 5 19:03:39 2019 +++ src/common/lib/libc/gen/radixtree.c Sun Jan 12 20:00:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: radixtree.c,v 1.20 2019/12/05 19:03:39 ad Exp $ */ +/* $NetBSD: radixtree.c,v 1.21 2020/01/12 20:00:41 para Exp $ */ /*- * Copyright (c)2011,2012,2013 YAMAMOTO Takashi, @@ -112,7 +112,7 @@ #include #if defined(_KERNEL) || defined(_STANDALONE) -__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.20 2019/12/05 19:03:39 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.21 2020/01/12 20:00:41 para Exp $"); #include #include #include @@ -122,7 +122,7 @@ __KERNEL_RCSID(0, "$NetBSD: radixtree.c, #include #endif /* defined(_STANDALONE) */ #else /* defined(_KERNEL) || defined(_STANDALONE) */ -__RCSID("$NetBSD: radixtree.c,v 1.20 2019/12/05 19:03:39 ad Exp $"); +__RCSID("$NetBSD: radixtree.c,v 1.21 2020/01/12 20:00:41 para Exp $"); #include #include #include @@ -345,7 +345,7 @@ radix_tree_init(void) { radix_tree_node_cache = pool_cache_init(sizeof(struct radix_tree_node), - coherency_unit, 0, 0, "radixnode", NULL, IPL_NONE, + coherency_unit, 0, PR_LARGECACHE, "radixnode", NULL, IPL_NONE, radix_tree_node_ctor, NULL, NULL); KASSERT(radix_tree_node_cache != NULL); }
CVS commit: src/common/lib/libc/gen
Module Name:src Committed By: para Date: Sun Jan 12 20:00:41 UTC 2020 Modified Files: src/common/lib/libc/gen: radixtree.c Log Message: initialize radix_tree_node_cache with PR_LARGECACHE this increases the cache groups from 15 to 63 items in order to reduce traffic between pool cache layers this is the same as for other highly frequented pool caches as the pvpool and anonpool To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/common/lib/libc/gen/radixtree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch/x86
We should absolutely verify this under DEBUG. -- thorpej Sent from my iPhone. > On Jan 12, 2020, at 11:25 AM, Joerg Sonnenberger wrote: > > On Sun, Jan 12, 2020 at 01:01:12PM +, Andrew Doran wrote: >> Module Name:src >> Committed By:ad >> Date:Sun Jan 12 13:01:12 UTC 2020 >> >> Modified Files: >>src/sys/arch/x86/include: pmap.h pmap_pv.h >>src/sys/arch/x86/x86: pmap.c vm_machdep.c x86_tlb.c >> >> Log Message: >> x86 pmap: >> >> - It turns out that every page the pmap frees is necessarily zeroed. Tell >> the VM system about this and use the pmap as a source of pre-zeroed pages. > > Would it make sense to actually verify this under DEBUG? I fear the > debugging we have to do if a chance ever violates this assumption. > > Joerg
Re: CVS commit: src/sys/arch/x86
On Sun, Jan 12, 2020 at 08:25:27PM +0100, Joerg Sonnenberger wrote: > On Sun, Jan 12, 2020 at 01:01:12PM +, Andrew Doran wrote: > > Module Name:src > > Committed By: ad > > Date: Sun Jan 12 13:01:12 UTC 2020 > > > > Modified Files: > > src/sys/arch/x86/include: pmap.h pmap_pv.h > > src/sys/arch/x86/x86: pmap.c vm_machdep.c x86_tlb.c > > > > Log Message: > > x86 pmap: > > > > - It turns out that every page the pmap frees is necessarily zeroed. Tell > > the VM system about this and use the pmap as a source of pre-zeroed pages. > > Would it make sense to actually verify this under DEBUG? I fear the > debugging we have to do if a chance ever violates this assumption. Yup we already do exactly this! Andrew
Re: CVS commit: src/sys/arch/x86
On Sun, Jan 12, 2020 at 01:01:12PM +, Andrew Doran wrote: > Module Name: src > Committed By: ad > Date: Sun Jan 12 13:01:12 UTC 2020 > > Modified Files: > src/sys/arch/x86/include: pmap.h pmap_pv.h > src/sys/arch/x86/x86: pmap.c vm_machdep.c x86_tlb.c > > Log Message: > x86 pmap: > > - It turns out that every page the pmap frees is necessarily zeroed. Tell > the VM system about this and use the pmap as a source of pre-zeroed pages. Would it make sense to actually verify this under DEBUG? I fear the debugging we have to do if a chance ever violates this assumption. Joerg
CVS commit: src/sys/arch/sparc/sparc
Module Name:src Committed By: ad Date: Sun Jan 12 19:13:55 UTC 2020 Modified Files: src/sys/arch/sparc/sparc: locore.s Log Message: Fix some more places in this file it's assumed cpu_info is smaller than 1kB. To generate a diff of this commit: cvs rdiff -u -r1.276 -r1.277 src/sys/arch/sparc/sparc/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc/sparc/locore.s diff -u src/sys/arch/sparc/sparc/locore.s:1.276 src/sys/arch/sparc/sparc/locore.s:1.277 --- src/sys/arch/sparc/sparc/locore.s:1.276 Wed Jan 8 20:59:19 2020 +++ src/sys/arch/sparc/sparc/locore.s Sun Jan 12 19:13:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.276 2020/01/08 20:59:19 skrll Exp $ */ +/* $NetBSD: locore.s,v 1.277 2020/01/12 19:13:55 ad Exp $ */ /* * Copyright (c) 1996 Paul Kranenburg @@ -2770,14 +2770,16 @@ lev14_softint: addx %l4, %g0, %l4 std %l4, [%l7 + CPUINFO_LEV14] - ld [%l6 + CPUINFO_XMSG_TRAP], %l7 + sethi %hi(CPUINFO_VA+CPUINFO_XMSG_TRAP), %l6 + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_TRAP)], %l7 #ifdef DIAGNOSTIC tst %l7 bz sparc_interrupt4m_bogus nop #endif + sethi %hi(CPUINFO_VA+CPUINFO_XMSG_ARG0), %l6 jmp %l7 - ld [%l6 + CPUINFO_XMSG_ARG0], %l3 ! prefetch 1st arg + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG0)], %l3 ! prefetch 1st arg /* * Fast flush handlers. xcalled from other CPUs throught soft interrupt 14 @@ -2789,9 +2791,11 @@ lev14_softint: */ _ENTRY(_C_LABEL(ft_tlb_flush)) ! <%l3 already fetched for us> ! va - ld [%l6 + CPUINFO_XMSG_ARG2], %l5 ! level + sethi %hi(CPUINFO_VA+CPUINFO_XMSG_ARG2), %l6 + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG2)], %l5 ! level andn %l3, 0xfff, %l3 ! %l3 = (va&~0xfff | lvl); - ld [%l6 + CPUINFO_XMSG_ARG1], %l4 ! context + sethi %hi(CPUINFO_VA+CPUINFO_XMSG_ARG1), %l6 + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG1)], %l4 ! context or %l3, %l5, %l3 mov SRMMU_CXR, %l7 ! @@ -2805,7 +2809,8 @@ ft_rett: ! enter here with %l5 = ctx to restore, %l6 = CPUINFO_VA, %l7 = ctx reg mov 1, %l4! sta %l5, [%l7]ASI_SRMMU ! restore context - st %l4, [%l6 + CPUINFO_XMSG_CMPLT] ! completed = 1 + sethi %hi(CPUINFO_VA+CPUINFO_XMSG_CMPLT), %l6 + st %l4, [%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_CMPLT)] ! completed = 1 mov %l0, %psr ! return from trap nop @@ -2813,21 +2818,24 @@ ft_rett: _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_page)) ! <%l3 already fetched for us> ! va - ld [%l6 + CPUINFO_XMSG_ARG1], %l4 ! context + sethi %hi(CPUINFO_VA+CPUINFO_XMSG_ARG1), %l6 + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG1)], %l4 ! context mov SRMMU_CXR, %l7 ! lda [%l7]ASI_SRMMU, %l5 ! %l5 = old context sta %l4, [%l7]ASI_SRMMU ! set new context set 4096, %l4 ! N = page size - ld [%l6 + CPUINFO_CACHE_LINESZ], %l7 + sethi %hi(CPUINFO_VA+CPUINFO_CACHE_LINESZ), %l6 + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_CACHE_LINESZ)], %l7 1: sta %g0, [%l3]ASI_IDCACHELFP ! flush cache line subcc %l4, %l7, %l4 ! p += linesz; bgu 1b! while ((N -= linesz) > 0) add %l3, %l7, %l3 - ld [%l6 + CPUINFO_XMSG_ARG0], %l3 ! reload va + sethi %hi(CPUINFO_VA+CPUINFO_XMSG_ARG0), %l6 + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG0)], %l3 ! reload va !or %l3, ASI_SRMMUFP_L3(=0), %l3 ! va |= ASI_SRMMUFP_L3 sta %g0, [%l3]ASI_SRMMUFP ! flush TLB @@ -2836,8 +2844,10 @@ _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_pa _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_segment)) ! <%l3 already fetched for us> ! vr - ld [%l6 + CPUINFO_XMSG_ARG1], %l5 ! vs - ld [%l6 + CPUINFO_XMSG_ARG2], %l4 ! context + sethi %hi(CPUINFO_VA+CPUINFO_XMSG_ARG1), %l6 + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG1)], %l5 ! vs + sethi %hi(CPUINFO_VA+CPUINFO_XMSG_ARG2), %l6 + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG2)], %l4 ! context sll %l3, 24, %l3 ! va = VSTOVA(vr,vs) sll %l5, 18, %l5 @@ -2847,8 +2857,10 @@ _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_se lda [%l7]ASI_SRMMU, %l5 ! %l5 = old context sta %l4, [%l7]ASI_SRMMU ! set new context - ld [%l6 + CPUINFO_CACHE_NLINES], %l4 - ld [%l6 + CPUINFO_CACHE_LINESZ], %l7 + sethi %hi(CPUINFO_VA+CPUINFO_CACHE_NLINES), %l6 + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_CACHE_NLINES)], %l4 + sethi %hi(CPUINFO_VA+CPUINFO_CACHE_LINESZ), %l6 + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_CACHE_LINESZ)], %l7 1: sta %g0, [%l3]ASI_IDCACHELFS ! flush cache line deccc %l4! p += linesz; @@ -2860,7 +2872,8 @@ _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_se _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_region)) ! <%l3 already fetched for us> ! vr - ld [%l6 + CPUINFO_XMSG_ARG1], %l4 ! context + sethi %hi(CPUINFO_VA+CPUINFO_XMSG_ARG1), %l6 + ld [%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG1)], %l4 ! context sll %l3, 24, %l3 ! va = VRTOVA(vr) @@ -2868,8 +2881,10 @@ _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_re lda [%l7]ASI_SRMMU, %l5 ! %l5 = old context sta %l4, [%l7]ASI_SRMMU ! set new context - ld [%l6 + CPUINFO_CACHE_NLINES], %l4 - ld [%l6 +
CVS commit: src/sys/arch/sparc/sparc
Module Name:src Committed By: ad Date: Sun Jan 12 19:13:55 UTC 2020 Modified Files: src/sys/arch/sparc/sparc: locore.s Log Message: Fix some more places in this file it's assumed cpu_info is smaller than 1kB. To generate a diff of this commit: cvs rdiff -u -r1.276 -r1.277 src/sys/arch/sparc/sparc/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/csh
Module Name:src Committed By: christos Date: Sun Jan 12 18:42:41 UTC 2020 Modified Files: src/bin/csh: set.c Log Message: Add file completion. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/bin/csh/set.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/csh/set.c diff -u src/bin/csh/set.c:1.36 src/bin/csh/set.c:1.37 --- src/bin/csh/set.c:1.36 Sat Jan 11 22:50:30 2020 +++ src/bin/csh/set.c Sun Jan 12 13:42:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: set.c,v 1.36 2020/01/12 03:50:30 christos Exp $ */ +/* $NetBSD: set.c,v 1.37 2020/01/12 18:42:41 christos Exp $ */ /*- * Copyright (c) 1980, 1991, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)set.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: set.c,v 1.36 2020/01/12 03:50:30 christos Exp $"); +__RCSID("$NetBSD: set.c,v 1.37 2020/01/12 18:42:41 christos Exp $"); #endif #endif /* not lint */ @@ -43,9 +43,7 @@ __RCSID("$NetBSD: set.c,v 1.36 2020/01/1 #include #include -#ifndef SHORT_STRINGS #include -#endif /* SHORT_STRINGS */ #include "csh.h" #include "extern.h" @@ -61,6 +59,41 @@ static void unsetv1(struct varent *); static void exportpath(Char **); static void balance(struct varent *, int, int); +#ifdef EDIT +static const char * +alias_text(void *dummy __unused, const char *name) +{ + static char *buf; + struct varent *vp; + Char **av; + char *p; + size_t len; + + vp = adrof1(str2short(name), ); + if (vp == NULL) + return NULL; + + len = 0; + for (av = vp->vec; *av; av++) { + len += strlen(vis_str(*av)); + if (av[1]) + len++; + } + len++; + free(buf); + p = buf = xmalloc(len); + for (av = vp->vec; *av; av++) { + const char *s = vis_str(*av); + while ((*p++ = *s++) != '\0') + continue; + if (av[1]) + *p++ = ' '; + } + *p = '\0'; + return buf; +} +#endif + /* * C Shell */ @@ -124,6 +157,11 @@ update_vars(Char *vp) SHIN, SHOUT, SHERR); el_set(el, EL_EDITOR, *vn ? short2str(vn) : "emacs"); el_set(el, EL_PROMPT, printpromptstr); + el_set(el, EL_ALIAS_TEXT, alias_text, NULL); + el_set(el, EL_ADDFN, "rl-complete", + "ReadLine compatible completion function", _el_fn_complete); + el_set(el, EL_BIND, "^I", adrof(STRfilec) ? "rl-complete" : "ed-insert", + NULL); hi = history_init(); history(hi, , H_SETSIZE, getn(value(STRhistory))); loadhist(Histlist.Hnext);
CVS commit: src/bin/csh
Module Name:src Committed By: christos Date: Sun Jan 12 18:42:41 UTC 2020 Modified Files: src/bin/csh: set.c Log Message: Add file completion. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/bin/csh/set.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Jan 12 18:37:10 UTC 2020 Modified Files: src/sys/kern: kern_rwlock.c vfs_vnops.c src/sys/sys: lwp.h Log Message: - Shuffle some items around in struct lwp to save space. Remove an unused item or two. - For lockstat, get a useful callsite for vnode locks (caller to vn_lock()). To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.204 -r1.205 src/sys/kern/vfs_vnops.c cvs rdiff -u -r1.193 -r1.194 src/sys/sys/lwp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_rwlock.c diff -u src/sys/kern/kern_rwlock.c:1.59 src/sys/kern/kern_rwlock.c:1.60 --- src/sys/kern/kern_rwlock.c:1.59 Mon Dec 9 21:02:10 2019 +++ src/sys/kern/kern_rwlock.c Sun Jan 12 18:37:10 2020 @@ -1,7 +1,8 @@ -/* $NetBSD: kern_rwlock.c,v 1.59 2019/12/09 21:02:10 ad Exp $ */ +/* $NetBSD: kern_rwlock.c,v 1.60 2020/01/12 18:37:10 ad Exp $ */ /*- - * Copyright (c) 2002, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc. + * Copyright (c) 2002, 2006, 2007, 2008, 2009, 2019, 2020 + * The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -38,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.59 2019/12/09 21:02:10 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.60 2020/01/12 18:37:10 ad Exp $"); #define __RWLOCK_PRIVATE @@ -420,9 +421,13 @@ rw_vector_enter(krwlock_t *rw, const krw } KPREEMPT_ENABLE(curlwp); - LOCKSTAT_EVENT(lsflag, rw, LB_RWLOCK | - (op == RW_WRITER ? LB_SLEEP1 : LB_SLEEP2), slpcnt, slptime); - LOCKSTAT_EVENT(lsflag, rw, LB_RWLOCK | LB_SPIN, spincnt, spintime); + LOCKSTAT_EVENT_RA(lsflag, rw, LB_RWLOCK | + (op == RW_WRITER ? LB_SLEEP1 : LB_SLEEP2), slpcnt, slptime, + (l->l_rwcallsite != 0 ? l->l_rwcallsite : + (uintptr_t)__builtin_return_address(0))); + LOCKSTAT_EVENT_RA(lsflag, rw, LB_RWLOCK | LB_SPIN, spincnt, spintime, + (l->l_rwcallsite != 0 ? l->l_rwcallsite : + (uintptr_t)__builtin_return_address(0))); LOCKSTAT_EXIT(lsflag); RW_DASSERT(rw, (op != RW_READER && RW_OWNER(rw) == curthread) || Index: src/sys/kern/vfs_vnops.c diff -u src/sys/kern/vfs_vnops.c:1.204 src/sys/kern/vfs_vnops.c:1.205 --- src/sys/kern/vfs_vnops.c:1.204 Mon Dec 16 22:47:54 2019 +++ src/sys/kern/vfs_vnops.c Sun Jan 12 18:37:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnops.c,v 1.204 2019/12/16 22:47:54 ad Exp $ */ +/* $NetBSD: vfs_vnops.c,v 1.205 2020/01/12 18:37:10 ad Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.204 2019/12/16 22:47:54 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.205 2020/01/12 18:37:10 ad Exp $"); #include "veriexec.h" @@ -1030,6 +1030,7 @@ vn_mmap(struct file *fp, off_t *offp, si int vn_lock(struct vnode *vp, int flags) { + struct lwp *l; int error; #if 0 @@ -1044,10 +1045,17 @@ vn_lock(struct vnode *vp, int flags) WAPBL_JUNLOCK_ASSERT(wapbl_vptomp(vp)); #endif + /* Get a more useful report for lockstat. */ + l = curlwp; + KASSERT(l->l_rwcallsite == 0); + l->l_rwcallsite = (uintptr_t)__builtin_return_address(0); + error = VOP_LOCK(vp, flags); if ((flags & LK_RETRY) != 0 && error == ENOENT) error = VOP_LOCK(vp, flags); + l->l_rwcallsite = 0; + KASSERT((flags & LK_RETRY) == 0 || (flags & LK_NOWAIT) != 0 || error == 0); Index: src/sys/sys/lwp.h diff -u src/sys/sys/lwp.h:1.193 src/sys/sys/lwp.h:1.194 --- src/sys/sys/lwp.h:1.193 Wed Jan 8 17:38:43 2020 +++ src/sys/sys/lwp.h Sun Jan 12 18:37:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lwp.h,v 1.193 2020/01/08 17:38:43 ad Exp $ */ +/* $NetBSD: lwp.h,v 1.194 2020/01/12 18:37:10 ad Exp $ */ /* * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010, 2019 @@ -92,17 +92,17 @@ struct lwp { kmutex_t * volatile l_mutex; /* l: ptr to mutex on sched state */ void *l_addr; /* l: PCB address; use lwp_getpcb() */ struct mdlwp l_md; /* l: machine-dependent fields. */ - int l_flag; /* l: misc flag values */ - int l_stat; /* l: overall LWP status */ struct bintime l_rtime; /* l: real time */ struct bintime l_stime; /* l: start time (while ONPROC) */ + int l_flag; /* l: misc flag values */ u_int l_swtime; /* l: time swapped in or out */ u_int l_rticks; /* l: Saved start time of run */ u_int l_rticksum; /* l: Sum of ticks spent running */ u_int l_slpticks; /* l: Saved start time of sleep */ u_int l_slpticksum; /* l: Sum of ticks spent sleeping */ int l_biglocks; /* l: biglock count before sleep */ - int l_class; /* l: scheduling class */ + short l_stat; /* l: overall LWP status */ + short l_class; /* l: scheduling class */ int l_kpriority; /* !: has kernel priority boost */ pri_t l_kpribase; /* !: kernel priority
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Jan 12 18:37:10 UTC 2020 Modified Files: src/sys/kern: kern_rwlock.c vfs_vnops.c src/sys/sys: lwp.h Log Message: - Shuffle some items around in struct lwp to save space. Remove an unused item or two. - For lockstat, get a useful callsite for vnode locks (caller to vn_lock()). To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.204 -r1.205 src/sys/kern/vfs_vnops.c cvs rdiff -u -r1.193 -r1.194 src/sys/sys/lwp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/csh
Module Name:src Committed By: christos Date: Sun Jan 12 18:36:55 UTC 2020 Modified Files: src/bin/csh: csh.c Log Message: remove unused To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/bin/csh/csh.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/csh
Module Name:src Committed By: christos Date: Sun Jan 12 18:36:55 UTC 2020 Modified Files: src/bin/csh: csh.c Log Message: remove unused To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/bin/csh/csh.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/csh/csh.c diff -u src/bin/csh/csh.c:1.48 src/bin/csh/csh.c:1.49 --- src/bin/csh/csh.c:1.48 Sat Jan 5 11:54:00 2019 +++ src/bin/csh/csh.c Sun Jan 12 13:36:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: csh.c,v 1.48 2019/01/05 16:54:00 christos Exp $ */ +/* $NetBSD: csh.c,v 1.49 2020/01/12 18:36:55 christos Exp $ */ /*- * Copyright (c) 1980, 1991, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93"; #else -__RCSID("$NetBSD: csh.c,v 1.48 2019/01/05 16:54:00 christos Exp $"); +__RCSID("$NetBSD: csh.c,v 1.49 2020/01/12 18:36:55 christos Exp $"); #endif #endif /* not lint */ @@ -105,9 +105,6 @@ static void mailchk(void); #ifndef _PATH_DEFPATH static Char **defaultpath(void); #endif -#ifdef EDITING -int editing = 0; -#endif int main(int argc, char *argv[])
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Jan 12 18:30:58 UTC 2020 Modified Files: src/sys/compat/linux/arch/amd64: linux_exec_machdep.c src/sys/compat/linux/common: linux_exec_elf32.c src/sys/kern: exec_elf.c exec_subr.c kern_exec.c src/sys/sys: exec.h Log Message: Tidy up the vnode locking around execve() on ELF images to acquire and release the locks fewer times. Proposed on tech-kern a very long time go. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 \ src/sys/compat/linux/arch/amd64/linux_exec_machdep.c cvs rdiff -u -r1.99 -r1.100 src/sys/compat/linux/common/linux_exec_elf32.c cvs rdiff -u -r1.100 -r1.101 src/sys/kern/exec_elf.c cvs rdiff -u -r1.82 -r1.83 src/sys/kern/exec_subr.c cvs rdiff -u -r1.486 -r1.487 src/sys/kern/kern_exec.c cvs rdiff -u -r1.157 -r1.158 src/sys/sys/exec.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Jan 12 18:30:58 UTC 2020 Modified Files: src/sys/compat/linux/arch/amd64: linux_exec_machdep.c src/sys/compat/linux/common: linux_exec_elf32.c src/sys/kern: exec_elf.c exec_subr.c kern_exec.c src/sys/sys: exec.h Log Message: Tidy up the vnode locking around execve() on ELF images to acquire and release the locks fewer times. Proposed on tech-kern a very long time go. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 \ src/sys/compat/linux/arch/amd64/linux_exec_machdep.c cvs rdiff -u -r1.99 -r1.100 src/sys/compat/linux/common/linux_exec_elf32.c cvs rdiff -u -r1.100 -r1.101 src/sys/kern/exec_elf.c cvs rdiff -u -r1.82 -r1.83 src/sys/kern/exec_subr.c cvs rdiff -u -r1.486 -r1.487 src/sys/kern/kern_exec.c cvs rdiff -u -r1.157 -r1.158 src/sys/sys/exec.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/linux/arch/amd64/linux_exec_machdep.c diff -u src/sys/compat/linux/arch/amd64/linux_exec_machdep.c:1.22 src/sys/compat/linux/arch/amd64/linux_exec_machdep.c:1.23 --- src/sys/compat/linux/arch/amd64/linux_exec_machdep.c:1.22 Sun Feb 23 12:01:51 2014 +++ src/sys/compat/linux/arch/amd64/linux_exec_machdep.c Sun Jan 12 18:30:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_exec_machdep.c,v 1.22 2014/02/23 12:01:51 njoly Exp $ */ +/* $NetBSD: linux_exec_machdep.c,v 1.23 2020/01/12 18:30:58 ad Exp $ */ /*- * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_exec_machdep.c,v 1.22 2014/02/23 12:01:51 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_exec_machdep.c,v 1.23 2020/01/12 18:30:58 ad Exp $"); #define ELFSIZE 64 @@ -156,7 +156,7 @@ ELFNAME2(linux,copyargs)(struct lwp *l, if (ap == NULL) { phsize = eh->e_phnum * sizeof(Elf_Phdr); ph = (Elf_Phdr *)kmem_alloc(phsize, KM_SLEEP); - error = exec_read_from(l, pack->ep_vp, eh->e_phoff, ph, phsize); + error = exec_read(l, pack->ep_vp, eh->e_phoff, ph, phsize, 0); if (error != 0) { for (i = 0; i < eh->e_phnum; i++) { if (ph[i].p_type == PT_PHDR) { Index: src/sys/compat/linux/common/linux_exec_elf32.c diff -u src/sys/compat/linux/common/linux_exec_elf32.c:1.99 src/sys/compat/linux/common/linux_exec_elf32.c:1.100 --- src/sys/compat/linux/common/linux_exec_elf32.c:1.99 Fri Mar 1 11:06:56 2019 +++ src/sys/compat/linux/common/linux_exec_elf32.c Sun Jan 12 18:30:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_exec_elf32.c,v 1.99 2019/03/01 11:06:56 pgoyette Exp $ */ +/* $NetBSD: linux_exec_elf32.c,v 1.100 2020/01/12 18:30:58 ad Exp $ */ /*- * Copyright (c) 1995, 1998, 2000, 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.99 2019/03/01 11:06:56 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.100 2020/01/12 18:30:58 ad Exp $"); #ifndef ELFSIZE /* XXX should die */ @@ -107,7 +107,8 @@ ELFNAME2(linux,atexit_signature)( /* Load the section header table. */ shsize = eh->e_shnum * sizeof(Elf_Shdr); sh = (Elf_Shdr *) malloc(shsize, M_TEMP, M_WAITOK); - error = exec_read_from(l, epp->ep_vp, eh->e_shoff, sh, shsize); + error = exec_read(l, epp->ep_vp, eh->e_shoff, sh, shsize, + IO_NODELOCKED); if (error) goto out; @@ -126,8 +127,8 @@ ELFNAME2(linux,atexit_signature)( if (s->sh_name + sigsz > sh[shstrndx].sh_size) continue; - error = exec_read_from(l, epp->ep_vp, stroff + s->sh_name, tbuf, - sigsz); + error = exec_read(l, epp->ep_vp, stroff + s->sh_name, tbuf, + sigsz, IO_NODELOCKED); if (error) goto out; if (!memcmp(tbuf, signature, sigsz)) { @@ -171,7 +172,8 @@ ELFNAME2(linux,gcc_signature)( shsize = eh->e_shnum * sizeof(Elf_Shdr); sh = (Elf_Shdr *) malloc(shsize, M_TEMP, M_WAITOK); - error = exec_read_from(l, epp->ep_vp, eh->e_shoff, sh, shsize); + error = exec_read(l, epp->ep_vp, eh->e_shoff, sh, shsize, + IO_NODELOCKED); if (error) goto out; @@ -189,8 +191,8 @@ ELFNAME2(linux,gcc_signature)( s->sh_size < sizeof(signature) - 1) continue; - error = exec_read_from(l, epp->ep_vp, s->sh_offset, tbuf, - sizeof(signature) - 1); + error = exec_read(l, epp->ep_vp, s->sh_offset, tbuf, + sizeof(signature) - 1, IO_NODELOCKED); if (error) continue; @@ -230,7 +232,8 @@ ELFNAME2(linux,debuglink_signature)(stru /* Load the section header table. */ shsize = eh->e_shnum * sizeof(Elf_Shdr); sh = (Elf_Shdr *) malloc(shsize, M_TEMP, M_WAITOK); - error = exec_read_from(l, epp->ep_vp, eh->e_shoff, sh, shsize); + error = exec_read(l, epp->ep_vp, eh->e_shoff, sh, shsize, + IO_NODELOCKED); if (error) goto out; @@ -249,8 +252,8 @@ ELFNAME2(linux,debuglink_signature)(stru if (s->sh_name + sigsz > sh[shstrndx].sh_size) continue; - error = exec_read_from(l, epp->ep_vp, stroff +
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Jan 12 17:49:17 UTC 2020 Modified Files: src/sys/kern: vfs_vnode.c Log Message: vput(): don't drop the vnode lock, carry the hold over into vrelel() which might need it anyway. To generate a diff of this commit: cvs rdiff -u -r1.106 -r1.107 src/sys/kern/vfs_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Jan 12 17:49:17 UTC 2020 Modified Files: src/sys/kern: vfs_vnode.c Log Message: vput(): don't drop the vnode lock, carry the hold over into vrelel() which might need it anyway. To generate a diff of this commit: cvs rdiff -u -r1.106 -r1.107 src/sys/kern/vfs_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_vnode.c diff -u src/sys/kern/vfs_vnode.c:1.106 src/sys/kern/vfs_vnode.c:1.107 --- src/sys/kern/vfs_vnode.c:1.106 Wed Jan 8 12:04:56 2020 +++ src/sys/kern/vfs_vnode.c Sun Jan 12 17:49:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnode.c,v 1.106 2020/01/08 12:04:56 ad Exp $ */ +/* $NetBSD: vfs_vnode.c,v 1.107 2020/01/12 17:49:17 ad Exp $ */ /*- * Copyright (c) 1997-2011, 2019 The NetBSD Foundation, Inc. @@ -146,7 +146,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.106 2020/01/08 12:04:56 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.107 2020/01/12 17:49:17 ad Exp $"); #include #include @@ -175,8 +175,6 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c, /* Flags to vrelel. */ #define VRELEL_ASYNC 0x0001 /* Always defer to vrele thread. */ -#define VRELEL_FORCE 0x0002 /* Must always succeed. */ -#define VRELEL_NOINACT 0x0004 /* Don't bother calling VOP_INACTIVE(). */ #define LRU_VRELE 0 #define LRU_FREE 1 @@ -213,7 +211,7 @@ static void vcache_free(vnode_impl_t *) static void vcache_init(void); static void vcache_reinit(void); static void vcache_reclaim(vnode_t *); -static void vrelel(vnode_t *, int); +static void vrelel(vnode_t *, int, int); static void vdrain_thread(void *); static void vnpanic(vnode_t *, const char *, ...) __printflike(2, 3); @@ -530,8 +528,9 @@ vrele_flush(struct mount *mp) TAILQ_INSERT_TAIL(vip->vi_lrulisthd, vip, vi_lrulist); mutex_exit(_lock); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); mutex_enter(vp->v_interlock); - vrelel(vp, VRELEL_FORCE); + vrelel(vp, 0, LK_EXCLUSIVE); mutex_enter(_lock); } @@ -573,8 +572,9 @@ vdrain_remove(vnode_t *vp) if (vcache_vget(vp) == 0) { if (!vrecycle(vp)) { + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); mutex_enter(vp->v_interlock); - vrelel(vp, VRELEL_FORCE); + vrelel(vp, 0, LK_EXCLUSIVE); } } fstrans_done(mp); @@ -612,8 +612,9 @@ vdrain_vrele(vnode_t *vp) vdrain_retry = true; mutex_exit(_lock); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); mutex_enter(vp->v_interlock); - vrelel(vp, VRELEL_FORCE); + vrelel(vp, 0, LK_EXCLUSIVE); fstrans_done(mp); mutex_enter(_lock); @@ -674,9 +675,16 @@ vdrain_thread(void *cookie) void vput(vnode_t *vp) { + int lktype; - VOP_UNLOCK(vp); - vrele(vp); + if ((vp->v_vflag & VV_LOCKSWORK) == 0) { + lktype = LK_EXCLUSIVE; + } else { + lktype = VOP_ISLOCKED(vp); + KASSERT(lktype != LK_NONE); + } + mutex_enter(vp->v_interlock); + vrelel(vp, 0, lktype); } /* @@ -684,10 +692,9 @@ vput(vnode_t *vp) * routine and either return to freelist or free to the pool. */ static void -vrelel(vnode_t *vp, int flags) +vrelel(vnode_t *vp, int flags, int lktype) { const bool async = ((flags & VRELEL_ASYNC) != 0); - const bool force = ((flags & VRELEL_FORCE) != 0); bool recycle, defer; int error; @@ -703,6 +710,9 @@ vrelel(vnode_t *vp, int flags) * and unlock. */ if (vp->v_usecount > 1) { + if (lktype != LK_NONE) { + VOP_UNLOCK(vp); + } vp->v_usecount--; mutex_exit(vp->v_interlock); return; @@ -723,39 +733,42 @@ vrelel(vnode_t *vp, int flags) * Defer vnode release to vdrain_thread if caller requests * it explicitly, is the pagedaemon or the lock failed. */ + defer = false; if ((curlwp == uvm.pagedaemon_lwp) || async) { defer = true; - } else if (force) { - mutex_exit(vp->v_interlock); - error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - defer = (error != 0); - mutex_enter(vp->v_interlock); - } else { - error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY | LK_NOWAIT); - defer = (error != 0); + } else if (lktype == LK_SHARED) { + /* Excellent chance of getting, if the last ref. */ + error = vn_lock(vp, LK_UPGRADE | LK_RETRY | + LK_NOWAIT); + if (error != 0) { + defer = true; + } else { + lktype = LK_EXCLUSIVE; + } + } else if (lktype == LK_NONE) { + /* Excellent chance of getting, if the last ref. */ + error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY | + LK_NOWAIT); + if (error != 0) { + defer = true; + } else { + lktype = LK_EXCLUSIVE; + } } KASSERT(mutex_owned(vp->v_interlock)); - KASSERT(! (force && defer)); if (defer) { /* * Defer reclaim to the kthread; it's not safe to * clean it here. We donate it our last reference. */ + if (lktype != LK_NONE) { + VOP_UNLOCK(vp); + } lru_requeue(vp, _list[LRU_VRELE]); mutex_exit(vp->v_interlock); return; } - - /* - * If the node got another reference while we - * released the interlock, don't try to inactivate
CVS commit: src/sys
Module Name:src Committed By: thorpej Date: Sun Jan 12 17:48:42 UTC 2020 Modified Files: src/sys/arch/arm/sunxi: sunxi_twi.c src/sys/dev/i2c: files.i2c gttwsi_core.c gttwsireg.h gttwsivar.h src/sys/dev/marvell: gttwsi.c Log Message: Clean up gttwsi's register access stuff: - Garbage-collect the obsolete GTTWSI_ALLWINNER option; it hasn't been needed since FDT'ization of the Allwinner support code. - Redefine thw "TWSI_*" register definitions to clearly call out: -> The Marvell flavor of the offsets -> The Allwinner flavor of the offsets ...and make the regular definitions indices into a register map. - Pass the appropriate register map from the front-end to the core. - Remove the customer register read/write callbacks -- they are no longer needed now that each front-end passes an appropriate register map to the core. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/sunxi/sunxi_twi.c cvs rdiff -u -r1.107 -r1.108 src/sys/dev/i2c/files.i2c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/i2c/gttwsi_core.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/gttwsireg.h cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/gttwsivar.h cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/gttwsi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/sunxi/sunxi_twi.c diff -u src/sys/arch/arm/sunxi/sunxi_twi.c:1.10 src/sys/arch/arm/sunxi/sunxi_twi.c:1.11 --- src/sys/arch/arm/sunxi/sunxi_twi.c:1.10 Sun Jul 1 21:16:19 2018 +++ src/sys/arch/arm/sunxi/sunxi_twi.c Sun Jan 12 17:48:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_twi.c,v 1.10 2018/07/01 21:16:19 jmcneill Exp $ */ +/* $NetBSD: sunxi_twi.c,v 1.11 2020/01/12 17:48:42 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -26,14 +26,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "opt_gttwsi.h" -#ifdef GTTWSI_ALLWINNER -# error Do not define GTTWSI_ALLWINNER when using this driver -#endif - #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c,v 1.10 2018/07/01 21:16:19 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c,v 1.11 2020/01/12 17:48:42 thorpej Exp $"); #include #include @@ -52,22 +47,14 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c, #define TWI_CCR_CLK_M __BITS(6,3) #define TWI_CCR_CLK_N __BITS(2,0) -static uint8_t sunxi_twi_regmap_rd[] = { - [TWSI_SLAVEADDR/4] = 0x00, - [TWSI_EXTEND_SLAVEADDR/4] = 0x04, - [TWSI_DATA/4] = 0x08, - [TWSI_CONTROL/4] = 0x0c, - [TWSI_STATUS/4] = 0x10, - [TWSI_SOFTRESET/4] = 0x18, -}; - -static uint8_t sunxi_twi_regmap_wr[] = { - [TWSI_SLAVEADDR/4] = 0x00, - [TWSI_EXTEND_SLAVEADDR/4] = 0x04, - [TWSI_DATA/4] = 0x08, - [TWSI_CONTROL/4] = 0x0c, - [TWSI_BAUDRATE/4] = 0x14, - [TWSI_SOFTRESET/4] = 0x18, +static const bus_size_t sunxi_twi_regmap[] = { + [TWSI_SLAVEADDR] = TWSI_ALLWINNER_SLAVEADDR, + [TWSI_EXTEND_SLAVEADDR] = TWSI_ALLWINNER_EXTEND_SLAVEADDR, + [TWSI_DATA] = TWSI_ALLWINNER_DATA, + [TWSI_CONTROL] = TWSI_ALLWINNER_CONTROL, + [TWSI_STATUS] = TWSI_ALLWINNER_STATUS, + [TWSI_BAUDRATE] = TWSI_ALLWINNER_BAUDRATE, + [TWSI_SOFTRESET] = TWSI_ALLWINNER_SOFTRESET, }; static int sunxi_twi_match(device_t, cfdata_t, void *); @@ -106,18 +93,6 @@ const struct fdtbus_i2c_controller_func .get_tag = sunxi_twi_get_tag, }; -static uint32_t -sunxi_twi_reg_read(struct gttwsi_softc *sc, uint32_t reg) -{ - return bus_space_read_4(sc->sc_bust, sc->sc_bush, sunxi_twi_regmap_rd[reg/4]); -} - -static void -sunxi_twi_reg_write(struct gttwsi_softc *sc, uint32_t reg, uint32_t val) -{ - bus_space_write_4(sc->sc_bust, sc->sc_bush, sunxi_twi_regmap_wr[reg/4], val); -} - static u_int sunxi_twi_calc_rate(u_int parent_rate, u_int n, u_int m) { @@ -130,11 +105,12 @@ sunxi_twi_set_clock(struct gttwsi_softc uint32_t baud; u_int n, m, best_rate; - baud = sunxi_twi_reg_read(sc, TWSI_BAUDRATE); + baud = gttwsi_read_4(sc, TWSI_BAUDRATE); for (best_rate = 0, n = 0; n < 8; n++) { for (m = 0; m < 16; m++) { - const u_int tmp_rate = sunxi_twi_calc_rate(parent_rate, n, m); + const u_int tmp_rate = + sunxi_twi_calc_rate(parent_rate, n, m); if (tmp_rate <= rate && tmp_rate > best_rate) { best_rate = tmp_rate; baud = __SHIFTIN(n, TWI_CCR_CLK_N) | @@ -143,7 +119,7 @@ sunxi_twi_set_clock(struct gttwsi_softc } } - sunxi_twi_reg_write(sc, TWSI_BAUDRATE, baud); + gttwsi_write_4(sc, TWSI_BAUDRATE, baud); delay(1); } @@ -202,9 +178,7 @@ sunxi_twi_attach(device_t parent, device conf->iflg_rwc); /* Attach gttwsi core */ - sc->sc_reg_read = sunxi_twi_reg_read; - sc->sc_reg_write = sunxi_twi_reg_write; - gttwsi_attach_subr(self, bst, bsh); + gttwsi_attach_subr(self, bst, bsh, sunxi_twi_regmap); /* * Set clock rate to 100kHz. Index: src/sys/dev/i2c/files.i2c diff -u src/sys/dev/i2c/files.i2c:1.107 src/sys/dev/i2c/files.i2c:1.108 --- src/sys/dev/i2c/files.i2c:1.107 Fri Jan 3 18:00:05 2020 +++
CVS commit: src/sys
Module Name:src Committed By: thorpej Date: Sun Jan 12 17:48:42 UTC 2020 Modified Files: src/sys/arch/arm/sunxi: sunxi_twi.c src/sys/dev/i2c: files.i2c gttwsi_core.c gttwsireg.h gttwsivar.h src/sys/dev/marvell: gttwsi.c Log Message: Clean up gttwsi's register access stuff: - Garbage-collect the obsolete GTTWSI_ALLWINNER option; it hasn't been needed since FDT'ization of the Allwinner support code. - Redefine thw "TWSI_*" register definitions to clearly call out: -> The Marvell flavor of the offsets -> The Allwinner flavor of the offsets ...and make the regular definitions indices into a register map. - Pass the appropriate register map from the front-end to the core. - Remove the customer register read/write callbacks -- they are no longer needed now that each front-end passes an appropriate register map to the core. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/sunxi/sunxi_twi.c cvs rdiff -u -r1.107 -r1.108 src/sys/dev/i2c/files.i2c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/i2c/gttwsi_core.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/gttwsireg.h cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/gttwsivar.h cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/gttwsi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Jan 12 17:46:56 UTC 2020 Modified Files: src/sys/uvm: uvm_map.c uvm_map.h Log Message: - uvm_unmap_remove(): need to call pmap_update() with the object still locked, otherwise the page could gain a new identity and still be visible via a stale mapping. - Adjust reference counts with atomics. To generate a diff of this commit: cvs rdiff -u -r1.370 -r1.371 src/sys/uvm/uvm_map.c cvs rdiff -u -r1.76 -r1.77 src/sys/uvm/uvm_map.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Jan 12 17:46:56 UTC 2020 Modified Files: src/sys/uvm: uvm_map.c uvm_map.h Log Message: - uvm_unmap_remove(): need to call pmap_update() with the object still locked, otherwise the page could gain a new identity and still be visible via a stale mapping. - Adjust reference counts with atomics. To generate a diff of this commit: cvs rdiff -u -r1.370 -r1.371 src/sys/uvm/uvm_map.c cvs rdiff -u -r1.76 -r1.77 src/sys/uvm/uvm_map.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/uvm/uvm_map.c diff -u src/sys/uvm/uvm_map.c:1.370 src/sys/uvm/uvm_map.c:1.371 --- src/sys/uvm/uvm_map.c:1.370 Sun Jan 5 15:57:15 2020 +++ src/sys/uvm/uvm_map.c Sun Jan 12 17:46:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_map.c,v 1.370 2020/01/05 15:57:15 para Exp $ */ +/* $NetBSD: uvm_map.c,v 1.371 2020/01/12 17:46:55 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.370 2020/01/05 15:57:15 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.371 2020/01/12 17:46:55 ad Exp $"); #include "opt_ddb.h" #include "opt_pax.h" @@ -2240,7 +2240,7 @@ uvm_unmap_remove(struct vm_map *map, vad } /* - * Save the free space hint + * save the free space hint */ if (map->first_free != >header && map->first_free->start >= start) @@ -2314,6 +2314,18 @@ uvm_unmap_remove(struct vm_map *map, vad uvm_map_lock_entry(entry); pmap_remove(map->pmap, entry->start, entry->end); + + /* + * note: if map is dying, leave pmap_update() for + * pmap_destroy(), which will be called later. + */ + + if ((map->flags & VM_MAP_DYING) == 0) { +pmap_update(vm_map_pmap(map)); + } else { +KASSERT(vm_map_pmap(map) != pmap_kernel()); + } + uvm_map_unlock_entry(entry); } @@ -2358,16 +2370,6 @@ uvm_unmap_remove(struct vm_map *map, vad entry = next; } - /* - * Note: if map is dying, leave pmap_update() for pmap_destroy(), - * which will be called later. - */ - if ((map->flags & VM_MAP_DYING) == 0) { - pmap_update(vm_map_pmap(map)); - } else { - KASSERT(vm_map_pmap(map) != pmap_kernel()); - } - uvm_map_check(map, "unmap_remove leave"); /* @@ -4254,14 +4256,10 @@ uvmspace_exec(struct lwp *l, vaddr_t sta void uvmspace_addref(struct vmspace *vm) { - struct vm_map *map = >vm_map; - - KASSERT((map->flags & VM_MAP_DYING) == 0); - mutex_enter(>misc_lock); + KASSERT((vm->vm_map.flags & VM_MAP_DYING) == 0); KASSERT(vm->vm_refcnt > 0); - vm->vm_refcnt++; - mutex_exit(>misc_lock); + atomic_inc_uint(>vm_refcnt); } /* @@ -4273,16 +4271,12 @@ uvmspace_free(struct vmspace *vm) { struct vm_map_entry *dead_entries; struct vm_map *map = >vm_map; - int n; UVMHIST_FUNC("uvmspace_free"); UVMHIST_CALLED(maphist); UVMHIST_LOG(maphist,"(vm=%#jx) ref=%jd", (uintptr_t)vm, vm->vm_refcnt, 0, 0); - mutex_enter(>misc_lock); - n = --vm->vm_refcnt; - mutex_exit(>misc_lock); - if (n > 0) + if (atomic_dec_uint_nv(>vm_refcnt) > 0) return; /* @@ -4777,15 +4771,14 @@ uvm_unmap1(struct vm_map *map, vaddr_t s /* * uvm_map_reference: add reference to a map * - * => map need not be locked (we use misc_lock). + * => map need not be locked */ void uvm_map_reference(struct vm_map *map) { - mutex_enter(>misc_lock); - map->ref_count++; - mutex_exit(>misc_lock); + + atomic_inc_uint(>ref_count); } void Index: src/sys/uvm/uvm_map.h diff -u src/sys/uvm/uvm_map.h:1.76 src/sys/uvm/uvm_map.h:1.77 --- src/sys/uvm/uvm_map.h:1.76 Sun Jan 5 15:57:15 2020 +++ src/sys/uvm/uvm_map.h Sun Jan 12 17:46:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_map.h,v 1.76 2020/01/05 15:57:15 para Exp $ */ +/* $NetBSD: uvm_map.h,v 1.77 2020/01/12 17:46:55 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -209,7 +209,7 @@ struct vm_map { struct pmap * pmap; /* Physical map */ krwlock_t lock; /* Non-intrsafe lock */ struct lwp * busy; /* LWP holding map busy */ - kmutex_t misc_lock; /* Lock for ref_count, cv */ + kmutex_t misc_lock; /* Lock for cv, busy */ kcondvar_t cv; /* For signalling */ int flags; /* flags */ struct rb_tree rb_tree; /* Tree for entries */
Re: CVS commit: src/sys/arch/arm/include/arm32
LGTM too. christos > On Jan 12, 2020, at 10:09 AM, Jason Thorpe wrote: > > > >> On Jan 11, 2020, at 10:47 PM, Izumi Tsutsui wrote: >> >> thorpej@ wrote: >> PGSHIFT is defined in and PAGE_SHIFT and PAGE_SIZE is in , but there is no common . >>> >>> Make a common that all of the platforms can #include, and >>> just put these common definitions in it (for now)? >> >> How about the attached diff? (untested, just for review) > > This looks good to me. > > -- thorpej signature.asc Description: Message signed with OpenPGP
CVS commit: src/share/mk
Module Name:src Committed By: christos Date: Sun Jan 12 16:11:51 UTC 2020 Modified Files: src/share/mk: bsd.own.mk Log Message: re-enable BSDTAR now that the two issues (symlinks/atomicity) have been fixed. To generate a diff of this commit: cvs rdiff -u -r1.1169 -r1.1170 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.1169 src/share/mk/bsd.own.mk:1.1170 --- src/share/mk/bsd.own.mk:1.1169 Sat Dec 14 05:59:25 2019 +++ src/share/mk/bsd.own.mk Sun Jan 12 11:11:51 2020 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1169 2019/12/14 10:59:25 mrg Exp $ +# $NetBSD: bsd.own.mk,v 1.1170 2020/01/12 16:11:51 christos Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -1082,6 +1082,7 @@ MKSTATICPIE?= no _MKVARS.yes= \ MKATF \ MKBINUTILS \ + MKBSDTAR \ MKCOMPLEX MKCVS MKCXX \ MKDOC MKDTC \ MKDYNAMICROOT \ @@ -1205,7 +1206,6 @@ _MKVARS.no= \ MKARGON2 \ MKARZERO \ MKBSDGREP \ - MKBSDTAR \ MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCTF \ MKDEBUG MKDEBUGLIB MKDTRACE \ MKEXTSRC \
CVS commit: src/share/mk
Module Name:src Committed By: christos Date: Sun Jan 12 16:11:51 UTC 2020 Modified Files: src/share/mk: bsd.own.mk Log Message: re-enable BSDTAR now that the two issues (symlinks/atomicity) have been fixed. To generate a diff of this commit: cvs rdiff -u -r1.1169 -r1.1170 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/libarchive/dist
Module Name:src Committed By: christos Date: Sun Jan 12 16:10:49 UTC 2020 Modified Files: src/external/bsd/libarchive/dist/libarchive: archive_write_disk_posix.c src/external/bsd/libarchive/dist/libarchive/test: test_write_disk_secure.c test_write_disk_secure744.c test_write_disk_secure746.c src/external/bsd/libarchive/dist/tar/test: test_option_U_upper.c test_symlink_dir.c Log Message: Leave pre-existing symlinks alone on extraction When libarchive encounters an existing symbolic link during extraction it removes that symbolic link first before overwriting it, unless it is told that it can trust symlinks from the archive. Placing symbolic links on known paths in the extracting subdirectory is a simple way that a system administrator can place data at a different location without having the overhead of a mountpoint. Trusting symlinks from an archive is never safe because they can maliciously overwrite files outside of the extraction directory. This patch adds a linked-list to track of the symbolic links that were created during extraction so that it does not trust them. This way during extraction, libarchive can remove the symlinks it created, but leave the pre-existing ones alone. Unit-tests were adjusted for this new behavior. (this is pull request 1300) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c cvs rdiff -u -r1.1.1.3 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c cvs rdiff -u -r1.1.1.1 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure744.c \ src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure746.c cvs rdiff -u -r1.1.1.2 -r1.2 \ src/external/bsd/libarchive/dist/tar/test/test_option_U_upper.c cvs rdiff -u -r1.1.1.3 -r1.2 \ src/external/bsd/libarchive/dist/tar/test/test_symlink_dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/libarchive/dist
Module Name:src Committed By: christos Date: Sun Jan 12 16:10:49 UTC 2020 Modified Files: src/external/bsd/libarchive/dist/libarchive: archive_write_disk_posix.c src/external/bsd/libarchive/dist/libarchive/test: test_write_disk_secure.c test_write_disk_secure744.c test_write_disk_secure746.c src/external/bsd/libarchive/dist/tar/test: test_option_U_upper.c test_symlink_dir.c Log Message: Leave pre-existing symlinks alone on extraction When libarchive encounters an existing symbolic link during extraction it removes that symbolic link first before overwriting it, unless it is told that it can trust symlinks from the archive. Placing symbolic links on known paths in the extracting subdirectory is a simple way that a system administrator can place data at a different location without having the overhead of a mountpoint. Trusting symlinks from an archive is never safe because they can maliciously overwrite files outside of the extraction directory. This patch adds a linked-list to track of the symbolic links that were created during extraction so that it does not trust them. This way during extraction, libarchive can remove the symlinks it created, but leave the pre-existing ones alone. Unit-tests were adjusted for this new behavior. (this is pull request 1300) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c cvs rdiff -u -r1.1.1.3 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure.c cvs rdiff -u -r1.1.1.1 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure744.c \ src/external/bsd/libarchive/dist/libarchive/test/test_write_disk_secure746.c cvs rdiff -u -r1.1.1.2 -r1.2 \ src/external/bsd/libarchive/dist/tar/test/test_option_U_upper.c cvs rdiff -u -r1.1.1.3 -r1.2 \ src/external/bsd/libarchive/dist/tar/test/test_symlink_dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c diff -u src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c:1.2 src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c:1.3 --- src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c:1.2 Sun Jan 12 11:08:31 2020 +++ src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c Sun Jan 12 11:10:48 2020 @@ -188,6 +188,12 @@ struct fixup_entry { char *name; }; +struct symlink_entry { + dev_t sc_dev; + ino_t sc_ino; + struct symlink_entry *sc_next; +}; + /* * We use a bitmask to track which operations remain to be done for * this file. In particular, this helps us avoid unnecessary @@ -223,6 +229,7 @@ struct archive_write_disk { mode_t user_umask; struct fixup_entry *fixup_list; struct fixup_entry *current_fixup; + struct symlink_entry *symlink_list; int64_t user_uid; int skip_file_set; int64_t skip_file_dev; @@ -358,8 +365,9 @@ struct archive_write_disk { static int la_opendirat(int, const char *); static void fsobj_error(int *, struct archive_string *, int, const char *, const char *); -static int check_symlinks_fsobj(char *, int *, struct archive_string *, - int); +static int check_symlinks_fsobj(struct archive_write_disk *, char *, int *, + struct archive_string *, int); + static int check_symlinks(struct archive_write_disk *); static int create_filesystem_object(struct archive_write_disk *); static struct fixup_entry *current_fixup(struct archive_write_disk *, @@ -409,6 +417,39 @@ static ssize_t _archive_write_disk_data_ size_t, int64_t); static int +symlink_add(struct archive_write_disk *a, const struct stat *st) +{ + struct symlink_entry *sc = malloc(sizeof(*sc)); + if (sc == NULL) + return errno; + sc->sc_next = a->symlink_list; + a->symlink_list = sc->sc_next; + sc->sc_dev = st->st_dev; + sc->sc_ino = st->st_ino; + return 0; +} + +static int +symlink_find(struct archive_write_disk *a, const struct stat *st) +{ + for (struct symlink_entry *sc = a->symlink_list; sc; sc = sc->sc_next) + if (st->st_ino == sc->sc_ino && st->st_dev == sc->sc_dev) + return 1; + return 0; +} + +static void +symlink_free(struct archive_write_disk *a) +{ + for (struct symlink_entry *sc = a->symlink_list; sc; ) { + struct symlink_entry *next = sc->sc_next; + free(sc); + sc = next; + } + a->symlink_list = NULL; +} + +static int la_mktemp(struct archive_write_disk *a) { int oerrno, fd; @@ -2245,7 +2286,7 @@ create_filesystem_object(struct archive_ */ return (EPERM); } - r = check_symlinks_fsobj(linkname_copy, _number, + r = check_symlinks_fsobj(a, linkname_copy, _number, _string, a->flags); if (r != ARCHIVE_OK) { archive_set_error(>archive, error_number, "%s", @@ -2298,7 +2339,18 @@
CVS commit: src/external/bsd/libarchive/dist
Module Name:src Committed By: christos Date: Sun Jan 12 16:08:31 UTC 2020 Modified Files: src/external/bsd/libarchive/dist/libarchive: archive.h archive_private.h archive_util.c archive_write_disk_posix.c src/external/bsd/libarchive/dist/tar: bsdtar.c Log Message: Introduce ARCHIVE_EXTRACT_ATOMIC and set it by default on bsdtar. This flag changes the way that regular files are extracted: Instead of removing existing files first and re-creating them in order to replace their contents, a temporary file is created and when writing to the temporary file is completed, the file is rename(2)d to the final destination name. This has the effect of presenting a consistent view of the file to the system (either the file with the new contents or the file with the old contents). Removing and overwriting the file has the undesired side effect that the the system can either not see the file at all (from the time it is being removed till the time it is being re-created), or worse it can see partial file contents. This is problematic when extracting system files (for example shared libraries). Perhaps there should be a flag to disable it, when for example it is not desirable because of space constraints, but then again one can specify to unlink the file before. (this is pull request 1289) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/external/bsd/libarchive/dist/libarchive/archive.h cvs rdiff -u -r1.1.1.3 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/archive_private.h cvs rdiff -u -r1.1.1.4 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/archive_util.c cvs rdiff -u -r1.1.1.2 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c cvs rdiff -u -r1.1.1.4 -r1.2 src/external/bsd/libarchive/dist/tar/bsdtar.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/libarchive/dist
Module Name:src Committed By: christos Date: Sun Jan 12 16:08:31 UTC 2020 Modified Files: src/external/bsd/libarchive/dist/libarchive: archive.h archive_private.h archive_util.c archive_write_disk_posix.c src/external/bsd/libarchive/dist/tar: bsdtar.c Log Message: Introduce ARCHIVE_EXTRACT_ATOMIC and set it by default on bsdtar. This flag changes the way that regular files are extracted: Instead of removing existing files first and re-creating them in order to replace their contents, a temporary file is created and when writing to the temporary file is completed, the file is rename(2)d to the final destination name. This has the effect of presenting a consistent view of the file to the system (either the file with the new contents or the file with the old contents). Removing and overwriting the file has the undesired side effect that the the system can either not see the file at all (from the time it is being removed till the time it is being re-created), or worse it can see partial file contents. This is problematic when extracting system files (for example shared libraries). Perhaps there should be a flag to disable it, when for example it is not desirable because of space constraints, but then again one can specify to unlink the file before. (this is pull request 1289) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/external/bsd/libarchive/dist/libarchive/archive.h cvs rdiff -u -r1.1.1.3 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/archive_private.h cvs rdiff -u -r1.1.1.4 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/archive_util.c cvs rdiff -u -r1.1.1.2 -r1.2 \ src/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c cvs rdiff -u -r1.1.1.4 -r1.2 src/external/bsd/libarchive/dist/tar/bsdtar.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libarchive/dist/libarchive/archive.h diff -u src/external/bsd/libarchive/dist/libarchive/archive.h:1.4 src/external/bsd/libarchive/dist/libarchive/archive.h:1.5 --- src/external/bsd/libarchive/dist/libarchive/archive.h:1.4 Wed Jul 24 10:03:57 2019 +++ src/external/bsd/libarchive/dist/libarchive/archive.h Sun Jan 12 11:08:31 2020 @@ -693,6 +693,8 @@ __LA_DECL int archive_read_set_passphras #define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x1) /* Default: Do not clear no-change flags when unlinking object */ #define ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS (0x2) +/* Default: Do not extract atomically (using rename) */ +#define ARCHIVE_EXTRACT_ATOMIC (0x4) __LA_DECL int archive_read_extract(struct archive *, struct archive_entry *, int flags); Index: src/external/bsd/libarchive/dist/libarchive/archive_private.h diff -u src/external/bsd/libarchive/dist/libarchive/archive_private.h:1.1.1.3 src/external/bsd/libarchive/dist/libarchive/archive_private.h:1.2 --- src/external/bsd/libarchive/dist/libarchive/archive_private.h:1.1.1.3 Thu Apr 20 08:55:34 2017 +++ src/external/bsd/libarchive/dist/libarchive/archive_private.h Sun Jan 12 11:08:31 2020 @@ -153,6 +153,7 @@ void __archive_errx(int retvalue, const void __archive_ensure_cloexec_flag(int fd); int __archive_mktemp(const char *tmpdir); +int __archive_mktempx(const char *tmpdir, struct archive_string *template); int __archive_clean(struct archive *); Index: src/external/bsd/libarchive/dist/libarchive/archive_util.c diff -u src/external/bsd/libarchive/dist/libarchive/archive_util.c:1.1.1.4 src/external/bsd/libarchive/dist/libarchive/archive_util.c:1.2 --- src/external/bsd/libarchive/dist/libarchive/archive_util.c:1.1.1.4 Wed Jul 24 09:50:21 2019 +++ src/external/bsd/libarchive/dist/libarchive/archive_util.c Sun Jan 12 11:08:31 2020 @@ -389,28 +389,33 @@ get_tempdir(struct archive_string *tempp */ int -__archive_mktemp(const char *tmpdir) +__archive_mktempx(const char *tmpdir, struct archive_string *template) { struct archive_string temp_name; int fd = -1; - archive_string_init(_name); - if (tmpdir == NULL) { - if (get_tempdir(_name) != ARCHIVE_OK) - goto exit_tmpfile; - } else { - archive_strcpy(_name, tmpdir); - if (temp_name.s[temp_name.length-1] != '/') - archive_strappend_char(_name, '/'); + if (template == NULL) { + archive_string_init(template = _name); + if (tmpdir == NULL) { + if (get_tempdir(_name) != ARCHIVE_OK) +goto exit_tmpfile; + } else { + archive_strcpy(_name, tmpdir); + if (temp_name.s[temp_name.length-1] != '/') +archive_strappend_char(_name, '/'); + } + archive_strcat(_name, "libarchive_XX"); } - archive_strcat(_name, "libarchive_XX"); - fd = mkstemp(temp_name.s); + fd = mkstemp(template->s); if (fd < 0) goto exit_tmpfile; __archive_ensure_cloexec_flag(fd); - unlink(temp_name.s); + + if (template == _name) + unlink(temp_name.s); exit_tmpfile: - archive_string_free(_name); + if (template == _name) +
Re: CVS commit: src/sys/arch/arm/include/arm32
> On Jan 11, 2020, at 10:47 PM, Izumi Tsutsui wrote: > > thorpej@ wrote: > >>> PGSHIFT is defined in and >>> PAGE_SHIFT and PAGE_SIZE is in , >>> but there is no common . >> >> Make a common that all of the platforms can #include, and >> just put these common definitions in it (for now)? > > How about the attached diff? (untested, just for review) This looks good to me. -- thorpej
CVS commit: src/sys/arch/x68k/stand
Module Name:src Committed By: isaki Date: Sun Jan 12 13:51:12 UTC 2020 Modified Files: src/sys/arch/x68k/stand/boot_ufs: version src/sys/arch/x68k/stand/boot_ustar: version Log Message: Fix broken RCS NetBSD tag. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x68k/stand/boot_ufs/version cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x68k/stand/boot_ustar/version Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x68k/stand
Module Name:src Committed By: isaki Date: Sun Jan 12 13:51:12 UTC 2020 Modified Files: src/sys/arch/x68k/stand/boot_ufs: version src/sys/arch/x68k/stand/boot_ustar: version Log Message: Fix broken RCS NetBSD tag. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x68k/stand/boot_ufs/version cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x68k/stand/boot_ustar/version Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x68k/stand/boot_ufs/version diff -u src/sys/arch/x68k/stand/boot_ufs/version:1.2 src/sys/arch/x68k/stand/boot_ufs/version:1.3 --- src/sys/arch/x68k/stand/boot_ufs/version:1.2 Sun Mar 17 16:14:31 2002 +++ src/sys/arch/x68k/stand/boot_ufs/version Sun Jan 12 13:51:12 2020 @@ -1,4 +1,4 @@ -$ NetBSD $ +$NetBSD: version,v 1.3 2020/01/12 13:51:12 isaki Exp $ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important - make sure the entries are appended on end, last item Index: src/sys/arch/x68k/stand/boot_ustar/version diff -u src/sys/arch/x68k/stand/boot_ustar/version:1.1 src/sys/arch/x68k/stand/boot_ustar/version:1.2 --- src/sys/arch/x68k/stand/boot_ustar/version:1.1 Mon Oct 15 16:23:01 2001 +++ src/sys/arch/x68k/stand/boot_ustar/version Sun Jan 12 13:51:12 2020 @@ -1,4 +1,4 @@ -$ NetBSD $ +$NetBSD: version,v 1.2 2020/01/12 13:51:12 isaki Exp $ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important - make sure the entries are appended on end, last item
CVS commit: src/sys/sys
Module Name:src Committed By: ad Date: Sun Jan 12 13:37:26 UTC 2020 Modified Files: src/sys/sys: param.h Log Message: Redo previous using COHERENCY_UNIT. To generate a diff of this commit: cvs rdiff -u -r1.638 -r1.639 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.638 src/sys/sys/param.h:1.639 --- src/sys/sys/param.h:1.638 Sun Jan 12 13:19:32 2020 +++ src/sys/sys/param.h Sun Jan 12 13:37:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.638 2020/01/12 13:19:32 ad Exp $ */ +/* $NetBSD: param.h,v 1.639 2020/01/12 13:37:26 ad Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -527,13 +527,16 @@ extern size_t coherency_unit; #endif /* _KERNEL */ /* - * Minimum alignment of "struct lwp" needed by the architecture. - * This counts when packing a lock byte into a word alongside a - * pointer to an LWP. We need a minimum of 32, but go with 64 - * to match the cache line size. + * Minimum alignment of "struct lwp" needed by the architecture. This + * counts when packing a lock byte into a word alongside a pointer to an + * LWP. We need a minimum of 32, but go with the cache line size. */ #ifndef MIN_LWP_ALIGNMENT -#define MIN_LWP_ALIGNMENT 64 +# if COHERENCY_UNIT > 32 +# define MIN_LWP_ALIGNMENT COHERENCY_UNIT +# else +# define MIN_LWP_ALIGNMENT 32 +# endif #endif #endif /* !__ASSEMBLER__ */
Re: CVS commit: src/sys/sys
On Sun, Jan 12, 2020 at 01:30:57PM +, Nick Hudson wrote: > On 12/01/2020 13:19, Andrew Doran wrote: > > Module Name:src > > Committed By: ad > > Date: Sun Jan 12 13:19:32 UTC 2020 > > > > Modified Files: > > src/sys/sys: param.h > > > > Log Message: > > Bump MIN_LWP_ALIGNMENT to 64. > > Should aarch64/mips define MIN_LWP_ALIGNMENT as 128 as they have CPUs > that have this cache line size? Good point - fixed! Cheers, Andrew
CVS commit: src/sys/sys
Module Name:src Committed By: ad Date: Sun Jan 12 13:37:26 UTC 2020 Modified Files: src/sys/sys: param.h Log Message: Redo previous using COHERENCY_UNIT. To generate a diff of this commit: cvs rdiff -u -r1.638 -r1.639 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/sys
On 12/01/2020 13:19, Andrew Doran wrote: Module Name:src Committed By: ad Date: Sun Jan 12 13:19:32 UTC 2020 Modified Files: src/sys/sys: param.h Log Message: Bump MIN_LWP_ALIGNMENT to 64. Should aarch64/mips define MIN_LWP_ALIGNMENT as 128 as they have CPUs that have this cache line size? Thanks, Nick
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Jan 12 13:29:24 UTC 2020 Modified Files: src/sys/kern: subr_cpu.c src/sys/sys: cpu_data.h Log Message: cpu topology: - Fix a stupid bug where it complained about non-existent SMT on assymetric systems. - Give each CPU a pointer back to the first CPU in same package. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_cpu.c cvs rdiff -u -r1.47 -r1.48 src/sys/sys/cpu_data.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_cpu.c diff -u src/sys/kern/subr_cpu.c:1.7 src/sys/kern/subr_cpu.c:1.8 --- src/sys/kern/subr_cpu.c:1.7 Sun Jan 12 09:29:18 2020 +++ src/sys/kern/subr_cpu.c Sun Jan 12 13:29:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_cpu.c,v 1.7 2020/01/12 09:29:18 mrg Exp $ */ +/* $NetBSD: subr_cpu.c,v 1.8 2020/01/12 13:29:24 ad Exp $ */ /*- * Copyright (c) 2007, 2008, 2009, 2010, 2012, 2019, 2020 @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.7 2020/01/12 09:29:18 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.8 2020/01/12 13:29:24 ad Exp $"); #include #include @@ -207,6 +207,8 @@ cpu_topology_dump(void) } printf("\n"); } + printf("%s first in package: %s\n", cpu_name(ci), + cpu_name(ci->ci_package1st)); } #endif /* DEBUG */ } @@ -229,6 +231,7 @@ cpu_topology_fake1(struct cpu_info *ci) } ci->ci_schedstate.spc_flags |= (SPCF_CORE1ST | SPCF_PACKAGE1ST | SPCF_1STCLASS); + ci->ci_package1st = ci; } /* @@ -338,8 +341,9 @@ cpu_topology_init(void) ci3->ci_schedstate.spc_flags |= SPCF_PACKAGE1ST; /* Walk through all CPUs in package and point to first. */ - ci2 = ci; + ci2 = ci3; do { + ci2->ci_package1st = ci3; ci2->ci_sibling[CPUREL_PACKAGE1ST] = ci3; ci2 = ci2->ci_sibling[CPUREL_PACKAGE]; } while (ci2 != ci); @@ -376,7 +380,7 @@ cpu_topology_init(void) * others, mark first class CPUs for the scheduler. This * conflicts with SMT right now so whinge if observed. */ - if (curcpu()->ci_nsibling[CPUREL_CORE] == 1) { + if (curcpu()->ci_nsibling[CPUREL_CORE] > 1) { printf("cpu_topology_init: asymmetric & SMT??\n"); } for (CPU_INFO_FOREACH(cii, ci)) { Index: src/sys/sys/cpu_data.h diff -u src/sys/sys/cpu_data.h:1.47 src/sys/sys/cpu_data.h:1.48 --- src/sys/sys/cpu_data.h:1.47 Thu Jan 9 16:35:03 2020 +++ src/sys/sys/cpu_data.h Sun Jan 12 13:29:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_data.h,v 1.47 2020/01/09 16:35:03 ad Exp $ */ +/* $NetBSD: cpu_data.h,v 1.48 2020/01/12 13:29:24 ad Exp $ */ /*- * Copyright (c) 2004, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc. @@ -151,6 +151,7 @@ struct cpu_data { bool cpu_is_slow; u_int cpu_nsibling[CPUREL_COUNT]; struct cpu_info *cpu_sibling[CPUREL_COUNT]; + struct cpu_info *cpu_package1st; /* 1st CPU in our package */ /* * This section is mostly CPU-private. @@ -203,6 +204,7 @@ struct cpu_data { #define ci_is_slow ci_data.cpu_is_slow #define ci_nsibling ci_data.cpu_nsibling #define ci_sibling ci_data.cpu_sibling +#define ci_package1st ci_data.cpu_package1st #define ci_faultrng ci_data.cpu_faultrng #define ci_counts ci_data.cpu_counts
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Jan 12 13:29:24 UTC 2020 Modified Files: src/sys/kern: subr_cpu.c src/sys/sys: cpu_data.h Log Message: cpu topology: - Fix a stupid bug where it complained about non-existent SMT on assymetric systems. - Give each CPU a pointer back to the first CPU in same package. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_cpu.c cvs rdiff -u -r1.47 -r1.48 src/sys/sys/cpu_data.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/sys
Module Name:src Committed By: ad Date: Sun Jan 12 13:19:32 UTC 2020 Modified Files: src/sys/sys: param.h Log Message: Bump MIN_LWP_ALIGNMENT to 64. To generate a diff of this commit: cvs rdiff -u -r1.637 -r1.638 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.637 src/sys/sys/param.h:1.638 --- src/sys/sys/param.h:1.637 Fri Jan 10 09:47:19 2020 +++ src/sys/sys/param.h Sun Jan 12 13:19:32 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.637 2020/01/10 09:47:19 ad Exp $ */ +/* $NetBSD: param.h,v 1.638 2020/01/12 13:19:32 ad Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -196,6 +196,7 @@ #define dbtob(x) ((x) << DEV_BSHIFT) #define btodb(x) ((x) >> DEV_BSHIFT) +/* Coherency unit: assumed cache line size. See also MIN_LWP_ALIGNMENT. */ #ifndef COHERENCY_UNIT #define COHERENCY_UNIT 64 #endif @@ -528,10 +529,11 @@ extern size_t coherency_unit; /* * Minimum alignment of "struct lwp" needed by the architecture. * This counts when packing a lock byte into a word alongside a - * pointer to an LWP. + * pointer to an LWP. We need a minimum of 32, but go with 64 + * to match the cache line size. */ #ifndef MIN_LWP_ALIGNMENT -#define MIN_LWP_ALIGNMENT 32 +#define MIN_LWP_ALIGNMENT 64 #endif #endif /* !__ASSEMBLER__ */
CVS commit: src/sys/sys
Module Name:src Committed By: ad Date: Sun Jan 12 13:19:32 UTC 2020 Modified Files: src/sys/sys: param.h Log Message: Bump MIN_LWP_ALIGNMENT to 64. To generate a diff of this commit: cvs rdiff -u -r1.637 -r1.638 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/emips/emips
Module Name:src Committed By: tsutsui Date: Sun Jan 12 13:15:10 UTC 2020 Modified Files: src/sys/arch/emips/emips: locore_machdep.S machdep.c Log Message: KNF and misc whitespace cleanup. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/emips/emips/locore_machdep.S cvs rdiff -u -r1.15 -r1.16 src/sys/arch/emips/emips/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Jan 12 13:15:08 UTC 2020 Modified Files: src/sys/kern: kern_lwp.c Log Message: Remove some unneeded kernel_lock handling. To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/sys/kern/kern_lwp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Jan 12 13:15:08 UTC 2020 Modified Files: src/sys/kern: kern_lwp.c Log Message: Remove some unneeded kernel_lock handling. To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/sys/kern/kern_lwp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_lwp.c diff -u src/sys/kern/kern_lwp.c:1.218 src/sys/kern/kern_lwp.c:1.219 --- src/sys/kern/kern_lwp.c:1.218 Wed Jan 8 17:38:42 2020 +++ src/sys/kern/kern_lwp.c Sun Jan 12 13:15:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_lwp.c,v 1.218 2020/01/08 17:38:42 ad Exp $ */ +/* $NetBSD: kern_lwp.c,v 1.219 2020/01/12 13:15:08 ad Exp $ */ /*- * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc. @@ -209,7 +209,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.218 2020/01/08 17:38:42 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.219 2020/01/12 13:15:08 ad Exp $"); #include "opt_ddb.h" #include "opt_lockdebug.h" @@ -1266,14 +1266,8 @@ lwp_free(struct lwp *l, bool recycle, bo * the target CPU. */ membar_enter(); - if ((l->l_flag & LW_RUNNING) != 0) { - int count; - (void)count; /* XXXgcc */ - KERNEL_UNLOCK_ALL(curlwp, ); - while ((l->l_flag & LW_RUNNING) != 0 || - l->l_cpu->ci_curlwp == l) - SPINLOCK_BACKOFF_HOOK; - KERNEL_LOCK(count, curlwp); + while (__predict_false((l->l_flag & LW_RUNNING) != 0)) { + SPINLOCK_BACKOFF_HOOK; } #endif
CVS commit: src/sys/arch/emips/emips
Module Name:src Committed By: tsutsui Date: Sun Jan 12 13:15:10 UTC 2020 Modified Files: src/sys/arch/emips/emips: locore_machdep.S machdep.c Log Message: KNF and misc whitespace cleanup. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/emips/emips/locore_machdep.S cvs rdiff -u -r1.15 -r1.16 src/sys/arch/emips/emips/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/emips/emips/locore_machdep.S diff -u src/sys/arch/emips/emips/locore_machdep.S:1.1 src/sys/arch/emips/emips/locore_machdep.S:1.2 --- src/sys/arch/emips/emips/locore_machdep.S:1.1 Wed Jan 26 01:18:50 2011 +++ src/sys/arch/emips/emips/locore_machdep.S Sun Jan 12 13:15:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_machdep.S,v 1.1 2011/01/26 01:18:50 pooka Exp $ */ +/* $NetBSD: locore_machdep.S,v 1.2 2020/01/12 13:15:10 tsutsui Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -47,52 +47,72 @@ /* * Extension control register bits, definitions and semantics */ -/* The Opcode field holds the opcode assigned to the given Extension slot (Z). - * When this field is written to, the CAM used for decoding the Extension Instructions is updated - * (in CAM Decoding mode). The value can be one of the eight Extension Opcodes, or any other opcode - * iff the Extension has priority and is meant to mask an existing instruction. +/* + * The Opcode field holds the opcode assigned to the given Extension slot (Z). + * When this field is written to, the CAM used for decoding the Extension + * Instructions is updated (in CAM Decoding mode). The value can be one + * of the eight Extension Opcodes, or any other opcode iff the Extension + * has priority and is meant to mask an existing instruction. */ #define EXTCTL_OP 0xfc00 -/* The Kernel/User flag denotes that Extension Z is a Kernel[0] or User[1] mode Extension. +/* + * The Kernel/User flag denotes that Extension Z is a Kernel[0] or User[1] + * mode Extension. */ #define EXTCTL_KU 0x0200 -/* The Scope flag denotes that Extension Z is a Local[0] (per process) or Global[1] (shared) Extension. +/* + * The Scope flag denotes that Extension Z is a Local[0] (per process) or + * Global[1] (shared) Extension. */ #define EXTCTL_SC 0x0100 -/* The Peripheral flag denotes that Extension Z is a Peripheral Extension. +/* + * The Peripheral flag denotes that Extension Z is a Peripheral Extension. */ #define EXTCTL_PER 0x0008 -/* The Interrupt flag denotes that Extension Z has an interrupt. +/* + * The Interrupt flag denotes that Extension Z has an interrupt. */ #define EXTCTL_INT 0x0004 -/* The Virtual/Physical flag denotes that Extension Z uses Virtual[0] or Physical[0] addresses - * when accessing the memory bus. +/* + * The Virtual/Physical flag denotes that Extension Z uses Virtual[0] or + * Physical[0] addresses when accessing the memory bus. */ #define EXTCTL_VP 0x0002 -/* The State field denotes the state of Extension Z. (Loaded, Config, Running, Suspend, etc) +/* + * The State field denotes the state of Extension Z. (Loaded, Config, + * Running, Suspend, etc) */ #define EXTCTL_ST 0xf000 -/* The Priority field denotes the execution priority for Extension Z during arbitration. +/* + * The Priority field denotes the execution priority for Extension Z + * during arbitration. */ #define EXTCTL_PR 0x0f00 -/* The Privileged flag denotes that Extension Z has access to security sensitive system resources. +/* + * The Privileged flag denotes that Extension Z has access to security + * sensitive system resources. */ #define EXTCTL_PRV 0x0080 -/* The Trap flag denotes whether an RI exception will be generated for an Extension Z's instruction - * if Extension Z is disabled. +/* + * The Trap flag denotes whether an RI exception will be generated for + * an Extension Z's instruction if Extension Z is disabled. */ #define EXTCTL_TR 0x0010 -/* The Trapped flag denotes that a trap occurred during Extension Z's last execution and it was unable - * to complete. +/* + * The Trapped flag denotes that a trap occurred during Extension Z's + * last execution and it was unable to complete. */ #define EXTCTL_TD 0x0008 -/* The Clock Enable flag denotes that the clock for Extension Z is active. +/* + * The Clock Enable flag denotes that the clock for Extension Z is active. */ #define EXTCTL_CE 0x0004 -/* The Enable flag denotes that Extension Z is enabled for execution. +/* + * The Enable flag denotes that Extension Z is enabled for execution. */ #define EXTCTL_EN 0x0002 -/* The Loaded flag denotes that Extension Z has been loaded +/* + * The Loaded flag denotes that Extension Z has been loaded */ #define EXTCTL_LD 0x0001 @@ -103,61 +123,62 @@ * nb: clears the counter too */
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Jan 12 13:08:32 UTC 2020 Modified Files: src/sys/kern: kern_sleepq.c Log Message: Nothing uses l->l_sleeperr any more. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_sleepq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_sleepq.c diff -u src/sys/kern/kern_sleepq.c:1.57 src/sys/kern/kern_sleepq.c:1.58 --- src/sys/kern/kern_sleepq.c:1.57 Wed Jan 8 17:38:42 2020 +++ src/sys/kern/kern_sleepq.c Sun Jan 12 13:08:32 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sleepq.c,v 1.57 2020/01/08 17:38:42 ad Exp $ */ +/* $NetBSD: kern_sleepq.c,v 1.58 2020/01/12 13:08:32 ad Exp $ */ /*- * Copyright (c) 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.57 2020/01/08 17:38:42 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.58 2020/01/12 13:08:32 ad Exp $"); #include #include @@ -215,7 +215,6 @@ sleepq_enqueue(sleepq_t *sq, wchan_t wch l->l_wmesg = wmesg; l->l_slptime = 0; l->l_stat = LSSLEEP; - l->l_sleeperr = 0; sleepq_insert(sq, l, sobj);
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Jan 12 13:08:32 UTC 2020 Modified Files: src/sys/kern: kern_sleepq.c Log Message: Nothing uses l->l_sleeperr any more. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_sleepq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86
Module Name:src Committed By: ad Date: Sun Jan 12 13:01:12 UTC 2020 Modified Files: src/sys/arch/x86/include: pmap.h pmap_pv.h src/sys/arch/x86/x86: pmap.c vm_machdep.c x86_tlb.c Log Message: x86 pmap: - It turns out that every page the pmap frees is necessarily zeroed. Tell the VM system about this and use the pmap as a source of pre-zeroed pages. - Redo deferred freeing of PTPs more elegantly, including the integration with pmap_remove_all(). This fixes problems with nvmm, and possibly also a crash discovered during fuzzing. Reported-by: syzbot+a97186518c84f1d85...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/arch/x86/include/pmap.h cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/include/pmap_pv.h cvs rdiff -u -r1.354 -r1.355 src/sys/arch/x86/x86/pmap.c cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x86/x86/vm_machdep.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/x86/x86_tlb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/include/pmap.h diff -u src/sys/arch/x86/include/pmap.h:1.108 src/sys/arch/x86/include/pmap.h:1.109 --- src/sys/arch/x86/include/pmap.h:1.108 Sat Jan 4 22:49:20 2020 +++ src/sys/arch/x86/include/pmap.h Sun Jan 12 13:01:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.108 2020/01/04 22:49:20 ad Exp $ */ +/* $NetBSD: pmap.h,v 1.109 2020/01/12 13:01:11 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -262,7 +262,7 @@ struct pmap { #if !defined(__x86_64__) vaddr_t pm_hiexec; /* highest executable mapping */ #endif /* !defined(__x86_64__) */ - int pm_flags; /* see below */ + struct lwp *pm_remove_all; /* who's emptying the pmap */ union descriptor *pm_ldt; /* user-set LDT */ size_t pm_ldt_len; /* size of LDT in bytes */ @@ -273,7 +273,7 @@ struct pmap { kcpuset_t *pm_xen_ptp_cpus; /* mask of CPUs which have this pmap's ptp mapped */ uint64_t pm_ncsw; /* for assertions */ - struct vm_page *pm_gc_ptp; /* pages from pmap g/c */ + LIST_HEAD(,vm_page) pm_gc_ptp; /* PTPs queued for free */ /* Used by NVMM. */ int (*pm_enter)(struct pmap *, vaddr_t, paddr_t, vm_prot_t, u_int); @@ -580,7 +580,6 @@ void pmap_kenter_ma(vaddr_t, paddr_t, vm int pmap_enter_ma(struct pmap *, vaddr_t, paddr_t, paddr_t, vm_prot_t, u_int, int); bool pmap_extract_ma(pmap_t, vaddr_t, paddr_t *); -void pmap_free_ptps(struct vm_page *); paddr_t pmap_get_physpage(void); Index: src/sys/arch/x86/include/pmap_pv.h diff -u src/sys/arch/x86/include/pmap_pv.h:1.9 src/sys/arch/x86/include/pmap_pv.h:1.10 --- src/sys/arch/x86/include/pmap_pv.h:1.9 Sat Jan 4 22:49:20 2020 +++ src/sys/arch/x86/include/pmap_pv.h Sun Jan 12 13:01:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_pv.h,v 1.9 2020/01/04 22:49:20 ad Exp $ */ +/* $NetBSD: pmap_pv.h,v 1.10 2020/01/12 13:01:11 ad Exp $ */ /*- * Copyright (c)2008 YAMAMOTO Takashi, @@ -69,7 +69,7 @@ struct pmap_page { struct pv_pte u_pte; /* PTPs */ - struct vm_page *u_link; + LIST_ENTRY(vm_page) u_link; } pp_u; LIST_HEAD(, pv_entry) pp_pvlist; #define pp_pte pp_u.u_pte @@ -83,6 +83,7 @@ struct pmap_page { /* pp_flags */ #define PP_EMBEDDED 1 +#define PP_FREEING 2 #define PMAP_PAGE_INIT(pp) LIST_INIT(&(pp)->pp_pvlist) Index: src/sys/arch/x86/x86/pmap.c diff -u src/sys/arch/x86/x86/pmap.c:1.354 src/sys/arch/x86/x86/pmap.c:1.355 --- src/sys/arch/x86/x86/pmap.c:1.354 Tue Jan 7 21:18:24 2020 +++ src/sys/arch/x86/x86/pmap.c Sun Jan 12 13:01:11 2020 @@ -1,7 +1,7 @@ -/* $NetBSD: pmap.c,v 1.354 2020/01/07 21:18:24 ad Exp $ */ +/* $NetBSD: pmap.c,v 1.355 2020/01/12 13:01:11 ad Exp $ */ /* - * Copyright (c) 2008, 2010, 2016, 2017, 2019 The NetBSD Foundation, Inc. + * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -130,7 +130,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.354 2020/01/07 21:18:24 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.355 2020/01/12 13:01:11 ad Exp $"); #include "opt_user_ldt.h" #include "opt_lockdebug.h" @@ -419,9 +419,9 @@ static void pmap_unget_ptp(struct pmap * static void pmap_install_ptp(struct pmap *, struct pmap_ptparray *, vaddr_t, pd_entry_t * const *); static struct vm_page *pmap_find_ptp(struct pmap *, vaddr_t, paddr_t, int); -static void pmap_freepages(struct pmap *, struct vm_page *); +static void pmap_freepage(struct pmap *, struct vm_page *, int); static void pmap_free_ptp(struct pmap *, struct vm_page *, vaddr_t, -pt_entry_t *, pd_entry_t * const *, struct vm_page **); +pt_entry_t *, pd_entry_t * const *); static bool pmap_remove_pte(struct pmap *, struct vm_page *, pt_entry_t *, vaddr_t, struct pv_entry **); static void pmap_remove_ptes(struct pmap *, struct vm_page *, vaddr_t,
CVS commit: src/sys/arch/x86
Module Name:src Committed By: ad Date: Sun Jan 12 13:01:12 UTC 2020 Modified Files: src/sys/arch/x86/include: pmap.h pmap_pv.h src/sys/arch/x86/x86: pmap.c vm_machdep.c x86_tlb.c Log Message: x86 pmap: - It turns out that every page the pmap frees is necessarily zeroed. Tell the VM system about this and use the pmap as a source of pre-zeroed pages. - Redo deferred freeing of PTPs more elegantly, including the integration with pmap_remove_all(). This fixes problems with nvmm, and possibly also a crash discovered during fuzzing. Reported-by: syzbot+a97186518c84f1d85...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/arch/x86/include/pmap.h cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/include/pmap_pv.h cvs rdiff -u -r1.354 -r1.355 src/sys/arch/x86/x86/pmap.c cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x86/x86/vm_machdep.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/x86/x86_tlb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Jan 12 12:55:03 UTC 2020 Modified Files: src/sys/uvm: uvm_glue.c Log Message: l->l_emap_gen isn't used any more. To generate a diff of this commit: cvs rdiff -u -r1.175 -r1.176 src/sys/uvm/uvm_glue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/uvm/uvm_glue.c diff -u src/sys/uvm/uvm_glue.c:1.175 src/sys/uvm/uvm_glue.c:1.176 --- src/sys/uvm/uvm_glue.c:1.175 Tue Dec 31 22:42:51 2019 +++ src/sys/uvm/uvm_glue.c Sun Jan 12 12:55:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_glue.c,v 1.175 2019/12/31 22:42:51 ad Exp $ */ +/* $NetBSD: uvm_glue.c,v 1.176 2020/01/12 12:55:03 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.175 2019/12/31 22:42:51 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.176 2020/01/12 12:55:03 ad Exp $"); #include "opt_kgdb.h" #include "opt_kstack.h" @@ -224,9 +224,6 @@ uvm_lwp_fork(struct lwp *l1, struct lwp * the specified entry point will be executed. */ cpu_lwp_fork(l1, l2, stack, stacksize, func, arg); - - /* Inactive emap for new LWP. */ - l2->l_emap_gen = UVM_EMAP_INACTIVE; } #ifndef USPACE_ALIGN
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Jan 12 12:55:03 UTC 2020 Modified Files: src/sys/uvm: uvm_glue.c Log Message: l->l_emap_gen isn't used any more. To generate a diff of this commit: cvs rdiff -u -r1.175 -r1.176 src/sys/uvm/uvm_glue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: mrg Date: Sun Jan 12 09:29:18 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: cpu.c cpufunc.c locore.S src/sys/arch/aarch64/include: cpu.h cpufunc.h src/sys/arch/arm/fdt: cpu_fdt.c src/sys/kern: subr_cpu.c Log Message: provide some semblance of valid cpu topology for big.little systems. while attaching cpus, if the FDT provides "capacity-dmips-mhz" track the fastest set, and call cpu_topology_set() with slow=true for any cpus that are not the fastest. bug fix for cpu_topology_set(): actually set ci_is_slow for slow cpus. with this change, and -current's recent scheduler changes, this means that long running processes run on the faster cores. on RK3399 based systems, i am seeing 20-50% speed ups for many tasks. XXX: all this can be made common with armv7 big.little. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/aarch64/aarch64/cpu.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/aarch64/cpufunc.c cvs rdiff -u -r1.50 -r1.51 src/sys/arch/aarch64/aarch64/locore.S cvs rdiff -u -r1.17 -r1.18 src/sys/arch/aarch64/include/cpu.h cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/include/cpufunc.h cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/fdt/cpu_fdt.c cvs rdiff -u -r1.6 -r1.7 src/sys/kern/subr_cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/cpu.c diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.32 src/sys/arch/aarch64/aarch64/cpu.c:1.33 --- src/sys/arch/aarch64/aarch64/cpu.c:1.32 Thu Jan 9 16:23:41 2020 +++ src/sys/arch/aarch64/aarch64/cpu.c Sun Jan 12 09:29:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.32 2020/01/09 16:23:41 martin Exp $ */ +/* $NetBSD: cpu.c,v 1.33 2020/01/12 09:29:18 mrg Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.32 2020/01/09 16:23:41 martin Exp $"); +__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.33 2020/01/12 09:29:18 mrg Exp $"); #include "locators.h" #include "opt_arm_debug.h" @@ -65,6 +65,7 @@ static void cpu_identify1(device_t self, static void cpu_identify2(device_t self, struct cpu_info *); static void cpu_setup_id(struct cpu_info *); static void cpu_setup_sysctl(device_t, struct cpu_info *); +static void cpu_do_topology(struct cpu_info *); #ifdef MULTIPROCESSOR uint64_t cpu_mpidr[MAXCPUS]; @@ -144,9 +145,9 @@ cpu_attach(device_t dv, cpuid_t id) ci->ci_dev = dv; dv->dv_private = ci; - aarch64_gettopology(ci, ci->ci_id.ac_mpidr); - + cpu_do_topology(ci); cpu_identify(ci->ci_dev, ci); + #ifdef MULTIPROCESSOR if (unit != 0) { mi_cpu_attach(ci); @@ -308,8 +309,8 @@ cpu_identify2(device_t self, struct cpu_ dfr0 = reg_id_aa64dfr0_el1_read(); - aprint_debug_dev(self, "midr=0x%" PRIx32 "\n", - (uint32_t)ci->ci_id.ac_midr); + aprint_debug_dev(self, "midr=0x%" PRIx32 " mpidr=0x%" PRIx32 "\n", + (uint32_t)ci->ci_id.ac_midr, (uint32_t)ci->ci_id.ac_mpidr); aprint_normal_dev(self, "revID=0x%" PRIx64, id->ac_revidr); /* ID_AA64DFR0_EL1 */ @@ -497,6 +498,43 @@ cpu_setup_sysctl(device_t dv, struct cpu CTL_CREATE, CTL_EOL); } +static void +cpu_do_topology(struct cpu_info *newci) +{ + struct cpu_info *ci; + CPU_INFO_ITERATOR cii; + prop_dictionary_t dict; + uint32_t capacity_dmips_mhz; + static uint32_t best_cap = 0; + + dict = device_properties(newci->ci_dev); + if (prop_dictionary_get_uint32(dict, "capacity_dmips_mhz", + _dmips_mhz)) { + newci->ci_capacity_dmips_mhz = capacity_dmips_mhz; + } else { + newci->ci_capacity_dmips_mhz = 0; + } + + if (newci->ci_capacity_dmips_mhz > best_cap) + best_cap = newci->ci_capacity_dmips_mhz; + + /* + * CPU_INFO_FOREACH() doesn't work for this CPU until mi_cpu_attach() + * is called and ncpu is bumped, so call it directly here. + */ + aarch64_set_topology(newci, newci->ci_id.ac_mpidr, + newci->ci_capacity_dmips_mhz < best_cap); + + /* + * Using saved largest capacity, refresh previous topology info. + * It's supposed to be OK to re-set topology. + */ + for (CPU_INFO_FOREACH(cii, ci)) { + aarch64_set_topology(ci, ci->ci_id.ac_mpidr, + ci->ci_capacity_dmips_mhz < best_cap); + } +} + #ifdef MULTIPROCESSOR void cpu_boot_secondary_processors(void) Index: src/sys/arch/aarch64/aarch64/cpufunc.c diff -u src/sys/arch/aarch64/aarch64/cpufunc.c:1.13 src/sys/arch/aarch64/aarch64/cpufunc.c:1.14 --- src/sys/arch/aarch64/aarch64/cpufunc.c:1.13 Thu Jan 9 16:35:03 2020 +++ src/sys/arch/aarch64/aarch64/cpufunc.c Sun Jan 12 09:29:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.c,v 1.13 2020/01/09 16:35:03 ad Exp $ */ +/* $NetBSD: cpufunc.c,v 1.14 2020/01/12 09:29:18 mrg Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -29,7 +29,7 @@ #include "opt_multiprocessor.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.13 2020/01/09 16:35:03 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD:
CVS commit: src/sys
Module Name:src Committed By: mrg Date: Sun Jan 12 09:29:18 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: cpu.c cpufunc.c locore.S src/sys/arch/aarch64/include: cpu.h cpufunc.h src/sys/arch/arm/fdt: cpu_fdt.c src/sys/kern: subr_cpu.c Log Message: provide some semblance of valid cpu topology for big.little systems. while attaching cpus, if the FDT provides "capacity-dmips-mhz" track the fastest set, and call cpu_topology_set() with slow=true for any cpus that are not the fastest. bug fix for cpu_topology_set(): actually set ci_is_slow for slow cpus. with this change, and -current's recent scheduler changes, this means that long running processes run on the faster cores. on RK3399 based systems, i am seeing 20-50% speed ups for many tasks. XXX: all this can be made common with armv7 big.little. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/aarch64/aarch64/cpu.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/aarch64/cpufunc.c cvs rdiff -u -r1.50 -r1.51 src/sys/arch/aarch64/aarch64/locore.S cvs rdiff -u -r1.17 -r1.18 src/sys/arch/aarch64/include/cpu.h cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/include/cpufunc.h cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/fdt/cpu_fdt.c cvs rdiff -u -r1.6 -r1.7 src/sys/kern/subr_cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.